Skip to content

Commit

Permalink
Merge pull request Nik-Potokar#1389 from Taurenkey/dtRefresh
Browse files Browse the repository at this point in the history
Dt refresh
  • Loading branch information
Taurenkey authored Jun 26, 2024
2 parents 0e37364 + 11cc614 commit dcecade
Show file tree
Hide file tree
Showing 24 changed files with 865 additions and 613 deletions.
2 changes: 1 addition & 1 deletion ECommons
Submodule ECommons updated 42 files
+12 −0 ECommons/Automation/Chat.cs
+52 −14 ECommons/Configuration/EzConfig.cs
+1 −0 ECommons/DalamudServices/Svc.cs
+2 −2 ECommons/ECommons.csproj
+5 −0 ECommons/ECommonsMain.cs
+11 −0 ECommons/ExcelServices/ExcelJobHelper.cs
+30 −3 ECommons/ExcelServices/ExcelWorldHelper.cs
+14 −0 ECommons/ExcelServices/GrandCompany.cs
+3 −1 ECommons/ExcelServices/Region.cs
+295 −2 ECommons/EzIpcManager/EzIPC.cs
+57 −0 ECommons/EzIpcManager/EzIPC.md
+30 −0 ECommons/EzIpcManager/EzIPCAttribute.cs
+55 −0 ECommons/EzIpcManager/EzIPCDisposalToken.cs
+27 −0 ECommons/EzIpcManager/EzIPCEventAttribute.cs
+321 −0 ECommons/EzIpcManager/EzIPCExtensions.cs
+26 −0 ECommons/EzIpcManager/SafeWrapper.cs
+289 −0 ECommons/EzIpcManager/SafeWrapperAny.cs
+289 −0 ECommons/EzIpcManager/SafeWrapperIPC.cs
+4 −2 ECommons/GameHelpers/Player.cs
+267 −34 ECommons/GenericHelpers.cs
+1 −1 ECommons/Hooks/MapEffect.cs
+5 −1 ECommons/ImGuiMethods/EColor.cs
+11 −43 ECommons/ImGuiMethods/FontAwesome.cs
+4 −2 ECommons/ImGuiMethods/ImGuiEx/Alignment.cs
+1 −1 ECommons/ImGuiMethods/ImGuiEx/Checkbox.cs
+9 −1 ECommons/ImGuiMethods/ImGuiEx/CollectionCheckbox.cs
+5 −5 ECommons/ImGuiMethods/ImGuiEx/EzTable.cs
+169 −18 ECommons/ImGuiMethods/ImGuiEx/ImGuiEx.cs
+7 −6 ECommons/ImGuiMethods/Notify.cs
+34 −0 ECommons/ImGuiMethods/NotifyWindow.cs
+13 −6 ECommons/ImGuiMethods/ThreadLoadImageHandler.cs
+3 −1 ECommons/PartyFunctions/UniversalPartyMember.cs
+28 −0 ECommons/Reflection/DalamudReflector.cs
+33 −0 ECommons/Reflection/FieldPropertyUnion/IFieldPropertyUnion.cs
+50 −0 ECommons/Reflection/FieldPropertyUnion/UnionField.cs
+49 −0 ECommons/Reflection/FieldPropertyUnion/UnionProperty.cs
+30 −2 ECommons/Reflection/ReflectionHelper/Call.cs
+48 −5 ECommons/Reflection/ReflectionHelper/ReflectionHelper.cs
+69 −3 ECommons/Reflection/ReflectionHelper/Utils.cs
+4 −2 ECommons/SimpleGui/ConfigWindow.cs
+16 −5 ECommons/SimpleGui/EzConfigGui.cs
+1 −1 ECommons/packages.lock.json
15 changes: 12 additions & 3 deletions XIVSlothCombo/Attributes/CustomComboInfoAttribute.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using ECommons.DalamudServices;
using Lumina.Excel.GeneratedSheets;
using System;
using System.Collections.Generic;
Expand Down Expand Up @@ -45,6 +46,17 @@ internal CustomComboInfoAttribute(string fancyName, string description, byte job
/// <summary> Gets the job ID. </summary>
public byte JobID { get; }

/// <summary> Gets the job role. </summary>
public int Role => JobIDToRole(JobID);

private int JobIDToRole(byte jobID)
{
if (Svc.Data.GetExcelSheet<ClassJob>().HasRow(jobID))
return Svc.Data.GetExcelSheet<ClassJob>().GetRow(jobID).Role;

return 0;
}

/// <summary> Gets the display order. </summary>
public int Order { get; }

Expand Down Expand Up @@ -75,9 +87,6 @@ private static string JobIDToShorthand(byte key)

public static string JobIDToName(byte key)
{
if (key == 41)
return "Viper";

if (key == 0)
return "General/Multiple Jobs";

Expand Down
3 changes: 3 additions & 0 deletions XIVSlothCombo/Attributes/ReplaceSkillAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,13 @@ internal ReplaceSkillAttribute(params uint[] actionIDs)
if (ActionWatching.ActionSheet.TryGetValue(id, out var action) && action != null)
{
ActionNames.Add($"{action.Name}");
ActionIcons.Add(action.Icon);
}
}
}

