local chests = {
[45868] = {itemid = 22398, count = 1},
[45869] = {itemid = 22401, count = 1},
[45870] = {itemid = 22404, count = 1},
[45871] = {itemid = 22410, count = 1},
[45872] = {itemid = 22416, count = 1},
[45873] = {itemid = 22419, count = 1},
[45874] = {itemid = 22422, count = 1}
}
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
if chests[item.uid] then
if player:getStorageValue(45875) == 1 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(45875, 1)
end
return true
end