Advertisement
Guest User

Untitled

a guest
Nov 23rd, 2014
147
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.64 KB | None | 0 0
  1. local tasks =
  2. {
  3.  
  4. [1] = {questStarted = 1510, questStorage = 65000, killsRequired = 100, raceName = "Trolls", rewards = {{enable = true, type = "exp", values = 200}, {enable = true, type = "money", values = 200}}},
  5.  
  6. [2] = {questStarted = 1511, questStorage = 65001, killsRequired = 150, raceName = "Goblins", rewards = {{enable = true, type = "exp", values = 300}, {enable = true, type = "money", values = 250}}},
  7.  
  8. [3] = {questStarted = 1512, questStorage = 65002, killsRequired = 300, raceName = "Rotworms", rewards = {{enable = true, type = "exp", values = 1000}, {enable = true, type = "money", values = 400}}},
  9.  
  10. [4] = {questStarted = 1513, questStorage = 65003, killsRequired = 500, raceName = "Cyclops", rewards = {{enable = true, type = "exp", values = 3000}, {enable = true, type = "money", values = 800}}},
  11.  
  12. [5] = {questStarted = 1514, questStorage = 65004, killsRequired = 300, raceName = "Crocodiles", rewards = {{enable = true, type = "exp", values = 800}, {enable = true, type = "boss", values = THESNAPPER_POSITION}, {enable = true, type = "points", values = 2}}},
  13.  
  14. [6] = {questStarted = 1515, questStorage = 65005, killsRequired = 300, raceName = "Tarantulas", rewards = {{enable = true, type = "money", values = 1500}, {enable = true, type = "boss", values = HIDE_POSITION}, {enable = true, type = "points", values = 2}}},
  15.  
  16. [7] = {questStarted = 1516, questStorage = 65006, killsRequired = 150, raceName = "Carniphilas", rewards = {{enable = true, type = "exp", values = 1500}, {enable = true, type = "points", values = 1}}},
  17.  
  18. [8] = {questStarted = 1517, questStorage = 65007, killsRequired = 200, raceName = "Stone Golems", rewards = {{enable = true, type = "exp", values = 2000}, {enable = true, type = "points", values = 1}}},
  19.  
  20. [9] = {questStarted = 1518, questStorage = 65008, killsRequired = 300, raceName = "Mammoths", rewards = {{enable = true, type = "exp", values = 4000}, {enable = true, type = "boss", values = THEBLOODTUSK_POSITION}, {enable = true, type = "points", values = 2}}},
  21.  
  22. [10] = {questStarted = 1519, questStorage = 65009, killsRequired = 300, raceName = "Ice Golems", rewards = {{enable = true, type = "exp", values = 15000}, {enable = true, type = "boss", values = SHARDHEAD_POSITION}, {enable = true, type = "points", values = 2}}},
  23.  
  24. [11] = {questStarted = 1520, questStorage = 65010, killsRequired = 300, raceName = "Quaras Scout", rewards = {{enable = true, type = "exp", values = 10000}, {enable = true, type = "points", values = 1}}},
  25.  
  26. [12] = {questStarted = 1521, questStorage = 65011, killsRequired = 300, raceName = "Quaras", rewards = {{enable = true, type = "exp", values = 12000}, {enable = true, type = "boss", values = THUL_POSITION}, {enable = true, type = "points", values = 2}}},
  27.  
  28. [13] = {questStarted = 1522, questStorage = 65012, killsRequired = 70, raceName = "Water Elementals", rewards = {{enable = true, type = "exp", values = 7000}, {enable = true, type = "points", values = 1}}},
  29.  
  30. [14] = {questStarted = 1523, questStorage = 65013, killsRequired = 70, raceName = "Earth Elementals", rewards = {{enable = true, type = "exp", values = 10000}, {enable = true, type = "points", values = 1}}},
  31.  
  32. [15] = {questStarted = 1524, questStorage = 65014, killsRequired = 70, raceName = "Energy Elementals", rewards = {{enable = true, type = "exp", values = 10000}, {enable = true, type = "points", values = 1}}},
  33.  
  34. [16] = {questStarted = 1525, questStorage = 65015, killsRequired = 70, raceName = "Fire Elementals", rewards = {{enable = true, type = "exp", values = 7000}, {enable = true, type = "points", values = 1}}},
  35.  
  36. [17] = {questStarted = 1526, questStorage = 65016, killsRequired = 200, raceName = "Mutated Rats", rewards = {{enable = true, type = "exp", values = 10000}, {enable = true, type = "boss", values = ESMERALDA_POSITION}, {enable = true, type = "points", values = 2}}},
  37.  
  38. [18] = {questStarted = 1527, questStorage = 65017, killsRequired = 500, raceName = "Giant Spiders", rewards = {{enable = true, type = "exp", values = 5000}, {enable = true, type = "boss", values = THEOLDWIDOW_POSITION}, {enable = true, type = "points", values = 2}}},
  39.  
  40. [19] = {questStarted = 1528, questStorage = 65018, killsRequired = 2000, raceName = "Hydras", rewards = {{enable = true, type = "boss", values = THEMANY_POSITION}, {enable = true, type = "points", values = 4}}},
  41.  
  42. [20] = {questStarted = 1529, questStorage = 65019, killsRequired = 2000, raceName = "Sea Serpents", rewards = {{enable = true, type = "boss", values = LEVIATHAN_POSITION}, {enable = true, type = "points", values = 4}}},
  43.  
  44. [21] = {questStarted = 1530, questStorage = 65020, killsRequired = 2000, raceName = "Behemoths", rewards = {{enable = true, type = "boss", values = STONECRACKER_POSITION}, {enable = true, type = "points", values = 4}}},
  45.  
  46. [22] = {questStarted = 1531, questStorage = 65021, killsRequired = 1500, raceName = "Serpents Spawn", rewards = {{enable = true, type = "teleport", values = THENOXIUSSPAWN_POSITION}, {enable = true, type = "points", values = 4}}},
  47.  
  48. [23] = {questStarted = 1532, questStorage = 65022, killsRequired = 500, raceName = "Green Djinns", rewards = {{enable = true, type = "exp", values = 10000}, {enable = true, type = "money", values = 5000}, {enable = true, type = "boss", values = MERIKHTHESLAUGHTERER_POSITION}}},
  49.  
  50. [24] = {questStarted = 1533, questStorage = 65023, killsRequired = 500, raceName = "Blue Djinns", rewards = {{enable = true, type = "exp", values = 10000}, {enable = true, type = "money", values = 5000}, {enable = true, type = "boss", values = FAHIMTHEWISE_POSITION}}},
  51.  
  52. [25] = {questStarted = 1534, questStorage = 65024, killsRequired = 3000, raceName = "Pirates", rewards = {{enable = true, type = "exp", values = 10000}, {enable = true, type = "money", values = 5000}, {enable = true, type = "boss", values = RANDOMPIRATEBOSS_POSITION}}},
  53.  
  54. [26] = {questStarted = 1535, questStorage = 65025, killsRequired = 3000, raceName = "Pirates", rewards = {{enable = true, type = "exp", values = 10000}, {enable = true, type = "money", values = 5000}}},
  55.  
  56. [27] = {questStarted = 1536, questStorage = 65026, killsRequired = 5000, raceName = "Minotaurs", rewards = {{enable = true, type = "boss", values = THEHORNEDFOX_POSITION}}},
  57.  
  58. [28] = {questStarted = 1537, questStorage = 65027, killsRequired = 4000, raceName = "Magicians", rewards = {{enable = true, type = "boss", values = NECROPHARUS_POSITION}}},
  59.  
  60. [29] = {questStarted = 1538, questStorage = 65028, killsRequired = 1000, raceName = "Magicians", rewards = {{enable = true, type = "exp", values = 40000}}},
  61.  
  62. [30] = {questStarted = 1539, questStorage = 65029, killsRequired = 6666, raceName = "Demons", rewards = {{enable = true, type = "storage", values = {65535, 1}}}}
  63. }
  64.  
  65. local rankStorage = 32150
  66. local storage = 64521
  67.  
  68. local keywordHandler = KeywordHandler:new()
  69. local npcHandler = NpcHandler:new(keywordHandler)
  70. NpcSystem.parseParameters(npcHandler)
  71. local talkState = {}
  72. local voc = {}
  73.  
  74. function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end
  75. function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end
  76. function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end
  77. function onThink() npcHandler:onThink() end
  78.  
  79. function creatureSayCallback(cid, type, msg)
  80.  
  81. local s = getCreatureStorage(cid, storage)
  82.  
  83. if(not npcHandler:isFocused(cid)) then
  84. return false
  85. end
  86. local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_PRIVATE and 0 or cid
  87. if msgcontains(msg, "task") then
  88.  
  89. if(s < 1) then
  90. doCreatureSetStorage(cid, storage, 1)
  91. s = getCreatureStorage(cid, storage)
  92. end
  93.  
  94. if(getCreatureStorage(cid, rankStorage) < 1) then
  95. doCreatureSetStorage(cid, rankStorage, 0)
  96. end
  97.  
  98. if tasks then
  99. if(getCreatureStorage(cid, tasks.questStarted) < 1) then
  100. if(getCreatureStorage(cid, tasks.creatureStorage) < 0) then
  101. doCreatureSetStorage(cid, tasks.creatureStorage, 0)
  102. end
  103.  
  104. if(getCreatureStorage(cid, tasks.questStorage) < 0) then
  105. doCreatureSetStorage(cid, tasks.questStorage, 0)
  106. end
  107.  
  108. doCreatureSetStorage(cid, tasks.questStarted, 1)
  109. selfSay("You have started the task number " .. getPlayerStorageValue(cid, storage) .. ", in this task you need to kill " .. tasks.killsRequired .. " " .. tasks.raceName .. ".", cid)
  110. else
  111. selfSay("You are currently making the task about " .. tasks.raceName .. ", task number " .. getPlayerStorageValue(cid, storage) .. ".", cid)
  112. end
  113. else
  114. print("[Warning - Error::Killing in the name of::Tasks config] Something is wrong.")
  115. end
  116.  
  117. elseif msgcontains(msg, "report") then
  118. if tasks and tasks.questStarted > 0 then
  119. if(getCreatureStorage(cid, tasks.creatureStorage) < 0) then
  120. doCreatureSetStorage(cid, tasks.creatureStorage, 0)
  121. end
  122.  
  123. if(getCreatureStorage(cid, tasks.questStorage) < 0) then
  124. doCreatureSetStorage(cid, tasks.questStorage, 0)
  125. end
  126.  
  127. if(getCreatureStorage(cid, tasks.questStorage) >= tasks.killsRequired) then
  128. for i = 1, table.maxn(tasks.rewards) do
  129. if(tasks.rewards[i].enable) then
  130. if isInArray({"boss", "teleport", 1}, tasks[s].rewards[i].type) then
  131. doTeleportThing(cid, tasks[s].rewards[i].values)
  132. elseif isInArray({"exp", "experience", 2}, tasks[s].rewards[i].type) then
  133. doPlayerAddExperience(cid, tasks[s].rewards[i].values)
  134. elseif isInArray({"item", 3}, tasks[s].rewards[i].type) then
  135. doPlayerAddItem(cid, tasks[s].rewards[i].values[1], tasks[s].rewards[i].values[2])
  136. elseif isInArray({"money", 4}, tasks[s].rewards[i].type) then
  137. doPlayerAddMoney(cid, tasks[s].rewards[i].values)
  138. elseif isInArray({"storage", "stor", 5}, tasks[s].rewards[i].type) then
  139. doCreatureSetStorage(cid, tasks[s].rewards[i].values[1], tasks[s].rewards[i].values[2])
  140. elseif isInArray({"points", "rank", 2}, tasks[s].rewards[i].type) then
  141. doCreatureSetStorage(cid, rankStorage, getCreatureStorage(cid, rankStorage) + tasks[s].rewards[i].values)
  142. else
  143. print("[Warning - Error::Killing in the name of::Tasks config] Bad reward type: " .. tasks[s].rewards[i].type .. ", reward could not be loaded.")
  144. end
  145. end
  146. end
  147. local rank = getCreatureStorage(cid, rankStorage)
  148. selfSay("Great!... you have finished the task number " .. s .. "" .. (rank > 4 and ", you are a " or "") .. "" .. (((rank > 4 and rank < 10) and ("Huntsman") or (rank > 9 and rank < 20) and ("Ranger") or (rank > 19 and rank < 30) and ("Big Game Hunter") or (rank > 29 and rank < 50) and ("Trophy Hunter") or (rank > 49) and ("Elite Hunter")) or "") .. ". Good job.", cid)
  149. doCreatureSetStorage(cid, storage, s + 1)
  150. else
  151. selfSay("Current " .. getCreatureStorage(cid, tasks[s].questStorage) .. " " .. tasks[s].raceName .. " killed, you need to kill " .. tasks[s].killsRequired .. ".", cid)
  152. end
  153. else
  154. selfSay("You do not have started any task.", cid)
  155. end
  156. end
  157. return true
  158. end
  159.  
  160. npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
  161. npcHandler:addModule(FocusModule:new())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement