Thread Tools Display Modes
07-05-17, 01:35 PM   #1
Linayo
A Deviate Faerie Dragon
AddOn Author - Click to view addons
Join Date: Jul 2012
Posts: 11
oUF_Drk Blue/green bar on PlayerFrame

Hi all,

I'm really struggling to find the part in the Lua Code that was changed recently.
U updated the oUF base to the latest version, but even going back a couple of versions shows the same picture in game.



I think it has something to do with the castbar.lua - probably something that channels has been removed or added? but can't put my finger on it

I'm really sorry if this has been answered somewhere, if you could point me in the right direction here on the forums I'll read up!

Lua Code:
  1. local addon, ns = ...
  2.   local cfg = ns.cfg
  3.   local cast = CreateFrame("Frame")
  4.  
  5.   -----------------------------
  6.   -- FUNCTIONS
  7.   -----------------------------
  8.   -- special thanks to Allez for coming up with this solution
  9. local channelingTicks = {
  10.     -- warlock
  11.     -- druid
  12.     [GetSpellInfo(740)] = 4, -- Tranquility
  13.     -- priest
  14.     [GetSpellInfo(15407)] = 4, -- Mind Flay
  15.     [GetSpellInfo(47540)] = 3, -- Penance
  16.     -- mage
  17.     [GetSpellInfo(5143)] = 5, -- arcane missiles
  18.     [GetSpellInfo(12051)] = 3, -- evocation
  19.     -- monk
  20.     [GetSpellInfo(115175)] = 8, -- soothing mist
  21.     [GetSpellInfo(113656)] = 5, -- fists of fury
  22. }
  23.  
  24. local ticks = {}
  25.  
  26. cast.setBarTicks = function(castBar, ticknum)
  27.     if ticknum and ticknum > 0 then
  28.         local delta = castBar:GetWidth() / ticknum
  29.         for k = 1, ticknum do
  30.             if not ticks[k] then
  31.                 ticks[k] = castBar:CreateTexture(nil, 'OVERLAY')
  32.                 ticks[k]:SetTexture(cfg.statusbar_texture)
  33.                 ticks[k]:SetVertexColor(0.8, 0.6, 0.6)
  34.                 ticks[k]:SetWidth(1)
  35.                 ticks[k]:SetHeight(castBar:GetHeight())
  36.             end
  37.             ticks[k]:ClearAllPoints()
  38.             ticks[k]:SetPoint("CENTER", castBar, "LEFT", delta * k, 0 )
  39.             ticks[k]:Show()
  40.         end
  41.     else
  42.         for k, v in pairs(ticks) do
  43.             v:Hide()
  44.         end
  45.     end
  46. end
  47.  
  48. cast.OnCastbarUpdate = function(self, elapsed)
  49.     local currentTime = GetTime()
  50.     if self.casting or self.channeling then
  51.         local parent = self:GetParent()
  52.         local duration = self.casting and self.duration + elapsed or self.duration - elapsed
  53.         if (self.casting and duration >= self.max) or (self.channeling and duration <= 0) then
  54.             self.casting = nil
  55.             self.channeling = nil
  56.             return
  57.         end
  58.         if parent.unit == 'player' then
  59.             if self.delay ~= 0 then
  60.                 self.Time:SetFormattedText('%.1f | |cffff0000%.1f|r', duration, self.casting and self.max + self.delay or self.max - self.delay)
  61.             else
  62.                 self.Time:SetFormattedText('%.1f | %.1f', duration, self.max)
  63.                 if self.SafeZone and self.SafeZone.timeDiff then
  64.                     self.Lag:SetFormattedText("%d ms", self.SafeZone.timeDiff * 1000)
  65.                 end
  66.             end
  67.         else
  68.             self.Time:SetFormattedText('%.1f | %.1f', duration, self.casting and self.max + self.delay or self.max - self.delay)
  69.         end
  70.         self.duration = duration
  71.         self:SetValue(duration)
  72.         self.Spark:SetPoint('CENTER', self, 'LEFT', (duration / self.max) * self:GetWidth(), 0)
  73.     else
  74.         self.Spark:Hide()
  75.         local alpha = self:GetAlpha() - 0.02
  76.         if alpha > 0 then
  77.             self:SetAlpha(alpha)
  78.         else
  79.             self.fadeOut = nil
  80.             self:Hide()
  81.         end
  82.     end
  83. end
  84.  
  85. cast.OnCastSent = function(self, event, unit, spell, rank)
  86.     if self.unit ~= unit or not self.Castbar.SafeZone then return end
  87.     self.Castbar.SafeZone.sendTime = GetTime()
  88. end
  89.  
  90. cast.PostCastStart = function(self, unit, name, rank, text)
  91.     local pcolor = {1, .5, .5}
  92.     local interruptcb = {.5, .5, 1}
  93.     self:SetAlpha(1.0)
  94.     self.Spark:Show()
  95.     self:SetStatusBarColor(unpack(self.casting and self.CastingColor or self.ChannelingColor))
  96.     if unit == "player" then
  97.         local sf = self.SafeZone
  98.         if sf and sf.sendTime ~= nil then
  99.             sf.timeDiff = GetTime() - sf.sendTime
  100.             sf.timeDiff = sf.timeDiff > self.max and self.max or sf.timeDiff
  101.             sf:SetWidth(self:GetWidth() * sf.timeDiff / self.max)
  102.             sf:Show()
  103.         end
  104.  
  105.         if self.casting then
  106.             cast.setBarTicks(self, 0)
  107.         else
  108.             local spell = UnitChannelInfo(unit)
  109.             self.channelingTicks = channelingTicks[spell] or 0
  110.             cast.setBarTicks(self, self.channelingTicks)
  111.         end
  112.     elseif (unit == "target" or unit == "focus") and not self.interrupt then
  113.         self:SetStatusBarColor(interruptcb[1],interruptcb[2],interruptcb[3],1)
  114.     else
  115.         self:SetStatusBarColor(pcolor[1], pcolor[2], pcolor[3],1)
  116.     end
  117. end
  118.  
  119. cast.PostCastStop = function(self, unit, name, rank, castid)
  120.     if not self.fadeOut then
  121.         self:SetStatusBarColor(unpack(self.CompleteColor))
  122.         self.fadeOut = true
  123.     end
  124.     self:SetValue(self.max)
  125.     self:Show()
  126. end
  127.  
  128. cast.PostChannelStop = function(self, unit, name, rank)
  129.     self.fadeOut = true
  130.     self:SetValue(0)
  131.     self:Show()
  132. end
  133.  
  134. cast.PostCastFailed = function(self, event, unit, name, rank, castid)
  135.     self:SetStatusBarColor(unpack(self.FailColor))
  136.     self:SetValue(self.max)
  137.     if not self.fadeOut then
  138.         self.fadeOut = true
  139.     end
  140.     self:Show()
  141. end
  142.   --hand the lib to the namespace for further usage
  143.   ns.cast = cast

thanks in advance for anyone who is trying to help me, much appreciated.
  Reply With Quote
07-05-17, 05:13 PM   #2
Layback_
An Onyxian Warder
Join Date: Feb 2016
Posts: 358
I can't be 100% sure, but to me that looks like a HealthPrediction element.
  Reply With Quote
07-10-17, 12:15 PM   #3
Linayo
A Deviate Faerie Dragon
AddOn Author - Click to view addons
Join Date: Jul 2012
Posts: 11
Thank you! it did sort of fix it (still shows RL, ML and the marker icons permanent but thats ok )
  Reply With Quote
07-10-17, 06:09 PM   #4
p3lim
A Pyroguard Emberseer
 
p3lim's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2007
Posts: 1,710
Originally Posted by Linayo View Post
(still shows RL, ML and the marker icons permanent but thats ok )
Please see this:
http://www.wowinterface.com/forums/s...ad.php?t=55422
  Reply With Quote
01-25-18, 10:55 PM   #5
Aideenwolf
A Murloc Raider
Join Date: Feb 2007
Posts: 8
Sorry to ress an old thread - but I'm having the same issue in the picture. I figured I could turn it off in the config but I rather like the overall combined healing display when i'm on my druid. Wracked my brain but I really don't quite get the LUA code enough to figure where i'm going wrong.

The worse thing is it's not throwing off a bug error so I can't go HA! That line!

Edit: Figured it out >< I never changed the function name >< -- so if anyone is wondering how to fix the health prediction code:


Core.Lua
Code:
function core.HealthPrediction_Override(self, event, unit)
	if self.unit ~= unit then return end

	local element = self.HealthPrediction
	local parent = self.Health

	local health, maxHealth = UnitHealth(unit), UnitHealthMax(unit)
	if maxHealth == 0 or UnitIsDeadOrGhost(unit) then
		element.healingBar:Hide()
		element.absorbsBar:Hide()
		return
	end

	local missing = maxHealth - health
	local healing = UnitGetIncomingHeals(unit) or 0

	if (healing / maxHealth) >= 0.01 and missing > 0 then
		local bar = element.healingBar
		bar:Show()
		bar:SetMinMaxValues(0, maxHealth)
		if healing > missing then
			bar:SetValue(missing)
			missing = 0
		else
			bar:SetValue(healing)
			missing = missing - healing
		end
		parent = bar
	else
		element.healingBar:Hide()
	end

	local absorbs = UnitGetTotalAbsorbs(unit) or 0
	if (absorbs / maxHealth) >= 0.01 and missing > 0 then
		local bar = element.absorbsBar
		bar:Show()
		bar:SetPoint("TOPLEFT", parent:GetStatusBarTexture(), "TOPRIGHT")
		bar:SetPoint("BOTTOMLEFT", parent:GetStatusBarTexture(), "BOTTOMRIGHT")
		bar:SetMinMaxValues(0, maxHealth)
		if absorbs > missing then
			bar:SetValue(missing)
		else
			bar:SetValue(absorbs)
		end
	else
		element.absorbsBar:Hide()
	end
end
Player/Target/Raid Frame
Code:
-- HealthPrediction 
....

		self.HealthPrediction = {
			healingBar = healing,
			absorbsBar = absorbs,
			Override = core.HealthPrediction_Override
		}
	end

Last edited by Aideenwolf : 01-26-18 at 12:51 AM.
  Reply With Quote

WoWInterface » Featured Projects » oUF (Otravi Unit Frames) » oUF_Drk Blue/green bar on PlayerFrame

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off