초기커밋

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,90 @@
using Newtonsoft.Json;
using ServerCommon;
using ServerCore; using ServerBase;
namespace GameServer;
internal partial class LocationAction
{
public async Task<Result> tryMoveToBattleIndun(InstanceRoomInfo instanceRoomInfo, Pos? enterPos = null, bool isReturn = false)
{
var result = new Result();
var err_msg = string.Empty;
var player = getOwner() as Player;
NullReferenceCheckHelper.throwIfNull(player, () => $"player is null !!!");
var server_logic = GameServerApp.getServerLogic();
var location_attribute = player.getEntityAttribute<LocationAttribute>();
NullReferenceCheckHelper.throwIfNull(location_attribute, () => $"location_attribute is null !!! - {player.toBasicString()}");
NullReferenceCheckHelper.throwIfNull(m_current_loaction, () => $"m_current_loaction is null !!! - {player.toBasicString()}");
NullReferenceCheckHelper.throwIfNull(m_location_cache_request_nullable, () => "Current Location Cache is null !!");
if (!MetaData.Instance._IndunTable.TryGetValue(instanceRoomInfo.InstanceId, out var indun_data))
{
err_msg = $"Failed to MetaData.TryGetValue() !!! : instanceMetaId:{instanceRoomInfo.InstanceId} - {player.toBasicString()}";
result.setFail(ServerErrorCode.InstanceMetaDataNotFound, err_msg);
Log.getLogger().error(result.toBasicString());
return result;
}
if (server_logic.getServerType().toServerType() == ServerType.Channel)
{
location_attribute.LastestChannelServerLocation.ServerName = server_logic.getServerName();
location_attribute.LastestChannelServerLocation.WorldMetaId = (int)server_logic.getWorldId();
location_attribute.LastestChannelServerLocation.SpawnPos = m_current_loaction.SpawnPos;
location_attribute.LastestChannelServerLocation.ForwardAngle = m_current_loaction.ForwardAngle;
server_logic.getReturnManager().addReturnUser(player.getUserGuid());
}
else if (isReturn == false)
{
IndunLocation indun_location = new();
indun_location.InstanceRoomId = location_attribute.CurrentIndunLocation.InstanceRoomId;
indun_location.InstanceMetaId = location_attribute.CurrentIndunLocation.InstanceMetaId;
indun_location.SpawnPos = m_current_loaction.SpawnPos;
indun_location.ForwardAngle = m_current_loaction.ForwardAngle;
location_attribute.ReturnIndunLocations.Add(indun_location);
server_logic.getReturnManager().addReturnUser(player.getUserGuid());
}
if (enterPos != null)
{
enterPos.Z += 100;
}
location_attribute.EnterIndunLocation.InstanceRoomId = instanceRoomInfo.roomId;
location_attribute.EnterIndunLocation.InstanceMetaId = instanceRoomInfo.InstanceId;
location_attribute.EnterIndunLocation.fromPos(enterPos == null ? MapManager.Instance.GetStartPos(indun_data.RoomFile) : enterPos);
location_attribute.modifiedEntityAttribute();
var location_cache = m_location_cache_request_nullable.getLocationCache();
NullReferenceCheckHelper.throwIfNull(location_cache, () => $"location_cache is null !!! - {player.toBasicString()}");
location_cache.copyCacheFromEntityAttribute(location_attribute);
result = await m_location_cache_request_nullable.upsertLocation();
if (result.isFail())
{
err_msg = $"Failed to upsertLocation() !!! : {result.toBasicString()}";
Log.getLogger().error(err_msg);
return result;
}
return result;
}
public LocationCacheRequest? getBattleLocationCacheRequestNullable()
{
return m_location_cache_request_nullable;
}
}