초기커밋
This commit is contained in:
@@ -0,0 +1,54 @@
|
||||
using ServerCommon;
|
||||
using ServerCore; using ServerBase;
|
||||
using static ClientToGameMessage.Types;
|
||||
|
||||
namespace GameServer
|
||||
{
|
||||
internal static class OwnedBuildingNotifyHelper
|
||||
{
|
||||
public static bool send_S2C_NTF_OWNED_BUILDING_INFOS(this Player player)
|
||||
{
|
||||
var owned_building_agent_action = player.getEntityAction<OwnedBuildingAgentAction>();
|
||||
ArgumentNullException.ThrowIfNull(owned_building_agent_action, $"building_agent_action is null !!!");
|
||||
|
||||
var ntf_packet = new ClientToGame();
|
||||
ntf_packet.Message = new ClientToGameMessage();
|
||||
ntf_packet.Message.NtfOwnedBuildingInfos = new GS2C_NTF_OWNED_BUILDING_INFOS();
|
||||
|
||||
var owned_buildings = owned_building_agent_action.getOwnedBuildings();
|
||||
foreach (var owned_building in owned_buildings)
|
||||
{
|
||||
var owned_building_attribute = owned_building.getEntityAttribute<OwnedBuildingAttribute>();
|
||||
NullReferenceCheckHelper.throwIfNull(owned_building_attribute, () => $"owned_building_attribute is null !!! - {player.toBasicString()}");
|
||||
|
||||
ntf_packet.Message.NtfOwnedBuildingInfos.OwnedBuildingInfos.Add((int)owned_building_attribute.BuildingMetaId);
|
||||
}
|
||||
|
||||
if (false == GameServerApp.getServerLogic().onSendPacket(player, ntf_packet))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public static bool send_S2C_NTF_OWNED_BUILDING_INFOS(this Player player, OwnedBuilding ownedBuilding)
|
||||
{
|
||||
var owned_building_attribute = ownedBuilding.getEntityAttribute<OwnedBuildingAttribute>();
|
||||
NullReferenceCheckHelper.throwIfNull(owned_building_attribute, () => $"owned_building_attribute is null !!! - {player.toBasicString()}");
|
||||
|
||||
var ntf_packet = new ClientToGame();
|
||||
ntf_packet.Message = new ClientToGameMessage();
|
||||
ntf_packet.Message.NtfOwnedBuildingInfos = new GS2C_NTF_OWNED_BUILDING_INFOS();
|
||||
|
||||
ntf_packet.Message.NtfOwnedBuildingInfos.OwnedBuildingInfos.Add((int)owned_building_attribute.BuildingMetaId);
|
||||
|
||||
if (false == GameServerApp.getServerLogic().onSendPacket(player, ntf_packet))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user