task_monsters = { 
    [1] = {name = "raging demons", mons_list = {"demon"}, storage = 400029, amount = 300, exp = 20000000, pointsTask = {1, 2}, items = {{id = 2472, count = 1},{id = 2470, count = 1}, {id = 7393, count = 1}, {id = 2160, count = 10} }, monsters = "Kill Demons around the world."},
    [2] = {name = "fire dragons", mons_list = {"dragon", "dragon lord"}, storage = 400030, amount = 450, exp = 8500000, pointsTask = {1, 2}, items = {{id = 7399, count = 1}, {id = 7402, count = 1}, {id = 2160, count = 4 }}, monsters = "Kill Dragons and Dragon lords around the world."},
    [3] = {name = "silence mountain", mons_list = {"frazzlemaw", "silencer"}, storage = 400033, amount = 300, exp = 15000000, pointsTask = {1, 2}, items = {{id = 22396, count = 1}, {id = 2160, count = 10}, {id = 18429, count = 10}, {id = 18421, count = 10}}, monsters = "Kill Frazzlemaws and Silencers."},
    [4] = {name = "fear valley", mons_list = {"retching Horror", "choking Fear"}, storage = 400034, amount = 500, exp = 25000000, pointsTask = {2, 3}, items = {{id = 22396, count = 2}, {id = 21308, count = 1}, {id = 10073, count = 1}, {id = 10075, count = 1}, {id = 10096, count = 1}}, monsters = "Kill Retching Horrors and Choking Fear."},
    [5] = {name = "poison combo", mons_list = {"hydra", "serpent spawn"}, storage = 400035, amount = 500, exp = 15000000, pointsTask = {1, 2}, items = {{id = 24807, count = 3}, {id = 33983, count = 3}, {id = 13582, count = 1}, {id = 13569, count = 1}, {id = 13165, count = 1}, {id = 13166, count = 1}}, monsters = "Kill Hydras and Serpent Spawn."},
    [6] = {name = "cobras", mons_list = {"cobra assassin", "cobra scout", "cobra vizier"}, storage = 400038, amount = 500, exp = 35000000, pointsTask = {2, 3}, items = {{id = 42081, count = 1}}, monsters = "Kill Cobras on Cobra Bastion."},
    [7] = {name = "falcons", mons_list = {"falcon knight", "falcon paladin"}, storage = 400039, amount = 500, exp = 35000000, pointsTask = {2, 3}, items = {{id = 25312, count = 1}}, monsters = "Kill Falcons on Falcon Bastion."},
    [8] = {name = "reapers", mons_list = {"grim reaper"}, storage = 400040, amount = 300, exp = 16500000, pointsTask = {1, 2}, items = {{id = 41995, count = 60}, {id = 41944, count = 5}}, monsters = "Kill Grim Reapers."},
    [9] = {name = "catacombs", mons_list = {"demon", "dark torturer", "juggernaut", "hellhound", "destroyer", "hellspawn"}, storage = 400041, amount = 750, exp = 50000000, pointsTask = {2, 4}, items = {{id = 12671, count = 1}, {id = 13560, count = 3}}, monsters = "Kill Demons, Hellhounds, Juggernaut, Destroyers, Hellspawn and Dark Torturers."},
    [10] = {name = "wyrms", mons_list = {"wyrm", "elder wyrm"}, storage = 400042, amount = 400, exp = 9500000, pointsTask = {1, 2}, items = {{id = 2160, count = 5},{id = 4867, count = 5}, {id = 4855, count = 5}, {id = 14336, count = 3}}, monsters = "Kill Demons, Hellhounds, Juggernaut, Destroyers, Hellspawn and Dark Torturers."},
    [11] = {name = "slugs task", mons_list = {"fallen shaman [1]", "tyrant slug [1]", "small slug [1]"},  storage = 400000, amount = 300, exp = 6500000, pointsTask = {0, 1}, items = {{id = 42027, count = 1}, {id = 7705, count = 10}, {id = 5089, count =  10}, {id = 7736, count = 10}, {id = 7844, count = 10}}, monsters = "Fallen Shaman [1], Tyrant Slug [1] and Small Slug [1]"},
    [12] = {name = "plants task", mons_list = {"atlantis manta [1]", "carnivor plant [1]", "deathrattle [1]"}, storage = 400001, amount = 300, exp = 6500000, pointsTask = {0, 1}, items = {{id = 42027, count = 1}, {id = 4854, count = 10}, {id = 7846, count = 10}, {id = 4851, count = 10}, {id = 4853, count = 10}}, monsters = "Atlantis Manta [1], Carnivor Plant [1] and Deathrattle [1]"},
    [13] = {name = "trolls task", mons_list = {"demon hunter [1]", "giant troll [1]"}, storage = 400002, amount = 300, exp = 8825000, pointsTask = {0, 1}, items = {{id = 42027, count = 1}, {id = 4872, count = 10}, {id = 4858, count = 10}, {id = 42051, count = 5}}, monsters = "Demon Hunter [1] and Giant Troll [1]"},
    [14] = {name = "fallens task", mons_list = {"eastern shaman [1]", "fallen rhino [1]"}, storage = 400003, amount = 300, exp = 8825000, pointsTask = {0, 1}, items = {{id = 42027, count = 1}, {id = 6105, count = 10},  {id = 6556, count = 10}, {id = 7245, count = 10}, {id = 7243, count = 10}}, monsters = "Eastern Shaman [1] and Fallen Rhino [1]"},
    [15] = {name = "sacreds task", mons_list = {"sacred hydra [2]", "sacred three [2]", "tyrant three [2]"}, storage = 400004, amount = 300, exp = 11775000, pointsTask = {0, 1}, items = {{id = 42027, count = 1}, {id = 8707, count = 10},  {id = 8701, count = 10}, {id = 10100, count = 10}, {id = 2630, count = 10}}, monsters = "Sacred Hydra [2], Sacred Three [2], Tyrant Three [2]"},
    [16] = {name = "on fire task", mons_list = {"demon hunter [2]", "evil hydra [2]", "inferno hydra [2]"}, storage = 400005, amount = 300, exp = 14275000, pointsTask = {0, 1}, items = {{id = 42027, count = 2}, {id = 13130, count = 75}, {id = 12803, count = 50}, {id = 36039, count = 15}}, monsters = "Demon Hunter [2], Evil Hydra [2] and Inferno Hydra [2]"},
    [17] = {name = "warcaller task", mons_list = {"slime of terror [2]", "warcaller [2]"}, storage = 400006, amount = 300, exp = 17775000, pointsTask = {0, 1}, items = {{id = 42027, count = 2}, {id = 12804, count = 35}, {id = 12805, count = 20}, {id = 36041, count = 10}}, monsters = "Slime of Terror [2] and Warcaller [2]"},
    [18] = {name = "enraged task", mons_list = {"enraged rat [2]", "shamed tree [2]", "venom tyrant [2]"}, storage = 400007, amount = 300, exp = 17775000, pointsTask = {0, 1}, items = {{id = 42027, count = 2}, {id = 36038, count = 20}, {id = 36040, count = 10}}, monsters = "Enraged Rat [2], Shamed Tree [2], Venom Tyrant [2]"},
    [19] = {name = "kings task", mons_list = {"damned soul [**]", "king skeleton [**]", "oculus rift [**]"}, storage = 400008, amount = 500, exp = 100000000, pointsTask = {1, 2}, items = {{id = 42027, count = 2}, {id = 39178, count = 10}, {id = 39179, count = 10}, {id = 13560, count = 3},  {id = 7861, count = 20}, {id = 7869, count = 20}}, monsters = "Damned Soul [**], King Skeleton [**] and Oculus Rift [**]"},
    [20] = {name = "dismembered task", mons_list = {"disemboweled [**]", "shaper of flesh [**]", "unspeakable terror [**]"}, storage = 400009, amount = 500, exp = 100000000, pointsTask = {1, 2}, items = {{id = 42027, count = 2}, {id = 21308, count = 1}, {id = 42054, count = 2}, {id = 13560, count = 3}, {id = 7877, count = 20}, {id = 7745, count = 20}}, monsters = "Disemboweled [**], Shaper of Flesh [**] and Unspeakable Terror [**]"},
    [21] = {name = "malfeasance task", mons_list = {"lurkbringer [**]", "malfeasance [**]", "mangler [**]"}, storage = 400010, amount = 500, exp = 100000000, pointsTask = {1, 2}, items = {{id = 42027, count = 2}, {id = 42103, count = 10}, {id = 42104, count = 5}, {id = 42105, count = 1}, {id = 13560, count = 3}, {id = 7753, count = 20}, {id = 7869, count = 20}}, monsters = "Lurkbringer [**], Malfeasance [**] and Mangler [**]"},
    [22] = {name = "wormboiler task", mons_list = {"dark elder [***]", "wormboiler [***]"}, storage = 400011, amount = 600, exp = 270000000, pointsTask = {2, 4}, items = {{id = 42027, count = 2}, {id = 41670, count = 5}, {id = 33973, count = 5}, {id = 36936, count = 1}}, monsters = "Dark Elder [***] and Wormboiler [***]"},
    [23] = {name = "evils task", mons_list = {"evil beholder [***]", "evil demon [***]"}, storage = 400012, amount = 600, exp = 270000000, pointsTask = {2, 4}, items = {{id = 42027, count = 2}, {id = 37419, count = 3}, {id = 33975, count = 3}, {id = 36936, count = 1}}, monsters = "Evil Beholder [***] and Evil Demon [***]"},
    [24] = {name = "gores task", mons_list = {"goreshot [***]", "zarhym [***]"}, storage = 400013, amount = 600, exp = 270000000, pointsTask = {2, 4}, items = {{id = 42027, count = 2}, {id = 34822, count = 1}, {id = 32446, count = 10}, {id = 42075, count = 20}, {id = 36936, count = 1}}, monsters = "Goreshot [***] and Zarhym [***]"},
    [25] = {name = "scourge task", mons_list = {"scourge of azazel [***]", "tyrant spider [***]"}, storage = 400014, amount = 600, exp = 270000000, pointsTask = {2, 4}, items = {{id = 42027, count = 2}, {id = 42074, count = 5}, {id = 42106, count = 5}, {id = 32757, count = 5}, {id = 36936, count = 1}}, monsters = "Scourge of Azazel [***] and Tyrant Spider [***]"},
    [26] = {name = "elder dragons task", mons_list = {"elder dragon lord [***]", "elder dragon [***]"}, storage = 400015, amount = 600, exp = 270000000, pointsTask = {2, 4}, items = {{id = 42027, count = 2}, {id = 41945, count = 1}, {id = 36936, count = 1}}, monsters = "Elder Dragon Lord [***] and Elder Dragon [***]"},
    [27] = {name = "soul task", mons_list = {"rust crawler [***]", "soul skull [***]"}, storage = 400016, amount = 600, exp = 270000000, pointsTask = {2, 4}, items = {{id = 42027, count = 2}, {id = 33983, count = 10}, {id = 24807, count = 5}, {id = 21309, count = 2}, {id = 36936, count = 1}}, monsters = "Rust Crawler [***], Soul Skull [***]"},
    [28] = {name = "black task", mons_list = {"black dragon [***]", "stone juggernaut [***]"}, storage = 400017, amount = 600, exp = 270000000, pointsTask = {2, 4}, items = {{id = 42027, count = 2}, {id = 25312, count = 2}, {id = 25316, count = 1}, {id = 36936, count = 1}}, monsters = "Black Dragon [***] and Stone Juggernaut [***]"},
    [29] = {name = "normal arkeron", mons_list = {"arcangel [****]", "cephalopod [****]", "divine angel [****]", "lokness [****]", "otzi [****]", "raven spider [****]", "solar guardian [****]"}, storage = 400018, amount = 1000, exp = 650000000, pointsTask = {5, 8}, items = {{id = 42027, count = 5}, {id = 24275, count = 5}, {id = 13565, count = 5}, {id = 36989, count = 3}, {id = 18559, count = 5}}, monsters = "All normal monsters on Arkeron \n  ( not Mutateds, not Amalgam, not Anomaly) with 4 Stars."},
    [30] = {name = "mutated arkeron", mons_list = {"mutated angry draptor [****]", "mutated draptor [****]", "mutated ghost [****]", "mutated lurkbringer lancer [****]", "mutated lurkbringer necromancer [****]", "mutated lurkbringer warrior [****]", "mutated lurkbringer [****]", "mutated scourge draptor [****]", "mutated stone golem [****]", "mutated wailing widow [****]"}, storage = 400019, amount = 1000, exp = 800000000, pointsTask = {5, 8}, items = {{id = 25315, count = 1}, {id = 24275, count = 5}, {id = 13565, count = 5}, {id = 25939, count = 3}, {id = 25936, count = 5}, {id = 18559, count = 5}}, monsters = "All mutateds monsters from Arkeron with 4 Stars."},
    [31] = {name = "amalgam arkeron", mons_list = {"behemoth amalgam [****]", "demon amalgam [****]", "despair tree amalgam [****]", "dragon amalgam [****]", "emeraude dragon amalgam [****]", "ghost hell amalgam [****]", "grim reaper amalgam [****]", "hellfire fighter amalgam [****]", "hydra amalgam [****]", "obsidian dragon amalgam [****]", "sapphir dragon amalgam [****]", "stone golem amalgam [****]", "tyrant tree amalgam [****]", "vampire viscount amalgam [****]", "winter wolf amalgam [****]", "yeti amalgam [****]"}, storage = 400020, amount = 1000, exp = 950000000, pointsTask = {5, 8}, items = {{id = 42027, count = 5}, {id = 24275, count = 5}, {id = 13565, count = 5}, {id = 37006, count = 10}, {id = 37007, count = 6}, {id = 18559, count = 5}}, monsters = "All Amalgam monsters from Arkeron with 4 Stars."},
    [32] = {name = "anomaly arkeron", mons_list = {"amazon anomaly [****]", "chester anomaly [****]", "demon anomaly [****]", "dragon anomaly [****]", "ghost anomaly [****]", "ghoul anomaly [****]", "hydra anomaly [****]", "mage anomaly [****]", "ulyss anomaly [****]", "undead berserker anomaly [****]", "undead elite guardian anomaly [****]", "undead elite mage anomaly [****]", "undead guardian anomaly [****]", "valkyrie anomaly [****]"}, storage = 400021, amount = 1000, exp = 1125000000, pointsTask = {5, 8}, items = {{id = 42027, count = 5}, {id = 24275, count = 5}, {id = 13565, count = 5}, {id = 25976, count = 10}, {id = 25979, count = 6}, {id = 25948, count = 10}, {id = 25951, count = 5}, {id = 18559, count = 5}}, monsters = "All Anomaly monsters from Arkeron with 4 Stars."},  
}
 
 task_daily = {
    [1] = {name = "plagirath", mons_list = {"plagirath"}, storage = 400031, amount = 1, exp = 12500000, pointsTask = {1, 2}, items = {{id = 42027, count = 2}, {id = 10131, count = 5}, {id = 12790, count = 1}, {id = 12793, count = 1}, {id = 12796, count = 1}}, monsters = "Kill Plagirath."},
    [2] = {name = "ushuriel", mons_list = {"ushuriel"}, storage = 400032, amount = 1, exp = 9000000, pointsTask = {1, 2}, items = {{id = 42027, count = 2}, {id = 10129, count = 5}, {id = 12787, count = 1}, {id = 12793, count = 1}, {id = 12976, count = 1}}, monsters = "Kill Ushuriel."},
    [3] = {name = "tentuglys", mons_list = {"tentuglys boss"}, storage = 400036, amount = 1, exp = 12500000, pointsTask = {1, 2}, items = {{id = 42027, count = 2}, {id = 42053, count = 2}, {id = 13560, count = 3}, {id = 2629, count = 1}}, monsters = "Kill Tentuglys."},
    [4] = {name = "the king", mons_list = {"king zelos"}, storage = 400037, amount = 1, exp = 17500000, pointsTask = {1, 2}, items = {{id = 42027, count = 2}, {id = 37419, count = 1}, {id = 33973, count = 1}, {id = 33975, count = 1}}, monsters = "Kill King Zelos."},
    [5] = {name = "megalomania", mons_list = {"goshnar megalomania"}, storage = 400043, amount = 1, exp = 25500000, pointsTask = {1, 2}, items = {{id = 42027, count = 3}, {id = 34822, count = 1}, {id = 39178, count = 5}, {id = 39179, count = 5}}, monsters = "Kill Goshnar Megalomania."},  
    [6] = {name = "bahamut", mons_list = {"bahamut [*****]"}, storage = 400022, amount = 1, exp = 500000000, pointsTask = {3, 5}, items = {{id = 42027, count = 10}, {id = 25932, count = 1}, {id = 27605, count = 1}, {id = 11400, count = 10}, {id = 24275, count = 5}, {id = 13565, count = 5}}, monsters = "Kill Bahamut [*****] Boss on Arkeron."},
    [7] = {name = "dracafeu", mons_list = {"dracafeu [*****]"}, storage = 400023, amount = 1, exp = 500000000, pointsTask = {3, 5}, items = {{id = 42027, count = 10}, {id = 25932, count = 1}, {id = 27605, count = 1}, {id = 11400, count = 10}, {id = 24275, count = 5}, {id = 13565, count = 5}}, monsters = "Kill Dracafeu [*****] Boss on Arkeron."},
    [8] = {name = "ghazrilla", mons_list = {"gahz'rilla [*****]"}, storage = 400024, amount = 1, exp = 500000000, pointsTask = {3, 5}, items = {{id = 42027, count = 10}, {id = 25932, count = 1}, {id = 27605, count = 1}, {id = 11400, count = 10}, {id = 24275, count = 5}, {id = 13565, count = 5}}, monsters = "Kill Ghaz'rilla [*****] Boss on Arkeron."},
    [9] = {name = "lost terror", mons_list = {"lost terror [*****]"}, storage = 400025, amount = 1, exp = 1000000000, pointsTask = {5, 10}, items = {{id = 42027, count = 10}, {id = 25932, count = 1}, {id = 27605, count = 1}, {id = 11400, count = 10}, {id = 24275, count = 10}, {id = 13565, count = 10}}, monsters = "Kill Lost Terror [*****] Boss on Arkeron."},
    [10] = {name = "onyxia", mons_list = {"onyxia [*****]"}, storage = 400026, amount = 1, exp = 500000000, pointsTask = {3, 5}, items = {{id = 42027, count = 10}, {id = 25932, count = 1}, {id = 27605, count = 1}, {id = 11400, count = 10}, {id = 24275, count = 5}, {id = 13565, count = 5}}, monsters = "Kill Onyxia [*****] Boss on Arkeron."},
    [11] = {name = "the monster", mons_list = {"the monster [*****]"}, storage = 400027, amount = 1, exp = 500000000, pointsTask = {3, 5}, items = {{id = 42027, count = 10}, {id = 25932, count = 1}, {id = 27605, count = 1}, {id = 11400, count = 10}, {id = 24275, count = 5}, {id = 13565, count = 5}}, monsters = "Kill The Monster [*****] Boss on Arkeron."},
    [12] = {name = "ultros", mons_list = {"ultros [*****]"}, storage = 400028, amount = 1, exp = 500000000, pointsTask = {3, 5}, items = {{id = 42027, count = 10}, {id = 25932, count = 1}, {id = 27605, count = 1}, {id = 11400, count = 10}, {id = 24275, count = 5}, {id = 13565, count = 5}}, monsters = "Kill Ultros [*****] Boss on Arkeron."}
}
 
 task_storage = 480000 
 task_points = 480001 
 task_sto_time = 480002 
 task_time = 1 
 task_rank = 480003 
 taskd_storage = 480004 
 time_daySto = 480005 
 awakening_points = 480006
 chaos_points = 480007
 
 
 local ranks_task = {
 [{1, 25}] = "Rookie",  
 [{26, 100}] = "Bronze", 
 [{101, 250}] = "Silver", 
 [{251, 470}] = "Gold", 
 [{471, 770}] = "Platinum", 
 [{771, 1220}] = "Diamond", 
 [{1221, 1820}] = "Ancestral", 
 [{1821, 2820}] = "Mystic", 
 [{2821, 4320}] = "Abyssal",
 [{4321, 6320}] = "Ascending",
 [{6321, 9999}] = "Chaos",
 [{10000, math.huge}] = "Awakening" 
 }
 
 local RankSequence = {
 ["Rookie"] = 1,
 ["Bronze"] = 2,
 ["Silver"] = 3,
 ["Gold"] = 4,
 ["Platinum"] = 5,
 ["Diamond"] = 6,
 ["Ancestral"] = 7,
 ["Mystic"] = 8,
 ["Abyssal"] = 9,
 ["Ascending"] = 10,
 ["Chaos"] = 11,
 ["Awakening"] = 11
 }
 
 function rankIsEqualOrHigher(myRank, RankCheck)
     local ret_1 = RankSequence[myRank]
     local ret_2 = RankSequence[RankCheck]
     return ret_1 >= ret_2
 end
 
 function getTaskInfos(player)
     local player = Player(player)
     return task_monsters[player:getStorageValue(task_storage)] or false
 end
 
 function getTaskDailyInfo(player)
     local player = Player(player)
     return task_daily[player:getStorageValue(taskd_storage)] or false
 end
 
 
 function taskPoints_get(player)
     local player = Player(player)
     if player:getStorageValue(task_points) == -1 then
         return 0 
     end
     return player:getStorageValue(task_points)
 end

 function awakeningPoints_get(player)
    local player = Player(player)
    if player:getStorageValue(awakening_points) == -1 then
        return 0 
    end
    return player:getStorageValue(awakening_points)
end
function awakeningPoints_add(player, count)
    local player = Player(player)
    return player:setStorageValue(awakening_points, awakeningPoints_get(player) + count)
end

function awakeningPoints_remove(player, count)
    local player = Player(player)
    return player:setStorageValue(awakening_points, awakeningPoints_get(player) - count)
end

function chaosPoints_get(player)
    local player = Player(player)
    if player:getStorageValue(chaos_points) == -1 then
        return 0 
    end
    return player:getStorageValue(chaos_points)
end
function chaosPoints_add(player, count)
    local player = Player(player)
    return player:setStorageValue(chaos_points, chaosPoints_get(player) + count)
end

function chaosPoints_remove(player, count)
    local player = Player(player)
    return player:setStorageValue(chaos_points, chaosPoints_get(player) - count)
end


 function taskPoints_add(player, count)
     local player = Player(player)
     return player:setStorageValue(task_points, taskPoints_get(player) + count)
 end
 
 function taskPoints_remove(player, count)
     local player = Player(player)
     return player:setStorageValue(task_points, taskPoints_get(player) - count)
 end
 
 function taskRank_get(player)
     local player = Player(player)
     if player:getStorageValue(task_rank) == -1 then
         return 1 
     end
     return player:getStorageValue(task_rank)
 end
 
 function taskRank_add(player, count)
     local player = Player(player)
     return player:setStorageValue(task_rank, taskRank_get(player) + count)
 end
 
 function getRankTask(player)
     local pontos = taskRank_get(player)
     local ret
     for _, z in pairs(ranks_task) do
         if pontos >= _[1] and pontos <= _[2] then
             ret = z
         end
     end
     return ret
 end
 
 function getItemsFromTable(itemtable)
      local text = ""
      for v = 1, #itemtable do
          count, info = itemtable[v].count, ItemType(itemtable[v].id)
          local ret = "\n   - "
          if v == 1 then
              ret = ""
          elseif v == #itemtable then
              ret = "\n   - "
          end
          text = text .. ret
          text = text .. (count > 1 and count or info:getArticle()).." "..(count > 1 and info:getPluralName() or info:getName())
      end
      return text
 end