Advertisement
Guest User

Untitled

a guest
Apr 21st, 2016
249
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 17.14 KB | None | 0 0
  1. local keywordHandler = KeywordHandler:new()
  2. local npcHandler = NpcHandler:new(keywordHandler)
  3. NpcSystem.parseParameters(npcHandler)
  4.  
  5. function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end
  6. function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end
  7. function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end
  8. function onThink() npcHandler:onThink() end
  9.  
  10. -- Buff Config beginning --
  11.  
  12. -- configs
  13. local config = {
  14. storage = 77700,
  15. value = 1,
  16. level = 100,
  17. }
  18. money = 0
  19. invisibleseconds = 600
  20. magicshieldseconds = 600
  21. regeseconds = 600
  22. speedseconds = 600
  23. skillsseconds = 600
  24. skillsupgrade = {}
  25. skillsupgrade['fist'] = 20
  26. skillsupgrade['club'] = 20
  27. skillsupgrade['sword'] = 20
  28. skillsupgrade['axe'] = 20
  29. skillsupgrade['distance'] = 20
  30. skillsupgrade['shield'] = 20
  31. skillsupgrade['ml'] = 10
  32. -- end configs
  33.  
  34. -- Configs of buffs
  35.  
  36. local conditionMagic = createConditionObject(CONDITION_ATTRIBUTES)
  37. setConditionParam(conditionMagic, CONDITION_PARAM_BUFF, true)
  38. setConditionParam(conditionMagic, CONDITION_PARAM_TICKS, skillsseconds * 1000)
  39. setConditionParam(conditionMagic, CONDITION_PARAM_STAT_MAGICLEVEL, skillsupgrade['ml'])
  40.  
  41. local combatInvisible = createConditionObject(CONDITION_INVISIBLE)
  42. setConditionParam(combatInvisible, CONDITION_PARAM_BUFF, true)
  43. setConditionParam(combatInvisible, CONDITION_PARAM_TICKS, invisibleseconds*1000)
  44.  
  45. local conditionMelee = createConditionObject(CONDITION_ATTRIBUTES)
  46. setConditionParam(conditionMelee, CONDITION_PARAM_BUFF, true)
  47. setConditionParam(conditionMelee, CONDITION_PARAM_TICKS, skillsseconds*1000)
  48. setConditionParam(conditionMelee, CONDITION_PARAM_SKILL_FIST, skillsupgrade['fist'])
  49. setConditionParam(conditionMelee, CONDITION_PARAM_SKILL_CLUB, skillsupgrade['club'])
  50. setConditionParam(conditionMelee, CONDITION_PARAM_SKILL_SWORD, skillsupgrade['sword'])
  51. setConditionParam(conditionMelee, CONDITION_PARAM_SKILL_AXE, skillsupgrade['axe'])
  52.  
  53. local conditionDistance = createConditionObject(CONDITION_ATTRIBUTES)
  54. setConditionParam(conditionDistance, CONDITION_PARAM_BUFF, true)
  55. setConditionParam(conditionDistance, CONDITION_PARAM_TICKS, skillsseconds*1000)
  56. setConditionParam(conditionDistance, CONDITION_PARAM_SKILL_DISTANCE, skillsupgrade['distance'])
  57.  
  58. local conditionShield = createConditionObject(CONDITION_ATTRIBUTES)
  59. setConditionParam(conditionShield, CONDITION_PARAM_BUFF, true)
  60. setConditionParam(conditionShield, CONDITION_PARAM_TICKS, skillsseconds*1000)
  61. setConditionParam(conditionShield, CONDITION_PARAM_SKILL_SHIELD, skillsupgrade['shield'])
  62.  
  63. local combatUtamo = createConditionObject(CONDITION_MANASHIELD)
  64. setConditionParam(combatUtamo, CONDITION_PARAM_BUFF, true)
  65. setConditionParam(combatUtamo, CONDITION_PARAM_TICKS, magicshieldseconds*1000)
  66.  
  67. local conditionRege = createConditionObject(CONDITION_REGENERATION)
  68. setConditionParam(conditionRege, CONDITION_PARAM_BUFF, true)
  69. setConditionParam(conditionRege, CONDITION_PARAM_TICKS, regeseconds*1000)
  70. setConditionParam(conditionRege, CONDITION_PARAM_HEALTHGAIN, 20)
  71. setConditionParam(conditionRege, CONDITION_PARAM_HEALTHTICKS, 2000)
  72.  
  73. local conditionspeed = createConditionObject(CONDITION_HASTE)
  74. setConditionParam(conditionspeed, CONDITION_PARAM_BUFF, true)
  75. setConditionParam(conditionspeed, CONDITION_PARAM_TICKS, speedseconds*1000)
  76. setConditionFormula(conditionspeed, 1.0, -86, 1.0, -86)
  77.  
  78. function getclass(cid)
  79. local player = Player(cid)
  80. for voc, x in pairs(config) do
  81. local v = player:getVocation():getId()
  82. end
  83. return player:getVocation():getId()
  84. end
  85.  
  86. -- Configs of buffs
  87.  
  88. function magicl(cid, message, keywords, parameters, node)
  89. local guid = getPlayerGUID(cid)
  90. local player = Player(cid)
  91. player:getLevel()
  92.  
  93. if not npcHandler:isFocused(cid) then
  94. return false
  95. end
  96. if player:getLevel(cid) < config.level then
  97. if getclass(cid) == 1 or getclass(cid) == 5 or getclass(cid) == 2 or getclass(cid) == 6 or getclass(cid) == 12 or getclass(cid) == 13 and getCreatureStorage(cid, config.storage) == -1 then
  98. if getPlayerMoney(cid) >= money then
  99. doPlayerRemoveMoney(cid, money)
  100. doAddCondition(cid, conditionMagic)
  101. npcHandler:say('Your magic level has increased for 10 minutes!', cid)
  102. setPlayerStorageValue(cid, config.storage, config.value)
  103. addEvent(db.executeQuery, skillsseconds * 1000, "UPDATE `player_storage` SET `key` = " .. config.storage .. ", `value` = -1 WHERE `player_id` = " .. guid .. " LIMIT 1;")
  104. else
  105. npcHandler:say('You don\'t have such money.', cid)
  106. end
  107. else
  108. npcHandler:say('You must be a druid or a sorcerer or a shaman to receive this increment.', cid)
  109. end
  110. else
  111. npcHandler:say('You need to be below level ' .. config.level .. ' .', cid)
  112. end
  113. end
  114. function invisible(cid, message, keywords, parameters, node)
  115. local guid = getPlayerGUID(cid)
  116. local player = Player(cid)
  117. player:getLevel()
  118.  
  119. if not npcHandler:isFocused(cid) then
  120. return false
  121. end
  122. if player:getLevel(cid) < config.level then
  123. if getclass(cid) == 1 or getclass(cid) == 5 or getclass(cid) == 2 or getclass(cid) == 6 or getclass(cid) == 12 or getclass(cid) == 13 and getCreatureStorage(cid, config.storage) == -1 then
  124. if getPlayerMoney(cid) >= money then
  125. doPlayerRemoveMoney(cid, money)
  126. npcHandler:say('You received invisibility for 10 minutes!', cid)
  127. doAddCondition(cid, combatInvisible)
  128. setPlayerStorageValue(cid, config.storage, config.value)
  129. addEvent(db.executeQuery, invisibleseconds * 1000, "UPDATE `player_storage` SET `key` = " .. config.storage .. ", `value` = -1 WHERE `player_id` = " .. guid .. " LIMIT 1;")
  130. else
  131. npcHandler:say('You don\'t have such money.', cid)
  132. end
  133. else
  134. npcHandler:say('You must be a druid or a sorcerer to receive this increment.', cid)
  135. end
  136. else
  137. npcHandler:say('You need to be below level ' .. config.level .. ' .', cid)
  138. end
  139. end
  140. function melee(cid, message, keywords, parameters, node)
  141. local guid = getPlayerGUID(cid)
  142. local player = Player(cid)
  143. player:getLevel()
  144.  
  145. if not npcHandler:isFocused(cid) then
  146. return false
  147. end
  148. if player:getLevel(cid) < config.level then
  149. if getclass(cid) == 4 or getclass(cid) == 8 or getclass(cid) == 12 or getclass(cid) == 13 or getclass(cid) == 10 or getclass(cid) == 11 and getCreatureStorage(cid, config.storage) == -1 then
  150. if getPlayerMoney(cid) >= money then
  151. doPlayerRemoveMoney(cid, money)
  152. doAddCondition(cid, conditionMelee)
  153. npcHandler:say('Your Melee Skills has increased for 10 minutes!', cid)
  154. setPlayerStorageValue(cid, config.storage, config.value)
  155. addEvent(db.executeQuery, skillsseconds * 1000, "UPDATE `player_storage` SET `key` = " .. config.storage .. ", `value` = -1 WHERE `player_id` = " .. guid .. " LIMIT 1;")
  156. else
  157. npcHandler:say('You don\'t have such money.', cid)
  158. end
  159. else
  160. npcHandler:say('You must be a knight to receive this increment.', cid)
  161. end
  162. else
  163. npcHandler:say('You need to be below level ' .. config.level .. ' .', cid)
  164. end
  165. end
  166. function distance(cid, message, keywords, parameters, node)
  167. local guid = getPlayerGUID(cid)
  168. local player = Player(cid)
  169. player:getLevel()
  170.  
  171. if not npcHandler:isFocused(cid) then
  172. return false
  173. end
  174. if player:getLevel(cid) < config.level then
  175. if getclass(cid) == 3 or getclass(cid) == 7 and getCreatureStorage(cid, config.storage) == -1 then
  176. if getPlayerMoney(cid) >= money then
  177. doPlayerRemoveMoney(cid, money)
  178. doAddCondition(cid, conditionDistance)
  179. npcHandler:say('Your Distance Skill has increased for 10 minutes!', cid)
  180. setPlayerStorageValue(cid, config.storage, config.value)
  181. addEvent(db.executeQuery, skillsseconds * 1000, "UPDATE `player_storage` SET `key` = " .. config.storage .. ", `value` = -1 WHERE `player_id` = " .. guid .. " LIMIT 1;")
  182. else
  183. npcHandler:say('You don\'t have such money.', cid)
  184. end
  185. else
  186. npcHandler:say('You must be a Paladin to receive this increment.', cid)
  187. end
  188. else
  189. npcHandler:say('You need to be below level ' .. config.level .. ' .', cid)
  190. end
  191. end
  192.  
  193. function shield(cid, message, keywords, parameters, node)
  194. local guid = getPlayerGUID(cid)
  195. local player = Player(cid)
  196. player:getLevel()
  197.  
  198. if not npcHandler:isFocused(cid) then
  199. return false
  200. end
  201. if player:getLevel(cid) < config.level then
  202. if getclass(cid) == 3 or getclass(cid) == 7 or getclass(cid) == 2 or getclass(cid) == 4 and getCreatureStorage(cid, config.storage) == -1 then
  203. if getPlayerMoney(cid) >= money then
  204. doPlayerRemoveMoney(cid, money)
  205. doAddCondition(cid, conditionShield)
  206. npcHandler:say('Your Shielding Skill has increased for 10 minutes!', cid)
  207. setPlayerStorageValue(cid, config.storage, config.value)
  208. addEvent(db.executeQuery, skillsseconds * 1000, "UPDATE `player_storage` SET `key` = " .. config.storage .. ", `value` = -1 WHERE `player_id` = " .. guid .. " LIMIT 1;")
  209. else
  210. npcHandler:say('You don\'t have such money.', cid)
  211. end
  212. else
  213. npcHandler:say('You must be a Paladin or a Knight to receive this increment.', cid)
  214. end
  215. else
  216. npcHandler:say('You need to be below level ' .. config.level .. ' .', cid)
  217. end
  218. end
  219.  
  220. function magicshield(cid, message, keywords, parameters, node)
  221. local guid = getPlayerGUID(cid)
  222. local player = Player(cid)
  223. player:getLevel()
  224.  
  225. if not npcHandler:isFocused(cid) then
  226. return false
  227. end
  228. if player:getLevel(cid) < config.level then
  229. if getclass(cid) == 1 or getclass(cid) == 5 or getclass(cid) == 2 or getclass(cid) == 6 or getclass(cid) == 12 or getclass(cid) == 13 and getCreatureStorage(cid, config.storage) == -1 then
  230. if getPlayerMoney(cid) >= money then
  231. doPlayerRemoveMoney(cid, money)
  232. doAddCondition(cid, combatUtamo)
  233. npcHandler:say('You received a Magic Shield for 10 minutes!', cid)
  234. setPlayerStorageValue(cid, config.storage, config.value)
  235. addEvent(db.executeQuery, magicshieldseconds * 1000, "UPDATE `player_storage` SET `key` = " .. config.storage .. ", `value` = -1 WHERE `player_id` = " .. guid .. " LIMIT 1;")
  236. else
  237. npcHandler:say('You don\'t have such money.', cid)
  238. end
  239. else
  240. npcHandler:say('Knights can\'t receive this increment.', cid)
  241. end
  242. else
  243. npcHandler:say('You need to be below level ' .. config.level .. ' .', cid)
  244. end
  245. end
  246.  
  247. function regener(cid, message, keywords, parameters, node)
  248. local guid = getPlayerGUID(cid)
  249. local player = Player(cid)
  250. player:getLevel()
  251.  
  252. if not npcHandler:isFocused(cid) then
  253. return false
  254. end
  255. if player:getLevel(cid) < config.level then
  256. if isPlayer(cid) and getCreatureStorage(cid, config.storage) == -1 then
  257. if getPlayerMoney(cid) >= money then
  258. doPlayerRemoveMoney(cid, money)
  259. doAddCondition(cid, conditionRege)
  260. npcHandler:say('Your regeneration has increased for 10 minutes!', cid)
  261. setPlayerStorageValue(cid, config.storage, config.value)
  262. addEvent(db.executeQuery, regeseconds * 1000, "UPDATE `player_storage` SET `key` = " .. config.storage .. ", `value` = -1 WHERE `player_id` = " .. guid .. " LIMIT 1;")
  263. else
  264. npcHandler:say('You don\'t have such money.', cid)
  265. end
  266. else
  267. npcHandler:say('You can\'t receive more than two increases.', cid)
  268. end
  269. else
  270. npcHandler:say('You need to be below level ' .. config.level .. ' .', cid)
  271. end
  272. end
  273.  
  274.  
  275. function speed(cid, message, keywords, parameters, node)
  276. local guid = getPlayerGUID(cid)
  277. local player = Player(cid)
  278. player:getLevel()
  279.  
  280. if not npcHandler:isFocused(cid) then
  281. return false
  282. end
  283. if player:getLevel(cid) < config.level then
  284. if isPlayer(cid) and getCreatureStorage(cid, config.storage) == -1 then
  285. if getPlayerMoney(cid) >= money then
  286. doPlayerRemoveMoney(cid, money)
  287. doAddCondition(cid, conditionspeed)
  288. npcHandler:say('Your speed has increased for 10 minutes!', cid)
  289. setPlayerStorageValue(cid, config.storage, config.value)
  290. addEvent(db.executeQuery, speedseconds * 1000, "UPDATE `player_storage` SET `key` = " .. config.storage .. ", `value` = -1 WHERE `player_id` = " .. guid .. " LIMIT 1;")
  291. else
  292. npcHandler:say('You don\'t have such money.', cid)
  293. end
  294. else
  295. npcHandler:say('You can\'t receive more than two increases.', cid)
  296. end
  297. else
  298. npcHandler:say('You need to be below level ' .. config.level .. ' .', cid)
  299. end
  300. end
  301. -- Buff Config End --
  302.  
  303. keywordHandler:addKeyword({'help'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I can increase your {melee}, {distance}, {shielding}, {magic level}, {regeneration}, {magic shield} and {speed} if you are below 100 lvl."})
  304.  
  305. local node1 = keywordHandler:addKeyword({'magic level'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to increase your magic level for a certain time?'})
  306. node1:addChildKeyword({'yes'}, magicl, {npcHandler = npcHandler, onlyFocus = true, reset = true})
  307. node1:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then. Come back if you want an upgrade in your skills.', reset = true})
  308.  
  309. --local node2 = keywordHandler:addKeyword({'invisibility'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to be invisible for a certain time?'})
  310. -- node2:addChildKeyword({'yes'}, invisible, {npcHandler = npcHandler, onlyFocus = true, reset = true})
  311. -- node2:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then. Come back if you want an upgrade in your skills.', reset = true})
  312.  
  313. local node3 = keywordHandler:addKeyword({'melee'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to increase your melee skills for a certain time?'})
  314. node3:addChildKeyword({'yes'}, melee, {npcHandler = npcHandler, onlyFocus = true, reset = true})
  315. node3:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then. Come back if you want an upgrade in your skills.', reset = true})
  316.  
  317. local node4 = keywordHandler:addKeyword({'distance'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to increase your distance skills for a certain time?'})
  318. node4:addChildKeyword({'yes'}, distance, {npcHandler = npcHandler, onlyFocus = true, reset = true})
  319. node4:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then. Come back if you want an upgrade in your skills.', reset = true})
  320.  
  321. local node5 = keywordHandler:addKeyword({'shielding'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to increase your shielding skill for a certain time?'})
  322. node5:addChildKeyword({'yes'}, shield, {npcHandler = npcHandler, onlyFocus = true, reset = true})
  323. node5:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then. Come back if you want an upgrade in your skills.', reset = true})
  324.  
  325. local node6 = keywordHandler:addKeyword({'magic shield'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to receive a magic shield for a certain time?'})
  326. node6:addChildKeyword({'yes'}, magicshield, {npcHandler = npcHandler, onlyFocus = true, reset = true})
  327. node6:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then. Come back if you want an upgrade in your skills.', reset = true})
  328.  
  329. local node7 = keywordHandler:addKeyword({'regeneration'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to increase your regeneration for a certain time?'})
  330. node7:addChildKeyword({'yes'}, regener, {npcHandler = npcHandler, onlyFocus = true, reset = true})
  331. node7:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then. Come back if you want an upgrade in your skills.', reset = true})
  332.  
  333. local node8 = keywordHandler:addKeyword({'speed'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to increase your speed for a certain time?'})
  334. node8:addChildKeyword({'yes'}, speed, {npcHandler = npcHandler, onlyFocus = true, reset = true})
  335. node8:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then. Come back if you want an upgrade in your skills.', reset = true})
  336.  
  337. npcHandler:addModule(FocusModule:new())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement