Exemple #1
0
        public static AllegianceData read(BinaryReader binaryReader)
        {
            AllegianceData newObj = new AllegianceData();

            newObj._id        = binaryReader.ReadUInt32();
            newObj._cp_cached = binaryReader.ReadUInt32();
            newObj._cp_tithed = binaryReader.ReadUInt32();
            newObj._bitfield  = binaryReader.ReadUInt32();
            newObj._gender    = binaryReader.ReadByte();
            newObj._hg        = binaryReader.ReadByte();
            newObj._rank      = binaryReader.ReadUInt16();
            if ((newObj._bitfield & 0x8) != 0)
            {
                newObj._level = binaryReader.ReadUInt32();
            }
            newObj._loyalty    = binaryReader.ReadUInt16();
            newObj._leadership = binaryReader.ReadUInt16();
            if ((newObj._bitfield & 0x4) != 0)
            {
                newObj._time_online__small = binaryReader.ReadUInt32();
                newObj._allegiance_age     = binaryReader.ReadUInt32();
            }
            else
            {
                newObj._time_online__large = binaryReader.ReadUInt64();
            }
            newObj._name = PStringChar.read(binaryReader);
            return(newObj);
        }
Exemple #2
0
        // TODO: May need to pass the character Guid down to this procedure to check where our character is in the hierarchy.
        // There is a chance that a node might get put in the wrong place in the hierarchy. We should be able to check
        // each nodes parent ID and group them accordingly once the correct hierarchy is known.
        // For example: if we are directly beneath the monarch does that make us a peer or a patron?
        // If we are the monarch does that make us a monarch node or a peer node? Can vassals only be listed under a patron node?
        public static AllegianceNode read(BinaryReader binaryReader, ushort packed_nodes)
        {
            AllegianceNode newObj = new AllegianceNode();

            newObj.vassalList = new List <AllegianceNode>();
            for (int i = 0; i < packed_nodes; i++)
            {
                if (i == 0)
                {
                    newObj._monarch = AllegianceData.read(binaryReader);
                }
                else if (i == 1)
                {
                    newObj._patron            = new AllegianceNode();
                    newObj._patron._parent_id = binaryReader.ReadUInt32();
                    newObj._patron._data      = AllegianceData.read(binaryReader);
                }
                else if (i == 2)
                {
                    newObj._peer            = new AllegianceNode();
                    newObj._peer._parent_id = binaryReader.ReadUInt32();
                    newObj._peer._data      = AllegianceData.read(binaryReader);
                }
                else
                {
                    var _vassal = new AllegianceNode();
                    _vassal._parent_id = binaryReader.ReadUInt32();
                    _vassal._data      = AllegianceData.read(binaryReader);
                    newObj.vassalList.Add(_vassal);
                }
            }
            return(newObj);
        }