Advertisement
Guest User

Untitled

a guest
Nov 22nd, 2017
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.46 KB | None | 0 0
  1. dofile(getDataDir() .. 'npc/scripts/lib/greeting.lua')
  2.  
  3. local keywordHandler = KeywordHandler:new()
  4. local npcHandler = NpcHandler:new(keywordHandler)
  5. NpcSystem.parseParameters(npcHandler)
  6.  
  7. -- OTServ event handling functions
  8. function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end
  9. function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end
  10. function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end
  11. function onThink() npcHandler:onThink() end
  12.  
  13. npcHandler:setMessage(MESSAGE_GREET, "Hello, |PLAYERNAME|! Feel free to ask me for help.")
  14.  
  15. local shopModule = ShopModule:new()
  16. npcHandler:addModule(shopModule)
  17.  
  18. keywordHandler:addKeyword({'job'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I am just a humble monk. Ask me if you need help or healing."})
  19. keywordHandler:addKeyword({'name'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "My name is Cipfried."})
  20. keywordHandler:addKeyword({'monk'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I sacrifice my life to serve the good gods of Tibia."})
  21. keywordHandler:addKeyword({'tibia'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "That's where we are. The world of Tibia."})
  22. keywordHandler:addKeyword({'rook'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "The gods have chosen this isle as the point of arrival for the newborn souls."})
  23. keywordHandler:addKeyword({'god'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "They created Tibia and all life on it. Visit our library and learn about them."})
  24. keywordHandler:addKeyword({'life'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "The gods decorated Tibia with various forms of life. Plants, the citizens, and even the monsters."})
  25. keywordHandler:addKeyword({'plant'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Just walk around. You will see grass, trees, and bushes."})
  26. keywordHandler:addKeyword({'citizen'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Only few people live here. Walk around and talk to them."})
  27. keywordHandler:addKeyword({'obi'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "He is a local shop owner."})
  28. keywordHandler:addKeyword({'al dee'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "He is a local shop owner."})
  29. keywordHandler:addKeyword({'seymour'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Seymour is a loyal follower of the king and responsibe for the academy."})
  30. keywordHandler:addKeyword({'academy'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "You should visit Seymour in the academy and ask him about a mission."})
  31. keywordHandler:addKeyword({'willie'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "He is a fine farmer. The farm is located to the left of the temple."})
  32. keywordHandler:addKeyword({'monster'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "They are a constant threat. Learn to fight by hunting rabbits, deers and sheeps. Then try to fight rats, bugs and perhaps spiders."})
  33. keywordHandler:addKeyword({'help'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "First you should try to get some gold and buy better equipment."})
  34. keywordHandler:addKeyword({'hint'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "First you should try to get some gold and buy better equipment."})
  35. keywordHandler:addKeyword({'quest'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "First you should try to get some gold and buy better equipment."})
  36. keywordHandler:addKeyword({'task'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "First you should try to get some gold and buy better equipment."})
  37. keywordHandler:addKeyword({'what'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "First you should try to get some gold and buy better equipment."})
  38. keywordHandler:addKeyword({'do'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "First you should try to get some gold and buy better equipment."})
  39. keywordHandler:addKeyword({'gold'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "You have to slay monsters and take their gold. Or sell food at Willie's farm."})
  40. keywordHandler:addKeyword({'money'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "If you need money, you have to slay monsters and take their gold. Look for spiders and rats."})
  41. keywordHandler:addKeyword({'rat'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "In the north of this temple you find a sewer grate. Use it to enter the sewers if you feel prepared. Don't forget a torch; you'll need it."})
  42. keywordHandler:addKeyword({'sewer'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "In the north of this temple you find a sewer grate. Use it to enter the sewers if you feel prepared. Don't forget a torch; you'll need it."})
  43. keywordHandler:addKeyword({'equipment'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "First you need some armor and perhaps a better weapon or a shield. A real adventurer needs a rope, a shovel, and a fishing pole, too."})
  44. keywordHandler:addKeyword({'fight'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Take a weapon in your hand, activate your combat mode, and select a target. After a fight you should eat something to heal your wounds"})
  45. keywordHandler:addKeyword({'slay'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Take a weapon in your hand, activate your combat mode, and select a target. After a fight you should eat something to heal your wounds"})
  46. keywordHandler:addKeyword({'eat'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "If you want to heal your wounds you should eat something. Willie sells excellent meals. But if you are very weak, come to me and ask me to heal you."})
  47. keywordHandler:addKeyword({'food'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "If you want to heal your wounds you should eat something. Willie sells excellent meals. But if you are very weak, come to me and ask me to heal you."})
  48. keywordHandler:addKeyword({'time'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Now, it is |TIME|, my child."})
  49.  
  50. function creatureSayCallback(cid, type, msg)
  51. if(cid ~= npcHandler.focus) then
  52. return false
  53. end
  54.  
  55. if msgcontains(msg, 'heal') then
  56. if hasCondition(cid, CONDITION_FIRE) == true then
  57. npcHandler:say('You are burning. I will help you.')
  58. doRemoveCondition(cid, CONDITION_FIRE)
  59. doSendMagicEffect(getCreaturePosition(cid), 14)
  60. elseif hasCondition(cid, CONDITION_POISON) == true then
  61. npcHandler:say('You are poisoned. I will help you.')
  62. doRemoveCondition(cid, CONDITION_POISON)
  63. doSendMagicEffect(getCreaturePosition(cid), 13)
  64. elseif getCreatureHealth(cid) < 65 then
  65. npcHandler:say('You are looking really bad. Let me heal your wounds.')
  66. doCreatureAddHealth(cid, 65 - getCreatureHealth(cid))
  67. doSendMagicEffect(getCreaturePosition(cid), 12)
  68. else
  69. npcHandler:say('You aren\'t looking really bad, ' .. getCreatureName(cid) .. '. I can only help in cases of real emergencies. Raise your health simply by eating food.')
  70. end
  71. return true
  72. end
  73. end
  74.  
  75. npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
  76. npcHandler:addModule(FocusModule:new())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement