Exemplo n.º 1
0
        public static BangDataHeader Load(BangChunkReader <BangDataHeader> chunkReader, BangGameTarget target, BangGameType type)
        {
            BangDataHeader header = new BangDataHeader();

            chunkReader.ReadExpectedTag(0x4742);
            header.FileVersion        = chunkReader.ReadInt32();
            header.VersionInformation = header.FileVersion >= 25 ? chunkReader.ReadString() : "Unknown";

            var lenUnkArray = header.FileVersion >= 4 ? chunkReader.ReadInt32() : 0;

            header.UnkCArray = chunkReader.ReadASCIIString(lenUnkArray);

            if (header.FileVersion >= 23)
            {
                int unkLangId = chunkReader.ReadInt32(); // TODO: This is lang id --> would need to load lang xml files
                header.UnkStr = chunkReader.ReadString();
            }

            if (header.FileVersion >= 33)
            {
                header.IsMultiplayerSave = chunkReader.ReadBoolean();
            }

            chunkReader.Header            = header;
            chunkReader.Header.GameTarget = target;
            chunkReader.Header.GameType   = type;

            return(header);
        }
Exemplo n.º 2
0
        public static BangHomeCityPreservedCard Load(BangChunkReader <BangDataHeader> chunkReader)
        {
            BangHomeCityPreservedCard bangHomeCityPreservedCard = new BangHomeCityPreservedCard();

            chunkReader.ReadExpectedTag(0x6463);

            bangHomeCityPreservedCard.Version = chunkReader.ReadUInt32();
            bangHomeCityPreservedCard.Name    = chunkReader.ReadString();
            bangHomeCityPreservedCard.ID      = chunkReader.ReadInt32();

            return(bangHomeCityPreservedCard);
        }
Exemplo n.º 3
0
        public static BangHomeCityManager Load(BangChunkReader <BangDataHeader> chunkReader)
        {
            BangHomeCityManager bangHomeCityManager = new BangHomeCityManager();

            chunkReader.ReadExpectedTag(0x4853);

            bangHomeCityManager.Version   = chunkReader.ReadUInt32();
            bangHomeCityManager.UnkDword4 = chunkReader.ReadInt32();

            // Only in Age3
            if (chunkReader.Header.GameTarget == BangGameTarget.AgeOfEmpires3)
            {
                int numOfHomeCity = chunkReader.ReadInt32();

                for (int i = 0; i < numOfHomeCity; i++)
                {
                    bangHomeCityManager.HomeCities.Add(BangHomeCity.Load(chunkReader));
                }
            }

            return(bangHomeCityManager);
        }
Exemplo n.º 4
0
        public static BangHomeCityCard Load(BangChunkReader <BangDataHeader> chunkReader)
        {
            BangHomeCityCard bangHomeCityCard = new BangHomeCityCard();

            chunkReader.ReadExpectedTag(0x6463);

            bangHomeCityCard.Version  = chunkReader.ReadUInt32();
            bangHomeCityCard.TechID   = chunkReader.ReadInt32();
            bangHomeCityCard.MaxCount = chunkReader.ReadInt32();
            bangHomeCityCard.Tier     = chunkReader.ReadInt32();
            bangHomeCityCard.Level    = chunkReader.ReadInt32();

            if (bangHomeCityCard.Version > 3)
            {
                bangHomeCityCard.SPCAct = chunkReader.ReadInt32();
            }

            bangHomeCityCard.UnkDword1C   = chunkReader.ReadInt32();
            bangHomeCityCard.PreReqTechID = chunkReader.ReadInt32();
            bangHomeCityCard.UnkDword14   = chunkReader.ReadInt32();

            if (bangHomeCityCard.Version > 0)
            {
                bangHomeCityCard.DisplayUnitCount = chunkReader.ReadInt32();
            }

            if (bangHomeCityCard.Version > 1)
            {
                bangHomeCityCard.IsInfiniteInLastAge = chunkReader.ReadBoolean();
            }

            if (bangHomeCityCard.Version > 2)
            {
                bangHomeCityCard.IsRevolt = chunkReader.ReadBoolean();
            }

            return(bangHomeCityCard);
        }
Exemplo n.º 5
0
        public static BangHomeCityDeck Load(BangChunkReader <BangDataHeader> chunkReader)
        {
            BangHomeCityDeck bangHomeCityDeck = new BangHomeCityDeck();

            chunkReader.ReadExpectedTag(0x6B44);

            bangHomeCityDeck.Version = chunkReader.ReadUInt32();
            bangHomeCityDeck.ID      = chunkReader.ReadInt32();
            bangHomeCityDeck.Name    = chunkReader.ReadString();
            if (bangHomeCityDeck.Version > 2)
            {
                bangHomeCityDeck.GameID = chunkReader.ReadInt32();
            }

            if (bangHomeCityDeck.Version > 0)
            {
                bangHomeCityDeck.IsDefault = chunkReader.ReadBoolean();
            }

            int numOfUnkArray10 = chunkReader.ReadInt32();

            for (int i = 0; i < numOfUnkArray10; i++)
            {
                bangHomeCityDeck.TechIDs.Add(chunkReader.ReadInt32());
            }

            if (bangHomeCityDeck.Version > 1)
            {
                int numOfCards = chunkReader.ReadInt32();
                for (int i = 0; i < numOfCards; i++)
                {
                    bangHomeCityDeck.Cards.Add(BangHomeCityCard.Load(chunkReader));
                }
            }

            if (bangHomeCityDeck.Version > 3)
            {
                int numOfPreservedCards = chunkReader.ReadInt32();
                for (int i = 0; i < numOfPreservedCards; i++)
                {
                    bangHomeCityDeck.PreservedCards.Add(BangHomeCityPreservedCard.Load(chunkReader));
                }
            }


            return(bangHomeCityDeck);
        }
Exemplo n.º 6
0
        public static BangHomeCity Load(BangChunkReader <BangDataHeader> chunkReader)
        {
            BangHomeCity bangHomeCity = new BangHomeCity();

            chunkReader.ReadExpectedTag(0x4853);

            bangHomeCity.Version = chunkReader.ReadUInt32();

            bangHomeCity.CivName     = chunkReader.ReadString();
            bangHomeCity.DataLoc     = chunkReader.ReadEnum <BangHomeCityDataLocation>();
            bangHomeCity.Filename    = chunkReader.ReadString();
            bangHomeCity.Type        = chunkReader.ReadString();
            bangHomeCity.Description = chunkReader.ReadString();
            bangHomeCity.HeroName    = chunkReader.ReadString();

            if (bangHomeCity.Version >= 2)
            {
                int numOfUnk = chunkReader.ReadInt32();
                for (int i = 0; i < numOfUnk; i++)
                {
                    bangHomeCity.UnkStrList.Add(chunkReader.ReadString());
                }
            }

            bangHomeCity.HeroDogName = chunkReader.ReadString();
            bangHomeCity.ShipName    = chunkReader.ReadString();
            bangHomeCity.ID          = chunkReader.ReadString();

            bangHomeCity.UnkByte4    = chunkReader.ReadBoolean();
            bangHomeCity.Level       = chunkReader.ReadInt32();
            bangHomeCity.NumberShips = chunkReader.ReadInt32();
            bangHomeCity.UnkDword1E4 = chunkReader.ReadInt32();
            bangHomeCity.UnkHomeCityFactorRelated = chunkReader.ReadFloat();
            bangHomeCity.NumPropUnlocksEarned     = chunkReader.ReadInt32();

            int numOfDecks = chunkReader.ReadInt32();

            for (int i = 0; i < numOfDecks; i++)
            {
                bangHomeCity.Decks.Add(BangHomeCityDeck.Load(chunkReader));
            }

            int numOfPreservedCards = chunkReader.ReadInt32();

            for (int i = 0; i < numOfPreservedCards; i++)
            {
                bangHomeCity.PreservedCards.Add(BangHomeCityPreservedCard.Load(chunkReader));
            }

            int numOfTechs = chunkReader.ReadInt32();

            for (int i = 0; i < numOfTechs; i++)
            {
                bangHomeCity.TechNames.Add(chunkReader.ReadString());
            }

            bangHomeCity.PreservedCards.Clear(); // ???
            numOfPreservedCards = chunkReader.ReadInt32();
            for (int i = 0; i < numOfPreservedCards; i++)
            {
                bangHomeCity.PreservedCards.Add(BangHomeCityPreservedCard.Load(chunkReader));
            }



            return(bangHomeCity);
        }