New config system, config flags for combos, commands for combos

This commit is contained in:
goat 2019-10-18 23:50:02 +09:00
parent 1bd4eed72c
commit 16a5788695
9 changed files with 572 additions and 257 deletions

View file

@ -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; }
}
}

View file

@ -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<string> BadWords { get; set; }
public static DalamudConfiguration Load(string path) {
return JsonConvert.DeserializeObject<DalamudConfiguration>(File.ReadAllText(path));
}
public void Save(string path) {
File.WriteAllText(path, JsonConvert.SerializeObject(this));
}
}
}

View file

@ -16,6 +16,7 @@ using Dalamud.Game.Network;
using Dalamud.Plugin; using Dalamud.Plugin;
using Dalamud.Settings; using Dalamud.Settings;
using Serilog; using Serilog;
using XIVLauncher.Dalamud;
namespace Dalamud { namespace Dalamud {
public sealed class Dalamud : IDisposable { public sealed class Dalamud : IDisposable {
@ -42,8 +43,11 @@ namespace Dalamud {
public readonly IconReplacer IconReplacer; public readonly IconReplacer IconReplacer;
public readonly DalamudConfiguration Configuration;
public Dalamud(DalamudStartInfo info) { public Dalamud(DalamudStartInfo info) {
this.StartInfo = info; this.StartInfo = info;
this.Configuration = DalamudConfiguration.Load(info.ConfigurationPath);
this.baseDirectory = info.WorkingDirectory; this.baseDirectory = info.WorkingDirectory;
@ -61,11 +65,11 @@ namespace Dalamud {
SetupCommands(); SetupCommands();
ChatHandlers = new ChatHandlers(this); 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.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); this.PluginManager = new PluginManager(this, info.PluginDirectory, info.DefaultPluginDirectory);
@ -122,6 +126,11 @@ namespace Dalamud {
ShowInHelp = false ShowInHelp = false
}); });
CommandManager.AddHandler("/xldcombo", new CommandInfo(OnCommandDebugCombo) {
HelpMessage = "COMBO debug",
ShowInHelp = false
});
CommandManager.AddHandler("/xlhelp", new CommandInfo(OnCommandHelp) { CommandManager.AddHandler("/xlhelp", new CommandInfo(OnCommandHelp) {
HelpMessage = "Shows list of commands available." 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<CustomComboPreset>()) {
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<CustomComboPreset>()) {
this.Configuration.ComboPresets &= value;
}
Framework.Gui.Chat.Print("all UNSET");
}
break;
case "set": {
foreach (var value in Enum.GetValues(typeof(CustomComboPreset)).Cast<CustomComboPreset>()) {
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<CustomComboPreset>()) {
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) { private void OnBotJoinCommand(string command, string arguments) {
if (this.BotManager != null && this.BotManager.IsConnected) if (this.BotManager != null && this.BotManager.IsConnected)
Process.Start( Process.Start(

View file

@ -64,4 +64,7 @@
<LastGenOutput>Resources.Designer.cs</LastGenOutput> <LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource> </EmbeddedResource>
</ItemGroup> </ItemGroup>
<ItemGroup>
<Folder Include="Configuration\" />
</ItemGroup>
</Project> </Project>

View file

@ -3,15 +3,14 @@ using Dalamud.DiscordBot;
namespace Dalamud { namespace Dalamud {
[Serializable] [Serializable]
public sealed class DalamudStartInfo { public sealed class DalamudStartInfo
{
public string WorkingDirectory; public string WorkingDirectory;
public string ConfigurationPath;
public string PluginDirectory; public string PluginDirectory;
public string DefaultPluginDirectory; public string DefaultPluginDirectory;
public ClientLanguage Language; public ClientLanguage Language;
public DiscordFeatureConfiguration DiscordFeatureConfig { get; set; }
public bool OptOutMbCollection { get; set; } = false;
} }
public enum ClientLanguage public enum ClientLanguage

View file

@ -10,6 +10,7 @@ using System.Threading.Tasks;
using Dalamud.Game.ClientState.Actors; using Dalamud.Game.ClientState.Actors;
using Dalamud.Game.ClientState.Actors.Types; using Dalamud.Game.ClientState.Actors.Types;
using Dalamud.Game.Internal; using Dalamud.Game.Internal;
using Serilog;
namespace Dalamud.Game.ClientState namespace Dalamud.Game.ClientState
{ {
@ -54,6 +55,8 @@ namespace Dalamud.Game.ClientState
Address = new ClientStateAddressResolver(); Address = new ClientStateAddressResolver();
Address.Setup(scanner); Address.Setup(scanner);
Log.Verbose("===== C L I E N T S T A T E =====");
this.ClientLanguage = startInfo.Language; this.ClientLanguage = startInfo.Language;
this.Actors = new ActorTable(Address); this.Actors = new ActorTable(Address);

View file

@ -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.Runtime.InteropServices;
using System.Text; using Serilog;
using System.Threading.Tasks;
namespace Dalamud.Game.ClientState { namespace Dalamud.Game.ClientState {
public class JobGauges { public class JobGauges {
@ -13,12 +7,14 @@ namespace Dalamud.Game.ClientState {
public JobGauges(ClientStateAddressResolver addressResolver) { public JobGauges(ClientStateAddressResolver addressResolver) {
Address = addressResolver; Address = addressResolver;
Log.Verbose("JobGaugeData address {JobGaugeData}", Address.ActorTable);
} }
// Should only be called with the gauge types in // Should only be called with the gauge types in
// ClientState.Structs.JobGauge // ClientState.Structs.JobGauge
public T Get<T>() { public T Get<T>() {
return Marshal.PtrToStructure<T>(Address.ActorTable); return Marshal.PtrToStructure<T>(Address.JobGaugeData);
} }
} }
} }

View file

@ -56,7 +56,7 @@ namespace Dalamud.Game.Internal {
Network = new GameNetwork(dalamud, scanner); Network = new GameNetwork(dalamud, scanner);
Resource = new ResourceManager(dalamud, scanner); //Resource = new ResourceManager(dalamud, scanner);
} }
private void HookVTable() { private void HookVTable() {

View file

@ -6,6 +6,7 @@ using Serilog;
using System; using System;
using System.Diagnostics; using System.Diagnostics;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using XIVLauncher.Dalamud;
namespace Dalamud.Game.Internal.Gui { namespace Dalamud.Game.Internal.Gui {
public class IconReplacer { public class IconReplacer {
@ -94,240 +95,296 @@ namespace Dalamud.Game.Internal.Gui {
// TODO: Jump/High Jump into Mirage Dive // TODO: Jump/High Jump into Mirage Dive
// Replace Coerthan Torment with Coerthan Torment combo chain // Replace Coerthan Torment with Coerthan Torment combo chain
if (actionID == 16477) { if (this.dalamud.Configuration.ComboPresets.HasFlag(CustomComboPreset.DragoonCoerthanTormentCombo)) {
if (comboTime > 0) { if (actionID == 16477) {
if (Marshal.ReadInt32(lastComboMove) == 86) return 7397; if (comboTime > 0) {
if (Marshal.ReadInt32(lastComboMove) == 7397) return 16477; 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 // Replace Chaos Thrust with the Chaos Thrust combo chain
if (actionID == 88) { if (this.dalamud.Configuration.ComboPresets.HasFlag(CustomComboPreset.DragoonChaosThrustCombo)) {
if (comboTime > 0) { if (actionID == 88) {
if (lastMove == 75 || lastMove == 16479) return 87; if (comboTime > 0) {
if (lastMove == 87) return 88; 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;
// Replace Full Thrust with the Full Thrust combo chain
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 // DARK KNIGHT
// Replace Souleater with Souleater combo chain // Replace Souleater with Souleater combo chain
if (actionID == 3632) { if (this.dalamud.Configuration.ComboPresets.HasFlag(CustomComboPreset.DarkSouleaterCombo)) {
if (comboTime > 0) { if (actionID == 3632) {
if (lastMove == 3617) return 3623; if (comboTime > 0) {
if (lastMove == 3623) return 3632; if (lastMove == 3617) return 3623;
if (lastMove == 3623) return 3632;
}
return 3617;
} }
return 3617;
} }
// Replace Stalwart Soul with Stalwart Soul combo chain // Replace Stalwart Soul with Stalwart Soul combo chain
if (actionID == 16468) { if (this.dalamud.Configuration.ComboPresets.HasFlag(CustomComboPreset.DarkStalwartSoulCombo)) {
if (comboTime > 0) { if (actionID == 16468) {
if (lastMove == 3621) return 16468; if (comboTime > 0) {
if (lastMove == 3621) return 16468;
}
return 3621;
} }
return 3621;
} }
// PALADIN // PALADIN
// Replace Goring Blade with Goring Blade combo // Replace Goring Blade with Goring Blade combo
if (actionID == 3538) { if (this.dalamud.Configuration.ComboPresets.HasFlag(CustomComboPreset.PaladinGoringBladeCombo)) {
if (comboTime > 0) { if (actionID == 3538) {
if (lastMove == 9) return 15; if (comboTime > 0) {
if (lastMove == 15) return 3538; if (lastMove == 9) return 15;
if (lastMove == 15) return 3538;
}
return 9;
} }
return 9;
} }
// Replace Royal Authority with Royal Authority combo // Replace Royal Authority with Royal Authority combo
if (actionID == 3539) { if (this.dalamud.Configuration.ComboPresets.HasFlag(CustomComboPreset.PaladinRoyalAuthorityCombo)) {
if (comboTime > 0) { if (actionID == 3539) {
if (lastMove == 9) return 15; if (comboTime > 0) {
if (lastMove == 15) return 3539; if (lastMove == 9) return 15;
if (lastMove == 15) return 3539;
}
return 9;
} }
return 9;
} }
// Replace Prominence with Prominence combo // Replace Prominence with Prominence combo
if (actionID == 16457) { if (this.dalamud.Configuration.ComboPresets.HasFlag(CustomComboPreset.PaladinProminenceCombo)) {
if (comboTime > 0) { if (actionID == 16457) {
if (lastMove == 7381) return 16457; if (comboTime > 0) {
if (lastMove == 7381) return 16457;
}
return 7381;
} }
return 7381;
} }
// WARRIOR // WARRIOR
// Replace Storm's Path with Storm's Path combo // Replace Storm's Path with Storm's Path combo
if (actionID == 42) { if (this.dalamud.Configuration.ComboPresets.HasFlag(CustomComboPreset.WarriorStormsPathCombo)) {
if (comboTime > 0) { if (actionID == 42) {
if (lastMove == 31) return 37; if (comboTime > 0) {
if (lastMove == 37) return 42; if (lastMove == 31) return 37;
if (lastMove == 37) return 42;
}
return 31;
} }
return 31;
} }
// Replace Storm's Eye with Storm's Eye combo // Replace Storm's Eye with Storm's Eye combo
if (actionID == 45) { if (this.dalamud.Configuration.ComboPresets.HasFlag(CustomComboPreset.WarriorStormsEyeCombo)) {
if (comboTime > 0) { if (actionID == 45) {
if (lastMove == 31) return 37; if (comboTime > 0) {
if (lastMove == 37) return 45; if (lastMove == 31) return 37;
if (lastMove == 37) return 45;
}
return 31;
} }
return 31;
} }
// Replace Mythril Tempest with Mythril Tempest combo // Replace Mythril Tempest with Mythril Tempest combo
if (actionID == 16462) { if (this.dalamud.Configuration.ComboPresets.HasFlag(CustomComboPreset.WarriorMythrilTempestCombo)) {
if (comboTime > 0) { if (actionID == 16462) {
if (lastMove == 41) return 16462; if (comboTime > 0) {
if (lastMove == 41) return 16462;
}
return 41;
} }
return 41;
} }
// SAMURAI // SAMURAI
// Replace Yukikaze with Yukikaze combo // Replace Yukikaze with Yukikaze combo
if (actionID == 7480) { if (this.dalamud.Configuration.ComboPresets.HasFlag(CustomComboPreset.SamuraiYukikazeCombo)) {
if (activeBuffArray != IntPtr.Zero) { if (actionID == 7480) {
if (SearchBuffArray(1233)) return 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 // Replace Gekko with Gekko combo
if (actionID == 7481) { if (this.dalamud.Configuration.ComboPresets.HasFlag(CustomComboPreset.SamuraiGekkoCombo)) {
if (activeBuffArray != IntPtr.Zero) { if (actionID == 7481) {
if (SearchBuffArray(1233)) return 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 // Replace Kasha with Kasha combo
if (actionID == 7482) { if (this.dalamud.Configuration.ComboPresets.HasFlag(CustomComboPreset.SamuraiKashaCombo)) {
if (activeBuffArray != null) { if (actionID == 7482) {
if (SearchBuffArray(1233)) return 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 // Replace Mangetsu with Mangetsu combo
if (actionID == 7484) { if (this.dalamud.Configuration.ComboPresets.HasFlag(CustomComboPreset.SamuraiMangetsuCombo)) {
if (activeBuffArray != null) { if (actionID == 7484) {
if (SearchBuffArray(1233)) return 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 // Replace Oka with Oka combo
if (actionID == 7485) { if (this.dalamud.Configuration.ComboPresets.HasFlag(CustomComboPreset.SamuraiOkaCombo)) {
if (activeBuffArray != null) { if (actionID == 7485) {
if (SearchBuffArray(1233)) return 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 // NINJA
// Replace Shadow Fang with Shadow Fang combo // Replace Shadow Fang with Shadow Fang combo
if (actionID == 2257) { if (this.dalamud.Configuration.ComboPresets.HasFlag(CustomComboPreset.NinjaShadowFangCombo)) {
if (comboTime > 0) { if (actionID == 2257) {
if (lastMove == 2240) return 2257; if (comboTime > 0) {
if (lastMove == 2240) return 2257;
}
return 2240;
} }
return 2240;
} }
// Replace Armor Crush with Armor Crush combo // Replace Armor Crush with Armor Crush combo
if (actionID == 2257) { if (this.dalamud.Configuration.ComboPresets.HasFlag(CustomComboPreset.NinjaArmorCrushCombo)) {
if (comboTime > 0) { if (actionID == 2257) {
if (lastMove == 2240) return 2242; if (comboTime > 0) {
if (lastMove == 2242) return 3563; if (lastMove == 2240) return 2242;
if (lastMove == 2242) return 3563;
}
return 2240;
} }
return 2240;
} }
// Replace Aeolian Edge with Aeolian Edge combo // Replace Aeolian Edge with Aeolian Edge combo
if (actionID == 2257) { if (this.dalamud.Configuration.ComboPresets.HasFlag(CustomComboPreset.NinjaAeolianEdgeCombo)) {
if (comboTime > 0) { if (actionID == 2257) {
if (lastMove == 2240) return 2242; if (comboTime > 0) {
if (lastMove == 2242) return 2255; if (lastMove == 2240) return 2242;
if (lastMove == 2242) return 2255;
}
return 2240;
} }
return 2240;
} }
// Replace Hakke Mujinsatsu with Hakke Mujinsatsu combo // Replace Hakke Mujinsatsu with Hakke Mujinsatsu combo
if (actionID == 16488) { if (this.dalamud.Configuration.ComboPresets.HasFlag(CustomComboPreset.NinjaHakkeMujinsatsuCombo)) {
if (comboTime > 0) { if (actionID == 16488) {
if (lastMove == 2254) return 16488; if (comboTime > 0) {
if (lastMove == 2254) return 16488;
}
return 2254;
} }
return 2254;
} }
// GUNBREAKER // GUNBREAKER
// Replace Solid Barrel with Solid Barrel combo // Replace Solid Barrel with Solid Barrel combo
if (actionID == 16145) { if (this.dalamud.Configuration.ComboPresets.HasFlag(CustomComboPreset.GunbreakerSolidBarrelCombo)) {
if (comboTime > 0) { if (actionID == 16145) {
if (lastMove == 16137) return 16139; if (comboTime > 0) {
if (lastMove == 16139) return 16145; if (lastMove == 16137) return 16139;
if (lastMove == 16139) return 16145;
}
return 16137;
} }
return 16137;
} }
// Replace Gnashing Fang with Gnashing Fang combo // Replace Gnashing Fang with Gnashing Fang combo
// TODO: Potentially add Contuation moves as well? // TODO: Potentially add Contuation moves as well?
if (actionID == 16146) { if (this.dalamud.Configuration.ComboPresets.HasFlag(CustomComboPreset.GunbreakerGnashingFangCombo)) {
byte ammoComboState = Marshal.ReadByte(jobInfo, 0x10); if (actionID == 16146) {
if (ammoComboState == 1) return 16147; byte ammoComboState = Marshal.ReadByte(jobInfo, 0x10);
if (ammoComboState == 2) return 16150; if (ammoComboState == 1) return 16147;
return 16146; if (ammoComboState == 2) return 16150;
return 16146;
}
} }
// Replace Demon Slaughter with Demon Slaughter combo // Replace Demon Slaughter with Demon Slaughter combo
if (actionID == 16149) { if (this.dalamud.Configuration.ComboPresets.HasFlag(CustomComboPreset.GunbreakerDemonSlaughterCombo)) {
if (comboTime > 0) { if (actionID == 16149) {
if (lastMove == 16141) return 16149; if (comboTime > 0) {
if (lastMove == 16141) return 16149;
}
return 16141;
} }
return 16141;
} }
// MACHINIST // MACHINIST
@ -335,63 +392,73 @@ namespace Dalamud.Game.Internal.Gui {
// Replace Heated Clean Shot with Heated Clean Shot combo // Replace Heated Clean Shot with Heated Clean Shot combo
// Or with Heat Blast when overheated. // Or with Heat Blast when overheated.
// For some reason the shots use their unheated IDs as combo moves // For some reason the shots use their unheated IDs as combo moves
if (actionID == 7413) { if (this.dalamud.Configuration.ComboPresets.HasFlag(CustomComboPreset.MachinistHeatedClanShotFeature)) {
if (this.dalamud.ClientState.JobGauges.Get<MCHGauge>().IsOverheated() && level >= 35) return 7410; if (actionID == 7413) {
if (comboTime > 0) { if (this.dalamud.ClientState.JobGauges.Get<MCHGauge>().IsOverheated() && level >= 35) return 7410;
if (lastMove == 2866) return 7412; if (comboTime > 0) {
if (lastMove == 2868) return 7413; if (lastMove == 2866) return 7412;
if (lastMove == 2868) return 7413;
}
return 7411;
} }
return 7411;
} }
// Replace Spread Shot with Auto Crossbow when overheated. // Replace Spread Shot with Auto Crossbow when overheated.
if (actionID == 2870) { if (this.dalamud.Configuration.ComboPresets.HasFlag(CustomComboPreset.MachinistSpreadShotFeature)) {
if (this.dalamud.ClientState.JobGauges.Get<MCHGauge>().IsOverheated() && level >= 52) return 16497; if (actionID == 2870) {
return 2870; if (this.dalamud.ClientState.JobGauges.Get<MCHGauge>().IsOverheated() && level >= 52) return 16497;
return 2870;
}
} }
// BLACK MAGE // BLACK MAGE
// Enochian changes to B4 or F4 depending on stance. // Enochian changes to B4 or F4 depending on stance.
if (actionID == 3575) { if (this.dalamud.Configuration.ComboPresets.HasFlag(CustomComboPreset.BlackEnochianFeature)) {
BLMGauge jobInfo = this.dalamud.ClientState.JobGauges.Get<BLMGauge>(); if (actionID == 3575) {
if (jobInfo.IsEnoActive) { BLMGauge jobInfo = this.dalamud.ClientState.JobGauges.Get<BLMGauge>();
if (jobInfo.InUmbralIce()) return 3576; if (jobInfo.IsEnoActive) {
return 3577; if (jobInfo.InUmbralIce()) return 3576;
return 3577;
}
return 3575;
} }
return 3575;
} }
// Umbral Soul and Transpose // Umbral Soul and Transpose
if (actionID == 149) { if (this.dalamud.Configuration.ComboPresets.HasFlag(CustomComboPreset.BlackManaFeature)) {
if (this.dalamud.ClientState.JobGauges.Get<BLMGauge>().InUmbralIce() && level >= 76) return 16506; if (actionID == 149) {
return 149; if (this.dalamud.ClientState.JobGauges.Get<BLMGauge>().InUmbralIce() && level >= 76) return 16506;
return 149;
}
} }
// ASTROLOGIAN // ASTROLOGIAN
// Make cards on the same button as draw // Make cards on the same button as draw
if (actionID == 17055) { if (this.dalamud.Configuration.ComboPresets.HasFlag(CustomComboPreset.AstrologianCardsOnDrawFeature)) {
byte x = Marshal.ReadByte(jobInfo, 0x10); if (actionID == 17055) {
switch (x) { byte x = Marshal.ReadByte(jobInfo, 0x10);
case 1: switch (x) {
return 4401; case 1:
case 2: return 4401;
return 4404; case 2:
case 3: return 4404;
return 4402; case 3:
case 4: return 4402;
return 4403; case 4:
case 5: return 4403;
return 4405; case 5:
case 6: return 4405;
return 4406; case 6:
case 0x70: return 4406;
return 7444; case 0x70:
case 0x80: return 7444;
return 7445; case 0x80:
default: return 7445;
return 3590; default:
return 3590;
}
} }
} }
@ -400,111 +467,125 @@ namespace Dalamud.Game.Internal.Gui {
// DWT changes. // DWT changes.
// Now contains DWT, Deathflare, Summon Bahamut, Enkindle Bahamut, FBT, and Enkindle Phoenix. // Now contains DWT, Deathflare, Summon Bahamut, Enkindle Bahamut, FBT, and Enkindle Phoenix.
// What a monster of a button. // What a monster of a button.
if (actionID == 3581) { if (this.dalamud.Configuration.ComboPresets.HasFlag(CustomComboPreset.SummonerDwtCombo)) {
byte stackState = Marshal.ReadByte(jobInfo, 0x10); if (actionID == 3581) {
if (Marshal.ReadInt16(jobInfo, 0xc) > 0) { byte stackState = Marshal.ReadByte(jobInfo, 0x10);
if (Marshal.ReadInt16(jobInfo, 0xe) > 0) { if (Marshal.ReadInt16(jobInfo, 0xc) > 0) {
if (stackState > 0) return 16516; if (Marshal.ReadInt16(jobInfo, 0xe) > 0) {
return 7429; 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 // SCHOLAR
// Change Fey Blessing into Consolation when Seraph is out. // Change Fey Blessing into Consolation when Seraph is out.
if (actionID == 16543) { if (this.dalamud.Configuration.ComboPresets.HasFlag(CustomComboPreset.ScholarSeraphConsolationFeature)) {
if (Marshal.ReadInt16(jobInfo, 0x10) > 0) return 16546; if (actionID == 16543) {
return 16543; if (Marshal.ReadInt16(jobInfo, 0x10) > 0) return 16546;
return 16543;
}
} }
// DANCER // DANCER
// Standard Step is one button. // Standard Step is one button.
if (actionID == 15997) { if (this.dalamud.Configuration.ComboPresets.HasFlag(CustomComboPreset.DancerStandardStepCombo)) {
DNCGauge gauge = this.dalamud.ClientState.JobGauges.Get<DNCGauge>(); if (actionID == 15997) {
if (gauge.IsDancing()) { DNCGauge gauge = this.dalamud.ClientState.JobGauges.Get<DNCGauge>();
if (gauge.NumCompleteSteps == 2) { if (gauge.IsDancing()) {
return 16192; if (gauge.NumCompleteSteps == 2) {
} return 16192;
else { }
// C# can't implicitly cast from int to ulong. else {
return (ulong)(15999 + gauge.StepOrder[gauge.NumCompleteSteps] - 1); // 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. // Technical Step is one button.
if (actionID == 15998) { if (this.dalamud.Configuration.ComboPresets.HasFlag(CustomComboPreset.DancerTechnicalStepCombo)) {
DNCGauge gauge = this.dalamud.ClientState.JobGauges.Get<DNCGauge>(); if (actionID == 15998) {
if (gauge.IsDancing()) { DNCGauge gauge = this.dalamud.ClientState.JobGauges.Get<DNCGauge>();
if (gauge.NumCompleteSteps == 4) { if (gauge.IsDancing()) {
return 16196; if (gauge.NumCompleteSteps == 4) {
} return 16196;
else { }
// C# can't implicitly cast from int to ulong. else {
return (ulong)(15999 + gauge.StepOrder[gauge.NumCompleteSteps] - 1); // 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, // Fountain changes into Fountain combo, prioritizing procs over combo,
// and Fountainfall over Reverse Cascade. // and Fountainfall over Reverse Cascade.
if (actionID == 15990) { if (this.dalamud.Configuration.ComboPresets.HasFlag(CustomComboPreset.DancerFountainCombo)) {
if (activeBuffArray != null) { if (actionID == 15990) {
if (SearchBuffArray(1815)) return 15992; if (activeBuffArray != null) {
if (SearchBuffArray(1814)) return 15991; 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 // AoE GCDs are split into two buttons, because priority matters
// differently in different single-target moments. Thanks yoship. // differently in different single-target moments. Thanks yoship.
// Replaces each GCD with its procced version. // Replaces each GCD with its procced version.
if (actionID == 15994) { if (this.dalamud.Configuration.ComboPresets.HasFlag(CustomComboPreset.DancerAoeGcdFeature)) {
if (activeBuffArray != null) { if (actionID == 15994) {
if (SearchBuffArray(1817)) return 15996; if (activeBuffArray != null) {
} if (SearchBuffArray(1817)) return 15996;
return 15994; }
} 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;
} }
return 16007; if (actionID == 15993) {
} if (activeBuffArray != null) {
if (SearchBuffArray(1816)) return 15995;
// Fan Dance 2 changes into Fan Dance 3 while flourishing. }
if (actionID == 16008) { return 15993;
if (activeBuffArray != null) {
if (SearchBuffArray(1820)) return 16009;
} }
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); return this.iconHook.Original(self, actionID);
} }