Пример #1
0
        private FightStartingPositions BuildNewSchema(Map.Map map)
        {
            Console.WriteLine("Build new fight schema");

            var finalFightStartingPos = new FightStartingPositions();
            var cellWalkable          = map.MapData.Cells.ToList().FindAll(x => x.Walkable && x.isObstacle() != true).Select(x => (uint)x.Id).ToList();

            if (cellWalkable.Count < 25)
            {
                return(new FightStartingPositions());
            }

            List <uint> cellWalkableForChallengers = new List <uint>();

            for (int i = 0; i < 12; i++) //build challengers
            {
                cellWalkableForChallengers.Add(cellWalkable[0]);
                cellWalkable.Remove(cellWalkable[0]);
            }

            List <uint> cellWalkableForDefenders = new List <uint>();

            for (int i = 0; i < 12; i++) //build defenders
            {
                cellWalkableForDefenders.Add(cellWalkable[0]);
                cellWalkable.Remove(cellWalkable[0]);
            }

            finalFightStartingPos.positionsForChallengers = cellWalkableForChallengers;
            finalFightStartingPos.positionsForDefenders   = cellWalkableForDefenders;

            return(finalFightStartingPos);
        }
 public MapComplementaryInformationsWithCoordsMessage(
     short subAreaId,
     double mapId,
     List <HouseInformations> houses,
     List <GameRolePlayActorInformations> actors,
     List <InteractiveElement> interactiveElements,
     List <StatedElement> statedElements,
     List <MapObstacle> obstacles,
     List <FightCommonInformations> fights,
     bool hasAggressiveMonsters,
     FightStartingPositions fightStartPositions,
     short worldX,
     short worldY
     ) : base(
         subAreaId,
         mapId,
         houses,
         actors,
         interactiveElements,
         statedElements,
         obstacles,
         fights,
         hasAggressiveMonsters,
         fightStartPositions
         )
 {
     WorldX = worldX;
     WorldY = worldY;
 }
Пример #3
0
 public MapComplementaryInformationsAnomalyMessage(
     short subAreaId,
     double mapId,
     List <HouseInformations> houses,
     List <GameRolePlayActorInformations> actors,
     List <InteractiveElement> interactiveElements,
     List <StatedElement> statedElements,
     List <MapObstacle> obstacles,
     List <FightCommonInformations> fights,
     bool hasAggressiveMonsters,
     FightStartingPositions fightStartPositions,
     short level,
     long closingTime
     ) : base(
         subAreaId,
         mapId,
         houses,
         actors,
         interactiveElements,
         statedElements,
         obstacles,
         fights,
         hasAggressiveMonsters,
         fightStartPositions
         )
 {
     Level       = level;
     ClosingTime = closingTime;
 }
 public MapComplementaryInformationsBreachMessage(
     short subAreaId,
     double mapId,
     List <HouseInformations> houses,
     List <GameRolePlayActorInformations> actors,
     List <InteractiveElement> interactiveElements,
     List <StatedElement> statedElements,
     List <MapObstacle> obstacles,
     List <FightCommonInformations> fights,
     bool hasAggressiveMonsters,
     FightStartingPositions fightStartPositions,
     int floor,
     byte room,
     List <BreachBranch> branches
     ) : base(
         subAreaId,
         mapId,
         houses,
         actors,
         interactiveElements,
         statedElements,
         obstacles,
         fights,
         hasAggressiveMonsters,
         fightStartPositions
         )
 {
     Floor    = floor;
     Room     = room;
     Branches = branches;
 }
        protected override void serializeContent(ICustomDataWriter writer)
        {
            var mapPosition = GameDataManager <MapPosition> .Instance.Get(MapId);

            writer.WriteVarShort((short)mapPosition.SubAreaId);
            writer.WriteDouble(MapId);
            writer.WriteShort(0); // House count

            //writer.WriteShort(0); // Actors count
            writer.WriteShort(1); // Actors count

            var actorInfos = new GameRolePlayCharacterInformations();

            actorInfos.Initialize(Entity);
            writer.WriteShort((short)actorInfos.ProtocolId);
            actorInfos.Serialize(writer);

            writer.WriteShort(0);    // Interactive elements count
            writer.WriteShort(0);    // Stated elements count
            writer.WriteShort(0);    // Obstacles count
            writer.WriteShort(0);    // Fights count
            writer.WriteBool(false); // Has aggressive monsters

            var fightPositions = new FightStartingPositions();

            fightPositions.Serialize(writer);
        }
 public MapComplementaryInformationsDataInHavenBagMessage(
     short subAreaId,
     double mapId,
     List <HouseInformations> houses,
     List <GameRolePlayActorInformations> actors,
     List <InteractiveElement> interactiveElements,
     List <StatedElement> statedElements,
     List <MapObstacle> obstacles,
     List <FightCommonInformations> fights,
     bool hasAggressiveMonsters,
     FightStartingPositions fightStartPositions,
     CharacterMinimalInformations ownerInformations,
     byte theme,
     byte roomId,
     byte maxRoomId
     ) : base(
         subAreaId,
         mapId,
         houses,
         actors,
         interactiveElements,
         statedElements,
         obstacles,
         fights,
         hasAggressiveMonsters,
         fightStartPositions
         )
 {
     OwnerInformations = ownerInformations;
     Theme             = theme;
     RoomId            = roomId;
     MaxRoomId         = maxRoomId;
 }
Пример #7
0
 public MapFightStartPositionsUpdateMessage(
     double mapId,
     FightStartingPositions fightStartPositions)
 {
     this.mapId = mapId;
     this.fightStartPositions = fightStartPositions;
 }
 public MapComplementaryInformationsDataInHouseMessage(
     short subAreaId,
     double mapId,
     List <HouseInformations> houses,
     List <GameRolePlayActorInformations> actors,
     List <InteractiveElement> interactiveElements,
     List <StatedElement> statedElements,
     List <MapObstacle> obstacles,
     List <FightCommonInformations> fights,
     bool hasAggressiveMonsters,
     FightStartingPositions fightStartPositions,
     HouseInformationsInside currentHouse
     ) : base(
         subAreaId,
         mapId,
         houses,
         actors,
         interactiveElements,
         statedElements,
         obstacles,
         fights,
         hasAggressiveMonsters,
         fightStartPositions
         )
 {
     CurrentHouse = currentHouse;
 }
Пример #9
0
        public void Initialize()
        {
            this.FightStartingPositions = new List <FightStartingPositions>();
            this.Random = new Random();

            foreach (var fightPos in Directory.GetFiles("fight_schemas/"))
            {
                StreamReader reader         = new StreamReader(fightPos);
                string       line           = "";
                bool         challengersPos = false;
                bool         defendersPos   = false;
                int          mapId          = 0;
                var          fightposition  = new FightStartingPositions();
                List <uint>  posChallengers = new List <uint>();
                List <uint>  posDefenders   = new List <uint>();

                while ((line = reader.ReadLine()) != null)
                {
                    if (line.Contains("MAPID"))
                    {
                        mapId = int.Parse(line.Replace("MAPID=", ""));
                    }

                    if (line.Contains("[CHALLENGERS]"))
                    {
                        challengersPos = true;
                    }
                    else if (line.Contains("[DEFENDERS]"))
                    {
                        challengersPos = false;
                        defendersPos   = true;
                    }
                    else if (challengersPos && line != "")
                    {
                        posChallengers.Add(uint.Parse(line));
                    }

                    else if (defendersPos && line != "")
                    {
                        posDefenders.Add(uint.Parse(line));
                    }
                }

                fightposition.positionsForChallengers = posChallengers;
                fightposition.positionsForDefenders   = posDefenders;


                if (mapId != 0 && fightposition.positionsForChallengers.Count > 0 && fightposition.positionsForDefenders.Count > 0)
                {
                    this.FightStartingPositions.Add(fightposition);
                }

                reader.Close();
                reader.Dispose();
            }

            this.IsInitialized = true;
            Console.WriteLine("{0} schemas for fight positions loaded.", this.FightStartingPositions.Count);
        }
Пример #10
0
 public override void Deserialize(IDataReader reader)
 {
     this.mapId = reader.ReadDouble();
     if (this.mapId < 0.0 || this.mapId > 9.00719925474099E+15)
     {
         throw new Exception("Forbidden value (" + (object)this.mapId + ") on element of MapFightStartPositionsUpdateMessage.mapId.");
     }
     this.fightStartPositions = new FightStartingPositions();
     this.fightStartPositions.Deserialize(reader);
 }
Пример #11
0
        public FightStartingPositions BuildFromSchema(Map.Map map)
        {
            if (!this.IsInitialized)
            {
                this.Initialize();
            }

            var schema = this.FightStartingPositions[this.Random.Next(1, this.FightStartingPositions.Count)];
            var finalFightStartingPos = new FightStartingPositions();

            try
            {
                List <uint> mixedCell = new List <uint>();
                List <uint> cellWalkableForChallengers = new List <uint>();

                foreach (var cell in schema.positionsForChallengers)
                {
                    uint walkableCell = this.GetWalkableCell(map, cell, cellWalkableForChallengers);

                    if (walkableCell != 0)
                    {
                        cellWalkableForChallengers.Add(walkableCell);
                        mixedCell.Add(walkableCell);
                    }
                }

                List <uint> cellWalkableForDefenders = new List <uint>();
                foreach (var cell in schema.positionsForDefenders)
                {
                    uint walkableCell = this.GetWalkableCell(map, cell, mixedCell);
                    if (walkableCell != 0 && !mixedCell.Contains(walkableCell))
                    {
                        cellWalkableForDefenders.Add(walkableCell);
                        mixedCell.Add(walkableCell);
                    }
                }

                finalFightStartingPos.positionsForChallengers = cellWalkableForChallengers;
                finalFightStartingPos.positionsForDefenders   = cellWalkableForDefenders;

                if ((finalFightStartingPos.positionsForChallengers.Count != schema.positionsForChallengers.Count) || (finalFightStartingPos.positionsForDefenders.Count != schema.positionsForDefenders.Count))
                {
                    this.BuildNewSchema(map);
                }
            }
            catch (Exception ex)
            {
                return(new FightStartingPositions());
            }


            return(finalFightStartingPos);
        }
Пример #12
0
 public MapComplementaryInformationsDataMessage(List <HouseInformations> houses, List <GameRolePlayActorInformations> actors, List <InteractiveElement> interactiveElements, List <StatedElement> statedElements, List <MapObstacle> obstacles, List <FightCommonInformations> fights, FightStartingPositions fightStartPositions, ushort subAreaId, int mapId, bool hasAggressiveMonsters)
 {
     m_houses = houses;
     m_actors = actors;
     m_interactiveElements = interactiveElements;
     m_statedElements      = statedElements;
     m_obstacles           = obstacles;
     m_fights = fights;
     m_fightStartPositions = fightStartPositions;
     m_subAreaId           = subAreaId;
     m_mapId = mapId;
     m_hasAggressiveMonsters = hasAggressiveMonsters;
 }
Пример #13
0
 public MapComplementaryInformationsDataMessage(uint subAreaId, int mapId, Types.HouseInformations[] houses, Types.GameRolePlayActorInformations[] actors, Types.InteractiveElement[] interactiveElements, Types.StatedElement[] statedElements, Types.MapObstacle[] obstacles, Types.FightCommonInformations[] fights, bool hasAggressiveMonsters, FightStartingPositions positions)
 {
     this.subAreaId             = subAreaId;
     this.mapId                 = mapId;
     this.houses                = houses;
     this.actors                = actors;
     this.interactiveElements   = interactiveElements;
     this.statedElements        = statedElements;
     this.obstacles             = obstacles;
     this.fights                = fights;
     this.hasAggressiveMonsters = hasAggressiveMonsters;
     fightStartPositions        = positions;
 }
 public MapComplementaryInformationsDataMessage(ushort SubAreaId, uint MapId, List <HouseInformations> Houses, List <GameRolePlayActorInformations> Actors, List <InteractiveElement> InteractiveElements, List <StatedElement> StatedElements, List <MapObstacle> Obstacles, List <FightCommonInformations> Fights, bool HasAggressiveMonsters, FightStartingPositions FightStartPositions)
 {
     this.SubAreaId             = SubAreaId;
     this.MapId                 = MapId;
     this.Houses                = Houses;
     this.Actors                = Actors;
     this.InteractiveElements   = InteractiveElements;
     this.StatedElements        = StatedElements;
     this.Obstacles             = Obstacles;
     this.Fights                = Fights;
     this.HasAggressiveMonsters = HasAggressiveMonsters;
     this.FightStartPositions   = FightStartPositions;
 }
Пример #15
0
 public MapComplementaryInformationsDataMessage(ushort subAreaId, double mapId, List <HouseInformations> houses, List <GameRolePlayActorInformations> actors, List <InteractiveElement> interactiveElements, List <StatedElement> statedElements, List <MapObstacle> obstacles, List <FightCommonInformations> fights, bool hasAggressiveMonsters, FightStartingPositions fightStartPositions)
 {
     SubAreaId             = subAreaId;
     MapId                 = mapId;
     Houses                = houses;
     Actors                = actors;
     InteractiveElements   = interactiveElements;
     StatedElements        = statedElements;
     Obstacles             = obstacles;
     Fights                = fights;
     HasAggressiveMonsters = hasAggressiveMonsters;
     FightStartPositions   = fightStartPositions;
 }
 public void Deserialize(IDataReader reader)
 {
     SubAreaId = (UInt16)reader.ReadVarShort();
     MapId     = reader.ReadDouble();
     Houses    = new HouseInformations[reader.ReadShort()];
     for (var i = 0; i < Houses.Length; i++)
     {
         (Houses[i] = new HouseInformations()).Deserialize(reader);
     }
     Actors = new GameRolePlayActorInformations[reader.ReadShort()];
     for (var i = 0; i < Actors.Length; i++)
     {
         (Actors[i] = new GameRolePlayActorInformations()).Deserialize(reader);
     }
     InteractiveElements = new InteractiveElement[reader.ReadShort()];
     for (var i = 0; i < InteractiveElements.Length; i++)
     {
         (InteractiveElements[i] = new InteractiveElement()).Deserialize(reader);
     }
     StatedElements = new StatedElement[reader.ReadShort()];
     for (var i = 0; i < StatedElements.Length; i++)
     {
         (StatedElements[i] = new StatedElement()).Deserialize(reader);
     }
     Obstacles = new MapObstacle[reader.ReadShort()];
     for (var i = 0; i < Obstacles.Length; i++)
     {
         (Obstacles[i] = new MapObstacle()).Deserialize(reader);
     }
     Fights = new FightCommonInformations[reader.ReadShort()];
     for (var i = 0; i < Fights.Length; i++)
     {
         (Fights[i] = new FightCommonInformations()).Deserialize(reader);
     }
     HasAggressiveMonsters = reader.ReadBoolean();
     FightStartPositions   = new FightStartingPositions();
     FightStartPositions.Deserialize(reader);
 }
        public override void Deserialize(ICustomDataInput reader)
        {
            SubAreaId = reader.ReadVarShort();
            MapId     = reader.ReadDouble();
            var countHouses = reader.ReadShort();

            Houses = new List <HouseInformations>();
            for (short i = 0; i < countHouses; i++)
            {
                var housestypeId       = reader.ReadShort();
                HouseInformations type = new HouseInformations();
                type.Deserialize(reader);
                Houses.Add(type);
            }
            var countActors = reader.ReadShort();

            Actors = new List <GameRolePlayActorInformations>();
            for (short i = 0; i < countActors; i++)
            {
                var actorstypeId = reader.ReadShort();
                GameRolePlayActorInformations type = new GameRolePlayActorInformations();
                type.Deserialize(reader);
                Actors.Add(type);
            }
            var countInteractiveElements = reader.ReadShort();

            InteractiveElements = new List <InteractiveElement>();
            for (short i = 0; i < countInteractiveElements; i++)
            {
                var interactiveElementstypeId = reader.ReadShort();
                InteractiveElement type       = new InteractiveElement();
                type.Deserialize(reader);
                InteractiveElements.Add(type);
            }
            var countStatedElements = reader.ReadShort();

            StatedElements = new List <StatedElement>();
            for (short i = 0; i < countStatedElements; i++)
            {
                StatedElement type = new StatedElement();
                type.Deserialize(reader);
                StatedElements.Add(type);
            }
            var countObstacles = reader.ReadShort();

            Obstacles = new List <MapObstacle>();
            for (short i = 0; i < countObstacles; i++)
            {
                MapObstacle type = new MapObstacle();
                type.Deserialize(reader);
                Obstacles.Add(type);
            }
            var countFights = reader.ReadShort();

            Fights = new List <FightCommonInformations>();
            for (short i = 0; i < countFights; i++)
            {
                FightCommonInformations type = new FightCommonInformations();
                type.Deserialize(reader);
                Fights.Add(type);
            }
            HasAggressiveMonsters = reader.ReadBoolean();
            FightStartPositions   = new FightStartingPositions();
            FightStartPositions.Deserialize(reader);
        }
 public MapFightStartPositionsUpdateMessage(int mapId, FightStartingPositions fightStartPositions)
 {
     MapId = mapId;
     FightStartPositions = fightStartPositions;
 }
 public override void Deserialize(IDataReader reader)
 {
     MapId = reader.ReadInt();
     FightStartPositions = new FightStartingPositions();
     FightStartPositions.Deserialize(reader);
 }
