Guest User

Untitled

a guest
Mar 14th, 2019
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.14 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 shopModule = ShopModule:new()
  12. npcHandler:addModule(shopModule)
  13.  
  14. shopModule:addBuyableItem({'spellbook'}, 2175, 150, 'spellbook')
  15. shopModule:addBuyableItem({'magic lightwand'}, 2163, 400, 'magic lightwand')
  16.  
  17. shopModule:addBuyableItem({'small health'}, 8704, 20, 1, 'small health potion')
  18. shopModule:addBuyableItem({'health potion'}, 7618, 45, 1, 'health potion')
  19. shopModule:addBuyableItem({'mana potion'}, 7620, 50, 1, 'mana potion')
  20. shopModule:addBuyableItem({'strong health'}, 7588, 100, 1, 'strong health potion')
  21. shopModule:addBuyableItem({'strong mana'}, 7589, 80, 1, 'strong mana potion')
  22. shopModule:addBuyableItem({'great health'}, 7591, 190, 1, 'great health potion')
  23. shopModule:addBuyableItem({'great mana'}, 7590, 120, 1, 'great mana potion')
  24. shopModule:addBuyableItem({'great spirit'}, 8472, 190, 1, 'great spirit potion')
  25. shopModule:addBuyableItem({'ultimate health'}, 8473, 310, 1, 'ultimate health potion')
  26. shopModule:addBuyableItem({'antidote potion'}, 8474, 50, 1, 'antidote potion')
  27.  
  28. shopModule:addSellableItem({'normal potion flask', 'normal flask'}, 7636, 5, 'empty small potion flask')
  29. shopModule:addSellableItem({'strong potion flask', 'strong flask'}, 7634, 10, 'empty strong potion flask')
  30. shopModule:addSellableItem({'great potion flask', 'great flask'}, 7635, 15, 'empty great potion flask')
  31.  
  32. shopModule:addBuyableItem({'instense healing'}, 2265, 95, 1, 'intense healing rune')
  33. shopModule:addBuyableItem({'ultimate healing'}, 2273, 175, 1, 'ultimate healing rune')
  34. shopModule:addBuyableItem({'magic wall'}, 2293, 350, 3, 'magic wall rune')
  35. shopModule:addBuyableItem({'destroy field'}, 2261, 45, 3, 'destroy field rune')
  36. shopModule:addBuyableItem({'light magic missile'}, 2287, 40, 10, 'light magic missile rune')
  37. shopModule:addBuyableItem({'heavy magic missile'}, 2311, 120, 10, 'heavy magic missile rune')
  38. shopModule:addBuyableItem({'great fireball'}, 2304, 180, 4, 'great fireball rune')
  39. shopModule:addBuyableItem({'explosion'}, 2313, 250, 6, 'explosion rune')
  40. shopModule:addBuyableItem({'sudden death'}, 2268, 350, 3, 'sudden death rune')
  41. shopModule:addBuyableItem({'death arrow'}, 2263, 300, 3, 'death arrow rune')
  42. shopModule:addBuyableItem({'paralyze'}, 2278, 700, 1, 'paralyze rune')
  43. shopModule:addBuyableItem({'animate dead'}, 2316, 375, 1, 'animate dead rune')
  44. shopModule:addBuyableItem({'convince creature'}, 2290, 80, 1, 'convince creature rune')
  45. shopModule:addBuyableItem({'chameleon'}, 2291, 210, 1, 'chameleon rune')
  46. shopModule:addBuyableItem({'desintegrate'}, 2310, 80, 3, 'desintegreate rune')
  47.  
  48. shopModule:addBuyableItemContainer({'bp slhp'}, 2000, 8704, 400, 1, 'backpack of small health potions')
  49. shopModule:addBuyableItemContainer({'bp hp'}, 2000, 7618, 900, 1, 'backpack of health potions')
  50. shopModule:addBuyableItemContainer({'bp mp'}, 2001, 7620, 1000, 1, 'backpack of mana potions')
  51. shopModule:addBuyableItemContainer({'bp shp'}, 2000, 7588, 2000, 1, 'backpack of strong health potions')
  52. shopModule:addBuyableItemContainer({'bp smp'}, 2001, 7589, 1600, 1, 'backpack of strong mana potions')
  53. shopModule:addBuyableItemContainer({'bp ghp'}, 2000, 7591, 3800, 1, 'backpack of great health potions')
  54. shopModule:addBuyableItemContainer({'bp gmp'}, 2001, 7590, 2400, 1, 'backpack of great mana potions')
  55. shopModule:addBuyableItemContainer({'bp gsp'}, 1999, 8472, 3800, 1, 'backpack of great spirit potions')
  56. shopModule:addBuyableItemContainer({'bp uhp'}, 2000, 8473, 6200, 1, 'backpack of ultimate health potions')
  57. shopModule:addBuyableItemContainer({'bp ap'}, 2002, 8474, 2000, 1, 'backpack of antidote potions')
  58.  
  59. shopModule:addBuyableItem({'wand of vortex', 'vortex'}, 2190, 500, 'wand of vortex')
  60. shopModule:addBuyableItem({'wand of dragonbreath', 'dragonbreath'}, 2191, 1000, 'wand of dragonbreath')
  61. shopModule:addBuyableItem({'wand of decay', 'decay'}, 2188, 5000, 'wand of decay')
  62. shopModule:addBuyableItem({'wand of draconia', 'draconia'}, 8921, 7500, 'wand of draconia')
  63. shopModule:addBuyableItem({'wand of cosmic energy', 'cosmic energy'}, 2189, 10000, 'wand of cosmic energy')
  64. shopModule:addBuyableItem({'wand of inferno', 'inferno'}, 2187, 15000, 'wand of inferno')
  65. shopModule:addBuyableItem({'wand of starstorm', 'starstorm'}, 8920, 18000, 'wand of starstorm')
  66. shopModule:addBuyableItem({'wand of voodoo', 'voodoo'}, 8922, 22000, 'wand of voodoo')
  67.  
  68. shopModule:addBuyableItem({'snakebite rod', 'snakebite'}, 2182, 500, 'snakebite rod')
  69. shopModule:addBuyableItem({'moonlight rod', 'moonlight'}, 2186, 1000, 'moonlight rod')
  70. shopModule:addBuyableItem({'necrotic rod', 'necrotic'}, 2185, 5000, 'necrotic rod')
  71. shopModule:addBuyableItem({'northwind rod', 'northwind'}, 8911, 7500, 'northwind rod')
  72. shopModule:addBuyableItem({'terra rod', 'terra'}, 2181, 10000, 'terra rod')
  73. shopModule:addBuyableItem({'hailstorm rod', 'hailstorm'}, 2183, 15000, 'hailstorm rod')
  74. shopModule:addBuyableItem({'springsprout rod', 'springsprout'}, 8912, 18000, 'springsprout rod')
  75. shopModule:addBuyableItem({'underworld rod', 'underworld'}, 8910, 22000, 'underworld rod')
  76.  
  77. shopModule:addSellableItem({'wand of vortex', 'vortex'}, 2190, 250, 'wand of vortex')
  78. shopModule:addSellableItem({'wand of dragonbreath', 'dragonbreath'}, 2191, 500, 'wand of dragonbreath')
  79. shopModule:addSellableItem({'wand of decay', 'decay'}, 2188, 2500, 'wand of decay')
  80. shopModule:addSellableItem({'wand of draconia', 'draconia'}, 8921, 3750, 'wand of draconia')
  81. shopModule:addSellableItem({'wand of cosmic energy', 'cosmic energy'}, 2189, 5000, 'wand of cosmic energy')
  82. shopModule:addSellableItem({'wand of inferno', 'inferno'},2187, 7500, 'wand of inferno')
  83. shopModule:addSellableItem({'wand of starstorm', 'starstorm'}, 8920, 9000, 'wand of starstorm')
  84. shopModule:addSellableItem({'wand of voodoo', 'voodoo'}, 8922, 11000, 'wand of voodoo')
  85.  
  86. shopModule:addSellableItem({'snakebite rod', 'snakebite'}, 2182, 250,'snakebite rod')
  87. shopModule:addSellableItem({'moonlight rod', 'moonlight'}, 2186, 500, 'moonlight rod')
  88. shopModule:addSellableItem({'necrotic rod', 'necrotic'}, 2185, 2500, 'necrotic rod')
  89. shopModule:addSellableItem({'northwind rod', 'northwind'}, 8911, 3750, 'northwind rod')
  90. shopModule:addSellableItem({'terra rod', 'terra'}, 2181, 5000, 'terra rod')
  91. shopModule:addSellableItem({'hailstorm rod', 'hailstorm'}, 2183, 7500, 'hailstorm rod')
  92. shopModule:addSellableItem({'springsprout rod', 'springsprout'}, 8912, 9000, 'springsprout rod')
  93. shopModule:addSellableItem({'underworld rod', 'underworld'}, 8910, 11000, 'underworld rod')
  94.  
  95. local items = {[1] = 2190, [2] = 2182, [5] = 2190, [6] = 2182}
  96. function creatureSayCallback(cid, type, msg)
  97. if(not npcHandler:isFocused(cid)) then
  98. return false
  99. end
  100.  
  101. local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
  102. if(msgcontains(msg, 'first rod') or msgcontains(msg, 'first wand')) then
  103. if(isSorcerer(cid) or isDruid(cid)) then
  104. if(getPlayerStorageValue(cid, 30002) <= 0) then
  105. selfSay('So you ask me for a {' .. getItemNameById(items[getPlayerVocation(cid)]) .. '} to begin your advanture?', cid)
  106. talkState[talkUser] = 1
  107. else
  108. selfSay('What? I have already gave you one {' .. getItemNameById(items[getPlayerVocation(cid)]) .. '}!', cid)
  109. end
  110. else
  111. selfSay('Sorry, you aren\'t a druid either a sorcerer.', cid)
  112. end
  113. elseif(msgcontains(msg, 'yes')) then
  114. if(talkState[talkUser] == 1) then
  115. doPlayerAddItem(cid, items[getPlayerVocation(cid)], 1)
  116. selfSay('Here you are young adept, take care yourself.', cid)
  117. setPlayerStorageValue(cid, 30002, 1)
  118. end
  119. talkState[talkUser] = 0
  120. elseif(msgcontains(msg, 'no') and isInArray({1}, talkState[talkUser])) then
  121. selfSay('Ok then.', cid)
  122. talkState[talkUser] = 0
  123. end
  124.  
  125. return true
  126. end
  127.  
  128. npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
  129. npcHandler:addModule(FocusModule:new())
Add Comment
Please, Sign In to add comment