feat : 파티 정보 업데이트 기능 추가
This commit is contained in:
@@ -584,6 +584,28 @@ public class GameServer : ServerBase
|
||||
BroadcastToUsers(party.PartyMemberIds, data); // 전원 (리더 포함)
|
||||
break;
|
||||
}
|
||||
case PartyUpdateType.UPDATE:
|
||||
{
|
||||
if (!pm.UpdateParty(hashKey, req.PartyId, out PartyInfo? party))
|
||||
{
|
||||
SendError(peer, ErrorCode.PARTY_UPDATE_FAILED);
|
||||
return;
|
||||
}
|
||||
|
||||
UpdatePartyPacket notify = new UpdatePartyPacket
|
||||
{
|
||||
PartyId = req.PartyId,
|
||||
Type = PartyUpdateType.LEAVE,
|
||||
LeaderId = party?.LeaderId ?? 0,
|
||||
PlayerId = hashKey,
|
||||
};
|
||||
byte[] data = PacketSerializer.Serialize<UpdatePartyPacket>((ushort)PacketCode.UPDATE_PARTY, notify);
|
||||
if (party != null)
|
||||
{
|
||||
BroadcastToUsers(party.PartyMemberIds, data); // 남은 멤버들에게
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -119,6 +119,27 @@ public class PartyManager
|
||||
return true;
|
||||
}
|
||||
|
||||
// 파티 업데이트
|
||||
public bool UpdateParty(int leaderId, int partyId, out PartyInfo? party)
|
||||
{
|
||||
party = null;
|
||||
|
||||
if (!parties.TryGetValue(partyId, out party))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (party.LeaderId != leaderId)
|
||||
{
|
||||
party = null;
|
||||
return false; // 리더만 업데이트 가능
|
||||
}
|
||||
|
||||
// 파티 이름 변경
|
||||
party.PartyName = party.PartyName;
|
||||
return true;
|
||||
}
|
||||
|
||||
// 전체 파티 목록 조회
|
||||
public IEnumerable<PartyInfo> GetAllParties()
|
||||
{
|
||||
|
||||
@@ -560,6 +560,7 @@ public enum ErrorCode : int
|
||||
PARTY_JOIN_FAILED = 10022,
|
||||
PARTY_NOT_IN_PARTY = 10023,
|
||||
PARTY_DELETE_FAILED = 10024,
|
||||
PARTY_UPDATE_FAILED = 10025,
|
||||
}
|
||||
|
||||
// ERROR (서버 -> 클라)
|
||||
@@ -583,7 +584,8 @@ public enum PartyUpdateType
|
||||
CREATE,
|
||||
DELETE,
|
||||
JOIN,
|
||||
LEAVE
|
||||
LEAVE,
|
||||
UPDATE
|
||||
}
|
||||
|
||||
// REQUEST_PARTY (클라 -> 서버) - CREATE: PartyName 사용 / JOIN·LEAVE·DELETE: PartyId 사용
|
||||
|
||||
Reference in New Issue
Block a user