CombatManager, Monster AI, monster death

This commit is contained in:
xeon 2024-02-17 16:49:28 +03:00
parent 4e82ccb871
commit d733766909
13 changed files with 636 additions and 207 deletions

View file

@ -0,0 +1,14 @@
using Protocol;
namespace GameServer.Controllers.Attributes;
[AttributeUsage(AttributeTargets.Method)]
internal class CombatRequestAttribute : Attribute
{
public CombatRequestData.MessageOneofCase MessageCase { get; }
public CombatRequestAttribute(CombatRequestData.MessageOneofCase messageCase)
{
MessageCase = messageCase;
}
}

View file

@ -16,14 +16,16 @@ internal class ChatSpawnCommandHandler
private readonly EntityFactory _entityFactory; private readonly EntityFactory _entityFactory;
private readonly PlayerSession _session; private readonly PlayerSession _session;
private readonly ConfigManager _configManager; private readonly ConfigManager _configManager;
private readonly CreatureController _creatureController;
public ChatSpawnCommandHandler(ModelManager modelManager, EntitySystem entitySystem, EntityFactory entityFactory, PlayerSession session, ConfigManager configManager) public ChatSpawnCommandHandler(ModelManager modelManager, EntitySystem entitySystem, EntityFactory entityFactory, PlayerSession session, ConfigManager configManager, CreatureController creatureController)
{ {
_helperRoom = modelManager.Chat.GetChatRoom(1338); _helperRoom = modelManager.Chat.GetChatRoom(1338);
_entitySystem = entitySystem; _entitySystem = entitySystem;
_entityFactory = entityFactory; _entityFactory = entityFactory;
_session = session; _session = session;
_configManager = configManager; _configManager = configManager;
_creatureController = creatureController;
} }
[ChatCommand("monster")] [ChatCommand("monster")]
@ -57,6 +59,8 @@ internal class ChatSpawnCommandHandler
EntityPbs = { monster.Pb } EntityPbs = { monster.Pb }
}); });
await _creatureController.UpdateAiHate();
_helperRoom.AddMessage(1338, 0, $"Successfully spawned monster with id {levelEntityId} at ({x}, {y}, {z})"); _helperRoom.AddMessage(1338, 0, $"Successfully spawned monster with id {levelEntityId} at ({x}, {y}, {z})");
} }
} }

View file

@ -0,0 +1,306 @@
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;
using GameServer.Systems.Entity.Component;
using Microsoft.Extensions.Logging;
using Protocol;
namespace GameServer.Controllers.Combat;
internal class CombatManager
{
private delegate Task<CombatResponseData> CombatRequestHandler(CombatManager combatManager, CombatRequestContext context);
private static readonly ImmutableDictionary<CombatRequestData.MessageOneofCase, CombatRequestHandler> s_requestHandlers;
private readonly ILogger _logger;
private readonly EntitySystem _entitySystem;
private readonly PlayerSession _session;
private readonly CreatureController _creatureController;
static CombatManager()
{
s_requestHandlers = MapRequestHandlers();
}
public CombatManager(ILogger<CombatManager> logger, EntitySystem entitySystem, PlayerSession session, CreatureController creatureController)
{
_logger = logger;
_entitySystem = entitySystem;
_session = session;
_creatureController = creatureController;
}
[CombatRequest(CombatRequestData.MessageOneofCase.DamageExecuteRequest)]
public async Task<CombatResponseData> OnDamageExecuteRequest(CombatRequestContext context)
{
DamageExecuteRequest request = context.Request.DamageExecuteRequest;
EntityBase? entity = _entitySystem.Get<EntityBase>(request.TargetEntityId);
if (entity == null)
{
return new CombatResponseData
{
RequestId = context.Request.RequestId,
CombatCommon = context.Request.CombatCommon,
DamageExecuteResponse = new()
{
ErrorCode = (int)ErrorCode.ErrThrowDamageReqEntityIsAlreadyDead
}
};
}
EntityAttributeComponent attr = entity.ComponentSystem.Get<EntityAttributeComponent>();
attr.SetAttribute(EAttributeType.Life, (int)request.DamageId); // Pakchunk patch! (cur hp instead of damageid)
if (request.DamageId <= 0 && entity.Type != EEntityType.Player) // Player death not implemented
{
_entitySystem.Destroy(entity);
await _session.Push(MessageId.EntityRemoveNotify, new EntityRemoveNotify
{
IsRemove = true,
RemoveInfos =
{
new EntityRemoveInfo
{
EntityId = entity.Id,
Type = (int)ERemoveEntityType.RemoveTypeNormal
}
}
});
}
return new CombatResponseData
{
RequestId = context.Request.RequestId,
CombatCommon = context.Request.CombatCommon,
DamageExecuteResponse = new()
{
AttackerEntityId = request.AttackerEntityId,
TargetEntityId = request.TargetEntityId,
ShieldCoverDamage = 0,
Damage = (int)request.DamageId,
PartId = request.PartId
}
};
}
[CombatRequest(CombatRequestData.MessageOneofCase.HitRequest)]
public CombatResponseData OnHitRequest(CombatRequestContext context)
{
return new CombatResponseData
{
RequestId = context.Request.RequestId,
CombatCommon = context.Request.CombatCommon,
HitResponse = new()
{
HitInfo = context.Request.HitRequest.HitInfo
}
};
}
[CombatRequest(CombatRequestData.MessageOneofCase.LogicStateInitRequest)]
public CombatResponseData OnLogicStateInitRequest(CombatRequestContext context)
{
CombatResponseData rsp = new()
{
CombatCommon = context.Request.CombatCommon,
RequestId = context.Request.RequestId,
LogicStateInitResponse = new()
};
EntityBase? entity = _entitySystem.Get<EntityBase>(context.Request.CombatCommon.EntityId);
if (entity == null) return rsp;
EntityLogicStateComponent logicStateComponent = entity.ComponentSystem.Get<EntityLogicStateComponent>();
logicStateComponent.States = [.. context.Request.LogicStateInitRequest.InitData.States];
context.Notifies.Add(new CombatNotifyData
{
CombatCommon = context.Request.CombatCommon,
LogicStateInitNotify = new()
{
CombatCommon = context.Request.CombatCommon,
EntityId = entity.Id,
InitData = logicStateComponent.Pb.LogicStateComponentPb
}
});
return rsp;
}
[CombatRequest(CombatRequestData.MessageOneofCase.SwitchLogicStateRequest)]
public CombatResponseData OnSwitchLogicStateRequest(CombatRequestContext context)
{
CombatResponseData rsp = new()
{
CombatCommon = context.Request.CombatCommon,
RequestId = context.Request.RequestId,
SwitchLogicStateResponse = new()
};
EntityBase? entity = _entitySystem.Get<EntityBase>(context.Request.CombatCommon.EntityId);
if (entity == null)
{
rsp.SwitchLogicStateResponse.ErrorCode = (int)ErrorCode.ErrActionEntityNoExist;
return rsp;
}
EntityLogicStateComponent logicStateComponent = entity.ComponentSystem.Get<EntityLogicStateComponent>();
logicStateComponent.States = [.. context.Request.SwitchLogicStateRequest.States];
context.Notifies.Add(new CombatNotifyData
{
CombatCommon = context.Request.CombatCommon,
SwitchLogicStateNotify = new()
{
States = { logicStateComponent.States }
}
});
return rsp;
}
[CombatRequest(CombatRequestData.MessageOneofCase.BattleStateChangeRequest)]
public CombatResponseData OnBattleStateChangeRequest(CombatRequestContext context)
{
return new CombatResponseData
{
CombatCommon = context.Request.CombatCommon,
RequestId = context.Request.RequestId,
BattleStateChangeResponse = new()
};
}
[CombatRequest(CombatRequestData.MessageOneofCase.ChangeStateConfirmRequest)]
public CombatResponseData OnChangeStateConfirmRequest(CombatRequestContext context)
{
CombatResponseData rsp = new()
{
CombatCommon = context.Request.CombatCommon,
RequestId = context.Request.RequestId,
ChangeStateConfirmResponse = new()
{
Error = new()
}
};
EntityBase? entity = _entitySystem.Get<EntityBase>(context.Request.CombatCommon.EntityId);
if (entity == null)
{
rsp.ChangeStateConfirmResponse.Error.ErrorCode = (int)ErrorCode.ErrEntityIsNotAlive;
return rsp;
}
ChangeStateConfirmRequest request = context.Request.ChangeStateConfirmRequest;
if (entity.ComponentSystem.TryGet(out EntityFsmComponent? fsmComponent))
{
DFsm? dfsm = fsmComponent.Fsms.FirstOrDefault(fsm => fsm.FsmId == request.FsmId);
dfsm ??= new()
{
FsmId = request.FsmId,
Status = 1,
Flag = (int)EFsmStateFlag.Confirmed
};
dfsm.CurrentState = request.State;
context.Notifies.Add(new CombatNotifyData
{
CombatCommon = context.Request.CombatCommon,
ChangeStateConfirmNotify = new ChangeStateConfirmNotify
{
State = request.State,
FsmId = request.FsmId
}
});
}
rsp.ChangeStateConfirmResponse.State = context.Request.ChangeStateConfirmRequest.State;
rsp.ChangeStateConfirmResponse.FsmId = context.Request.ChangeStateConfirmRequest.FsmId;
return rsp;
}
[CombatRequest(CombatRequestData.MessageOneofCase.FsmConditionPassRequest)]
public CombatResponseData OnFsmConditionPassRequest(CombatRequestContext context)
{
return new CombatResponseData
{
CombatCommon = context.Request.CombatCommon,
RequestId = context.Request.RequestId,
FsmConditionPassResponse = new()
{
FsmId = context.Request.FsmConditionPassRequest.FsmId,
Error = new()
}
};
}
[CombatRequest(CombatRequestData.MessageOneofCase.AiInformationRequest)]
public CombatResponseData OnAiInformationRequest(CombatRequestContext context)
{
// Currently like this, TODO!
context.Notifies.Add(new CombatNotifyData
{
CombatCommon = new CombatCommon
{
EntityId = context.Request.CombatCommon.EntityId, // id of monster
},
AiHateNotify = new AiHateNotify
{
HateList =
{
new AiHateEntity
{
EntityId = _creatureController.GetPlayerEntity()!.Id, // id of hated entity (the player)
HatredValue = 99999
}
}
}
});
return new CombatResponseData
{
CombatCommon = context.Request.CombatCommon,
RequestId = context.Request.RequestId,
AiInformationResponse = new() // ?? contains nothing
};
}
public Task<CombatResponseData?> HandleRequest(CombatRequestContext context)
{
if (s_requestHandlers.TryGetValue(context.Request.MessageCase, out CombatRequestHandler? handler))
return handler(this, context)!;
_logger.LogWarning("Combat request not handled: {type}", context.Request.MessageCase);
return Task.FromResult<CombatResponseData?>(null);
}
private static ImmutableDictionary<CombatRequestData.MessageOneofCase, CombatRequestHandler> MapRequestHandlers()
{
var builder = ImmutableDictionary.CreateBuilder<CombatRequestData.MessageOneofCase, CombatRequestHandler>();
MethodInfo taskFromResultMethod = typeof(Task).GetMethod(nameof(Task.FromResult))!.MakeGenericMethod(typeof(CombatResponseData));
foreach (MethodInfo method in typeof(CombatManager).GetMethods())
{
CombatRequestAttribute? attribute = method.GetCustomAttribute<CombatRequestAttribute>();
if (attribute == null) continue;
ParameterExpression combatManagerParam = Expression.Parameter(typeof(CombatManager));
ParameterExpression contextParam = Expression.Parameter(typeof(CombatRequestContext));
Expression call = Expression.Call(combatManagerParam, method, contextParam);
if (method.ReturnType == typeof(CombatResponseData))
call = Expression.Call(taskFromResultMethod, call);
Expression<CombatRequestHandler> lambda = Expression.Lambda<CombatRequestHandler>(call, combatManagerParam, contextParam);
builder.Add(attribute.MessageCase, lambda.Compile());
}
return builder.ToImmutable();
}
}

View file

@ -0,0 +1,14 @@
using Protocol;
namespace GameServer.Controllers.Combat;
internal class CombatRequestContext
{
public CombatRequestData Request { get; }
public List<CombatNotifyData> Notifies { get; }
public CombatRequestContext(CombatRequestData request)
{
Request = request;
Notifies = [];
}
}

View file

@ -1,4 +1,5 @@
using GameServer.Controllers.Attributes; using GameServer.Controllers.Attributes;
using GameServer.Controllers.Combat;
using GameServer.Network; using GameServer.Network;
using GameServer.Network.Messages; using GameServer.Network.Messages;
using Protocol; using Protocol;
@ -12,5 +13,33 @@ internal class CombatMessageController : Controller
} }
[NetEvent(MessageId.CombatSendPackRequest)] // TODO: CombatSendPackRequest is important [NetEvent(MessageId.CombatSendPackRequest)] // TODO: CombatSendPackRequest is important
public ResponseMessage OnCombatSendPackRequest() => Response(MessageId.CombatSendPackResponse, new CombatSendPackResponse()); public async Task<ResponseMessage> OnCombatSendPackRequest(CombatSendPackRequest request, CombatManager combatManager)
{
CombatReceivePackNotify combatPackNotify = new();
foreach (CombatSendData sendData in request.Data)
{
if (sendData.Request != null)
{
CombatRequestContext context = new(sendData.Request);
CombatResponseData? responseData = await combatManager.HandleRequest(context);
combatPackNotify.Data.AddRange(context.Notifies.Select(notify => new CombatReceiveData
{
CombatNotifyData = notify
}));
if (responseData != null)
{
combatPackNotify.Data.Add(new CombatReceiveData
{
CombatResponseData = responseData
});
}
}
}
await Session.Push(MessageId.CombatReceivePackNotify, combatPackNotify);
return Response(MessageId.CombatSendPackResponse, new CombatSendPackResponse());
}
} }

View file

@ -67,9 +67,10 @@ internal class CreatureController : Controller
} }
[NetEvent(MessageId.SceneLoadingFinishRequest)] [NetEvent(MessageId.SceneLoadingFinishRequest)]
public ResponseMessage OnSceneLoadingFinishRequest() public async Task<ResponseMessage> OnSceneLoadingFinishRequest()
{ {
_modelManager.Creature.OnWorldDone(); _modelManager.Creature.OnWorldDone();
await UpdateAiHate();
return Response(MessageId.SceneLoadingFinishResponse, new SceneLoadingFinishResponse()); return Response(MessageId.SceneLoadingFinishResponse, new SceneLoadingFinishResponse());
} }
@ -79,10 +80,7 @@ internal class CreatureController : Controller
{ {
// Remove old entities // Remove old entities
IEnumerable<PlayerEntity> oldEntities = _entitySystem.EnumerateEntities() IEnumerable<PlayerEntity> oldEntities = GetPlayerEntities().ToArray();
.Where(e => e is PlayerEntity entity && entity.PlayerId == _modelManager.Player.Id)
.Cast<PlayerEntity>().ToArray();
foreach (PlayerEntity oldEntity in oldEntities) foreach (PlayerEntity oldEntity in oldEntities)
{ {
_entitySystem.Destroy(oldEntity); _entitySystem.Destroy(oldEntity);
@ -105,10 +103,7 @@ internal class CreatureController : Controller
CreateTeamPlayerEntities(); CreateTeamPlayerEntities();
IEnumerable<PlayerEntity> newEntities = _entitySystem.EnumerateEntities() IEnumerable<PlayerEntity> newEntities = GetPlayerEntities();
.Where(e => e is PlayerEntity entity && entity.PlayerId == _modelManager.Player.Id)
.Cast<PlayerEntity>();
await Session.Push(MessageId.EntityAddNotify, new EntityAddNotify await Session.Push(MessageId.EntityAddNotify, new EntityAddNotify
{ {
IsAdd = true, IsAdd = true,
@ -124,6 +119,8 @@ internal class CreatureController : Controller
PlayerId = _modelManager.Player.Id, PlayerId = _modelManager.Player.Id,
FightRoleInfos = { GetFightRoleInfos() } FightRoleInfos = { GetFightRoleInfos() }
}); });
await UpdateAiHate();
} }
[GameEvent(GameEventType.VisionSkillChanged)] [GameEvent(GameEventType.VisionSkillChanged)]
@ -165,13 +162,43 @@ internal class CreatureController : Controller
prevEntity.IsCurrentRole = false; prevEntity.IsCurrentRole = false;
PlayerEntity? newEntity = _entitySystem.EnumerateEntities().FirstOrDefault(e => e is PlayerEntity playerEntity && playerEntity.ConfigId == roleId) as PlayerEntity; if (_entitySystem.EnumerateEntities().FirstOrDefault(e => e is PlayerEntity playerEntity && playerEntity.ConfigId == roleId) is not PlayerEntity newEntity) return;
if (newEntity == null) return;
_modelManager.Creature.PlayerEntityId = newEntity.Id; _modelManager.Creature.PlayerEntityId = newEntity.Id;
newEntity.IsCurrentRole = true; newEntity.IsCurrentRole = true;
await OnVisionSkillChanged(); await UpdateAiHate();
}
public async Task UpdateAiHate()
{
IEnumerable<EntityBase> monsters = _entitySystem.EnumerateEntities().Where(e => e is MonsterEntity);
if (!monsters.Any()) return;
await Session.Push(MessageId.CombatReceivePackNotify, new CombatReceivePackNotify
{
Data =
{
monsters.Select(monster => new CombatReceiveData
{
CombatNotifyData = new()
{
CombatCommon = new() { EntityId = monster.Id },
AiHateNotify = new()
{
HateList =
{
GetPlayerEntities().Select(player => new AiHateEntity
{
EntityId = player.Id,
HatredValue = 99999 // currently this, TODO!
})
}
}
}
})
}
});
} }
private SceneInformation CreateSceneInfo() => new() private SceneInformation CreateSceneInfo() => new()
@ -200,11 +227,7 @@ internal class CreatureController : Controller
private IEnumerable<FightRoleInformation> GetFightRoleInfos() private IEnumerable<FightRoleInformation> GetFightRoleInfos()
{ {
IEnumerable<PlayerEntity> playerEntities = _entitySystem.EnumerateEntities() return GetPlayerEntities().Select(playerEntity => new FightRoleInformation
.Where(e => e is PlayerEntity entity && entity.PlayerId == _modelManager.Player.Id)
.Cast<PlayerEntity>();
return playerEntities.Select(playerEntity => new FightRoleInformation
{ {
EntityId = playerEntity.Id, EntityId = playerEntity.Id,
CurHp = playerEntity.Health, CurHp = playerEntity.Health,

View file

@ -35,8 +35,9 @@ internal class RoleController : Controller
} }
[NetEvent(MessageId.SwitchRoleRequest)] [NetEvent(MessageId.SwitchRoleRequest)]
public ResponseMessage OnSwitchRoleRequest(SwitchRoleRequest request) public async Task<ResponseMessage> OnSwitchRoleRequest(SwitchRoleRequest request, CreatureController creatureController)
{ {
await creatureController.SwitchPlayerEntity(request.RoleId);
return Response(MessageId.SwitchRoleResponse, new SwitchRoleResponse return Response(MessageId.SwitchRoleResponse, new SwitchRoleResponse
{ {
RoleId = request.RoleId RoleId = request.RoleId

View file

@ -1,6 +1,7 @@
using Core.Config; using Core.Config;
using Core.Extensions; using Core.Extensions;
using GameServer.Controllers.ChatCommands; using GameServer.Controllers.ChatCommands;
using GameServer.Controllers.Combat;
using GameServer.Controllers.Factory; using GameServer.Controllers.Factory;
using GameServer.Controllers.Manager; using GameServer.Controllers.Manager;
using GameServer.Extensions; using GameServer.Extensions;
@ -39,7 +40,8 @@ internal static class Program
.AddScoped<RpcManager>().AddScoped<IRpcEndPoint, RpcSessionEndPoint>() .AddScoped<RpcManager>().AddScoped<IRpcEndPoint, RpcSessionEndPoint>()
.AddSingleton<SessionManager>() .AddSingleton<SessionManager>()
.AddScoped<EventSystem>().AddScoped<EntitySystem>().AddScoped<EntityFactory>() .AddScoped<EventSystem>().AddScoped<EntitySystem>().AddScoped<EntityFactory>()
.AddScoped<ModelManager>().AddScoped<ControllerManager>().AddScoped<ChatCommandManager>() .AddScoped<ModelManager>().AddScoped<ControllerManager>()
.AddScoped<CombatManager>().AddScoped<ChatCommandManager>()
.AddHostedService<WWGameServer>(); .AddHostedService<WWGameServer>();
IHost host = builder.Build(); IHost host = builder.Build();

View file

@ -37,6 +37,7 @@ internal class EntityAttributeComponent : EntityComponentBase
} }
attribute.CurrentValue = currentValue; attribute.CurrentValue = currentValue;
attribute.BaseValue = currentValue;
} }
public int GetAttribute(EAttributeType type) public int GetAttribute(EAttributeType type)

View file

@ -1,4 +1,5 @@
using Protocol; using System.Diagnostics.CodeAnalysis;
using Protocol;
namespace GameServer.Systems.Entity.Component; namespace GameServer.Systems.Entity.Component;
internal class EntityComponentSystem internal class EntityComponentSystem
@ -25,7 +26,7 @@ internal class EntityComponentSystem
return (_components.Single(component => component is TEntityComponent) as TEntityComponent)!; return (_components.Single(component => component is TEntityComponent) as TEntityComponent)!;
} }
public bool TryGet<TEntityComponent>(out TEntityComponent? component) where TEntityComponent : EntityComponentBase public bool TryGet<TEntityComponent>([NotNullWhen(true)] out TEntityComponent? component) where TEntityComponent : EntityComponentBase
{ {
return (component = _components.SingleOrDefault(component => component is TEntityComponent) as TEntityComponent) != null; return (component = _components.SingleOrDefault(component => component is TEntityComponent) as TEntityComponent) != null;
} }

View file

@ -0,0 +1,22 @@
using Protocol;
namespace GameServer.Systems.Entity.Component;
internal class EntityLogicStateComponent : EntityComponentBase
{
public List<int> States { get; set; }
public EntityLogicStateComponent()
{
States = [];
}
public override EntityComponentType Type => EntityComponentType.LogicState;
public override EntityComponentPb Pb => new()
{
LogicStateComponentPb = new()
{
States = { States }
}
};
}

View file

@ -28,6 +28,8 @@ internal abstract class EntityBase
public virtual void OnCreate() public virtual void OnCreate()
{ {
State = EntityState.Born; State = EntityState.Born;
_ = ComponentSystem.Create<EntityLogicStateComponent>();
} }
public virtual void Activate() public virtual void Activate()

View file

@ -1604,78 +1604,84 @@ message CombatMaxCaseMessageResponse { // MessageId: 11987
message CombatNotifyData { message CombatNotifyData {
CombatCommon combat_common = 1; CombatCommon combat_common = 1;
CreateBulletNotify create_bullet_notify = 2; oneof message {
DestroyBulletNotify destroy_bullet_notify = 3; CreateBulletNotify create_bullet_notify = 2;
DamageExecuteNotify damage_execute_notify = 4; DestroyBulletNotify destroy_bullet_notify = 3;
ApplyGameplayEffectNotify apply_gameplay_effect_notify = 5; DamageExecuteNotify damage_execute_notify = 4;
RemoveGameplayEffectNotify remove_gameplay_effect_notify = 6; ApplyGameplayEffectNotify apply_gameplay_effect_notify = 5;
HitNotify hit_notify = 7; RemoveGameplayEffectNotify remove_gameplay_effect_notify = 6;
SkillNotify skill_notify = 8; HitNotify hit_notify = 7;
UseSkillNotify use_skill_notify = 9; SkillNotify skill_notify = 8;
EndSkillNotify end_skill_notify = 10; UseSkillNotify use_skill_notify = 9;
EntityLoadCompleteNotify entity_load_complete_notify = 11; EndSkillNotify end_skill_notify = 10;
PartUpdateNotify part_update_notify = 12; EntityLoadCompleteNotify entity_load_complete_notify = 11;
PartComponentInitNotify part_component_init_notify = 14; PartUpdateNotify part_update_notify = 12;
MaterialNotify material_notify = 15; PartComponentInitNotify part_component_init_notify = 14;
ParticleNotify particle_notify = 16; MaterialNotify material_notify = 15;
EntityIsVisibleNotify entity_is_visible_notify = 17; ParticleNotify particle_notify = 16;
SwitchCharacterStateNotify switch_character_state_notify = 18; EntityIsVisibleNotify entity_is_visible_notify = 17;
PlayerRebackSceneNotify player_reback_scene_notify = 19; SwitchCharacterStateNotify switch_character_state_notify = 18;
LogicStateInitNotify logic_state_init_notify = 20; PlayerRebackSceneNotify player_reback_scene_notify = 19;
SwitchLogicStateNotify switch_logic_state_notify = 21; LogicStateInitNotify logic_state_init_notify = 20;
AttributeChangedNotify attribute_changed_notify = 22; SwitchLogicStateNotify switch_logic_state_notify = 21;
AnimationStateChangedNotify animation_state_changed_notify = 23; AttributeChangedNotify attribute_changed_notify = 22;
AnimationStateInitNotify animation_state_init_notify = 24; AnimationStateChangedNotify animation_state_changed_notify = 23;
ModifyBulletParamsNotify modify_bullet_params_notify = 25; AnimationStateInitNotify animation_state_init_notify = 24;
DrownNotify drown_notify = 26; ModifyBulletParamsNotify modify_bullet_params_notify = 25;
OrderApplyBuffNotify order_apply_buff_notify = 27; DrownNotify drown_notify = 26;
OrderRemoveBuffNotify order_remove_buff_notify = 28; OrderApplyBuffNotify order_apply_buff_notify = 27;
ActivateBuffNotify activate_buff_notify = 29; OrderRemoveBuffNotify order_remove_buff_notify = 28;
OrderRemoveBuffByTagsNotify order_remove_buff_by_tags_notify = 30; ActivateBuffNotify activate_buff_notify = 29;
AiInformationNotify ai_information_notify = 31; OrderRemoveBuffByTagsNotify order_remove_buff_by_tags_notify = 30;
BattleStateChangeNotify battle_state_change_notify = 32; AiInformationNotify ai_information_notify = 31;
AnimationGameplayTagNotify animation_gameplay_tag_notify = 33; BattleStateChangeNotify battle_state_change_notify = 32;
BoneVisibleChangeNotify bone_visible_change_notify = 34; AnimationGameplayTagNotify animation_gameplay_tag_notify = 33;
AiBlackboardCdNotify ai_blackboard_cd_notify = 35; BoneVisibleChangeNotify bone_visible_change_notify = 34;
CaughtNotify caught_notify = 36; AiBlackboardCdNotify ai_blackboard_cd_notify = 35;
EntityStaticHookMoveNotify entity_static_hook_move_notify = 37; CaughtNotify caught_notify = 36;
ChangeStateNotify change_state_notify = 38; EntityStaticHookMoveNotify entity_static_hook_move_notify = 37;
ChangeStateConfirmNotify change_state_confirm_notify = 40; ChangeStateNotify change_state_notify = 38;
BuffStackCountNotify buff_stack_count_notify = 41; ChangeStateConfirmNotify change_state_confirm_notify = 40;
MontagePlayNotify montage_play_notify = 42; BuffStackCountNotify buff_stack_count_notify = 41;
ANStartNotify an_start_notify = 43; MontagePlayNotify montage_play_notify = 42;
FsmResetNotify fsm_reset_notify = 44; ANStartNotify an_start_notify = 43;
DamageRecordNotify damage_record_notify = 45; FsmResetNotify fsm_reset_notify = 44;
AiHateNotify ai_hate_notify = 46; DamageRecordNotify damage_record_notify = 45;
FsmBlackboardNotify fsm_blackboard_notify = 47; AiHateNotify ai_hate_notify = 46;
CharacterBattleStateChangeNotify character_battle_state_change_notify = 48; FsmBlackboardNotify fsm_blackboard_notify = 47;
FormationBuffApplyNotify formation_buff_apply_notify = 49; CharacterBattleStateChangeNotify character_battle_state_change_notify = 48;
FormationBuffStackNotify formation_buff_stack_notify = 50; FormationBuffApplyNotify formation_buff_apply_notify = 49;
FormationBuffApplyS2cRequestNotify formation_buff_apply_s2c_request_notify = 51; FormationBuffStackNotify formation_buff_stack_notify = 50;
FormationBuffRemoveS2cRequestNotify formation_buff_remove_s2c_request_notify = 52; FormationBuffApplyS2cRequestNotify formation_buff_apply_s2c_request_notify = 51;
ApplyBuffS2cRequestNotify apply_buff_s2c_request_notify = 53; FormationBuffRemoveS2cRequestNotify formation_buff_remove_s2c_request_notify = 52;
RemoveBuffS2cRequestNotify remove_buff_s2c_request_notify = 54; ApplyBuffS2cRequestNotify apply_buff_s2c_request_notify = 53;
FormationBuffRemoveNotify formation_buff_remove_notify = 55; RemoveBuffS2cRequestNotify remove_buff_s2c_request_notify = 54;
FormationBuffActivateNotify formation_buff_activate_notify = 56; FormationBuffRemoveNotify formation_buff_remove_notify = 55;
ActorVisibleNotify actor_visible_notify = 57; FormationBuffActivateNotify formation_buff_activate_notify = 56;
RecoverPropChangedNotify recover_prop_changed_notify = 58; ActorVisibleNotify actor_visible_notify = 57;
RemoveBuffByIdS2cRequestNotify remove_buff_by_id_s2c_request_notify = 59; RecoverPropChangedNotify recover_prop_changed_notify = 58;
FormationBuffRemoveByIdS2cRequestNotify formation_buff_remove_by_id_s2c_request_notify = 60; RemoveBuffByIdS2cRequestNotify remove_buff_by_id_s2c_request_notify = 59;
FormationBuffRemoveByIdS2cRequestNotify formation_buff_remove_by_id_s2c_request_notify = 60;
}
} }
message CombatPushData { message CombatPushData {
CombatCommon combat_common = 1; CombatCommon combat_common = 1;
FormationBuffApplyS2cResponsePush formation_buff_apply_s2c_response_push = 2; oneof message {
FormationBuffRemoveS2cResponsePush formation_buff_remove_s2c_response_push = 3; FormationBuffApplyS2cResponsePush formation_buff_apply_s2c_response_push = 2;
ApplyBuffS2cResponsePush apply_buff_s2c_response_push = 4; FormationBuffRemoveS2cResponsePush formation_buff_remove_s2c_response_push = 3;
RemoveBuffS2cResponsePush remove_buff_s2c_response_push = 5; ApplyBuffS2cResponsePush apply_buff_s2c_response_push = 4;
RemoveBuffByIdS2cResponsePush remove_buff_by_id_s2c_response_push = 6; RemoveBuffS2cResponsePush remove_buff_s2c_response_push = 5;
FormationBuffRemoveByIdS2cResponsePush formation_buff_remove_by_id_s2c_response_push = 7; RemoveBuffByIdS2cResponsePush remove_buff_by_id_s2c_response_push = 6;
FormationBuffRemoveByIdS2cResponsePush formation_buff_remove_by_id_s2c_response_push = 7;
}
} }
message CombatReceiveData { message CombatReceiveData {
CombatNotifyData combat_notify_data = 2; oneof message {
CombatResponseData combat_response_data = 3; CombatNotifyData combat_notify_data = 2;
CombatResponseData combat_response_data = 3;
}
} }
message CombatReceivePackNotify { // MessageId: 1332 message CombatReceivePackNotify { // MessageId: 1332
@ -1685,131 +1691,135 @@ message CombatReceivePackNotify { // MessageId: 1332
message CombatRequestData { message CombatRequestData {
CombatCommon combat_common = 1; CombatCommon combat_common = 1;
int32 request_id = 2; int32 request_id = 2;
CreateBulletRequest create_bullet_request = 3; oneof message {
DestroyBulletRequest destroy_bullet_request = 4; CreateBulletRequest create_bullet_request = 3;
DamageExecuteRequest damage_execute_request = 5; DestroyBulletRequest destroy_bullet_request = 4;
ApplyGameplayEffectRequest apply_gameplay_effect_request = 6; DamageExecuteRequest damage_execute_request = 5;
RemoveGameplayEffectRequest remove_gameplay_effect_request = 7; ApplyGameplayEffectRequest apply_gameplay_effect_request = 6;
HitRequest hit_request = 8; RemoveGameplayEffectRequest remove_gameplay_effect_request = 7;
HitEndRequest hit_end_request = 9; HitRequest hit_request = 8;
SkillRequest skill_request = 10; HitEndRequest hit_end_request = 9;
UseSkillRequest use_skill_request = 11; SkillRequest skill_request = 10;
EndSkillRequest end_skill_request = 12; UseSkillRequest use_skill_request = 11;
PartUpdateRequest part_update_request = 13; EndSkillRequest end_skill_request = 12;
MaterialRequest material_request = 14; PartUpdateRequest part_update_request = 13;
ParticleRequest particle_request = 15; MaterialRequest material_request = 14;
EntityIsVisibleRequest entity_is_visible_request = 16; ParticleRequest particle_request = 15;
SwitchCharacterStateRequest switch_character_state_request = 17; EntityIsVisibleRequest entity_is_visible_request = 16;
LogicStateInitRequest logic_state_init_request = 18; SwitchCharacterStateRequest switch_character_state_request = 17;
SwitchLogicStateRequest switch_logic_state_request = 19; LogicStateInitRequest logic_state_init_request = 18;
AnimationStateChangedRequest animation_state_changed_request = 20; SwitchLogicStateRequest switch_logic_state_request = 19;
AnimationStateInitRequest animation_state_init_request = 21; AnimationStateChangedRequest animation_state_changed_request = 20;
ModifyBulletParamsRequest modify_bullet_params_request = 22; AnimationStateInitRequest animation_state_init_request = 21;
DrownRequest drown_request = 23; ModifyBulletParamsRequest modify_bullet_params_request = 22;
OrderApplyBuffRequest order_apply_buff_request = 24; DrownRequest drown_request = 23;
OrderRemoveBuffRequest order_remove_buff_request = 25; OrderApplyBuffRequest order_apply_buff_request = 24;
ActivateBuffRequest activate_buff_request = 26; OrderRemoveBuffRequest order_remove_buff_request = 25;
OrderRemoveBuffByTagsRequest order_remove_buff_by_tags_request = 27; ActivateBuffRequest activate_buff_request = 26;
AiInformationRequest ai_information_request = 28; OrderRemoveBuffByTagsRequest order_remove_buff_by_tags_request = 27;
ToughCalcExtraRatioChangeRequest tough_calc_extra_ratio_change_request = 29; AiInformationRequest ai_information_request = 28;
BattleStateChangeRequest battle_state_change_request = 30; ToughCalcExtraRatioChangeRequest tough_calc_extra_ratio_change_request = 29;
AnimationGameplayTagRequest animation_gameplay_tag_request = 31; BattleStateChangeRequest battle_state_change_request = 30;
BoneVisibleChangeRequest bone_visible_change_request = 32; AnimationGameplayTagRequest animation_gameplay_tag_request = 31;
AiBlackboardsRequest ai_blackboards_request = 33; BoneVisibleChangeRequest bone_visible_change_request = 32;
AiBlackboardCdRequest ai_blackboard_cd_request = 34; AiBlackboardsRequest ai_blackboards_request = 33;
AiHateRequest ai_hate_request = 35; AiBlackboardCdRequest ai_blackboard_cd_request = 34;
MonsterBoomRequest monster_boom_request = 36; AiHateRequest ai_hate_request = 35;
CaughtRequest caught_request = 37; MonsterBoomRequest monster_boom_request = 36;
EntityStaticHookMoveRequest entity_static_hook_move_request = 38; CaughtRequest caught_request = 37;
ChangeStateRequest change_state_request = 39; EntityStaticHookMoveRequest entity_static_hook_move_request = 38;
ChangeStateConfirmRequest change_state_confirm_request = 40; ChangeStateRequest change_state_request = 39;
FsmConditionPassRequest fsm_condition_pass_request = 41; ChangeStateConfirmRequest change_state_confirm_request = 40;
BuffStackCountRequest buff_stack_count_request = 42; FsmConditionPassRequest fsm_condition_pass_request = 41;
MontagePlayRequest montage_play_request = 43; BuffStackCountRequest buff_stack_count_request = 42;
ANStartRequest an_start_request = 44; MontagePlayRequest montage_play_request = 43;
UseSkillFailRequest use_skill_fail_request = 45; ANStartRequest an_start_request = 44;
EnterViewDirectionRequest enter_view_direction_request = 46; UseSkillFailRequest use_skill_fail_request = 45;
ExitViewDirectionRequest exit_view_direction_request = 47; EnterViewDirectionRequest enter_view_direction_request = 46;
PassiveSkillAddRequest passive_skill_add_request = 48; ExitViewDirectionRequest exit_view_direction_request = 47;
PassiveSkillActiveRequest passive_skill_active_request = 49; PassiveSkillAddRequest passive_skill_add_request = 48;
InterruptSkillInDelayRequest interrupt_skill_in_delay_request = 50; PassiveSkillActiveRequest passive_skill_active_request = 49;
TriggerExitSkillRequest trigger_exit_skill_request = 51; InterruptSkillInDelayRequest interrupt_skill_in_delay_request = 50;
FormationBuffApplyRequest formation_buff_apply_request = 52; TriggerExitSkillRequest trigger_exit_skill_request = 51;
FormationBuffStackRequest formation_buff_stack_request = 53; FormationBuffApplyRequest formation_buff_apply_request = 52;
FormationBuffRemoveRequest formation_buff_remove_request = 54; FormationBuffStackRequest formation_buff_stack_request = 53;
FormationBuffActivateRequest formation_buff_activate_request = 55; FormationBuffRemoveRequest formation_buff_remove_request = 54;
ActorVisibleRequest actor_visible_request = 56; FormationBuffActivateRequest formation_buff_activate_request = 55;
BuffEffectRequest buff_effect_request = 57; ActorVisibleRequest actor_visible_request = 56;
FragileChangeRequest fragile_change_request = 58; BuffEffectRequest buff_effect_request = 57;
RTimeStopRequest r_time_stop_request = 59; FragileChangeRequest fragile_change_request = 58;
DrownEndTeleportRequest drown_end_teleport_request = 60; RTimeStopRequest r_time_stop_request = 59;
MonsterDrownRequest monster_drown_request = 61; DrownEndTeleportRequest drown_end_teleport_request = 60;
CombatMaxCaseMessageRequest combat_max_case_message_request = 62; MonsterDrownRequest monster_drown_request = 61;
CombatMaxCaseMessageRequest combat_max_case_message_request = 62;
}
CombatContext context = 100; CombatContext context = 100;
} }
message CombatResponseData { message CombatResponseData {
CombatCommon combat_common = 1; CombatCommon combat_common = 1;
int32 request_id = 2; int32 request_id = 2;
CreateBulletResponse create_bullet_response = 3; oneof message {
DestroyBulletResponse destroy_bullet_response = 4; CreateBulletResponse create_bullet_response = 3;
DamageExecuteResponse damage_execute_response = 5; DestroyBulletResponse destroy_bullet_response = 4;
ApplyGameplayEffectResponse apply_gameplay_effect_response = 6; DamageExecuteResponse damage_execute_response = 5;
RemoveGameplayEffectResponse remove_gameplay_effect_response = 7; ApplyGameplayEffectResponse apply_gameplay_effect_response = 6;
HitResponse hit_response = 8; RemoveGameplayEffectResponse remove_gameplay_effect_response = 7;
HitEndResponse hit_end_response = 9; HitResponse hit_response = 8;
SkillResponse skill_response = 10; HitEndResponse hit_end_response = 9;
UseSkillResponse use_skill_response = 11; SkillResponse skill_response = 10;
EndSkillResponse end_skill_response = 12; UseSkillResponse use_skill_response = 11;
PartUpdateResponse part_update_response = 13; EndSkillResponse end_skill_response = 12;
MaterialResponse material_response = 14; PartUpdateResponse part_update_response = 13;
ParticleResponse particle_response = 15; MaterialResponse material_response = 14;
EntityIsVisibleResponse entity_is_visible_response = 16; ParticleResponse particle_response = 15;
SwitchCharacterStateResponse switch_character_state_response = 17; EntityIsVisibleResponse entity_is_visible_response = 16;
LogicStateInitResponse logic_state_init_response = 18; SwitchCharacterStateResponse switch_character_state_response = 17;
SwitchLogicStateResponse switch_logic_state_response = 19; LogicStateInitResponse logic_state_init_response = 18;
AnimationStateChangedResponse animation_state_changed_response = 20; SwitchLogicStateResponse switch_logic_state_response = 19;
AnimationStateInitResponse animation_state_init_response = 21; AnimationStateChangedResponse animation_state_changed_response = 20;
ModifyBulletParamsResponse modify_bullet_params_response = 22; AnimationStateInitResponse animation_state_init_response = 21;
DrownResponse drown_response = 23; ModifyBulletParamsResponse modify_bullet_params_response = 22;
OrderApplyBuffResponse order_apply_buff_response = 24; DrownResponse drown_response = 23;
OrderRemoveBuffResponse order_remove_buff_response = 25; OrderApplyBuffResponse order_apply_buff_response = 24;
ActivateBuffResponse activate_buff_response = 26; OrderRemoveBuffResponse order_remove_buff_response = 25;
OrderRemoveBuffByTagsResponse order_remove_buff_by_tags_response = 27; ActivateBuffResponse activate_buff_response = 26;
AiInformationResponse ai_information_response = 28; OrderRemoveBuffByTagsResponse order_remove_buff_by_tags_response = 27;
ToughCalcExtraRatioChangeResponse tough_calc_extra_ratio_change_response = 29; AiInformationResponse ai_information_response = 28;
BattleStateChangeResponse battle_state_change_response = 30; ToughCalcExtraRatioChangeResponse tough_calc_extra_ratio_change_response = 29;
AnimationGameplayTagResponse animation_gameplay_tag_response = 31; BattleStateChangeResponse battle_state_change_response = 30;
BoneVisibleChangeResponse bone_visible_change_response = 32; AnimationGameplayTagResponse animation_gameplay_tag_response = 31;
AiBlackboardsResponse ai_blackboards_response = 33; BoneVisibleChangeResponse bone_visible_change_response = 32;
AiBlackboardCdResponse ai_blackboard_cd_response = 34; AiBlackboardsResponse ai_blackboards_response = 33;
AiHateResponse ai_hate_response = 35; AiBlackboardCdResponse ai_blackboard_cd_response = 34;
MonsterBoomResponse monster_boom_response = 36; AiHateResponse ai_hate_response = 35;
CaughtResponse caught_response = 37; MonsterBoomResponse monster_boom_response = 36;
EntityStaticHookMoveResponse entity_static_hook_move_response = 38; CaughtResponse caught_response = 37;
ChangeStateResponse change_state_response = 39; EntityStaticHookMoveResponse entity_static_hook_move_response = 38;
ChangeStateConfirmResponse change_state_confirm_response = 40; ChangeStateResponse change_state_response = 39;
FsmConditionPassResponse fsm_condition_pass_response = 41; ChangeStateConfirmResponse change_state_confirm_response = 40;
BuffStackCountResponse buff_stack_count_response = 42; FsmConditionPassResponse fsm_condition_pass_response = 41;
MontagePlayResponse montage_play_response = 43; BuffStackCountResponse buff_stack_count_response = 42;
ANStartResponse an_start_response = 44; MontagePlayResponse montage_play_response = 43;
UseSkillFailResponse use_skill_fail_response = 45; ANStartResponse an_start_response = 44;
EnterViewDirectionResponse enter_view_direction_response = 46; UseSkillFailResponse use_skill_fail_response = 45;
ExitViewDirectionResponse exit_view_direction_response = 47; EnterViewDirectionResponse enter_view_direction_response = 46;
PassiveSkillAddResponse passive_skill_add_response = 48; ExitViewDirectionResponse exit_view_direction_response = 47;
PassiveSkillActiveResponse passive_skill_active_response = 49; PassiveSkillAddResponse passive_skill_add_response = 48;
InterruptSkillInDelayResponse interrupt_skill_in_delay_response = 50; PassiveSkillActiveResponse passive_skill_active_response = 49;
TriggerExitSkillResponse trigger_exit_skill_response = 51; InterruptSkillInDelayResponse interrupt_skill_in_delay_response = 50;
FormationBuffApplyResponse formation_buff_apply_response = 52; TriggerExitSkillResponse trigger_exit_skill_response = 51;
FormationBuffStackResponse formation_buff_stack_response = 53; FormationBuffApplyResponse formation_buff_apply_response = 52;
FormationBuffRemoveResponse formation_buff_remove_response = 54; FormationBuffStackResponse formation_buff_stack_response = 53;
FormationBuffActivateResponse formation_buff_activate_response = 55; FormationBuffRemoveResponse formation_buff_remove_response = 54;
ActorVisibleResponse actor_visible_response = 56; FormationBuffActivateResponse formation_buff_activate_response = 55;
BuffEffectResponse buff_effect_response = 57; ActorVisibleResponse actor_visible_response = 56;
FragileChangeResponse fragile_change_response = 58; BuffEffectResponse buff_effect_response = 57;
RTimeStopResponse r_time_stop_response = 59; FragileChangeResponse fragile_change_response = 58;
DrownEndTeleportResponse drown_end_teleport_response = 60; RTimeStopResponse r_time_stop_response = 59;
MonsterDrownResponse monster_drown_response = 61; DrownEndTeleportResponse drown_end_teleport_response = 60;
MonsterDrownResponse monster_drown_response = 61;
}
} }
message CombatSendData { message CombatSendData {