Hey there!
My addon has a list of outfits in the LAM2 settings page. After renaming an outfit, I've noticed it doesn't update in LAM2 until you reload UI.
I tried solving it by listening to the event EVENT_OUTFIT_RENAME_RESPONSE but with no luck.
Here's my code:
Lua Code:
function LeonardosWardrobeManager:Initialize()
LeonardosWardrobeManager.savedVariables = ZO_SavedVars:NewCharacterIdSettings("LeonardosWardrobeManagerVars", LeonardosWardrobeManager.variableVersion, nil, LeonardosWardrobeManager.Default, GetWorldName())
self.inCombat = IsUnitInCombat("player")
self.inStealth = GetUnitStealthState("player")
for i=1,GetNumUnlockedOutfits() do
self.allOutfits[i + OUTFIT_OFFSET] = GetOutfitName(0, i)
end
LAM2:RegisterAddonPanel("LeonardosWardrobeManagerOptions", panelData)
LAM2:RegisterOptionControls("LeonardosWardrobeManagerOptions", optionsData)
EVENT_MANAGER:RegisterForEvent(self.name, EVENT_OUTFIT_RENAME_RESPONSE, self.OnOutfitRenamed)
EVENT_MANAGER:RegisterForEvent(self.name, EVENT_ZONE_UPDATE, self.OnZoneChange)
EVENT_MANAGER:RegisterForEvent(self.name, EVENT_PLAYER_COMBAT_STATE, self.OnPlayerCombatState)
EVENT_MANAGER:RegisterForEvent(self.name, EVENT_STEALTH_STATE_CHANGED, self.OnPlayerStealthState)
end
Lua Code:
function LeonardosWardrobeManager.OnOutfitRenamed(_, _, index) -- TODO: Still not working
LeonardosWardrobeManager.allOutfits[index + OUTFIT_OFFSET] = GetOutfitName(index + OUTFIT_OFFSET)
optionsData[3].controls[1].choices = LeonardosWardrobeManager.allOutfits
optionsData[3].controls[2].choices = LeonardosWardrobeManager.allOutfits
end
Lua Code:
optionsData = {
[1] = {
type = "description",
title = nil,
text = "Warning: If you rename an outfit, you will need to reload the UI for those changes to take effect here",
width = "full",
},
[2] = {
type = "dropdown",
name = "Default Outfit",
tooltip = "The outfit to be worn by default",
choices = LeonardosWardrobeManager.allOutfits,
getFunc = function() return LeonardosWardrobeManager.savedVariables.defaultOutfit end,
setFunc = function(var) LeonardosWardrobeManager.SetStateOutfit("DEFAULT", var) end,
},
[3] = {
type = "submenu",
name = "Combat",
tooltip = "Options related to combat and stealth", --(optional)
controls = {
[1] = {
type = "dropdown",
name = "Combat Outfit",
tooltip = "The outfit to be switched to upon entering combat",
choices = LeonardosWardrobeManager.allOutfits,
getFunc = function() return LeonardosWardrobeManager.savedVariables.combatOutfit end,
setFunc = function(var) LeonardosWardrobeManager.SetStateOutfit("COMBAT", var) end,
},
[2] = {
type = "dropdown",
name = "Stealth Outfit",
tooltip = "The outfit to be switched to upon entering stealth",
choices = LeonardosWardrobeManager.allOutfits,
getFunc = function() return LeonardosWardrobeManager.savedVariables.stealthOutfit end,
setFunc = function(var) LeonardosWardrobeManager.SetStateOutfit("STEALTH", var) end,
},
}
}
}