Misc 7.1 fixes
authorLiza Carvelli <liza@carvel.li>
Sun, 17 Nov 2024 18:52:04 +0000 (19:52 +0100)
committerLiza Carvelli <liza@carvel.li>
Sun, 17 Nov 2024 18:52:04 +0000 (19:52 +0100)
Questionable/Controller/CombatModules/ItemUseModule.cs
Questionable/Controller/Steps/Common/Mount.cs
Questionable/Data/GatheringData.cs
Questionable/Data/QuestData.cs
Questionable/Data/Sheets/QuestEx.cs [deleted file]
Questionable/Functions/ExcelFunctions.cs
Questionable/Model/QuestInfo.cs

index ec9adfa129f0da8cf3b8d5313c199599dd45b789..b5b6fd289b3721f5775489c789a5f21f3072177b 100644 (file)
@@ -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;
index 2fb0d2d701190a6e2b9f73c40140468bf51d893b..1e03d8e9708ec6700cfad37fed358f9b97bbf104 100644 (file)
@@ -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
index 1d11a1ba33cd79d3b658c65c5c85ba7eaaa67fe1..41a6631b31e7303569074cebf68cbee60bcf4ffc 100644 (file)
@@ -36,8 +36,8 @@ internal sealed class GatheringData
         }
 
         _itemIdToCollectability = dataManager.GetSubrowExcelSheet<SatisfactionSupply>()
+            .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<SatisfactionNpc>()
             .Where(x => x.RowId > 0)
             .SelectMany(x => dataManager.GetSubrowExcelSheet<SatisfactionSupply>()
+                .Flatten()
                 .Where(y => y.RowId == x.SatisfactionNpcParams.Last().SupplyIndex)
-                .SelectMany(y => y)
                 .Select(y => new
                 {
                     ItemId = y.Item.RowId,
index b055a7d733ada5fd90d0d393155480bac8061416..0bc96b55d3e58b9e39cb4b16b538e2dd902b6045 100644 (file)
@@ -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<IQuestInfo> quests =
         [
-            ..dataManager.GetExcelSheet<QuestEx>()
+            ..dataManager.GetExcelSheet<Quest>()
                 .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 (file)
index 2dc47b8..0000000
+++ /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<QuestEx>
-{
-    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<Level> IssuerLocation => new(page.Module, page.ReadUInt32(offset + 2460), page.Language);
-    public RowRef<JournalGenre> JournalGenre => new(page.Module, page.ReadUInt32(offset + 2468), page.Language);
-    public ushort SortKey => page.ReadUInt16(offset + 2502);
-    public readonly RowRef<ExVersion> Expansion => new(page.Module, (uint)page.ReadUInt8(offset + 2504), page.Language);
-    public readonly byte PreviousQuestJoin => page.ReadUInt8(offset + 2508);
-    public readonly RowRef<ClassJobCategory> ClassJobCategory0 => new(page.Module, (uint)page.ReadUInt8(offset + 2505), page.Language);
-    public readonly RowRef<ClassJobCategory> ClassJobCategory1 => new(page.Module, (uint)page.ReadUInt8(offset + 2507), page.Language);
-    public readonly RowRef<Festival> 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> GrandCompany => new(page.Module, (uint)page.ReadUInt8(offset + 2514), page.Language);
-    public readonly byte InstanceContentJoin => page.ReadUInt8(offset + 2516);
-    public readonly RowRef<BeastTribe> BeastTribe => new(page.Module, (uint)page.ReadUInt8(offset + 2520), page.Language);
-    public bool IsRepeatable => page.ReadPackedBool(offset + 2535, 1);
-
-    public readonly Collection<RowRef<Quest>> PreviousQuest => new(page, offset, offset, &PreviousQuestCtor, 3);
-    private static RowRef<Quest> PreviousQuestCtor(ExcelPage page, uint parentOffset, uint offset, uint i) => new(page.Module, page.ReadUInt32(offset + 2424 + i * 4), page.Language);
-
-    public readonly Collection<RowRef<Quest>> QuestLock => new(page, offset, offset, &QuestLockCtor, 2);
-    private static RowRef<Quest> QuestLockCtor(ExcelPage page, uint parentOffset, uint offset, uint i) => new(page.Module, page.ReadUInt32(offset + 2436 + i * 4), page.Language);
-
-    public readonly Collection<ushort> 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<RowRef<InstanceContent>> InstanceContent => new(page, offset, offset, &InstanceContentCtor, 3);
-    private static RowRef<InstanceContent> InstanceContentCtor(ExcelPage page, uint parentOffset, uint offset, uint i) => new(page.Module, page.ReadUInt32(offset + 2444 + i * 4), page.Language);
-
-    static QuestEx IExcelRow<QuestEx>.Create(ExcelPage page, uint offset, uint row) =>
-        new(page, offset, row);
-}
index 3109f942e16e1f9c3bb5ff9f6e4e3337696781ec..48a9d10536590c4e3b1bf668937dd8feef23f0b6 100644 (file)
@@ -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<QuestEx>().GetRowOrDefault((uint)currentQuest.Id.Value +
+                _dataManager.GetExcelSheet<Lumina.Excel.Sheets.Quest>().GetRowOrDefault((uint)currentQuest.Id.Value +
                     0x10000);
             if (questRow == null)
             {
index cca298902644335340654bcd30adf2caf9fab19c..bc766b6710747fae69d60b2b03b78471cd8f9482 100644 (file)
@@ -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;