feat: add preset copy button
This commit is contained in:
parent
3b596f289e
commit
3167d286e3
|
@ -105,6 +105,28 @@ namespace BetterPartyFinder {
|
|||
}
|
||||
}
|
||||
|
||||
internal ConfigurationFilter Clone() {
|
||||
var categories = this.Categories.ToHashSet();
|
||||
var duties = this.Duties.ToHashSet();
|
||||
var jobs = this.Jobs.ToList();
|
||||
|
||||
return new ConfigurationFilter {
|
||||
Categories = categories,
|
||||
Conditions = this.Conditions,
|
||||
Duties = duties,
|
||||
Jobs = jobs,
|
||||
Name = string.Copy(this.Name),
|
||||
Objectives = this.Objectives,
|
||||
DutiesMode = this.DutiesMode,
|
||||
LootRule = this.LootRule,
|
||||
SearchArea = this.SearchArea,
|
||||
DutyFinderSettings = this.DutyFinderSettings,
|
||||
MaxItemLevel = this.MaxItemLevel,
|
||||
MinItemLevel = this.MinItemLevel,
|
||||
AllowHugeItemLevel = this.AllowHugeItemLevel,
|
||||
};
|
||||
}
|
||||
|
||||
internal static ConfigurationFilter Create() {
|
||||
return new() {
|
||||
Categories = Enum.GetValues(typeof(UiCategory))
|
||||
|
|
|
@ -220,6 +220,20 @@ namespace BetterPartyFinder {
|
|||
|
||||
ImGui.SameLine();
|
||||
|
||||
if (IconButton(FontAwesomeIcon.Copy, "copy") && selected != null) {
|
||||
if (this.Plugin.Config.Presets.TryGetValue(selected.Value, out var copyFilter)) {
|
||||
var guid = Guid.NewGuid();
|
||||
|
||||
var copied = copyFilter.Clone();
|
||||
copied.Name += " (copy)";
|
||||
this.Plugin.Config.Presets.Add(guid, copied);
|
||||
this.Plugin.Config.SelectedPreset = guid;
|
||||
this.Plugin.Config.Save();
|
||||
}
|
||||
}
|
||||
|
||||
ImGui.SameLine();
|
||||
|
||||
if (IconButton(FontAwesomeIcon.Cog, "settings")) {
|
||||
this.SettingsVisible = true;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue