Advertisement
Guest User

Untitled

a guest
Oct 2nd, 2018
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 16.42 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 = "Cyclops", start = 176201, monsters_list = {"Cyclops","Cyclops Smith"}, level = 8, count = 4000, points = 1, items = {}, reward = {}, exp = 7000000, money = 50000000},
  6. [2] = {name = "Dragon", start = 176202, monsters_list = {"Dragon","Dragon Lord","Donate Dragon Lord","Dragon Lord Vip III","Castle Dragon Lord","Wyrm","Undead Dragon"}, level = 100, count = 7000, points = 2, items = {}, reward = {{7440,1}}, exp = 8000000, money = 60000000},
  7. [3] = {name = "Hydra", start = 176203, monsters_list = {"Hydra","Hydra Vip","Hydra Vip II"}, level = 150, count = 5000, points = 2, items = {}, reward = {{7440,1}}, exp = 8000000, money = 60000000},
  8. [4] = {name = "Frost Dragon", start = 176204, monsters_list = {"Frost Dragon","Frost Dragon Hatchling","Frost Dragon Vip","Donate Frost Dragon","Castle Frost Dragon"}, level = 150, count = 8000, points = 2, items = {}, reward = {{7440,1}}, exp = 8000000, money = 70000000},
  9. [5] = {name = "Behemoth", start = 176205, monsters_list = {"Behemoth","Hellspawn"}, level = 150, count = 3000, points = 2, items = {}, reward = {{7440,1}}, exp = 8000000, money = 70000000},
  10. [6] = {name = "Demon", start = 176206, monsters_list = {"Demon","Demon Vip","Demon Vip III","Donate Demon","Castle Demon"}, level = 200, count = 9999, points = 3, items = {}, reward = {{7440,1}}, exp = 9000000, money = 90000000},
  11. [7] = {name = "Grim Reaper", start = 176207, monsters_list = {"Castle Grim Reaper","Grim Reaper","Grim Reaper Vip III","Donate Grim Reaper"}, level = 200, count = 8000, points = 3, items = {}, reward = {{7440,1}}, exp = 9000000, money = 80000000},
  12. [8] = {name = "Warlock", start = 176208, monsters_list = {"Warlock","Warlock Vip","Donate Warlock","Castle Warlock"}, level = 200, count = 7000, points = 3, items = {}, reward = {{7440,1}}, exp = 9000000, money = 80000000},
  13. [9] = {name = "Hero", start = 176209, monsters_list = {"Hero"}, level = 200, count = 3000, points = 3, items = {}, reward = {{7440,1}}, exp = 9000000, money = 80000000},
  14. [10] = {name = "Fury", start = 176210, monsters_list = {"Fury","Infernalist"}, level = 200, count = 5000, points = 3, items = {}, reward = {{7440,1}}, exp = 9000000, money = 80000000},
  15. [11] = {name = "Medusa", start = 176211, monsters_list = {"Medusa","Medusa Vip"}, level = 250, count = 4000, points = 3, items = {}, reward = {{7440,1}}, exp = 9000000, money = 80000000},
  16. [12] = {name = "Lizard Dragon Priest", start = 176212, monsters_list = {"Serpent Spawn","Lizard Dragon Priest"}, level = 200, count = 3000, points = 3, items = {}, reward = {{7440,1}}, exp = 9000000, money = 80000000},
  17. [13] = {name = "Nightmare" ,start = 176213, monsters_list = {"Nightmare","Lost Soul","Mr. Punish"}, level = 200, count = 6000, points = 3, items = {}, reward = {{7440,1}}, exp = 9000000, money = 80000000},
  18. [14] = {name = "Juggernaut" ,start = 176214, monsters_list = {"Juggernaut","Massacre"}, level = 200, count = 5000, points = 3, items = {}, reward = {{7440,1}}, exp = 9000000, money = 80000000},
  19. [15] = {name = "Ferumbras" ,start = 176215, monsters_list = {"Ferumbras"}, level = 200, count = 3000, points = 3, items = {}, reward = {{7440,1}}, exp = 9000000, money = 80000000},
  20. [16] = {name = "Defiler" ,start = 176216, monsters_list = {"Defiler"}, level = 250, count = 4000, points = 3, items = {}, reward = {{7440,1}}, exp = 9000000, money = 80000000},
  21. [17] = {name = "Fluffy" ,start = 176217, monsters_list = {"Fluffy","Hellhound"}, level = 250, count = 7000, points = 3, items = {}, reward = {{7440,1}}, exp = 9000000, money = 90000000},
  22. [18] = {name = "Hellfire Fighter" ,start = 176218, monsters_list = {"Hellfire Fighter"}, level = 300, count = 2000, points = 4, items = {}, reward = {{7440,1}}, exp = 90000000, money = 300000000},
  23. [19] = {name = "Dark Torturer" ,start = 176219, monsters_list = {"Dark Torturer","Betrayed Wraith"}, level = 250, count = 4000, points = 3, items = {}, reward = {{7440,1}}, exp = 20000000, money = 300000000},
  24. [20] = {name = "Nomad" ,start = 176220, monsters_list = {"Nomad"}, level = 250, count = 5000, points = 4, items = {}, reward = {{7440,1}}, exp = 90000000, money = 300000000},
  25. [21] = {name = "Lethal Lissy" ,start = 176220, monsters_list = {"Lethal Lissy"}, level = 250, count = 5000, points = 4, items = {}, reward = {{7440,1}}, exp = 90000000, money = 300000000},
  26. [22] = {name = "Storm Wolf" ,start = 176222, monsters_list = {"Storm Wolf"}, level = 250, count = 9000, points = 5, items = {}, reward = {{7440,1}}, exp = 90000000, money = 400000000},
  27. [23] = {name = "Deadeye Devious" ,start = 176223, monsters_list = {"Deadeye Devious"}, level = 250, count = 9000, points = 5, items = {}, reward = {{7440,1}}, exp = 90000000, money = 500000000},
  28. [24] = {name = "Gang Member" ,start = 176224, monsters_list = {"Gang Member"}, level = 250, count = 9000, points = 5, items = {}, reward = {{7440,1}}, exp = 90000000, money = 600000000},
  29. [25] = {name = "Draken Abomination" ,start = 176225, monsters_list = {"Draken Abomination"}, level = 250, count = 3000, points = 5, items = {}, reward = {{7440,1}}, exp = 90000000, money = 700000000}
  30. }
  31. daily_task = {
  32. [1] = {name = "Ghastly Dragon" ,monsters_list = {"Ghastly Dragon"}, count = 2000, points = 2, reward = {{7440,1}}, exp = 90000000, money = 700000000},
  33. [2] = {name = "Werewolf" ,monsters_list = {"Werewolf"}, count = 2000, points = 2, reward = {{7440,1}}, exp = 90000000, money = 700000000},
  34. [3] = {name = "Draken Elite" ,monsters_list = {"Draken Elite"}, count = 2000, points = 2, reward = {{7440,1}}, exp = 90000000, money = 700000000},
  35. [4] = {name = "Eternal Guardian" ,monsters_list = {"Eternal Guardian"}, count = 2000, points = 3, reward = {{7440,1}}, exp = 90000000, money = 700000000},
  36. [5] = {name = "Draken Warmaster" ,monsters_list = {"Draken Warmaster"}, count = 2000, points = 3, reward = {{7440,1}}, exp = 90000000, money = 700000000},
  37. [6] = {name = "Morgaroth" ,monsters_list = {"Morgaroth"}, count = 2000, points = 3, reward = {{7440,1}}, exp = 90000000, money = 700000000},
  38. [7] = {name = "Annihilon" ,monsters_list = {"Annihilon"}, count = 2000, points = 3, reward = {{7440,1}}, exp = 90000000, money = 700000000},
  39. [8] = {name = "Ghazbaran" ,monsters_list = {"Ghazbaran"}, count = 2000, points = 3, reward = {{7440,1}}, exp = 90000000, money = 700000000},
  40. [9] = {name = "Dragon" ,monsters_list = {"Dragon","Dragon Lord","Donate Dragon Lord","Dragon Lord Vip III","Castle Dragon Lord","Wyrm","Undead Dragon"}, count = 3000, points = 3, reward = {{7440,1}}, exp = 90000000, money = 700000000},
  41. [10] = {name = "Frost Dragon" ,monsters_list = {"Frost Dragon","Frost Dragon Hatchling","Frost Dragon Vip","Donate Frost Dragon","Castle Frost Dragon"}, count = 3000, points = 4, reward = {{12505,1}}, exp = 90000000, money = 700000000},
  42. [11] = {name = "Grim Reaper" ,monsters_list = {"Castle Grim Reaper","Grim Reaper","Grim Reaper Vip III","Donate Grim Reaper"}, count = 3000, points = 4, reward = {{12505,1}}, exp = 90000000, money = 700000000},
  43. [12] = {name = "Demon" ,monsters_list = {"Demon","Demon Vip","Demon Vip III","Donate Demon","Castle Demon"}, count = 3000, points = 4, reward = {{12505,1}}, exp = 90000000, money = 700000000}
  44. }task_sys_storages = {176601, 176602, 176603, 176604, 176605, 176606, 176607, 176608} -- task, points, count, daily task, daily count, daily time , daily start, contador
  45. function getTaskMission(cid)
  46. return getPlayerStorageValue(cid,task_sys_storages[1]) < 0 and 1 or getPlayerStorageValue(cid,task_sys_storages[1])
  47. end
  48. function getDailyTaskMission(cid)
  49. return getPlayerStorageValue(cid,task_sys_storages[4]) < 0 and 1 or getPlayerStorageValue(cid,task_sys_storages[4])
  50. end
  51. function getTaskPoints(cid)
  52. return getPlayerStorageValue(cid,task_sys_storages[2]) < 0 and 0 or getPlayerStorageValue(cid,task_sys_storages[2])
  53. end
  54. function doRandomDailyTask(cid)
  55. local t = {
  56. [{150,200}] = {1,3},
  57. [{201,350}] = {4,6},
  58. [{351,500}] = {7,9},
  59. [{501,math.huge}] = {10,12}
  60. }
  61. for a , b in pairs(t) do
  62. if getPlayerLevel(cid) >= a[1] and getPlayerLevel(cid) <= a[2] then
  63. return math.random(b[1], b[2])
  64. end
  65. end
  66. return 0
  67. end
  68. function GetRankTask(cid)
  69. local ranks = {
  70. [{1, 20}] = "Bronze",
  71. [{21, 50}] = "Prata",
  72. [{51, 100}] = "Ouro",
  73. [{101, 200}] = "Platina",
  74. [{201, 250}] = "Diamante",
  75. [{251, 300}] = "Mestre",
  76. [{301, math.huge}] = "Challenger"
  77. }
  78. for v , r in pairs(ranks) do
  79. if getTaskPoints(cid) >= v[1] and getTaskPoints(cid) <= v[2] then
  80. return r
  81. end
  82. end
  83. return 0
  84. end
  85. function getItemsFromList(items)
  86. local str = ''
  87. if table.maxn(items) > 0 then
  88. for i = 1, table.maxn(items) do
  89. str = str .. items[i][2] .. ' ' .. getItemNameById(items[i][1])
  90. if i ~= table.maxn(items) then str = str .. ', '
  91. end
  92. end
  93. end
  94. return str
  95. end
  96. function doRemoveItemsFromList(cid,items)
  97. local count = 0
  98. if table.maxn(items) > 0 then
  99. for i = 1, table.maxn(items) do
  100. if getPlayerItemCount(cid,items[i][1]) >= items[i][2] then
  101. count = count + 1 end
  102. end
  103. end
  104. if count == table.maxn(items) then
  105. for i = 1, table.maxn(items) do doPlayerRemoveItem(cid,items[i][1],items[i][2]) end
  106. else
  107. return false
  108. end
  109. return true
  110. end
  111. function getMonsterFromList(monster)
  112. local str = ''
  113. if #monster > 0 then
  114. for i = 1, #monster do
  115. str = str .. monster[i]
  116. if i ~= #monster then str = str .. ', ' end
  117. end
  118. end
  119. return str
  120. end
  121. function GiveRewardsTask(cid, items)
  122. local backpack = doPlayerAddItem(cid, 1999, 1) -- backpackID
  123. for _, i_i in ipairs(items) do
  124. local item, amount = i_i[1],i_i[2]
  125. if isItemStackable(item) or amount == 1 then
  126. doAddContainerItem(backpack, item, amount)
  127. else
  128. for i = 1, amount do
  129. doAddContainerItem(backpack, item, 1)
  130. end
  131. end
  132. end
  133. end
  134. function isSummon(cid)
  135. if(not isCreature(cid)) then
  136. return false
  137. end
  138. return getCreatureMaster(cid) ~= cid
  139. end
  140. ]]></config>
  141. <event type="login" name="TaskLogin" event="script"><![CDATA[
  142. function onLogin(cid)
  143. registerCreatureEvent(cid, "KillTask")
  144. registerCreatureEvent(cid, "TaskLook")
  145. return true
  146. end]]></event>
  147. <talkaction words="/task;!task" event="buffer"><![CDATA[
  148. domodlib('task_func')
  149. param,task,daily = param:lower(), getTaskMission(cid), getDailyTaskMission(cid)
  150. if isInArray({"counter","contador"},param) then
  151. setPlayerStorageValue(cid, task_sys_storages[8], getPlayerStorageValue(cid, task_sys_storages[8]) <= 0 and 1 or 0)
  152. doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE,"[Task System] O contador foi "..(getPlayerStorageValue(cid, task_sys_storages[8]) <= 0 and "ativado" or "desativado")..".") return true
  153. elseif isInArray({"daily","diaria"},param) then
  154. if not daily_task[daily] or getPlayerStorageValue(cid, task_sys_storages[7]) <= 0 then
  155. doPlayerSendCancel(cid, "Desculpe, Mas você não está em nenhuma Daily Task.") return true
  156. elseif getPlayerStorageValue(cid, task_sys_storages[6]) - os.time() <= 0 and getPlayerStorageValue(cid, task_sys_storages[5]) < daily_task[daily].count then
  157. 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
  158. end
  159. 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")..".")
  160. end
  161. if not task_sys[task] or getPlayerStorageValue(cid, task_sys[task].start) <= 0 then
  162. doPlayerSendCancel(cid, "você não está em nenhuma task.") return true
  163. end
  164. 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")..".")
  165. ]]></talkaction>
  166. <event type="look" name="TaskLook" event="script"><![CDATA[
  167. domodlib('task_func')
  168. function onLook(cid, thing, position, lookDistance)
  169. if isPlayer(thing.uid) and getTaskPoints(thing.uid) > 0 then
  170. doPlayerSetSpecialDescription(thing.uid, "\n"..(getPlayerSex(thing.uid) == 0 and "She" or "He").. " is a "..GetRankTask(thing.uid))
  171. end
  172. return true
  173. end]]></event>
  174. <event type="kill" name="KillTask" event="script"><![CDATA[
  175. domodlib('task_func')
  176. function onKill(cid, target)
  177.  
  178. local t,daily = task_sys[getTaskMission(cid)], daily_task[getDailyTaskMission(cid)]
  179. 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
  180. setPlayerStorageValue(cid, task_sys_storages[3], getPlayerStorageValue(cid, task_sys_storages[3]) < 0 and 1 or (getPlayerStorageValue(cid, task_sys_storages[3])+1))
  181. if getPlayerStorageValue(cid, task_sys_storages[8]) <= 0 and getPlayerStorageValue(cid, task_sys_storages[3]) < t.count then
  182. doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE,"[Task System] defeated Total [" .. getPlayerStorageValue(cid, task_sys_storages[3]) .. "/" .. t.count .. "] da Task do " .. t.name .. ".")
  183. end
  184. if getPlayerStorageValue(cid, task_sys_storages[3]) >= t.count then
  185. doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE,"[Task System] Parabéns! Você terminou a Task do "..t.name..", volte ao npc parece receber sua recompensa.")
  186. end
  187. end
  188. 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
  189. setPlayerStorageValue(cid, task_sys_storages[5], getPlayerStorageValue(cid, task_sys_storages[5]) < 0 and 1 or (getPlayerStorageValue(cid, task_sys_storages[5])+1))
  190. if getPlayerStorageValue(cid, task_sys_storages[8]) <= 0 and getPlayerStorageValue(cid, task_sys_storages[5]) < daily.count then
  191. doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE,"[Daily Task System] defeated Total [" .. getPlayerStorageValue(cid, task_sys_storages[5]) .. "/" .. daily.count .. "] da Task do " .. daily.name .. ".")
  192. end
  193. if getPlayerStorageValue(cid, task_sys_storages[5]) >= daily.count then
  194. 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.")
  195. end
  196. end
  197. end
  198. return true
  199. end]]></event>
  200. <action actionid="65521;65522;65523;65524;65525;65526;65527;65528;65529;65530;65531;65532;65533;65534" event="script"><![CDATA[
  201. domodlib('task_func')
  202. function onUse(cid, item, frompos, item2, topos)
  203. local t = {[65521] = 50, [65522] = 80, [65523] = 90, [65524] = 100, [65525] = 110, [65526] = 120, [65527] = 130, [65528] = 140, [65529] = 150, [65530] = 160, [65531] = 170, [65532] = 180, [65533] = 190, [65534] = 200}
  204. if not t[item.actionid] then return true end
  205. if getTaskPoints(cid) < t[item.actionid] then
  206. return doPlayerSendTextMessage(cid,22,"Você só pode passar se tiver " .. t[item.actionid] .. " Hunt Points.")
  207. end
  208. doTransformItem(item.uid, item.itemid + 1)
  209. doTeleportThing(cid, topos, true)
  210. doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE,"Welcome, Hunt Points!")
  211. return true
  212. end]]></action>
  213. </mod>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement