コード例 #1
0
        //returns the inventory item as a set of 10 bytes for reinserting into raw data
        public List <Byte> recompile(itemHandler handler)
        {
            List <Byte> final          = new List <Byte> {
            };
            List <int> encodedItem     = handler.encodeData(buff.ID);
            List <int> encodedDuration = handler.encodeData(duration);

            //bytes 2, 3, 6, 7 and 9 seem to make the item dissapear if they are anything other than 0x00
            final.Add((byte)encodedItem[0]);
            final.Add((byte)encodedItem[1]);
            final.Add(0x00);
            final.Add(0x00);
            final.Add((byte)encodedDuration[0]);
            final.Add((byte)encodedDuration[1]);
            final.Add(0x00);
            final.Add(0x00);
            return(final);
        }
コード例 #2
0
        //returns the inventory item as a set of 10 bytes for reinserting into raw data
        public List <Byte> recompile(itemHandler handler)
        {
            List <Byte> final       = new List <Byte> {
            };
            List <int> encodedItem  = handler.encodeData(item.ID);
            List <int> encodedQuant = handler.encodeData(quantity);

            //bytes 2, 3, 6, 7 and 9 seem to make the item dissapear if they are anything other than 0x00
            final.Add((byte)encodedItem[0]);
            final.Add((byte)encodedItem[1]);
            final.Add(0x00);
            final.Add(0x00);
            final.Add((byte)encodedQuant[0]);
            final.Add((byte)encodedQuant[1]);
            final.Add(0x00);
            final.Add(0x00);
            final.Add((byte)prefix.ID);
            final.Add(0x00);
            return(final);
        }
コード例 #3
0
        //returns the inventory item as a set of 10 bytes for reinserting into raw data
        public List <Byte> recompile(itemHandler handler, encodeMethod e)
        {
            List <Byte> final       = new List <Byte> {
            };
            List <int> encodedItem  = handler.encodeData(item.ID);
            List <int> encodedQuant = handler.encodeData(quantity);

            //bytes 2, 3, 6, 7 and 9 seem to make the item dissapear if they are anything other than 0x00
            final.Add((byte)encodedItem[0]);
            final.Add((byte)encodedItem[1]);
            final.Add(0x00);
            final.Add(0x00);
            final.Add((byte)encodedQuant[0]);
            final.Add((byte)encodedQuant[1]);
            final.Add(0x00);
            final.Add(0x00);
            final.Add((byte)prefix.ID);
            if (e == encodeMethod.Long)
            {
                final.Add((byte)(isFavorite == true ? 0x01 : 0x00));
            }

            return(final);
        }
コード例 #4
0
ファイル: entry.cs プロジェクト: thepleon/WinTerrEdit
        public List <Byte> reEncode()
        {
            //i hate this method so much

            List <Byte> buffer = new List <Byte> {
            };
            List <Byte> save   = rawDecrypted;

            foreach (invItem iv in inventory)
            {
                List <Byte> tmp = iv.recompile(ih);
                buffer.AddRange(tmp);
            }

            foreach (Color c in playerColours)
            {
                buffer.AddRange(new List <Byte> {
                    c.R, c.G, c.B
                });
            }

            buffer.Add((byte)ih.encodeData(playerHealth[0])[0]);
            buffer.Add((byte)ih.encodeData(playerHealth[0])[1]);
            buffer.Add(0x00);
            buffer.Add(0x00);
            buffer.Add((byte)ih.encodeData(playerHealth[1])[0]);
            buffer.Add((byte)ih.encodeData(playerHealth[1])[1]);
            buffer.Add(0x00);
            buffer.Add(0x00);
            buffer.Add((byte)ih.encodeData(playerMana[0])[0]);
            buffer.Add((byte)ih.encodeData(playerMana[0])[1]);
            buffer.Add(0x00);
            buffer.Add(0x00);
            buffer.Add((byte)ih.encodeData(playerMana[1])[0]);
            buffer.Add((byte)ih.encodeData(playerMana[1])[1]);
            buffer.Add(0x00);
            buffer.Add(0x00);

            int dataBeginOffset = nameEndOffset + inventoryOffset;
            int dataEndOffset   = dataBeginOffset + 500;
            int extCount        = 0;

            for (int i = dataBeginOffset; i < dataEndOffset; i++)
            {
                save[i] = buffer[extCount];
                extCount++;
            }

            int CoinDataBeginOffset = nameEndOffset + coinOffset;
            int CoinDataEndOffset   = CoinDataBeginOffset + 80;

            for (int i = CoinDataBeginOffset; i < CoinDataEndOffset; i++)
            {
                save[i] = buffer[extCount];
                extCount++;
            }

            int ColourDataBeginOffset = nameEndOffset + 40;
            int ColourDataEndOffset   = ColourDataBeginOffset + 21;

            for (int i = ColourDataBeginOffset; i < ColourDataEndOffset; i++)
            {
                save[i] = buffer[extCount];
                extCount++;
            }

            int HealthDataBeginOffset = nameEndOffset + 18;
            int HealthDataEndOffset   = HealthDataBeginOffset + 8;

            for (int i = HealthDataBeginOffset; i < HealthDataEndOffset; i++)
            {
                save[i] = buffer[extCount];
                extCount++;
            }

            int ManaDataBeginOffset = nameEndOffset + 26;
            int ManaDataEndOffset   = ManaDataBeginOffset + 8;

            for (int i = ManaDataBeginOffset; i < ManaDataEndOffset; i++)
            {
                save[i] = buffer[extCount];
                extCount++;
            }

            //insert padding if needed
            while (save.Count() % 16 != 0)
            {
                save.Add(0);
            }

            return(save);
        }
コード例 #5
0
ファイル: entry.cs プロジェクト: Damian109/WinTerrEdit
        public List <Byte> reEncode()
        {
            List <Byte> buffer = new List <Byte> {
            };
            List <Byte> save   = rawDecrypted;

            foreach (invItem iv in inventory)
            {
                List <Byte> tmp = iv.recompile(ih);
                foreach (byte b in tmp)
                {
                    buffer.Add(b);
                }
            }

            foreach (Color c in playerColours)
            {
                List <int> tmpCol = new List <int> {
                };
                tmpCol.Add(c.R);
                tmpCol.Add(c.G);
                tmpCol.Add(c.B);
                foreach (int i in tmpCol)
                {
                    buffer.Add((byte)i);
                }
            }

            buffer.Add((byte)ih.encodeData(playerHealth[0])[0]);
            buffer.Add((byte)ih.encodeData(playerHealth[0])[1]);
            buffer.Add(0x00);
            buffer.Add(0x00);
            buffer.Add((byte)ih.encodeData(playerHealth[1])[0]);
            buffer.Add((byte)ih.encodeData(playerHealth[1])[1]);
            buffer.Add(0x00);
            buffer.Add(0x00);
            buffer.Add((byte)ih.encodeData(playerMana[0])[0]);
            buffer.Add((byte)ih.encodeData(playerMana[0])[1]);
            buffer.Add(0x00);
            buffer.Add(0x00);
            buffer.Add((byte)ih.encodeData(playerMana[1])[0]);
            buffer.Add((byte)ih.encodeData(playerMana[1])[1]);
            buffer.Add(0x00);
            buffer.Add(0x00);

            int dataBeginOffset = nameEndOffset + inventoryOffset;
            int dataEndOffset   = dataBeginOffset + 500;
            int extCount        = 0;

            Console.WriteLine(buffer.Count());

            for (int i = dataBeginOffset; i < dataEndOffset; i++)
            {
                save[i] = buffer[extCount];
                extCount++;
            }

            int ColourDataBeginOffset = nameEndOffset + 40;
            int ColourDataEndOffset   = ColourDataBeginOffset + 21;

            for (int i = ColourDataBeginOffset; i < ColourDataEndOffset; i++)
            {
                save[i] = buffer[extCount];
                extCount++;
            }

            int HealthDataBeginOffset = nameEndOffset + 18;
            int HealthDataEndOffset   = HealthDataBeginOffset + 8;

            for (int i = HealthDataBeginOffset; i < HealthDataEndOffset; i++)
            {
                save[i] = buffer[extCount];
                extCount++;
            }

            int ManaDataBeginOffset = nameEndOffset + 26;
            int ManaDataEndOffset   = ManaDataBeginOffset + 8;

            for (int i = ManaDataBeginOffset; i < ManaDataEndOffset; i++)
            {
                save[i] = buffer[extCount];
                extCount++;
            }

            int unlockAllBeginOffser = nameEndOffset + 2557;

            save.InsertRange(unlockAllBeginOffser, unlockAllData);

            //insert padding if needed
            while (save.Count() % 16 != 0)
            {
                save.Add(0);
            }

            return(save);
        }