ye
This commit is contained in:
parent
a6709df643
commit
a0e9e892bc
|
@ -12,6 +12,7 @@ internal class Settings : ITab {
|
||||||
private Plugin Plugin { get; }
|
private Plugin Plugin { get; }
|
||||||
private int _tab;
|
private int _tab;
|
||||||
private string _extraCode = string.Empty;
|
private string _extraCode = string.Empty;
|
||||||
|
private List<(uint, string)> Territories { get; }
|
||||||
|
|
||||||
private delegate void DrawSettingsDelegate(ref bool anyChanged, ref bool vfx);
|
private delegate void DrawSettingsDelegate(ref bool anyChanged, ref bool vfx);
|
||||||
|
|
||||||
|
@ -20,6 +21,12 @@ internal class Settings : ITab {
|
||||||
internal Settings(Plugin plugin) {
|
internal Settings(Plugin plugin) {
|
||||||
this.Plugin = plugin;
|
this.Plugin = plugin;
|
||||||
|
|
||||||
|
this.Territories = this.Plugin.DataManager.GetExcelSheet<TerritoryType>()!
|
||||||
|
.Where(row => row.RowId != 0)
|
||||||
|
.Select(row => (row.RowId, row.PlaceName.Value?.Name?.ToDalamudString().TextValue))
|
||||||
|
.Where(entry => entry.TextValue != null && !string.IsNullOrWhiteSpace(entry.TextValue))
|
||||||
|
.ToList()!;
|
||||||
|
|
||||||
this.Tabs = new List<(string, DrawSettingsDelegate)> {
|
this.Tabs = new List<(string, DrawSettingsDelegate)> {
|
||||||
("General", this.DrawGeneral),
|
("General", this.DrawGeneral),
|
||||||
("Writer", this.DrawWriter),
|
("Writer", this.DrawWriter),
|
||||||
|
@ -112,21 +119,16 @@ internal class Settings : ITab {
|
||||||
|
|
||||||
ImGui.Separator();
|
ImGui.Separator();
|
||||||
|
|
||||||
var clipper = ImGuiExt.Clipper((int) (tt.RowCount - this.Plugin.Config.BannedTerritories.Count));
|
var clipper = ImGuiExt.Clipper(this.Territories.Count - this.Plugin.Config.BannedTerritories.Count);
|
||||||
while (clipper.Step()) {
|
while (clipper.Step()) {
|
||||||
for (var i = clipper.DisplayStart; i < clipper.DisplayEnd; i++) {
|
for (var i = clipper.DisplayStart; i < clipper.DisplayEnd; i++) {
|
||||||
var territory = tt.GetRow((uint) i);
|
var (rowId, name) = this.Territories[i];
|
||||||
if (territory == null || territory.RowId == 0 || this.Plugin.Config.BannedTerritories.Contains(territory.RowId)) {
|
if (this.Plugin.Config.BannedTerritories.Contains(rowId)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
var name = territory.PlaceName.Value?.Name?.ToDalamudString().TextValue;
|
if (ImGui.Selectable($"{name}##{rowId}")) {
|
||||||
if (name == null) {
|
toAdd = rowId;
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ImGui.Selectable($"{name}##{territory.RowId}")) {
|
|
||||||
toAdd = territory.RowId;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user