1function onUse(player, item, fromPosition, target, toPosition, isHotkey)
2 if _DEBUG_MODE then
3 print("[ACTION - CAJA CENTRAL] " ..player:getName().. " - Abrindo Caja Central")
4 end
5 local G = PlayerGoldCoins(player, 00)
6 local tutor = 0
7 if player:getStorageValue(_QUESTLOG[06].UID_01) > 0 and player:getStorageValue(_QUESTLOG[06].UID_01) < 100 then
8 tutor = 1
9 end
10
11
12 local slot = 03
13 local ext = 00
14 local totalDesconto = 00
15 if Game.getStorageValue(_GLOBAL_RANDOM.DAILY_EVENTS.STORAGE) == 04 then
16 local players = Game.getPlayers()
17 for _, targetPlayer in ipairs(players) do
18 totalDesconto = totalDesconto + 01
19 end
20 end
21
22 doBackpack(player, 00, slot, ext, 01)
23 player:sendCancelMessage("@OpenSellComboBox")
24 player:sendCancelMessage("@CentralBox " ..G.. " " ..tutor.. " " .. 0 .. " " ..math.floor(totalDesconto / 2))
25 player:sendCancelMessage("@closedBackpack")
26end
27