local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end
function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end
function onThink() npcHandler:onThink() end
function creatureSayCallback(cid, type, msg)
if(not npcHandler:isFocused(cid)) then
return false
end
--CONFIG
local config = {
machUID = 1400,
machStorage = 1400,
arkStorage = 1401,
overStorage = 1402,
emachAID = 1403,
emachStorage = 1403,
lordStorage = 1404,
resStorage = 1405,
res2Storage = 1406,
messNotGem = "You can't proceed, go back and talk with Arkulius.",
messdontDo = "You can't proceed, you need kill your Elemental Overlord.",
effect = 11 --you can test effects with !z command (ex. !z 23)
}
--/CONFIG
local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
if msgcontains(msg, 'hi') then
if getPlayerStorageValue(cid,config.machStorage) == -1 and talkState[talkUser] == 0 then
npcHandler:say("...then I could transform a spell to bend... How can anyone expect me to work under these conditions?? What do you want?", cid)
talkState[talkUser] = 1
elseif getPlayerStorageValue(cid,config.overStorage) == 1 and talkState[talkUser] == 6 then
npcHandler:say("...then I could transform a spell to bend... How can anyone expect me to work under these conditions?? What do you want?", cid)
talkState[talkUser] = 7
elseif getPlayerStorageValue(cid,config.lordStorage) == 1 and talkState[talkUser] == 8 then
npcHandler:say("...then I could transform a spell to bend... How can anyone expect me to work under these conditions?? What do you want?", cid)
talkState[talkUser] = 9
end
elseif msgcontains(msg, 'Alverus') then
if talkState[talkUser] == 1 then
doNPCTalkALot({"It happened while he carried out an experiment concerning the creation of the elemental shrines. I still get goose bumps just by thinking of it. ...", "You need to know about the process of creating an elemental shrine to understand it completely, but I don't want to go into detail now. ...", "Anyway, his spell had a different outcome than he had planned. He accidentally created an Ice Overlord, pure living elemental ice, who froze him in a blink of an eye."}, 10000, cid)
talkState[talkUser] = 2
end
elseif msgcontains(msg, 'shrines') then
if talkState[talkUser] == 2 then
doNPCTalkALot({"The creation of the elemental shrines is a really complex matter. They are actually nodes, locations where the matching elemental sphere is very close. ...", "The shrine itself is like a portal between our world and the elemental sphere and enables us to use the elemental energy emerging from it."}, 10000, cid)
talkState[talkUser] = 3
end
elseif msgcontains(msg, 'sphere') then
if talkState[talkUser] == 3 then
doNPCTalkALot({"There are four spheres we know of: ice, fire, earth and energy. ....<mumbles> Hmmm, should I ask or not?....The heck with it! Now that you know about the spheres ...", "I found a way to visit them. It's VERY dangerous and there is a decent chance that you won't come back BUT if you succeed you'll write history!!! Ask me about that mission if you're interested."}, 10000, cid)
talkState[talkUser] = 4
end
elseif msgcontains(msg, 'mission') then
if talkState[talkUser] == 4 then
if getPlayerLevel(cid) < 100 then
npcHandler:say("I'm sorry this task is highly dangerous and I need experienced people for it.", cid)
talkState[talkUser] = 0
elseif getPlayerLevel(cid) >= 100 then
doNPCTalkALot({"Okay, listen closely: First of all, you need to gather 20 enchanted amethysts in order to go to the energy sphere. Deep under the academy, one floor below the elemental shrines, there is a machine. Put the gems in there and activate it. ...", "Once you got there, find a way to gather elemental energy in any form. You will face energy elementals, that's for sure, but I don't know how the energy is stored. ...", "Anyway, there should be a way to use that energy and strengthen one of the elementals. If my calculations are right, you will create an Energy Overlord who hopefully will consist of some sort of 'concentrated' energy. ...", "THAT'S what we need!! Are you in on it?"}, 10000, cid)
talkState[talkUser] = 5
elseif getPlayerItemCount(cid, 8300) == 1 or getPlayerItemCount(cid, 8304) == 1 or getPlayerItemCount(cid, 8305) == 1 or getPlayerItemCount(cid, 8306) == 1 and talkState[talkUser] == 7 and getPlayerStorageValue(cid,config.OverStorage) == 1 then
setPlayerStorageValue(cid, config.arkStorage, 1)
talkState[talkUser] = 8
if isPaladin(cid) then
doNPCTalkALot({"Impressive!! Let me take a look.......Ahh, an FLAWLESS ICE CRYSTAL ! Now you need to find a knight, a druid and a sorcerer who also completed this first task. ...", "Go down in the cellar again. I prepared a room under the academy where it should be safe. Your task is to charge the machines with the elemental substances and summon the LORD OF THE ELEMENTS. ...", "When you use an obsidian knife on it's corpse you hopefully get some of the precious neutral matter. It's the only way to revive my dear friend Alverus!!"}, 10000, cid)
elseif isSorcerer(cid) then
doNPCTalkALot({"Impressive!! Let me take a look.......Ahh, an ETERNAL FLAME! Now you need to find a knight, a druid and a paladin who also completed this first task. ...", "Go down in the cellar again. I prepared a room under the academy where it should be safe. Your task is to charge the machines with the elemental substances and summon the LORD OF THE ELEMENTS. ...", "When you use an obsidian knife on it's corpse you hopefully get some of the precious neutral matter. It's the only way to revive my dear friend Alverus!!"}, 10000, cid)
elseif isDruid(cid) then
doNPCTalkALot({"Impressive!! Let me take a look.......Ahh, an MOTHER SOIL! Now you need to find a knight, a paladin and a sorcerer who also completed this first task. ...", "Go down in the cellar again. I prepared a room under the academy where it should be safe. Your task is to charge the machines with the elemental substances and summon the LORD OF THE ELEMENTS. ...", "When you use an obsidian knife on it's corpse you hopefully get some of the precious neutral matter. It's the only way to revive my dear friend Alverus!!"}, 10000, cid)
elseif isKnight(cid) then
doNPCTalkALot({"Impressive!! Let me take a look.......Ahh, an PURE ENERGY! Now you need to find a druid, a paladin and a sorcerer who also completed this first task. ...", "Go down in the cellar again. I prepared a room under the academy where it should be safe. Your task is to charge the machines with the elemental substances and summon the LORD OF THE ELEMENTS. ...", "When you use an obsidian knife on it's corpse you hopefully get some of the precious neutral matter. It's the only way to revive my dear friend Alverus!!"}, 10000, cid)
else
doPlayerSendCancel(cid,config.messdontDo)
end
elseif getPlayerStorageValue(cid,config.lordStorage) == 1 and talkState[talkUser] == 9 then
npcHandler:say("AMAZING!! I'm going to start immediately with the research. If it turns out the way I expect it, Alverus will be revived soon!! Here, take this as a reward and try to collect more of this substance. I'll make you a good offer, I promise.", cid)
talkState[talkUser] = 0
setPlayerStorageValue(cid, config.arkStorage, 2)
if isPaladin(cid) then
doPlayerAddItem(cid,8853,1)
elseif isSorcerer(cid) then
doPlayerAddItem(cid,8867,1)
elseif isDruid(cid) then
doPlayerAddItem(cid,8869,1)
elseif isKnight(cid) then
doPlayerAddItem(cid,8883,1)
end
end
elseif msgcontains(msg, 'yes') then
if talkState[talkUser] == 5 then
npcHandler:say("Good, don't waste time! Come back here when you have the elemental object!", cid)
setPlayerStorageValue(cid, config.machStorage, 1)
talkState[talkUser] = 6
end
end
end
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())