Files
caliverse_server/GameServer/Contents/SwitchingProp/Helper/SwitchingPropHelper.cs
2025-05-01 07:20:41 +09:00

49 lines
1.6 KiB
C#

using Google.Protobuf;
using Google.Protobuf.WellKnownTypes;
using ServerCore;
using ServerBase;
using ServerCommon;
using ServerCommon.BusinessLogDomain;
using MetaAssets;
namespace GameServer;
public static class SwitchingPropHelper
{
public static void send_GS2C_NTF_SWITCHING_PROP_STATE(Player player)
{
var attribute = player.getEntityAttribute<SwitchingPropAttribute>();
NullReferenceCheckHelper.throwIfNull(attribute, () => $"attribute is null !!! - player:{player.toBasicString()}");
var ntf_packet = new ClientToGame();
ntf_packet.Message = new ClientToGameMessage();
ntf_packet.Message.NtfSwitchingPropState = new();
foreach (var prop in attribute.m_switching_props)
{
SwitchingPropState state = new();
state.SwitchingPropId = prop.Key;
state.PropState = prop.Value;
ntf_packet.Message.NtfSwitchingPropState.SwitchingPropState.Add(state);
}
GameServerApp.getServerLogic().onSendPacket(player, ntf_packet);
}
public static void send_GS2C_NTF_SWITCHING_PROP_STATE(Player player, Int32 propId, Int32 propState)
{
var ntf_packet = new ClientToGame();
ntf_packet.Message = new ClientToGameMessage();
ntf_packet.Message.NtfSwitchingPropState = new();
SwitchingPropState state = new();
state.SwitchingPropId = propId;
state.PropState = propState;
ntf_packet.Message.NtfSwitchingPropState.SwitchingPropState.Add(state);
GameServerApp.getServerLogic().onSendPacket(player, ntf_packet);
}
}