View Single Post
08/27/21, 10:16 PM   #1
Leonardo1123
AddOn Author - Click to view addons
Join Date: Aug 2021
Posts: 19
Unnamed outfits don't show up in the dropdown of all outfits in LAM

Hey there!

I'm not sure if the name of unnamed outfits isn't actually the name but really placeholder text that's failing to trigger my code correctly or what, but any outfit that hasn't been custom-named doesn't show up in my dropdown. All code here, relevant code below.

Initialize:
Lua Code:
  1. function LeonardosWardrobeManager:Initialize()
  2.     LeonardosWardrobeManager.savedVariables = ZO_SavedVars:NewCharacterIdSettings(
  3.             "LeonardosWardrobeManagerVars",
  4.             LeonardosWardrobeManager.variableVersion, nil, LeonardosWardrobeManager.Default, GetWorldName())
  5.  
  6.     self.inCombat = IsUnitInCombat("player")
  7.     self.inStealth = GetUnitStealthState("player")
  8.  
  9.     for i=1,GetNumUnlockedOutfits() do
  10.         self.allOutfits[i + OUTFIT_OFFSET] = GetOutfitName(0, i)
  11.     end
  12.  
  13.     button, LeonardosWardrobeManager.feedback = LibFeedback:initializeFeedbackWindow(
  14.             LeonardosWardrobeManager,
  15.             "Leonardo's Wardrobe Manager",
  16.             WINDOW_MANAGER:CreateTopLevelWindow("LeonardosWardrobeDummyControl"),
  17.             "@Leonardo1123",
  18.             {CENTER , GuiRoot , CENTER , 10, 10},
  19.             {0,5000,50000},
  20.             "Send ")
  21.     button:SetHidden(true)
  22.  
  23.     LAM2:RegisterAddonPanel("LeonardosWardrobeManagerOptions", panelData)
  24.     LAM2:RegisterOptionControls("LeonardosWardrobeManagerOptions", optionsData)
  25.  
  26.     EVENT_MANAGER:RegisterForEvent(self.name, EVENT_OUTFIT_RENAME_RESPONSE, self.OnOutfitRenamed)
  27.     EVENT_MANAGER:RegisterForEvent(self.name, EVENT_PLAYER_ACTIVATED, self.OnPlayerActivated)
  28.     EVENT_MANAGER:RegisterForEvent(self.name, EVENT_PLAYER_COMBAT_STATE, self.OnPlayerCombatState)
  29.     EVENT_MANAGER:RegisterForEvent(self.name, EVENT_STEALTH_STATE_CHANGED, self.OnPlayerStealthState)
  30. end

LAM:
Lua Code:
  1. optionsData = {
  2.     [1] = {
  3.         type = "description",
  4.         title = nil,
  5.         text = "Warning: If you rename an outfit, you will need to reload the UI for those changes to take effect here",
  6.         width = "full",
  7.     },
  8.     [2] = {
  9.         type = "dropdown",
  10.         name = "Default Outfit",
  11.         tooltip = "The outfit to be worn by default",
  12.         choices = LeonardosWardrobeManager.allOutfits,
  13.         getFunc = function() return LeonardosWardrobeManager.savedVariables.defaultOutfit end,
  14.         setFunc = function(var) LeonardosWardrobeManager.SetStateOutfit("DEFAULT", var) end,
  15.         reference = "LeonardosWardrobeManager_Default_Dropdown"
  16.     },
  17.     [3] = {
  18.         type = "submenu",
  19.         name = "Combat",
  20.         tooltip = "Options related to combat and stealth", --(optional)
  21.         reference = "LeonardosWardrobeManager_Feedback",
  22.         controls = {
  23.             [1] = {
  24.                 type = "dropdown",
  25.                 name = "Combat Outfit",
  26.                 tooltip = "The outfit to be switched to upon entering combat",
  27.                 choices = LeonardosWardrobeManager.allOutfits,
  28.                 getFunc = function() return LeonardosWardrobeManager.savedVariables.combatOutfit end,
  29.                 setFunc = function(var) LeonardosWardrobeManager.SetStateOutfit("COMBAT", var) end,
  30.                 reference = "LeonardosWardrobeManager_Combat_Dropdown"
  31.             },
  32.             [2] = {
  33.                 type = "dropdown",
  34.                 name = "Stealth Outfit",
  35.                 tooltip = "The outfit to be switched to upon entering stealth",
  36.                 choices = LeonardosWardrobeManager.allOutfits,
  37.                 getFunc = function() return LeonardosWardrobeManager.savedVariables.stealthOutfit end,
  38.                 setFunc = function(var) LeonardosWardrobeManager.SetStateOutfit("STEALTH", var) end,
  39.                 reference = "LeonardosWardrobeManager_Stealth_Dropdown"
  40.             },
  41.         }
  42.     }
  43. }
  Reply With Quote