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.Linq.Expressions;
|
||||
using System.Reflection;
|
||||
using System.Security.Cryptography;
|
||||
using GameServer.Controllers.Attributes;
|
||||
using GameServer.Network;
|
||||
using GameServer.Systems.Entity;
|
||||
|
@ -32,45 +33,6 @@ internal class CombatManager
|
|||
_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)]
|
||||
public CombatResponseData OnCreateBulletRequest(CombatRequestContext context)
|
||||
{
|
||||
|
@ -247,18 +209,12 @@ internal class CombatManager
|
|||
if (entity.ComponentSystem.TryGet(out EntityFsmComponent? fsmComponent))
|
||||
{
|
||||
DFsm? dfsm = fsmComponent.Fsms.FirstOrDefault(fsm => fsm.FsmId == request.FsmId);
|
||||
|
||||
if (dfsm == null)
|
||||
dfsm ??= new()
|
||||
{
|
||||
dfsm = new DFsm
|
||||
{
|
||||
FsmId = request.FsmId,
|
||||
Status = 1,
|
||||
Flag = (int)EFsmStateFlag.Confirmed
|
||||
};
|
||||
|
||||
fsmComponent.Fsms.Add(dfsm);
|
||||
}
|
||||
FsmId = request.FsmId,
|
||||
Status = 1,
|
||||
Flag = (int)EFsmStateFlag.Confirmed
|
||||
};
|
||||
|
||||
dfsm.CurrentState = request.State;
|
||||
context.Notifies.Add(new CombatNotifyData
|
||||
|
|
|
@ -1,44 +1,18 @@
|
|||
using GameServer.Controllers.Attributes;
|
||||
using GameServer.Controllers.Combat;
|
||||
using GameServer.Models;
|
||||
using GameServer.Network;
|
||||
using GameServer.Systems.Entity;
|
||||
using GameServer.Systems.Event;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using GameServer.Network.Messages;
|
||||
using Protocol;
|
||||
|
||||
namespace GameServer.Controllers;
|
||||
internal class CombatMessageController : Controller
|
||||
{
|
||||
private readonly ILogger _logger;
|
||||
|
||||
public CombatMessageController(PlayerSession session, ILogger<CombatMessageController> logger) : base(session)
|
||||
public CombatMessageController(PlayerSession session) : base(session)
|
||||
{
|
||||
_logger = logger;
|
||||
// CombatMessageController.
|
||||
}
|
||||
|
||||
[NetEvent(MessageId.MovePackagePush)]
|
||||
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)]
|
||||
[NetEvent(MessageId.CombatSendPackRequest)] // TODO: CombatSendPackRequest is important
|
||||
public async Task<RpcResult> OnCombatSendPackRequest(CombatSendPackRequest request, CombatManager combatManager)
|
||||
{
|
||||
CombatReceivePackNotify combatPackNotify = new();
|
||||
|
|
|
@ -130,12 +130,6 @@ internal class CreatureController : Controller
|
|||
await UpdateAiHate();
|
||||
}
|
||||
|
||||
[GameEvent(GameEventType.PlayerPositionChanged)]
|
||||
public void OnPlayerPositionChanged()
|
||||
{
|
||||
_modelManager.Player.Position.MergeFrom(GetPlayerEntity()!.Pos);
|
||||
}
|
||||
|
||||
[GameEvent(GameEventType.VisionSkillChanged)]
|
||||
public async Task OnVisionSkillChanged()
|
||||
{
|
||||
|
@ -180,9 +174,6 @@ internal class CreatureController : Controller
|
|||
_modelManager.Creature.PlayerEntityId = newEntity.Id;
|
||||
newEntity.IsCurrentRole = true;
|
||||
|
||||
newEntity.Pos.MergeFrom(prevEntity.Pos);
|
||||
newEntity.Rot.MergeFrom(prevEntity.Rot);
|
||||
|
||||
await UpdateAiHate();
|
||||
}
|
||||
|
||||
|
@ -297,9 +288,8 @@ internal class CreatureController : Controller
|
|||
PlayerEntity concomitant = _entityFactory.CreatePlayer(roleId, 0);
|
||||
_entitySystem.Create(concomitant);
|
||||
|
||||
EntityConcomitantsComponent concomitants = entity.ComponentSystem.Create<EntityConcomitantsComponent>();
|
||||
EntityConcomitantsComponent concomitants = entity.ComponentSystem.Get<EntityConcomitantsComponent>();
|
||||
concomitants.CustomEntityIds.Clear();
|
||||
concomitants.VisionEntityId = concomitant.Id;
|
||||
concomitants.CustomEntityIds.Add(concomitant.Id);
|
||||
|
||||
EntitySummonerComponent summoner = concomitant.ComponentSystem.Create<EntitySummonerComponent>();
|
||||
|
@ -307,7 +297,6 @@ internal class CreatureController : Controller
|
|||
summoner.SummonConfigId = summonConfigId;
|
||||
summoner.SummonType = ESummonType.ConcomitantCustom;
|
||||
summoner.PlayerId = _modelManager.Player.Id;
|
||||
|
||||
concomitant.InitProps(_configManager.GetConfig<BasePropertyConfig>(roleId)!);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ internal class EntitySummonerComponent : EntityComponentBase
|
|||
Type = (int)SummonType,
|
||||
SummonerId = SummonerId,
|
||||
PlayerId = PlayerId,
|
||||
SummonSkillId = SummonSkillId,
|
||||
SummonSkillId = SummonSkillId
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
|
@ -15,8 +15,6 @@ internal abstract class EntityBase
|
|||
|
||||
public EntityState State { get; protected set; }
|
||||
|
||||
public bool IsConcomitant => ComponentSystem.TryGet<EntitySummonerComponent>(out _);
|
||||
|
||||
public EntityBase(long id)
|
||||
{
|
||||
Id = id;
|
||||
|
|
|
@ -37,6 +37,10 @@ internal class PlayerEntity : EntityBase
|
|||
{
|
||||
base.OnCreate();
|
||||
|
||||
// Should be created immediately
|
||||
EntityConcomitantsComponent concomitantsComponent = ComponentSystem.Create<EntityConcomitantsComponent>();
|
||||
concomitantsComponent.CustomEntityIds.Add(Id);
|
||||
|
||||
EntityVisionSkillComponent visionSkillComponent = ComponentSystem.Create<EntityVisionSkillComponent>();
|
||||
visionSkillComponent.SetExploreTool(1001);
|
||||
|
||||
|
@ -78,7 +82,7 @@ internal class PlayerEntity : EntityBase
|
|||
public override EEntityType Type => EEntityType.Player;
|
||||
public override EntityConfigType ConfigType => EntityConfigType.Character;
|
||||
|
||||
public override bool IsVisible => IsCurrentRole || IsConcomitant;
|
||||
public override bool IsVisible => IsCurrentRole;
|
||||
|
||||
public override EntityPb Pb
|
||||
{
|
||||
|
|
|
@ -6,7 +6,6 @@ internal enum GameEventType
|
|||
PushDataDone,
|
||||
|
||||
// Actions
|
||||
PlayerPositionChanged,
|
||||
FormationUpdated,
|
||||
VisionSkillChanged,
|
||||
|
||||
|
|
Loading…
Reference in a new issue