Skip to content

Commit

Permalink
refactor: centralize storage store coins/wheel scrolls to the core (#…
Browse files Browse the repository at this point in the history
…2284)

Moved scripts to core and added warning log to the tibia coins item, as
players should not have access to this item.
  • Loading branch information
omarcopires authored Feb 22, 2024
1 parent 520a539 commit c798b3c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
local storeCoin = Action()

function storeCoin.onUse(player, item, fromPosition, target, toPosition, isHotkey)
player:getPosition():sendMagicEffect(CONST_ME_MAGIC_GREEN)
local count = item:getCount()
item:remove()
player:addTransferableCoins(count)
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You have added " .. count .. " tibia coins to your balance. Your total is now " .. player:getTransferableCoins() .. ".")
player:getPosition():sendMagicEffect(CONST_ME_MAGIC_GREEN)
item:remove()

logger.warn("[StoreCoinScript - ITEM_STORE_COIN] The player {} used the item to store Tibia Coins.", player:getName())
return true
end

storeCoin:id(ITEM_STORE_COIN)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ function scroll.onUse(player, item, fromPosition, target, toPosition, isHotkey)
player:setStorageValueByName(scrollData.storageName, 1)
player:sendTextMessage(MESSAGE_LOOK, "You have gained " .. scrollData.points .. " promotion points for the Wheel of Destiny by deciphering the " .. scrollData.name .. ".")
item:remove(1)

return true
end

Expand Down

0 comments on commit c798b3c

Please sign in to comment.