internal List<string> ActionNames { get; set; } = [];

internal List<ushort> ActionIcons { get; set; } = [];
}
}
53 changes: 53 additions & 0 deletions XIVSlothCombo/Combos/PvE/PCT.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
namespace XIVSlothCombo.Combos.PvE
{
internal class PCT
{
public const byte JobID = 42;

public const uint
AdventofChocobastion = 39215,
AeroinGreen = 39192,
BlizzardinCyan = 39194,
ClawMotif = 34666,
CometinBlack = 39199,
CreatureMotif = 34689,
LivingMuse = 35347,
MawMotif = 34667,
MogoftheAges = 39782,
PomMotif1 = 34664,
PomMotif2 = 39200,
PomMuse1 = 34670,
PomMuse2 = 39205,
RainbowDrip = 34688,
ReleaseSubtractivePalette = 39214,
RetributionoftheMadeen1 = 34677,
RetributionoftheMadeen2 = 39783,
ScenicMuse = 35349,
Smudge1 = 34684,
Smudge2 = 39210,
StarPrism = 34681,
SteelMuse = 35348,
SubtractivePalette = 39213,
ThunderIIinMagenta = 34661,
ThunderinMagenta1 = 34655,
ThunderinMagenta2 = 39196,
WaterinBlue = 34652,
WeaponMotif = 34690,
WingMotif = 34665;

public static class Buffs
{

}

public static class Debuffs
{

}

public static class Config
{

}
}
}
10 changes: 5 additions & 5 deletions XIVSlothCombo/Combos/PvE/SCH.cs
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,11 @@ protected override uint Invoke(uint actionID, uint lastComboMove, float comboTim

if (ActionFound)
{
//Ruin 2 Movement
if (IsEnabled(CustomComboPreset.SCH_DPS_Ruin2Movement) &&
LevelChecked(Ruin2) &&
IsMoving) return OriginalHook(Ruin2); //Who knows in the future

var incombat = HasCondition(Dalamud.Game.ClientState.Conditions.ConditionFlag.InCombat);
if (!incombat)
{
Expand Down Expand Up @@ -404,11 +409,6 @@ protected override uint Invoke(uint actionID, uint lastComboMove, float comboTim
GetTargetHPPercent() > Config.SCH_ST_DPS_BioOption)
return dot; //Use appropriate DoT Action
}

//Ruin 2 Movement
if (IsEnabled(CustomComboPreset.SCH_DPS_Ruin2Movement) &&
LevelChecked(Ruin2) && InCombat() &&
IsMoving) return OriginalHook(Ruin2); //Who knows in the future
}
}
return actionID;
Expand Down
2 changes: 1 addition & 1 deletion XIVSlothCombo/Combos/PvE/SMN.cs
Original file line number Diff line number Diff line change
Expand Up @@ -627,7 +627,7 @@ protected override uint Invoke(uint actionID, uint lastComboMove, float comboTim
if ((Config.SMN_ST_Egi_AstralFlow[2] && HasEffect(Buffs.GarudasFavor) && (IsNotEnabled(CustomComboPreset.SMN_DemiEgiMenu_SwiftcastEgi) || swiftcastPhase == 2)) || // Garuda
(Config.SMN_ST_Egi_AstralFlow[0] && HasEffect(Buffs.TitansFavor) && lastComboMove is TopazRite or TopazCata && CanSpellWeave(actionID)) || // Titan
(Config.SMN_ST_Egi_AstralFlow[1] && HasEffect(Buffs.IfritsFavor) && !Config.SMN_ST_CrimsonCycloneMelee && (IsMoving || gauge.Attunement == 0 || (lastComboMove is CrimsonCyclone && InMeleeRange()))) ||
(Config.SMN_ST_Egi_AstralFlow[1] && HasEffect(Buffs.IfritsFavor) && Config.SMN_ST_CrimsonCycloneMelee && InMeleeRange()) || lastComboMove is CrimsonCyclone) // Ifrit
(Config.SMN_ST_Egi_AstralFlow[1] && HasEffect(Buffs.IfritsFavor) && Config.SMN_ST_CrimsonCycloneMelee && InMeleeRange())) // Ifrit
return OriginalHook(AstralFlow);

