Guest User

Untitled

a guest
Jan 19th, 2019
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 11.45 KB | None | 0 0
  1. local keywordHandler = KeywordHandler:new()
  2. local npcHandler = NpcHandler:new(keywordHandler)
  3. NpcSystem.parseParameters(npcHandler)
  4.  
  5. local Topic = {}
  6. local storageMain = 65100
  7. local storageKill = 65101
  8. local greetMsg = {
  9. "...if the expected constant is higher than... Hmmm, who are you?? What do you want?",
  10. "...then I could transform a spell to bend... How can anyone expect me to work under these conditions?? What do you want?",
  11. "...if my calculations are correct, I will be able to revive... Arrgghh!! What do you want?"
  12. }
  13. local thinkMsg = {
  14. "Oh my! Alverus!! Did you really...?!?! I have to recalculate it to make sure that I made no mistake.",
  15. "...the minimum square deviation could cause a dislocation, in a matter of fact...",
  16. "...it could be possible to bring the sphere to a destination where...",
  17. "...the arithmetical paradox has the same value in a metaphysical way, then...",
  18. "<mumbles>",
  19. "Yes, that's it! The elementary particle are corresponding to the... the ... UNBELIEVEABLE!!! "
  20. }
  21.  
  22. function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end
  23. function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end
  24. function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end
  25. function onThink() npcHandler:onThink() end
  26.  
  27. function thinkCallback(cid)
  28. local rand = math.random(250)
  29. if thinkMsg[rand] then
  30. npcHandler:say(thinkMsg[rand])
  31. end
  32. return true
  33. end
  34.  
  35. function greetCallback(cid)
  36. npcHandler:setMessage(MESSAGE_GREET, greetMsg[math.random(#greetMsg)])
  37. Topic[cid] = 0
  38. return true
  39. end
  40.  
  41. function creatureSayCallback(cid, type, msg)
  42. if(not npcHandler:isFocused(cid)) then
  43. return false
  44. elseif msgcontains(msg, "job") then
  45. npcHandler:say("How dare you asking me this?!? I'm Arkulius - Master of Elements, the HEADMASTER of this academy!!", cid)
  46. Topic[cid] = 0
  47. elseif msgcontains(msg, "name") then
  48. npcHandler:say("I'm Arkulius - Master of Elements, the headmaster of this academy.", cid)
  49. Topic[cid] = 0
  50. elseif msgcontains(msg, "help") then
  51. npcHandler:say("I have better things to do than helping you. See that ice statue over there? My dear friend Alverus needs to be revived!", cid)
  52. Topic[cid] = 0
  53. elseif msgcontains(msg, "time") then
  54. npcHandler:say("Time is an illusion and completely irrelevant to me.", cid)
  55. Topic[cid] = 0
  56. elseif msgcontains(msg, "weapon") then
  57. npcHandler:say("Weapons are for those people who aren't able to use their heads or better what's INSIDE their heads. No offence <coughs>.", cid) -- < Knight; FIXME !!!
  58. Topic[cid] = 0
  59. elseif msgcontains(msg, "pits") and msgcontains(msg, "of") and msgcontains(msg, "inferno") then
  60. npcHandler:say("Yeye, I believe you almost feel like home among all those brainless creatures!", cid)
  61. Topic[cid] = 0
  62. elseif msgcontains(msg, "alverus") then
  63. npcHandler:say({"It happened while he carried out an experiment concerning the creation of the elemental {shrines}. I still get goose bumps just by thinking of it. ...", "You need to know about the process of creating an elemental shrine to understand it completely, but I don't want to go into detail now. ...", "Anyway, his spell had a different outcome than he had planned. He accidentally created an Ice Overlord, pure living elemental ice, who froze him in a blink of an eye."}, cid)
  64. Topic[cid] = 0
  65. elseif msgcontains(msg, "shrine") then
  66. npcHandler:say({"The creation of the elemental shrines is a really complex matter. They are actually nodes, locations where the matching elemental sphere is very close. ...", "The shrine itself is like a portal between our world and the elemental {sphere} and enables us to use the elemental energy emerging from it."}, cid)
  67. Topic[cid] = 0
  68. elseif msgcontains(msg, "sphere") and getPlayerLevel(cid) >= 80 then
  69. npcHandler:say({"There are four spheres we know of: ice, fire, earth and energy. ....<mumbles> Hmmm, should I ask or not?....The heck with it! Now that you know about the spheres ...", "I found a way to visit them. It's VERY dangerous and there is a decent chance that you won't come back BUT if you succeed you'll write history!!! Ask me about that {mission} if you're interested."}, cid)
  70. Topic[cid] = 0
  71. elseif msgcontains(msg, "mission") or msgcontains(msg, "quest") then
  72. local v = getPlayerStorageValue(cid, storageMain)
  73. if v < 1 then
  74. if getPlayerLevel(cid) >= 80 then
  75. if isSorcerer(cid) then
  76. npcHandler:say({"Okay, listen closely: First of all, you need to gather 20 enchanted rubies in order to go to the fire sphere. Deep under the academy, one floor below the elemental shrines, there is a machine. Put the gems in there and activate it. ...", "Once you got there, find a way to gather elemental fire in any form. You will face fire elementals, that's for sure, but I don't know how the fire is stored. ...", "Anyway, there should be a way to use that elemental fire and strengthen one of the elementals. If my calculations are right, you will create a Fire Overlord who hopefully will consist of some sort of 'concentrated' fire or something similar. ...", "Arkulius: THAT'S what we need!! Are you in on it?"}, cid)
  77. elseif isDruid(cid) then
  78. npcHandler:say({"Okay, listen closely: First of all, you need to gather 20 enchanted emeralds in order to go to the earth sphere. Deep under the academy, one floor below the elemental shrines, there is a machine. Put the gems in there and activate it. ...", "Once you got there, find a way to gather elemental earth in any form. You will face earth elementals, that's for sure, but I don't know how the earth is stored. ...", "Anyway, there should be a way to use that elemental earth and strengthen one of the elementals. If my calculations are right, you will create an Earth Overlord who hopefully will consist of some sort of 'concentrated' earth or something similar. ...", "Arkulius: THAT'S what we need!! Are you in on it?"}, cid)
  79. elseif isPaladin(cid) then
  80. npcHandler:say({"Okay, listen closely: First of all, you need to gather 20 enchanted sapphires in order to go to the ice sphere. Deep under the academy, one floor below the elemental shrines, there is a machine. Put the gems in there and activate it. ...", "Once you got there, find a way to gather elemental ice in any form. You will face ice elementals, that's for sure, but I don't know how the ice is stored. ...", "Anyway, there should be a way to use that elemental ice and strengthen one of the elementals. If my calculations are right, you will create an Ice Overlord who hopefully will consist of some sort of 'concentrated' ice or something similar. ...", "Arkulius: THAT'S what we need!! Are you in on it?"}, cid)
  81. elseif isKnight(cid) then
  82. npcHandler:say({"Okay, listen closely: First of all, you need to gather 20 enchanted amethysts in order to go to the energy sphere. Deep under the academy, one floor below the elemental shrines, there is a machine. Put the gems in there and activate it. ...", "Once you got there, find a way to gather elemental energy in any form. You will face energy elementals, that's for sure, but I don't know how the energy is stored. ...", "Anyway, there should be a way to use that energy and strengthen one of the elementals. If my calculations are right, you will create an Energy Overlord who hopefully will consist of some sort of 'concentrated' energy. ...", "THAT'S what we need!! Are you in on it?"}, cid)
  83. end
  84. else
  85. npcHandler:say("I'm sorry this task is highly dangerous and I need experienced people for it.", cid)
  86. Topic[cid] = 0
  87. return
  88. end
  89. Topic[cid] = 1
  90. elseif v == 1 then
  91. if --[[getPlayerStorageValue(cid, storageKill) == 1 and]] getPlayerItemCount(cid, isSorcerer(cid) and 8304 or isDruid(cid) and 8305 or isPaladin(cid) and 8300 or isKnight(cid) and 8306) > 0 then
  92. setPlayerStorageValue(cid, storageMain, 2)
  93. npcHandler:say({"Impressive!! Let me take a look.......Ahh, " .. (isSorcerer(cid) and "an ETERNAL FLAME! Now you need to find a knight, a druid, and a paladin who also completed this first task. ..." or isDruid(cid) and "MOTHER SOIL! Now you need to find a knight, a paladin, and a sorcerer who also completed this first task. ..." or isPaladin(cid) and "a FLAWLESS ICE CRYSTAL! Now you need to find a knight, a druid, and a sorcerer who also completed this first task. ..." or isKnight(cid) and "PURE ENERGY! Now you need to find a druid, a paladin, and a sorcerer who also completed this first task. ..."), "Go down in the cellar again. I prepared a room under the academy where it should be safe. Your task is to charge the machines with the elemental substances and summon the LORD OF THE ELEMENTS. ...", "When you use an obsidian knife on it's corpse you hopefully get some of the precious neutral matter. It's the only way to revive my dear friend Alverus!!"}, cid)
  94. else
  95. npcHandler:say("You need some kind of pure elemental soil from the " .. (isSorcerer(cid) and "Fire" or isDruid(cid) and "Earth" or isPaladin(cid) and "Ice" or isKnight(cid) and "Energy") .. " Overlord. Come back when you've got it.", cid)
  96. end
  97. Topic[cid] = 0
  98. elseif v == 2 then
  99. if --[[getPlayerStorageValue(cid, storageKill) == 2 and]] doPlayerRemoveItem(cid, 8310, 1) == TRUE then
  100. npcHandler:say("AMAZING!! I'm going to start immediately with the research. If it turns out the way I expect it, Alverus will be revived soon!! Here, take this as a reward and try to collect more of this substance. I'll make you a good offer, I promise. ", cid)
  101. doPlayerAddItem(cid, isSorcerer(cid) and 8867 or isDruid(cid) and 8869 or isPaladin(cid) and 8853 or isKnight(cid) and 8883, 1)
  102. setPlayerStorageValue(cid, storageMain, 3)
  103. end
  104. end
  105. elseif Topic[cid] == 1 and msgcontains(msg, "yes") then
  106. setPlayerStorageValue(cid, storageMain, 1)
  107. npcHandler:say("Good, don't waste time! Come back here when you have the elemental object!", cid)
  108. Topic[cid] = 0
  109. elseif msgcontains(msg, "trade") and getPlayerStorageValue(cid, 65100) == 3 then
  110. local items = {{name="neutral matter", id=8310, sell=5000, subType = 1}}
  111. openShopWindow(cid, items,
  112. function(cid, itemid, subType, amount, ignoreCap, inBackpacks)
  113. customCallbackOnBuy(cid, itemid, subType, amount, ignoreCap, inBackpacks, items)
  114. end,
  115. function(cid, itemid, subType, amount, ignoreCap, inBackpacks)
  116. customCallbackOnSell(cid, itemid, subType, amount, ignoreCap, inBackpacks, items)
  117. end
  118. )
  119. npcHandler:say("I only buy neutral matter. You'll get 5,000 gold for each.", cid)
  120. Topic[cid] = 0
  121. end
  122. return TRUE
  123. end
  124.  
  125. npcHandler:setMessage(MESSAGE_WALKAWAY, "Good bye and please stay away, okay?")
  126. npcHandler:setMessage(MESSAGE_FAREWELL, "At last! Good things come to those who wait.")
  127. npcHandler:setCallback(CALLBACK_ONTHINK, thinkCallback)
  128. npcHandler:setCallback(CALLBACK_GREET, greetCallback)
  129. npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
  130. npcHandler:addModule(FocusModule:new())
Add Comment
Please, Sign In to add comment