Пример #20
0
 public override void Deserialize(ICustomDataInput reader)
 {
     MapId = reader.ReadDouble();
     FightStartPositions = new FightStartingPositions();
     FightStartPositions.Deserialize(reader);
 }
Пример #21
0
 public MapComplementaryInformationsDataInHavenBagMessage(uint subAreaId, int mapId, Types.HouseInformations[] houses, Types.GameRolePlayActorInformations[] actors, Types.InteractiveElement[] interactiveElements, Types.StatedElement[] statedElements, Types.MapObstacle[] obstacles, Types.FightCommonInformations[] fights, bool hasAggressiveMonsters, Types.CharacterMinimalInformations ownerInformations, sbyte theme, sbyte roomId, sbyte maxRoomId, FightStartingPositions positions)
     : base(subAreaId, mapId, houses, actors, interactiveElements, statedElements, obstacles, fights, hasAggressiveMonsters, positions)
 {
     this.ownerInformations = ownerInformations;
     this.theme             = theme;
     this.roomId            = roomId;
     this.maxRoomId         = maxRoomId;
 }
Пример #22
0
 public MapComplementaryInformationsDataInHouseMessage(uint subAreaId, int mapId, Types.HouseInformations[] houses, Types.GameRolePlayActorInformations[] actors, Types.InteractiveElement[] interactiveElements, Types.StatedElement[] statedElements, Types.MapObstacle[] obstacles, Types.FightCommonInformations[] fights, bool hasAggressiveMonsters, Types.HouseInformationsInside currentHouse, FightStartingPositions positions)
     : base(subAreaId, mapId, houses, actors, interactiveElements, statedElements, obstacles, fights, hasAggressiveMonsters, positions)
 {
     this.currentHouse = currentHouse;
 }
