1. local keywordHandler = KeywordHandler:new()
  2. local npcHandler = NpcHandler:new(keywordHandler)
  3. NpcSystem.parseParameters(npcHandler)
  4. function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end
  5. function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end
  6. function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg:lower()) end
  7. function onThink() npcHandler:onThink() end
  8. local talkState = {}
  9. function creatureSayCallback(cid, type, msg)
  10. local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
  11. talkState[talkUser] = talkState[talkUser] or 0
  12. if msgcontains(msg, "mission") then
  13. if not max_task.getTaskIn(cid, "budrik")[1] then
  14. if getPlayerLevel(cid) > 40 or getPlayerStorageValue(cid, 40141) ~= -1 then
  15. npcHandler:say("I have no missions for you.", cid)
  16. return true
  17. end
  18. local msgs = {
  19. "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. ...",
  20. "I want you to kill 5000 minotaurs - no matter where - for me and all the dwarfs of Kazordoon! Are you willing to do that?",
  21. }
  22. npcHandler:say(msgs, cid)
  23. talkState[talkUser] = 1
  24. else
  25. if getPlayerStorageValue(cid, 40140) >= 5000 then
  26. 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)
  27. setPlayerStorageValue(cid, 40141, 1)
  28. setPlayerStorageValue(cid, 40140, -1)
  29. elseif getPlayerStorageValue(cid, 40141) == 1 then
  30. npcHandler:say("You have not killed {The Horned Fox} yet.", cid)
  31. elseif getPlayerStorageValue(cid, 40141) == 2 then
  32. 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)
  33. setPlayerStorageValue(cid, 40141, 3)
  34. else
  35. npcHandler:say("Go and finish your current task.", cid)
  36. end
  37. end
  38. elseif msgcontains(msg, "yes") and talkState[talkUser] == 1 then
  39. 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)
  40. setPlayerStorageValue(cid, 40140, 0)
  41. talkState[talkUser] = 0
  42. end
  43. return true
  44. end
  45. npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
  46. npcHandler:addModule(FocusModule:new())

NPC BUDRIK