From e8ce90539c808cf7df0944fbfd41a2214d3eccd4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Szymon=20Kami=C5=84ski?= Date: Sun, 9 Feb 2025 14:46:46 +0100 Subject: [PATCH] Add experimental implementations of commands --- .../GameServer/Data/CharacterInventory.cs | 5 + UdpHosts/GameServer/Data/CharacterLoadout.cs | 1 + .../Entities/Character/CharacterEntity.cs | 13 +++ .../Entities/Vehicle/VehicleEntity.cs | 11 +++ UdpHosts/GameServer/IPlayer.cs | 1 + UdpHosts/GameServer/NetworkClient.cs | 6 ++ UdpHosts/GameServer/NetworkPlayer.cs | 7 +- .../StaticDB/Loaders/CustomDBLoader.cs | 6 +- .../Systems/Aptitude/AptitudeTargets.cs | 5 + .../Impact/ImpactRemoveEffectCommand.cs | 15 +++ .../Impact/ImpactToggleEffectCommand.cs | 17 ++-- .../Impact/TeleportInstanceCommand.cs | 39 ++++++++ .../Impact/Todo/TeleportInstanceCommand.cs | 19 ---- .../Interaction/BeginInteractionCommand.cs | 29 +++--- .../Interaction/EndInteractionCommand.cs | 93 ++++++++----------- .../NPC/{Todo => }/NPCSpawnCommand.cs | 10 ++ .../{Todo => }/DestroyAbilityObjectCommand.cs | 8 +- .../{Todo => }/AddAccountGroupCommand.cs | 3 + .../Other/AuthorizeTerminalCommand.cs | 24 ++--- .../Other/ConsumeSuperChargeCommand.cs | 43 +++++++++ .../Other/ModifyOwnerResourcesCommand.cs | 42 +++++++++ .../Commands/Other/RequestArcJobsCommand.cs | 32 +++++++ .../Other/{Todo => }/SendTipMessageCommand.cs | 3 + .../{Todo => }/SetHoverParametersCommand.cs | 11 +++ .../Commands/Other/ShowRewardScreenCommand.cs | 33 +++++++ .../Other/{Todo => }/SlotAbilityCommand.cs | 14 +++ .../Other/Todo/ConsumeSuperChargeCommand.cs | 19 ---- .../Other/Todo/ModifyOwnerResourcesCommand.cs | 19 ---- .../Other/Todo/ReputationModifierCommand.cs | 15 +++ .../Other/Todo/RequestArcJobsCommand.cs | 19 ---- .../Commands/Other/Todo/RestockAmmoCommand.cs | 8 ++ .../Other/Todo/ShowRewardScreenCommand.cs | 19 ---- .../Commands/Other/Todo/UnpackItemCommand.cs | 19 ---- .../Commands/Other/UnpackItemCommand.cs | 35 +++++++ .../Register/LoadRegisterFromLevelCommand.cs | 46 +++++++++ .../LoadRegisterFromResourceCommand.cs | 32 +++++++ .../{Todo => }/PeekRegisterCommand.cs | 5 +- .../Register/{Todo => }/PopRegisterCommand.cs | 3 + .../{Todo => }/PushRegisterCommand.cs | 3 + .../Register/RegisterRandomCommand.cs | 27 ++---- .../Todo/LoadRegisterFromLevelCommand.cs | 19 ---- .../Todo/LoadRegisterFromResourceCommand.cs | 19 ---- .../Requirement/RequireArmyCommand.cs | 36 +++++++ .../Requirement/RequireCAISStateCommand.cs | 54 +++++++++++ .../Requirement/RequireEliteLevelCommand.cs | 35 +++++++ .../Requirement/RequireFriendsCommand.cs | 35 +++++++ .../Requirement/RequireHasEffectCommand.cs | 48 ++++++---- .../RequireInitiatorExistsCommand.cs | 2 +- .../Requirement/RequireIsNPCCommand.cs | 40 ++++++++ .../Requirement/RequireLevelCommand.cs | 44 +++++++++ .../RequireMovementFlagsCommand.cs | 47 ++++++++++ .../Requirement/RequireNeedsAmmoCommand.cs | 44 +++++++++ .../Requirement/RequirePermissionCommand.cs | 37 ++++++++ .../Requirement/RequireReloadCommand.cs | 43 +++++++++ .../Requirement/RequireSuperChargeCommand.cs | 36 +++++++ .../Requirement/Todo/RequireArmyCommand.cs | 19 ---- .../Todo/RequireCAISStateCommand.cs | 19 ---- .../Todo/RequireEliteLevelCommand.cs | 19 ---- .../Requirement/Todo/RequireFriendsCommand.cs | 19 ---- .../Requirement/Todo/RequireIsNPCCommand.cs | 19 ---- .../Requirement/Todo/RequireLevelCommand.cs | 19 ---- .../Todo/RequireMovementFlagsCommand.cs | 19 ---- .../Todo/RequireNeedsAmmoCommand.cs | 19 ---- .../Todo/RequirePermissionCommand.cs | 19 ---- .../Requirement/Todo/RequireReloadCommand.cs | 19 ---- .../Todo/RequireSuperChargeCommand.cs | 19 ---- .../Commands/Target/PopTargetsCommand.cs | 5 +- .../Commands/Target/PushTargetsCommand.cs | 7 +- .../Commands/Target/TargetByEffectCommand.cs | 71 ++++++++++++++ .../{Todo => }/TargetByEffectTagCommand.cs | 0 .../Commands/Target/TargetByHealthCommand.cs | 48 ++++++++++ .../Target/TargetFilterByRangeCommand.cs | 49 ++++++++++ .../Commands/Target/TargetInitiatorCommand.cs | 7 +- .../Target/TargetInteractivesCommand.cs | 39 ++++++++ .../Target/TargetPassengersCommand.cs | 68 ++++++++++++++ .../Commands/Target/TargetSelfCommand.cs | 6 +- .../Target/Todo/TargetByEffectCommand.cs | 57 ------------ .../Target/Todo/TargetByHealthCommand.cs | 19 ---- .../Target/Todo/TargetByNPCTypeCommand.cs | 22 +++++ .../Target/Todo/TargetCharacterNPCsCommand.cs | 13 +++ .../Target/Todo/TargetFilterByRangeCommand.cs | 19 ---- .../Target/Todo/TargetFriendliesCommand.cs | 35 ++++--- .../Target/Todo/TargetInteractivesCommand.cs | 19 ---- .../Target/Todo/TargetPassengersCommand.cs | 53 ----------- .../{Todo => }/UnlockBattleframesCommand.cs | 10 ++ .../Unlock/{Todo => }/UnlockTitlesCommand.cs | 2 +- .../GameServer/Systems/Aptitude/Factory.cs | 92 +++++++++--------- 87 files changed, 1406 insertions(+), 742 deletions(-) create mode 100644 UdpHosts/GameServer/Systems/Aptitude/Commands/Impact/TeleportInstanceCommand.cs delete mode 100644 UdpHosts/GameServer/Systems/Aptitude/Commands/Impact/Todo/TeleportInstanceCommand.cs rename UdpHosts/GameServer/Systems/Aptitude/Commands/NPC/{Todo => }/NPCSpawnCommand.cs (53%) rename UdpHosts/GameServer/Systems/Aptitude/Commands/Object/{Todo => }/DestroyAbilityObjectCommand.cs (64%) rename UdpHosts/GameServer/Systems/Aptitude/Commands/Other/{Todo => }/AddAccountGroupCommand.cs (83%) create mode 100644 UdpHosts/GameServer/Systems/Aptitude/Commands/Other/ConsumeSuperChargeCommand.cs create mode 100644 UdpHosts/GameServer/Systems/Aptitude/Commands/Other/ModifyOwnerResourcesCommand.cs create mode 100644 UdpHosts/GameServer/Systems/Aptitude/Commands/Other/RequestArcJobsCommand.cs rename UdpHosts/GameServer/Systems/Aptitude/Commands/Other/{Todo => }/SendTipMessageCommand.cs (80%) rename UdpHosts/GameServer/Systems/Aptitude/Commands/Other/{Todo => }/SetHoverParametersCommand.cs (57%) create mode 100644 UdpHosts/GameServer/Systems/Aptitude/Commands/Other/ShowRewardScreenCommand.cs rename UdpHosts/GameServer/Systems/Aptitude/Commands/Other/{Todo => }/SlotAbilityCommand.cs (52%) delete mode 100644 UdpHosts/GameServer/Systems/Aptitude/Commands/Other/Todo/ConsumeSuperChargeCommand.cs delete mode 100644 UdpHosts/GameServer/Systems/Aptitude/Commands/Other/Todo/ModifyOwnerResourcesCommand.cs delete mode 100644 UdpHosts/GameServer/Systems/Aptitude/Commands/Other/Todo/RequestArcJobsCommand.cs delete mode 100644 UdpHosts/GameServer/Systems/Aptitude/Commands/Other/Todo/ShowRewardScreenCommand.cs delete mode 100644 UdpHosts/GameServer/Systems/Aptitude/Commands/Other/Todo/UnpackItemCommand.cs create mode 100644 UdpHosts/GameServer/Systems/Aptitude/Commands/Other/UnpackItemCommand.cs create mode 100644 UdpHosts/GameServer/Systems/Aptitude/Commands/Register/LoadRegisterFromLevelCommand.cs create mode 100644 UdpHosts/GameServer/Systems/Aptitude/Commands/Register/LoadRegisterFromResourceCommand.cs rename UdpHosts/GameServer/Systems/Aptitude/Commands/Register/{Todo => }/PeekRegisterCommand.cs (65%) rename UdpHosts/GameServer/Systems/Aptitude/Commands/Register/{Todo => }/PopRegisterCommand.cs (79%) rename UdpHosts/GameServer/Systems/Aptitude/Commands/Register/{Todo => }/PushRegisterCommand.cs (81%) delete mode 100644 UdpHosts/GameServer/Systems/Aptitude/Commands/Register/Todo/LoadRegisterFromLevelCommand.cs delete mode 100644 UdpHosts/GameServer/Systems/Aptitude/Commands/Register/Todo/LoadRegisterFromResourceCommand.cs create mode 100644 UdpHosts/GameServer/Systems/Aptitude/Commands/Requirement/RequireArmyCommand.cs create mode 100644 UdpHosts/GameServer/Systems/Aptitude/Commands/Requirement/RequireCAISStateCommand.cs create mode 100644 UdpHosts/GameServer/Systems/Aptitude/Commands/Requirement/RequireEliteLevelCommand.cs create mode 100644 UdpHosts/GameServer/Systems/Aptitude/Commands/Requirement/RequireFriendsCommand.cs rename UdpHosts/GameServer/Systems/Aptitude/Commands/Requirement/{Todo => }/RequireInitiatorExistsCommand.cs (81%) create mode 100644 UdpHosts/GameServer/Systems/Aptitude/Commands/Requirement/RequireIsNPCCommand.cs create mode 100644 UdpHosts/GameServer/Systems/Aptitude/Commands/Requirement/RequireLevelCommand.cs create mode 100644 UdpHosts/GameServer/Systems/Aptitude/Commands/Requirement/RequireMovementFlagsCommand.cs create mode 100644 UdpHosts/GameServer/Systems/Aptitude/Commands/Requirement/RequireNeedsAmmoCommand.cs create mode 100644 UdpHosts/GameServer/Systems/Aptitude/Commands/Requirement/RequirePermissionCommand.cs create mode 100644 UdpHosts/GameServer/Systems/Aptitude/Commands/Requirement/RequireReloadCommand.cs create mode 100644 UdpHosts/GameServer/Systems/Aptitude/Commands/Requirement/RequireSuperChargeCommand.cs delete mode 100644 UdpHosts/GameServer/Systems/Aptitude/Commands/Requirement/Todo/RequireArmyCommand.cs delete mode 100644 UdpHosts/GameServer/Systems/Aptitude/Commands/Requirement/Todo/RequireCAISStateCommand.cs delete mode 100644 UdpHosts/GameServer/Systems/Aptitude/Commands/Requirement/Todo/RequireEliteLevelCommand.cs delete mode 100644 UdpHosts/GameServer/Systems/Aptitude/Commands/Requirement/Todo/RequireFriendsCommand.cs delete mode 100644 UdpHosts/GameServer/Systems/Aptitude/Commands/Requirement/Todo/RequireIsNPCCommand.cs delete mode 100644 UdpHosts/GameServer/Systems/Aptitude/Commands/Requirement/Todo/RequireLevelCommand.cs delete mode 100644 UdpHosts/GameServer/Systems/Aptitude/Commands/Requirement/Todo/RequireMovementFlagsCommand.cs delete mode 100644 UdpHosts/GameServer/Systems/Aptitude/Commands/Requirement/Todo/RequireNeedsAmmoCommand.cs delete mode 100644 UdpHosts/GameServer/Systems/Aptitude/Commands/Requirement/Todo/RequirePermissionCommand.cs delete mode 100644 UdpHosts/GameServer/Systems/Aptitude/Commands/Requirement/Todo/RequireReloadCommand.cs delete mode 100644 UdpHosts/GameServer/Systems/Aptitude/Commands/Requirement/Todo/RequireSuperChargeCommand.cs create mode 100644 UdpHosts/GameServer/Systems/Aptitude/Commands/Target/TargetByEffectCommand.cs rename UdpHosts/GameServer/Systems/Aptitude/Commands/Target/{Todo => }/TargetByEffectTagCommand.cs (100%) create mode 100644 UdpHosts/GameServer/Systems/Aptitude/Commands/Target/TargetByHealthCommand.cs create mode 100644 UdpHosts/GameServer/Systems/Aptitude/Commands/Target/TargetFilterByRangeCommand.cs create mode 100644 UdpHosts/GameServer/Systems/Aptitude/Commands/Target/TargetInteractivesCommand.cs create mode 100644 UdpHosts/GameServer/Systems/Aptitude/Commands/Target/TargetPassengersCommand.cs delete mode 100644 UdpHosts/GameServer/Systems/Aptitude/Commands/Target/Todo/TargetByEffectCommand.cs delete mode 100644 UdpHosts/GameServer/Systems/Aptitude/Commands/Target/Todo/TargetByHealthCommand.cs delete mode 100644 UdpHosts/GameServer/Systems/Aptitude/Commands/Target/Todo/TargetFilterByRangeCommand.cs delete mode 100644 UdpHosts/GameServer/Systems/Aptitude/Commands/Target/Todo/TargetInteractivesCommand.cs delete mode 100644 UdpHosts/GameServer/Systems/Aptitude/Commands/Target/Todo/TargetPassengersCommand.cs rename UdpHosts/GameServer/Systems/Aptitude/Commands/Unlock/{Todo => }/UnlockBattleframesCommand.cs (66%) rename UdpHosts/GameServer/Systems/Aptitude/Commands/Unlock/{Todo => }/UnlockTitlesCommand.cs (88%) diff --git a/UdpHosts/GameServer/Data/CharacterInventory.cs b/UdpHosts/GameServer/Data/CharacterInventory.cs index 0454961..cf58b64 100644 --- a/UdpHosts/GameServer/Data/CharacterInventory.cs +++ b/UdpHosts/GameServer/Data/CharacterInventory.cs @@ -182,6 +182,11 @@ public bool ConsumeResource(uint sdbId, uint cost) } } + public uint GetResourceQuantity(uint sdbId) + { + return _resources.TryGetValue(sdbId, out var value) ? value.Quantity : 0; + } + public void AddLoadout(Loadout loadout) { _loadouts.Add(loadout.FrameLoadoutId, loadout); diff --git a/UdpHosts/GameServer/Data/CharacterLoadout.cs b/UdpHosts/GameServer/Data/CharacterLoadout.cs index f128f79..74e5ad8 100644 --- a/UdpHosts/GameServer/Data/CharacterLoadout.cs +++ b/UdpHosts/GameServer/Data/CharacterLoadout.cs @@ -155,6 +155,7 @@ public CharacterLoadout(LoadoutReferenceData refData) public uint GliderID { get; set; } public uint ChassisID { get; set; } public uint BackpackID { get; set; } + public uint ChassisChangeTime { get; set; } = 0; public ChassisWarpaintResult ChassisWarpaint { get; set; } public VisualsBlock GetChassisVisuals() diff --git a/UdpHosts/GameServer/Entities/Character/CharacterEntity.cs b/UdpHosts/GameServer/Entities/Character/CharacterEntity.cs index af6b141..f044999 100644 --- a/UdpHosts/GameServer/Entities/Character/CharacterEntity.cs +++ b/UdpHosts/GameServer/Entities/Character/CharacterEntity.cs @@ -915,6 +915,11 @@ public void SetSpawnTime(uint time) } } + public void SetNpcType(ushort npcType) + { + Character_ObserverView.NPCTypeProp = npcType; + } + public void SetWeaponIndex(WeaponIndexData value) { WeaponIndex = value; @@ -949,6 +954,14 @@ public void SetGliderProfileId(uint profileId) } } + public void SetHoverProfileId(uint profileId) + { + if (Character_CombatController != null) + { + Character_CombatController.HoverProfileIdProp = profileId; + } + } + public void SetAuthorizedTerminal(AuthorizedTerminalData value) { AuthorizedTerminal = value; diff --git a/UdpHosts/GameServer/Entities/Vehicle/VehicleEntity.cs b/UdpHosts/GameServer/Entities/Vehicle/VehicleEntity.cs index e13700d..c4bea6c 100644 --- a/UdpHosts/GameServer/Entities/Vehicle/VehicleEntity.cs +++ b/UdpHosts/GameServer/Entities/Vehicle/VehicleEntity.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Linq; using System.Numerics; using AeroMessages.Common; using AeroMessages.GSS.V66; @@ -629,6 +630,16 @@ public void ChangeOccupantSeat(CharacterEntity character, byte requestedSeatInde } } + public void SlotAbility(uint abilityId) + { + var index = Abilities.FirstOrDefault(a => a.Value == 0).Key; + + Abilities[index] = abilityId; + + Vehicle_CombatController?.GetType().GetProperty($"SlottedAbility_{index}Prop") + ?.SetValue(Vehicle_CombatController, abilityId, null); + } + private void InitFields() { HostilityInfo = new HostilityInfoData { Flags = 0 | HostilityInfoData.HostilityFlags.Faction, FactionId = 1 }; diff --git a/UdpHosts/GameServer/IPlayer.cs b/UdpHosts/GameServer/IPlayer.cs index 26a2b1e..763f092 100644 --- a/UdpHosts/GameServer/IPlayer.cs +++ b/UdpHosts/GameServer/IPlayer.cs @@ -48,6 +48,7 @@ public enum PlayerStatus void Login(ulong characterId); void EnterZoneAck(); + void ExitZoneAck(); void Ready(); void Respawn(); void Jump(); diff --git a/UdpHosts/GameServer/NetworkClient.cs b/UdpHosts/GameServer/NetworkClient.cs index abcbd73..792e3eb 100644 --- a/UdpHosts/GameServer/NetworkClient.cs +++ b/UdpHosts/GameServer/NetworkClient.cs @@ -218,6 +218,12 @@ private void Matrix_PacketAvailable(GamePacket packet) Factory.Get().Init(this, Player, AssignedShard, Logger); Player.EnterZoneAck(); break; + case MatrixPacketType.ExitZone: + NetChannels[ChannelType.Matrix].SendMessage(new ExitZone()); + break; + case MatrixPacketType.ExitZoneAck: + Player.ExitZoneAck(); + break; case MatrixPacketType.KeyframeRequest: var query = packet.Unpack(); Logger.Verbose($"KeyframeRequest with {query.EntityRequests?.Length ?? 0} entity requests and {query.RefRequests?.Length ?? 0} ref requests. Total scoped for player: {AssignedShard.EntityMan.GetNumberOfScopedEntities(Player)}"); diff --git a/UdpHosts/GameServer/NetworkPlayer.cs b/UdpHosts/GameServer/NetworkPlayer.cs index 71c34fb..310d36e 100644 --- a/UdpHosts/GameServer/NetworkPlayer.cs +++ b/UdpHosts/GameServer/NetworkPlayer.cs @@ -140,6 +140,11 @@ public void EnterZoneAck() AssignedShard.EntityMan.Add(CharacterEntity.EntityId, CharacterEntity); } + public void ExitZoneAck() + { + AssignedShard.EntityMan.Remove(CharacterEntity); + } + public void Respawn() { var outpostId = FindClosestAvailableOutpost(CurrentZone, CurrentOutpostId); @@ -290,7 +295,7 @@ public void HandleFireWeaponProjectile(uint time, Vector3 aim) AssignedShard.WeaponSim.OnFireWeaponProjectile(CharacterEntity, time, aim); } - private void EnterZone(Zone z, uint outpostId = 0) + public void EnterZone(Zone z, uint outpostId = 0) { var spawnPoint = outpostId == 0 ? new SpawnPoint { Position = z.POIs["spawn"] } diff --git a/UdpHosts/GameServer/StaticDB/Loaders/CustomDBLoader.cs b/UdpHosts/GameServer/StaticDB/Loaders/CustomDBLoader.cs index b8065c8..af90449 100644 --- a/UdpHosts/GameServer/StaticDB/Loaders/CustomDBLoader.cs +++ b/UdpHosts/GameServer/StaticDB/Loaders/CustomDBLoader.cs @@ -223,7 +223,7 @@ public Dictionary LoadNPCEquipMonsterCommandDef public Dictionary LoadNPCSpawnCommandDef() { - return LoadJSON("./StaticDB/CustomData/Todo/aptgss_agsNPCSpawnCommandDef.json") + return LoadJSON("./StaticDB/CustomData/aptgss_agsNPCSpawnCommandDef.json") .ToDictionary(row => row.Id); } @@ -361,7 +361,7 @@ public Dictionary LoadTinyObjectUpdateCommandD public Dictionary LoadTurretControlCommandDef() { - return LoadJSON("./StaticDB/CustomData/Todo/aptgss_agsTurretControlCommandDef.json") + return LoadJSON("./StaticDB/CustomData/aptgss_agsTurretControlCommandDef.json") .ToDictionary(row => row.Id); } @@ -871,7 +871,7 @@ public Dictionary LoadUnlockWarpaintsCommandDef public Dictionary LoadUnpackItemCommandDef() { - return LoadJSON("./StaticDB/CustomData/Todo/aptgss_UnpackItemCommandDef.json") + return LoadJSON("./StaticDB/CustomData/aptgss_UnpackItemCommandDef.json") .ToDictionary(row => row.Id); } diff --git a/UdpHosts/GameServer/Systems/Aptitude/AptitudeTargets.cs b/UdpHosts/GameServer/Systems/Aptitude/AptitudeTargets.cs index 3a7036a..6285b9b 100644 --- a/UdpHosts/GameServer/Systems/Aptitude/AptitudeTargets.cs +++ b/UdpHosts/GameServer/Systems/Aptitude/AptitudeTargets.cs @@ -13,6 +13,11 @@ public AptitudeTargets() _targets = new(); } + public AptitudeTargets(AptitudeTargets initialTargets) + { + _targets = new List(initialTargets.ToArray()); + } + public AptitudeTargets(params IAptitudeTarget[] initialTargets) { _targets = new(initialTargets.Length); diff --git a/UdpHosts/GameServer/Systems/Aptitude/Commands/Impact/ImpactRemoveEffectCommand.cs b/UdpHosts/GameServer/Systems/Aptitude/Commands/Impact/ImpactRemoveEffectCommand.cs index fd59d94..7451702 100644 --- a/UdpHosts/GameServer/Systems/Aptitude/Commands/Impact/ImpactRemoveEffectCommand.cs +++ b/UdpHosts/GameServer/Systems/Aptitude/Commands/Impact/ImpactRemoveEffectCommand.cs @@ -1,5 +1,6 @@ using System; using System.Linq; +using System.Text; using GameServer.Data.SDB.Records.customdata; namespace GameServer.Aptitude; @@ -33,6 +34,20 @@ public bool Execute(Context context) } else { + StringBuilder stringBuilder = new(); + stringBuilder.AppendLine("Active Effects (Self):"); + var character = context.Self; + var activefx = character.GetActiveEffects(); + foreach (var activeEffect in activefx) + { + if (activeEffect != null) + { + stringBuilder.AppendLine($"{activeEffect.Index} : {activeEffect.Effect?.Id}"); + } + } + + string message = stringBuilder.ToString(); + Console.WriteLine(message); Console.WriteLine($"Don't know which effect to remove for ImpactRemoveEffectCommand {Params.Id}"); } diff --git a/UdpHosts/GameServer/Systems/Aptitude/Commands/Impact/ImpactToggleEffectCommand.cs b/UdpHosts/GameServer/Systems/Aptitude/Commands/Impact/ImpactToggleEffectCommand.cs index 4c08944..14a4ea5 100644 --- a/UdpHosts/GameServer/Systems/Aptitude/Commands/Impact/ImpactToggleEffectCommand.cs +++ b/UdpHosts/GameServer/Systems/Aptitude/Commands/Impact/ImpactToggleEffectCommand.cs @@ -17,7 +17,6 @@ public bool Execute(Context context) Context effectContext = new Context(context.Shard, context.Initiator) { InitTime = context.InitTime, - ExecutionHint = ExecutionHint.ApplyEffect }; if (Params.PassRegister == 1) @@ -43,7 +42,8 @@ public bool Execute(Context context) if (active.Effect.Id == Params.EffectId) { targetHasEffect = true; - context.Abilities.DoRemoveEffect(active); + effectContext.ExecutionHint = ExecutionHint.RemoveEffect; + effectContext.Abilities.DoRemoveEffect(active); break; } } @@ -55,17 +55,12 @@ public bool Execute(Context context) if (Params.PreApplyChain != 0) { - var chain = context.Abilities.Factory.LoadChain(Params.PreApplyChain); - chain.Execute(new Context(context.Shard, context.Initiator) - { - ChainId = Params.PreApplyChain, - Targets = new AptitudeTargets(target), - InitTime = context.InitTime, - ExecutionHint = ExecutionHint.Proximity - }); + var chain = effectContext.Abilities.Factory.LoadChain(Params.PreApplyChain); + chain.Execute(effectContext); } - context.Abilities.DoApplyEffect(Params.EffectId, target, effectContext); + effectContext.ExecutionHint = ExecutionHint.ApplyEffect; + effectContext.Abilities.DoApplyEffect(Params.EffectId, target, effectContext); } return true; diff --git a/UdpHosts/GameServer/Systems/Aptitude/Commands/Impact/TeleportInstanceCommand.cs b/UdpHosts/GameServer/Systems/Aptitude/Commands/Impact/TeleportInstanceCommand.cs new file mode 100644 index 0000000..3719354 --- /dev/null +++ b/UdpHosts/GameServer/Systems/Aptitude/Commands/Impact/TeleportInstanceCommand.cs @@ -0,0 +1,39 @@ +using AeroMessages.Matrix.V25; +using GameServer.Data.SDB.Records.customdata; +using GameServer.Entities.Character; +using GameServer.Test; + +namespace GameServer.Aptitude; + +public class TeleportInstanceCommand : Command, ICommand +{ + private TeleportInstanceCommandDef Params; + + public TeleportInstanceCommand(TeleportInstanceCommandDef par) +: base(par) + { + Params = par; + } + + public bool Execute(Context context) + { + if (Params.ZoneId == 0) + { + return true; + } + + foreach (var target in context.Targets) + { + if (target is not CharacterEntity { Player: NetworkPlayer networkPlayer }) + { + continue; + } + + networkPlayer.NetChannels[ChannelType.Matrix].SendMessage(new ExitZone()); + + networkPlayer.EnterZone(DataUtils.GetZone(Params.ZoneId)); + } + + return true; + } +} \ No newline at end of file diff --git a/UdpHosts/GameServer/Systems/Aptitude/Commands/Impact/Todo/TeleportInstanceCommand.cs b/UdpHosts/GameServer/Systems/Aptitude/Commands/Impact/Todo/TeleportInstanceCommand.cs deleted file mode 100644 index 1942d63..0000000 --- a/UdpHosts/GameServer/Systems/Aptitude/Commands/Impact/Todo/TeleportInstanceCommand.cs +++ /dev/null @@ -1,19 +0,0 @@ -using GameServer.Data.SDB.Records.customdata; - -namespace GameServer.Aptitude; - -public class TeleportInstanceCommand : Command, ICommand -{ - private TeleportInstanceCommandDef Params; - - public TeleportInstanceCommand(TeleportInstanceCommandDef par) -: base(par) - { - Params = par; - } - - public bool Execute(Context context) - { - return true; - } -} \ No newline at end of file diff --git a/UdpHosts/GameServer/Systems/Aptitude/Commands/Interaction/BeginInteractionCommand.cs b/UdpHosts/GameServer/Systems/Aptitude/Commands/Interaction/BeginInteractionCommand.cs index fba1a94..d1745a0 100644 --- a/UdpHosts/GameServer/Systems/Aptitude/Commands/Interaction/BeginInteractionCommand.cs +++ b/UdpHosts/GameServer/Systems/Aptitude/Commands/Interaction/BeginInteractionCommand.cs @@ -1,3 +1,4 @@ +using System; using GameServer.Entities; namespace GameServer.Aptitude; @@ -13,22 +14,24 @@ public BeginInteractionCommand(uint id) public bool Execute(Context context) { - if (context.Targets.Count > 0) + if (context.Targets.Count == 0) { - var interactionEntity = context.Targets.Peek(); - var hack = interactionEntity as BaseEntity; - var abilityId = hack.Interaction.StartedAbilityId; - if (abilityId != 0) - { - var actingEntity = context.Self; - context.Shard.Abilities.HandleActivateAbility(context.Shard, actingEntity, abilityId, context.Shard.CurrentTime, new AptitudeTargets(interactionEntity)); - } - - return true; + return false; } - else + + var interactionEntity = context.Targets.Peek(); + var abilityId = ((BaseEntity)interactionEntity).Interaction.StartedAbilityId; + if (abilityId != 0) { - return false; + var actingEntity = context.Self; + context.Shard.Abilities.HandleActivateAbility( + context.Shard, + interactionEntity, + abilityId, + context.Shard.CurrentTime, + new AptitudeTargets(actingEntity)); } + + return true; } } \ No newline at end of file diff --git a/UdpHosts/GameServer/Systems/Aptitude/Commands/Interaction/EndInteractionCommand.cs b/UdpHosts/GameServer/Systems/Aptitude/Commands/Interaction/EndInteractionCommand.cs index 439bb9d..d357f57 100644 --- a/UdpHosts/GameServer/Systems/Aptitude/Commands/Interaction/EndInteractionCommand.cs +++ b/UdpHosts/GameServer/Systems/Aptitude/Commands/Interaction/EndInteractionCommand.cs @@ -1,12 +1,9 @@ using System; -using System.Collections.Generic; -using System.Linq; -using AeroMessages.GSS.V66.Character; using AeroMessages.GSS.V66.Character.Event; -using GameServer.Data.SDB.Records.apt; using GameServer.Entities; using GameServer.Entities.Character; using GameServer.Entities.Deployable; +using GameServer.Entities.Vehicle; using GameServer.Systems.Encounters; namespace GameServer.Aptitude; @@ -22,65 +19,53 @@ public EndInteractionCommand(uint id) public bool Execute(Context context) { - if (context.Targets.Count > 0) + if (context.Targets.Count == 0 || context.Self is not CharacterEntity character) { - var actingEntity = context.Self; - if (actingEntity.GetType() == typeof(Entities.Character.CharacterEntity)) - { - var character = actingEntity as Entities.Character.CharacterEntity; - - if (character.IsPlayerControlled) - { - var message = new InteractionCompleted { Percent = 100 }; - character.Player.NetChannels[ChannelType.ReliableGss].SendMessage(message, character.EntityId); - } - } - - var interactionEntity = context.Targets.Peek(); - var hack = (BaseEntity)interactionEntity; - - if (hack.Encounter is { Instance: IInteractionHandler encounter }) - { - encounter.OnInteraction((BaseEntity)actingEntity, hack); - - return true; - } + return false; + } - if (hack.Encounter is { SpawnDef: { } spawnData }) - { - context.Shard.EncounterMan.Factory.SpawnEncounter(spawnData, (CharacterEntity)actingEntity); - } + var interactionEntity = (BaseEntity)context.Targets.Peek(); - var abilityId = hack.Interaction.CompletedAbilityId; - if (abilityId != 0) - { - context.Shard.Abilities.HandleActivateAbility(context.Shard, actingEntity, abilityId, context.Shard.CurrentTime, new AptitudeTargets(interactionEntity)); - } + if (character is { IsPlayerControlled: true }) + { + var message = new InteractionCompleted { Percent = 100 }; + character.Player.NetChannels[ChannelType.ReliableGss].SendMessage(message, character.EntityId); + } - var interactionType = hack.Interaction.Type; + if (interactionEntity.Encounter is { Instance: IInteractionHandler encounter }) + { + encounter.OnInteraction(character, interactionEntity); + } - if (hack is DeployableEntity { Turret: not null } deployable) - { - var character = actingEntity as CharacterEntity; + if (interactionEntity.Encounter is { SpawnDef: { } spawnData }) + { + context.Shard.EncounterMan.Factory.SpawnEncounter(spawnData, character); + } - deployable.Turret.SetControllingPlayer(character.Player); - } - else if (interactionType == InteractionType.Vehicle) - { - if (actingEntity.GetType() == typeof(Entities.Character.CharacterEntity) && interactionEntity.GetType() == typeof(Entities.Vehicle.VehicleEntity)) - { - var character = actingEntity as Entities.Character.CharacterEntity; - var vehicle = interactionEntity as Entities.Vehicle.VehicleEntity; + var abilityId = interactionEntity.Interaction.CompletedAbilityId; + if (abilityId != 0) + { + context.Shard.Abilities.HandleActivateAbility( + context.Shard, + (IAptitudeTarget)interactionEntity, + abilityId, + context.Shard.CurrentTime, + new AptitudeTargets(character)); + } - vehicle.AddOccupant(character); - } - } + var interactionType = interactionEntity.Interaction.Type; - return true; - } - else + // if (hack is DeployableEntity { Turret: not null } deployable) + // { + // var character = initiator as CharacterEntity; + // + // deployable.Turret.SetControllingPlayer(character.Player); + // } + if (interactionType == InteractionType.Vehicle && interactionEntity is VehicleEntity vehicle) { - return false; + vehicle.AddOccupant(character); } + + return true; } } \ No newline at end of file diff --git a/UdpHosts/GameServer/Systems/Aptitude/Commands/NPC/Todo/NPCSpawnCommand.cs b/UdpHosts/GameServer/Systems/Aptitude/Commands/NPC/NPCSpawnCommand.cs similarity index 53% rename from UdpHosts/GameServer/Systems/Aptitude/Commands/NPC/Todo/NPCSpawnCommand.cs rename to UdpHosts/GameServer/Systems/Aptitude/Commands/NPC/NPCSpawnCommand.cs index ea5b723..809fe3e 100644 --- a/UdpHosts/GameServer/Systems/Aptitude/Commands/NPC/Todo/NPCSpawnCommand.cs +++ b/UdpHosts/GameServer/Systems/Aptitude/Commands/NPC/NPCSpawnCommand.cs @@ -1,4 +1,5 @@ using GameServer.Data.SDB.Records.customdata; +using GameServer.Entities.Character; namespace GameServer.Aptitude; @@ -14,6 +15,15 @@ public NPCSpawnCommand(NPCSpawnCommandDef par) public bool Execute(Context context) { + if (Params.MonsterId == 0) + { + return true; + } + + var owner = Params.SetOwner ? context.Self as CharacterEntity : null; + + context.Shard.EntityMan.SpawnCharacter(Params.MonsterId, context.InitPosition, owner); + return true; } } \ No newline at end of file diff --git a/UdpHosts/GameServer/Systems/Aptitude/Commands/Object/Todo/DestroyAbilityObjectCommand.cs b/UdpHosts/GameServer/Systems/Aptitude/Commands/Object/DestroyAbilityObjectCommand.cs similarity index 64% rename from UdpHosts/GameServer/Systems/Aptitude/Commands/Object/Todo/DestroyAbilityObjectCommand.cs rename to UdpHosts/GameServer/Systems/Aptitude/Commands/Object/DestroyAbilityObjectCommand.cs index b50b00b..cd0599e 100644 --- a/UdpHosts/GameServer/Systems/Aptitude/Commands/Object/Todo/DestroyAbilityObjectCommand.cs +++ b/UdpHosts/GameServer/Systems/Aptitude/Commands/Object/DestroyAbilityObjectCommand.cs @@ -1,4 +1,5 @@ using GameServer.Data.SDB.Records.customdata; +using GameServer.Entities; namespace GameServer.Aptitude; @@ -14,7 +15,12 @@ public DestroyAbilityObjectCommand(DestroyAbilityObjectCommandDef par) public bool Execute(Context context) { - // context.Shard.EntityMan.Remove(...); + // occurs often after TargetClear -> TargetSelf + foreach (var target in context.Targets) + { + context.Shard.EntityMan.Remove((IEntity)target); + } + return true; } } \ No newline at end of file diff --git a/UdpHosts/GameServer/Systems/Aptitude/Commands/Other/Todo/AddAccountGroupCommand.cs b/UdpHosts/GameServer/Systems/Aptitude/Commands/Other/AddAccountGroupCommand.cs similarity index 83% rename from UdpHosts/GameServer/Systems/Aptitude/Commands/Other/Todo/AddAccountGroupCommand.cs rename to UdpHosts/GameServer/Systems/Aptitude/Commands/Other/AddAccountGroupCommand.cs index a392194..7464a1f 100644 --- a/UdpHosts/GameServer/Systems/Aptitude/Commands/Other/Todo/AddAccountGroupCommand.cs +++ b/UdpHosts/GameServer/Systems/Aptitude/Commands/Other/AddAccountGroupCommand.cs @@ -14,6 +14,9 @@ public AddAccountGroupCommand(AddAccountGroupCommandDef par) public bool Execute(Context context) { + // examples: + // vip + // mamba lgv rental (41157) return true; } } \ No newline at end of file diff --git a/UdpHosts/GameServer/Systems/Aptitude/Commands/Other/AuthorizeTerminalCommand.cs b/UdpHosts/GameServer/Systems/Aptitude/Commands/Other/AuthorizeTerminalCommand.cs index cbd4a2e..d49a3d6 100644 --- a/UdpHosts/GameServer/Systems/Aptitude/Commands/Other/AuthorizeTerminalCommand.cs +++ b/UdpHosts/GameServer/Systems/Aptitude/Commands/Other/AuthorizeTerminalCommand.cs @@ -1,8 +1,7 @@ using System; -using System.Linq; -using System.Numerics; -using AeroMessages.GSS.V66.Character.Event; +using AeroMessages.GSS.V66.Character.Controller; using GameServer.Data.SDB.Records.customdata; +using GameServer.Entities.Character; namespace GameServer.Aptitude; @@ -16,38 +15,39 @@ public AuthorizeTerminalCommand(AuthorizeTerminalCommandDef par) Params = par; } + // self is terminal, target is interacting player public bool Execute(Context context) { - var target = context.Self; + var terminal = context.Self; if (context.Targets.Count == 0) { Console.WriteLine($"AuthorizeTerminalCommand fails because there are no targets (There should be a target?)"); return false; } - var terminal = context.Targets.Peek(); + var target = context.Targets.Peek(); - if (target.GetType() == typeof(Entities.Character.CharacterEntity)) + if (target is CharacterEntity character) { - var character = target as Entities.Character.CharacterEntity; - if (!character.IsPlayerControlled) { Console.WriteLine($"AuthorizeTerminalCommand skips because target is not a player (should this really be happening, why did we target an NPC with this?)"); return true; } - character.SetAuthorizedTerminal(new AeroMessages.GSS.V66.Character.Controller.AuthorizedTerminalData + Console.WriteLine($"Authorized terminal {Params.TerminalType}, {terminal}"); + + character.SetAuthorizedTerminal(new AuthorizedTerminalData { - TerminalType = (byte)Params.TerminalType, + TerminalType = (byte)Params.TerminalType, TerminalId = (byte)Params.TerminalId, - TerminalEntityId = terminal.EntityId + TerminalEntityId = terminal.AeroEntityId.Backing }); return true; } - Console.WriteLine($"AuthorizeTerminalCommand fails because self is not a character (why is it running on something other than a character?)"); + Console.WriteLine($"AuthorizeTerminalCommand fails because target is not a character (why is it running on something other than a character?)"); return false; } } \ No newline at end of file diff --git a/UdpHosts/GameServer/Systems/Aptitude/Commands/Other/ConsumeSuperChargeCommand.cs b/UdpHosts/GameServer/Systems/Aptitude/Commands/Other/ConsumeSuperChargeCommand.cs new file mode 100644 index 0000000..b7d3686 --- /dev/null +++ b/UdpHosts/GameServer/Systems/Aptitude/Commands/Other/ConsumeSuperChargeCommand.cs @@ -0,0 +1,43 @@ +using System; +using AeroMessages.GSS.V66.Character.Controller; +using GameServer.Data.SDB.Records.aptfs; +using GameServer.Entities.Character; +using GameServer.Enums; + +namespace GameServer.Aptitude; + +public class ConsumeSuperChargeCommand : Command, ICommand +{ + private ConsumeSuperChargeCommandDef Params; + + public ConsumeSuperChargeCommand(ConsumeSuperChargeCommandDef par) + : base(par) + { + Params = par; + } + + public bool Execute(Context context) + { + var target = context.Self; + + if (target is CharacterEntity character) + { + var currentValue = character.Character_CombatController.SuperChargeProp.Value; + + var percent = AbilitySystem.RegistryOp(context.Register, Params.Percent, (Operand)Params.PercentRegop); + var value = percent / 100 * currentValue; + + character.Character_CombatController.SuperChargeProp = new SuperChargeData() + { + Value = currentValue - value, + Op = (byte)Operand.ASSIGN, + }; + + return true; + } + + Console.WriteLine("ConsumeSuperChargeCommand fails because target is not a Character. If this is happening, we should investigate why."); + + return false; + } +} \ No newline at end of file diff --git a/UdpHosts/GameServer/Systems/Aptitude/Commands/Other/ModifyOwnerResourcesCommand.cs b/UdpHosts/GameServer/Systems/Aptitude/Commands/Other/ModifyOwnerResourcesCommand.cs new file mode 100644 index 0000000..2664d83 --- /dev/null +++ b/UdpHosts/GameServer/Systems/Aptitude/Commands/Other/ModifyOwnerResourcesCommand.cs @@ -0,0 +1,42 @@ +using GameServer.Data.SDB.Records.customdata; +using GameServer.Entities.Character; + +namespace GameServer.Aptitude; + +public class ModifyOwnerResourcesCommand : Command, ICommand +{ + private ModifyOwnerResourcesCommandDef Params; + + public ModifyOwnerResourcesCommand(ModifyOwnerResourcesCommandDef par) +: base(par) + { + Params = par; + } + + public bool Execute(Context context) + { + if (Params.ResourceSdbId == 0 || Params.Quantity == 0) + { + return true; + } + + foreach (var target in context.Targets) + { + if (target is not CharacterEntity { IsPlayerControlled: true } character) + { + continue; + } + + if (Params.Quantity > 0) + { + character.Player.Inventory.AddResource(Params.ResourceSdbId, (uint)Params.Quantity); + } + else + { + character.Player.Inventory.ConsumeResource(Params.ResourceSdbId, (uint)(-Params.Quantity)); + } + } + + return true; + } +} \ No newline at end of file diff --git a/UdpHosts/GameServer/Systems/Aptitude/Commands/Other/RequestArcJobsCommand.cs b/UdpHosts/GameServer/Systems/Aptitude/Commands/Other/RequestArcJobsCommand.cs new file mode 100644 index 0000000..cec45c0 --- /dev/null +++ b/UdpHosts/GameServer/Systems/Aptitude/Commands/Other/RequestArcJobsCommand.cs @@ -0,0 +1,32 @@ +using AeroMessages.GSS.V66.Generic; +using GameServer.Data.SDB.Records.customdata; +using GameServer.Entities.Character; + +namespace GameServer.Aptitude; + +public class RequestArcJobsCommand : Command, ICommand +{ + private RequestArcJobsCommandDef Params; + + public RequestArcJobsCommand(RequestArcJobsCommandDef par) +: base(par) + { + Params = par; + } + + public bool Execute(Context context) + { + // var message = ? + foreach (var target in context.Targets) + { + if (target is not CharacterEntity character) + { + continue; + } + + // character.Player.NetChannels[ChannelType.ReliableGss].SendMessage(message, character.EntityId); + } + + return true; + } +} \ No newline at end of file diff --git a/UdpHosts/GameServer/Systems/Aptitude/Commands/Other/Todo/SendTipMessageCommand.cs b/UdpHosts/GameServer/Systems/Aptitude/Commands/Other/SendTipMessageCommand.cs similarity index 80% rename from UdpHosts/GameServer/Systems/Aptitude/Commands/Other/Todo/SendTipMessageCommand.cs rename to UdpHosts/GameServer/Systems/Aptitude/Commands/Other/SendTipMessageCommand.cs index eb30e0d..02ec3d6 100644 --- a/UdpHosts/GameServer/Systems/Aptitude/Commands/Other/Todo/SendTipMessageCommand.cs +++ b/UdpHosts/GameServer/Systems/Aptitude/Commands/Other/SendTipMessageCommand.cs @@ -1,3 +1,4 @@ +using AeroMessages.GSS.V66.Generic; using GameServer.Data.SDB.Records.customdata; namespace GameServer.Aptitude; @@ -14,6 +15,8 @@ public SendTipMessageCommand(SendTipMessageCommandDef par) public bool Execute(Context context) { + // var message = new SendTipMessage() { }; + return true; } } \ No newline at end of file diff --git a/UdpHosts/GameServer/Systems/Aptitude/Commands/Other/Todo/SetHoverParametersCommand.cs b/UdpHosts/GameServer/Systems/Aptitude/Commands/Other/SetHoverParametersCommand.cs similarity index 57% rename from UdpHosts/GameServer/Systems/Aptitude/Commands/Other/Todo/SetHoverParametersCommand.cs rename to UdpHosts/GameServer/Systems/Aptitude/Commands/Other/SetHoverParametersCommand.cs index 73d8c42..a19eecd 100644 --- a/UdpHosts/GameServer/Systems/Aptitude/Commands/Other/Todo/SetHoverParametersCommand.cs +++ b/UdpHosts/GameServer/Systems/Aptitude/Commands/Other/SetHoverParametersCommand.cs @@ -1,4 +1,5 @@ using GameServer.Data.SDB.Records.customdata; +using GameServer.Entities.Character; namespace GameServer.Aptitude; @@ -14,6 +15,16 @@ public SetHoverParametersCommand(SetHoverParametersCommandDef par) public bool Execute(Context context) { + var target = context.Self; + + if (target is CharacterEntity character) + { + // if (Params.Value != null) + // { + // character.SetHoverProfileId(Params.Value); + // } + } + return true; } } \ No newline at end of file diff --git a/UdpHosts/GameServer/Systems/Aptitude/Commands/Other/ShowRewardScreenCommand.cs b/UdpHosts/GameServer/Systems/Aptitude/Commands/Other/ShowRewardScreenCommand.cs new file mode 100644 index 0000000..eb582ed --- /dev/null +++ b/UdpHosts/GameServer/Systems/Aptitude/Commands/Other/ShowRewardScreenCommand.cs @@ -0,0 +1,33 @@ +using AeroMessages.GSS.V66.Character.Event; +using GameServer.Data.SDB.Records.customdata; +using GameServer.Entities.Character; + +namespace GameServer.Aptitude; + +public class ShowRewardScreenCommand : Command, ICommand +{ + private ShowRewardScreenCommandDef Params; + + public ShowRewardScreenCommand(ShowRewardScreenCommandDef par) +: base(par) + { + Params = par; + } + + public bool Execute(Context context) + { + var message = new DisplayRewards() { }; + + foreach (var target in context.Targets) + { + if (target is not CharacterEntity character) + { + continue; + } + + character.Player.NetChannels[ChannelType.ReliableGss].SendMessage(message, character.EntityId); + } + + return true; + } +} \ No newline at end of file diff --git a/UdpHosts/GameServer/Systems/Aptitude/Commands/Other/Todo/SlotAbilityCommand.cs b/UdpHosts/GameServer/Systems/Aptitude/Commands/Other/SlotAbilityCommand.cs similarity index 52% rename from UdpHosts/GameServer/Systems/Aptitude/Commands/Other/Todo/SlotAbilityCommand.cs rename to UdpHosts/GameServer/Systems/Aptitude/Commands/Other/SlotAbilityCommand.cs index 6a54b12..ab9158b 100644 --- a/UdpHosts/GameServer/Systems/Aptitude/Commands/Other/Todo/SlotAbilityCommand.cs +++ b/UdpHosts/GameServer/Systems/Aptitude/Commands/Other/SlotAbilityCommand.cs @@ -1,4 +1,5 @@ using GameServer.Data.SDB.Records.customdata; +using GameServer.Entities.Vehicle; namespace GameServer.Aptitude; @@ -14,6 +15,19 @@ public SlotAbilityCommand(SlotAbilityCommandDef par) public bool Execute(Context context) { + if (Params.AbilityId == 0) + { + return true; + } + + foreach (var target in context.Targets) + { + if (target is VehicleEntity vehicle) + { + vehicle.SlotAbility(Params.AbilityId); + } + } + return true; } } \ No newline at end of file diff --git a/UdpHosts/GameServer/Systems/Aptitude/Commands/Other/Todo/ConsumeSuperChargeCommand.cs b/UdpHosts/GameServer/Systems/Aptitude/Commands/Other/Todo/ConsumeSuperChargeCommand.cs deleted file mode 100644 index c601c8b..0000000 --- a/UdpHosts/GameServer/Systems/Aptitude/Commands/Other/Todo/ConsumeSuperChargeCommand.cs +++ /dev/null @@ -1,19 +0,0 @@ -using GameServer.Data.SDB.Records.aptfs; - -namespace GameServer.Aptitude; - -public class ConsumeSuperChargeCommand : Command, ICommand -{ - private ConsumeSuperChargeCommandDef Params; - - public ConsumeSuperChargeCommand(ConsumeSuperChargeCommandDef par) -: base(par) - { - Params = par; - } - - public bool Execute(Context context) - { - return true; - } -} \ No newline at end of file diff --git a/UdpHosts/GameServer/Systems/Aptitude/Commands/Other/Todo/ModifyOwnerResourcesCommand.cs b/UdpHosts/GameServer/Systems/Aptitude/Commands/Other/Todo/ModifyOwnerResourcesCommand.cs deleted file mode 100644 index 8d5f7f8..0000000 --- a/UdpHosts/GameServer/Systems/Aptitude/Commands/Other/Todo/ModifyOwnerResourcesCommand.cs +++ /dev/null @@ -1,19 +0,0 @@ -using GameServer.Data.SDB.Records.customdata; - -namespace GameServer.Aptitude; - -public class ModifyOwnerResourcesCommand : Command, ICommand -{ - private ModifyOwnerResourcesCommandDef Params; - - public ModifyOwnerResourcesCommand(ModifyOwnerResourcesCommandDef par) -: base(par) - { - Params = par; - } - - public bool Execute(Context context) - { - return true; - } -} \ No newline at end of file diff --git a/UdpHosts/GameServer/Systems/Aptitude/Commands/Other/Todo/ReputationModifierCommand.cs b/UdpHosts/GameServer/Systems/Aptitude/Commands/Other/Todo/ReputationModifierCommand.cs index 99e6b0a..c024720 100644 --- a/UdpHosts/GameServer/Systems/Aptitude/Commands/Other/Todo/ReputationModifierCommand.cs +++ b/UdpHosts/GameServer/Systems/Aptitude/Commands/Other/Todo/ReputationModifierCommand.cs @@ -1,4 +1,5 @@ using GameServer.Data.SDB.Records.customdata; +using GameServer.Entities.Character; namespace GameServer.Aptitude; @@ -14,6 +15,20 @@ public ReputationModifierCommand(ReputationModifierCommandDef par) public bool Execute(Context context) { + foreach (var target in context.Targets) + { + if (target is not CharacterEntity character) + { + continue; + } + + // character.Character_BaseController.ReputationBoostModifierProp + // character.Character_BaseController.ReputationPermanentModifierProp + // character.Character_BaseController.ReputationZoneModifierProp + // character.Character_BaseController.ReputationVipModifierProp + // character.Character_BaseController.ReputationEventModifierProp + } + return true; } } \ No newline at end of file diff --git a/UdpHosts/GameServer/Systems/Aptitude/Commands/Other/Todo/RequestArcJobsCommand.cs b/UdpHosts/GameServer/Systems/Aptitude/Commands/Other/Todo/RequestArcJobsCommand.cs deleted file mode 100644 index ad8ad46..0000000 --- a/UdpHosts/GameServer/Systems/Aptitude/Commands/Other/Todo/RequestArcJobsCommand.cs +++ /dev/null @@ -1,19 +0,0 @@ -using GameServer.Data.SDB.Records.customdata; - -namespace GameServer.Aptitude; - -public class RequestArcJobsCommand : Command, ICommand -{ - private RequestArcJobsCommandDef Params; - - public RequestArcJobsCommand(RequestArcJobsCommandDef par) -: base(par) - { - Params = par; - } - - public bool Execute(Context context) - { - return true; - } -} \ No newline at end of file diff --git a/UdpHosts/GameServer/Systems/Aptitude/Commands/Other/Todo/RestockAmmoCommand.cs b/UdpHosts/GameServer/Systems/Aptitude/Commands/Other/Todo/RestockAmmoCommand.cs index a49d153..e5d2663 100644 --- a/UdpHosts/GameServer/Systems/Aptitude/Commands/Other/Todo/RestockAmmoCommand.cs +++ b/UdpHosts/GameServer/Systems/Aptitude/Commands/Other/Todo/RestockAmmoCommand.cs @@ -1,4 +1,5 @@ using GameServer.Data.SDB.Records.customdata; +using GameServer.Entities.Character; namespace GameServer.Aptitude; @@ -12,8 +13,15 @@ public RestockAmmoCommand(RestockAmmoCommandDef par) Params = par; } + // todo: should act on targets? + // abilities: 53, 57 public bool Execute(Context context) { + if (context.Self is CharacterEntity character) + { + // character.Character_CombatController.Ammo_0Prop = max + } + return true; } } \ No newline at end of file diff --git a/UdpHosts/GameServer/Systems/Aptitude/Commands/Other/Todo/ShowRewardScreenCommand.cs b/UdpHosts/GameServer/Systems/Aptitude/Commands/Other/Todo/ShowRewardScreenCommand.cs deleted file mode 100644 index be77324..0000000 --- a/UdpHosts/GameServer/Systems/Aptitude/Commands/Other/Todo/ShowRewardScreenCommand.cs +++ /dev/null @@ -1,19 +0,0 @@ -using GameServer.Data.SDB.Records.customdata; - -namespace GameServer.Aptitude; - -public class ShowRewardScreenCommand : Command, ICommand -{ - private ShowRewardScreenCommandDef Params; - - public ShowRewardScreenCommand(ShowRewardScreenCommandDef par) -: base(par) - { - Params = par; - } - - public bool Execute(Context context) - { - return true; - } -} \ No newline at end of file diff --git a/UdpHosts/GameServer/Systems/Aptitude/Commands/Other/Todo/UnpackItemCommand.cs b/UdpHosts/GameServer/Systems/Aptitude/Commands/Other/Todo/UnpackItemCommand.cs deleted file mode 100644 index 3e4a756..0000000 --- a/UdpHosts/GameServer/Systems/Aptitude/Commands/Other/Todo/UnpackItemCommand.cs +++ /dev/null @@ -1,19 +0,0 @@ -using GameServer.Data.SDB.Records.customdata; - -namespace GameServer.Aptitude; - -public class UnpackItemCommand : Command, ICommand -{ - private UnpackItemCommandDef Params; - - public UnpackItemCommand(UnpackItemCommandDef par) -: base(par) - { - Params = par; - } - - public bool Execute(Context context) - { - return true; - } -} \ No newline at end of file diff --git a/UdpHosts/GameServer/Systems/Aptitude/Commands/Other/UnpackItemCommand.cs b/UdpHosts/GameServer/Systems/Aptitude/Commands/Other/UnpackItemCommand.cs new file mode 100644 index 0000000..b43e78d --- /dev/null +++ b/UdpHosts/GameServer/Systems/Aptitude/Commands/Other/UnpackItemCommand.cs @@ -0,0 +1,35 @@ +using System; +using GameServer.Data.SDB.Records.customdata; +using GameServer.Entities.Character; + +namespace GameServer.Aptitude; + +public class UnpackItemCommand : Command, ICommand +{ + private UnpackItemCommandDef Params; + + public UnpackItemCommand(UnpackItemCommandDef par) +: base(par) + { + Params = par; + } + + public bool Execute(Context context) + { + if (Params.PackageSdbId == 0 || Params.ItemSdbId == 0) + { + return true; + } + + if (context.Self is not CharacterEntity { IsPlayerControlled: true } character) + { + Console.WriteLine($"Self{context.Self} is not a CharacterEntity"); + return false; + } + + // todo: consume package by sdb_id and give item by sdb_id to self + character.Player.Inventory.CreateItem(Params.ItemSdbId); + + return true; + } +} \ No newline at end of file diff --git a/UdpHosts/GameServer/Systems/Aptitude/Commands/Register/LoadRegisterFromLevelCommand.cs b/UdpHosts/GameServer/Systems/Aptitude/Commands/Register/LoadRegisterFromLevelCommand.cs new file mode 100644 index 0000000..0a44b96 --- /dev/null +++ b/UdpHosts/GameServer/Systems/Aptitude/Commands/Register/LoadRegisterFromLevelCommand.cs @@ -0,0 +1,46 @@ +using GameServer.Data.SDB.Records.apt; +using GameServer.Entities.Character; +using GameServer.Enums; + +namespace GameServer.Aptitude; + +public class LoadRegisterFromLevelCommand : Command, ICommand +{ + private LoadRegisterFromLevelCommandDef Params; + + public LoadRegisterFromLevelCommand(LoadRegisterFromLevelCommandDef par) +: base(par) + { + Params = par; + } + + public bool Execute(Context context) + { + if (Params.FromInitiator == 1) + { + if (context.Initiator is not CharacterEntity initiator) + { + return false; + } + + context.Register = AbilitySystem.RegistryOp( + context.Register, + initiator.Character_BaseController.LevelProp, + (Operand)Params.Regop); + + return true; + } + + if (context.Self is not CharacterEntity character) + { + return false; + } + + context.Register = AbilitySystem.RegistryOp( + context.Register, + character.Character_BaseController.LevelProp, + (Operand)Params.Regop); + + return true; + } +} \ No newline at end of file diff --git a/UdpHosts/GameServer/Systems/Aptitude/Commands/Register/LoadRegisterFromResourceCommand.cs b/UdpHosts/GameServer/Systems/Aptitude/Commands/Register/LoadRegisterFromResourceCommand.cs new file mode 100644 index 0000000..6ee1611 --- /dev/null +++ b/UdpHosts/GameServer/Systems/Aptitude/Commands/Register/LoadRegisterFromResourceCommand.cs @@ -0,0 +1,32 @@ +using GameServer.Data.SDB.Records.apt; +using GameServer.Entities.Character; +using GameServer.Enums; + +namespace GameServer.Aptitude; + +public class LoadRegisterFromResourceCommand : Command, ICommand +{ + private LoadRegisterFromResourceCommandDef Params; + + public LoadRegisterFromResourceCommand(LoadRegisterFromResourceCommandDef par) +: base(par) + { + Params = par; + } + + public bool Execute(Context context) + { + // todo: meaning of Params.RegisterVal_0 - RegisterVal_10 + if (context.Self is not CharacterEntity character) + { + return false; + } + + context.Register = AbilitySystem.RegistryOp( + context.Register, + character.Player.Inventory.GetResourceQuantity(Params.ResourceId), + (Operand)Params.Regop); + + return true; + } +} \ No newline at end of file diff --git a/UdpHosts/GameServer/Systems/Aptitude/Commands/Register/Todo/PeekRegisterCommand.cs b/UdpHosts/GameServer/Systems/Aptitude/Commands/Register/PeekRegisterCommand.cs similarity index 65% rename from UdpHosts/GameServer/Systems/Aptitude/Commands/Register/Todo/PeekRegisterCommand.cs rename to UdpHosts/GameServer/Systems/Aptitude/Commands/Register/PeekRegisterCommand.cs index 8a430ab..748785e 100644 --- a/UdpHosts/GameServer/Systems/Aptitude/Commands/Register/Todo/PeekRegisterCommand.cs +++ b/UdpHosts/GameServer/Systems/Aptitude/Commands/Register/PeekRegisterCommand.cs @@ -1,4 +1,5 @@ using GameServer.Data.SDB.Records.apt; +using GameServer.Enums; namespace GameServer.Aptitude; @@ -14,6 +15,8 @@ public PeekRegisterCommand(PeekRegisterCommandDef par) public bool Execute(Context context) { - return true; + context.Register = AbilitySystem.RegistryOp(context.Register, context.Register, (Operand)Params.Regop); + + return context.Register != 0; } } \ No newline at end of file diff --git a/UdpHosts/GameServer/Systems/Aptitude/Commands/Register/Todo/PopRegisterCommand.cs b/UdpHosts/GameServer/Systems/Aptitude/Commands/Register/PopRegisterCommand.cs similarity index 79% rename from UdpHosts/GameServer/Systems/Aptitude/Commands/Register/Todo/PopRegisterCommand.cs rename to UdpHosts/GameServer/Systems/Aptitude/Commands/Register/PopRegisterCommand.cs index 5b4dbd6..d3ee153 100644 --- a/UdpHosts/GameServer/Systems/Aptitude/Commands/Register/Todo/PopRegisterCommand.cs +++ b/UdpHosts/GameServer/Systems/Aptitude/Commands/Register/PopRegisterCommand.cs @@ -14,6 +14,9 @@ public PopRegisterCommand(PopRegisterCommandDef par) public bool Execute(Context context) { + context.Register = context.FormerRegister; + context.FormerRegister = 0; + return true; } } \ No newline at end of file diff --git a/UdpHosts/GameServer/Systems/Aptitude/Commands/Register/Todo/PushRegisterCommand.cs b/UdpHosts/GameServer/Systems/Aptitude/Commands/Register/PushRegisterCommand.cs similarity index 81% rename from UdpHosts/GameServer/Systems/Aptitude/Commands/Register/Todo/PushRegisterCommand.cs rename to UdpHosts/GameServer/Systems/Aptitude/Commands/Register/PushRegisterCommand.cs index ae56ccb..981359c 100644 --- a/UdpHosts/GameServer/Systems/Aptitude/Commands/Register/Todo/PushRegisterCommand.cs +++ b/UdpHosts/GameServer/Systems/Aptitude/Commands/Register/PushRegisterCommand.cs @@ -14,6 +14,9 @@ public PushRegisterCommand(PushRegisterCommandDef par) public bool Execute(Context context) { + context.FormerRegister = context.Register; + context.Register = 0; + return true; } } \ No newline at end of file diff --git a/UdpHosts/GameServer/Systems/Aptitude/Commands/Register/RegisterRandomCommand.cs b/UdpHosts/GameServer/Systems/Aptitude/Commands/Register/RegisterRandomCommand.cs index 2f5eff4..880b8a7 100644 --- a/UdpHosts/GameServer/Systems/Aptitude/Commands/Register/RegisterRandomCommand.cs +++ b/UdpHosts/GameServer/Systems/Aptitude/Commands/Register/RegisterRandomCommand.cs @@ -1,7 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using GameServer.Data.SDB; using GameServer.Data.SDB.Records.apt; using GameServer.Enums; @@ -10,10 +7,10 @@ namespace GameServer.Aptitude; public class RegisterRandomCommand : Command, ICommand { private RegisterRandomCommandDef Params; - private Random rng = new Random(); + private Random rng = new(); public RegisterRandomCommand(RegisterRandomCommandDef par) -: base(par) + : base(par) { Params = par; } @@ -21,24 +18,14 @@ public RegisterRandomCommand(RegisterRandomCommandDef par) public bool Execute(Context context) { float prevValue = context.Register; - float randValue = rng.Next((int)Params.MinValue, (int)Params.MaxValue); - context.Register = AbilitySystem.RegistryOp(prevValue, randValue, (Operand)Params.Regop); - if (!IsWhole(Params.MinValue) || !IsWhole(Params.MaxValue)) - { - Console.WriteLine($"RegisterRandomCommand {Params.Id} uses floats with decimals, not handled"); - } + float rand = rng.NextSingle(); + float range = Params.MaxValue - Params.MinValue; + float randValue = Params.MinValue + (range * rand); + context.Register = AbilitySystem.RegistryOp(prevValue, randValue, (Operand)Params.Regop); - if (true) - { - Console.WriteLine($"RegisterRandomCommand: ({prevValue}, {randValue} ({Params.MinValue} - {Params.MaxValue}), {(Operand)Params.Regop}) => {context.Register}"); - } + Console.WriteLine($"RegisterRandomCommand: ({prevValue}, {randValue} ({Params.MinValue} - {Params.MaxValue}), {(Operand)Params.Regop}) => {context.Register}"); return true; } - - private bool IsWhole(float val) - { - return val % 1 == 0; - } } \ No newline at end of file diff --git a/UdpHosts/GameServer/Systems/Aptitude/Commands/Register/Todo/LoadRegisterFromLevelCommand.cs b/UdpHosts/GameServer/Systems/Aptitude/Commands/Register/Todo/LoadRegisterFromLevelCommand.cs deleted file mode 100644 index 5025c45..0000000 --- a/UdpHosts/GameServer/Systems/Aptitude/Commands/Register/Todo/LoadRegisterFromLevelCommand.cs +++ /dev/null @@ -1,19 +0,0 @@ -using GameServer.Data.SDB.Records.apt; - -namespace GameServer.Aptitude; - -public class LoadRegisterFromLevelCommand : Command, ICommand -{ - private LoadRegisterFromLevelCommandDef Params; - - public LoadRegisterFromLevelCommand(LoadRegisterFromLevelCommandDef par) -: base(par) - { - Params = par; - } - - public bool Execute(Context context) - { - return true; - } -} \ No newline at end of file diff --git a/UdpHosts/GameServer/Systems/Aptitude/Commands/Register/Todo/LoadRegisterFromResourceCommand.cs b/UdpHosts/GameServer/Systems/Aptitude/Commands/Register/Todo/LoadRegisterFromResourceCommand.cs deleted file mode 100644 index eb8a570..0000000 --- a/UdpHosts/GameServer/Systems/Aptitude/Commands/Register/Todo/LoadRegisterFromResourceCommand.cs +++ /dev/null @@ -1,19 +0,0 @@ -using GameServer.Data.SDB.Records.apt; - -namespace GameServer.Aptitude; - -public class LoadRegisterFromResourceCommand : Command, ICommand -{ - private LoadRegisterFromResourceCommandDef Params; - - public LoadRegisterFromResourceCommand(LoadRegisterFromResourceCommandDef par) -: base(par) - { - Params = par; - } - - public bool Execute(Context context) - { - return true; - } -} \ No newline at end of file diff --git a/UdpHosts/GameServer/Systems/Aptitude/Commands/Requirement/RequireArmyCommand.cs b/UdpHosts/GameServer/Systems/Aptitude/Commands/Requirement/RequireArmyCommand.cs new file mode 100644 index 0000000..4e90181 --- /dev/null +++ b/UdpHosts/GameServer/Systems/Aptitude/Commands/Requirement/RequireArmyCommand.cs @@ -0,0 +1,36 @@ +using GameServer.Data.SDB.Records.aptfs; +using GameServer.Entities.Character; + +namespace GameServer.Aptitude; + +public class RequireArmyCommand : Command, ICommand +{ + private RequireArmyCommandDef Params; + + public RequireArmyCommand(RequireArmyCommandDef par) + : base(par) + { + Params = par; + } + + /* + * Params.CheckTarget and Params.Rank are equal to 0 for all 3 instances + * Possibly Rank = webapi's ArmyRank.Position + */ + public bool Execute(Context context) + { + if (Params.CheckTarget == 1) + { + if (context.Targets.TryPeek(out var t) && t is CharacterEntity target) + { + return target.Character_BaseController.ArmyGUIDProp != 0; + } + } + else if (context.Self is CharacterEntity self) + { + return self.Character_BaseController.ArmyGUIDProp != 0; + } + + return false; + } +} \ No newline at end of file diff --git a/UdpHosts/GameServer/Systems/Aptitude/Commands/Requirement/RequireCAISStateCommand.cs b/UdpHosts/GameServer/Systems/Aptitude/Commands/Requirement/RequireCAISStateCommand.cs new file mode 100644 index 0000000..434baea --- /dev/null +++ b/UdpHosts/GameServer/Systems/Aptitude/Commands/Requirement/RequireCAISStateCommand.cs @@ -0,0 +1,54 @@ +using System; +using AeroMessages.GSS.V66.Character.Controller; +using GameServer.Data.SDB.Records.aptfs; +using GameServer.Entities.Character; + +namespace GameServer.Aptitude; + +public class RequireCAISStateCommand : Command, ICommand +{ + private RequireCAISStateCommandDef Params; + + public RequireCAISStateCommand(RequireCAISStateCommandDef par) + : base(par) + { + Params = par; + } + + public bool Execute(Context context) + { + bool result = false; + + var target = context.Self; + + if (target is not CharacterEntity character) + { + Console.WriteLine("RequireCAISStateCommand fails because target is not a Character. If this is happening, we should investigate why."); + return false; + } + + var state = character.Character_BaseController.CAISStatusProp.State; + + if (Params.None == 1) + { + result = state == CAISStatusData.CAISState.None; + } + + if (Params.Fatigued == 1) + { + result = result || state == CAISStatusData.CAISState.Fatigued; + } + + if (Params.Unhealthy == 1) + { + result = result || state == CAISStatusData.CAISState.Unhealthy; + } + + if (Params.Healthy == 1) + { + result = result || state == CAISStatusData.CAISState.Healthy; + } + + return result; + } +} \ No newline at end of file diff --git a/UdpHosts/GameServer/Systems/Aptitude/Commands/Requirement/RequireEliteLevelCommand.cs b/UdpHosts/GameServer/Systems/Aptitude/Commands/Requirement/RequireEliteLevelCommand.cs new file mode 100644 index 0000000..1af8553 --- /dev/null +++ b/UdpHosts/GameServer/Systems/Aptitude/Commands/Requirement/RequireEliteLevelCommand.cs @@ -0,0 +1,35 @@ +using System; +using GameServer.Data.SDB.Records.aptfs; +using GameServer.Entities.Character; + +namespace GameServer.Aptitude; + +public class RequireEliteLevelCommand : Command, ICommand +{ + private RequireEliteLevelCommandDef Params; + + public RequireEliteLevelCommand(RequireEliteLevelCommandDef par) + : base(par) + { + Params = par; + } + + public bool Execute(Context context) + { + bool result = false; + + // NOTE: Investigate target handling + var target = context.Self; + + if (target is CharacterEntity character) + { + result = character.Character_BaseController.EliteLevelProp >= Params.Level; + } + else + { + Console.WriteLine("RequireEliteLevelCommand fails because target is not a Character. If this is happening, we should investigate why."); + } + + return result; + } +} \ No newline at end of file diff --git a/UdpHosts/GameServer/Systems/Aptitude/Commands/Requirement/RequireFriendsCommand.cs b/UdpHosts/GameServer/Systems/Aptitude/Commands/Requirement/RequireFriendsCommand.cs new file mode 100644 index 0000000..65c493b --- /dev/null +++ b/UdpHosts/GameServer/Systems/Aptitude/Commands/Requirement/RequireFriendsCommand.cs @@ -0,0 +1,35 @@ +using System; +using GameServer.Data.SDB.Records.aptfs; +using GameServer.Entities.Character; + +namespace GameServer.Aptitude; + +public class RequireFriendsCommand : Command, ICommand +{ + private RequireFriendsCommandDef Params; + + public RequireFriendsCommand(RequireFriendsCommandDef par) + : base(par) + { + Params = par; + } + + public bool Execute(Context context) + { + bool result = false; + + // NOTE: Investigate target handling + var target = context.Self; + + if (target is CharacterEntity character) + { + result = character.Character_BaseController.FriendCountProp >= Params.Friends; + } + else + { + Console.WriteLine("RequireFriendsCommand fails because target is not a Character. If this is happening, we should investigate why."); + } + + return result; + } +} \ No newline at end of file diff --git a/UdpHosts/GameServer/Systems/Aptitude/Commands/Requirement/RequireHasEffectCommand.cs b/UdpHosts/GameServer/Systems/Aptitude/Commands/Requirement/RequireHasEffectCommand.cs index 592a65b..7bc4d48 100644 --- a/UdpHosts/GameServer/Systems/Aptitude/Commands/Requirement/RequireHasEffectCommand.cs +++ b/UdpHosts/GameServer/Systems/Aptitude/Commands/Requirement/RequireHasEffectCommand.cs @@ -35,6 +35,12 @@ public bool Execute(Context context) if (active.Effect.Id == Params.EffectId && active.Stacks >= Params.StackCount) { targetResult = true; + + if (Params.SameInitiator == 1 && context.Initiator != active.Context.Initiator) + { + targetResult = false; + } + break; } } @@ -49,29 +55,35 @@ public bool Execute(Context context) matchCounter++; } } - + if (matchCounter == context.Targets.Count) { result = true; } } - else - { - var target = context.Self; - foreach (EffectState active in target.GetActiveEffects()) - { - if (active == null) - { - continue; - } - - if (active.Effect.Id == Params.EffectId && active.Stacks >= Params.StackCount) - { - result = true; - break; - } - } - } + // else + // { + // var target = context.Self; + // foreach (EffectState active in target.GetActiveEffects()) + // { + // if (active == null) + // { + // continue; + // } + // + // if (active.Effect.Id == Params.EffectId && active.Stacks >= Params.StackCount) + // { + // result = true; + // + // if (Params.SameInitiator == 1 && context.Initiator != active.Context.Initiator) + // { + // result = false; + // } + // + // break; + // } + // } + // } if (Params.Negate == 1) { diff --git a/UdpHosts/GameServer/Systems/Aptitude/Commands/Requirement/Todo/RequireInitiatorExistsCommand.cs b/UdpHosts/GameServer/Systems/Aptitude/Commands/Requirement/RequireInitiatorExistsCommand.cs similarity index 81% rename from UdpHosts/GameServer/Systems/Aptitude/Commands/Requirement/Todo/RequireInitiatorExistsCommand.cs rename to UdpHosts/GameServer/Systems/Aptitude/Commands/Requirement/RequireInitiatorExistsCommand.cs index 9f61909..98b23e0 100644 --- a/UdpHosts/GameServer/Systems/Aptitude/Commands/Requirement/Todo/RequireInitiatorExistsCommand.cs +++ b/UdpHosts/GameServer/Systems/Aptitude/Commands/Requirement/RequireInitiatorExistsCommand.cs @@ -14,6 +14,6 @@ public RequireInitiatorExistsCommand(RequireInitiatorExistsCommandDef par) public bool Execute(Context context) { - return true; + return context.Shard.Entities.TryGetValue(context.Initiator.EntityId, out _); } } \ No newline at end of file diff --git a/UdpHosts/GameServer/Systems/Aptitude/Commands/Requirement/RequireIsNPCCommand.cs b/UdpHosts/GameServer/Systems/Aptitude/Commands/Requirement/RequireIsNPCCommand.cs new file mode 100644 index 0000000..38ebad9 --- /dev/null +++ b/UdpHosts/GameServer/Systems/Aptitude/Commands/Requirement/RequireIsNPCCommand.cs @@ -0,0 +1,40 @@ +using System; +using GameServer.Data.SDB.Records.aptfs; +using GameServer.Entities.Character; + +namespace GameServer.Aptitude; + +public class RequireIsNPCCommand : Command, ICommand +{ + private RequireIsNPCCommandDef Params; + + public RequireIsNPCCommand(RequireIsNPCCommandDef par) + : base(par) + { + Params = par; + } + + public bool Execute(Context context) + { + bool result = false; + + // NOTE: Investigate target handling + var target = context.Self; + + if (target is CharacterEntity character) + { + result = character.IsPlayerControlled; + } + else + { + Console.WriteLine("RequireIsNPCCommand fails because target is not a Character. If this is happening, we should investigate why."); + } + + if (Params.Negate == 1) + { + result = !result; + } + + return result; + } +} \ No newline at end of file diff --git a/UdpHosts/GameServer/Systems/Aptitude/Commands/Requirement/RequireLevelCommand.cs b/UdpHosts/GameServer/Systems/Aptitude/Commands/Requirement/RequireLevelCommand.cs new file mode 100644 index 0000000..cff89ee --- /dev/null +++ b/UdpHosts/GameServer/Systems/Aptitude/Commands/Requirement/RequireLevelCommand.cs @@ -0,0 +1,44 @@ +using System; +using GameServer.Data.SDB.Records.aptfs; +using GameServer.Entities.Character; + +namespace GameServer.Aptitude; + +public class RequireLevelCommand : Command, ICommand +{ + private RequireLevelCommandDef Params; + + public RequireLevelCommand(RequireLevelCommandDef par) + : base(par) + { + Params = par; + } + + public bool Execute(Context context) + { + bool result = false; + + // NOTE: Investigate target handling + var target = context.Self; + + if (target is CharacterEntity character) + { + if (Params.FrameLevel == 1) + { + result = character.Character_BaseController.LevelProp >= Params.Level; + } + else if (Params.SessionLevel == 1) + { + // todo + Console.WriteLine($"[RequireLevelCommand] Session level, level {Params.Level}"); + result = true; + } + } + else + { + Console.WriteLine("RequireLevelCommand fails because target is not a Character. If this is happening, we should investigate why."); + } + + return result; + } +} \ No newline at end of file diff --git a/UdpHosts/GameServer/Systems/Aptitude/Commands/Requirement/RequireMovementFlagsCommand.cs b/UdpHosts/GameServer/Systems/Aptitude/Commands/Requirement/RequireMovementFlagsCommand.cs new file mode 100644 index 0000000..e38f9d3 --- /dev/null +++ b/UdpHosts/GameServer/Systems/Aptitude/Commands/Requirement/RequireMovementFlagsCommand.cs @@ -0,0 +1,47 @@ +using System; +using GameServer.Data.SDB.Records.aptfs; +using GameServer.Entities.Character; + +namespace GameServer.Aptitude; + +public class RequireMovementFlagsCommand : Command, ICommand +{ + private RequireMovementFlagsCommandDef Params; + + public RequireMovementFlagsCommand(RequireMovementFlagsCommandDef par) + : base(par) + { + Params = par; + } + + public bool Execute(Context context) + { + bool result = false; + + // NOTE: Investigate target handling + var target = context.Self; + + if (target is CharacterEntity character) + { + if (Params.Crouch == 1 && character.MovementStateContainer.Crouch) + { + result = true; + } + else if (Params.Sprint == 1 && character.MovementStateContainer.Sprint) + { + result = true; + } + } + else + { + Console.WriteLine($"RequireMovementFlagsCommand fails because target is not a Character. If this is happening, we should investigate why."); + } + + if (Params.Negate == 1) + { + result = !result; + } + + return result; + } +} \ No newline at end of file diff --git a/UdpHosts/GameServer/Systems/Aptitude/Commands/Requirement/RequireNeedsAmmoCommand.cs b/UdpHosts/GameServer/Systems/Aptitude/Commands/Requirement/RequireNeedsAmmoCommand.cs new file mode 100644 index 0000000..e41bb49 --- /dev/null +++ b/UdpHosts/GameServer/Systems/Aptitude/Commands/Requirement/RequireNeedsAmmoCommand.cs @@ -0,0 +1,44 @@ +using GameServer.Data.SDB.Records.aptfs; +using GameServer.Entities.Character; + +namespace GameServer.Aptitude; + +public class RequireNeedsAmmoCommand : Command, ICommand +{ + private RequireNeedsAmmoCommandDef Params; + + public RequireNeedsAmmoCommand(RequireNeedsAmmoCommandDef par) + : base(par) + { + Params = par; + } + + // todo recheck controller props + public bool Execute(Context context) + { + bool result = false; + + // NOTE: Investigate target handling + var target = context.Self; + + if (target is CharacterEntity character) + { + if (Params.CheckPrimary == 1) + { + result = character.Character_CombatController.Ammo_0Prop == 0; + } + + if (Params.CheckSecondary == 1) + { + result = character.Character_CombatController.AltAmmo_0Prop == 0; + } + } + + if (Params.Negate == 1) + { + result = !result; + } + + return result; + } +} \ No newline at end of file diff --git a/UdpHosts/GameServer/Systems/Aptitude/Commands/Requirement/RequirePermissionCommand.cs b/UdpHosts/GameServer/Systems/Aptitude/Commands/Requirement/RequirePermissionCommand.cs new file mode 100644 index 0000000..5c94daf --- /dev/null +++ b/UdpHosts/GameServer/Systems/Aptitude/Commands/Requirement/RequirePermissionCommand.cs @@ -0,0 +1,37 @@ +using AeroMessages.GSS.V66.Character.Controller; +using GameServer.Data.SDB.Records.aptfs; +using GameServer.Entities.Character; + +namespace GameServer.Aptitude; + +public class RequirePermissionCommand : Command, ICommand +{ + private RequirePermissionCommandDef Params; + + public RequirePermissionCommand(RequirePermissionCommandDef par) + : base(par) + { + Params = par; + } + + public bool Execute(Context context) + { + bool result = false; + + // NOTE: Investigate target handling + var target = context.Self; + + if (target is CharacterEntity character) + { + result = character.Character_CombatController.PermissionFlagsProp.Value.HasFlag( + (PermissionFlagsData.CharacterPermissionFlags)(1 << Params.Permission)); + } + + if (Params.Negate == 1) + { + result = !result; + } + + return result; + } +} \ No newline at end of file diff --git a/UdpHosts/GameServer/Systems/Aptitude/Commands/Requirement/RequireReloadCommand.cs b/UdpHosts/GameServer/Systems/Aptitude/Commands/Requirement/RequireReloadCommand.cs new file mode 100644 index 0000000..14a930a --- /dev/null +++ b/UdpHosts/GameServer/Systems/Aptitude/Commands/Requirement/RequireReloadCommand.cs @@ -0,0 +1,43 @@ +using System; +using GameServer.Data.SDB.Records.aptfs; +using GameServer.Entities.Character; + +namespace GameServer.Aptitude; + +public class RequireReloadCommand : Command, ICommand +{ + private RequireReloadCommandDef Params; + + public RequireReloadCommand(RequireReloadCommandDef par) + : base(par) + { + Params = par; + } + + public bool Execute(Context context) + { + bool result = false; + + // NOTE: Investigate target handling + var target = context.Self; + + if (target is CharacterEntity character) + { + if (Params.Inittime == 1) + { + result = character.Character_CombatView.WeaponReloadedProp > context.InitTime; + } + } + else + { + Console.WriteLine("RequireReloadCommand fails because target is not a Character. If this is happening, we should investigate why."); + } + + if (Params.Negate == 1) + { + result = !result; + } + + return result; + } +} \ No newline at end of file diff --git a/UdpHosts/GameServer/Systems/Aptitude/Commands/Requirement/RequireSuperChargeCommand.cs b/UdpHosts/GameServer/Systems/Aptitude/Commands/Requirement/RequireSuperChargeCommand.cs new file mode 100644 index 0000000..644488d --- /dev/null +++ b/UdpHosts/GameServer/Systems/Aptitude/Commands/Requirement/RequireSuperChargeCommand.cs @@ -0,0 +1,36 @@ +using System; +using GameServer.Data.SDB.Records.aptfs; +using GameServer.Entities.Character; +using GameServer.Enums; + +namespace GameServer.Aptitude; + +public class RequireSuperChargeCommand : Command, ICommand +{ + private RequireSuperChargeCommandDef Params; + + public RequireSuperChargeCommand(RequireSuperChargeCommandDef par) + : base(par) + { + Params = par; + } + + public bool Execute(Context context) + { + var target = context.Self; + + if (target is CharacterEntity character) + { + var currentValue = character.Character_CombatController.SuperChargeProp.Value; + + var percent = AbilitySystem.RegistryOp(context.Register, Params.Percent, (Operand)Params.PercentRegop); + var value = percent / 100 * currentValue; + + return currentValue >= value; + } + + Console.WriteLine("ConsumeSuperChargeCommand fails because target is not a Character. If this is happening, we should investigate why."); + + return false; + } +} \ No newline at end of file diff --git a/UdpHosts/GameServer/Systems/Aptitude/Commands/Requirement/Todo/RequireArmyCommand.cs b/UdpHosts/GameServer/Systems/Aptitude/Commands/Requirement/Todo/RequireArmyCommand.cs deleted file mode 100644 index 490872b..0000000 --- a/UdpHosts/GameServer/Systems/Aptitude/Commands/Requirement/Todo/RequireArmyCommand.cs +++ /dev/null @@ -1,19 +0,0 @@ -using GameServer.Data.SDB.Records.aptfs; - -namespace GameServer.Aptitude; - -public class RequireArmyCommand : Command, ICommand -{ - private RequireArmyCommandDef Params; - - public RequireArmyCommand(RequireArmyCommandDef par) -: base(par) - { - Params = par; - } - - public bool Execute(Context context) - { - return true; - } -} \ No newline at end of file diff --git a/UdpHosts/GameServer/Systems/Aptitude/Commands/Requirement/Todo/RequireCAISStateCommand.cs b/UdpHosts/GameServer/Systems/Aptitude/Commands/Requirement/Todo/RequireCAISStateCommand.cs deleted file mode 100644 index 6e4ad95..0000000 --- a/UdpHosts/GameServer/Systems/Aptitude/Commands/Requirement/Todo/RequireCAISStateCommand.cs +++ /dev/null @@ -1,19 +0,0 @@ -using GameServer.Data.SDB.Records.aptfs; - -namespace GameServer.Aptitude; - -public class RequireCAISStateCommand : Command, ICommand -{ - private RequireCAISStateCommandDef Params; - - public RequireCAISStateCommand(RequireCAISStateCommandDef par) -: base(par) - { - Params = par; - } - - public bool Execute(Context context) - { - return true; - } -} \ No newline at end of file diff --git a/UdpHosts/GameServer/Systems/Aptitude/Commands/Requirement/Todo/RequireEliteLevelCommand.cs b/UdpHosts/GameServer/Systems/Aptitude/Commands/Requirement/Todo/RequireEliteLevelCommand.cs deleted file mode 100644 index e043e49..0000000 --- a/UdpHosts/GameServer/Systems/Aptitude/Commands/Requirement/Todo/RequireEliteLevelCommand.cs +++ /dev/null @@ -1,19 +0,0 @@ -using GameServer.Data.SDB.Records.aptfs; - -namespace GameServer.Aptitude; - -public class RequireEliteLevelCommand : Command, ICommand -{ - private RequireEliteLevelCommandDef Params; - - public RequireEliteLevelCommand(RequireEliteLevelCommandDef par) -: base(par) - { - Params = par; - } - - public bool Execute(Context context) - { - return true; - } -} \ No newline at end of file diff --git a/UdpHosts/GameServer/Systems/Aptitude/Commands/Requirement/Todo/RequireFriendsCommand.cs b/UdpHosts/GameServer/Systems/Aptitude/Commands/Requirement/Todo/RequireFriendsCommand.cs deleted file mode 100644 index 66336c9..0000000 --- a/UdpHosts/GameServer/Systems/Aptitude/Commands/Requirement/Todo/RequireFriendsCommand.cs +++ /dev/null @@ -1,19 +0,0 @@ -using GameServer.Data.SDB.Records.aptfs; - -namespace GameServer.Aptitude; - -public class RequireFriendsCommand : Command, ICommand -{ - private RequireFriendsCommandDef Params; - - public RequireFriendsCommand(RequireFriendsCommandDef par) -: base(par) - { - Params = par; - } - - public bool Execute(Context context) - { - return true; - } -} \ No newline at end of file diff --git a/UdpHosts/GameServer/Systems/Aptitude/Commands/Requirement/Todo/RequireIsNPCCommand.cs b/UdpHosts/GameServer/Systems/Aptitude/Commands/Requirement/Todo/RequireIsNPCCommand.cs deleted file mode 100644 index b6b5e22..0000000 --- a/UdpHosts/GameServer/Systems/Aptitude/Commands/Requirement/Todo/RequireIsNPCCommand.cs +++ /dev/null @@ -1,19 +0,0 @@ -using GameServer.Data.SDB.Records.aptfs; - -namespace GameServer.Aptitude; - -public class RequireIsNPCCommand : Command, ICommand -{ - private RequireIsNPCCommandDef Params; - - public RequireIsNPCCommand(RequireIsNPCCommandDef par) -: base(par) - { - Params = par; - } - - public bool Execute(Context context) - { - return true; - } -} \ No newline at end of file diff --git a/UdpHosts/GameServer/Systems/Aptitude/Commands/Requirement/Todo/RequireLevelCommand.cs b/UdpHosts/GameServer/Systems/Aptitude/Commands/Requirement/Todo/RequireLevelCommand.cs deleted file mode 100644 index 87262e7..0000000 --- a/UdpHosts/GameServer/Systems/Aptitude/Commands/Requirement/Todo/RequireLevelCommand.cs +++ /dev/null @@ -1,19 +0,0 @@ -using GameServer.Data.SDB.Records.aptfs; - -namespace GameServer.Aptitude; - -public class RequireLevelCommand : Command, ICommand -{ - private RequireLevelCommandDef Params; - - public RequireLevelCommand(RequireLevelCommandDef par) -: base(par) - { - Params = par; - } - - public bool Execute(Context context) - { - return true; - } -} \ No newline at end of file diff --git a/UdpHosts/GameServer/Systems/Aptitude/Commands/Requirement/Todo/RequireMovementFlagsCommand.cs b/UdpHosts/GameServer/Systems/Aptitude/Commands/Requirement/Todo/RequireMovementFlagsCommand.cs deleted file mode 100644 index 098aa01..0000000 --- a/UdpHosts/GameServer/Systems/Aptitude/Commands/Requirement/Todo/RequireMovementFlagsCommand.cs +++ /dev/null @@ -1,19 +0,0 @@ -using GameServer.Data.SDB.Records.aptfs; - -namespace GameServer.Aptitude; - -public class RequireMovementFlagsCommand : Command, ICommand -{ - private RequireMovementFlagsCommandDef Params; - - public RequireMovementFlagsCommand(RequireMovementFlagsCommandDef par) -: base(par) - { - Params = par; - } - - public bool Execute(Context context) - { - return true; - } -} diff --git a/UdpHosts/GameServer/Systems/Aptitude/Commands/Requirement/Todo/RequireNeedsAmmoCommand.cs b/UdpHosts/GameServer/Systems/Aptitude/Commands/Requirement/Todo/RequireNeedsAmmoCommand.cs deleted file mode 100644 index 0a6229b..0000000 --- a/UdpHosts/GameServer/Systems/Aptitude/Commands/Requirement/Todo/RequireNeedsAmmoCommand.cs +++ /dev/null @@ -1,19 +0,0 @@ -using GameServer.Data.SDB.Records.aptfs; - -namespace GameServer.Aptitude; - -public class RequireNeedsAmmoCommand : Command, ICommand -{ - private RequireNeedsAmmoCommandDef Params; - - public RequireNeedsAmmoCommand(RequireNeedsAmmoCommandDef par) -: base(par) - { - Params = par; - } - - public bool Execute(Context context) - { - return true; - } -} \ No newline at end of file diff --git a/UdpHosts/GameServer/Systems/Aptitude/Commands/Requirement/Todo/RequirePermissionCommand.cs b/UdpHosts/GameServer/Systems/Aptitude/Commands/Requirement/Todo/RequirePermissionCommand.cs deleted file mode 100644 index ba02fa4..0000000 --- a/UdpHosts/GameServer/Systems/Aptitude/Commands/Requirement/Todo/RequirePermissionCommand.cs +++ /dev/null @@ -1,19 +0,0 @@ -using GameServer.Data.SDB.Records.aptfs; - -namespace GameServer.Aptitude; - -public class RequirePermissionCommand : Command, ICommand -{ - private RequirePermissionCommandDef Params; - - public RequirePermissionCommand(RequirePermissionCommandDef par) -: base(par) - { - Params = par; - } - - public bool Execute(Context context) - { - return true; - } -} \ No newline at end of file diff --git a/UdpHosts/GameServer/Systems/Aptitude/Commands/Requirement/Todo/RequireReloadCommand.cs b/UdpHosts/GameServer/Systems/Aptitude/Commands/Requirement/Todo/RequireReloadCommand.cs deleted file mode 100644 index 34cd55d..0000000 --- a/UdpHosts/GameServer/Systems/Aptitude/Commands/Requirement/Todo/RequireReloadCommand.cs +++ /dev/null @@ -1,19 +0,0 @@ -using GameServer.Data.SDB.Records.aptfs; - -namespace GameServer.Aptitude; - -public class RequireReloadCommand : Command, ICommand -{ - private RequireReloadCommandDef Params; - - public RequireReloadCommand(RequireReloadCommandDef par) -: base(par) - { - Params = par; - } - - public bool Execute(Context context) - { - return true; - } -} \ No newline at end of file diff --git a/UdpHosts/GameServer/Systems/Aptitude/Commands/Requirement/Todo/RequireSuperChargeCommand.cs b/UdpHosts/GameServer/Systems/Aptitude/Commands/Requirement/Todo/RequireSuperChargeCommand.cs deleted file mode 100644 index fa656b0..0000000 --- a/UdpHosts/GameServer/Systems/Aptitude/Commands/Requirement/Todo/RequireSuperChargeCommand.cs +++ /dev/null @@ -1,19 +0,0 @@ -using GameServer.Data.SDB.Records.aptfs; - -namespace GameServer.Aptitude; - -public class RequireSuperChargeCommand : Command, ICommand -{ - private RequireSuperChargeCommandDef Params; - - public RequireSuperChargeCommand(RequireSuperChargeCommandDef par) -: base(par) - { - Params = par; - } - - public bool Execute(Context context) - { - return true; - } -} \ No newline at end of file diff --git a/UdpHosts/GameServer/Systems/Aptitude/Commands/Target/PopTargetsCommand.cs b/UdpHosts/GameServer/Systems/Aptitude/Commands/Target/PopTargetsCommand.cs index 6f21519..3b6ecb4 100644 --- a/UdpHosts/GameServer/Systems/Aptitude/Commands/Target/PopTargetsCommand.cs +++ b/UdpHosts/GameServer/Systems/Aptitude/Commands/Target/PopTargetsCommand.cs @@ -23,9 +23,8 @@ public bool Execute(Context context) if (Params.Current == 1) { - var ok = context.Targets.TryPop(out _); - - return ok; + context.Targets = new AptitudeTargets(context.FormerTargets); + context.FormerTargets = new AptitudeTargets(); } return true; diff --git a/UdpHosts/GameServer/Systems/Aptitude/Commands/Target/PushTargetsCommand.cs b/UdpHosts/GameServer/Systems/Aptitude/Commands/Target/PushTargetsCommand.cs index ba79d21..0fb4fa4 100644 --- a/UdpHosts/GameServer/Systems/Aptitude/Commands/Target/PushTargetsCommand.cs +++ b/UdpHosts/GameServer/Systems/Aptitude/Commands/Target/PushTargetsCommand.cs @@ -17,12 +17,13 @@ public bool Execute(Context context) // todo aptitude: verify what to push if (Params.Former == 1 && context.FormerTargets.Count > 0) { - context.FormerTargets.Push(context.Targets.Peek()); + // assuming push == saving for later, this shouldnt occur and it doesnt in 1962 } - if (Params.Current == 1 && context.Targets.Count > 0) + if (Params.Current == 1) { - context.Targets.Push(context.Targets.Peek()); + context.FormerTargets = new AptitudeTargets(context.Targets); + context.Targets = new AptitudeTargets(); } return true; diff --git a/UdpHosts/GameServer/Systems/Aptitude/Commands/Target/TargetByEffectCommand.cs b/UdpHosts/GameServer/Systems/Aptitude/Commands/Target/TargetByEffectCommand.cs new file mode 100644 index 0000000..a9ea9a4 --- /dev/null +++ b/UdpHosts/GameServer/Systems/Aptitude/Commands/Target/TargetByEffectCommand.cs @@ -0,0 +1,71 @@ +using System; +using GameServer.Data.SDB.Records.aptfs; + +namespace GameServer.Aptitude; + +public class TargetByEffectCommand : Command, ICommand +{ + private TargetByEffectCommandDef Params; + + public TargetByEffectCommand(TargetByEffectCommandDef par) +: base(par) + { + Params = par; + } + + public bool Execute(Context context) + { + // todo Params.FilterList, equal to 1 in 1086 instances, 0 in 6 instances + var result = false; + var previousTargets = context.Targets; + var newTargets = new AptitudeTargets(); + + Console.WriteLine("prev:" + previousTargets.Count); + foreach (IAptitudeTarget target in previousTargets) + { + foreach (EffectState active in target.GetActiveEffects()) + { + if (active == null) + { + continue; + } + + var condition = Params.EffectId == active.Effect.Id && active.Stacks >= Params.StackCount; + if (Params.Negate == 1) + { + condition = !condition; + } + + if (condition) + { + if (Params.SameInitiator == 1) + { + var condition2 = Params.Negate == 1 + ? context.Initiator == active.Context.Initiator + : context.Initiator != active.Context.Initiator; + if (condition2) + { + newTargets.Push(target); + } + } + else + { + newTargets.Push(target); + } + + break; + } + } + } + + context.FormerTargets = previousTargets; + context.Targets = newTargets; + + if (Params.FailNoTargets == 1 && context.Targets.Count == 0) + { + return false; + } + + return true; + } +} \ No newline at end of file diff --git a/UdpHosts/GameServer/Systems/Aptitude/Commands/Target/Todo/TargetByEffectTagCommand.cs b/UdpHosts/GameServer/Systems/Aptitude/Commands/Target/TargetByEffectTagCommand.cs similarity index 100% rename from UdpHosts/GameServer/Systems/Aptitude/Commands/Target/Todo/TargetByEffectTagCommand.cs rename to UdpHosts/GameServer/Systems/Aptitude/Commands/Target/TargetByEffectTagCommand.cs diff --git a/UdpHosts/GameServer/Systems/Aptitude/Commands/Target/TargetByHealthCommand.cs b/UdpHosts/GameServer/Systems/Aptitude/Commands/Target/TargetByHealthCommand.cs new file mode 100644 index 0000000..b7f0c99 --- /dev/null +++ b/UdpHosts/GameServer/Systems/Aptitude/Commands/Target/TargetByHealthCommand.cs @@ -0,0 +1,48 @@ +using GameServer.Data.SDB.Records.aptfs; +using GameServer.Entities.Character; +using GameServer.Enums; + +namespace GameServer.Aptitude; + +public class TargetByHealthCommand : Command, ICommand +{ + private TargetByHealthCommandDef Params; + + public TargetByHealthCommand(TargetByHealthCommandDef par) +: base(par) + { + Params = par; + } + + public bool Execute(Context context) + { + var previousTargets = context.Targets; + var newTargets = new AptitudeTargets(); + + var healthPct = AbilitySystem.RegistryOp(context.Register, Params.HealthPct, (Operand)Params.HealthRegop); + + foreach (IAptitudeTarget target in previousTargets) + { + if (target is CharacterEntity character) + { + var currentHealthPct = (character.Character_BaseController.CurrentHealthProp / + character.Character_BaseController.MaxHealthProp.Value) * 100; + + if (currentHealthPct >= healthPct) + { + newTargets.Push(target); + } + } + } + + context.FormerTargets = previousTargets; + context.Targets = newTargets; + + if (Params.FailNoTargets == 1 && context.Targets.Count == 0) + { + return false; + } + + return true; + } +} \ No newline at end of file diff --git a/UdpHosts/GameServer/Systems/Aptitude/Commands/Target/TargetFilterByRangeCommand.cs b/UdpHosts/GameServer/Systems/Aptitude/Commands/Target/TargetFilterByRangeCommand.cs new file mode 100644 index 0000000..abbfc58 --- /dev/null +++ b/UdpHosts/GameServer/Systems/Aptitude/Commands/Target/TargetFilterByRangeCommand.cs @@ -0,0 +1,49 @@ +using System; +using System.Numerics; +using GameServer.Data.SDB.Records.aptfs; +using GameServer.Entities.Character; +using GameServer.Enums; + +namespace GameServer.Aptitude; + +public class TargetFilterByRangeCommand : Command, ICommand +{ + private TargetFilterByRangeCommandDef Params; + + public TargetFilterByRangeCommand(TargetFilterByRangeCommandDef par) +: base(par) + { + Params = par; + } + + public bool Execute(Context context) + { + context.FormerTargets = context.Targets; + context.Targets = new AptitudeTargets(); + + var range = AbilitySystem.RegistryOp(context.Register, Params.Range, (Operand)Params.RangeRegop); + var sourcePosition = context.Self.Position; + + foreach (IAptitudeTarget target in context.FormerTargets) + { + if (target is CharacterEntity character) + { + if (Vector3.Distance(sourcePosition, target.Position) <= range) + { + context.Targets.Push(character); + } + } + else + { + Console.WriteLine($"[TargetFilterByRange] Target is not CharacterEntity: {target}"); + } + } + + if (Params.FailNoTargets == 1 && context.Targets.Count == 0) + { + return false; + } + + return true; + } +} \ No newline at end of file diff --git a/UdpHosts/GameServer/Systems/Aptitude/Commands/Target/TargetInitiatorCommand.cs b/UdpHosts/GameServer/Systems/Aptitude/Commands/Target/TargetInitiatorCommand.cs index a6ae7f9..1fb4bf3 100644 --- a/UdpHosts/GameServer/Systems/Aptitude/Commands/Target/TargetInitiatorCommand.cs +++ b/UdpHosts/GameServer/Systems/Aptitude/Commands/Target/TargetInitiatorCommand.cs @@ -1,5 +1,3 @@ -using System; -using System.Linq; using GameServer.Data.SDB.Records.apt; namespace GameServer.Aptitude; @@ -16,12 +14,9 @@ public TargetInitiatorCommand(TargetInitiatorCommandDef par) public bool Execute(Context context) { - // Console.WriteLine($"TargetSelfCommand Pre Target {context.Targets.FirstOrDefault()}"); - - // TODO: FormerTargets ? + context.FormerTargets = new AptitudeTargets(context.Targets); context.Targets.Push(context.Initiator); - // Console.WriteLine($"TargetSelfCommand Post Target {context.Targets.FirstOrDefault()}"); return true; } } \ No newline at end of file diff --git a/UdpHosts/GameServer/Systems/Aptitude/Commands/Target/TargetInteractivesCommand.cs b/UdpHosts/GameServer/Systems/Aptitude/Commands/Target/TargetInteractivesCommand.cs new file mode 100644 index 0000000..ac8eb37 --- /dev/null +++ b/UdpHosts/GameServer/Systems/Aptitude/Commands/Target/TargetInteractivesCommand.cs @@ -0,0 +1,39 @@ +using GameServer.Data.SDB.Records.aptfs; +using GameServer.Entities; + +namespace GameServer.Aptitude; + +public class TargetInteractivesCommand : Command, ICommand +{ + private TargetInteractivesCommandDef Params; + + public TargetInteractivesCommand(TargetInteractivesCommandDef par) +: base(par) + { + Params = par; + } + + public bool Execute(Context context) + { + var previousTargets = context.Targets; + var newTargets = new AptitudeTargets(); + + foreach (var target in context.Targets) + { + if (target is BaseEntity { Interaction: not null }) + { + newTargets.Push(target); + } + } + + context.FormerTargets = previousTargets; + context.Targets = newTargets; + + if (Params.FailNoTargets == 1 && newTargets.Count == 0) + { + return false; + } + + return true; + } +} \ No newline at end of file diff --git a/UdpHosts/GameServer/Systems/Aptitude/Commands/Target/TargetPassengersCommand.cs b/UdpHosts/GameServer/Systems/Aptitude/Commands/Target/TargetPassengersCommand.cs new file mode 100644 index 0000000..b8831a5 --- /dev/null +++ b/UdpHosts/GameServer/Systems/Aptitude/Commands/Target/TargetPassengersCommand.cs @@ -0,0 +1,68 @@ +using System; +using GameServer.Data.SDB.Records.aptfs; +using GameServer.Entities.Character; +using GameServer.Entities.Vehicle; + +namespace GameServer.Aptitude; + +public class TargetPassengersCommand : Command, ICommand +{ + private TargetPassengersCommandDef Params; + + public TargetPassengersCommand(TargetPassengersCommandDef par) +: base(par) + { + Params = par; + } + + public bool Execute(Context context) + { + if (context.Self is not VehicleEntity vehicle) + { + Console.WriteLine("TargetPassengersCommand fails because self is not a Vehicle. If this is happening, we should investigate why."); + return false; + } + + context.FormerTargets = new AptitudeTargets(context.Targets); + + var targets = new AptitudeTargets(); + + if (Params.Filter == 1) + { + context.Targets = new AptitudeTargets(); + + foreach (var target in context.FormerTargets) + { + if (target is not CharacterEntity character) + { + continue; + } + + if (character.AttachedToEntity != vehicle + || vehicle.ControllingPlayer == character.Player) + { + continue; + } + + targets.Push(target); + } + } + else + { + foreach (var occupant in vehicle.Occupants.Values) + { + if (occupant.Occupant != vehicle.ControllingPlayer.CharacterEntity) + { + context.Targets.Push((IAptitudeTarget)occupant.Occupant); + } + } + } + + if (Params.FailNone == 1 && context.Targets.Count == 0) + { + return false; + } + + return true; + } +} \ No newline at end of file diff --git a/UdpHosts/GameServer/Systems/Aptitude/Commands/Target/TargetSelfCommand.cs b/UdpHosts/GameServer/Systems/Aptitude/Commands/Target/TargetSelfCommand.cs index 9ffd387..99dd521 100644 --- a/UdpHosts/GameServer/Systems/Aptitude/Commands/Target/TargetSelfCommand.cs +++ b/UdpHosts/GameServer/Systems/Aptitude/Commands/Target/TargetSelfCommand.cs @@ -1,5 +1,3 @@ -using System; -using System.Linq; using GameServer.Data.SDB.Records.apt; namespace GameServer.Aptitude; @@ -16,12 +14,10 @@ public TargetSelfCommand(TargetSelfCommandDef par) public bool Execute(Context context) { - // Console.WriteLine($"TargetSelfCommand Pre Target {context.Targets.FirstOrDefault()}"); + context.FormerTargets = new AptitudeTargets(context.Targets); - // TODO: FormerTargets ? context.Targets.Push(context.Self); - // Console.WriteLine($"TargetSelfCommand Post Target {context.Targets.FirstOrDefault()}"); return true; } } \ No newline at end of file diff --git a/UdpHosts/GameServer/Systems/Aptitude/Commands/Target/Todo/TargetByEffectCommand.cs b/UdpHosts/GameServer/Systems/Aptitude/Commands/Target/Todo/TargetByEffectCommand.cs deleted file mode 100644 index 376b1d0..0000000 --- a/UdpHosts/GameServer/Systems/Aptitude/Commands/Target/Todo/TargetByEffectCommand.cs +++ /dev/null @@ -1,57 +0,0 @@ -using GameServer.Data.SDB.Records.aptfs; - -namespace GameServer.Aptitude; - -public class TargetByEffectCommand : Command, ICommand -{ - private TargetByEffectCommandDef Params; - - public TargetByEffectCommand(TargetByEffectCommandDef par) -: base(par) - { - Params = par; - } - - public bool Execute(Context context) - { - var result = false; - var previousTargets = context.Targets; - var newTargets = new AptitudeTargets(); - - foreach (IAptitudeTarget target in previousTargets) - { - foreach (EffectState active in target.GetActiveEffects()) - { - if (active == null) - { - continue; - } - - if (Params.EffectId == active.Effect.Id && active.Stacks >= Params.StackCount) - { - newTargets.Push(target); - break; - } - } - } - - context.FormerTargets = previousTargets; - context.Targets = newTargets; - - if (Params.FailNoTargets == 1 && context.Targets.Count == 0) - { - result = false; - } - else - { - result = true; - } - - if (Params.Negate == 1) - { - result = !result; - } - - return result; - } -} \ No newline at end of file diff --git a/UdpHosts/GameServer/Systems/Aptitude/Commands/Target/Todo/TargetByHealthCommand.cs b/UdpHosts/GameServer/Systems/Aptitude/Commands/Target/Todo/TargetByHealthCommand.cs deleted file mode 100644 index c8211a8..0000000 --- a/UdpHosts/GameServer/Systems/Aptitude/Commands/Target/Todo/TargetByHealthCommand.cs +++ /dev/null @@ -1,19 +0,0 @@ -using GameServer.Data.SDB.Records.aptfs; - -namespace GameServer.Aptitude; - -public class TargetByHealthCommand : Command, ICommand -{ - private TargetByHealthCommandDef Params; - - public TargetByHealthCommand(TargetByHealthCommandDef par) -: base(par) - { - Params = par; - } - - public bool Execute(Context context) - { - return true; - } -} \ No newline at end of file diff --git a/UdpHosts/GameServer/Systems/Aptitude/Commands/Target/Todo/TargetByNPCTypeCommand.cs b/UdpHosts/GameServer/Systems/Aptitude/Commands/Target/Todo/TargetByNPCTypeCommand.cs index 2212b14..37376b0 100644 --- a/UdpHosts/GameServer/Systems/Aptitude/Commands/Target/Todo/TargetByNPCTypeCommand.cs +++ b/UdpHosts/GameServer/Systems/Aptitude/Commands/Target/Todo/TargetByNPCTypeCommand.cs @@ -1,4 +1,5 @@ using GameServer.Data.SDB.Records.customdata; +using GameServer.Entities.Character; namespace GameServer.Aptitude; @@ -14,6 +15,27 @@ public TargetByNPCTypeCommand(TargetByNPCTypeCommandDef par) public bool Execute(Context context) { + if (Params.Type == 0) + { + return true; + } + + context.FormerTargets = context.Targets; + context.Targets = new AptitudeTargets(); + + foreach (var target in context.FormerTargets) + { + if (target is not CharacterEntity { IsPlayerControlled: false } npc) + { + continue; + } + + if (npc.Character_ObserverView.NPCTypeProp == Params.Type) + { + context.Targets.Push(npc); + } + } + return true; } } \ No newline at end of file diff --git a/UdpHosts/GameServer/Systems/Aptitude/Commands/Target/Todo/TargetCharacterNPCsCommand.cs b/UdpHosts/GameServer/Systems/Aptitude/Commands/Target/Todo/TargetCharacterNPCsCommand.cs index c94958d..1f9ee53 100644 --- a/UdpHosts/GameServer/Systems/Aptitude/Commands/Target/Todo/TargetCharacterNPCsCommand.cs +++ b/UdpHosts/GameServer/Systems/Aptitude/Commands/Target/Todo/TargetCharacterNPCsCommand.cs @@ -1,4 +1,5 @@ using GameServer.Data.SDB.Records.customdata; +using GameServer.Entities.Character; namespace GameServer.Aptitude; @@ -14,6 +15,18 @@ public TargetCharacterNPCsCommand(TargetCharacterNPCsCommandDef par) public bool Execute(Context context) { + if (context.Self is not CharacterEntity { IsPlayerControlled: true } player) + { + return false; + } + + context.FormerTargets = new AptitudeTargets(context.Targets); + + // foreach (var npc in player.OwnedNPCs) + // { + // context.Targets.Push(npc); + // } + return true; } } \ No newline at end of file diff --git a/UdpHosts/GameServer/Systems/Aptitude/Commands/Target/Todo/TargetFilterByRangeCommand.cs b/UdpHosts/GameServer/Systems/Aptitude/Commands/Target/Todo/TargetFilterByRangeCommand.cs deleted file mode 100644 index 753e252..0000000 --- a/UdpHosts/GameServer/Systems/Aptitude/Commands/Target/Todo/TargetFilterByRangeCommand.cs +++ /dev/null @@ -1,19 +0,0 @@ -using GameServer.Data.SDB.Records.aptfs; - -namespace GameServer.Aptitude; - -public class TargetFilterByRangeCommand : Command, ICommand -{ - private TargetFilterByRangeCommandDef Params; - - public TargetFilterByRangeCommand(TargetFilterByRangeCommandDef par) -: base(par) - { - Params = par; - } - - public bool Execute(Context context) - { - return true; - } -} \ No newline at end of file diff --git a/UdpHosts/GameServer/Systems/Aptitude/Commands/Target/Todo/TargetFriendliesCommand.cs b/UdpHosts/GameServer/Systems/Aptitude/Commands/Target/Todo/TargetFriendliesCommand.cs index 1663218..5a61630 100644 --- a/UdpHosts/GameServer/Systems/Aptitude/Commands/Target/Todo/TargetFriendliesCommand.cs +++ b/UdpHosts/GameServer/Systems/Aptitude/Commands/Target/Todo/TargetFriendliesCommand.cs @@ -1,4 +1,7 @@ using GameServer.Data.SDB.Records.aptfs; +using GameServer.Entities.Deployable; +using GameServer.Entities.Thumper; +using GameServer.Entities.Vehicle; namespace GameServer.Aptitude; @@ -12,27 +15,29 @@ public TargetFriendliesCommand(TargetFriendliesCommandDef par) Params = par; } + // abilities used: 8 public bool Execute(Context context) { - foreach (var target in context.Targets) - { - // todo aptitude: remove non-friendlies - } + // todo aptitude: remove non-friendlies + var previousTargets = context.Targets; + var newTargets = new AptitudeTargets(); - if (Params.IncludeInitiator == 1) + foreach (var target in previousTargets) { - context.Targets.Push(context.Initiator); + if ( + (target == context.Self && Params.IncludeSelf == 0) + || (target == context.Initiator && Params.IncludeInitiator == 0) + || (target == context.Self.Owner && Params.IncludeOwner == 0)) + /* || (target is hostile) */ + { + continue; + } + + context.Targets.Push(target); } - if (Params.IncludeOwner == 1) - { - // todo aptitude: handle owner - } - - if (Params.IncludeSelf == 1) - { - context.Targets.Push(context.Self); - } + context.FormerTargets = previousTargets; + context.Targets = newTargets; if (Params.FailNoTargets == 1 && context.Targets.Count == 0) { diff --git a/UdpHosts/GameServer/Systems/Aptitude/Commands/Target/Todo/TargetInteractivesCommand.cs b/UdpHosts/GameServer/Systems/Aptitude/Commands/Target/Todo/TargetInteractivesCommand.cs deleted file mode 100644 index 860d688..0000000 --- a/UdpHosts/GameServer/Systems/Aptitude/Commands/Target/Todo/TargetInteractivesCommand.cs +++ /dev/null @@ -1,19 +0,0 @@ -using GameServer.Data.SDB.Records.aptfs; - -namespace GameServer.Aptitude; - -public class TargetInteractivesCommand : Command, ICommand -{ - private TargetInteractivesCommandDef Params; - - public TargetInteractivesCommand(TargetInteractivesCommandDef par) -: base(par) - { - Params = par; - } - - public bool Execute(Context context) - { - return true; - } -} \ No newline at end of file diff --git a/UdpHosts/GameServer/Systems/Aptitude/Commands/Target/Todo/TargetPassengersCommand.cs b/UdpHosts/GameServer/Systems/Aptitude/Commands/Target/Todo/TargetPassengersCommand.cs deleted file mode 100644 index ffc462e..0000000 --- a/UdpHosts/GameServer/Systems/Aptitude/Commands/Target/Todo/TargetPassengersCommand.cs +++ /dev/null @@ -1,53 +0,0 @@ -using System; -using GameServer.Data.SDB.Records.aptfs; -using GameServer.Entities.Character; -using GameServer.Entities.Vehicle; - -namespace GameServer.Aptitude; - -public class TargetPassengersCommand : Command, ICommand -{ - private TargetPassengersCommandDef Params; - - public TargetPassengersCommand(TargetPassengersCommandDef par) -: base(par) - { - Params = par; - } - - public bool Execute(Context context) - { - var targets = new AptitudeTargets(); - - foreach (var target in context.Targets) - { - if (target is CharacterEntity character) - { - var isPassenger = character.AttachedToEntity is VehicleEntity vehicle - && vehicle.ControllingPlayer != character.Player; - - // todo aptitude: verify Filter param - if (isPassenger && Params.Filter == 1) - { - continue; - } - - targets.Push(target); - } - else - { - Console.WriteLine("TargetPassengersCommand fails because target is not a Character. If this is happening, we should investigate why."); - } - } - - context.FormerTargets = context.Targets; - context.Targets = targets; - - if (Params.FailNone == 1 && targets.Count == 0) - { - return false; - } - - return true; - } -} \ No newline at end of file diff --git a/UdpHosts/GameServer/Systems/Aptitude/Commands/Unlock/Todo/UnlockBattleframesCommand.cs b/UdpHosts/GameServer/Systems/Aptitude/Commands/Unlock/UnlockBattleframesCommand.cs similarity index 66% rename from UdpHosts/GameServer/Systems/Aptitude/Commands/Unlock/Todo/UnlockBattleframesCommand.cs rename to UdpHosts/GameServer/Systems/Aptitude/Commands/Unlock/UnlockBattleframesCommand.cs index eeb31f4..54c01d6 100644 --- a/UdpHosts/GameServer/Systems/Aptitude/Commands/Unlock/Todo/UnlockBattleframesCommand.cs +++ b/UdpHosts/GameServer/Systems/Aptitude/Commands/Unlock/UnlockBattleframesCommand.cs @@ -1,4 +1,5 @@ using GameServer.Data.SDB.Records.customdata; +using GameServer.Entities.Character; namespace GameServer.Aptitude; @@ -14,6 +15,15 @@ public UnlockBattleframesCommand(UnlockBattleframesCommandDef par) public bool Execute(Context context) { + if (Params.SdbId == 0) + { + return true; + } + + if (context.Self is CharacterEntity character) + { + } + return true; } } \ No newline at end of file diff --git a/UdpHosts/GameServer/Systems/Aptitude/Commands/Unlock/Todo/UnlockTitlesCommand.cs b/UdpHosts/GameServer/Systems/Aptitude/Commands/Unlock/UnlockTitlesCommand.cs similarity index 88% rename from UdpHosts/GameServer/Systems/Aptitude/Commands/Unlock/Todo/UnlockTitlesCommand.cs rename to UdpHosts/GameServer/Systems/Aptitude/Commands/Unlock/UnlockTitlesCommand.cs index ca8d2e4..07609ae 100644 --- a/UdpHosts/GameServer/Systems/Aptitude/Commands/Unlock/Todo/UnlockTitlesCommand.cs +++ b/UdpHosts/GameServer/Systems/Aptitude/Commands/Unlock/UnlockTitlesCommand.cs @@ -14,7 +14,7 @@ public UnlockTitlesCommand(UnlockTitlesCommandDef par) public bool Execute(Context context) { - if (Params.TitleId == null || Params.TitleId == 0) + if (Params.TitleId == 0) { return true; } diff --git a/UdpHosts/GameServer/Systems/Aptitude/Factory.cs b/UdpHosts/GameServer/Systems/Aptitude/Factory.cs index 204d80b..2acef64 100644 --- a/UdpHosts/GameServer/Systems/Aptitude/Factory.cs +++ b/UdpHosts/GameServer/Systems/Aptitude/Factory.cs @@ -108,8 +108,8 @@ public ICommand LoadCommand(uint commandId, uint typeId) return new ImpactRemoveEffectCommand(CustomDBInterface.GetImpactRemoveEffectCommandDef(commandId)); // case CommandType.TimedActivation: // return new TimedActivationCommand(SDBInterface.GetTimedActivationCommandDef(commandId)); - // case CommandType.TargetByEffect: - // return new TargetByEffectCommand(SDBInterface.GetTargetByEffectCommandDef(commandId)); + case CommandType.TargetByEffect: + return new TargetByEffectCommand(SDBInterface.GetTargetByEffectCommandDef(commandId)); case CommandType.TargetClear: return new TargetClearCommand(SDBInterface.GetTargetClearCommandDef(commandId)); // case CommandType.TargetConeAE: @@ -136,8 +136,8 @@ public ICommand LoadCommand(uint commandId, uint typeId) return new BeginInteractionCommand(commandId); case CommandType.EndInteraction: return new EndInteractionCommand(commandId); - // case CommandType.TargetInteractives: - // return new TargetInteractivesCommand(SDBInterface.GetTargetInteractivesCommandDef(commandId)); + case CommandType.TargetInteractives: + return new TargetInteractivesCommand(SDBInterface.GetTargetInteractivesCommandDef(commandId)); // case CommandType.ImpactMarkInteractives: // return new ImpactMarkInteractivesCommand(SDBInterface.GetImpactMarkInteractivesCommandDef(commandId)); case CommandType.TargetPrevious: @@ -148,8 +148,8 @@ public ICommand LoadCommand(uint commandId, uint typeId) // return new InflictDamageCommand(SDBInterface.GetInflictDamageCommandDef(commandId)); // case CommandType.CreateAbilityObject: // return new CreateAbilityObjectCommand(CustomDBInterface.GetCreateAbilityObjectCommandDef(commandId)); - // case CommandType.DestroyAbilityObject: - // return new DestroyAbilityObjectCommand(CustomDBInterface.GetDestroyAbilityObjectCommandDef(commandId)); + case CommandType.DestroyAbilityObject: + return new DestroyAbilityObjectCommand(CustomDBInterface.GetDestroyAbilityObjectCommandDef(commandId)); // case CommandType.SetPosition: // Zero instances in BaseCommandDef // case CommandType.SetOrientation: @@ -214,8 +214,8 @@ public ICommand LoadCommand(uint commandId, uint typeId) // return new CancelRopePullCommand(CustomDBInterface.GetCancelRopePullCommandDef(commandId)); case CommandType.RequestBattleFrameList: return new RequestBattleFrameListCommand(SDBInterface.GetRequestBattleFrameList(commandId)); - // case CommandType.NPCSpawn: - // return new NPCSpawnCommand(CustomDBInterface.GetNPCSpawnCommandDef(commandId)); + case CommandType.NPCSpawn: + return new NPCSpawnCommand(CustomDBInterface.GetNPCSpawnCommandDef(commandId)); // case CommandType.ApplyImpulse: // return new ApplyImpulseCommand(SDBInterface.GetApplyImpulseCommandDef(commandId)); case CommandType.DeployableSpawn: @@ -236,8 +236,8 @@ public ICommand LoadCommand(uint commandId, uint typeId) // return new ConsumeEnergyCommand(SDBInterface.GetConsumeEnergyCommandDef(commandId)); // case CommandType.TargetClassType: // return new TargetClassTypeCommand(SDBInterface.GetTargetClassTypeCommandDef(commandId)); - // case CommandType.TargetDifference: - // return new TargetDifferenceCommand(SDBInterface.GetTargetDifferenceCommandDef(commandId)); + case CommandType.TargetDifference: + return new TargetDifferenceCommand(SDBInterface.GetTargetDifferenceCommandDef(commandId)); case CommandType.ConditionalBranch: return new ConditionalBranchCommand(SDBInterface.GetConditionalBranchCommandDef(commandId)); case CommandType.LogicOr: @@ -276,8 +276,8 @@ public ICommand LoadCommand(uint commandId, uint typeId) // return new CopyInitiationPositionCommand(SDBInterface.GetCopyInitiationPositionCommandDef(commandId)); // case CommandType.RequireLevel: // return new RequireLevelCommand(SDBInterface.GetRequireLevelCommandDef(commandId)); - // case CommandType.RequireJumped: - // return new RequireJumpedCommand(SDBInterface.GetRequireJumpedCommandDef(commandId)); + case CommandType.RequireJumped: + return new RequireJumpedCommand(SDBInterface.GetRequireJumpedCommandDef(commandId)); // case CommandType.RequireProjectileSlope: // return new RequireProjectileSlopeCommand(SDBInterface.GetRequireProjectileSlopeCommandDef(commandId)); // case CommandType.CreateSpawnPoint: @@ -292,8 +292,8 @@ public ICommand LoadCommand(uint commandId, uint typeId) // return new SlotAmmoCommand(SDBInterface.GetSlotAmmoCommandDef(commandId)); // case CommandType.AddPhysics: // return new AddPhysicsCommand(SDBInterface.GetAddPhysicsCommandDef(commandId)); - // case CommandType.RequireReload: - // return new RequireReloadCommand(SDBInterface.GetRequireReloadCommandDef(commandId)); + case CommandType.RequireReload: + return new RequireReloadCommand(SDBInterface.GetRequireReloadCommandDef(commandId)); // case CommandType.TargetByExists: // return new TargetByExistsCommand(CustomDBInterface.GetTargetByExistsCommandDef(commandId)); case CommandType.InteractionType: @@ -322,8 +322,8 @@ public ICommand LoadCommand(uint commandId, uint typeId) // return new ModifyOwnerResourcesCommand(CustomDBInterface.GetModifyOwnerResourcesCommandDef(commandId)); case CommandType.ModifyPermission: return new ModifyPermissionCommand(CustomDBInterface.GetModifyPermissionCommandDef(commandId)); - // case CommandType.RequirePermission: - // return new RequirePermissionCommand(SDBInterface.GetRequirePermissionCommandDef(commandId)); + case CommandType.RequirePermission: + return new RequirePermissionCommand(SDBInterface.GetRequirePermissionCommandDef(commandId)); // case CommandType.TargetPassengers: // return new TargetPassengersCommand(SDBInterface.GetTargetPassengersCommandDef(commandId)); // case CommandType.TargetSquadmates: @@ -354,8 +354,8 @@ public ICommand LoadCommand(uint commandId, uint typeId) return new ImpactToggleEffectCommand(SDBInterface.GetImpactToggleEffectCommandDef(commandId)); case CommandType.DeployableCalldown: return new DeployableCalldownCommand(SDBInterface.GetDeployableCalldownCommandDef(commandId)); - // case CommandType.TurretControl: - // return new TurretControlCommand(CustomDBInterface.GetTurretControlCommandDef(commandId)); + case CommandType.TurretControl: + return new TurretControlCommand(CustomDBInterface.GetTurretControlCommandDef(commandId)); // case CommandType.Bombardment: // return new BombardmentCommand(SDBInterface.GetBombardmentCommandDef(commandId)); // case CommandType.RequireResource: @@ -393,8 +393,8 @@ public ICommand LoadCommand(uint commandId, uint typeId) // return new SpawnLootCommand(CustomDBInterface.GetSpawnLootCommandDef(commandId)); // case CommandType.AbilitySlotted: // return new AbilitySlottedCommand(CustomDBInterface.GetAbilitySlottedCommandDef(commandId)); - // case CommandType.LoadRegisterFromResource: - // return new LoadRegisterFromResourceCommand(SDBInterface.GetLoadRegisterFromResourceCommandDef(commandId)); + case CommandType.LoadRegisterFromResource: + return new LoadRegisterFromResourceCommand(SDBInterface.GetLoadRegisterFromResourceCommandDef(commandId)); // case CommandType.SetLookAtTarget: // return new SetLookAtTargetCommand(CustomDBInterface.GetSetLookAtTargetCommandDef(commandId)); case CommandType.EncounterSpawn: @@ -429,8 +429,8 @@ public ICommand LoadCommand(uint commandId, uint typeId) // return new DeployableUpgradeCommand(CustomDBInterface.GetDeployableUpgradeCommandDef(commandId)); // case CommandType.NPCEquipMonster: // return new NPCEquipMonsterCommand(CustomDBInterface.GetNPCEquipMonsterCommandDef(commandId)); - // case CommandType.RequireArmy: - // return new RequireArmyCommand(SDBInterface.GetRequireArmyCommandDef(commandId)); + case CommandType.RequireArmy: + return new RequireArmyCommand(SDBInterface.GetRequireArmyCommandDef(commandId)); // case CommandType.SetHostility: // return new SetHostilityCommand(CustomDBInterface.GetSetHostilityCommandDef(commandId)); // case CommandType.Teleport: @@ -484,8 +484,8 @@ public ICommand LoadCommand(uint commandId, uint typeId) return new RegisterRandomCommand(SDBInterface.GetRegisterRandomCommandDef(commandId)); case CommandType.SetGliderParametersDef: return new SetGliderParametersCommand(CustomDBInterface.GetSetGliderParametersCommandDef(commandId)); - // case CommandType.SetHoverParametersDef: - // return new SetHoverParametersCommand(CustomDBInterface.GetSetHoverParametersCommandDef(commandId)); + case CommandType.SetHoverParametersDef: + return new SetHoverParametersCommand(CustomDBInterface.GetSetHoverParametersCommandDef(commandId)); // case CommandType.SetVisualInfoIndex: // return new SetVisualInfoIndexCommand(CustomDBInterface.GetSetVisualInfoIndexCommandDef(commandId)); // case CommandType.UiNamedVariable: @@ -496,8 +496,8 @@ public ICommand LoadCommand(uint commandId, uint typeId) return new VehicleCalldownCommand(SDBInterface.GetVehicleCalldownCommandDef(commandId)); case CommandType.EncounterSignal: return new EncounterSignalCommand(CustomDBInterface.GetEncounterSignalCommandDef(commandId)); - // case CommandType.RequireNeedsAmmo: - // return new RequireNeedsAmmoCommand(SDBInterface.GetRequireNeedsAmmoCommandDef(commandId)); + case CommandType.RequireNeedsAmmo: + return new RequireNeedsAmmoCommand(SDBInterface.GetRequireNeedsAmmoCommandDef(commandId)); // case CommandType.TargetByNPCType: // return new TargetByNPCTypeCommand(CustomDBInterface.GetTargetByNPCTypeCommandDef(commandId)); case CommandType.LoadRegisterFromItemStat: @@ -548,8 +548,8 @@ public ICommand LoadCommand(uint commandId, uint typeId) // return new EquipLoadoutCommand(CustomDBInterface.GetEquipLoadoutCommandDef(commandId)); case CommandType.RequireHasEffectTag: return new RequireHasEffectTagCommand(SDBInterface.GetRequireHasEffectTagCommandDef(commandId)); - // case CommandType.TargetByEffectTag: - // return new TargetByEffectTagCommand(SDBInterface.GetTargetByEffectTagCommandDef(commandId)); + case CommandType.TargetByEffectTag: + return new TargetByEffectTagCommand(SDBInterface.GetTargetByEffectTagCommandDef(commandId)); // case CommandType.RemoveEffectByTag: // return new RemoveEffectByTagCommand(CustomDBInterface.GetRemoveEffectByTagCommandDef(commandId)); // case CommandType.RegisterEffectTagTrigger: @@ -558,14 +558,14 @@ public ICommand LoadCommand(uint commandId, uint typeId) // return new ReplenishableDurationCommand(CustomDBInterface.GetReplenishableDurationCommandDef(commandId)); // case CommandType.ReplenishEffectDuration: // return new ReplenishEffectDurationCommand(CustomDBInterface.GetReplenishEffectDurationCommandDef(commandId)); - // case CommandType.ConsumeSuperCharge: - // return new ConsumeSuperChargeCommand(SDBInterface.GetConsumeSuperChargeCommandDef(commandId)); + case CommandType.ConsumeSuperCharge: + return new ConsumeSuperChargeCommand(SDBInterface.GetConsumeSuperChargeCommandDef(commandId)); // case CommandType.RequireSuperCharge: // return new RequireSuperChargeCommand(SDBInterface.GetRequireSuperChargeCommandDef(commandId)); // case CommandType.ActivateAbilityTrigger: // return new ActivateAbilityTriggerCommand(CustomDBInterface.GetActivateAbilityTriggerCommandDef(commandId)); - // case CommandType.TargetByHealth: - // return new TargetByHealthCommand(SDBInterface.GetTargetByHealthCommandDef(commandId)); + case CommandType.TargetByHealth: + return new TargetByHealthCommand(SDBInterface.GetTargetByHealthCommandDef(commandId)); // case CommandType.RegisterHitTagTypeTrigger: // return new RegisterHitTagTypeTriggerCommand(CustomDBInterface.GetRegisterHitTagTypeTriggerCommandDef(commandId)); case CommandType.LogicOrChain: @@ -578,8 +578,8 @@ public ICommand LoadCommand(uint commandId, uint typeId) return new AuthorizeTerminalCommand(CustomDBInterface.GetAuthorizeTerminalCommandDef(commandId)); // case CommandType.TemporaryEquipmentStatMapping: // return new TemporaryEquipmentStatMappingCommand(CustomDBInterface.GetTemporaryEquipmentStatMappingCommandDef(commandId)); - // case CommandType.LoadRegisterFromLevel: - // return new LoadRegisterFromLevelCommand(SDBInterface.GetLoadRegisterFromLevelCommandDef(commandId)); + case CommandType.LoadRegisterFromLevel: + return new LoadRegisterFromLevelCommand(SDBInterface.GetLoadRegisterFromLevelCommandDef(commandId)); // case CommandType.UnlockCerts: // return new UnlockCertsCommand(CustomDBInterface.GetUnlockCertsCommandDef(commandId)); // case CommandType.UnlockPatterns: @@ -642,8 +642,8 @@ public ICommand LoadCommand(uint commandId, uint typeId) // return new ModifyDamageByTargetDamageResponseCommand(CustomDBInterface.GetModifyDamageByTargetDamageResponseCommandDef(commandId)); // case CommandType.AddAccountGroup: // return new AddAccountGroupCommand(CustomDBInterface.GetAddAccountGroupCommandDef(commandId)); - // case CommandType.RequireInitiatorExists: - // return new RequireInitiatorExistsCommand(CustomDBInterface.GetRequireInitiatorExistsCommandDef(commandId)); + case CommandType.RequireInitiatorExists: + return new RequireInitiatorExistsCommand(CustomDBInterface.GetRequireInitiatorExistsCommandDef(commandId)); // case CommandType.RegisterTimedTrigger: // return new RegisterTimedTriggerCommand(CustomDBInterface.GetRegisterTimedTriggerCommandDef(commandId)); // case CommandType.Taunt: @@ -668,18 +668,18 @@ public ICommand LoadCommand(uint commandId, uint typeId) // return new RequireInCombatCommand(SDBInterface.GetRequireInCombatCommandDef(commandId)); // case CommandType.RequireHasItem: // return new RequireHasItemCommand(SDBInterface.GetRequireHasItemCommandDef(commandId)); - // case CommandType.MountVehicle: - // return new MountVehicleCommand(CustomDBInterface.GetMountVehicleCommandDef(commandId)); - // case CommandType.RequireIsNPC: - // return new RequireIsNPCCommand(SDBInterface.GetRequireIsNPCCommandDef(commandId)); + case CommandType.MountVehicle: + return new MountVehicleCommand(CustomDBInterface.GetMountVehicleCommandDef(commandId)); + case CommandType.RequireIsNPC: + return new RequireIsNPCCommand(SDBInterface.GetRequireIsNPCCommandDef(commandId)); // case CommandType.TargetAiTarget: // return new TargetAiTargetCommand(CustomDBInterface.GetTargetAiTargetCommandDef(commandId)); // case CommandType.ModifyDamageForInflict: // return new ModifyDamageForInflictCommand(CustomDBInterface.GetModifyDamageForInflictCommandDef(commandId)); // case CommandType.ApplyAmmoRider: // return new ApplyAmmoRiderCommand(SDBInterface.GetApplyAmmoRiderCommandDef(commandId)); - // case CommandType.TargetFilterByRange: - // return new TargetFilterByRangeCommand(SDBInterface.GetTargetFilterByRangeCommandDef(commandId)); + case CommandType.TargetFilterByRange: + return new TargetFilterByRangeCommand(SDBInterface.GetTargetFilterByRangeCommandDef(commandId)); // case CommandType.OverrideCollision: // return new OverrideCollisionCommand(SDBInterface.GetOverrideCollisionCommandDef(commandId)); // case CommandType.RequireHasUnlock: @@ -700,12 +700,12 @@ public ICommand LoadCommand(uint commandId, uint typeId) // return new AddFactionReputationCommand(CustomDBInterface.GetAddFactionReputationCommandDef(commandId)); // case CommandType.MovementFacing: // return new MovementFacingCommand(SDBInterface.GetMovementFacingCommandDef(commandId)); - // case CommandType.RequireFriends: - // return new RequireFriendsCommand(SDBInterface.GetRequireFriendsCommandDef(commandId)); + case CommandType.RequireFriends: + return new RequireFriendsCommand(SDBInterface.GetRequireFriendsCommandDef(commandId)); // case CommandType.TargetFilterBySinAcquired: // return new TargetFilterBySinAcquiredCommand(SDBInterface.GetTargetFilterBySinAcquiredCommandDef(commandId)); - // case CommandType.RequireMovementFlags: - // return new RequireMovementFlagsCommand(SDBInterface.GetRequireMovementFlagsCommandDef(commandId)); + case CommandType.RequireMovementFlags: + return new RequireMovementFlagsCommand(SDBInterface.GetRequireMovementFlagsCommandDef(commandId)); // case CommandType.ItemAttributeModifier: // return new ItemAttributeModifierCommand(CustomDBInterface.GetItemAttributeModifierCommandDef(commandId)); // case CommandType.MovementTether: