From d677a04f1a424301fd6da4dab221b75ddd85bacb Mon Sep 17 00:00:00 2001 From: Parnic Date: Sat, 18 Sep 2010 07:26:50 +0000 Subject: [PATCH] - fixed a bug where the combat icon would get stuck if you went into combat when resting but had the resting icon display disabled - made the combat icon replace the resting icon if you go into combat while resting and then switch back to the resting icon (if appropriate) when dropping combat --- modules/PlayerHealth.lua | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/modules/PlayerHealth.lua b/modules/PlayerHealth.lua index e3c0c6d..7a09bdb 100644 --- a/modules/PlayerHealth.lua +++ b/modules/PlayerHealth.lua @@ -933,11 +933,15 @@ function PlayerHealth.prototype:Resting() -- moved icon logic above :Update so that it will trigger the alpha settings properly if (self.resting) then - if self.moduleSettings.showStatusIcon and self.moduleSettings.showStatusResting and not self.frame.statusIcon then - self.frame.statusIcon = self:CreateTexCoord(self.frame.statusIcon, "Interface\\CharacterFrame\\UI-StateIcon", 20, 20, + if self.moduleSettings.showStatusIcon and self.moduleSettings.showStatusResting then + if not self.frame.statusIcon then + self.frame.statusIcon = self:CreateTexCoord(self.frame.statusIcon, "Interface\\CharacterFrame\\UI-StateIcon", 20, 20, self.moduleSettings.statusIconScale, 0.0625, 0.4475, 0.0625, 0.4375) - self:SetTexLoc(self.frame.statusIcon, self.moduleSettings.statusIconOffset['x'], self.moduleSettings.statusIconOffset['y']) - self:SetIconAlpha() + self:SetTexLoc(self.frame.statusIcon, self.moduleSettings.statusIconOffset['x'], self.moduleSettings.statusIconOffset['y']) + self:SetIconAlpha() + else + self.frame.statusIcon:SetTexCoord(0.0625, 0.4475, 0.0625, 0.4375) + end elseif (not self.moduleSettings.showStatusIcon or not self.moduleSettings.showStatusResting) and self.frame.statusIcon and not self.combat then self.frame.statusIcon = self:DestroyTexFrame(self.frame.statusIcon) end @@ -975,17 +979,23 @@ function PlayerHealth.prototype:CheckCombat() end if self.combat or configMode then - if (configMode or (self.moduleSettings.showStatusIcon and self.moduleSettings.showStatusCombat)) and not self.frame.statusIcon then - self.frame.statusIcon = self:CreateTexCoord(self.frame.statusIcon, "Interface\\CharacterFrame\\UI-StateIcon", 20, 20, + if (configMode or (self.moduleSettings.showStatusIcon and self.moduleSettings.showStatusCombat)) then + if not self.frame.statusIcon then + self.frame.statusIcon = self:CreateTexCoord(self.frame.statusIcon, "Interface\\CharacterFrame\\UI-StateIcon", 20, 20, self.moduleSettings.statusIconScale, 0.5625, 0.9375, 0.0625, 0.4375) - self:SetTexLoc(self.frame.statusIcon, self.moduleSettings.statusIconOffset['x'], self.moduleSettings.statusIconOffset['y']) - self:SetIconAlpha() + self:SetTexLoc(self.frame.statusIcon, self.moduleSettings.statusIconOffset['x'], self.moduleSettings.statusIconOffset['y']) + self:SetIconAlpha() + else + self.frame.statusIcon:SetTexCoord(0.5625, 0.9375, 0.0625, 0.4375) + end elseif not configMode and not self.resting and (not self.moduleSettings.showStatusIcon or not self.moduleSettings.showStatusCombat) and self.frame.statusIcon then self.frame.statusIcon = self:DestroyTexFrame(self.frame.statusIcon) end else - if not self.resting and self.frame.statusIcon then + if (not self.resting or not self.moduleSettings.showStatusResting) and self.frame.statusIcon then self.frame.statusIcon = self:DestroyTexFrame(self.frame.statusIcon) + elseif self.resting then + self:Resting() end end end