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

@ -192,28 +192,6 @@ internal sealed class AlliedSocietyData
case 5287:
case 5288:
return EAlliedSociety.MamoolJa;
case 5343:
case 5344:
case 5345:
case 5346:
case 5347:
case 5348:
case 5349:
case 5350:
case 5351:
case 5352:
case 5353:
case 5354:
case 5355:
case 5356:
case 5357:
case 5358:
case 5359:
case 5360:
case 5361:
case 5362:
case 5363:
return EAlliedSociety.YokHuy;
default:
return EAlliedSociety.None;
}

View file

@ -1,7 +1,9 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Dalamud.Plugin.Services;
using Lumina.Excel.Sheets;
using Microsoft.Extensions.Logging;
using Questionable.Model;
using Questionable.Model.Questing;
@ -19,12 +21,15 @@ internal sealed class JournalData
public List<IQuestInfo> Quests { get; }
public bool IsUnderOtherQuests { get; set; }
public Genre(JournalGenre journalGenre, List<IQuestInfo> quests)
{
Id = journalGenre.RowId;
Name = journalGenre.Name.ToString();
CategoryId = journalGenre.JournalCategory.RowId;
Quests = quests;
IsUnderOtherQuests = false;
}
public Genre(uint id, string name, uint categoryId, List<IQuestInfo> quests)
@ -33,6 +38,16 @@ internal sealed class JournalData
Name = name;
CategoryId = categoryId;
Quests = quests;
IsUnderOtherQuests = false;
}
public Genre(uint id, string name, uint categoryId, List<IQuestInfo> quests, bool isUnderOtherQuests = false)
{
Id = id;
Name = name;
CategoryId = categoryId;
Quests = quests;
IsUnderOtherQuests = isUnderOtherQuests;
}
}
@ -68,15 +83,20 @@ internal sealed class JournalData
}
}
private readonly ILogger<JournalData> _logger;
public List<Genre> Genres { get; }
public List<Category> Categories { get; }
public List<Section> Sections { get; }
public JournalData(IDataManager dataManager, QuestData questData)
public int? OtherQuestsSectionRowId { get; private set; }
public JournalData(IDataManager dataManager, QuestData questData, ILogger<JournalData> logger)
{
JournalData journalData = this;
_logger = logger;
List<Genre> list = (from x in dataManager.GetExcelSheet<JournalGenre>()
where x.RowId != 0 && x.Icon > 0
select new Genre(x, questData.GetAllByJournalGenre(x.RowId))).ToList();
@ -92,7 +112,7 @@ internal sealed class JournalData
Genre genreUldah = new Genre(4294967294u, "Starting in Ul'dah", 1u, (from x in new uint[3] { 568u, 569u, 570u }.Concat(row3.QuestRedoParam.Select((QuestRedo.QuestRedoParamStruct x) => x.Quest.RowId))
where x != 0
select questData.GetQuestInfo(QuestId.FromRowId(x))).ToList());
list.InsertRange(0, new global::_003C_003Ez__ReadOnlyArray<Genre>(new Genre[3] { genreLimsa, genreGridania, genreUldah }));
list.InsertRange(0, new Genre[3] { genreLimsa, genreGridania, genreUldah });
list.Single((Genre x) => x.Id == 1).Quests.RemoveAll((IQuestInfo x) => genreLimsa.Quests.Contains(x) || genreGridania.Quests.Contains(x) || genreUldah.Quests.Contains(x));
Genres = list.ToList();
Categories = (from x in dataManager.GetExcelSheet<JournalCategory>()
@ -100,5 +120,51 @@ internal sealed class JournalData
select new Category(x, journalData.Genres.Where((Genre y) => y.CategoryId == x.RowId).ToList())).ToList();
Sections = (from x in dataManager.GetExcelSheet<JournalSection>()
select new Section(x, journalData.Categories.Where((Category y) => y.SectionId == x.RowId).ToList())).ToList();
_logger.LogDebug("Resolving OtherQuests section id...");
OtherQuestsSectionRowId = GetOtherQuestsSectionRowId(dataManager);
_logger.LogDebug("Resolved OtherQuestsSectionRowId = {Id}", OtherQuestsSectionRowId);
int? otherQuestsSectionRowId = OtherQuestsSectionRowId;
if (otherQuestsSectionRowId.HasValue)
{
int valueOrDefault = otherQuestsSectionRowId.GetValueOrDefault();
uint otherIdU = (uint)valueOrDefault;
Section section = Sections.FirstOrDefault((Section s) => s.Id == otherIdU);
if (section != null)
{
int num = 0;
foreach (Category category in section.Categories)
{
foreach (Genre genre in category.Genres)
{
genre.IsUnderOtherQuests = true;
num++;
}
}
_logger.LogInformation("Marked {Count} genres as under 'Other Quests' (section id {Id})", num, valueOrDefault);
}
else
{
_logger.LogWarning("OtherQuestsSectionRowId {Id} found but matching Section not present in constructed Sections", valueOrDefault);
}
}
else
{
_logger.LogDebug("OtherQuestsSectionRowId not found - falling back to localized name lookup when necessary");
}
}
private int? GetOtherQuestsSectionRowId(IDataManager dataManager)
{
JournalSection journalSection = dataManager.GetExcelSheet<JournalSection>().FirstOrDefault((JournalSection s) => s.Name.ToString() == "Other Quests");
int? result = ((journalSection.RowId != 0) ? new int?((int)journalSection.RowId) : ((int?)null));
if (!result.HasValue)
{
Section section = Sections.FirstOrDefault((Section s) => s.Name.Equals("Other Quests", StringComparison.OrdinalIgnoreCase));
if (section != null)
{
result = (int)section.Id;
}
}
return result;
}
}

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>>();