Пример #1
0
        public void AppendFight(Character character, int mapId, MonsterRecord[] templates)
        {
            if (Exist(mapId, character))
            {
                throw new Exception(string.Format("Instance on mapId: {0} already exist!", mapId));
            }
            else
            {
                character.Teleport(mapId);

                MapRecord map = MapRecord.GetMap(mapId);

                var newFight = FightProvider.Instance.CreateFreeFightInstancePvM(templates, map);

                FightTeam characterTeam = newFight.GetTeam(TeamTypeEnum.TEAM_TYPE_PLAYER);
                FightTeam monsterTeam   = newFight.GetTeam(TeamTypeEnum.TEAM_TYPE_MONSTER);

                characterTeam.AddFighter(character.CreateFighter(characterTeam));

                foreach (var monster in newFight.Group.CreateFighters(monsterTeam))
                {
                    monsterTeam.AddFighter(monster);
                }

                newFight.FightStartEvt   += newFight_FightStartEvt;
                newFight.OnFightEndedEvt += newFight_OnFightEndedEvt;
                newFight.StartPlacement();

                m_fights.Add(mapId, newFight);
            }
        }
        public static void SpawnMonsters(DelayedAction action)
        {
            ushort[] monsterIds = Array.ConvertAll(action.Record.Value1.Split(','), x => ushort.Parse(x));

            MonsterRecord[] templates = new MonsterRecord[monsterIds.Length];

            for (int i = 0; i < monsterIds.Length; i++)
            {
                templates[i] = MonsterRecord.GetMonster(monsterIds[i]);
            }

            MapRecord targetedMap;

            if (action.Record.Value2 != string.Empty)
            {
                targetedMap = MapRecord.GetMap(int.Parse(action.Record.Value2));
            }
            else
            {
                targetedMap = MapRecord.RandomOutdoorMap();
            }

            if (!MonsterSpawnManager.Instance.GroupExist(targetedMap.Instance, templates))
            {
                MonsterSpawnManager.Instance.AddFixedMonsterGroup(targetedMap.Instance, templates, false);
            }
        }
Пример #3
0
        public static void HandleTeleportRequestMessage(TeleportRequestMessage message, WorldClient client)
        {
            if ((TeleporterTypeEnum)message.teleporterType == TeleporterTypeEnum.TELEPORTER_ZAAP)
            {
                InteractiveRecord destinationZaap = MapRecord.GetMap(message.mapId).Zaap;
                if (client.Character.Map != null)
                {
                    InteractiveRecord currentZaap = client.Character.Map.Zaap;
                    if (destinationZaap.OptionalValue1 != currentZaap.OptionalValue1)
                    {
                        return;
                    }
                }
                else
                {
                    return;
                }
            }
            client.Character.Teleport(message.mapId, (short)InteractiveRecord.GetTeleporterCellId(message.mapId, (TeleporterTypeEnum)message.teleporterType));
            switch ((TeleporterTypeEnum)message.teleporterType)
            {
            case TeleporterTypeEnum.TELEPORTER_ZAAP:
                client.Character.RemoveKamas(InteractiveActionProvider.ZaapCost, true);
                break;

            case TeleporterTypeEnum.TELEPORTER_SUBWAY:
                client.Character.RemoveKamas(InteractiveActionProvider.ZaapiCost, true);
                break;

            case TeleporterTypeEnum.TELEPORTER_PRISM:
                break;
            }
            client.Character.LeaveDialog();
            client.Character.Reply("Vous avez été téleporté");
        }
Пример #4
0
 public Npc(NpcSpawnRecord spawnRecord)
 {
     this.SpawnRecord   = spawnRecord;
     this.ActionsRecord = NpcActionRecord.GetActions(SpawnRecord.Id);
     this.Map           = MapRecord.GetMap(spawnRecord.MapId);
     this.m_Id          = this.Map.Instance.PopNextNPEntityId();
 }
Пример #5
0
 public Map(Game game)
 {
     Record = MapRecord.GetMap((int)Id);
     Script = CreateScript(game);
     Game   = game;
     Units  = new List <Unit>();
 }
Пример #6
0
        public static ushort GetTeleporterCellId(int mapid, TeleporterTypeEnum tptype)
        {
            var    map        = MapRecord.GetMap(mapid);
            string actionType = string.Empty;

            switch (tptype)
            {
            case TeleporterTypeEnum.TELEPORTER_ZAAP:
                actionType = "Zaap";
                break;

            case TeleporterTypeEnum.TELEPORTER_SUBWAY:
                actionType = "Zaapi";
                break;

            case TeleporterTypeEnum.TELEPORTER_PRISM:
                actionType = "Prism";
                break;

            default:
                break;
            }
            var interactive = GetInteractivesByActionType(actionType).Find(x => x.MapId == mapid);

            if (interactive != null)
            {
                var mapElements = MapElementRecord.GetMapElementByMap(interactive.MapId);
                var ele         = mapElements.Find(x => x.ElementId == interactive.ElementId);
                return((ushort)map.CloseCell((short)ele.CellId));
            }
            return((ushort)map.RandomWalkableCell());
        }
Пример #7
0
        public static void EndFightCommand(string value, WorldClient client)
        {
            var map = int.Parse(value);

            var record   = MapRecord.GetMap(map);
            var endFight = new EndFightActionRecord(EndFightActionRecord.EndFightActions.DynamicPop(x => x.Id), client.Character.Map.Id, map, record.RandomWalkableCell());

            endFight.AddElement();

            client.Character.Reply("EndFightAction has been added");
        }
Пример #8
0
        public static void Build(WorldClient client, string[] args)
        {
            if (Mine == null)
            {
                client.Character.ReplyError("Unable to create mine, none has been initialized.");
                return;
            }

            if (!Mine.Maps.Any())
            {
                client.Character.ReplyError("You have not registered any map. See cmds <i>.mine addmap</i> and <i>.mine ps</i>.");
                return;
            }

            int        idx         = 0;
            List <int> oreSequence = BuildRandomInteractivesSequence();

            if (!oreSequence.Any())
            {
                client.Character.ReplyError("You have not registered any ore. See cmd <i>.mine addore</i>.");
                return;
            }

            int nextSkillUid = InteractiveSkillRecord.InteractiveSkills.DynamicPop(x => x.UID);

            foreach (MineMap mineMap in Mine.Maps)
            {
                foreach (int elementId in mineMap.ElementIds)
                {
                    int elementType = oreSequence[idx];

                    // InteractiveElements
                    InteractiveElementRecord interactiveElementRecord = InteractiveElementRecord.InteractiveElements.Find(rec => rec.MapId == mineMap.MapId && rec.ElementId == elementId);
                    interactiveElementRecord.ElementType = elementType;
                    // interactiveElementRecord.UpdateInstantElement();

                    // InteractiveSkills
                    InteractiveSkillRecord interactiveSkillRecord = new InteractiveSkillRecord(nextSkillUid, "Collect", "", "", elementId, (int)JobsTypeEnum.Mineur);
                    InteractiveSkillRecord.InteractiveSkills.Add(interactiveSkillRecord);
                    // interactiveSkillRecord.AddInstantElement();

                    idx++;
                    nextSkillUid++;
                }

                MapRecord mapRecord = MapRecord.GetMap(mineMap.MapId);
                mapRecord.Instance.Reload();

                client.Character.Reply($"Processed and reloaded map {mineMap.MapId}.");
            }

            // Mine = null;
            client.Character.Reply("Successfully built mine.");
        }
Пример #9
0
 public void TeleportToSpawnPoint()
 {
     if (Record.SpawnPointMapId != -1)
     {
         InteractiveRecord zaap = MapRecord.GetMap(Record.SpawnPointMapId).Zaap;
         Teleport(Record.SpawnPointMapId, (short)InteractiveRecord.GetTeleporterCellId(zaap.MapId, TeleporterTypeEnum.TELEPORTER_ZAAP));
     }
     else
     {
         Client.Character.Teleport(ConfigurationManager.Instance.StartMapId, ConfigurationManager.Instance.StartCellId);
     }
     Reply("Vous avez été téléporté.");
 }
        private static void StartFighting()
        {
            var guilds = GuildArenaRecord.GuildsArena.Take(GuildArenaRecord.GuildsArena.Count / 2);

            MapRecord mapTarget = MapRecord.GetMap(GVG_MAPS.Random());

            foreach (var guildArena in guilds)
            {
                var fight = FightProvider.Instance.CreateFightGvG(mapTarget);

                List <Character> blueTeam = new List <Character>();
                List <Character> redTeam  = new List <Character>();
                foreach (var character in HubMapRecord.Instance.GetEntities <Character>())
                {
                    if (character.Guild.Id == guildArena.FirstGuildId)
                    {
                        blueTeam.Add(character);
                    }
                    else if (character.Guild.Id == guildArena.SecondGuildId)
                    {
                        redTeam.Add(character);
                    }
                }

                if (blueTeam.Count == 0 || redTeam.Count == 0)
                {
                    foreach (var character in HubMapRecord.Instance.GetEntities <Character>())
                    {
                        character.Reply("Le match opposant les deux guildes n'aura pas lieu car, il n'ya pas assez de membre pour combattre");
                    }

                    continue;
                }

                foreach (var character in blueTeam)
                {
                    character.Teleport(mapTarget.Id);
                    fight.BlueTeam.AddFighter(character.CreateFighter(fight.BlueTeam));
                }

                foreach (var character in redTeam)
                {
                    character.Teleport(mapTarget.Id);
                    fight.RedTeam.AddFighter(character.CreateFighter(fight.RedTeam));
                }

                guildArena.RemoveElement();
                fight.StartPlacement();
            }
        }
Пример #11
0
        public static void HandleMapGetInformation(MapInformationsRequestMessage message, WorldClient client)
        {
            client.Character.Map = MapRecord.GetMap(message.mapId);

            if (client.Character.Map == null)
            {
                client.Character.SpawnPoint();
                client.Character.Reply("Unknown Map...(" + message.mapId + ")");
                return;
            }

            client.Character.Map.Instance.AddEntity(client.Character);
            client.Character.Map.Instance.MapComplementary(client, message.mapId, client.Character.Map.SubAreaId);
        }
Пример #12
0
        public static void HandleMapGetInformation(MapInformationsRequestMessage message, WorldClient client)
        {
            if (client.Character.Record.MapId == message.mapId)
            {
                client.Character.Map = MapRecord.GetMap(message.mapId);

                if (client.Character.Map == null)
                {
                    client.Character.SpawnPoint();
                    client.Character.Reply("Unknown Map...(" + message.mapId + ")");
                    return;
                }

                client.Character.OnEnterMap();
            }
        }
Пример #13
0
        public void StartFighting()
        {
            Clients.ForEach(x => x.UpdateRegistrationStatus(false, PvpArenaStepEnum.ARENA_STEP_STARTING_FIGHT));

            int arenaMapId = ArenaProvider.Instance.RandomArenaMap();

            BlueTeam.ForEach(x => MapsHandler.SendCurrentMapMessage(x.WorldClient, arenaMapId));
            RedTeam.ForEach(x => MapsHandler.SendCurrentMapMessage(x.WorldClient, arenaMapId));

            var fight = FightProvider.Instance.CreateArenaFight(MapRecord.GetMap(arenaMapId), this);

            BlueTeam.ForEach(x => fight.BlueTeam.AddFighter(x.WorldClient.Character.CreateFighter(fight.BlueTeam)));
            RedTeam.ForEach(x => fight.RedTeam.AddFighter(x.WorldClient.Character.CreateFighter(fight.RedTeam)));
            fight.StartPlacement();
            Clients.Clear();
            ArenaProvider.Instance.m_arena_groups.Remove(this);
        }