// Gemshine/Precious Brilliance
Expand Down
55 changes: 55 additions & 0 deletions XIVSlothCombo/Combos/PvE/VPR.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace XIVSlothCombo.Combos.PvE
{
internal class VPR
{
public const byte JobID = 41;

public const uint
DreadFangs = 34607,
DreadMaw = 34615,
Dreadwinder = 34620,
HuntersCoil = 34621,
HuntersDen = 34624,
HuntersSnap = 39166,
PitofDread = 34623,
RattlingCoil = 39189,
Reawaken = 34626,
SerpentsIre = 34647,
SerpentsTail1 = 35920,
SerpentsTail2 = 39183,
Slither1 = 34646,
Slither2 = 39184,
SnakeScales = 39185,
SteelFangs = 34606,
SteelMaw = 34614,
SwiftskinsCoil = 34622,
SwiftskinsDen = 34625,
Twinblood = 35922,
Twinfang = 35921,
UncoiledFury1 = 34633,
UncoiledFury2 = 39168,
Worldswallower = 39190,
WrithingSnap = 34632;

public static class Buffs
{

}

public static class Debuffs
{

}

public static class Config
{

}
}
}
5 changes: 4 additions & 1 deletion XIVSlothCombo/Core/IconReplacer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,10 @@ private unsafe uint GetIconDetour(IntPtr actionManager, uint actionID)
if (Service.ClientState.LocalPlayer == null)
return OriginalHook(actionID);

if (ClassLocked()) 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))
return OriginalHook(actionID);

