Esempio n. 1
0
        /// <summary>
        /// Encodes in the specified stream.
        /// </summary>
        /// <param name="Stream">The stream.</param>
        public virtual void Encode(ChecksumEncoder Stream)
        {
            Stream.WriteLogicLong(this.HighId, this.LowId);
            Stream.WriteLogicLong(this.SenderHighId, this.SenderLowId);
            Stream.WriteLogicLong(this.SenderHighId, this.SenderLowId); // HomeID

            Stream.WriteString(this.SenderName);

            Stream.WriteVInt(this.SenderExpLevel);
            Stream.WriteVInt(this.SenderRole);
            Stream.WriteVInt(this.AgeSeconds);

            Stream.WriteBoolean(this.Removed);
        }
Esempio n. 2
0
        /// <summary>
        /// Encodes this instance.
        /// </summary>
        public void Encode(ChecksumEncoder Stream, Player Player)
        {
            Stream.EncodeLogicData(this.LocationData, 15);
            Stream.WriteVInt(this.PlayerCount);
            Stream.EncodeLogicData(this.NpcData, 48);
            Stream.EncodeLogicData(this.ArenaData, 54);

            for (int I = 0; I < this.PlayerCount; I++)
            {
                Stream.WriteLogicLong(this.Players[I].HighId, this.Players[I].LowId);
                Stream.WriteVInt(0);
            }

            Stream.EncodeConstantSizeIntArray(new int[8], 8);
            {
                Stream.WriteVInt(1);
                Stream.WriteVInt(1);
                Stream.WriteVInt(0);
                Stream.WriteVInt(0);

                Stream.WriteVInt(7); // EncodeLogicData (type=72)
                Stream.WriteVInt(0); // EncodeLogicData (type=79)
                Stream.WriteVInt(0); // EncodeLogicData (type=81)
            }

            Stream.WriteBoolean(this.EndedCalled);
            Stream.WriteBoolean(this.EndedWithTimeOut);
            Stream.WriteBoolean(false); // ?
            Stream.WriteBoolean(false); // hasPlayerFinishedNpcLevel
            Stream.WriteBoolean(this.InOvertime);
            Stream.WriteBoolean(false); // Live

            Stream.WriteVInt(this.Type);

            Stream.WriteVInt(0);
            Stream.WriteVInt(0);
            {
                // LogicGameObjectManager::encode().
                Stream.AddRange("00-B9-03-C7-7C-00-00-06-7A".HexaToBytes());

                Stream.WriteVInt(6);                                                      // Count

                Stream.EncodeData(CsvFiles.Get(Gamefile.Buildings).GetWithInstanceId(1)); // PrincessTower
                Stream.EncodeData(CsvFiles.Get(Gamefile.Buildings).GetWithInstanceId(1)); // PrincessTower
                Stream.EncodeData(CsvFiles.Get(Gamefile.Buildings).GetWithInstanceId(1)); // PrincessTower
                Stream.EncodeData(CsvFiles.Get(Gamefile.Buildings).GetWithInstanceId(1)); // PrincessTower
                Stream.EncodeData(CsvFiles.Get(Gamefile.Buildings).GetWithInstanceId(0)); // KingTower
                Stream.EncodeData(CsvFiles.Get(Gamefile.Buildings).GetWithInstanceId(0)); // KingTower

                // Type (Enemy, etc...)
                Stream.WriteVInt(1);
                Stream.WriteVInt(0);
                Stream.WriteVInt(1);
                Stream.WriteVInt(0);
                Stream.WriteVInt(0);
                Stream.WriteVInt(1);

                // ID (Like 500xxxxxx for CoC)
                Stream.AddRange("05-00".HexaToBytes());
                Stream.AddRange("05-01".HexaToBytes());
                Stream.AddRange("05-02".HexaToBytes());
                Stream.AddRange("05-03".HexaToBytes());
                Stream.AddRange("05-04".HexaToBytes());
                Stream.AddRange("05-05".HexaToBytes());

                // LogicGameObject::encode(): vInt, Vector2, vInt
                // GameObjectType:
                // 0: LogicDeco
                // 1: LogicSpawnPoint
                // 2: LogicAreaEffectObject
                // 3: LogicProjectile
                // 4: LogicCharacter
                Stream.AddRange("00-0D-A4-E2-01-9C-8E-03-00-00-7F-00-C0-7C-00-00-02-00-00-00-00-00".HexaToBytes()); // LogicCharacter::encode
                Stream.AddRange("00-0D-AC-36-A4-65-00-00-7F-00-80-04-00-00-01-00-00-00-00-00".HexaToBytes());       // LogicCharacter::encode
                Stream.AddRange("00-0D-AC-36-9C-8E-03-00-00-7F-00-C0-7C-00-00-01-00-00-00-00-00".HexaToBytes());    // LogicCharacter::encode
                Stream.AddRange("00-0D-A4-E2-01-A4-65-00-00-7F-00-80-04-00-00-02-00-00-00-00-00".HexaToBytes());    // LogicCharacter::encode

                if (this.Players[1] == Player)
                {
                    Stream.AddRange("00-0D-A8-8C-01-B8-2E-00-00-7F-00-80-04-00-00-00-00-00-00-00-00".HexaToBytes());       // LogicCharacter::encode
                    Stream.AddRange("0C-00-00-A0-9A-0C-00-00-00-00-00-7F-7F-7F-7F-7F-7F-7F-7F-00-00-00-00".HexaToBytes()); // LogicSummoner::encode

                    // LogicSummoner::encode
                    Stream.AddRange("00-0D-A8-8C-01-88-C5-03-00-00-7F-00-C0-7C-00-00-00-00-00-00-00-00".HexaToBytes()); // LogicCharacter::encode

                    Stream.WriteBoolean(true);                                                                          // HAS DECK
                    Stream.WriteBoolean(false);                                                                         // ?
                    Stream.WriteBoolean(true);                                                                          // AI ENABLED ?

                    if (true)
                    {
                        // If HAS DECK
                        Stream.WriteVInt(4);
                        {
                            // ByteStreamHelper::writeConstantSizeIntArray(4)
                            Stream.WriteVInt(6);
                            Stream.WriteVInt(-1);
                            Stream.WriteVInt(-4);
                            Stream.WriteVInt(-1);
                        }

                        Stream.WriteVInt(4);
                        {
                            // Count
                            Stream.WriteVInt(3);
                            Stream.WriteVInt(4);
                            Stream.WriteVInt(2);
                            Stream.WriteVInt(7);
                        }

                        Stream.WriteVInt(0);
                        {
                            // Same, Is Count
                        }

                        Stream.WriteVInt(-1);
                        Stream.WriteVInt(-1);
                        Stream.WriteVInt(0);

                        if (Globals.QuestsEnabled)
                        {
                            Stream.WriteVInt(0); // Count

                            // LogicQuestManager::encode()
                        }
                    }

                    Stream.WriteVInt(0);
                    Stream.WriteVInt(0); // MsBeforeStartRegenMana
                    Stream.WriteVInt(5); // Mana
                    Stream.WriteVInt(0);
                    Stream.WriteVInt(0);
                    Stream.WriteVInt(0);
                    {
                        // LogicSpellAIBlackboard::encode
                        Stream.WriteVInt(0);
                        Stream.WriteVInt(0);
                    }

                    for (int I = 0; I < 8; I++)
                    {
                        Stream.WriteVInt(-1);
                    }

                    Stream.WriteBoolean(false);
                    {
                        // ?
                    }

                    Stream.WriteVInt(0);
                    Stream.WriteVInt(0);
                    Stream.WriteVInt(0);
                }
                else
                {
                    Stream.AddRange("00-0D-A8-8C-01-B8-2E-00-00-7F-00-80-04-00-00-00-00-00-00-00-00".HexaToBytes()); // LogicCharacter::encode

                    Stream.WriteBoolean(true);                                                                       // HAS DECK
                    Stream.WriteBoolean(false);                                                                      // ?
                    Stream.WriteBoolean(true);                                                                       // AI ENABLED ?

                    if (true)
                    {
                        // If HAS DECK
                        Stream.WriteVInt(4);
                        {
                            // ByteStreamHelper::writeConstantSizeIntArray(4)
                            Stream.WriteVInt(6);  // 6 = SpellDeck[6]
                            Stream.WriteVInt(-1); // 6 - 1 = SpellDeck[6 - 1]
                            Stream.WriteVInt(-4); // 6 - 1 - 4 = SpellDeck[6 - 1 - 4]
                            Stream.WriteVInt(-1); // 6 - 1 - 4 - 1 =  = SpellDeck[6 - 1 - 4 - 1]
                        }

                        Stream.WriteVInt(4);
                        {
                            // Spell Queue Count
                            Stream.WriteVInt(3);
                            Stream.WriteVInt(4);
                            Stream.WriteVInt(2);
                            Stream.WriteVInt(7);
                        }

                        Stream.WriteVInt(0);
                        {
                            // Spell Queue 2 Count
                        }

                        Stream.WriteVInt(-1);
                        Stream.WriteVInt(-1);
                        Stream.WriteVInt(0);

                        if (Globals.QuestsEnabled)
                        {
                            Stream.WriteVInt(0); // Count

                            // LogicQuestManager::encode()
                        }
                    }

                    Stream.WriteVInt(0);
                    Stream.WriteVInt(0); // MsBeforeStartRegenMana
                    Stream.WriteVInt(5); // Mana
                    Stream.WriteVInt(0);
                    Stream.WriteVInt(0);
                    Stream.WriteVInt(0);
                    {
                        // LogicSpellAIBlackboard::encode
                        Stream.WriteVInt(0);
                        Stream.WriteVInt(0);
                    }

                    for (int I = 0; I < 8; I++)
                    {
                        Stream.WriteVInt(-1);
                    }

                    Stream.WriteBoolean(false);
                    {
                        // ?
                    }

                    Stream.WriteVInt(0);
                    Stream.WriteVInt(0);
                    Stream.WriteVInt(0);

                    Stream.AddRange("00-0D-A8-8C-01-88-C5-03-00-00-7F-00-C0-7C-00-00-00-00-00-00-00-00".HexaToBytes());    // LogicCharacter::encode
                    Stream.AddRange("0C-00-00-A0-9A-0C-00-00-00-00-00-7F-7F-7F-7F-7F-7F-7F-7F-00-00-00-00".HexaToBytes()); // LogicSummoner::encode
                }

                // -- COMPONENT --
                Stream.AddRange("00-00-00-00-00-00-00-00".HexaToBytes());
                Stream.AddRange("00-00-00-00-00-00-00-00".HexaToBytes());
                Stream.AddRange("00-00-00-00-00-00-00-00".HexaToBytes());
                Stream.AddRange("00-00-00-00-00-00-00-00".HexaToBytes());
                Stream.AddRange("00-00-00-00-00-00-00-00".HexaToBytes());
                Stream.AddRange("00-00-00-00-00-00-00-00".HexaToBytes());

                // LogicHitpointComponent
                Stream.AddRange("B8-15-00".HexaToBytes());
                Stream.AddRange("B8-15-00".HexaToBytes());
                Stream.AddRange("B8-15-00".HexaToBytes());
                Stream.AddRange("B8-15-00".HexaToBytes());
                Stream.AddRange("A0-25-00".HexaToBytes());
                Stream.AddRange("A0-25-00".HexaToBytes());

                // LogicCharacterBuffComponent
                Stream.AddRange("00-00-00-00-00-00-00-A4-01-A4-01-00".HexaToBytes());
                Stream.AddRange("00-00-00-00-00-00-00-A4-01-A4-01-00".HexaToBytes());
                Stream.AddRange("00-00-00-00-00-00-00-A4-01-A4-01-00".HexaToBytes());
                Stream.AddRange("00-00-00-00-00-00-00-A4-01-A4-01-00".HexaToBytes());
                Stream.AddRange("00-00-00-00-00-00-00-A4-01-A4-01-00".HexaToBytes());
                Stream.AddRange("00-00-00-00-00-00-00-A4-01-A4-01-00".HexaToBytes());
            }

            for (int I = 0; I < 2; I++)
            {
                if (this.Players[I] == Player)
                {
                    Stream.WriteBoolean(true);
                    this.Decks[I].EncodeAttack(Stream);
                    break;
                }

                Stream.WriteBoolean(false);
            }

            Stream.AddRange("00-00-05-06-02-02-04-02-01-03-00-00-00-00-00-00-00-00".HexaToBytes());
        }
