Files
caliverse_server/GameServer/Contents/Party/RabbitMessageHandler/NotifyChangePartyNameHandler.cs
2025-05-01 07:20:41 +09:00

47 lines
1.3 KiB
C#

using Google.Protobuf;
using Google.Protobuf.WellKnownTypes;
using ServerCore;
using ServerBase;
using ServerCommon;
using ServerCommon.BusinessLogDomain;
using MetaAssets;
using USER_GUID = System.String;
namespace GameServer;
public class NotifyChangePartyNameHandler
{
public async Task recvChangePartyNameHandler(ServerMessage.Types.ExchangePartyNameNoti notify)
{
var global_party = GameServerApp.getServerLogic().findGlobalEntity<GlobalParty>();
ArgumentNullException.ThrowIfNull(global_party);
var party = global_party.getParty(notify.PartyGuid);
ArgumentNullException.ThrowIfNull(party);
var party_info_action = party.getEntityAction<GlobalPartyDetailInfoAction>();
ArgumentNullException.ThrowIfNull(party_info_action);
// 1. 파티명 변경
var result = await party_info_action.changePartyName(notify.NewPartyName, false);
if (result.isFail()) return;
// 2. 파티명 변경 알림
var message = new ClientToGame()
{
Message = new()
{
ExchangePartyNameNoti = new()
{
NewPartyName = notify.NewPartyName
}
}
};
PartyHelper.BroadcastToClients(party, message, new List<USER_GUID>());
}
}