Advertisement
Guest User

[NPC] AuraSystem.xml

a guest
Jan 14th, 2014
553
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.85 KB | None | 0 0
  1. local keywordHandler = KeywordHandler:new()
  2. local npcHandler = NpcHandler:new(keywordHandler)
  3. NpcSystem.parseParameters(npcHandler)
  4. local talkState = {}
  5.  
  6. function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end
  7. function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end
  8. function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end
  9. function onThink() npcHandler:onThink() end
  10.  
  11. local gold_id = 2160
  12. local ammout = 10
  13.  
  14. function creatureSayCallback(cid, type, msg)
  15. if(not npcHandler:isFocused(cid)) then
  16. return false
  17. end
  18.  
  19. local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
  20.  
  21. if(msgcontains(msg, 'aura') or msgcontains(msg, 'auras')) then
  22.  
  23. selfSay('Bom.. Eu tenho algumas auras. como: {Death}, {Earth}, {Poison}, {Physical}, {Ice}, {Fire}, {Holy} e {Energy}!.', cid)
  24. elseif(msgcontains(msg, 'death') or msgcontains(msg, 'DEATH')) then
  25. if getPlayerStorageValue(cid, 99125) >= 1 then
  26.  
  27. selfSay('Voce ja tem a aura de death.', cid)
  28. return true
  29. end
  30.  
  31. if(doPlayerRemoveItem(cid, gold_id, ammout) == true) then
  32.  
  33. setPlayerStorageValue(cid, 99125, 1)
  34. selfSay('Obrigado. Agora voce tem sua aura de death.', cid)
  35. doSendMagicEffect(getThingPos(cid), 17)
  36. else
  37.  
  38. selfSay('Voce não tem dinheiro pra isso.', cid)
  39. return true
  40. end
  41. elseif(msgcontains(msg, 'earth') or msgcontains(msg, 'EARTH')) then
  42. if getPlayerStorageValue(cid, 99128) >= 1 then
  43.  
  44. selfSay('Voce ja tem a aura de earth.', cid)
  45. return true
  46. end
  47.  
  48. if(doPlayerRemoveItem(cid, gold_id, ammout) == true) then
  49.  
  50. setPlayerStorageValue(cid, 99128, 1)
  51. selfSay('Obrigado. agora voce tem sua aura de earth', cid)
  52. doSendMagicEffect(getThingPos(cid), 45)
  53. else
  54. selfSay('Voce não tem dinheiro pra isso.', cid)
  55. return true
  56. end
  57. elseif(msgcontains(msg, 'fire') or msgcontains(msg, 'FIRE')) then
  58. if getPlayerStorageValue(cid, 99130) >= 1 then
  59.  
  60. selfSay('Voce ja tem a aura de fire.', cid)
  61. return true
  62. end
  63.  
  64. if(doPlayerRemoveItem(cid, gold_id, ammout) == true) then
  65.  
  66. setPlayerStorageValue(cid, 99130, 1)
  67. selfSay('Obrigado. agora voce tem sua aura de fire', cid)
  68. doSendMagicEffect(getThingPos(cid), 15)
  69. else
  70. selfSay('Voce não tem dinheiro pra isso.', cid)
  71. return true
  72. end
  73. elseif(msgcontains(msg, 'ice') or msgcontains(msg, 'ICE')) then
  74. if getPlayerStorageValue(cid, 99123) >= 1 then
  75.  
  76. selfSay('Voce ja tem a aura de ice.', cid)
  77. return true
  78. end
  79.  
  80. if(doPlayerRemoveItem(cid, gold_id, ammout) == true) then
  81.  
  82. setPlayerStorageValue(cid, 99123, 1)
  83. selfSay('Obrigado. agora voce tem sua aura de ice', cid)
  84. doSendMagicEffect(getThingPos(cid), 43)
  85. else
  86. selfSay('Voce não tem dinheiro pra isso.', cid)
  87. return true
  88. end
  89. elseif(msgcontains(msg, 'holy') or msgcontains(msg, 'HOLY')) then
  90. if getPlayerStorageValue(cid, 99124) >= 1 then
  91.  
  92. selfSay('Voce ja tem a aura de holy.', cid)
  93. return true
  94. end
  95.  
  96. if(doPlayerRemoveItem(cid, gold_id, ammout) == true) then
  97.  
  98. setPlayerStorageValue(cid, 99124, 1)
  99. selfSay('Obrigado. agora voce tem sua aura de holy', cid)
  100. doSendMagicEffect(getThingPos(cid), 39)
  101. else
  102. selfSay('Voce não tem dinheiro pra isso.', cid)
  103. return true
  104. end
  105. elseif(msgcontains(msg, 'physical') or msgcontains(msg, 'PHYSICAL')) then
  106. if getPlayerStorageValue(cid, 99126) >= 1 then
  107.  
  108. selfSay('Voce ja tem a aura de physical.', cid)
  109. return true
  110. end
  111.  
  112. if(doPlayerRemoveItem(cid, gold_id, ammout) == true) then
  113.  
  114. setPlayerStorageValue(cid, 99126, 1)
  115. selfSay('Obrigado. agora voce tem sua aura de physical', cid)
  116. doSendMagicEffect(getThingPos(cid), 3)
  117. else
  118. selfSay('Voce não tem dinheiro pra isso.', cid)
  119. return true
  120. end
  121. elseif(msgcontains(msg, 'energy') or msgcontains(msg, 'ENERGY')) then
  122. if getPlayerStorageValue(cid, 99127) >= 1 then
  123.  
  124. selfSay('Voce ja tem a aura de energy.', cid)
  125. return true
  126. end
  127.  
  128. if(doPlayerRemoveItem(cid, gold_id, ammout) == true) then
  129.  
  130. setPlayerStorageValue(cid, 99127, 1)
  131. selfSay('Obrigado. agora voce tem sua aura de energy', cid)
  132. doSendMagicEffect(getThingPos(cid), 11)
  133. else
  134. selfSay('Voce não tem dinheiro pra isso.', cid)
  135. return true
  136. end
  137. elseif(msgcontains(msg, 'poison') or msgcontains(msg, 'POISON')) then
  138. if getPlayerStorageValue(cid, 99129) >= 1 then
  139.  
  140. selfSay('Voce ja tem a aura de poison.', cid)
  141. return true
  142. end
  143.  
  144. if(doPlayerRemoveItem(cid, gold_id, ammout) == true) then
  145.  
  146. setPlayerStorageValue(cid, 99129, 1)
  147. selfSay('Obrigado. agora voce tem sua aura de posion', cid)
  148. doSendMagicEffect(getThingPos(cid), 8)
  149. else
  150. selfSay('Voce não tem dinheiro pra isso.', cid)
  151. return true
  152. end
  153. end
  154. return true
  155. end
  156.  
  157. npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
  158. npcHandler:addModule(FocusModule:new())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement