diff --git a/item/bottles.lua b/item/bottles.lua index 916cceb75..3c42302d8 100644 --- a/item/bottles.lua +++ b/item/bottles.lua @@ -15,52 +15,28 @@ You should have received a copy of the GNU Affero General Public License along with this program. If not, see . ]] --- UPDATE items SET itm_script='item.bottles' WHERE itm_id IN (2500, 2496, 2497, 2501, 2499); - local common = require("base.common") local lookat = require("base.lookat") local M = {} --- nameDE, nameEN, leftover item, { {empty target container, filled target container}, ...} -local drinkList = {} -drinkList[2500] = { "Weinflasche", "bottle of wine", 2498, - {{1858, 1860}, {224, 1857}, {2055, 2057}, {1840, 1842}, {2185, 2187}} } -- Kelch, Goldkelch, Glas, Kupferkelch, Holzbecher - -drinkList[2496] = { "Wasserflasche", "bottle of water", 2498, - { {1858, 1855}, {224, 1854}, {2055, 2058},{1840, 1841}, {2185, 2186} } } - -drinkList[2497] = { "Metflasche", "bottle of mead", 2498, - { {1858, 1853}, {224, 1856}, {2055, 2056},{1840, 1843}, {2185, 2188} } } - -drinkList[2501] = { "Bierflasche", "bottle of dark beer", 2498, - { {1908, 1909} } } -- Krug - -drinkList[2499] = { "Ciderflasche", "bottle of cider", 2498, - { {1858, 1859}, {224, 1861},{2055, 2059},{1840, 1844}, {2185, 2189} } } - -local BottleQualDe = {"Randvolle ", "Volle ", "Halbvolle ", "Fast leere "} -local BottleQualEn = {"Brimfull ", "Full ", "Half full ", "Almost empty "} -local BottleQualLm = {8, 6, 3, 1} - - -local function evilrockEntrance(user, sourceItem, actionstate) +local function evilrockEntrance(user, sourceItem, actionState) local evilrockBucket = common.GetItemInArea(user.pos, Item.bucket, 1, false, {key = "evilrockBucket", value = "true"}) - if evilrockBucket == nil or sourceItem.id ~= 2496 then + if evilrockBucket == nil or sourceItem.id ~= Item.bottleOfWater then return false end common.TurnTo(user, evilrockBucket.pos) -- turn if necessary - if ( actionstate == Action.none ) then + if ( actionState == Action.none ) then user:startAction( 20, 21, 5, 10, 25) user:talk(Character.say, "#me beginnt den Eimer zu befüllen.", "#me starts to fill the bucket.") return true end - if ( actionstate == Action.abort ) then + if ( actionState == Action.abort ) then common.InformNLS(user, "Du brichst deine Arbeit ab.", "You abort your work.") return true end @@ -69,10 +45,10 @@ local function evilrockEntrance(user, sourceItem, actionstate) sourceItem.id = Item.largeEmptyBottle world:changeItem(sourceItem) - for xx = 992, 996 do - local EntranceTrap = world:getItemOnField(position(xx,195,0)) - if EntranceTrap.id == 3097 then - world:erase(EntranceTrap,EntranceTrap.number) + for x = 992, 996 do + local entranceTrap = world:getItemOnField(position(x,195,0)) + if entranceTrap.id == 3097 then + world:erase(entranceTrap,entranceTrap.number) world:makeSound(4,user.pos) world:makeSound(5,user.pos) end @@ -82,98 +58,883 @@ local function evilrockEntrance(user, sourceItem, actionstate) end -function M.UseItem(User, SourceItem, ltstate) +local bottles = { + { + full = { + Item.bottleOfWater, Item.clayServingJugWithWater, Item.ceramicServingJugWithWater, + Item.ironServingJugWithWater, Item.copperServingJugWithWater, Item.silverServingJugWithWater, + Item.goldServingJugWithWater, Item.glassServingJugWithWater}, + half = { + Item.bottleOfWaterHalf,Item.glassServingJugWithWaterHalf}, + quarter = {Item.bottleOfWaterQuarter, Item.glassServingJugWithWaterQuarter}, + empty = { + Item.largeEmptyBottle, Item.clayServingJug, Item.ceramicServingJug, + Item.ironServingJug, Item.copperServingJug, Item.silverServingJug, + Item.goldServingJug, Item.glassServingJug}, + vessels = { + {empty = Item.clayCup, filled = Item.clayCupWithWater, amount = 1}, + {empty = Item.ceramicCup, filled = Item.ceramicCupWithWater, amount = 1}, + {empty = Item.woodenCup, filled = Item.cupWithWater, amount = 1}, + {empty = Item.ironGoblet, filled = Item.ironGobletWithWater, amount = 1}, + {empty = Item.copperGoblet, filled = Item.copperGobletWithWater, amount = 1}, + {empty = Item.silverGoblet, filled = Item.silverGobletWithWater, amount = 1}, + {empty = Item.goldenGoblet, filled = Item.goldenGobletWithWater, amount = 1}, + {empty = Item.glass, filled = Item.glassWithWater, amount = 1}, + {empty = Item.clayServingJug, filled = Item.clayServingJugWithWater, amount = 1, max = 8}, + {empty = Item.ceramicServingJug, filled = Item.ceramicServingJugWithWater, amount = 1, max = 8}, + {empty = Item.ironServingJug, filled = Item.ironServingJugWithWater, amount = 1, max = 8}, + {empty = Item.copperServingJug, filled = Item.copperServingJugWithWater, amount = 1, max = 8}, + {empty = Item.silverServingJug, filled = Item.silverServingJugWithWater, amount = 1, max = 8}, + {empty = Item.goldServingJug, filled = Item.goldServingJugWithWater, amount = 1, max = 8}, + {empty = Item.glassServingJug, filled = Item.glassServingJugWithWater, amount = 6, max = 8}, + {empty = Item.glassServingJug, filled = Item.glassServingJugWithWaterHalf, amount = 3, max = 5}, + {empty = Item.glassServingJug, filled = Item.glassServingJugWithWaterQuarter, amount = 1, max = 2}}, + type = "jug"}, + + { + full = { + Item.bottleOfWine, Item.clayServingJugWithWine, Item.ceramicServingJugWithWine, + Item.ironServingJugWithWine, Item.copperServingJugWithWine, Item.silverServingJugWithWine, + Item.goldServingJugWithWine, Item.glassServingJugWithWine}, + half = { + Item.bottleOfWineHalf,Item.glassServingJugWithWineHalf}, + quarter = {Item.bottleOfWineQuarter, Item.glassServingJugWithWineQuarter}, + empty = { + Item.largeEmptyBottle, Item.clayServingJug, Item.ceramicServingJug, + Item.ironServingJug, Item.copperServingJug, Item.silverServingJug, + Item.goldServingJug, Item.glassServingJug}, + vessels = { + {empty = Item.clayCup, filled = Item.clayCupWithWine, amount = 1}, + {empty = Item.ceramicCup, filled = Item.ceramicCupWithWine, amount = 1}, + {empty = Item.woodenCup, filled = Item.cupWithWine, amount = 1}, + {empty = Item.ironGoblet, filled = Item.ironGobletWithWine, amount = 1}, + {empty = Item.copperGoblet, filled = Item.copperGobletWithWine, amount = 1}, + {empty = Item.silverGoblet, filled = Item.silverGobletWithWine, amount = 1}, + {empty = Item.goldenGoblet, filled = Item.goldenGobletWithWine, amount = 1}, + {empty = Item.glass, filled = Item.glassWithWine, amount = 1}, + {empty = Item.clayServingJug, filled = Item.clayServingJugWithWine, amount = 1, max = 8}, + {empty = Item.ceramicServingJug, filled = Item.ceramicServingJugWithWine, amount = 1, max = 8}, + {empty = Item.ironServingJug, filled = Item.ironServingJugWithWine, amount = 1, max = 8}, + {empty = Item.copperServingJug, filled = Item.copperServingJugWithWine, amount = 1, max = 8}, + {empty = Item.silverServingJug, filled = Item.silverServingJugWithWine, amount = 1, max = 8}, + {empty = Item.goldServingJug, filled = Item.goldServingJugWithWine, amount = 1, max = 8}, + {empty = Item.glassServingJug, filled = Item.glassServingJugWithWine, amount = 6, max = 8}, + {empty = Item.glassServingJug, filled = Item.glassServingJugWithWineHalf, amount = 3, max = 5}, + {empty = Item.glassServingJug, filled = Item.glassServingJugWithWineQuarter, amount = 1, max = 2}}, + type = "jug"}, + + { + full = { + Item.bottleOfCider, Item.clayServingJugWithCider, Item.ceramicServingJugWithCider, + Item.ironServingJugWithCider, Item.copperServingJugWithCider, Item.silverServingJugWithCider, + Item.goldServingJugWithCider, Item.glassServingJugWithCider}, + half = { + Item.bottleOfCiderHalf,Item.glassServingJugWithCiderHalf}, + quarter = {Item.bottleOfCiderQuarter, Item.glassServingJugWithCiderQuarter}, + empty = { + Item.largeEmptyBottle, Item.clayServingJug, Item.ceramicServingJug, + Item.ironServingJug, Item.copperServingJug, Item.silverServingJug, + Item.goldServingJug, Item.glassServingJug}, + vessels = { + {empty = Item.clayCup, filled = Item.clayCupWithCider, amount = 1}, + {empty = Item.ceramicCup, filled = Item.ceramicCupWithCider, amount = 1}, + {empty = Item.woodenCup, filled = Item.cupWithCider, amount = 1}, + {empty = Item.ironGoblet, filled = Item.ironGobletWithCider, amount = 1}, + {empty = Item.copperGoblet, filled = Item.copperGobletWithCider, amount = 1}, + {empty = Item.silverGoblet, filled = Item.silverGobletWithCider, amount = 1}, + {empty = Item.goldenGoblet, filled = Item.goldenGobletWithCider, amount = 1}, + {empty = Item.glass, filled = Item.glassWithCider, amount = 1}, + {empty = Item.clayServingJug, filled = Item.clayServingJugWithCider, amount = 1, max = 8}, + {empty = Item.ceramicServingJug, filled = Item.ceramicServingJugWithCider, amount = 1, max = 8}, + {empty = Item.ironServingJug, filled = Item.ironServingJugWithCider, amount = 1, max = 8}, + {empty = Item.copperServingJug, filled = Item.copperServingJugWithCider, amount = 1, max = 8}, + {empty = Item.silverServingJug, filled = Item.silverServingJugWithCider, amount = 1, max = 8}, + {empty = Item.goldServingJug, filled = Item.goldServingJugWithCider, amount = 1, max = 8}, + {empty = Item.glassServingJug, filled = Item.glassServingJugWithCider, amount = 6, max = 8}, + {empty = Item.glassServingJug, filled = Item.glassServingJugWithCiderHalf, amount = 3, max = 5}, + {empty = Item.glassServingJug, filled = Item.glassServingJugWithCiderQuarter, amount = 1, max = 2}}, + type = "jug"}, + { + full = { + Item.bottleOfMead, Item.clayServingJugWithMead, Item.ceramicServingJugWithMead, + Item.ironServingJugWithMead, Item.copperServingJugWithMead, Item.silverServingJugWithMead, + Item.goldServingJugWithMead, Item.glassServingJugWithMead}, + half = { + Item.bottleOfMeadHalf,Item.glassServingJugWithMeadHalf}, + quarter = {Item.bottleOfMeadQuarter, Item.glassServingJugWithMeadQuarter}, + empty = { + Item.largeEmptyBottle, Item.clayServingJug, Item.ceramicServingJug, + Item.ironServingJug, Item.copperServingJug, Item.silverServingJug, + Item.goldServingJug, Item.glassServingJug}, + vessels = { + {empty = Item.clayCup, filled = Item.clayCupWithMead, amount = 1}, + {empty = Item.ceramicCup, filled = Item.ceramicCupWithMead, amount = 1}, + {empty = Item.woodenCup, filled = Item.cupWithMead, amount = 1}, + {empty = Item.ironGoblet, filled = Item.ironGobletWithMead, amount = 1}, + {empty = Item.copperGoblet, filled = Item.copperGobletWithMead, amount = 1}, + {empty = Item.silverGoblet, filled = Item.silverGobletWithMead, amount = 1}, + {empty = Item.goldenGoblet, filled = Item.goldenGobletWithMead, amount = 1}, + {empty = Item.glass, filled = Item.glassWithMead, amount = 1}, + {empty = Item.clayServingJug, filled = Item.clayServingJugWithMead, amount = 1, max = 8}, + {empty = Item.ceramicServingJug, filled = Item.ceramicServingJugWithMead, amount = 1, max = 8}, + {empty = Item.ironServingJug, filled = Item.ironServingJugWithMead, amount = 1, max = 8}, + {empty = Item.copperServingJug, filled = Item.copperServingJugWithMead, amount = 1, max = 8}, + {empty = Item.silverServingJug, filled = Item.silverServingJugWithMead, amount = 1, max = 8}, + {empty = Item.goldServingJug, filled = Item.goldServingJugWithMead, amount = 1, max = 8}, + {empty = Item.glassServingJug, filled = Item.glassServingJugWithMead, amount = 6, max = 8}, + {empty = Item.glassServingJug, filled = Item.glassServingJugWithMeadHalf, amount = 3, max = 5}, + {empty = Item.glassServingJug, filled = Item.glassServingJugWithMeadQuarter, amount = 1, max = 2}}, + type = "jug"}, + { + full = { + Item.bottleOfFairyWine, Item.clayServingJugWithFairyWine, Item.ceramicServingJugWithFairyWine, + Item.ironServingJugWithFairyWine, Item.copperServingJugWithFairyWine, Item.silverServingJugWithFairyWine, + Item.goldServingJugWithFairyWine, Item.glassServingJugWithFairyWine}, + half = { + Item.bottleOfFairyWineHalf,Item.glassServingJugWithFairyWineHalf}, + quarter = {Item.bottleOfFairyWineQuarter, Item.glassServingJugWithFairyWineQuarter}, + empty = { + Item.largeEmptyBottle, Item.clayServingJug, Item.ceramicServingJug, + Item.ironServingJug, Item.copperServingJug, Item.silverServingJug, + Item.goldServingJug, Item.glassServingJug}, + vessels = { + {empty = Item.clayCup, filled = Item.clayCupWithFairywine, amount = 1}, + {empty = Item.ceramicCup, filled = Item.ceramicCupWithFairyWine, amount = 1}, + {empty = Item.woodenCup, filled = Item.cupWithFairywine, amount = 1}, + {empty = Item.ironGoblet, filled = Item.ironGobletWithFairywine, amount = 1}, + {empty = Item.copperGoblet, filled = Item.copperGobletWithFairywine, amount = 1}, + {empty = Item.silverGoblet, filled = Item.silverGobletWithFairywine, amount = 1}, + {empty = Item.goldenGoblet, filled = Item.goldGobletWithFairywine, amount = 1}, + {empty = Item.glass, filled = Item.glassWithFairywine, amount = 1}, + {empty = Item.clayServingJug, filled = Item.clayServingJugWithFairyWine, amount = 1, max = 8}, + {empty = Item.ceramicServingJug, filled = Item.ceramicServingJugWithFairyWine, amount = 1, max = 8}, + {empty = Item.ironServingJug, filled = Item.ironServingJugWithFairyWine, amount = 1, max = 8}, + {empty = Item.copperServingJug, filled = Item.copperServingJugWithFairyWine, amount = 1, max = 8}, + {empty = Item.silverServingJug, filled = Item.silverServingJugWithFairyWine, amount = 1, max = 8}, + {empty = Item.goldServingJug, filled = Item.goldServingJugWithFairyWine, amount = 1, max = 8}, + {empty = Item.glassServingJug, filled = Item.glassServingJugWithFairyWine, amount = 6, max = 8}, + {empty = Item.glassServingJug, filled = Item.glassServingJugWithFairyWineHalf, amount = 3, max = 5}, + {empty = Item.glassServingJug, filled = Item.glassServingJugWithFairyWineQuarter, amount = 1, max = 2}}, + type = "jug"}, + { + full = { + Item.bottleOfBeer, Item.clayServingJugWithBeer, Item.ceramicServingJugWithBeer, + Item.ironServingJugWithBeer, Item.copperServingJugWithBeer, Item.silverServingJugWithBeer, + Item.goldServingJugWithBeer, Item.glassServingJugWithBeer}, + half = { + Item.bottleOfBeerHalf,Item.glassServingJugWithBeerHalf}, + quarter = {Item.bottleOfBeerQuarter, Item.glassServingJugWithBeerQuarter}, + empty = { + Item.largeEmptyBottle, Item.clayServingJug, Item.ceramicServingJug, + Item.ironServingJug, Item.copperServingJug, Item.silverServingJug, + Item.goldServingJug, Item.glassServingJug}, + vessels = { + {empty = Item.clayMug, filled = Item.clayBeerMugFull, amount = 1}, + {empty = Item.glassMug, filled = Item.beerMug, amount = 1}, + {empty = Item.clayServingJug, filled = Item.clayServingJugWithBeer, amount = 1, max = 8}, + {empty = Item.ceramicServingJug, filled = Item.ceramicServingJugWithBeer, amount = 1, max = 8}, + {empty = Item.ironServingJug, filled = Item.ironServingJugWithBeer, amount = 1, max = 8}, + {empty = Item.copperServingJug, filled = Item.copperServingJugWithBeer, amount = 1, max = 8}, + {empty = Item.silverServingJug, filled = Item.silverServingJugWithBeer, amount = 1, max = 8}, + {empty = Item.goldServingJug, filled = Item.goldServingJugWithBeer, amount = 1, max = 8}, + {empty = Item.glassServingJug, filled = Item.glassServingJugWithBeer, amount = 6, max = 8}, + {empty = Item.glassServingJug, filled = Item.glassServingJugWithBeerHalf, amount = 3, max = 5}, + {empty = Item.glassServingJug, filled = Item.glassServingJugWithBeerQuarter, amount = 1, max = 2}}, + type = "jug"}, + { + full = { + Item.bottleOfMilk, Item.bottleOfSheepMilk, Item.bottleOfDeerMilk, + Item.clayServingJugWithMilk, Item.ceramicServingJugWithMilk, + Item.ironServingJugWithMilk, Item.copperServingJugWithMilk, Item.silverServingJugWithMilk, + Item.goldServingJugWithMilk, Item.glassServingJugWithMilk}, + half = { + Item.bottleOfMilkHalf, Item.bottleOfSheepMilkHalf, Item.bottleOfDeerMilkHalf, + Item.glassServingJugWithMilkHalf}, + quarter = {Item.bottleOfMilkQuarter, Item.bottleOfSheepMilkQuarter, + Item.bottleOfDeerMilkQuarter, Item.glassServingJugWithMilkQuarter}, + empty = { + Item.largeEmptyBottle, Item.clayServingJug, Item.ceramicServingJug, + Item.ironServingJug, Item.copperServingJug, Item.silverServingJug, + Item.goldServingJug, Item.glassServingJug}, + vessels = { + {empty = Item.clayCup, filled = Item.clayCupWithMilk, amount = 1}, + {empty = Item.ceramicCup, filled = Item.ceramicCupWithMilk, amount = 1}, + {empty = Item.woodenCup, filled = Item.cupWithMilk, amount = 1}, + {empty = Item.ironGoblet, filled = Item.ironGobletWithMilk, amount = 1}, + {empty = Item.copperGoblet, filled = Item.copperGobletWithMilk, amount = 1}, + {empty = Item.silverGoblet, filled = Item.silverGobletglassWithMilk, amount = 1}, + {empty = Item.goldenGoblet, filled = Item.goldGobletWithMilk, amount = 1}, + {empty = Item.glass, filled = Item.glassWithMilk, amount = 1}, + {empty = Item.clayServingJug, filled = Item.clayServingJugWithMilk, amount = 1, max = 8}, + {empty = Item.ceramicServingJug, filled = Item.ceramicServingJugWithMilk, amount = 1, max = 8}, + {empty = Item.ironServingJug, filled = Item.ironServingJugWithMilk, amount = 1, max = 8}, + {empty = Item.copperServingJug, filled = Item.copperServingJugWithMilk, amount = 1, max = 8}, + {empty = Item.silverServingJug, filled = Item.silverServingJugWithMilk, amount = 1, max = 8}, + {empty = Item.goldServingJug, filled = Item.goldServingJugWithMilk, amount = 1, max = 8}, + {empty = Item.glassServingJug, filled = Item.glassServingJugWithMilk, amount = 6, max = 8}, + {empty = Item.glassServingJug, filled = Item.glassServingJugWithMilkHalf, amount = 3, max = 5}, + {empty = Item.glassServingJug, filled = Item.glassServingJugWithMilkQuarter, amount = 1, max = 2}}, + type = "jug", + breakPoint = 3}, + { + full = {Item.bottleOfElvenWine}, + half = {Item.bottleOfElvenWineHalf}, + quarter = {Item.bottleOfElvenWineQuarter}, + empty = {Item.emptyLiquorBottle}, + vessels = { + {empty = Item.clayShotGlass, filled = Item.clayShotGlassWithElvenWine, amount = 1}, + {empty = Item.ceramicShotGlass, filled = Item.ceramicShotGlassWithElvenWine, amount = 1}, + {empty = Item.ironShotGlass, filled = Item.ironShotGlassWithElvenWine, amount = 1}, + {empty = Item.copperShotGlass, filled = Item.copperShotGlassWithElvenWine, amount = 1}, + {empty = Item.silverShotGlass, filled = Item.silverShotGlassWithElvenWine, amount = 1}, + {empty = Item.goldShotGlass, filled = Item.goldShotGlassWithElvenWine, amount = 1}, + {empty = Item.shotGlass, filled = Item.shotGlassWithElvenWine, amount = 1} + }, + }, + { + full = {Item.bottleOfAbsinthe}, + half = {Item.bottleOfAbsinthHalf}, + quarter = {Item.bottleOfAbsinthQuarter}, + empty = {Item.emptyLiquorBottle}, + vessels = { + {empty = Item.clayShotGlass, filled = Item.clayShotGlassWithAbsinthe, amount = 1}, + {empty = Item.ceramicShotGlass, filled = Item.ceramicShotGlassWithAbsinthe, amount = 1}, + {empty = Item.ironShotGlass, filled = Item.ironShotGlassWithAbsinthe, amount = 1}, + {empty = Item.copperShotGlass, filled = Item.copperShotGlassWithAbsinthe, amount = 1}, + {empty = Item.silverShotGlass, filled = Item.silverShotGlassWithAbsinthe, amount = 1}, + {empty = Item.goldShotGlass, filled = Item.goldShotGlassWithAbsinthe, amount = 1}, + {empty = Item.shotGlass, filled = Item.shotGlassWithAbsinthe, amount = 1} + }, + }, + { + full = {Item.bottleOfBearSlayer}, + half = {Item.bottleOfBearSlayerHalf}, + quarter = {Item.bottleOfBearSlayerQuarter}, + empty = {Item.emptyLiquorBottle}, + vessels = { + {empty = Item.clayShotGlass, filled = Item.clayShotGlassWithBearSlayer, amount = 1}, + {empty = Item.ceramicShotGlass, filled = Item.ceramicShotGlassWithBearSlayer, amount = 1}, + {empty = Item.ironShotGlass, filled = Item.ironShotGlassWithBearSlayer, amount = 1}, + {empty = Item.copperShotGlass, filled = Item.copperShotGlassWithBearSlayer, amount = 1}, + {empty = Item.silverShotGlass, filled = Item.silverShotGlassWithBearSlayer, amount = 1}, + {empty = Item.goldShotGlass, filled = Item.goldShotGlassWithBearSlayer, amount = 1}, + {empty = Item.shotGlass, filled = Item.shotGlassWithBearSlayer, amount = 1} + }, + }, + { + full = {Item.bottleOfBerryBooze}, + half = {Item.bottleOfBerryBoozeHalf}, + quarter = {Item.bottleOfBerryBoozeQuarter}, + empty = {Item.emptyLiquorBottle}, + vessels = { + {empty = Item.clayShotGlass, filled = Item.clayShotGlassWithBerryBooze, amount = 1}, + {empty = Item.ceramicShotGlass, filled = Item.ceramicShotGlassWithBerryBooze, amount = 1}, + {empty = Item.ironShotGlass, filled = Item.ironShotGlassWithBerryBooze, amount = 1}, + {empty = Item.copperShotGlass, filled = Item.copperShotGlassWithBerryBooze, amount = 1}, + {empty = Item.silverShotGlass, filled = Item.silverShotGlassWithBerryBooze, amount = 1}, + {empty = Item.goldShotGlass, filled = Item.goldShotGlassWithBerryBooze, amount = 1}, + {empty = Item.shotGlass, filled = Item.shotGlassWithBerryBooze, amount = 1} + }, + }, + { + full = {Item.bottleOfCherrySchnapps}, + half = {Item.bottleOfCherrySchnappsHalf}, + quarter = {Item.bottleOfCherrySchnappsQuarter}, + empty = {Item.emptyLiquorBottle}, + vessels = { + {empty = Item.clayShotGlass, filled = Item.clayShotGlassWithCherrySchnapps, amount = 1}, + {empty = Item.ceramicShotGlass, filled = Item.ceramicShotGlassWithCherrySchnapps, amount = 1}, + {empty = Item.ironShotGlass, filled = Item.ironShotGlassWithCherrySchnapps, amount = 1}, + {empty = Item.copperShotGlass, filled = Item.copperShotGlassWithCherrySchnapps, amount = 1}, + {empty = Item.silverShotGlass, filled = Item.silverShotGlassWithCherrySchnapps, amount = 1}, + {empty = Item.goldShotGlass, filled = Item.goldShotGlassWithCherrySchnapps, amount = 1}, + {empty = Item.shotGlass, filled = Item.shotGlassWithCherrySchnapps, amount = 1} + }, + }, + { + full = {Item.bottleOfMulledWine}, + half = {Item.bottleOfMulledWineHalf}, + quarter = {Item.bottleOfMulledWineQuarter}, + empty = {Item.emptyLiquorBottle}, + vessels = { + {empty = Item.clayShotGlass, filled = Item.clayShotGlassWithMulledWine, amount = 1}, + {empty = Item.ceramicShotGlass, filled = Item.ceramicShotGlassWithMulledWine, amount = 1}, + {empty = Item.ironShotGlass, filled = Item.ironShotGlassWithMulledWine, amount = 1}, + {empty = Item.copperShotGlass, filled = Item.copperShotGlassWithMulledWine, amount = 1}, + {empty = Item.silverShotGlass, filled = Item.silverShotGlassWithMulledWine, amount = 1}, + {empty = Item.goldShotGlass, filled = Item.goldShotGlassWithMulledWine, amount = 1}, + {empty = Item.shotGlass, filled = Item.shotGlassWithMulledWine, amount = 1} + }, + }, + { + full = {Item.bottleOfOrangeSchnapps}, + half = {Item.bottleOfOrangeSchnappsHalf}, + quarter = {Item.bottleOfOrangeSchnappsQuarter}, + empty = {Item.emptyLiquorBottle}, + vessels = { + {empty = Item.clayShotGlass, filled = Item.clayShotGlassWithOrangeSchnapps, amount = 1}, + {empty = Item.ceramicShotGlass, filled = Item.ceramicShotGlassWithOrangeSchnapps, amount = 1}, + {empty = Item.ironShotGlass, filled = Item.ironShotGlassWithOrangeSchnapps, amount = 1}, + {empty = Item.copperShotGlass, filled = Item.copperShotGlassWithOrangeSchnapps, amount = 1}, + {empty = Item.silverShotGlass, filled = Item.silverShotGlassWithOrangeSchnapps, amount = 1}, + {empty = Item.goldShotGlass, filled = Item.goldShotGlassWithOrangeSchnapps, amount = 1}, + {empty = Item.shotGlass, filled = Item.shotGlassWithOrangeSchnapps, amount = 1} + }, + }, + { + full = {Item.bottleOfStoneFace}, + half = {Item.bottleOfStoneFaceHalf}, + quarter = {Item.bottleOfStoneFaceQuarter}, + empty = {Item.emptyLiquorBottle}, + vessels = { + {empty = Item.clayShotGlass, filled = Item.clayShotGlassWithStoneFace, amount = 1}, + {empty = Item.ceramicShotGlass, filled = Item.ceramicShotGlassWithStoneFace, amount = 1}, + {empty = Item.ironShotGlass, filled = Item.ironShotGlassWithStoneFace, amount = 1}, + {empty = Item.copperShotGlass, filled = Item.copperShotGlassWithStoneFace, amount = 1}, + {empty = Item.silverShotGlass, filled = Item.silverShotGlassWithStoneFace, amount = 1}, + {empty = Item.goldShotGlass, filled = Item.goldShotGlassWithStoneFace, amount = 1}, + {empty = Item.shotGlass, filled = Item.shotGlassWithStoneFace, amount = 1} + }, + }, + { + full = {Item.bottleOfDruidsTea, Item.glassTeapotDruidsTea}, + half = {Item.bottleOfDruidsTeaHalf, Item.glassTeapotDruidsTeaHalf}, + quarter = {Item.bottleOfDruidsTeaQuarter, Item.glassTeapotDruidsTeaQuarter}, + empty = {Item.teaBottle, Item.glassTeapot}, + vessels = { + {empty = Item.clayTeaCup, filled = Item.clayTeaCupDruid, amount = 1}, + {empty = Item.ceramicTeaCup, filled = Item.ceramicTeaCupDruid, amount = 1}, + {empty = Item.ironTeaCup, filled = Item.ironTeaCupDruid, amount = 1}, + {empty = Item.copperTeaCup, filled = Item.copperTeaCupDruid, amount = 1}, + {empty = Item.silverTeaCup, filled = Item.silverTeaCupDruid, amount = 1}, + {empty = Item.goldTeaCup, filled = Item.goldTeaCupDruid, amount = 1}, + {empty = Item.glassTeaCup, filled = Item.glassTeaCupDruid, amount = 1}, + }, + type = "druid" + }, + { + full = {Item.bottleOfGreenTea, Item.glassTeapotGreenTea}, + half = {Item.bottleOfGreenTeaHalf, Item.glassTeapotGreenTeaHalf}, + quarter = {Item.bottleOfGreenTeaQuarter, Item.glassTeapotGreenTeaQuarter}, + empty = {Item.teaBottle, Item.glassTeapot}, + vessels = { + {empty = Item.clayTeaCup, filled = Item.clayTeaCupGreen, amount = 1}, + {empty = Item.ceramicTeaCup, filled = Item.ceramicTeaCupGreen, amount = 1}, + {empty = Item.ironTeaCup, filled = Item.ironTeaCupGreen, amount = 1}, + {empty = Item.copperTeaCup, filled = Item.copperTeaCupGreen, amount = 1}, + {empty = Item.silverTeaCup, filled = Item.silverTeaCupGreen, amount = 1}, + {empty = Item.goldTeaCup, filled = Item.goldTeaCupGreen, amount = 1}, + {empty = Item.glassTeaCup, filled = Item.glassTeaCupGreen, amount = 1}, + }, + type = "green" + }, + { + full = {Item.bottleOfFirNeedleTea, Item.glassTeapotFirNeedleTea}, + half = {Item.bottleOfFirNeedleTeaHalf, Item.glassTeapotFirNeedleTeaHalf}, + quarter = {Item.bottleOfFirNeedleTeaQuarter, Item.glassTeapotFirNeedleTeaQuarter}, + empty = {Item.teaBottle, Item.glassTeapot}, + vessels = { + {empty = Item.clayTeaCup, filled = Item.clayTeaCupFirNeedle, amount = 1}, + {empty = Item.ceramicTeaCup, filled = Item.ceramicTeaCupFirNeedle, amount = 1}, + {empty = Item.ironTeaCup, filled = Item.ironTeaCupFirNeedle, amount = 1}, + {empty = Item.copperTeaCup, filled = Item.copperTeaCupFirNeedle, amount = 1}, + {empty = Item.silverTeaCup, filled = Item.silverTeaCupFirNeedle, amount = 1}, + {empty = Item.goldTeaCup, filled = Item.goldTeaCupFirNeedle, amount = 1}, + {empty = Item.glassTeaCup, filled = Item.glassTeaCupFirNeedle, amount = 1}, + }, + type = "firNeedle" + }, + { + full = {Item.bottleOfVirginsWeedTea, Item.glassTeapotVirginsWeedTea}, + half = {Item.bottleOfVirginsWeedTeaHalf, Item.glassTeapotVirginsWeedTeaHalf}, + quarter = {Item.bottleOfVirginsWeedTeaQuarter, Item.glassTeapotVirginsWeedTeaQuarter}, + empty = {Item.teaBottle, Item.glassTeapot}, + vessels = { + {empty = Item.clayTeaCup, filled = Item.clayTeaCupVirginWeed, amount = 1}, + {empty = Item.ceramicTeaCup, filled = Item.ceramicTeaCupVirginWeed, amount = 1}, + {empty = Item.ironTeaCup, filled = Item.ironTeaCupVirginWeed, amount = 1}, + {empty = Item.copperTeaCup, filled = Item.copperTeaCupVirginWeed, amount = 1}, + {empty = Item.silverTeaCup, filled = Item.silverTeaCupVirginWeed, amount = 1}, + {empty = Item.goldTeaCup, filled = Item.goldTeaCupVirginWeed, amount = 1}, + {empty = Item.glassTeaCup, filled = Item.glassTeaCupVirginWeed, amount = 1}, + {empty = Item.clayTeapot, filled = Item.clayTeapot, amount = 1, max = 8}, + {empty = Item.ceramicTeapot, filled = Item.ceramicTeapot, amount = 1, max = 8}, + {empty = Item.ironTeapot, filled = Item.ironTeapot, amount = 1, max = 8}, + {empty = Item.copperTeapot, filled = Item.copperTeapot, amount = 1, max = 8}, + {empty = Item.silverTeapot, filled = Item.silverTeapot, amount = 1, max = 8}, + {empty = Item.goldTeapot, filled = Item.goldTeapot, amount = 1, max = 8}, + {empty = Item.glassTeapot, filled = Item.glassTeapot, amount = 1, max = 8} + }, + type = "virginWeed" + }, +} + +local function getTeaVesselBasedOnType(type) + + local pot + + if type == "druid" then + pot = Item.glassTeapotDruidsTea + elseif type == "firNeedle" then + pot = Item.glassTeapotFirNeedleTea + elseif type == "virginWeed" then + pot = Item.glassTeapotVirginsWeedTea + elseif type == "green" then + pot = Item.glassTeapotGreenTea + end - local food = drinkList[ SourceItem.id ]; - if (food ~= nil ) then - if evilrockEntrance(User, SourceItem, ltstate) == true then - return + for _, bottle in pairs(bottles) do + for _, fullBottle in pairs(bottle.full) do + if fullBottle == pot then + return bottle.vessels + end end + end +end + +local teaPots = {Item.clayTeapot, Item.copperTeapot, Item.silverTeapot, Item.goldTeapot, Item.ironTeapot, Item.glassTeapot, Item.ceramicTeapot} + +local function getBottleInfo(sourceItem) + + for _, bottle in pairs(bottles) do - if SourceItem.wear == 255 then --It's a static display item, not something to consume - return + for index, fullBottle in pairs(bottle.full) do + if fullBottle == sourceItem.id then + return true, bottle.half[index], bottle.quarter[index], bottle.empty[index], bottle.vessels, 8, index, bottle.type, bottle.breakPoint + end end - local TargetItems = {} - for _, combo in pairs(food[4]) do - table.insert(TargetItems,combo[1]) + for index, halfBottle in pairs(bottle.half) do + if halfBottle == sourceItem.id then + return true, bottle.half[index], bottle.quarter[index], bottle.empty[index], bottle.vessels, 5, index, bottle.type, bottle.breakPoint + + end end - local foundVessels, vesselItem = common.GetTargetItemAnywhere(User,TargetItems) - - if foundVessels == 0 then - common.InformNLS( User, "Dir fällt auf, dass du gar kein Gefäß hast, welches du füllen könntest.", - "You notice that you do not have a vessel which you could fill.") - elseif foundVessels == 1 then - for _, combo in pairs(food[4]) do - if combo[1] == vesselItem.id then - -- fill drink - if (vesselItem.number > 1) then - world:erase(vesselItem, 1) - common.CreateItem(User, combo[2], 1, 333, nil) - else - vesselItem.id = combo[2] - world:changeItem(vesselItem) - end - world:makeSound(10,User.pos) - - -- create leftovers - if( SourceItem.quality > 199 ) then - -- reduce one portion - SourceItem.quality = SourceItem.quality-100 - world:changeItem(SourceItem) - --world:changeQuality( SourceItem, -100 ); - else - if( math.random( 50 ) <= 1 ) then - common.InformNLS( User, - "Die leere Flasche ist angeschlagen und unbrauchbar.", - "The empty bottle is broken and no longer usable."); - else - local dataCopy = {descriptionDe=SourceItem:getData("descriptionDe"), descriptionEn=SourceItem:getData("descriptionEn")}; - common.CreateItem(User, food[3], 1, 333, dataCopy) - end - world:erase(SourceItem, 1) - end - - -- cancel after one found item - break; - end -- found item + + for index, quarterBottle in pairs(bottle.quarter) do + if quarterBottle == sourceItem.id then + return true, bottle.half[index], bottle.quarter[index], bottle.empty[index], bottle.vessels, 2, index, bottle.type, bottle.breakPoint + end + end + end + + return false +end + +local bottleTexts = { + english = { + "The bottle is nearly empty.", + "A quarter of the bottle contains liquid.", + "Nearly half of the bottle is full.", + "Half of the bottle is full.", + "The bottle is a little above half filled.", + "The bottle is almost full.", + "The bottle is full.", + "The bottle is filled to the brim." + }, + german = { + "GERMAN TRANSLATION", + "GERMAN TRANSLATION", + "GERMAN TRANSLATION", + "GERMAN TRANSLATION", + "GERMAN TRANSLATION", + "GERMAN TRANSLATION", + "GERMAN TRANSLATION", + "GERMAN TRANSLATION" + }} + +local servingJugTexts = { + english = { + "The jug is nearly empty.", + "A quarter of the jug contains liquid.", + "Nearly half of the jug is full.", + "Half of the jug is full.", + "The jug is a little above half filled.", + "The jug is almost full.", + "The jug is full.", + "The jug is filled to the brim." + }, + german = { + "GERMAN TRANSLATION", + "GERMAN TRANSLATION", + "GERMAN TRANSLATION", + "GERMAN TRANSLATION", + "GERMAN TRANSLATION", + "GERMAN TRANSLATION", + "GERMAN TRANSLATION", + "GERMAN TRANSLATION" + }} + +local glassTeaPotTexts = { + english = { + "The pot is empty.", + "The pot barely has any tea left.", + "A quarter of the pot contains tea.", + "Nearly half of the pot is full of tea.", + "Half of the pot is full of tea.", + "The pot is a little above half filled with tea.", + "The pot is almost full with tea.", + "The pot is full of tea.", + "The pot is filled to the brim with tea." + }, + german = { + "GERMAN TRANSLATION", + "GERMAN TRANSLATION", + "GERMAN TRANSLATION", + "GERMAN TRANSLATION", + "GERMAN TRANSLATION", + "GERMAN TRANSLATION", + "GERMAN TRANSLATION", + "GERMAN TRANSLATION" + }} + +local teaPotTexts = { + english = { + "The pot is empty.", + "The pot barely has any ", + "A quarter of the pot contains ", + "Nearly half of the pot is full of ", + "Half of the pot is full of ", + "The pot is a little above half filled with ", + "The pot is almost full with ", + "The pot is full of ", + "The pot is filled to the brim with " + }, + german = { + "GERMAN TRANSLATION", + "GERMAN TRANSLATION", + "GERMAN TRANSLATION", + "GERMAN TRANSLATION", + "GERMAN TRANSLATION", + "GERMAN TRANSLATION", + "GERMAN TRANSLATION", + "GERMAN TRANSLATION" + }} + +local function getVesselToFill(user, vessels, amount) + + for _, vessel in pairs(vessels) do + + if amount >= vessel.amount then -- Checks amount so that it skips to the half/quarter serving jugs if there is not enough liquid for full/half + + if common.hasItemIdInHand(user, vessel.empty) then + return common.getItemInHand(user, vessel.empty), vessel.filled, vessel.amount, vessel.max + end + + local potentialVessel = common.GetFrontItem(user) + + if potentialVessel and potentialVessel.id == vessel.empty then + return potentialVessel, vessel.filled, vessel.amount, vessel.max + end + end + end + + return false + +end + +local function isTeaPot(sourceItem) + + for _, pot in pairs(teaPots) do + + if sourceItem.id == pot then + return true + end + + end + + return false + +end + +local function getTypeOfTea(sourceItem) + + for _, bottle in pairs(bottles) do + for _, fullBottle in pairs(bottle.full) do + if fullBottle == sourceItem.id then + return bottle.type + end + end + + for _, halfBottle in pairs(bottle.half) do + if halfBottle == sourceItem.id then + return bottle.type + end + end + + for _, quarterBottle in pairs(bottle.quarter) do + if quarterBottle == sourceItem.id then + return bottle.type + end + end + end +end + +local function fillTea(user, sourceItem, amount, half, quarter, empty, vesselToFill) + + local type = sourceItem:getData("teaType") + + if vesselToFill and isTeaPot(vesselToFill) and not isTeaPot(sourceItem) then + type = getTypeOfTea(sourceItem) + end + + local suitableVessels = getTeaVesselBasedOnType(type) + + local filledVessel, minAmountToFill, maxAmountToFill + + vesselToFill, filledVessel, minAmountToFill, maxAmountToFill = getVesselToFill(user, suitableVessels, amount) + + if not vesselToFill then + common.InformNLS(user, + "Dir fällt auf, dass du gar kein Gefäß hast, welches du füllen könntest.", + "You notice that you do not have a vessel which you could fill.") + return false + end + + local amountToFill = minAmountToFill + + if not maxAmountToFill then + maxAmountToFill = minAmountToFill + end + + if amount >= maxAmountToFill then + amountToFill = maxAmountToFill + elseif amount > minAmountToFill then + amountToFill = amount + end + + local newAmount = amount - amountToFill + + vesselToFill.id = filledVessel + + if maxAmountToFill > 1 then + vesselToFill:setData("teaType", type) + vesselToFill:setData("drinksRemaining", amountToFill) + end + + world:changeItem(vesselToFill) + + sourceItem:setData("drinksRemaining", newAmount) + + if newAmount == 0 then + sourceItem:setData("drinksRemaining", "") + vesselToFill:setData("teaType", "") + if empty then + sourceItem.id = empty + end + elseif quarter and newAmount <= 2 then + sourceItem.id = quarter + elseif half and newAmount <= 5 then + sourceItem.id = half + end + + world:changeItem(sourceItem) + + return true, sourceItem +end + +local function fillVessel(user, sourceItem, bottle) + + local _, half, quarter, empty, vessels, maxAmount = getBottleInfo(sourceItem) + + local amount = sourceItem:getData("drinksRemaining") + + if common.IsNilOrEmpty(amount) then + amount = maxAmount + else + amount = tonumber(amount) + end + + local vesselToFill, filledVessel, minAmountToFill, maxAmountToFill = getVesselToFill(user, vessels, amount) + + if not vesselToFill then + common.InformNLS(user, + "Dir fällt auf, dass du gar kein Gefäß hast, welches du füllen könntest.", + "You notice that you do not have a vessel which you could fill.") + return false + end + + if isTeaPot(vesselToFill) then + return fillTea(user, sourceItem, amount, half, quarter, empty, vesselToFill) + end + + local amountToFill = minAmountToFill + + if not maxAmountToFill then + maxAmountToFill = minAmountToFill + end + + if amount >= maxAmountToFill then + amountToFill = maxAmountToFill + elseif amount > minAmountToFill then + amountToFill = amount + end + + local newAmount = amount - amountToFill + + vesselToFill.id = filledVessel + + if maxAmountToFill > 1 then + vesselToFill:setData("drinksRemaining", amountToFill) + end + + world:changeItem(vesselToFill) + + sourceItem:setData("drinksRemaining", newAmount) + + if newAmount == 0 then + sourceItem:setData("drinksRemaining", "") + sourceItem.id = empty + elseif newAmount <= 2 then + sourceItem.id = quarter + elseif newAmount <= 5 then + sourceItem.id = half + end + + world:changeItem(sourceItem) + + return true, sourceItem + +end + + + +function M.UseItem(user, sourceItem, actionState) + + if evilrockEntrance(user, sourceItem, actionState) == true then + return + end + + if sourceItem.wear == 255 then --It's a static display item, not something to consume + return + end + + local filled = false + + local updatedSourceItem = nil + + local amount = sourceItem:getData("drinksRemaining") + + if isTeaPot(sourceItem) and common.IsNilOrEmpty(amount) then + amount = 0 + else + amount = tonumber(amount) + end + + if not isTeaPot(sourceItem) then + for _, bottle in ipairs(bottles) do + + for _, quarterBottle in pairs(bottle.quarter) do + if quarterBottle == sourceItem.id then + filled, updatedSourceItem = fillVessel(user, sourceItem, bottle) + end + end + + for _, halfBottle in pairs(bottle.half) do + if halfBottle == sourceItem.id then + filled, updatedSourceItem = fillVessel(user, sourceItem, bottle) + end + end + + for index, fullBottle in pairs(bottle.full) do + if fullBottle == sourceItem.id then + filled, updatedSourceItem = fillVessel(user, sourceItem, bottle) + end end - else - common.InformNLS( User, "Du bist dir nicht ganz sicher, welches Gefäß du füllen willst. Vielleicht nimmst du es in die Hand?", - "You are not sure what vessel you want to fill. Perhaps you could hold one in your hand?") end + elseif amount > 0 then + filled, updatedSourceItem = fillTea(user, sourceItem, amount) + end + + if not filled then + return + end + + local isBigBottle, _, _, empty = getBottleInfo(updatedSourceItem) + + local isEmpty = false + + if isBigBottle and empty == updatedSourceItem.id then + isEmpty = true + end + + if isEmpty and math.random(1,20) == 1 then -- Same chance as with food dishes breaking is applied + user:inform("Die leere Flasche ist angeschlagen und unbrauchbar.", + "The empty bottle is broken and no longer usable.", Character.highPriority) end + end -function M.LookAtItem(User, Item) - local lookAt = lookat.GenerateLookAt(User, Item) - local food = drinkList[ Item.id ]; - if food == nil then - return lookAt +local teaNames = { + druid = {german = "Druidentee", english = "druids tea"}, + firNeedle = {german = "Tannenadeltee", english = "fir needle tea"}, + virginWeed = {german = "Jungfernkrauttee", english = "virgin weed tea"}, + green = {german = "grüner Tee", english = "green tea"}} + +function M.LookAtItem(user, sourceItem) + + local typeOfTea = sourceItem:getData("teaType") + + local teaName + + if not common.IsNilOrEmpty(typeOfTea) then + teaName = teaNames[typeOfTea] end - -- decode item quality, extract duration - local itemDura=math.fmod(Item.quality,100); - local itemQual=(Item.quality-itemDura)/100; - --User:inform("portions "..itemQual); + local lookAt = lookat.GenerateLookAt(user, sourceItem) - -- build description + local amount = sourceItem:getData("drinksRemaining") - local DisplayText=""; + local textsToUse - -- build quality text - for i,qualLimit in pairs(BottleQualLm) do - if (itemQual>=qualLimit ) then - DisplayText = common.GetNLS( User, BottleQualDe[i], BottleQualEn[i] ); - break; + local isBottle, _, _, _, _, maxAmount, index, type, breakPoint = getBottleInfo(sourceItem) + + if not breakPoint then + breakPoint = 1 + end + + if isBottle or isTeaPot(sourceItem) then + if common.IsNilOrEmpty(amount) and isBottle then + amount = maxAmount + elseif common.IsNilOrEmpty(amount) and isTeaPot(sourceItem) then + amount = 0 + else + amount = tonumber(amount) end + + if isTeaPot(sourceItem) then + amount = amount+1 --since lua tables(arrays) dont start at 0 + end + + textsToUse = bottleTexts + + if index and index > breakPoint then -- First listed is always the bottle, then come the jugs/pots. If there's more than one bottle, a breakpoint is provided + if type == "jug" then + textsToUse = servingJugTexts + elseif isTeaPot(sourceItem) then + textsToUse = teaPotTexts + else + textsToUse = glassTeaPotTexts + amount = amount+1 + end + elseif not index then -- empty teapot + textsToUse = teaPotTexts + end + else + return lookAt -- item is not in any of the lists for texts to add end - DisplayText = DisplayText..common.GetNLS( User, food[1], food[2] ); - if lookAt.description ~= nil then -- append the label - DisplayText = DisplayText..". "..lookAt.description; + local description = common.GetNLS(user, textsToUse.german[amount], textsToUse.english[amount]) + + if teaName and amount > 1 then --add the type of tea if the tea pot is not empty for the non-glass teapots so we know what is in them + description = common.GetNLS(user, description..teaName.german..".", description..teaName.english..".") + end + + if lookAt.description ~= nil then + description = description.."\n"..lookAt.description; end - lookAt.description = DisplayText + + lookAt.description = description return lookAt end diff --git a/item/drinks.lua b/item/drinks.lua index 0567f5542..0f36091db 100644 --- a/item/drinks.lua +++ b/item/drinks.lua @@ -22,64 +22,207 @@ local lookat = require("base.lookat") local M = {} --- item ID, food value, leftover item, alcohol strength +-- [item ID], {food value, remnant item} M.drinkList = {} -M.drinkList[2502] = { 800, 2498, 0} -- bottle with sheep milk -M.drinkList[1841] = { 100, 1840, 0} -- goblet with water -M.drinkList[1842] = { 800, 1840, 15} -- goblet with wine -M.drinkList[1843] = { 1000, 1840, 10} -- goblet with mead -M.drinkList[1844] = { 800, 1840, 20} -- goblet with cider -M.drinkList[1853] = { 1000, 1858, 10} -- goblet with mead -M.drinkList[1854] = { 100, 224, 0} -- goblet with water -M.drinkList[1855] = { 100, 1858, 0} -- goblet with water -M.drinkList[1856] = { 1000, 224, 10} -- goblet with mead -M.drinkList[1857] = { 800, 224, 15} -- goblet with wine -M.drinkList[1859] = { 800, 1858, 20} -- goblet with cider -M.drinkList[1860] = { 800, 1858, 15} -- goblet with wine -M.drinkList[1861] = { 800, 224, 20} -- goblet with cider -M.drinkList[1906] = { 200, 1908, 10} -- beer mug -M.drinkList[1907] = { 200, 1910, 10} -- beer mug -M.drinkList[1909] = { 200, 1907, 10} -- beer mug -M.drinkList[1910] = { 200, 1906, 10} -- beer mug -M.drinkList[2056] = { 500, 2055, 10} -- goblet with mead -M.drinkList[2057] = { 400, 2055, 15} -- goblet with wine -M.drinkList[2058] = { 50, 2055, 0} -- goblet with water -M.drinkList[2059] = { 400, 2055, 20} -- goblet with cider -M.drinkList[2186] = { 100, 2185, 0} -- mug with water -M.drinkList[2187] = { 800, 2185, 15} -- mug with wine -M.drinkList[2188] = { 1000, 2185, 10} -- mug with mead -M.drinkList[2189] = { 800, 2185, 20} -- mug with cider -M.drinkList[517] = { 400, 518, 35} -- bottle of rum -M.drinkList[1315] = { 400, 1317, 35} -- bottle of berry booze -M.drinkList[1316] = { 400, 1317, 35} -- bottle of bear slayer -M.drinkList[1318] = { 400, 1317, 35} -- bottle of elven wine -M.drinkList[1319] = { 400, 1317, 35} -- bottle of cherry schnapps -M.drinkList[783] = {500, 790, 0} -- bottle of blackberry juice -M.drinkList[784] = {500, 790, 0} -- bottle of tangerine juice -M.drinkList[785] = {500, 790, 0} -- bottle of banana juice -M.drinkList[786] = {500, 790, 0} -- bottle of cabbage juice -M.drinkList[787] = {500, 790, 0} -- bottle of virgings weed tea -M.drinkList[788] = {500, 790, 0} -- bottle of carrot juice -M.drinkList[789] = {500, 790, 0} -- bottle of strawberry juice -M.drinkList[791] = {500, 790, 0} -- bottle of grape juice -M.drinkList[3611] = {500, 790, 0} -- bottle of orange juice -M.drinkList[1320] = { 400, 1317, 35} -- bottle of stone face -M.drinkList[1321] = { 400, 1317, 35} -- bottle of absinthe -M.drinkList[1322] = { 400, 1317, 35} -- bottle of orange schnapps -M.drinkList[1323] = { 400, 1317, 35} -- bottle of mulled wine -M.drinkList[3720] = {500, 790, 0} -- bottle of fir needle tea -M.drinkList[3721] = {500, 790, 0} -- bottle of green tea -M.drinkList[3722] = {500, 790, 0} -- bottle of druids tea -function M.UseItem(user, SourceItem) +M.drinkList[Item.cupWithWater] = {100, Item.woodenCup} +M.drinkList[Item.cupWithWine] = {800, Item.woodenCup} +M.drinkList[Item.cupWithMead] = {1000, Item.woodenCup} +M.drinkList[Item.cupWithCider] = {800, Item.woodenCup} +M.drinkList[Item.cupWithMilk] = {400, Item.woodenCup} +M.drinkList[Item.cupWithFairywine] = {1000, Item.woodenCup} + +M.drinkList[Item.clayCupWithWater] = {100, Item.clayCup} +M.drinkList[Item.clayCupWithWine] = {800, Item.clayCup} +M.drinkList[Item.clayCupWithMead] = {1000, Item.clayCup} +M.drinkList[Item.clayCupWithCider] = {800, Item.clayCup} +M.drinkList[Item.clayCupWithMilk] = {400, Item.clayCup} +M.drinkList[Item.clayCupWithFairywine] = {1000, Item.clayCup} + +M.drinkList[Item.ceramicCupWithWater] = {100, Item.ceramicCup} +M.drinkList[Item.ceramicCupWithWine] = {800, Item.ceramicCup} +M.drinkList[Item.ceramicCupWithMead] = {1000, Item.ceramicCup} +M.drinkList[Item.ceramicCupWithCider] = {800, Item.ceramicCup} +M.drinkList[Item.ceramicCupWithMilk] = {400, Item.ceramicCup} +M.drinkList[Item.ceramicCupWithFairyWine] = {1000, Item.ceramicCup} + +M.drinkList[Item.ironGobletWithWater] = {100, Item.ironGoblet} +M.drinkList[Item.ironGobletWithWine] = {800, Item.ironGoblet} +M.drinkList[Item.ironGobletWithMead] = {1000, Item.ironGoblet} +M.drinkList[Item.ironGobletWithCider] = {800, Item.ironGoblet} +M.drinkList[Item.ironGobletWithMilk] = {400, Item.ironGoblet} +M.drinkList[Item.ironGobletWithFairywine] = {1000, Item.ironGoblet} + +M.drinkList[Item.copperGobletWithWater] = {100, Item.copperGoblet} +M.drinkList[Item.copperGobletWithWine] = {800, Item.copperGoblet} +M.drinkList[Item.copperGobletWithMead] = {1000, Item.copperGoblet} +M.drinkList[Item.copperGobletWithCider] = {800, Item.copperGoblet} +M.drinkList[Item.copperGobletWithMilk] = {400, Item.copperGoblet} +M.drinkList[Item.copperGobletWithFairywine] = {1000, Item.copperGoblet} + +M.drinkList[Item.silverGobletWithWater] = {100, Item.silverGoblet} +M.drinkList[Item.silverGobletWithWine] = {800, Item.silverGoblet} +M.drinkList[Item.silverGobletWithMead] = {1000, Item.silverGoblet} +M.drinkList[Item.silverGobletWithCider] = {800, Item.silverGoblet} +M.drinkList[Item.silverGobletglassWithMilk] = {400, Item.silverGoblet} +M.drinkList[Item.silverGobletWithFairywine] = {1000, Item.silverGoblet} + +M.drinkList[Item.goldenGobletWithWater] = {100, Item.goldenGoblet} +M.drinkList[Item.goldenGobletWithWine] = {800, Item.goldenGoblet} +M.drinkList[Item.goldenGobletWithMead] = {1000, Item.goldenGoblet} +M.drinkList[Item.goldenGobletWithCider] = {800, Item.goldenGoblet} +M.drinkList[Item.goldGobletWithMilk] = {400, Item.goldenGoblet} +M.drinkList[Item.goldGobletWithFairywine] = {1000, Item.goldenGoblet} + +M.drinkList[Item.glassWithWater] = {50, Item.glass} +M.drinkList[Item.glassWithWine] = {400, Item.glass} +M.drinkList[Item.glassWithMead] = {500, Item.glass} +M.drinkList[Item.glassWithCider] = {400, Item.glass} +M.drinkList[Item.glassWithMilk] = {400, Item.glass} +M.drinkList[Item.glassWithFairywine] = {1000, Item.glass} + +M.drinkList[Item.beerMug] = {200, 1907} +M.drinkList[1907] = {200, 1910} -- nearly full beer mug +M.drinkList[1910] = {200, 1906} -- half full beer mug +M.drinkList[1906] = {200, Item.glassMug} -- nearly empty beer mug + +M.drinkList[Item.clayBeerMugFull] = {400, Item.clayBeerMugHalf} +M.drinkList[Item.clayBeerMugHalf] = {400, Item.clayMug} + +M.drinkList[Item.bottleOfBlackberryJuice] = {500, Item.emptyJuiceBottle} +M.drinkList[Item.bottleOfStrawberryJuice] = {500, Item.emptyJuiceBottle} +M.drinkList[Item.blueberryJuice] = {500, Item.emptyJuiceBottle} +M.drinkList[Item.cloudberryJuice] = {500, Item.emptyJuiceBottle} +M.drinkList[Item.raspberryJuice] = {500, Item.emptyJuiceBottle} +M.drinkList[Item.deerberryJuice] = {500, Item.emptyJuiceBottle} +M.drinkList[Item.elderberryJuice] = {500, Item.emptyJuiceBottle} + +M.drinkList[Item.bottleOfCabbageJuice] = {500, Item.vegetableJuiceBottle} +M.drinkList[Item.bottleOfCarrotJuice] = {500, Item.vegetableJuiceBottle} +M.drinkList[Item.bellpepperJuice] = {500, Item.vegetableJuiceBottle} +M.drinkList[Item.cucumberJuice] = {500, Item.vegetableJuiceBottle} +M.drinkList[Item.pumpkinJuice] = {500, Item.vegetableJuiceBottle} +M.drinkList[Item.tomatoJuice] = {500, Item.vegetableJuiceBottle} + +M.drinkList[Item.bottleOfGrapeJuice] = {500, Item.fruitJuiceBottle} +M.drinkList[Item.bottleOfOrangeJuice] = {500, Item.fruitJuiceBottle} +M.drinkList[Item.bottleOfTangerineJuice] = {500, Item.fruitJuiceBottle} +M.drinkList[Item.bottleOfBananaJuice] = {500, Item.fruitJuiceBottle} +M.drinkList[Item.appleJuice] = {500, Item.fruitJuiceBottle} +M.drinkList[Item.cherryJuice] = {500, Item.fruitJuiceBottle} +M.drinkList[Item.pearJuice] = {500, Item.fruitJuiceBottle} +M.drinkList[Item.mangoJuice] = {500, Item.fruitJuiceBottle} +M.drinkList[Item.peachJuice] = {500, Item.fruitJuiceBottle} +M.drinkList[Item.plumJuice] = {500, Item.fruitJuiceBottle} +M.drinkList[Item.pineappleJuice] = {500, Item.fruitJuiceBottle} + + +M.drinkList[Item.clayShotGlassWithAbsinthe] = {800, Item.clayShotGlass} +M.drinkList[Item.clayShotGlassWithBearSlayer] = {800, Item.clayShotGlass} +M.drinkList[Item.clayShotGlassWithBerryBooze] = {800, Item.clayShotGlass} +M.drinkList[Item.clayShotGlassWithCherrySchnapps] = {800, Item.clayShotGlass} +M.drinkList[Item.clayShotGlassWithElvenWine] = {800, Item.clayShotGlass} +M.drinkList[Item.clayShotGlassWithMulledWine] = {800, Item.clayShotGlass} +M.drinkList[Item.clayShotGlassWithOrangeSchnapps] = {800, Item.clayShotGlass} +M.drinkList[Item.clayShotGlassWithStoneFace] = {800, Item.clayShotGlass} + +M.drinkList[Item.ceramicShotGlassWithAbsinthe] = {800, Item.ceramicShotGlass} +M.drinkList[Item.ceramicShotGlassWithBearSlayer] = {800, Item.ceramicShotGlass} +M.drinkList[Item.ceramicShotGlassWithBerryBooze] = {800, Item.ceramicShotGlass} +M.drinkList[Item.ceramicShotGlassWithCherrySchnapps] = {800, Item.ceramicShotGlass} +M.drinkList[Item.ceramicShotGlassWithElvenWine] = {800, Item.ceramicShotGlass} +M.drinkList[Item.ceramicShotGlassWithMulledWine] = {800, Item.ceramicShotGlass} +M.drinkList[Item.ceramicShotGlassWithOrangeSchnapps] = {800, Item.ceramicShotGlass} +M.drinkList[Item.ceramicShotGlassWithStoneFace] = {800, Item.ceramicShotGlass} +M.drinkList[Item.ironShotGlassWithAbsinthe] = {800, Item.ironShotGlass} +M.drinkList[Item.ironShotGlassWithBearSlayer] = {800, Item.ironShotGlass} +M.drinkList[Item.ironShotGlassWithBerryBooze] = {800, Item.ironShotGlass} +M.drinkList[Item.ironShotGlassWithCherrySchnapps] = {800, Item.ironShotGlass} +M.drinkList[Item.ironShotGlassWithElvenWine] = {800, Item.ironShotGlass} +M.drinkList[Item.ironShotGlassWithMulledWine] = {800, Item.ironShotGlass} +M.drinkList[Item.ironShotGlassWithOrangeSchnapps] = {800, Item.ironShotGlass} +M.drinkList[Item.ironShotGlassWithStoneFace] = {800, Item.ironShotGlass} + +M.drinkList[Item.copperShotGlassWithAbsinthe] = {800, Item.copperShotGlass} +M.drinkList[Item.copperShotGlassWithBearSlayer] = {800, Item.copperShotGlass} +M.drinkList[Item.copperShotGlassWithBerryBooze] = {800, Item.copperShotGlass} +M.drinkList[Item.copperShotGlassWithCherrySchnapps] = {800, Item.copperShotGlass} +M.drinkList[Item.copperShotGlassWithElvenWine] = {800, Item.copperShotGlass} +M.drinkList[Item.copperShotGlassWithMulledWine] = {800, Item.copperShotGlass} +M.drinkList[Item.copperShotGlassWithOrangeSchnapps] = {800, Item.copperShotGlass} +M.drinkList[Item.copperShotGlassWithStoneFace] = {800, Item.copperShotGlass} + +M.drinkList[Item.silverShotGlassWithAbsinthe] = {800, Item.silverShotGlass} +M.drinkList[Item.silverShotGlassWithBearSlayer] = {800, Item.silverShotGlass} +M.drinkList[Item.silverShotGlassWithBerryBooze] = {800, Item.silverShotGlass} +M.drinkList[Item.silverShotGlassWithCherrySchnapps] = {800, Item.silverShotGlass} +M.drinkList[Item.silverShotGlassWithElvenWine] = {800, Item.silverShotGlass} +M.drinkList[Item.silverShotGlassWithMulledWine] = {800, Item.silverShotGlass} +M.drinkList[Item.silverShotGlassWithOrangeSchnapps] = {800, Item.silverShotGlass} +M.drinkList[Item.silverShotGlassWithStoneFace] = {800, Item.silverShotGlass} + +M.drinkList[Item.goldShotGlassWithAbsinthe] = {800, Item.goldShotGlass} +M.drinkList[Item.goldShotGlassWithBearSlayer] = {800, Item.goldShotGlass} +M.drinkList[Item.goldShotGlassWithBerryBooze] = {800, Item.goldShotGlass} +M.drinkList[Item.goldShotGlassWithCherrySchnapps] = {800, Item.goldShotGlass} +M.drinkList[Item.goldShotGlassWithElvenWine] = {800, Item.goldShotGlass} +M.drinkList[Item.goldShotGlassWithMulledWine] = {800, Item.goldShotGlass} +M.drinkList[Item.goldShotGlassWithOrangeSchnapps] = {800, Item.goldShotGlass} +M.drinkList[Item.goldShotGlassWithStoneFace] = {800, Item.goldShotGlass} + +M.drinkList[Item.shotGlassWithAbsinthe] = {800, Item.shotGlass} +M.drinkList[Item.shotGlassWithBearSlayer] = {800, Item.shotGlass} +M.drinkList[Item.shotGlassWithBerryBooze] = {800, Item.shotGlass} +M.drinkList[Item.shotGlassWithCherrySchnapps] = {800, Item.shotGlass} +M.drinkList[Item.shotGlassWithElvenWine] = {800, Item.shotGlass} +M.drinkList[Item.shotGlassWithMulledWine] = {800, Item.shotGlass} +M.drinkList[Item.shotGlassWithOrangeSchnapps] = {800, Item.shotGlass} +M.drinkList[Item.shotGlassWithStoneFace] = {800, Item.shotGlass} + +M.drinkList[Item.clayTeaCupDruid] = {1000, Item.clayTeaCup} +M.drinkList[Item.clayTeaCupFirNeedle] = {1000, Item.clayTeaCup} +M.drinkList[Item.clayTeaCupGreen] = {1000, Item.clayTeaCup} +M.drinkList[Item.clayTeaCupVirginWeed] = {1000, Item.clayTeaCup} + +M.drinkList[Item.ceramicTeaCupDruid] = {1000, Item.ceramicTeaCup} +M.drinkList[Item.ceramicTeaCupFirNeedle] = {1000, Item.ceramicTeaCup} +M.drinkList[Item.ceramicTeaCupGreen] = {1000, Item.ceramicTeaCup} +M.drinkList[Item.ceramicTeaCupVirginWeed] = {1000, Item.ceramicTeaCup} + +M.drinkList[Item.ironTeaCupDruid] = {1000, Item.ironTeaCup} +M.drinkList[Item.ironTeaCupFirNeedle] = {1000, Item.ironTeaCup} +M.drinkList[Item.ironTeaCupGreen] = {1000, Item.ironTeaCup} +M.drinkList[Item.ironTeaCupVirginWeed] = {1000, Item.ironTeaCup} + +M.drinkList[Item.copperTeaCupDruid] = {1000, Item.copperTeaCup} +M.drinkList[Item.copperTeaCupFirNeedle] = {1000, Item.copperTeaCup} +M.drinkList[Item.copperTeaCupGreen] = {1000, Item.copperTeaCup} +M.drinkList[Item.copperTeaCupVirginWeed] = {1000, Item.copperTeaCup} + +M.drinkList[Item.silverTeaCupDruid] = {1000, Item.silverTeaCup} +M.drinkList[Item.silverTeaCupFirNeedle] = {1000, Item.silverTeaCup} +M.drinkList[Item.silverTeaCupGreen] = {1000, Item.silverTeaCup} +M.drinkList[Item.silverTeaCupVirginWeed] = {1000, Item.silverTeaCup} + +M.drinkList[Item.goldTeaCupDruid] = {1000, Item.goldTeaCup} +M.drinkList[Item.goldTeaCupFirNeedle] = {1000, Item.goldTeaCup} +M.drinkList[Item.goldTeaCupGreen] = {1000, Item.goldTeaCup} +M.drinkList[Item.goldTeaCupVirginWeed] = {1000, Item.goldTeaCup} + +M.drinkList[Item.glassTeaCupDruid] = {1000, Item.glassTeaCup} +M.drinkList[Item.glassTeaCupFirNeedle] = {1000, Item.glassTeaCup} +M.drinkList[Item.glassTeaCupGreen] = {1000, Item.glassTeaCup} +M.drinkList[Item.glassTeaCupVirginWeed] = {1000, Item.glassTeaCup} + + +function M.UseItem(user, SourceItem) if user.attackmode then common.InformNLS( user, "Du würdest alles verschütten.", "You'd spill everything.") return end - -- item should not be static if SourceItem.wear == 255 then common.HighInformNLS(user, @@ -96,8 +239,9 @@ function M.UseItem(user, SourceItem) return end - local food = M.drinkList[SourceItem.id] - if (food == nil) then + local drink = M.drinkList[SourceItem.id] + + if not drink then user:inform("Unknown drinking Item: ID"..SourceItem.id.." Please Report this to a developer.") return end @@ -108,14 +252,14 @@ function M.UseItem(user, SourceItem) common.InformNLS( user, customInformDE, customInformEN) end - local foodLevel = user:increaseAttrib("foodlevel", 0) + food[1] + local foodLevel = user:increaseAttrib("foodlevel", 0) + drink[1] world:makeSound(12, user.pos) -- drink sound if math.random(50) <= 1 then common.InformNLS( user, "Das alte Geschirr ist nicht mehr brauchbar.", "The old dishes are no longer usable.") else local dataCopy = {descriptionDe=SourceItem:getData("descriptionDe"), descriptionEn=SourceItem:getData("descriptionEn")} - common.CreateItem(user, food[2], 1, 333, dataCopy) -- create the remnant item + common.CreateItem(user, drink[2], 1, 333, dataCopy) -- create the remnant item end world:erase(SourceItem, 1) @@ -123,7 +267,7 @@ function M.UseItem(user, SourceItem) common.InformNLS( user, "Du hast genug getrunken.", "You have had enough to drink.") elseif foodLevel > 40000 then common.InformNLS( user, "Du schaffst es nicht noch mehr zu trinken.", "You cannot drink anything else.") - foodLevel = foodLevel - food[1] + foodLevel = foodLevel - drink[1] end if user:increaseAttrib("foodlevel", 0) ~= foodLevel then