Ejemplo n.º 1
0
        internal virtual void Encode(ByteWriter Packet)
        {
            Packet.AddLong(this.HighId, this.LowId);

            Packet.AddBoolean(this.SenderLowId > 0);
            Packet.AddBoolean(this.SenderLowId > 0); // Home
            Packet.AddBoolean(false);                // ?

            if (this.SenderLowId > 0)
            {
                Packet.AddLong(this.SenderHighId, this.SenderLowId);
            }

            if (this.SenderLowId > 0)
            {
                Packet.AddLong(this.SenderHighId, this.SenderLowId); // Home
            }

            Packet.AddString(this.SenderName);

            Packet.AddInt(this.SenderLevel);
            Packet.AddInt(this.SenderLeague);
            Packet.AddInt((int)this.SenderRole);

            Packet.AddInt(this.Age);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Encodes this command.
        /// </summary>
        /// <param name="reader"></param>
        internal override void Encode(ByteWriter writer)
        {
            writer.AddInt(this.X);
            writer.AddInt(this.Y);
            writer.AddInt(this.Id);

            base.Encode(writer);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Encodes this instance.
        /// </summary>
        internal override void Encode(ByteWriter Packet)
        {
            Packet.AddLong(this.AllianceID);
            Packet.AddString(this.AllianceName);
            Packet.AddInt(this.AllianceBadge);
            Packet.AddBoolean(this.CreateAlliance);
            Packet.AddInt(this.AllianceLevel);

            base.Encode(Packet);
        }
Ejemplo n.º 4
0
        internal void Encode(ByteWriter Packet)
        {
            Packet.AddInt(0);
            Packet.AddInt(this.Score);

            Packet.AddInt(this.Type);

            Packet.AddString(this.Name);

            for (int i = 0; i < 5; i++)
            {
                Packet.AddInt(this.Loot.Resources[i].Count);
            }

            Packet.AddInt(0);

            Packet.AddBoolean(false);

            Packet.AddInt(0);
            Packet.AddInt(0);
            Packet.AddInt(0);

            Packet.AddString(this.Note);

            Packet.AddInt(0);
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Encodes this instance.
        /// </summary>
        internal void Encode(ByteWriter Packet)
        {
            for (int i = 0; i < this.MapRegions.Count; i++)
            {
                this.MapRegions[i].Encode(Packet);
            }

            for (int i = 0; i < this.Sectors.Count; i++)
            {
                this.Sectors[i].Encode(Packet);
            }


            Packet.AddInt(this.ExplorationRegionId);
            Packet.AddBoolean(this.ExplorationInProgress);
            Packet.AddInt(this.ExplorationCounter);

            Packet.AddInt(this.Frags);
            Packet.AddInt(this.Outposts);

            Packet.AddInt(this.MissionTile);
            Packet.AddInt(this.MissionIndex);

            Packet.AddInt(this.MissionCompletedAt);
            Packet.AddInt(this.MissionTotalLength);
            Packet.AddInt(this.MissionLeft);

            Packet.AddBoolean(this.DeepseaUpgrading);
        }
        /// <summary>
        /// Encodes this command.
        /// </summary>
        /// <param name="writer">The byte stream.</param>
        internal override void Encode(ByteWriter writer)
        {
            writer.AddInt(this.X);
            writer.AddInt(this.Y);
            writer.AddData(this.Data);
            writer.AddBoolean(this.Instant);

            writer.AddInt(0);

            base.Encode(writer);
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Encodes this instance.
        /// </summary>
        internal void Encode(ByteWriter Packet)
        {
            Packet.AddInt(this.HighID);
            Packet.AddInt(this.LowID);

            Packet.AddInt(0); // Shield
            Packet.AddInt(0); // Guard
            Packet.AddInt(365 * 86400);

            Packet.AddCompressableString(this.HomeJSON.ToString());
            Packet.AddCompressableString("{}");
            Packet.AddCompressableString("{}");
        }
        /// <summary>
        /// Encodes this instance.
        /// </summary>
        internal override void Encode(ByteWriter Packet)
        {
            Packet.AddBoolean(this.AlliangeGift);

            Packet.AddInt(this.Count);
            Packet.AddData(this.BillingPackageData);
            Packet.AddData(this.GemBundleData);
            Packet.AddInt(this.AlliangeGift ? 1 : 0);

            Packet.AddString(null); // TransactionID

            base.Encode(Packet);
        }
Ejemplo n.º 9
0
        internal void Encode(ByteWriter Packet)
        {
            this.Header.Encode(Packet);

            Packet.AddString(this.Description);
            Packet.AddInt(0);
            Packet.AddBoolean(false);
            Packet.AddInt(0);
            Packet.AddBoolean(false);

            this.Members.Encode(Packet);

            Packet.AddInt(0);
            Packet.AddInt(52);
        }
        /// <summary>
        /// Encodes this instance.
        /// </summary>
        internal override void Encode(ByteWriter Packet)
        {
            Packet.AddLong(this.AllianceID);
            Packet.AddInt(this.AllianceBadge);

            base.Encode(Packet);
        }
        /// <summary>
        /// Encodes this instance.
        /// </summary>
        internal override void Encode(ByteWriter Packet)
        {
            Packet.AddString(this.AvatarName);
            Packet.AddInt(this.ChangeNameCount);

            base.Encode(Packet);
        }
Ejemplo n.º 12
0
        internal override void Encode(ByteWriter Packet)
        {
            base.Encode(Packet);

            Packet.AddInt((int)this.Event);
            Packet.AddLong(this.ExecuterHighId, this.ExecuterLowId);
            Packet.AddString(this.ExecuterName);
        }
Ejemplo n.º 13
0
        internal static void AddCompressedString(this ByteWriter Writer, string Value)
        {
            byte[] Data = ZlibStream.CompressString(Value);

            Writer.AddInt(Data.Length + 4);
            Writer.AddIntEndian(Value.Length);
            Writer.AddRange(Data);
        }
Ejemplo n.º 14
0
        internal void Encode(ByteWriter Packet)
        {
            Packet.AddInt(this.Count);

            this.ForEach(Item =>
            {
                Item.Encode(Packet);
            });
        }
Ejemplo n.º 15
0
        internal void Encode(ByteWriter Packet)
        {
            Member[] Items = this.Slots.Values.ToArray();

            Packet.AddInt(Items.Length);

            for (int i = 0; i < Items.Length; i++)
            {
                Items[i].Encode(Packet);
            }
        }
Ejemplo n.º 16
0
        /// <summary>
        /// Encodes this instance.
        /// </summary>
        internal void Encode(ByteWriter Packet)
        {
            int Count = this.Count;

            Packet.AddInt(Count);

            for (int i = 0; i < Count; i++)
            {
                this[i].Encode(Packet);
            }
        }
Ejemplo n.º 17
0
        /// <summary>
        /// Encodes this instance.
        /// </summary>
        internal void Encode(ByteWriter Packet)
        {
            T[] Items = this.Values.ToArray();
            int Count = Items.Length;

            Packet.AddInt(Count);

            if (Count > 0)
            {
                for (int i = 0; i < Count; i++)
                {
                    Items[i].Encode(Packet);
                }
            }
        }
Ejemplo n.º 18
0
        internal static void AddCompressableString(this ByteWriter Writer, string Value)
        {
            if (Value != null)
            {
                int length = Value.Length;

                if (length > 50)
                {
                    Writer.AddBoolean(true);
                    Writer.AddCompressedString(Value);
                }
                else
                {
                    Writer.AddBoolean(false);
                    Writer.AddString(Value);
                }
            }
            else
            {
                Writer.AddBoolean(false);
                Writer.AddInt(-1);
            }
        }
Ejemplo n.º 19
0
        /// <summary>
        /// Encodes this instance.
        /// </summary>
        internal void Encode(ByteWriter Packet)
        {
            Packet.AddLong(this.HighID, this.LowID);

            Packet.AddString(this.Name);
            Packet.AddString(this.Facebook.Identifier);

            Packet.AddInt(0); // lastPlayedLevel
            Packet.AddInt(this.Diamonds);
            Packet.AddInt(this.FreeDiamonds);
            Packet.AddBoolean(this.NameSetByUser);
            Packet.AddInt(this.Score);

            this.Resources.Encode(Packet);

            Packet.AddInt(this.AchievementsClaimed.Count);
            this.AchievementsClaimed.ForEach(Packet.AddData);

            this.AchievementProgresses.Encode(Packet);

            Packet.AddInt(0); // LevelScores (List<DataSlots>)
            Packet.AddInt(0); // LevelAreas (List<DataSlots>)
        }
Ejemplo n.º 20
0
        internal void Encode(ByteWriter Packet)
        {
            Packet.AddLong(this.Alliance.HighID, this.Alliance.LowID);

            Packet.AddString(this.Name);

            Packet.AddInt(this.Badge);
            Packet.AddInt((int)this.Type);
            Packet.AddInt(this.NumberOfMembers);
            Packet.AddInt(this.Score);
            Packet.AddInt(this.DuelScore);
            Packet.AddInt(this.RequiredScore);

            Packet.AddInt(this.WonWarCount);
            Packet.AddInt(this.LostWarCount);
            Packet.AddInt(this.EqualWarCount);

            Packet.AddInt(this.Locale);
            Packet.AddInt(this.ConsecutiveWarWinsCount);
            Packet.AddInt(this.Origin);

            Packet.AddInt(this.ExpPoints);
            Packet.AddInt(this.ExpLevel);
            Packet.AddInt(this.ConsecutiveWarWinsCount);
            Packet.AddBoolean(this.PublicWarLog);
            Packet.AddInt(0);
            Packet.AddBoolean(this.AmicalWar);
        }
Ejemplo n.º 21
0
        /// <summary>
        /// Encodes this instance.
        /// </summary>
        internal void Encode(ByteWriter Packet)
        {
            Packet.AddLong(this.HighID, this.LowID);
            Packet.AddLong(this.HighID, this.LowID);

            if (this.InAlliance)
            {
                Packet.AddBoolean(true);

                Packet.AddLong(this.AllianceHighID, this.AllianceLowID);

                Packet.AddString(this.Alliance.Header.Name);

                Packet.AddInt(this.Alliance.Header.Badge);
                Packet.AddInt((int)this.AllianceMember.Role);
                Packet.AddInt(this.Alliance.Header.ExpLevel);
            }
            else
            {
                Packet.AddBoolean(false);
            }

            if (this.LeagueID > 0)
            {
                Packet.AddBoolean(true);
                Packet.AddLong(this.LeagueHighID, this.LeagueLowID);
            }
            else
            {
                Packet.AddBoolean(false);
            }

            Packet.AddInt(0);
            Packet.AddInt(0);

            {
                Packet.AddInt(0);
                Packet.AddInt(0);
                Packet.AddInt(0);
                Packet.AddInt(0);
                Packet.AddInt(0);
                Packet.AddInt(0);
                Packet.AddInt(0);
                Packet.AddInt(0);
                Packet.AddInt(0);
                Packet.AddInt(0);
            }
            {
                Packet.AddInt(0);
                Packet.AddInt(0);
                Packet.AddInt(0);
                Packet.AddInt(0);
                Packet.AddInt(0);
                Packet.AddInt(0);
                Packet.AddInt(0);
                Packet.AddInt(0);
                Packet.AddInt(0);
                Packet.AddInt(0);
            }

            Packet.AddInt(0);
            Packet.AddInt(0);
            Packet.AddInt(0);

            Packet.AddInt(this.League);

            Packet.AddInt(this.CastleLevel);
            Packet.AddInt(this.CastleTotalCapacity);
            Packet.AddInt(this.CastleUsedCapacity);
            Packet.AddInt(this.CastleTotalSpellCapacity);
            Packet.AddInt(this.CastleUsedSpellCapacity);
            Packet.AddInt(this.TownHallLevel);
            Packet.AddInt(this.TownHallLevel2);

            Packet.AddString(this.Name);
            Packet.AddString(this.Facebook.Identifier);

            Packet.AddInt(this.ExpLevel);
            Packet.AddInt(this.ExpPoints);

            Packet.AddInt(this.Diamonds);
            Packet.AddInt(this.FreeDiamonds);

            Packet.AddInt(60);
            Packet.AddInt(1200);

            Packet.AddInt(this.Score);
            Packet.AddInt(0);
            Packet.AddInt(0);
            Packet.AddInt(0);
            Packet.AddInt(0);
            Packet.AddInt(0);
            Packet.AddInt(0);
            Packet.AddInt(0);
            Packet.AddInt(0);
            Packet.AddInt(0);

            if (true)
            {
                Packet.AddBoolean(true);

                Packet.AddInt(220);
                Packet.AddInt(1828055880);
            }
            else
            {
                Packet.AddBoolean(false);
            }

            Packet.AddBoolean(this.NameSetByUser);
            Packet.AddBoolean(false);

            Packet.AddInt(this.ChangeNameCount);
            Packet.AddInt(6900);
            Packet.AddInt(0);
            Packet.AddInt(this.ClanWarPreference);
            Packet.AddInt(0);
            Packet.AddInt(0);

            if (false)
            {
                Packet.AddBoolean(true);

                Packet.AddInt(0);
                Packet.AddLong(0);
            }
            else
            {
                Packet.AddBoolean(false);
            }

            this.ResourceCaps.Encode(Packet);
            this.Resources.Encode(Packet);
            this.Units.Encode(Packet);
            this.Spells.Encode(Packet);

            this.UnitUpgrades.Encode(Packet);
            this.SpellUpgrades.Encode(Packet);

            Packet.AddInt(0); // Hero Upgrades
            Packet.AddInt(0); // Hero Health
            Packet.AddInt(0); // Hero State

            this.AllianceUnits.Encode(Packet);

            Packet.AddInt(this.Missions.Count);
            this.Missions.ForEach(Packet.AddData);

            Packet.AddInt(this.Achievements.Count);
            this.Achievements.ForEach(Packet.AddData);

            this.AchievementProgress.Encode(Packet);

            this.NpcMapProgress.Encode(Packet);
            this.NpcLootedGold.Encode(Packet);
            this.NpcLootedElixir.Encode(Packet);

            this.Variables.Encode(Packet);

            Packet.AddInt(0); // Hero Modes
            Packet.AddInt(0); // UnitPreset1
            Packet.AddInt(0); // UnitPreset2
            Packet.AddInt(0); // UnitPreset3
            Packet.AddInt(0); // PreviousArmySize
            Packet.AddInt(0); // UnitCounterForEvent
            Packet.AddInt(0); // Units Village2
            Packet.AddInt(0); // Units Village2 new
            Packet.AddInt(0); // DataSlots
        }
Ejemplo n.º 22
0
 /// <summary>
 /// Encodes this instance.
 /// </summary>
 internal virtual void Encode(ByteWriter Packet)
 {
     Packet.AddData(this.Data);
     Packet.AddInt(this.Count);
 }
Ejemplo n.º 23
0
 /// <summary>
 /// Encodes this instance.
 /// </summary>
 internal override void Encode(ByteWriter Packet)
 {
     Packet.AddInt(this.Id);
     base.Encode(Packet);
 }
Ejemplo n.º 24
0
 /// <summary>
 /// Encodes this command.
 /// </summary>
 /// <param name="reader"></param>
 internal override void Encode(ByteWriter writer)
 {
     writer.AddInt(this.BoatID);
     writer.AddInt(this.UnitType);
     writer.AddData(this.UnitData);
 }
Ejemplo n.º 25
0
 /// <summary>
 /// Encodes this instance.
 /// </summary>
 internal virtual void Encode(ByteWriter Packet)
 {
     Packet.AddInt(this.ExecuteSubTick);
 }
Ejemplo n.º 26
0
 internal static void AddData(this ByteWriter Writer, Data Data)
 {
     Writer.AddInt(Data != null ? Data.GlobalID : 0);
 }
Ejemplo n.º 27
0
 /// <summary>
 /// Encodes this instance.
 /// </summary>
 /// <param name="Packet"></param>
 internal void Encode(ByteWriter Packet)
 {
     Packet.AddInt(0); // Timer
 }
Ejemplo n.º 28
0
 internal override void Encode(ByteWriter Writer)
 {
     base.Encode(Writer);
     Writer.AddInt(this.Level);
 }
Ejemplo n.º 29
0
 internal static void EncodeCommand(Command Command, ByteWriter Packet)
 {
     Packet.AddInt(Command.Type);
     Command.Encode(Packet);
 }
Ejemplo n.º 30
0
        /// <summary>
        /// Encodes this instance.
        /// </summary>
        /// <param name="Packet">The byte stream.</param>
        internal void Encode(ByteWriter Packet)
        {
            Packet.AddLong(this.HighID, this.LowID); // AccountID
            Packet.AddLong(this.HighID, this.LowID); // ID

            if (this.AllianceID > 0)
            {
                Packet.AddBoolean(true);

                Packet.AddLong(this.AllianceHighID, this.AllianceLowID);

                Packet.AddString("TID_ALLIANCE_NAME");
                Packet.AddInt(0); // Badge
                Packet.AddInt(0); // Role
            }
            else
            {
                Packet.AddBoolean(false);
            }

            Packet.AddInt(this.TownHallLevel);

            Packet.AddString(this.Name);
            Packet.AddString(this.Facebook.Identifier);

            Packet.AddInt(this.ExpLevel);
            Packet.AddInt(this.ExpPoints);
            Packet.AddInt(this.Diamonds);
            Packet.AddInt(this.Diamonds);
            Packet.AddInt(this.GainIntel);
            Packet.AddInt(this.AttackKFactor);
            Packet.AddInt(this.Score);
            Packet.AddBoolean(this.NameSetByUser);
            Packet.AddInt(this.CumulativePurchasedDiamonds);
            Packet.AddInt(this.NumberOnePosCounter);

            this.ResourceCaps.Encode(Packet);
            this.Resources.Encode(Packet);
            this.ResourcesConvertedToSupplies.Encode(Packet);
            this.Units.Encode(Packet);
            this.UnitUpgrades.Encode(Packet);
            this.SpellUpgrades.Encode(Packet);
            this.HeroUpgrades.Encode(Packet);
            this.NpcSeens.Encode(Packet);
            this.TrapUpgrades.Encode(Packet);
            this.BuildingLevels.Encode(Packet);
            this.ArtifactBonuses.Encode(Packet);
            this.LandingBoatLevels.Encode(Packet);

            Packet.AddInt(0); // Unknown DataSlots

            Packet.AddInt(this.MissionCompleted.Count);

            for (int i = 0; i < this.MissionCompleted.Count; i++)
            {
                Packet.AddInt(this.MissionCompleted[i]);
            }

            Packet.AddInt(this.AchievementClaimed.Count);

            for (int i = 0; i < this.AchievementClaimed.Count; i++)
            {
                Packet.AddInt(this.AchievementClaimed[i]);
            }

            this.AchievementProgresses.Encode(Packet);
            this.BottleChainProgresses.Encode(Packet);
            this.SubscriptionExpirationTimes.Encode(Packet);
            this.HeroStatus.Encode(Packet);
            this.HeroSelectedAbilities.Encode(Packet);
            this.HeroSeens.Encode(Packet);
            this.HeroAbilitySeens.Encode(Packet);
            this.SectorLevels.Encode(Packet);
            this.SectorBoostLevels.Encode(Packet);
            this.SectorBonuses.Encode(Packet);
            this.SectorBonusFilter.Encode(Packet);

            Packet.AddInt(0); // Unknown DataSlots

            this.PlayerMap.Encode(Packet);
        }