Esempio n. 1
0
        public static void HandlePartyInvitationRequestMessage(WorldClient client, PartyInvitationRequestMessage message)
        {
            var target = World.Instance.GetCharacter(message.name);

            if (target == null)
            {
                SendPartyCannotJoinErrorMessage(client, PartyJoinErrorEnum.PARTY_JOIN_ERROR_PLAYER_NOT_FOUND);
                return;
            }

            if (target.FriendsBook.IsIgnored(client.Account.Id))
            {
                SendPartyCannotJoinErrorMessage(client, PartyJoinErrorEnum.PARTY_JOIN_ERROR_PLAYER_BUSY);
                return;
            }

            if (!target.IsAvailable(client.Character, false))
            {
                SendPartyCannotJoinErrorMessage(client, PartyJoinErrorEnum.PARTY_JOIN_ERROR_PLAYER_BUSY);
                return;
            }
            if (target.IsLoyalToParty(PartyTypeEnum.PARTY_TYPE_CLASSICAL))
            {
                SendPartyCannotJoinErrorMessage(client, PartyJoinErrorEnum.PARTY_JOIN_ERROR_PLAYER_LOYAL);
                // 310		%1 est déjà dans un groupe et refuse les invitations actuellement.
                client.Character.SendInformationMessage(TextInformationTypeEnum.TEXT_INFORMATION_ERROR, 310, target.Name);
                return;
            }

            client.Character.Invite(target, PartyTypeEnum.PARTY_TYPE_CLASSICAL);
        }
Esempio n. 2
0
        public static void HandlePartyInvitationRequest(PartyInvitationRequestMessage message, WorldClient client)
        {
            WorldClient target = WorldServer.Instance.GetOnlineClient(message.name);

            if (target != null)
            {
                client.Character.InviteParty(target.Character);
            }
            else
            {
                client.Character.OnPartyJoinError(PartyJoinErrorEnum.PARTY_JOIN_ERROR_PLAYER_NOT_FOUND);
            }
        }
Esempio n. 3
0
        public static void HandlePartyInvitationRequestMessage(Client client, PartyInvitationRequestMessage message)
        {
            Client targetClient = Server.Clients.FirstOrDefault(target => target.Character.Name == message.name);

            if (targetClient != null && targetClient != client)
            {
                if (client.Character.Party != null)
                {
                    //invite
                }
                else
                {
                    client.Character.Party = new PartyEngine(client, targetClient);
                }
            }
            else
            {
                client.Send(new PartyCannotJoinErrorMessage((sbyte)PartyJoinErrorEnum.PARTY_JOIN_ERROR_PLAYER_NOT_FOUND));
            }
        }
        public static void HandlePartyInvitationRequestMessage(WorldClient client, PartyInvitationRequestMessage message)
        {
            Character character = Singleton <World> .Instance.GetCharacter(message.name);

            if (character == null)
            {
                PartyHandler.SendPartyCannotJoinErrorMessage(client, PartyJoinErrorEnum.PARTY_JOIN_ERROR_PLAYER_NOT_FOUND);
            }
            else
            {
                if (character.IsAway)
                {
                    PartyHandler.SendPartyCannotJoinErrorMessage(client, PartyJoinErrorEnum.PARTY_JOIN_ERROR_PLAYER_BUSY);
                }
                else
                {
                    client.Character.Invite(character);
                }
            }
        }
Esempio n. 5
0
        public static void RequestParty(PartyInvitationRequestMessage message, WorldClient client)
        {
            Party p;

            if (client.Character.PartyMember == null)
            {
                WorldServer.Instance.Parties.OrderBy(x => x.Id);
                int partyId = 0;
                if (WorldServer.Instance.Parties.Count > 0)
                {
                    partyId = WorldServer.Instance.Parties.Last().Id + 1;
                }
                else
                {
                    partyId = 1;
                }
                p = new Party(partyId, client.Character.Id, "");
            }
            else
            {
                p = WorldServer.Instance.Parties.Find(x => x.Id == client.Character.PartyMember.Party.Id);
            }
            if (p == null)
            {
                return;
            }
            WorldClient to = WorldServer.Instance.WorldClients.Find(x => x.Character.Record.Name == message.name);

            p.CreateInvitation(client, to);
            if (p.Members.Count == 0)
            {
                if (to.Character.PartyMember != null && to.Character.PartyMember.Loyal)
                {
                    return;
                }
                p.BossCharacterId = client.Character.Id;
                p.NewMember(client);
            }
        }
Esempio n. 6
0
        private void Invite(string name, AccountUC account)
        {
            PartyInvitationRequestMessage msg = new PartyInvitationRequestMessage(name);

            account.SocketManager.Send(msg);
        }