Example #1
0
        public void Load(BinaryReader reader)
        {
            this.Id                 = reader.ReadInt32();
            this.IsDungeon          = reader.ReadBoolean();
            this.DungeonId          = reader.ReadInt32();
            this.Area               = reader.ReadString();
            this.IsRoomTransition   = reader.ReadBoolean();
            this.RoomFlags          = (RoomFlags)reader.ReadInt32();
            this.DifficultyModifier = reader.ReadSingle();
            this.X = reader.ReadInt32();
            this.Y = reader.ReadInt32();
            this.VariationIndex   = reader.ReadInt32();
            this.SpawnIndex       = reader.ReadInt32();
            this.TemplateId       = reader.ReadInt32();
            this.PlayerEntersLeft = reader.ReadBoolean();
            int count = reader.ReadInt32();

            LeftDoors = new Dictionary <int, LinkDefinition>(count);
            for (int i = 0; i < count; i++)
            {
                int            key   = reader.ReadInt32();
                LinkDefinition value = default(LinkDefinition);
                value.Load(reader);
                this.LeftDoors.Add(key, value);
            }
            count      = reader.ReadInt32();
            RightDoors = new Dictionary <int, LinkDefinition>(count);
            for (int j = 0; j < count; j++)
            {
                int            key   = reader.ReadInt32();
                LinkDefinition value = default(LinkDefinition);
                value.Load(reader);
                this.RightDoors.Add(key, value);
            }
            count       = reader.ReadInt32();
            CustomDoors = new Dictionary <int, LinkDefinition>(count);
            for (int k = 0; k < count; k++)
            {
                int            key   = reader.ReadInt32();
                LinkDefinition value = default(LinkDefinition);
                value.Load(reader);
                this.CustomDoors.Add(key, value);
            }
            count     = reader.ReadInt32();
            EnemyInfo = new List <EnemyInfo>(count);
            for (int l = 0; l < count; l++)
            {
                EnemyInfo item = default(EnemyInfo);
                item.Load(reader);
                this.EnemyInfo.Add(item);
            }
            count       = reader.ReadInt32();
            RandomProps = new List <PropData>(count);
            for (int m = 0; m < count; m++)
            {
                string fullName  = reader.ReadString();
                string localName = fullName.IndexOf("ComboLock", StringComparison.OrdinalIgnoreCase) > -1
                    ? "ComboLockHint"
                    : fullName.Substring(fullName.LastIndexOf(".", StringComparison.OrdinalIgnoreCase) + 1);
                Type        type        = Type.GetType("ChasmDeserializer.Model.SaveGameData.WorldState.Saveable." + localName);
                GenericProp genericProp = Activator.CreateInstance(type) as GenericProp;
                this.RandomProps.Add(new PropData(fullName, genericProp));
                ISaveGame saveGame = genericProp as ISaveGame;
                saveGame.LoadGame(reader);
            }
            count           = reader.ReadInt32();
            AreaConnections = new List <AreaConnectionDef>(count);
            for (int n = 0; n < count; n++)
            {
                this.AreaConnections.Add(AreaConnectionDef.Load(reader));
            }
            this.IsDark      = reader.ReadBoolean();
            this.IsBacktrack = reader.ReadBoolean();
            count            = reader.ReadInt32();
            LocalVaribles    = new Dictionary <string, string>(count);
            for (int num4 = 0; num4 < count; num4++)
            {
                string key   = reader.ReadString();
                string value = reader.ReadString();
                this.LocalVaribles.Add(key, value);
            }
            this.IsHub     = reader.ReadBoolean();
            count          = reader.ReadInt32();
            IdTranslations = new List <KeyValuePair <int, int> >(count);
            for (int num6 = 0; num6 < count; num6++)
            {
                int key   = reader.ReadInt32();
                int value = reader.ReadInt32();
                this.IdTranslations.Add(new KeyValuePair <int, int>(key, value));
            }
        }