예제 #1
0
        private bool LoadFile(Stream stream, uint shopStart, uint shopCount, uint itemStart, uint itemCount, Util.Endianness endian, Util.Bitness bits)
        {
            ShopDefinitions = new List <ShopDefinition>((int)shopCount);
            ShopItems       = new List <ShopItem>((int)itemCount);

            for (int i = 0; i < shopCount; ++i)
            {
                stream.Position = shopStart + i * (28 + bits.NumberOfBytes());
                var shop = new ShopDefinition(stream, endian, bits);
                ShopDefinitions.Add(shop);
            }

            for (int i = 0; i < itemCount; ++i)
            {
                stream.Position = itemStart + i * 56;
                var item = new ShopItem(stream, endian);
                ShopItems.Add(item);
            }

            foreach (var shop in ShopDefinitions)
            {
                shop.ShopItems = ShopItems.Where(x => x.ShopID == shop.InGameID).ToArray();
            }

            ShopDictionary = new Dictionary <uint, ShopDefinition>();
            foreach (var shop in ShopDefinitions)
            {
                ShopDictionary.Add(shop.InGameID, shop);
            }

            return(true);
        }
예제 #2
0
        private bool LoadFile( Stream stream, uint shopStart, uint shopCount, uint itemStart, uint itemCount )
        {
            ShopDefinitions = new List<ShopDefinition>( (int)shopCount );
            ShopItems = new List<ShopItem>( (int)itemCount );

            for ( int i = 0; i < shopCount; ++i ) {
                stream.Position = shopStart + i * 32;
                var shop = new ShopDefinition( stream );
                ShopDefinitions.Add( shop );
            }

            for ( int i = 0; i < itemCount; ++i ) {
                stream.Position = itemStart + i * 56;
                var item = new ShopItem( stream );
                ShopItems.Add( item );
            }

            foreach ( var shop in ShopDefinitions ) {
                shop.ShopItems = ShopItems.Where( x => x.ShopID == shop.InGameID ).ToArray();
            }

            ShopDictionary = new Dictionary<uint, ShopDefinition>();
            foreach ( var shop in ShopDefinitions ) {
                ShopDictionary.Add( shop.InGameID, shop );
            }

            return true;
        }
예제 #3
0
        private bool LoadFile(Stream stream, uint shopStart, uint shopCount, uint itemStart, uint itemCount)
        {
            ShopDefinitions = new List <ShopDefinition>((int)shopCount);
            ShopItems       = new List <ShopItem>((int)itemCount);

            for (int i = 0; i < shopCount; ++i)
            {
                stream.Position = shopStart + i * 32;
                var shop = new ShopDefinition(stream);
                ShopDefinitions.Add(shop);
            }

            for (int i = 0; i < itemCount; ++i)
            {
                stream.Position = itemStart + i * 56;
                var item = new ShopItem(stream);
                ShopItems.Add(item);
            }

            foreach (var shop in ShopDefinitions)
            {
                shop.ShopItems = ShopItems.Where(x => x.ShopID == shop.InGameID).ToArray();
            }

            ShopDictionary = new Dictionary <uint, ShopDefinition>();
            foreach (var shop in ShopDefinitions)
            {
                ShopDictionary.Add(shop.InGameID, shop);
            }

            return(true);
        }