Example #1
0
        public static void HandleBattleFieldStatusRequest(IRealmClient client, RealmPacketIn packet)
        {
            Character activeCharacter = client.ActiveCharacter;

            if (!activeCharacter.Battlegrounds.IsEnqueuedForBattleground)
            {
                return;
            }
            BattlegroundRelation[] relations = activeCharacter.Battlegrounds.Relations;
            int length = activeCharacter.Battlegrounds.Relations.Length;

            for (int index = 0; index < length; ++index)
            {
                BattlegroundRelation relation = relations[index];
                if (relation != null)
                {
                    if (relation.IsEnqueued)
                    {
                        BattlegroundHandler.SendStatusEnqueued(activeCharacter, index, relation,
                                                               relation.Queue.ParentQueue);
                    }
                    else if (activeCharacter.Map is Battleground &&
                             relation.BattlegroundId == ((Battleground)activeCharacter.Map).Template.Id)
                    {
                        BattlegroundHandler.SendStatusActive(activeCharacter, (Battleground)activeCharacter.Map,
                                                             index);
                    }
                }
            }
        }