コード例 #1
0
        public static void Write(this BinaryWriter writer, AllegianceData data)
        {
            // ObjectID - characterID - Character ID
            // uint - cpCached - XP gained while logged off
            // uint - cpTithed - Total allegiance XP contribution
            // uint - bitfield - AllegianceIndex
            // Gender - gender - The gender of the character (for determining title)
            // HeritageGroup - hg - The heritage of the character (for determining title)
            // ushort - rank - The numerical rank (1 is lowest).

            // Choose valid sections by masking against bitfield
            // uint - level

            // ushort - loyalty - Character loyalty
            // ushort - leadership - Character leadership

            // Choose based on testing bitfield == 0x4
            // True:
            // ulong - timeOnline
            // False:
            // uint - timeOnline
            // uint - allegianceAge

            // string - name
            var    characterID   = new ObjectGuid(0);
            uint   cpCached      = 0;
            uint   cpTithed      = 0;
            var    bitfield      = AllegianceIndex.HasAllegianceAge | AllegianceIndex.HasPackedLevel | AllegianceIndex.LoggedIn;
            var    gender        = Gender.Female;
            var    hg            = HeritageGroup.Aluvian;
            ushort rank          = 0;
            uint   level         = 0;
            ushort loyalty       = 0;
            ushort leadership    = 0;
            ulong  uTimeOnline   = 0;
            uint   timeOnline    = 0;
            uint   allegianceAge = 0;
            var    name          = "";

            if (data.Node != null)
            {
                var node   = data.Node;
                var player = node.Player;

                characterID = player.Guid;
                gender      = (Gender)player.Gender;
                hg          = (HeritageGroup)player.Heritage;
                rank        = (ushort)node.Rank;
                level       = (uint)player.Level;
                loyalty     = (ushort)player.GetCurrentLoyalty();
                leadership  = (ushort)player.GetCurrentLeadership();
                name        = player.Name;
            }

            writer.Write(characterID.Full);
            writer.Write(cpCached);
            writer.Write(cpTithed);
            writer.Write((uint)bitfield);
            writer.Write((byte)gender);
            writer.Write((byte)hg);
            writer.Write(rank);

            if (bitfield.HasFlag(AllegianceIndex.HasPackedLevel))
            {
                writer.Write(level);
            }

            writer.Write(loyalty);
            writer.Write(leadership);

            if (!bitfield.HasFlag(AllegianceIndex.HasAllegianceAge))  // verify: reversed in aclogview?
            {
                writer.Write(uTimeOnline);
            }
            else
            {
                writer.Write(timeOnline);
                writer.Write(allegianceAge);
            }
            writer.WriteString16L(name);
        }
コード例 #2
0
ファイル: AllegianceHierarchy.cs プロジェクト: ziang4891/ACE
        public static void Write(this BinaryWriter writer, AllegianceHierarchy hierarchy)
        {
            // ushort - recordCount - Number of character allegiance records
            // ushort - oldVersion = 0x000B - Defines which properties are available. 0x000B seems to be the latest version which includes all properties.
            // Dictionary<ObjectID, AllegianceOfficerLevel> - officers - Taking a guess on these values. Guessing they may only be valid for Monarchs
            //                                                           A list of officers and their officer levels?
            // List<string> - officerTitles - Believe these may pass in the current officer title list. Guessing they may only be valid on Monarchs.
            // uint - monarchBroadcastTime - May only be valid for Monarchs/Speakers?
            // uint - monarchBroadcastsToday - May only be valid for Monarchs/Speakers?
            // uint - spokesBroadcastTime - May only be valid for Monarchs/Speakers?
            // uint - spokesBroadcastsToday - May only be valid for Monarchs/Speakers?
            // string - motd - Text for current Message of the Day. May only be valid for Monarchs/Speakers?
            // string - motdSetBy - Who set the current Message of the Day. May only be valid for Monarchs/Speakers?
            // uint - chatRoomID - allegiance chat channel number
            // Position - bindpoint - Location of monarchy bindpoint
            // string - allegianceName - The name of the allegiance.
            // uint - nameLastSetTime - Time name was last set. Seems to count upward for some reason.
            // bool - isLocked - Whether allegiance is locked.
            // int - approvedVassal - ??
            // AllegianceData - monarchData - Monarch's data

            // records: vector of length recordCount - 1
            // ObjectID - treeParent - The ObjectID for the parent character to this character. Used by the client to decide how to build the display in the Allegiance tab. 1 is the monarch.
            // AllegianceData - allegianceData

            // recordCount = Monarch + Patron + Vassals?
            // 2 in data for small allegiances?
            ushort         recordCount            = 0;
            ushort         oldVersion             = 0x000B;
            var            officers               = new Dictionary <ObjectGuid, AllegianceOfficerLevel>();
            var            officerTitles          = new List <string>();
            uint           monarchBroadcastTime   = 0;
            uint           monarchBroadcastsToday = 0;
            uint           spokesBroadcastTime    = 0;
            uint           spokesBroadcastsToday  = 0;
            var            motd            = "";
            var            motdSetBy       = "";
            uint           chatRoomID      = 0;
            var            bindPoint       = new Position();
            var            allegianceName  = "";
            uint           nameLastSetTime = 0;
            bool           isLocked        = false;
            int            approvedVassal  = 0;
            AllegianceData monarchData     = null;
            List <Tuple <ObjectGuid, AllegianceData> > records = null;

            var allegiance = hierarchy.Profile.Allegiance;
            var node       = hierarchy.Profile.Node;

            if (allegiance != null && node != null)
            {
                // only send these to monarch?
                //foreach (var officer in allegiance.Officers)
                //officers.Add(officer.Key, (AllegianceOfficerLevel)officer.Value.Player.AllegianceOfficerRank);

                // not in retail packets, breaks decal

                /*if (allegiance.HasCustomTitles)
                 * {
                 *  officerTitles.Add(allegiance.GetOfficerTitle(AllegianceOfficerLevel.Speaker));
                 *  officerTitles.Add(allegiance.GetOfficerTitle(AllegianceOfficerLevel.Seneschal));
                 *  officerTitles.Add(allegiance.GetOfficerTitle(AllegianceOfficerLevel.Castellan));
                 * }*/

                allegianceName = allegiance.AllegianceName ?? allegiance.Monarch.Player.Name;
                //motd = allegiance.AllegianceMotd ?? "";
                //motdSetBy = allegiance.AllegianceMotdSetBy ?? "";
                motd       = "";    // fixes decal AllegianceUpdate parsing
                motdSetBy  = "";
                chatRoomID = allegiance.Biota.Id;

                if (allegiance.Sanctuary != null)
                {
                    bindPoint = allegiance.Sanctuary;
                }

                // aclogview (verify):
                // i == 0 : monarch (no guid)
                // i == 1 : patron
                // i == 2 : peer?
                // i  > 2 : vassals

                // peers = others with the same patron?

                recordCount = 1;                                   // monarch
                if (node.Patron != null && !node.Patron.IsMonarch) // patron
                {
                    recordCount++;
                }
                if (!node.IsMonarch)    // self
                {
                    recordCount++;
                }
                if (node.TotalVassals > 0)  // vassals
                {
                    recordCount += (ushort)node.TotalVassals;
                }
                //Console.WriteLine("Records: " + recordCount);

                // monarch
                monarchData = new AllegianceData(allegiance.Monarch);

                if (recordCount > 1)
                {
                    records = new List <Tuple <ObjectGuid, AllegianceData> >();

                    // patron
                    if (node.Patron != null && !node.Patron.IsMonarch)
                    {
                        records.Add(new Tuple <ObjectGuid, AllegianceData>(node.Monarch.PlayerGuid, new AllegianceData(node.Patron)));
                    }

                    // self
                    if (!node.IsMonarch)
                    {
                        records.Add(new Tuple <ObjectGuid, AllegianceData>(node.Patron.PlayerGuid, new AllegianceData(node)));
                    }

                    // vassals
                    if (node.TotalVassals > 0)
                    {
                        foreach (var vassal in node.Vassals.Values)
                        {
                            records.Add(new Tuple <ObjectGuid, AllegianceData>(node.PlayerGuid, new AllegianceData(vassal)));
                        }
                    }
                }
            }

            writer.Write(recordCount);
            writer.Write(oldVersion);
            writer.Write(officers);
            writer.Write(officerTitles);
            writer.Write(monarchBroadcastTime);
            writer.Write(monarchBroadcastsToday);
            writer.Write(spokesBroadcastTime);
            writer.Write(spokesBroadcastsToday);
            writer.WriteString16L(motd);
            writer.WriteString16L(motdSetBy);
            writer.Write(chatRoomID);
            writer.Write(bindPoint);
            writer.WriteString16L(allegianceName);
            writer.Write(nameLastSetTime);
            writer.Write(Convert.ToUInt32(isLocked));
            writer.Write(approvedVassal);

            if (monarchData != null)
            {
                writer.Write(monarchData);
            }

            if (records != null)
            {
                writer.Write(records);
            }
        }
コード例 #3
0
        public static void Write(this BinaryWriter writer, AllegianceData data)
        {
            // ObjectID - characterID - Character ID
            // uint - cpCached - XP gained while logged off
            // uint - cpTithed - Total allegiance XP contribution
            // uint - bitfield - AllegianceIndex
            // Gender - gender - The gender of the character (for determining title)
            // HeritageGroup - hg - The heritage of the character (for determining title)
            // ushort - rank - The numerical rank (1 is lowest).

            // Choose valid sections by masking against bitfield
            // uint - level

            // ushort - loyalty - Character loyalty
            // ushort - leadership - Character leadership

            // Choose based on testing bitfield == 0x4 (HasAllegianceAge)
            // True:
            // uint - timeOnline
            // uint - allegianceAge
            // False: (Not found in later retail pcaps. Probably deprecated.)
            // ulong - uTimeOnline

            // string - name

            uint   characterID   = 0;
            uint   cpCached      = 0;
            uint   cpTithed      = 0;
            var    bitfield      = AllegianceIndex.HasAllegianceAge | AllegianceIndex.HasPackedLevel;
            var    gender        = Gender.Female;
            var    hg            = HeritageGroup.Aluvian;
            ushort rank          = 0;
            uint   level         = 0;
            ushort loyalty       = 0;
            ushort leadership    = 0;
            ulong  uTimeOnline   = 0;
            uint   timeOnline    = 0;
            uint   allegianceAge = 0;
            var    name          = "";

            if (data.Node != null)
            {
                var node       = data.Node;
                var playerGuid = node.PlayerGuid;
                var player     = PlayerManager.FindByGuid(playerGuid, out var playerIsOnline);

                characterID = player.Guid.Full;
                cpCached    = (uint)player.AllegianceXPCached;
                cpTithed    = (uint)player.AllegianceXPGenerated;

                if (playerIsOnline)
                {
                    bitfield |= AllegianceIndex.LoggedIn;
                }

                if (!node.IsMonarch && node.Player.ExistedBeforeAllegianceXpChanges)
                {
                    bitfield |= AllegianceIndex.MayPassupExperience;
                }

                gender     = (Gender)player.Gender;
                hg         = (HeritageGroup)player.Heritage;
                rank       = (ushort)node.Rank;
                level      = (uint)player.Level;
                loyalty    = (ushort)player.GetCurrentLoyalty();
                leadership = (ushort)player.GetCurrentLeadership();

                //if (!node.IsMonarch)
                //{
                // TODO: Get/set total time sworn to patron (allegianceAge) and total in-game time since swearing to patron (timeOnline)
                //}

                name = player.Name;
            }

            writer.Write(characterID);
            writer.Write(cpCached);
            writer.Write(cpTithed);
            writer.Write((uint)bitfield);
            writer.Write((byte)gender);
            writer.Write((byte)hg);
            writer.Write(rank);

            if (bitfield.HasFlag(AllegianceIndex.HasPackedLevel))
            {
                writer.Write(level);
            }

            writer.Write(loyalty);
            writer.Write(leadership);

            if (bitfield.HasFlag(AllegianceIndex.HasAllegianceAge))
            {
                writer.Write(timeOnline);
                writer.Write(allegianceAge);
            }
            else
            {
                writer.Write(uTimeOnline);
            }

            writer.WriteString16L(name);
        }