Esempio n. 3
0
        /// <summary>
        /// Encodes in the specified stream.
        /// </summary>
        /// <param name="Stream">The stream.</param>
        /// <param name="BattleEncode">if set to <c>true</c> [battle encode].</param>
        public void Encode(ChecksumEncoder Stream, bool BattleEncode = false)
        {
            Stream.WriteLogicLong(this.HighId, this.LowId); // Avatar
            Stream.WriteLogicLong(this.HighId, this.LowId); // Account
            Stream.WriteLogicLong(this.HighId, this.LowId); // Home

            Stream.WriteString(this.Name);

            if (!BattleEncode)
            {
                Stream.WriteVInt(this.NameChangeState);
            }

            Stream.EncodeLogicData(this.Arena, 54);
            Stream.WriteVInt(this.Score);
            Stream.WriteVInt(0);
            Stream.WriteVInt(this.MaxScore);

            if (!BattleEncode)
            {
                Stream.WriteVInt(0);
            }

            Stream.WriteVInt(0);
            Stream.WriteVInt(0);
            Stream.WriteVInt(0);
            Stream.WriteVInt(0);
            Stream.WriteVInt(0);

            Stream.WriteVInt(0); // 0x26

            Stream.WriteVInt(0);
            Stream.WriteVInt(0);
            Stream.WriteVInt(0);
            Stream.WriteVInt(0);
            Stream.WriteVInt(0);

            this.CommoditySlots.Encode(Stream);

            if (!BattleEncode)
            {
                Stream.WriteVInt(this.Diamonds);
                Stream.WriteVInt(this.FreeDiamonds);
                Stream.WriteVInt(this.ExpPoints);
                Stream.WriteVInt(this.ExpLevel);
                Stream.WriteVInt(0);



                Stream.WriteBoolean(this.IsNameSet);
                Stream.WriteBoolean(false); // ?
            }
            else
            {
                Stream.WriteVInt(this.ExpLevel);
            }

            Stream.WriteBoolean(false); // ?
            Stream.WriteBoolean(this.IsInAlliance);

            if (this.IsInAlliance)
            {
                Stream.WriteLogicLong(this.ClanHighId, this.ClanLowId);
                Stream.WriteString(this.AllianceName);
                Stream.EncodeLogicData(this.Badge, 16);

                if (!BattleEncode)
                {
                    Stream.WriteVInt(this.AllianceRole);
                }
            }

            Stream.WriteVInt(0);
            Stream.WriteVInt(0);
            Stream.WriteVInt(0);
            Stream.WriteVInt(0);
            Stream.WriteVInt(0);

            Stream.WriteBool(false);

            Stream.WriteVInt(7); // Training Step
            Stream.WriteVInt(1); // 0x00 = Training || bool (?)
            Stream.WriteVInt(0);
            Stream.WriteVInt(0);
            Stream.WriteVInt(1); // bool (?)
            Stream.WriteVInt(0);
        }