예제 #1
0
        public static void OnRemovePartyMember(WorldClient client, INetPacketStream packet)
        {
            var removePartyMemberPacket    = new PartyRemoveMemberPacket(packet);
            var removePartyMemberEventArgs = new PartyRemoveMemberEventArgs(removePartyMemberPacket);

            client.Player.NotifySystem <PartySystem>(removePartyMemberEventArgs);
        }
예제 #2
0
        private void OnRemovePartyMember(IPlayerEntity player, PartyRemoveMemberEventArgs e)
        {
            var partyManager = DependencyContainer.Instance.Resolve <PartyManager>();
            var worldServer  = DependencyContainer.Instance.Resolve <IWorldServer>();

            var member = worldServer.GetPlayerEntityByCharacterId(e.MemberId);

            if (member == null || !member.Party.IsInParty)
            {
                return;
            }

            var party = partyManager.GetPartyById(member.Party.Party.Id);

            if (party == null)
            {
                return;
            }

            if (e.LeaderId != e.MemberId && party.PartyLeaderId != e.LeaderId)
            {
                return;
            }

            if (party.RemoveMember(member))
            {
                if (party.Members.Count < 2)
                {
                    WorldPacketFactory.SendAddPartyMember(party.PartyLeader, null, 0, party.PartyLeader.Object.Name, member.Object.Name);
                    party.PartyLeader.Party.Party = null;
                    partyManager.RemoveParty(party);
                }
                else
                {
                    foreach (var partyMember in party.Members)
                    {
                        WorldPacketFactory.SendAddPartyMember(partyMember, party, member.PlayerData.Id, party.PartyLeader.Object.Name, member.Object.Name);
                    }
                }

                WorldPacketFactory.SendAddPartyMember(member, null, member.PlayerData.Id, party.PartyLeader.Object.Name, member.Object.Name);
            }
        }