コード例 #1
0
        public static void SendWarTeamListResponse(Character chr)
        {
            Asda2Battleground        currentBattleGround = chr.CurrentBattleGround;
            List <List <Character> > characterListList   = new List <List <Character> >();

            lock (currentBattleGround.JoinLock)
            {
                if (chr.Asda2FactionId == (short)0)
                {
                    int num = currentBattleGround.LightTeam.Count / 6;
                    if (num == 0)
                    {
                        num = 1;
                    }
                    for (int index = 0; index < num; ++index)
                    {
                        characterListList.Add(currentBattleGround.LightTeam.Values.Skip <Character>(index * 6)
                                              .Take <Character>(6).ToList <Character>());
                    }
                }
                else
                {
                    int num = currentBattleGround.DarkTeam.Count / 6;
                    if (num == 0)
                    {
                        num = 1;
                    }
                    for (int index = 0; index < num; ++index)
                    {
                        characterListList.Add(currentBattleGround.DarkTeam.Values.Skip <Character>(index * 6)
                                              .Take <Character>(6).ToList <Character>());
                    }
                }

                foreach (List <Character> characterList in characterListList)
                {
                    using (RealmPacketOut packet = new RealmPacketOut(RealmServerOpCode.WarTeamList))
                    {
                        foreach (Character character in characterList)
                        {
                            packet.WriteByte(character.CurrentBattleGroundId);
                            packet.WriteByte(character.Asda2FactionId);
                            packet.WriteInt16(character.SessionId);
                            packet.WriteInt32(character.AccId);
                            packet.WriteByte(character.CharNum);
                            packet.WriteByte(3);
                            packet.WriteByte(character.Asda2FactionRank);
                            packet.WriteInt16(character.Level);
                            packet.WriteByte(character.ProfessionLevel);
                            packet.WriteByte((byte)character.Archetype.ClassId);
                            packet.WriteByte(character.Guild == null ? 0 : (character.Guild.ClanCrest == null ? 0 : 1));
                            packet.WriteSkip(character.Guild == null
                                ? Asda2BattlegroundHandler.guildCrest
                                : character.Guild.ClanCrest ?? Asda2BattlegroundHandler.guildCrest);
                            packet.WriteInt16(character.IsInGroup ? 1 : -1);
                            packet.WriteInt16(character.BattlegroundDeathes);
                            packet.WriteInt16(character.BattlegroundKills);
                            packet.WriteInt16(character.BattlegroundActPoints);
                            packet.WriteFixedAsciiString(character.Name, 20, Locale.Start);
                            packet.WriteFixedAsciiString(character.Guild == null ? "" : character.Guild.Name, 17,
                                                         Locale.Start);
                            packet.WriteInt16((short)character.Asda2Position.X);
                            packet.WriteInt16((short)character.Asda2Position.Y);
                        }

                        chr.Send(packet, false);
                    }
                }

                Asda2BattlegroundHandler.SendWarTeamListEndedResponse(chr.Client);
            }
        }