Advertisement
GooGoo

data_npc_scripts_killinginthenameof.lua

Nov 18th, 2013
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 12.63 KB | None | 0 0
  1. THESNAPPER_POSITION = {x=2482, y=1196, z=10}
  2. HIDE_POSITION = {x=1009, y=797, z=8}
  3. THEBLOODTUSK_POSITION = {x=1144, y=676, z=5}
  4. SHARDHEAD_POSITION = {x=1058, y=576, z=5}
  5. THUL_POSITION = {x=843, y=872, z=8}
  6. ESMERALDA_POSITION = {x=1027, y=748, z=11}
  7. THEOLDWIDOW_POSITION = {x=1048, y=746, z=3}
  8. THEMANY_POSITION = {x=1116, y=980, z=4}
  9. LEVIATHAN_POSITION = {x=851, y=866, z=9}
  10. STONECRACKER_POSITION = {x=1066, y=790, z=14}
  11. THENOXIUSSPAWN_POSITION = {x=1050, y=905, z=10}
  12. MERIKHTHESLAUGHTERER_POSITION = {x=1208, y=795, z=2}
  13. FAHIMTHEWISE_POSITION = {x=1209, y=837, z=2}
  14. RANDOMPIRATEBOSS_POSITION = {{x=1134, y=889, z=5} or {x=1134, y=881, z=5} or {x=1152, y=881, z=5} or {x=1152, y=889, z=5}}
  15. THEHORNEDFOX_POSITION = {x=1244, y=904, z=5}
  16. NECROPHARUS_POSITION = {x=819, y=977, z=8}
  17.  
  18. local tasks =
  19. {
  20.     [1] = {questStarted = 1510, questStorage = 65000, killsRequired = 100, raceName = "Trolls", rewards = {{enable = true, type = "exp", values = 20000}, {enable = true, type = "money", values = 2000}}},
  21.     [2] = {questStarted = 1511, questStorage = 65001, killsRequired = 150, raceName = "Goblins", rewards = {{enable = true, type = "exp", values = 30000}, {enable = true, type = "money", values = 2500}}},
  22.     [3] = {questStarted = 1512, questStorage = 65002, killsRequired = 300, raceName = "Rotworms", rewards = {{enable = true, type = "exp", values = 40000}, {enable = true, type = "money", values = 4000}}},
  23.     [4] = {questStarted = 1513, questStorage = 65003, killsRequired = 500, raceName = "Cyclops", rewards = {{enable = true, type = "exp", values = 50000}, {enable = true, type = "money", values = 8000}}},
  24.     [5] = {questStarted = 1514, questStorage = 65004, killsRequired = 300, raceName = "Crocodiles", rewards = {{enable = true, type = "exp", values = 60000}, {enable = true, type = "boss", values = THESNAPPER_POSITION}, {enable = true, type = "points", values = 2}}},
  25.     [6] = {questStarted = 1515, questStorage = 65005, killsRequired = 300, raceName = "Tarantulas", rewards = {{enable = true, type = "money", values = 15000}, {enable = true, type = "boss", values = HIDE_POSITION}, {enable = true, type = "points", values = 2}}},
  26.     [7] = {questStarted = 1516, questStorage = 65006, killsRequired = 150, raceName = "Carniphilas", rewards = {{enable = true, type = "exp", values = 70000}, {enable = true, type = "points", values = 1}}},
  27.     [8] = {questStarted = 1517, questStorage = 65007, killsRequired = 200, raceName = "Stone Golems", rewards = {{enable = true, type = "exp", values = 80000}, {enable = true, type = "points", values = 1}}},
  28.     [9] = {questStarted = 1518, questStorage = 65008, killsRequired = 300, raceName = "Mammoths", rewards = {{enable = true, type = "exp", values = 90000}, {enable = true, type = "boss", values = THEBLOODTUSK_POSITION}, {enable = true, type = "points", values = 2}}},
  29.     [10] = {questStarted = 1519, questStorage = 65009, killsRequired = 300, raceName = "Ice Golems", rewards = {{enable = true, type = "exp", values = 100000}, {enable = true, type = "boss", values = SHARDHEAD_POSITION}, {enable = true, type = "points", values = 2}}},
  30.     [11] = {questStarted = 1520, questStorage = 65010, killsRequired = 300, raceName = "Quaras Scout", rewards = {{enable = true, type = "exp", values = 200000}, {enable = true, type = "points", values = 1}}},
  31.     [12] = {questStarted = 1521, questStorage = 65011, killsRequired = 300, raceName = "Quaras", rewards = {{enable = true, type = "exp", values = 300000}, {enable = true, type = "boss", values = THUL_POSITION}, {enable = true, type = "points", values = 2}}},
  32.     [13] = {questStarted = 1522, questStorage = 65012, killsRequired = 70, raceName = "Water Elementals", rewards = {{enable = true, type = "exp", values = 400000}, {enable = true, type = "points", values = 1}}},
  33.     [14] = {questStarted = 1523, questStorage = 65013, killsRequired = 70, raceName = "Earth Elementals", rewards = {{enable = true, type = "exp", values = 500000}, {enable = true, type = "points", values = 1}}},
  34.     [15] = {questStarted = 1524, questStorage = 65014, killsRequired = 70, raceName = "Energy Elementals", rewards = {{enable = true, type = "exp", values = 600000}, {enable = true, type = "points", values = 1}}},
  35.     [16] = {questStarted = 1525, questStorage = 65015, killsRequired = 70, raceName = "Fire Elementals", rewards = {{enable = true, type = "exp", values = 700000}, {enable = true, type = "points", values = 1}}},
  36.     [17] = {questStarted = 1526, questStorage = 65016, killsRequired = 200, raceName = "Mutated Rats", rewards = {{enable = true, type = "exp", values = 800000}, {enable = true, type = "boss", values = ESMERALDA_POSITION}, {enable = true, type = "points", values = 2}}},
  37.     [18] = {questStarted = 1527, questStorage = 65017, killsRequired = 500, raceName = "Giant Spiders", rewards = {{enable = true, type = "exp", values = 900000}, {enable = true, type = "boss", values = THEOLDWIDOW_POSITION}, {enable = true, type = "points", values = 2}}},
  38.     [19] = {questStarted = 1528, questStorage = 65018, killsRequired = 1000, raceName = "Hydras", rewards = {{enable = true, type = "boss", values = THEMANY_POSITION}, {enable = true, type = "points", values = 4}}},
  39.     [20] = {questStarted = 1529, questStorage = 65019, killsRequired = 500, raceName = "Sea Serpents", rewards = {{enable = true, type = "boss", values = LEVIATHAN_POSITION}, {enable = true, type = "points", values = 4}}},
  40.     [21] = {questStarted = 1530, questStorage = 65020, killsRequired = 500, raceName = "Behemoths", rewards = {{enable = true, type = "boss", values = STONECRACKER_POSITION}, {enable = true, type = "points", values = 4}}},
  41.     [22] = {questStarted = 1531, questStorage = 65021, killsRequired = 500, raceName = "Serpents Spawn", rewards = {{enable = true, type = "teleport", values = THENOXIUSSPAWN_POSITION}, {enable = true, type = "points", values = 4}}},
  42.     [23] = {questStarted = 1532, questStorage = 65022, killsRequired = 250, raceName = "Green Djinns", rewards = {{enable = true, type = "exp", values = 1000000}, {enable = true, type = "money", values = 5000}, {enable = true, type = "boss", values = MERIKHTHESLAUGHTERER_POSITION}}},
  43.     [24] = {questStarted = 1533, questStorage = 65023, killsRequired = 250, raceName = "Blue Djinns", rewards = {{enable = true, type = "exp", values = 2000000}, {enable = true, type = "money", values = 5000}, {enable = true, type = "boss", values = FAHIMTHEWISE_POSITION}}},
  44.     [25] = {questStarted = 1534, questStorage = 65024, killsRequired = 1500, raceName = "Pirates", rewards = {{enable = true, type = "exp", values = 3000000}, {enable = true, type = "money", values = 5000000}, {enable = true, type = "boss", values = RANDOMPIRATEBOSS_POSITION}}},
  45.     [26] = {questStarted = 1535, questStorage = 65025, killsRequired = 1500, raceName = "Pirates", rewards = {{enable = true, type = "exp", values = 4000000}, {enable = true, type = "money", values = 5000000}}},
  46.     [27] = {questStarted = 1536, questStorage = 65026, killsRequired = 5000, raceName = "Minotaurs", rewards = {{enable = true, type = "boss", values = THEHORNEDFOX_POSITION}}},
  47.     [28] = {questStarted = 1537, questStorage = 65027, killsRequired = 200, raceName = "Magicians", rewards = {{enable = true, type = "boss", values = NECROPHARUS_POSITION}}},
  48.     [29] = {questStarted = 1538, questStorage = 65028, killsRequired = 500, raceName = "Magicians", rewards = {{enable = true, type = "exp", values = 5000000}}},
  49.     [30] = {questStarted = 1539, questStorage = 65029, killsRequired = 6666, raceName = "Demons", rewards = {{enable = true, type = "storage", values = {65535, 1}}}}
  50. }
  51. local rankStorage = 32150
  52. local storage = 64521
  53. local keywordHandler = KeywordHandler:new()
  54. local npcHandler = NpcHandler:new(keywordHandler)
  55. NpcSystem.parseParameters(npcHandler)
  56. local talkState = {}
  57. local voc = {}
  58. function onCreatureAppear(cid)                          npcHandler:onCreatureAppear(cid) end
  59. function onCreatureDisappear(cid)                      npcHandler:onCreatureDisappear(cid) end
  60. function onCreatureSay(cid, type, msg)                  npcHandler:onCreatureSay(cid, type, msg) end
  61. function onThink()                                      npcHandler:onThink() end
  62. function creatureSayCallback(cid, type, msg)
  63.     local s = getPlayerStorageValue(cid, storage)
  64.     if(not npcHandler:isFocused(cid)) then
  65.         return false
  66.     end
  67.     local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_PRIVATE and 0 or cid
  68.     if msgcontains(msg, "task") then
  69.         if(s < 1) then
  70.             setPlayerStorageValue(cid, storage, 1)
  71.             s = getPlayerStorageValue(cid, storage)
  72.         end
  73.         if(getPlayerStorageValue(cid, rankStorage) < 1) then
  74.             setPlayerStorageValue(cid, rankStorage, 0)
  75.         end
  76.         if tasks[s] then
  77.             if(getPlayerStorageValue(cid, tasks[s].questStarted) < 1) then
  78.                 if(getPlayerStorageValue(cid, tasks[s].creatureStorage) < 0) then
  79.                     setPlayerStorageValue(cid, tasks[s].creatureStorage, 0)
  80.                 end
  81.                 if(getPlayerStorageValue(cid, tasks[s].questStorage) < 0) then
  82.                     setPlayerStorageValue(cid, tasks[s].questStorage, 0)
  83.                 end
  84.                 setPlayerStorageValue(cid, tasks[s].questStarted, 1)
  85.                 selfSay("You have started the task number " .. getPlayerStorageValue(cid, storage) .. ", in this task you need to kill " .. tasks[s].killsRequired .. " " .. tasks[s].raceName .. ".", cid)
  86.             else
  87.                 selfSay("You are currently making the task about " .. tasks[s].raceName .. ", task number " .. getPlayerStorageValue(cid, storage) .. ".", cid)
  88.             end
  89.         else
  90.             print("[Warning - Error::Killing in the name of::Tasks config] Something is wrong.")
  91.         end
  92.     elseif msgcontains(msg, "report") then
  93.         if tasks[s] and tasks[s].questStarted > 0 then
  94.             if(getPlayerStorageValue(cid, tasks[s].creatureStorage) < 0) then
  95.                 setPlayerStorageValue(cid, tasks[s].creatureStorage, 0)
  96.             end
  97.             if(getPlayerStorageValue(cid, tasks[s].questStorage) < 0) then
  98.                 setPlayerStorageValue(cid, tasks[s].questStorage, 0)
  99.             end
  100.             if(getPlayerStorageValue(cid, tasks[s].questStorage) >= tasks[s].killsRequired) then
  101.                 for i = 1, table.maxn(tasks[s].rewards) do
  102.                     if(tasks[s].rewards[i].enable) then
  103.                         if isInArray({"boss", "teleport", 1}, tasks[s].rewards[i].type) then
  104.                             doTeleportThing(cid, tasks[s].rewards[i].values)
  105.                         elseif isInArray({"exp", "experience", 2}, tasks[s].rewards[i].type) then
  106.                             doPlayerAddExperience(cid, tasks[s].rewards[i].values)
  107.                         elseif isInArray({"item", 3}, tasks[s].rewards[i].type) then
  108.                             doPlayerAddItem(cid, tasks[s].rewards[i].values[1], tasks[s].rewards[i].values[2])
  109.                         elseif isInArray({"money", 4}, tasks[s].rewards[i].type) then
  110.                             doPlayerAddMoney(cid, tasks[s].rewards[i].values)
  111.                         elseif isInArray({"storage", "stor", 5}, tasks[s].rewards[i].type) then
  112.                             setPlayerStorageValue(cid, tasks[s].rewards[i].values[1], tasks[s].rewards[i].values[2])
  113.                         elseif isInArray({"points", "rank", 2}, tasks[s].rewards[i].type) then
  114.                             setPlayerStorageValue(cid, rankStorage, getPlayerStorageValue(cid, rankStorage) + tasks[s].rewards[i].values)
  115.                         else
  116.                             print("[Warning - Error::Killing in the name of::Tasks config] Bad reward type: " .. tasks[s].rewards[i].type .. ", reward could not be loaded.")
  117.                         end
  118.                     end
  119.                 end
  120.                 local rank = getPlayerStorageValue(cid, rankStorage)
  121.                 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)
  122.                 setPlayerStorageValue(cid, storage, s + 1)
  123.             else
  124.                 selfSay("Current " .. getPlayerStorageValue(cid, tasks[s].questStorage) .. " " .. tasks[s].raceName .. " killed, you need to kill " .. tasks[s].killsRequired .. ".", cid)
  125.             end
  126.         else
  127.             selfSay("You do not have started any task.", cid)
  128.         end
  129.     end
  130.     return true
  131. end
  132. npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
  133. npcHandler:addModule(FocusModule:new())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement