ESOUI

ESOUI (https://www.esoui.com/forums/index.php)
-   AddOn Search/Requests (https://www.esoui.com/forums/forumdisplay.php?f=165)
-   -   Shield Strength (https://www.esoui.com/forums/showthread.php?t=2313)

spoqster 10/07/14 10:15 AM

Shield Strength
 
Hi!

I am looking for an AddOn that displays the current shield strength. Shields such as the Blazing Shield start out with a specific strength and this strength is reduced as the player takes hits. Thus, by taking damage the shield's up time is reduced.

It would be really useful to have the current shield strength displayed on screen.

I suggested the new value on hits to be shown in Combat Cloud, but Garkin disliked the idea and suggested that this may be a better fit for FTC or Srendarr. But these buff trackers typically display run times, rather than values.

So maybe a standalone addon would be the best fit.

Anybody else think this is a good idea?

Ayantir 10/07/14 11:17 AM

something like http://www.esoui.com/downloads/info2...tionAlert.html ?
I'm not very skilled in this category, but you should find an "item status" addon, because shield is like whole armor, it decrease wth hits you take.

Garkin 10/07/14 12:55 PM

By default is shield is displayed on unitframes, so what do you exactly want? Some number on the screen or some kind of progress bar?

There is a hack how to get numeric shiled value from the unitframes:
Lua Code:
  1. for k, module in pairs(PLAYER_ATTRIBUTE_BARS.attributeVisualizer.visualModules) do
  2.    if module.moduleId == 5 then
  3.       ZO_PreHook(module, "OnValueChanged", function(self, bar, info) d(info.value) end)
  4.       break
  5.    end
  6. end
If you run this code for example using the ZAM Notebook, it will print shield value every time when shield value is changed.

spoqster 10/08/14 06:05 AM

Quote:

Originally Posted by Garkin (Post 12540)
By default is shield is displayed on unitframes, so what do you exactly want? Some number on the screen or some kind of progress bar?

There is a hack how to get numeric shiled value from the unitframes:
Lua Code:
  1. for k, module in pairs(PLAYER_ATTRIBUTE_BARS.attributeVisualizer.visualModules) do
  2.    if module.moduleId == 5 then
  3.       ZO_PreHook(module, "OnValueChanged", function(self, bar, info) d(info.value) end)
  4.       break
  5.    end
  6. end
If you run this code for example using the ZAM Notebook, it will print shield value every time when shield value is changed.

That sounds pretty much like what I had in mind.

The original idea was to have a Combat Cloud style message on screen when the shield is cast that reads "Blazing Shield at 800" and when you take a 250 point hit the text pops up again and reads "Blazing Shield at 550".

Of course having the current shield strength displayed next to the buff is also an option. But it would be a bit of a design exception in the buff context, because an extra value like this is only relevant for few buffs. Also I really like the way Combat Cloud displays information. It's very clear and relevant.

Garkin 10/09/14 05:19 PM

I have written a small addon to test how shields works:

ShieldInfo.txt
Code:

## APIVersion: 100009
## Title: Shield Info v0.1
## Version: 0.1
## Author: Garkin
## SavedVariables: SHIELD_INFO_SV

ShieldInfo.xml
ShieldInfo.lua

ShieldInfo.xml
xml Code:
  1. <GuiXml>
  2.    <Controls>
  3.       <TopLevelControl name="ShieldInfo_Template" clampedToScreen="true" mouseEnabled="false" movable="false" hidden="true" virtual="true">
  4.          <Dimensions x="200" y="64" />
  5.          <Controls>
  6.  
  7.             <Backdrop alpha="0.3" hidden="true">
  8.                <Anchor point="TOPLEFT" offsetX="-8" offsetY="-8" />
  9.                <Anchor point="BOTTOMRIGHT" offsetX="8" offsetY="8" />
  10.                <Edge file="EsoUI/Art/Tooltips/UI-Border.dds" edgeFileWidth="128" edgeFileHeight="16" />
  11.                <Center file="EsoUI/Art/Tooltips/UI-TooltipCenter.dds" />
  12.                <Insets left="16" top="16" right="-16" bottom="-16" />
  13.  
  14.                <Controls>
  15.                   <Texture textureFile="EsoUI/Art/Tooltips/munge_overlay.dds" addressMode="WRAP">
  16.                      <AnchorFill />
  17.                   </Texture>
  18.                </Controls>
  19.  
  20.                <OnInitialized>
  21.                   self:GetParent().bd = self
  22.                </OnInitialized>
  23.             </Backdrop>
  24.  
  25.             <Texture textureFile="EsoUI/Art/Repair/inventory_tabicon_repair_up.dds">
  26.                <Anchor point="LEFT" />
  27.                <Dimensions x="64" y="64" />
  28.                <OnInitialized>
  29.                   self:GetParent().icon = self
  30.                </OnInitialized>
  31.             </Texture>
  32.  
  33.             <Label font="ZoFontTooltipTitle" color="INTERFACE_COLOR_TYPE_TEXT_COLORS:INTERFACE_TEXT_COLOR_NORMAL" verticalAlignment="CENTER">
  34.                <Anchor point="RIGHT" />
  35.                <Dimensions x="130" y="64" />
  36.                <OnInitialized>
  37.                   self:GetParent().label = self
  38.                </OnInitialized>
  39.             </Label>
  40.  
  41.          </Controls>
  42.       </TopLevelControl>
  43.    </Controls>
  44. </GuiXml>
ShieldInfo.lua
Lua Code:
  1. local ADDON_NAME = "ShieldInfo"
  2. local EM = GetEventManager()
  3. local WM = GetWindowManager()
  4. local SV, UI
  5. local current = 0
  6. local maximum = 0
  7.  
  8.  
  9. local function SetupUI(state)
  10.    UI:SetMouseEnabled(state)
  11.    UI:SetMovable(state)
  12.  
  13.    UI.bd:SetHidden(not state)
  14.    UI:SetHidden(not (state or (current > 0)))
  15.  
  16.    if current > 0 then
  17.       UI.label:SetText(("%d/%d"):format(current, maximum))
  18.    else
  19.       UI.label:SetText("current/max")
  20.    end
  21.  
  22.    if not state then
  23.       local valid, point, target, relPoint, x, y = UI:GetAnchor(0)
  24.  
  25.       if valid then
  26.          SV.Anchor = { p = point, t = target:GetName(), r = relPoint, x = x, y = y }
  27.       end
  28.    end
  29. end
  30.  
  31. local function OnMouseUp(self, button, upInside)
  32.    if upInside then
  33.       if button == 2 then
  34.          ClearMenu()
  35.          AddMenuItem("Save & Hide", function() SetupUI(false) end)
  36.          ShowMenu(self)
  37.       end
  38.    end
  39. end
  40.  
  41. local function UnitAttributeVisual(eventCode, unitTag, unitAttributeVisual, statType, attributeType, powerType, value1, value2, value3, value4)
  42.    if unitTag == "player" and unitAttributeVisual == ATTRIBUTE_VISUAL_POWER_SHIELDING and attributeType == ATTRIBUTE_HEALTH then
  43.       if eventCode == EVENT_UNIT_ATTRIBUTE_VISUAL_UPDATED then
  44.          current = current + (value2 - value1)
  45.          maximum = maximum + (value4 - value3)
  46.       elseif eventCode == EVENT_UNIT_ATTRIBUTE_VISUAL_ADDED then
  47.          current = current + value1
  48.          maximum = maximum + value2
  49.       elseif eventCode == EVENT_UNIT_ATTRIBUTE_VISUAL_REMOVED then
  50.          current = current - value1
  51.          maximum = maximum - value2
  52.       end
  53.    end
  54.  
  55.    if current > 0 then
  56.       UI.label:SetText(("%d/%d"):format(current, maximum))
  57.       UI:SetHidden(false)
  58.    else
  59.       UI:SetHidden(true)
  60.    end
  61. end
  62.  
  63. local function OnLoaded(event, name)
  64.    if name == ADDON_NAME then
  65.       EM:UnregisterForEvent(name, event)
  66.  
  67.       SV = ZO_SavedVars:New("SHIELD_INFO_SV", 1, { Anchor = { p = BOTTOM, t = "GuiRoot", r = CENTER, x = 0, y = -100 }, firstTime = true })
  68.  
  69.       UI = WM:CreateControlFromVirtual(nil, GuiRoot, "ShieldInfo_Template")
  70.  
  71.       UI:SetHandler("OnMouseUp", OnMouseUp)
  72.  
  73.       if SV.firstTime then
  74.          SV.firstTime = false
  75.          d("=== Shield Info ===")
  76.          d("Adjust ShieldInfo position and then right-click to hide window and save its position.")
  77.          d("Type /si to unlock ShieldInfo window again.")
  78.          SetupUI(true)
  79.       end
  80.  
  81.       UI:SetAnchor(SV.Anchor.p, _G[SV.Anchor.t], SV.Anchor.r, SV.Anchor.x, SV.Anchor.y)
  82.  
  83.       UI:RegisterForEvent(EVENT_UNIT_ATTRIBUTE_VISUAL_ADDED, UnitAttributeVisual)
  84.       UI:RegisterForEvent(EVENT_UNIT_ATTRIBUTE_VISUAL_REMOVED, UnitAttributeVisual)
  85.       UI:RegisterForEvent(EVENT_UNIT_ATTRIBUTE_VISUAL_UPDATED, UnitAttributeVisual)
  86.  
  87.       SLASH_COMMANDS["/si"] = function() SetupUI(true) end
  88.    end
  89. end
  90.  
  91. EM:RegisterForEvent(ADDON_NAME, EVENT_ADD_ON_LOADED, OnLoaded)

Download link: https://www.dropbox.com/s/p1orffil60...ldInfo_0.1.zip


All times are GMT -6. The time now is 09:26 PM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2014 - 2022 MMOUI