local chests = {
[9008] = {itemid = 2495, count = 1},
[9009] = {itemid = 8905, count = 1},
[9010] = {itemid = 16111, count = 1},
}
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
if chests[item.uid] then
if player:getStorageValue(9999) ~= 0 then
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'It\'s empty.')
return true
end
local chest = chests[item.uid]
local itemType = ItemType(chest.itemid)
if itemType then
local article = itemType:getArticle()
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'You have found ' .. (#article > 0 and article .. ' ' or '') .. itemType:getName() .. '.')
end
player:addItem(chest.itemid, chest.count)
player:setStorageValue(9999,1)
end
elseif chest[9012] and player:getStorageValue(9990) ~= 1 then
player:addMount(MountID)
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'You get a new Mount.')
player:setStorageValue(9999,1)
else
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'It\'s empty.')
return true
end
end