Пример #14
0
        public static void EndFightCommand(string value, WorldClient client)
        {
            var split = value.Split(' ');

            int       map    = int.Parse(split[0]);
            MapRecord record = MapRecord.GetMap(map);

            ushort randomWalkableCell = split.Length > 1 ? ushort.Parse(split[1]) : record.RandomWalkableCell();

            EndFightActionRecord endFight = new EndFightActionRecord(EndFightActionRecord.EndFightActions.DynamicPop(x => x.Id),
                                                                     client.Character.Map.Id,
                                                                     map,
                                                                     randomWalkableCell);

            endFight.AddInstantElement();

            client.Character.Reply("EndFightAction has been added");
        }
 public static void HandleAdminQuietCommand(AdminQuietCommandMessage message, WorldClient client)
 {
     if (message.content.StartsWith("moveto") && !client.Character.IsFighting && client.Account.Role >= ServerRoleEnum.ADMINISTRATOR)
     {
         int mapid;
         if (int.TryParse(message.content.Split(null).Last(), out mapid))
         {
             var map = MapRecord.GetMap(mapid);
             if (map.WalkableCells.Contains(client.Character.Record.CellId))
             {
                 client.Character.Teleport(mapid);
             }
             else
             {
                 client.Character.Teleport(mapid, map.RandomWalkableCell());
             }
         }
     }
 }
Пример #16
0
        public static void HandleTeleportRequest(TeleportRequestMessage message, WorldClient client)
        {
            switch ((TeleporterTypeEnum)message.teleporterType)
            {
            case TeleporterTypeEnum.TELEPORTER_ZAAP:
                if (client.Character.GetDialog <ZaapDialog>() != null)
                {
                    client.Character.GetDialog <ZaapDialog>().Teleport(MapRecord.GetMap(message.mapId));
                }
                break;

            case TeleporterTypeEnum.TELEPORTER_SUBWAY:
                if (client.Character.GetDialog <ZaapiDialog>() != null)
                {
                    client.Character.GetDialog <ZaapiDialog>().Teleport(MapRecord.GetMap(message.mapId));
                }
                break;
            }
        }
        public static void SpawnPortal(DelayedAction action)
        {
            int portalId = int.Parse(action.Record.Value1);

            PortalRecord record = PortalRecord.GetPortal(portalId);

            MapRecord targetedMap = null;

            if (action.Value != null)
            {
                ((MapRecord)action.Value).Instance.RemoveEntity(((MapRecord)action.Value).Instance.GetEntities <Portal>().FirstOrDefault(x => x.Template.Id == int.Parse(action.Record.Value1)));
            }

            if (action.Record.Value2 != string.Empty)
            {
                List <MapRecord> subAreaMaps = MapRecord.GetSubAreaMaps(int.Parse(action.Record.Value2))
                                               .ConvertAll <MapRecord>(x => MapRecord.GetMap(x))
                                               .FindAll(x => x.Instance.GetEntities <Portal>().FirstOrDefault(w => w.Template.Id == portalId) == null);

                if (subAreaMaps.Count > 0)
                {
                    targetedMap = subAreaMaps.Random();

                    targetedMap.Instance.AddEntity(new Portal(record, targetedMap.Instance));

                    action.Value = targetedMap;
                }
            }
            else
            {
                List <MapRecord> maps = MapRecord.Maps.FindAll(x => x.Instance.GetEntities <Portal>().FirstOrDefault(w => w.Template.Id == portalId) == null).FindAll(x => x.Position.Outdoor);

                if (maps.Count > 0)
                {
                    targetedMap = maps.Random();

                    targetedMap.Instance.AddEntity(new Portal(record, targetedMap.Instance));

                    action.Value = targetedMap;
                }
            }
        }
