コード例 #1
0
ファイル: Character.cs プロジェクト: dwing10/TBQuestGame_S4
 public Character(string id, string name, CharacterTitle title, int rank, int power)
 {
     _name  = name;
     _title = title;
     _rank  = rank;
     _power = power;
 }
コード例 #2
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);
            }
        }
コード例 #3
0
ファイル: Character.cs プロジェクト: dwing10/TBQuestGame_S2
 public Character(string name, CharacterTitle title, int rank, int attack, int defense)
 {
     _name    = name;
     _title   = title;
     _rank    = rank;
     _attack  = attack;
     _defense = defense;
 }
コード例 #4
0
        public Value(RewardType qrt, BinaryReader reader)
        {
            Initialize();

            Unk = reader.ReadBytes(2);

            switch (qrt)
            {
            case RewardType.Exp:
                Exp  = reader.ReadUInt32();
                Rest = reader.ReadBytes(4);
                break;

            case RewardType.Money:
                Money = reader.ReadUInt32();
                Rest  = reader.ReadBytes(4);
                break;

            case RewardType.Item:
                Item = new Item(reader);
                Rest = reader.ReadBytes(4);
                break;

            case RewardType.Abstate:
                Abstate = new Abstate(reader);
                break;

            case RewardType.Fame:
                Fame = reader.ReadUInt32();
                Rest = reader.ReadBytes(4);
                break;

            case RewardType.Pet:
                PetID = reader.ReadUInt32();
                Rest  = reader.ReadBytes(4);
                break;

            case RewardType.MiniHouse:
                MiniHouseID = reader.ReadByte();
                Rest        = reader.ReadBytes(7);
                break;

            case RewardType.Title:
                CharacterTitle = new CharacterTitle(reader);
                Rest           = reader.ReadBytes(4);
                break;

            case RewardType.KillPoint:
                KillPoint = reader.ReadUInt32();
                Rest      = reader.ReadBytes(4);
                break;

            default:
                return;
            }
        }
コード例 #5
0
 public NPC(string id, string name, CharacterTitle title, int rank, int power, string description) :
     base(id, name, title, rank, power)
 {
     ID          = id;
     Name        = name;
     Title       = title;
     Rank        = rank;
     Power       = power;
     Description = description;
 }
コード例 #6
0
 public void Initialize()
 {
     Exp            = 0;
     Money          = 0;
     Item           = new Item();
     Abstate        = new Abstate();
     Fame           = 0;
     PetID          = 0;
     MiniHouseID    = 0;
     CharacterTitle = new CharacterTitle();
     KillPoint      = 0;
 }
コード例 #7
0
        public string GetTitle(CharacterTitle title)
        {
            var titleEnums = DatManager.PortalDat.ReadFromDat <EnumMapper>(EnumMapper_CharacterTitle_FileID);

            if (!titleEnums.IdToStringMap.TryGetValue((uint)title, out var titleEnum))
            {
                return(null);
            }

            var hash = SpellTable.ComputeHash(titleEnum);

            var entry = DatManager.LanguageDat.CharacterTitles.StringTableData.FirstOrDefault(i => i.Id == hash);

            if (entry == null)
            {
                return(null);
            }

            return(entry.Strings.FirstOrDefault());
        }
コード例 #8
0
 public void AddTitle(CharacterTitle title, bool setAsDisplayTitle = false)
 {
     AddTitle((uint)title, setAsDisplayTitle);
 }
コード例 #9
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);
     }
 }
コード例 #10
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);
     }
     }
 }
コード例 #11
0
 public AddCharacterTitle(CharacterTitle title) : base(EmoteType.AddCharacterTitle)
 {
     Stat = (int)title;
 }
コード例 #12
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;
        }
コード例 #13
0
 public void Update(CharacterTitle entity)
 {
     throw new NotImplementedException();
 }
コード例 #14
0
ファイル: D2Packet.cs プロジェクト: killerbonzai/BlueVex2
 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;
 }
コード例 #15
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);
                }
            }
        }
コード例 #16
0
 public void SetTitle(CharacterTitle title)
 {
     AddTitle(title, true);
 }
コード例 #17
0
 public EnemyMilitary(string id, string name, CharacterTitle title, int rank, int power, string description, List <string> messages) :
     base(id, name, title, rank, power, description)
 {
     Messages = messages;
 }
コード例 #18
0
 public void Insert(CharacterTitle entity)
 {
     this.Collection.InsertOne(entity);
 }