コード例 #1
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);
        }
コード例 #2
0
        /// <summary>
        /// Encodes this instance.
        /// </summary>
        /// <param name="Packet">The byte stream.</param>
        internal void Encode(ByteWriter Packet)
        {
            Packet.AddLong(this.HighID, this.LowID);

            Packet.AddString(this.HomeBaseLevel);
            Packet.AddString(this.LevelAuthorName);

            Packet.AddCompressableString(this.Save().ToString(Formatting.None));
        }
コード例 #3
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);
        }
コード例 #4
0
        internal void Encode(ByteWriter Packet)
        {
            Packet.AddLong(this.HighID, this.LowID);

            Packet.AddString(this.Name);

            Packet.AddInt((int)this.Role);
            Packet.AddInt(this.ExpLevel);
            Packet.AddInt(this.League);
            Packet.AddInt(this.Score);
            Packet.AddInt(this.DuelScore);
            Packet.AddInt(this.TroopSended);
            Packet.AddInt(this.TroopReceived);
            Packet.AddInt(6);
            Packet.AddInt(0);
            Packet.AddInt(42);
            Packet.AddInt(0);
            Packet.AddInt(957071);
            Packet.AddInt(0);
            Packet.AddInt(1);

            Packet.AddBoolean(true);
            {
                Packet.AddLong(this.HighID, this.LowID);
            }
        }
コード例 #5
0
        /// <summary>
        /// Encodes this instance.
        /// </summary>
        internal override void Encode(ByteWriter Packet)
        {
            Packet.AddString(this.AvatarName);
            Packet.AddInt(this.ChangeNameCount);

            base.Encode(Packet);
        }
コード例 #6
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);
        }
コード例 #7
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);
        }
コード例 #8
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);
        }
コード例 #9
0
        /// <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);
        }
コード例 #10
0
ファイル: Player.cs プロジェクト: nextgenhacker/GL.Servers
        /// <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>)
        }
コード例 #11
0
ファイル: Alliance.cs プロジェクト: nextgenhacker/GL.Servers
        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);
        }
コード例 #12
0
        /// <summary>
        /// Get byte representation of the question.
        /// </summary>
        public byte[] ToBytes()
        {
            var byteWriter = new ByteWriter();

            var labels = Name.Split('.');

            foreach (var label in labels)
            {
                byteWriter.AddByte((byte)label.Length);
                byteWriter.AddString(label);
            }
            byteWriter.AddByte(0);

            byteWriter.AddUshort(QType);
            byteWriter.AddUshort(QClass);

            return(byteWriter.GetValue());
        }
コード例 #13
0
        public void NormalOperationTest()
        {
            ByteWriter writer = new ByteWriter();

            writer.AddUshort(35000);
            writer.AddByte(230);
            writer.AddString("spam");
            writer.AddUint(4211001100);

            writer.AddBits(1, 1);
            writer.AddBits(4, 2);
            writer.AddBits(3, 1);

            writer.AddByte(10);

            byte[] expected = File.ReadAllBytes(Path.Combine("Files", "structdata.dat"));
            byte[] actual   = writer.GetValue();

            Assert.AreEqual(BitConverter.ToString(expected), BitConverter.ToString(actual));
        }
コード例 #14
0
ファイル: ByteStreamHelper.cs プロジェクト: nako75/GL.Servers
        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);
            }
        }
コード例 #15
0
ファイル: Player.cs プロジェクト: nextgenhacker/GL.Servers
        /// <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
        }
コード例 #16
0
 /// <summary>
 /// Encodes this instance.
 /// </summary>
 internal void Encode(ByteWriter Packet)
 {
     Packet.AddLong(this.HighID, this.LowID);
     Packet.AddString(this.HomeJSON.ToString(Formatting.None));
 }
コード例 #17
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);
        }
コード例 #18
0
 internal override void Encode(ByteWriter Packet)
 {
     base.Encode(Packet);
     Packet.AddString(this.Message);
 }