Shields Module for Pitbull4
This module allows you to add a bar to your Pitbull4 frames, where the extra bar will show you the remaing amount (not remaining time) of any shield(s) on that target. You can also use a Lua text to read the values and overlay those as a text element wherever you might want. I'll show you the code that below. It's not automatically integrated to export to just show up magically in Pitbull's list yet, though that's a TODO.
Currently it know about these shields:
- Death Knight
- Sorry, they took all Druid shields away!
- Trinket and other object
If you know of other shields people might want to track, let me know and I'll see about adding them. There's code in the addon which will print a message to the console when it detects a new kind of shield that it might be able to track.
It will show those shields on any unit frame the bar's enabled for, whether they're the unit that cast the shield or not. The idea is if you're a Disc priest, you can shield your tank and know how much damage is left on that shield before you need to refresh it.
In the Layout editor, choose a layout and go to the
Bars tab. You'll see another set of tabs, with one called
Shields. The settings for the shields bar are there. Note that by default,
Hide empty bar is turned on, so if you have no shield on you, you'll see nothing until you do put up a shield.
If you want to overlay the actual value of the remaining shield, you'll need to extract the value from the shields module. This is set up to be fairly easy to do.
This is how you do it:
- Open the /pitbull config window
Layout Editor, then choode the layout you want to add the text element to
- Select the
- In the
New textbox, type the name you want your text field to be called; anything you want. I use
- "Type" should be
- "Attach to" wherever you want it to show up, configure it to look the way you want. I attach to
Shields: default, with
Custom, then in the box below, enter this code:
local current=0 for s,ss in pairs(PitBull4_Shields_combatFrame.shields) do current = current + (ss.cur[UnitGUID(unit)] or 0) end return string.format("|cffff0000%0.1fk",current/1000)
Events, you want to select
UNIT_AURAboth. Deselect the others.
Tada! You're all done. Cast a shield on yourself and see the results.
Also, note that the last line there is made to show the text as
27.8k instead of
27814 to save some space on the narrow default bar. You should feel free to hack that up and change it to display the way you want it to display.
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License.
No doubt there's lots of bugs. You can let me know about them here. I might even fix them if you let me know.
- Date created
- Mar 31, 2011
- Last update
- Oct 17, 2014
- Development stage
- Creative Commons Attribution-NonCommercial-ShareAlike
- Curse link
- Recent files
- Required dependency
- PitBull Unit Frames 4.0