v1.0.3.0: Alliance frames fixes, PvP support, shared hotbar persistence, config save on teleport
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -154,6 +154,7 @@ namespace HSUI.Config
|
||||
CheckVersion();
|
||||
|
||||
Plugin.ClientState.Logout += OnLogout;
|
||||
Plugin.ClientState.TerritoryChanged += OnTerritoryChanged;
|
||||
Plugin.JobChangedEvent += OnJobChanged;
|
||||
|
||||
_configBaseNode.CreateNodesIfNeeded();
|
||||
@@ -179,6 +180,7 @@ namespace HSUI.Config
|
||||
|
||||
ConfigBaseNode.ConfigObjectResetEvent -= OnConfigObjectReset;
|
||||
Plugin.ClientState.Logout -= OnLogout;
|
||||
Plugin.ClientState.TerritoryChanged -= OnTerritoryChanged;
|
||||
Plugin.JobChangedEvent -= OnJobChanged;
|
||||
|
||||
Instance = null!;
|
||||
@@ -197,6 +199,13 @@ namespace HSUI.Config
|
||||
ProfilesManager.Instance?.SaveCurrentProfile();
|
||||
}
|
||||
|
||||
private void OnTerritoryChanged(ushort territoryId)
|
||||
{
|
||||
// Persist config on teleport/zone change so changes aren't lost during loading screens
|
||||
if (ConfigBaseNode.NeedsSave)
|
||||
SaveConfigurations();
|
||||
}
|
||||
|
||||
private void OnJobChanged(uint jobId)
|
||||
{
|
||||
UpdateCurrentProfile();
|
||||
@@ -602,6 +611,16 @@ namespace HSUI.Config
|
||||
|
||||
// Party Frames
|
||||
typeof(PartyFramesConfig),
|
||||
typeof(AllianceFramesHealthBarsConfig),
|
||||
typeof(AllianceFramesManaBarConfig),
|
||||
typeof(AllianceFramesCastbarConfig),
|
||||
typeof(AllianceFramesIconsConfig),
|
||||
typeof(AllianceFramesBuffsConfig),
|
||||
typeof(AllianceFramesDebuffsConfig),
|
||||
typeof(AllianceFramesTrackersConfig),
|
||||
typeof(AllianceFramesCooldownListConfig),
|
||||
typeof(AllianceFrames1Config),
|
||||
typeof(AllianceFrames2Config),
|
||||
typeof(PartyFramesHealthBarsConfig),
|
||||
typeof(PartyFramesManaBarConfig),
|
||||
typeof(PartyFramesCastbarConfig),
|
||||
|
||||
@@ -290,16 +290,26 @@ namespace HSUI.Config.Tree
|
||||
Type type = ConfigObject.GetType();
|
||||
ImportData? importData = ProfilesManager.Instance?.DefaultImportData(type);
|
||||
|
||||
if (importData == null)
|
||||
PluginConfigObject? config = null;
|
||||
if (importData != null)
|
||||
{
|
||||
Plugin.Logger.Error("Error finding default import data for type " + type.ToString());
|
||||
return;
|
||||
config = importData.GetObject();
|
||||
}
|
||||
|
||||
PluginConfigObject? config = importData.GetObject();
|
||||
if (config == null)
|
||||
{
|
||||
Plugin.Logger.Error("Error importing default import data for type " + type.ToString());
|
||||
// Fallback: invoke static DefaultConfig() when no import data (e.g. new config types not yet in Default.HSUI)
|
||||
MethodInfo? defaultConfigMethod = type.GetMethod("DefaultConfig", BindingFlags.Public | BindingFlags.Static);
|
||||
if (defaultConfigMethod != null && defaultConfigMethod.ReturnType != typeof(void))
|
||||
{
|
||||
object? result = defaultConfigMethod.Invoke(null, null);
|
||||
config = result as PluginConfigObject;
|
||||
}
|
||||
}
|
||||
|
||||
if (config == null)
|
||||
{
|
||||
Plugin.Logger.Error("Error resetting config for type " + type.ToString() + " (no import data and no DefaultConfig)");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user