local counter = getTileItemById(toPosition, 1617)
if counter.uid ~= 0 then
local itemid = item:getId()
local price = buyableItems[itemid]
if price then
if self:getMoney() >= price then
self:removeMoney(buyableItems[itemid])
self:addItem(itemid)
self:sendTextMessage(22,"You bought " .. item:getArticle() .." " .. item:getName() .. " for " .. price .. " gold.")
else
self:sendTextMessage(22,"You don't have enough gold to buy the " .. item:getName() .. ".")
end
else
self:sendTextMessage(22,"" .. item:getName() .. " is not buyable.")
end
return false
end