diff --git a/data/actions/actions.xml b/data/actions/actions.xml index 26bc8ee..9e4accd 100644 --- a/data/actions/actions.xml +++ b/data/actions/actions.xml @@ -146,6 +146,7 @@ + diff --git a/data/actions/scripts/misc/dice.lua b/data/actions/scripts/misc/dice.lua new file mode 100644 index 0000000..f237519 --- /dev/null +++ b/data/actions/scripts/misc/dice.lua @@ -0,0 +1,15 @@ +function onUse(player, item, fromPosition, target, toPosition, isHotkey) + local dicePosition = item:getPosition() + local value = math.random(6) + local isInGhostMode = player:isInGhostMode() + + dicePosition:sendMagicEffect(CONST_ME_CRAPS, isInGhostMode and player) + + local spectators = Game.getSpectators(dicePosition, false, true, 3, 3) + for i = 1, #spectators do + player:say(player:getName() .. " rolled a " .. value .. ".", TALKTYPE_MONSTER_SAY, isInGhostMode, spectators[i], dicePosition) + end + + item:transform(5791 + value) + return true +end diff --git a/data/items/items.srv b/data/items/items.srv index 8aaff20..3105452 100644 --- a/data/items/items.srv +++ b/data/items/items.srv @@ -26110,7 +26110,7 @@ TypeID = 5786 Name = "a wooden whistle" Flags = {Take} Attributes = {Weight=100} -# pradzia nuo cia + TypeID = 5787 Name = "a training dummy" Flags = {Unpass,Unmove,Unlay} @@ -26129,37 +26129,37 @@ Flags = {Unmove} TypeID = 5791 Name = "a stuffed dragon" -Flags = {Take} +Flags = {UseEvent,Take} Attributes = {Weight=850} TypeID = 5792 -Name = "a die" -Flags = {Take} -Attributes = {Weight=200} # TODO: implement like in tibia wiki says +Name = "a dice" +Flags = {UseEvent,Take} +Attributes = {Weight=200} TypeID = 5793 -Name = "a die" -Flags = {Take} +Name = "a dice" +Flags = {UseEvent,Take} Attributes = {Weight=200} TypeID = 5794 -Name = "a die" -Flags = {Take} +Name = "a dice" +Flags = {UseEvent,Take} Attributes = {Weight=200} TypeID = 5795 -Name = "a die" -Flags = {Take} +Name = "a dice" +Flags = {UseEvent,Take} Attributes = {Weight=200} TypeID = 5796 -Name = "a die" -Flags = {Take} +Name = "a dice" +Flags = {UseEvent,Take} Attributes = {Weight=200} TypeID = 5797 -Name = "a die" -Flags = {Take} +Name = "a dice" +Flags = {UseEvent,Take} Attributes = {Weight=200} TypeID = 5798 diff --git a/data/npc/zebron.npc b/data/npc/zebron.npc index d92417b..e5a98e4 100644 --- a/data/npc/zebron.npc +++ b/data/npc/zebron.npc @@ -40,11 +40,22 @@ VANISH,! -> "Hey, you can't leave. Luck is smiling on you. I can feel "game" -> * "dice" -> * -Topic=1,"yes" -> "I will roll a dice. If it shows 6, you will get five times your bet. How much do you want to bet?", Amount=Random(1,6), Topic=2 +Topic=1,"yes" -> "Hmmm, would you like to play for money or for a chance to win your own dice?", Topic=3 Topic=1,"no" -> "Oh come on, don't be a child." -Topic=2,%1,0<%1,100>%1,CountMoney>=%1,Amount=6 -> Price=%1*5, "Ok, here we go ... 6! You have won %P, congratulations. One more game?", CreateMoney, Topic=1 -Topic=2,%1,0<%1,100>%1,CountMoney>=%1 -> Price=%1, "Ok, here we go ... %A! You have lost. Bad luck. One more game?", DeleteMoney, Topic=1 +Topic=3,"money" -> "I thought so. Okay, I will roll a dice. If it shows 6, you will get five times your bet. How much do you want to bet?", Amount=Random(1,6), Topic=2 +Topic=3,"dice" -> "Hehe, good choice. Okay, the price for this game is 100 gold pieces. I will roll a dice. If I roll a 6, you can have my dice. Agreed?", Amount=Random(1,6), Topic=4 + +Topic=6,"yes" -> "Okay, I will roll a dice. If it shows 6, you will get five times your bet. How much do you want to bet?", Amount=Random(1,6), Topic=2 +Topic=6,"no" -> "Oh come on, don't be a child." +Topic=2,%1,0<%1,100>%1,CountMoney>=%1,Amount=6 -> Price=%1*5, "Ok, here we go ... 6! You have won %P, congratulations. One more game?", CreateMoney, EffectMe(27), Topic=6 +Topic=2,%1,0<%1,100>%1,CountMoney>=%1 -> Price=%1, "Ok, here we go ... %A! You have lost. Bad luck. One more game?", DeleteMoney, EffectMe(27), Topic=6 Topic=2,%1,0<%1,100>%1 -> "I am sorry, but you don't have so much money. How much do you want to bet?", Topic=2 Topic=2,%1 -> "I am sorry, but I accept only bets between 1 and 99 gold. I don't want to ruin you after all. How much do you want to bet?", Topic=2 + +Topic=5,"yes" -> "Okay, the price for this game is 100 gold pieces. I will roll a dice. If I roll a 6, you can have my dice. Agreed?", Amount=Random(1,6), Topic=4 +Topic=5,"no" -> "Oh come on, don't be a child." +Topic=4,"yes",CountMoney>=100,Amount=6 -> Price=100, Type=5792, Amount=1, "Ok, here we go ... 6! You have won a dice, congratulations. One more game?", DeleteMoney, Create(Type), EffectMe(27), Topic=5 +Topic=4,"yes",CountMoney>=100 -> Price=100, "Ok, here we go ... %A! You have lost. Bad luck. One more game?", DeleteMoney, EffectMe(27), Topic=5 +Topic=4,"yes" -> "I am sorry, but you don't have so much money." } diff --git a/src/const.h b/src/const.h index 0fffaa3..b6c28a3 100644 --- a/src/const.h +++ b/src/const.h @@ -50,6 +50,8 @@ enum MagicEffectClasses : uint8_t { CONST_ME_SOUND_PURPLE = 23, CONST_ME_SOUND_BLUE = 24, CONST_ME_SOUND_WHITE = 25, + CONST_ME_BUBBLES = 26, + CONST_ME_CRAPS = 27, }; enum ShootType_t : uint8_t { diff --git a/src/luascript.cpp b/src/luascript.cpp index bfb34fc..509f4ff 100644 --- a/src/luascript.cpp +++ b/src/luascript.cpp @@ -1189,6 +1189,8 @@ void LuaScriptInterface::registerFunctions() registerEnum(CONST_ME_SOUND_PURPLE) registerEnum(CONST_ME_SOUND_BLUE) registerEnum(CONST_ME_SOUND_WHITE) + registerEnum(CONST_ME_BUBBLES) + registerEnum(CONST_ME_CRAPS) registerEnum(CONST_ANI_NONE) registerEnum(CONST_ANI_SPEAR) registerEnum(CONST_ANI_BOLT) diff --git a/src/tools.cpp b/src/tools.cpp index cfc6174..a5a80f8 100644 --- a/src/tools.cpp +++ b/src/tools.cpp @@ -646,6 +646,8 @@ MagicEffectNames magicEffectNames[] = { {"purplenote", CONST_ME_SOUND_PURPLE}, {"bluenote", CONST_ME_SOUND_BLUE}, {"whitenote", CONST_ME_SOUND_WHITE}, + {"bubbles", CONST_ME_BUBBLES}, + {"dice", CONST_ME_CRAPS}, }; ShootTypeNames shootTypeNames[] = {