Skip to content

Commit 1daece5

Browse files
authored
Merge pull request #804 from FFXIV-CombatReborn/ShakeABranch
Update WAR and enhance Dalamud branch caching
2 parents 1a7352b + 9d44763 commit 1daece5

File tree

4 files changed

+18
-23
lines changed

4 files changed

+18
-23
lines changed

BasicRotations/Tank/WAR_Default.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ protected override bool HealSingleAbility(IAction nextGCD, out IAction? act)
182182
{
183183
if (ShakeItOffPvE.CanUse(out act, skipAoeCheck: true))
184184
{
185-
return false;
185+
return true;
186186
}
187187

188188
return base.HealSingleAbility(nextGCD, out act);

RotationSolver.Basic/Actions/ActionTargetInfo.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
using ECommons.GameHelpers;
66
using ECommons.Logging;
77
using FFXIVClientStructs.FFXIV.Client.Game;
8-
using FFXIVClientStructs.FFXIV.Client.Game.Event;
98
using FFXIVClientStructs.FFXIV.Client.Game.Object;
109
using FFXIVClientStructs.FFXIV.Client.Graphics.Scene;
1110
using RotationSolver.Basic.Configuration;

RotationSolver.Basic/Rotations/Duties/PhantomRotation.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ public virtual void DisplayStatus()
4949
private static readonly BaseItem OccultElixirItem = new(47743);
5050
private static readonly BaseItem OccultPotionItem = new(47741);
5151
#endregion
52+
5253
#region Status Tracking
5354

5455
/// <summary>
@@ -177,7 +178,6 @@ static partial void ModifyOccultCounterPvE(ref ActionSetting setting)
177178
setting.CreateConfig = () => new ActionConfig()
178179
{
179180
AoeCount = 1,
180-
IsEnabled = false,
181181
};
182182
}
183183

RotationSolver/Watcher.cs

Lines changed: 16 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -29,50 +29,46 @@ public static void Disable()
2929
public static string ShowStrSelf { get; private set; } = string.Empty;
3030
public static string ShowStrEnemy { get; private set; } = string.Empty;
3131

32+
private static string? _cachedBranch = null;
33+
3234
public static string DalamudBranch()
3335
{
36+
if (_cachedBranch != null)
37+
return _cachedBranch;
38+
3439
const string stg = "stg";
3540
const string release = "release";
3641
const string other = "other";
42+
string result = other;
3743

3844
if (DalamudReflector.TryGetDalamudStartInfo(out Dalamud.Common.DalamudStartInfo? startinfo, Svc.PluginInterface))
3945
{
4046
if (File.Exists(startinfo.ConfigurationPath))
4147
{
4248
try
4349
{
44-
string file = File.ReadAllText(startinfo.ConfigurationPath);
45-
dynamic? ob = JsonConvert.DeserializeObject<dynamic>(file);
46-
string? type = ob?.DalamudBetaKind;
47-
if (type is not null && !string.IsNullOrEmpty(type))
50+
using var fs = File.OpenRead(startinfo.ConfigurationPath);
51+
using var doc = System.Text.Json.JsonDocument.Parse(fs);
52+
if (doc.RootElement.TryGetProperty("DalamudBetaKind", out var kindProp))
4853
{
49-
return type switch
54+
string? type = kindProp.GetString();
55+
result = type switch
5056
{
5157
"stg" => stg,
5258
"release" => release,
5359
_ => other,
5460
};
5561
}
56-
else
57-
{
58-
PluginLog.Information("Dalamud release is not a string or null.");
59-
return other;
60-
}
6162
}
62-
catch (Exception ex)
63+
catch
6364
{
64-
PluginLog.Information($"Failed to read or deserialize configuration file: {ex.Message}");
65-
return other;
65+
result = other;
6666
}
6767
}
68-
else
69-
{
70-
PluginLog.Information("Configuration file does not exist.");
71-
return other;
72-
}
7368
}
74-
PluginLog.Information("Failed to get Dalamud start info.");
75-
return other;
69+
70+
_cachedBranch = result;
71+
return result;
7672
}
7773

7874
private static void ActionFromEnemy(ActionEffectSet set)

0 commit comments

Comments
 (0)