초기커밋

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,62 @@

using ServerCore;
using ServerBase;
using ServerCommon;
namespace GameServer;
public static class GameZoneMoveHelper
{
public static async Task<Result> moveToAnotherChannel(Player player, ServerInfo destServer, Pos? pos)
{
var server_logic = GameServerApp.getServerLogic();
var server_name = ServerBase.ServerHelper.makeGameServerName(ServerType.Channel, destServer.WorldId, destServer.Channel);
var WORLD_META_ID = destServer.WorldId;
// 1. otp 생성
var (result, reserved_to_switch_server) = await ServerConnectionSwitchHelper.startServerSwitch(player, server_logic.getRedisConnector(), server_name);
if (result.isFail() || null == reserved_to_switch_server) return result;
var game_login_action = player.getEntityAction<GameLoginAction>();
NullReferenceCheckHelper.throwIfNull(game_login_action, () => $"game login action is null !!! - {player.toBasicString()}");
var login_cache = game_login_action.getLoginCacheRequest()?.getLoginCache();
NullReferenceCheckHelper.throwIfNull(login_cache, () => $"login cache is null !!! - player:{player.toBasicString()}");
login_cache.ReservedToSwitchServer = reserved_to_switch_server;
// 2. 이동 정보 저장
var account_attribute = player.getEntityAttribute<AccountAttribute>();
NullReferenceCheckHelper.throwIfNull(account_attribute, () => $"account attribute is null !!! - {player.toBasicString()}");
account_attribute.ToConnectGameServerAddress = destServer.toNetworkAddress();
account_attribute.ToConnectGameServerName = server_name;
account_attribute.OtpForServerConnect = reserved_to_switch_server.OneTimeKey;
account_attribute.modifiedEntityAttribute();
// 3. Buff 정보 수정
var buff_action = player.getEntityAction<BuffAction>();
NullReferenceCheckHelper.throwIfNull(buff_action, () => $"buff action is null !!! - {player.toBasicString()}");
result = await buff_action.MoveServer(EPlaceType.World);
if (result.isFail()) return result;
// 4. 위치 수정
var location_action = player.getEntityAction<LocationAction>();
NullReferenceCheckHelper.throwIfNull(location_action, () => $"location action is null !!! - {player.toBasicString()}");
if (pos == null)
{
pos = location_action.getCurrentPos();
}
result = await location_action.tryMoveToChannel(server_name, WORLD_META_ID, pos);
if (result.isFail())
{
var err_msg = $"Failed to tryMoveToChannel() !!! : {result.toBasicString()}";
Log.getLogger().error(err_msg);
}
return result;
}
}

View File

@@ -0,0 +1,66 @@
using Google.Protobuf;
using Google.Protobuf.WellKnownTypes;
using ServerCore;
using ServerBase;
using ServerCommon;
using ServerCommon.BusinessLogDomain;
using MetaAssets;
namespace GameServer;
public static class GameZoneNofityHelper
{
public static bool send_S2C_NTF_USE_MOUNT_PROP(this Player player, string anchorGuid)
{
var game_zone_action = player.getEntityAction<GameZoneAction>();
NullReferenceCheckHelper.throwIfNull(game_zone_action, () => $"game zone action is null !!! - {player.toBasicString()}");
var ntf_packet = new ClientToGame();
ntf_packet.Message = new();
ntf_packet.Message.UseMountPropNoti = new();
ntf_packet.Message.UseMountPropNoti.AnchorGuid = anchorGuid;
ntf_packet.Message.UseMountPropNoti.ActorGuid = player.getUserGuid();
game_zone_action.broadcast(player, ntf_packet);
return true;
}
public static bool send_S2C_NTF_END_USE_MOUNT_PROP(this Player player, string anchorGuid)
{
var game_zone_action = player.getEntityAction<GameZoneAction>();
NullReferenceCheckHelper.throwIfNull(game_zone_action, () => $"game zone action is null !!! - {player.toBasicString()}");
var ntf_packet = new ClientToGame();
ntf_packet.Message = new();
ntf_packet.Message.EndUseMountPropNoti = new();
ntf_packet.Message.EndUseMountPropNoti.AnchorGuid = anchorGuid;
ntf_packet.Message.EndUseMountPropNoti.ActorGuid = player.getUserGuid();
game_zone_action.broadcast(player, ntf_packet);
return true;
}
public static bool send_S2C_NTF_REWARD_PROP_STATE(this Player player, string anchorGuid, bool isUsable)
{
var game_zone_action = player.getEntityAction<GameZoneAction>();
NullReferenceCheckHelper.throwIfNull(game_zone_action, () => $"game zone action is null !!! - {player.toBasicString()}");
var ntf_packet = new ClientToGame();
ntf_packet.Message = new();
ntf_packet.Message.RewardPropStateNoti = new();
ntf_packet.Message.RewardPropStateNoti.AnchorGuid = anchorGuid;
ntf_packet.Message.RewardPropStateNoti.IsUsable = isUsable ? 1 : 0;
game_zone_action.broadcast(player, ntf_packet);
return true;
}
}

View File

@@ -0,0 +1,49 @@
using Google.Protobuf;
using Google.Protobuf.WellKnownTypes;
using ServerCore;
using ServerBase;
using ServerCommon;
using ServerCommon.BusinessLogDomain;
using MetaAssets;
namespace GameServer;
internal static class PositionBusinessLogHelper
{
public static PositionLogInfo toPositionLogInfo(PositionMoveType positionType, PositionInfo positionInfo)
{
var position_log_info = new PositionLogInfo();
position_log_info.setPositionInfo(positionType, positionInfo);
return position_log_info;
}
public static void setPositionInfo(this PositionLogInfo logData, PositionMoveType positionType, PositionInfo positionInfo)
{
logData.PositionMoveType = positionType.ToString();
logData.ServerName = positionInfo.ServerName;
logData.RoomId = positionInfo.RoomId;
logData.MapType = positionInfo.MapFileType.ToString();
logData.MapMId = positionInfo.MapMid;
logData.Pos = positionInfo.Pos.Clone();
}
public static PositionLogInfo toPositionLogInfo(PositionMoveType positionType, string serverName, string roomId, MapFileType mapFileType, int mapMid, Pos pos)
{
var position_log_info = new PositionLogInfo();
position_log_info.setPositionInfo(positionType, serverName, roomId, mapFileType, mapMid, pos);
return position_log_info;
}
public static void setPositionInfo(this PositionLogInfo logData, PositionMoveType positionType, string serverName, string roomId, MapFileType mapFileType, int mapMid, Pos pos)
{
logData.PositionMoveType = positionType.ToString();
logData.ServerName = serverName;
logData.RoomId = roomId;
logData.MapType = mapFileType.ToString();
logData.MapMId = mapMid;
logData.Pos = pos.Clone();
}
}

View File

@@ -0,0 +1,34 @@
using Google.Protobuf;
using Google.Protobuf.WellKnownTypes;
using ServerCore;
using ServerBase;
using ServerCommon;
using ServerCommon.BusinessLogDomain;
using MetaAssets;
namespace GameServer;
public static class StageBusinessLogHelper
{
public static StageLogInfo toStageLogInfo(StageMoveType stageMoveType, Map map)
{
var max_joiner_count = 0;
if (GameServerApp.getServerLogic().getServerType().toServerType() == ServerType.Channel)
{
max_joiner_count = GameServerApp.getServerLogic().getServerConfig().DefaultMaxUser;
}
else
{
max_joiner_count = InstanceRoomManager.Instance.getRoomCapacity(map.m_room_id);
}
var stage_log_info = new StageLogInfo();
stage_log_info.setLogProperty(stageMoveType, map.MapFileType, map.MapMId, map.m_room_id, max_joiner_count, map.getCurrentPlayerCount());
return stage_log_info;
}
}

View File

@@ -0,0 +1,38 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ServerCommon;
using ServerCommon.BusinessLogDomain;
using MetaAssets;
namespace GameServer
{
public static class TaxiBusinessLogHelper
{
public static TaxiLogInfo toTaxiLogInfo(TaxiMetaData taxiMetaData)
{
var taxi_log_info = new TaxiLogInfo();
taxi_log_info.setTaxiInfo(taxiMetaData);
return taxi_log_info;
}
public static void setTaxiInfo(this TaxiLogInfo logData, TaxiMetaData taxiMetaData)
{
logData.TaxiMID = taxiMetaData.TaxiId;
logData.TaxiType = taxiMetaData.Type.ToString();
logData.Cost = taxiMetaData.UnloadingCost;
logData.UnloadingWorldId = taxiMetaData.UnloadingWorldId;
logData.UnloadingLandId = taxiMetaData.UnloadingLandId;
logData.UnloadingFloor = taxiMetaData.UnloadingFloorId;
logData.UnloadingPos.X = taxiMetaData.UnloadingPositionX;
logData.UnloadingPos.Y = taxiMetaData.UnloadingPositionY;
logData.UnloadingPos.Z = taxiMetaData.UnloadingPositionZ;
logData.UnloadingPos.Angle = taxiMetaData.UnloadingRotate;
}
}
}