mirror of
https://github.com/ErikasKontenis/SabrehavenServer.git
synced 2025-04-30 01:29:21 +02:00
16 lines
545 B
Lua
16 lines
545 B
Lua
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
|