03-22-10, 10:01 AM | #1 |
Aura Duration
Hi
I'm using oUF_Itchy-pal at the moment, and I'd like to make it show my (player) buffs and debuffs. I was able to make the icons show but I'd also like it to show the duration left. Right now I have the cooldown spiral and OmniCC text but I'd like to have a text string with MM:SS left on the (de)buff. This is the first time I modified oUF and I couldn't figure it out. (I think this is the part where I should be looking) Code:
local auraIcon = function(self, button, icons) icons.showDebuffType = true -- show debuff border type color button.icon:SetTexCoord(.07, .93, .07, .93) button.icon:SetPoint("TOPLEFT", button, "TOPLEFT", 1, -1) button.icon:SetPoint("BOTTOMRIGHT", button, "BOTTOMRIGHT", -1, 1) button.overlay:SetTexture(bufftex) button.overlay:SetTexCoord(0,1,0,1) button.overlay.Hide = function(self) self:SetVertexColor(0.15, 0.15, 0.15) end button.cd:SetReverse() button.cd:SetPoint("TOPLEFT", button, "TOPLEFT", 2, -2) button.cd:SetPoint("BOTTOMRIGHT", button, "BOTTOMRIGHT", -2, 2) end Code:
-- ------------------------------------ -- player -- ------------------------------------ if unit=="player" then self:SetWidth(186) self:SetHeight(13) self.Health:SetHeight(10.5) self.Health.value:SetPoint("RIGHT", 0, 9) self.Power:SetHeight(1.5) self.Power.value:SetPoint("LEFT", self.Health, 0, 9) self.Power.value:SetJustifyH"LEFT" self.Level:Hide() self.Name:Hide() -- leader icon self.Leader = self.Health:CreateTexture(nil, "OVERLAY") self.Leader:SetHeight(12) self.Leader:SetWidth(12) self.Leader:SetPoint("BOTTOMRIGHT", self, -2, 4) self.Leader:SetTexture"Interface\\GroupFrame\\UI-Group-LeaderIcon" -- raid target icons self.RaidIcon = self.Health:CreateTexture(nil, "OVERLAY") self.RaidIcon:SetHeight(16) self.RaidIcon:SetWidth(16) self.RaidIcon:SetPoint("TOP", self, 0, 9) self.RaidIcon:SetTexture"Interface\\TargetingFrame\\UI-RaidTargetingIcons" -- buffs self.Buffs = CreateFrame("Frame", "buffs", self) self.Buffs.size = 30 self.Buffs:SetHeight(self.Buffs.size) self.Buffs:SetWidth(self.Buffs.size * 10) self.Buffs:SetPoint("TOPRIGHT", "UIParent", "TOPRIGHT", -27, -30) self.Buffs.initialAnchor = "TOPRIGHT" self.Buffs["growth-x"] = "LEFT" self.Buffs["growth-y"] = "BOTTOM" self.Buffs.num = 20 self.Buffs.spacing = 10 self.Buffs:Show() end |
|
03-22-10, 10:58 AM | #2 |
You need to change the behaviour of OmniCC or drop it completely and write a counter yourself.
|
|
03-22-10, 11:07 AM | #3 | |
Code:
button.cd.noCooldownCount = true Last edited by Freebaser : 03-22-10 at 11:11 AM. Reason: its "noCooldownCount" |
||
03-22-10, 11:13 AM | #4 |
I believe I put a wrong meaning on the "drop it completely" part ^^
|
|
03-23-10, 08:34 AM | #5 |
Ok, I was able to make the duration show up using some code from oUF_Caellian. Is there a way the only show the duration on my (player) (de)buffs? I don't want to know the duration on my target buffs etc.
Also, is there some oUF API documentation somewhere I could read? (code, in case someone has a similar question) Code:
-- ------------------------------------------------------------------------ -- aura reskin -- ------------------------------------------------------------------------ local auraIcon = function(self, button, icons) icons.showDebuffType = true -- show debuff border type color button.icon:SetTexCoord(.07, .93, .07, .93) button.icon:SetPoint("TOPLEFT", button, "TOPLEFT", 1, -1) button.icon:SetPoint("BOTTOMRIGHT", button, "BOTTOMRIGHT", -1, 1) button.overlay:SetTexture(bufftex) button.overlay:SetPoint("TOPLEFT", button, "TOPLEFT", -1, 1) button.overlay:SetPoint("BOTTOMRIGHT", button, "BOTTOMRIGHT", 1, -1) button.overlay:SetTexCoord(0,1,0,1) button.overlay.Hide = function(self) self:SetVertexColor(0.15, 0.15, 0.15) end button.cd.noOCC = true button.cd.noCooldownCount = true icons.disableCooldown = true button.cd:SetReverse() button.cd:SetPoint("TOPLEFT", button, "TOPLEFT", 2, -2) button.cd:SetPoint("BOTTOMRIGHT", button, "BOTTOMRIGHT", -2, 2) button.remaining = SetFontString(button, font, 10, "OUTLINE") button.remaining:SetPoint("bottom", 0, -10) end local CreateAuraTimer = function(self,elapsed) if self.timeLeft then self.elapsed = (self.elapsed or 0) + elapsed if self.elapsed >= 0.1 then if not self.first then self.timeLeft = self.timeLeft - self.elapsed else self.timeLeft = self.timeLeft - GetTime() self.first = false end if self.timeLeft > 0 then local time = FormatTime(self.timeLeft) -- if type(time) == "string" or time >= 10 then self.remaining:SetText(time) -- else -- self.remaining:SetFormattedText("%.1f", time) -- end self.remaining:SetTextColor(0.84, 0.75, 0.65) else self.remaining:Hide() self:SetScript("OnUpdate", nil) end self.elapsed = 0 end end end local UpdateAura = function(self, icons, unit, icon, index) local _, _, _, _, _, duration, expirationTime, unitCaster, _ = UnitAura(unit, index, icon.filter) if unitCaster == "player" or unitCaster == "pet" or unitCaster == "vehicle" then if icon.debuff then icon.overlay:SetVertexColor(0.69, 0.31, 0.31) else icon.overlay:SetVertexColor(0.33, 0.59, 0.33) end else if UnitIsEnemy("player", unit) then if icon.debuff then icon.icon:SetDesaturated(true) end end icon.overlay:SetVertexColor(0.25, 0.25, 0.25) end if duration and duration > 0 then icon.remaining:Show() else icon.remaining:Hide() end icon.duration = duration icon.timeLeft = expirationTime icon.first = true icon:SetScript("OnUpdate", CreateAuraTimer) end Code:
--Font stuff local SetFontString = function(parent, fontName, fontHeight, fontStyle) local fs = parent:CreateFontString(nil, "OVERLAY") fs:SetFont(fontName, fontHeight, fontStyle) fs:SetJustifyH("LEFT") fs:SetShadowColor(0, 0, 0) fs:SetShadowOffset(1.25, -1.25) return fs end local FormatTime = function(s) local day, hour, minute = 86400, 3600, 60 if s >= day then return format("%dd", floor(s/day + 0.5)), s % day elseif s >= hour then return format("%dh", floor(s/hour + 0.5)), s % hour elseif s >= minute then if s <= minute * 5 then return format("%d:%02d", floor(s/60), s % minute), s - floor(s) end return format("%dm", floor(s/minute + 0.5)), s % minute elseif s >= minute / 12 then return floor(s + 0.5), (s * 100 - floor(s * 100))/100 end return format("%.1f", s), (s * 100 - floor(s * 100))/100 end Code:
self.PostCreateAuraIcon = auraIcon self.PostUpdateAuraIcon = UpdateAura |
|
WoWInterface » Featured Projects » oUF (Otravi Unit Frames) » Aura Duration |
«
Previous Thread
|
Next Thread
»
|
Display Modes |
Linear Mode |
Switch to Hybrid Mode |
Switch to Threaded Mode |
|
|