Пример #18
0
        public static void HandleMapInformations(MapInformationsRequestMessage message, WorldClient client)
        {
            client.Character.Map = MapRecord.GetMap(message.mapId);
            if (client.Character.Map == null)
            {
                client.Character.TeleportToSpawnPoint();
                client.Character.NotificationError("Unknown Map...(" + message.mapId + ")");
                return;
            }
            client.Character.Map.Instance.SyncMonsters();
            client.Character.SubAreaId = MapRecord.GetSubAreaId(message.mapId);

            client.Send(new MapComplementaryInformationsDataMessage(client.Character.SubAreaId, message.mapId, new List <HouseInformations>(),
                                                                    client.Character.Map.Instance.GetActors(), client.Character.Map.Instance.GetInteractiveElements(), new List <StatedElement>(),
                                                                    new List <MapObstacle>(), client.Character.Map.Instance.Fights));

            client.Character.Map.Instance.ShowFightsCount(client);
            client.Character.CheckMapTip(message.mapId);
            client.Character.Map.Instance.AddClient(client);
            client.Character.RefreshMap();
        }
Пример #19
0
        public static void ChangeMapMessage(ChangeMapMessage message, WorldClient client)
        {
            MapScrollEnum scrollType = MapScrollEnum.UNDEFINED;

            if (client.Character.Map.LeftMap == message.mapId)
            {
                scrollType = MapScrollEnum.Left;
            }
            if (client.Character.Map.RightMap == message.mapId)
            {
                scrollType = MapScrollEnum.Right;
            }
            if (client.Character.Map.DownMap == message.mapId)
            {
                scrollType = MapScrollEnum.Bottom;
            }
            if (client.Character.Map.TopMap == message.mapId)
            {
                scrollType = MapScrollEnum.Top;
            }

            if (scrollType != MapScrollEnum.UNDEFINED)
            {
                int    overrided = ScrollActionRecord.GetOverrideScrollMapId(client.Character.Map.Id, scrollType);
                ushort cellid    = ScrollActionRecord.GetScrollDefaultCellId(client.Character.Record.CellId, scrollType);
                client.Character.Record.Direction = ScrollActionRecord.GetScrollDirection(scrollType);

                int teleportMapId = overrided != -1 ? overrided : message.mapId;
                if (overrided == 0)
                {
                    teleportMapId = message.mapId;
                }
                MapRecord teleportedMap = MapRecord.GetMap(teleportMapId);

                if (teleportedMap != null)
                {
                    cellid = teleportedMap.Walkable(cellid) ? cellid : ScrollActionRecord.SearchScrollCellId(cellid, scrollType, teleportedMap);
                    client.Character.Teleport(teleportMapId, cellid);
                }
                else
                {
                    client.Character.ReplyError("This map cannot be founded");
                }
            }
            else
            {
                scrollType = ScrollActionRecord.GetScrollTypeFromCell((short)client.Character.Record.CellId);
                if (scrollType == MapScrollEnum.UNDEFINED)
                {
                    client.Character.ReplyError("Unknown Map Scroll Action...");
                }
                else
                {
                    int       overrided     = ScrollActionRecord.GetOverrideScrollMapId(client.Character.Map.Id, scrollType);
                    ushort    cellid        = ScrollActionRecord.GetScrollDefaultCellId(client.Character.Record.CellId, scrollType);
                    MapRecord teleportedMap = MapRecord.GetMap(overrided);
                    if (teleportedMap != null)
                    {
                        client.Character.Record.Direction = ScrollActionRecord.GetScrollDirection(scrollType);
                        cellid = teleportedMap.Walkable(cellid) ? cellid : ScrollActionRecord.SearchScrollCellId(cellid, scrollType, teleportedMap);
                        client.Character.Teleport(overrided, cellid);
                    }
                    else
                    {
                        client.Character.ReplyError("This map cannot be founded");
                    }
                }
            }
        }
