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.Linq.Expressions;
|
||||
using System.Reflection;
|
||||
using System.Security.Cryptography;
|
||||
using GameServer.Controllers.Attributes;
|
||||
using GameServer.Network;
|
||||
using GameServer.Systems.Entity;
|
||||
|
@ -33,6 +32,45 @@ 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)
|
||||
{
|
||||
|
@ -209,13 +247,19 @@ internal class CombatManager
|
|||
if (entity.ComponentSystem.TryGet(out EntityFsmComponent? fsmComponent))
|
||||
{
|
||||
DFsm? dfsm = fsmComponent.Fsms.FirstOrDefault(fsm => fsm.FsmId == request.FsmId);
|
||||
dfsm ??= new()
|
||||
|
||||
if (dfsm == null)
|
||||
{
|
||||
dfsm = new DFsm
|
||||
{
|
||||
FsmId = request.FsmId,
|
||||
Status = 1,
|
||||
Flag = (int)EFsmStateFlag.Confirmed
|
||||
};
|
||||
|
||||
fsmComponent.Fsms.Add(dfsm);
|
||||
}
|
||||
|
||||
dfsm.CurrentState = request.State;
|
||||
context.Notifies.Add(new CombatNotifyData
|
||||
{
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
using GameServer.Controllers.Attributes;
|
||||
using GameServer.Controllers.Combat;
|
||||
using GameServer.Network;
|
||||
using GameServer.Network.Messages;
|
||||
using Protocol;
|
||||
|
||||
namespace GameServer.Controllers;
|
||||
|
|
|
@ -288,8 +288,9 @@ internal class CreatureController : Controller
|
|||
PlayerEntity concomitant = _entityFactory.CreatePlayer(roleId, 0);
|
||||
_entitySystem.Create(concomitant);
|
||||
|
||||
EntityConcomitantsComponent concomitants = entity.ComponentSystem.Get<EntityConcomitantsComponent>();
|
||||
EntityConcomitantsComponent concomitants = entity.ComponentSystem.Create<EntityConcomitantsComponent>();
|
||||
concomitants.CustomEntityIds.Clear();
|
||||
concomitants.VisionEntityId = concomitant.Id;
|
||||
concomitants.CustomEntityIds.Add(concomitant.Id);
|
||||
|
||||
EntitySummonerComponent summoner = concomitant.ComponentSystem.Create<EntitySummonerComponent>();
|
||||
|
@ -297,6 +298,7 @@ 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,6 +15,8 @@ internal abstract class EntityBase
|
|||
|
||||
public EntityState State { get; protected set; }
|
||||
|
||||
public bool IsConcomitant => ComponentSystem.TryGet<EntitySummonerComponent>(out _);
|
||||
|
||||
public EntityBase(long id)
|
||||
{
|
||||
Id = id;
|
||||
|
|
|
@ -37,10 +37,6 @@ 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);
|
||||
|
||||
|
@ -82,7 +78,7 @@ internal class PlayerEntity : EntityBase
|
|||
public override EEntityType Type => EEntityType.Player;
|
||||
public override EntityConfigType ConfigType => EntityConfigType.Character;
|
||||
|
||||
public override bool IsVisible => IsCurrentRole;
|
||||
public override bool IsVisible => IsCurrentRole || IsConcomitant;
|
||||
|
||||
public override EntityPb Pb
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue