초기커밋
This commit is contained in:
@@ -0,0 +1,68 @@
|
||||
using Google.Protobuf;
|
||||
using Google.Protobuf.WellKnownTypes;
|
||||
|
||||
|
||||
using ServerCore;
|
||||
using ServerBase;
|
||||
using ServerCommon;
|
||||
using ServerCommon.BusinessLogDomain;
|
||||
using MetaAssets;
|
||||
|
||||
|
||||
|
||||
namespace GameServer.PacketHandler;
|
||||
|
||||
[PacketHandler("allgameserver", typeof(ServerMessage.Types.GS2GS_NTF_MODIFY_BUILDING_INFO), typeof(NtfModifyBuildingInfoMQPacketHandler), typeof(RabbitMQ4Game))]
|
||||
internal class NtfModifyBuildingInfoMQPacketHandler : PacketRecvHandler
|
||||
{
|
||||
public override async Task<Result> onProcessPacket(ISession session, IMessage recvMessage)
|
||||
{
|
||||
var result = new Result();
|
||||
var err_msg = string.Empty;
|
||||
|
||||
var server_logic = GameServerApp.getServerLogic();
|
||||
|
||||
var message = recvMessage as ServerMessage;
|
||||
ArgumentNullException.ThrowIfNull(message, $"message is null !!!");
|
||||
|
||||
var ntf_modify_building_info = message.NtfModifyBuildingInfo;
|
||||
if (ntf_modify_building_info.ExceptServerName == server_logic.getServerName())
|
||||
return result;
|
||||
|
||||
Log.getLogger().info($"MQ - NtfModifyBuildingInfos");
|
||||
|
||||
var building_infos = ntf_modify_building_info.BuildingInfos.ToList();
|
||||
|
||||
foreach ( var building_info in building_infos )
|
||||
{
|
||||
if (!MapManager.Instance.GetBuildingMapTree(building_info.BuildingMetaId, out var building_map_tree))
|
||||
{
|
||||
err_msg = $"Failed to GetLandMapTree() !!! : LandMetaId:{building_info.BuildingMetaId}";
|
||||
result.setFail(ServerErrorCode.BuildingMapTreeDataNotFound, err_msg);
|
||||
Log.getLogger().error(result.toBasicString());
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
var building_manager = server_logic.getBuildingManager();
|
||||
if (!building_manager.tryGetBuilding(building_info.BuildingMetaId, out var building))
|
||||
{
|
||||
err_msg = $"Failed to tryGetBuilding() !!! : buildingMetaId:{building_info.BuildingMetaId}";
|
||||
result.setFail(ServerErrorCode.BuildingNotFound, err_msg);
|
||||
Log.getLogger().error(result.toBasicString());
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
var building_action = building.getEntityAction<BuildingAction>();
|
||||
ArgumentNullReferenceCheckHelper.throwIfNull(building_action, () => $"building_action is null !!!");
|
||||
|
||||
// 빌딩 정보 수정
|
||||
building_action.modifyBuildingInfo(building_info);
|
||||
}
|
||||
|
||||
BuildingNotifyHelper.broadcast_S2C_NTF_BUILDING_INFOS(building_infos);
|
||||
|
||||
return await Task.FromResult(result);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user