Пример #23
0
        public override void Deserialize(IDataReader reader)
        {
            SubAreaId = reader.ReadVarUhShort();
            MapId     = reader.ReadDouble();
            var housesCount = reader.ReadUShort();

            Houses = new List <HouseInformations>();
            for (var housesIndex = 0; housesIndex < housesCount; housesIndex++)
            {
                var objectToAdd = ProtocolTypeManager.GetInstance <HouseInformations>(reader.ReadUShort());
                objectToAdd.Deserialize(reader);
                Houses.Add(objectToAdd);
            }
            var actorsCount = reader.ReadUShort();

            Actors = new List <GameRolePlayActorInformations>();
            for (var actorsIndex = 0; actorsIndex < actorsCount; actorsIndex++)
            {
                var objectToAdd = ProtocolTypeManager.GetInstance <GameRolePlayActorInformations>(reader.ReadUShort());
                objectToAdd.Deserialize(reader);
                Actors.Add(objectToAdd);
            }
            var interactiveElementsCount = reader.ReadUShort();

            InteractiveElements = new List <InteractiveElement>();
            for (var interactiveElementsIndex = 0; interactiveElementsIndex < interactiveElementsCount; interactiveElementsIndex++)
            {
                var objectToAdd = ProtocolTypeManager.GetInstance <InteractiveElement>(reader.ReadUShort());
                objectToAdd.Deserialize(reader);
                InteractiveElements.Add(objectToAdd);
            }
            var statedElementsCount = reader.ReadUShort();

            StatedElements = new List <StatedElement>();
            for (var statedElementsIndex = 0; statedElementsIndex < statedElementsCount; statedElementsIndex++)
            {
                var objectToAdd = new StatedElement();
                objectToAdd.Deserialize(reader);
                StatedElements.Add(objectToAdd);
            }
            var obstaclesCount = reader.ReadUShort();

            Obstacles = new List <MapObstacle>();
            for (var obstaclesIndex = 0; obstaclesIndex < obstaclesCount; obstaclesIndex++)
            {
                var objectToAdd = new MapObstacle();
                objectToAdd.Deserialize(reader);
                Obstacles.Add(objectToAdd);
            }
            var fightsCount = reader.ReadUShort();

            Fights = new List <FightCommonInformations>();
            for (var fightsIndex = 0; fightsIndex < fightsCount; fightsIndex++)
            {
                var objectToAdd = new FightCommonInformations();
                objectToAdd.Deserialize(reader);
                Fights.Add(objectToAdd);
            }
            HasAggressiveMonsters = reader.ReadBoolean();
            FightStartPositions   = new FightStartingPositions();
            FightStartPositions.Deserialize(reader);
        }
        public override void Deserialize(IDataReader reader)
        {
            SubAreaId = reader.ReadVarUhShort();
            MapId     = (uint)reader.ReadDouble();
            var HousesCount = reader.ReadShort();

            Houses = new List <HouseInformations>();
            for (var i = 0; i < HousesCount; i++)
            {
                HouseInformations objectToAdd = ProtocolTypeManager.GetInstance(reader.ReadUShort());
                objectToAdd.Deserialize(reader);
                Houses.Add(objectToAdd);
            }
            var ActorsCount = reader.ReadShort();

            Actors = new List <GameRolePlayActorInformations>();
            for (var i = 0; i < ActorsCount; i++)
            {
                GameRolePlayActorInformations objectToAdd = ProtocolTypeManager.GetInstance(reader.ReadUShort());
                objectToAdd.Deserialize(reader);
                Actors.Add(objectToAdd);
            }
            var InteractiveElementsCount = reader.ReadShort();

            InteractiveElements = new List <InteractiveElement>();
            for (var i = 0; i < InteractiveElementsCount; i++)
            {
                InteractiveElement objectToAdd = ProtocolTypeManager.GetInstance(reader.ReadUShort());
                objectToAdd.Deserialize(reader);
                InteractiveElements.Add(objectToAdd);
            }
            var StatedElementsCount = reader.ReadShort();

            StatedElements = new List <StatedElement>();
            for (var i = 0; i < StatedElementsCount; i++)
            {
                var objectToAdd = new StatedElement();
                objectToAdd.Deserialize(reader);
                StatedElements.Add(objectToAdd);
            }
            var ObstaclesCount = reader.ReadShort();

            Obstacles = new List <MapObstacle>();
            for (var i = 0; i < ObstaclesCount; i++)
            {
                var objectToAdd = new MapObstacle();
                objectToAdd.Deserialize(reader);
                Obstacles.Add(objectToAdd);
            }
            var FightsCount = reader.ReadShort();

            Fights = new List <FightCommonInformations>();
            for (var i = 0; i < FightsCount; i++)
            {
                var objectToAdd = new FightCommonInformations();
                objectToAdd.Deserialize(reader);
                Fights.Add(objectToAdd);
            }
            HasAggressiveMonsters = reader.ReadBoolean();
            FightStartPositions   = new FightStartingPositions();
            FightStartPositions.Deserialize(reader);
        }
 public void Deserialize(IDataReader reader)
 {
     MapId = reader.ReadDouble();
     FightStartPositions = new FightStartingPositions();
     FightStartPositions.Deserialize(reader);
 }
 public MapComplementaryInformationsWithCoordsMessage(uint subAreaId, int mapId, Types.HouseInformations[] houses, Types.GameRolePlayActorInformations[] actors, Types.InteractiveElement[] interactiveElements, Types.StatedElement[] statedElements, Types.MapObstacle[] obstacles, Types.FightCommonInformations[] fights, bool hasAggressiveMonsters, short worldX, short worldY, FightStartingPositions positions)
     : base(subAreaId, mapId, houses, actors, interactiveElements, statedElements, obstacles, fights, hasAggressiveMonsters, positions)
 {
     this.worldX = worldX;
     this.worldY = worldY;
 }
