Skip to content

Commit 3338e8f

Browse files
authored
API 11 (#36)
2 parents 708f4d2 + 5c2b924 commit 3338e8f

File tree

80 files changed

+438
-456
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

80 files changed

+438
-456
lines changed

Action/ASTHelper.cs

Lines changed: 25 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,16 @@
99
using System.Web;
1010
using DailyRoutines.Abstracts;
1111
using DailyRoutines.Managers;
12-
using Dalamud.Game.ClientState.Party;
12+
using Dalamud.Game.Addon.Lifecycle;
13+
using Dalamud.Game.Addon.Lifecycle.AddonArgTypes;
1314
using Dalamud.Game.ClientState.Conditions;
15+
using Dalamud.Game.ClientState.Party;
1416
using Dalamud.Interface.Utility.Raii;
1517
using FFXIVClientStructs.FFXIV.Client.Game;
1618
using FFXIVClientStructs.FFXIV.Client.UI.Agent;
1719
using FFXIVClientStructs.FFXIV.Component.GUI;
1820
using Newtonsoft.Json;
19-
using Dalamud.Game.Addon.Lifecycle;
20-
using Dalamud.Game.Addon.Lifecycle.AddonArgTypes;
21-
using LuminaAction = Lumina.Excel.GeneratedSheets.Action;
21+
using LuminaAction = Lumina.Excel.Sheets.Action;
2222

2323
namespace DailyRoutines.Modules;
2424

@@ -72,7 +72,7 @@ public override void ConfigUI()
7272
{
7373
// auto play card
7474
ImGui.TextColored(LightSkyBlue, GetLoc("ASTHelper-AutoPlayCardTitle"));
75-
ImGuiOm.HelpMarker(GetLoc("ASTHelper-AutoPlayCardDescription", LuminaCache.GetRow<LuminaAction>(17055).Name.ExtractText()));
75+
ImGuiOm.HelpMarker(GetLoc("ASTHelper-AutoPlayCardDescription", LuminaCache.GetRow<LuminaAction>(17055)!.Value.Name.ExtractText()));
7676

7777
ImGui.Spacing();
7878

@@ -209,7 +209,7 @@ public override void ConfigUI()
209209
if (ImGui.SliderFloat("##MarkScale", ref ModuleConfig.MarkScale, 0.1f, 1.0f, "%.2f"))
210210
{
211211
SaveConfig(ModuleConfig);
212-
NewMark(0, LuminaCache.GetRow<LuminaAction>(37023).Icon);
212+
NewMark(0, LuminaCache.GetRow<LuminaAction>(37023)!.Value.Icon);
213213
DService.Framework.RunOnTick(async () => await PreviewTimer(() => DelMark(0), 6000));
214214
RefreshMarks(true);
215215
}
@@ -219,7 +219,7 @@ public override void ConfigUI()
219219
if (ImGui.SliderFloat2("##MarkMargin", ref ModuleConfig.MarkOffset, -50f, 50f, "%.2f"))
220220
{
221221
SaveConfig(ModuleConfig);
222-
NewMark(0, LuminaCache.GetRow<LuminaAction>(37023).Icon);
222+
NewMark(0, LuminaCache.GetRow<LuminaAction>(37023)!.Value.Icon);
223223
DService.Framework.RunOnTick(async () => await PreviewTimer(() => DelMark(0), 6000));
224224
RefreshMarks(true);
225225
}
@@ -254,8 +254,8 @@ private static void OnPreUseAction(
254254
if (member != null)
255255
{
256256
var name = member.Name.ExtractText();
257-
var classJobIcon = member.ClassJob.GameData.ToBitmapFontIcon();
258-
var classJobName = member.ClassJob.GameData.Name.ExtractText();
257+
var classJobIcon = member.ClassJob.ValueNullable.ToBitmapFontIcon();
258+
var classJobName = member.ClassJob.Value.Name.ExtractText();
259259

260260
var locKey = actionID switch
261261
{
@@ -296,8 +296,8 @@ private static void OnPreUseAction(
296296
if (member != null)
297297
{
298298
var name = member.Name.ExtractText();
299-
var classJobIcon = member.ClassJob.GameData.ToBitmapFontIcon();
300-
var classJobName = member.ClassJob.GameData.Name.ExtractText();
299+
var classJobIcon = member.ClassJob.ValueNullable.ToBitmapFontIcon();
300+
var classJobName = member.ClassJob.Value.Name.ExtractText();
301301

302302
if (ModuleConfig.SendChat)
303303
Chat(GetSLoc("ASTHealer-EasyHeal-Message", name, classJobIcon, classJobName));
@@ -306,7 +306,8 @@ private static void OnPreUseAction(
306306
if (ModuleConfig.OverlayMark)
307307
{
308308
var idx = FetchMemberIndex((uint)targetID) ?? 0;
309-
NewMark(idx, LuminaCache.GetRow<LuminaAction>(actionID).Icon);
309+
if (!LuminaCache.TryGetRow<LuminaAction>(actionID, out var actionRow)) return;
310+
NewMark(idx, actionRow.Icon);
310311
DService.Framework.RunOnTick(async () => await MarkTimer(() => DelMark(idx), 6000));
311312
}
312313
}
@@ -384,7 +385,7 @@ public static unsafe void OnPartyListPostDraw(AddonEvent type, AddonArgs args)
384385
if (meleeIdx != MeleeCandidateIdxCache)
385386
{
386387
DelMark(MeleeCandidateIdxCache);
387-
NewMark(meleeIdx, LuminaCache.GetRow<LuminaAction>(37023).Icon);
388+
NewMark(meleeIdx, LuminaCache.GetRow<LuminaAction>(37023)!.Value.Icon);
388389
MeleeCandidateIdxCache = meleeIdx;
389390
}
390391

@@ -394,7 +395,7 @@ public static unsafe void OnPartyListPostDraw(AddonEvent type, AddonArgs args)
394395
if (rangeIdx != RangeCandidateIdxCache)
395396
{
396397
DelMark(RangeCandidateIdxCache);
397-
NewMark(rangeIdx, LuminaCache.GetRow<LuminaAction>(37026).Icon);
398+
NewMark(rangeIdx, LuminaCache.GetRow<LuminaAction>(37026)!.Value.Icon);
398399
RangeCandidateIdxCache = rangeIdx;
399400
}
400401
}
@@ -439,7 +440,7 @@ private static void OrderCandidates()
439440

440441
// find card candidates
441442
var partyList = DService.PartyList; // role [1 tank, 2 melee, 3 range, 4 healer]
442-
if (partyList.Length is 0 || DService.ClientState.LocalPlayer.ClassJob.GameData.Abbreviation != "AST" || ModuleConfig.AutoPlayCard == AutoPlayCardStatus.Disable)
443+
if (partyList.Length is 0 || DService.ClientState.LocalPlayer.ClassJob.Value.Abbreviation != "AST" || ModuleConfig.AutoPlayCard == AutoPlayCardStatus.Disable)
443444
return;
444445

445446
// advance fallback when no valid zone id or invalid key
@@ -461,15 +462,15 @@ private static void OrderCandidates()
461462
var meleeOrder = MeleeOrder[orderLabel];
462463
for (var idx = 0; idx < meleeOrder.Length; idx++)
463464
{
464-
var member = partyList.FirstOrDefault(m => m.ClassJob.GameData.NameEnglish == meleeOrder[idx]);
465+
var member = partyList.FirstOrDefault(m => m.ClassJob.Value.NameEnglish == meleeOrder[idx]);
465466
if (member is not null && MeleeCandidateOrder.All(m => m.id != member.ObjectId))
466467
MeleeCandidateOrder.Add((member.ObjectId, 2 - (idx * 0.1)));
467468
}
468469

469470
var rangeOrder = RangeOrder[orderLabel];
470471
for (var idx = 0; idx < rangeOrder.Length; idx++)
471472
{
472-
var member = partyList.FirstOrDefault(m => m.ClassJob.GameData.NameEnglish == rangeOrder[idx]);
473+
var member = partyList.FirstOrDefault(m => m.ClassJob.Value.NameEnglish == rangeOrder[idx]);
473474
if (member is not null && RangeCandidateOrder.All(m => m.id != member.ObjectId))
474475
RangeCandidateOrder.Add((member.ObjectId, 2 - (idx * 0.1)));
475476
}
@@ -486,7 +487,7 @@ private static void OrderCandidates()
486487
var scale = 1 / (1 + Math.Exp(-(bestRecord.Percentile - 50) / 8.33));
487488

488489
// update priority
489-
if (member.ClassJob.GameData.Role is (1 or 2))
490+
if (member.ClassJob.Value.Role is (1 or 2))
490491
{
491492
var idx = MeleeCandidateOrder.FindIndex(m => m.id == member.ObjectId);
492493
if (idx != -1)
@@ -495,7 +496,7 @@ private static void OrderCandidates()
495496
MeleeCandidateOrder[idx] = (member.ObjectId, priority);
496497
}
497498
}
498-
else if (member.ClassJob.GameData.Role is 3)
499+
else if (member.ClassJob.Value.Role is 3)
499500
{
500501
var idx = RangeCandidateOrder.FindIndex(m => m.id == member.ObjectId);
501502
if (idx != -1)
@@ -510,14 +511,14 @@ private static void OrderCandidates()
510511
// fallback: select the first dps in party list
511512
if (MeleeCandidateOrder.Count is 0)
512513
{
513-
var firstRange = partyList.FirstOrDefault(m => m.ClassJob.GameData.Role is (1 or 3));
514+
var firstRange = partyList.FirstOrDefault(m => m.ClassJob.Value.Role is (1 or 3));
514515
if (firstRange is not null)
515516
MeleeCandidateOrder.Add((firstRange.ObjectId, -5));
516517
}
517518

518519
if (RangeCandidateOrder.Count is 0)
519520
{
520-
var firstMelee = partyList.FirstOrDefault(m => m.ClassJob.GameData.Role is 2);
521+
var firstMelee = partyList.FirstOrDefault(m => m.ClassJob.Value.Role is 2);
521522
if (firstMelee is not null)
522523
RangeCandidateOrder.Add((firstMelee.ObjectId, -5));
523524
}
@@ -630,7 +631,7 @@ private async Task CheckKeyStatus()
630631

631632
private static string GetRegion()
632633
{
633-
return DService.ClientState.LocalPlayer.CurrentWorld.GameData.DataCenter.Value.Region switch
634+
return DService.ClientState.LocalPlayer.CurrentWorld.Value.DataCenter.Value.Region switch
634635
{
635636
1 => "JP",
636637
2 => "NA",
@@ -649,9 +650,9 @@ private static string GetRegion()
649650

650651
// get character info
651652
var charaName = member.Name;
652-
var serverSlug = member.World.GameData.Name;
653+
var serverSlug = member.World.Value.Name.ExtractText();
653654
var region = GetRegion();
654-
var job = member.ClassJob.GameData.NameEnglish;
655+
var job = member.ClassJob.Value.NameEnglish.ExtractText();
655656

656657
// fetch record
657658
try

Action/AutoCancelCast.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public override void Init()
3939
{
4040
CancelCast ??= Marshal.GetDelegateForFunctionPointer<Action>(CancelCastSig.ScanText());
4141

42-
TargetAreaActions ??= LuminaCache.Get<Lumina.Excel.GeneratedSheets.Action>()
42+
TargetAreaActions ??= LuminaCache.Get<Lumina.Excel.Sheets.Action>()
4343
.Where(x => x.TargetArea)
4444
.Select(x => x.RowId).ToHashSet();
4545

Action/AutoChakraFormShift.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
using FFXIVClientStructs.FFXIV.Client.Game;
55
using System.Collections.Generic;
66
using DailyRoutines.Abstracts;
7-
using Lumina.Excel.GeneratedSheets;
7+
using Lumina.Excel.Sheets;
88

99
namespace DailyRoutines.Modules;
1010

@@ -29,7 +29,7 @@ public override void Init()
2929
private bool? CheckCurrentJob()
3030
{
3131
if (BetweenAreas || OccupiedInEvent) return false;
32-
if (DService.ClientState.LocalPlayer is not { ClassJob.Id: 20 } || !IsValidPVEDuty())
32+
if (DService.ClientState.LocalPlayer is not { ClassJob.RowId: 20 } || !IsValidPVEDuty())
3333
{
3434
TaskHelper.Abort();
3535
return true;
@@ -46,7 +46,7 @@ private static unsafe bool IsValidPVEDuty()
4646
var isPVP = GameMain.IsInPvPArea() || GameMain.IsInPvPInstance();
4747
var contentData = LuminaCache.GetRow<ContentFinderCondition>(GameMain.Instance()->CurrentContentFinderConditionId);
4848

49-
return !isPVP && (contentData == null || !InvalidContentTypes.Contains(contentData.ContentType.Row));
49+
return !isPVP && (contentData == null || !InvalidContentTypes.Contains(contentData.Value.ContentType.RowId));
5050
}
5151

5252
private unsafe bool? UseRelatedActions()
@@ -100,7 +100,7 @@ private void OnDutyRecommenced(object? sender, ushort e)
100100
// 进入副本
101101
private void OnZoneChanged(ushort zone)
102102
{
103-
if (LuminaCache.GetRow<TerritoryType>(zone) is not { ContentFinderCondition.Row: > 0 }) return;
103+
if (LuminaCache.GetRow<TerritoryType>(zone) is not { ContentFinderCondition.RowId: > 0 }) return;
104104

105105
TaskHelper.Abort();
106106
TaskHelper.Enqueue(CheckCurrentJob);

Action/AutoDrawMotifs.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
using FFXIVClientStructs.FFXIV.Client.Game;
66
using Dalamud.Game.ClientState.Conditions;
77
using Dalamud.Game.ClientState.JobGauge.Types;
8-
using Lumina.Excel.GeneratedSheets;
8+
using Lumina.Excel.Sheets;
99

1010
namespace DailyRoutines.Modules;
1111

@@ -72,7 +72,7 @@ private void OnZoneChanged(ushort zone)
7272
private bool? CheckCurrentJob()
7373
{
7474
if (BetweenAreas || OccupiedInEvent) return false;
75-
if (DService.ClientState.LocalPlayer is not { ClassJob.Id: 42, Level: >= 30 } || !IsValidPVEDuty())
75+
if (DService.ClientState.LocalPlayer is not { ClassJob.RowId: 42, Level: >= 30 } || !IsValidPVEDuty())
7676
{
7777
TaskHelper.Abort();
7878
return true;
@@ -115,7 +115,7 @@ private static unsafe bool IsValidPVEDuty()
115115
var isPVP = GameMain.IsInPvPArea() || GameMain.IsInPvPInstance();
116116
var contentData = LuminaCache.GetRow<ContentFinderCondition>(GameMain.Instance()->CurrentContentFinderConditionId);
117117

118-
return !isPVP && (contentData == null || !InvalidContentTypes.Contains(contentData.ContentType.Row));
118+
return !isPVP && (contentData == null || !InvalidContentTypes.Contains(contentData.Value.ContentType.RowId));
119119
}
120120

121121
public override void Uninit()

Action/AutoGathererRoleActions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public override void Init()
3939

4040
DService.ClientState.ClassJobChanged += OnJobChanged;
4141
if (DService.ClientState.LocalPlayer != null)
42-
OnJobChanged(DService.ClientState.LocalPlayer.ClassJob.Id);
42+
OnJobChanged(DService.ClientState.LocalPlayer.ClassJob.RowId);
4343
}
4444

4545
private unsafe void OnJobChanged(uint jobID)

Action/AutoPeloton.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ private bool Cycle(int delayMs = 0)
130130
{
131131
if (BetweenAreas || !IsScreenReady() || OccupiedInEvent) return Cycle(1_000);
132132
if (DService.ClientState.LocalPlayer is not { } localPlayer) return Cycle(1_000);
133-
if (!s_ClassJobArr.Contains(localPlayer.ClassJob.Id)) return true;
133+
if (!s_ClassJobArr.Contains(localPlayer.ClassJob.RowId)) return true;
134134
if (!IsActionUnlocked(s_PelotoningActionId)) return true;
135135

136136
if (Config.DisableInWalk && Control.Instance()->IsWalking) return Cycle(1_000);

Action/AutoPetFollow.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ private static unsafe void OnConditionChanged(ConditionFlag flag, bool value)
3434
{
3535
if (flag is not ConditionFlag.InCombat || value) return;
3636

37-
if (DService.ClientState.LocalPlayer is not { ClassJob.Id: 26 or 27 or 28 } player) return;
37+
if (DService.ClientState.LocalPlayer is not { ClassJob.RowId: 26 or 27 or 28 } player) return;
3838

3939
var isPetSummoned = CharacterManager.Instance()->LookupPetByOwnerObject((BattleChara*)player.Address) != null;
4040
if (!isPetSummoned) return;

Action/AutoPreventDuplicateStatus.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
using FFXIVClientStructs.FFXIV.Client.Game.Character;
1111
using FFXIVClientStructs.FFXIV.Client.Game.Control;
1212
using FFXIVClientStructs.FFXIV.Client.Game.Object;
13-
using Lumina.Excel.GeneratedSheets;
13+
using Lumina.Excel.Sheets;
1414

1515
namespace DailyRoutines.Modules;
1616

@@ -275,7 +275,7 @@ private static void OnPreUseAction(
275275
var actionData = LuminaCache.GetRow<Action>(adjustedActionID);
276276
if (actionData == null) return;
277277

278-
var canTargetSelf = actionData.CanTargetSelf;
278+
var canTargetSelf = actionData.Value.CanTargetSelf;
279279
// 雪仇
280280
if (adjustedActionID == 7535) canTargetSelf = false;
281281

@@ -289,7 +289,7 @@ private static void OnPreUseAction(
289289
{
290290
if (ModuleConfig.SendNotification && NotificationThrottler.Throttle(adjustedActionID, 1_000))
291291
NotificationInfo(GetLoc("AutoPreventDuplicateStatus-PreventedNotification",
292-
actionData.Name.ExtractText(), adjustedActionID));
292+
actionData.Value.Name.ExtractText(), adjustedActionID));
293293

294294
isPrevented = true;
295295
}

Action/AutoReplaceActionLowLevel.cs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
using System.Collections.Generic;
2-
using System.Numerics;
31
using DailyRoutines.Abstracts;
42
using Dalamud.Hooking;
53
using Dalamud.Interface.Utility.Raii;
64
using FFXIVClientStructs.FFXIV.Client.Game;
75
using FFXIVClientStructs.FFXIV.Client.UI.Misc;
8-
using Lumina.Excel.GeneratedSheets;
6+
using Lumina.Excel.Sheets;
7+
using System.Collections.Generic;
8+
using System.Numerics;
99

1010
namespace DailyRoutines.Modules;
1111

@@ -18,10 +18,9 @@ public unsafe class AutoReplaceActionLowLevel : DailyModuleBase
1818
Category = ModuleCategories.Action,
1919
};
2020

21-
private static readonly CompSig IsActionReplaceableSig =
22-
new("E8 ?? ?? ?? ?? 84 C0 0F 84 ?? ?? ?? ?? C6 83 ?? ?? ?? ?? ?? 48 8B 5C 24");
23-
private delegate bool IsActionReplaceableDelegate(uint actionID);
24-
private static Hook<IsActionReplaceableDelegate> IsActionReplaceableHook;
21+
private static readonly CompSig IsActionReplaceableSig = new("E8 ?? ?? ?? ?? 84 C0 74 69 8B D3");
22+
private delegate bool IsActionReplaceableDelegate(uint actionID);
23+
private static Hook<IsActionReplaceableDelegate> IsActionReplaceableHook;
2524

2625
private static readonly CompSig GetAdjustedActionIDSig = new("E8 ?? ?? ?? ?? 89 03 8B 03");
2726
private delegate uint GetAdjustedActionIDDelegate(ActionManager* manager, uint actionID);
@@ -84,20 +83,20 @@ public override void ConfigUI()
8483
var action1Data = LuminaCache.GetRow<Action>(action1);
8584
if (action0Data == null || action1Data == null) continue;
8685

87-
var action0Icon = DService.Texture.GetFromGameIcon(new(action0Data.Icon)).GetWrapOrDefault();
88-
var action1Icon = DService.Texture.GetFromGameIcon(new(action1Data.Icon)).GetWrapOrDefault();
86+
var action0Icon = DService.Texture.GetFromGameIcon(new(action0Data.Value.Icon)).GetWrapOrDefault();
87+
var action1Icon = DService.Texture.GetFromGameIcon(new(action1Data.Value.Icon)).GetWrapOrDefault();
8988
if (action0Icon == null || action1Icon == null) continue;
9089

9190
ImGui.TableNextRow();
9291
ImGui.TableNextColumn();
93-
ImGuiOm.TextImage(action0Data.Name.ExtractText(), action0Icon.ImGuiHandle, new(ImGui.GetTextLineHeightWithSpacing()));
92+
ImGuiOm.TextImage(action0Data.Value.Name.ExtractText(), action0Icon.ImGuiHandle, new(ImGui.GetTextLineHeightWithSpacing()));
9493

9594
ImGui.TableNextColumn();
9695
ImGui.AlignTextToFramePadding();
9796
ImGui.Text("→");
9897

9998
ImGui.TableNextColumn();
100-
ImGuiOm.TextImage(action1Data.Name.ExtractText(), action1Icon.ImGuiHandle, new(ImGui.GetTextLineHeightWithSpacing()));
99+
ImGuiOm.TextImage(action1Data.Value.Name.ExtractText(), action1Icon.ImGuiHandle, new(ImGui.GetTextLineHeightWithSpacing()));
101100
}
102101
}
103102

@@ -129,10 +128,11 @@ private static uint GetIconIDForSlotDetour(
129128
{
130129
if (type != RaptureHotbarModule.HotbarSlotType.Action)
131130
return GetIconIDForSlotHook.Original(slot, type, actionID);
132-
133131
return !TryGetReplacement(actionID, out var adjustedActionID)
134132
? GetIconIDForSlotHook.Original(slot, type, actionID)
135-
: LuminaCache.GetRow<Action>(adjustedActionID).Icon;
133+
: LuminaCache.TryGetRow<Action>(adjustedActionID, out var row)
134+
? row.Icon
135+
: 0u;
136136
}
137137

138138
private static bool IsActionReplaceableDetour(uint actionID) => true;

0 commit comments

Comments
 (0)