Postado Fevereiro 11, 2017 8 anos Autor Em 10/02/2017 em 23:25, liteon9y disse: cara eu tava instalando teu sistema aqui no servidor, e reparei um erro quando o pessoal usava !task, para conferir o progresso da task. quando era uma task normal, abria uma janela certinho mostrando a recompensa, quantos bixo tem que matar e etc.. mais quando vc estava em uma daily task, nao aparecia nada, e no console (no executavel) aparecia um erro, toda vez que alguem escrevia !task (e estava em uma daily task) Mostrar conteúdo oculto Mostrar conteúdo oculto [10/2/2017 21:15:29] [Error - TalkAction Interface] [10/2/2017 21:15:29] local cid = 268445933 [10/2/2017 21:15:29] local words = "!task" [10/2/2017 21:15:29] local param = "" [10/2/2017 21:15:29] local channel = 65534 [10/2/2017 21:15:29] domodlib('task_func') [10/2/2017 21:15:29] param,task,daily = param:lower(), getTaskMission(cid), getDailyTaskMission(cid) [10/2/2017 21:15:29] if isInArray({"counter","contador"},param) then [10/2/2017 21:15:29] setPlayerStorageValue(cid, task_sys_storages[8], getPlayerStorageValue(cid, task_sys_storages[8]) <= 0 and 1 or 0) [10/2/2017 21:15:29] doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE,"[Nexth Task System] O contador foi "..(getPlayerStorageValue(cid, task_sys_storages[8]) <= 0 and "ativado" or "desativado")..".") return true [10/2/2017 21:15:29] elseif isInArray({"daily","diaria"},param) then [10/2/2017 21:15:29] if not daily_task[daily] or getPlayerStorageValue(cid, task_sys_storages[7]) <= 0 then [10/2/2017 21:15:29] doPlayerSendCancel(cid, "Desculpe, Mas você não está em nenhuma Nexth Daily Task.") return true [10/2/2017 21:15:29] elseif getPlayerStorageValue(cid, task_sys_storages[6]) - os.time() <= 0 and getPlayerStorageValue(cid, task_sys_storages[5]) < daily_task[daily].count then [10/2/2017 21:15:29] doPlayerSendCancel(cid,"Desculpe, Mas Você não terminou a Nexth Daily Task a tempo! Por favor volte ao npc e comece uma nova Nexth Daily Task!") return true [10/2/2017 21:15:29] end [10/2/2017 21:15:29] return doShowTextDialog(cid, 8983, "[->] NEXTH 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[->] RECOMPENSAS [<-]\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")..".") [10/2/2017 21:15:29] end [10/2/2017 21:15:29] if not task_sys[task] or getPlayerStorageValue(cid, task_sys[task].start) <= 0 then [10/2/2017 21:15:29] doPlayerSendCancel(cid, "você não está em nenhuma task.") return true [10/2/2017 21:15:29] end [10/2/2017 21:15:29] 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")..".") [10/2/2017 21:15:29] Description: [10/2/2017 21:15:29] [string "task_sys = {..."]:85: attempt to index field '?' (a number value) mas eu testei e no meu serve não aparecia nada disso,a té pq !task mostra o progresso da task principal e !task daily mostra de outra... como vc fez para aparecer esse erro? [*Ninguém será digno do sucesso se não usar suas derrotas para conquistá-lo.*] DISCORD: vodkart#6090
Postado Fevereiro 11, 2017 8 anos Em 11/02/2017 em 02:34, Vodkart disse: mas eu testei e no meu serve não aparecia nada disso,a té pq !task mostra o progresso da task principal e !task daily mostra de outra... como vc fez para aparecer esse erro? aff, eu revisei todo o script, eu sem querer apaguei algumas coisas a mais, na hora de editar os monstros e suas recompensar, aff, desculpa o incomodo de varde -.-' fico no aguardo do script modificado para ganhar outfits.. desculpa, vou verificar tudo antes de reclamar aqui no forum hehe !
Postado Fevereiro 11, 2017 8 anos Autor Mostrar conteúdo oculto o mods: <?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 = "Trolls", start = 176201, monsters_list = {"Troll","Troll champion"}, level = 8, count = 40, points = 0, items = {}, reward = {}, exp = 2000, money = 2000, out = {288,289}}, --demonhunter [2] = {name = "rotworms", start = 176202, monsters_list = {"rotworm","carrion worm","Rotworm Queen"}, level = 12, count = 50, points = 0, items = {}, reward = {}, exp = 2500, money = 3000}, [3] = {name = "cyclops", start = 176203, monsters_list = {"cyclops","cyclops smith","cyclops drone"}, level = 19, count = 60, points = 0, items = {}, reward = {}, exp = 3000, money = 3000}, [4] = {name = "Green Djinn", start = 176204, monsters_list = {"Green Djinn","Efreet"}, level = 23, count = 80, points = 1, items = {}, reward = {}, exp = 10000, money = 5000}, [5] = {name = "Blue Djinn", start = 176205, monsters_list = {"Blue Djinn","Marid"}, level = 25, count = 80, points = 1, items = {}, reward = {}, exp = 10000, money = 5000}, [6] = {name = "pirates", start = 176206, monsters_list = {"Pirate Marauder","Pirate Cutthroat","Pirate Buccaneer","Pirate Corsair"}, level = 30, count = 120, points = 2, items = {}, reward = {}, exp = 10000, money = 5000}, [7] = {name = "Stone Golems", start = 176207, monsters_list = {"Stone Golem"}, level = 33, count = 130, points = 3, items = {}, reward = {}, exp = 12000, money = 7000}, [8] = {name = "Carniphilas", start = 176208, monsters_list = {"carniphila"}, level = 36, count = 135, points = 3, items = {}, reward = {}, exp = 8000, money = 8000}, [9] = {name = "Ice Golems", start = 176209, monsters_list = {"ice golem"}, level = 40, count = 150, points = 2, items = {}, reward = {}, exp = 12000, money = 8200}, [10] = {name = "Wailing Widows", start = 176210, monsters_list = {"Wailing Widow"}, level = 42, count = 150, points = 3, items = {}, reward = {}, exp = 0, money = 0}, [11] = {name = "Mutated Rats", start = 176211, monsters_list = {"Mutated Rat"}, level = 46, count = 170, points = 2, items = {}, reward = {}, exp = 8000, money = 8500, out = {269,268}}, -- nightmare [12] = {name = "Dragons", start = 176212, monsters_list = {"dragon"}, level = 50, count = 120, points = 1, items = {}, reward = {}, exp = 9000, money = 9000}, [13] = {name = "Necromancer" ,start = 176213, monsters_list = {"Necromancer"}, level = 60, count = 200, points = 3, items = {}, reward = {}, exp = 20000, money = 15000}, [14] = {name = "Crystal Spiders" ,start = 176214, monsters_list = {"Crystal Spider"}, level = 63, count = 250, points = 3, items = {}, reward = {}, exp = 25000, money = 11000}, [15] = {name = "Giant Spider" ,start = 176215, monsters_list = {"Giant Spider","The old widow"}, level = 80, count = 500, points = 0, items = {}, reward = {}, exp = 20000, money = 32000}, [16] = {name = "Underwater Quaras" ,start = 176216, monsters_list = {"quara predator","quara constrictor","quara hydromancer","quara mantassin","quara pincher"}, level = 82, count = 550, points = 3, items = {}, reward = {}, exp = 22000, money = 15000}, [17] = {name = "Underwater Quaras Scout" ,start = 176217, monsters_list = {"quara predator scout","quara constrictor scout","quara hydromancer scout","quara mantassin scout","quara pincher scout"}, level = 83, count = 600, points = 3, items = {}, reward = {}, exp = 25000, money = 18000}, [18] = {name = "Hellspawn" ,start = 176218, monsters_list = {"Hellspawn"}, level = 85, count = 600, points = 4, items = {}, reward = {}, exp = 28000, money = 26000}, [19] = {name = "Dragon Lords" ,start = 176219, monsters_list = {"Dragon lord"}, level = 88, count = 650, points = 3, items = {}, reward = {}, exp = 30000, money = 35000}, [20] = {name = "Lizard Dragons" ,start = 176220, monsters_list = {"Lizard Chosen","Lizard Dragon Priest","Lizard High Guard","Lizard Legionnaire", "Lizard Zaogun"}, level = 90, count = 600, points = 4, items = {}, reward = {}, exp = 28000, money = 26000}, [21] = {name = "Nightmare" ,start = 176221, monsters_list = {"Nightmare","nightmare scion"}, level = 95, count = 650, points = 2, items = {}, reward = {}, exp = 30000, money = 35000}, [22] = {name = "Hydras" ,start = 176222, monsters_list = {"Hydra"}, level = 100, count = 700, points = 3, items = {}, reward = {}, exp = 40000, money = 40000}, [23] = {name = "Serpent Spawn" ,start = 176223, monsters_list = {"Serpent Spawn"}, level = 103, count = 720, points = 4, items = {}, reward = {}, exp = 50000, money = 45000}, [24] = {name = "Hellhounds" ,start = 176224, monsters_list = {"Hellhound"}, level = 107, count = 650, points = 2, items = {}, reward = {}, exp = 30000, money = 35000}, [25] = {name = "Demons" ,start = 176225, monsters_list = {"Demon"}, level = 110, count = 666, points = 4, items = {}, reward = {}, exp = 66600, money = 66000} } daily_task = { [1] = {name = "Orcs" ,monsters_list = {"Orc Berserker","Orc Rider","Orc Leader","Orc Warlord"}, count = 100, points = 0, reward = {}, exp = 5000, money = 10000}, [2] = {name = "TarantulaS" ,monsters_list = {"Tarantula"}, count = 120, points = 1, reward = {}, exp = 9000, money = 12000}, [3] = {name = "Wyvern" ,monsters_list = {"Wyvern"}, count = 125, points = 2, reward = {}, exp = 9000, money = 15000}, [4] = {name = "Dragons" ,monsters_list = {"Dragon","Dragon Hatchling"}, count = 150, points = 0, reward = {}, exp = 2000, money = 10000}, [5] = {name = "Wailing Widows" ,monsters_list = {"Wailing Widows"}, count = 200, points = 1, reward = {}, exp = 20000, money = 25000}, [6] = {name = "Ancient Scarabs" ,monsters_list = {"Ancient Scarab"}, count = 180, points = 5, reward = {}, exp = 22000, money = 18000}, [7] = {name = "High Class Lizards" ,monsters_list = {"Corrupted Soul","Eternal Guardian","Lizard Chosen","Lizard Dragon Priest","Lizard High Guard","Lizard Legionnaire","Lizard Magistratus","Lizard Noble","Lizard Zaogun"}, count = 300, points = 3, reward = {}, exp = 50000, money = 60000}, [8] = {name = "Mutated BatS" ,monsters_list = {"Mutated Bat"}, count = 260, points = 2, reward = {}, exp = 40000, money = 55000}, [9] = {name = "Giant Spiders" ,monsters_list = {"Giant Spider"}, count = 350, points = 3, reward = {}, exp = 60000, money = 70000}, [10] = {name = "Undead Dragons" ,monsters_list = {"Undead Dragon"}, count = 500, points = 3, reward = {{2173,1}}, exp = 90000, money = 120000}, [11] = {name = "HydraS" ,monsters_list = {"Hydra"}, count = 600, points = 3, reward = {{2173,1}}, exp = 100000, money = 160000}, [12] = {name = "Ghastly Dragons" ,monsters_list = {"Ghastly Dragon"}, count = 700, points = 3, reward = {{2173,1}}, exp = 130000, money = 200000} } 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) and not isSummon(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> npc domodlib('task_func') local keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcHandler) local talkState = {} function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end function onThink() npcHandler:onThink() end function creatureSayCallback(cid, type, msg) if(not npcHandler:isFocused(cid)) then return false end local talkUser,msg, str,rst = NPCHANDLER_CONVbehavior == CONVERSATION_DEFAULT and 0 or cid, msg:lower(),"","" local task,daily, hours = getTaskMission(cid),getDailyTaskMission(cid), 24 if isInArray({"task","tasks","missao","mission"}, msg) then if task_sys[task] then if getPlayerStorageValue(cid, task_sys[task].start) <= 0 then if getPlayerLevel(cid) >= task_sys[task].level then setPlayerStorageValue(cid, task_sys[task].start, 1) npcHandler:say("[Task System] Parabéns, agora você está participando da Task do "..task_sys[task].name.." e deverá matar "..task_sys[task].count.." desta lista: "..getMonsterFromList(task_sys[task].monsters_list)..". "..(#task_sys[task].items > 0 and "Ah e por favor me traga "..getItemsFromList(task_sys[task].items).." para mim." or "").."" , cid) else npcHandler:say("Desculpe, Mas você precisa alcançar level "..task_sys[task].level.." para poder participar da Task dos "..task_sys[task].name.."!", cid) end else npcHandler:say("Desculpe, Mas você atualmente está na task "..task_sys[task].name..". Você pode {entregar} caso já tenha terminado.", cid) end else npcHandler:say("Desculpe, Mas por enquanto não tenho mais nenhuma task para você!", cid) end elseif isInArray({"diaria","daili","daily","dayli","diario"}, msg) then if getPlayerStorageValue(cid, task_sys_storages[6]) - os.time() > 0 then npcHandler:say("Desculpe, você deve esperar até "..os.date("%d %B %Y %X ", getPlayerStorageValue(cid,task_sys_storages[6])).." para iniciar uma nova task diaria!", cid) return true elseif daily_task[daily] and getPlayerStorageValue(cid, task_sys_storages[5]) >= daily_task[daily].count then npcHandler:say("Desculpe, você tem task para {entregar} !", cid) return true end local r = doRandomDailyTask(cid) if r == 0 then npcHandler:say("Desculpe, mas você não tem level para completar nenhuma Task diaria.", cid) return true end setPlayerStorageValue(cid, task_sys_storages[4], r) setPlayerStorageValue(cid, task_sys_storages[6], os.time()+hours*3600) setPlayerStorageValue(cid, task_sys_storages[7], 1) setPlayerStorageValue(cid, task_sys_storages[5], 0) local dtask = daily_task[r] npcHandler:say("[Daily Task System] Parabéns, agora você está participando da Task Diaria do "..dtask.name.." e deverá matar "..dtask.count.." monstros desta lista: "..getMonsterFromList(dtask.monsters_list).." até "..os.date("%d %B %Y %X ", getPlayerStorageValue(cid,task_sys_storages[6]))..". Boa sorte!" , cid) elseif isInArray({"receber","reward","recompensa","report","reportar","entregar","entrega"}, msg) then local v, k = task_sys[task], daily_task[daily] if v then -- original task if getPlayerStorageValue(cid, v.start) > 0 then if getPlayerStorageValue(cid,task_sys_storages[3]) >= v.count then if #v.items > 0 and not doRemoveItemsFromList(cid, v.items) then npcHandler:say("Desculpe, Mas você também precisa entregar os itens desta lista: "..getItemsFromList(v.items), cid) return true end if v.exp > 0 then doPlayerAddExp(cid, v.exp) str = str.."".. (str == "" and "" or ", ") .." "..v.exp.." de exp" end if v.points > 0 then setPlayerStorageValue(cid, task_sys_storages[2], (getTaskPoints(cid)+v.points)) str = str.."".. (str == "" and "" or ", ") .." + "..v.points.."task points" end if v.money > 0 then doPlayerAddMoney(cid, v.money) str = str.."".. (str == "" and "" or ", ") ..""..v.money.." gps" end if v.out ~= nil then doPlayerAddOutfit(cid, getPlayerSex(cid) == 0 and v.out[1] or v.out[2], 3) str = str.."".. (str == "" and "" or ", ") .." New Outfit" end if table.maxn(v.reward) > 0 then GiveRewardsTask(cid, v.reward) str = str.."".. (str == "" and "" or ", ") ..""..getItemsFromList(v.reward) end npcHandler:say("Obrigado pela sua ajuda Recompensas: "..(str == "" and "nenhuma" or ""..str.."").." por ter completado a task do "..v.name, cid) setPlayerStorageValue(cid, task_sys_storages[3], 0) setPlayerStorageValue(cid, task_sys_storages[1], (task+1)) if not task_sys[getTaskMission(cid)] then doPlayerAddPremiumDays(cid, 10) npcHandler:say("Você finalizou todas as Taks e recebeu 10 premium days, parabens.", cid) end else npcHandler:say("Desculpe, Mas você ainda não terminou a sua task do "..v.name..". Preciso que mate mais "..(getPlayerStorageValue(cid, task_sys_storages[3]) < 0 and v.count or -(getPlayerStorageValue(cid,task_sys_storages[3])-v.count)).." Destes monstros terriveis!", cid) end end end if k then -- daily task if getPlayerStorageValue(cid, task_sys_storages[7]) > 0 then if getPlayerStorageValue(cid, task_sys_storages[5]) >= k.count then if k.exp > 0 then doPlayerAddExp(cid, k.exp) rst = rst.."".. (rst == "" and "" or ", ") .." "..k.exp.." de exp" end if k.points > 0 then setPlayerStorageValue(cid, task_sys_storages[2], (getTaskPoints(cid)+k.points)) rst = rst.."".. (rst == "" and "" or ", ") .." + "..k.points.."task points" end if k.money > 0 then doPlayerAddMoney(cid, k.money) rst = rst.."".. (rst == "" and "" or ", ") ..""..k.money.." gps" end if table.maxn(k.reward) > 0 then GiveRewardsTask(cid, k.reward) rst = rst.."".. (rst == "" and "" or ", ") ..""..getItemsFromList(k.reward) end npcHandler:say("Obrigado pela sua ajuda! Recompensas: "..(rst == "" and "nenhuma" or ""..rst.."").." por ter completado a task do "..k.name, cid) setPlayerStorageValue(cid, task_sys_storages[4], 0) setPlayerStorageValue(cid, task_sys_storages[5], 0) setPlayerStorageValue(cid, task_sys_storages[7], 0) else npcHandler:say("Desculpe, Mas você ainda não terminou a sua task diaria do "..k.name..". Preciso que mate mais "..(getPlayerStorageValue(cid, task_sys_storages[5]) < 0 and k.count or -(getPlayerStorageValue(cid,task_sys_storages[5])-k.count)).." Destes monstros!", cid) end end end elseif msg == "no" then selfSay("Tudo bem então", cid) talkState[talkUser] = 0 npcHandler:releaseFocus(cid) end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) para adicionar a outfit só adicionar uma váriavel "out" ficando assim por exemplo: [1] = {name = "Trolls", start = 176201, monsters_list = {"Troll","Troll champion"}, level = 8, count = 40, points = 0, items = {}, reward = {}, exp = 2000, money = 2000}, para [1] = {name = "Trolls", start = 176201, monsters_list = {"Troll","Troll champion"}, level = 8, count = 40, points = 0, items = {}, reward = {}, exp = 2000, money = 2000, out = {288,289}}, --demonhunter depois de "money" adicione uma virgula e coloque out = {outfit female, outfit male} igual ficou nesse mods que editei, pode adicionar em qual task você quiser... no caso coloquei pra vc testar na task 1 e na task 11. obs: npc configurado para adc 10 dias de PA já. Mostrar conteúdo oculto Editado Fevereiro 11, 2017 8 anos por Vodkart (veja o histórico de edições) [*Ninguém será digno do sucesso se não usar suas derrotas para conquistá-lo.*] DISCORD: vodkart#6090
Postado Fevereiro 11, 2017 8 anos Em 11/02/2017 em 14:55, Vodkart disse: Mostrar conteúdo oculto Mostrar conteúdo oculto o mods: <?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 = "Trolls", start = 176201, monsters_list = {"Troll","Troll champion"}, level = 8, count = 40, points = 0, items = {}, reward = {}, exp = 2000, money = 2000, out = {288,289}}, --demonhunter [2] = {name = "rotworms", start = 176202, monsters_list = {"rotworm","carrion worm","Rotworm Queen"}, level = 12, count = 50, points = 0, items = {}, reward = {}, exp = 2500, money = 3000}, [3] = {name = "cyclops", start = 176203, monsters_list = {"cyclops","cyclops smith","cyclops drone"}, level = 19, count = 60, points = 0, items = {}, reward = {}, exp = 3000, money = 3000}, [4] = {name = "Green Djinn", start = 176204, monsters_list = {"Green Djinn","Efreet"}, level = 23, count = 80, points = 1, items = {}, reward = {}, exp = 10000, money = 5000}, [5] = {name = "Blue Djinn", start = 176205, monsters_list = {"Blue Djinn","Marid"}, level = 25, count = 80, points = 1, items = {}, reward = {}, exp = 10000, money = 5000}, [6] = {name = "pirates", start = 176206, monsters_list = {"Pirate Marauder","Pirate Cutthroat","Pirate Buccaneer","Pirate Corsair"}, level = 30, count = 120, points = 2, items = {}, reward = {}, exp = 10000, money = 5000}, [7] = {name = "Stone Golems", start = 176207, monsters_list = {"Stone Golem"}, level = 33, count = 130, points = 3, items = {}, reward = {}, exp = 12000, money = 7000}, [8] = {name = "Carniphilas", start = 176208, monsters_list = {"carniphila"}, level = 36, count = 135, points = 3, items = {}, reward = {}, exp = 8000, money = 8000}, [9] = {name = "Ice Golems", start = 176209, monsters_list = {"ice golem"}, level = 40, count = 150, points = 2, items = {}, reward = {}, exp = 12000, money = 8200}, [10] = {name = "Wailing Widows", start = 176210, monsters_list = {"Wailing Widow"}, level = 42, count = 150, points = 3, items = {}, reward = {}, exp = 0, money = 0}, [11] = {name = "Mutated Rats", start = 176211, monsters_list = {"Mutated Rat"}, level = 46, count = 170, points = 2, items = {}, reward = {}, exp = 8000, money = 8500, out = {269,268}}, -- nightmare [12] = {name = "Dragons", start = 176212, monsters_list = {"dragon"}, level = 50, count = 120, points = 1, items = {}, reward = {}, exp = 9000, money = 9000}, [13] = {name = "Necromancer" ,start = 176213, monsters_list = {"Necromancer"}, level = 60, count = 200, points = 3, items = {}, reward = {}, exp = 20000, money = 15000}, [14] = {name = "Crystal Spiders" ,start = 176214, monsters_list = {"Crystal Spider"}, level = 63, count = 250, points = 3, items = {}, reward = {}, exp = 25000, money = 11000}, [15] = {name = "Giant Spider" ,start = 176215, monsters_list = {"Giant Spider","The old widow"}, level = 80, count = 500, points = 0, items = {}, reward = {}, exp = 20000, money = 32000}, [16] = {name = "Underwater Quaras" ,start = 176216, monsters_list = {"quara predator","quara constrictor","quara hydromancer","quara mantassin","quara pincher"}, level = 82, count = 550, points = 3, items = {}, reward = {}, exp = 22000, money = 15000}, [17] = {name = "Underwater Quaras Scout" ,start = 176217, monsters_list = {"quara predator scout","quara constrictor scout","quara hydromancer scout","quara mantassin scout","quara pincher scout"}, level = 83, count = 600, points = 3, items = {}, reward = {}, exp = 25000, money = 18000}, [18] = {name = "Hellspawn" ,start = 176218, monsters_list = {"Hellspawn"}, level = 85, count = 600, points = 4, items = {}, reward = {}, exp = 28000, money = 26000}, [19] = {name = "Dragon Lords" ,start = 176219, monsters_list = {"Dragon lord"}, level = 88, count = 650, points = 3, items = {}, reward = {}, exp = 30000, money = 35000}, [20] = {name = "Lizard Dragons" ,start = 176220, monsters_list = {"Lizard Chosen","Lizard Dragon Priest","Lizard High Guard","Lizard Legionnaire", "Lizard Zaogun"}, level = 90, count = 600, points = 4, items = {}, reward = {}, exp = 28000, money = 26000}, [21] = {name = "Nightmare" ,start = 176221, monsters_list = {"Nightmare","nightmare scion"}, level = 95, count = 650, points = 2, items = {}, reward = {}, exp = 30000, money = 35000}, [22] = {name = "Hydras" ,start = 176222, monsters_list = {"Hydra"}, level = 100, count = 700, points = 3, items = {}, reward = {}, exp = 40000, money = 40000}, [23] = {name = "Serpent Spawn" ,start = 176223, monsters_list = {"Serpent Spawn"}, level = 103, count = 720, points = 4, items = {}, reward = {}, exp = 50000, money = 45000}, [24] = {name = "Hellhounds" ,start = 176224, monsters_list = {"Hellhound"}, level = 107, count = 650, points = 2, items = {}, reward = {}, exp = 30000, money = 35000}, [25] = {name = "Demons" ,start = 176225, monsters_list = {"Demon"}, level = 110, count = 666, points = 4, items = {}, reward = {}, exp = 66600, money = 66000} } daily_task = { [1] = {name = "Orcs" ,monsters_list = {"Orc Berserker","Orc Rider","Orc Leader","Orc Warlord"}, count = 100, points = 0, reward = {}, exp = 5000, money = 10000}, [2] = {name = "TarantulaS" ,monsters_list = {"Tarantula"}, count = 120, points = 1, reward = {}, exp = 9000, money = 12000}, [3] = {name = "Wyvern" ,monsters_list = {"Wyvern"}, count = 125, points = 2, reward = {}, exp = 9000, money = 15000}, [4] = {name = "Dragons" ,monsters_list = {"Dragon","Dragon Hatchling"}, count = 150, points = 0, reward = {}, exp = 2000, money = 10000}, [5] = {name = "Wailing Widows" ,monsters_list = {"Wailing Widows"}, count = 200, points = 1, reward = {}, exp = 20000, money = 25000}, [6] = {name = "Ancient Scarabs" ,monsters_list = {"Ancient Scarab"}, count = 180, points = 5, reward = {}, exp = 22000, money = 18000}, [7] = {name = "High Class Lizards" ,monsters_list = {"Corrupted Soul","Eternal Guardian","Lizard Chosen","Lizard Dragon Priest","Lizard High Guard","Lizard Legionnaire","Lizard Magistratus","Lizard Noble","Lizard Zaogun"}, count = 300, points = 3, reward = {}, exp = 50000, money = 60000}, [8] = {name = "Mutated BatS" ,monsters_list = {"Mutated Bat"}, count = 260, points = 2, reward = {}, exp = 40000, money = 55000}, [9] = {name = "Giant Spiders" ,monsters_list = {"Giant Spider"}, count = 350, points = 3, reward = {}, exp = 60000, money = 70000}, [10] = {name = "Undead Dragons" ,monsters_list = {"Undead Dragon"}, count = 500, points = 3, reward = {{2173,1}}, exp = 90000, money = 120000}, [11] = {name = "HydraS" ,monsters_list = {"Hydra"}, count = 600, points = 3, reward = {{2173,1}}, exp = 100000, money = 160000}, [12] = {name = "Ghastly Dragons" ,monsters_list = {"Ghastly Dragon"}, count = 700, points = 3, reward = {{2173,1}}, exp = 130000, money = 200000} } 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) and not isSummon(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> npc domodlib('task_func') local keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcHandler) local talkState = {} function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end function onThink() npcHandler:onThink() end function creatureSayCallback(cid, type, msg) if(not npcHandler:isFocused(cid)) then return false end local talkUser,msg, str,rst = NPCHANDLER_CONVbehavior == CONVERSATION_DEFAULT and 0 or cid, msg:lower(),"","" local task,daily, hours = getTaskMission(cid),getDailyTaskMission(cid), 24 if isInArray({"task","tasks","missao","mission"}, msg) then if task_sys[task] then if getPlayerStorageValue(cid, task_sys[task].start) <= 0 then if getPlayerLevel(cid) >= task_sys[task].level then setPlayerStorageValue(cid, task_sys[task].start, 1) npcHandler:say("[Task System] Parabéns, agora você está participando da Task do "..task_sys[task].name.." e deverá matar "..task_sys[task].count.." desta lista: "..getMonsterFromList(task_sys[task].monsters_list)..". "..(#task_sys[task].items > 0 and "Ah e por favor me traga "..getItemsFromList(task_sys[task].items).." para mim." or "").."" , cid) else npcHandler:say("Desculpe, Mas você precisa alcançar level "..task_sys[task].level.." para poder participar da Task dos "..task_sys[task].name.."!", cid) end else npcHandler:say("Desculpe, Mas você atualmente está na task "..task_sys[task].name..". Você pode {entregar} caso já tenha terminado.", cid) end else npcHandler:say("Desculpe, Mas por enquanto não tenho mais nenhuma task para você!", cid) end elseif isInArray({"diaria","daili","daily","dayli","diario"}, msg) then if getPlayerStorageValue(cid, task_sys_storages[6]) - os.time() > 0 then npcHandler:say("Desculpe, você deve esperar até "..os.date("%d %B %Y %X ", getPlayerStorageValue(cid,task_sys_storages[6])).." para iniciar uma nova task diaria!", cid) return true elseif daily_task[daily] and getPlayerStorageValue(cid, task_sys_storages[5]) >= daily_task[daily].count then npcHandler:say("Desculpe, você tem task para {entregar} !", cid) return true end local r = doRandomDailyTask(cid) if r == 0 then npcHandler:say("Desculpe, mas você não tem level para completar nenhuma Task diaria.", cid) return true end setPlayerStorageValue(cid, task_sys_storages[4], r) setPlayerStorageValue(cid, task_sys_storages[6], os.time()+hours*3600) setPlayerStorageValue(cid, task_sys_storages[7], 1) setPlayerStorageValue(cid, task_sys_storages[5], 0) local dtask = daily_task[r] npcHandler:say("[Daily Task System] Parabéns, agora você está participando da Task Diaria do "..dtask.name.." e deverá matar "..dtask.count.." monstros desta lista: "..getMonsterFromList(dtask.monsters_list).." até "..os.date("%d %B %Y %X ", getPlayerStorageValue(cid,task_sys_storages[6]))..". Boa sorte!" , cid) elseif isInArray({"receber","reward","recompensa","report","reportar","entregar","entrega"}, msg) then local v, k = task_sys[task], daily_task[daily] if v then -- original task if getPlayerStorageValue(cid, v.start) > 0 then if getPlayerStorageValue(cid,task_sys_storages[3]) >= v.count then if #v.items > 0 and not doRemoveItemsFromList(cid, v.items) then npcHandler:say("Desculpe, Mas você também precisa entregar os itens desta lista: "..getItemsFromList(v.items), cid) return true end if v.exp > 0 then doPlayerAddExp(cid, v.exp) str = str.."".. (str == "" and "" or ", ") .." "..v.exp.." de exp" end if v.points > 0 then setPlayerStorageValue(cid, task_sys_storages[2], (getTaskPoints(cid)+v.points)) str = str.."".. (str == "" and "" or ", ") .." + "..v.points.."task points" end if v.money > 0 then doPlayerAddMoney(cid, v.money) str = str.."".. (str == "" and "" or ", ") ..""..v.money.." gps" end if v.out ~= nil then doPlayerAddOutfit(cid, getPlayerSex(cid) == 0 and v.out[1] or v.out[2], 3) str = str.."".. (str == "" and "" or ", ") .." New Outfit" end if table.maxn(v.reward) > 0 then GiveRewardsTask(cid, v.reward) str = str.."".. (str == "" and "" or ", ") ..""..getItemsFromList(v.reward) end npcHandler:say("Obrigado pela sua ajuda Recompensas: "..(str == "" and "nenhuma" or ""..str.."").." por ter completado a task do "..v.name, cid) setPlayerStorageValue(cid, task_sys_storages[3], 0) setPlayerStorageValue(cid, task_sys_storages[1], (task+1)) if not task_sys[getTaskMission(cid)] then doPlayerAddPremiumDays(cid, 10) npcHandler:say("Você finalizou todas as Taks e recebeu 10 premium days, parabens.", cid) end else npcHandler:say("Desculpe, Mas você ainda não terminou a sua task do "..v.name..". Preciso que mate mais "..(getPlayerStorageValue(cid, task_sys_storages[3]) < 0 and v.count or -(getPlayerStorageValue(cid,task_sys_storages[3])-v.count)).." Destes monstros terriveis!", cid) end end end if k then -- daily task if getPlayerStorageValue(cid, task_sys_storages[7]) > 0 then if getPlayerStorageValue(cid, task_sys_storages[5]) >= k.count then if k.exp > 0 then doPlayerAddExp(cid, k.exp) rst = rst.."".. (rst == "" and "" or ", ") .." "..k.exp.." de exp" end if k.points > 0 then setPlayerStorageValue(cid, task_sys_storages[2], (getTaskPoints(cid)+k.points)) rst = rst.."".. (rst == "" and "" or ", ") .." + "..k.points.."task points" end if k.money > 0 then doPlayerAddMoney(cid, k.money) rst = rst.."".. (rst == "" and "" or ", ") ..""..k.money.." gps" end if table.maxn(k.reward) > 0 then GiveRewardsTask(cid, k.reward) rst = rst.."".. (rst == "" and "" or ", ") ..""..getItemsFromList(k.reward) end npcHandler:say("Obrigado pela sua ajuda! Recompensas: "..(rst == "" and "nenhuma" or ""..rst.."").." por ter completado a task do "..k.name, cid) setPlayerStorageValue(cid, task_sys_storages[4], 0) setPlayerStorageValue(cid, task_sys_storages[5], 0) setPlayerStorageValue(cid, task_sys_storages[7], 0) else npcHandler:say("Desculpe, Mas você ainda não terminou a sua task diaria do "..k.name..". Preciso que mate mais "..(getPlayerStorageValue(cid, task_sys_storages[5]) < 0 and k.count or -(getPlayerStorageValue(cid,task_sys_storages[5])-k.count)).." Destes monstros!", cid) end end end elseif msg == "no" then selfSay("Tudo bem então", cid) talkState[talkUser] = 0 npcHandler:releaseFocus(cid) end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) para adicionar a outfit só adicionar uma váriavel "out" ficando assim por exemplo: [1] = {name = "Trolls", start = 176201, monsters_list = {"Troll","Troll champion"}, level = 8, count = 40, points = 0, items = {}, reward = {}, exp = 2000, money = 2000}, para [1] = {name = "Trolls", start = 176201, monsters_list = {"Troll","Troll champion"}, level = 8, count = 40, points = 0, items = {}, reward = {}, exp = 2000, money = 2000, out = {288,289}}, --demonhunter depois de "money" adicione uma virgula e coloque out = {outfit female, outfit male} igual ficou nesse mods que editei, pode adicionar em qual task você quiser... no caso coloquei pra vc testar na task 1 e na task 11. obs: npc configurado para adc 10 dias de PA já. Mostrar conteúdo oculto Mostrar conteúdo oculto nossa cara muuito obrigado! show de bola, fico bem do jeitinho que eu queria. hehe! valeeu! REP++ Em 11/02/2017 em 14:55, Vodkart disse: Mostrar conteúdo oculto Mostrar conteúdo oculto o mods: <?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 = "Trolls", start = 176201, monsters_list = {"Troll","Troll champion"}, level = 8, count = 40, points = 0, items = {}, reward = {}, exp = 2000, money = 2000, out = {288,289}}, --demonhunter [2] = {name = "rotworms", start = 176202, monsters_list = {"rotworm","carrion worm","Rotworm Queen"}, level = 12, count = 50, points = 0, items = {}, reward = {}, exp = 2500, money = 3000}, [3] = {name = "cyclops", start = 176203, monsters_list = {"cyclops","cyclops smith","cyclops drone"}, level = 19, count = 60, points = 0, items = {}, reward = {}, exp = 3000, money = 3000}, [4] = {name = "Green Djinn", start = 176204, monsters_list = {"Green Djinn","Efreet"}, level = 23, count = 80, points = 1, items = {}, reward = {}, exp = 10000, money = 5000}, [5] = {name = "Blue Djinn", start = 176205, monsters_list = {"Blue Djinn","Marid"}, level = 25, count = 80, points = 1, items = {}, reward = {}, exp = 10000, money = 5000}, [6] = {name = "pirates", start = 176206, monsters_list = {"Pirate Marauder","Pirate Cutthroat","Pirate Buccaneer","Pirate Corsair"}, level = 30, count = 120, points = 2, items = {}, reward = {}, exp = 10000, money = 5000}, [7] = {name = "Stone Golems", start = 176207, monsters_list = {"Stone Golem"}, level = 33, count = 130, points = 3, items = {}, reward = {}, exp = 12000, money = 7000}, [8] = {name = "Carniphilas", start = 176208, monsters_list = {"carniphila"}, level = 36, count = 135, points = 3, items = {}, reward = {}, exp = 8000, money = 8000}, [9] = {name = "Ice Golems", start = 176209, monsters_list = {"ice golem"}, level = 40, count = 150, points = 2, items = {}, reward = {}, exp = 12000, money = 8200}, [10] = {name = "Wailing Widows", start = 176210, monsters_list = {"Wailing Widow"}, level = 42, count = 150, points = 3, items = {}, reward = {}, exp = 0, money = 0}, [11] = {name = "Mutated Rats", start = 176211, monsters_list = {"Mutated Rat"}, level = 46, count = 170, points = 2, items = {}, reward = {}, exp = 8000, money = 8500, out = {269,268}}, -- nightmare [12] = {name = "Dragons", start = 176212, monsters_list = {"dragon"}, level = 50, count = 120, points = 1, items = {}, reward = {}, exp = 9000, money = 9000}, [13] = {name = "Necromancer" ,start = 176213, monsters_list = {"Necromancer"}, level = 60, count = 200, points = 3, items = {}, reward = {}, exp = 20000, money = 15000}, [14] = {name = "Crystal Spiders" ,start = 176214, monsters_list = {"Crystal Spider"}, level = 63, count = 250, points = 3, items = {}, reward = {}, exp = 25000, money = 11000}, [15] = {name = "Giant Spider" ,start = 176215, monsters_list = {"Giant Spider","The old widow"}, level = 80, count = 500, points = 0, items = {}, reward = {}, exp = 20000, money = 32000}, [16] = {name = "Underwater Quaras" ,start = 176216, monsters_list = {"quara predator","quara constrictor","quara hydromancer","quara mantassin","quara pincher"}, level = 82, count = 550, points = 3, items = {}, reward = {}, exp = 22000, money = 15000}, [17] = {name = "Underwater Quaras Scout" ,start = 176217, monsters_list = {"quara predator scout","quara constrictor scout","quara hydromancer scout","quara mantassin scout","quara pincher scout"}, level = 83, count = 600, points = 3, items = {}, reward = {}, exp = 25000, money = 18000}, [18] = {name = "Hellspawn" ,start = 176218, monsters_list = {"Hellspawn"}, level = 85, count = 600, points = 4, items = {}, reward = {}, exp = 28000, money = 26000}, [19] = {name = "Dragon Lords" ,start = 176219, monsters_list = {"Dragon lord"}, level = 88, count = 650, points = 3, items = {}, reward = {}, exp = 30000, money = 35000}, [20] = {name = "Lizard Dragons" ,start = 176220, monsters_list = {"Lizard Chosen","Lizard Dragon Priest","Lizard High Guard","Lizard Legionnaire", "Lizard Zaogun"}, level = 90, count = 600, points = 4, items = {}, reward = {}, exp = 28000, money = 26000}, [21] = {name = "Nightmare" ,start = 176221, monsters_list = {"Nightmare","nightmare scion"}, level = 95, count = 650, points = 2, items = {}, reward = {}, exp = 30000, money = 35000}, [22] = {name = "Hydras" ,start = 176222, monsters_list = {"Hydra"}, level = 100, count = 700, points = 3, items = {}, reward = {}, exp = 40000, money = 40000}, [23] = {name = "Serpent Spawn" ,start = 176223, monsters_list = {"Serpent Spawn"}, level = 103, count = 720, points = 4, items = {}, reward = {}, exp = 50000, money = 45000}, [24] = {name = "Hellhounds" ,start = 176224, monsters_list = {"Hellhound"}, level = 107, count = 650, points = 2, items = {}, reward = {}, exp = 30000, money = 35000}, [25] = {name = "Demons" ,start = 176225, monsters_list = {"Demon"}, level = 110, count = 666, points = 4, items = {}, reward = {}, exp = 66600, money = 66000} } daily_task = { [1] = {name = "Orcs" ,monsters_list = {"Orc Berserker","Orc Rider","Orc Leader","Orc Warlord"}, count = 100, points = 0, reward = {}, exp = 5000, money = 10000}, [2] = {name = "TarantulaS" ,monsters_list = {"Tarantula"}, count = 120, points = 1, reward = {}, exp = 9000, money = 12000}, [3] = {name = "Wyvern" ,monsters_list = {"Wyvern"}, count = 125, points = 2, reward = {}, exp = 9000, money = 15000}, [4] = {name = "Dragons" ,monsters_list = {"Dragon","Dragon Hatchling"}, count = 150, points = 0, reward = {}, exp = 2000, money = 10000}, [5] = {name = "Wailing Widows" ,monsters_list = {"Wailing Widows"}, count = 200, points = 1, reward = {}, exp = 20000, money = 25000}, [6] = {name = "Ancient Scarabs" ,monsters_list = {"Ancient Scarab"}, count = 180, points = 5, reward = {}, exp = 22000, money = 18000}, [7] = {name = "High Class Lizards" ,monsters_list = {"Corrupted Soul","Eternal Guardian","Lizard Chosen","Lizard Dragon Priest","Lizard High Guard","Lizard Legionnaire","Lizard Magistratus","Lizard Noble","Lizard Zaogun"}, count = 300, points = 3, reward = {}, exp = 50000, money = 60000}, [8] = {name = "Mutated BatS" ,monsters_list = {"Mutated Bat"}, count = 260, points = 2, reward = {}, exp = 40000, money = 55000}, [9] = {name = "Giant Spiders" ,monsters_list = {"Giant Spider"}, count = 350, points = 3, reward = {}, exp = 60000, money = 70000}, [10] = {name = "Undead Dragons" ,monsters_list = {"Undead Dragon"}, count = 500, points = 3, reward = {{2173,1}}, exp = 90000, money = 120000}, [11] = {name = "HydraS" ,monsters_list = {"Hydra"}, count = 600, points = 3, reward = {{2173,1}}, exp = 100000, money = 160000}, [12] = {name = "Ghastly Dragons" ,monsters_list = {"Ghastly Dragon"}, count = 700, points = 3, reward = {{2173,1}}, exp = 130000, money = 200000} } 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) and not isSummon(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> npc domodlib('task_func') local keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcHandler) local talkState = {} function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end function onThink() npcHandler:onThink() end function creatureSayCallback(cid, type, msg) if(not npcHandler:isFocused(cid)) then return false end local talkUser,msg, str,rst = NPCHANDLER_CONVbehavior == CONVERSATION_DEFAULT and 0 or cid, msg:lower(),"","" local task,daily, hours = getTaskMission(cid),getDailyTaskMission(cid), 24 if isInArray({"task","tasks","missao","mission"}, msg) then if task_sys[task] then if getPlayerStorageValue(cid, task_sys[task].start) <= 0 then if getPlayerLevel(cid) >= task_sys[task].level then setPlayerStorageValue(cid, task_sys[task].start, 1) npcHandler:say("[Task System] Parabéns, agora você está participando da Task do "..task_sys[task].name.." e deverá matar "..task_sys[task].count.." desta lista: "..getMonsterFromList(task_sys[task].monsters_list)..". "..(#task_sys[task].items > 0 and "Ah e por favor me traga "..getItemsFromList(task_sys[task].items).." para mim." or "").."" , cid) else npcHandler:say("Desculpe, Mas você precisa alcançar level "..task_sys[task].level.." para poder participar da Task dos "..task_sys[task].name.."!", cid) end else npcHandler:say("Desculpe, Mas você atualmente está na task "..task_sys[task].name..". Você pode {entregar} caso já tenha terminado.", cid) end else npcHandler:say("Desculpe, Mas por enquanto não tenho mais nenhuma task para você!", cid) end elseif isInArray({"diaria","daili","daily","dayli","diario"}, msg) then if getPlayerStorageValue(cid, task_sys_storages[6]) - os.time() > 0 then npcHandler:say("Desculpe, você deve esperar até "..os.date("%d %B %Y %X ", getPlayerStorageValue(cid,task_sys_storages[6])).." para iniciar uma nova task diaria!", cid) return true elseif daily_task[daily] and getPlayerStorageValue(cid, task_sys_storages[5]) >= daily_task[daily].count then npcHandler:say("Desculpe, você tem task para {entregar} !", cid) return true end local r = doRandomDailyTask(cid) if r == 0 then npcHandler:say("Desculpe, mas você não tem level para completar nenhuma Task diaria.", cid) return true end setPlayerStorageValue(cid, task_sys_storages[4], r) setPlayerStorageValue(cid, task_sys_storages[6], os.time()+hours*3600) setPlayerStorageValue(cid, task_sys_storages[7], 1) setPlayerStorageValue(cid, task_sys_storages[5], 0) local dtask = daily_task[r] npcHandler:say("[Daily Task System] Parabéns, agora você está participando da Task Diaria do "..dtask.name.." e deverá matar "..dtask.count.." monstros desta lista: "..getMonsterFromList(dtask.monsters_list).." até "..os.date("%d %B %Y %X ", getPlayerStorageValue(cid,task_sys_storages[6]))..". Boa sorte!" , cid) elseif isInArray({"receber","reward","recompensa","report","reportar","entregar","entrega"}, msg) then local v, k = task_sys[task], daily_task[daily] if v then -- original task if getPlayerStorageValue(cid, v.start) > 0 then if getPlayerStorageValue(cid,task_sys_storages[3]) >= v.count then if #v.items > 0 and not doRemoveItemsFromList(cid, v.items) then npcHandler:say("Desculpe, Mas você também precisa entregar os itens desta lista: "..getItemsFromList(v.items), cid) return true end if v.exp > 0 then doPlayerAddExp(cid, v.exp) str = str.."".. (str == "" and "" or ", ") .." "..v.exp.." de exp" end if v.points > 0 then setPlayerStorageValue(cid, task_sys_storages[2], (getTaskPoints(cid)+v.points)) str = str.."".. (str == "" and "" or ", ") .." + "..v.points.."task points" end if v.money > 0 then doPlayerAddMoney(cid, v.money) str = str.."".. (str == "" and "" or ", ") ..""..v.money.." gps" end if v.out ~= nil then doPlayerAddOutfit(cid, getPlayerSex(cid) == 0 and v.out[1] or v.out[2], 3) str = str.."".. (str == "" and "" or ", ") .." New Outfit" end if table.maxn(v.reward) > 0 then GiveRewardsTask(cid, v.reward) str = str.."".. (str == "" and "" or ", ") ..""..getItemsFromList(v.reward) end npcHandler:say("Obrigado pela sua ajuda Recompensas: "..(str == "" and "nenhuma" or ""..str.."").." por ter completado a task do "..v.name, cid) setPlayerStorageValue(cid, task_sys_storages[3], 0) setPlayerStorageValue(cid, task_sys_storages[1], (task+1)) if not task_sys[getTaskMission(cid)] then doPlayerAddPremiumDays(cid, 10) npcHandler:say("Você finalizou todas as Taks e recebeu 10 premium days, parabens.", cid) end else npcHandler:say("Desculpe, Mas você ainda não terminou a sua task do "..v.name..". Preciso que mate mais "..(getPlayerStorageValue(cid, task_sys_storages[3]) < 0 and v.count or -(getPlayerStorageValue(cid,task_sys_storages[3])-v.count)).." Destes monstros terriveis!", cid) end end end if k then -- daily task if getPlayerStorageValue(cid, task_sys_storages[7]) > 0 then if getPlayerStorageValue(cid, task_sys_storages[5]) >= k.count then if k.exp > 0 then doPlayerAddExp(cid, k.exp) rst = rst.."".. (rst == "" and "" or ", ") .." "..k.exp.." de exp" end if k.points > 0 then setPlayerStorageValue(cid, task_sys_storages[2], (getTaskPoints(cid)+k.points)) rst = rst.."".. (rst == "" and "" or ", ") .." + "..k.points.."task points" end if k.money > 0 then doPlayerAddMoney(cid, k.money) rst = rst.."".. (rst == "" and "" or ", ") ..""..k.money.." gps" end if table.maxn(k.reward) > 0 then GiveRewardsTask(cid, k.reward) rst = rst.."".. (rst == "" and "" or ", ") ..""..getItemsFromList(k.reward) end npcHandler:say("Obrigado pela sua ajuda! Recompensas: "..(rst == "" and "nenhuma" or ""..rst.."").." por ter completado a task do "..k.name, cid) setPlayerStorageValue(cid, task_sys_storages[4], 0) setPlayerStorageValue(cid, task_sys_storages[5], 0) setPlayerStorageValue(cid, task_sys_storages[7], 0) else npcHandler:say("Desculpe, Mas você ainda não terminou a sua task diaria do "..k.name..". Preciso que mate mais "..(getPlayerStorageValue(cid, task_sys_storages[5]) < 0 and k.count or -(getPlayerStorageValue(cid,task_sys_storages[5])-k.count)).." Destes monstros!", cid) end end end elseif msg == "no" then selfSay("Tudo bem então", cid) talkState[talkUser] = 0 npcHandler:releaseFocus(cid) end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) para adicionar a outfit só adicionar uma váriavel "out" ficando assim por exemplo: [1] = {name = "Trolls", start = 176201, monsters_list = {"Troll","Troll champion"}, level = 8, count = 40, points = 0, items = {}, reward = {}, exp = 2000, money = 2000}, para [1] = {name = "Trolls", start = 176201, monsters_list = {"Troll","Troll champion"}, level = 8, count = 40, points = 0, items = {}, reward = {}, exp = 2000, money = 2000, out = {288,289}}, --demonhunter depois de "money" adicione uma virgula e coloque out = {outfit female, outfit male} igual ficou nesse mods que editei, pode adicionar em qual task você quiser... no caso coloquei pra vc testar na task 1 e na task 11. obs: npc configurado para adc 10 dias de PA já. Mostrar conteúdo oculto Mostrar conteúdo oculto Aaah cara, só uma ultima coisa, se voce ainda tiver tempo, existe a possibilidade de adicionar uma divisao de outfits -> 1 para cada vocaçao como premio? explicando melhor: quando voce entrega a task dos troll ganha demohunter outfit, mais no meu servidor esse outfit adiciona +10 de meele entao nao fais muito sentido um sorcerer ganhar este outfit. eu queria se possivel que voce adicione nesse 'script', uma funçao para adicionar um outfit para cada vocaçao, exemplo, ao entregar a task dos troll; os knight ganham brotherhood outfit, mais os druids e sorc ganham summoner outfit, e os paladins ganham demonhunter.. existe como fazer esta separaçao de premio? (lembrando que é a mesma task, mais com recompensa diferenciada para cada vocaçao) ja vou deixar o REP+ porque tenho certeza que vc vai conseguir! UM HEROI NUNCA FALHA!!! cara se voce conseguir fazer isso, vou deixar os creditos deste script sendo anunciado no serverlog a cada 5 minutos. !!!!!! REP + REP + REP + !!!! Editado Fevereiro 11, 2017 8 anos por liteon9y + detalhes adicionados (veja o histórico de edições)
Postado Fevereiro 11, 2017 8 anos Autor Mostrar conteúdo oculto ficou assim: [1] = {name = "Trolls", start = 176201, monsters_list = {"Troll","Troll champion"}, level = 8, count = 40, points = 0, items = {}, reward = {}, exp = 2000, money = 2000, out = {[1] = {var = {141,133}, name = "Summoner"},[2] = {var = {141,133}, name = "Summoner"},[3] = {var = {288,289}, name = "Demonhunter"},[4] = {var = {279,278}, name = "Brotherhood"}}}, a tabela das voc está assim: out = {[1] = {var = {141,133}, name = "Summoner"},[2] = {var = {141,133}, name = "Summoner"},[3] = {var = {288,289}, name = "Demonhunter"},[4] = {var = {279,278}, name = "Brotherhood"}} [1] -- aqui é o id da vocation, 1 é sorcerer se não me engano então var = {141, 133} é o id da outfit female e male name -- é o nome da outfit que ele vai receber caso queira adicionar mais uma, por exemplo a voc 5(master sorc) ficaria assim: out = {[1] = {var = {141,133}, name = "Summoner"},[2] = {var = {141,133}, name = "Summoner"},[3] = {var = {288,289}, name = "Demonhunter"},[4] = {var = {279,278}, name = "Brotherhood"},[5] = {var = {141,133}, name = "Summoner"}} mods <?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 = "Trolls", start = 176201, monsters_list = {"Troll","Troll champion"}, level = 8, count = 40, points = 0, items = {}, reward = {}, exp = 2000, money = 2000, out = {[1] = {var = {141,133}, name = "Summoner"},[2] = {var = {141,133}, name = "Summoner"},[3] = {var = {288,289}, name = "Demonhunter"},[4] = {var = {279,278}, name = "Brotherhood"}}}, [2] = {name = "rotworms", start = 176202, monsters_list = {"rotworm","carrion worm","Rotworm Queen"}, level = 12, count = 50, points = 0, items = {}, reward = {}, exp = 2500, money = 3000}, [3] = {name = "cyclops", start = 176203, monsters_list = {"cyclops","cyclops smith","cyclops drone"}, level = 19, count = 60, points = 0, items = {}, reward = {}, exp = 3000, money = 3000}, [4] = {name = "Green Djinn", start = 176204, monsters_list = {"Green Djinn","Efreet"}, level = 23, count = 80, points = 1, items = {}, reward = {}, exp = 10000, money = 5000}, [5] = {name = "Blue Djinn", start = 176205, monsters_list = {"Blue Djinn","Marid"}, level = 25, count = 80, points = 1, items = {}, reward = {}, exp = 10000, money = 5000}, [6] = {name = "pirates", start = 176206, monsters_list = {"Pirate Marauder","Pirate Cutthroat","Pirate Buccaneer","Pirate Corsair"}, level = 30, count = 120, points = 2, items = {}, reward = {}, exp = 10000, money = 5000}, [7] = {name = "Stone Golems", start = 176207, monsters_list = {"Stone Golem"}, level = 33, count = 130, points = 3, items = {}, reward = {}, exp = 12000, money = 7000}, [8] = {name = "Carniphilas", start = 176208, monsters_list = {"carniphila"}, level = 36, count = 135, points = 3, items = {}, reward = {}, exp = 8000, money = 8000}, [9] = {name = "Ice Golems", start = 176209, monsters_list = {"ice golem"}, level = 40, count = 150, points = 2, items = {}, reward = {}, exp = 12000, money = 8200}, [10] = {name = "Wailing Widows", start = 176210, monsters_list = {"Wailing Widow"}, level = 42, count = 150, points = 3, items = {}, reward = {}, exp = 0, money = 0}, [11] = {name = "Mutated Rats", start = 176211, monsters_list = {"Mutated Rat"}, level = 46, count = 170, points = 2, items = {}, reward = {}, exp = 8000, money = 8500}, [12] = {name = "Dragons", start = 176212, monsters_list = {"dragon"}, level = 50, count = 120, points = 1, items = {}, reward = {}, exp = 9000, money = 9000}, [13] = {name = "Necromancer" ,start = 176213, monsters_list = {"Necromancer"}, level = 60, count = 200, points = 3, items = {}, reward = {}, exp = 20000, money = 15000}, [14] = {name = "Crystal Spiders" ,start = 176214, monsters_list = {"Crystal Spider"}, level = 63, count = 250, points = 3, items = {}, reward = {}, exp = 25000, money = 11000}, [15] = {name = "Giant Spider" ,start = 176215, monsters_list = {"Giant Spider","The old widow"}, level = 80, count = 500, points = 0, items = {}, reward = {}, exp = 20000, money = 32000}, [16] = {name = "Underwater Quaras" ,start = 176216, monsters_list = {"quara predator","quara constrictor","quara hydromancer","quara mantassin","quara pincher"}, level = 82, count = 550, points = 3, items = {}, reward = {}, exp = 22000, money = 15000}, [17] = {name = "Underwater Quaras Scout" ,start = 176217, monsters_list = {"quara predator scout","quara constrictor scout","quara hydromancer scout","quara mantassin scout","quara pincher scout"}, level = 83, count = 600, points = 3, items = {}, reward = {}, exp = 25000, money = 18000}, [18] = {name = "Hellspawn" ,start = 176218, monsters_list = {"Hellspawn"}, level = 85, count = 600, points = 4, items = {}, reward = {}, exp = 28000, money = 26000}, [19] = {name = "Dragon Lords" ,start = 176219, monsters_list = {"Dragon lord"}, level = 88, count = 650, points = 3, items = {}, reward = {}, exp = 30000, money = 35000}, [20] = {name = "Lizard Dragons" ,start = 176220, monsters_list = {"Lizard Chosen","Lizard Dragon Priest","Lizard High Guard","Lizard Legionnaire", "Lizard Zaogun"}, level = 90, count = 600, points = 4, items = {}, reward = {}, exp = 28000, money = 26000}, [21] = {name = "Nightmare" ,start = 176221, monsters_list = {"Nightmare","nightmare scion"}, level = 95, count = 650, points = 2, items = {}, reward = {}, exp = 30000, money = 35000}, [22] = {name = "Hydras" ,start = 176222, monsters_list = {"Hydra"}, level = 100, count = 700, points = 3, items = {}, reward = {}, exp = 40000, money = 40000}, [23] = {name = "Serpent Spawn" ,start = 176223, monsters_list = {"Serpent Spawn"}, level = 103, count = 720, points = 4, items = {}, reward = {}, exp = 50000, money = 45000}, [24] = {name = "Hellhounds" ,start = 176224, monsters_list = {"Hellhound"}, level = 107, count = 650, points = 2, items = {}, reward = {}, exp = 30000, money = 35000}, [25] = {name = "Demons" ,start = 176225, monsters_list = {"Demon"}, level = 110, count = 666, points = 4, items = {}, reward = {}, exp = 66600, money = 66000} } daily_task = { [1] = {name = "Orcs" ,monsters_list = {"Orc Berserker","Orc Rider","Orc Leader","Orc Warlord"}, count = 100, points = 0, reward = {}, exp = 5000, money = 10000}, [2] = {name = "TarantulaS" ,monsters_list = {"Tarantula"}, count = 120, points = 1, reward = {}, exp = 9000, money = 12000}, [3] = {name = "Wyvern" ,monsters_list = {"Wyvern"}, count = 125, points = 2, reward = {}, exp = 9000, money = 15000}, [4] = {name = "Dragons" ,monsters_list = {"Dragon","Dragon Hatchling"}, count = 150, points = 0, reward = {}, exp = 2000, money = 10000}, [5] = {name = "Wailing Widows" ,monsters_list = {"Wailing Widows"}, count = 200, points = 1, reward = {}, exp = 20000, money = 25000}, [6] = {name = "Ancient Scarabs" ,monsters_list = {"Ancient Scarab"}, count = 180, points = 5, reward = {}, exp = 22000, money = 18000}, [7] = {name = "High Class Lizards" ,monsters_list = {"Corrupted Soul","Eternal Guardian","Lizard Chosen","Lizard Dragon Priest","Lizard High Guard","Lizard Legionnaire","Lizard Magistratus","Lizard Noble","Lizard Zaogun"}, count = 300, points = 3, reward = {}, exp = 50000, money = 60000}, [8] = {name = "Mutated BatS" ,monsters_list = {"Mutated Bat"}, count = 260, points = 2, reward = {}, exp = 40000, money = 55000}, [9] = {name = "Giant Spiders" ,monsters_list = {"Giant Spider"}, count = 350, points = 3, reward = {}, exp = 60000, money = 70000}, [10] = {name = "Undead Dragons" ,monsters_list = {"Undead Dragon"}, count = 500, points = 3, reward = {{2173,1}}, exp = 90000, money = 120000}, [11] = {name = "HydraS" ,monsters_list = {"Hydra"}, count = 600, points = 3, reward = {{2173,1}}, exp = 100000, money = 160000}, [12] = {name = "Ghastly Dragons" ,monsters_list = {"Ghastly Dragon"}, count = 700, points = 3, reward = {{2173,1}}, exp = 130000, money = 200000} } 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) and not isSummon(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> npc domodlib('task_func') local keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcHandler) local talkState = {} function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end function onThink() npcHandler:onThink() end function creatureSayCallback(cid, type, msg) if(not npcHandler:isFocused(cid)) then return false end local talkUser,msg, str,rst = NPCHANDLER_CONVbehavior == CONVERSATION_DEFAULT and 0 or cid, msg:lower(),"","" local task,daily, hours = getTaskMission(cid),getDailyTaskMission(cid), 24 if isInArray({"task","tasks","missao","mission"}, msg) then if task_sys[task] then if getPlayerStorageValue(cid, task_sys[task].start) <= 0 then if getPlayerLevel(cid) >= task_sys[task].level then setPlayerStorageValue(cid, task_sys[task].start, 1) npcHandler:say("[Task System] Parabéns, agora você está participando da Task do "..task_sys[task].name.." e deverá matar "..task_sys[task].count.." desta lista: "..getMonsterFromList(task_sys[task].monsters_list)..". "..(#task_sys[task].items > 0 and "Ah e por favor me traga "..getItemsFromList(task_sys[task].items).." para mim." or "").."" , cid) else npcHandler:say("Desculpe, Mas você precisa alcançar level "..task_sys[task].level.." para poder participar da Task dos "..task_sys[task].name.."!", cid) end else npcHandler:say("Desculpe, Mas você atualmente está na task "..task_sys[task].name..". Você pode {entregar} caso já tenha terminado.", cid) end else npcHandler:say("Desculpe, Mas por enquanto não tenho mais nenhuma task para você!", cid) end elseif isInArray({"diaria","daili","daily","dayli","diario"}, msg) then if getPlayerStorageValue(cid, task_sys_storages[6]) - os.time() > 0 then npcHandler:say("Desculpe, você deve esperar até "..os.date("%d %B %Y %X ", getPlayerStorageValue(cid,task_sys_storages[6])).." para iniciar uma nova task diaria!", cid) return true elseif daily_task[daily] and getPlayerStorageValue(cid, task_sys_storages[5]) >= daily_task[daily].count then npcHandler:say("Desculpe, você tem task para {entregar} !", cid) return true end local r = doRandomDailyTask(cid) if r == 0 then npcHandler:say("Desculpe, mas você não tem level para completar nenhuma Task diaria.", cid) return true end setPlayerStorageValue(cid, task_sys_storages[4], r) setPlayerStorageValue(cid, task_sys_storages[6], os.time()+hours*3600) setPlayerStorageValue(cid, task_sys_storages[7], 1) setPlayerStorageValue(cid, task_sys_storages[5], 0) local dtask = daily_task[r] npcHandler:say("[Daily Task System] Parabéns, agora você está participando da Task Diaria do "..dtask.name.." e deverá matar "..dtask.count.." monstros desta lista: "..getMonsterFromList(dtask.monsters_list).." até "..os.date("%d %B %Y %X ", getPlayerStorageValue(cid,task_sys_storages[6]))..". Boa sorte!" , cid) elseif isInArray({"receber","reward","recompensa","report","reportar","entregar","entrega"}, msg) then local v, k = task_sys[task], daily_task[daily] if v then -- original task if getPlayerStorageValue(cid, v.start) > 0 then if getPlayerStorageValue(cid,task_sys_storages[3]) >= v.count then if #v.items > 0 and not doRemoveItemsFromList(cid, v.items) then npcHandler:say("Desculpe, Mas você também precisa entregar os itens desta lista: "..getItemsFromList(v.items), cid) return true end if v.exp > 0 then doPlayerAddExp(cid, v.exp) str = str.."".. (str == "" and "" or ", ") .." "..v.exp.." de exp" end if v.points > 0 then setPlayerStorageValue(cid, task_sys_storages[2], (getTaskPoints(cid)+v.points)) str = str.."".. (str == "" and "" or ", ") .." + "..v.points.."task points" end if v.money > 0 then doPlayerAddMoney(cid, v.money) str = str.."".. (str == "" and "" or ", ") ..""..v.money.." gps" end if v.out ~= nil then local ret = v.out[getPlayerVocation(cid)] if ret then doPlayerAddOutfit(cid, getPlayerSex(cid) == 0 and ret.var[1] or ret.var[2], 3) str = str.."".. (str == "" and "" or ", ") .." New "..ret.name.." Outfit" end end if table.maxn(v.reward) > 0 then GiveRewardsTask(cid, v.reward) str = str.."".. (str == "" and "" or ", ") ..""..getItemsFromList(v.reward) end npcHandler:say("Obrigado pela sua ajuda Recompensas: "..(str == "" and "nenhuma" or ""..str.."").." por ter completado a task do "..v.name, cid) setPlayerStorageValue(cid, task_sys_storages[3], 0) setPlayerStorageValue(cid, task_sys_storages[1], (task+1)) if not task_sys[getTaskMission(cid)] then doPlayerAddPremiumDays(cid, 10) npcHandler:say("Você finalizou todas as Taks e recebeu 10 premium days, parabens.", cid) end else npcHandler:say("Desculpe, Mas você ainda não terminou a sua task do "..v.name..". Preciso que mate mais "..(getPlayerStorageValue(cid, task_sys_storages[3]) < 0 and v.count or -(getPlayerStorageValue(cid,task_sys_storages[3])-v.count)).." Destes monstros terriveis!", cid) end end end if k then -- daily task if getPlayerStorageValue(cid, task_sys_storages[7]) > 0 then if getPlayerStorageValue(cid, task_sys_storages[5]) >= k.count then if k.exp > 0 then doPlayerAddExp(cid, k.exp) rst = rst.."".. (rst == "" and "" or ", ") .." "..k.exp.." de exp" end if k.points > 0 then setPlayerStorageValue(cid, task_sys_storages[2], (getTaskPoints(cid)+k.points)) rst = rst.."".. (rst == "" and "" or ", ") .." + "..k.points.."task points" end if k.money > 0 then doPlayerAddMoney(cid, k.money) rst = rst.."".. (rst == "" and "" or ", ") ..""..k.money.." gps" end if table.maxn(k.reward) > 0 then GiveRewardsTask(cid, k.reward) rst = rst.."".. (rst == "" and "" or ", ") ..""..getItemsFromList(k.reward) end npcHandler:say("Obrigado pela sua ajuda! Recompensas: "..(rst == "" and "nenhuma" or ""..rst.."").." por ter completado a task do "..k.name, cid) setPlayerStorageValue(cid, task_sys_storages[4], 0) setPlayerStorageValue(cid, task_sys_storages[5], 0) setPlayerStorageValue(cid, task_sys_storages[7], 0) else npcHandler:say("Desculpe, Mas você ainda não terminou a sua task diaria do "..k.name..". Preciso que mate mais "..(getPlayerStorageValue(cid, task_sys_storages[5]) < 0 and k.count or -(getPlayerStorageValue(cid,task_sys_storages[5])-k.count)).." Destes monstros!", cid) end end end elseif msg == "no" then selfSay("Tudo bem então", cid) talkState[talkUser] = 0 npcHandler:releaseFocus(cid) end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) ok? qualquer dúvida avisa [*Ninguém será digno do sucesso se não usar suas derrotas para conquistá-lo.*] DISCORD: vodkart#6090
Participe da conversa
Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.