Thread Tools Display Modes
02/19/22, 10:22 AM   #1
IsJustaGhost
AddOn Author - Click to view addons
Join Date: May 2020
Posts: 37
proposed change to ingame/hud/hudinfamymeter.lua and ingame/hud/hudtelvarmeter.lua

I propose a change to ingame/hud/hudinfamymeter.lua to make it use templates like how the other HUD meters do.
This will allow addons to manipulate the layout easier.

In function ZO_HUDInfamyMeter.Initialize
Lua Code:
  1. -- from line 65 change >
  2.     -- Set up platform styles
  3.     self.keyboardStyle =
  4.     {
  5.         template = "ZO_HUDInfamyMeter_KeyboardTemplate" ,
  6.         currencyOptions =
  7.         {
  8.             showTooltips = true,
  9.             customTooltip = SI_STATS_BOUNTY_LABEL,
  10.             isGamepad = false,
  11.             font = "ZoFontGameLargeBold",
  12.             iconSide = RIGHT,,
  13.             overrideTexture = nil
  14.         },
  15.     }
  16.     self.gamepadStyle =
  17.     {
  18.         template = "ZO_HUDInfamyMeter_GamepadTemplate",
  19.         currencyOptions =
  20.         {
  21.             showTooltips = false,
  22.             customTooltip = SI_STATS_BOUNTY_LABEL,
  23.             isGamepad = true,
  24.             font = "ZoFontGamepadHeaderDataValue",
  25.             iconSide = RIGHT,
  26.             overrideTexture = ZO_Currency_GetGamepadCurrencyIcon(CURT_MONEY)
  27.         },
  28.     }
  29.    
  30.     self.currencyOptions = self.isInGamepadMode and self.gamepadStyle or self.keyboardStyle
  31.    
  32. --< end change 73

In function ZO_HUDInfamyMeter.OnInfamyUpdated
Lua Code:
  1. if oldInfamy ~= self.infamyMeterState.infamy or updateType == UPDATE_TYPE_EVENT or gamepadModeSwitchUpdate then
  2.         -- Update frame and bars if we're switching between PC and console mode
  3.         if IsInGamepadPreferredMode() and not self.isInGamepadMode then
  4. -- from line 159 change >
  5.             self.currencyOptions = self.gamepadStyle
  6.             self.isInGamepadMode = true
  7.         elseif not IsInGamepadPreferredMode() and self.isInGamepadMode then
  8.             self.currencyOptions = self.keyboardStyle
  9.             self.isInGamepadMode = false
  10. --< end change 168
  11.         end



The above was written during initial lookup and taking notes in preparation of implementation into addon.
After beginning work on adding into the addon, I realized I missed an important detail for the telvar meter.

Proposed change to ingame/hud/hudtelvarmeter.lua
Due to not storing the object returned by ZO_PlatformStyle:New, one would need to replace or hook HUD_TELVAR_METER:UpdatePlatformStyle(styleTable)
Lua Code:
  1. self.platformStyle = ZO_PlatformStyle:New(function(...) self:UpdatePlatformStyle(...) end, self.keyboardStyle, self.gamepadStyle)
  2.     -- line 59 ^

Examples
Current method:
Lua Code:
  1. -- initialize
  2.     -- used outside of UpdatePlatformStyle
  3.     HUD_TELVAR_METER.gamepadStyle = customGamepadStyle
  4.     HUD_TELVAR_METER.keyboardStyle = customKeyboardStyle
  5.    
  6.     function HUD_TELVAR_METER:UpdatePlatformStyle(styleTable)
  7.         styleTable = self.styleTable
  8.         ApplyTemplateToControl(self.control, styleTable.template)
  9.         ZO_CurrencyControl_SetSimpleCurrency(self.telvarDisplayControl, CURT_TELVAR_STONES, GetCurrencyAmount(CURT_TELVAR_STONES, CURRENCY_LOCATION_CHARACTER), styleTable.currencyOptions, CURRENCY_SHOW_ALL)
  10.         local isMaxThreshold = IsMaxTelvarStoneMultiplierThreshold(self.telvarStoneThreshold)
  11.         self.meterBarControl:SetHidden(isMaxThreshold)
  12.         self.meterOverlayControl:SetAlpha(isMaxThreshold and 1 or 0)
  13.     end
  14.    
  15. -- on platform style change
  16.     HUD_TELVAR_METER.styleTable = isGamepadMode and HUD_TELVAR_METER.gamepadStyle or HUD_TELVAR_METER.keyboardStyle
  17.     HUD_TELVAR_METER:UpdatePlatformStyle()

Proposed method:
Lua Code:
  1. -- initialize
  2.     -- used outside of UpdatePlatformStyle
  3.     HUD_TELVAR_METER.gamepadStyle = customGamepadStyle
  4.     HUD_TELVAR_METER.keyboardStyle = customKeyboardStyle
  5.    
  6.     -- used in UpdatePlatformStyle
  7.     HUD_TELVAR_METER.platformStyle.gamepadStyle = customGamepadStyle
  8.     HUD_TELVAR_METER.platformStyle.keyboardStyle = customKeyboardStyle
  9.     HUD_TELVAR_METER.platformStyle:Apply()

Last edited by IsJustaGhost : 02/20/22 at 11:23 AM.
  Reply With Quote

ESOUI » Developer Discussions » Wish List » proposed change to ingame/hud/hudinfamymeter.lua

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off