-- TASK
RANK_NONE = 0
RANK_HUNTSMAN = 1
RANK_RANGER = 2
RANK_BIGGAMEHUNTER = 3
RANK_TROPHYHUNTER = 4
RANK_ELITEHUNTER = 5
REWARD_MONEY = 1
REWARD_EXP = 2
REWARD_ACHIEVEMENT = 3
REWARD_STORAGE = 4
REWARD_POINT = 5
REWARD_ITEM = 6
QUESTSTORAGE_BASE = 71500
KILLSSTORAGE_BASE = 72500
REPEATSTORAGE_BASE = 73500
POINTSSTORAGE = 72500
ONTASKSTORAGE = 74500
tasks =
{
[1] = {killsRequired = 100, raceName = "Easy Monsters", level = {1, 6656}, premium = false, creatures = {"Dwarf", "Dwarf Soldier", "spider", "troll", "bug"}, rewards = {
{type = "exp", value = {5000}},
{type = "money", value = {5000}},
{type = "points", value = {1}},
{type = "storage", value = {81500,1}}
}},
[2] = {killsRequired = 150, raceName = "Vampire", level = {1, 6656}, premium = false, creatures = {"vampire"}, rewards = {
{type = "exp", value = {34000}},
{type = "money", value = {10000}},
{type = "points", value = {1}},
}},
[3] = {killsRequired = 100, raceName = "Ghoul", level = {1, 6656}, premium = false, creatures = {"ghoul", "skeleton"}, rewards = {
{type = "exp", value = {11000}},
{type = "money", value = {7000}},
{type = "points", value = {1}},
}},
[4] = {killsRequired = 350, raceName = "Necromancer", level = {1, 6656}, premium = false, creatures = {"necromancer"}, rewards = {
{type = "exp", value = {50000}},
{type = "item", value = {2195,1}},
{type = "points", value = {1}},
{type = "storage", value = {81500,3}}
}},
[5] = {killsRequired = 400, raceName = "Dragons", level = {1, 6656}, premium = false, creatures = {"Dragon", "Dragon Lord"}, rewards = {
{type = "exp", value = {100000}},
{type = "money", value = {35000}},
{type = "points", value = {1}},
{type = "storage", value = {81500,4}}
}},
[6] = {killsRequired = 300, raceName = "Hydras", level = {1, 6656}, premium = false, creatures = {"hydra"}, rewards = {
{type = "exp", value = {350000}},
{type = "money", value = {50000}},
{type = "points", value = {1}},
{type = "storage", value = {81500,5}}
}},
[7] = {killsRequired = 400, raceName = "Serpent Spawns", level = {1, 6566}, premium = false, creatures = {"serpent spawn"}, rewards = {
{type = "exp", value = {600000}},
{type = "money", value = {80000}},
{type = "points", value = {1}},
{type = "storage", value = {81500,6}}
}},
[8] = {killsRequired = 300, raceName = "Behemoth", level = {1, 6656}, premium = false, creatures = {"behemoth"}, rewards = {
{type = "exp", value = {400000}},
{type = "money", value = {80000}},
{type = "points", value = {1}},
{type = "storage", value = {81500,7}}
}},
[9] = {killsRequired = 500, raceName = "Warlock", level = {1, 6656}, premium = false, creatures = {"warlock"}, rewards = {
{type = "exp", value = {700000}},
{type = "money", value = {100000}},
{type = "points", value = {1}},
{type = "storage", value = {81500,8}}
}},
[10] = {killsRequired = 1500, raceName = "Demon", level = {1, 6566}, premium = false, creatures = {"demon"}, rewards = {
{type = "exp", value = {10000000}},
{type = "item", value = {2357, 1}},
{type = "points", value = {1}},
{type = "storage", value = {81500,9}}
}},
[11] = {killsRequired = 500, raceName = "Mutateds", level = {1, 6656}, premium = false, creatures = {"mutated rat", "mutated bat", "mutated wolf"}, rewards = {
{type = "exp", value = {200000}},
{type = "money", value = {50000}},
{type = "points", value = {1}},
{type = "storage", value = {81500,10}}
}},
[12] = {killsRequired = 400, raceName = "Guzzlemaw", level = {1, 6566}, premium = false, creatures = {"frazzlemaw", "guzzlemaw"}, rewards = {
{type = "exp", value = {900000}},
{type = "money", value = {150000}},
{type = "points", value = {1}},
{type = "storage", value = {81500,11}}
}},
[13] = {killsRequired = 245, raceName = "Undead Gladiator", level = {1, 6656}, premium = false, creatures = {"undead gladiator"}, rewards = {
{type = "exp", value = {250000}},
{type = "money", value = {30000}},
{type = "points", value = {1}},
{type = "storage", value = {81500,12}}
}},
[14] = {killsRequired = 300, raceName = "Worker Golem", level = {1, 6566}, premium = false, creatures = {"worker golem"}, rewards = {
{type = "exp", value = {300000}},
{type = "money", value = {40000}},
{type = "points", value = {1}},
{type = "storage", value = {81500,13}}
}},
[15] = {killsRequired = 200, raceName = "Vampire Bride", level = {1, 6566}, premium = false, creatures = {"vampire bride"}, rewards = {
{type = "exp", value = {400000}},
{type = "money", value = {40000}},
{type = "points", value = {1}},
{type = "storage", value = {81500,14}}
}},
[16] = {killsRequired = 200, raceName = "Ancient Scarab", level = {1, 6665}, premium = false, creatures = {"ancient scarab"}, rewards = {
{type = "exp", value = {200000}},
{type = "money", value = {20000}},
{type = "points", value = {1}},
{type = "storage", value = {81500,15}}
}},
[17] = {killsRequired = 500, raceName = "Heroes", level = {1, 6665}, premium = false, creatures = {"hero", "black knight"}, rewards = {
{type = "exp", value = {450000}},
{type = "money", value = {50000}},
{type = "points", value = {1}},
{type = "storage", value = {81500,17}}
}},
[18] = {killsRequired = 250, raceName = "Orcs", level = {1, 6665}, premium = false, creatures = {"orc", "orc spearman", "orc leader", "orc warlord", "orc berserker", "orc shaman"}, rewards = {
{type = "exp", value = {70000}},
{type = "money", value = {10000}},
{type = "points", value = {1}},
{type = "storage", value = {81500,18}}
}},
[18] = {killsRequired = 250, raceName = "Cyclops", level = {1, 6665}, premium = false, creatures = {"cyclops"}, rewards = {
{type = "exp", value = {100000}},
{type = "money", value = {10000}},
{type = "points", value = {1}},
{type = "storage", value = {81500,19}}
}},
[19] = {killsRequired = 450, raceName = "Strong Minotaurs", level = {1, 6665}, premium = false, creatures = {"mooh tah", "exekutor", "mino hunter"}, rewards = {
{type = "exp", value = {450000}},
{type = "money", value = {50000}},
{type = "points", value = {1}},
{type = "storage", value = {81500,20}}
}},
[20] = {killsRequired = 250, raceName = "Bonebeasts", level = {1, 6665}, premium = false, creatures = {"bonebeast"}, rewards = {
{type = "exp", value = {250000}},
{type = "money", value = {20000}},
{type = "points", value = {1}},
{type = "storage", value = {81500,21}}
}},
[21] = {killsRequired = 200, raceName = "Giant Spiders", level = {1, 6665}, premium = false, creatures = {"giant spider"}, rewards = {
{type = "exp", value = {350000}},
{type = "money", value = {30000}},
{type = "points", value = {1}},
{type = "storage", value = {81500,22}}
}},
[22] = {killsRequired = 200, raceName = "Minotaurs", level = {1, 6665}, premium = false, creatures = {"minotaur", "minotaur archer", "minotaur mage", "minotaur guard"}, rewards = {
{type = "exp", value = {60000}},
{type = "money", value = {8000}},
{type = "points", value = {1}},
{type = "storage", value = {81500,23}}
}},
[23] = {killsRequired = 1500, raceName = "High Warlocks", level = {1, 6665}, premium = false, creatures = {"warlock"}, rewards = {
{type = "exp", value = {1000000}},
{type = "item", value = {2323, 1}},
{type = "points", value = {1}},
{type = "storage", value = {81500,24}}
}}
}
tasksByPlayer = 999999
repeatTimes = 999999
function getPlayerRank(cid)
return (getPlayerStorageValue(cid, POINTSSTORAGE) >= 100 and RANK_ELITEHUNTER or getPlayerStorageValue(cid, POINTSSTORAGE) >= 70 and RANK_TROPHYHUNTER or getPlayerStorageValue(cid, POINTSSTORAGE) >= 40 and RANK_BIGGAMEHUNTER or getPlayerStorageValue(cid, POINTSSTORAGE) >= 20 and RANK_RANGER or getPlayerStorageValue(cid, POINTSSTORAGE) >= 10 and RANK_HUNTSMAN or RANK_NONE)
end
function getTaskByName(name, table)
local t = (table and table or tasks)
for k, v in pairs(t) do
if v.name then
if v.name:lower() == name:lower() then
return k
end
else
if v.raceName:lower() == name:lower() then
return k
end
end
end
return false
end
function getTasksByPlayer(cid)
local canmake = {}
local able = {}
for k, v in pairs(tasks) do
if getPlayerStorageValue(cid, QUESTSTORAGE_BASE + k) < 1 and getPlayerStorageValue(cid, REPEATSTORAGE_BASE + k) < repeatTimes then
able[k] = true
if getPlayerLevel(cid) < v.level[1] or getPlayerLevel(cid) > v.level[2] then
able[k] = false
end
if v.storage and getPlayerStorageValue(cid, v.storage[1]) < v.storage[2] then
able[k] = false
end
if v.rank then
if getPlayerRank(cid) < v.rank then
able[k] = false
end
end
if v.premium then
if not isPremium(cid) then
able[k] = false
end
end
if able[k] then
table.insert(canmake, k)
end
end
end
return canmake
end
function canStartTask(cid, name, table)
local v = ""
local id = 0
local t = (table and table or tasks)
for k, i in pairs(t) do
if i.name then
if i.name:lower() == name:lower() then
v = i
id = k
break
end
else
if i.raceName:lower() == name:lower() then
v = i
id = k
break
end
end
end
if v == "" then
return false
end
if getPlayerStorageValue(cid, QUESTSTORAGE_BASE + id) > 0 then
return false
end
if (getPlayerStorageValue(cid, REPEATSTORAGE_BASE + id) >= repeatTimes) or (v.norepeatable and getPlayerStorageValue(cid, REPEATSTORAGE_BASE + id) > 0) then
return false
end
if getPlayerLevel(cid) >= v.level[1] and getPlayerLevel(cid) <= v.level[2] then
if v.premium then
if isPremium(cid) then
if v.rank then
if getPlayerRank(cid) >= v.rank then
if v.storage then
if getPlayerStorageValue(cid, v.storage[1]) >= v.storage[2] then
return true
end
else
return true
end
end
else
return true
end
end
else
return true
end
end
return false
end
function getPlayerStartedTasks(cid)
local tmp = {}
for k, v in pairs(tasks) do
if getPlayerStorageValue(cid, QUESTSTORAGE_BASE + k) > 0 and getPlayerStorageValue(cid, QUESTSTORAGE_BASE + k) < 2 then
table.insert(tmp, k)
end
end
return tmp
end