Advertisement
Kaiquegabriel

mods

Jul 23rd, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.95 KB | None | 0 0
  1. <?xml version="1.0" encoding="UTF-8"?>
  2.  
  3. <mod name="Simple Task" version="3.0" author="Vodkart" contact="tibiaking.com" enabled="yes">
  4.  
  5. <config name="task_func"><![CDATA[
  6.  
  7.  
  8. tasktabble = {
  9.  
  10. ["rats"] = {monster_race={"rat","cave rat"}, storage_start = 200201, storage = 91001,count = 50,exp = 500,money = 500},
  11.  
  12. ["troll"] = {monster_race={"troll","frost troll","swamp troll"}, storage_start = 200202, storage = 91002,count = 150,exp = 0,money = 800},
  13.  
  14. ["rotworm"] = {monster_race={"rotworm","carrion worm"}, storage_start = 200203, storage = 91003,count = 300,exp = 1000,money = 800},
  15.  
  16. ["cyclops"] = {monster_race={"cyclops","cyclops smith","cyclops drone"}, storage_start = 200204, storage = 91004,count = 300,exp = 2000,money = 1000},
  17.  
  18. ["thornback tortoise"] = {monster_race={"thornback tortoise"}, storage_start = 200205, storage = 91005,count = 300,exp = 1500,money = 0},
  19.  
  20. ["tarantula"] = {monster_race={"tarantula"}, storage_start = 200206, storage = 91006,count = 300,exp = 1500, money = 0, reward = {{5879,1}}},
  21.  
  22. ["monkey"] = {monster_race={"konkra","sibang","merlkin"}, storage_start = 200207, storage = 91007,count = 300,exp = 1000,money = 0},
  23.  
  24. ["pirate two"] = {monster_race={"pirate buccaneer","pirate corsair","pirate cutthroat","pirate ghost","pirate marauder","pirate skeleton"}, storage_start = 200208, storage = 91008,count = 300,exp = 10000,money = 5000},
  25.  
  26. ["minotaur"] = {monster_race={"minotaur","minotaur archer","minotaur mage","minotaur guard"}, storage_start = 200209, storage = 91009,count = 20},
  27.  
  28. ["mammoth"] = {monster_race={"mammoth"}, storage_start = 200210, storage = 91010,count= 300},
  29.  
  30. ["carniphila"] = {monster_race={"carniphila"}, storage_start = 200211, storage = 91011,count= 150, exp = 2500},
  31.  
  32. ["stone golem"] = {monster_race={"stone golem"}, storage_start = 200212, storage = 91012,count= 200, exp = 2000},
  33.  
  34. ["ice golem"] = {monster_race={"ice golem"}, storage_start = 200213, storage = 91013,count= 300, exp = 12000},
  35.  
  36. ["dragon"] = {monster_race={"dragon","dragon lord"}, storage_start = 200214, storage = 91014,count= 1000, exp = 25000},
  37.  
  38. ["giant spider"] = {monster_race={"giant spider"}, storage_start = 200215, storage = 91016,count = 500, exp = 20000, money = 0, reward = {{5886,1}}},
  39.  
  40. ["ancient scarab"] = {monster_race={"ancient scarab"}, storage_start = 200217, storage = 91017,count = 300, exp = 15000, money = 10000, reward = {{2181,1}}},
  41.  
  42. ["crystal spider"] = {monster_race={"crystal spider"}, storage_start = 200218, storage = 91018,count = 300, exp = 15000, money = 0},
  43.  
  44. ["bonebeast"] = {monster_race={"bonebeast"}, storage_start = 200219, storage = 91019,count = 300, exp = 12000, money = 0},
  45.  
  46. ["nightmare"] = {monster_race={"nightmare"}, storage_start = 200220, storage = 91020,count = 400, exp = 25000, money = 30000},
  47.  
  48. ["hydra"] = {monster_race={"hydra"}, storage_start = 200221, storage = 91021,count = 650, exp = 30000, money = 0, reward = {{2195,1}}},
  49.  
  50. ["quara"] = {monster_race={"quara predator","quara constrictor","quara hydromancer","quara mantassin","quara pincher"}, storage_start = 200222, storage = 91022,count = 600, exp = 15000 money = 0},
  51.  
  52. ["serpent spawn"] = {monster_race={"serpent spawn"}, storage_start = 200223, storage = 91023,count = 800, exp = 30000, money = 0, reward = {{10309,1}}},
  53.  
  54. ["medusa"] = {monster_race={"medusa"}, storage_start = 200224, storage = 91024,count = 500, exp = 40000, money = 25000},
  55.  
  56. ["behemoth"] = {monster_race={"behemoth"}, storage_start = 200224, storage = 91024,count = 500, exp = 40000, money = 25000},
  57.  
  58. }
  59.  
  60.  
  61.  
  62. configbosses_task = {
  63.  
  64. {race = "minotaur",Playerpos = {x = 189, y = 57, z = 7}, FromPosToPos = {{x = 186, y = 54, z = 7},{x = 193, y = 60, z = 7}},time = 5},
  65.  
  66. {race = "necromancer",Playerpos = {x = 196, y = 39, z = 7}, FromPosToPos = {{x = 195, y = 37, z = 7},{x = 198, y = 41, z = 7}}, time = 5},
  67.  
  68. {race = "dragon",Playerpos = {x = 208, y = 59, z = 7}, FromPosToPos = {{x = 206, y = 56, z = 7},{x = 209, y = 65, z = 7}}, time = 5}
  69.  
  70. }
  71.  
  72.  
  73. function CheckTask(cid)
  74.  
  75. for k, v in pairs(tasktabble) do
  76.  
  77. if getPlayerStorageValue(cid,v.storage_start) >= 1 then return true end
  78.  
  79. end
  80.  
  81. return false
  82.  
  83. end
  84.  
  85. function finisheAllTask(cid)
  86.  
  87. local config = {
  88.  
  89. exp = {true,100000},
  90.  
  91. money = {true,200000},
  92.  
  93. items ={false,{{2124,2},{2173,1}}},
  94.  
  95. premium ={true,5}
  96.  
  97. }
  98.  
  99. local x = true
  100.  
  101. for k, v in pairs(tasktabble) do
  102.  
  103. if tonumber(getPlayerStorageValue(cid,v.storage)) then
  104.  
  105. x = false
  106.  
  107. end
  108.  
  109. end
  110.  
  111. if x == true then
  112.  
  113. setPlayerStorageValue(cid, 521456, 0)
  114.  
  115. local b = getGlobalStorageValue(63005) if b == -1 then b = 1 end
  116.  
  117. if b < 11 then
  118.  
  119. setGlobalStorageValue(63005,b+1)
  120.  
  121. doBroadcastMessage('[Task Mission Complete] '..getCreatureName(cid)..' was the '..b..' to finish the task!.')
  122.  
  123. doPlayerAddPremiumDays(cid, config.premium[1] == true and config.premium[2] or 0)
  124.  
  125. doPlayerAddExp(cid, config.exp[1] == true and config.exp[2] or 0)
  126.  
  127. doPlayerAddMoney(cid, config.money[1] == true and config.money[2] or 0)
  128.  
  129. if config.items[1] == true then doAddItemsFromList(cid,config.items[2]) end
  130.  
  131. doItemSetAttribute(doPlayerAddItem(cid, 7369), "name", "trophy "..getCreatureName(cid).." completed all the task.")
  132.  
  133. end
  134.  
  135. end
  136.  
  137. end
  138.  
  139. function HavePlayerPosition(cid, from, to)
  140.  
  141. return isInRange(getPlayerPosition(cid), from, to) and true or false
  142.  
  143. end
  144.  
  145. function getRankStorage(cid, value, max, RankName) -- by vodka
  146.  
  147. local str =""
  148.  
  149. str = "--[".. (RankName == nil and "RANK STORAGE" or ""..RankName.."") .."]--\n\n"
  150.  
  151. local query = db.getResult("SELECT `player_id`, `value` FROM `player_storage` WHERE `key` = "..value.." ORDER BY cast(value as INTEGER) DESC;")
  152.  
  153. if (query:getID() ~= -1) then k = 1 repeat if k > max then break end
  154.  
  155. str = str .. "\n " .. k .. ". "..getPlayerNameByGUID(query:getDataString("player_id")).." - [" .. query:getDataInt("value") .. "]"
  156.  
  157. k = k + 1 until not query:next() end return doShowTextDialog(cid, 2529, str)
  158.  
  159. end
  160.  
  161. function getItemsInContainerById(container, itemid) -- Function By Kydrai
  162.  
  163. local items = {}
  164.  
  165. if isContainer(container) and getContainerSize(container) > 0 then
  166.  
  167. for slot=0, (getContainerSize(container)-1) do
  168.  
  169. local item = getContainerItem(container, slot)
  170.  
  171. if isContainer(item.uid) then
  172.  
  173. local itemsbag = getItemsInContainerById(item.uid, itemid)
  174.  
  175. for i=0, #itemsbag do
  176.  
  177. table.insert(items, itemsbag[i])
  178.  
  179. end
  180.  
  181. else
  182.  
  183. if itemid == item.itemid then
  184.  
  185. table.insert(items, item.uid)
  186.  
  187. end
  188.  
  189. end
  190.  
  191. end
  192.  
  193. end
  194.  
  195. return items
  196.  
  197. end
  198.  
  199. function doPlayerAddItemStacking(cid, itemid, quant) -- by mkalo
  200.  
  201. local item = getItemsInContainerById(getPlayerSlotItem(cid, 3).uid, itemid)
  202.  
  203. local piles = 0
  204.  
  205. if #item > 0 then
  206.  
  207. for i,x in pairs(item) do
  208.  
  209. if getThing(x).type < 100 then
  210.  
  211. local it = getThing(x)
  212.  
  213. doTransformItem(it.uid, itemid, it.type+quant)
  214.  
  215. if it.type+quant > 100 then
  216.  
  217. doPlayerAddItem(cid, itemid, it.type+quant-100)
  218.  
  219. end
  220.  
  221. else
  222.  
  223. piles = piles+1
  224.  
  225. end
  226.  
  227. end
  228.  
  229. else
  230.  
  231. return doPlayerAddItem(cid, itemid, quant)
  232.  
  233. end
  234.  
  235. if piles == #item then
  236.  
  237. doPlayerAddItem(cid, itemid, quant)
  238.  
  239. end
  240.  
  241. end
  242.  
  243. function getItemsFromList(items) -- by vodka
  244.  
  245. local str = ''
  246.  
  247. if table.maxn(items) > 0 then
  248.  
  249. for i = 1, table.maxn(items) do
  250.  
  251. str = str .. items[i][2] .. ' ' .. getItemNameById(items[i][1])
  252.  
  253. if i ~= table.maxn(items) then str = str .. ', ' end end end
  254.  
  255. return str
  256.  
  257. end
  258.  
  259. function doAddItemsFromList(cid,items) -- by vodka
  260.  
  261. if table.maxn(items) > 0 then
  262.  
  263. for i = 1, table.maxn(items) do
  264.  
  265. local count = items[i][2]
  266.  
  267. while count > 0 do
  268.  
  269. if isItemStackable(items[i][1]) then
  270.  
  271. doPlayerAddItemStacking(cid, items[i][1], 1)
  272.  
  273. else
  274.  
  275. doPlayerAddItem(cid, items[i][1],1)
  276.  
  277. end
  278.  
  279. count = count - 1
  280.  
  281. end
  282.  
  283. end
  284.  
  285. end
  286.  
  287. end
  288.  
  289. function pairsByKeys(t, f)
  290.  
  291. local a = {}
  292.  
  293. for n in pairs(t) do table.insert(a, n) end
  294.  
  295. table.sort(a, f)
  296.  
  297. local i = 0
  298.  
  299. local iter = function ()
  300.  
  301. i = i + 1
  302.  
  303. if a[i] == nil then return nil
  304.  
  305. else return a[i], t[a[i]]
  306.  
  307. end
  308.  
  309. end
  310.  
  311. return iter
  312.  
  313. end
  314.  
  315. ]]></config>
  316.  
  317. <event type="login" name="TaskLogin" event="script"><![CDATA[
  318.  
  319. function onLogin(cid)
  320.  
  321. registerCreatureEvent(cid, "KillTask")
  322.  
  323. return true
  324.  
  325. end]]></event>
  326.  
  327. <talkaction words="/task;!task" event="buffer"><![CDATA[
  328.  
  329. domodlib('task_func')
  330.  
  331. local param = string.lower(param)
  332.  
  333. if param == "rank" then
  334.  
  335. getRankStorage(cid, 521456, 20, "Task Rank Finalizadas") return true
  336.  
  337. end
  338.  
  339. local str = ""
  340.  
  341. str = str .. "Task Completed :\n\n"
  342.  
  343. for k, v in pairsByKeys(tasktabble) do
  344.  
  345. local contagem = getPlayerStorageValue(cid, v.storage)
  346.  
  347. if (contagem == -1) then contagem = 1 end
  348.  
  349. str = str..k.." = ".. (not tonumber(contagem) and "["..contagem.."]" or "["..((contagem)-1).."/"..v.count.."]") .."\n"
  350.  
  351. end
  352.  
  353. str = str .. ""
  354.  
  355. return doShowTextDialog(cid, 8983, str)
  356.  
  357. ]]></talkaction>
  358.  
  359. <event type="kill" name="KillTask" event="script"><![CDATA[
  360.  
  361. domodlib('task_func')
  362.  
  363. function onKill(cid, target, lastHit)
  364.  
  365. if(isMonster(target) == true) then
  366.  
  367. local n = string.lower(getCreatureName(target))
  368.  
  369. for race, mob in pairs(tasktabble) do
  370.  
  371. if getPlayerStorageValue(cid,mob .storage_start) >= 1 then
  372.  
  373. for i = 1,#mob.monster_race do
  374.  
  375. if n == mob.monster_race[i] then
  376.  
  377. local contagem = getPlayerStorageValue(cid, mob.storage)
  378.  
  379. if (contagem == -1) then contagem = 1 end
  380.  
  381. if not tonumber(contagem) then return true end
  382.  
  383. if contagem > mob.count then return true end
  384.  
  385. if contagem > mob.count then return true end
  386.  
  387. setPlayerStorageValue(cid, mob.storage, contagem+1)
  388.  
  389. doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE,""..(contagem == mob.count and "Congratulations! You finished the task of "..race.."." or "You killed " .. contagem .. " off " .. mob.count .. " " .. race .. "s.").."")
  390.  
  391. end
  392.  
  393. end
  394.  
  395. end
  396.  
  397. end
  398.  
  399. end
  400.  
  401. return true
  402.  
  403. end]]></event>
  404.  
  405. </mod>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement