local raids = { regular = { [1] = { id = 9, name = 'Rats', chance = 95, monsters = { [1] = {name = 'Rat', count = 32}, [2] = {name = 'Cave Rat', count = 12}, [3] = {name = 'Munster', count = 1} }, extended = true, position = {x = 32347, y = 32214, z = 7}, messages = {'Rat Plague in Thais!'} }, [2] = { id = 10, name = 'Pirates', chance = 75, monsters = { [1] = {name = 'Pirate Buccaneer', count = 16}, [2] = {name = 'Pirate Corsair', count = 16}, [3] = {name = 'Pirate Cutthroat', count = 16}, [4] = {name = 'Pirate Marauder', count = 16}, [5] = {name = 'Pirate Ghost', count = 16} }, randommonsters = {'Brutus Bloodbeard', 'Deadeye Devious', 'Lethal Lissy', 'Ron the Ripper'}, extended = true, position = {x = 32295, y = 32861, z = 7}, messages = {'Unknown ships are sighted south of Liberty Bay.', 'The ships that approach Liberty Bay from the south have raised the pirate flag! Hide or grab your weapons to fight.', 'Pirates are launching an attack on Liberty Bay! Hide or fight.'} }, [3] = { i = 11, name = 'Minotaurs', chance = 75, monsters = { [1] = {name = 'Minotaur', count = 16}, [2] = {name = 'Minotaur Archer', count = 36}, [3] = {name = 'Minotaur Guard', count = 16}, [4] = {name = 'Minotaur Mage', count = 36} }, randommonsters = {'General Murius', 'The Horned Fox'}, extended = true, position = {x = 32368, y = 32168, z = 7}, messages = {'Minotaur activity near Thais reported! Beware!', 'Thais\' north gates are under attack!'} }, [4] = { id = 12, name = 'Orcs', chance = 75, monsters = { [1] = {name = 'Orc', count = 16}, [2] = {name = 'Orc Spearman', count = 16}, [3] = {name = 'Orc Warrior', count = 36}, [4] = {name = 'Orc Shaman', count = 36}, [5] = {name = 'Orc Berserker', count = 36}, [6] = {name = 'Orc Leader', count = 16}, [7] = {name = 'Orc Warlord', count = 16} }, extended = true, position = {x = 32368, y = 32168, z = 7}, messages = {'Orc activity near Thais reported! Beware!', 'Thais\' north gates are under attack!'} }, [5] = { id = 13, name = 'Nomads', chance = 100, monsters = { [1] = {name = 'Nomad', count = 128} }, extended = true, position = {x = 33193, y = 32493, z = 7}, messages = {'Nomad are grouping arround darashia.', 'Darashia is occupated by Nomads!'} }, [6] = { id = 14, name = 'Scarabs', chance = 90, monsters = { [1] = {name = 'Ancient Scarab', count = 15}, [2] = {name = 'Scarab', count = 45}, [3] = {name = 'Larva', count = 60} }, extended = true, position = {x = 33152, y = 32734, z = 7}, messages = {'Unusual frequent scarab sightings at the gates of Ankrahmun.', 'Ancient scarabs are leading an attack on Ankrahmun.'} }, [7] = { id = 15, name = 'Elfs', chance = 85, monsters = { [1] = {name = 'Dharalion', count = 2}, [2] = {name = 'Elf', count = 48}, [3] = {name = 'Elf Scout', count = 48}, [4] = {name = 'Elf Arcanist', count = 48} }, extended = true, position = {x = 32639, y = 31728, z = 7}, messages = {'Trees behave weird near Ab\'dendriel.', 'Elf activity near Ab\'dendriel reported! Beware!', 'Ab\'dendriel is under attack!'} }, [8] = { id = 16, name = 'Undeads', chance = 65, monsters = { [1] = {name = 'Ghoul', count = 32}, [2] = {name = 'Demon Skeleton', count = 32}, [3] = {name = 'Banshee', count = 6}, [4] = {name = 'Necromancer', count = 6}, [5] = {name = 'Priestess', count = 6} }, extended = true, position = {x = 32801, y = 32285, z = 7}, messages = {'The dead of the plains of havoc are becoming restless!', 'A veritable army of undead is amassing in the plains of havoc, beware!', 'The dreaded banshees lead their undead minions to claim the plains of havoc!'} }, [9] = { id = 17, name = 'Monks', chance = 90, monsters = { [1] = {name = 'Fernfang', count = 1}, [2] = {name = 'Monk', count = 32} }, extended = true, position = {x = 32386, y = 31184, z = 7}, messages = {'There has been a rebellion in the Monks Order near Svargrond grounds.', 'The monks are preparing an attack...', 'The Monks are attacking Svargrond, defend it before it is too late.'} }, }, boss = { [1] = { id = 1, name = 'Orshabaal', chance = 50, monsters = { [1] = {name = 'Orshabaal', count = 1}, [2] = {name = 'Demon', count = 4} }, extended = false, position = {x = 33118, y = 31700, z = 7}, messages = {'Orshabaal\'s minions are working on his return to the World. LEAVE Edron at once, mortals.', 'Orshabaal is about to make his way into the mortal realm. Run for your lives!', 'Orshabaal has been summoned from hell to plague the lands of mortals again.'}, }, [2] = { id = 2, name = 'Morgaroth', chance = 50, monsters = { [1] = {name = 'Morgaroth', count = 1}, [2] = {name = 'Demon', count = 2} }, extended = false, position = {x = 31895, y = 32619, z = 14}, messages = {'The ancient volcano on Goroma slowly becomes active once again.', 'There is an evil presence at the volcano of Goroma.', 'Evil Cultists have called an ancient evil into the volcano on Goroma. Beware of its power mortals.'}, }, [3] = { id = 3, name = 'Ghazbaran', chance = 50, monsters = { [1] = {name = 'Ghazbaran', count = 1}, [2] = {name = 'Deathslicer', count = 2} }, extended = false, position = {x = 32312, y = 31212, z = 15}, messages = {'An ancient evil is awakening in the mines beneath Hrodmir.', 'Demonic entities are entering the mortal realm in the Hrodmir mines.', 'The demonic master has revealed itself in the mines of Hrodmir.'}, }, [4] = { id = 4, name = 'Ferumbras', chance = 40, monsters = { [1] = {name = 'Ferumbras', count = 1}, [2] = {name = 'Demon', count = 3} }, extended = false, position = {x = 31954, y = 32694, z = 4}, messages = {'The seals on Ferumbras old cidatel are glowing. Prepare for HIS return mortals.', 'Ferumbras return is at hand. The Edron Academy calls for Heroes to fight that evil.', 'Ferumbras has returned to his citadel once more. Stop him before its too late.'} }, [5] = { id = 5, name = 'Tiquandas Revenge', chance = 55, monsters = { [1] = {name = 'Tiquandas Revenge', count = 1}, [2] = {name = 'Hydra', count = 5} }, extended = false, position = {x = 32701, y = 32680, z = 7}, messages = {'Tiquanda\'s bushes are moving.', 'Creatures have come out of Tiquanda\'s bushes.', 'Tiquanda\'s Revenge has been sighted in Port Hope.', 'Port Hope is under attack!'}, }, [6] = { id = 6, name = 'Demodras', chance = 55, monsters = { [1] = {name = 'Demodras', count = 1}, [2] = {name = 'Dragon Lord', count = 2} }, extended = false, position = {x = 32776, y = 32287, z = 10}, messages = {'The Lord of the Dragons has been sighted at the Plains of Havoc.', 'The Lord of the Dragons is waiting in his cave, brave heroes - kill him!'}, }, [7] = { id = 7, name = 'The Old Widow', chance = 75, monsters = { [1] = {name = 'The Old Widow', count = 1}, [2] = {name = 'Giant Spider', count = 4} }, extended = false, position = {x = 32760, y = 32296, z = 7}, messages = {'High activity of Giant Spiders has been noticed on Plains of Havoc.', 'The Old Widow has spawned.'}, }, [8] = { id = 8, name = 'Necropharus', chance = 45, monsters = { [1] = {name = 'Necropharus', count = 1}, [2] = {name = 'Necromancer', count = 4} }, extended = false, position = {x = 33043, y = 32400, z = 10}, messages = {'The king of the necromantic cult has been risen from death.'}, } } } local function StartRaid(t) local pos, n = t.extended and getArea(t.position, 20, 20) or t.position, 0 if t.monsters then for _, data in ipairs(t.monsters) do n = n + data.count for i = 1, data.count do doCreateMonster(data.name, t.extended and pos[math.random(#pos)] or pos, true, false, false) end end end if t.randmonsters then doCreateMonster(t.randommonsters[math.random(#t.randommonsters)], t.extended and pos[math.random(#pos)] or pos) end if #t.messages > 0 then doBroadcastMessage(t.messages[#t.messages], MESSAGE_EVENT_ADVANCE) end if t.id then db.query('UPDATE `raids` SET `executes` = `executes` + 1, `time` = '.. os.time() ..' WHERE `id` = '.. t.id ..';') end print('>> Raid \''.. t.name ..'\' has been executed, spawned '.. n ..' monsters.') end function onThink(interval) if #getPlayersOnline() < 15 then print('>> Unable to execute raid system, system requires at least 15 players online.') return true end local raid, t = {}, math.random(1, 3) == 1 and raids.boss or raids.regular raid = t[math.random(#t)] if raid then if raid.chance and math.random(1, 100) > raid.chance then return true end for i, message in ipairs(raid.messages) do if i ~= #raid.messages then addEvent(doBroadcastMessage, i * 60 * 1000, message, MESSAGE_EVENT_ADVANCE) else addEvent(StartRaid, i * 60 * 1000, raid) end end end return true end