Ejemplo n.º 1
0
        /// <summary>
        /// Handles an incoming group invite request (/invite Player)
        /// </summary>
        /// <param name="client">the Session the incoming packet belongs to</param>
        /// <param name="packet">the full packet</param>
        public static void GroupInviteRequest(IRealmClient client, RealmPacketIn packet)
        {
            string    str             = packet.ReadCString();
            Character activeCharacter = client.ActiveCharacter;
            Group     group           = activeCharacter.Group;
            Character target;

            if (Group.CheckInvite(activeCharacter, out target, str) != GroupResult.NoError)
            {
                return;
            }
            HashSet <IBaseRelation> relations =
                Singleton <RelationMgr> .Instance.GetRelations(activeCharacter.EntityId.Low,
                                                               CharacterRelationType.GroupInvite);

            if (group != null && relations.Count >= (int)group.InvitesLeft)
            {
                return;
            }
            Singleton <RelationMgr> .Instance.AddRelation(RelationMgr.CreateRelation(activeCharacter.EntityId.Low,
                                                                                     target.EntityId.Low, CharacterRelationType.GroupInvite));

            Group.SendResult((IPacketReceiver)activeCharacter.Client, GroupResult.NoError, str);
            GroupHandler.SendGroupInvite((IPacketReceiver)target.Client, activeCharacter.Name);
        }
Ejemplo n.º 2
0
        /// <summary>Handles an incoming convert party to raid request</summary>
        /// <param name="client">the Session the incoming packet belongs to</param>
        /// <param name="packet">the full packet</param>
        public static void ConvertToRaidRequest(IRealmClient client, RealmPacketIn packet)
        {
            GroupMember groupMember = client.ActiveCharacter.GroupMember;

            if (groupMember == null)
            {
                return;
            }
            Group group1 = groupMember.Group;

            if (!(group1 is PartyGroup) || !group1.CheckPrivs(groupMember, GroupPrivs.Leader))
            {
                return;
            }
            Group group2 = (Group)((PartyGroup)group1).ConvertTo();

            GroupHandler.SendResult((IPacketReceiver)client, GroupResult.NoError);
            group2.SendUpdate();
        }
Ejemplo n.º 3
0
        /// <summary>Handles an incoming decline on group invite request</summary>
        /// <param name="client">the Session the incoming packet belongs to</param>
        /// <param name="packet">the full packet</param>
        public static void GroupDecline(IRealmClient client, RealmPacketIn packet)
        {
            Character     activeCharacter = client.ActiveCharacter;
            IBaseRelation relation        = Singleton <RelationMgr> .Instance
                                            .GetPassiveRelations(activeCharacter.EntityId.Low, CharacterRelationType.GroupInvite)
                                            .FirstOrDefault <IBaseRelation>();

            if (relation == null)
            {
                return;
            }
            Singleton <RelationMgr> .Instance.RemoveRelation(relation);

            Character character = World.GetCharacter(relation.CharacterId);

            if (character == null)
            {
                return;
            }
            GroupHandler.SendGroupDecline((IPacketReceiver)character.Client, activeCharacter.Name);
        }
Ejemplo n.º 4
0
        /// <summary>Handles an incoming request on random roll</summary>
        /// <param name="client">the Session the incoming packet belongs to</param>
        /// <param name="packet">the full packet</param>
        public static void RandomRollRequest(IRealmClient client, RealmPacketIn packet)
        {
            int num1 = packet.ReadInt32();
            int num2 = packet.ReadInt32();

            if (num1 > num2 || num2 > 10000)
            {
                return;
            }
            int   roll  = new Random().Next(num1, num2);
            Group group = client.ActiveCharacter.Group;

            if (group == null)
            {
                GroupHandler.SendRoll((IPacketReceiver)client, num1, num2, roll, client.ActiveCharacter.EntityId);
            }
            else
            {
                group.SendRoll(num1, num2, roll, client.ActiveCharacter.EntityId);
            }
        }
Ejemplo n.º 5
0
        /// <summary>Handles an incoming request for a group member status</summary>
        /// <param name="client">the Session the incoming packet belongs to</param>
        /// <param name="packet">the full packet</param>
        public static void RequestPartyMemberStats(IRealmClient client, RealmPacketIn packet)
        {
            EntityId entityId = packet.ReadEntityId();
            Group    group    = client.ActiveCharacter.Group;

            if (group == null)
            {
                return;
            }
            GroupMember member = group.GetMember(entityId.Low);

            if (member == null)
            {
                return;
            }
            GroupUpdateFlags groupUpdateFlags = GroupUpdateFlags.None;
            GroupUpdateFlags flags            = member.Character == null
                ? groupUpdateFlags | GroupUpdateFlags.Status
                : groupUpdateFlags | GroupUpdateFlags.UpdateFull;

            GroupHandler.SendPartyMemberStatsFull((IPacketReceiver)client, member, flags);
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Handles an incoming request on moving Character from one subgroup to another
        /// </summary>
        /// <param name="client">the Session the incoming packet belongs to</param>
        /// <param name="packet">the full packet</param>
        public static void ChangeSubgroupRequest(IRealmClient client, RealmPacketIn packet)
        {
            GroupMember groupMember1 = client.ActiveCharacter.GroupMember;

            if (groupMember1 == null)
            {
                return;
            }
            RaidGroup group1 = groupMember1.Group as RaidGroup;

            if (group1 == null)
            {
                return;
            }
            string      targetName   = packet.ReadCString();
            byte        num          = packet.ReadByte();
            GroupMember groupMember2 = group1[targetName];

            if (group1.CheckAction(groupMember1, groupMember2, targetName, GroupPrivs.Assistant) != GroupResult.NoError)
            {
                return;
            }
            SubGroup group2 = group1.SubGroups.Get <SubGroup>((int)num);

            if (group2 == null)
            {
                return;
            }
            if (!group1.MoveMember(groupMember2, group2))
            {
                GroupHandler.SendResult((IPacketReceiver)client, GroupResult.GroupIsFull);
            }
            else
            {
                group1.SendUpdate();
            }
        }
Ejemplo n.º 7
0
 /// <summary>
 /// Sends the requested party member stats data to the client
 /// </summary>
 /// <param name="client">realm client</param>
 /// <param name="member">The character whose stats is going to be retrieved</param>
 /// <param name="flags">The stats to be retrieved from the <paramref name="member" /></param>
 public static void SendPartyMemberStats(IPacketReceiver client, GroupMember member, GroupUpdateFlags flags)
 {
     GroupHandler.SendPartyMemberStatsInternal(client, member, flags, RealmServerOpCode.SMSG_PARTY_MEMBER_STATS);
 }
Ejemplo n.º 8
0
 public static void HandleMeetingStoneInfoRequest(IRealmClient client, RealmPacketIn packet)
 {
     GroupHandler.SendMeetingStoneSetQueue((IPacketReceiver)client.ActiveCharacter);
 }