Advertisement
Guest User

simpletask mod rg

a guest
Aug 29th, 2018
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
XML 16.63 KB | None | 0 0
  1. <?xml version="1.0" encoding="ISO-8859-1"?>
  2. <mod name="Simple Task" version="4.0" author="Vodkart" contact="tibiaking.com" enabled="yes">
  3. <config name="task_func"><![CDATA[
  4. task_sys = {
  5.     [1] = {name = "Trolls", start = 176201, monsters_list = {"Troll","Troll champion"}, level = 8, count = 40, points = 0, items = {}, reward = {}, exp = 2000, money = 2000},
  6.     [2] = {name = "rotworms", start = 176202, monsters_list = {"rotworm","carrion worm","Rotworm Queen"}, level = 12, count = 50, points = 0, items = {}, reward = {}, exp = 2500, money = 3000},
  7.     [3] = {name = "cyclops", start = 176203, monsters_list = {"cyclops","cyclops smith","cyclops drone"}, level = 19, count = 60, points = 0, items = {}, reward = {}, exp = 3000, money = 3000},
  8.     [4] = {name = "Green Djinn", start = 176204, monsters_list = {"Green Djinn","Efreet"}, level = 23, count = 80, points = 1, items = {}, reward = {}, exp = 10000, money = 5000},
  9.     [5] = {name = "Blue Djinn", start = 176205, monsters_list = {"Blue Djinn","Marid"}, level = 25, count = 80, points = 1, items = {}, reward = {}, exp = 10000, money = 5000},
  10.     [6] = {name = "pirates", start = 176206, monsters_list = {"Pirate Marauder","Pirate Cutthroat","Pirate Buccaneer","Pirate Corsair"}, level = 30, count = 120, points = 2, items = {}, reward = {}, exp = 10000, money = 5000},
  11.     [7] = {name = "Stone Golems", start = 176207, monsters_list = {"Stone Golem"}, level = 33, count = 130, points = 3, items = {}, reward = {}, exp = 12000, money = 7000},
  12.     [8] = {name = "Carniphilas", start = 176208, monsters_list = {"carniphila"}, level = 36, count = 135, points = 3, items = {}, reward = {}, exp = 8000, money = 8000},
  13.     [9] = {name = "Ice Golems", start = 176209, monsters_list = {"ice golem"}, level = 40, count = 150, points = 2, items = {}, reward = {}, exp = 12000, money = 8200},
  14.     [10] = {name = "Wailing Widows", start = 176210, monsters_list = {"Wailing Widow"}, level = 42, count = 150, points = 3, items = {}, reward = {}, exp = 0, money = 0},
  15.     [11] = {name = "Mutated Rats", start = 176211, monsters_list = {"Mutated Rat"}, level = 46, count = 170, points = 2, items = {}, reward = {}, exp = 8000, money = 8500},
  16.     [12] = {name = "Dragons", start = 176212, monsters_list = {"dragon"}, level = 50, count = 120, points = 1, items = {}, reward = {}, exp = 9000, money = 9000},
  17.     [13] = {name = "Necromancer" ,start = 176213, monsters_list = {"Necromancer"}, level = 60, count = 200, points = 3, items = {}, reward = {}, exp = 20000, money = 15000},
  18.     [14] = {name = "Crystal Spiders" ,start = 176214, monsters_list = {"Crystal Spider"}, level = 63, count = 250, points = 3, items = {}, reward = {}, exp = 25000, money = 11000},
  19.     [15] = {name = "Giant Spider" ,start = 176215, monsters_list = {"Giant Spider","The old widow"}, level = 80, count = 500, points = 0, items = {}, reward = {}, exp = 20000, money = 32000},
  20.     [16] = {name = "Underwater Quaras" ,start = 176216, monsters_list = {"quara predator","quara constrictor","quara hydromancer","quara mantassin","quara pincher"}, level = 82, count = 550, points = 3, items = {}, reward = {}, exp = 22000, money = 15000},
  21.     [17] = {name = "Underwater Quaras Scout" ,start = 176217, monsters_list = {"quara predator scout","quara constrictor scout","quara hydromancer scout","quara mantassin scout","quara pincher scout"}, level = 83, count = 600, points = 3, items = {}, reward = {}, exp = 25000, money = 18000},
  22.     [18] = {name = "Hellspawn" ,start = 176218, monsters_list = {"Hellspawn"}, level = 85, count = 600, points = 4, items = {}, reward = {}, exp = 28000, money = 26000},
  23.     [19] = {name = "Dragon Lords" ,start = 176219, monsters_list = {"Dragon lord"}, level = 88, count = 650, points = 3, items = {}, reward = {}, exp = 30000, money = 35000},
  24.     [20] = {name = "Lizard Dragons" ,start = 176220, monsters_list = {"Lizard Chosen","Lizard Dragon Priest","Lizard High Guard","Lizard Legionnaire", "Lizard Zaogun"}, level = 90, count = 600, points = 4, items = {}, reward = {}, exp = 28000, money = 26000},
  25.     [21] = {name = "Nightmare" ,start = 176221, monsters_list = {"Nightmare","nightmare scion"}, level = 95, count = 650, points = 2, items = {}, reward = {}, exp = 30000, money = 35000},
  26.     [22] = {name = "Hydras" ,start = 176222, monsters_list = {"Hydra"}, level = 100, count = 700, points = 3, items = {}, reward = {}, exp = 40000, money = 40000},
  27.     [23] = {name = "Serpent Spawn" ,start = 176223, monsters_list = {"Serpent Spawn"}, level = 103, count = 720, points = 4, items = {}, reward = {}, exp = 50000, money = 45000},
  28.     [24] = {name = "Hellhounds" ,start = 176224, monsters_list = {"Hellhound"}, level = 107, count = 650, points = 2, items = {}, reward = {}, exp = 30000, money = 35000},
  29.     [25] = {name = "Demons" ,start = 176225, monsters_list = {"Demon"}, level = 110, count = 666, points = 4, items = {}, reward = {}, exp = 66600, money = 66000}
  30. }
  31. daily_task = {
  32.     [1] = {name = "Orcs Daily" ,monsters_list = {"Orc Berserker","orc","orc warrior","orc spearman","orc shaman"}, count = 300, points = 1, reward = {}, exp = 12000, money = 15000},
  33.     [2] = {name = "Rotworms Daily" ,monsters_list = {"rotworm","carrion worm","Rotworm Queen"}, count = 300, points = 1, reward = {}, exp = 12000, money = 8000},
  34.     [3] = {name = "Cyclops Daily" ,monsters_list = {"cyclops","cyclops smith","cyclops drone"}, count = 300, points = 1, reward = {}, exp = 15000, money = 10000},
  35.     [3] = {name = "Lizards Daily" ,monsters_list = {"lizard sentinel","lizard snakecharmer","lizard templar"}, count = 200, points = 1, reward = {}, exp = 12000, money = 8000},
  36.     [5] = {name = "Cemitery Daily" ,monsters_list = {"ghoul","skeleton warrior"}, count = 200, points = 1, reward = {}, exp = 12000, money = 8000},
  37.     [6] = {name = "Thiefs Daily" ,monsters_list = {"bandit","smuggler","wild warrior"}, count = 150, points = 1, reward = {}, exp = 12000, money = 8000},
  38.     [7] = {name = "Cyclops Smith Daily" ,monsters_list = {"Cyclops Smith"}, count = 150, points = 1, reward = {}, exp = 20000, money = 15000},
  39.     [8] = {name = "Wyvern Daily" ,monsters_list = {"Wyvern"}, count = 30, points = 1, reward = {}, exp = 15000, money = 10000},
  40.     [9] = {name = "Big Foot Daily" ,monsters_list = {"Big Foot"}, count = 2, points = 2, reward = {}, exp = 20000, money = 20000},
  41.     [10] = {name = "The Giant Daily" ,monsters_list = {"Golliath"}, count = 2, points = 2, reward = {}, exp = 30000, money = 30000}
  42.     [11] = {name = "Superior Orcs Daily" ,monsters_list = {"Orc Berserker","Orc Rider","Orc Leader","Orc Warlord"}, count = 100, points = 1, reward = {}, exp = 15000, money = 10000},
  43.     [12] = {name = "Giant Spiders Daily" ,monsters_list = {"Giant Spider"}, count = 40, points = 1, reward = {}, exp = 15000, money = 10000},
  44.     [13] = {name = "Dragons Daily" ,monsters_list = {"Dragon","Dragon Lord"}, count = 150, points = 1, reward = {}, exp = 20000, money = 20000},
  45.     [14] = {name = "Wyrm Daily" ,monsters_list = {"Wyrm"}, count = 100, points = 1, reward = {}, exp = 15000, money = 15000},
  46.     [15] = {name = "Ancient Scarabs Daily" ,monsters_list = {"Ancient Scarab"}, count = 180, points = 1, reward = {}, exp = 22000, money = 20000},
  47.     [16] = {name = "High Class Lizards Daily" ,monsters_list = {"Lizard Chosen","Lizard Dragon Priest","Lizard High Guard","Lizard Legionnaire","Lizard Zaogun"}, count = 300, points = 1, reward = {}, exp = 20000, money = 20000},
  48.     [17] = {name = "Firelord Daily" ,monsters_list = {"Diabolic Imp","Dragon Lord"}, count = 250, points = 1, reward = {}, exp = 30000, money = 30000},
  49.     [18] = {name = "Frost Dragons Daily" ,monsters_list = {"Frost Dragon"}, count = 150, points = 2, reward = {}, exp = 35000, money = 35000},
  50.     [19] = {name = "General Luther Daily" ,monsters_list = {"General Luther"}, count = 1, points = 1, reward = {}, exp = 20000, money = 20000},
  51.     [20] = {name = "Hydras Daily" ,monsters_list = {"Hydra"}, count = 150, points = 2, reward = {}, exp = 30000, money = 25000},
  52.     [21] = {name = "The Bosses Daily" ,monsters_list = {"General Luther","King Orc","Spider Queen"}, count = 3, points = 3, reward = {}, exp = 100000, money = 80000},
  53.     [22] = {name = "The Dragon Bosses Daily" ,monsters_list = {"Lord Murdrake","Twister","Undra"}, count = 3, points = 5, reward = {}, exp = 300000, money = 150000},
  54.     [23] = {name = "Drakens Daily" ,monsters_list = {"Draken Elite","Draken Abomination","Draken Spellweaver"}, count = 100, points = 1, reward = {}, exp = 50000, money = 30000}
  55. }
  56. task_sys_storages = {176601, 176602, 176603, 176604, 176605, 176606, 176607, 176608} -- task, points, count, daily task, daily count, daily time , daily start, contador
  57. function getTaskMission(cid)
  58.     return getPlayerStorageValue(cid,task_sys_storages[1]) < 0 and 1 or getPlayerStorageValue(cid,task_sys_storages[1])
  59. end
  60. function getDailyTaskMission(cid)
  61.     return getPlayerStorageValue(cid,task_sys_storages[4]) < 0 and 1 or getPlayerStorageValue(cid,task_sys_storages[4])
  62. end
  63. function getTaskPoints(cid)
  64.     return getPlayerStorageValue(cid,task_sys_storages[2]) < 0 and 0 or getPlayerStorageValue(cid,task_sys_storages[2])
  65. end
  66. function doRandomDailyTask(cid)
  67.     local t = {
  68.         [{6,49}] = {1,3},
  69.         [{50,79}] = {4,6},
  70.         [{80,129}] = {7,9},
  71.         [{130,math.huge}] = {10,12}
  72.     }
  73.     for a , b in pairs(t) do
  74.         if getPlayerLevel(cid) >= a[1] and getPlayerLevel(cid) <= a[2] then
  75.             return math.random(b[1], b[2])
  76.         end
  77.     end
  78.     return 0
  79. end
  80. function GetRankTask(cid)
  81.     local ranks = {
  82.         [{1, 20}] = "Huntsman",
  83.         [{21, 50}] = "Ranger",
  84.         [{51, 100}] = "Big Game Hunter",
  85.         [{101, 200}] = "Trophy Hunter",    
  86.         [{201, math.huge}] = "Elite Hunter"
  87.     }
  88.     for v , r in pairs(ranks) do
  89.         if getTaskPoints(cid) >= v[1] and getTaskPoints(cid) <= v[2] then
  90.             return r
  91.         end
  92.     end
  93.     return 0
  94. end
  95. function getItemsFromList(items)
  96.     local str = ''
  97.     if table.maxn(items) > 0 then
  98.         for i = 1, table.maxn(items) do
  99.             str = str .. items[i][2] .. ' ' .. getItemNameById(items[i][1])
  100.             if i ~= table.maxn(items) then str = str .. ', '
  101.             end
  102.         end
  103.     end
  104.     return str
  105. end
  106. function doRemoveItemsFromList(cid,items)
  107.     local count = 0
  108.     if table.maxn(items) > 0 then
  109.         for i = 1, table.maxn(items) do
  110.             if getPlayerItemCount(cid,items[i][1]) >= items[i][2] then
  111.             count = count + 1 end
  112.         end
  113.     end
  114.     if count == table.maxn(items) then
  115.         for i = 1, table.maxn(items) do doPlayerRemoveItem(cid,items[i][1],items[i][2]) end
  116.     else
  117.         return false
  118.     end
  119.     return true
  120. end
  121. function getMonsterFromList(monster)
  122.     local str = ''
  123.     if #monster > 0 then
  124.         for i = 1, #monster do
  125.             str = str .. monster[i]
  126.             if i ~= #monster then str = str .. ', ' end
  127.         end
  128.     end
  129.     return str
  130. end
  131. function GiveRewardsTask(cid, items)
  132.     local backpack = doPlayerAddItem(cid, 1999, 1) -- backpackID
  133.     for _, i_i in ipairs(items) do
  134.         local item, amount = i_i[1],i_i[2]
  135.         if isItemStackable(item) or amount == 1 then
  136.             doAddContainerItem(backpack, item, amount)
  137.         else
  138.             for i = 1, amount do
  139.                 doAddContainerItem(backpack, item, 1)
  140.             end
  141.         end
  142.     end
  143. end
  144. function isSummon(cid)
  145.     if(not isCreature(cid)) then
  146.         return false
  147.     end
  148.     return getCreatureMaster(cid) ~= cid
  149. end
  150. ]]></config>
  151. <event type="login" name="TaskLogin" event="script"><![CDATA[
  152. function onLogin(cid)
  153.     registerCreatureEvent(cid, "KillTask")
  154.     registerCreatureEvent(cid, "TaskLook")
  155.     return true
  156. end]]></event>
  157. <talkaction words="/task;!task" event="buffer"><![CDATA[
  158. domodlib('task_func')
  159. param,task,daily = param:lower(), getTaskMission(cid), getDailyTaskMission(cid)
  160. if isInArray({"counter","contador"},param) then
  161.     setPlayerStorageValue(cid, task_sys_storages[8], getPlayerStorageValue(cid, task_sys_storages[8]) <= 0 and 1 or 0)
  162.     doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE,"[Task System] O contador foi "..(getPlayerStorageValue(cid, task_sys_storages[8]) <= 0 and "ativado" or "desativado")..".") return true
  163. elseif isInArray({"daily","diaria"},param) then
  164.     if not daily_task[daily] or getPlayerStorageValue(cid, task_sys_storages[7]) <= 0 then
  165.         doPlayerSendCancel(cid, "Desculpe, Mas você não está em nenhuma Daily Task.") return true
  166.     elseif getPlayerStorageValue(cid, task_sys_storages[6]) - os.time() <= 0 and getPlayerStorageValue(cid, task_sys_storages[5]) < daily_task[daily].count then
  167.         doPlayerSendCancel(cid,"Desculpe, Mas Você não terminou a Daily Task a tempo! Por favor volte ao npc e comece uma nova Daily Task!") return true
  168.     end
  169.     return doShowTextDialog(cid, 8983, "[->] CURRENT DAILY TASK INFO [<-]\n\nNome: "..daily_task[daily].name.."\nProgresso: ["..(getPlayerStorageValue(cid, task_sys_storages[5]) < 0 and 0 or getPlayerStorageValue(cid, task_sys_storages[5])).."/"..daily_task[daily].count.."]\nPrazo para entrega: "..os.date("%d %B %Y %X ", getPlayerStorageValue(cid,task_sys_storages[6])).."\nMonstros para caçar: "..getMonsterFromList(daily_task[daily].monsters_list).."\n\n[->] CURRENT TASK REWARDS [<-]\n\nMoney: "..(daily_task[daily].money > 0 and daily_task[daily].money or 0).."\nExperiencia: "..(daily_task[daily].exp > 0 and daily_task[daily].exp or 0).."\nTask Points: "..daily_task[daily].points.."\nItems: "..(#daily_task[daily].reward > 0 and getItemsFromList(daily_task[daily].reward) or "Nenhum item de recompensa")..".")
  170. end
  171. if not task_sys[task] or getPlayerStorageValue(cid, task_sys[task].start) <= 0 then
  172.     doPlayerSendCancel(cid, "você não está em nenhuma task.") return true
  173. end
  174. return doShowTextDialog(cid, 8983, "-> CURRENT TASK ["..getTaskMission(cid).."/"..#task_sys.."] <-\n\nTask Name: "..task_sys[task].name.."\nTask Level: "..task_sys[task].level.."\nTask Progress: ["..(getPlayerStorageValue(cid, task_sys_storages[3]) < 0 and 0 or getPlayerStorageValue(cid, task_sys_storages[3])).."/"..task_sys[task].count.."]\nMonster To Hunt: "..getMonsterFromList(task_sys[task].monsters_list)..".\nItens Para Entrega: "..(#task_sys[task].items > 0 and getItemsFromList(task_sys[task].items) or "Nenhum")..".\n\n[->] CURRENT TASK REWARDS [<-]\n\nReward Money: "..(task_sys[task].money > 0 and task_sys[task].money or 0).."\nReward Experiencia: "..(task_sys[task].exp > 0 and task_sys[task].exp or 0).."\nReward Points: "..task_sys[task].points.."\nRedward Items: "..(#task_sys[task].reward > 0 and getItemsFromList(task_sys[task].reward) or "Nenhum item de recompensa")..".")
  175. ]]></talkaction>
  176. <event type="look" name="TaskLook" event="script"><![CDATA[
  177. domodlib('task_func')
  178. function onLook(cid, thing, position, lookDistance)
  179.     if isPlayer(thing.uid) and getTaskPoints(thing.uid) > 0 then
  180.         doPlayerSetSpecialDescription(thing.uid, "\n"..(getPlayerSex(thing.uid) == 0 and "She" or "He").. " is a "..GetRankTask(thing.uid))
  181.     end
  182.     return true
  183. end]]></event>
  184. <event type="kill" name="KillTask" event="script"><![CDATA[
  185. domodlib('task_func')
  186. function onKill(cid, target)
  187.     if isPlayer(cid) and isMonster(target) and not isSummon(target) then
  188.         local t,daily = task_sys[getTaskMission(cid)], daily_task[getDailyTaskMission(cid)]
  189.         if t and getPlayerStorageValue(cid, t.start) > 0 and isInArray(t.monsters_list, getCreatureName(target):lower()) and getPlayerStorageValue(cid, task_sys_storages[3]) < t.count then
  190.             setPlayerStorageValue(cid, task_sys_storages[3], getPlayerStorageValue(cid, task_sys_storages[3]) < 0 and 1 or (getPlayerStorageValue(cid, task_sys_storages[3])+1))
  191.             if getPlayerStorageValue(cid, task_sys_storages[8]) <= 0 and getPlayerStorageValue(cid, task_sys_storages[3]) < t.count then
  192.                 doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE,"[Task System] defeated Total [" .. getPlayerStorageValue(cid, task_sys_storages[3]) .. "/" .. t.count .. "] da Task do " .. t.name .. ".")
  193.             end
  194.             if getPlayerStorageValue(cid, task_sys_storages[3]) >= t.count then
  195.                 doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE,"[Task System] Parabéns! Você terminou a Task do "..t.name..", volte ao npc parece receber sua recompensa.")
  196.             end
  197.         end
  198.         if daily and getPlayerStorageValue(cid, task_sys_storages[7]) > 0 and getPlayerStorageValue(cid, task_sys_storages[6]) - os.time() >= 0 and isInArray(daily.monsters_list, getCreatureName(target):lower()) and getPlayerStorageValue(cid, task_sys_storages[5]) < daily.count then
  199.             setPlayerStorageValue(cid, task_sys_storages[5], getPlayerStorageValue(cid, task_sys_storages[5]) < 0 and 1 or (getPlayerStorageValue(cid, task_sys_storages[5])+1))
  200.             if getPlayerStorageValue(cid, task_sys_storages[8]) <= 0 and getPlayerStorageValue(cid, task_sys_storages[5]) < daily.count then
  201.                 doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE,"[Daily Task System] defeated Total [" .. getPlayerStorageValue(cid, task_sys_storages[5]) .. "/" .. daily.count .. "] da Task do " .. daily.name .. ".")
  202.             end
  203.             if getPlayerStorageValue(cid, task_sys_storages[5]) >= daily.count then
  204.                 doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE,"[Daily Task System] Parabéns! Você terminou a Task do "..daily.name..", volte ao npc parece receber sua recompensa.")
  205.             end
  206.         end
  207.     end
  208.     return true
  209. end]]></event>
  210. </mod>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement