mirror of
https://github.com/ErikasKontenis/SabrehavenServer.git
synced 2025-04-30 01:29:21 +02:00
implement dice functionality
This commit is contained in:
parent
2a432da341
commit
b9b021ea58
@ -146,6 +146,7 @@
|
||||
<action fromid="3331" toid="3348" script="misc/weapons.lua" />
|
||||
<action itemid="3208" script="misc/weapons.lua" />
|
||||
<action itemid="3059" script="misc/spellbook.lua" />
|
||||
<action fromid="5792" toid="5797" script="misc/dice.lua" />
|
||||
|
||||
<!-- Dolls -->
|
||||
<action itemid="5080" script="misc/dolls.lua" />
|
||||
|
15
data/actions/scripts/misc/dice.lua
Normal file
15
data/actions/scripts/misc/dice.lua
Normal file
@ -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
|
@ -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
|
||||
|
@ -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."
|
||||
}
|
||||
|
@ -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 {
|
||||
|
@ -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)
|
||||
|
@ -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[] = {
|
||||
|
Loading…
x
Reference in New Issue
Block a user