From a7c498b4d04c04d6e354c48d6d39f958a7a4dd89 Mon Sep 17 00:00:00 2001 From: Parnic Date: Mon, 19 Jan 2009 04:57:53 +0000 Subject: [PATCH] - added user-requested toggle to color the TargetHealth bar by hostility if the target is an NPC and the bar is set to use class coloring (instead of health % coloring) - cleaned up the options and options dependencies a bit in the target health module --- modules/TargetHealth.lua | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/modules/TargetHealth.lua b/modules/TargetHealth.lua index 40b59b5..5c2e180 100644 --- a/modules/TargetHealth.lua +++ b/modules/TargetHealth.lua @@ -58,6 +58,7 @@ function IceTargetHealth.prototype:GetDefaultSettings() settings["PvPIconScale"] = 1.0 settings["PvPIconOnTop"] = false settings["allowMouseInteraction"] = false + settings["npcHostilityColor"] = false return settings end @@ -70,7 +71,7 @@ function IceTargetHealth.prototype:GetOptions() opts["classColor"] = { type = "toggle", name = "Class color bar", - desc = "Use class color as the bar color instead of reaction color", + desc = "Use class color as the bar color instead of reaction color\n\n(Note: The 'color bar by health %' setting overrides this)", get = function() return self.moduleSettings.classColor end, @@ -79,11 +80,28 @@ function IceTargetHealth.prototype:GetOptions() self:Update(self.unit) end, disabled = function() - return not self.moduleSettings.enabled + return not self.moduleSettings.enabled or self.moduleSettings.scaleHealthColor end, order = 41 } + opts["npcHostilityColor"] = { + type = "toggle", + name = "Color NPC's by hostility", + desc = "If you are using the 'class color bar' setting above, then enabling this will color NPC's by their hostility toward you since NPC class isn't very helpful or applicable information.", + get = function() + return self.moduleSettings.npcHostilityColor + end, + set = function(v) + self.moduleSettings.npcHostilityColor = v + self:Redraw() + end, + disabled = function() + return not self.moduleSettings.enabled or not self.moduleSettings.classColor or self.moduleSettings.scaleHealthColor + end, + order = 41.5 + } + opts["hideBlizz"] = { type = "toggle", name = "Hide Blizzard Frame", @@ -126,7 +144,7 @@ function IceTargetHealth.prototype:GetOptions() opts["scaleHealthColor"] = { type = "toggle", name = "Color bar by health %", - desc = "Colors the health bar from MaxHealthColor to MinHealthColor based on current health %", + desc = "Colors the health bar from MaxHealthColor to MinHealthColor based on current health %\n\n(Note: This overrides the 'class color bar' setting. Disable this to use class coloring)", get = function() return self.moduleSettings.scaleHealthColor end, @@ -647,7 +665,7 @@ function IceTargetHealth.prototype:Update(unit) self.color = "TargetHealthHostile" end - if (self.moduleSettings.classColor) then + if (self.moduleSettings.classColor) and (not self.moduleSettings.npcHostilityColor or UnitPlayerControlled("target")) then self.color = self.unitClass end