초기커밋

This commit is contained in:
2025-05-01 07:20:41 +09:00
commit 98bb2e3c5c
2747 changed files with 646947 additions and 0 deletions

View File

@@ -0,0 +1,50 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ServerCore; using ServerBase;
using ServerCommon;
namespace GameServer
{
public static class OwnedBuildingHelper
{
public static async Task<(Result, OwnedBuilding)> createOwnedBuilding(Player player, int buildingMetaId, OwnedType ownedType)
{
var result = new Result();
var err_msg = string.Empty;
var owned_building = new OwnedBuilding(player);
result = await owned_building.onInit();
if (result.isFail())
{
err_msg = $"Failed to OwnedBuilding.onInit() !!! : {result.toBasicString()}";
Log.getLogger().error(err_msg);
return (result, owned_building);
}
var owned_building_attribute = owned_building.getEntityAttribute<OwnedBuildingAttribute>();
NullReferenceCheckHelper.throwIfNull(owned_building_attribute, () => $"owned_building_attribute is null !!!");
owned_building_attribute.BuildingMetaId = (uint)buildingMetaId;
owned_building_attribute.OwnedType = ownedType;
owned_building_attribute.newEntityAttribute();
return (result, owned_building);
}
public static int getBuildingMetaId(this OwnedBuilding ownedBuilding)
{
var owned_building_attribute = ownedBuilding.getEntityAttribute<OwnedBuildingAttribute>();
NullReferenceCheckHelper.throwIfNull(owned_building_attribute, () => $"owned_building_attribute is null !!!");
return (int)owned_building_attribute.BuildingMetaId;
}
}
}

View File

@@ -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;
}
}
}