Advertisement
Guest User

Untitled

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