Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?xml version="1.0" encoding="ISO-8859-1"?>
- <mod name="Simple Task" version="4.0" author="Vodkart" contact="tibiaking.com" enabled="yes">
- <config name="task_func"><![CDATA[
- task_sys = {
- [1] = {name = "Dwarf Guard", start = 176201, monsters_list = {"Dwarf Guard"}, level = 100, count = 100, points = 100, items = {}, reward = {}, exp = 2000, money = 200000},
- [2] = {name = "Squirrel Yet", start = 176202, monsters_list = {"Squirrel Yet"}, level = 2000, count = 500, points = 100, items = {}, reward = {}, exp = 2500, money = 300000},
- [3] = {name = "Korova Dragon", start = 176203, monsters_list = {"Korova Dragon"}, level = 3000, count = 1200, points = 100, items = {}, reward = {}, exp = 3000, money = 400000},
- [4] = {name = "Phyculos", start = 176204, monsters_list = {"Phyculos"}, level = 5000, count = 2000, points = 100, items = {}, reward = {}, exp = 2000, money = 500000},
- [5] = {name = "Mad Scientist", start = 176205, monsters_list = {"Mad Scientist"}, level = 7000, count = 2500, points = 100, items = {}, reward = {}, exp = 6000, money = 600000},
- [6] = {name = "Omega lizard", start = 176206, monsters_list = {"Omega lizard"}, level = 10000, count = 3500, points = 100, items = {}, reward = {}, exp = 6000, money = 700000},
- [7] = {name = "Warchief", start = 176207, monsters_list = {"Warchief"}, level = 12000, count = 5000, points = 100, items = {}, reward = {}, exp = 3000, money = 800000},
- [8] = {name = "Beholder", start = 176208, monsters_list = {"Beholder"}, level = 15000, count = 5000, points = 100, items = {}, reward = {}, exp = 7000, money = 900000},
- [9] = {name = "Barbarian SkullHunter", start = 176209, monsters_list = {"Barbarian SkullHunter"}, level = 17000, count = 8000, points = 100, items = {}, reward = {}, exp = 9000, money = 100000},
- [10] = {name = "Evil Octopus", start = 176210, monsters_list = {"Evil Octopus"}, level = 20000, count = 11000, points = 100, items = {}, reward = {}, exp = 5000, money = 110000},
- [11] = {name = "Thornback Tortoise", start = 176211, monsters_list = {"Thornback Tortoise"}, level = 22000, count = 15000, points = 100, items = {}, reward = {}, exp = 2000, money = 120000},
- [12] = {name = "Energy", start = 176212, monsters_list = {"Energy"}, level = 25000, count = 18000, points = 100, items = {}, reward = {}, exp = 10000, money = 130000},
- [13] = {name = "Azazel" ,start = 176213, monsters_list = {"Azazel"}, level = 30000, count = 25000, points = 100, items = {}, reward = {}, exp = 2000, money = 140000},
- [14] = {name = "Calmadios" ,start = 176214, monsters_list = {"Calmadios"}, level = 30000, count = 25000, points = 100, items = {}, reward = {}, exp = 8000, money = 140000},
- [15] = {name = "Caos" ,start = 176215, monsters_list = {"Caos"}, level = 30000, count = 30000, points = 100, items = {}, reward = {}, exp = 8000, money = 140000},
- [16] = {name = "Leprechaun" ,start = 176216, monsters_list = {"Leprechaun"}, level = 30000, count = 30000, points = 100, items = {}, reward = {}, exp = 8000, money = 140000},
- [17] = {name = "Misthur" ,start = 176217, monsters_list = {"Misthur"}, level = 30000, count = 45000, points = 100, items = {}, reward = {}, exp = 8000, money = 140000},
- [18] = {name = "Monspiet" ,start = 176218, monsters_list = {"Monspiet"}, level = 30000, count = 45000, points = 100, items = {}, reward = {}, exp = 9000, money = 140000}
- }
- daily_task = {
- [1] = {name = "Beholder" ,monsters_list = {"Beholder"}, count = 15000, points = 200, reward = {}, exp = 7000, money = 100000000},
- [2] = {name = "Thornback Tortoise" ,monsters_list = {"Thornback Tortoise"}, count = 15000, points = 1, reward = {}, exp = 2000, money = 100000000},
- [3] = {name = "Energy" ,monsters_list = {"Energy"}, count = 20000, points = 2, reward = {}, exp = 10000, money = 100000000},
- [4] = {name = "Mad Scientist" ,monsters_list = {"Mad Scientist"}, count = 25000, points = 0, reward = {}, exp = 6000, money = 100000000},
- [5] = {name = "Korova Dragon" ,monsters_list = {"Korova Dragon"}, count = 5000, points = 1, reward = {}, exp = 1000, money = 100000000},
- [6] = {name = "Warchief" ,monsters_list = {"Warchief"}, count = 17500, points = 200, reward = {}, exp = 3000, money = 100000000}
- }
- task_sys_storages = {176601, 176602, 176603, 176604, 176605, 176606, 176607, 176608} -- task, points, count, daily task, daily count, daily time , daily start, contador
- function getTaskMission(cid)
- return getPlayerStorageValue(cid,task_sys_storages[1]) < 0 and 1 or getPlayerStorageValue(cid,task_sys_storages[1])
- end
- function getDailyTaskMission(cid)
- return getPlayerStorageValue(cid,task_sys_storages[4]) < 0 and 1 or getPlayerStorageValue(cid,task_sys_storages[4])
- end
- function getTaskPoints(cid)
- return getPlayerStorageValue(cid,task_sys_storages[2]) < 0 and 0 or getPlayerStorageValue(cid,task_sys_storages[2])
- end
- function doRandomDailyTask(cid)
- local t = {
- [{6,49}] = {1,3},
- [{50,79}] = {4,6},
- [{80,129}] = {7,9},
- [{130,math.huge}] = {10,12}
- }
- for a , b in pairs(t) do
- if getPlayerLevel(cid) >= a[1] and getPlayerLevel(cid) <= a[2] then
- return math.random(b[1], b[2])
- end
- end
- return 0
- end
- function GetRankTask(cid)
- local ranks = {
- [{1, 20}] = "Huntsman",
- [{21, 50}] = "Ranger",
- [{51, 100}] = "Big Game Hunter",
- [{101, 200}] = "Trophy Hunter",
- [{201, math.huge}] = "Elite Hunter"
- }
- for v , r in pairs(ranks) do
- if getTaskPoints(cid) >= v[1] and getTaskPoints(cid) <= v[2] then
- return r
- end
- end
- return 0
- end
- function getItemsFromList(items)
- local str = ''
- if table.maxn(items) > 0 then
- for i = 1, table.maxn(items) do
- str = str .. items[i][2] .. ' ' .. getItemNameById(items[i][1])
- if i ~= table.maxn(items) then str = str .. ', '
- end
- end
- end
- return str
- end
- function doRemoveItemsFromList(cid,items)
- local count = 0
- if table.maxn(items) > 0 then
- for i = 1, table.maxn(items) do
- if getPlayerItemCount(cid,items[i][1]) >= items[i][2] then
- count = count + 1 end
- end
- end
- if count == table.maxn(items) then
- for i = 1, table.maxn(items) do doPlayerRemoveItem(cid,items[i][1],items[i][2]) end
- else
- return false
- end
- return true
- end
- function getMonsterFromList(monster)
- local str = ''
- if #monster > 0 then
- for i = 1, #monster do
- str = str .. monster[i]
- if i ~= #monster then str = str .. ', ' end
- end
- end
- return str
- end
- function GiveRewardsTask(cid, items)
- local backpack = doPlayerAddItem(cid, 1999, 1) -- backpackID
- for _, i_i in ipairs(items) do
- local item, amount = i_i[1],i_i[2]
- if isItemStackable(item) or amount == 1 then
- doAddContainerItem(backpack, item, amount)
- else
- for i = 1, amount do
- doAddContainerItem(backpack, item, 1)
- end
- end
- end
- end
- function isSummon(cid)
- if(not isCreature(cid)) then
- return false
- end
- return getCreatureMaster(cid) ~= cid
- end
- ]]></config>
- <event type="login" name="TaskLogin" event="script"><![CDATA[
- function onLogin(cid)
- registerCreatureEvent(cid, "KillTask")
- registerCreatureEvent(cid, "TaskLook")
- return true
- end]]></event>
- <talkaction words="/task;!task" event="buffer"><![CDATA[
- domodlib('task_func')
- param,task,daily = param:lower(), getTaskMission(cid), getDailyTaskMission(cid)
- if isInArray({"counter","contador"},param) then
- setPlayerStorageValue(cid, task_sys_storages[8], getPlayerStorageValue(cid, task_sys_storages[8]) <= 0 and 1 or 0)
- doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE,"[Task System] O contador foi "..(getPlayerStorageValue(cid, task_sys_storages[8]) <= 0 and "ativado" or "desativado")..".") return true
- elseif isInArray({"daily","diaria"},param) then
- if not daily_task[daily] or getPlayerStorageValue(cid, task_sys_storages[7]) <= 0 then
- doPlayerSendCancel(cid, "Desculpe, Mas você não está em nenhuma Daily Task.") return true
- elseif getPlayerStorageValue(cid, task_sys_storages[6]) - os.time() <= 0 and getPlayerStorageValue(cid, task_sys_storages[5]) < daily_task[daily].count then
- 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
- end
- 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")..".")
- end
- if not task_sys[task] or getPlayerStorageValue(cid, task_sys[task].start) <= 0 then
- doPlayerSendCancel(cid, "você não está em nenhuma task.") return true
- end
- 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")..".")
- ]]></talkaction>
- <event type="look" name="TaskLook" event="script"><![CDATA[
- domodlib('task_func')
- function onLook(cid, thing, position, lookDistance)
- if isPlayer(thing.uid) and getTaskPoints(thing.uid) > 0 then
- doPlayerSetSpecialDescription(thing.uid, "\n"..(getPlayerSex(thing.uid) == 0 and "She" or "He").. " is a "..GetRankTask(thing.uid))
- end
- return true
- end]]></event>
- <event type="kill" name="KillTask" event="script"><![CDATA[
- domodlib('task_func')
- function onKill(cid, target)
- if isPlayer(cid) and isMonster(target) then
- local t,daily = task_sys[getTaskMission(cid)], daily_task[getDailyTaskMission(cid)]
- 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
- setPlayerStorageValue(cid, task_sys_storages[3], getPlayerStorageValue(cid, task_sys_storages[3]) < 0 and 1 or (getPlayerStorageValue(cid, task_sys_storages[3])+1))
- if getPlayerStorageValue(cid, task_sys_storages[8]) <= 0 and getPlayerStorageValue(cid, task_sys_storages[3]) < t.count then
- doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE,"[Task System] defeated Total [" .. getPlayerStorageValue(cid, task_sys_storages[3]) .. "/" .. t.count .. "] da Task do " .. t.name .. ".")
- end
- if getPlayerStorageValue(cid, task_sys_storages[3]) >= t.count then
- doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE,"[Task System] Parabéns! Você terminou a Task do "..t.name..", volte ao npc parece receber sua recompensa.")
- end
- end
- 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
- setPlayerStorageValue(cid, task_sys_storages[5], getPlayerStorageValue(cid, task_sys_storages[5]) < 0 and 1 or (getPlayerStorageValue(cid, task_sys_storages[5])+1))
- if getPlayerStorageValue(cid, task_sys_storages[8]) <= 0 and getPlayerStorageValue(cid, task_sys_storages[5]) < daily.count then
- doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE,"[Daily Task System] defeated Total [" .. getPlayerStorageValue(cid, task_sys_storages[5]) .. "/" .. daily.count .. "] da Task do " .. daily.name .. ".")
- end
- if getPlayerStorageValue(cid, task_sys_storages[5]) >= daily.count then
- 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.")
- end
- end
- end
- return true
- end]]></event>
- </mod>
Add Comment
Please, Sign In to add comment