fix : 서버 설정파일 빼기 작업

This commit is contained in:
qornwh1
2026-03-16 11:14:38 +09:00
parent f6067047d9
commit f2bc3d7924
6 changed files with 100 additions and 23 deletions

View File

@@ -457,7 +457,7 @@ public class GameServer : ServerBase
newParty.DeepCopySemi(preParty);
// 최대 인원 체크
if (newChannel.UserCount + newParty.PartyMemberIds.Count >= newChannel.UserCountMax)
if (newChannel.UserCount + preParty.PartyMemberIds.Count >= newChannel.UserCountMax)
{
Log.Warning("[GameServer] INTO_CHANNEL_PARTY 채널 인원 초과 HashKey={Key} ChannelId={ChannelId} UserCount={Count}/{Max}",
hashKey, packet.ChannelId, newChannel.UserCount, newChannel.UserCountMax);
@@ -497,8 +497,9 @@ public class GameServer : ServerBase
Type = PartyUpdateType.DELETE,
LeaderId = preParty.LeaderId,
};
BroadcastToChannel(preChannelId,
PacketSerializer.Serialize<UpdatePartyPacket>((ushort)PacketCode.UPDATE_PARTY, notify)); // 채널 전체 파티 목록 갱신
// 채널 전체 파티 목록 갱신
BroadcastToChannel(preChannelId, PacketSerializer.Serialize<UpdatePartyPacket>((ushort)PacketCode.UPDATE_PARTY, notify));
// 새로운 채널에 파티원 넣기
foreach (int memberId in newParty.PartyMemberIds)
@@ -525,17 +526,22 @@ public class GameServer : ServerBase
}
// 새로운 채널에 파티를 추가한다.
newChannel.GetPartyManager().CreateParty(newParty.LeaderId, newParty.PartyName, out newParty, newParty.PartyMemberIds);
// 새 채널 기존 유저들에게 파티 생성 알림
UpdatePartyPacket createNotify = new UpdatePartyPacket
if (newChannel.GetPartyManager().CreateParty(newParty.LeaderId, newParty.PartyName, out PartyInfo? createdParty, newParty.PartyMemberIds) && createdParty != null)
{
PartyId = newParty.PartyId,
Type = PartyUpdateType.CREATE,
LeaderId = newParty.LeaderId,
PartyName = newParty.PartyName,
};
BroadcastToChannel(packet.ChannelId, PacketSerializer.Serialize<UpdatePartyPacket>((ushort)PacketCode.UPDATE_PARTY, createNotify));
// 새 채널 기존 유저들에게 파티 생성 알림
UpdatePartyPacket createNotify = new UpdatePartyPacket
{
PartyId = createdParty.PartyId,
Type = PartyUpdateType.CREATE,
LeaderId = createdParty.LeaderId,
PartyName = createdParty.PartyName,
};
BroadcastToChannel(packet.ChannelId, PacketSerializer.Serialize<UpdatePartyPacket>((ushort)PacketCode.UPDATE_PARTY, createNotify));
}
else
{
Log.Warning("[GameServer] 파티생성 실패 !!!");
}
}
private void OnExitChannel(NetPeer peer, int hashKey, byte[] payload)
@@ -688,7 +694,7 @@ public class GameServer : ServerBase
}
case PartyUpdateType.LEAVE:
{
if (!pm.LeaveParty(hashKey, out PartyInfo? party))
if (!pm.LeaveParty(hashKey, out PartyInfo? party) || party == null)
{
SendError(peer, ErrorCode.PARTY_NOT_IN_PARTY);
return;
@@ -696,7 +702,7 @@ public class GameServer : ServerBase
UpdatePartyPacket notify = new UpdatePartyPacket
{
PartyId = party.PartyId, Type = PartyUpdateType.DELETE, LeaderId = party?.LeaderId ?? 0, PlayerId = hashKey,
PartyId = party.PartyId, Type = PartyUpdateType.DELETE, LeaderId = party.LeaderId, PlayerId = hashKey,
};
// 파티가 남아있으면 살린다.

View File

@@ -15,10 +15,9 @@ public class PartyManager
// 파티 생성
public bool CreateParty(int leaderId, string partyName, out PartyInfo? party, List<int>? memeberIds = null)
{
party = null;
if (playerPartyMap.ContainsKey(leaderId))
{
party = null;
return false; // 이미 파티에 속해있음
}