초기커밋

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,46 @@
using Google.Protobuf;
using Google.Protobuf.WellKnownTypes;
using ServerCore;
using ServerBase;
using ServerCommon.BusinessLogDomain;
using MetaAssets;
using WORLD_META_ID = System.UInt32;
namespace ServerCommon;
public static class ServerMetricsHelper
{
public static async Task<(Result, List<ServerInfo>)> getServerInfoAll(this IWithServerMetrics serverMetrics)
{
var result = new Result();
var server_metrics_request = serverMetrics.getServerMetricsCacheRequest();
NullReferenceCheckHelper.throwIfNull(server_metrics_request, () => $"server_metrics_request is null - {serverMetrics.toBasicString()}");
var handler_type = (uint)ServerMetricsCacheRequest.TriggerType.ServerMetrics_AllGetAndFill;
var world_meta_ids = new List<WORLD_META_ID>();
foreach (var worldData in MetaData.Instance._WorldMetaTable)
{
world_meta_ids.Add((WORLD_META_ID)worldData.Value.Id);
}
var with_result = await server_metrics_request.tryRunTriggerHandler(handler_type, world_meta_ids);
if (with_result.Result.isFail())
{
return (with_result.Result, new List<ServerInfo>());
}
if (with_result.isResultOnly())
{
return (result, new List<ServerInfo>());
}
var result_value_server_info = with_result as ResultValue<List<ServerInfo>>;
NullReferenceCheckHelper.throwIfNull(result_value_server_info, () => $"result_value_server_info is null - {serverMetrics.toBasicString()}");
return (result, result_value_server_info.ValueOfResult);
}
}