コード例 #1
0
        public static void JoinParty(Party party, Client client)
        {
            PacketHitList hitlist = null;

            PacketHitList.MethodStart(ref hitlist);

            if (party != null)
            {
                Client leader = party.GetLeader();
                if (Combat.MoveProcessor.IsInAreaRange(1, client.Player.X, client.Player.Y, leader.Player.X, leader.Player.Y))
                {
                    if (party.AddToParty(client))
                    {
                        client.Player.PartyID = party.PartyID;
                        client.Player.AddExpKitModule(new AvailableExpKitModule(Enums.ExpKitModules.Party, true));
                        hitlist.AddPacket(client, PacketBuilder.CreateChatMsg("You have joined the party!", Text.BrightGreen));
                        //PartyMember member = party.FindMember(client.Player.CharID);
                        int slot = party.GetMemberSlot(client.Player.CharID);
                        //Messenger.SendPartyMemberData(client, member, slot);
                        foreach (Client i in party.GetOnlineMemberClients())
                        {
                            if (i.IsPlaying() && i != client)
                            {
                                //PartyMember teamMember = party.Members.FindMember(i.Player.CharID);
                                //int teamMemberSlot = party.Members.GetMemberSlot(i.Player.CharID);
                                //Messenger.SendPartyMemberData(client, teamMember, teamMemberSlot);
                                //Messenger.SendPartyMemberData(i, member, slot);
                                hitlist.AddPacket(i, PacketBuilder.CreateChatMsg(client.Player.Name + " has joined the party!", Text.BrightGreen));
                            }
                            PacketBuilder.AppendPartyMemberData(i, hitlist, slot);
                        }
                    }
                    else
                    {
                        hitlist.AddPacket(client, PacketBuilder.CreateChatMsg("You couldn't join the party!", Text.BrightRed));
                    }
                }
                else
                {
                    Messenger.PlayerMsg(client, "You need to stand next to the leader to join the party!", Text.BrightRed);
                }
            }

            PacketHitList.MethodEnded(ref hitlist);
        }