Advertisement
Guest User

Untitled

a guest
Jul 17th, 2019
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 8.48 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.  
  13. local vocation = getPlayerVocation(cid)
  14.  
  15. -- Configs of buffs
  16.  
  17. local conditionMagic = createConditionObject(CONDITION_ATTRIBUTES)
  18. setConditionParam(conditionMagic, CONDITION_PARAM_BUFF, true)
  19. setConditionParam(conditionMagic, CONDITION_PARAM_TICKS, 600*1000)
  20. setConditionParam(conditionMagic, CONDITION_PARAM_STAT_MAGICLEVEL, 10)
  21.  
  22. local combatInvisible = createConditionObject(CONDITION_INVISIBLE)
  23. setConditionParam(combatInvisible, CONDITION_PARAM_BUFF, true)
  24. setConditionParam(combatInvisible, CONDITION_PARAM_TICKS, 600*1000)
  25.  
  26. local conditionMelee = createConditionObject(CONDITION_ATTRIBUTES)
  27. setConditionParam(conditionMelee, CONDITION_PARAM_BUFF, true)
  28. setConditionParam(conditionMelee, CONDITION_PARAM_TICKS, 600*1000)
  29. setConditionParam(conditionMelee, CONDITION_PARAM_SKILL_FIST, 20)
  30. setConditionParam(conditionMelee, CONDITION_PARAM_SKILL_CLUB, 20)
  31. setConditionParam(conditionMelee, CONDITION_PARAM_SKILL_SWORD, 20)
  32. setConditionParam(conditionMelee, CONDITION_PARAM_SKILL_AXE, 20)
  33.  
  34. local conditionDistance = createConditionObject(CONDITION_ATTRIBUTES)
  35. setConditionParam(conditionDistance, CONDITION_PARAM_BUFF, true)
  36. setConditionParam(conditionDistance, CONDITION_PARAM_TICKS, 600*1000)
  37. setConditionParam(conditionDistance, CONDITION_PARAM_SKILL_DISTANCE, 20)
  38.  
  39. local conditionShield = createConditionObject(CONDITION_ATTRIBUTES)
  40. setConditionParam(conditionShield, CONDITION_PARAM_BUFF, true)
  41. setConditionParam(conditionShield, CONDITION_PARAM_TICKS, 600*1000)
  42. setConditionParam(conditionShield, CONDITION_PARAM_SKILL_SHIELD, 20)
  43.  
  44. local combatUtamo = createConditionObject(CONDITION_MANASHIELD)
  45. setConditionParam(combatUtamo, CONDITION_PARAM_BUFF, true)
  46. setConditionParam(combatUtamo, CONDITION_PARAM_TICKS, 600*1000)
  47.  
  48. local conditionRege = createConditionObject(CONDITION_REGENERATION)
  49. setConditionParam(conditionRege, CONDITION_PARAM_BUFF, true)
  50. setConditionParam(conditionRege, CONDITION_PARAM_TICKS, 600*1000)
  51. setConditionParam(conditionRege, CONDITION_PARAM_HEALTHGAIN, 20)
  52. setConditionParam(conditionRege, CONDITION_PARAM_HEALTHTICKS, 2000)
  53.  
  54. local conditionspeed = createConditionObject(CONDITION_HASTE)
  55. setConditionParam(conditionspeed, CONDITION_PARAM_TICKS, 600*1000)
  56. setConditionFormula(conditionspeed, 1.0, -86, 1.0, -86)
  57.  
  58. -- Configs of buffs
  59.  
  60. function magicl(cid, message, keywords, parameters, node)
  61.     local guid = getPlayerGUID(cid)
  62.  
  63.     if not npcHandler:isFocused(cid) then
  64.         return false
  65.     end
  66.  
  67.     if isDruid(cid) or isSorcerer(cid) then
  68.         if getPlayerMoney(cid) >= 200 then
  69.             doPlayerRemoveMoney(cid, 200)
  70.             doAddCondition(cid, conditionMagic)
  71.             selfSay('Your magic level has increased for ' .. 600 .. '!', cid)
  72.             setPlayerStorageValue(cid, 77700, 1)       
  73.             addEvent(db.executeQuery, 600 * 1000, "UPDATE `player_storage` SET `key` = " .. 77700 .. ", `1` = -1 WHERE `player_id` = " .. guid .. " LIMIT 1;")
  74.         else
  75.             selfSay('You don\'t have such money.', cid)
  76.         end
  77.     else
  78.         selfSay('You must be a druid or a sorcerer to receive this increment.', cid)
  79.     end
  80. end
  81.  
  82. function invisible(cid, message, keywords, parameters, node)
  83.     local guid = getPlayerGUID(cid)
  84.  
  85.     if not npcHandler:isFocused(cid) then
  86.         return false
  87.     end
  88.  
  89.     if isDruid(cid) or isSorcerer(cid) then
  90.         if getPlayerMoney(cid) >= 200 then
  91.             doPlayerRemoveMoney(cid, 200)
  92.             selfSay('You received invisibility for ".. 600.."!', cid)
  93.             doAddCondition(cid, combatInvisible)
  94.             setPlayerStorageValue(cid, 77700, 1)       
  95.             addEvent(db.executeQuery, 600 * 1000, "UPDATE `player_storage` SET `key` = " .. 77700 .. ", `1` = -1 WHERE `player_id` = " .. guid .. " LIMIT 1;")
  96.         else
  97.             selfSay('You don\'t have such money.', cid)
  98.         end
  99.     else
  100.         selfSay('You must be a druid or a sorcerer to receive this increment.', cid)
  101.     end
  102. end
  103.  
  104. function melee(cid, message, keywords, parameters, node)
  105.     local guid = getPlayerGUID(cid)
  106.  
  107.     if not npcHandler:isFocused(cid) then
  108.         return false
  109.     end
  110.  
  111.     if isKnight(cid) then
  112.         if getPlayerMoney(cid) >= 200 then
  113.             doPlayerRemoveMoney(cid, 200)
  114.             doAddCondition(cid, conditionMelee)
  115.             selfSay('Your Melee Skills has increased for ".. 600 .."!', cid)
  116.             setPlayerStorageValue(cid, 77700, 1)       
  117.             addEvent(db.executeQuery, 600 * 1000, "UPDATE `player_storage` SET `key` = " .. 77700 .. ", `1` = -1 WHERE `player_id` = " .. guid .. " LIMIT 1;")
  118.         else
  119.             selfSay('You don\'t have such money.', cid)
  120.         end
  121.     else
  122.         selfSay('You must be a knight to receive this increment.', cid)
  123.     end
  124. end
  125.  
  126. function distance(cid, message, keywords, parameters, node)
  127.     local guid = getPlayerGUID(cid)
  128.  
  129.     if not npcHandler:isFocused(cid) then
  130.         return false
  131.     end
  132.  
  133.     if isPaladin(cid) then
  134.         if getPlayerMoney(cid) >= 200 then
  135.             doPlayerRemoveMoney(cid, 200)
  136.             doAddCondition(cid, conditionDistance)
  137.             selfSay('Your Distance Skill has increased for ".. 600 .."!', cid)
  138.             setPlayerStorageValue(cid, 77700, 1)       
  139.             addEvent(db.executeQuery, 600 * 1000, "UPDATE `player_storage` SET `key` = " .. 77700 .. ", `1` = -1 WHERE `player_id` = " .. guid .. " LIMIT 1;")
  140.         else
  141.             selfSay('You don\'t have such money.', cid)
  142.         end
  143.     else
  144.         selfSay('You must be a Paladin to receive this increment.', cid)
  145.     end
  146. end
  147.  
  148.  
  149. function shield(cid, message, keywords, parameters, node)
  150.     local guid = getPlayerGUID(cid)
  151.  
  152.     if not npcHandler:isFocused(cid) then
  153.         return false
  154.     end
  155.  
  156.     if isPaladin(cid) or isKnight(cid) then
  157.         if getPlayerMoney(cid) >= 200 then
  158.             doPlayerRemoveMoney(cid, 200)
  159.                 doAddCondition(cid, conditionShield)
  160.             selfSay('Your Shielding Skill has increased for ".. 600 .."!', cid)
  161.             setPlayerStorageValue(cid, 77700, 1)       
  162.             addEvent(db.executeQuery, 600 * 1000, "UPDATE `player_storage` SET `key` = " .. 77700 .. ", `1` = -1 WHERE `player_id` = " .. guid .. " LIMIT 1;")
  163.         else
  164.             selfSay('You don\'t have such money.', cid)
  165.         end
  166.     else
  167.         selfSay('You must be a Paladin or a Knight to receive this increment.', cid)
  168.     end
  169. end
  170.  
  171.  
  172. function magicshield(cid, message, keywords, parameters, node)
  173.     local guid = getPlayerGUID(cid)
  174.  
  175.     if not npcHandler:isFocused(cid) then
  176.         return false
  177.     end
  178.  
  179.     if isPaladin(cid) or isDruid(cid) or isSorcerer(cid) then
  180.         if getPlayerMoney(cid) >= 200 then
  181.             doPlayerRemoveMoney(cid, 200)
  182.                 doAddCondition(cid, combatUtamo)
  183.             selfSay('You received a Magic Shield for ".. 600 .."!', cid)
  184.             setPlayerStorageValue(cid, 77700, 1)       
  185.             addEvent(db.executeQuery, 600 * 1000, "UPDATE `player_storage` SET `key` = " .. 77700 .. ", `1` = -1 WHERE `player_id` = " .. guid .. " LIMIT 1;")
  186.         else
  187.             selfSay('You don\'t have such money.', cid)
  188.         end
  189.     else
  190.         selfSay('Knights can\'t receive this increment.', cid)
  191.     end
  192. end
  193.  
  194.  
  195. function regener(cid, message, keywords, parameters, node)
  196.     local guid = getPlayerGUID(cid)
  197.  
  198.     if not npcHandler:isFocused(cid) then
  199.         return false
  200.     end
  201.  
  202.     if isPlayer(cid) then
  203.         if getPlayerMoney(cid) >= 200 then
  204.             doPlayerRemoveMoney(cid, 200)
  205.                 doAddCondition(cid, conditionRege)
  206.             selfSay('Your regeneration has increased for ".. 600 .."!', cid)
  207.             setPlayerStorageValue(cid, 77700, 1)       
  208.             addEvent(db.executeQuery, 600 * 1000, "UPDATE `player_storage` SET `key` = " .. 77700 .. ", `1` = -1 WHERE `player_id` = " .. guid .. " LIMIT 1;")
  209.         else
  210.             selfSay('You don\'t have such money.', cid)
  211.         end
  212.     else
  213.         selfSay('Something is wrong, you didn\'t received this increment.', cid)
  214.     end
  215. end
  216.  
  217.  
  218. function speed(cid, message, keywords, parameters, node)
  219.     local guid = getPlayerGUID(cid)
  220.  
  221.     if not npcHandler:isFocused(cid) then
  222.         return false
  223.     end
  224.  
  225.     if isPlayer(cid) then
  226.         if getPlayerMoney(cid) >= 200 then
  227.             doPlayerRemoveMoney(cid, 200)
  228.                 doAddCondition(cid, conditionspeed)
  229.             selfSay('Your regeneration has increased for ".. 600 .."!', cid)
  230.             setPlayerStorageValue(cid, 77700, 1)       
  231.             addEvent(db.executeQuery, 600 * 1000, "UPDATE `player_storage` SET `key` = " .. 77700 .. ", `1` = -1 WHERE `player_id` = " .. guid .. " LIMIT 1;")
  232.         else
  233.             selfSay('You don\'t have such money.', cid)
  234.         end
  235.     else
  236.         selfSay('Something is wrong, you didn\'t received this increment.', cid)
  237.     end
  238. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement