local x = missions[player:getStorageValue(storage)]
local x = missions[player:getStorageValue(storage)]
if x then
if x then
selfSay(x.message.." "..getItemsMonstersFromTable(x.items or x.monsters)..".", cid)
selfSay(x.message.." "..getItemsMonstersFromTable(x.items or x.monsters)..".", cid)
else
else
selfSay("Well done! You did a great job on all your missions.", cid)
selfSay("Well done! You did a great job on all your missions.", cid)
end
end
else
else
local n = 0
local n = 0
for i = 1, #imtable do
for i = 1, #imtable do
local check = x.items and player:getItemCount(imtable[i].id) or player:getStorageValue(imtable[i].storage)
local check = x.items and player:getItemCount(imtable[i].id) or player:getStorageValue(imtable[i].storage)
if check < imtable[i].count then
if check < imtable[i].count then
n = n + 1
n = n + 1
end
end
end
end
local text = ""
local text = ""
local c = 0
local c = 0
for v = 1, #imtable do
for v = 1, #imtable do
local check = x.items and player:getItemCount(imtable[v].id) or player:getStorageValue(imtable[v].storage)
local check = x.items and player:getItemCount(imtable[v].id) or player:getStorageValue(imtable[v].storage)
if check < imtable[v].count then
if check < imtable[v].count then
c = c + 1
c = c + 1
local ret = ", "
local ret = ", "
if c == 1 then
if c == 1 then
ret = ""
ret = ""
elseif c == n then
elseif c == n then
ret = " and "
ret = " and "
end
end
text = text .. ret
text = text .. ret
if x.items then
if x.items then
local count, info = imtable[v].count - player:getItemCount(imtable[v].id), ItemType(imtable[v].id)
local count, info = imtable[v].count - player:getItemCount(imtable[v].id), ItemType(imtable[v].id)
text = text .. (count > 1 and count or info:getArticle()).." "..(count > 1 and info:getPluralName() or info:getName())
text = text .. (count > 1 and count or info:getArticle()).." "..(count > 1 and info:getPluralName() or info:getName())
else
else
local count = imtable[v].count - (player:getStorageValue(imtable[v].storage) + 1)
local count = imtable[v].count - (player:getStorageValue(imtable[v].storage) + 1)
text = text .. count.." "..imtable[v].name
text = text .. count.." "..imtable[v].name
end
end
end
end
end
end
selfSay(x.items and "You don't have all items, you still need to get "..text.."." or "You didn't kill all monsters, you still need to kill "..text..".", cid)
selfSay(x.items and "You don't have all items, you still need to get "..text.."." or "You didn't kill all monsters, you still need to kill "..text..".", cid)
end
end
end
end
npcHandler.topic[cid] = 0
npcHandler.topic[cid] = 0
elseif msgcontains(msg, 'no') and npcHandler.topic[cid] == 1 then
elseif msgcontains(msg, 'no') and npcHandler.topic[cid] == 1 then
selfSay("Oh well, I guess not then.", cid)
selfSay("Oh well, I guess not then.", cid)
npcHandler.topic[cid] = 0
npcHandler.topic[cid] = 0
end
end
return true
return true
end
end
npcHandler:setMessage(MESSAGE_FAREWELL, "Bye!")
npcHandler:setMessage(MESSAGE_FAREWELL, "Bye!")
npcHandler:setMessage(MESSAGE_WALKAWAY, "Good bye, have a nice day!")
npcHandler:setMessage(MESSAGE_WALKAWAY, "Good bye, have a nice day!")