Пример #27
0
        public override void Deserialize(IDataReader reader)
        {
            m_subAreaId = reader.ReadVarUhShort();
            m_mapId     = reader.ReadInt();
            int housesCount = reader.ReadUShort();
            int housesIndex;

            m_houses = new System.Collections.Generic.List <HouseInformations>();
            for (housesIndex = 0; (housesIndex < housesCount); housesIndex = (housesIndex + 1))
            {
                HouseInformations objectToAdd = ProtocolTypeManager.GetInstance <HouseInformations>(reader.ReadUShort());
                objectToAdd.Deserialize(reader);
                m_houses.Add(objectToAdd);
            }

            int actorsCount = reader.ReadUShort();
            int actorsIndex;

            m_actors = new System.Collections.Generic.List <GameRolePlayActorInformations>();
            for (actorsIndex = 0; (actorsIndex < actorsCount); actorsIndex = (actorsIndex + 1))
            {
                GameRolePlayActorInformations objectToAdd = ProtocolTypeManager.GetInstance <GameRolePlayActorInformations>(reader.ReadUShort());
                objectToAdd.Deserialize(reader);
                m_actors.Add(objectToAdd);
            }
            int interactiveElementsCount = reader.ReadUShort();
            int interactiveElementsIndex;

            m_interactiveElements = new System.Collections.Generic.List <InteractiveElement>();
            for (interactiveElementsIndex = 0; (interactiveElementsIndex < interactiveElementsCount); interactiveElementsIndex = (interactiveElementsIndex + 1))
            {
                InteractiveElement objectToAdd = ProtocolTypeManager.GetInstance <InteractiveElement>(reader.ReadUShort());
                objectToAdd.Deserialize(reader);
                m_interactiveElements.Add(objectToAdd);
            }
            int statedElementsCount = reader.ReadUShort();
            int statedElementsIndex;

            m_statedElements = new System.Collections.Generic.List <StatedElement>();
            for (statedElementsIndex = 0; (statedElementsIndex < statedElementsCount); statedElementsIndex = (statedElementsIndex + 1))
            {
                StatedElement objectToAdd = new StatedElement();
                objectToAdd.Deserialize(reader);
                m_statedElements.Add(objectToAdd);
            }
            int obstaclesCount = reader.ReadUShort();
            int obstaclesIndex;

            m_obstacles = new System.Collections.Generic.List <MapObstacle>();
            for (obstaclesIndex = 0; (obstaclesIndex < obstaclesCount); obstaclesIndex = (obstaclesIndex + 1))
            {
                MapObstacle objectToAdd = new MapObstacle();
                objectToAdd.Deserialize(reader);
                m_obstacles.Add(objectToAdd);
            }
            int fightsCount = reader.ReadUShort();
            int fightsIndex;

            m_fights = new System.Collections.Generic.List <FightCommonInformations>();
            for (fightsIndex = 0; (fightsIndex < fightsCount); fightsIndex = (fightsIndex + 1))
            {
                FightCommonInformations objectToAdd = new FightCommonInformations();
                objectToAdd.Deserialize(reader);
                m_fights.Add(objectToAdd);
            }
            m_hasAggressiveMonsters = reader.ReadBoolean();
            m_fightStartPositions   = new FightStartingPositions();
            m_fightStartPositions.Deserialize(reader);
        }
