1
0
forked from liza/Questionable

Version bump, remove redundant nullability checks, minor cleanup

This commit is contained in:
Liza 2024-11-18 20:56:13 +01:00
parent 3ab1069ab7
commit 28795e68e4
Signed by: liza
GPG Key ID: 7199F8D727D55F67
9 changed files with 16 additions and 19 deletions

View File

@ -1,5 +1,5 @@
<Project>
<PropertyGroup>
<Version>4.1</Version>
<Version>4.2</Version>
</PropertyGroup>
</Project>

2
LLib

@ -1 +1 @@
Subproject commit 70b0bef2459898a70f7b34b4d196bbaeb72397b1
Subproject commit e4bbc05ede6f6f01e7028b24614ed8cb333e909c

View File

@ -756,12 +756,12 @@ internal sealed class InteractionUiController : IDisposable
private bool TryFindWarp(ushort targetTerritoryId, string actualPrompt, [NotNullWhen(true)] out uint? warpId,
[NotNullWhen(true)] out string? warpText)
{
var warps = _dataManager.GetExcelSheet<Warp>()!
var warps = _dataManager.GetExcelSheet<Warp>()
.Where(x => x.RowId > 0 && x.TerritoryType.RowId == targetTerritoryId);
foreach (var entry in warps)
{
string? excelName = entry.Name.ToString();
string? excelQuestion = entry.Question.ToString();
string excelName = entry.Name.ToString();
string excelQuestion = entry.Question.ToString();
if (!string.IsNullOrEmpty(excelQuestion) && GameFunctions.GameStringEquals(excelQuestion, actualPrompt))
{

View File

@ -11,7 +11,7 @@ internal sealed class AetherCurrentData
public AetherCurrentData(IDataManager dataManager)
{
_overworldCurrents = dataManager.GetExcelSheet<AetherCurrentCompFlgSet>()!
_overworldCurrents = dataManager.GetExcelSheet<AetherCurrentCompFlgSet>()
.Where(x => x.RowId > 0)
.Where(x => x.Territory.IsValid)
.ToImmutableDictionary(

View File

@ -40,7 +40,7 @@ internal sealed class QuestData
public QuestData(IDataManager dataManager)
{
Dictionary<uint, uint> questChapters =
dataManager.GetExcelSheet<QuestChapter>()!
dataManager.GetExcelSheet<QuestChapter>()
.Where(x => x.RowId > 0 && x.Quest.RowId > 0)
.ToDictionary(x => x.Quest.RowId, x => x.Redo.RowId);

View File

@ -46,7 +46,7 @@ internal sealed unsafe class ChatFunctions
.Where(x => x.TextCommand.IsValid)
.Select(x => (x.RowId, Command: x.TextCommand.Value.Command.ToString()))
.Where(x => !string.IsNullOrEmpty(x.Command) && x.Command.StartsWith('/'))
.ToDictionary(x => (EEmote)x.RowId, x => x.Command!)
.ToDictionary(x => (EEmote)x.RowId, x => x.Command)
.AsReadOnly();
}

View File

@ -129,9 +129,6 @@ internal sealed unsafe class QuestFunctions
var trackedQuest = questManager->TrackedQuests[i];
switch (trackedQuest.QuestType)
{
default:
break;
case 1: // normal quest
currentQuest = new QuestId(questManager->NormalQuests[trackedQuest.Index].QuestId);
if (_questRegistry.IsKnownQuest(currentQuest))
@ -629,7 +626,7 @@ internal sealed unsafe class QuestFunctions
public bool IsClassJobUnlocked(EClassJob classJob)
{
var classJobRow = _dataManager.GetExcelSheet<ClassJob>()!.GetRow((uint)classJob)!;
var classJobRow = _dataManager.GetExcelSheet<ClassJob>().GetRow((uint)classJob);
var questId = (ushort)classJobRow.UnlockQuest.RowId;
if (questId != 0)
return IsQuestComplete(new QuestId(questId));
@ -640,7 +637,7 @@ internal sealed unsafe class QuestFunctions
public bool IsJobUnlocked(EClassJob classJob)
{
var classJobRow = _dataManager.GetExcelSheet<ClassJob>()!.GetRow((uint)classJob)!;
var classJobRow = _dataManager.GetExcelSheet<ClassJob>().GetRow((uint)classJob);
return IsClassJobUnlocked((EClassJob)classJobRow.ClassJobParent.RowId);
}

View File

@ -15,7 +15,7 @@ internal sealed class SatisfactionSupplyInfo : IQuestInfo
IssuerDataId = npc.Npc.RowId;
Level = npc.LevelUnlock;
SortKey = QuestId.Value;
Expansion = (EExpansionVersion)npc.QuestRequired.Value!.Expansion.RowId;
Expansion = (EExpansionVersion)npc.QuestRequired.Value.Expansion.RowId;
PreviousQuests = [new PreviousQuestInfo(new QuestId((ushort)(npc.QuestRequired.RowId & 0xFFFF)))];
}

View File

@ -108,9 +108,9 @@ internal sealed class GatheringJournalComponent
.GroupBy(x => x.GatheringPointId)
.ToDictionary(x => x.Key, x => x.First());
var itemSheet = dataManager.GetExcelSheet<Item>()!;
var itemSheet = dataManager.GetExcelSheet<Item>();
_gatheringItems = dataManager.GetExcelSheet<GatheringItem>()!
_gatheringItems = dataManager.GetExcelSheet<GatheringItem>()
.Where(x => x.RowId != 0 && x.GatheringItemLevel.RowId != 0)
.Select(x => new
{
@ -120,7 +120,7 @@ internal sealed class GatheringJournalComponent
.Where(x => !string.IsNullOrEmpty(x.Name))
.ToDictionary(x => x.GatheringItemId, x => x.Name!);
_gatheringPointsByExpansion = dataManager.GetExcelSheet<GatheringPoint>()!
_gatheringPointsByExpansion = dataManager.GetExcelSheet<GatheringPoint>()
.Where(x => x.GatheringPointBase.RowId != 0)
.Where(x => x.GatheringPointBase.RowId is < 653 or > 680) // exclude ishgard restoration phase 1
.DistinctBy(x => x.GatheringPointBase.RowId)
@ -128,7 +128,7 @@ internal sealed class GatheringJournalComponent
{
GatheringPointId = x.RowId,
Point = new DefaultGatheringPoint(new GatheringPointId((ushort)x.GatheringPointBase.RowId),
x.GatheringPointBase.Value!.GatheringType.RowId switch
x.GatheringPointBase.Value.GatheringType.RowId switch
{
0 or 1 => EClassJob.Miner,
2 or 3 => EClassJob.Botanist,
@ -159,7 +159,7 @@ internal sealed class GatheringJournalComponent
_gatheringPointRegistry.TryGetGatheringPoint(x.Point.Id, out GatheringRoot? gatheringRoot))
{
// for some reason the game doesn't know where this gathering location is
var territoryType = territoryTypeSheet.GetRow(gatheringRoot.Steps.Last().TerritoryId)!;
var territoryType = territoryTypeSheet.GetRow(gatheringRoot.Steps.Last().TerritoryId);
return x.Point with
{
Expansion = (EExpansionVersion)territoryType.ExVersion.RowId,