More combat handlers
This commit is contained in:
parent
32b7c987bf
commit
e20c69f465
6 changed files with 57 additions and 14 deletions
|
@ -1,7 +1,6 @@
|
||||||
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;
|
||||||
|
@ -33,6 +32,45 @@ 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)
|
||||||
{
|
{
|
||||||
|
@ -209,12 +247,18 @@ 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)
|
||||||
{
|
{
|
||||||
FsmId = request.FsmId,
|
dfsm = new DFsm
|
||||||
Status = 1,
|
{
|
||||||
Flag = (int)EFsmStateFlag.Confirmed
|
FsmId = request.FsmId,
|
||||||
};
|
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,7 +1,6 @@
|
||||||
using GameServer.Controllers.Attributes;
|
using GameServer.Controllers.Attributes;
|
||||||
using GameServer.Controllers.Combat;
|
using GameServer.Controllers.Combat;
|
||||||
using GameServer.Network;
|
using GameServer.Network;
|
||||||
using GameServer.Network.Messages;
|
|
||||||
using Protocol;
|
using Protocol;
|
||||||
|
|
||||||
namespace GameServer.Controllers;
|
namespace GameServer.Controllers;
|
||||||
|
|
|
@ -288,8 +288,9 @@ 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.Get<EntityConcomitantsComponent>();
|
EntityConcomitantsComponent concomitants = entity.ComponentSystem.Create<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>();
|
||||||
|
@ -297,6 +298,7 @@ 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,6 +15,8 @@ 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,10 +37,6 @@ 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);
|
||||||
|
|
||||||
|
@ -82,7 +78,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;
|
public override bool IsVisible => IsCurrentRole || IsConcomitant;
|
||||||
|
|
||||||
public override EntityPb Pb
|
public override EntityPb Pb
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue