From 0420e2510d3ce93485a218c186d9d4e8f68e41f6 Mon Sep 17 00:00:00 2001 From: iceroth Date: Mon, 2 Oct 2006 18:14:43 +0000 Subject: [PATCH] Bugfixes --- IceCore.lua | 2 +- IceHUD.toc | 3 ++- modules/PetHealth.lua | 27 ++++++++++++++++++++-- modules/TargetInfo.lua | 51 +++++++++++++++++++++++++++++++++--------- 4 files changed, 68 insertions(+), 15 deletions(-) diff --git a/IceCore.lua b/IceCore.lua index 0782510..b944f0b 100644 --- a/IceCore.lua +++ b/IceCore.lua @@ -35,7 +35,7 @@ function IceCore.prototype:init() local defaultPreset = "RoundBar" local defaults = { gap = 150, - verticalPos = -150, + verticalPos = -50, scale = 0.9, alphaooc = 0.3, diff --git a/IceHUD.toc b/IceHUD.toc index 4f85459..40d8d86 100644 --- a/IceHUD.toc +++ b/IceHUD.toc @@ -3,7 +3,7 @@ ## Name: IceHUD ## Title: IceHUD |cff7fff7f -Ace2-|r ## Notes: Another HUD mod -## Version: 0.7.2 ($Revision$) +## Version: 0.7.3 ($Revision$) ## SavedVariables: IceCoreDB ## OptionalDeps: Ace2, DewdropLib, FuBar_ToFu, DruidBar, SoleManax, MobHealth, SpellStatusLib ## X-Category: UnitFrame @@ -51,3 +51,4 @@ modules\ComboPoints.lua modules\CastBar.lua modules\MirrorBar.lua modules\TimerBar.lua + diff --git a/modules/PetHealth.lua b/modules/PetHealth.lua index e860f35..0a72caa 100644 --- a/modules/PetHealth.lua +++ b/modules/PetHealth.lua @@ -2,11 +2,16 @@ local AceOO = AceLibrary("AceOO-2.0") local PetHealth = AceOO.Class(IceUnitBar) +PetHealth.prototype.happiness = nil + + -- Constructor -- function PetHealth.prototype:init() PetHealth.super.prototype.init(self, "PetHealth", "pet") - self:SetDefaultColor("PetHealth", 37, 164, 30) + self:SetDefaultColor("PetHealthHappy", 37, 164, 30) + self:SetDefaultColor("PetHealthContent", 164, 164, 30) + self:SetDefaultColor("PetHealthUnhappy", 164, 30, 30) self.scalingEnabled = true end @@ -48,14 +53,26 @@ function PetHealth.prototype:Enable(core) self:RegisterEvent("UNIT_HEALTH", "Update") self:RegisterEvent("UNIT_MAXHEALTH", "Update") + + self:RegisterEvent("UNIT_HAPPINESS", "PetHappiness") self:CheckPet() end +function PetHealth.prototype:PetHappiness(unit) + if (unit and (unit ~= self.unit)) then + return + end + + self.happiness = GetPetHappiness() + self.happiness = self.happiness or 3 -- '3' means happy +end + function PetHealth.prototype:CheckPet() if (UnitExists(self.unit)) then self.frame:Show() + self:PetHappiness(self.unit) self:Update(self.unit) else self.frame:Hide() @@ -69,7 +86,13 @@ function PetHealth.prototype:Update(unit) return end - local color = "PetHealth" + local color = "PetHealthHappy" + if (self.happiness == 2) then + color = "PetHealthContent" + elseif(self.happiness == 1) then + color = "PetHealthUnhappy" + end + if not (self.alive) then color = "Dead" end diff --git a/modules/TargetInfo.lua b/modules/TargetInfo.lua index 2dc21e0..9853ccd 100644 --- a/modules/TargetInfo.lua +++ b/modules/TargetInfo.lua @@ -22,6 +22,7 @@ TargetInfo.prototype.level = nil TargetInfo.prototype.classification = nil TargetInfo.prototype.reaction = nil TargetInfo.prototype.tapped = nil +TargetInfo.prototype.pvpRank = nil TargetInfo.prototype.isPlayer = nil @@ -98,6 +99,26 @@ function TargetInfo.prototype:GetOptions() order = 32 } + opts["stackFontSize"] = { + type = 'range', + name = 'Stack Font Size', + desc = 'Stack Font Size', + get = function() + return self.moduleSettings.stackFontSize + end, + set = function(v) + self.moduleSettings.stackFontSize = v + self:Redraw() + end, + min = 8, + max = 20, + step = 1, + disabled = function() + return not self.moduleSettings.enabled + end, + order = 32 + } + opts["zoom"] = { type = 'range', name = 'Buff zoom', @@ -164,9 +185,10 @@ end function TargetInfo.prototype:GetDefaultSettings() local defaults = TargetInfo.super.prototype.GetDefaultSettings(self) defaults["fontSize"] = 13 + defaults["stackFontSize"] = 11 defaults["vpos"] = -50 - defaults["zoom"] = 0.2 - defaults["buffSize"] = 13 + defaults["zoom"] = 0.08 + defaults["buffSize"] = 14 defaults["mouse"] = true return defaults end @@ -180,6 +202,7 @@ function TargetInfo.prototype:Redraw() self:CreateFrame(true) self:TargetChanged() end + end @@ -384,13 +407,14 @@ function TargetInfo.prototype:CreateIconFrames(parent, direction, buffs, type) buffs[i].icon.texture:ClearAllPoints() buffs[i].icon.texture:SetAllPoints(buffs[i].icon) - - buffs[i].icon.stack = self:FontFactory("Bold", 11, buffs[i].icon) - - buffs[i].icon.stack:ClearAllPoints() - buffs[i].icon.stack:SetPoint("BOTTOMRIGHT" , buffs[i].icon, "BOTTOMRIGHT", 1, -1) end + buffs[i].icon.stack = self:FontFactory("Bold", self.moduleSettings.stackFontSize, buffs[i].icon) + + buffs[i].icon.stack:ClearAllPoints() + buffs[i].icon.stack:SetPoint("BOTTOMRIGHT" , buffs[i].icon, "BOTTOMRIGHT", 1, -1) + + buffs[i].id = i if (self.moduleSettings.mouse) then buffs[i]:EnableMouse(true) @@ -423,8 +447,6 @@ function TargetInfo.prototype:UpdateBuffs() local alpha = buffTexture and 0.5 or 0 self.frame.buffFrame.buffs[i].texture:SetTexture(0, 0, 0, alpha) - self.frame.buffFrame.buffs[i].texture:SetVertexColor(color.r, color.g, color.b) - --buffApplications = 2 @@ -518,6 +540,9 @@ function TargetInfo.prototype:TargetChanged() self.name, self.realm = UnitName(target) self.classLocale, self.classEnglish = UnitClass(target) self.isPlayer = UnitIsPlayer(target) + + local rank = UnitPVPRank(target) + self.pvpRank = (rank >= 5) and rank-4 or nil local classification = UnitClassification(target) if (string.find(classification, "boss")) then @@ -601,10 +626,14 @@ function TargetInfo.prototype:TargetFaction(unit) if (UnitFactionGroup(target) ~= UnitFactionGroup("player")) then color = "ffff1010" -- hostile end - self.pvp = " |c" .. color .. "PvP|r" + self.pvp = " |c" .. color .. "PvP" else - self.pvp = " |cff1010ffPvE|r" + self.pvp = " |cff1010ffPvE" end + + -- add rank + self.pvp = self.pvpRank and (self.pvp .. "/" .. self.pvpRank .. "|r") or (self.pvp .. "|r") + else self.pvp = "" end