Пример #28
0
 public MapFightStartPositionsUpdateMessage(double MapId, FightStartingPositions FightStartPositions)
 {
     this.MapId = MapId;
     this.FightStartPositions = FightStartPositions;
 }
        public override void Deserialize(IDataReader reader)
        {
            this.subAreaId = (uint)reader.ReadVarUhShort();
            if (this.subAreaId < 0U)
            {
                throw new Exception("Forbidden value (" + (object)this.subAreaId + ") on element of MapComplementaryInformationsDataMessage.subAreaId.");
            }
            this.mapId = reader.ReadDouble();
            if (this.mapId < 0.0 || this.mapId > 9.00719925474099E+15)
            {
                throw new Exception("Forbidden value (" + (object)this.mapId + ") on element of MapComplementaryInformationsDataMessage.mapId.");
            }
            uint num1 = (uint)reader.ReadUShort();

            for (int index = 0; (long)index < (long)num1; ++index)
            {
                HouseInformations instance = ProtocolTypeManager.GetInstance <HouseInformations>((uint)reader.ReadUShort());
                instance.Deserialize(reader);
                this.houses.Add(instance);
            }
            uint num2 = (uint)reader.ReadUShort();

            for (int index = 0; (long)index < (long)num2; ++index)
            {
                GameRolePlayActorInformations instance = ProtocolTypeManager.GetInstance <GameRolePlayActorInformations>((uint)reader.ReadUShort());
                instance.Deserialize(reader);
                this.actors.Add(instance);
            }
            uint num3 = (uint)reader.ReadUShort();

            for (int index = 0; (long)index < (long)num3; ++index)
            {
                InteractiveElement instance = ProtocolTypeManager.GetInstance <InteractiveElement>((uint)reader.ReadUShort());
                instance.Deserialize(reader);
                this.interactiveElements.Add(instance);
            }
            uint num4 = (uint)reader.ReadUShort();

            for (int index = 0; (long)index < (long)num4; ++index)
            {
                StatedElement statedElement = new StatedElement();
                statedElement.Deserialize(reader);
                this.statedElements.Add(statedElement);
            }
            uint num5 = (uint)reader.ReadUShort();

            for (int index = 0; (long)index < (long)num5; ++index)
            {
                MapObstacle mapObstacle = new MapObstacle();
                mapObstacle.Deserialize(reader);
                this.obstacles.Add(mapObstacle);
            }
            uint num6 = (uint)reader.ReadUShort();

            for (int index = 0; (long)index < (long)num6; ++index)
            {
                FightCommonInformations commonInformations = new FightCommonInformations();
                commonInformations.Deserialize(reader);
                this.fights.Add(commonInformations);
            }
            this.hasAggressiveMonsters = reader.ReadBoolean();
            this.fightStartPositions   = new FightStartingPositions();
            this.fightStartPositions.Deserialize(reader);
        }
 public MapFightStartPositionsUpdateMessage(FightStartingPositions fightStartPositions, int mapId)
 {
     m_fightStartPositions = fightStartPositions;
     m_mapId = mapId;
 }