uint lastComboMove = *(uint*)Service.Address.LastComboMove;
float comboTime = *(float*)Service.Address.ComboTimer;
Expand Down
107 changes: 7 additions & 100 deletions XIVSlothCombo/Core/PluginConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,45 +17,6 @@ namespace XIVSlothCombo.Core
[Serializable]
public class PluginConfiguration : IPluginConfiguration
{
private static readonly HashSet<CustomComboPreset> SecretCombos;
private static readonly HashSet<CustomComboPreset> VariantCombos;
private static readonly HashSet<CustomComboPreset> BozjaCombos;
private static readonly HashSet<CustomComboPreset> EurekaCombos;
private static readonly Dictionary<CustomComboPreset, CustomComboPreset[]> ConflictingCombos;
private static readonly Dictionary<CustomComboPreset, CustomComboPreset?> ParentCombos; // child: parent

static PluginConfiguration()
{
// Secret combos
SecretCombos = Enum.GetValues<CustomComboPreset>()
.Where(preset => preset.GetAttribute<SecretCustomComboAttribute>() != default)
.ToHashSet();

VariantCombos = Enum.GetValues<CustomComboPreset>()
.Where(preset => preset.GetAttribute<VariantAttribute>() != default)
.ToHashSet();

BozjaCombos = Enum.GetValues<CustomComboPreset>()
.Where(preset => preset.GetAttribute<BozjaAttribute>() != default)
.ToHashSet();

EurekaCombos = Enum.GetValues<CustomComboPreset>()
.Where(preset => preset.GetAttribute<EurekaAttribute>() != default)
.ToHashSet();

// Conflicting combos
ConflictingCombos = Enum.GetValues<CustomComboPreset>()
.ToDictionary(
preset => preset,
preset => preset.GetAttribute<ConflictingCombosAttribute>()?.ConflictingPresets ?? Array.Empty<CustomComboPreset>());

// Parent combos
ParentCombos = Enum.GetValues<CustomComboPreset>()
.ToDictionary(
preset => preset,
preset => preset.GetAttribute<ParentComboAttribute>()?.ParentPreset);
}

#region Version

/// <summary> Gets or sets the configuration version. </summary>
Expand All @@ -66,7 +27,7 @@ static PluginConfiguration()
#region EnabledActions

/// <summary> Gets or sets the collection of enabled combos. </summary>
[JsonProperty("EnabledActionsV5")]
[JsonProperty("EnabledActionsV6")]
public HashSet<CustomComboPreset> EnabledActions { get; set; } = [];

#endregion
Expand All @@ -89,58 +50,9 @@ static PluginConfiguration()

#endregion

#region Combo Preset Checks

/// <summary> Gets a value indicating whether a preset is enabled. </summary>
/// <param name="preset"> Preset to check. </param>
/// <returns> The boolean representation. </returns>
public bool IsEnabled(CustomComboPreset preset) => EnabledActions.Contains(preset);

/// <summary> Gets a value indicating whether a preset is secret. </summary>
/// <param name="preset"> Preset to check. </param>
/// <returns> The boolean representation. </returns>
public static bool IsSecret(CustomComboPreset preset) => SecretCombos.Contains(preset);

/// <summary> Gets a value indicating whether a preset is secret. </summary>
/// <param name="preset"> Preset to check. </param>
/// <returns> The boolean representation. </returns>
public static bool IsVariant(CustomComboPreset preset) => VariantCombos.Contains(preset);

/// <summary> Gets a value indicating whether a preset is secret. </summary>
/// <param name="preset"> Preset to check. </param>
/// <returns> The boolean representation. </returns>
public static bool IsBozja(CustomComboPreset preset) => BozjaCombos.Contains(preset);

/// <summary> Gets a value indicating whether a preset is secret. </summary>
/// <param name="preset"> Preset to check. </param>
/// <returns> The boolean representation. </returns>
public static bool IsEureka(CustomComboPreset preset) => EurekaCombos.Contains(preset);

/// <summary> Gets the parent combo preset if it exists, or null. </summary>
/// <param name="preset"> Preset to check. </param>
/// <returns> The parent preset. </returns>
public static CustomComboPreset? GetParent(CustomComboPreset preset) => ParentCombos[preset];

#endregion

#region Conflicting Combos

/// <summary> Gets an array of conflicting combo presets. </summary>
/// <param name="preset"> Preset to check. </param>
/// <returns> The conflicting presets. </returns>
public static CustomComboPreset[] GetConflicts(CustomComboPreset preset) => ConflictingCombos[preset];

/// <summary> Gets the full list of conflicted combos. </summary>
public static List<CustomComboPreset> GetAllConflicts() => ConflictingCombos.Keys.ToList();

/// <summary> Get all the info from conflicted combos. </summary>
public static List<CustomComboPreset[]> GetAllConflictOriginals() => ConflictingCombos.Values.ToList();

#endregion

#region Custom Float Values

[JsonProperty]
[JsonProperty("CustomFloatValuesV6")]
internal static Dictionary<string, float> CustomFloatValues { get; set; } = [];

/// <summary> Gets a custom float value. </summary>
Expand All @@ -162,7 +74,7 @@ public static float GetCustomFloatValue(string config, float defaultMinValue = 0

#region Custom Int Values

[JsonProperty]
[JsonProperty("CustomIntValuesV6")]
internal static Dictionary<string, int> CustomIntValues { get; set; } = [];

/// <summary> Gets a custom integer value. </summary>
Expand All @@ -183,7 +95,7 @@ public static int GetCustomIntValue(string config, int defaultMinVal = 0)
#endregion

#region Custom Int Array Values
[JsonProperty]
[JsonProperty("CustomIntArrayValuesV6")]
internal static Dictionary<string, int[]> CustomIntArrayValues { get; set; } = [];

/// <summary> Gets a custom integer array value. </summary>
Expand All @@ -205,7 +117,7 @@ public static int[] GetCustomIntArrayValue(string config)

#region Custom Bool Values

[JsonProperty]
[JsonProperty("CustomBoolValuesV6")]
internal static Dictionary<string, bool> CustomBoolValues { get; set; } = [];

/// <summary> Gets a custom boolean value. </summary>
Expand All @@ -227,7 +139,7 @@ public static bool GetCustomBoolValue(string config)

#region Custom Bool Array Values

[JsonProperty]
[JsonProperty("CustomBoolArrayValuesV6")]
internal static Dictionary<string, bool[]> CustomBoolArrayValues { get; set; } = [];

/// <summary> Gets a custom boolean array value. </summary>
Expand Down Expand Up @@ -298,7 +210,7 @@ public void ResetFeatures(string config, int[] values)
.Where(preset => (int)preset == value)
.First();

if (!IsEnabled(preset)) continue;
if (!PresetStorage.IsEnabled(preset)) continue;

if (!needToResetMessagePrinted)
{
Expand All @@ -321,11 +233,6 @@ public void ResetFeatures(string config, int[] values)

#endregion

#region UI Settings
public bool AutomaticallyOpenToCurrentJob { get; set; } = false;

#endregion

#region Other (SpecialEvent, MotD, Save)

/// <summary> Handles 'special event' feature naming. </summary>
Expand Down
Loading

0 comments on commit dcecade

Please sign in to comment.