示例#1
0
        public static void PartyInvireAnswerRequest(IRealmClient client, RealmPacketIn packet)
        {
            packet.Position -= 12;
            byte          num             = packet.ReadByte();
            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;
            }
            if (num == (byte)1)
            {
                (character.Group ?? (Group) new PartyGroup(character)).AddMember(activeCharacter, true);
                Asda2GroupHandler.SendPartyIniteResponseResponse(character.Client, character, activeCharacter,
                                                                 PartyInviteStatusResponse.TheInvitionRequestHasBeenAccepted);
                Asda2GroupHandler.SendPartyIniteResponseResponse(activeCharacter.Client, character, activeCharacter,
                                                                 PartyInviteStatusResponse.TheInvitionRequestHasBeenAccepted);
            }
            else
            {
                Asda2GroupHandler.SendPartyIniteResponseResponse(character.Client, character, activeCharacter,
                                                                 PartyInviteStatusResponse.TheInvitionRequestHasBeenDeclined);
            }
        }
示例#2
0
 public static void LeaveFromPartyRequest(IRealmClient client, RealmPacketIn packet)
 {
     if (client.ActiveCharacter.IsInGroup)
     {
         client.ActiveCharacter.GroupMember.LeaveGroup();
     }
     Asda2GroupHandler.SendPartyHasBrokenResponse(client);
 }
示例#3
0
        private static void OnPartyInviteRequest(IRealmClient client, Character destChr)
        {
            if (!destChr.EnablePartyRequest)
            {
                client.ActiveCharacter.SendSystemMessage(string.Format("Sorry ,but {0} rejects all party requests.",
                                                                       (object)destChr.Name));
            }
            else if (client.ActiveCharacter.Asda2FactionId != (short)-1 && destChr.Asda2FactionId != (short)-1 &&
                     (int)destChr.Asda2FactionId != (int)client.ActiveCharacter.Asda2FactionId)
            {
                client.ActiveCharacter.SendSystemMessage(string.Format("Sorry ,but {0} is in other faction.",
                                                                       (object)destChr.Name));
            }
            else
            {
                string        name            = destChr.Name;
                Character     activeCharacter = client.ActiveCharacter;
                Group         group           = activeCharacter.Group;
                IBaseRelation relation1       = Singleton <RelationMgr> .Instance
                                                .GetPassiveRelations(destChr.EntityId.Low, CharacterRelationType.GroupInvite)
                                                .FirstOrDefault <IBaseRelation>();

                if (relation1 != null && Environment.TickCount - int.Parse(relation1.Note) > 30000)
                {
                    Singleton <RelationMgr> .Instance.RemoveRelation(relation1);
                }
                Character target;
                if (Group.CheckInvite(activeCharacter, out target, name) == GroupResult.NoError)
                {
                    HashSet <IBaseRelation> relations =
                        Singleton <RelationMgr> .Instance.GetRelations(activeCharacter.EntityId.Low,
                                                                       CharacterRelationType.GroupInvite);

                    if (group != null && relations.Count >= (int)group.InvitesLeft)
                    {
                        return;
                    }
                    BaseRelation relation2 = RelationMgr.CreateRelation(activeCharacter.EntityId.Low,
                                                                        target.EntityId.Low, CharacterRelationType.GroupInvite);
                    relation2.Note = Environment.TickCount.ToString((IFormatProvider)CultureInfo.InvariantCulture);
                    Singleton <RelationMgr> .Instance.AddRelation(relation2);

                    Asda2GroupHandler.SendInviteToPartyResponseOrRequestToAnotherPlayerResponse(target.Client,
                                                                                                PartyInviteStatusRequest.Invite, client.ActiveCharacter.Name);
                    Asda2GroupHandler.SendPartyIniteResponseResponse(client, activeCharacter, target,
                                                                     PartyInviteStatusResponse.SomeOneRevicingYourInvation);
                }
                else
                {
                    Asda2GroupHandler.SendPartyIniteResponseResponse(client, activeCharacter, target,
                                                                     PartyInviteStatusResponse.ThereIsNoOneToInvite);
                }
            }
        }
示例#4
0
        public static void SendPartyInviteRequest(IRealmClient client, RealmPacketIn packet)
        {
            packet.Position -= 8;
            Character characterBySessionId = World.GetCharacterBySessionId(packet.ReadUInt16());

            if (characterBySessionId == null)
            {
                return;
            }
            Asda2GroupHandler.OnPartyInviteRequest(client, characterBySessionId);
        }
示例#5
0
 private static void NotifyMoving(Character chr)
 {
     if (chr.IsInGroup)
     {
         Asda2GroupHandler.SendPartyMemberPositionInfoResponse(chr);
     }
     if (chr.IsSoulmated)
     {
         Asda2SoulmateHandler.SendSoulmatePositionResponse(chr.Client);
     }
     if (chr.IsAsda2BattlegroundInProgress)
     {
         Asda2BattlegroundHandler.SendCharacterPositionInfoOnWarResponse(chr);
     }
 }
示例#6
0
 private static void NotifyMoving(Character chr)
 {
     chr.Map.CallDelayed(3000, (Action)(() =>
     {
         if (chr.IsInGroup)
         {
             Asda2GroupHandler.SendPartyMemberPositionInfoResponse(chr);
         }
         if (chr.IsSoulmated)
         {
             Asda2SoulmateHandler.SendSoulmatePositionResponse(chr.Client);
         }
         if (!chr.IsAsda2BattlegroundInProgress)
         {
             return;
         }
         Asda2BattlegroundHandler.SendCharacterPositionInfoOnWarResponse(chr);
     }));
 }