implement dice functionality

This commit is contained in:
ErikasKontenis
2019-11-24 16:11:07 +02:00
parent 2a432da341
commit b9b021ea58
7 changed files with 51 additions and 18 deletions

View File

@@ -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" />

View 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