local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local t = {}
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)
local f
if not npcHandler:isFocused(cid) then
if msgcontains(msg, 'hello') or msgcontains(msg, 'hi') then
local a = getPlayerVocation(cid)
if a == 1 or a == 5 then
npcHandler:say('It\'s good to see somebody who has chosen the path of wisdom. What do you want?', cid)
elseif a == 2 or a == 6 then
npcHandler:say('Hail, friend of nature! How may I help you?', cid)
elseif a == 3 or a == 7 then
npcHandler:say('Neither strong enough to be a knight nor wise enough to be a real mage. You like it easy, don\'t you? Why are you disturbing me?', cid)
else
npcHandler:say('Another creature who believes thinks physical strength is more important than wisdom! Why are you disturbing me?', cid)
end
npcHandler:addFocus(cid)
else
return false
end
elseif msgcontains(msg, 'bye') or msgcontains(msg, 'farewell') then
npcHandler:say('Farewell, '..getCreatureName(cid)..'!', cid)
npcHandler:releaseFocus(cid)
elseif t[cid] == 1 and msgcontains(msg, 'yes') then
npcHandler:say('Before we start I must ask you for a small donation of 1000 gold coins. Are you willing to pay 1000 gold coins for the test?', cid)
f = 2
elseif t[cid] == 1 and msgcontains(msg, 'no') then
npcHandler:say('Then leave, unworthy worm!', cid)
npcHandler:releaseFocus(cid)
elseif t[cid] == 1 then
npcHandler:say('You\'re not worthy if you cannot make up your mind. Leave!', cid)
npcHandler:releaseFocus(cid)
elseif t[cid] == 2 and msgcontains(msg, 'yes') then
if doPlayerRemoveMoney(cid, 1000) then
npcHandler:say('All right then. Here comes the first question. What was the name of Dago\'s favourite pet?', cid)
f = 3
else
npcHandler:say('You don\'t even have the money to make a donation? Then go!', cid)
npcHandler:releaseFocus(cid)
end
elseif t[cid] == 2 and msgcontains(msg, 'no') then
npcHandler:say('You\'re not worthy then. Now leave!', cid)
npcHandler:releaseFocus(cid)
elseif t[cid] == 2 then
npcHandler:say('You\'re not worthy if you cannot make up your mind. Leave!', cid)
npcHandler:releaseFocus(cid)
elseif t[cid] == 3 and msgcontains(msg, 'redips') then
npcHandler:say('Perhaps you knew him after all. Tell me - how many fingers did he have when he died?', cid)
f = 4
elseif t[cid] == 3 then
npcHandler:say('You are wrong. Get lost!', cid)
npcHandler:releaseFocus(cid)
elseif t[cid] == 4 and (msgcontains(msg, '7') or msgcontains(msg, 'seven')) then
npcHandler:say('Also true. But can you also tell me the colour of the deamons in which master specialized?', cid)
f = 5
elseif t[cid] == 4 then
npcHandler:say('You are wrong. Get lost!', cid)
npcHandler:releaseFocus(cid)
elseif t[cid] == 5 and msgcontains(msg, 'black') then
npcHandler:say('It seems you are worthy after all. Do you want the key to the crypt?', cid)
f = 6
elseif t[cid] == 5 then
npcHandler:say('You are wrong. Get lost!', cid)
npcHandler:releaseFocus(cid)
elseif t[cid] == 6 and msgcontains(msg, 'yes') then
npcHandler:say('Here you are.', cid)
doItemSetAttribute(doPlayerAddItem(cid, 2089, 1), 'aid', 3142)
elseif t[cid] == 6 then
npcHandler:say('It is always a wise decision to leave the dead alone.', cid)
elseif msgcontains(msg, 'job') then
npcHandler:say('Once I was the master of all mages, but now I only protect this crypt.', cid)
elseif msgcontains(msg, 'name') then
npcHandler:say('I am Skjaar the Mage, master of all spells.', cid)
elseif msgcontains(msg, 'door') then
npcHandler:say('This door seals a crypt.', cid)
elseif msgcontains(msg, 'crypt') then
npcHandler:say('Here lies my master. Only his closest followers may enter.', cid)
elseif msgcontains(msg, 'help') then
npcHandler:say('I\'m not here to help anybody. I only protect my master\'s crypt.', cid)
elseif msgcontains(msg, 'mountain') then
npcHandler:say('Hundreds of years my master\'s castle stood on the top of this mountain. Now there is a volcano.', cid)
elseif msgcontains(msg, 'volcano') then
npcHandler:say('I can still feel the magical energy in the volcano.', cid)
elseif msgcontains(msg, 'castle') then
npcHandler:say('The castle was destroyed when my master tried to summon a nameless creature. All that is left is this volcano.', cid)
elseif msgcontains(msg, 'time') then
npcHandler:say('To those who have lived for a thousand years time holds no more terror.', cid)
elseif msgcontains(msg, 'master') then
npcHandler:say('If you are one of his followers, you need not ask about him, for you will know. And if you aren\'t, you are not worthy anyway!', cid)
elseif msgcontains(msg, 'key') then
npcHandler:say('I will give the key to the crypt only to the closest followers of my master. Would you like me to test you?', cid)
f = 1
elseif msgcontains(msg, 'fuck') or msgcontains(msg, 'idiot') or msgcontains(msg, 'asshole') then
npcHandler:say('Take this for your words!', cid)
local h = getCreatureHealth(cid)
if h ~= 1 then
doCreatureAddHealth(cid, -(h - 1))
end
doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_RED)
npcHandler:releaseFocus(cid)
end
t[cid] = f or nil
return true
end
npcHandler:setMessage(MESSAGE_WALKAWAY, 'Run away, unworthy |PLAYERNAME|!')
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)