using System.Collections.Generic;
+using System.Diagnostics.CodeAnalysis;
using Questionable.Model.V1;
namespace Questionable.QuestPaths;
+[SuppressMessage("ReSharper", "PartialTypeWithSinglePart", Justification = "Required for RELEASE")]
public static partial class AssemblyQuestLoader
{
public static IReadOnlyDictionary<ushort, QuestRoot> GetQuests() =>
{
public override ExcelRef? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
- if (reader.TokenType == JsonTokenType.String)
- return new ExcelRef(reader.GetString()!);
- else if (reader.TokenType == JsonTokenType.Number)
- return new ExcelRef(reader.GetUInt32());
- else
- return null;
+ return reader.TokenType switch
+ {
+ JsonTokenType.String => ExcelRef.FromKey(reader.GetString()!),
+ JsonTokenType.Number => ExcelRef.FromRowId(reader.GetUInt32()),
+ _ => null
+ };
}
public override void Write(Utf8JsonWriter writer, ExcelRef? value, JsonSerializerOptions options)
Type = EType.RowId;
}
- /// <summary>
- /// Only used internally (not serialized) with specific values that have been read from the sheets already.
- /// </summary>
- private ExcelRef(string value, bool v)
+ private ExcelRef(string? stringValue, uint? rowIdValue, EType type)
{
- if (!v)
- throw new ArgumentException(nameof(v));
-
- _stringValue = value;
- _rowIdValue = null;
- Type = EType.RawString;
+ _stringValue = stringValue;
+ _rowIdValue = rowIdValue;
+ Type = type;
}
- public static ExcelRef FromSheetValue(string value) => new(value, true);
+ public static ExcelRef FromKey(string value) => new(value, null, EType.Key);
+ public static ExcelRef FromRowId(uint rowId) => new(null, rowId, EType.RowId);
+ public static ExcelRef FromSheetValue(string value) => new(value, null, EType.RawString);
public EType Type { get; }
using System.Collections.Generic;
using System.Collections.ObjectModel;
+using System.Diagnostics.CodeAnalysis;
using System.Linq;
using Dalamud.Game.ClientState.Conditions;
using Dalamud.Game.ClientState.Objects;
return _condition[ConditionFlag.InCombat];
}
+ [SuppressMessage("ReSharper", "RedundantJumpStatement")]
private IGameObject? FindNextTarget()
{
if (_currentFight == null)
SelectIconStringPostSetup(addonSelectIconString, false);
}
+ [SuppressMessage("ReSharper", "RedundantJumpStatement")]
private unsafe void SelectIconStringPostSetup(AddonSelectIconString* addonSelectIconString, bool checkAllSteps)
{
string? actualPrompt = addonSelectIconString->AtkUnitBase.AtkValues[3].ReadAtkString();
{
var qInfo = _questData.GetQuestInfo(q);
var (iconColor, icon, _) = GetQuestStyle(q);
+ // ReSharper disable once UnusedVariable
using (var font = _pluginInterface.UiBuilder.IconFontFixedWidthHandle.Push())
{
if (_questRegistry.IsKnownQuest(qInfo.QuestId))
{
var qInfo = _questData.GetQuestInfo(q);
var (iconColor, icon, _) = GetQuestStyle(q);
+ // ReSharper disable once UnusedVariable
using (var font = _pluginInterface.UiBuilder.IconFontFixedWidthHandle.Push())
{
if (_questRegistry.IsKnownQuest(qInfo.QuestId))