Skip to content

Commit

Permalink
Merge pull request #389 from ffxivcode/Fix-Trust-Queuing-for-Trials
Browse files Browse the repository at this point in the history
Fix Trust Index for 0 based per Expansion
  • Loading branch information
Herculezz55 authored Sep 4, 2024
2 parents a49d686 + 401ad6a commit 0351fb6
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
18 changes: 15 additions & 3 deletions AutoDuty/Helpers/ContentHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
namespace AutoDuty.Helpers
{
using Dalamud.Utility;
using static global::AutoDuty.Data.Classes;

internal static class ContentHelper
{
Expand All @@ -33,6 +34,17 @@ private unsafe static int DawnIndex(uint index, uint ex)
};
}

private unsafe static int TrustIndex(int index, uint ex)
{
return ex switch
{
3 => index,
4 => index - 11,
5 => index - 22,
_ => -1
};
}

internal static void PopulateDuties()
{
var listContentFinderCondition = Svc.Data.GameData.GetExcelSheet<ContentFinderCondition>();
Expand Down Expand Up @@ -65,7 +77,7 @@ static string CleanName(string name)
ItemLevelRequired = contentFinderCondition.ItemLevelRequired,
DawnContent = listDawnContent.Any(dawnContent => dawnContent.Content.Value == contentFinderCondition),
TrustContent = listDawnContent.Any(dawnContent => dawnContent.Content.Value == contentFinderCondition && dawnContent.Unknown13),
TrustIndex = listDawnContent.Where(dawnContent => dawnContent.Unknown13).IndexOf(x => x.Content.Value == contentFinderCondition),
TrustIndex = TrustIndex(listDawnContent.Where(dawnContent => dawnContent.Unknown13).IndexOf(x => x.Content.Value == contentFinderCondition), contentFinderCondition.TerritoryType.Value.ExVersion.Value.RowId),
VariantContent = ListVVDContent.Any(variantContent => variantContent == contentFinderCondition.TerritoryType.Value.RowId),
VVDIndex = ListVVDContent.FindIndex(variantContent => variantContent == contentFinderCondition.TerritoryType.Value.RowId),
GCArmyContent = ListGCArmyContent.Any(gcArmyContent => gcArmyContent == contentFinderCondition.TerritoryType.Value.RowId),
Expand All @@ -92,10 +104,10 @@ static string CleanName(string name)
if (content.ExVersion == 5)
content.TrustMembers.Add(TrustHelper.Members[TrustMemberName.Krile]);
}

DictionaryContent.Add(contentFinderCondition.TerritoryType.Value.RowId, content);
}

DictionaryContent = DictionaryContent.OrderBy(content => content.Value.ExVersion).ThenBy(content => content.Value.ClassJobLevelRequired).ThenBy(content => content.Value.TerritoryType).ToDictionary();
}

Expand Down
6 changes: 3 additions & 3 deletions AutoDuty/Helpers/QueueHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,10 @@ internal static void QueueTrust()
AddonHelper.FireCallBack(addonDawn, true, 20, (_content!.ExVersion - 3));
return;
}
else if (addonDawn->AtkValues[151].UInt != _content.DawnIndex)
else if (addonDawn->AtkValues[151].UInt != _content.TrustIndex)
{
Svc.Log.Debug($"Queue Helper - Clicking: {_content.EnglishName} at index: {_content.DawnIndex}");
AddonHelper.FireCallBack(addonDawn, true, 15, _content.DawnIndex);
Svc.Log.Debug($"Queue Helper - Clicking: {_content.EnglishName} at index: {_content.TrustIndex}");
AddonHelper.FireCallBack(addonDawn, true, 15, _content.TrustIndex);
}
else if (!_turnedOffTrustMembers)
{
Expand Down

0 comments on commit 0351fb6

Please sign in to comment.