2020-07-29 16:01:00 +00:00
|
|
|
|
using Dalamud.Configuration;
|
|
|
|
|
using Dalamud.Plugin;
|
2020-08-04 02:13:29 +00:00
|
|
|
|
using Newtonsoft.Json;
|
2020-07-29 16:01:00 +00:00
|
|
|
|
using System;
|
2020-07-30 01:01:22 +00:00
|
|
|
|
using System.Collections.Generic;
|
2020-08-04 02:13:29 +00:00
|
|
|
|
using System.Collections.ObjectModel;
|
2020-07-29 16:01:00 +00:00
|
|
|
|
|
|
|
|
|
namespace HudSwap {
|
|
|
|
|
[Serializable]
|
2020-07-31 17:58:56 +00:00
|
|
|
|
public class PluginConfig : IPluginConfiguration {
|
2020-07-29 16:01:00 +00:00
|
|
|
|
public int Version { get; set; } = 1;
|
|
|
|
|
|
|
|
|
|
[NonSerialized]
|
|
|
|
|
private DalamudPluginInterface pi;
|
|
|
|
|
|
2020-07-30 17:53:13 +00:00
|
|
|
|
public bool FirstRun { get; set; } = true;
|
2020-07-30 18:41:10 +00:00
|
|
|
|
public bool UnderstandsRisks { get; set; } = false;
|
2020-07-30 17:53:13 +00:00
|
|
|
|
|
2020-08-04 02:13:29 +00:00
|
|
|
|
public bool ImportPositions { get; set; } = false;
|
2020-07-30 01:01:22 +00:00
|
|
|
|
public bool SwapsEnabled { get; set; } = false;
|
2020-07-29 16:01:00 +00:00
|
|
|
|
|
2020-07-30 17:54:13 +00:00
|
|
|
|
public HudSlot StagingSlot { get; set; } = HudSlot.Four;
|
|
|
|
|
|
2020-07-31 17:58:56 +00:00
|
|
|
|
public Guid DefaultLayout { get; set; } = Guid.Empty;
|
2020-07-29 16:01:00 +00:00
|
|
|
|
|
2020-07-31 17:58:56 +00:00
|
|
|
|
#pragma warning disable CA1051 // Do not declare visible instance fields
|
2020-07-31 16:46:40 +00:00
|
|
|
|
[Obsolete("Individual layout fields are deprecated; use StatusLayouts instead")]
|
2020-07-30 01:01:22 +00:00
|
|
|
|
public Guid combatLayout = Guid.Empty;
|
2020-07-31 16:46:40 +00:00
|
|
|
|
[Obsolete("Individual layout fields are deprecated; use StatusLayouts instead")]
|
2020-07-30 01:01:22 +00:00
|
|
|
|
public Guid weaponDrawnLayout = Guid.Empty;
|
2020-07-31 16:46:40 +00:00
|
|
|
|
[Obsolete("Individual layout fields are deprecated; use StatusLayouts instead")]
|
2020-07-30 01:01:22 +00:00
|
|
|
|
public Guid instanceLayout = Guid.Empty;
|
2020-07-31 16:46:40 +00:00
|
|
|
|
[Obsolete("Individual layout fields are deprecated; use StatusLayouts instead")]
|
2020-07-30 01:01:22 +00:00
|
|
|
|
public Guid craftingLayout = Guid.Empty;
|
2020-07-31 16:46:40 +00:00
|
|
|
|
[Obsolete("Individual layout fields are deprecated; use StatusLayouts instead")]
|
2020-07-30 01:01:22 +00:00
|
|
|
|
public Guid gatheringLayout = Guid.Empty;
|
2020-07-31 16:46:40 +00:00
|
|
|
|
[Obsolete("Individual layout fields are deprecated; use StatusLayouts instead")]
|
2020-07-30 01:54:04 +00:00
|
|
|
|
public Guid fishingLayout = Guid.Empty;
|
2020-07-31 16:46:40 +00:00
|
|
|
|
[Obsolete("Individual layout fields are deprecated; use StatusLayouts instead")]
|
2020-07-31 04:15:07 +00:00
|
|
|
|
public Guid roleplayingLayout = Guid.Empty;
|
2020-07-31 17:58:56 +00:00
|
|
|
|
#pragma warning restore CA1051 // Do not declare visible instance fields
|
2020-07-31 04:15:07 +00:00
|
|
|
|
|
2020-09-02 23:36:55 +00:00
|
|
|
|
[Obsolete("Superceded by HudConditionMatches")]
|
2020-07-31 17:58:56 +00:00
|
|
|
|
public Dictionary<Status, Guid> StatusLayouts { get; } = new Dictionary<Status, Guid>();
|
2020-09-02 23:36:55 +00:00
|
|
|
|
[Obsolete("Superceded by HudConditionMatches")]
|
2020-07-31 17:58:56 +00:00
|
|
|
|
public Dictionary<string, Guid> JobLayouts { get; } = new Dictionary<string, Guid>();
|
2020-09-02 23:36:55 +00:00
|
|
|
|
[Obsolete("Superceded by HudConditionMatches")]
|
2020-07-31 04:15:07 +00:00
|
|
|
|
public bool HighPriorityJobs { get; set; } = false;
|
2020-09-02 23:36:55 +00:00
|
|
|
|
[Obsolete("Superceded by HudConditionMatches")]
|
2020-07-31 04:15:07 +00:00
|
|
|
|
public bool JobsCombatOnly { get; set; } = false;
|
2020-07-29 16:01:00 +00:00
|
|
|
|
|
2020-08-04 02:13:29 +00:00
|
|
|
|
[Obsolete("Use Layouts2 instead")]
|
2020-07-30 01:01:22 +00:00
|
|
|
|
public Dictionary<Guid, Tuple<string, byte[]>> Layouts { get; } = new Dictionary<Guid, Tuple<string, byte[]>>();
|
2020-08-04 02:13:29 +00:00
|
|
|
|
public Dictionary<Guid, Layout> Layouts2 { get; } = new Dictionary<Guid, Layout>();
|
2020-07-29 16:01:00 +00:00
|
|
|
|
|
2020-09-02 23:36:55 +00:00
|
|
|
|
public List<HudConditionMatch> HudConditionMatches { get; } = new List<HudConditionMatch>();
|
2020-09-02 23:36:53 +00:00
|
|
|
|
|
2020-07-29 16:01:00 +00:00
|
|
|
|
public void Initialize(DalamudPluginInterface pluginInterface) {
|
|
|
|
|
this.pi = pluginInterface;
|
2020-07-31 16:46:40 +00:00
|
|
|
|
this.Migrate();
|
|
|
|
|
this.Save();
|
2020-07-29 16:01:00 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void Save() {
|
|
|
|
|
this.pi.SavePluginConfig(this);
|
|
|
|
|
}
|
2020-07-31 16:46:40 +00:00
|
|
|
|
|
|
|
|
|
private void Migrate() {
|
|
|
|
|
#pragma warning disable 618
|
|
|
|
|
if (this.combatLayout != Guid.Empty) {
|
|
|
|
|
this.StatusLayouts[Status.InCombat] = this.combatLayout;
|
|
|
|
|
this.combatLayout = Guid.Empty;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (this.weaponDrawnLayout != Guid.Empty) {
|
|
|
|
|
this.StatusLayouts[Status.WeaponDrawn] = this.weaponDrawnLayout;
|
|
|
|
|
this.weaponDrawnLayout = Guid.Empty;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (this.instanceLayout != Guid.Empty) {
|
|
|
|
|
this.StatusLayouts[Status.InInstance] = this.instanceLayout;
|
|
|
|
|
this.instanceLayout = Guid.Empty;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (this.craftingLayout != Guid.Empty) {
|
|
|
|
|
this.StatusLayouts[Status.Crafting] = this.craftingLayout;
|
|
|
|
|
this.craftingLayout = Guid.Empty;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (this.gatheringLayout != Guid.Empty) {
|
|
|
|
|
this.StatusLayouts[Status.Gathering] = this.gatheringLayout;
|
|
|
|
|
this.gatheringLayout = Guid.Empty;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (this.fishingLayout != Guid.Empty) {
|
|
|
|
|
this.StatusLayouts[Status.Fishing] = this.fishingLayout;
|
|
|
|
|
this.fishingLayout = Guid.Empty;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (this.roleplayingLayout != Guid.Empty) {
|
|
|
|
|
this.StatusLayouts[Status.Roleplaying] = this.roleplayingLayout;
|
|
|
|
|
this.roleplayingLayout = Guid.Empty;
|
|
|
|
|
}
|
2020-08-04 02:13:29 +00:00
|
|
|
|
|
|
|
|
|
if (this.Layouts.Count != 0) {
|
|
|
|
|
foreach (KeyValuePair<Guid, Tuple<string, byte[]>> entry in this.Layouts) {
|
|
|
|
|
Layout layout = new Layout(entry.Value.Item1, entry.Value.Item2, new Dictionary<string, Vector2<short>>());
|
|
|
|
|
this.Layouts2.Add(entry.Key, layout);
|
|
|
|
|
}
|
|
|
|
|
this.Layouts.Clear();
|
|
|
|
|
}
|
2020-09-02 23:36:55 +00:00
|
|
|
|
|
|
|
|
|
if (this.JobLayouts.Count != 0) {
|
|
|
|
|
foreach (var jobLayout in JobLayouts)
|
|
|
|
|
this.HudConditionMatches.Add(new HudConditionMatch() {
|
|
|
|
|
ClassJob = jobLayout.Key,
|
|
|
|
|
Status = JobsCombatOnly ? Status.InCombat : default,
|
|
|
|
|
LayoutId = jobLayout.Value
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
JobLayouts.Clear();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (this.StatusLayouts.Count != 0) {
|
|
|
|
|
foreach (var statusLayout in StatusLayouts) {
|
|
|
|
|
var match = new HudConditionMatch() {Status = statusLayout.Key, LayoutId = statusLayout.Value};
|
|
|
|
|
if (HighPriorityJobs)
|
|
|
|
|
this.HudConditionMatches.Add(match);
|
|
|
|
|
else
|
|
|
|
|
this.HudConditionMatches.Insert(0, match);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
StatusLayouts.Clear();
|
|
|
|
|
}
|
2020-07-31 16:46:40 +00:00
|
|
|
|
#pragma warning restore 618
|
|
|
|
|
}
|
2020-07-29 16:01:00 +00:00
|
|
|
|
}
|
|
|
|
|
}
|