diff --git a/Questionable/Controller/CombatModules/ItemUseModule.cs b/Questionable/Controller/CombatModules/ItemUseModule.cs index ec9adfa12..b5b6fd289 100644 --- a/Questionable/Controller/CombatModules/ItemUseModule.cs +++ b/Questionable/Controller/CombatModules/ItemUseModule.cs @@ -142,7 +142,8 @@ internal sealed class ItemUseModule : ICombatModule { BattleChara* battleChara = (BattleChara*)gameObject.Address; if (_combatData.CombatItemUse.Condition == ECombatItemUseCondition.Incapacitated) - return (battleChara->CombatTagType & 128u) != 0; // FIXME 7.1 + //return (byte)(((nint)battleChara + 0x1C68) & 0x40) != 0; // FIXME 7.1 + return false; if (_combatData.CombatItemUse.Condition == ECombatItemUseCondition.HealthPercent) return (100f * battleChara->Health / battleChara->MaxHealth) < _combatData.CombatItemUse.Value; diff --git a/Questionable/Controller/Steps/Common/Mount.cs b/Questionable/Controller/Steps/Common/Mount.cs index 2fb0d2d70..1e03d8e97 100644 --- a/Questionable/Controller/Steps/Common/Mount.cs +++ b/Questionable/Controller/Steps/Common/Mount.cs @@ -1,7 +1,9 @@ using System; using Dalamud.Game.ClientState.Conditions; +using Dalamud.Game.ClientState.Objects.SubKinds; using Dalamud.Plugin.Services; using FFXIVClientStructs.FFXIV.Client.Game; +using FFXIVClientStructs.FFXIV.Client.Game.Character; using FFXIVClientStructs.FFXIV.Common.Math; using Microsoft.Extensions.Logging; using Questionable.Data; @@ -184,7 +186,17 @@ internal static class Mount : ETaskResult.TaskComplete; } - private unsafe bool IsUnmounting() => **(byte**)(clientState.LocalPlayer!.Address + 1432) == 1; + private unsafe bool IsUnmounting() + { + IPlayerCharacter? localPlayer = clientState.LocalPlayer; + if (localPlayer != null) + { + BattleChara* battleChara = (BattleChara*) localPlayer.Address; + return (battleChara->Mount.Flags & 1) == 1; + } + + return false; + } } public enum EMountIf diff --git a/Questionable/Data/GatheringData.cs b/Questionable/Data/GatheringData.cs index 1d11a1ba3..41a6631b3 100644 --- a/Questionable/Data/GatheringData.cs +++ b/Questionable/Data/GatheringData.cs @@ -36,8 +36,8 @@ internal sealed class GatheringData } _itemIdToCollectability = dataManager.GetSubrowExcelSheet() + .Flatten() .Where(x => x.RowId > 0) - .SelectMany(x => x) .Where(x => x.Slot is 2) .Select(x => new { @@ -50,8 +50,8 @@ internal sealed class GatheringData _npcForCustomDeliveries = dataManager.GetExcelSheet() .Where(x => x.RowId > 0) .SelectMany(x => dataManager.GetSubrowExcelSheet() + .Flatten() .Where(y => y.RowId == x.SatisfactionNpcParams.Last().SupplyIndex) - .SelectMany(y => y) .Select(y => new { ItemId = y.Item.RowId, diff --git a/Questionable/Data/QuestData.cs b/Questionable/Data/QuestData.cs index b055a7d73..0bc96b55d 100644 --- a/Questionable/Data/QuestData.cs +++ b/Questionable/Data/QuestData.cs @@ -6,7 +6,6 @@ using Dalamud.Plugin.Services; using FFXIVClientStructs.FFXIV.Client.Game.UI; using LLib.GameData; using Lumina.Excel.Sheets; -using Questionable.Data.Sheets; using Questionable.Model; using Questionable.Model.Questing; using Quest = Lumina.Excel.Sheets.Quest; @@ -55,7 +54,7 @@ internal sealed class QuestData List quests = [ - ..dataManager.GetExcelSheet() + ..dataManager.GetExcelSheet() .Where(x => x.RowId > 0) .Where(x => x.IssuerLocation.RowId > 0) .Select(x => new QuestInfo(x, questChapters.GetValueOrDefault(x.RowId), diff --git a/Questionable/Data/Sheets/QuestEx.cs b/Questionable/Data/Sheets/QuestEx.cs deleted file mode 100644 index 2dc47b8e3..000000000 --- a/Questionable/Data/Sheets/QuestEx.cs +++ /dev/null @@ -1,46 +0,0 @@ -using Lumina.Excel; -using Lumina.Excel.Sheets; -using Lumina.Text.ReadOnly; - -namespace Questionable.Data.Sheets; - -// TODO Remove once fixed in dalamud -[Sheet("Quest", 0x1F8C7430)] -public readonly unsafe struct QuestEx(ExcelPage page, uint offset, uint row) : IExcelRow -{ - public uint RowId => row; - - public Quest Original { get; } = new(page, offset, row); - - public readonly ReadOnlySeString Id => page.ReadString(offset + 2420, offset); - public RowRef IssuerStart => RowRef.GetFirstValidRowOrUntyped(page.Module, page.ReadUInt32(offset + 2456), [typeof(EObjName), typeof(ENpcResident)], 882056187, page.Language); - public RowRef IssuerLocation => new(page.Module, page.ReadUInt32(offset + 2460), page.Language); - public RowRef JournalGenre => new(page.Module, page.ReadUInt32(offset + 2468), page.Language); - public ushort SortKey => page.ReadUInt16(offset + 2502); - public readonly RowRef Expansion => new(page.Module, (uint)page.ReadUInt8(offset + 2504), page.Language); - public readonly byte PreviousQuestJoin => page.ReadUInt8(offset + 2508); - public readonly RowRef ClassJobCategory0 => new(page.Module, (uint)page.ReadUInt8(offset + 2505), page.Language); - public readonly RowRef ClassJobCategory1 => new(page.Module, (uint)page.ReadUInt8(offset + 2507), page.Language); - public readonly RowRef Festival => new(page.Module, (uint)page.ReadUInt8(offset + 2517), page.Language); - public readonly byte Unknown7 => page.ReadUInt8(offset + 2509); - public readonly byte QuestLockJoin => page.ReadUInt8(offset + 2510); - public readonly RowRef GrandCompany => new(page.Module, (uint)page.ReadUInt8(offset + 2514), page.Language); - public readonly byte InstanceContentJoin => page.ReadUInt8(offset + 2516); - public readonly RowRef BeastTribe => new(page.Module, (uint)page.ReadUInt8(offset + 2520), page.Language); - public bool IsRepeatable => page.ReadPackedBool(offset + 2535, 1); - - public readonly Collection> PreviousQuest => new(page, offset, offset, &PreviousQuestCtor, 3); - private static RowRef PreviousQuestCtor(ExcelPage page, uint parentOffset, uint offset, uint i) => new(page.Module, page.ReadUInt32(offset + 2424 + i * 4), page.Language); - - public readonly Collection> QuestLock => new(page, offset, offset, &QuestLockCtor, 2); - private static RowRef QuestLockCtor(ExcelPage page, uint parentOffset, uint offset, uint i) => new(page.Module, page.ReadUInt32(offset + 2436 + i * 4), page.Language); - - public readonly Collection ClassJobLevel => new(page, offset, offset, &ClassJobLevelCtor, 2); - private static ushort ClassJobLevelCtor(ExcelPage page, uint parentOffset, uint offset, uint i) => page.ReadUInt16(offset + 2484 + i * 2); - - public Collection> InstanceContent => new(page, offset, offset, &InstanceContentCtor, 3); - private static RowRef InstanceContentCtor(ExcelPage page, uint parentOffset, uint offset, uint i) => new(page.Module, page.ReadUInt32(offset + 2444 + i * 4), page.Language); - - static QuestEx IExcelRow.Create(ExcelPage page, uint offset, uint row) => - new(page, offset, row); -} diff --git a/Questionable/Functions/ExcelFunctions.cs b/Questionable/Functions/ExcelFunctions.cs index 3109f942e..48a9d1053 100644 --- a/Questionable/Functions/ExcelFunctions.cs +++ b/Questionable/Functions/ExcelFunctions.cs @@ -3,13 +3,10 @@ using System.Linq; using Dalamud.Plugin.Services; using Dalamud.Utility; using LLib; -using Lumina.Excel; using Lumina.Excel.Exceptions; using Lumina.Excel.Sheets; -using Lumina.Text; using Lumina.Text.ReadOnly; using Microsoft.Extensions.Logging; -using Questionable.Data.Sheets; using Questionable.Model; using Quest = Questionable.Model.Quest; using GimmickYesNo = Lumina.Excel.Sheets.GimmickYesNo; @@ -41,7 +38,7 @@ internal sealed class ExcelFunctions if (currentQuest != null && excelSheetName == null) { var questRow = - _dataManager.GetExcelSheet().GetRowOrDefault((uint)currentQuest.Id.Value + + _dataManager.GetExcelSheet().GetRowOrDefault((uint)currentQuest.Id.Value + 0x10000); if (questRow == null) { diff --git a/Questionable/Model/QuestInfo.cs b/Questionable/Model/QuestInfo.cs index cca298902..bc766b671 100644 --- a/Questionable/Model/QuestInfo.cs +++ b/Questionable/Model/QuestInfo.cs @@ -4,14 +4,14 @@ using System.Collections.Immutable; using System.Linq; using FFXIVClientStructs.FFXIV.Client.UI.Agent; using LLib.GameData; -using Questionable.Data.Sheets; using Questionable.Model.Questing; +using ExcelQuest = Lumina.Excel.Sheets.Quest; namespace Questionable.Model; internal sealed class QuestInfo : IQuestInfo { - public QuestInfo(QuestEx quest, uint newGamePlusChapter, byte startingCity) + public QuestInfo(ExcelQuest quest, uint newGamePlusChapter, byte startingCity) { QuestId = new QuestId((ushort)(quest.RowId & 0xFFFF)); @@ -33,7 +33,7 @@ internal sealed class QuestInfo : IQuestInfo _ => "", }; - Name = $"{quest.Original.Name}{suffix}"; + Name = $"{quest.Name}{suffix}"; Level = quest.ClassJobLevel[0]; IssuerDataId = quest.IssuerStart.RowId; IsRepeatable = quest.IsRepeatable; @@ -55,7 +55,7 @@ internal sealed class QuestInfo : IQuestInfo JournalGenre = quest.JournalGenre.ValueNullable?.RowId; SortKey = quest.SortKey; IsMainScenarioQuest = quest.JournalGenre.ValueNullable?.JournalCategory.ValueNullable?.JournalSection.ValueNullable?.RowId is 0 or 1; - CompletesInstantly = quest.Original.TodoParams[0].ToDoCompleteSeq == 0; + CompletesInstantly = quest.TodoParams[0].ToDoCompleteSeq == 0; PreviousInstanceContent = quest.InstanceContent.Select(x => (ushort)x.RowId).Where(x => x != 0).ToList(); PreviousInstanceContentJoin = (EQuestJoin)quest.InstanceContentJoin; GrandCompany = (GrandCompany)quest.GrandCompany.RowId;