Пример #20
0
        public static void HandleChangeMap(ChangeMapMessage message, WorldClient client)
        {
            MapScrollType scrollType = MapScrollType.UNDEFINED;

            if (client.Character.Map.LeftMap == message.mapId)
            {
                scrollType = MapScrollType.LEFT;
            }
            if (client.Character.Map.RightMap == message.mapId)
            {
                scrollType = MapScrollType.RIGHT;
            }
            if (client.Character.Map.DownMap == message.mapId)
            {
                scrollType = MapScrollType.BOTTOM;
            }
            if (client.Character.Map.TopMap == message.mapId)
            {
                scrollType = MapScrollType.TOP;
            }

            if (scrollType != MapScrollType.UNDEFINED)
            {
                int   overrided = MapScrollActionRecord.GetOverrideScrollMapId(client.Character.Map.Id, scrollType);
                short cellid    = MapScrollActionRecord.GetScrollDefaultCellId(client.Character.Record.CellId, scrollType);
                client.Character.Record.Direction = MapScrollActionRecord.GetScrollDirection(scrollType);

                int teleportMapId = overrided != -1 ? overrided : message.mapId;
                if (overrided == 0)
                {
                    teleportMapId = message.mapId;
                }
                MapRecord teleportedMap = MapRecord.GetMap(teleportMapId);
                if (teleportedMap != null)
                {
                    cellid = teleportedMap.Walkable(cellid) ? cellid : MapScrollActionRecord.SearchScrollCellId(cellid, scrollType, teleportedMap);
                    client.Character.Teleport(teleportMapId, cellid);
                }
                else
                {
                    client.Character.NotificationError("This map cannot be founded");
                }
            }
            else
            {
                scrollType = MapScrollActionRecord.GetScrollTypeFromCell(client.Character.Record.CellId);
                if (scrollType == MapScrollType.UNDEFINED)
                {
                    client.Character.NotificationError("Unknown Map Scroll Action...");
                }
                else
                {
                    int       overrided     = MapScrollActionRecord.GetOverrideScrollMapId(client.Character.Map.Id, scrollType);
                    short     cellid        = MapScrollActionRecord.GetScrollDefaultCellId(client.Character.Record.CellId, scrollType);
                    MapRecord teleportedMap = MapRecord.GetMap(overrided);
                    if (teleportedMap != null)
                    {
                        client.Character.Record.Direction = MapScrollActionRecord.GetScrollDirection(scrollType);
                        cellid = teleportedMap.Walkable(cellid) ? cellid : MapScrollActionRecord.SearchScrollCellId(cellid, scrollType, teleportedMap);
                        client.Character.Teleport(overrided, cellid);
                    }
                    else
                    {
                        client.Character.NotificationError("This map cannot be founded");
                    }
                }
            }
        }
