Advertisement
Guest User

Untitled

a guest
Feb 23rd, 2020
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.86 KB | None | 0 0
  1. local LEVEL = 8
  2.  
  3. local keywordHandler = KeywordHandler:new()
  4. local npcHandler = NpcHandler:new(keywordHandler)
  5. NpcSystem.parseParameters(npcHandler)
  6.  
  7. function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end
  8. function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end
  9. function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end
  10. function onThink() npcHandler:onThink() end
  11.  
  12. npcHandler:setMessage(MESSAGE_GREET, '|PLAYERNAME|, ARE YOU PREPAED TO FACE YOUR DESTINY?')
  13.  
  14. function oracle(cid, message, keywords, parameters, node)
  15. if(cid ~= npcHandler.focus) then
  16. return false
  17. end
  18.  
  19. local cityNode = node:getParent():getParent()
  20. local vocNode = node:getParent()
  21.  
  22. local destination = cityNode:getParameters().destination
  23. local townid = cityNode:getParameters().townid
  24. local voc = vocNode:getParameters().voc
  25.  
  26. if(destination ~= nil and voc ~= nil and townid ~= nil) then
  27. if(getPlayerLevel(cid) < parameters.level) then
  28. npcHandler:say('YOU MUST FIRST REACH LEVEL ' .. parameters.level .. '!')
  29. else
  30. doPlayerSetVocation(cid,voc)
  31. doPlayerSetTown(cid,townid)
  32. doPlayerAddItem(cid, 2190, 1)
  33. doPlayerAddItem(cid, 2182, 1)
  34. doPlayerAddItem(cid, 2397, 1)
  35. doPlayerAddItem(cid, 2152, 5)
  36. doTeleportThing(cid,destination)
  37. doSendMagicEffect(getPlayerPosition(cid), CONST_ME_MAGIC_BLUE)
  38. end
  39. else
  40. error('Destination:', destination, 'Vocation:', vocation, 'Townid:', townid)
  41. end
  42. npcHandler:resetNpc()
  43. return true
  44. end
  45.  
  46.  
  47. function greetCallback(cid)
  48. if(getPlayerLevel(cid) < LEVEL) then
  49. npcHandler:say('CHILD! COME BACK WHEN YOU HAVE GROWN UP!')
  50. return false
  51. else
  52. return true
  53. end
  54. end
  55.  
  56. -- Pre-create the yes/no nodes.
  57. local yesNode = KeywordNode:new({'yes'}, oracle, {level = LEVEL})
  58. local noNode = KeywordNode:new({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, moveup = 1, text = 'KNIGHT, PALADIN, SORCERER, OR DRUID?'})
  59.  
  60. -- Create the actual keyword structure...
  61. local node1 = keywordHandler:addKeyword({'yes'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'IN WHICH TOWN DO YOU WANT TO LIVE: CARLIN, EDRON, THAIS, AB\'DENDRIEL OR VENORE?'})
  62. local node2 = node1:addChildKeyword({'thais'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, townid = 3, destination = {x=32369, y=32241, z=7}, text = 'IN THAIS! AND WHAT PROFESSION HAVE YOU CHOSEN: KNIGHT, PALADIN, SORCERER, OR DRUID?'})
  63. local node3 = node2:addChildKeyword({'sorcerer'}, StdModule.say, {npcHandler = npcHandler, voc = 1, onlyFocus = true, text = 'A SORCERER! ARE YOU SURE? THIS DECISION IS IRREVERSIBLE!'})
  64. node3:addChildKeywordNode(yesNode)
  65. node3:addChildKeywordNode(noNode)
  66. local node3 = node2:addChildKeyword({'druid'}, StdModule.say, {npcHandler = npcHandler, voc = 2, onlyFocus = true, text = 'A DRUID! ARE YOU SURE? THIS DECISION IS IRREVERSIBLE!'})
  67. node3:addChildKeywordNode(yesNode)
  68. node3:addChildKeywordNode(noNode)
  69. local node3 = node2:addChildKeyword({'paladin'}, StdModule.say, {npcHandler = npcHandler, voc = 3, onlyFocus = true, text = 'A PALADIN! ARE YOU SURE? THIS DECISION IS IRREVERSIBLE!'})
  70. node3:addChildKeywordNode(yesNode)
  71. node3:addChildKeywordNode(noNode)
  72. local node3 = node2:addChildKeyword({'knight'}, StdModule.say, {npcHandler = npcHandler, voc = 4, onlyFocus = true, text = 'A KNIGHT! ARE YOU SURE? THIS DECISION IS IRREVERSIBLE!'})
  73. node3:addChildKeywordNode(yesNode)
  74. node3:addChildKeywordNode(noNode)
  75.  
  76. local node2 = node1:addChildKeyword({'carlin'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, townid = 5, destination = {x=32360, y=31782, z=7}, text = 'IN CARLIN! AND WHAT PROFESSION HAVE YOU CHOSEN: KNIGHT, PALADIN, SORCERER, OR DRUID?'})
  77. local node3 = node2:addChildKeyword({'sorcerer'}, StdModule.say, {npcHandler = npcHandler, voc = 1, onlyFocus = true, text = 'A SORCERER! ARE YOU SURE? THIS DECISION IS IRREVERSIBLE!'})
  78. node3:addChildKeywordNode(yesNode)
  79. node3:addChildKeywordNode(noNode)
  80. local node3 = node2:addChildKeyword({'druid'}, StdModule.say, {npcHandler = npcHandler, voc = 2, onlyFocus = true, text = 'A DRUID! ARE YOU SURE? THIS DECISION IS IRREVERSIBLE!'})
  81. node3:addChildKeywordNode(yesNode)
  82. node3:addChildKeywordNode(noNode)
  83. local node3 = node2:addChildKeyword({'paladin'}, StdModule.say, {npcHandler = npcHandler, voc = 3, onlyFocus = true, text = 'A PALADIN! ARE YOU SURE? THIS DECISION IS IRREVERSIBLE!'})
  84. node3:addChildKeywordNode(yesNode)
  85. node3:addChildKeywordNode(noNode)
  86. local node3 = node2:addChildKeyword({'knight'}, StdModule.say, {npcHandler = npcHandler, voc = 4, onlyFocus = true, text = 'A KNIGHT! ARE YOU SURE? THIS DECISION IS IRREVERSIBLE!'})
  87. node3:addChildKeywordNode(yesNode)
  88. node3:addChildKeywordNode(noNode)
  89.  
  90. local node2 = node1:addChildKeyword({'venore'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, townid = 4, destination = {x=32957, y=32076, z=7}, text = 'IN VENORE! AND WHAT PROFESSION HAVE YOU CHOSEN: KNIGHT, PALADIN, SORCERER, OR DRUID?'})
  91. local node3 = node2:addChildKeyword({'sorcerer'}, StdModule.say, {npcHandler = npcHandler, voc = 1, onlyFocus = true, text = 'A SORCERER! ARE YOU SURE? THIS DECISION IS IRREVERSIBLE!'})
  92. node3:addChildKeywordNode(yesNode)
  93. node3:addChildKeywordNode(noNode)
  94. local node3 = node2:addChildKeyword({'druid'}, StdModule.say, {npcHandler = npcHandler, voc = 2, onlyFocus = true, text = 'A DRUID! ARE YOU SURE? THIS DECISION IS IRREVERSIBLE!'})
  95. node3:addChildKeywordNode(yesNode)
  96. node3:addChildKeywordNode(noNode)
  97. local node3 = node2:addChildKeyword({'paladin'}, StdModule.say, {npcHandler = npcHandler, voc = 3, onlyFocus = true, text = 'A PALADIN! ARE YOU SURE? THIS DECISION IS IRREVERSIBLE!'})
  98. node3:addChildKeywordNode(yesNode)
  99. node3:addChildKeywordNode(noNode)
  100. local node3 = node2:addChildKeyword({'knight'}, StdModule.say, {npcHandler = npcHandler, voc = 4, onlyFocus = true, text = 'A KNIGHT! ARE YOU SURE? THIS DECISION IS IRREVERSIBLE!'})
  101. node3:addChildKeywordNode(yesNode)
  102. node3:addChildKeywordNode(noNode)
  103.  
  104. local node2 = node1:addChildKeyword({'edron'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, townid = 9, destination = {x=33217, y=31814, z=8}, text = 'IN EDRON! AND WHAT PROFESSION HAVE YOU CHOSEN: KNIGHT, PALADIN, SORCERER, OR DRUID?'})
  105. local node3 = node2:addChildKeyword({'sorcerer'}, StdModule.say, {npcHandler = npcHandler, voc = 1, onlyFocus = true, text = 'A SORCERER! ARE YOU SURE? THIS DECISION IS IRREVERSIBLE!'})
  106. node3:addChildKeywordNode(yesNode)
  107. node3:addChildKeywordNode(noNode)
  108. local node3 = node2:addChildKeyword({'druid'}, StdModule.say, {npcHandler = npcHandler, voc = 2, onlyFocus = true, text = 'A DRUID! ARE YOU SURE? THIS DECISION IS IRREVERSIBLE!'})
  109. node3:addChildKeywordNode(yesNode)
  110. node3:addChildKeywordNode(noNode)
  111. local node3 = node2:addChildKeyword({'paladin'}, StdModule.say, {npcHandler = npcHandler, voc = 3, onlyFocus = true, text = 'A PALADIN! ARE YOU SURE? THIS DECISION IS IRREVERSIBLE!'})
  112. node3:addChildKeywordNode(yesNode)
  113. node3:addChildKeywordNode(noNode)
  114. local node3 = node2:addChildKeyword({'knight'}, StdModule.say, {npcHandler = npcHandler, voc = 4, onlyFocus = true, text = 'A KNIGHT! ARE YOU SURE? THIS DECISION IS IRREVERSIBLE!'})
  115. node3:addChildKeywordNode(yesNode)
  116. node3:addChildKeywordNode(noNode)
  117.  
  118. local node2 = node1:addChildKeyword({'ab\'dendriel'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, townid = 1, destination = {x=32732, y=31634, z=7}, text = 'IN AB\'DENDRIEL! AND WHAT PROFESSION HAVE YOU CHOSEN: KNIGHT, PALADIN, SORCERER, OR DRUID?'})
  119. local node3 = node2:addChildKeyword({'sorcerer'}, StdModule.say, {npcHandler = npcHandler, voc = 1, onlyFocus = true, text = 'A SORCERER! ARE YOU SURE? THIS DECISION IS IRREVERSIBLE!'})
  120. node3:addChildKeywordNode(yesNode)
  121. node3:addChildKeywordNode(noNode)
  122. local node3 = node2:addChildKeyword({'druid'}, StdModule.say, {npcHandler = npcHandler, voc = 2, onlyFocus = true, text = 'A DRUID! ARE YOU SURE? THIS DECISION IS IRREVERSIBLE!'})
  123. node3:addChildKeywordNode(yesNode)
  124. node3:addChildKeywordNode(noNode)
  125. local node3 = node2:addChildKeyword({'paladin'}, StdModule.say, {npcHandler = npcHandler, voc = 3, onlyFocus = true, text = 'A PALADIN! ARE YOU SURE? THIS DECISION IS IRREVERSIBLE!'})
  126. node3:addChildKeywordNode(yesNode)
  127. node3:addChildKeywordNode(noNode)
  128. local node3 = node2:addChildKeyword({'knight'}, StdModule.say, {npcHandler = npcHandler, voc = 4, onlyFocus = true, text = 'A KNIGHT! ARE YOU SURE? THIS DECISION IS IRREVERSIBLE!'})
  129. node3:addChildKeywordNode(yesNode)
  130. node3:addChildKeywordNode(noNode)
  131.  
  132. keywordHandler:addKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'COME BACK WHEN YOU ARE PREPARED TO FACE YOUR DESTINY!'})
  133.  
  134. npcHandler:addModule(FocusModule:new())
  135. npcHandler:setCallback(CALLBACK_GREET, greetCallback)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement