diff --git a/Dalamud/Game/UnlockState/ItemActionType.cs b/Dalamud/Game/UnlockState/ItemActionAction.cs similarity index 96% rename from Dalamud/Game/UnlockState/ItemActionType.cs rename to Dalamud/Game/UnlockState/ItemActionAction.cs index 8e3d79b84..0e86fcb67 100644 --- a/Dalamud/Game/UnlockState/ItemActionType.cs +++ b/Dalamud/Game/UnlockState/ItemActionAction.cs @@ -3,9 +3,9 @@ using Lumina.Excel.Sheets; namespace Dalamud.Game.UnlockState; /// -/// Enum for . +/// Enum for . /// -internal enum ItemActionType : ushort +internal enum ItemActionAction : ushort { /// /// No item action. diff --git a/Dalamud/Game/UnlockState/RecipeData.cs b/Dalamud/Game/UnlockState/RecipeData.cs index c419ba4fd..7fa0d4b8f 100644 --- a/Dalamud/Game/UnlockState/RecipeData.cs +++ b/Dalamud/Game/UnlockState/RecipeData.cs @@ -158,67 +158,23 @@ internal unsafe class RecipeData : IInternalDisposableService { noteBookDivisionIndex++; - // For future Lumina.Excel update, replace with: - // if (!notebookDivisionRow.AllowedCraftTypes[craftType]) - // continue; - - switch (craftTypeRow.RowId) - { - case 0 when !noteBookDivisionRow.CRPCraft: continue; - case 1 when !noteBookDivisionRow.BSMCraft: continue; - case 2 when !noteBookDivisionRow.ARMCraft: continue; - case 3 when !noteBookDivisionRow.GSMCraft: continue; - case 4 when !noteBookDivisionRow.LTWCraft: continue; - case 5 when !noteBookDivisionRow.WVRCraft: continue; - case 6 when !noteBookDivisionRow.ALCCraft: continue; - case 7 when !noteBookDivisionRow.CULCraft: continue; - } + if (!noteBookDivisionRow.AllowedCraftTypes[craftType]) + continue; if (noteBookDivisionRow.GatheringOpeningLevel != byte.MaxValue) continue; - // For future Lumina.Excel update, replace with: - // if (notebookDivisionRow.RequiresSecretRecipeBookGroupUnlock) - if (noteBookDivisionRow.Unknown1) + if (noteBookDivisionRow.RequiresSecretRecipeBookGroupUnlock) { var secretRecipeBookUnlocked = false; - // For future Lumina.Excel update, iterate over notebookDivisionRow.SecretRecipeBookGroups - for (var i = 0; i < 2; i++) + foreach (var secretRecipeBookGroup in noteBookDivisionRow.SecretRecipeBookGroups) { - // For future Lumina.Excel update, replace with: - // if (secretRecipeBookGroup.RowId == 0 || !secretRecipeBookGroup.IsValid) - // continue; - var secretRecipeBookGroupRowId = i switch - { - 0 => noteBookDivisionRow.Unknown2, - 1 => noteBookDivisionRow.Unknown2, - _ => default, - }; - - if (secretRecipeBookGroupRowId == 0) + if (secretRecipeBookGroup.RowId == 0 || !secretRecipeBookGroup.IsValid) continue; - if (!this.dataManager.GetExcelSheet().TryGetRow(secretRecipeBookGroupRowId, out var secretRecipeBookGroupRow)) - continue; - - // For future Lumina.Excel update, replace with: - // var bitIndex = secretRecipeBookGroup.Value.UnlockBitIndex[craftType]; - - var bitIndex = craftType switch - { - 0 => secretRecipeBookGroupRow.Unknown0, - 1 => secretRecipeBookGroupRow.Unknown1, - 2 => secretRecipeBookGroupRow.Unknown2, - 3 => secretRecipeBookGroupRow.Unknown3, - 4 => secretRecipeBookGroupRow.Unknown4, - 5 => secretRecipeBookGroupRow.Unknown5, - 6 => secretRecipeBookGroupRow.Unknown6, - 7 => secretRecipeBookGroupRow.Unknown7, - _ => default, - }; - - if (PlayerState.Instance()->UnlockedSecretRecipeBooksBitArray.Get(bitIndex)) + var bitIndex = secretRecipeBookGroup.Value.SecretRecipeBook[craftType].RowId; + if (PlayerState.Instance()->UnlockedSecretRecipeBooksBitArray.Get((int)bitIndex)) { secretRecipeBookUnlocked = true; break; diff --git a/Dalamud/Game/UnlockState/UnlockState.cs b/Dalamud/Game/UnlockState/UnlockState.cs index cd896ffb6..cc70a524c 100644 --- a/Dalamud/Game/UnlockState/UnlockState.cs +++ b/Dalamud/Game/UnlockState/UnlockState.cs @@ -209,7 +209,7 @@ internal unsafe class UnlockState : IInternalDisposableService, IUnlockState /// public bool IsEmjVoiceNpcUnlocked(EmjVoiceNpc row) { - return this.IsUnlockLinkUnlocked(row.Unknown26); + return this.IsUnlockLinkUnlocked(row.UnlockLink); } /// @@ -217,7 +217,7 @@ internal unsafe class UnlockState : IInternalDisposableService, IUnlockState { return this.dataManager.GetExcelSheet().TryGetRow(row.RowId, out var emjVoiceNpcRow) && this.IsEmjVoiceNpcUnlocked(emjVoiceNpcRow) - && QuestManager.IsQuestComplete(row.Unknown1); + && QuestManager.IsQuestComplete(row.UnlockQuest.RowId); } /// @@ -264,47 +264,47 @@ internal unsafe class UnlockState : IInternalDisposableService, IUnlockState // To avoid the ExdModule.GetItemRowById call, which can return null if the excel page // is not loaded, we're going to imitate the IsItemActionUnlocked call first: - switch ((ItemActionType)row.ItemAction.Value.Type) + switch ((ItemActionAction)row.ItemAction.Value.Action.RowId) { - case ItemActionType.Companion: + case ItemActionAction.Companion: return UIState.Instance()->IsCompanionUnlocked(row.ItemAction.Value.Data[0]); - case ItemActionType.BuddyEquip: + case ItemActionAction.BuddyEquip: return UIState.Instance()->Buddy.CompanionInfo.IsBuddyEquipUnlocked(row.ItemAction.Value.Data[0]); - case ItemActionType.Mount: + case ItemActionAction.Mount: return PlayerState.Instance()->IsMountUnlocked(row.ItemAction.Value.Data[0]); - case ItemActionType.SecretRecipeBook: + case ItemActionAction.SecretRecipeBook: return PlayerState.Instance()->IsSecretRecipeBookUnlocked(row.ItemAction.Value.Data[0]); - case ItemActionType.UnlockLink: - case ItemActionType.OccultRecords: + case ItemActionAction.UnlockLink: + case ItemActionAction.OccultRecords: return UIState.Instance()->IsUnlockLinkUnlocked(row.ItemAction.Value.Data[0]); - case ItemActionType.TripleTriadCard when row.AdditionalData.Is(): + case ItemActionAction.TripleTriadCard when row.AdditionalData.Is(): return UIState.Instance()->IsTripleTriadCardUnlocked((ushort)row.AdditionalData.RowId); - case ItemActionType.FolkloreTome: + case ItemActionAction.FolkloreTome: return PlayerState.Instance()->IsFolkloreBookUnlocked(row.ItemAction.Value.Data[0]); - case ItemActionType.OrchestrionRoll when row.AdditionalData.Is(): + case ItemActionAction.OrchestrionRoll when row.AdditionalData.Is(): return PlayerState.Instance()->IsOrchestrionRollUnlocked(row.AdditionalData.RowId); - case ItemActionType.FramersKit: + case ItemActionAction.FramersKit: return PlayerState.Instance()->IsFramersKitUnlocked(row.AdditionalData.RowId); - case ItemActionType.Ornament: + case ItemActionAction.Ornament: return PlayerState.Instance()->IsOrnamentUnlocked(row.ItemAction.Value.Data[0]); - case ItemActionType.Glasses: + case ItemActionAction.Glasses: return PlayerState.Instance()->IsGlassesUnlocked((ushort)row.AdditionalData.RowId); - case ItemActionType.SoulShards when PublicContentOccultCrescent.GetState() is var occultCrescentState && occultCrescentState != null: + case ItemActionAction.SoulShards when PublicContentOccultCrescent.GetState() is var occultCrescentState && occultCrescentState != null: var supportJobId = (byte)row.ItemAction.Value.Data[0]; return supportJobId < occultCrescentState->SupportJobLevels.Length && occultCrescentState->SupportJobLevels[supportJobId] != 0; - case ItemActionType.CompanySealVouchers: + case ItemActionAction.CompanySealVouchers: return false; } @@ -327,7 +327,7 @@ internal unsafe class UnlockState : IInternalDisposableService, IUnlockState /// public bool IsMKDLoreUnlocked(MKDLore row) { - return this.IsUnlockLinkUnlocked(row.Unknown2); + return this.IsUnlockLinkUnlocked(row.UnlockLink); } /// @@ -414,20 +414,20 @@ internal unsafe class UnlockState : IInternalDisposableService, IUnlockState if (row.ItemAction.RowId == 0) return false; - return (ItemActionType)row.ItemAction.Value.Type - is ItemActionType.Companion - or ItemActionType.BuddyEquip - or ItemActionType.Mount - or ItemActionType.SecretRecipeBook - or ItemActionType.UnlockLink - or ItemActionType.TripleTriadCard - or ItemActionType.FolkloreTome - or ItemActionType.OrchestrionRoll - or ItemActionType.FramersKit - or ItemActionType.Ornament - or ItemActionType.Glasses - or ItemActionType.OccultRecords - or ItemActionType.SoulShards; + return (ItemActionAction)row.ItemAction.Value.Action.RowId + is ItemActionAction.Companion + or ItemActionAction.BuddyEquip + or ItemActionAction.Mount + or ItemActionAction.SecretRecipeBook + or ItemActionAction.UnlockLink + or ItemActionAction.TripleTriadCard + or ItemActionAction.FolkloreTome + or ItemActionAction.OrchestrionRoll + or ItemActionAction.FramersKit + or ItemActionAction.Ornament + or ItemActionAction.Glasses + or ItemActionAction.OccultRecords + or ItemActionAction.SoulShards; } /// diff --git a/Directory.Packages.props b/Directory.Packages.props index 06338efac..77a4035a4 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -15,7 +15,7 @@ - + diff --git a/lib/Lumina.Excel b/lib/Lumina.Excel index 5d01489c3..4650ad332 160000 --- a/lib/Lumina.Excel +++ b/lib/Lumina.Excel @@ -1 +1 @@ -Subproject commit 5d01489c34f33a3d645f49085d7fc0065a1ac801 +Subproject commit 4650ad332dd22aeff0d1f7ac33845b1c2aca4f8d