From 9c5db41fd9de387bd021726b30ee9db870ccd4cc Mon Sep 17 00:00:00 2001 From: ErikasKontenis Date: Mon, 25 Nov 2019 19:28:05 +0200 Subject: [PATCH] implement juice squeezer and few new 781 items --- data/actions/actions.xml | 2 ++ data/actions/scripts/misc/fluids.lua | 6 +++--- data/actions/scripts/misc/juice_squeezer.lua | 9 +++++++++ data/items/items.srv | 9 ++++++--- data/npc/brasith.npc | 2 ++ data/npc/livielle.npc | 2 ++ src/const.h | 1 + src/luascript.cpp | 1 + src/tools.cpp | 4 +++- 9 files changed, 29 insertions(+), 7 deletions(-) create mode 100644 data/actions/scripts/misc/juice_squeezer.lua diff --git a/data/actions/actions.xml b/data/actions/actions.xml index 0421a7c..c6379a7 100644 --- a/data/actions/actions.xml +++ b/data/actions/actions.xml @@ -176,6 +176,7 @@ + @@ -214,6 +215,7 @@ + diff --git a/data/actions/scripts/misc/fluids.lua b/data/actions/scripts/misc/fluids.lua index 79f5465..4d8160f 100644 --- a/data/actions/scripts/misc/fluids.lua +++ b/data/actions/scripts/misc/fluids.lua @@ -23,7 +23,8 @@ local messages = { [FLUID_LIFEFLUID] = "Aaaah...", [FLUID_LEMONADE] = "Mmmh.", [FLUID_RUM] = "Aah...", - [FLUID_COCONUTMILK] = "Mmmh." + [FLUID_COCONUTMILK] = "Mmmh.", + [FLUID_FRUITJUICE] = "Mmmh." } function onUse(player, item, fromPosition, target, toPosition) @@ -34,8 +35,7 @@ function onUse(player, item, fromPosition, target, toPosition) item:transform(item:getId(), 0) return true elseif target:getFluidType() ~= 0 and item:getFluidType() == 0 then - target:transform(target:getId(), 0) - item:transform(item:getId(), target:getFluidType()) + player:sendCancelMessage("You cannot use this object.") return true end end diff --git a/data/actions/scripts/misc/juice_squeezer.lua b/data/actions/scripts/misc/juice_squeezer.lua new file mode 100644 index 0000000..9827692 --- /dev/null +++ b/data/actions/scripts/misc/juice_squeezer.lua @@ -0,0 +1,9 @@ +local fruits = {3584, 3585, 3586, 3587, 3588, 3589, 3590, 3591, 3592, 3593, 3595, 3596, 5096} + +function onUse(player, item, fromPosition, target, toPosition, isHotkey) + if isInArray(fruits, target.itemid) and player:removeItem(2874, 1, 0) then + target:remove(1) + player:addItem(2874, target.itemid == 3589 and 14 or 15) + return true + end +end \ No newline at end of file diff --git a/data/items/items.srv b/data/items/items.srv index 4214cc3..d634e0e 100644 --- a/data/items/items.srv +++ b/data/items/items.srv @@ -43,6 +43,9 @@ Name = "rum" TypeID = 14 Name = "coconut milk" +TypeID = 15 +Name = "fruit juice" + # --- end of server specific object types --- TypeID = 100 @@ -26474,11 +26477,11 @@ Flags = {Unmove} TypeID = 5864 Name = "" # this is nothing in client -# pradzia nuo cia jau reikia implementuoti juiceri + TypeID = 5865 Name = "a juice squeezer" Flags = {Take} -Attributes = {Weight=1500} # TODO: Implement like in tibia wiki +Attributes = {Weight=1500} TypeID = 5866 Name = "rubble" @@ -26515,7 +26518,7 @@ Flags = {Unmove} TypeID = 5874 Name = "a poison trickle" Flags = {Unmove} - +# pradeti nuo cia ir nepamirsti implementuoti visiem npc ir monstram TypeID = 5875 Name = "sniper gloves" Description = "They are the pride of the paladin guild" diff --git a/data/npc/brasith.npc b/data/npc/brasith.npc index 02637c0..c217374 100644 --- a/data/npc/brasith.npc +++ b/data/npc/brasith.npc @@ -59,6 +59,7 @@ VANISH,! -> "Asha Thrazi." "strawberry" -> Type=3591, Amount=1, Price=1, "Do you want to buy a strawberry for %P gold?", Topic=1 "carrot" -> Type=3595, Amount=1, Price=3, "Do you want to buy a carrot for %P gold?", Topic=1 "pumpkin" -> Type=3594, Amount=1, Price=10, "Do you want to buy a pumpkin for %P gold?", Topic=1 +"juice squeezer" -> Type=5865, Amount=1, Price=100, "Do you want to buy a juice squeezer for %P gold?", Topic=1 %1,1<%1,"corncob" -> Type=3597, Amount=%1, Price=3*%1, "Do you want to buy %A corncobs for %P gold?", Topic=1 %1,1<%1,"cherr" -> Type=3590, Amount=%1, Price=1*%1, "Do you want to buy %A cherries for %P gold?", Topic=1 @@ -68,6 +69,7 @@ VANISH,! -> "Asha Thrazi." %1,1<%1,"strawberries" -> Type=3591, Amount=%1, Price=1*%1, "Do you want to buy %A strawberries for %P gold?", Topic=1 %1,1<%1,"carrot" -> Type=3595, Amount=%1, Price=3*%1, "Do you want to buy %A carrots for %P gold?", Topic=1 %1,1<%1,"pumpkin" -> Type=3594, Amount=%1, Price=10*%1, "Do you want to buy %A pumpkins for %P gold?", Topic=1 +%1,1<%1,"juice squeezer" -> Type=5865, Amount=%1, Price=100*%1, "Do you want to buy %A juice squeezers for %P gold?", Topic=1 "bugmilk" -> Type=2875, Data=9, Amount=1, Price=15, "Do you want to buy a bottle of bugmilk for %P gold?", Topic=1 diff --git a/data/npc/livielle.npc b/data/npc/livielle.npc index b241e7f..e967651 100644 --- a/data/npc/livielle.npc +++ b/data/npc/livielle.npc @@ -45,6 +45,7 @@ VANISH,! -> "Aww, I don't even deserve a farewell?" "pumpkin" -> Type=3594, Amount=1, Price=10, "Do you want to buy a pumpkin for %P gold?", Topic=1 "blueberr" -> Type=3588, Amount=1, Price=1, "Do you want to buy a blueberry for %P gold?", Topic=1 "mango" -> Type=5096, Amount=1, Price=10, "Do you want to buy a mango for %P gold?", Topic=1 +"juice squeezer" -> Type=5865, Amount=1, Price=100, "Do you want to buy a juice squeezer for %P gold?", Topic=1 %1,1<%1,"banana" -> Type=3587, Amount=%1, Price=5*%1, "Do you want to buy %A bananas for %P gold?", Topic=1 %1,1<%1,"white","mushroom" -> Type=3723, Amount=%1, Price=10*%1, "Do you want to buy %A of the white mushrooms for %P gold?", Topic=1 @@ -54,6 +55,7 @@ VANISH,! -> "Aww, I don't even deserve a farewell?" %1,1<%1,"pumpkin" -> Type=3594, Amount=%1, Price=10*%1, "Do you want to buy %A pumpkins for %P gold?", Topic=1 %1,1<%1,"blueberr" -> Type=3588, Amount=%1, Price=1*%1, "Do you want to buy %A blueberries for %P gold?", Topic=1 %1,1<%1,"mango" -> Type=5096, Amount=%1, Price=10*%1, "Do you want to buy %A mangos for %P gold?", Topic=1 +%1,1<%1,"juice squeezer" -> Type=5865, Amount=%1, Price=100*%1, "Do you want to buy %A juice squeezers for %P gold?", Topic=1 Topic=1,"yes",CountMoney>=Price -> "Merci, 'ere you go.", DeleteMoney, Create(Type) Topic=1,"yes" -> "Sorry, but that's not enough money, please count again." diff --git a/src/const.h b/src/const.h index b6c28a3..fd9107c 100644 --- a/src/const.h +++ b/src/const.h @@ -126,6 +126,7 @@ enum FluidTypes_t : uint8_t FLUID_LEMONADE, FLUID_RUM, FLUID_COCONUTMILK, + FLUID_FRUITJUICE, }; enum FluidColor_t : uint8_t diff --git a/src/luascript.cpp b/src/luascript.cpp index 509f4ff..4338a6b 100644 --- a/src/luascript.cpp +++ b/src/luascript.cpp @@ -1411,6 +1411,7 @@ void LuaScriptInterface::registerFunctions() registerEnum(FLUID_LEMONADE) registerEnum(FLUID_RUM) registerEnum(FLUID_COCONUTMILK) + registerEnum(FLUID_FRUITJUICE) registerEnum(TALKTYPE_SAY) registerEnum(TALKTYPE_WHISPER) diff --git a/src/tools.cpp b/src/tools.cpp index a5a80f8..84560bc 100644 --- a/src/tools.cpp +++ b/src/tools.cpp @@ -220,6 +220,7 @@ uint8_t getLiquidColor(uint8_t type) break; case FLUID_URINE: case FLUID_LEMONADE: + case FLUID_FRUITJUICE: result = FLUID_COLOR_YELLOW; break; default: @@ -723,7 +724,8 @@ FluidNames fluidNames[] = { {"lifefluid", FLUID_LIFEFLUID}, {"lemonade", FLUID_LEMONADE}, {"rum", FLUID_RUM}, - {"coconutmilk", FLUID_COCONUTMILK} + {"coconutmilk", FLUID_COCONUTMILK}, + {"fruitjuice", FLUID_FRUITJUICE} }; MagicEffectClasses getMagicEffect(const std::string& strValue)