local specialQuests = {
[2001] = 30015 --Annihilator
}
local questsExperience = {
[30015] = 10000
}
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
local storage = specialQuests[item:getActionId()]
if not storage then
storage = item:getUniqueId()
if storage > 65535 then
return false
end
end
if player:getStorageValue(storage) > 0 then
player:sendTextMessage(MESSAGE_INFO_DESCR, "It is empty.")
return true
end
if itemType:isContainer() == true then
items = container:getItems()
rewardWeight = items[2]
local itemType = ItemType(item:getId())
local container = Container(item.uid)
local playerCap = player:getFreeCapacity() / 100
local items = {}
local rewardWeight = 0
if playerCap < rewardWeight then
player:sendTextMessage(MESSAGE_INFO_DESCR, 'You have found ' .. items[1][1]:getArticle() .. ' ' .. items[1][1]:getName() .. ' weighing ' .. rewardWeight .. ' oz it\'s too heavy.')
return true
end
items = items[1]
size = table.maxn(items)
if size == 1 then
local item = items[1]
local count = item:getCount()
local rewardContainer = Container(item.uid)
if rewardContainer ~= nil then
bag = player:addItem(item:getId(), 1)
local rewardItems = rewardContainer:getItems()[1]
for i = 1, #rewardItems do
bag:addItem(rewardItems[i]:getId(), rewardItems[i]:getCount())
end
else
player:addItem(item:getId(), count)
end
player:setStorageValue(storage, 1)
if count > 1 then
player:sendTextMessage(MESSAGE_INFO_DESCR, 'You have found ' .. count .. ' ' .. item:getPluralName() .. '.')
else
player:sendTextMessage(MESSAGE_INFO_DESCR, 'You have found a ' .. item:getName() .. '.')
end
end
end
return true
end