muffin v6.12

This commit is contained in:
alydev 2025-10-09 07:53:51 +10:00
parent cfb4dea47e
commit c8197297b2
58 changed files with 40038 additions and 58059 deletions

View file

@ -8,8 +8,10 @@ using Dalamud.Plugin.Services;
using FFXIVClientStructs.FFXIV.Client.Game.UI;
using LLib.GameData;
using Lumina.Excel.Sheets;
using Microsoft.Extensions.Logging;
using Questionable.Model;
using Questionable.Model.Questing;
using Questionable.Windows.QuestComponents;
namespace Questionable.Data;
@ -52,6 +54,8 @@ internal sealed class QuestData
private readonly Dictionary<ElementId, IQuestInfo> _quests;
private readonly ILogger<QuestData> _logger;
public static ImmutableHashSet<QuestId> AetherCurrentQuests { get; }
public IReadOnlyList<QuestInfo> MainScenarioQuests { get; }
@ -60,9 +64,10 @@ internal sealed class QuestData
public QuestId LastMainScenarioQuestId { get; }
public QuestData(IDataManager dataManager, ClassJobUtils classJobUtils)
public QuestData(IDataManager dataManager, ClassJobUtils classJobUtils, ILogger<QuestData> logger)
{
QuestData questData = this;
_logger = logger ?? throw new ArgumentNullException("logger");
JournalGenreOverrides journalGenreOverrides = new JournalGenreOverrides
{
ARelicRebornQuests = dataManager.GetExcelSheet<Lumina.Excel.Sheets.Quest>().GetRow(65742u).JournalGenre.RowId,
@ -93,18 +98,59 @@ internal sealed class QuestData
where x.RowId != 0 && !x.Name.IsEmpty
select x).SelectMany(delegate(BeastTribe x)
{
if (!Enum.IsDefined(typeof(EAlliedSociety), (byte)x.RowId))
{
questData._logger.LogWarning("Skipping unknown BeastTribe with RowId {RowId} (Name: {Name})", x.RowId, x.Name.ToString());
return Enumerable.Empty<AlliedSocietyDailyInfo>();
}
if (x.RowId < 5)
{
List<byte> list2 = new List<byte>();
list2.Add(0);
list2.AddRange((from QuestInfo y in quests.Where((IQuestInfo y) => (uint)y.AlliedSociety == (byte)x.RowId && y.IsRepeatable)
List<byte> list3 = new List<byte>();
list3.Add(0);
list3.AddRange((from QuestInfo y in quests.Where((IQuestInfo y) => (uint)y.AlliedSociety == (byte)x.RowId && y.IsRepeatable)
select (byte)y.AlliedSocietyRank).Distinct());
return new _003C_003Ez__ReadOnlyList<byte>(list2).Select((byte rank) => new AlliedSocietyDailyInfo(x, rank, classJobUtils));
return new _003C_003Ez__ReadOnlyList<byte>(list3).Select((byte rank) => new AlliedSocietyDailyInfo(x, rank, classJobUtils));
}
return new global::_003C_003Ez__ReadOnlySingleElementList<AlliedSocietyDailyInfo>(new AlliedSocietyDailyInfo(x, 0, classJobUtils));
}));
quests.Add(new UnlockLinkQuestInfo(new UnlockLinkId(506), "Patch 7.2 Fantasia", 1052475u));
quests.Add(new UnlockLinkQuestInfo(new UnlockLinkId(568), "Patch 7.3 Fantasia", 1052475u));
int num = 15;
List<AethernetQuestInfo> list2 = new List<AethernetQuestInfo>(num);
CollectionsMarshal.SetCount(list2, num);
Span<AethernetQuestInfo> span = CollectionsMarshal.AsSpan(list2);
int num2 = 0;
span[num2] = new AethernetQuestInfo(new AethernetId(1), "Limsa Lominsa");
num2++;
span[num2] = new AethernetQuestInfo(new AethernetId(2), "Gridania");
num2++;
span[num2] = new AethernetQuestInfo(new AethernetId(3), "Ul'dah");
num2++;
span[num2] = new AethernetQuestInfo(new AethernetId(4), "The Gold Saucer");
num2++;
span[num2] = new AethernetQuestInfo(new AethernetId(5), "Ishgard");
num2++;
span[num2] = new AethernetQuestInfo(new AethernetId(6), "Idyllshire");
num2++;
span[num2] = new AethernetQuestInfo(new AethernetId(7), "Rhalgr's Reach");
num2++;
span[num2] = new AethernetQuestInfo(new AethernetId(8), "Kugane");
num2++;
span[num2] = new AethernetQuestInfo(new AethernetId(9), "Doman Enclave");
num2++;
span[num2] = new AethernetQuestInfo(new AethernetId(10), "The Crystarium");
num2++;
span[num2] = new AethernetQuestInfo(new AethernetId(11), "Eulmore");
num2++;
span[num2] = new AethernetQuestInfo(new AethernetId(12), "Old Sharlayan");
num2++;
span[num2] = new AethernetQuestInfo(new AethernetId(13), "Radz-at-Han");
num2++;
span[num2] = new AethernetQuestInfo(new AethernetId(14), "Tuliyollal");
num2++;
span[num2] = new AethernetQuestInfo(new AethernetId(15), "Solution Nine");
List<AethernetQuestInfo> collection = list2;
List<AetherCurrentQuestInfo> collection2 = new List<AetherCurrentQuestInfo>();
quests.AddRange(collection);
quests.AddRange(collection2);
_quests = quests.ToDictionary((IQuestInfo x) => x.QuestId, (IQuestInfo x) => x);
AddPreviousQuest(new QuestId(425), new QuestId(495));
AddPreviousQuest(new QuestId(1480), new QuestId(2373));
@ -265,7 +311,6 @@ internal sealed class QuestData
public List<IQuestInfo> GetAllByJournalGenre(uint journalGenre)
{
return (from x in _quests.Values
where !(x is QuestInfo { IsSeasonalEvent: not false })
where x.JournalGenre == journalGenre
orderby x.SortKey, x.QuestId
select x).ToList();
@ -1158,6 +1203,32 @@ internal sealed class QuestData
select new QuestId(x)).ToList();
}
public void ApplySeasonalOverride(ElementId questId, bool isSeasonal, DateTime? expiry)
{
if (_quests.TryGetValue(questId, out IQuestInfo value) && value is QuestInfo questInfo)
{
DateTime? seasonalQuestExpiry = null;
if (expiry.HasValue)
{
DateTime value2 = expiry.Value;
seasonalQuestExpiry = ((!(value2.TimeOfDay == TimeSpan.Zero)) ? new DateTime?((value2.Kind == DateTimeKind.Utc) ? value2 : value2.ToUniversalTime()) : new DateTime?(EventInfoComponent.AtDailyReset(DateOnly.FromDateTime(value2))));
}
questInfo.IsSeasonalQuest = isSeasonal;
questInfo.SeasonalQuestExpiry = seasonalQuestExpiry;
}
else
{
_logger.LogWarning("ApplySeasonalOverride: Quest {QuestId} not found in QuestData (could not apply seasonal override)", questId);
}
}
public void AddOrReplaceQuestInfo(IQuestInfo info)
{
ArgumentNullException.ThrowIfNull(info, "info");
_quests[info.QuestId] = info;
_logger.LogDebug("Added or replaced QuestInfo for {QuestId} in QuestData", info.QuestId);
}
static QuestData()
{
Dictionary<uint, List<ushort>> dictionary = new Dictionary<uint, List<ushort>>();