Guest User

Untitled

a guest
Jan 24th, 2022
28
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 12.48 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 = "Dwarf Guard", start = 176201, monsters_list = {"Dwarf Guard"}, level = 100, count = 100, points = 100, items = {}, reward = {}, exp = 2000, money = 200000},
  6. [2] = {name = "Squirrel Yet", start = 176202, monsters_list = {"Squirrel Yet"}, level = 2000, count = 500, points = 100, items = {}, reward = {}, exp = 2500, money = 300000},
  7. [3] = {name = "Korova Dragon", start = 176203, monsters_list = {"Korova Dragon"}, level = 3000, count = 1200, points = 100, items = {}, reward = {}, exp = 3000, money = 400000},
  8. [4] = {name = "Phyculos", start = 176204, monsters_list = {"Phyculos"}, level = 5000, count = 2000, points = 100, items = {}, reward = {}, exp = 2000, money = 500000},
  9. [5] = {name = "Mad Scientist", start = 176205, monsters_list = {"Mad Scientist"}, level = 7000, count = 2500, points = 100, items = {}, reward = {}, exp = 6000, money = 600000},
  10. [6] = {name = "Omega lizard", start = 176206, monsters_list = {"Omega lizard"}, level = 10000, count = 3500, points = 100, items = {}, reward = {}, exp = 6000, money = 700000},
  11. [7] = {name = "Warchief", start = 176207, monsters_list = {"Warchief"}, level = 12000, count = 5000, points = 100, items = {}, reward = {}, exp = 3000, money = 800000},
  12. [8] = {name = "Beholder", start = 176208, monsters_list = {"Beholder"}, level = 15000, count = 5000, points = 100, items = {}, reward = {}, exp = 7000, money = 900000},
  13. [9] = {name = "Barbarian SkullHunter", start = 176209, monsters_list = {"Barbarian SkullHunter"}, level = 17000, count = 8000, points = 100, items = {}, reward = {}, exp = 9000, money = 100000},
  14. [10] = {name = "Evil Octopus", start = 176210, monsters_list = {"Evil Octopus"}, level = 20000, count = 11000, points = 100, items = {}, reward = {}, exp = 5000, money = 110000},
  15. [11] = {name = "Thornback Tortoise", start = 176211, monsters_list = {"Thornback Tortoise"}, level = 22000, count = 15000, points = 100, items = {}, reward = {}, exp = 2000, money = 120000},
  16. [12] = {name = "Energy", start = 176212, monsters_list = {"Energy"}, level = 25000, count = 18000, points = 100, items = {}, reward = {}, exp = 10000, money = 130000},
  17. [13] = {name = "Azazel" ,start = 176213, monsters_list = {"Azazel"}, level = 30000, count = 25000, points = 100, items = {}, reward = {}, exp = 2000, money = 140000},
  18. [14] = {name = "Calmadios" ,start = 176214, monsters_list = {"Calmadios"}, level = 30000, count = 25000, points = 100, items = {}, reward = {}, exp = 8000, money = 140000},
  19. [15] = {name = "Caos" ,start = 176215, monsters_list = {"Caos"}, level = 30000, count = 30000, points = 100, items = {}, reward = {}, exp = 8000, money = 140000},
  20. [16] = {name = "Leprechaun" ,start = 176216, monsters_list = {"Leprechaun"}, level = 30000, count = 30000, points = 100, items = {}, reward = {}, exp = 8000, money = 140000},
  21. [17] = {name = "Misthur" ,start = 176217, monsters_list = {"Misthur"}, level = 30000, count = 45000, points = 100, items = {}, reward = {}, exp = 8000, money = 140000},
  22. [18] = {name = "Monspiet" ,start = 176218, monsters_list = {"Monspiet"}, level = 30000, count = 45000, points = 100, items = {}, reward = {}, exp = 9000, money = 140000}
  23. }
  24. daily_task = {
  25. [1] = {name = "Beholder" ,monsters_list = {"Beholder"}, count = 15000, points = 200, reward = {}, exp = 7000, money = 100000000},
  26. [2] = {name = "Thornback Tortoise" ,monsters_list = {"Thornback Tortoise"}, count = 15000, points = 1, reward = {}, exp = 2000, money = 100000000},
  27. [3] = {name = "Energy" ,monsters_list = {"Energy"}, count = 20000, points = 2, reward = {}, exp = 10000, money = 100000000},
  28. [4] = {name = "Mad Scientist" ,monsters_list = {"Mad Scientist"}, count = 25000, points = 0, reward = {}, exp = 6000, money = 100000000},
  29. [5] = {name = "Korova Dragon" ,monsters_list = {"Korova Dragon"}, count = 5000, points = 1, reward = {}, exp = 1000, money = 100000000},
  30. [6] = {name = "Warchief" ,monsters_list = {"Warchief"}, count = 17500, points = 200, reward = {}, exp = 3000, money = 100000000}
  31. }
  32. task_sys_storages = {176601, 176602, 176603, 176604, 176605, 176606, 176607, 176608} -- task, points, count, daily task, daily count, daily time , daily start, contador
  33. function getTaskMission(cid)
  34. return getPlayerStorageValue(cid,task_sys_storages[1]) < 0 and 1 or getPlayerStorageValue(cid,task_sys_storages[1])
  35. end
  36. function getDailyTaskMission(cid)
  37. return getPlayerStorageValue(cid,task_sys_storages[4]) < 0 and 1 or getPlayerStorageValue(cid,task_sys_storages[4])
  38. end
  39. function getTaskPoints(cid)
  40. return getPlayerStorageValue(cid,task_sys_storages[2]) < 0 and 0 or getPlayerStorageValue(cid,task_sys_storages[2])
  41. end
  42. function doRandomDailyTask(cid)
  43. local t = {
  44. [{6,49}] = {1,3},
  45. [{50,79}] = {4,6},
  46. [{80,129}] = {7,9},
  47. [{130,math.huge}] = {10,12}
  48. }
  49. for a , b in pairs(t) do
  50. if getPlayerLevel(cid) >= a[1] and getPlayerLevel(cid) <= a[2] then
  51. return math.random(b[1], b[2])
  52. end
  53. end
  54. return 0
  55. end
  56. function GetRankTask(cid)
  57. local ranks = {
  58. [{1, 20}] = "Huntsman",
  59. [{21, 50}] = "Ranger",
  60. [{51, 100}] = "Big Game Hunter",
  61. [{101, 200}] = "Trophy Hunter",
  62. [{201, math.huge}] = "Elite Hunter"
  63. }
  64. for v , r in pairs(ranks) do
  65. if getTaskPoints(cid) >= v[1] and getTaskPoints(cid) <= v[2] then
  66. return r
  67. end
  68. end
  69. return 0
  70. end
  71. function getItemsFromList(items)
  72. local str = ''
  73. if table.maxn(items) > 0 then
  74. for i = 1, table.maxn(items) do
  75. str = str .. items[i][2] .. ' ' .. getItemNameById(items[i][1])
  76. if i ~= table.maxn(items) then str = str .. ', '
  77. end
  78. end
  79. end
  80. return str
  81. end
  82. function doRemoveItemsFromList(cid,items)
  83. local count = 0
  84. if table.maxn(items) > 0 then
  85. for i = 1, table.maxn(items) do
  86. if getPlayerItemCount(cid,items[i][1]) >= items[i][2] then
  87. count = count + 1 end
  88. end
  89. end
  90. if count == table.maxn(items) then
  91. for i = 1, table.maxn(items) do doPlayerRemoveItem(cid,items[i][1],items[i][2]) end
  92. else
  93. return false
  94. end
  95. return true
  96. end
  97. function getMonsterFromList(monster)
  98. local str = ''
  99. if #monster > 0 then
  100. for i = 1, #monster do
  101. str = str .. monster[i]
  102. if i ~= #monster then str = str .. ', ' end
  103. end
  104. end
  105. return str
  106. end
  107. function GiveRewardsTask(cid, items)
  108. local backpack = doPlayerAddItem(cid, 1999, 1) -- backpackID
  109. for _, i_i in ipairs(items) do
  110. local item, amount = i_i[1],i_i[2]
  111. if isItemStackable(item) or amount == 1 then
  112. doAddContainerItem(backpack, item, amount)
  113. else
  114. for i = 1, amount do
  115. doAddContainerItem(backpack, item, 1)
  116. end
  117. end
  118. end
  119. end
  120. function isSummon(cid)
  121. if(not isCreature(cid)) then
  122. return false
  123. end
  124. return getCreatureMaster(cid) ~= cid
  125. end
  126. ]]></config>
  127. <event type="login" name="TaskLogin" event="script"><![CDATA[
  128. function onLogin(cid)
  129. registerCreatureEvent(cid, "KillTask")
  130. registerCreatureEvent(cid, "TaskLook")
  131. return true
  132. end]]></event>
  133. <talkaction words="/task;!task" event="buffer"><![CDATA[
  134. domodlib('task_func')
  135. param,task,daily = param:lower(), getTaskMission(cid), getDailyTaskMission(cid)
  136. if isInArray({"counter","contador"},param) then
  137. setPlayerStorageValue(cid, task_sys_storages[8], getPlayerStorageValue(cid, task_sys_storages[8]) <= 0 and 1 or 0)
  138. doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE,"[Task System] O contador foi "..(getPlayerStorageValue(cid, task_sys_storages[8]) <= 0 and "ativado" or "desativado")..".") return true
  139. elseif isInArray({"daily","diaria"},param) then
  140. if not daily_task[daily] or getPlayerStorageValue(cid, task_sys_storages[7]) <= 0 then
  141. doPlayerSendCancel(cid, "Desculpe, Mas você não está em nenhuma Daily Task.") return true
  142. elseif getPlayerStorageValue(cid, task_sys_storages[6]) - os.time() <= 0 and getPlayerStorageValue(cid, task_sys_storages[5]) < daily_task[daily].count then
  143. 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
  144. end
  145. 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")..".")
  146. end
  147. if not task_sys[task] or getPlayerStorageValue(cid, task_sys[task].start) <= 0 then
  148. doPlayerSendCancel(cid, "você não está em nenhuma task.") return true
  149. end
  150. 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")..".")
  151. ]]></talkaction>
  152. <event type="look" name="TaskLook" event="script"><![CDATA[
  153. domodlib('task_func')
  154. function onLook(cid, thing, position, lookDistance)
  155. if isPlayer(thing.uid) and getTaskPoints(thing.uid) > 0 then
  156. doPlayerSetSpecialDescription(thing.uid, "\n"..(getPlayerSex(thing.uid) == 0 and "She" or "He").. " is a "..GetRankTask(thing.uid))
  157. end
  158. return true
  159. end]]></event>
  160. <event type="kill" name="KillTask" event="script"><![CDATA[
  161. domodlib('task_func')
  162. function onKill(cid, target)
  163. if isPlayer(cid) and isMonster(target) then
  164. local t,daily = task_sys[getTaskMission(cid)], daily_task[getDailyTaskMission(cid)]
  165. 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
  166. setPlayerStorageValue(cid, task_sys_storages[3], getPlayerStorageValue(cid, task_sys_storages[3]) < 0 and 1 or (getPlayerStorageValue(cid, task_sys_storages[3])+1))
  167. if getPlayerStorageValue(cid, task_sys_storages[8]) <= 0 and getPlayerStorageValue(cid, task_sys_storages[3]) < t.count then
  168. doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE,"[Task System] defeated Total [" .. getPlayerStorageValue(cid, task_sys_storages[3]) .. "/" .. t.count .. "] da Task do " .. t.name .. ".")
  169. end
  170. if getPlayerStorageValue(cid, task_sys_storages[3]) >= t.count then
  171. doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE,"[Task System] Parabéns! Você terminou a Task do "..t.name..", volte ao npc parece receber sua recompensa.")
  172. end
  173. end
  174. 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
  175. setPlayerStorageValue(cid, task_sys_storages[5], getPlayerStorageValue(cid, task_sys_storages[5]) < 0 and 1 or (getPlayerStorageValue(cid, task_sys_storages[5])+1))
  176. if getPlayerStorageValue(cid, task_sys_storages[8]) <= 0 and getPlayerStorageValue(cid, task_sys_storages[5]) < daily.count then
  177. doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE,"[Daily Task System] defeated Total [" .. getPlayerStorageValue(cid, task_sys_storages[5]) .. "/" .. daily.count .. "] da Task do " .. daily.name .. ".")
  178. end
  179. if getPlayerStorageValue(cid, task_sys_storages[5]) >= daily.count then
  180. 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.")
  181. end
  182. end
  183. end
  184. return true
  185. end]]></event>
  186. </mod>
Add Comment
Please, Sign In to add comment