Add override notice on Classes tab, include class in profile names

- Show "These settings are currently overridden" and grey out the
  frame checkboxes on the Classes tab, but only while viewing the
  logged-in character's own class and its active profile has the
  override enabled - other classes stay fully editable.
- GetCharacterKey() now embeds the class token ("Name - Class -
  Realm"), so auto-created per-character profiles carry it too.
  Migrate existing "Name - Realm" profiles/assignments/overrides to
  the new key on the affected character's next login.
This commit is contained in:
2026-07-08 00:26:58 +02:00
parent 83a1cda15c
commit 79f45e5c41
2 changed files with 53 additions and 6 deletions
+27 -5
View File
@@ -66,7 +66,9 @@ local function EnsureClassSettingsComplete(classSettings)
end
local function GetCharacterKey()
return UnitName("player") .. " - " .. GetRealmName()
local _, classToken = UnitClass("player")
local className = (LOCALIZED_CLASS_NAMES_MALE and LOCALIZED_CLASS_NAMES_MALE[classToken]) or classToken
return UnitName("player") .. " - " .. className .. " - " .. GetRealmName()
end
HideCoA.GetCharacterKey = GetCharacterKey
@@ -377,11 +379,31 @@ f:SetScript("OnEvent", function(self, event, arg1)
-- The profile-name syntax used to be "realm - character"; rename any
-- existing profile created under that scheme to the new ordering
-- instead of leaving it orphaned in the list.
local oldCharKey = GetRealmName() .. " - " .. UnitName("player")
local ancientCharKey = GetRealmName() .. " - " .. UnitName("player")
if HideCoADB.profiles[oldCharKey] and not HideCoADB.profiles[charKey] then
HideCoADB.profiles[charKey] = HideCoADB.profiles[oldCharKey]
HideCoADB.profiles[oldCharKey] = nil
if HideCoADB.profiles[ancientCharKey] and not HideCoADB.profiles[charKey] then
HideCoADB.profiles[charKey] = HideCoADB.profiles[ancientCharKey]
HideCoADB.profiles[ancientCharKey] = nil
end
-- The syntax was later "character - realm", without the class; rename
-- any existing profile/assignment created under that scheme too.
local legacyCharKey = UnitName("player") .. " - " .. GetRealmName()
if HideCoADB.profiles[legacyCharKey] and not HideCoADB.profiles[charKey] then
HideCoADB.profiles[charKey] = HideCoADB.profiles[legacyCharKey]
HideCoADB.profiles[legacyCharKey] = nil
end
if HideCoADB.charProfile[legacyCharKey] then
local assigned = HideCoADB.charProfile[legacyCharKey]
HideCoADB.charProfile[charKey] = (assigned == legacyCharKey) and charKey or assigned
HideCoADB.charProfile[legacyCharKey] = nil
end
if HideCoADB.characterOverrides and HideCoADB.characterOverrides[legacyCharKey] and not HideCoADB.characterOverrides[charKey] then
HideCoADB.characterOverrides[charKey] = HideCoADB.characterOverrides[legacyCharKey]
HideCoADB.characterOverrides[legacyCharKey] = nil
end
if not HideCoADB.profiles[charKey] then