WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   oUF (Otravi Unit Frames) (https://www.wowinterface.com/forums/forumdisplay.php?f=87)
-   -   oUF_Drk Blue/green bar on PlayerFrame (https://www.wowinterface.com/forums/showthread.php?t=55550)

Linayo 07-05-17 01:35 PM

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.

Layback_ 07-05-17 05:13 PM

I can't be 100% sure, but to me that looks like a HealthPrediction element.

Linayo 07-10-17 12:15 PM

Thank you! it did sort of fix it (still shows RL, ML and the marker icons permanent but thats ok :D )

p3lim 07-10-17 06:09 PM

Quote:

Originally Posted by Linayo (Post 324154)
(still shows RL, ML and the marker icons permanent but thats ok :D )

Please see this:
http://www.wowinterface.com/forums/s...ad.php?t=55422

Aideenwolf 01-25-18 10:55 PM

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



All times are GMT -6. The time now is 07:59 PM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI