Misc 7.1 fixes

This commit is contained in:
Liza 2024-11-17 19:52:04 +01:00
parent 313179e154
commit 54baec68bf
Signed by: liza
GPG Key ID: 7199F8D727D55F67
7 changed files with 23 additions and 60 deletions

View 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;

View 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

View 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,

View 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),

View File

@ -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);
}

View 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)
{

View 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;