<?xml version="1.0" encoding="ISO-8859-1"?>
<mod name="Automatic Simple Task" version="1.0" author="Vodkart" contact="tibiaking.com" enabled="yes">
<config name="auto_stask"><![CDATA[
automatic_task = {
[1] = {name = "Dragon", storage = 761000, monsters_list = {"Dragon"}, can_repeat = false, level_min = 10, count = 4, reward = {{6527,75}, {2160,100}, {8261,1}, {10314,1}}, exp = 500000},
[2] = {name = "Crystal Spider", storage = 761001, monsters_list = {"Crystal Spider"}, can_repeat = false, level_min = 10, count = 2500, reward = {{6527,75}, {2160,100}, {8261,1}, {10314,1}}, exp = 500000},
[3] = {name = "Damaged Worker Golem", storage = 761002, monsters_list = {"Damaged Worker Golem"}, can_repeat = false, level_min = 10, count = 2500, reward = {{6527,75}, {2160,100}, {8261,1}, {10314,1}}, exp = 500000},
[4] = {name = "Demon", storage = 761003, monsters_list = {"Demon"}, can_repeat = false, level_min = 10, count = 2500, reward = {{6527,75}, {2160,100}, {8261,1}, {10314,1}}, exp = 500000},
[5] = {name = "Dragon Lord", storage = 761004, monsters_list = {"Dragon Lord"}, can_repeat = false, level_min = 10, count = 2500, reward = {{6527,75}, {2160,100}, {8261,1}, {10314,1}}, exp = 500000},
[6] = {name = "Donate Gang Member", storage = 761005, monsters_list = {"Donate Gang Member"}, can_repeat = false, level_min = 10, count = 15000, reward = {{6527,75}, {2160,100}, {8261,1}, {10314,1}}, exp = 73000000},
[7] = {name = "Earth Elemental", storage = 761006, monsters_list = {"Earth Elemental"}, can_repeat = false, level_min = 10, count = 2500, reward = {{6527,75}, {2160,100}, {8261,1}, {10314,1}}, exp = 500000},
[8] = {name = "Eternal Guardian", storage = 761007, monsters_list = {"Eternal Guardian"}, can_repeat = false, level_min = 10, count = 2500, reward = {{6527,75}, {2160,100}, {8261,1}, {10314,1}}, exp = 500000},
[9] = {name = "Ferumbras", storage = 761008, monsters_list = {"Ferumbras"}, can_repeat = false, level_min = 10, count = 2500, reward = {{6527,75}, {2160,100}, {8261,1}, {10314,1}}, exp = 500000},
[10] = {name = "Frost Dragon", storage = 761009, monsters_list = {"Frost Dragon"}, can_repeat = false, level_min = 10, count = 2500, reward = {{6527,75}, {2160,100}, {8261,1}, {10314,1}}, exp = 500000},
}
automatic_task_config = {
reward_type = MESSAGE_STATUS_CONSOLE_BLUE,
defeat_type = MESSAGE_STATUS_CONSOLE_ORANGE,
defeat_storage = 963850,
lvl_advance_control = 963851
}
function getItemsFromList(items)
local str = ''
if #items > 0 then
for i = 1, #items do
str = str .. items[i][2] .. ' ' .. getItemNameById(items[i][1])
if i ~= #items then str = str .. ', ' end
end
end
return str
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, 7343, 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
]]></config>
<event type="advance" name="TaskAutAdvance" event="script"><![CDATA[
domodlib('auto_stask')
function onAdvance(cid, skill, oldLevel, newLevel)
if (skill == SKILL__LEVEL) then
if getPlayerStorageValue(cid, automatic_task_config.lvl_advance_control) < newLevel then
for k, v in pairs(automatic_task) do
if v.level_min == newLevel then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "[Task Automatico] --> Voce Desbloqueou a "..v.name.." Task! Parabens!")
end
end
setPlayerStorageValue(cid, automatic_task_config.lvl_advance_control, newLevel)
end
end
return true
end
]]></event>
<talkaction words="/task;!task" event="buffer"><![CDATA[
domodlib('auto_stask')
param, str = param:lower(), "Task(s) Disponiveis:\n\n"
if isInArray({"counter","contador","count"}, param) then
setPlayerStorageValue(cid, automatic_task_config.defeat_storage, getPlayerStorageValue(cid, automatic_task_config.defeat_storage) <= 0 and 1 or 0)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "[Task Automatico] --> O Contador Foi "..(getPlayerStorageValue(cid, automatic_task_config.defeat_storage) <= 0 and "Ativado" or "Desativado")..".")
return true
end
for k, v in pairs(automatic_task) do
if getPlayerLevel(cid) >= v.level_min and getPlayerStorageValue(cid, v.storage) < v.count then
local amount = getPlayerStorageValue(cid, v.storage) <= 0 and 0 or getPlayerStorageValue(cid, v.storage)
str = str.."[+] "..v.name.." Task [+]\n\nMonster Count: ["..amount.."/"..v.count.."]\n\nMonsters Killing: "..getMonsterFromList(v.monsters_list)..".\n\nLevel: "..v.level_min.." or More.\n\nCan repeat: "..(v.can_repeat and "yes" or "no")..".\n\nRewards: "..(#v.reward > 0 and getItemsFromList(v.reward) or "Nothing")..".\n\nExp: "..(v.exp > 0 and v.exp or 0)..".\n\n"
end
end
return doShowTextDialog(cid, 8983, str)
]]></talkaction>
<event type="login" name="TaskAutLogin" event="script"><![CDATA[
function onLogin(cid)
registerCreatureEvent(cid, "KillAutTask")
registerCreatureEvent(cid, "TaskAutAdvance")
return true
end
]]></event>
<event type="kill" name="KillAutTask" event="script"><![CDATA[
domodlib('auto_stask')
function onKill(cid, target)
local str = ""
if isPlayer(cid) and isMonster(target) then
for task, info in pairs(automatic_task) do
if isInArray(info.monsters_list, getCreatureName(target)) and getPlayerLevel(cid) >= info.level_min then
local ret = getPlayerStorageValue(cid, info.storage) <= 0 and 0 or getPlayerStorageValue(cid, info.storage)
if ret < info.count then
setPlayerStorageValue(cid, info.storage, getPlayerStorageValue(cid, info.storage) <= 0 and 1 or (getPlayerStorageValue(cid, info.storage)+1))
if getPlayerStorageValue(cid, automatic_task_config.defeat_storage) <= 0 and getPlayerStorageValue(cid, info.storage) < info.count then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE,"[Task Automatico] --> Voce Matou [" .. getPlayerStorageValue(cid, info.storage) .. "/" .. info.count .. "] da Task do " .. info.name .. ".")
end
if getPlayerStorageValue(cid, info.storage) >= info.count then
if info.exp > 0 then
doPlayerAddExp(cid, info.exp)
str = str..(str == "" and "" or ", ")..info.exp.." de Exp"
end
if #info.reward > 0 then
GiveRewardsTask(cid, info.reward)
str = str..(str == "" and "" or ", ")..getItemsFromList(info.reward)
end
doPlayerSendTextMessage(cid, automatic_task_config.reward_type, "[Task Automatico] --> Voce Completou a "..info.name.." Task. PREMIOS: "..(str == "" and "nenhuma" or str))
if info.can_repeat == true then
setPlayerStorageValue(cid, info.storage, 0)
end
end
end
end
end
end
return true
end
]]></event>
</mod>