- local keywordHandler = KeywordHandler:new()
- local npcHandler = NpcHandler:new(keywordHandler)
- NpcSystem.parseParameters(npcHandler)
- function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end
- function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end
- function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg:lower()) end
- function onThink() npcHandler:onThink() end
- local talkState = {}
- function creatureSayCallback(cid, type, msg)
- local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
- talkState[talkUser] = talkState[talkUser] or 0
- if msgcontains(msg, "mission") then
- if not max_task.getTaskIn(cid, "budrik")[1] then
- if getPlayerLevel(cid) > 40 or getPlayerStorageValue(cid, 40141) ~= -1 then
- npcHandler:say("I have no missions for you.", cid)
- return true
- end
- local msgs = {
- "I am so angry I could spit grit! That damn Horned Fox and his attacks! Let's show those bull-heads that they have messed with the wrong people. ...",
- "I want you to kill 5000 minotaurs - no matter where - for me and all the dwarfs of Kazordoon! Are you willing to do that?",
- }
- npcHandler:say(msgs, cid)
- talkState[talkUser] = 1
- else
- if getPlayerStorageValue(cid, 40140) >= 5000 then
- npcHandler:say("By all that is holy! You are a truly great warrior! With much patience! I have just found out the location the hideout of The Horned Fox! I have marked the spot on your map so you can find it. Go there and slay him!! Good luck!", cid)
- setPlayerStorageValue(cid, 40141, 1)
- setPlayerStorageValue(cid, 40140, -1)
- elseif getPlayerStorageValue(cid, 40141) == 1 then
- npcHandler:say("You have not killed {The Horned Fox} yet.", cid)
- elseif getPlayerStorageValue(cid, 40141) == 2 then
- npcHandler:say("It was very decent of you to help me, and I am thankful, really I am, but now I have to get back to my duties as a foreman.", cid)
- setPlayerStorageValue(cid, 40141, 3)
- else
- npcHandler:say("Go and finish your current task.", cid)
- end
- end
- elseif msgcontains(msg, "yes") and talkState[talkUser] == 1 then
- npcHandler:say("Hussah! Let's bring war to those hoof-legged, dirt-necked, bull-headed minotaurs!! Come back to me when you are done with your mission.", cid)
- setPlayerStorageValue(cid, 40140, 0)
- talkState[talkUser] = 0
- end
- return true
- end
- npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
- npcHandler:addModule(FocusModule:new())
NPC BUDRIK