Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- ########################################################
- -- ##### Name: Adriano Swatt' #####
- -- ##### Version: 3.0 #####
- -- ########################################################
- -- ##### Developed by Adriano Swatt' #####
- -- ##### Contact: adrianoswat@yahoo.com.br #####
- -- ##### PERSONALIZED TASK SYSTEM BY SWATT' #####
- -- ########################################################
- -- [[ EXPLAIN // EXPLICAÇÃO // COMO CONFIGURAR ]] --
- -- storage = Storage Que Salva: Task Ativa/Repetição/Dia/Hora/Minute
- -- countSto = Storage Que Salva Quantidade que Matou
- -- count = Quantidade Total Que Precisará Matar
- -- price = Preço da Task em Gold Coins
- -- repeated = Quantas Vezes Pode Realizar a Task
- -- inDay = Day Value: Quantos dias para realizar // false: se a task fica ativa até a conclusão
- -- awards = [1] = {id = Premio, multiply = quantidade} // seguindo modelo // usar [1] = {id = "exp", multiply = QUANTIDADE}
- -- DICA: Deixe sempre a Experiência por último
- _SETTING_TASK_SYSTEM_CONFIG = {
- taskAtSameTime = 3, -- Quantas Tasks Ativas Ao Mesmo Tempo
- }
- _MONSTERS_TASK_SYSTEM_CONFIG = {
- ["crocodile"] = {storage = 20001, countSto = 30001, count = 300, price = 0, repeated = 5, inDay = false,
- mlist = {"crocodile"},
- awards = {
- [1] = {id = 2476, multiply = 1},
- [2] = {id = "exp", multiply = 800}
- }
- },
- -- [[ SPACE ]] --
- ["tarantula"] = {storage = 20002, countSto = 30002, count = 300, price = 0, repeated = 5, inDay = false,
- mlist = {"tarantula"},
- awards = {
- [1] = {id = 2477, multiply = 1},
- [2] = {id = 5879, multiply = 5},
- [3] = {id = "exp", multiply = 1500}
- }
- },
- -- [[ SPACE ]] --
- ["carniphila"] = {storage = 20003, countSto = 30003, count = 150, price = 0, repeated = 1, inDay = false,
- mlist = {"carniphila"},
- awards = {
- [1] = {id = 7886, multiply = 1},
- [2] = {id = 5015, multiply = 1},
- [3] = {id = "exp", multiply = 2500}
- }
- },
- -- [[ SPACE ]] --
- ["ice golem"] = {storage = 20004, countSto = 30004, count = 400, price = 0, repeated = 5, inDay = false,
- mlist = {"ice golem"},
- awards = {
- [1] = {id = 2160, multiply = 1},
- [2] = {id = 7290, multiply = 1},
- [3] = {id = "exp", multiply = 12000}
- }
- },
- -- [[ SPACE ]] --
- ["mutated rat"] = {storage = 20005, countSto = 30005, count = 500, price = 0, repeated = 5, inDay = false,
- mlist = {"mutated rat"},
- awards = {
- [1] = {id = 2438, multiply = 1},
- [2] = {id = 7884, multiply = 1},
- [3] = {id = "exp", multiply = 10000}
- }
- },
- -- [[ SPACE ]] --
- ["ancient scarab"] = {storage = 20006, countSto = 30006, count = 250, price = 0, repeated = 2, inDay = false,
- mlist = {"ancient scarab"},
- awards = {
- [1] = {id = 2160, multiply = 5},
- [2] = {id = "exp", multiply = 15000}
- }
- },
- -- [[ SPACE ]] --
- ["wailing widow"] = {storage = 20007, countSto = 30007, count = 500, price = 0, repeated = 1, inDay = false,
- mlist = {"wailing widow"},
- awards = {
- [1] = {id = 13307, multiply = 1},
- [2] = {id = "exp", multiply = 15000}
- }
- },
- -- [[ SPACE ]] --
- ["bonebeast"] = {storage = 20008, countSto = 30008, count = 500, price = 0, repeated = 1, inDay = false,
- mlist = {"bonebeast"},
- awards = {
- [1] = {id = 13291, multiply = 1},
- [2] = {id = "exp", multiply = 15000}
- }
- },
- -- [[ SPACE ]] --
- ["crystal spider"] = {storage = 20009, countSto = 30009, count = 300, price = 0, repeated = 5, inDay = false,
- mlist = {"crystal spider"},
- awards = {
- [1] = {id = 7437, multiply = 1},
- [2] = {id = "exp", multiply = 15000}
- }
- },
- -- [[ SPACE ]] --
- ["giant spider"] = {storage = 20010, countSto = 30010, count = 500, price = 0, repeated = 5, inDay = false,
- mlist = {"giant spider"},
- awards = {
- [1] = {id = 7416, multiply = 1},
- [2] = {id = 5879, multiply = 10},
- [3] = {id = "exp", multiply = 20000}
- }
- },
- -- [[ SPACE ]] --
- ["werewolf"] = {storage = 20011, countSto = 30011, count = 300, price = 0, repeated = 2, inDay = false,
- mlist = {"werewolf"},
- awards = {
- [1] = {id = 5897, multiply = 50},
- [2] = {id = 2160, multiply = 5},
- [3] = {id = "exp", multiply = 20000}
- }
- },
- -- [[ SPACE ]] --
- ["nightmare"] = {storage = 20012, countSto = 30012, count = 500, price = 0, repeated = 1, inDay = false,
- mlist = {"nightmare"},
- awards = {
- [1] = {id = 2195, multiply = 1},
- [2] = {id = 13830, multiply = 1},
- [3] = {id = "exp", multiply = 30000}
- }
- },
- -- [[ SPACE ]] --
- ["hellspawn"] = {storage = 20013, countSto = 30013, count = 600, price = 0, repeated = 2, inDay = false,
- mlist = {"hellspawn"},
- awards = {
- [1] = {id = 6500, multiply = 150},
- [2] = {id = 2160, multiply = 5},
- [3] = {id = "exp", multiply = 30000}
- }
- },
- -- [[ SPACE ]] --
- ["mutated bat"] = {storage = 20014, countSto = 30014, count = 400, price = 0, repeated = 5, inDay = false,
- mlist = {"mutated bat"},
- awards = {
- [1] = {id = 5894, multiply = 50},
- [2] = {id = "exp", multiply = 20000}
- }
- },
- -- [[ SPACE ]] --
- ["hydra"] = {storage = 20015, countSto = 30015, count = 600, price = 0, repeated = 5, inDay = false,
- mlist = {"hydra"},
- awards = {
- [1] = {id = 2160, multiply = 100},
- [2] = {id = "exp", multiply = 30000}
- }
- },
- -- [[ SPACE ]] --
- ["medusa"] = {storage = 20016, countSto = 30016, count = 500, price = 0, repeated = 1, inDay = false,
- mlist = {"medusa"},
- awards = {
- [1] = {id = 7887, multiply = 1},
- [2] = {id = 7885, multiply = 1},
- [3] = {id = 7884, multiply = 1},
- [4] = {id = 7886, multiply = 1},
- [5] = {id = "exp", multiply = 40000}
- }
- },
- -- [[ SPACE ]] --
- ["behemoth"] = {storage = 20017, countSto = 30017, count = 700, price = 0, repeated = 3, inDay = false,
- mlist = {"behemoth"},
- awards = {
- [1] = {id = 5930, multiply = 1},
- [2] = {id = 5893, multiply = 5},
- [3] = {id = "exp", multiply = 50000}
- }
- },
- -- [[ SPACE ]] --
- ["sea serpent"] = {storage = 20018, countSto = 30018, count = 900, price = 0, repeated = 1, inDay = false,
- mlist = {"sea serpent"},
- awards = {
- [1] = {id = 8887, multiply = 1},
- [2] = {id = "exp", multiply = 30000}
- }
- },
- -- [[ SPACE ]] --
- ["undead dragon"] = {storage = 20019, countSto = 30019, count = 400, price = 0, repeated = 1, inDay = false,
- mlist = {"undead dragon"},
- awards = {
- [1] = {id = 8885, multiply = 1},
- [2] = {id = "exp", multiply = 80000}
- }
- },
- -- [[ SPACE ]] --
- ["ghastly dragon"] = {storage = 20020, countSto = 30020, count = 500, price = 0, repeated = 1, inDay = false,
- mlist = {"ghastly dragon"},
- awards = {
- [1] = {id = 13938, multiply = 1},
- [2] = {id = "exp", multiply = 80000}
- }
- },
- -- [[ SPACE ]] --
- ["dragon lord"] = {storage = 20021, countSto = 30021, count = 1000, price = 0, repeated = 1, inDay = false,
- mlist = {"dragon lord"},
- awards = {
- [1] = {id = 5919, multiply = 1},
- [2] = {id = "exp", multiply = 100000}
- }
- },
- -- [[ SPACE ]] --
- ["demon"] = {storage = 20022, countSto = 30022, count = 666, price = 0, repeated = 1, inDay = false,
- mlist = {"demon"},
- awards = {
- [1] = {id = 2160, multiply = 10},
- [2] = {id = "exp", multiply = 500000}
- }
- },
- -- [[ SPACE ]] --
- ["frost dragon"] = {storage = 20024, countSto = 30024, count = 1000, price = 0, repeated = 3, inDay = false,
- mlist = {"frost dragon"},
- awards = {
- [1] = {id = 2160, multiply = 10},
- [2] = {id = "exp", multiply = 200000}
- }
- },
- ["minotaur"] = {storage = 20025, countSto = 30025, count = 1000, price = 5000, repeated = 5, inDay = false,
- mlist = {"minotaur", "minotaur archer", "minotaur guard"},
- awards = {
- [1] = {id = 5804, multiply = 1},
- [2] = {id = "exp", multiply = 15000}
- }
- },
- -- [[ SPACE ]] --
- ["cyclops"] = {storage = 20026, countSto = 30026, count = 700, price = 7000, repeated = 3, inDay = false,
- mlist = {"cyclops", "cyclops drone", "cyclops smith"},
- awards = {
- [1] = {id = 2195, multiply = 1},
- [2] = {id = 2160, multiply = 5},
- [3] = {id = "exp", multiply = 15000}
- }
- },
- -- [[ SPACE ]] --
- ["orc"] = {storage = 20027, countSto = 30027, count = 440, price = 5000, repeated = 3, inDay = false,
- mlist = {"orc", "orc berserker", "orc leader", "orc warrior"},
- awards = {
- [1] = {id = 2195, multiply = 1},
- [2] = {id = 6561, multiply = 1},
- [3] = {id = 2160, multiply = 10},
- [4] = {id = "exp", multiply = 100000}
- }
- },
- }
- -- [[ Storage: ativo (1) / repetição / Prazo ]] --
- function checkPlayerIsInTask(cid) -- RETURN: True if he can do some task // MonsterName if he can't
- getSto = doOrganizeTaskSto(_MONSTERS_TASK_SYSTEM_CONFIG)
- if isPlayer(cid) then
- pTaskTab = {}
- for a = getSto[1], getSto[#getSto] do
- if getPlayerStorageValue(cid, a) ~= -1 then
- onCheck = doCutTaskStorage(cid, a, "/")
- if #onCheck > 0 then
- active = tonumber(onCheck[1]:sub(2, 2))
- if active >= 1 then
- mName = whatTaskIsActive(cid, a)
- table.insert(pTaskTab, mName)
- end
- end
- end
- end
- return pTaskTab
- end
- return true
- end
- function checkAlreadyDoingThisTask(cid, name, list) -- Return Monster Name if Can Do, or false if can't
- cfg = _MONSTERS_TASK_SYSTEM_CONFIG
- for i = 1, #list do
- getArray = cfg[list[i]].mlist
- if getArray then
- if isInArray(getArray, name) then
- return list[i]
- end
- end
- end
- return false
- end
- function getInfoPlayerTask(cid, mName) -- Returns: [1] Repetition, [2] full date from Especific Task.
- local infoTab = {}
- getList = _MONSTERS_TASK_SYSTEM_CONFIG
- if isPlayer(cid) then
- getInfo = getList[mName:lower()]
- if getInfo then
- if getPlayerStorageValue(cid, getInfo.storage) ~= -1 then
- local onCut = doCutTaskStorage(cid, getInfo.storage, "/")
- if #onCut > 0 then
- for a = 2, 3 do
- table.insert(infoTab, tonumber(onCut[a]))
- end
- return infoTab
- else
- return true
- end
- else
- return false
- end
- end
- end
- end
- function doCutTaskStorage(cid, storageKey, cutType) -- cutType [Ex: ","]
- local cutSto = {}
- local string = tostring(getPlayerStorageValue(cid, storageKey))
- local cutSto = string:explode(cutType)
- if #cutSto > 0 then
- for i = 1, #cutSto do
- table.insert(cutSto, cutSto[i])
- end
- return cutSto
- else
- return true
- end
- end
- function whatTaskIsActive(cid, stoKey) -- Retorna Qual Task Ativa
- taskList = _MONSTERS_TASK_SYSTEM_CONFIG
- for index, result in pairs(taskList) do
- if result.storage == stoKey then
- return index
- end
- end
- end
- function getAwardsList(cid, list) -- Retorna Lista de Premiação
- local awardList = ''
- get = list
- for a = 1, #list do
- if isNumber(list[a].id) then
- if list[a].multiply <= 1 then
- awardList = awardList.."{"..list[a].multiply.."x "..getItemNameById(list[a].id).."}, "
- else
- awardList = awardList.."{"..list[a].multiply.."x "..getItemPluralNameById(list[a].id).."}, "
- end
- else
- cawardList = awardList:sub(1, (#awardList-2))
- awardList = cawardList.." and {"..list[a].multiply.." experience points}"
- end
- end
- return awardList
- end
- function doGiveTaskAwards(cid, list) -- Entrega Lista de Prêmios
- if isPlayer(cid) then
- for a = 1, #list do
- if isNumber(list[a].id) then
- doPlayerAddItem(cid, list[a].id, list[a].multiply)
- else
- doPlayerAddExp(cid, list[a].multiply)
- end
- end
- end
- return true
- end
- function doGiveTaskMonsterList(cid, list) -- Retorna Lista de Task Ativas [Tabela Monster Names]
- if isPlayer(cid) then
- name = ""
- for a = 1, #list do
- if a == 1 then
- name = "{"..list[a].."}"
- elseif a > 1 and a < #list then
- name = ""..name..", {"..list[a].."}"
- else
- name = ""..name.." and {"..list[a].."}"
- end
- end
- end
- return name
- end
- function doCloseTimedTask(cid, monster)
- getInfo = getInfoPlayerTask(cid, monster)
- taskList = _MONSTERS_TASK_SYSTEM_CONFIG
- getM = taskList[monster]
- if getM then
- if getInfo then
- repet = getInfo[1]
- data = getInfo[2]
- newValue = "&0/"..repet.."/"..data..""
- setPlayerStorageValue(cid, getM.storage, newValue)
- setPlayerStorageValue(cid, getM.countSto, 0)
- end
- end
- end
- function doPlayerDonePersoTask(cid)
- taskList = checkPlayerIsInTask(cid)
- if #taskList > 0 then
- mList = _MONSTERS_TASK_SYSTEM_CONFIG
- for i = 1, #taskList do
- task = mList[taskList[i]]
- if task then
- killeds = getPlayerStorageValue(cid, task.countSto)
- if killeds == task.count then
- return taskList[i]
- end
- end
- end
- else
- return false
- end
- end
- function doOrganizeTaskSto(taskList) -- Retorna Primeira e Última Storage de Todas Tasks
- local tabSto = {}
- taskList = _MONSTERS_TASK_SYSTEM_CONFIG
- for index, result in pairs(taskList) do
- if result.storage then
- table.insert(tabSto, result.storage)
- end
- end
- table.sort(tabSto, function(a, b) return a < b end)
- return tabSto
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement