Example #1
0
        // Methods
        public EnterChatResponse(byte[] data) : base(data)
        {
            this.clientVersion  = -1;
            this.characterType  = BattleNetCharacter.Unknown;
            this.characterLevel = -1;
            this.characterAct   = -1;
            this.characterTitle = CharacterTitle.None;
            this.username       = ByteConverter.GetNullString(data, 3);
            int startIndex = 4 + this.username.Length;

            this.client = (BattleNetClient)BitConverter.ToUInt32(data, startIndex);
            if (data[startIndex += 4] == 0)
            {
                this.account = ByteConverter.GetNullString(data, startIndex + 1);
            }
            else
            {
                this.realm  = ByteConverter.GetString(data, startIndex, -1, 0x2c);
                startIndex += 1 + this.realm.Length;
                this.name   = ByteConverter.GetString(data, startIndex, -1, 0x2c);
                startIndex += 1 + this.name.Length;
                int num2 = ByteConverter.GetByteOffset(data, 0, startIndex);
                this.account = ByteConverter.GetNullString(data, (startIndex + num2) + 1);
                if (this.client == BattleNetClient.Diablo2LoD)
                {
                    this.characterFlags |= CharacterFlags.Expansion;
                }
                StatString.ParseD2StatString(data, startIndex, ref this.clientVersion, ref this.characterType, ref this.characterLevel, ref this.characterFlags, ref this.characterAct, ref this.characterTitle);
            }
        }
 // Methods
 public EnterChatResponse(byte[] data)
     : base(data)
 {
     this.clientVersion = -1;
     this.characterType = BattleNetCharacter.Unknown;
     this.characterLevel = -1;
     this.characterAct = -1;
     this.characterTitle = CharacterTitle.None;
     this.username = ByteConverter.GetNullString(data, 3);
     int startIndex = 4 + this.username.Length;
     this.client = (BattleNetClient) BitConverter.ToUInt32(data, startIndex);
     if (data[startIndex += 4] == 0)
     {
     this.account = ByteConverter.GetNullString(data, startIndex + 1);
     }
     else
     {
     this.realm = ByteConverter.GetString(data, startIndex, -1, 0x2c);
     startIndex += 1 + this.realm.Length;
     this.name = ByteConverter.GetString(data, startIndex, -1, 0x2c);
     startIndex += 1 + this.name.Length;
     int num2 = ByteConverter.GetByteOffset(data, 0, startIndex);
     this.account = ByteConverter.GetNullString(data, (startIndex + num2) + 1);
     if (this.client == BattleNetClient.Diablo2LoD)
     {
         this.characterFlags |= CharacterFlags.Expansion;
     }
     StatString.ParseD2StatString(data, startIndex, ref this.clientVersion, ref this.characterType, ref this.characterLevel, ref this.characterFlags, ref this.characterAct, ref this.characterTitle);
     }
 }
 // Methods
 public ChatEvent(byte[] data)
     : base(data)
 {
     this.clientVersion = -1;
     this.characterType = BattleNetCharacter.Unknown;
     this.characterLevel = -1;
     this.characterAct = -1;
     this.characterTitle = CharacterTitle.None;
     this.eventType = (ChatEventType) BitConverter.ToUInt32(data, 3);
     this.flags = BitConverter.ToUInt32(data, 7);
     this.ping = BitConverter.ToUInt32(data, 11);
     int length = ByteConverter.GetByteOffset(data, 0, 0x1b);
     int num2 = ByteConverter.GetByteOffset(data, 0x2a, 0x1b, length);
     if (num2 > 0)
     {
     this.name = ByteConverter.GetString(data, 0x1b, num2);
     length -= num2 + 1;
     num2 += 0x1c;
     }
     else if (num2 == 0)
     {
     num2 = 0x1c;
     length--;
     this.characterType = BattleNetCharacter.OpenCharacter;
     }
     else
     {
     num2 = 0x1b;
     }
     this.account = ByteConverter.GetString(data, num2, length);
     length += num2 + 1;
     if (this.eventType != ChatEventType.ChannelLeave)
     {
     if ((this.eventType == ChatEventType.ChannelJoin) || (this.eventType == ChatEventType.ChannelUser))
     {
         if ((data.Length - length) > 3)
         {
             this.client = (BattleNetClient) BitConverter.ToUInt32(data, length);
             length += 4;
         }
         if ((((this.client != BattleNetClient.StarcraftShareware) && (this.client != BattleNetClient.Starcraft)) && (this.client != BattleNetClient.StarcraftBroodWar)) && ((this.client == BattleNetClient.Diablo2) || (this.client == BattleNetClient.Diablo2LoD)))
         {
             if (this.client == BattleNetClient.Diablo2LoD)
             {
                 this.characterFlags |= CharacterFlags.Expansion;
             }
             if ((data.Length - length) >= 4)
             {
                 this.realm = ByteConverter.GetString(data, length, -1, 0x2c);
                 length += this.realm.Length + 1;
                 if (data.Length >= length)
                 {
                     length += ByteConverter.GetByteOffset(data, 0x2c, length) + 1;
                     if (((length != -1) && (data.Length > length)) && ((data.Length - length) >= 0x21))
                     {
                         StatString.ParseD2StatString(data, length, ref this.clientVersion, ref this.characterType, ref this.characterLevel, ref this.characterFlags, ref this.characterAct, ref this.characterTitle);
                     }
                 }
             }
         }
     }
     else
     {
         this.message = ByteConverter.GetNullString(data, length);
     }
     }
 }
Example #4
0
        public static void ParseD2StatString(byte[] data, int index, ref int clientVersion, ref BattleNetCharacter characterType, ref int characterLevel, ref CharacterFlags characterFlags, ref int characterAct, ref CharacterTitle characterTitle)
        {
            int num2;

            clientVersion = data[index];
            int num = data[index + 13] - 1;

            if ((num < 0) || (num > 6))
            {
                characterType = BattleNetCharacter.Unknown;
            }
            else
            {
                characterType = (BattleNetCharacter)num;
                if (CharactersInfo.Genders[(int)characterType])
                {
                    characterFlags |= CharacterFlags.Female;
                }
            }
            characterLevel  = data[index + 0x19];
            characterFlags |= (CharacterFlags)data[index + 0x1a];
            int num3 = (data[index + 0x1b] & 0x3e) >> 1;

            if ((characterFlags & CharacterFlags.Expansion) == CharacterFlags.Expansion)
            {
                num2 = num3 / 5;
                num3 = num3 % 5;
            }
            else
            {
                num2 = num3 / 4;
                num3 = num3 % 4;
            }
            if (num2 == 3)
            {
                characterAct = 0x29a;
            }
            else
            {
                characterAct = num3 + 1;
            }
            if ((characterFlags & CharacterFlags.Hardcore) == CharacterFlags.Hardcore)
            {
                num2 |= 4;
            }
            if ((characterFlags & CharacterFlags.Expansion) == CharacterFlags.Expansion)
            {
                num2 |= 0x20;
            }
            if ((characterFlags & CharacterFlags.Female) == CharacterFlags.Female)
            {
                num2 |= 0x100;
            }
            characterTitle = (CharacterTitle)num2;
        }
Example #5
0
 public static void ParseD2StatString(byte[] data, int index, ref int clientVersion, ref BattleNetCharacter characterType, ref int characterLevel, ref CharacterFlags characterFlags, ref int characterAct, ref CharacterTitle characterTitle)
 {
     int num2;
     clientVersion = data[index];
     int num = data[index + 13] - 1;
     if ((num < 0) || (num > 6))
     {
         characterType = BattleNetCharacter.Unknown;
     }
     else
     {
         characterType = (BattleNetCharacter)num;
         if (CharactersInfo.Genders[(int)characterType])
         {
             characterFlags |= CharacterFlags.Female;
         }
     }
     characterLevel = data[index + 0x19];
     characterFlags |= (CharacterFlags)data[index + 0x1a];
     int num3 = (data[index + 0x1b] & 0x3e) >> 1;
     if ((characterFlags & CharacterFlags.Expansion) == CharacterFlags.Expansion)
     {
         num2 = num3 / 5;
         num3 = num3 % 5;
     }
     else
     {
         num2 = num3 / 4;
         num3 = num3 % 4;
     }
     if (num2 == 3)
     {
         characterAct = 0x29a;
     }
     else
     {
         characterAct = num3 + 1;
     }
     if ((characterFlags & CharacterFlags.Hardcore) == CharacterFlags.Hardcore)
     {
         num2 |= 4;
     }
     if ((characterFlags & CharacterFlags.Expansion) == CharacterFlags.Expansion)
     {
         num2 |= 0x20;
     }
     if ((characterFlags & CharacterFlags.Female) == CharacterFlags.Female)
     {
         num2 |= 0x100;
     }
     characterTitle = (CharacterTitle)num2;
 }
Example #6
0
        // Methods
        public ChatEvent(byte[] data) : base(data)
        {
            this.clientVersion  = -1;
            this.characterType  = BattleNetCharacter.Unknown;
            this.characterLevel = -1;
            this.characterAct   = -1;
            this.characterTitle = CharacterTitle.None;
            this.eventType      = (ChatEventType)BitConverter.ToUInt32(data, 3);
            this.flags          = BitConverter.ToUInt32(data, 7);
            this.ping           = BitConverter.ToUInt32(data, 11);
            int length = ByteConverter.GetByteOffset(data, 0, 0x1b);
            int num2   = ByteConverter.GetByteOffset(data, 0x2a, 0x1b, length);

            if (num2 > 0)
            {
                this.name = ByteConverter.GetString(data, 0x1b, num2);
                length   -= num2 + 1;
                num2     += 0x1c;
            }
            else if (num2 == 0)
            {
                num2 = 0x1c;
                length--;
                this.characterType = BattleNetCharacter.OpenCharacter;
            }
            else
            {
                num2 = 0x1b;
            }
            this.account = ByteConverter.GetString(data, num2, length);
            length      += num2 + 1;
            if (this.eventType != ChatEventType.ChannelLeave)
            {
                if ((this.eventType == ChatEventType.ChannelJoin) || (this.eventType == ChatEventType.ChannelUser))
                {
                    if ((data.Length - length) > 3)
                    {
                        this.client = (BattleNetClient)BitConverter.ToUInt32(data, length);
                        length     += 4;
                    }
                    if ((((this.client != BattleNetClient.StarcraftShareware) && (this.client != BattleNetClient.Starcraft)) && (this.client != BattleNetClient.StarcraftBroodWar)) && ((this.client == BattleNetClient.Diablo2) || (this.client == BattleNetClient.Diablo2LoD)))
                    {
                        if (this.client == BattleNetClient.Diablo2LoD)
                        {
                            this.characterFlags |= CharacterFlags.Expansion;
                        }
                        if ((data.Length - length) >= 4)
                        {
                            this.realm = ByteConverter.GetString(data, length, -1, 0x2c);
                            length    += this.realm.Length + 1;
                            if (data.Length >= length)
                            {
                                length += ByteConverter.GetByteOffset(data, 0x2c, length) + 1;
                                if (((length != -1) && (data.Length > length)) && ((data.Length - length) >= 0x21))
                                {
                                    StatString.ParseD2StatString(data, length, ref this.clientVersion, ref this.characterType, ref this.characterLevel, ref this.characterFlags, ref this.characterAct, ref this.characterTitle);
                                }
                            }
                        }
                    }
                }
                else
                {
                    this.message = ByteConverter.GetNullString(data, length);
                }
            }
        }