Skip to content

Instantly share code, notes, and snippets.

@Fylwind
Last active August 29, 2015 14:07
Show Gist options
  • Save Fylwind/c83dadeb43eb655374f3 to your computer and use it in GitHub Desktop.
Save Fylwind/c83dadeb43eb655374f3 to your computer and use it in GitHub Desktop.
A patch for adding two new Bouquet Statusbars to the VuhDo addon: Total absorption % and Excess absorption %, which show the amount of absorption on a unit as a fraction of the unit's maximum health. "Total" refers the sum of all absorption effects, while "Excess" refers the sum of all absorption effects minus the amount of missing health.
--- VuhDo/VuhDoBouquetValidators.lua 2014-10-16 04:18:04.000000000 -0400
+++ VuhDo/VuhDoBouquetValidators.lua 2014-10-15 23:11:25.199736500 -0400
@@ -646,12 +646,31 @@
return true, nil, VUHDO_getIncHealOnUnit(anInfo["unit"]), -1, anInfo["healthmax"];
end
--
+local function VUHDO_statusExcessAbsorbValidator(anInfo, _)
+ local healthmax = anInfo["healthmax"]
+ local excessAbsorb = (UnitGetTotalAbsorbs(anInfo["unit"]) or 0) + anInfo["health"] - healthmax
+ if excessAbsorb < 0 then
+ return true, nil, 0, -1, healthmax
+ end
+ return true, nil, excessAbsorb, -1, healthmax
+end
+
+
+
+--
+local function VUHDO_statusTotalAbsorbValidator(anInfo, _)
+ return true, nil, UnitGetTotalAbsorbs(anInfo["unit"]) or 0, -1, anInfo["healthmax"]
+end
+
+
+
+--
local function VUHDO_statusThreatValidator(anInfo, _)
return true, nil, anInfo["threatPerc"], -1, 100;
end
@@ -1250,12 +1269,26 @@
["displayName"] = VUHDO_I18N_BOUQUET_STATUS_INCOMING,
["validator"] = VUHDO_statusIncomingValidator,
["custom_type"] = VUHDO_BOUQUET_CUSTOM_TYPE_STATUSBAR,
["interests"] = { VUHDO_UPDATE_INC },
},
+ ["STATUS_EXCESSABSORB"] = {
+ ["displayName"] = "Statusbar: Excess absorption %",
+ ["validator"] = VUHDO_statusExcessAbsorbValidator,
+ ["custom_type"] = VUHDO_BOUQUET_CUSTOM_TYPE_STATUSBAR,
+ ["interests"] = { VUHDO_UPDATE_HEALTH, VUHDO_UPDATE_HEALTH_MAX, VUHDO_UPDATE_SHIELD },
+ },
+
+ ["STATUS_TOTALABSORB"] = {
+ ["displayName"] = "Statusbar: Total absorption %",
+ ["validator"] = VUHDO_statusTotalAbsorbValidator,
+ ["custom_type"] = VUHDO_BOUQUET_CUSTOM_TYPE_STATUSBAR,
+ ["interests"] = { VUHDO_UPDATE_HEALTH_MAX, VUHDO_UPDATE_SHIELD },
+ },
+
["STATUS_THREAT"] = {
["displayName"] = VUHDO_I18N_BOUQUET_STATUS_THREAT,
["validator"] = VUHDO_statusThreatValidator,
["custom_type"] = VUHDO_BOUQUET_CUSTOM_TYPE_STATUSBAR,
["interests"] = { VUHDO_UPDATE_THREAT_PERC },
},
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment