104 lines
3.7 KiB
C#
104 lines
3.7 KiB
C#
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using Dalamud.Plugin.Services;
|
|
using Lumina.Excel.Sheets;
|
|
using Questionable.Model;
|
|
using Questionable.Model.Questing;
|
|
|
|
namespace Questionable.Data;
|
|
|
|
internal sealed class JournalData
|
|
{
|
|
internal sealed class Genre
|
|
{
|
|
public uint Id { get; }
|
|
|
|
public string Name { get; }
|
|
|
|
public uint CategoryId { get; }
|
|
|
|
public List<IQuestInfo> Quests { get; }
|
|
|
|
public Genre(JournalGenre journalGenre, List<IQuestInfo> quests)
|
|
{
|
|
Id = journalGenre.RowId;
|
|
Name = journalGenre.Name.ToString();
|
|
CategoryId = journalGenre.JournalCategory.RowId;
|
|
Quests = quests;
|
|
}
|
|
|
|
public Genre(uint id, string name, uint categoryId, List<IQuestInfo> quests)
|
|
{
|
|
Id = id;
|
|
Name = name;
|
|
CategoryId = categoryId;
|
|
Quests = quests;
|
|
}
|
|
}
|
|
|
|
internal sealed class Category
|
|
{
|
|
public uint Id { get; } = journalCategory.RowId;
|
|
|
|
public string Name { get; } = journalCategory.Name.ToString();
|
|
|
|
public uint SectionId { get; } = journalCategory.JournalSection.RowId;
|
|
|
|
public IReadOnlyList<Genre> Genres { get; }
|
|
|
|
public Category(JournalCategory journalCategory, IReadOnlyList<Genre> genres)
|
|
{
|
|
Genres = genres;
|
|
base._002Ector();
|
|
}
|
|
}
|
|
|
|
internal sealed class Section
|
|
{
|
|
public uint Id { get; } = journalSection.RowId;
|
|
|
|
public string Name { get; } = journalSection.Name.ToString();
|
|
|
|
public IReadOnlyList<Category> Categories { get; }
|
|
|
|
public Section(JournalSection journalSection, IReadOnlyList<Category> categories)
|
|
{
|
|
Categories = categories;
|
|
base._002Ector();
|
|
}
|
|
}
|
|
|
|
public List<Genre> Genres { get; }
|
|
|
|
public List<Category> Categories { get; }
|
|
|
|
public List<Section> Sections { get; }
|
|
|
|
public JournalData(IDataManager dataManager, QuestData questData)
|
|
{
|
|
JournalData journalData = this;
|
|
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();
|
|
QuestRedo row = dataManager.GetExcelSheet<QuestRedo>().GetRow(1u);
|
|
QuestRedo row2 = dataManager.GetExcelSheet<QuestRedo>().GetRow(2u);
|
|
QuestRedo row3 = dataManager.GetExcelSheet<QuestRedo>().GetRow(3u);
|
|
Genre genreLimsa = new Genre(4294967292u, "Starting in Limsa Lominsa", 1u, (from x in new uint[2] { 108u, 109u }.Concat(row.QuestRedoParam.Select((QuestRedo.QuestRedoParamStruct x) => x.Quest.RowId))
|
|
where x != 0
|
|
select questData.GetQuestInfo(QuestId.FromRowId(x))).ToList());
|
|
Genre genreGridania = new Genre(4294967293u, "Starting in Gridania", 1u, (from x in new uint[3] { 85u, 123u, 124u }.Concat(row2.QuestRedoParam.Select((QuestRedo.QuestRedoParamStruct x) => x.Quest.RowId))
|
|
where x != 0
|
|
select questData.GetQuestInfo(QuestId.FromRowId(x))).ToList());
|
|
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.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>()
|
|
where x.RowId != 0
|
|
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();
|
|
}
|
|
}
|