Advertisement
Guest User

Untitled

a guest
Jul 20th, 2017
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.89 KB | None | 0 0
  1. dofile(getDataDir() .. 'global/greeting.lua')
  2. dofile(getDataDir() .. 'global/items-config.lua')
  3.  
  4. local keywordHandler = KeywordHandler:new()
  5. local npcHandler = NpcHandler:new(keywordHandler)
  6. NpcSystem.parseParameters(npcHandler)
  7. -- OTServ event handling functions start
  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. function creatureSayCallback(cid, type, msg)
  14.     if(npcHandler.focus ~= cid) then
  15.         return false
  16.     end
  17.  
  18. function selfGotoIdle()
  19.         following = false
  20.         attacking = false
  21.         selfAttackCreature(0)
  22.         target = 0
  23. end
  24.    
  25.     msg = msg:lower()
  26.    
  27. creaturepos1 = {x=32921, y=32074, z=9}
  28. creaturepos2 = {x=32923, y=32074, z=9}
  29. creaturepos3 = {x=32921, y=32076, z=9}
  30. creaturepos4 = {x=32923, y=32076, z=9}
  31.  
  32. keywordHandler:addKeyword({'name'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "My name is not of your concern."})
  33. keywordHandler:addKeyword({'job'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "That's only my business, not yours."})
  34. keywordHandler:addKeyword({'david'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I never heard that name and now get lost."})
  35. keywordHandler:addKeyword({'brassacres'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I never heard that name and now get lost."})
  36.  
  37.  
  38. if getPlayerStorageValue(cid, 5209) == 1 and msgcontains(msg, 'hat') then
  39. selfSay('What? My hat?? Theres... nothing special about it!')
  40. talk_state = 1
  41.  
  42. -- Without Value --
  43.  
  44. elseif getPlayerStorageValue(cid, 5209) == -1 and msgcontains(msg, 'bill') then
  45. selfSay('Thats not my concern, you are probably looking for someone else and now get lost!')
  46. talk_state = 0
  47. npcHandler:releaseFocus()
  48.  
  49. elseif getPlayerStorageValue(cid, 5209) == -1 and msgcontains(msg, 'hat') then
  50. selfSay('Get lost!')
  51. npcHandler:releaseFocus()
  52. talk_state = 0
  53.  
  54. -- Without Value --
  55.  
  56. -- After Quest Questions --
  57.  
  58. elseif msgcontains(msg, 'david') and getPlayerStorage(cid, 5211) == 1 then
  59. selfSay('Yes, yes... Its me .. you exposed me! Stop nagging me with that.')
  60. talk_state = 0
  61.  
  62. elseif msgcontains(msg, 'brassacres') and getPlayerStorage(cid, 5211) == 1 then
  63. selfSay('Yes, yes... Its me .. you exposed me! Stop nagging me with that.')
  64. talk_state = 0
  65.  
  66. -- After Quest Questions --
  67.  
  68. elseif talk_state == 1 and msgcontains(msg, 'hat') then
  69. selfSay('Stop bugging me about that hat, do you listen?')
  70. talk_state = 2
  71.  
  72. elseif msgcontains(msg, 'hat') and talk_state == 2 then
  73. selfSay('Hey! Don\'t touch that hat! Leave it alone!!! Don\'t do this!!!!')
  74. talk_state = 3
  75.  
  76. elseif msgcontains(msg, 'hat') and talk_state == 3 then
  77. selfSay('Noooooo! Argh, ok, ok, I guess I can\'t deny it anymore, I am David Brassacres, the magnificent, so what do you want?')
  78. doSummonCreature("Rat", creaturepos1)
  79. doSummonCreature("Rat", creaturepos2)
  80. doSummonCreature("Rat", creaturepos3)
  81. doSummonCreature("Rat", creaturepos4)
  82. setPlayerStorageValue(cid, 5210, 1)
  83. talk_state = 4
  84.  
  85. elseif getPlayerStorageValue(cid, 5210) == 1  and msgcontains(msg, 'bill') and talk_state == 4 then
  86. selfSay('A bill? Oh boy so you are delivering another bill to poor me?')
  87. talk_state = 5
  88.  
  89. elseif msgcontains(msg, 'yes') then
  90. if talk_state == 5 then
  91. selfSay('Ok, ok, I\'ll take it. I guess I have no other choice anyways. And now leave me alone in my misery please.')
  92. setPlayerStorageValue(cid, 5211, 1)
  93. doPlayerRemoveItem(cid, 2329, 1)
  94. talk_state = 6
  95. else
  96. selfSay('Ha Ha! You have none!! Naanaanaanaaanaaaa!')
  97. npcHandler:releaseFocus()
  98. end
  99.  
  100. elseif talk_state ~= 0 then
  101. selfSay('')
  102. selfGotoIdle()
  103.  
  104. end
  105. return true
  106. end
  107.    
  108.    
  109.     npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
  110. npcHandler:addModule(FocusModule:new())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement