From 366edbcb36e44b827abdef1025dee09446ed2a8b Mon Sep 17 00:00:00 2001 From: Taurenkey Date: Wed, 13 Nov 2024 06:49:31 +0000 Subject: [PATCH] API 11 --- ECommons | 2 +- .../Attributes/CustomComboInfoAttribute.cs | 10 +++--- .../Attributes/ReplaceSkillAttribute.cs | 2 +- XIVSlothCombo/Combos/JobHelpers/AST.cs | 19 +++++------ XIVSlothCombo/Combos/JobHelpers/NIN.cs | 2 -- XIVSlothCombo/Combos/JobHelpers/PCT.cs | 5 --- XIVSlothCombo/Combos/PvE/ALL.cs | 6 ++-- XIVSlothCombo/Combos/PvE/AST.cs | 1 - XIVSlothCombo/Combos/PvE/BLM.cs | 1 - XIVSlothCombo/Combos/PvE/BRD.cs | 1 - XIVSlothCombo/Combos/PvE/DNC.cs | 1 - XIVSlothCombo/Combos/PvE/DRK.cs | 1 - XIVSlothCombo/Combos/PvE/NIN.cs | 6 ++-- XIVSlothCombo/Combos/PvE/RDM.cs | 1 - XIVSlothCombo/Combos/PvE/SGE.cs | 1 - XIVSlothCombo/Combos/PvE/WAR.cs | 1 - XIVSlothCombo/Combos/PvE/WHM.cs | 2 ++ XIVSlothCombo/Combos/PvP/GNBPVP.cs | 3 +- XIVSlothCombo/Core/IconReplacer.cs | 10 +++--- XIVSlothCombo/Core/PluginAddressResolver.cs | 6 ++-- XIVSlothCombo/CustomCombo/CustomCombo.cs | 2 +- XIVSlothCombo/CustomCombo/Functions/Action.cs | 2 +- .../CustomCombo/Functions/PlayerCharacter.cs | 4 +-- XIVSlothCombo/CustomCombo/Functions/Status.cs | 1 - XIVSlothCombo/CustomCombo/Functions/Target.cs | 4 ++- XIVSlothCombo/Data/ActionWatching.cs | 26 +++++++-------- XIVSlothCombo/Window/Functions/Presets.cs | 2 -- XIVSlothCombo/Window/Tabs/Debug.cs | 33 +++++++++---------- XIVSlothCombo/XIVSlothCombo.cs | 21 ++++++------ XIVSlothCombo/XIVSlothCombo.csproj | 2 +- XIVSlothCombo/XIVSlothCombo.json | 2 +- 31 files changed, 80 insertions(+), 100 deletions(-) diff --git a/ECommons b/ECommons index d77c9db19..0e0cc76e4 160000 --- a/ECommons +++ b/ECommons @@ -1 +1 @@ -Subproject commit d77c9db195056fca9e855c7d142bc6cd8566258f +Subproject commit 0e0cc76e4197e28b2576502f8a059815ce0a3aa4 diff --git a/XIVSlothCombo/Attributes/CustomComboInfoAttribute.cs b/XIVSlothCombo/Attributes/CustomComboInfoAttribute.cs index 8ab5928a3..a282bffe6 100644 --- a/XIVSlothCombo/Attributes/CustomComboInfoAttribute.cs +++ b/XIVSlothCombo/Attributes/CustomComboInfoAttribute.cs @@ -1,5 +1,5 @@ using ECommons.DalamudServices; -using Lumina.Excel.GeneratedSheets; +using Lumina.Excel.Sheets; using System; using System.Collections.Generic; using System.Globalization; @@ -61,7 +61,7 @@ private static int JobIDToRole(byte jobID) private static uint JobIDToClassJobCategory(byte jobID) { if (Svc.Data.GetExcelSheet().HasRow(jobID)) - return Svc.Data.GetExcelSheet().GetRow(jobID).ClassJobCategory.Row; + return Svc.Data.GetExcelSheet().GetRow(jobID).ClassJobCategory.RowId; return 0; } @@ -84,7 +84,7 @@ private static string JobIDToShorthand(byte key) if (ClassJobs.TryGetValue(key, out var job)) { - return job.Abbreviation.RawString; + return job.Abbreviation.ToString(); } else { @@ -102,10 +102,10 @@ public static string JobIDToName(byte key) //Override DOH/DOL if (key is DOH.JobID) key = 08; //Set to Carpenter if (key is DOL.JobID) key = 16; //Set to Miner - if (ClassJobs.TryGetValue(key, out ClassJob? job)) + if (ClassJobs.TryGetValue(key, out ClassJob job)) { //Grab Category name for DOH/DOL, else the normal Name for the rest - string jobname = key is 08 or 16 ? job.ClassJobCategory.Value.Name : job.Name; + string jobname = key is 08 or 16 ? job.ClassJobCategory.Value.Name.ToString() : job.Name.ToString(); //Job names are all lowercase by default. This capitalizes based on regional rules string cultureID = Svc.ClientState.ClientLanguage switch { diff --git a/XIVSlothCombo/Attributes/ReplaceSkillAttribute.cs b/XIVSlothCombo/Attributes/ReplaceSkillAttribute.cs index d81d2b3cc..d7bf95773 100644 --- a/XIVSlothCombo/Attributes/ReplaceSkillAttribute.cs +++ b/XIVSlothCombo/Attributes/ReplaceSkillAttribute.cs @@ -14,7 +14,7 @@ internal ReplaceSkillAttribute(params uint[] actionIDs) { foreach (uint id in actionIDs) { - if (ActionWatching.ActionSheet.TryGetValue(id, out var action) && action != null) + if (ActionWatching.ActionSheet.TryGetValue(id, out var action)) { ActionNames.Add($"{action.Name}"); ActionIcons.Add(action.Icon); diff --git a/XIVSlothCombo/Combos/JobHelpers/AST.cs b/XIVSlothCombo/Combos/JobHelpers/AST.cs index d5b7ea2b8..c4c3a2e9b 100644 --- a/XIVSlothCombo/Combos/JobHelpers/AST.cs +++ b/XIVSlothCombo/Combos/JobHelpers/AST.cs @@ -1,9 +1,8 @@ - using Dalamud.Game.ClientState.JobGauge.Enums; +using Dalamud.Game.ClientState.JobGauge.Enums; using Dalamud.Game.ClientState.Objects.Types; using Dalamud.Plugin.Services; using ECommons.DalamudServices; using ECommons.GameFunctions; -using ECommons.ExcelServices; using System.Collections.Generic; using System.Linq; using XIVSlothCombo.CustomComboNS.Functions; @@ -21,7 +20,7 @@ internal static void Init() private static void CheckCards(IFramework framework) { - if (Svc.ClientState.LocalPlayer is null || Svc.ClientState.LocalPlayer.ClassJob.Id != 33) + if (Svc.ClientState.LocalPlayer is null || Svc.ClientState.LocalPlayer.ClassJob.RowId != 33) return; if (Svc.Condition[Dalamud.Game.ClientState.Conditions.ConditionFlag.BetweenAreas] || Svc.Condition[Dalamud.Game.ClientState.Conditions.ConditionFlag.Unconscious]) @@ -55,8 +54,8 @@ private static bool BetterTargetAvailable() return true; var m = AST_QuickTargetCards.SelectedRandomMember as IBattleChara; - if ((DrawnCard is CardType.BALANCE && CustomComboFunctions.JobIDs.Melee.Any(x => x == m.ClassJob.Id)) || - (DrawnCard is CardType.SPEAR && CustomComboFunctions.JobIDs.Ranged.Any(x => x == m.ClassJob.Id))) + if ((DrawnCard is CardType.BALANCE && CustomComboFunctions.JobIDs.Melee.Any(x => x == m.ClassJob.RowId)) || + (DrawnCard is CardType.SPEAR && CustomComboFunctions.JobIDs.Ranged.Any(x => x == m.ClassJob.RowId))) return false; var targets = new List(); @@ -80,8 +79,8 @@ private static bool BetterTargetAvailable() } if (targets.Count == 0) return false; - if ((DrawnCard is CardType.BALANCE && targets.Any(x => CustomComboFunctions.JobIDs.Melee.Any(y => y == x.ClassJob.Id))) || - (DrawnCard is CardType.SPEAR && targets.Any(x => CustomComboFunctions.JobIDs.Ranged.Any(y => y == x.ClassJob.Id)))) + if ((DrawnCard is CardType.BALANCE && targets.Any(x => CustomComboFunctions.JobIDs.Melee.Any(y => y == x.ClassJob.RowId))) || + (DrawnCard is CardType.SPEAR && targets.Any(x => CustomComboFunctions.JobIDs.Ranged.Any(y => y == x.ClassJob.RowId)))) { AST_QuickTargetCards.SelectedRandomMember = null; return true; @@ -172,7 +171,7 @@ private static bool SetTarget() //Give card to DPS first for (int i = 0; i <= PartyTargets.Count - 1; i++) { - byte job = PartyTargets[i] is IBattleChara ? (byte)(PartyTargets[i] as IBattleChara).ClassJob.Id : (byte)0; + byte job = PartyTargets[i] is IBattleChara ? (byte)(PartyTargets[i] as IBattleChara).ClassJob.RowId : (byte)0; if (((cardDrawn is CardType.BALANCE) && JobIDs.Melee.Contains(job)) || ((cardDrawn is CardType.SPEAR) && JobIDs.Ranged.Contains(job))) { @@ -184,7 +183,7 @@ private static bool SetTarget() //Give card to unsuitable DPS next for (int i = 0; i <= PartyTargets.Count - 1; i++) { - byte job = PartyTargets[i] is IBattleChara ? (byte)(PartyTargets[i] as IBattleChara).ClassJob.Id : (byte)0; + byte job = PartyTargets[i] is IBattleChara ? (byte)(PartyTargets[i] as IBattleChara).ClassJob.RowId : (byte)0; if (((cardDrawn is CardType.BALANCE) && JobIDs.Ranged.Contains(job)) || ((cardDrawn is CardType.SPEAR) && JobIDs.Melee.Contains(job))) { @@ -199,7 +198,7 @@ private static bool SetTarget() { for (int i = 0; i <= PartyTargets.Count - 1; i++) { - byte job = PartyTargets[i] is IBattleChara ? (byte)(PartyTargets[i] as IBattleChara).ClassJob.Id : (byte)0; + byte job = PartyTargets[i] is IBattleChara ? (byte)(PartyTargets[i] as IBattleChara).ClassJob.RowId : (byte)0; if ((cardDrawn is CardType.BALANCE && JobIDs.Tank.Contains(job)) || (cardDrawn is CardType.SPEAR && JobIDs.Healer.Contains(job))) { diff --git a/XIVSlothCombo/Combos/JobHelpers/NIN.cs b/XIVSlothCombo/Combos/JobHelpers/NIN.cs index e1e4485c9..9af849a29 100644 --- a/XIVSlothCombo/Combos/JobHelpers/NIN.cs +++ b/XIVSlothCombo/Combos/JobHelpers/NIN.cs @@ -1,10 +1,8 @@ using Dalamud.Game.ClientState.Conditions; using Dalamud.Game.ClientState.JobGauge.Types; using ECommons.DalamudServices; -using System; using XIVSlothCombo.Combos.JobHelpers.Enums; using XIVSlothCombo.CustomComboNS.Functions; -using XIVSlothCombo.Data; using XIVSlothCombo.Extensions; namespace XIVSlothCombo.Combos.JobHelpers diff --git a/XIVSlothCombo/Combos/JobHelpers/PCT.cs b/XIVSlothCombo/Combos/JobHelpers/PCT.cs index e7761ca6f..0b6acf33f 100644 --- a/XIVSlothCombo/Combos/JobHelpers/PCT.cs +++ b/XIVSlothCombo/Combos/JobHelpers/PCT.cs @@ -1,10 +1,5 @@ using Dalamud.Game.ClientState.JobGauge.Types; using ECommons.DalamudServices; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; using XIVSlothCombo.Combos.JobHelpers.Enums; using XIVSlothCombo.Combos.PvE; using XIVSlothCombo.CustomComboNS.Functions; diff --git a/XIVSlothCombo/Combos/PvE/ALL.cs b/XIVSlothCombo/Combos/PvE/ALL.cs index f6d049e16..1ba1d8e99 100644 --- a/XIVSlothCombo/Combos/PvE/ALL.cs +++ b/XIVSlothCombo/Combos/PvE/ALL.cs @@ -134,7 +134,7 @@ internal class ALL_Healer_Raise : CustomCombo protected override uint Invoke(uint actionID, uint lastComboMove, float comboTime, byte level) { if ((actionID is WHM.Raise or AST.Ascend or SGE.Egeiro) - || (actionID is SCH.Resurrection && LocalPlayer.ClassJob.Id is SCH.JobID)) + || (actionID is SCH.Resurrection && LocalPlayer.ClassJob.Value.RowId is SCH.JobID)) { if (ActionReady(Swiftcast)) return Swiftcast; @@ -173,13 +173,13 @@ internal class ALL_Caster_Raise : CustomCombo protected override uint Invoke(uint actionID, uint lastComboMove, float comboTime, byte level) { if ((actionID is BLU.AngelWhisper or RDM.Verraise) - || (actionID is SMN.Resurrection && LocalPlayer.ClassJob.Id is SMN.JobID)) + || (actionID is SMN.Resurrection && LocalPlayer.ClassJob.RowId is SMN.JobID)) { if (HasEffect(Buffs.Swiftcast) || HasEffect(RDM.Buffs.Dualcast)) return actionID; if (IsOffCooldown(Swiftcast)) return Swiftcast; - if (LocalPlayer.ClassJob.Id is RDM.JobID && + if (LocalPlayer.ClassJob.RowId is RDM.JobID && ActionReady(RDM.Vercure)) return RDM.Vercure; } diff --git a/XIVSlothCombo/Combos/PvE/AST.cs b/XIVSlothCombo/Combos/PvE/AST.cs index 387e5e0eb..f2d0991d5 100644 --- a/XIVSlothCombo/Combos/PvE/AST.cs +++ b/XIVSlothCombo/Combos/PvE/AST.cs @@ -2,7 +2,6 @@ using Dalamud.Game.ClientState.JobGauge.Types; using Dalamud.Game.ClientState.Objects.Types; using Dalamud.Game.ClientState.Statuses; -using System.Collections; using System.Collections.Generic; using System.Linq; using XIVSlothCombo.Combos.PvE.Content; diff --git a/XIVSlothCombo/Combos/PvE/BLM.cs b/XIVSlothCombo/Combos/PvE/BLM.cs index 11a120d4d..6ca66bd9e 100644 --- a/XIVSlothCombo/Combos/PvE/BLM.cs +++ b/XIVSlothCombo/Combos/PvE/BLM.cs @@ -1,5 +1,4 @@ using Dalamud.Game.ClientState.JobGauge.Types; -using ECommons.DalamudServices; using System; using System.Collections.Generic; using XIVSlothCombo.Combos.JobHelpers; diff --git a/XIVSlothCombo/Combos/PvE/BRD.cs b/XIVSlothCombo/Combos/PvE/BRD.cs index 90dc03f51..fd27a225b 100644 --- a/XIVSlothCombo/Combos/PvE/BRD.cs +++ b/XIVSlothCombo/Combos/PvE/BRD.cs @@ -2,7 +2,6 @@ using Dalamud.Game.ClientState.JobGauge.Types; using Dalamud.Game.ClientState.Statuses; using System; -using System.ComponentModel.Design; using XIVSlothCombo.Combos.PvE.Content; using XIVSlothCombo.Core; using XIVSlothCombo.CustomComboNS; diff --git a/XIVSlothCombo/Combos/PvE/DNC.cs b/XIVSlothCombo/Combos/PvE/DNC.cs index e1b513b2a..4ff1da3b8 100644 --- a/XIVSlothCombo/Combos/PvE/DNC.cs +++ b/XIVSlothCombo/Combos/PvE/DNC.cs @@ -1,6 +1,5 @@ using Dalamud.Game.ClientState.JobGauge.Types; using XIVSlothCombo.Combos.PvE.Content; -using XIVSlothCombo.Core; using XIVSlothCombo.CustomComboNS; using XIVSlothCombo.CustomComboNS.Functions; using XIVSlothCombo.Services; diff --git a/XIVSlothCombo/Combos/PvE/DRK.cs b/XIVSlothCombo/Combos/PvE/DRK.cs index d3d2e29ea..eff77a9a3 100644 --- a/XIVSlothCombo/Combos/PvE/DRK.cs +++ b/XIVSlothCombo/Combos/PvE/DRK.cs @@ -1,6 +1,5 @@ using Dalamud.Game.ClientState.JobGauge.Types; using XIVSlothCombo.Combos.PvE.Content; -using XIVSlothCombo.Core; using XIVSlothCombo.CustomComboNS; using XIVSlothCombo.CustomComboNS.Functions; diff --git a/XIVSlothCombo/Combos/PvE/NIN.cs b/XIVSlothCombo/Combos/PvE/NIN.cs index ec2c6da4a..289dd6c4e 100644 --- a/XIVSlothCombo/Combos/PvE/NIN.cs +++ b/XIVSlothCombo/Combos/PvE/NIN.cs @@ -1,7 +1,5 @@ using Dalamud.Game.ClientState.JobGauge.Types; using Dalamud.Game.ClientState.Statuses; -using ECommons.DalamudServices; -using System; using XIVSlothCombo.Combos.PvE.Content; using XIVSlothCombo.Core; using XIVSlothCombo.CustomComboNS; @@ -215,7 +213,7 @@ protected override uint Invoke(uint actionID, uint lastComboMove, float comboTim (IsNotEnabled(CustomComboPreset.NIN_ST_AdvancedMode_Mug) || (IsEnabled(CustomComboPreset.NIN_ST_AdvancedMode_Mug) && IsOnCooldown(Mug)))) mudraState.CurrentMudra = MudraCasting.MudraState.CastingHyoshoRanryu; - if (NINHelper.InMudra) + if (NINHelper.InMudra || mudraState.CurrentMudra != MudraCasting.MudraState.None) { if (mudraState.ContinueCurrentMudra(ref actionID)) return actionID; @@ -488,7 +486,7 @@ protected override uint Invoke(uint actionID, uint lastComboMove, float comboTim NINGauge? gauge = GetJobGauge(); bool canWeave = CanWeave(GustSlash); bool chargeCheck = IsNotEnabled(CustomComboPreset.NIN_AoE_AdvancedMode_Ninjitsus_ChargeHold) || (IsEnabled(CustomComboPreset.NIN_AoE_AdvancedMode_Ninjitsus_ChargeHold) && GetRemainingCharges(Ten) == 2); - bool inMudraState = HasEffect(Buffs.Mudra); + bool inMudraState = NINHelper.InMudra; int hellfrogPool = GetOptionValue(Config.Ninki_HellfrogPooling); int dotonTimer = GetOptionValue(Config.Advanced_DotonTimer); int dotonThreshold = GetOptionValue(Config.Advanced_DotonHP); diff --git a/XIVSlothCombo/Combos/PvE/RDM.cs b/XIVSlothCombo/Combos/PvE/RDM.cs index 299114148..dee8d701e 100644 --- a/XIVSlothCombo/Combos/PvE/RDM.cs +++ b/XIVSlothCombo/Combos/PvE/RDM.cs @@ -1,5 +1,4 @@ using Dalamud.Game.ClientState.Conditions; -using XIVSlothCombo.Combos.JobHelpers; using XIVSlothCombo.Combos.PvE.Content; using XIVSlothCombo.CustomComboNS; using XIVSlothCombo.CustomComboNS.Functions; diff --git a/XIVSlothCombo/Combos/PvE/SGE.cs b/XIVSlothCombo/Combos/PvE/SGE.cs index 940e03f67..13b5e8e66 100644 --- a/XIVSlothCombo/Combos/PvE/SGE.cs +++ b/XIVSlothCombo/Combos/PvE/SGE.cs @@ -9,7 +9,6 @@ using XIVSlothCombo.CustomComboNS.Functions; using static XIVSlothCombo.Combos.JobHelpers.SGEHelper; using XIVSlothCombo.Data; -using XIVSlothCombo.Combos.JobHelpers; namespace XIVSlothCombo.Combos.PvE { diff --git a/XIVSlothCombo/Combos/PvE/WAR.cs b/XIVSlothCombo/Combos/PvE/WAR.cs index d1eebaf01..0a8f0743f 100644 --- a/XIVSlothCombo/Combos/PvE/WAR.cs +++ b/XIVSlothCombo/Combos/PvE/WAR.cs @@ -1,4 +1,3 @@ -using System; using Dalamud.Game.ClientState.JobGauge.Types; using Dalamud.Game.ClientState.Statuses; using XIVSlothCombo.Combos.PvE.Content; diff --git a/XIVSlothCombo/Combos/PvE/WHM.cs b/XIVSlothCombo/Combos/PvE/WHM.cs index bede66d03..24902c5e7 100644 --- a/XIVSlothCombo/Combos/PvE/WHM.cs +++ b/XIVSlothCombo/Combos/PvE/WHM.cs @@ -1,5 +1,6 @@ using Dalamud.Game.ClientState.JobGauge.Types; using Dalamud.Game.ClientState.Objects.Types; +using ECommons.DalamudServices; using System.Collections.Generic; using System.Linq; using XIVSlothCombo.Combos.PvE.Content; @@ -202,6 +203,7 @@ protected override uint Invoke(uint actionID, uint lastComboMove, float comboTim } else ActionFound = StoneGlareList.Contains(actionID); //default handling + Svc.Log.Debug($"HERE"); if (ActionFound) { WHMGauge? gauge = GetJobGauge(); diff --git a/XIVSlothCombo/Combos/PvP/GNBPVP.cs b/XIVSlothCombo/Combos/PvP/GNBPVP.cs index edd658690..a53c3c99a 100644 --- a/XIVSlothCombo/Combos/PvP/GNBPVP.cs +++ b/XIVSlothCombo/Combos/PvP/GNBPVP.cs @@ -1,5 +1,4 @@ -using System; -using XIVSlothCombo.CustomComboNS; +using XIVSlothCombo.CustomComboNS; using XIVSlothCombo.Data; namespace XIVSlothCombo.Combos.PvP diff --git a/XIVSlothCombo/Core/IconReplacer.cs b/XIVSlothCombo/Core/IconReplacer.cs index 8f0c46496..6ccff82e4 100644 --- a/XIVSlothCombo/Core/IconReplacer.cs +++ b/XIVSlothCombo/Core/IconReplacer.cs @@ -7,6 +7,7 @@ using System.Linq; using System.Reflection; using XIVSlothCombo.CustomComboNS; +using XIVSlothCombo.Extensions; using XIVSlothCombo.Services; namespace XIVSlothCombo.Core @@ -64,8 +65,8 @@ private unsafe uint GetIconDetour(IntPtr actionManager, uint actionID) return OriginalHook(actionID); if (ClassLocked() || - (DisabledJobsPVE.Any(x => x == Svc.ClientState.LocalPlayer.ClassJob.Id) && !Svc.ClientState.IsPvP) || - (DisabledJobsPVP.Any(x => x == Svc.ClientState.LocalPlayer.ClassJob.Id) && Svc.ClientState.IsPvP)) + (DisabledJobsPVE.Any(x => x == Svc.ClientState.LocalPlayer.ClassJob.RowId) && !Svc.ClientState.IsPvP) || + (DisabledJobsPVP.Any(x => x == Svc.ClientState.LocalPlayer.ClassJob.RowId) && Svc.ClientState.IsPvP)) return OriginalHook(actionID); uint lastComboMove = ActionManager.Instance()->Combo.Action; @@ -76,6 +77,7 @@ private unsafe uint GetIconDetour(IntPtr actionManager, uint actionID) { if (combo.TryInvoke(actionID, level, lastComboMove, comboTime, out uint newActionID)) return newActionID; + } return OriginalHook(actionID); @@ -95,14 +97,14 @@ public unsafe static bool ClassLocked() if (Svc.ClientState.LocalPlayer.Level <= 35) return false; - if (Svc.ClientState.LocalPlayer.ClassJob.Id is + if (Svc.ClientState.LocalPlayer.ClassJob.RowId is (>= 8 and <= 25) or 27 or 28 or >= 30) return false; if (!UIState.Instance()->IsUnlockLinkUnlockedOrQuestCompleted(66049)) return false; - if ((Svc.ClientState.LocalPlayer.ClassJob.Id is 1 or 2 or 3 or 4 or 5 or 6 or 7 or 26 or 29) && + if ((Svc.ClientState.LocalPlayer.ClassJob.RowId is 1 or 2 or 3 or 4 or 5 or 6 or 7 or 26 or 29) && Svc.Condition[Dalamud.Game.ClientState.Conditions.ConditionFlag.BoundByDuty] && Svc.ClientState.LocalPlayer.Level > 35) return true; diff --git a/XIVSlothCombo/Core/PluginAddressResolver.cs b/XIVSlothCombo/Core/PluginAddressResolver.cs index 401f43d3e..b79b5d8e4 100644 --- a/XIVSlothCombo/Core/PluginAddressResolver.cs +++ b/XIVSlothCombo/Core/PluginAddressResolver.cs @@ -13,10 +13,10 @@ internal class PluginAddressResolver /// public unsafe void Setup(ISigScanner scanner) { - IsActionIdReplaceable = scanner.ScanText("40 53 48 83 EC 20 8B D9 48 8B 0D ?? ?? ?? ?? E8 ?? ?? ?? ?? 48 85 C0 74 1F"); + IsActionIdReplaceable = scanner.ScanText("40 53 48 83 EC 20 8B D9 48 8B 0D ?? ?? ?? ?? E8 ?? ?? ?? ?? 48 85 C0 74 1B"); - Svc.Log.Verbose("===== X I V S L O T H C O M B O ====="); - Svc.Log.Verbose($"{nameof(IsActionIdReplaceable)} 0x{IsActionIdReplaceable:X}"); + Svc.Log.Debug("===== X I V S L O T H C O M B O ====="); + Svc.Log.Debug($"{nameof(IsActionIdReplaceable)} 0x{IsActionIdReplaceable:X}"); } } } diff --git a/XIVSlothCombo/CustomCombo/CustomCombo.cs b/XIVSlothCombo/CustomCombo/CustomCombo.cs index 9767aae47..31e74b21a 100644 --- a/XIVSlothCombo/CustomCombo/CustomCombo.cs +++ b/XIVSlothCombo/CustomCombo/CustomCombo.cs @@ -49,7 +49,7 @@ public unsafe bool TryInvoke(uint actionID, byte level, uint lastComboMove, floa if (!IsEnabled(Preset)) return false; - uint classJobID = LocalPlayer!.ClassJob.Id; + uint classJobID = LocalPlayer!.ClassJob.RowId; if (classJobID is >= 8 and <= 15) classJobID = DOH.JobID; diff --git a/XIVSlothCombo/CustomCombo/Functions/Action.cs b/XIVSlothCombo/CustomCombo/Functions/Action.cs index 7a79b10ac..e6cb028ca 100644 --- a/XIVSlothCombo/CustomCombo/Functions/Action.cs +++ b/XIVSlothCombo/CustomCombo/Functions/Action.cs @@ -20,7 +20,7 @@ internal abstract partial class CustomComboFunctions /// Checks if the player is high enough level to use the passed Action ID. /// ID of the action. /// - public static bool LevelChecked(uint actionid) => LocalPlayer.Level >= GetLevel(actionid) && NoBlockingStatuses(actionid) && IsActionUnlocked(actionid); + public static bool LevelChecked(uint actionid) => LocalPlayer.Level >= GetLevel(actionid) && NoBlockingStatuses(actionid) && IsActionUnlocked(actionid); /// Checks if the player is high enough level to use the passed Trait ID. /// ID of the action. diff --git a/XIVSlothCombo/CustomCombo/Functions/PlayerCharacter.cs b/XIVSlothCombo/CustomCombo/Functions/PlayerCharacter.cs index b11fd5660..e0e49e545 100644 --- a/XIVSlothCombo/CustomCombo/Functions/PlayerCharacter.cs +++ b/XIVSlothCombo/CustomCombo/Functions/PlayerCharacter.cs @@ -2,7 +2,7 @@ using Dalamud.Game.ClientState.Objects.SubKinds; using ECommons.DalamudServices; using FFXIVClientStructs.FFXIV.Client.Game.UI; -using Lumina.Excel.GeneratedSheets; +using Lumina.Excel.Sheets; using GameMain = FFXIVClientStructs.FFXIV.Client.Game.GameMain; namespace XIVSlothCombo.CustomComboNS.Functions @@ -37,7 +37,7 @@ internal abstract partial class CustomComboFunctions /// A value indicating a quest has been completed for a job action. public static unsafe bool IsActionUnlocked(uint id) { - var unlockLink = Svc.Data.GetExcelSheet().GetRow(id).UnlockLink; + var unlockLink = Svc.Data.GetExcelSheet().GetRow(id).UnlockLink.RowId; if (unlockLink == 0) return true; return UIState.Instance()->IsUnlockLinkUnlockedOrQuestCompleted(unlockLink); } diff --git a/XIVSlothCombo/CustomCombo/Functions/Status.cs b/XIVSlothCombo/CustomCombo/Functions/Status.cs index f213fbcde..0cc1e43f0 100644 --- a/XIVSlothCombo/CustomCombo/Functions/Status.cs +++ b/XIVSlothCombo/CustomCombo/Functions/Status.cs @@ -1,5 +1,4 @@ using Dalamud.Game.ClientState.Objects.Types; -using Dalamud.Game.ClientState.Statuses; using FFXIVClientStructs.FFXIV.Client.Game; using XIVSlothCombo.Data; using XIVSlothCombo.Services; diff --git a/XIVSlothCombo/CustomCombo/Functions/Target.cs b/XIVSlothCombo/CustomCombo/Functions/Target.cs index d9869f6b1..f7264902c 100644 --- a/XIVSlothCombo/CustomCombo/Functions/Target.cs +++ b/XIVSlothCombo/CustomCombo/Functions/Target.cs @@ -1,8 +1,10 @@ using Dalamud.Game.ClientState.Objects; using Dalamud.Game.ClientState.Objects.Enums; using Dalamud.Game.ClientState.Objects.Types; +using ECommons; using ECommons.DalamudServices; using FFXIVClientStructs.FFXIV.Client.System.Framework; +using Lumina.Excel.Sheets; using System; using System.Linq; using System.Numerics; @@ -180,7 +182,7 @@ public static bool TargetNeedsPositionals() { if (!HasBattleTarget()) return false; if (TargetHasEffectAny(3808)) return false; // Directional Disregard Effect (Patch 7.01) - if (ActionWatching.BNpcSheet.TryGetValue(CurrentTarget.DataId, out var bnpc) && !bnpc.Unknown10) return true; + if (Svc.Data.Excel.GetSheet().TryGetFirst(x => x.RowId == CurrentTarget.DataId, out var bnpc) && !bnpc.IsOmnidirectional) return true; return false; } diff --git a/XIVSlothCombo/Data/ActionWatching.cs b/XIVSlothCombo/Data/ActionWatching.cs index a00b8ae56..b6b98a1a6 100644 --- a/XIVSlothCombo/Data/ActionWatching.cs +++ b/XIVSlothCombo/Data/ActionWatching.cs @@ -4,7 +4,7 @@ using ECommons.DalamudServices; using ECommons.GameFunctions; using FFXIVClientStructs.FFXIV.Client.Game; -using Lumina.Excel.GeneratedSheets; +using Lumina.Excel.Sheets; using System; using System.Collections.Generic; using System.Linq; @@ -18,18 +18,15 @@ namespace XIVSlothCombo.Data { public static class ActionWatching { - internal static Dictionary ActionSheet = Svc.Data.GetExcelSheet()! + internal static Dictionary ActionSheet = Svc.Data.GetExcelSheet()! .Where(i => i.RowId is not 7) .ToDictionary(i => i.RowId, i => i); - internal static Dictionary StatusSheet = Svc.Data.GetExcelSheet()! + internal static Dictionary StatusSheet = Svc.Data.GetExcelSheet()! .ToDictionary(i => i.RowId, i => i); internal static Dictionary TraitSheet = Svc.Data.GetExcelSheet()! - .Where(i => i.ClassJobCategory is not null) //All player traits are assigned to a category. Chocobo and other garbage lacks this, thus excluded. - .ToDictionary(i => i.RowId, i => i); - - internal static Dictionary BNpcSheet = Svc.Data.GetExcelSheet()! + .Where(i => i.ClassJobCategory.IsValid) //All player traits are assigned to a category. Chocobo and other garbage lacks this, thus excluded. .ToDictionary(i => i.RowId, i => i); private static readonly Dictionary> statusCache = []; @@ -61,9 +58,8 @@ private static void ReceiveActionEffectDetour(ulong sourceObjectId, IntPtr sourc LastAction = header.ActionId; - ActionSheet.TryGetValue(header.ActionId, out var sheet); - if (sheet != null) - { + if (ActionSheet.TryGetValue(header.ActionId, out var sheet)) + { switch (sheet.ActionCategory.Value.RowId) { case 2: //Spell @@ -271,21 +267,21 @@ public static void Disable() Svc.Condition.ConditionChange -= ResetActions; } - public static int GetLevel(uint id) => ActionSheet.TryGetValue(id, out var action) && action.ClassJobCategory is not null ? action.ClassJobLevel : 255; + public static int GetLevel(uint id) => ActionSheet.TryGetValue(id, out var action) && action.ClassJobCategory.IsValid ? action.ClassJobLevel : 255; public static float GetActionCastTime(uint id) => ActionSheet.TryGetValue(id, out var action) ? action.Cast100ms / (float)10 : 0; public static int GetActionRange(uint id) => ActionSheet.TryGetValue(id, out var action) ? action.Range : -2; // 0 & -1 are valid numbers. -2 is our failure code for InActionRange public static int GetActionEffectRange(uint id) => ActionSheet.TryGetValue(id, out var action) ? action.EffectRange : -1; public static int GetTraitLevel(uint id) => TraitSheet.TryGetValue(id, out var trait) ? trait.Level : 255; - public static string GetActionName(uint id) => ActionSheet.TryGetValue(id, out var action) ? (string)action.Name : "UNKNOWN ABILITY"; + public static string GetActionName(uint id) => ActionSheet.TryGetValue(id, out var action) ? action.Name.ToString() : "UNKNOWN ABILITY"; public static string GetBLUIndex(uint id) { - var aozKey = Svc.Data.GetExcelSheet()!.First(x => x.Action.Row == id).RowId; + var aozKey = Svc.Data.GetExcelSheet()!.First(x => x.Action.RowId == id).RowId; var index = Svc.Data.GetExcelSheet().GetRow(aozKey).Number; return $"#{index} "; } - public static string GetStatusName(uint id) => StatusSheet.TryGetValue(id, out var status) ? (string)status.Name : "Unknown Status"; + public static string GetStatusName(uint id) => StatusSheet.TryGetValue(id, out var status) ? status.Name.ToString() : "Unknown Status"; public static List? GetStatusesByName(string status) { @@ -302,7 +298,7 @@ public static ActionAttackType GetAttackType(uint id) { if (!ActionSheet.TryGetValue(id, out var action)) return ActionAttackType.Unknown; - return action.ActionCategory.Row switch + return action.ActionCategory.RowId switch { 2 => ActionAttackType.Spell, 3 => ActionAttackType.Weaponskill, diff --git a/XIVSlothCombo/Window/Functions/Presets.cs b/XIVSlothCombo/Window/Functions/Presets.cs index bbb734dc0..2f2b698dc 100644 --- a/XIVSlothCombo/Window/Functions/Presets.cs +++ b/XIVSlothCombo/Window/Functions/Presets.cs @@ -1,6 +1,5 @@ using Dalamud.Interface.Colors; using Dalamud.Interface.Components; -using Dalamud.Interface.Utility; using Dalamud.Interface.Utility.Raii; using Dalamud.Utility; using ECommons.DalamudServices; @@ -9,7 +8,6 @@ using System.Collections.Generic; using System.Linq; using System.Numerics; -using System.Reflection.Emit; using System.Text; using XIVSlothCombo.Attributes; using XIVSlothCombo.Combos; diff --git a/XIVSlothCombo/Window/Tabs/Debug.cs b/XIVSlothCombo/Window/Tabs/Debug.cs index 06df7e63b..b5c106830 100644 --- a/XIVSlothCombo/Window/Tabs/Debug.cs +++ b/XIVSlothCombo/Window/Tabs/Debug.cs @@ -4,10 +4,11 @@ using Dalamud.Interface.Utility.Raii; using ECommons.DalamudServices; using ECommons.ImGuiMethods; +using ECommons.Reflection; using FFXIVClientStructs.FFXIV.Client.Game; using FFXIVClientStructs.FFXIV.Client.Game.UI; using ImGuiNET; -using Lumina.Excel.GeneratedSheets; +using Lumina.Excel.Sheets; using System; using System.Linq; using XIVSlothCombo.Combos; @@ -15,8 +16,6 @@ using XIVSlothCombo.CustomComboNS.Functions; using XIVSlothCombo.Data; using XIVSlothCombo.Services; -using static XIVSlothCombo.Combos.JobHelpers.NIN; -using Action = Lumina.Excel.GeneratedSheets.Action; using Status = Dalamud.Game.ClientState.Statuses.Status; namespace XIVSlothCombo.Window.Tabs @@ -31,7 +30,7 @@ internal class DebugCombo : CustomCombo protected override uint Invoke(uint actionID, uint lastComboActionID, float comboTime, byte level) => actionID; } - internal static Action? debugSpell; + internal static Lumina.Excel.Sheets.Action? debugSpell; internal unsafe static new void Draw() { DebugCombo? comboClass = new(); @@ -132,7 +131,7 @@ static void CustomStyleText(string label, object? value) } if (ImGui.CollapsingHeader("Action Info")) { - string prev = debugSpell == null ? "Select Action" : $"({debugSpell.RowId}) Lv.{debugSpell.ClassJobLevel}. {debugSpell.Name} - {(debugSpell.IsPvP ? "PvP" : "Normal")}"; + string prev = debugSpell == null ? "Select Action" : $"({debugSpell.Value.RowId}) Lv.{debugSpell.Value.ClassJobLevel}. {debugSpell.Value.Name} - {(debugSpell.Value.IsPvP ? "PvP" : "Normal")}"; ImGuiEx.SetNextItemFullWidth(); using (var comboBox = ImRaii.Combo("###ActionCombo", prev)) { @@ -144,7 +143,7 @@ static void CustomStyleText(string label, object? value) } var classId = CustomComboFunctions.JobIDs.JobToClass(JobID.Value); - foreach (var act in Svc.Data.GetExcelSheet().Where(x => x.IsPlayerAction && x.ClassJob.Row == classId || x.ClassJob.Row == JobID.Value).OrderBy(x => x.ClassJobLevel)) + foreach (var act in Svc.Data.GetExcelSheet().Where(x => x.IsPlayerAction && x.ClassJob.RowId == classId || x.ClassJob.RowId == JobID.Value).OrderBy(x => x.ClassJobLevel)) { if (ImGui.Selectable($"({act.RowId}) Lv.{act.ClassJobLevel}. {act.Name} - {(act.IsPvP ? "PvP" : "Normal")}", debugSpell?.RowId == act.RowId)) { @@ -156,19 +155,19 @@ static void CustomStyleText(string label, object? value) if (debugSpell != null) { - var actionStatus = ActionManager.Instance()->GetActionStatus(ActionType.Action, debugSpell.RowId); - var icon = Svc.Texture.GetFromGameIcon(new(debugSpell.Icon)).GetWrapOrEmpty().ImGuiHandle; + var actionStatus = ActionManager.Instance()->GetActionStatus(ActionType.Action, debugSpell.Value.RowId); + var icon = Svc.Texture.GetFromGameIcon(new(debugSpell.Value.Icon)).GetWrapOrEmpty().ImGuiHandle; ImGui.Image(icon, new System.Numerics.Vector2(60f.Scale(), 60f.Scale())); ImGui.SameLine(); ImGui.Image(icon, new System.Numerics.Vector2(30f.Scale(), 30f.Scale())); CustomStyleText($"Action Status:", $"{actionStatus} ({Svc.Data.GetExcelSheet().GetRow(actionStatus).Text})"); - CustomStyleText($"Action Type:", debugSpell.ActionCategory.Value.Name); - if (debugSpell.UnlockLink != 0) - CustomStyleText($"Quest:", $"{Svc.Data.GetExcelSheet().GetRow(debugSpell.UnlockLink).Name} ({(UIState.Instance()->IsUnlockLinkUnlockedOrQuestCompleted(debugSpell.UnlockLink) ? "Completed" : "Not Completed")})"); - CustomStyleText($"Base Recast:", $"{debugSpell.Recast100ms / 10f}s"); - CustomStyleText($"Max Charges:", $"{debugSpell.MaxCharges}"); - if (ActionWatching.ActionTimestamps.ContainsKey(debugSpell.RowId)) - CustomStyleText($"Time Since Last Use:", $"{(Environment.TickCount64 - ActionWatching.ActionTimestamps[debugSpell.RowId])/1000f:F2}"); + CustomStyleText($"Action Type:", debugSpell.Value.ActionCategory.Value.Name); + if (debugSpell.Value.UnlockLink.RowId != 0) + CustomStyleText($"Quest:", $"{Svc.Data.GetExcelSheet().GetRow(debugSpell.Value.UnlockLink.RowId).Name} ({(UIState.Instance()->IsUnlockLinkUnlockedOrQuestCompleted(debugSpell.Value.UnlockLink.RowId) ? "Completed" : "Not Completed")})"); + CustomStyleText($"Base Recast:", $"{debugSpell.Value.Recast100ms / 10f}s"); + CustomStyleText($"Max Charges:", $"{debugSpell.Value.MaxCharges}"); + if (ActionWatching.ActionTimestamps.ContainsKey(debugSpell.Value.RowId)) + CustomStyleText($"Time Since Last Use:", $"{(Environment.TickCount64 - ActionWatching.ActionTimestamps[debugSpell.Value.RowId])/1000f:F2}"); } } @@ -176,7 +175,7 @@ static void CustomStyleText(string label, object? value) ImGui.Spacing(); ImGui.Text("Player Info"); ImGui.Separator(); - CustomStyleText("Job:", $"{LocalPlayer.ClassJob.GameData.NameEnglish} (ID: {LocalPlayer.ClassJob.Id})"); + CustomStyleText("Job:", $"{LocalPlayer.ClassJob.Value.NameEnglish} (ID: {LocalPlayer.ClassJob.RowId})"); CustomStyleText("Zone:", $"{Svc.Data.GetExcelSheet()?.FirstOrDefault(x => x.RowId == Svc.ClientState.TerritoryType).PlaceName.Value.Name} (ID: {Svc.ClientState.TerritoryType})"); CustomStyleText("In PvP:", CustomComboFunctions.InPvP()); CustomStyleText("In Combat:", CustomComboFunctions.InCombat()); @@ -227,7 +226,7 @@ static void CustomStyleText(string label, object? value) if (CustomComboFunctions.GetPartySlot(i) is not IBattleChara member || member is null) continue; ImGui.TextUnformatted($"Slot {i} ->"); ImGui.SameLine(0, 4f); - CustomStyleText($"{CustomComboFunctions.GetPartySlot(i).Name}", $"({member.ClassJob.GameData.Abbreviation})"); + CustomStyleText($"{CustomComboFunctions.GetPartySlot(i).Name}", $"({member.ClassJob.Value.Abbreviation})"); } } ImGui.Spacing(); diff --git a/XIVSlothCombo/XIVSlothCombo.cs b/XIVSlothCombo/XIVSlothCombo.cs index 8e21ca3a3..20203abea 100644 --- a/XIVSlothCombo/XIVSlothCombo.cs +++ b/XIVSlothCombo/XIVSlothCombo.cs @@ -1,4 +1,3 @@ -using Dalamud.Game.ClientState.Statuses; using Dalamud.Game.Command; using Dalamud.Game.Text; using Dalamud.Game.Text.SeStringHandling; @@ -9,6 +8,7 @@ using Dalamud.Utility; using ECommons; using ECommons.DalamudServices; +using Lumina.Excel.Sheets; using System; using System.Collections.Generic; using System.IO; @@ -25,6 +25,7 @@ using XIVSlothCombo.Services; using XIVSlothCombo.Window; using XIVSlothCombo.Window.Tabs; +using Status = Dalamud.Game.ClientState.Statuses.Status; namespace XIVSlothCombo { @@ -95,7 +96,7 @@ public XIVSlothCombo(IDalamudPluginInterface pluginInterface) P = this; pluginInterface.Create(); ECommonsMain.Init(pluginInterface, this); - + Service.Configuration = pluginInterface.GetPluginConfig() as PluginConfiguration ?? new PluginConfiguration(); Service.Address = new PluginAddressResolver(); Service.Address.Setup(Svc.SigScanner); @@ -160,7 +161,7 @@ private static void HandleConflictedCombos() private void OnFrameworkUpdate(IFramework framework) { if (Svc.ClientState.LocalPlayer is not null) - JobID = Svc.ClientState.LocalPlayer?.ClassJob?.Id; + JobID = Svc.ClientState.LocalPlayer?.ClassJob.RowId; BlueMageService.PopulateBLUSpells(); TargetHelper.Draw(); @@ -431,13 +432,13 @@ private void OnCommand(string command, string arguments) file.WriteLine($"Installation Repo: {RepoCheckFunctions.FetchCurrentRepo()?.InstalledFromUrl}"); // Installation Repo file.WriteLine(""); file.WriteLine($"Current Job: " + // Current Job - $"{Svc.ClientState.LocalPlayer.ClassJob.GameData.Name} / " + // - Client Name - $"{Svc.ClientState.LocalPlayer.ClassJob.GameData.NameEnglish} / " + // - EN Name - $"{Svc.ClientState.LocalPlayer.ClassJob.GameData.Abbreviation}"); // - Abbreviation - file.WriteLine($"Current Job Index: {Svc.ClientState.LocalPlayer.ClassJob.Id}"); // Job Index + $"{Svc.ClientState.LocalPlayer.ClassJob.Value.Name} / " + // - Client Name + $"{Svc.ClientState.LocalPlayer.ClassJob.Value.NameEnglish} / " + // - EN Name + $"{Svc.ClientState.LocalPlayer.ClassJob.Value.Abbreviation}"); // - Abbreviation + file.WriteLine($"Current Job Index: {Svc.ClientState.LocalPlayer.ClassJob.RowId}"); // Job Index file.WriteLine($"Current Job Level: {Svc.ClientState.LocalPlayer.Level}"); // Job Level file.WriteLine(""); - file.WriteLine($"Current Zone: {Svc.Data.GetExcelSheet()?.FirstOrDefault(x => x.RowId == Svc.ClientState.TerritoryType).PlaceName.Value.Name}"); // Current zone location + file.WriteLine($"Current Zone: {Svc.Data.GetExcelSheet()?.FirstOrDefault(x => x.RowId == Svc.ClientState.TerritoryType).PlaceName.Value.Name}"); // Current zone location file.WriteLine($"Current Party Size: {Svc.Party.Length}"); // Current party size file.WriteLine(""); file.WriteLine($"START ENABLED FEATURES"); @@ -500,8 +501,8 @@ private void OnCommand(string command, string arguments) else { var jobname = ConfigWindow.groupedPresets.Where(x => x.Value.Any(y => y.Info.JobShorthand.Equals(specificJob.ToLower(), StringComparison.CurrentCultureIgnoreCase))).FirstOrDefault().Key; - var jobID = Svc.Data.GetExcelSheet()? - .Where(x => x.Name.RawString.Equals(jobname, StringComparison.CurrentCultureIgnoreCase)) + var jobID = Svc.Data.GetExcelSheet()? + .Where(x => x.Name.ToString().Equals(jobname, StringComparison.CurrentCultureIgnoreCase)) .First() .RowId; diff --git a/XIVSlothCombo/XIVSlothCombo.csproj b/XIVSlothCombo/XIVSlothCombo.csproj index 6905552b7..0e1b425a6 100644 --- a/XIVSlothCombo/XIVSlothCombo.csproj +++ b/XIVSlothCombo/XIVSlothCombo.csproj @@ -66,7 +66,7 @@ - + diff --git a/XIVSlothCombo/XIVSlothCombo.json b/XIVSlothCombo/XIVSlothCombo.json index 42654f4ca..00c19a340 100644 --- a/XIVSlothCombo/XIVSlothCombo.json +++ b/XIVSlothCombo/XIVSlothCombo.json @@ -2,7 +2,7 @@ "Author": "Team Sloth", "Name": "XIVSlothCombo", "InternalName": "XIVSlothCombo", - "DalamudApiLevel": 10, + "DalamudApiLevel": 11, "Punchline": "Condenses combos and mutually exclusive abilities onto a single button - and then some.", "Description": "Condenses combos and mutually exclusive abilities onto a single button - and then some.", "RepoUrl": "https://github.com/Nik-Potokar/XIVSlothCombo",