local config = {
[40407] = {changeTo = ITEM_CRYSTAL_COIN},
[ITEM_CRYSTAL_COIN] = {changeBack = 40407}
}
local changegold = Action()
function changegold.onUse(player, item, fromPosition, itemEx, toPosition, isHotkey)
local coin = config[item.itemid]
if not coin then
return false
end
if coin.changeTo and item.type == 1 then
item:remove()
player:addItem(coin.changeTo, 5)
elseif coin.changeBack then
item:transform(item.itemid, item.type - 5)
player:addItem(coin.changeBack, 1)
else
return false
end
return true
end
changegold:id(40407, 2160)
changegold:register()
5cc to 1 pirate coin and back, but when i have less than 5cc like 1-4 it makes 255c by click, why?