Compare commits
No commits in common. "d6d7ca6e76db2a5ee88a9a0a0b6b5cb0395c6746" and "32b7c987bf2e43bae863f0c74765e21c3f0a9744" have entirely different histories.
d6d7ca6e76
...
32b7c987bf
7 changed files with 17 additions and 97 deletions
|
@ -1,6 +1,7 @@
|
||||||
using System.Collections.Immutable;
|
using System.Collections.Immutable;
|
||||||
using System.Linq.Expressions;
|
using System.Linq.Expressions;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
using System.Security.Cryptography;
|
||||||
using GameServer.Controllers.Attributes;
|
using GameServer.Controllers.Attributes;
|
||||||
using GameServer.Network;
|
using GameServer.Network;
|
||||||
using GameServer.Systems.Entity;
|
using GameServer.Systems.Entity;
|
||||||
|
@ -32,45 +33,6 @@ internal class CombatManager
|
||||||
_creatureController = creatureController;
|
_creatureController = creatureController;
|
||||||
}
|
}
|
||||||
|
|
||||||
[CombatRequest(CombatRequestData.MessageOneofCase.RTimeStopRequest)]
|
|
||||||
public CombatResponseData OnRTimeStopRequest(CombatRequestContext context) => new()
|
|
||||||
{
|
|
||||||
CombatCommon = context.Request.CombatCommon,
|
|
||||||
RTimeStopResponse = new()
|
|
||||||
};
|
|
||||||
|
|
||||||
[CombatRequest(CombatRequestData.MessageOneofCase.ActivateBuffRequest)]
|
|
||||||
public CombatResponseData OnActivateBuffRequest(CombatRequestContext context) => new()
|
|
||||||
{
|
|
||||||
CombatCommon = context.Request.CombatCommon,
|
|
||||||
ActivateBuffResponse = new()
|
|
||||||
};
|
|
||||||
|
|
||||||
[CombatRequest(CombatRequestData.MessageOneofCase.UseSkillRequest)]
|
|
||||||
public CombatResponseData OnUseSkillRequest(CombatRequestContext context) => new()
|
|
||||||
{
|
|
||||||
CombatCommon = context.Request.CombatCommon,
|
|
||||||
UseSkillResponse = new()
|
|
||||||
{
|
|
||||||
SkillSingleId = context.Request.UseSkillRequest.SkillSingleId,
|
|
||||||
UseSkillInfo = context.Request.UseSkillRequest.UseSkillInfo
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
[CombatRequest(CombatRequestData.MessageOneofCase.ApplyGameplayEffectRequest)]
|
|
||||||
public CombatResponseData OnApplyGameplayEffectRequest(CombatRequestContext context) => new()
|
|
||||||
{
|
|
||||||
CombatCommon = context.Request.CombatCommon,
|
|
||||||
ApplyGameplayEffectResponse = new ApplyGameplayEffectResponse()
|
|
||||||
};
|
|
||||||
|
|
||||||
[CombatRequest(CombatRequestData.MessageOneofCase.RemoveGameplayEffectRequest)]
|
|
||||||
public CombatResponseData OnRemoveGameplayEffectRequest(CombatRequestContext context) => new()
|
|
||||||
{
|
|
||||||
CombatCommon = context.Request.CombatCommon,
|
|
||||||
RemoveGameplayEffectResponse = new RemoveGameplayEffectResponse()
|
|
||||||
};
|
|
||||||
|
|
||||||
[CombatRequest(CombatRequestData.MessageOneofCase.CreateBulletRequest)]
|
[CombatRequest(CombatRequestData.MessageOneofCase.CreateBulletRequest)]
|
||||||
public CombatResponseData OnCreateBulletRequest(CombatRequestContext context)
|
public CombatResponseData OnCreateBulletRequest(CombatRequestContext context)
|
||||||
{
|
{
|
||||||
|
@ -247,18 +209,12 @@ internal class CombatManager
|
||||||
if (entity.ComponentSystem.TryGet(out EntityFsmComponent? fsmComponent))
|
if (entity.ComponentSystem.TryGet(out EntityFsmComponent? fsmComponent))
|
||||||
{
|
{
|
||||||
DFsm? dfsm = fsmComponent.Fsms.FirstOrDefault(fsm => fsm.FsmId == request.FsmId);
|
DFsm? dfsm = fsmComponent.Fsms.FirstOrDefault(fsm => fsm.FsmId == request.FsmId);
|
||||||
|
dfsm ??= new()
|
||||||
if (dfsm == null)
|
|
||||||
{
|
{
|
||||||
dfsm = new DFsm
|
FsmId = request.FsmId,
|
||||||
{
|
Status = 1,
|
||||||
FsmId = request.FsmId,
|
Flag = (int)EFsmStateFlag.Confirmed
|
||||||
Status = 1,
|
};
|
||||||
Flag = (int)EFsmStateFlag.Confirmed
|
|
||||||
};
|
|
||||||
|
|
||||||
fsmComponent.Fsms.Add(dfsm);
|
|
||||||
}
|
|
||||||
|
|
||||||
dfsm.CurrentState = request.State;
|
dfsm.CurrentState = request.State;
|
||||||
context.Notifies.Add(new CombatNotifyData
|
context.Notifies.Add(new CombatNotifyData
|
||||||
|
|
|
@ -1,44 +1,18 @@
|
||||||
using GameServer.Controllers.Attributes;
|
using GameServer.Controllers.Attributes;
|
||||||
using GameServer.Controllers.Combat;
|
using GameServer.Controllers.Combat;
|
||||||
using GameServer.Models;
|
|
||||||
using GameServer.Network;
|
using GameServer.Network;
|
||||||
using GameServer.Systems.Entity;
|
using GameServer.Network.Messages;
|
||||||
using GameServer.Systems.Event;
|
|
||||||
using Microsoft.Extensions.Logging;
|
|
||||||
using Protocol;
|
using Protocol;
|
||||||
|
|
||||||
namespace GameServer.Controllers;
|
namespace GameServer.Controllers;
|
||||||
internal class CombatMessageController : Controller
|
internal class CombatMessageController : Controller
|
||||||
{
|
{
|
||||||
private readonly ILogger _logger;
|
public CombatMessageController(PlayerSession session) : base(session)
|
||||||
|
|
||||||
public CombatMessageController(PlayerSession session, ILogger<CombatMessageController> logger) : base(session)
|
|
||||||
{
|
{
|
||||||
_logger = logger;
|
// CombatMessageController.
|
||||||
}
|
}
|
||||||
|
|
||||||
[NetEvent(MessageId.MovePackagePush)]
|
[NetEvent(MessageId.CombatSendPackRequest)] // TODO: CombatSendPackRequest is important
|
||||||
public async Task OnMovePackagePush(MovePackagePush push, EntitySystem entitySystem, EventSystem eventSystem, ModelManager modelManager)
|
|
||||||
{
|
|
||||||
foreach (MovingEntityData movingEntityData in push.MovingEntities)
|
|
||||||
{
|
|
||||||
EntityBase? entity = entitySystem.Get<EntityBase>(movingEntityData.EntityId);
|
|
||||||
if (entity == null)
|
|
||||||
{
|
|
||||||
_logger.LogWarning("OnMovePackagePush: moving entity not found! Id: {entityId}", movingEntityData.EntityId);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
MoveReplaySample lastMoveReplay = movingEntityData.MoveInfos.Last();
|
|
||||||
entity.Pos.MergeFrom(lastMoveReplay.Location);
|
|
||||||
entity.Rot.MergeFrom(lastMoveReplay.Rotation);
|
|
||||||
|
|
||||||
if (entity.Id == modelManager.Creature.PlayerEntityId)
|
|
||||||
await eventSystem.Emit(GameEventType.PlayerPositionChanged);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[NetEvent(MessageId.CombatSendPackRequest)]
|
|
||||||
public async Task<RpcResult> OnCombatSendPackRequest(CombatSendPackRequest request, CombatManager combatManager)
|
public async Task<RpcResult> OnCombatSendPackRequest(CombatSendPackRequest request, CombatManager combatManager)
|
||||||
{
|
{
|
||||||
CombatReceivePackNotify combatPackNotify = new();
|
CombatReceivePackNotify combatPackNotify = new();
|
||||||
|
|
|
@ -130,12 +130,6 @@ internal class CreatureController : Controller
|
||||||
await UpdateAiHate();
|
await UpdateAiHate();
|
||||||
}
|
}
|
||||||
|
|
||||||
[GameEvent(GameEventType.PlayerPositionChanged)]
|
|
||||||
public void OnPlayerPositionChanged()
|
|
||||||
{
|
|
||||||
_modelManager.Player.Position.MergeFrom(GetPlayerEntity()!.Pos);
|
|
||||||
}
|
|
||||||
|
|
||||||
[GameEvent(GameEventType.VisionSkillChanged)]
|
[GameEvent(GameEventType.VisionSkillChanged)]
|
||||||
public async Task OnVisionSkillChanged()
|
public async Task OnVisionSkillChanged()
|
||||||
{
|
{
|
||||||
|
@ -180,9 +174,6 @@ internal class CreatureController : Controller
|
||||||
_modelManager.Creature.PlayerEntityId = newEntity.Id;
|
_modelManager.Creature.PlayerEntityId = newEntity.Id;
|
||||||
newEntity.IsCurrentRole = true;
|
newEntity.IsCurrentRole = true;
|
||||||
|
|
||||||
newEntity.Pos.MergeFrom(prevEntity.Pos);
|
|
||||||
newEntity.Rot.MergeFrom(prevEntity.Rot);
|
|
||||||
|
|
||||||
await UpdateAiHate();
|
await UpdateAiHate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -297,9 +288,8 @@ internal class CreatureController : Controller
|
||||||
PlayerEntity concomitant = _entityFactory.CreatePlayer(roleId, 0);
|
PlayerEntity concomitant = _entityFactory.CreatePlayer(roleId, 0);
|
||||||
_entitySystem.Create(concomitant);
|
_entitySystem.Create(concomitant);
|
||||||
|
|
||||||
EntityConcomitantsComponent concomitants = entity.ComponentSystem.Create<EntityConcomitantsComponent>();
|
EntityConcomitantsComponent concomitants = entity.ComponentSystem.Get<EntityConcomitantsComponent>();
|
||||||
concomitants.CustomEntityIds.Clear();
|
concomitants.CustomEntityIds.Clear();
|
||||||
concomitants.VisionEntityId = concomitant.Id;
|
|
||||||
concomitants.CustomEntityIds.Add(concomitant.Id);
|
concomitants.CustomEntityIds.Add(concomitant.Id);
|
||||||
|
|
||||||
EntitySummonerComponent summoner = concomitant.ComponentSystem.Create<EntitySummonerComponent>();
|
EntitySummonerComponent summoner = concomitant.ComponentSystem.Create<EntitySummonerComponent>();
|
||||||
|
@ -307,7 +297,6 @@ internal class CreatureController : Controller
|
||||||
summoner.SummonConfigId = summonConfigId;
|
summoner.SummonConfigId = summonConfigId;
|
||||||
summoner.SummonType = ESummonType.ConcomitantCustom;
|
summoner.SummonType = ESummonType.ConcomitantCustom;
|
||||||
summoner.PlayerId = _modelManager.Player.Id;
|
summoner.PlayerId = _modelManager.Player.Id;
|
||||||
|
|
||||||
concomitant.InitProps(_configManager.GetConfig<BasePropertyConfig>(roleId)!);
|
concomitant.InitProps(_configManager.GetConfig<BasePropertyConfig>(roleId)!);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,7 @@ internal class EntitySummonerComponent : EntityComponentBase
|
||||||
Type = (int)SummonType,
|
Type = (int)SummonType,
|
||||||
SummonerId = SummonerId,
|
SummonerId = SummonerId,
|
||||||
PlayerId = PlayerId,
|
PlayerId = PlayerId,
|
||||||
SummonSkillId = SummonSkillId,
|
SummonSkillId = SummonSkillId
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,8 +15,6 @@ internal abstract class EntityBase
|
||||||
|
|
||||||
public EntityState State { get; protected set; }
|
public EntityState State { get; protected set; }
|
||||||
|
|
||||||
public bool IsConcomitant => ComponentSystem.TryGet<EntitySummonerComponent>(out _);
|
|
||||||
|
|
||||||
public EntityBase(long id)
|
public EntityBase(long id)
|
||||||
{
|
{
|
||||||
Id = id;
|
Id = id;
|
||||||
|
|
|
@ -37,6 +37,10 @@ internal class PlayerEntity : EntityBase
|
||||||
{
|
{
|
||||||
base.OnCreate();
|
base.OnCreate();
|
||||||
|
|
||||||
|
// Should be created immediately
|
||||||
|
EntityConcomitantsComponent concomitantsComponent = ComponentSystem.Create<EntityConcomitantsComponent>();
|
||||||
|
concomitantsComponent.CustomEntityIds.Add(Id);
|
||||||
|
|
||||||
EntityVisionSkillComponent visionSkillComponent = ComponentSystem.Create<EntityVisionSkillComponent>();
|
EntityVisionSkillComponent visionSkillComponent = ComponentSystem.Create<EntityVisionSkillComponent>();
|
||||||
visionSkillComponent.SetExploreTool(1001);
|
visionSkillComponent.SetExploreTool(1001);
|
||||||
|
|
||||||
|
@ -78,7 +82,7 @@ internal class PlayerEntity : EntityBase
|
||||||
public override EEntityType Type => EEntityType.Player;
|
public override EEntityType Type => EEntityType.Player;
|
||||||
public override EntityConfigType ConfigType => EntityConfigType.Character;
|
public override EntityConfigType ConfigType => EntityConfigType.Character;
|
||||||
|
|
||||||
public override bool IsVisible => IsCurrentRole || IsConcomitant;
|
public override bool IsVisible => IsCurrentRole;
|
||||||
|
|
||||||
public override EntityPb Pb
|
public override EntityPb Pb
|
||||||
{
|
{
|
||||||
|
|
|
@ -6,7 +6,6 @@ internal enum GameEventType
|
||||||
PushDataDone,
|
PushDataDone,
|
||||||
|
|
||||||
// Actions
|
// Actions
|
||||||
PlayerPositionChanged,
|
|
||||||
FormationUpdated,
|
FormationUpdated,
|
||||||
VisionSkillChanged,
|
VisionSkillChanged,
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue