T
Tibia Demon
Guest
Is it possible instead of returning the amount of gold coins to return the money name? like
I tried to add it to script like this.
Here is the full script
You have bought an amulet of loss for 5 crystal coins, 3 platinum coins and 70 gold coins
I tried to add it to script like this.
Lua:
if not player:removeTotalMoney(config.shopItem.cost) then
player:sendTextMessage(MESSAGE_INFO_DESCR, 'You need '.. config.shopItem.cost ..' gold coins to buy '.. config.itemType:getName() .. '.')
player:getPosition():sendMagicEffect(CONST_ME_POFF)
return false
end
Lua:
local shop = {
[13337] = {id = 12325, cost = 20, count = 1},
[2081] = {id = 8300, cost = 30, count = 1},
[2082] = {id = 12662, cost = 50, count = 5},
}
local AolSHOP = Action()
function AolSHOP.onUse(player, item, fromPosition, target, toPosition, isHotkey)
local config = {}
local AolSHOP = shop[item:getActionId()]
config.shopItem = shop[item:getActionId()]
config.itemType = ItemType(config.shopItem.id)
if not player:removeTotalMoney(config.shopItem.cost) then
player:sendTextMessage(MESSAGE_INFO_DESCR, 'You need '.. config.shopItem.cost ..' gold coins to buy '.. config.itemType:getName() .. '.')
player:getPosition():sendMagicEffect(CONST_ME_POFF)
return false
end
player:addItem(config.shopItem.id, config.shopItem.count)
player:sendTextMessage(MESSAGE_INFO_DESCR, 'You bought a '.. config.itemType:getName() .. '.')
player:getPosition():sendMagicEffect(CONST_ME_MAGIC_BLUE)
return true
end
for k, v in pairs(shop) do
AolSHOP:aid(k)
end
AolSHOP:register()