mirror of
https://github.com/Ottermandias/Glamourer.git
synced 2025-12-13 12:14:18 +01:00
Update API 9 and add data to items.
This commit is contained in:
parent
c98ed04bf3
commit
cb0da11529
62 changed files with 524 additions and 268 deletions
|
|
@ -9,8 +9,9 @@ namespace Glamourer;
|
|||
|
||||
public static class GameData
|
||||
{
|
||||
private static Dictionary<byte, Job>? _jobs;
|
||||
private static Dictionary<ushort, JobGroup>? _jobGroups;
|
||||
private static Dictionary<byte, Job>? _jobs;
|
||||
private static Dictionary<ushort, JobGroup>? _jobGroups;
|
||||
private static JobGroup[]? _allJobGroups;
|
||||
|
||||
public static IReadOnlyDictionary<byte, Job> Jobs(IDataManager dataManager)
|
||||
{
|
||||
|
|
@ -22,14 +23,22 @@ public static class GameData
|
|||
return _jobs;
|
||||
}
|
||||
|
||||
public static IReadOnlyList<JobGroup> AllJobGroups(IDataManager dataManager)
|
||||
{
|
||||
if (_allJobGroups != null)
|
||||
return _allJobGroups;
|
||||
|
||||
var sheet = dataManager.GetExcelSheet<ClassJobCategory>()!;
|
||||
var jobs = dataManager.GetExcelSheet<ClassJob>(ClientLanguage.English)!;
|
||||
_allJobGroups = sheet.Select(j => new JobGroup(j, jobs)).ToArray();
|
||||
return _allJobGroups;
|
||||
}
|
||||
|
||||
public static IReadOnlyDictionary<ushort, JobGroup> JobGroups(IDataManager dataManager)
|
||||
{
|
||||
if (_jobGroups != null)
|
||||
return _jobGroups;
|
||||
|
||||
var sheet = dataManager.GetExcelSheet<ClassJobCategory>()!;
|
||||
var jobs = dataManager.GetExcelSheet<ClassJob>(ClientLanguage.English)!;
|
||||
|
||||
static bool ValidIndex(uint idx)
|
||||
{
|
||||
if (idx is > 0 and < 36)
|
||||
|
|
@ -68,12 +77,12 @@ public static class GameData
|
|||
69 => true,
|
||||
68 => true,
|
||||
93 => true,
|
||||
_ => false,
|
||||
_ => false,
|
||||
};
|
||||
}
|
||||
|
||||
_jobGroups = sheet.Where(j => ValidIndex(j.RowId))
|
||||
.ToDictionary(j => (ushort)j.RowId, j => new JobGroup(j, jobs));
|
||||
_jobGroups = AllJobGroups(dataManager).Where(j => ValidIndex(j.Id))
|
||||
.ToDictionary(j => (ushort) j.Id, j => j);
|
||||
return _jobGroups;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue