From 16a5788695af8df1d54df952fc53434849db0270 Mon Sep 17 00:00:00 2001 From: goat Date: Fri, 18 Oct 2019 23:50:02 +0900 Subject: [PATCH] New config system, config flags for combos, commands for combos --- Dalamud/Configuration/CustomComboPreset.cs | 147 +++++ Dalamud/Configuration/DalamudConfiguration.cs | 29 + Dalamud/Dalamud.cs | 61 +- Dalamud/Dalamud.csproj | 3 + Dalamud/DalamudStartInfo.cs | 9 +- Dalamud/Game/ClientState/ClientState.cs | 3 + Dalamud/Game/ClientState/JobGauge.cs | 12 +- Dalamud/Game/Internal/Framework.cs | 2 +- Dalamud/Game/Internal/Gui/IconReplacer.cs | 563 ++++++++++-------- 9 files changed, 572 insertions(+), 257 deletions(-) create mode 100644 Dalamud/Configuration/CustomComboPreset.cs create mode 100644 Dalamud/Configuration/DalamudConfiguration.cs diff --git a/Dalamud/Configuration/CustomComboPreset.cs b/Dalamud/Configuration/CustomComboPreset.cs new file mode 100644 index 000000000..965a8574d --- /dev/null +++ b/Dalamud/Configuration/CustomComboPreset.cs @@ -0,0 +1,147 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace XIVLauncher.Dalamud +{ + [Flags] + public enum CustomComboPreset + { + None = 0, + + // DRAGOON + [CustomComboInfo("Coerthan Torment Combo", "Replace Coearthan Torment with its combo chain", 22)] + DragoonCoerthanTormentCombo = 1 << 0, + + [CustomComboInfo("Chaos Thrust Combo", "Replace Chaos Thrust with its combo chain", 22)] + DragoonChaosThrustCombo = 1 << 1, + + [CustomComboInfo("Full Thrust Combo", "Replace Full Thrust with its combo chain", 22)] + DragoonFullThrustCombo = 1 << 2, + + // DARK KNIGHT + [CustomComboInfo("Souleater Combo", "Replace Souleater with its combo chain", 32)] + DarkSouleaterCombo = 1 << 3, + + [CustomComboInfo("Stalwart Soul Combo", "Replace Stalwart Soul with its combo chain", 32)] + DarkStalwartSoulCombo = 1 << 4, + + // PALADIN + [CustomComboInfo("Goring Blade Combo", "Replace Goring Blade with its combo chain", 19)] + PaladinGoringBladeCombo = 1 << 5, + + [CustomComboInfo("Royal Authority Combo", "Replace Royal Authority with its combo chain", 19)] + PaladinRoyalAuthorityCombo = 1 << 6, + + [CustomComboInfo("Prominence Combo", "Replace Prominence with its combo chain", 19)] + PaladinProminenceCombo = 1 << 7, + + // WARRIOR + [CustomComboInfo("Storms Path Combo", "Replace Storms Path with its combo chain", 21)] + WarriorStormsPathCombo = 1 << 8, + + [CustomComboInfo("Storms Eye Combo", "Replace Storms Eye with its combo chain", 21)] + WarriorStormsEyeCombo = 1 << 9, + + [CustomComboInfo("Mythril Tempest Combo", "Replace Mythril Tempest with its combo chain", 21)] + WarriorMythrilTempestCombo = 1 << 10, + + // SAMURAI + [CustomComboInfo("Yukikaze Combo", "Replace Yukikaze with its combo chain", 34)] + SamuraiYukikazeCombo = 1 << 11, + + [CustomComboInfo("Gekko Combo", "Replace Gekko with its combo chain", 34)] + SamuraiGekkoCombo = 1 << 12, + + [CustomComboInfo("Kasha Combo", "Replace Kasha with its combo chain", 34)] + SamuraiKashaCombo = 1 << 13, + + [CustomComboInfo("Mangetsu Combo", "Replace Mangetsu with its combo chain", 34)] + SamuraiMangetsuCombo = 1 << 14, + + [CustomComboInfo("Oka Combo", "Replace Oka with its combo chain", 34)] + SamuraiOkaCombo = 1 << 15, + + + // NINJA + [CustomComboInfo("Shadow Fang Combo", "Replace Shadow Fang with its combo chain", 30)] + NinjaShadowFangCombo = 1 << 16, + + [CustomComboInfo("Armor Crush Combo", "Replace Armor Crush with its combo chain", 30)] + NinjaArmorCrushCombo = 1 << 17, + + [CustomComboInfo("Aeolian Edge Combo", "Replace Aeolian Edge with its combo chain", 30)] + NinjaAeolianEdgeCombo = 1 << 18, + + [CustomComboInfo("Hakke Mujinsatsu Combo", "Replace Hakke Mujinsatsu with its combo chain", 30)] + NinjaHakkeMujinsatsuCombo = 1 << 19, + + // GUNBREAKER + [CustomComboInfo("Solid Barrel Combo", "Replace Solid Barrel with its combo chain", 37)] + GunbreakerSolidBarrelCombo = 1 << 20, + + [CustomComboInfo("Gnashing Fang Combo", "Replace Gnashing Fang with its combo chain", 37)] + GunbreakerGnashingFangCombo = 1 << 21, + + [CustomComboInfo("Demon Slaughter Combo", "Replace Demon Slaughter with its combo chain", 37)] + GunbreakerDemonSlaughterCombo = 1 << 22, + + // MACHINIST + [CustomComboInfo("Heated Clan Shot Combo/Heat", "Replace Heated Clan Shot with its combo chain or with Heat Blast when overheated.", 31)] + MachinistHeatedClanShotFeature = 1 << 23, + + [CustomComboInfo("Spread Shot Heat", "Replace Spread Shot with Heat Blast when overheated.", 31)] + MachinistSpreadShotFeature = 1 << 24, + + // BLACK MAGE + [CustomComboInfo("Enochian Stance Switcher", "Change Enochian to Fire 4 or Blizzard 4 depending on stance.", 25)] + BlackEnochianFeature = 1 << 25, + + [CustomComboInfo("Umbral Soul/Transpose Switcher", "Change between Umbral Soul and Transpose automatically.", 25)] + BlackManaFeature = 1 << 26, + + // ASTROLOGIAN + [CustomComboInfo("Cards on Draw", "Play your Astrologian Cards on Draw.", 33)] + AstrologianCardsOnDrawFeature = 1 << 27, + + // SUMMONER + [CustomComboInfo("Dreadwyrm Combiner", "Now comes with Dreadwyrm Trance, Deathflare, Summon Bahamut, Enkindle Bahamut, FBT, and Enkindle Phoenix.", 27)] + SummonerDwtCombo = 1 << 28, + + // SCHOLAR + [CustomComboInfo("Seraph Fey Blessing/Consolation", "Change Fey Blessing into Consolation when Seraph is out.", 28)] + ScholarSeraphConsolationFeature = 1 << 29, + + // DANCER + [CustomComboInfo("Standard Step Combo", "Standard Step on one button.", 38)] + DancerStandardStepCombo = 1 << 30, + + [CustomComboInfo("Technical Step Combo", "Technical Step on one button.", 38)] + DancerTechnicalStepCombo = 1 << 31, + + [CustomComboInfo("AoE GCD procs", "Replaces all AoE GCDs with their procced version when available.", 38)] + DancerAoeGcdFeature = 1 << 32, + + [CustomComboInfo("Fan Dance Combos", "Change Fan Dance and Fan Dance 2 into Fan Dance 3 while flourishing.", 38)] + DancerFanDanceCombo = 1 << 33, + + [CustomComboInfo("Fountain Combos", "Fountain changes into Fountain combo, prioritizing procs over combo, and Fountainfall over Reverse Cascade.", 38)] + DancerFountainCombo = 1 << 34 + } + + public class CustomComboInfoAttribute : Attribute + { + internal CustomComboInfoAttribute(string fancyName, string description, byte classJob) + { + FancyName = fancyName; + Description = description; + ClassJob = classJob; + } + + public string FancyName { get; } + public string Description { get; } + public byte ClassJob { get; } + } +} diff --git a/Dalamud/Configuration/DalamudConfiguration.cs b/Dalamud/Configuration/DalamudConfiguration.cs new file mode 100644 index 000000000..32f2c0bd9 --- /dev/null +++ b/Dalamud/Configuration/DalamudConfiguration.cs @@ -0,0 +1,29 @@ +using System; +using System.Collections.Generic; +using System.IO; +using Dalamud.DiscordBot; +using Newtonsoft.Json; +using XIVLauncher.Dalamud; + +namespace Dalamud +{ + [Serializable] + public class DalamudConfiguration + { + public DiscordFeatureConfiguration DiscordFeatureConfig { get; set; } + + public bool OptOutMbCollection { get; set; } = false; + + public CustomComboPreset ComboPresets { get; set; } + + public List BadWords { get; set; } + + public static DalamudConfiguration Load(string path) { + return JsonConvert.DeserializeObject(File.ReadAllText(path)); + } + + public void Save(string path) { + File.WriteAllText(path, JsonConvert.SerializeObject(this)); + } + } +} diff --git a/Dalamud/Dalamud.cs b/Dalamud/Dalamud.cs index c5ecdf65f..b93033c92 100644 --- a/Dalamud/Dalamud.cs +++ b/Dalamud/Dalamud.cs @@ -16,6 +16,7 @@ using Dalamud.Game.Network; using Dalamud.Plugin; using Dalamud.Settings; using Serilog; +using XIVLauncher.Dalamud; namespace Dalamud { public sealed class Dalamud : IDisposable { @@ -42,8 +43,11 @@ namespace Dalamud { public readonly IconReplacer IconReplacer; + public readonly DalamudConfiguration Configuration; + public Dalamud(DalamudStartInfo info) { this.StartInfo = info; + this.Configuration = DalamudConfiguration.Load(info.ConfigurationPath); this.baseDirectory = info.WorkingDirectory; @@ -61,11 +65,11 @@ namespace Dalamud { SetupCommands(); ChatHandlers = new ChatHandlers(this); - NetworkHandlers = new NetworkHandlers(this, info.OptOutMbCollection); + NetworkHandlers = new NetworkHandlers(this, this.Configuration.OptOutMbCollection); this.ClientState = new ClientState(this, info, this.sigScanner, this.targetModule); - this.BotManager = new DiscordBotManager(this, info.DiscordFeatureConfig); + this.BotManager = new DiscordBotManager(this, this.Configuration.DiscordFeatureConfig); this.PluginManager = new PluginManager(this, info.PluginDirectory, info.DefaultPluginDirectory); @@ -122,6 +126,11 @@ namespace Dalamud { ShowInHelp = false }); + CommandManager.AddHandler("/xldcombo", new CommandInfo(OnCommandDebugCombo) { + HelpMessage = "COMBO debug", + ShowInHelp = false + }); + CommandManager.AddHandler("/xlhelp", new CommandInfo(OnCommandHelp) { HelpMessage = "Shows list of commands available." }); @@ -320,6 +329,54 @@ namespace Dalamud { } } + private void OnCommandDebugCombo(string command, string arguments) { + var argumentsParts = arguments.Split(); + + switch (argumentsParts[0]) { + case "setall": { + foreach (var value in Enum.GetValues(typeof(CustomComboPreset)).Cast()) { + if (value == CustomComboPreset.None) + continue; + + this.Configuration.ComboPresets |= value; + } + + Framework.Gui.Chat.Print("all SET"); + } + break; + case "unsetall": { + foreach (var value in Enum.GetValues(typeof(CustomComboPreset)).Cast()) { + this.Configuration.ComboPresets &= value; + } + + Framework.Gui.Chat.Print("all UNSET"); + } + break; + case "set": { + foreach (var value in Enum.GetValues(typeof(CustomComboPreset)).Cast()) { + if (value.ToString().ToLower() != argumentsParts[1].ToLower()) + continue; + + this.Configuration.ComboPresets |= value; + Framework.Gui.Chat.Print(argumentsParts[1] + " SET"); + } + } + break; + case "list": { + foreach (var value in Enum.GetValues(typeof(CustomComboPreset)).Cast()) { + if (this.Configuration.ComboPresets.HasFlag(value)) + Framework.Gui.Chat.Print(value.ToString()); + } + } + break; + + default: Framework.Gui.Chat.Print("Unknown"); + break; + } + + this.Configuration.Save(this.StartInfo.ConfigurationPath); + } + private void OnBotJoinCommand(string command, string arguments) { if (this.BotManager != null && this.BotManager.IsConnected) Process.Start( diff --git a/Dalamud/Dalamud.csproj b/Dalamud/Dalamud.csproj index 99f9eca5e..b14a0da76 100644 --- a/Dalamud/Dalamud.csproj +++ b/Dalamud/Dalamud.csproj @@ -64,4 +64,7 @@ Resources.Designer.cs + + + \ No newline at end of file diff --git a/Dalamud/DalamudStartInfo.cs b/Dalamud/DalamudStartInfo.cs index b0cac09b2..16d43e5fa 100644 --- a/Dalamud/DalamudStartInfo.cs +++ b/Dalamud/DalamudStartInfo.cs @@ -3,15 +3,14 @@ using Dalamud.DiscordBot; namespace Dalamud { [Serializable] - public sealed class DalamudStartInfo { + public sealed class DalamudStartInfo + { public string WorkingDirectory; + public string ConfigurationPath; + public string PluginDirectory; public string DefaultPluginDirectory; public ClientLanguage Language; - - public DiscordFeatureConfiguration DiscordFeatureConfig { get; set; } - - public bool OptOutMbCollection { get; set; } = false; } public enum ClientLanguage diff --git a/Dalamud/Game/ClientState/ClientState.cs b/Dalamud/Game/ClientState/ClientState.cs index e12d542b1..98e1c2e29 100644 --- a/Dalamud/Game/ClientState/ClientState.cs +++ b/Dalamud/Game/ClientState/ClientState.cs @@ -10,6 +10,7 @@ using System.Threading.Tasks; using Dalamud.Game.ClientState.Actors; using Dalamud.Game.ClientState.Actors.Types; using Dalamud.Game.Internal; +using Serilog; namespace Dalamud.Game.ClientState { @@ -54,6 +55,8 @@ namespace Dalamud.Game.ClientState Address = new ClientStateAddressResolver(); Address.Setup(scanner); + Log.Verbose("===== C L I E N T S T A T E ====="); + this.ClientLanguage = startInfo.Language; this.Actors = new ActorTable(Address); diff --git a/Dalamud/Game/ClientState/JobGauge.cs b/Dalamud/Game/ClientState/JobGauge.cs index 3e458fffc..916921af7 100644 --- a/Dalamud/Game/ClientState/JobGauge.cs +++ b/Dalamud/Game/ClientState/JobGauge.cs @@ -1,11 +1,5 @@ -using Dalamud.Game.ClientState.Structs.JobGauge; -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.Linq; using System.Runtime.InteropServices; -using System.Text; -using System.Threading.Tasks; +using Serilog; namespace Dalamud.Game.ClientState { public class JobGauges { @@ -13,12 +7,14 @@ namespace Dalamud.Game.ClientState { public JobGauges(ClientStateAddressResolver addressResolver) { Address = addressResolver; + + Log.Verbose("JobGaugeData address {JobGaugeData}", Address.ActorTable); } // Should only be called with the gauge types in // ClientState.Structs.JobGauge public T Get() { - return Marshal.PtrToStructure(Address.ActorTable); + return Marshal.PtrToStructure(Address.JobGaugeData); } } } diff --git a/Dalamud/Game/Internal/Framework.cs b/Dalamud/Game/Internal/Framework.cs index 487ff699a..547753157 100644 --- a/Dalamud/Game/Internal/Framework.cs +++ b/Dalamud/Game/Internal/Framework.cs @@ -56,7 +56,7 @@ namespace Dalamud.Game.Internal { Network = new GameNetwork(dalamud, scanner); - Resource = new ResourceManager(dalamud, scanner); + //Resource = new ResourceManager(dalamud, scanner); } private void HookVTable() { diff --git a/Dalamud/Game/Internal/Gui/IconReplacer.cs b/Dalamud/Game/Internal/Gui/IconReplacer.cs index a248378c5..234426564 100644 --- a/Dalamud/Game/Internal/Gui/IconReplacer.cs +++ b/Dalamud/Game/Internal/Gui/IconReplacer.cs @@ -6,6 +6,7 @@ using Serilog; using System; using System.Diagnostics; using System.Runtime.InteropServices; +using XIVLauncher.Dalamud; namespace Dalamud.Game.Internal.Gui { public class IconReplacer { @@ -94,240 +95,296 @@ namespace Dalamud.Game.Internal.Gui { // TODO: Jump/High Jump into Mirage Dive // Replace Coerthan Torment with Coerthan Torment combo chain - if (actionID == 16477) { - if (comboTime > 0) { - if (Marshal.ReadInt32(lastComboMove) == 86) return 7397; - if (Marshal.ReadInt32(lastComboMove) == 7397) return 16477; + if (this.dalamud.Configuration.ComboPresets.HasFlag(CustomComboPreset.DragoonCoerthanTormentCombo)) { + if (actionID == 16477) { + if (comboTime > 0) { + if (Marshal.ReadInt32(lastComboMove) == 86) return 7397; + if (Marshal.ReadInt32(lastComboMove) == 7397) return 16477; + } + return 86; } - return 86; } + // Replace Chaos Thrust with the Chaos Thrust combo chain - if (actionID == 88) { - if (comboTime > 0) { - if (lastMove == 75 || lastMove == 16479) return 87; - if (lastMove == 87) return 88; + if (this.dalamud.Configuration.ComboPresets.HasFlag(CustomComboPreset.DragoonChaosThrustCombo)) { + if (actionID == 88) { + if (comboTime > 0) { + if (lastMove == 75 || lastMove == 16479) return 87; + if (lastMove == 87) return 88; + } + if (activeBuffArray != IntPtr.Zero) { + if (SearchBuffArray(802)) return 3554; + if (SearchBuffArray(803)) return 3556; + if (SearchBuffArray(1863)) return 16479; + } + return 75; } - if (activeBuffArray != IntPtr.Zero) { - if (SearchBuffArray(802)) return 3554; - if (SearchBuffArray(803)) return 3556; - if (SearchBuffArray(1863)) return 16479; - } - return 75; } + // Replace Full Thrust with the Full Thrust combo chain - if (actionID == 84) { - if (comboTime > 0) { - if (lastMove == 75 || lastMove == 16479) return 78; - if (lastMove == 78) return 84; + if (this.dalamud.Configuration.ComboPresets.HasFlag(CustomComboPreset.DragoonFullThrustCombo)) { + if (actionID == 84) { + if (comboTime > 0) { + if (lastMove == 75 || lastMove == 16479) return 78; + if (lastMove == 78) return 84; + } + + if (activeBuffArray != IntPtr.Zero) { + if (SearchBuffArray(802)) return 3554; + if (SearchBuffArray(803)) return 3556; + if (SearchBuffArray(1863)) return 16479; + } + + return 75; } - if (activeBuffArray != IntPtr.Zero) { - if (SearchBuffArray(802)) return 3554; - if (SearchBuffArray(803)) return 3556; - if (SearchBuffArray(1863)) return 16479; - } - return 75; } // DARK KNIGHT // Replace Souleater with Souleater combo chain - if (actionID == 3632) { - if (comboTime > 0) { - if (lastMove == 3617) return 3623; - if (lastMove == 3623) return 3632; + if (this.dalamud.Configuration.ComboPresets.HasFlag(CustomComboPreset.DarkSouleaterCombo)) { + if (actionID == 3632) { + if (comboTime > 0) { + if (lastMove == 3617) return 3623; + if (lastMove == 3623) return 3632; + } + + return 3617; } - return 3617; } // Replace Stalwart Soul with Stalwart Soul combo chain - if (actionID == 16468) { - if (comboTime > 0) { - if (lastMove == 3621) return 16468; + if (this.dalamud.Configuration.ComboPresets.HasFlag(CustomComboPreset.DarkStalwartSoulCombo)) { + if (actionID == 16468) { + if (comboTime > 0) { + if (lastMove == 3621) return 16468; + } + + return 3621; } - return 3621; } // PALADIN // Replace Goring Blade with Goring Blade combo - if (actionID == 3538) { - if (comboTime > 0) { - if (lastMove == 9) return 15; - if (lastMove == 15) return 3538; + if (this.dalamud.Configuration.ComboPresets.HasFlag(CustomComboPreset.PaladinGoringBladeCombo)) { + if (actionID == 3538) { + if (comboTime > 0) { + if (lastMove == 9) return 15; + if (lastMove == 15) return 3538; + } + + return 9; } - return 9; } // Replace Royal Authority with Royal Authority combo - if (actionID == 3539) { - if (comboTime > 0) { - if (lastMove == 9) return 15; - if (lastMove == 15) return 3539; + if (this.dalamud.Configuration.ComboPresets.HasFlag(CustomComboPreset.PaladinRoyalAuthorityCombo)) { + if (actionID == 3539) { + if (comboTime > 0) { + if (lastMove == 9) return 15; + if (lastMove == 15) return 3539; + } + + return 9; } - return 9; } // Replace Prominence with Prominence combo - if (actionID == 16457) { - if (comboTime > 0) { - if (lastMove == 7381) return 16457; + if (this.dalamud.Configuration.ComboPresets.HasFlag(CustomComboPreset.PaladinProminenceCombo)) { + if (actionID == 16457) { + if (comboTime > 0) { + if (lastMove == 7381) return 16457; + } + + return 7381; } - return 7381; } // WARRIOR // Replace Storm's Path with Storm's Path combo - if (actionID == 42) { - if (comboTime > 0) { - if (lastMove == 31) return 37; - if (lastMove == 37) return 42; + if (this.dalamud.Configuration.ComboPresets.HasFlag(CustomComboPreset.WarriorStormsPathCombo)) { + if (actionID == 42) { + if (comboTime > 0) { + if (lastMove == 31) return 37; + if (lastMove == 37) return 42; + } + + return 31; } - return 31; } // Replace Storm's Eye with Storm's Eye combo - if (actionID == 45) { - if (comboTime > 0) { - if (lastMove == 31) return 37; - if (lastMove == 37) return 45; + if (this.dalamud.Configuration.ComboPresets.HasFlag(CustomComboPreset.WarriorStormsEyeCombo)) { + if (actionID == 45) { + if (comboTime > 0) { + if (lastMove == 31) return 37; + if (lastMove == 37) return 45; + } + return 31; } - return 31; } // Replace Mythril Tempest with Mythril Tempest combo - if (actionID == 16462) { - if (comboTime > 0) { - if (lastMove == 41) return 16462; + if (this.dalamud.Configuration.ComboPresets.HasFlag(CustomComboPreset.WarriorMythrilTempestCombo)) { + if (actionID == 16462) { + if (comboTime > 0) { + if (lastMove == 41) return 16462; + } + return 41; } - return 41; } // SAMURAI // Replace Yukikaze with Yukikaze combo - if (actionID == 7480) { - if (activeBuffArray != IntPtr.Zero) { - if (SearchBuffArray(1233)) return 7480; + if (this.dalamud.Configuration.ComboPresets.HasFlag(CustomComboPreset.SamuraiYukikazeCombo)) { + if (actionID == 7480) { + if (activeBuffArray != IntPtr.Zero) { + if (SearchBuffArray(1233)) return 7480; + } + if (comboTime > 0) { + if (lastMove == 7477) return 7480; + } + return 7477; } - if (comboTime > 0) { - if (lastMove == 7477) return 7480; - } - return 7477; } // Replace Gekko with Gekko combo - if (actionID == 7481) { - if (activeBuffArray != IntPtr.Zero) { - if (SearchBuffArray(1233)) return 7481; + if (this.dalamud.Configuration.ComboPresets.HasFlag(CustomComboPreset.SamuraiGekkoCombo)) { + if (actionID == 7481) { + if (activeBuffArray != IntPtr.Zero) { + if (SearchBuffArray(1233)) return 7481; + } + if (comboTime > 0) { + if (lastMove == 7477) return 7478; + if (lastMove == 7478) return 7481; + } + return 7477; } - if (comboTime > 0) { - if (lastMove == 7477) return 7478; - if (lastMove == 7478) return 7481; - } - return 7477; } // Replace Kasha with Kasha combo - if (actionID == 7482) { - if (activeBuffArray != null) { - if (SearchBuffArray(1233)) return 7482; + if (this.dalamud.Configuration.ComboPresets.HasFlag(CustomComboPreset.SamuraiKashaCombo)) { + if (actionID == 7482) { + if (activeBuffArray != null) { + if (SearchBuffArray(1233)) return 7482; + } + if (comboTime > 0) { + if (lastMove == 7477) return 7479; + if (lastMove == 7479) return 7482; + } + return 7477; } - if (comboTime > 0) { - if (lastMove == 7477) return 7479; - if (lastMove == 7479) return 7482; - } - return 7477; } // Replace Mangetsu with Mangetsu combo - if (actionID == 7484) { - if (activeBuffArray != null) { - if (SearchBuffArray(1233)) return 7484; + if (this.dalamud.Configuration.ComboPresets.HasFlag(CustomComboPreset.SamuraiMangetsuCombo)) { + if (actionID == 7484) { + if (activeBuffArray != null) { + if (SearchBuffArray(1233)) return 7484; + } + if (comboTime > 0) { + if (lastMove == 7483) return 7484; + } + return 7483; } - if (comboTime > 0) { - if (lastMove == 7483) return 7484; - } - return 7483; } - // Replace Yukikaze with Yukikaze combo - if (actionID == 7485) { - if (activeBuffArray != null) { - if (SearchBuffArray(1233)) return 7485; + // Replace Oka with Oka combo + if (this.dalamud.Configuration.ComboPresets.HasFlag(CustomComboPreset.SamuraiOkaCombo)) { + if (actionID == 7485) { + if (activeBuffArray != null) { + if (SearchBuffArray(1233)) return 7485; + } + if (comboTime > 0) { + if (lastMove == 7483) return 7485; + } + return 7483; } - if (comboTime > 0) { - if (lastMove == 7483) return 7485; - } - return 7483; } // NINJA // Replace Shadow Fang with Shadow Fang combo - if (actionID == 2257) { - if (comboTime > 0) { - if (lastMove == 2240) return 2257; + if (this.dalamud.Configuration.ComboPresets.HasFlag(CustomComboPreset.NinjaShadowFangCombo)) { + if (actionID == 2257) { + if (comboTime > 0) { + if (lastMove == 2240) return 2257; + } + return 2240; } - return 2240; } // Replace Armor Crush with Armor Crush combo - if (actionID == 2257) { - if (comboTime > 0) { - if (lastMove == 2240) return 2242; - if (lastMove == 2242) return 3563; + if (this.dalamud.Configuration.ComboPresets.HasFlag(CustomComboPreset.NinjaArmorCrushCombo)) { + if (actionID == 2257) { + if (comboTime > 0) { + if (lastMove == 2240) return 2242; + if (lastMove == 2242) return 3563; + } + return 2240; } - return 2240; } // Replace Aeolian Edge with Aeolian Edge combo - if (actionID == 2257) { - if (comboTime > 0) { - if (lastMove == 2240) return 2242; - if (lastMove == 2242) return 2255; + if (this.dalamud.Configuration.ComboPresets.HasFlag(CustomComboPreset.NinjaAeolianEdgeCombo)) { + if (actionID == 2257) { + if (comboTime > 0) { + if (lastMove == 2240) return 2242; + if (lastMove == 2242) return 2255; + } + return 2240; } - return 2240; } // Replace Hakke Mujinsatsu with Hakke Mujinsatsu combo - if (actionID == 16488) { - if (comboTime > 0) { - if (lastMove == 2254) return 16488; + if (this.dalamud.Configuration.ComboPresets.HasFlag(CustomComboPreset.NinjaHakkeMujinsatsuCombo)) { + if (actionID == 16488) { + if (comboTime > 0) { + if (lastMove == 2254) return 16488; + } + return 2254; } - return 2254; } // GUNBREAKER // Replace Solid Barrel with Solid Barrel combo - if (actionID == 16145) { - if (comboTime > 0) { - if (lastMove == 16137) return 16139; - if (lastMove == 16139) return 16145; + if (this.dalamud.Configuration.ComboPresets.HasFlag(CustomComboPreset.GunbreakerSolidBarrelCombo)) { + if (actionID == 16145) { + if (comboTime > 0) { + if (lastMove == 16137) return 16139; + if (lastMove == 16139) return 16145; + } + return 16137; } - return 16137; } // Replace Gnashing Fang with Gnashing Fang combo // TODO: Potentially add Contuation moves as well? - if (actionID == 16146) { - byte ammoComboState = Marshal.ReadByte(jobInfo, 0x10); - if (ammoComboState == 1) return 16147; - if (ammoComboState == 2) return 16150; - return 16146; + if (this.dalamud.Configuration.ComboPresets.HasFlag(CustomComboPreset.GunbreakerGnashingFangCombo)) { + if (actionID == 16146) { + byte ammoComboState = Marshal.ReadByte(jobInfo, 0x10); + if (ammoComboState == 1) return 16147; + if (ammoComboState == 2) return 16150; + return 16146; + } } // Replace Demon Slaughter with Demon Slaughter combo - if (actionID == 16149) { - if (comboTime > 0) { - if (lastMove == 16141) return 16149; + if (this.dalamud.Configuration.ComboPresets.HasFlag(CustomComboPreset.GunbreakerDemonSlaughterCombo)) { + if (actionID == 16149) { + if (comboTime > 0) { + if (lastMove == 16141) return 16149; + } + return 16141; } - return 16141; } // MACHINIST @@ -335,63 +392,73 @@ namespace Dalamud.Game.Internal.Gui { // Replace Heated Clean Shot with Heated Clean Shot combo // Or with Heat Blast when overheated. // For some reason the shots use their unheated IDs as combo moves - if (actionID == 7413) { - if (this.dalamud.ClientState.JobGauges.Get().IsOverheated() && level >= 35) return 7410; - if (comboTime > 0) { - if (lastMove == 2866) return 7412; - if (lastMove == 2868) return 7413; + if (this.dalamud.Configuration.ComboPresets.HasFlag(CustomComboPreset.MachinistHeatedClanShotFeature)) { + if (actionID == 7413) { + if (this.dalamud.ClientState.JobGauges.Get().IsOverheated() && level >= 35) return 7410; + if (comboTime > 0) { + if (lastMove == 2866) return 7412; + if (lastMove == 2868) return 7413; + } + return 7411; } - return 7411; } // Replace Spread Shot with Auto Crossbow when overheated. - if (actionID == 2870) { - if (this.dalamud.ClientState.JobGauges.Get().IsOverheated() && level >= 52) return 16497; - return 2870; + if (this.dalamud.Configuration.ComboPresets.HasFlag(CustomComboPreset.MachinistSpreadShotFeature)) { + if (actionID == 2870) { + if (this.dalamud.ClientState.JobGauges.Get().IsOverheated() && level >= 52) return 16497; + return 2870; + } } // BLACK MAGE // Enochian changes to B4 or F4 depending on stance. - if (actionID == 3575) { - BLMGauge jobInfo = this.dalamud.ClientState.JobGauges.Get(); - if (jobInfo.IsEnoActive) { - if (jobInfo.InUmbralIce()) return 3576; - return 3577; + if (this.dalamud.Configuration.ComboPresets.HasFlag(CustomComboPreset.BlackEnochianFeature)) { + if (actionID == 3575) { + BLMGauge jobInfo = this.dalamud.ClientState.JobGauges.Get(); + if (jobInfo.IsEnoActive) { + if (jobInfo.InUmbralIce()) return 3576; + return 3577; + } + return 3575; } - return 3575; } // Umbral Soul and Transpose - if (actionID == 149) { - if (this.dalamud.ClientState.JobGauges.Get().InUmbralIce() && level >= 76) return 16506; - return 149; + if (this.dalamud.Configuration.ComboPresets.HasFlag(CustomComboPreset.BlackManaFeature)) { + if (actionID == 149) { + if (this.dalamud.ClientState.JobGauges.Get().InUmbralIce() && level >= 76) return 16506; + return 149; + } } // ASTROLOGIAN // Make cards on the same button as draw - if (actionID == 17055) { - byte x = Marshal.ReadByte(jobInfo, 0x10); - switch (x) { - case 1: - return 4401; - case 2: - return 4404; - case 3: - return 4402; - case 4: - return 4403; - case 5: - return 4405; - case 6: - return 4406; - case 0x70: - return 7444; - case 0x80: - return 7445; - default: - return 3590; + if (this.dalamud.Configuration.ComboPresets.HasFlag(CustomComboPreset.AstrologianCardsOnDrawFeature)) { + if (actionID == 17055) { + byte x = Marshal.ReadByte(jobInfo, 0x10); + switch (x) { + case 1: + return 4401; + case 2: + return 4404; + case 3: + return 4402; + case 4: + return 4403; + case 5: + return 4405; + case 6: + return 4406; + case 0x70: + return 7444; + case 0x80: + return 7445; + default: + return 3590; + } } } @@ -400,111 +467,125 @@ namespace Dalamud.Game.Internal.Gui { // DWT changes. // Now contains DWT, Deathflare, Summon Bahamut, Enkindle Bahamut, FBT, and Enkindle Phoenix. // What a monster of a button. - if (actionID == 3581) { - byte stackState = Marshal.ReadByte(jobInfo, 0x10); - if (Marshal.ReadInt16(jobInfo, 0xc) > 0) { - if (Marshal.ReadInt16(jobInfo, 0xe) > 0) { - if (stackState > 0) return 16516; - return 7429; + if (this.dalamud.Configuration.ComboPresets.HasFlag(CustomComboPreset.SummonerDwtCombo)) { + if (actionID == 3581) { + byte stackState = Marshal.ReadByte(jobInfo, 0x10); + if (Marshal.ReadInt16(jobInfo, 0xc) > 0) { + if (Marshal.ReadInt16(jobInfo, 0xe) > 0) { + if (stackState > 0) return 16516; + return 7429; + } + return 3582; + } + else { + if (stackState == 0) return 3581; + if (stackState == 8) return 7427; + if (stackState == 0x10) return 16513; + return 3581; } - return 3582; - } - else { - if (stackState == 0) return 3581; - if (stackState == 8) return 7427; - if (stackState == 0x10) return 16513; - return 3581; } } // SCHOLAR // Change Fey Blessing into Consolation when Seraph is out. - if (actionID == 16543) { - if (Marshal.ReadInt16(jobInfo, 0x10) > 0) return 16546; - return 16543; + if (this.dalamud.Configuration.ComboPresets.HasFlag(CustomComboPreset.ScholarSeraphConsolationFeature)) { + if (actionID == 16543) { + if (Marshal.ReadInt16(jobInfo, 0x10) > 0) return 16546; + return 16543; + } } // DANCER // Standard Step is one button. - if (actionID == 15997) { - DNCGauge gauge = this.dalamud.ClientState.JobGauges.Get(); - if (gauge.IsDancing()) { - if (gauge.NumCompleteSteps == 2) { - return 16192; - } - else { - // C# can't implicitly cast from int to ulong. - return (ulong)(15999 + gauge.StepOrder[gauge.NumCompleteSteps] - 1); + if (this.dalamud.Configuration.ComboPresets.HasFlag(CustomComboPreset.DancerStandardStepCombo)) { + if (actionID == 15997) { + DNCGauge gauge = this.dalamud.ClientState.JobGauges.Get(); + if (gauge.IsDancing()) { + if (gauge.NumCompleteSteps == 2) { + return 16192; + } + else { + // C# can't implicitly cast from int to ulong. + return (ulong)(15999 + gauge.StepOrder[gauge.NumCompleteSteps] - 1); + } } + return 15997; } - return 15997; } // Technical Step is one button. - if (actionID == 15998) { - DNCGauge gauge = this.dalamud.ClientState.JobGauges.Get(); - if (gauge.IsDancing()) { - if (gauge.NumCompleteSteps == 4) { - return 16196; - } - else { - // C# can't implicitly cast from int to ulong. - return (ulong)(15999 + gauge.StepOrder[gauge.NumCompleteSteps] - 1); + if (this.dalamud.Configuration.ComboPresets.HasFlag(CustomComboPreset.DancerTechnicalStepCombo)) { + if (actionID == 15998) { + DNCGauge gauge = this.dalamud.ClientState.JobGauges.Get(); + if (gauge.IsDancing()) { + if (gauge.NumCompleteSteps == 4) { + return 16196; + } + else { + // C# can't implicitly cast from int to ulong. + return (ulong)(15999 + gauge.StepOrder[gauge.NumCompleteSteps] - 1); + } } + return 15998; } - return 15998; } // Fountain changes into Fountain combo, prioritizing procs over combo, // and Fountainfall over Reverse Cascade. - if (actionID == 15990) { - if (activeBuffArray != null) { - if (SearchBuffArray(1815)) return 15992; - if (SearchBuffArray(1814)) return 15991; + if (this.dalamud.Configuration.ComboPresets.HasFlag(CustomComboPreset.DancerFountainCombo)) { + if (actionID == 15990) { + if (activeBuffArray != null) { + if (SearchBuffArray(1815)) return 15992; + if (SearchBuffArray(1814)) return 15991; + } + if (comboTime > 0) { + if (lastMove == 15989) return 15990; + } + return 15989; } - if (comboTime > 0) { - if (lastMove == 15989) return 15990; - } - return 15989; } // AoE GCDs are split into two buttons, because priority matters // differently in different single-target moments. Thanks yoship. // Replaces each GCD with its procced version. - if (actionID == 15994) { - if (activeBuffArray != null) { - if (SearchBuffArray(1817)) return 15996; - } - return 15994; - } - - if (actionID == 15993) { - if (activeBuffArray != null) { - if (SearchBuffArray(1816)) return 15995; - } - return 15993; - } - - // Fan Dance changes into Fan Dance 3 while flourishing. - if (actionID == 16007) { - if (activeBuffArray != null) { - if (SearchBuffArray(1820)) return 16009; + if (this.dalamud.Configuration.ComboPresets.HasFlag(CustomComboPreset.DancerAoeGcdFeature)) { + if (actionID == 15994) { + if (activeBuffArray != null) { + if (SearchBuffArray(1817)) return 15996; + } + return 15994; } - return 16007; - } - - // Fan Dance 2 changes into Fan Dance 3 while flourishing. - if (actionID == 16008) { - if (activeBuffArray != null) { - if (SearchBuffArray(1820)) return 16009; + if (actionID == 15993) { + if (activeBuffArray != null) { + if (SearchBuffArray(1816)) return 15995; + } + return 15993; } - return 16008; } + if (this.dalamud.Configuration.ComboPresets.HasFlag(CustomComboPreset.DancerFanDanceCombo)) { + // Fan Dance changes into Fan Dance 3 while flourishing. + if (actionID == 16007) { + if (activeBuffArray != null) { + if (SearchBuffArray(1820)) return 16009; + } + + return 16007; + } + + // Fan Dance 2 changes into Fan Dance 3 while flourishing. + if (actionID == 16008) { + if (activeBuffArray != null) { + if (SearchBuffArray(1820)) return 16009; + } + return 16008; + } + } + return this.iconHook.Original(self, actionID); }