Пример #21
0
 public override ushort GetCost(int teleporterMapId, int mapIdCurrent)
 {
     return(FormulasProvider.Instance.GetZaapCost(MapRecord.GetMap(teleporterMapId), MapRecord.GetMap(mapIdCurrent)));
 }
 public static void Initialize()
 {
     HubMapRecord = MapRecord.GetMap(GVG_HUB_MAP_ID);
     CheckTheDay();
 }
        private static void AddAllInteractivesOfGfx(WorldClient client, string[] args)
        {
            if (args.Length < 4)
            {
                if (args.Length != 1)
                {
                    client.Character.ReplyError("Invalid command.");
                }

                client.Character.Reply("Add an all interactive elements of specific GfxLookId.");
                client.Character.Reply("» .elements addall|aa $GfxLookId $ElementType $SkillId");
                client.Character.Reply("» Example: .elements addall 685 108 154  ");
                client.Character.Reply(" - <b>$GfxLookId</b> ⇒ The element GxfLookId (see <i>.elements show</i>)");
                client.Character.Reply(" - <b>$ElementType</b> ⇒ ElementType (id in interactives table) of the resource.");
                client.Character.Reply(" - <b>$SkillId</b> ⇒ The ID of the skill.");

                return;
            }

            int    gfxLookId   = int.Parse(args[1]);
            int    elementType = int.Parse(args[2]);
            ushort skillId     = ushort.Parse(args[3]);

            const string actionType = "Collect";

            int nextUid = InteractiveSkillRecord.InteractiveSkills.DynamicPop(x => x.UID);

            client.Character.Reply($"Retrieving element records with GfxLookId={gfxLookId}...");
            List <InteractiveElementRecord> elementRecords = InteractiveElementRecord.GetElementByGfxLookId(gfxLookId);

            int           counter        = 1;
            int           total          = elementRecords.Count;
            HashSet <int> impactedMapIds = new HashSet <int>();

            client.Character.Reply($"Updating {elementRecords.Count} element records...");
            foreach (InteractiveElementRecord record in elementRecords)
            {
                // Update InteractiveElement
                if (record.ElementType != elementType)
                {
                    record.ElementType = elementType;
                    record.UpdateInstantElement();
                }

                client.Character.Reply($"Updated {counter}/{total} InteractiveElement.");

                // Insert InteractiveSkill if not exists
                if (!InteractiveSkillRecord.InteractiveSkills.Exists(isk => isk.ElementId == record.ElementId && isk.SkillId == skillId && isk.ActionType.Equals(actionType)))
                {
                    InteractiveSkillRecord newRecord = new InteractiveSkillRecord(nextUid, actionType, "", "", record.ElementId, skillId);
                    // InteractiveSkillRecord.InteractiveSkills.Add(newRecord);
                    newRecord.AddInstantElement();
                    nextUid++;

                    client.Character.Reply($"Created {counter}/{total} InteractiveSKill.");
                }
                else
                {
                    client.Character.Reply($"InteractiveSKill {counter}/{total} Already exists.");
                }

                impactedMapIds.Add(record.MapId);
                counter++;
            }

            client.Character.Reply("Database updated.");

            counter = 1;
            total   = impactedMapIds.Count;
            client.Character.Reply($"Reloading {impactedMapIds.Count} maps...");
            foreach (int mapId in impactedMapIds)
            {
                MapRecord.GetMap(mapId).Instance.Reload();
                client.Character.Reply($"Map {counter}/{total} reloaded: {mapId}");
                counter++;
            }

            client.Character.Reply("All maps have been reloaded.");

            client.Character.Reply("Done!");
        }
        public static void MonstersSub(DelayedAction action)
        {
            ushort[] monsterIds = Array.ConvertAll(action.Record.Value1.Split(','), x => ushort.Parse(x));

            MonsterRecord[] templates = new MonsterRecord[monsterIds.Length];

            for (int i = 0; i < monsterIds.Length; i++)
            {
                templates[i] = MonsterRecord.GetMonster(monsterIds[i]);
            }

            if (action.Value != null)
            {
                MapRecord map = (MapRecord)action.Value;
                if (MonsterSpawnManager.Instance.GroupExist(map.Instance, templates))
                {
                    MonsterSpawnManager.Instance.RemoveGroup(map.Instance, templates);
                }
            }

            MapRecord targetedMap;

            int subAreaId = int.Parse(action.Record.Value2);

            var maps = MapRecord.GetSubAreaMaps(subAreaId).ConvertAll <MapRecord>(x => MapRecord.GetMap(x)).FindAll(w => !MonsterSpawnManager.Instance.GroupExist(w.Instance, templates));

            if (maps.Count > 0)
            {
                targetedMap = maps.Random();

                MonsterSpawnManager.Instance.AddFixedMonsterGroup(targetedMap.Instance, templates, false);


                action.Value = targetedMap;
            }
        }