초기커밋

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,67 @@
using Google.Protobuf;
using Google.Protobuf.WellKnownTypes;
using ServerCore;
using ServerBase;
using ServerCommon;
using ServerCommon.BusinessLogDomain;
using MetaAssets;
using USER_GUID = System.String;
namespace GameServer;
public class ReservationManager : ReservationManagerBase
{
public ReservationManager()
{
base.onInit(GameServerApp.getServerLogic());
}
protected override async Task<bool> checkReservationCondition(ServerMoveType moveType, USER_GUID reservationUserGuid)
{
// 1. server block 체크
var block_enable = GameServerApp.getServerLogic().getAccountLoginBlockEnable();
if (true == block_enable.Value)
{
return false;
}
// 2. 기존 예약 유저 체크
if (m_reservation_user_manager.checkReserved(reservationUserGuid))
{
return true;
}
// 3. return user 체크
if (GameServerApp.getServerLogic().getReturnManager().isReturnUser(reservationUserGuid))
return true;
// 4. free count 체크 ( 리턴으로 인한 예약이면 return_count 에 포함되는 인원임 )
var free_count = await checkFreeSessionCount();
// 5. Force 이동 체크
if (moveType == ServerMoveType.Force && free_count >= 1)
return true;
// 6. 입장 허용치 계산
return calculateConnectionRate(free_count);
}
protected override async Task<int> checkFreeSessionCount()
{
await Task.CompletedTask;
var server_logic = GameServerApp.getServerLogic();
var pround_net_listener = server_logic.getProudNetListener();
var max_connection_count = pround_net_listener.getMaxConnectionCount();
// 잔여 공간 계산 : MaxCount - ( 유저 Connection 수 + 입장 예약자 수 + 리턴 예약자 수 + 비컨 설치 수 )
var delete_count = pround_net_listener.getEntityWithSessions().Count + m_reservation_user_manager.Count + server_logic.getReturnManager().getReturnUserCount() + UgcNpcCountManager.Instance.calculateNpcCount();
var free_count = max_connection_count - delete_count;
return free_count;
}
}

View File

@@ -0,0 +1,12 @@
using ServerCommon;
namespace GameServer;
public class ReturnManager : ReturnManagerBase
{
public ReturnManager()
{
base.onInit(GameServerApp.getServerLogic());
}
}

View File

@@ -0,0 +1,25 @@
using ServerCommon;
namespace GameServer;
public class UgcNpcCountManager
{
private static readonly Lazy<UgcNpcCountManager> m_instance = new(() => new UgcNpcCountManager());
public static UgcNpcCountManager Instance => m_instance.Value;
public int calculateNpcCount()
{
var count = 0;
// 1. 기본 Map 의 UgcNpc Count
count += GameServerApp.getServerLogic().getMap().getCurrCountAsAddConnectedUser();
// 2. Instance Room 의 UgcNpc Count
count += InstanceRoomManager.Instance.getInstanceRooms().Sum(room => room.Value.getMap().getCurrCountAsAddConnectedUser());
return count;
}
}