mirror of
https://github.com/Ottermandias/Glamourer.git
synced 2025-12-12 18:27:24 +01:00
Some cleanup, use OtterGui.
This commit is contained in:
parent
a36d1f1935
commit
0fc8992271
40 changed files with 2686 additions and 2792 deletions
48
Glamourer.GameData/Structs/JobGroup.cs
Normal file
48
Glamourer.GameData/Structs/JobGroup.cs
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using Lumina.Excel;
|
||||
using Lumina.Excel.GeneratedSheets;
|
||||
|
||||
namespace Glamourer.Structs;
|
||||
|
||||
public readonly struct JobGroup
|
||||
{
|
||||
public readonly string Name;
|
||||
private readonly ulong _flags;
|
||||
public readonly int Count;
|
||||
public readonly uint Id;
|
||||
|
||||
public JobGroup(ClassJobCategory group, ExcelSheet<ClassJob> jobs)
|
||||
{
|
||||
Count = 0;
|
||||
_flags = 0ul;
|
||||
Id = group.RowId;
|
||||
Name = group.Name.ToString();
|
||||
|
||||
Debug.Assert(jobs.RowCount < 64);
|
||||
foreach (var job in jobs)
|
||||
{
|
||||
var abbr = job.Abbreviation.ToString();
|
||||
if (!abbr.Any())
|
||||
continue;
|
||||
|
||||
var prop = group.GetType().GetProperty(abbr);
|
||||
Debug.Assert(prop != null);
|
||||
|
||||
if (!(bool)prop.GetValue(group)!)
|
||||
continue;
|
||||
|
||||
++Count;
|
||||
_flags |= 1ul << (int)job.RowId;
|
||||
}
|
||||
}
|
||||
|
||||
public bool Fits(Job job)
|
||||
=> Fits(job.Id);
|
||||
|
||||
public bool Fits(uint jobId)
|
||||
{
|
||||
var flag = 1ul << (int)jobId;
|
||||
return (flag & _flags) != 0;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue