From 15b25914acd6c5cbb08d99066adc730e583bd51f Mon Sep 17 00:00:00 2001 From: Tartarga <109563717+Tartarga@users.noreply.github.com> Date: Thu, 25 Jul 2024 00:25:09 -0500 Subject: [PATCH] Healer DoTs: Replaced dot time checking with GetDebuffRemainingTime Service.AnythingDalamudPlugin migrated to ECommons Svc Using and Whitespace code cleanup ran. --- .../Attributes/CustomComboInfoAttribute.cs | 5 +- XIVSlothCombo/Combos/CustomComboPreset.cs | 2 +- XIVSlothCombo/Combos/JobHelpers/AST.cs | 10 +- XIVSlothCombo/Combos/JobHelpers/BLM.cs | 2 +- XIVSlothCombo/Combos/JobHelpers/NIN.cs | 6 +- XIVSlothCombo/Combos/JobHelpers/RDM.cs | 6 +- XIVSlothCombo/Combos/JobHelpers/SGE.cs | 2 +- XIVSlothCombo/Combos/JobHelpers/VPR.cs | 6 +- XIVSlothCombo/Combos/PvE/ALL.cs | 12 +- XIVSlothCombo/Combos/PvE/AST.cs | 24 ++-- XIVSlothCombo/Combos/PvE/BLM.cs | 10 +- XIVSlothCombo/Combos/PvE/BRD.cs | 2 - XIVSlothCombo/Combos/PvE/Content/Variant.cs | 8 +- XIVSlothCombo/Combos/PvE/DOL.cs | 8 +- XIVSlothCombo/Combos/PvE/DRG.cs | 1 - XIVSlothCombo/Combos/PvE/DRK.cs | 5 - XIVSlothCombo/Combos/PvE/GNB.cs | 8 +- XIVSlothCombo/Combos/PvE/MNK.cs | 10 +- XIVSlothCombo/Combos/PvE/NIN.cs | 2 +- XIVSlothCombo/Combos/PvE/PLD.cs | 4 +- XIVSlothCombo/Combos/PvE/RDM.cs | 24 ++-- XIVSlothCombo/Combos/PvE/SAM.cs | 4 +- XIVSlothCombo/Combos/PvE/SCH.cs | 53 ++++----- XIVSlothCombo/Combos/PvE/SGE.cs | 43 ++++--- XIVSlothCombo/Combos/PvE/SMN.cs | 20 ++-- XIVSlothCombo/Combos/PvE/WAR.cs | 1 - XIVSlothCombo/Combos/PvE/WHM.cs | 19 ++- XIVSlothCombo/Combos/PvP/BRDPVP.cs | 4 +- XIVSlothCombo/Combos/PvP/GNBPVP.cs | 3 +- XIVSlothCombo/Combos/PvP/PLDPVP.cs | 6 +- XIVSlothCombo/Combos/PvP/SAMPVP.cs | 2 +- XIVSlothCombo/Combos/PvP/SMNPvP.cs | 2 +- XIVSlothCombo/Core/IconReplacer.cs | 33 +++--- XIVSlothCombo/Core/PluginAddressResolver.cs | 9 +- XIVSlothCombo/Core/PluginConfiguration.cs | 22 ++-- XIVSlothCombo/CustomCombo/Functions/Action.cs | 2 +- XIVSlothCombo/CustomCombo/Functions/Party.cs | 13 +- .../CustomCombo/Functions/PlayerCharacter.cs | 11 +- XIVSlothCombo/CustomCombo/Functions/Target.cs | 70 ++++++----- XIVSlothCombo/Data/ActionWatching.cs | 24 ++-- XIVSlothCombo/Data/CustomComboCache.cs | 19 ++- XIVSlothCombo/Data/RepoCheck.cs | 6 +- XIVSlothCombo/Data/TempSCHGauge.cs | 7 +- XIVSlothCombo/Extensions/UIntExtensions.cs | 2 +- XIVSlothCombo/Global.cs | 2 - XIVSlothCombo/Services/BlueMageService.cs | 4 +- .../Services/PartyTargetingService.cs | 6 +- XIVSlothCombo/Services/Service.cs | 82 ------------- XIVSlothCombo/Window/ConfigWindow.cs | 9 +- XIVSlothCombo/Window/Functions/Presets.cs | 4 +- XIVSlothCombo/Window/Functions/UserConfig.cs | 12 +- XIVSlothCombo/Window/IconTextButton.cs | 1 - XIVSlothCombo/Window/InfoBox.cs | 8 +- XIVSlothCombo/Window/Tabs/AboutUs.cs | 1 - XIVSlothCombo/Window/Tabs/Debug.cs | 48 ++++---- XIVSlothCombo/Window/Tabs/PvEFeatures.cs | 5 +- XIVSlothCombo/Window/Tabs/PvPFeatures.cs | 10 +- XIVSlothCombo/Window/Tabs/Settings.cs | 4 +- XIVSlothCombo/Window/TargetHelper.cs | 2 +- XIVSlothCombo/XIVSlothCombo.cs | 112 +++++++++--------- 60 files changed, 359 insertions(+), 483 deletions(-) diff --git a/XIVSlothCombo/Attributes/CustomComboInfoAttribute.cs b/XIVSlothCombo/Attributes/CustomComboInfoAttribute.cs index 97ca55650..8ab5928a3 100644 --- a/XIVSlothCombo/Attributes/CustomComboInfoAttribute.cs +++ b/XIVSlothCombo/Attributes/CustomComboInfoAttribute.cs @@ -6,7 +6,6 @@ using System.Linq; using System.Runtime.CompilerServices; using XIVSlothCombo.Combos.PvE; -using XIVSlothCombo.Services; namespace XIVSlothCombo.Attributes { @@ -93,7 +92,7 @@ private static string JobIDToShorthand(byte key) } } - private static readonly Dictionary ClassJobs = Service.DataManager.GetExcelSheet()!.ToDictionary(i => i.RowId, i => i); + private static readonly Dictionary ClassJobs = Svc.Data.GetExcelSheet()!.ToDictionary(i => i.RowId, i => i); public static string JobIDToName(byte key) { @@ -108,7 +107,7 @@ public static string JobIDToName(byte key) //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; //Job names are all lowercase by default. This capitalizes based on regional rules - string cultureID = Service.ClientState.ClientLanguage switch + string cultureID = Svc.ClientState.ClientLanguage switch { Dalamud.Game.ClientLanguage.French => "fr-FR", Dalamud.Game.ClientLanguage.Japanese => "ja-JP", diff --git a/XIVSlothCombo/Combos/CustomComboPreset.cs b/XIVSlothCombo/Combos/CustomComboPreset.cs index 24ae8e46e..857997fd9 100644 --- a/XIVSlothCombo/Combos/CustomComboPreset.cs +++ b/XIVSlothCombo/Combos/CustomComboPreset.cs @@ -3840,7 +3840,7 @@ The three digets after RDM.JobID can be used to reorder items in the list [ReplaceSkill(WAR.StormsPath)] [CustomComboInfo("Advanced Mode - Single Target", "Replaces Storm's Path with a one-button full single target rotation.\nThese features are ideal if you want to customize the rotation.", WAR.JobID, 1)] - WAR_ST_StormsPath = 18000, + WAR_ST_StormsPath = 18000, [ParentCombo(WAR_ST_StormsPath)] [CustomComboInfo("Berserk / Inner Release Option", "Adds Berserk / Inner Release to Advanced Mode.", WAR.JobID)] diff --git a/XIVSlothCombo/Combos/JobHelpers/AST.cs b/XIVSlothCombo/Combos/JobHelpers/AST.cs index ee5524d3c..f2ffd6673 100644 --- a/XIVSlothCombo/Combos/JobHelpers/AST.cs +++ b/XIVSlothCombo/Combos/JobHelpers/AST.cs @@ -2,12 +2,10 @@ using Dalamud.Game.ClientState.Objects.Types; using Dalamud.Plugin.Services; using ECommons.DalamudServices; -using System; using System.Collections.Generic; using System.Linq; using XIVSlothCombo.CustomComboNS.Functions; using XIVSlothCombo.Extensions; -using XIVSlothCombo.Services; using static XIVSlothCombo.Combos.PvE.AST; namespace XIVSlothCombo.Combos.JobHelpers @@ -16,12 +14,12 @@ internal static class AST { internal static void Init() { - Service.Framework.Update += CheckCards; + Svc.Framework.Update += CheckCards; } private static void CheckCards(IFramework framework) { - if (Service.ClientState.LocalPlayer is null || Service.ClientState.LocalPlayer.ClassJob.Id != 33) + if (Svc.ClientState.LocalPlayer is null || Svc.ClientState.LocalPlayer.ClassJob.Id != 33) return; if (Svc.Condition[Dalamud.Game.ClientState.Conditions.ConditionFlag.BetweenAreas] || Svc.Condition[Dalamud.Game.ClientState.Conditions.ConditionFlag.Unconscious]) @@ -35,7 +33,7 @@ private static void CheckCards(IFramework framework) DrawnCard = Gauge.DrawnCards[0]; } - if (CustomComboFunctions.IsEnabled(CustomComboPreset.AST_Cards_QuickTargetCards) && + if (CustomComboFunctions.IsEnabled(CustomComboPreset.AST_Cards_QuickTargetCards) && (AST_QuickTargetCards.SelectedRandomMember is null || BetterTargetAvailable())) { if (CustomComboFunctions.ActionReady(Play1)) @@ -205,7 +203,7 @@ private static bool SetTarget() internal static void Dispose() { - Service.Framework.Update -= CheckCards; + Svc.Framework.Update -= CheckCards; } } } diff --git a/XIVSlothCombo/Combos/JobHelpers/BLM.cs b/XIVSlothCombo/Combos/JobHelpers/BLM.cs index cdadadf66..e1af5e4fe 100644 --- a/XIVSlothCombo/Combos/JobHelpers/BLM.cs +++ b/XIVSlothCombo/Combos/JobHelpers/BLM.cs @@ -431,7 +431,7 @@ public bool DoFullOpener(ref uint actionID, bool simpleMode) ResetOpener(); CurrentState = OpenerState.PrePull; } - + return false; } diff --git a/XIVSlothCombo/Combos/JobHelpers/NIN.cs b/XIVSlothCombo/Combos/JobHelpers/NIN.cs index 126ec8809..5ece51f04 100644 --- a/XIVSlothCombo/Combos/JobHelpers/NIN.cs +++ b/XIVSlothCombo/Combos/JobHelpers/NIN.cs @@ -1,10 +1,10 @@ using Dalamud.Game.ClientState.Conditions; using Dalamud.Game.ClientState.JobGauge.Types; +using ECommons.DalamudServices; using XIVSlothCombo.Combos.JobHelpers.Enums; using XIVSlothCombo.CustomComboNS.Functions; using XIVSlothCombo.Data; using XIVSlothCombo.Extensions; -using XIVSlothCombo.Services; namespace XIVSlothCombo.Combos.JobHelpers { @@ -593,7 +593,7 @@ public bool DoFullOpener(ref uint actionID, MudraCasting mudraState) { if (!LevelChecked) return false; - if (!openerEventsSetup) { Service.Condition.ConditionChange += CheckCombatStatus; openerEventsSetup = true; } + if (!openerEventsSetup) { Svc.Condition.ConditionChange += CheckCombatStatus; openerEventsSetup = true; } if (CurrentState == OpenerState.PrePull || CurrentState == OpenerState.FailedOpener) if (DoPrePullSteps(ref actionID, mudraState)) return true; @@ -609,7 +609,7 @@ public bool DoFullOpener(ref uint actionID, MudraCasting mudraState) internal void Dispose() { - Service.Condition.ConditionChange -= CheckCombatStatus; + Svc.Condition.ConditionChange -= CheckCombatStatus; } private void CheckCombatStatus(ConditionFlag flag, bool value) diff --git a/XIVSlothCombo/Combos/JobHelpers/RDM.cs b/XIVSlothCombo/Combos/JobHelpers/RDM.cs index d93ee893b..114f94989 100644 --- a/XIVSlothCombo/Combos/JobHelpers/RDM.cs +++ b/XIVSlothCombo/Combos/JobHelpers/RDM.cs @@ -110,7 +110,7 @@ public static (bool useFire, bool useStone, bool useThunder, bool useAero, bool } internal class MeleeFinisher : PvE.RDM - { + { internal static bool CanUse(in uint lastComboMove, out uint actionID) { int blackmana = RDMMana.Black; @@ -170,7 +170,7 @@ internal class OGCDHelper : PvE.RDM internal static bool CanUse(in uint actionID, in bool SingleTarget, out uint newActionID) { var distance = CustomComboFunctions.GetTargetDistance(); - + uint placeOGCD = 0; bool fleche = SingleTarget ? Config.RDM_ST_oGCD_Fleche : Config.RDM_AoE_oGCD_Fleche; @@ -199,7 +199,7 @@ internal static bool CanUse(in uint actionID, in bool SingleTarget, out uint new && LevelChecked(Corpsacorps) && distance <= corpacorpsRange) placeOGCD = Corpsacorps; - + if (contra && ActionReady(ContreSixte)) placeOGCD = ContreSixte; diff --git a/XIVSlothCombo/Combos/JobHelpers/SGE.cs b/XIVSlothCombo/Combos/JobHelpers/SGE.cs index 70dc24554..84425e8f3 100644 --- a/XIVSlothCombo/Combos/JobHelpers/SGE.cs +++ b/XIVSlothCombo/Combos/JobHelpers/SGE.cs @@ -8,7 +8,7 @@ internal class SGE : CustomComboFunctions public static int GetMatchingConfigST(int i, out uint action, out bool enabled) { var healTarget = GetHealTarget(PvE.SGE.Config.SGE_ST_Heal_Adv && PvE.SGE.Config.SGE_ST_Heal_UIMouseOver); - + switch (i) { case 0: diff --git a/XIVSlothCombo/Combos/JobHelpers/VPR.cs b/XIVSlothCombo/Combos/JobHelpers/VPR.cs index 623042ffa..62bb1f27e 100644 --- a/XIVSlothCombo/Combos/JobHelpers/VPR.cs +++ b/XIVSlothCombo/Combos/JobHelpers/VPR.cs @@ -63,7 +63,7 @@ public OpenerState CurrentState private bool DoPrePullSteps(ref uint actionID) { - if (!LevelChecked) + if (!LevelChecked) return false; if (CanOpener && PrePullStep == 0) @@ -213,7 +213,7 @@ private bool DoOpener(ref uint actionID) if (((actionID == SerpentsIre && CustomComboFunctions.IsOnCooldown(SerpentsIre)) || (actionID == Dreadwinder && CustomComboFunctions.GetRemainingCharges(Dreadwinder) < 2)) && ActionWatching.TimeSinceLastAction.TotalSeconds >= 3) - { + { CurrentState = OpenerState.FailedOpener; return false; } @@ -230,7 +230,7 @@ private void ResetOpener() public bool DoFullOpener(ref uint actionID) { - if (!LevelChecked) + if (!LevelChecked) return false; if (CurrentState == OpenerState.PrePull) diff --git a/XIVSlothCombo/Combos/PvE/ALL.cs b/XIVSlothCombo/Combos/PvE/ALL.cs index 3c5e658a0..9946cfcc7 100644 --- a/XIVSlothCombo/Combos/PvE/ALL.cs +++ b/XIVSlothCombo/Combos/PvE/ALL.cs @@ -1,6 +1,6 @@ -using XIVSlothCombo.CustomComboNS; +using ECommons.DalamudServices; +using XIVSlothCombo.CustomComboNS; using XIVSlothCombo.CustomComboNS.Functions; -using XIVSlothCombo.Services; namespace XIVSlothCombo.Combos.PvE { @@ -84,7 +84,7 @@ internal class ALL_IslandSanctuary_Sprint : CustomCombo protected override uint Invoke(uint actionID, uint lastComboMove, float comboTime, byte level) { - if (actionID is Sprint && Service.ClientState.TerritoryType is 1055) return IsleSprint; + if (actionID is Sprint && Svc.ClientState.TerritoryType is 1055) return IsleSprint; else return actionID; } } @@ -133,7 +133,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) + if ((actionID is WHM.Raise or AST.Ascend or SGE.Egeiro) || (actionID is SCH.Resurrection && LocalPlayer.ClassJob.Id is SCH.JobID)) { if (ActionReady(Swiftcast)) @@ -172,7 +172,7 @@ 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) + if ((actionID is BLU.AngelWhisper or RDM.Verraise) || (actionID is SMN.Resurrection && LocalPlayer.ClassJob.Id is SMN.JobID)) { if (HasEffect(Buffs.Swiftcast) || HasEffect(RDM.Buffs.Dualcast)) @@ -241,7 +241,7 @@ internal class ALL_Ranged_Interrupt : CustomCombo protected override uint Invoke(uint actionID, uint lastComboMove, float comboTime, byte level) { - return (actionID is FootGraze && CanInterruptEnemy() && ActionReady(HeadGraze) ) ? HeadGraze : actionID; + return (actionID is FootGraze && CanInterruptEnemy() && ActionReady(HeadGraze)) ? HeadGraze : actionID; } } } diff --git a/XIVSlothCombo/Combos/PvE/AST.cs b/XIVSlothCombo/Combos/PvE/AST.cs index 54b203e0d..cb6d69508 100644 --- a/XIVSlothCombo/Combos/PvE/AST.cs +++ b/XIVSlothCombo/Combos/PvE/AST.cs @@ -2,7 +2,7 @@ using Dalamud.Game.ClientState.JobGauge.Types; using Dalamud.Game.ClientState.Objects.Types; using Dalamud.Game.ClientState.Statuses; -using ECommons.DalamudServices; +using System.Collections; using System.Collections.Generic; using System.Linq; using XIVSlothCombo.Combos.PvE.Content; @@ -216,7 +216,7 @@ protected override uint Invoke(uint actionID, uint lastComboMove, float comboTim !HasEffect(Buffs.Lightspeed)) return Lightspeed; - + if (IsEnabled(CustomComboPreset.AST_DPS_Lucid) && ActionReady(All.LucidDreaming) && @@ -252,7 +252,7 @@ Gauge.DrawnCards[0] is not CardType.NONE && if (IsEnabled(CustomComboPreset.AST_DPS_Oracle) && HasEffect(Buffs.Divining) && CanSpellWeave(actionID)) - return Oracle; + return Oracle; //Minor Arcana / Lord of Crowns if (ActionReady(OriginalHook(MinorArcana)) && @@ -266,23 +266,19 @@ Gauge.DrawnCards[0] is not CardType.NONE && //Combust if (IsEnabled(CustomComboPreset.AST_ST_DPS_CombustUptime) && !GravityList.Contains(actionID) && - LevelChecked(Combust)) + LevelChecked(Combust) && + CombustList.TryGetValue(OriginalHook(Combust), out ushort dotDebuffID)) { - //Grab current DoT via OriginalHook, grab it's fellow debuff ID from Dictionary, then check for the debuff - uint dot = OriginalHook(Combust); - Status? dotDebuff = FindTargetEffect(CombustList[dot]); - float refreshtimer = Config.AST_ST_DPS_CombustUptime_Adv ? Config.AST_ST_DPS_CombustUptime_Threshold : 3; - if (IsEnabled(CustomComboPreset.AST_Variant_SpiritDart) && IsEnabled(Variant.VariantSpiritDart) && - (sustainedDamage is null || sustainedDamage?.RemainingTime <= 3) && + GetDebuffRemainingTime(Variant.Debuffs.SustainedDamage) <= 3 && CanSpellWeave(actionID)) return Variant.VariantSpiritDart; - - - if ((dotDebuff is null || dotDebuff.RemainingTime <= refreshtimer) && + + float refreshtimer = Config.AST_ST_DPS_CombustUptime_Adv ? Config.AST_ST_DPS_CombustUptime_Threshold : 3; + if (GetDebuffRemainingTime(dotDebuffID) <= refreshtimer && GetTargetHPPercent() > Config.AST_DPS_CombustOption) - return dot; + return OriginalHook(Combust); //AlterateMode idles as Malefic if (AlternateMode) return OriginalHook(Malefic); diff --git a/XIVSlothCombo/Combos/PvE/BLM.cs b/XIVSlothCombo/Combos/PvE/BLM.cs index cfaca72cc..6653a50b2 100644 --- a/XIVSlothCombo/Combos/PvE/BLM.cs +++ b/XIVSlothCombo/Combos/PvE/BLM.cs @@ -573,7 +573,7 @@ protected override uint Invoke(uint actionID, uint lastComboMove, float comboTim if (gauge.ElementTimeRemaining <= astralFireRefresh && !HasEffect(Buffs.Firestarter) && currentMP >= MP.FireI) return OriginalHook(Fire); - if (IsEnabled(CustomComboPreset.BLM_Adv_Cooldowns) && + if (IsEnabled(CustomComboPreset.BLM_Adv_Cooldowns) && Config.BLM_Adv_Cooldowns_Choice[0] && ActionReady(Manafont) && WasLastAction(Despair)) return Manafont; @@ -718,7 +718,7 @@ protected override uint Invoke(uint actionID, uint lastComboMove, float comboTim // Blizzard to Umbral Ice if ((currentMP is 0 && WasLastAction(Flare)) || (currentMP < MP.FireAoE && !LevelChecked(Flare))) - return OriginalHook(Blizzard2); + return OriginalHook(Blizzard2); if (currentMP >= MP.AllMPSpells) { @@ -768,7 +768,7 @@ protected override uint Invoke(uint actionID, uint lastComboMove, float comboTim if (currentMP < 9400 && !TraitLevelChecked(Traits.EnhancedFreeze) && Freeze.LevelChecked() && currentMP >= MP.Freeze) return Freeze; - + if (currentMP >= 9400 && !TraitLevelChecked(Traits.AspectMasteryIII)) return Transpose; @@ -889,8 +889,8 @@ protected override uint Invoke(uint actionID, uint lastComboMove, float comboTim ActionReady(Triplecast) && !HasEffect(Buffs.Triplecast)) return Triplecast; - if (LevelChecked(Flare) && HasEffect(Buffs.EnhancedFlare) && TraitLevelChecked(Traits.Enochian) && - (gauge.UmbralHearts is 1 || currentMP < MP.FireAoE)) + if (LevelChecked(Flare) && HasEffect(Buffs.EnhancedFlare) && TraitLevelChecked(Traits.Enochian) && + (gauge.UmbralHearts is 1 || currentMP < MP.FireAoE)) return Flare; if (currentMP > MP.FireAoE) diff --git a/XIVSlothCombo/Combos/PvE/BRD.cs b/XIVSlothCombo/Combos/PvE/BRD.cs index d5570a874..82b51dc98 100644 --- a/XIVSlothCombo/Combos/PvE/BRD.cs +++ b/XIVSlothCombo/Combos/PvE/BRD.cs @@ -1,12 +1,10 @@ using Dalamud.Game.ClientState.JobGauge.Enums; 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; -using static FFXIVClientStructs.FFXIV.Client.UI.AddonJobHudBRD0; namespace XIVSlothCombo.Combos.PvE { diff --git a/XIVSlothCombo/Combos/PvE/Content/Variant.cs b/XIVSlothCombo/Combos/PvE/Content/Variant.cs index 4e7d4e23f..8f31b9a04 100644 --- a/XIVSlothCombo/Combos/PvE/Content/Variant.cs +++ b/XIVSlothCombo/Combos/PvE/Content/Variant.cs @@ -1,4 +1,4 @@ -using XIVSlothCombo.Services; +using ECommons.DalamudServices; namespace XIVSlothCombo.Combos.PvE.Content { @@ -11,21 +11,21 @@ public const uint //1069 = The Sil'dihn Subterrane //1137 = Mount Rokkon //1176 = Aloalo Island - public static uint VariantCure => Service.ClientState.TerritoryType switch + public static uint VariantCure => Svc.ClientState.TerritoryType switch { 1069 => 29729, 1137 or 1176 => 33862, _ => 0 }; - public static uint VariantSpiritDart => Service.ClientState.TerritoryType switch + public static uint VariantSpiritDart => Svc.ClientState.TerritoryType switch { 1069 => 29732, 1137 or 1176 => 33863, _ => 0 }; - public static uint VariantRampart => Service.ClientState.TerritoryType switch + public static uint VariantRampart => Svc.ClientState.TerritoryType switch { 1069 => 29733, 1137 or 1176 => 33864, diff --git a/XIVSlothCombo/Combos/PvE/DOL.cs b/XIVSlothCombo/Combos/PvE/DOL.cs index 9bd4dd632..365bfddd6 100644 --- a/XIVSlothCombo/Combos/PvE/DOL.cs +++ b/XIVSlothCombo/Combos/PvE/DOL.cs @@ -21,7 +21,7 @@ internal const uint Triangulate = 210, ArborCall = 211, ArborCall2 = 290, - TruthOfForests = 221, + TruthOfForests = 221, //FSH Cast = 289, Hook = 296, @@ -89,17 +89,17 @@ protected override uint Invoke(uint actionID, uint lastComboMove, float comboTim internal class FSH_CastHook : CustomCombo { protected internal override CustomComboPreset Preset { get; } = CustomComboPreset.FSH_CastHook; - protected override uint Invoke(uint actionID, uint lastComboMove, float comboTime, byte level) + protected override uint Invoke(uint actionID, uint lastComboMove, float comboTime, byte level) => actionID is Cast && HasCondition(ConditionFlag.Fishing) ? Hook : actionID; } - + internal class FSH_Swim : CustomCombo { protected internal override CustomComboPreset Preset { get; } = CustomComboPreset.FSH_Swim; protected override uint Invoke(uint actionID, uint lastComboMove, float comboTime, byte level) { if (HasCondition(ConditionFlag.Diving)) - { + { if (actionID is Cast && IsEnabled(CustomComboPreset.FSH_CastGig)) return Gig; if (actionID is SurfaceSlap && IsEnabled(CustomComboPreset.FSH_SurfaceTrade)) return VeteranTrade; if (actionID is PrizeCatch && IsEnabled(CustomComboPreset.FSH_PrizeBounty)) return NaturesBounty; diff --git a/XIVSlothCombo/Combos/PvE/DRG.cs b/XIVSlothCombo/Combos/PvE/DRG.cs index 8b9d84867..bbdfe6a80 100644 --- a/XIVSlothCombo/Combos/PvE/DRG.cs +++ b/XIVSlothCombo/Combos/PvE/DRG.cs @@ -1,4 +1,3 @@ -using System; using Dalamud.Game.ClientState.JobGauge.Types; using Dalamud.Game.ClientState.Statuses; using XIVSlothCombo.Combos.JobHelpers; diff --git a/XIVSlothCombo/Combos/PvE/DRK.cs b/XIVSlothCombo/Combos/PvE/DRK.cs index 59b919654..b3cf4d9b7 100644 --- a/XIVSlothCombo/Combos/PvE/DRK.cs +++ b/XIVSlothCombo/Combos/PvE/DRK.cs @@ -1,13 +1,10 @@ -using System.Diagnostics.CodeAnalysis; using Dalamud.Game.ClientState.JobGauge.Types; -using Dalamud.Game.ClientState.Statuses; using XIVSlothCombo.Combos.PvE.Content; using XIVSlothCombo.Core; using XIVSlothCombo.CustomComboNS; namespace XIVSlothCombo.Combos.PvE { - [SuppressMessage("ReSharper", "MemberCanBePrivate.Global")] internal static class DRK { public const byte JobID = 32; @@ -56,7 +53,6 @@ public const uint #endregion - [SuppressMessage("ReSharper", "MemberHidesStaticFromOuterClass")] public static class Buffs { public const ushort @@ -79,7 +75,6 @@ public const ushort Placeholder = 1; } - [SuppressMessage("ReSharper", "InconsistentNaming")] public static class Config { public const string diff --git a/XIVSlothCombo/Combos/PvE/GNB.cs b/XIVSlothCombo/Combos/PvE/GNB.cs index 6a912eb2d..f7c018b90 100644 --- a/XIVSlothCombo/Combos/PvE/GNB.cs +++ b/XIVSlothCombo/Combos/PvE/GNB.cs @@ -1,11 +1,7 @@ -using System; using Dalamud.Game.ClientState.JobGauge.Types; using Dalamud.Game.ClientState.Statuses; -using FFXIVClientStructs.FFXIV.Client.UI; using XIVSlothCombo.Combos.PvE.Content; -using XIVSlothCombo.Core; using XIVSlothCombo.CustomComboNS; -using XIVSlothCombo.Data; namespace XIVSlothCombo.Combos.PvE { @@ -267,7 +263,7 @@ protected override uint Invoke(uint actionID, uint lastComboMove, float comboTim // Gnashing Fang if (IsEnabled(CustomComboPreset.GNB_ST_Gnashing) && LevelChecked(GnashingFang)) { - if (IsEnabled(CustomComboPreset.GNB_ST_GnashingFang_Starter) && GetCooldownRemainingTime(GnashingFang) <= 0.5 && !HasEffect(Buffs.ReadyToBlast) && gauge.AmmoComboStep == 0 && + if (IsEnabled(CustomComboPreset.GNB_ST_GnashingFang_Starter) && GetCooldownRemainingTime(GnashingFang) <= 0.5 && !HasEffect(Buffs.ReadyToBlast) && gauge.AmmoComboStep == 0 && ((HasEffect(Buffs.NoMercy) && WasLastWeaponskill(DoubleDown)) // 60s use; DD>GF (as of 7.0 DT) || (gauge.Ammo == 1 && HasEffect(Buffs.NoMercy) && GetCooldownRemainingTime(DoubleDown) > GCD * 4) //NMDDGF windows/Scuffed windows || (gauge.Ammo > 0 && GetCooldownRemainingTime(NoMercy) > GCD * 7 && GetCooldownRemainingTime(NoMercy) < GCD * 14) // 30s use @@ -295,7 +291,7 @@ protected override uint Invoke(uint actionID, uint lastComboMove, float comboTim { if (HasEffect(Buffs.NoMercy)) { - if (!LevelChecked(ReignOfBeasts) + if (!LevelChecked(ReignOfBeasts) && gauge.Ammo >= 1 && gauge.AmmoComboStep == 0 && GetCooldownRemainingTime(NoMercy) <= GCD * 3 && !HasEffect(Buffs.ReadyToReign) && !HasEffect(Buffs.ReadyToBreak) diff --git a/XIVSlothCombo/Combos/PvE/MNK.cs b/XIVSlothCombo/Combos/PvE/MNK.cs index d6e625661..4fe8e62f2 100644 --- a/XIVSlothCombo/Combos/PvE/MNK.cs +++ b/XIVSlothCombo/Combos/PvE/MNK.cs @@ -1,7 +1,7 @@ -using System; -using System.Linq; using Dalamud.Game.ClientState.JobGauge.Enums; using Dalamud.Game.ClientState.JobGauge.Types; +using System; +using System.Linq; using XIVSlothCombo.Combos.PvE.Content; using XIVSlothCombo.Core; using XIVSlothCombo.CustomComboNS; @@ -233,7 +233,7 @@ protected override uint Invoke(uint actionID, uint lastComboMove, float comboTim if (HasEffect(Buffs.RaptorForm)) { if (FourPointFury.LevelChecked()) - return FourPointFury; + return FourPointFury; if (TwinSnakes.LevelChecked()) return TwinSnakes; @@ -562,7 +562,7 @@ protected override uint Invoke(uint actionID, uint lastComboMove, float comboTim if (canWeave) { - if (IsEnabled(CustomComboPreset.MNK_ST_Simple_Meditation) && level >= Levels.Meditation && gauge.Chakra == 5 && (HasEffect(Buffs.DisciplinedFist) || level < Levels.TwinSnakes)) + if (IsEnabled(CustomComboPreset.MNK_ST_Simple_Meditation) && level >= Levels.Meditation && gauge.Chakra == 5 && (HasEffect(Buffs.DisciplinedFist) || level < Levels.TwinSnakes)) { if (level < Levels.RiddleOfFire || !IsEnabled(CustomComboPreset.MNK_ST_Simple_CDs) || (GetCooldownRemainingTime(RiddleOfFire) >= 1.5 && IsOnCooldown(RiddleOfFire) && lastComboMove != RiddleOfFire)) { @@ -637,7 +637,7 @@ protected override uint Invoke(uint actionID, uint lastComboMove, float comboTim if (!HasEffect(Buffs.FormlessFist) && HasEffect(Buffs.RaptorForm)) { - if (!LevelChecked(TrueStrike)) + if (!LevelChecked(TrueStrike)) { return Bootshine; } diff --git a/XIVSlothCombo/Combos/PvE/NIN.cs b/XIVSlothCombo/Combos/PvE/NIN.cs index 15b5e01ee..58976b453 100644 --- a/XIVSlothCombo/Combos/PvE/NIN.cs +++ b/XIVSlothCombo/Combos/PvE/NIN.cs @@ -347,7 +347,7 @@ protected override uint Invoke(uint actionID, uint lastComboMove, float comboTim if (IsEnabled(CustomComboPreset.NIN_ST_AdvancedMode_Ninjitsus)) { if (IsEnabled(CustomComboPreset.NIN_ST_AdvancedMode_Ninjitsus_Suiton) && - setupSuitonWindow && + setupSuitonWindow && TrickAttack.LevelChecked() && !HasEffect(Buffs.Suiton) && chargeCheck && diff --git a/XIVSlothCombo/Combos/PvE/PLD.cs b/XIVSlothCombo/Combos/PvE/PLD.cs index 29d2be72a..961e90ea2 100644 --- a/XIVSlothCombo/Combos/PvE/PLD.cs +++ b/XIVSlothCombo/Combos/PvE/PLD.cs @@ -87,8 +87,8 @@ public static UserInt //PLD_AoE_RequiescatWeave = new("PLD_AoE_RequiescatWeave"), //PLD_ST_AtonementTiming = new("PLD_ST_EquilibriumTiming"), //PLD_ST_DivineMightTiming = new("PLD_ST_DivineMightTiming"), - PLD_Intervene_MeleeOnly = new ("PLD_Intervene_MeleeOnly", 1), - PLD_ShieldLob_SubOption = new ("PLD_ShieldLob_SubOption", 1); + PLD_Intervene_MeleeOnly = new("PLD_Intervene_MeleeOnly", 1), + PLD_ShieldLob_SubOption = new("PLD_ShieldLob_SubOption", 1); } internal class PLD_ST_SimpleMode : CustomCombo diff --git a/XIVSlothCombo/Combos/PvE/RDM.cs b/XIVSlothCombo/Combos/PvE/RDM.cs index 2a93d51df..6efd611b6 100644 --- a/XIVSlothCombo/Combos/PvE/RDM.cs +++ b/XIVSlothCombo/Combos/PvE/RDM.cs @@ -81,7 +81,7 @@ public static class Debuffs // public const short placeholder = 0; } - + public static class Traits { @@ -89,15 +89,15 @@ public const uint EnhancedEmbolden = 620, EnhancedManaficationII = 622, EnhancedManaficationIII = 622, - EnhancedAccelerationII = 624; + EnhancedAccelerationII = 624; } public static class Config { public static UserInt RDM_VariantCure = new("RDM_VariantCure"), - RDM_ST_Lucid_Threshold = new("RDM_LucidDreaming_Threshold",6500), - RDM_AoE_Lucid_Threshold = new("RDM_AoE_Lucid_Threshold",6500), + RDM_ST_Lucid_Threshold = new("RDM_LucidDreaming_Threshold", 6500), + RDM_AoE_Lucid_Threshold = new("RDM_AoE_Lucid_Threshold", 6500), RDM_AoE_MoulinetRange = new("RDM_MoulinetRange"); public static UserBool RDM_ST_oGCD_OnAction_Adv = new("RDM_ST_oGCD_OnAction_Adv"), @@ -541,7 +541,7 @@ protected override uint Invoke(uint actionID, uint lastComboMove, float comboTim { //Run the Mana Balance Computer var actions = RDMMana.CheckBalance(); - + if (actions.useAero && LevelChecked(OriginalHook(Veraero))) return OriginalHook(Veraero); if (actions.useThunder && LevelChecked(OriginalHook(Verthunder))) return OriginalHook(Verthunder); } @@ -549,7 +549,7 @@ protected override uint Invoke(uint actionID, uint lastComboMove, float comboTim if (HasCharges(Acceleration)) return Acceleration; } if (GetTargetDistance() <= 3) - return OriginalHook(Riposte); + return OriginalHook(Riposte); } } @@ -586,7 +586,7 @@ protected override uint Invoke(uint actionID, uint lastComboMove, float comboTim { if (TraitLevelChecked(Traits.EnhancedAccelerationII) && HasEffect(Buffs.GrandImpactReady)) - return GrandImpact; + return GrandImpact; //RDM_VERFIREVERSTONE if (IsEnabled(CustomComboPreset.RDM_ST_FireStone) @@ -609,7 +609,7 @@ protected override uint Invoke(uint actionID, uint lastComboMove, float comboTim if (actions.useAero) return OriginalHook(Veraero); } //END_RDM_VERTHUNDERVERAERO - + } //NO_CONDITIONS_MET @@ -677,10 +677,10 @@ actionID is Scatter or Impact && if (ActionFound) { //Finish the combo - if (LevelChecked(Moulinet) + if (LevelChecked(Moulinet) && lastComboMove is EnchantedMoulinet or EnchantedMoulinetDeux && comboTime > 0f) - return OriginalHook(Moulinet); + return OriginalHook(Moulinet); //RDM_AOE_MANAFICATIONEMBOLDEN if (IsEnabled(CustomComboPreset.RDM_AoE_MeleeCombo_ManaEmbolden)) @@ -750,7 +750,7 @@ actionID is Scatter or Impact && // int ManaBuff = GetBuffStacks(Buffs.MagickedSwordPlay); // if (ManaBuff > 0) Mana = 50; //ITS FREE REAL ESTATE //} - + if (LevelChecked(Moulinet) && LocalPlayer.IsCasting == false && !HasEffect(Buffs.Dualcast) @@ -804,7 +804,7 @@ actionID is Scatter or Impact && if (TraitLevelChecked(Traits.EnhancedAccelerationII) && HasEffect(Buffs.GrandImpactReady)) - return GrandImpact; + return GrandImpact; var actions = RDMMana.CheckBalance(); if (actions.useThunder2) return OriginalHook(Verthunder2); diff --git a/XIVSlothCombo/Combos/PvE/SAM.cs b/XIVSlothCombo/Combos/PvE/SAM.cs index 5f04d5a29..6fdb43b8d 100644 --- a/XIVSlothCombo/Combos/PvE/SAM.cs +++ b/XIVSlothCombo/Combos/PvE/SAM.cs @@ -151,7 +151,7 @@ protected override uint Invoke(uint actionID, uint lastComboMove, float comboTim var enemyHP = GetTargetHPPercent(); bool openerReady = GetRemainingCharges(MeikyoShisui) == 1 && IsOffCooldown(Senei) && IsOffCooldown(Ikishoten) && GetRemainingCharges(TsubameGaeshi) == 2; - + if (!InCombat()) { hasDied = false; @@ -665,7 +665,7 @@ protected override uint Invoke(uint actionID, uint lastComboMove, float comboTim { if (IsEnabled(CustomComboPreset.SAM_AoE_MangetsuCombo_Hagakure) && OriginalHook(Iaijutsu) == Setsugekka && LevelChecked(Hagakure)) return Hagakure; - + if (IsEnabled(CustomComboPreset.SAM_AoE_MangetsuCombo_Guren) && ActionReady(Guren) && gauge.Kenki >= 25) return Guren; diff --git a/XIVSlothCombo/Combos/PvE/SCH.cs b/XIVSlothCombo/Combos/PvE/SCH.cs index 8d966b489..3b5113bbf 100644 --- a/XIVSlothCombo/Combos/PvE/SCH.cs +++ b/XIVSlothCombo/Combos/PvE/SCH.cs @@ -40,7 +40,7 @@ internal const uint EnergyDrain = 167, ArtOfWar = 16539, ArtOfWarII = 25866, - BanefulImpaction = 37012, + BanefulImpaction = 37012, // Faerie SummonSeraph = 16545, @@ -132,8 +132,8 @@ public static UserInt public static UserBool SCH_ST_Heal_Adv = new("SCH_ST_Heal_Adv"), SCH_ST_Heal_UIMouseOver = new("SCH_ST_Heal_UIMouseOver"), - SCH_DeploymentTactics_Adv = new ("SCH_DeploymentTactics_Adv"), - SCH_DeploymentTactics_UIMouseOver = new ("SCH_DeploymentTactics_UIMouseOver"); + SCH_DeploymentTactics_Adv = new("SCH_DeploymentTactics_Adv"), + SCH_DeploymentTactics_UIMouseOver = new("SCH_DeploymentTactics_UIMouseOver"); #endregion #region Utility @@ -343,8 +343,8 @@ protected override uint Invoke(uint actionID, uint lastComboMove, float comboTim openerState = OpenerState.InOpener; } - if (IsEnabled(CustomComboPreset.SCH_DPS_Variant_Rampart) && - IsEnabled(Variant.VariantRampart) && + if (IsEnabled(CustomComboPreset.SCH_DPS_Variant_Rampart) && + IsEnabled(Variant.VariantRampart) && IsOffCooldown(Variant.VariantRampart) && CanSpellWeave(actionID)) return Variant.VariantRampart; @@ -398,28 +398,25 @@ protected override uint Invoke(uint actionID, uint lastComboMove, float comboTim HasEffect(Buffs.ImpactImminent) && InCombat() && CanSpellWeave(actionID)) - return BanefulImpaction; + return BanefulImpaction; // Don't use OriginalHook(ChainStratagem), because player can disable ingame action replacement } - + //Bio/Biolysis - if (IsEnabled(CustomComboPreset.SCH_DPS_Bio) && LevelChecked(Bio) && InCombat()) + if (IsEnabled(CustomComboPreset.SCH_DPS_Bio) && LevelChecked(Bio) && InCombat() && + BioList.TryGetValue(OriginalHook(Bio), out ushort dotDebuffID)) { - uint dot = OriginalHook(Bio); //Grab the appropriate DoT Action - Status? dotDebuff = FindTargetEffect(BioList[dot]); //Match it with it's Debuff ID, and check for the Debuff - Status? sustainedDamage = FindTargetEffect(Variant.Debuffs.SustainedDamage); - float refreshtimer = Config.SCH_ST_DPS_Bio_Adv ? Config.SCH_ST_DPS_Bio_Threshold : 3; - - if (IsEnabled(CustomComboPreset.SCH_DPS_Variant_SpiritDart) && - IsEnabled(Variant.VariantSpiritDart) && - (sustainedDamage is null || sustainedDamage?.RemainingTime <= 3) && + if (IsEnabled(CustomComboPreset.SCH_DPS_Variant_SpiritDart) && + IsEnabled(Variant.VariantSpiritDart) && + GetDebuffRemainingTime(Variant.Debuffs.SustainedDamage) <= 3 && CanSpellWeave(actionID)) return Variant.VariantSpiritDart; - if ((dotDebuff is null || dotDebuff?.RemainingTime <= refreshtimer) && + float refreshtimer = Config.SCH_ST_DPS_Bio_Adv ? Config.SCH_ST_DPS_Bio_Threshold : 3; + if (GetDebuffRemainingTime(dotDebuffID) <= refreshtimer && GetTargetHPPercent() > Config.SCH_ST_DPS_BioOption) - return dot; //Use appropriate DoT Action + return OriginalHook(Bio); //Use appropriate DoT Action } //Ruin 2 Movement @@ -444,16 +441,16 @@ protected override uint Invoke(uint actionID, uint lastComboMove, float comboTim { if (actionID is ArtOfWar or ArtOfWarII) { - if (IsEnabled(CustomComboPreset.SCH_DPS_Variant_Rampart) && - IsEnabled(Variant.VariantRampart) && + if (IsEnabled(CustomComboPreset.SCH_DPS_Variant_Rampart) && + IsEnabled(Variant.VariantRampart) && IsOffCooldown(Variant.VariantRampart) && CanSpellWeave(actionID)) return Variant.VariantRampart; Status? sustainedDamage = FindTargetEffect(Variant.Debuffs.SustainedDamage); - if (IsEnabled(CustomComboPreset.SCH_DPS_Variant_SpiritDart) && - IsEnabled(Variant.VariantSpiritDart) && - (sustainedDamage is null || sustainedDamage?.RemainingTime <= 3) && + if (IsEnabled(CustomComboPreset.SCH_DPS_Variant_SpiritDart) && + IsEnabled(Variant.VariantSpiritDart) && + (sustainedDamage is null || sustainedDamage?.RemainingTime <= 3) && HasBattleTarget() && CanSpellWeave(actionID)) return Variant.VariantSpiritDart; @@ -509,7 +506,7 @@ protected override uint Invoke(uint actionID, uint lastComboMove, float comboTim return actionID; } } - + /* * SCH_Fairy_Combo * Overrides Whispering Dawn @@ -534,12 +531,12 @@ protected override uint Invoke(uint actionID, uint lastComboMove, float comboTim return OriginalHook(actionID); if (IsEnabled(CustomComboPreset.SCH_Fairy_Combo_Consolation) && Gauge.SeraphTimer > 0 && GetRemainingCharges(Consolation) > 0) - return OriginalHook(Consolation); + return OriginalHook(Consolation); } return actionID; } } - + /* * SCH_ST_Heal * Overrides main AoE Healing abiility, Succor @@ -580,10 +577,10 @@ protected override uint Invoke(uint actionID, uint lastComboMove, float comboTim { return OriginalHook(Adloquium); } - + //Cast Lustrate if you have Aetherflow and Target HP is below % if (IsEnabled(CustomComboPreset.SCH_ST_Heal_Lustrate) && - ActionReady(Lustrate) && + ActionReady(Lustrate) && Gauge.HasAetherflow() && GetTargetHPPercent(healTarget) <= Config.SCH_ST_Heal_LustrateOption) { diff --git a/XIVSlothCombo/Combos/PvE/SGE.cs b/XIVSlothCombo/Combos/PvE/SGE.cs index e939b4b3b..e71e99c8b 100644 --- a/XIVSlothCombo/Combos/PvE/SGE.cs +++ b/XIVSlothCombo/Combos/PvE/SGE.cs @@ -1,6 +1,7 @@ using Dalamud.Game.ClientState.JobGauge.Types; using Dalamud.Game.ClientState.Objects.Types; using Dalamud.Game.ClientState.Statuses; +using System; using System.Collections.Generic; using System.Linq; using XIVSlothCombo.Combos.PvE.Content; @@ -254,16 +255,13 @@ protected override uint Invoke(uint actionID, uint lastComboMove, float comboTim !WasLastSpell(EukrasianDyskrasia) && //AoE DoT can be slow to take affect, doesn't apply to target first before others TraitLevelChecked(Traits.OffensiveMagicMasteryII) && HasBattleTarget() && - InActionRange(Dyskrasia)) //Same range + InActionRange(Dyskrasia) && //Same range + DosisList.TryGetValue(OriginalHook(Dosis), out ushort dotDebuffID)) { - Status? dosisDebuff = FindTargetEffect(Debuffs.EukrasianDosis3); - Status? dyskrasiaDebuff = FindTargetEffect(Debuffs.EukrasianDyskrasia); - Status? dotDebuff = dosisDebuff ?? dyskrasiaDebuff; - + float dotDebuff = Math.Max(GetDebuffRemainingTime(dotDebuffID), GetDebuffRemainingTime(Debuffs.EukrasianDyskrasia)); float refreshtimer = 3; //Will revisit if it's really needed....SGE_ST_DPS_EDosis_Adv ? Config.SGE_ST_DPS_EDosisThreshold : 3; - - if ((dotDebuff is null || dotDebuff.RemainingTime <= refreshtimer) && - GetTargetHPPercent() > 10)//Will Revisit if Config is neededConfig.SGE_ST_DPS_EDosisHPPer) + if (dotDebuff <= refreshtimer && + GetTargetHPPercent() > 10)//Will Revisit if Config is needed Config.SGE_ST_DPS_EDosisHPPer) return Eukrasia; } } @@ -284,10 +282,10 @@ protected override uint Invoke(uint actionID, uint lastComboMove, float comboTim uint PhlegmaID = OriginalHook(Phlegma); if (ActionReady(PhlegmaID) && HasBattleTarget() && - InActionRange(PhlegmaID)) + InActionRange(PhlegmaID)) return PhlegmaID; } - + //Toxikon if (IsEnabled(CustomComboPreset.SGE_AoE_DPS_Toxikon)) { @@ -317,7 +315,7 @@ internal class SGE_ST_DPS : CustomCombo protected override uint Invoke(uint actionID, uint lastComboMove, float comboTime, byte level) { bool ActionFound = actionID is Dosis2 || (!Config.SGE_ST_DPS_Adv && DosisList.ContainsKey(actionID)); - + if (ActionFound) { // Kardia Reminder @@ -360,22 +358,21 @@ protected override uint Invoke(uint actionID, uint lastComboMove, float comboTim // EDosis will show for half a second if the buff is removed manually or some other act of God if (DosisList.TryGetValue(OriginalHook(actionID), out ushort dotDebuffID)) { - Status? sustainedDamage = FindTargetEffect(Variant.Debuffs.SustainedDamage); if (IsEnabled(CustomComboPreset.SGE_DPS_Variant_SpiritDart) && IsEnabled(Variant.VariantSpiritDart) && - (sustainedDamage is null || sustainedDamage?.RemainingTime <= 3) && + GetDebuffRemainingTime(Variant.Debuffs.SustainedDamage) <= 3 && CanSpellWeave(actionID)) return Variant.VariantSpiritDart; - Status? dosisDebuff = FindTargetEffect(dotDebuffID); - Status? dyskrasiaDebuff = null; - //If we have AoE DoT, go with it because St DoT overwrites - //Else search for the ST DoT - if (TraitLevelChecked(Traits.OffensiveMagicMasteryII)) dyskrasiaDebuff = FindTargetEffect(Debuffs.EukrasianDyskrasia); - Status? dotDebuff = dosisDebuff ?? dyskrasiaDebuff; + // Dosis DoT Debuff + float dotDebuff = GetDebuffRemainingTime(dotDebuffID); + // Check for the AoE DoT. These DoTs overlap, so get time remaining of any of them + if (TraitLevelChecked(Traits.OffensiveMagicMasteryII)) + dotDebuff = Math.Max(dotDebuff, GetDebuffRemainingTime(Debuffs.EukrasianDyskrasia)); + float refreshtimer = Config.SGE_ST_DPS_EDosis_Adv ? Config.SGE_ST_DPS_EDosisThreshold : 3; - if ((dotDebuff is null || dotDebuff.RemainingTime <= refreshtimer) && + if (dotDebuff <= refreshtimer && GetTargetHPPercent() > Config.SGE_ST_DPS_EDosisHPPer) return Eukrasia; } @@ -393,7 +390,7 @@ protected override uint Invoke(uint actionID, uint lastComboMove, float comboTim ActionReady(Psyche) && InCombat() && CanSpellWeave(actionID)) //ToDo: Verify - return Psyche; + return Psyche; // Movement Options @@ -521,7 +518,7 @@ protected override uint Invoke(uint actionID, uint lastComboMove, float comboTim if (actionID is Prognosis) { if (IsEnabled(CustomComboPreset.SGE_AoE_Heal_EPrognosis) && HasEffect(Buffs.Eukrasia)) - return OriginalHook(Prognosis); + return OriginalHook(Prognosis); if (IsEnabled(CustomComboPreset.SGE_AoE_Heal_Rhizomata) && ActionReady(Rhizomata) && !Gauge.HasAddersgall()) @@ -558,7 +555,7 @@ protected override uint Invoke(uint actionID, uint lastComboMove, float comboTim { if (HasEffectAny(Buffs.Kerachole) || (IsEnabled(CustomComboPreset.SGE_OverProtect_SacredSoil) && HasEffectAny(SCH.Buffs.SacredSoil))) - return SCH.SacredSoil; + return SCH.SacredSoil; } if (actionID is Panhaima && IsEnabled(CustomComboPreset.SGE_OverProtect_Panhaima) && diff --git a/XIVSlothCombo/Combos/PvE/SMN.cs b/XIVSlothCombo/Combos/PvE/SMN.cs index 6d2b82b9d..6f6680288 100644 --- a/XIVSlothCombo/Combos/PvE/SMN.cs +++ b/XIVSlothCombo/Combos/PvE/SMN.cs @@ -83,7 +83,7 @@ public const uint BrandOfPurgatory = 16515, // AoE Phoenix GCD Rekindle = 25830, // Healing oGCD Phoenix EnkindlePhoenix = 16516, - + UmbralImpulse = 36994, //Single target Solar Bahamut GCD UmbralFlare = 36995, //AoE Solar Bahamut GCD Sunflare = 36996, //Damage oGCD Solar Bahamut @@ -274,7 +274,7 @@ protected override uint Invoke(uint actionID, uint lastComboMove, float comboTim if (HasEffect(Buffs.RubysGlimmer) && LevelChecked(SearingFlash)) return SearingFlash; - + if (OriginalHook(Ruin) is AstralImpulse or UmbralImpulse or FountainOfFire) { if (IsOffCooldown(OriginalHook(EnkindleBahamut)) && LevelChecked(SummonBahamut)) @@ -285,7 +285,7 @@ protected override uint Invoke(uint actionID, uint lastComboMove, float comboTim if (IsOffCooldown(Rekindle) && OriginalHook(Ruin) is FountainOfFire) return OriginalHook(AstralFlow); - + if (IsOffCooldown(LuxSolaris) && HasEffect(Buffs.RefulgentLux)) return OriginalHook(LuxSolaris); } @@ -454,7 +454,7 @@ protected override uint Invoke(uint actionID, uint lastComboMove, float comboTim } // Emergency priority Demi Nuke to prevent waste if you can't get demi attacks out to satisfy the slider check. - if (OriginalHook(Ruin) is AstralImpulse or UmbralImpulse or FountainOfFire && + if (OriginalHook(Ruin) is AstralImpulse or UmbralImpulse or FountainOfFire && IsEnabled(CustomComboPreset.SMN_Advanced_Combo_DemiSummons_Attacks) && GetCooldown(OriginalHook(Aethercharge)).CooldownElapsed >= 12.5) { if (IsEnabled(CustomComboPreset.SMN_Advanced_Combo_DemiSummons_Attacks)) @@ -467,7 +467,7 @@ protected override uint Invoke(uint actionID, uint lastComboMove, float comboTim if (IsOffCooldown(OriginalHook(EnkindlePhoenix)) && LevelChecked(SummonPhoenix)) return OriginalHook(EnkindlePhoenix); - + if (IsEnabled(CustomComboPreset.SMN_Advanced_Combo_DemiSummons_Rekindle)) if (IsOffCooldown(Rekindle) && OriginalHook(Ruin) is FountainOfFire) return OriginalHook(AstralFlow); @@ -528,11 +528,11 @@ protected override uint Invoke(uint actionID, uint lastComboMove, float comboTim { if (IsOffCooldown(OriginalHook(EnkindlePhoenix)) && LevelChecked(SummonPhoenix) && OriginalHook(Ruin) is FountainOfFire) return OriginalHook(EnkindlePhoenix); - + if (IsOffCooldown(Rekindle) && IsEnabled(CustomComboPreset.SMN_Advanced_Combo_DemiSummons_Rekindle) && OriginalHook(Ruin) is FountainOfFire) return OriginalHook(AstralFlow); } - + // Demi Nuke 3: More Boogaloo if (IsEnabled(CustomComboPreset.SMN_Advanced_Combo_DemiSummons_Attacks) && IsSolarBahamutReady && DemiAttackCount >= burstDelay) { @@ -541,7 +541,7 @@ protected override uint Invoke(uint actionID, uint lastComboMove, float comboTim if (IsOffCooldown(Sunflare) && LevelChecked(Sunflare) && OriginalHook(Ruin) is UmbralImpulse) return OriginalHook(AstralFlow); - + if (IsOffCooldown(LuxSolaris) && IsEnabled(CustomComboPreset.SMN_Advanced_Combo_DemiSummons_LuxSolaris) && HasEffect(Buffs.RefulgentLux)) return OriginalHook(LuxSolaris); } @@ -793,10 +793,10 @@ protected override uint Invoke(uint actionID, uint lastComboMove, float comboTim if (IsOffCooldown(EnkindleSolarBahamut) && OriginalHook(Ruin) is UmbralImpulse) return OriginalHook(EnkindleBahamut); - + if ((OriginalHook(AstralFlow) is Deathflare && IsOffCooldown(Deathflare)) || (OriginalHook(AstralFlow) is Rekindle && IsOffCooldown(Rekindle))) return OriginalHook(AstralFlow); - + if (OriginalHook(AstralFlow) is Sunflare && IsOffCooldown(Sunflare)) return OriginalHook(Sunflare); } diff --git a/XIVSlothCombo/Combos/PvE/WAR.cs b/XIVSlothCombo/Combos/PvE/WAR.cs index d9bfab2e5..a513ced63 100644 --- a/XIVSlothCombo/Combos/PvE/WAR.cs +++ b/XIVSlothCombo/Combos/PvE/WAR.cs @@ -3,7 +3,6 @@ using XIVSlothCombo.Combos.PvE.Content; using XIVSlothCombo.Core; using XIVSlothCombo.CustomComboNS; -using XIVSlothCombo.Extensions; namespace XIVSlothCombo.Combos.PvE { diff --git a/XIVSlothCombo/Combos/PvE/WHM.cs b/XIVSlothCombo/Combos/PvE/WHM.cs index f2b3619d7..b664b4ff7 100644 --- a/XIVSlothCombo/Combos/PvE/WHM.cs +++ b/XIVSlothCombo/Combos/PvE/WHM.cs @@ -6,7 +6,6 @@ using XIVSlothCombo.CustomComboNS; using XIVSlothCombo.CustomComboNS.Functions; using XIVSlothCombo.Data; -using Status = Dalamud.Game.ClientState.Statuses.Status; namespace XIVSlothCombo.Combos.PvE { @@ -122,7 +121,7 @@ internal static UserFloat public static UserBoolArray WHM_ST_MainCombo_Adv_Actions = new("WHM_ST_MainCombo_Adv_Actions"); } - + internal class WHM_SolaceMisery : CustomCombo { protected internal override CustomComboPreset Preset { get; } = CustomComboPreset.WHM_SolaceMisery; @@ -234,7 +233,7 @@ protected override uint Invoke(uint actionID, uint lastComboMove, float comboTim return OriginalHook(PresenceOfMind); if (ActionReady(Assize)) - return Assize; + return Assize; } if (Glare3Count > 0) @@ -267,21 +266,18 @@ protected override uint Invoke(uint actionID, uint lastComboMove, float comboTim if (InCombat()) { // DoTs - if (IsEnabled(CustomComboPreset.WHM_ST_MainCombo_DoT) && LevelChecked(Aero) && HasBattleTarget()) + if (IsEnabled(CustomComboPreset.WHM_ST_MainCombo_DoT) && LevelChecked(Aero) && HasBattleTarget() && + AeroList.TryGetValue(OriginalHook(Aero), out ushort dotDebuffID)) { - Status? sustainedDamage = FindTargetEffect(Variant.Debuffs.SustainedDamage); if (IsEnabled(CustomComboPreset.WHM_DPS_Variant_SpiritDart) && IsEnabled(Variant.VariantSpiritDart) && - (sustainedDamage is null || sustainedDamage?.RemainingTime <= 3) && + GetDebuffRemainingTime(Variant.Debuffs.SustainedDamage) <= 3 && CanSpellWeave(actionID)) return Variant.VariantSpiritDart; - uint dot = OriginalHook(Aero); //Grab the appropriate DoT Action - Status? dotDebuff = FindTargetEffect(AeroList[dot]); //Match it with it's Debuff ID, and check for the Debuff - // DoT Uptime & HP% threshold float refreshtimer = Config.WHM_ST_MainCombo_DoT_Adv ? Config.WHM_ST_MainCombo_DoT_Threshold : 3; - if ((dotDebuff is null || dotDebuff.RemainingTime <= refreshtimer) && + if (GetDebuffRemainingTime(dotDebuffID) <= refreshtimer && GetTargetHPPercent() > Config.WHM_STDPS_MainCombo_DoT) return OriginalHook(Aero); } @@ -446,10 +442,9 @@ protected override uint Invoke(uint actionID, uint lastComboMove, float comboTim IsOffCooldown(Variant.VariantRampart)) return Variant.VariantRampart; - Status? sustainedDamage = FindTargetEffect(Variant.Debuffs.SustainedDamage); if (IsEnabled(CustomComboPreset.WHM_DPS_Variant_SpiritDart) && IsEnabled(Variant.VariantSpiritDart) && - (sustainedDamage is null || sustainedDamage?.RemainingTime <= 3) && + GetDebuffRemainingTime(Variant.Debuffs.SustainedDamage) <= 3 && HasBattleTarget()) return Variant.VariantSpiritDart; diff --git a/XIVSlothCombo/Combos/PvP/BRDPVP.cs b/XIVSlothCombo/Combos/PvP/BRDPVP.cs index 7ae4df739..35ff4cc78 100644 --- a/XIVSlothCombo/Combos/PvP/BRDPVP.cs +++ b/XIVSlothCombo/Combos/PvP/BRDPVP.cs @@ -32,7 +32,7 @@ internal class BRDPvP_BurstMode : CustomCombo protected override uint Invoke(uint actionID, uint lastComboMove, float comboTime, byte level) { - + if (actionID == PowerfulShot) { var canWeave = CanWeave(actionID, 0.5); @@ -57,7 +57,7 @@ protected override uint Invoke(uint actionID, uint lastComboMove, float comboTim return OriginalHook(PowerfulShot); } - + return actionID; } } diff --git a/XIVSlothCombo/Combos/PvP/GNBPVP.cs b/XIVSlothCombo/Combos/PvP/GNBPVP.cs index 9ca26538d..08f9e0e7f 100644 --- a/XIVSlothCombo/Combos/PvP/GNBPVP.cs +++ b/XIVSlothCombo/Combos/PvP/GNBPVP.cs @@ -1,5 +1,4 @@ -using XIVSlothCombo.Combos.PvE; -using XIVSlothCombo.CustomComboNS; +using XIVSlothCombo.CustomComboNS; namespace XIVSlothCombo.Combos.PvP { diff --git a/XIVSlothCombo/Combos/PvP/PLDPVP.cs b/XIVSlothCombo/Combos/PvP/PLDPVP.cs index d132986f2..08910b9d3 100644 --- a/XIVSlothCombo/Combos/PvP/PLDPVP.cs +++ b/XIVSlothCombo/Combos/PvP/PLDPVP.cs @@ -30,11 +30,11 @@ protected override uint Invoke(uint actionID, uint lastComboMove, float comboTim if (IsEnabled(CustomComboPreset.PLDPvP_ShieldBash) && InCombat() && IsOffCooldown(ShieldBash) && CanWeave(actionID)) return ShieldBash; - + if (IsEnabled(CustomComboPreset.PLDPvP_Confiteor)) { - if (IsOffCooldown(Confiteor)) - return Confiteor; + if (IsOffCooldown(Confiteor)) + return Confiteor; } } diff --git a/XIVSlothCombo/Combos/PvP/SAMPVP.cs b/XIVSlothCombo/Combos/PvP/SAMPVP.cs index eb56dd1c6..475e048a4 100644 --- a/XIVSlothCombo/Combos/PvP/SAMPVP.cs +++ b/XIVSlothCombo/Combos/PvP/SAMPVP.cs @@ -53,7 +53,7 @@ internal class SAMPvP_BurstMode : CustomCombo protected override uint Invoke(uint actionID, uint lastComboMove, float comboTime, byte level) { var sotenCharges = PluginConfiguration.GetCustomIntValue(Config.SAMPvP_SotenCharges); - + if ((IsNotEnabled(CustomComboPreset.SAMPvP_BurstMode_MainCombo) && actionID == MeikyoShisui) || (IsEnabled(CustomComboPreset.SAMPvP_BurstMode_MainCombo) && actionID is Yukikaze or Gekko or Kasha or Hyosetsu or Oka or Mangetsu)) { diff --git a/XIVSlothCombo/Combos/PvP/SMNPvP.cs b/XIVSlothCombo/Combos/PvP/SMNPvP.cs index 1338a2c26..815bee246 100644 --- a/XIVSlothCombo/Combos/PvP/SMNPvP.cs +++ b/XIVSlothCombo/Combos/PvP/SMNPvP.cs @@ -95,7 +95,7 @@ protected override uint Invoke(uint actionID, uint lastComboMove, float comboTim if (IsOffCooldown(CrimsonCyclone) && InMeleeRange()) return CrimsonCyclone; } - + // Garuda if (IsOffCooldown(Slipstream)) return Slipstream; diff --git a/XIVSlothCombo/Core/IconReplacer.cs b/XIVSlothCombo/Core/IconReplacer.cs index 6f0b4c329..2f24d2f06 100644 --- a/XIVSlothCombo/Core/IconReplacer.cs +++ b/XIVSlothCombo/Core/IconReplacer.cs @@ -1,10 +1,11 @@ +using Dalamud.Hooking; +using ECommons.DalamudServices; +using FFXIVClientStructs.FFXIV.Client.Game; +using FFXIVClientStructs.FFXIV.Client.Game.UI; using System; using System.Collections.Generic; using System.Linq; using System.Reflection; -using Dalamud.Hooking; -using FFXIVClientStructs.FFXIV.Client.Game; -using FFXIVClientStructs.FFXIV.Client.Game.UI; using XIVSlothCombo.CustomComboNS; using XIVSlothCombo.Services; @@ -30,8 +31,8 @@ public IconReplacer() .OrderByDescending(x => x.Preset) .ToList(); - getIconHook = Service.GameInteropProvider.HookFromAddress((nint)ActionManager.Addresses.GetAdjustedActionId.Value, GetIconDetour); - isIconReplaceableHook = Service.GameInteropProvider.HookFromAddress(Service.Address.IsActionIdReplaceable, IsIconReplaceableDetour); + getIconHook = Svc.Hook.HookFromAddress((nint)ActionManager.Addresses.GetAdjustedActionId.Value, GetIconDetour); + isIconReplaceableHook = Svc.Hook.HookFromAddress(Service.Address.IsActionIdReplaceable, IsIconReplaceableDetour); getIconHook.Enable(); isIconReplaceableHook.Enable(); @@ -59,17 +60,17 @@ private unsafe uint GetIconDetour(IntPtr actionManager, uint actionID) try { - if (Service.ClientState.LocalPlayer == null) + if (Svc.ClientState.LocalPlayer == null) return OriginalHook(actionID); if (ClassLocked() || - (DisabledJobsPVE.Any(x => x == Service.ClientState.LocalPlayer.ClassJob.Id) && !Service.ClientState.IsPvP) || - (DisabledJobsPVP.Any(x => x == Service.ClientState.LocalPlayer.ClassJob.Id) && Service.ClientState.IsPvP)) + (DisabledJobsPVE.Any(x => x == Svc.ClientState.LocalPlayer.ClassJob.Id) && !Svc.ClientState.IsPvP) || + (DisabledJobsPVP.Any(x => x == Svc.ClientState.LocalPlayer.ClassJob.Id) && Svc.ClientState.IsPvP)) return OriginalHook(actionID); uint lastComboMove = ActionManager.Instance()->Combo.Action; float comboTime = ActionManager.Instance()->Combo.Timer; - byte level = Service.ClientState.LocalPlayer?.Level ?? 0; + byte level = Svc.ClientState.LocalPlayer?.Level ?? 0; foreach (CustomCombo? combo in customCombos) { @@ -82,7 +83,7 @@ private unsafe uint GetIconDetour(IntPtr actionManager, uint actionID) catch (Exception ex) { - Service.PluginLog.Error(ex, "Preset error"); + Svc.Log.Error(ex, "Preset error"); return OriginalHook(actionID); } } @@ -90,20 +91,20 @@ private unsafe uint GetIconDetour(IntPtr actionManager, uint actionID) // Class locking public unsafe static bool ClassLocked() { - if (Service.ClientState.LocalPlayer is null) return false; + if (Svc.ClientState.LocalPlayer is null) return false; - if (Service.ClientState.LocalPlayer.Level <= 35) return false; + if (Svc.ClientState.LocalPlayer.Level <= 35) return false; - if (Service.ClientState.LocalPlayer.ClassJob.Id is + if (Svc.ClientState.LocalPlayer.ClassJob.Id is (>= 8 and <= 25) or 27 or 28 or >= 30) return false; if (!UIState.Instance()->IsUnlockLinkUnlockedOrQuestCompleted(66049)) return false; - if ((Service.ClientState.LocalPlayer.ClassJob.Id is 1 or 2 or 3 or 4 or 5 or 6 or 7 or 26 or 29) && - Service.Condition[Dalamud.Game.ClientState.Conditions.ConditionFlag.BoundByDuty] && - Service.ClientState.LocalPlayer.Level > 35) return true; + if ((Svc.ClientState.LocalPlayer.ClassJob.Id 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; return false; } diff --git a/XIVSlothCombo/Core/PluginAddressResolver.cs b/XIVSlothCombo/Core/PluginAddressResolver.cs index 2fdcab6f6..401f43d3e 100644 --- a/XIVSlothCombo/Core/PluginAddressResolver.cs +++ b/XIVSlothCombo/Core/PluginAddressResolver.cs @@ -1,7 +1,6 @@ -using System; using Dalamud.Game; -using FFXIVClientStructs.FFXIV.Client.Game; -using XIVSlothCombo.Services; +using ECommons.DalamudServices; +using System; namespace XIVSlothCombo.Core { @@ -16,8 +15,8 @@ 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"); - Service.PluginLog.Verbose("===== X I V S L O T H C O M B O ====="); - Service.PluginLog.Verbose($"{nameof(IsActionIdReplaceable)} 0x{IsActionIdReplaceable:X}"); + Svc.Log.Verbose("===== X I V S L O T H C O M B O ====="); + Svc.Log.Verbose($"{nameof(IsActionIdReplaceable)} 0x{IsActionIdReplaceable:X}"); } } } diff --git a/XIVSlothCombo/Core/PluginConfiguration.cs b/XIVSlothCombo/Core/PluginConfiguration.cs index 9d23f1a03..0f717f004 100644 --- a/XIVSlothCombo/Core/PluginConfiguration.cs +++ b/XIVSlothCombo/Core/PluginConfiguration.cs @@ -1,13 +1,13 @@ +using Dalamud.Configuration; +using ECommons.DalamudServices; +using Newtonsoft.Json; using System; using System.Collections.Generic; using System.Linq; -using Dalamud.Configuration; -using Newtonsoft.Json; +using System.Numerics; using XIVSlothCombo.Combos; using XIVSlothCombo.Combos.PvE; -using XIVSlothCombo.Services; using XIVSlothCombo.Extensions; -using System.Numerics; namespace XIVSlothCombo.Core { @@ -192,7 +192,7 @@ private static void SetResetValues(string config, bool value) public void ResetFeatures(string config, int[] values) { - Service.PluginLog.Debug($"{config} {GetResetValues(config)}"); + Svc.Log.Debug($"{config} {GetResetValues(config)}"); if (!GetResetValues(config)) { bool needToResetMessagePrinted = false; @@ -201,7 +201,7 @@ public void ResetFeatures(string config, int[] values) foreach (int value in values) { - Service.PluginLog.Debug(value.ToString()); + Svc.Log.Debug(value.ToString()); if (presets.Contains(value)) { var preset = Enum.GetValues() @@ -212,18 +212,18 @@ public void ResetFeatures(string config, int[] values) if (!needToResetMessagePrinted) { - Service.ChatGui.PrintError($"[XIVSlothCombo] Some features have been disabled due to an internal configuration update:"); + Svc.Chat.PrintError($"[XIVSlothCombo] Some features have been disabled due to an internal configuration update:"); needToResetMessagePrinted = !needToResetMessagePrinted; } var info = preset.GetComboAttribute(); - Service.ChatGui.PrintError($"[XIVSlothCombo] - {info.JobName}: {info.FancyName}"); + Svc.Chat.PrintError($"[XIVSlothCombo] - {info.JobName}: {info.FancyName}"); EnabledActions.Remove(preset); } } - + if (needToResetMessagePrinted) - Service.ChatGui.PrintError($"[XIVSlothCombo] Please re-enable these features to use them again. We apologise for the inconvenience"); + Svc.Chat.PrintError($"[XIVSlothCombo] Please re-enable these features to use them again. We apologise for the inconvenience"); } SetResetValues(config, true); Save(); @@ -242,7 +242,7 @@ public void ResetFeatures(string config, int[] values) public bool RecommendedSettingsViewed { get; set; } = false; /// Save the configuration to disk. - public void Save() => Service.Interface.SavePluginConfig(this); + public void Save() => Svc.PluginInterface.SavePluginConfig(this); #endregion } diff --git a/XIVSlothCombo/CustomCombo/Functions/Action.cs b/XIVSlothCombo/CustomCombo/Functions/Action.cs index 17b4e742f..89ea2062e 100644 --- a/XIVSlothCombo/CustomCombo/Functions/Action.cs +++ b/XIVSlothCombo/CustomCombo/Functions/Action.cs @@ -73,7 +73,7 @@ public static bool InActionRange(uint id) default: return GetTargetDistance() <= range; } - } + } /// Returns the level of a trait. /// ID of the action. diff --git a/XIVSlothCombo/CustomCombo/Functions/Party.cs b/XIVSlothCombo/CustomCombo/Functions/Party.cs index 32c7051d1..e1fa0df6a 100644 --- a/XIVSlothCombo/CustomCombo/Functions/Party.cs +++ b/XIVSlothCombo/CustomCombo/Functions/Party.cs @@ -1,6 +1,7 @@ -using System.Linq; -using Dalamud.Game.ClientState.Objects.Types; +using Dalamud.Game.ClientState.Objects.Types; using Dalamud.Plugin.Services; +using ECommons.DalamudServices; +using System.Linq; using XIVSlothCombo.Services; namespace XIVSlothCombo.CustomComboNS.Functions @@ -8,11 +9,11 @@ namespace XIVSlothCombo.CustomComboNS.Functions internal abstract partial class CustomComboFunctions { /// Checks if player is in a party - public static bool IsInParty() => (Service.PartyList.PartyId > 0); + public static bool IsInParty() => (Svc.Party.PartyId > 0); /// Gets the party list /// Current party list. - public static IPartyList GetPartyMembers() => Service.PartyList; + public static IPartyList GetPartyMembers() => Svc.Party; public unsafe static IGameObject? GetPartySlot(int slot) { @@ -31,8 +32,8 @@ internal abstract partial class CustomComboFunctions _ => GetTarget(TargetType.Self), }; ulong i = PartyTargetingService.GetObjectID(o); - return Service.ObjectTable.Where(x => x.GameObjectId == i).Any() - ? Service.ObjectTable.Where(x => x.GameObjectId == i).First() + return Svc.Objects.Where(x => x.GameObjectId == i).Any() + ? Svc.Objects.Where(x => x.GameObjectId == i).First() : null; } diff --git a/XIVSlothCombo/CustomCombo/Functions/PlayerCharacter.cs b/XIVSlothCombo/CustomCombo/Functions/PlayerCharacter.cs index eaacc2c1a..b11fd5660 100644 --- a/XIVSlothCombo/CustomCombo/Functions/PlayerCharacter.cs +++ b/XIVSlothCombo/CustomCombo/Functions/PlayerCharacter.cs @@ -3,7 +3,6 @@ using ECommons.DalamudServices; using FFXIVClientStructs.FFXIV.Client.Game.UI; using Lumina.Excel.GeneratedSheets; -using XIVSlothCombo.Services; using GameMain = FFXIVClientStructs.FFXIV.Client.Game.GameMain; namespace XIVSlothCombo.CustomComboNS.Functions @@ -11,24 +10,24 @@ namespace XIVSlothCombo.CustomComboNS.Functions internal abstract partial class CustomComboFunctions { /// Gets the player or null. - public static IPlayerCharacter? LocalPlayer => Service.ClientState.LocalPlayer; + public static IPlayerCharacter? LocalPlayer => Svc.ClientState.LocalPlayer; /// Find if the player has a certain condition. /// Condition flag. /// A value indicating whether the player is in the condition. - public static bool HasCondition(ConditionFlag flag) => Service.Condition[flag]; + public static bool HasCondition(ConditionFlag flag) => Svc.Condition[flag]; /// Find if the player is in combat. /// A value indicating whether the player is in combat. - public static bool InCombat() => Service.Condition[ConditionFlag.InCombat]; + public static bool InCombat() => Svc.Condition[ConditionFlag.InCombat]; /// Find if the player has a pet present. /// A value indicating whether the player has a pet (fairy/carbuncle) present. - public static bool HasPetPresent() => Service.BuddyList.PetBuddy != null; + public static bool HasPetPresent() => Svc.Buddies.PetBuddy != null; /// Find if the player has a companion (chocobo) present. /// A value indicating whether the player has a companion (chocobo). - public static bool HasCompanionPresent() => Service.BuddyList.CompanionBuddy != null; + public static bool HasCompanionPresent() => Svc.Buddies.CompanionBuddy != null; /// Checks if the player is in a PVP enabled zone. /// A value indicating whether the player is in a PVP enabled zone. diff --git a/XIVSlothCombo/CustomCombo/Functions/Target.cs b/XIVSlothCombo/CustomCombo/Functions/Target.cs index 7c578fb09..1db773970 100644 --- a/XIVSlothCombo/CustomCombo/Functions/Target.cs +++ b/XIVSlothCombo/CustomCombo/Functions/Target.cs @@ -1,11 +1,11 @@ -using System; -using System.Linq; -using System.Numerics; -using Dalamud.Game.ClientState.Objects; +using Dalamud.Game.ClientState.Objects; using Dalamud.Game.ClientState.Objects.Enums; using Dalamud.Game.ClientState.Objects.Types; using ECommons.DalamudServices; using FFXIVClientStructs.FFXIV.Client.System.Framework; +using System; +using System.Linq; +using System.Numerics; using XIVSlothCombo.Data; using XIVSlothCombo.Services; using StructsObject = FFXIVClientStructs.FFXIV.Client.Game.Object; @@ -15,7 +15,7 @@ namespace XIVSlothCombo.CustomComboNS.Functions internal abstract partial class CustomComboFunctions { /// Gets the current target or null. - public static IGameObject? CurrentTarget => Service.TargetManager.Target; + public static IGameObject? CurrentTarget => Svc.Targets.Target; /// Find if the player has a target. /// A value indicating whether the player has a target. @@ -124,8 +124,8 @@ public static bool HasFriendlyTarget(IGameObject? OurTarget = null) public static unsafe IGameObject? GetHealTarget(bool checkMOPartyUI = false, bool restrictToMouseover = false) { IGameObject? healTarget = null; - ITargetManager tm = Service.TargetManager; - + ITargetManager tm = Svc.Targets; + if (HasFriendlyTarget(tm.SoftTarget)) healTarget = tm.SoftTarget; if (healTarget is null && HasFriendlyTarget(CurrentTarget) && !restrictToMouseover) healTarget = CurrentTarget; //if (checkMO && HasFriendlyTarget(tm.MouseOverTarget)) healTarget = tm.MouseOverTarget; @@ -134,7 +134,7 @@ public static bool HasFriendlyTarget(IGameObject? OurTarget = null) StructsObject.GameObject* t = Framework.Instance()->GetUIModule()->GetPronounModule()->UiMouseOverTarget; if (t != null && t->GetGameObjectId().ObjectId != 0) { - IGameObject? uiTarget = Service.ObjectTable.Where(x => x.GameObjectId == t->GetGameObjectId().ObjectId).FirstOrDefault(); + IGameObject? uiTarget = Svc.Objects.Where(x => x.GameObjectId == t->GetGameObjectId().ObjectId).FirstOrDefault(); if (uiTarget != null && HasFriendlyTarget(uiTarget)) healTarget = uiTarget; if (restrictToMouseover) @@ -164,7 +164,7 @@ public static bool CanInterruptEnemy() /// Sets the player's target. /// Target must be a game object that the player can normally click and target. - public static void SetTarget(IGameObject? target) => Service.TargetManager.Target = target; + public static void SetTarget(IGameObject? target) => Svc.Targets.Target = target; /// Checks if target is in appropriate range for targeting /// The target object to check @@ -190,7 +190,7 @@ protected static unsafe void TargetObject(TargetType target) StructsObject.GameObject* t = GetTarget(target); if (t == null) return; ulong o = PartyTargetingService.GetObjectID(t); - IGameObject? p = Service.ObjectTable.Where(x => x.GameObjectId == o).First(); + IGameObject? p = Svc.Objects.Where(x => x.GameObjectId == o).First(); if (IsInRange(p)) SetTarget(p); } @@ -207,24 +207,24 @@ public static void TargetObject(IGameObject? target) switch (target) { case TargetType.Target: - o = Service.TargetManager.Target; + o = Svc.Targets.Target; break; case TargetType.SoftTarget: - o = Service.TargetManager.SoftTarget; + o = Svc.Targets.SoftTarget; break; case TargetType.FocusTarget: - o = Service.TargetManager.FocusTarget; + o = Svc.Targets.FocusTarget; break; case TargetType.UITarget: return PartyTargetingService.UITarget; case TargetType.FieldTarget: - o = Service.TargetManager.MouseOverTarget; + o = Svc.Targets.MouseOverTarget; break; - case TargetType.TargetsTarget when Service.TargetManager.Target is { TargetObjectId: not 0xE0000000 }: - o = Service.TargetManager.Target.TargetObject; + case TargetType.TargetsTarget when Svc.Targets.Target is { TargetObjectId: not 0xE0000000 }: + o = Svc.Targets.Target.TargetObject; break; case TargetType.Self: - o = Service.ClientState.LocalPlayer; + o = Svc.ClientState.LocalPlayer; break; case TargetType.LastTarget: return PartyTargetingService.GetGameObjectFromPronounID(1006); @@ -279,27 +279,32 @@ public enum TargetType public static float AngleToTarget() { if (CurrentTarget is null || LocalPlayer is null) - return 0; + return 0; if (CurrentTarget is not IBattleChara || CurrentTarget.ObjectKind != ObjectKind.BattleNpc) return 0; var angle = PositionalMath.AngleXZ(CurrentTarget.Position, LocalPlayer.Position) - CurrentTarget.Rotation; var regionDegrees = PositionalMath.Degrees(angle); - if(regionDegrees < 0) { + if (regionDegrees < 0) + { regionDegrees = 360 + regionDegrees; } - if( ( regionDegrees >= 45 ) && ( regionDegrees <= 135 ) ) { + if ((regionDegrees >= 45) && (regionDegrees <= 135)) + { return 1; } - if( ( regionDegrees >= 135 ) && ( regionDegrees <= 225 ) ) { + if ((regionDegrees >= 135) && (regionDegrees <= 225)) + { return 2; } - if( ( regionDegrees >= 225 ) && ( regionDegrees <= 315 ) ) { + if ((regionDegrees >= 225) && (regionDegrees <= 315)) + { return 3; } - if( ( regionDegrees >= 315 ) || ( regionDegrees <= 45 ) ) { + if ((regionDegrees >= 315) || (regionDegrees <= 45)) + { return 4; } return 0; @@ -319,13 +324,15 @@ public static bool OnTargetsRear() var angle = PositionalMath.AngleXZ(CurrentTarget.Position, LocalPlayer.Position) - CurrentTarget.Rotation; var regionDegrees = PositionalMath.Degrees(angle); - if( regionDegrees < 0 ) { + if (regionDegrees < 0) + { regionDegrees = 360 + regionDegrees; } - if( ( regionDegrees >= 135 ) && ( regionDegrees <= 225 ) ) { + if ((regionDegrees >= 135) && (regionDegrees <= 225)) + { return true; - } + } return false; } @@ -344,16 +351,19 @@ public static bool OnTargetsFlank() var angle = PositionalMath.AngleXZ(CurrentTarget.Position, LocalPlayer.Position) - CurrentTarget.Rotation; var regionDegrees = PositionalMath.Degrees(angle); - if( regionDegrees < 0 ) { + if (regionDegrees < 0) + { regionDegrees = 360 + regionDegrees; } // left flank - if( ( regionDegrees >= 45 ) && ( regionDegrees <= 135 ) ) { + if ((regionDegrees >= 45) && (regionDegrees <= 135)) + { return true; } // right flank - if( ( regionDegrees >= 225 ) && ( regionDegrees <= 315 ) ) { + if ((regionDegrees >= 225) && (regionDegrees <= 315)) + { return true; } return false; @@ -378,7 +388,7 @@ static internal float AngleXZ(Vector3 a, Vector3 b) } } - internal unsafe static bool OutOfRange(uint actionID, IGameObject target) => ActionWatching.OutOfRange(actionID, Service.ClientState.LocalPlayer!, target); + internal unsafe static bool OutOfRange(uint actionID, IGameObject target) => ActionWatching.OutOfRange(actionID, Svc.ClientState.LocalPlayer!, target); } } diff --git a/XIVSlothCombo/Data/ActionWatching.cs b/XIVSlothCombo/Data/ActionWatching.cs index 9bbc7d1fa..c684179b1 100644 --- a/XIVSlothCombo/Data/ActionWatching.cs +++ b/XIVSlothCombo/Data/ActionWatching.cs @@ -4,7 +4,6 @@ using ECommons.DalamudServices; using ECommons.GameFunctions; using FFXIVClientStructs.FFXIV.Client.Game; -using FFXIVClientStructs.FFXIV.Client.Game.Object; using Lumina.Excel.GeneratedSheets; using System; using System.Collections.Generic; @@ -12,25 +11,24 @@ using System.Runtime.InteropServices; using XIVSlothCombo.Combos.PvE; using XIVSlothCombo.CustomComboNS.Functions; -using XIVSlothCombo.Extensions; using XIVSlothCombo.Services; namespace XIVSlothCombo.Data { public static class ActionWatching { - internal static Dictionary ActionSheet = Service.DataManager.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 = Service.DataManager.GetExcelSheet()! + internal static Dictionary StatusSheet = Svc.Data.GetExcelSheet()! .ToDictionary(i => i.RowId, i => i); - internal static Dictionary TraitSheet = Service.DataManager.GetExcelSheet()! + 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 = Service.DataManager.GetExcelSheet()! + internal static Dictionary BNpcSheet = Svc.Data.GetExcelSheet()! .ToDictionary(i => i.RowId, i => i); private static readonly Dictionary> statusCache = []; @@ -48,7 +46,7 @@ private static void ReceiveActionEffectDetour(ulong sourceObjectId, IntPtr sourc if (ActionType is 13 or 2) return; if (header.ActionId != 7 && header.ActionId != 8 && - sourceObjectId == Service.ClientState.LocalPlayer.GameObjectId) + sourceObjectId == Svc.ClientState.LocalPlayer.GameObjectId) { TimeLastActionUsed = DateTime.Now; LastActionUseCount++; @@ -98,7 +96,7 @@ private unsafe static void SendActionDetour(ulong targetObjectId, byte actionTyp } catch (Exception ex) { - Service.PluginLog.Error(ex, "SendActionDetour"); + Svc.Log.Error(ex, "SendActionDetour"); SendActionHook!.Original(targetObjectId, actionType, actionId, sequence, a5, a6, a7, a8, a9); } } @@ -107,7 +105,7 @@ private unsafe static void CheckForChangedTarget(uint actionId, ref ulong target { if (actionId is AST.Balance or AST.Spear && Combos.JobHelpers.AST.AST_QuickTargetCards.SelectedRandomMember is not null && - !OutOfRange(actionId, Service.ClientState.LocalPlayer!, Combos.JobHelpers.AST.AST_QuickTargetCards.SelectedRandomMember)) + !OutOfRange(actionId, Svc.ClientState.LocalPlayer!, Combos.JobHelpers.AST.AST_QuickTargetCards.SelectedRandomMember)) { int targetOptions = AST.Config.AST_QuickTarget_Override; @@ -119,7 +117,7 @@ Combos.JobHelpers.AST.AST_QuickTargetCards.SelectedRandomMember is not null && break; case 1: if (CustomComboFunctions.HasFriendlyTarget()) - targetObjectId = Service.ClientState.LocalPlayer.TargetObject.GameObjectId; + targetObjectId = Svc.ClientState.LocalPlayer.TargetObject.GameObjectId; else targetObjectId = Combos.JobHelpers.AST.AST_QuickTargetCards.SelectedRandomMember.GameObjectId; break; @@ -197,7 +195,7 @@ public static bool HasDoubleWeaved() public static void OutputLog() { - Service.ChatGui.Print($"You just used: {GetActionName(LastAction)} x{LastActionUseCount}"); + Svc.Chat.Print($"You just used: {GetActionName(LastAction)} x{LastActionUseCount}"); } public static void Dispose() @@ -208,8 +206,8 @@ public static void Dispose() static unsafe ActionWatching() { - ReceiveActionEffectHook ??= Service.GameInteropProvider.HookFromSignature("40 55 56 57 41 54 41 55 41 56 48 8D AC 24", ReceiveActionEffectDetour); - SendActionHook ??= Service.GameInteropProvider.HookFromSignature("48 89 5C 24 ?? 48 89 6C 24 ?? 48 89 74 24 ?? 57 48 81 EC ?? ?? ?? ?? 48 8B 05 ?? ?? ?? ?? 48 33 C4 48 89 84 24 ?? ?? ?? ?? 48 8B E9 41 0F B7 D9", SendActionDetour); + ReceiveActionEffectHook ??= Svc.Hook.HookFromSignature("40 55 56 57 41 54 41 55 41 56 48 8D AC 24", ReceiveActionEffectDetour); + SendActionHook ??= Svc.Hook.HookFromSignature("48 89 5C 24 ?? 48 89 6C 24 ?? 48 89 74 24 ?? 57 48 81 EC ?? ?? ?? ?? 48 8B 05 ?? ?? ?? ?? 48 33 C4 48 89 84 24 ?? ?? ?? ?? 48 8B E9 41 0F B7 D9", SendActionDetour); } diff --git a/XIVSlothCombo/Data/CustomComboCache.cs b/XIVSlothCombo/Data/CustomComboCache.cs index 820117afa..1edbce42f 100644 --- a/XIVSlothCombo/Data/CustomComboCache.cs +++ b/XIVSlothCombo/Data/CustomComboCache.cs @@ -1,12 +1,11 @@ -using System; -using Dalamud.Game.ClientState.JobGauge.Types; +using Dalamud.Game.ClientState.JobGauge.Types; using Dalamud.Game.ClientState.Objects.Types; -using Dalamud.Game.ClientState.Objects.SubKinds; -using DalamudStatus = Dalamud.Game.ClientState.Statuses; // conflicts with structs if not defined -using FFXIVClientStructs.FFXIV.Client.Game; -using XIVSlothCombo.Services; using Dalamud.Plugin.Services; +using ECommons.DalamudServices; +using FFXIVClientStructs.FFXIV.Client.Game; +using System; using System.Collections.Concurrent; +using DalamudStatus = Dalamud.Game.ClientState.Statuses; // conflicts with structs if not defined namespace XIVSlothCombo.Data { @@ -23,12 +22,12 @@ internal partial class CustomComboCache : IDisposable private readonly ConcurrentDictionary jobGaugeCache = new(); /// Initializes a new instance of the class. - public CustomComboCache() => Service.Framework.Update += Framework_Update; + public CustomComboCache() => Svc.Framework.Update += Framework_Update; private delegate IntPtr GetActionCooldownSlotDelegate(IntPtr actionManager, int cooldownGroup); /// - public void Dispose() => Service.Framework.Update -= Framework_Update; + public void Dispose() => Svc.Framework.Update -= Framework_Update; /// Gets a job gauge. /// Type of job gauge. @@ -36,7 +35,7 @@ internal partial class CustomComboCache : IDisposable internal T GetJobGauge() where T : JobGaugeBase { if (!jobGaugeCache.TryGetValue(typeof(T), out JobGaugeBase? gauge)) - gauge = jobGaugeCache[typeof(T)] = Service.JobGauges.Get(); + gauge = jobGaugeCache[typeof(T)] = Svc.Gauges.Get(); return (T)gauge; } @@ -80,7 +79,7 @@ internal unsafe CooldownData GetCooldown(uint actionID) ActionID = actionID, }; - return cooldownCache[actionID] = data; + return cooldownCache[actionID] = data; } /// Get the maximum number of charges for an action. diff --git a/XIVSlothCombo/Data/RepoCheck.cs b/XIVSlothCombo/Data/RepoCheck.cs index 27abb0c76..1f9bfa53c 100644 --- a/XIVSlothCombo/Data/RepoCheck.cs +++ b/XIVSlothCombo/Data/RepoCheck.cs @@ -1,6 +1,6 @@ -using Newtonsoft.Json; +using ECommons.DalamudServices; +using Newtonsoft.Json; using System.IO; -using XIVSlothCombo.Services; namespace XIVSlothCombo.Data { @@ -13,7 +13,7 @@ public static class RepoCheckFunctions { public static RepoCheck? FetchCurrentRepo() { - FileInfo? f = Service.Interface.AssemblyLocation; + FileInfo? f = Svc.PluginInterface.AssemblyLocation; var manifest = Path.Join(f.DirectoryName, "XIVSlothCombo.json"); if (File.Exists(manifest)) diff --git a/XIVSlothCombo/Data/TempSCHGauge.cs b/XIVSlothCombo/Data/TempSCHGauge.cs index 82fc5192c..55c2c6759 100644 --- a/XIVSlothCombo/Data/TempSCHGauge.cs +++ b/XIVSlothCombo/Data/TempSCHGauge.cs @@ -2,10 +2,7 @@ using Dalamud.Game.ClientState.JobGauge.Types; using ECommons.DalamudServices; using System; -using System.Diagnostics.Contracts; using System.Runtime.InteropServices; -using XIVSlothCombo.Services; -using XIVSlothCombo.Window.Tabs; namespace XIVSlothCombo.Data; @@ -23,7 +20,7 @@ public unsafe class TmpSCHGauge public TmpSCHGauge() { - Struct = (TmpScholarGauge*)Service.JobGauges.Get().Address; + Struct = (TmpScholarGauge*)Svc.Gauges.Get().Address; } } @@ -103,7 +100,7 @@ public enum CreatureFlags : byte Pom = 1, Wings = 2, Claw = 4, - + MooglePortrait = 16, MadeenPortrait = 32, } diff --git a/XIVSlothCombo/Extensions/UIntExtensions.cs b/XIVSlothCombo/Extensions/UIntExtensions.cs index bbef91205..e6ab850d0 100644 --- a/XIVSlothCombo/Extensions/UIntExtensions.cs +++ b/XIVSlothCombo/Extensions/UIntExtensions.cs @@ -14,6 +14,6 @@ internal static class UIntExtensions internal static class UShortExtensions { - internal static string StatusName(this ushort value) => ActionWatching.GetStatusName(value); + internal static string StatusName(this ushort value) => ActionWatching.GetStatusName(value); } } diff --git a/XIVSlothCombo/Global.cs b/XIVSlothCombo/Global.cs index 99c5b0e65..312db4996 100644 --- a/XIVSlothCombo/Global.cs +++ b/XIVSlothCombo/Global.cs @@ -1,3 +1 @@ global using static XIVSlothCombo.XIVSlothCombo; -global using InteropGenerator.Runtime; -global using InteropGenerator.Runtime.Attributes; \ No newline at end of file diff --git a/XIVSlothCombo/Services/BlueMageService.cs b/XIVSlothCombo/Services/BlueMageService.cs index a1fa6799b..6df4c8898 100644 --- a/XIVSlothCombo/Services/BlueMageService.cs +++ b/XIVSlothCombo/Services/BlueMageService.cs @@ -1,5 +1,5 @@ -using System.Linq; -using FFXIVClientStructs.FFXIV.Client.Game; +using FFXIVClientStructs.FFXIV.Client.Game; +using System.Linq; namespace XIVSlothCombo.Services { diff --git a/XIVSlothCombo/Services/PartyTargetingService.cs b/XIVSlothCombo/Services/PartyTargetingService.cs index d9d86ac83..9b721140b 100644 --- a/XIVSlothCombo/Services/PartyTargetingService.cs +++ b/XIVSlothCombo/Services/PartyTargetingService.cs @@ -1,6 +1,6 @@ -using System; -using FFXIVClientStructs.FFXIV.Client.Game.Object; +using ECommons.DalamudServices; using FFXIVClientStructs.FFXIV.Client.System.Framework; +using System; using GameObject = FFXIVClientStructs.FFXIV.Client.Game.Object.GameObject; namespace XIVSlothCombo.Services @@ -16,7 +16,7 @@ public static ulong GetObjectID(GameObject* o) return id.ObjectId; } - private static readonly delegate* unmanaged getGameObjectFromPronounID = (delegate* unmanaged)Service.SigScanner.ScanText("E8 ?? ?? ?? ?? 48 8B D8 48 85 C0 0F 85 ?? ?? ?? ?? 8D 4F DD"); + private static readonly delegate* unmanaged getGameObjectFromPronounID = (delegate* unmanaged)Svc.SigScanner.ScanText("E8 ?? ?? ?? ?? 48 8B D8 48 85 C0 0F 85 ?? ?? ?? ?? 8D 4F DD"); public static GameObject* GetGameObjectFromPronounID(uint id) => getGameObjectFromPronounID(pronounModule, id); } } diff --git a/XIVSlothCombo/Services/Service.cs b/XIVSlothCombo/Services/Service.cs index 65fdcd634..8370588ba 100644 --- a/XIVSlothCombo/Services/Service.cs +++ b/XIVSlothCombo/Services/Service.cs @@ -1,11 +1,3 @@ -using System; -using System.IO; -using System.Reflection; -using Dalamud.Game; -using Dalamud.Game.ClientState.Objects; -using Dalamud.IoC; -using Dalamud.Plugin; -using Dalamud.Plugin.Services; using XIVSlothCombo.Core; using XIVSlothCombo.Data; @@ -17,87 +9,13 @@ internal class Service /// Gets or sets the plugin address resolver. internal static PluginAddressResolver Address { get; set; } = null!; - /// Gets the Dalamud buddy list. - [PluginService] - internal static IBuddyList BuddyList { get; private set; } = null!; - - /// Gets the Dalamud chat gui. - [PluginService] - internal static IChatGui ChatGui { get; private set; } = null!; - - /// Gets the Dalamud client state. - [PluginService] - internal static IClientState ClientState { get; private set; } = null!; - /// Gets or sets the plugin caching mechanism. internal static CustomComboCache ComboCache { get; set; } = null!; - /// Gets the Dalamud command manager. - [PluginService] - internal static ICommandManager CommandManager { get; private set; } = null!; - - /// Gets the Dalamud condition. - [PluginService] - internal static ICondition Condition { get; private set; } = null!; - /// Gets or sets the plugin configuration. internal static PluginConfiguration Configuration { get; set; } = null!; - /// Gets the Dalamud data manager. - [PluginService] - internal static IDataManager DataManager { get; private set; } = null!; - - /// Gets the Dalamud framework manager. - [PluginService] - internal static IFramework Framework { get; private set; } = null!; - - /// Handles the in-game UI. - [PluginService] - internal static IGameGui GameGui { get; private set; } = null!; - /// Gets or sets the plugin icon replacer. internal static IconReplacer IconReplacer { get; set; } = null!; - - /// Gets the Dalamud plugin interface. - [PluginService] - internal static IDalamudPluginInterface Interface { get; private set; } = null!; - - /// Gets the Dalamud job gauges. - [PluginService] - internal static IJobGauges JobGauges { get; private set; } = null!; - - /// Gets the Dalamud object table. - [PluginService] - internal static IObjectTable ObjectTable { get; private set; } = null!; - - /// Returns the Plugin Folder location - public static string PluginFolder - { - get - { - string codeBase = Assembly.GetExecutingAssembly().Location; - UriBuilder uri = new(codeBase); - string path = Uri.UnescapeDataString(uri.Path); - return Path.GetDirectoryName(path)!; - } - } - - /// Gets the Dalamud party list. - [PluginService] - internal static IPartyList PartyList { get; private set; } = null!; - - /// Facilitates searching for memory signatures. - [PluginService] - internal static ISigScanner SigScanner { get; private set; } = null!; - - /// Gets the Dalamud target manager. - [PluginService] - internal static ITargetManager TargetManager { get; private set; } = null!; - - [PluginService] - internal static IGameInteropProvider GameInteropProvider { get; private set; } = null!; - - [PluginService] - internal static IPluginLog PluginLog { get; private set; } = null!; } } diff --git a/XIVSlothCombo/Window/ConfigWindow.cs b/XIVSlothCombo/Window/ConfigWindow.cs index cfead9dfd..834d7e46b 100644 --- a/XIVSlothCombo/Window/ConfigWindow.cs +++ b/XIVSlothCombo/Window/ConfigWindow.cs @@ -1,24 +1,17 @@ using Dalamud.Interface.ManagedFontAtlas; -using Dalamud.Interface.Utility; using Dalamud.Interface.Utility.Raii; using Dalamud.Utility; using ECommons.DalamudServices; using ECommons.ImGuiMethods; -using FFXIVClientStructs.FFXIV.Client.UI; -using FFXIVClientStructs.FFXIV.Component.GUI; using ImGuiNET; -using Lumina.Excel.GeneratedSheets; using System; using System.Collections.Generic; using System.Linq; using System.Numerics; -using System.Runtime.InteropServices; using XIVSlothCombo.Attributes; using XIVSlothCombo.Combos; using XIVSlothCombo.Combos.PvE; using XIVSlothCombo.Core; -using XIVSlothCombo.CustomComboNS.Functions; -using XIVSlothCombo.Services; using XIVSlothCombo.Window.Tabs; namespace XIVSlothCombo.Window @@ -183,7 +176,7 @@ public override void Draw() }; } - + public void Dispose() { diff --git a/XIVSlothCombo/Window/Functions/Presets.cs b/XIVSlothCombo/Window/Functions/Presets.cs index 0cfcb3b1d..24e7dda68 100644 --- a/XIVSlothCombo/Window/Functions/Presets.cs +++ b/XIVSlothCombo/Window/Functions/Presets.cs @@ -99,7 +99,7 @@ internal unsafe static void DrawPreset(CustomComboPreset preset, CustomComboInfo } if (!string.IsNullOrEmpty(comboInfo.JobShorthand)) - conflictBuilder.Insert(0, $"[{comboInfo.JobShorthand}] "); + conflictBuilder.Insert(0, $"[{comboInfo.JobShorthand}] "); ImGuiEx.Text(GradientColor.Get(ImGuiColors.DalamudRed, CustomComboNS.Functions.CustomComboFunctions.IsEnabled(conflict) ? ImGuiColors.HealerGreen : ImGuiColors.DalamudRed, 1500), $"- {conflictBuilder}"); conflictBuilder.Clear(); @@ -274,7 +274,7 @@ private static void DrawReplaceAttribute(CustomComboPreset preset) ImGui.BeginTooltip(); foreach (var icon in att.ActionIcons) { - var img = Svc.Texture.GetFromGameIcon(new (icon)).GetWrapOrEmpty(); + var img = Svc.Texture.GetFromGameIcon(new(icon)).GetWrapOrEmpty(); ImGui.Image(img.ImGuiHandle, (img.Size / 2f) * ImGui.GetIO().FontGlobalScale); ImGui.SameLine(); } diff --git a/XIVSlothCombo/Window/Functions/UserConfig.cs b/XIVSlothCombo/Window/Functions/UserConfig.cs index a8a74170b..2ccf56d47 100644 --- a/XIVSlothCombo/Window/Functions/UserConfig.cs +++ b/XIVSlothCombo/Window/Functions/UserConfig.cs @@ -2,6 +2,7 @@ using Dalamud.Interface; using Dalamud.Interface.Colors; using Dalamud.Utility; +using ECommons.DalamudServices; using ImGuiNET; using System; using System.Linq; @@ -15,6 +16,7 @@ using XIVSlothCombo.Extensions; using XIVSlothCombo.Services; + namespace XIVSlothCombo.Window.Functions { public static class UserConfig @@ -1411,10 +1413,10 @@ internal static void Draw(CustomComboPreset preset, bool enabled) { //int[]? actions = Service.Configuration.DancerDanceCompatActionIDs.Cast().ToArray(); int[]? actions = Service.Configuration.DancerDanceCompatActionIDs.Select(x => (int)x).ToArray(); - + bool inputChanged = false; - + inputChanged |= ImGui.InputInt("Emboite (Red) ActionID", ref actions[0], 0); inputChanged |= ImGui.InputInt("Entrechat (Blue) ActionID", ref actions[1], 0); inputChanged |= ImGui.InputInt("Jete (Green) ActionID", ref actions[2], 0); @@ -2002,7 +2004,7 @@ internal static void Draw(CustomComboPreset preset, bool enabled) // ==================================================================================== #region SAGE - if (preset is CustomComboPreset.SGE_ST_DPS) + if (preset is CustomComboPreset.SGE_ST_DPS) UserConfig.DrawAdditionalBoolChoice(SGE.Config.SGE_ST_DPS_Adv, $"Apply all selected options to {SGE.Dosis2.ActionName()}", $"{SGE.Dosis.ActionName()} & {SGE.Dosis3.ActionName()} will behave normally."); if (preset is CustomComboPreset.SGE_ST_DPS_EDosis) @@ -2593,13 +2595,13 @@ internal static void Draw(CustomComboPreset preset, bool enabled) // ==================================================================================== #region PvP VALUES - IPlayerCharacter? pc = Service.ClientState.LocalPlayer; + IPlayerCharacter? pc = Svc.ClientState.LocalPlayer; if (preset == CustomComboPreset.PvP_EmergencyHeals) { if (pc != null) { - uint maxHP = Service.ClientState.LocalPlayer?.MaxHp <= 15000 ? 0 : Service.ClientState.LocalPlayer.MaxHp - 15000; + uint maxHP = Svc.ClientState.LocalPlayer?.MaxHp <= 15000 ? 0 : Svc.ClientState.LocalPlayer.MaxHp - 15000; if (maxHP > 0) { diff --git a/XIVSlothCombo/Window/IconTextButton.cs b/XIVSlothCombo/Window/IconTextButton.cs index fc63cebc1..82d7b6bd8 100644 --- a/XIVSlothCombo/Window/IconTextButton.cs +++ b/XIVSlothCombo/Window/IconTextButton.cs @@ -1,5 +1,4 @@ using Dalamud.Interface; -using Dalamud.Interface.Internal; using Dalamud.Interface.Textures.TextureWraps; using ECommons.ImGuiMethods; using ImGuiNET; diff --git a/XIVSlothCombo/Window/InfoBox.cs b/XIVSlothCombo/Window/InfoBox.cs index f05b1cd9e..7466c41f2 100644 --- a/XIVSlothCombo/Window/InfoBox.cs +++ b/XIVSlothCombo/Window/InfoBox.cs @@ -1,8 +1,8 @@ -using System; -using System.Numerics; -using Dalamud.Interface.Utility; +using Dalamud.Interface.Utility; using Dalamud.Interface.Utility.Raii; using ImGuiNET; +using System; +using System.Numerics; namespace XIVSlothCombo.Window { @@ -50,7 +50,7 @@ public void Draw() if (HasMaxWidth) { if ((ImGui.GetItemRectMax().X - ImGui.GetItemRectMin().X + 15f) < ImGui.GetWindowSize().X - 60f) - Size = Size with { X = ImGui.GetItemRectMax().X - ImGui.GetItemRectMin().X + 15f }; + Size = Size with { X = ImGui.GetItemRectMax().X - ImGui.GetItemRectMin().X + 15f }; } DrawCorners(); diff --git a/XIVSlothCombo/Window/Tabs/AboutUs.cs b/XIVSlothCombo/Window/Tabs/AboutUs.cs index d15e3d0aa..e1b84aa46 100644 --- a/XIVSlothCombo/Window/Tabs/AboutUs.cs +++ b/XIVSlothCombo/Window/Tabs/AboutUs.cs @@ -1,6 +1,5 @@ using Dalamud.Interface; using Dalamud.Interface.Colors; -using Dalamud.Interface.Internal; using Dalamud.Interface.Textures.TextureWraps; using Dalamud.Interface.Utility; using Dalamud.Utility; diff --git a/XIVSlothCombo/Window/Tabs/Debug.cs b/XIVSlothCombo/Window/Tabs/Debug.cs index a906ebac5..314aabe74 100644 --- a/XIVSlothCombo/Window/Tabs/Debug.cs +++ b/XIVSlothCombo/Window/Tabs/Debug.cs @@ -1,5 +1,4 @@ -using Dalamud.Game.ClientState.JobGauge.Types; -using Dalamud.Game.ClientState.Objects.SubKinds; +using Dalamud.Game.ClientState.Objects.SubKinds; using Dalamud.Game.ClientState.Objects.Types; using ECommons.DalamudServices; using ImGuiNET; @@ -7,7 +6,6 @@ using System.Linq; using System.Numerics; using XIVSlothCombo.Combos; -using XIVSlothCombo.Combos.PvE; using XIVSlothCombo.CustomComboNS; using XIVSlothCombo.CustomComboNS.Functions; using XIVSlothCombo.Data; @@ -31,12 +29,12 @@ internal class DebugCombo : CustomCombo public static int debugNum = 0; internal unsafe static new void Draw() { - IPlayerCharacter? LocalPlayer = Service.ClientState.LocalPlayer; + IPlayerCharacter? LocalPlayer = Svc.ClientState.LocalPlayer; DebugCombo? comboClass = new(); if (LocalPlayer != null) { - if (Service.ClientState.LocalPlayer.TargetObject is IBattleChara chara) + if (Svc.ClientState.LocalPlayer.TargetObject is IBattleChara chara) { foreach (Status? status in chara.StatusList) { @@ -44,14 +42,14 @@ internal class DebugCombo : CustomCombo } } - foreach (Status? status in (Service.ClientState.LocalPlayer as IBattleChara).StatusList) + foreach (Status? status in (Svc.ClientState.LocalPlayer as IBattleChara).StatusList) { - ImGui.TextUnformatted($"SELF STATUS CHECK: {Service.ClientState.LocalPlayer.Name} -> {ActionWatching.GetStatusName(status.StatusId)}: {status.StatusId} {Math.Round(status.RemainingTime, 1)}"); + ImGui.TextUnformatted($"SELF STATUS CHECK: {Svc.ClientState.LocalPlayer.Name} -> {ActionWatching.GetStatusName(status.StatusId)}: {status.StatusId} {Math.Round(status.RemainingTime, 1)}"); } - ImGui.TextUnformatted($"TERRITORY: {Service.ClientState.TerritoryType}"); - ImGui.TextUnformatted($"TARGET OBJECT KIND: {Service.ClientState.LocalPlayer.TargetObject?.ObjectKind}"); - ImGui.TextUnformatted($"TARGET IS BATTLE CHARA: {Service.ClientState.LocalPlayer.TargetObject is IBattleChara}"); + ImGui.TextUnformatted($"TERRITORY: {Svc.ClientState.TerritoryType}"); + ImGui.TextUnformatted($"TARGET OBJECT KIND: {Svc.ClientState.LocalPlayer.TargetObject?.ObjectKind}"); + ImGui.TextUnformatted($"TARGET IS BATTLE CHARA: {Svc.ClientState.LocalPlayer.TargetObject is IBattleChara}"); ImGui.TextUnformatted($"IN COMBAT: {CustomComboFunctions.InCombat()}"); ImGui.TextUnformatted($"IN MELEE RANGE: {CustomComboFunctions.InMeleeRange()}"); ImGui.TextUnformatted($"DISTANCE FROM TARGET: {CustomComboFunctions.GetTargetDistance()}"); @@ -62,26 +60,26 @@ internal class DebugCombo : CustomCombo ImGui.TextUnformatted($"LAST WEAPONSKILL: {ActionWatching.GetActionName(ActionWatching.LastWeaponskill)}"); ImGui.TextUnformatted($"LAST SPELL: {ActionWatching.GetActionName(ActionWatching.LastSpell)}"); ImGui.TextUnformatted($"LAST ABILITY: {ActionWatching.GetActionName(ActionWatching.LastAbility)}"); - ImGui.TextUnformatted($"ZONE: {Service.ClientState.TerritoryType}"); + ImGui.TextUnformatted($"ZONE: {Svc.ClientState.TerritoryType}"); ImGui.BeginChild("BLUSPELLS", new Vector2(250, 100), false); ImGui.TextUnformatted($"SELECTED BLU SPELLS:\n{string.Join("\n", Service.Configuration.ActiveBLUSpells.Select(x => ActionWatching.GetActionName(x)).OrderBy(x => x))}"); ImGui.EndChild(); - /* var gauge = CustomComboFunctions.GetJobGauge(); - ImGui.Text($"{gauge.DrawnCards[0]}"); - ImGui.Text($"{gauge.DrawnCards[1]}"); - ImGui.Text($"{gauge.DrawnCards[2]}"); - ImGui.Text($"{gauge.ActiveDraw}"); - ImGui.Text($"{gauge.DrawnCrownCard}"); + /* var gauge = CustomComboFunctions.GetJobGauge(); + ImGui.Text($"{gauge.DrawnCards[0]}"); + ImGui.Text($"{gauge.DrawnCards[1]}"); + ImGui.Text($"{gauge.DrawnCards[2]}"); + ImGui.Text($"{gauge.ActiveDraw}"); + ImGui.Text($"{gauge.DrawnCrownCard}"); - ImGui.Text($"{CustomComboFunctions.GetPartySlot(1).Name}"); - ImGui.Text($"{CustomComboFunctions.GetPartySlot(2).Name}"); - ImGui.Text($"{CustomComboFunctions.GetPartySlot(3).Name}"); - ImGui.Text($"{CustomComboFunctions.GetPartySlot(4).Name}"); - ImGui.Text($"{CustomComboFunctions.GetPartySlot(5).Name}"); - ImGui.Text($"{CustomComboFunctions.GetPartySlot(6).Name}"); - ImGui.Text($"{CustomComboFunctions.GetPartySlot(7).Name}"); - ImGui.Text($"{CustomComboFunctions.GetPartySlot(8).Name}");*/ + ImGui.Text($"{CustomComboFunctions.GetPartySlot(1).Name}"); + ImGui.Text($"{CustomComboFunctions.GetPartySlot(2).Name}"); + ImGui.Text($"{CustomComboFunctions.GetPartySlot(3).Name}"); + ImGui.Text($"{CustomComboFunctions.GetPartySlot(4).Name}"); + ImGui.Text($"{CustomComboFunctions.GetPartySlot(5).Name}"); + ImGui.Text($"{CustomComboFunctions.GetPartySlot(6).Name}"); + ImGui.Text($"{CustomComboFunctions.GetPartySlot(7).Name}"); + ImGui.Text($"{CustomComboFunctions.GetPartySlot(8).Name}");*/ } else diff --git a/XIVSlothCombo/Window/Tabs/PvEFeatures.cs b/XIVSlothCombo/Window/Tabs/PvEFeatures.cs index 19c6e76d5..323a9dcb4 100644 --- a/XIVSlothCombo/Window/Tabs/PvEFeatures.cs +++ b/XIVSlothCombo/Window/Tabs/PvEFeatures.cs @@ -1,5 +1,4 @@ -using Dalamud.Interface.Internal; -using Dalamud.Interface.Textures.TextureWraps; +using Dalamud.Interface.Textures.TextureWraps; using Dalamud.Interface.Utility; using Dalamud.Interface.Utility.Raii; using ECommons.ImGuiMethods; @@ -182,7 +181,7 @@ internal static void DrawHeadingContents(string jobName, int i) else { presetBox.Draw(); - + continue; } } diff --git a/XIVSlothCombo/Window/Tabs/PvPFeatures.cs b/XIVSlothCombo/Window/Tabs/PvPFeatures.cs index cca1d0da7..2522f99d7 100644 --- a/XIVSlothCombo/Window/Tabs/PvPFeatures.cs +++ b/XIVSlothCombo/Window/Tabs/PvPFeatures.cs @@ -1,12 +1,11 @@ -using System.Linq; -using System.Numerics; -using Dalamud.Interface; -using Dalamud.Interface.Internal; +using Dalamud.Interface; using Dalamud.Interface.Textures.TextureWraps; using Dalamud.Interface.Utility; using Dalamud.Interface.Utility.Raii; using ECommons.ImGuiMethods; using ImGuiNET; +using System.Linq; +using System.Numerics; using XIVSlothCombo.Core; using XIVSlothCombo.Services; using XIVSlothCombo.Window.Functions; @@ -42,7 +41,8 @@ internal class PvPFeatures : ConfigWindow ImGui.TextWrapped($"{FontAwesomeIcon.SkullCrossbones.ToIconString()}"); ImGui.PopFont(); }); - ImGuiEx.LineCentered($"pvpDesc2", () => { + ImGuiEx.LineCentered($"pvpDesc2", () => + { ImGuiEx.TextUnderlined("Select a job from below to enable and configure features for it."); }); ImGui.Spacing(); diff --git a/XIVSlothCombo/Window/Tabs/Settings.cs b/XIVSlothCombo/Window/Tabs/Settings.cs index a36a53a51..71ae59937 100644 --- a/XIVSlothCombo/Window/Tabs/Settings.cs +++ b/XIVSlothCombo/Window/Tabs/Settings.cs @@ -1,6 +1,6 @@ -using System; +using ImGuiNET; +using System; using System.Numerics; -using ImGuiNET; using XIVSlothCombo.Attributes; using XIVSlothCombo.Services; diff --git a/XIVSlothCombo/Window/TargetHelper.cs b/XIVSlothCombo/Window/TargetHelper.cs index 6fe678514..f8d0afe02 100644 --- a/XIVSlothCombo/Window/TargetHelper.cs +++ b/XIVSlothCombo/Window/TargetHelper.cs @@ -28,7 +28,7 @@ internal unsafe void DrawTargetHelper() if (CustomComboFunctions.GetPartySlot(i) is null) continue; if (CustomComboFunctions.GetPartySlot(i).GameObjectId == Combos.JobHelpers.AST.AST_QuickTargetCards.SelectedRandomMember.GameObjectId) { - IntPtr partyPTR = Service.GameGui.GetAddonByName("_PartyList", 1); + IntPtr partyPTR = Svc.GameGui.GetAddonByName("_PartyList", 1); if (partyPTR == IntPtr.Zero) return; diff --git a/XIVSlothCombo/XIVSlothCombo.cs b/XIVSlothCombo/XIVSlothCombo.cs index 92e4d0f4d..8089b4de7 100644 --- a/XIVSlothCombo/XIVSlothCombo.cs +++ b/XIVSlothCombo/XIVSlothCombo.cs @@ -3,13 +3,20 @@ using Dalamud.Game.Text; using Dalamud.Game.Text.SeStringHandling; using Dalamud.Game.Text.SeStringHandling.Payloads; +using Dalamud.Interface.Windowing; using Dalamud.Plugin; +using Dalamud.Plugin.Services; +using Dalamud.Utility; +using ECommons; +using ECommons.DalamudServices; using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Net.Http; +using System.Reflection; using System.Threading.Tasks; +using XIVSlothCombo.Attributes; using XIVSlothCombo.Combos; using XIVSlothCombo.Combos.PvE; using XIVSlothCombo.Combos.PvP; @@ -18,15 +25,6 @@ using XIVSlothCombo.Services; using XIVSlothCombo.Window; using XIVSlothCombo.Window.Tabs; -using ECommons; -using Dalamud.Plugin.Services; -using System.Reflection; -using Dalamud.Utility; -using XIVSlothCombo.Attributes; -using Dalamud.Interface.Windowing; -using Dalamud.Game.Addon.Lifecycle; -using ECommons.DalamudServices; -using Dalamud.Game.Addon.Lifecycle.AddonArgTypes; namespace XIVSlothCombo { @@ -82,7 +80,7 @@ public static uint? JobID { if (jobID != value && value != null) { - Service.PluginLog.Debug($"Switched to job {value}"); + Svc.Log.Debug($"Switched to job {value}"); PvEFeatures.HasToOpenJob = true; } jobID = value; @@ -99,7 +97,7 @@ public XIVSlothCombo(IDalamudPluginInterface pluginInterface) Service.Configuration = pluginInterface.GetPluginConfig() as PluginConfiguration ?? new PluginConfiguration(); Service.Address = new PluginAddressResolver(); - Service.Address.Setup(Service.SigScanner); + Service.Address.Setup(Svc.SigScanner); PresetStorage.Init(); Service.ComboCache = new CustomComboCache(); @@ -114,19 +112,19 @@ public XIVSlothCombo(IDalamudPluginInterface pluginInterface) ws.AddWindow(ConfigWindow); ws.AddWindow(TargetHelper); - Service.Interface.UiBuilder.Draw += ws.Draw; - Service.Interface.UiBuilder.OpenConfigUi += OnOpenConfigUi; + Svc.PluginInterface.UiBuilder.Draw += ws.Draw; + Svc.PluginInterface.UiBuilder.OpenConfigUi += OnOpenConfigUi; - Service.CommandManager.AddHandler(Command, new CommandInfo(OnCommand) + Svc.Commands.AddHandler(Command, new CommandInfo(OnCommand) { HelpMessage = "Open a window to edit custom combo settings.", ShowInHelp = true, }); - Service.ClientState.Login += PrintLoginMessage; - if (Service.ClientState.IsLoggedIn) ResetFeatures(); + Svc.ClientState.Login += PrintLoginMessage; + if (Svc.ClientState.IsLoggedIn) ResetFeatures(); - Service.Framework.Update += OnFrameworkUpdate; + Svc.Framework.Update += OnFrameworkUpdate; KillRedundantIDs(); HandleConflictedCombos(); @@ -160,8 +158,8 @@ private static void HandleConflictedCombos() private void OnFrameworkUpdate(IFramework framework) { - if (Service.ClientState.LocalPlayer is not null) - JobID = Service.ClientState.LocalPlayer?.ClassJob?.Id; + if (Svc.ClientState.LocalPlayer is not null) + JobID = Svc.ClientState.LocalPlayer?.ClassJob?.Id; BlueMageService.PopulateBLUSpells(); TargetHelper.Draw(); @@ -218,7 +216,7 @@ private void PrintMotD() EmphasisItalicPayload.ItalicsOff ]; - Service.ChatGui.Print(new XivChatEntry + Svc.Chat.Print(new XivChatEntry { Message = new SeString(payloads), Type = XivChatType.Echo @@ -227,7 +225,7 @@ private void PrintMotD() catch (Exception ex) { - Service.PluginLog.Error(ex, "Unable to retrieve MotD"); + Svc.Log.Error(ex, "Unable to retrieve MotD"); } } @@ -241,10 +239,10 @@ public void Dispose() ConfigWindow?.Dispose(); ws.RemoveAllWindows(); - Service.CommandManager.RemoveHandler(Command); - Service.Framework.Update -= OnFrameworkUpdate; - Service.Interface.UiBuilder.OpenConfigUi -= OnOpenConfigUi; - Service.Interface.UiBuilder.Draw -= DrawUI; + Svc.Commands.RemoveHandler(Command); + Svc.Framework.Update -= OnFrameworkUpdate; + Svc.PluginInterface.UiBuilder.OpenConfigUi -= OnOpenConfigUi; + Svc.PluginInterface.UiBuilder.Draw -= DrawUI; Service.IconReplacer?.Dispose(); Service.ComboCache?.Dispose(); @@ -252,7 +250,7 @@ public void Dispose() Combos.JobHelpers.AST.Dispose(); DisposeOpeners(); - Service.ClientState.Login -= PrintLoginMessage; + Svc.ClientState.Login -= PrintLoginMessage; P = null; } @@ -277,14 +275,14 @@ private void OnCommand(string command, string arguments) Service.Configuration.EnabledActions.Remove(preset); } - Service.ChatGui.Print("All UNSET"); + Svc.Chat.Print("All UNSET"); Service.Configuration.Save(); break; } case "set": // set a feature { - if (!Service.Condition[Dalamud.Game.ClientState.Conditions.ConditionFlag.InCombat]) + if (!Svc.Condition[Dalamud.Game.ClientState.Conditions.ConditionFlag.InCombat]) { string? targetPreset = argumentsParts[1].ToLowerInvariant(); foreach (CustomComboPreset preset in Enum.GetValues()) @@ -293,7 +291,7 @@ private void OnCommand(string command, string arguments) continue; Service.Configuration.EnabledActions.Add(preset); - Service.ChatGui.Print($"{preset} SET"); + Svc.Chat.Print($"{preset} SET"); } Service.Configuration.Save(); @@ -301,7 +299,7 @@ private void OnCommand(string command, string arguments) else { - Service.ChatGui.PrintError("Features cannot be set in combat."); + Svc.Chat.PrintError("Features cannot be set in combat."); } break; @@ -309,7 +307,7 @@ private void OnCommand(string command, string arguments) case "toggle": // toggle a feature { - if (!Service.Condition[Dalamud.Game.ClientState.Conditions.ConditionFlag.InCombat]) + if (!Svc.Condition[Dalamud.Game.ClientState.Conditions.ConditionFlag.InCombat]) { string? targetPreset = argumentsParts[1].ToLowerInvariant(); foreach (CustomComboPreset preset in Enum.GetValues()) @@ -320,11 +318,11 @@ private void OnCommand(string command, string arguments) if (!Service.Configuration.EnabledActions.Remove(preset)) { Service.Configuration.EnabledActions.Add(preset); - Service.ChatGui.Print($"{preset} SET"); + Svc.Chat.Print($"{preset} SET"); } else { - Service.ChatGui.Print($"{preset} UNSET"); + Svc.Chat.Print($"{preset} UNSET"); } } @@ -333,7 +331,7 @@ private void OnCommand(string command, string arguments) else { - Service.ChatGui.PrintError("Features cannot be toggled in combat."); + Svc.Chat.PrintError("Features cannot be toggled in combat."); } break; @@ -341,7 +339,7 @@ private void OnCommand(string command, string arguments) case "unset": // unset a feature { - if (!Service.Condition[Dalamud.Game.ClientState.Conditions.ConditionFlag.InCombat]) + if (!Svc.Condition[Dalamud.Game.ClientState.Conditions.ConditionFlag.InCombat]) { string? targetPreset = argumentsParts[1].ToLowerInvariant(); foreach (CustomComboPreset preset in Enum.GetValues()) @@ -350,7 +348,7 @@ private void OnCommand(string command, string arguments) continue; Service.Configuration.EnabledActions.Remove(preset); - Service.ChatGui.Print($"{preset} UNSET"); + Svc.Chat.Print($"{preset} UNSET"); } Service.Configuration.Save(); @@ -358,7 +356,7 @@ private void OnCommand(string command, string arguments) else { - Service.ChatGui.PrintError("Features cannot be unset in combat."); + Svc.Chat.PrintError("Features cannot be unset in combat."); } break; @@ -375,7 +373,7 @@ private void OnCommand(string command, string arguments) foreach (bool preset in Enum.GetValues() .Select(preset => PresetStorage.IsEnabled(preset))) { - Service.ChatGui.Print(preset.ToString()); + Svc.Chat.Print(preset.ToString()); } } @@ -384,7 +382,7 @@ private void OnCommand(string command, string arguments) foreach (bool preset in Enum.GetValues() .Select(preset => !PresetStorage.IsEnabled(preset))) { - Service.ChatGui.Print(preset.ToString()); + Svc.Chat.Print(preset.ToString()); } } @@ -392,13 +390,13 @@ private void OnCommand(string command, string arguments) { foreach (CustomComboPreset preset in Enum.GetValues()) { - Service.ChatGui.Print(preset.ToString()); + Svc.Chat.Print(preset.ToString()); } } else { - Service.ChatGui.PrintError("Available list filters: set, unset, all"); + Svc.Chat.PrintError("Available list filters: set, unset, all"); } break; @@ -409,7 +407,7 @@ private void OnCommand(string command, string arguments) foreach (CustomComboPreset preset in Service.Configuration.EnabledActions.OrderBy(x => x)) { if (int.TryParse(preset.ToString(), out int pres)) continue; - Service.ChatGui.Print($"{(int)preset} - {preset}"); + Svc.Chat.Print($"{(int)preset} - {preset}"); } break; @@ -432,14 +430,14 @@ private void OnCommand(string command, string arguments) file.WriteLine($"Installation Repo: {RepoCheckFunctions.FetchCurrentRepo()?.InstalledFromUrl}"); // Installation Repo file.WriteLine(""); file.WriteLine($"Current Job: " + // Current Job - $"{Service.ClientState.LocalPlayer.ClassJob.GameData.Name} / " + // - Client Name - $"{Service.ClientState.LocalPlayer.ClassJob.GameData.NameEnglish} / " + // - EN Name - $"{Service.ClientState.LocalPlayer.ClassJob.GameData.Abbreviation}"); // - Abbreviation - file.WriteLine($"Current Job Index: {Service.ClientState.LocalPlayer.ClassJob.Id}"); // Job Index - file.WriteLine($"Current Job Level: {Service.ClientState.LocalPlayer.Level}"); // Job Level + $"{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 + file.WriteLine($"Current Job Level: {Svc.ClientState.LocalPlayer.Level}"); // Job Level file.WriteLine(""); - file.WriteLine($"Current Zone: {Service.DataManager.GetExcelSheet()?.FirstOrDefault(x => x.RowId == Service.ClientState.TerritoryType).PlaceName.Value.Name}"); // Current zone location - file.WriteLine($"Current Party Size: {Service.PartyList.Length}"); // Current party size + 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"); @@ -501,7 +499,7 @@ 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 = Service.DataManager.GetExcelSheet()? + var jobID = Svc.Data.GetExcelSheet()? .Where(x => x.Name.RawString.Equals(jobname, StringComparison.CurrentCultureIgnoreCase)) .First() .RowId; @@ -573,12 +571,12 @@ private void OnCommand(string command, string arguments) file.WriteLine(""); } - file.WriteLine($"Status Effect Count: {Service.ClientState.LocalPlayer.StatusList.Count(x => x != null)}"); + file.WriteLine($"Status Effect Count: {Svc.ClientState.LocalPlayer.StatusList.Count(x => x != null)}"); - if (Service.ClientState.LocalPlayer.StatusList.Length > 0) + if (Svc.ClientState.LocalPlayer.StatusList.Length > 0) { file.WriteLine($"START STATUS EFFECTS"); - foreach (Status? status in Service.ClientState.LocalPlayer.StatusList) + foreach (Status? status in Svc.ClientState.LocalPlayer.StatusList) { file.WriteLine($"ID: {status.StatusId}, COUNT: {status.StackCount}, SOURCE: {status.SourceId} NAME: {ActionWatching.GetStatusName(status.StatusId)}"); } @@ -587,15 +585,15 @@ private void OnCommand(string command, string arguments) } file.WriteLine("END DEBUG LOG"); - Service.ChatGui.Print("Please check your desktop for SlothDebug.txt and upload this file where requested."); + Svc.Chat.Print("Please check your desktop for SlothDebug.txt and upload this file where requested."); break; } catch (Exception ex) { - Service.PluginLog.Error(ex, "Debug Log"); - Service.ChatGui.Print("Unable to write Debug log."); + Svc.Log.Error(ex, "Debug Log"); + Svc.Chat.Print("Unable to write Debug log."); break; } } @@ -606,7 +604,7 @@ private void OnCommand(string command, string arguments) { var jobname = ConfigWindow.groupedPresets.Where(x => x.Value.Any(y => y.Info.JobShorthand.Equals(argumentsParts[0].ToLower(), StringComparison.CurrentCultureIgnoreCase))).FirstOrDefault().Key; var header = $"{jobname} - {argumentsParts[0].ToUpper()}"; - Service.PluginLog.Debug($"{jobname}"); + Svc.Log.Debug($"{jobname}"); PvEFeatures.HeaderToOpen = header; } break;