Advertisement
ederfrota

Untitled

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