feat : 파티 패킷 추가 / 채널 접속시 모든 파티 리스트 전달

This commit is contained in:
qornwh1
2026-03-10 09:40:00 +09:00
parent a3bcbd073e
commit 9828b967a1
4 changed files with 88 additions and 35 deletions

View File

@@ -251,7 +251,7 @@ public class GameServer : ServerBase
Channel.Channel channel = cm.GetChannel(channelId);
Player? myPlayer = channel.GetPlayer(hashKey);
// 1. 새 유저에게: 자신을 제외한 기존 채널 유저 목록 전송
// 1. 새 유저에게: 자신을 제외한 기존 채널 유저 목록 + 파티 목록 전송
IntoChannelPacket response = new IntoChannelPacket { ChannelId = channelId };
foreach (int userId in channel.GetConnectUsers())
{
@@ -267,6 +267,16 @@ public class GameServer : ServerBase
}
}
foreach (PartyInfo party in channel.GetPartyManager().GetAllParties())
{
response.Parties.Add(new PartyInfoData
{
PartyId = party.PartyId,
LeaderId = party.LeaderId,
MemberPlayerIds = new List<int>(party.PartyMemberIds),
});
}
byte[] toNewUser = PacketSerializer.Serialize<IntoChannelPacket>((ushort)PacketCode.INTO_CHANNEL, response);
SendTo(peer, toNewUser);

View File

@@ -119,6 +119,12 @@ public class PartyManager
return true;
}
// 전체 파티 목록 조회
public IEnumerable<PartyInfo> GetAllParties()
{
return parties.Values;
}
// 조회
public PartyInfo? GetParty(int partyId)
{

View File

@@ -210,6 +210,32 @@ public class LoadChannelPacket
} = new List<ChannelInfo>();
}
// 채널 내 파티 정보 (INTO_CHANNEL 응답에 포함)
[ProtoContract]
public class PartyInfoData
{
[ProtoMember(1)]
public int PartyId
{
get;
set;
}
[ProtoMember(2)]
public int LeaderId
{
get;
set;
}
[ProtoMember(3)]
public List<int> MemberPlayerIds
{
get;
set;
} = new List<int>();
}
// INTO_CHANNEL 클라->서버: 입장할 채널 ID / 서버->클라: 채널 내 나 이외 플레이어 목록
[ProtoContract]
public class IntoChannelPacket
@@ -227,6 +253,13 @@ public class IntoChannelPacket
get;
set;
} = new List<PlayerInfo>(); // 서버->클라: 채널 내 플레이어 목록
[ProtoMember(3)]
public List<PartyInfoData> Parties
{
get;
set;
} = new List<PartyInfoData>(); // 서버->클라: 채널 내 파티 목록
}
// UPDATE_CHANNEL_USER 유저 접속/나감