local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
function onCreatureAppear(player) npcHandler:onCreatureAppear(player) end
function onCreatureDisappear(player) npcHandler:onCreatureDisappear(player) end
function onCreatureSay(player, type, msg) npcHandler:onCreatureSay(player, type, msg) end
function onThink() npcHandler:onThink() end
function creatureSayCallback(player, type, msg)
if(not npcHandler:isFocused(player)) then
return false
end
if msgcontains(msg:lower(), 'mission') then
if isPremium(player) then --May not work in TFS 0.3.6. If not, use 'if getPlayerPremiumDays(player) > 0 then'.
if getPlayerStorageValue(player,1259) < 1 then
selfSay('Why indeed I have a mission you can do. I would love it if you could rid these lands of some of the {Demonic Monsters} that roam here.', player)
elseif getPlayerStorageValue(player,1257) == 1 then
selfSay('Please bring me 3000 Demonic Essence so I can start my research.', player)
elseif getPlayerStorageValue(player,1258) == 1 then
selfSay('Please bring me 3000 Demonic Essense so I can complete my research.', player)
elseif getPlayerStorageValue(player,1259) == 2 then
selfSay('Why yes I do have a further mission for you. I need another 3000 Demonic Essence to complete my research. Will you be able to get them for me?', player)
topic = 3
elseif getPlayerStorageValue(player,1259) == 4 then
selfSay('Thank you for all you have done, my research will be finished soon, and I can begin fighting against these evil creatures.', player)
end
else
selfSay('You must be premium to find out more.', player)
end
elseif msgcontains(msg:lower(), 'monster') then
selfSay('These monsters drop Demonic Essence. I require these to understand the evil powers that these creatures bare, and try to find a way to protect against them. Will you gather these for me?', player)
topic = 1
elseif msgcontains(msg:lower(), 'yes') and topic == 1 then
selfSay('Great. I will require 3000 Demonic Essense to get me research going. Please bring these to me and I will get a reward ready for you.', player)
setPlayerStorageValue(player,1257,1)
setPlayerStorageValue(player,1259,1)
setPlayerStorageValue(player,5008,1)
elseif msgcontains(msg:lower(), 'demonic') then
if getPlayerStorageValue(player,1257) == 1 then
selfSay('Did you bring me 3000 Demonic Essence?', player)
topic = 2
else
if getPlayerStorageValue(player,1258) == 1 then
selfSay('Did you bring me 3000 Demonic Essence?', player)
topic = 4
end
end
elseif msgcontains(msg:lower(), 'yes') and topic == 2 then
if getPlayerItemCount(player,6500) >= 3000 then
doPlayerRemoveItem(player,6500,3000)
setPlayerStorageValue(player,1259,1)
setPlayerStorageValue(player,1257,2)
selfSay('Ooo I can sense the evil from here! This will certainly get my research going. Please take this outfit. The ancient and evil Nightmare Nights used to wear it. I found it buried beneath the temple.. Must of been from when they attacked us! Come and see my again, I may have a further mission.', player)
else
selfSay('You do not have 3000 Demonic Essence!', player)
topic = 0
end
if getPlayerStorageValue(player,1259) == 1 and getPlayerStorageValue(player,1257) == 2 then
doSendMagicEffect(getPlayerPosition(player), 29)
doPlayerAddOutfit(player, 268, 3)
doPlayerAddOutfit(player, 269, 3)
setPlayerStorageValue(player,1259,2)
setPlayerStorageValue(player,5008,2)
player:addAchievement("Nightmare Walker")
end
elseif msgcontains(msg:lower(), 'yes') and topic == 3 then
selfSay('Marvelous! While you collect these, I will train this monster I captured so your able to ride on it. I trust this will satisfy as a reward!', player)
setPlayerStorageValue(player,1258,1)
setPlayerStorageValue(player,5009,1)
elseif msgcontains(msg:lower(), 'yes') and topic == 4 then
if getPlayerItemCount(player,6500) >= 3000 then
doPlayerRemoveItem(player,6500,3000)
setPlayerStorageValue(player,1259,3)
setPlayerStorageValue(player,1258,2)
end
if getPlayerStorageValue(player,1259) == 3 and getPlayerStorageValue(player,1258) == 2 then
doSendMagicEffect(getPlayerPosition(player), 30)
doPlayerAddMount(player, 104)
setPlayerStorageValue(player,1259,4)
setPlayerStorageValue(player,5009,2)
player:addAchievement("A Total Nightmare")
selfSay('Excellent, my research will soon be complete! This monster is now fully trained, please take it as a thank you for all your hard work.', player)
else
selfSay('You don\'t have the 3000 Demonic Essence I require!', player)
topic = 0
end
end
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())