Download
(2 Kb)
Download
Updated: 08-26-12 11:24 PM
Compatibility:
Mists of Pandaria (5.0.4)
Updated:08-26-12 11:24 PM
Created:07-02-12 12:42 AM
Downloads:1,466
Favorites:6
MD5:
oUF Warlock Specs Bars
Version: 1.00
by: tukz [More]
Little oUF plugin for Warlock and their specific class bar according to their spec on MoP Beta. This is not yet include in oUF so I've made a couple of weeks ago a plugin for it. Haste will probably include this feature in oUF at a later date so this plugin is just for helping oUF layout editor temporary on 5.0.4 with their oUF layouts.

Layout Example:

Code:
-- Warlock Spec Bars
if select(2, UnitClass("player")) == "WARLOCK" then
	local wb = CreateFrame("Frame", "TukuiWarlockSpecBars", self)
	wb:SetPoint("BOTTOMLEFT", self, "TOPLEFT", 0, 1)
	wb:SetWidth(250)
	wb:SetHeight(8)
	wb:SetBackdrop({
	  bgFile = texture, 
	  edgeFile = C.media.blank, 
	  tile = false, tileSize = 0, edgeSize = 1, 
	  insets = { left = -1, right = -1, top = -1, bottom = -1}
	})
	wb:SetBackdropColor(unpack(C.media.backdropcolor))
	wb:SetBackdropBorderColor(unpack(C.media.backdropcolor))
	
	for i = 1, 4 do
		wb[i] = CreateFrame("StatusBar", "TukuiWarlockSpecBars"..i, wb)
		wb[i]:SetHeight(8)
		wb[i]:SetStatusBarTexture(C.media.normTex)
		
		if i == 1 then
			wb[i]:SetWidth((250 / 4) - 2)
			wb[i]:SetPoint("LEFT", wb, "LEFT", 0, 0)
		else
			wb[i]:SetWidth((250 / 4) - 1)
			wb[i]:SetPoint("LEFT", wb[i-1], "RIGHT", 1, 0)
		end
	end
	
	self.WarlockSpecBars = wb				
end
-- 27/08/2012
-----> 1 or 2 bugs fixes
-----> Bar colors is now matching spec
-----> Last update before 5.0.4 hit live server. Warlock class bar won't be in oUF the day 5.0.4 will hit live server so this can be used as an alternative. This version was tested by various oUF layout editor and no issues reported with this version.

-- 16/07/2012
-----> cleanup & better codes

-- 13/07/2012
-----> plugin rewrite
Optional Files (0)


Post A Reply Comment Options
Unread 01-27-14, 12:08 PM  
riph
A Murloc Raider
AddOn Author - Click to view AddOns

Forum posts: 5
File comments: 7
Uploads: 1
Trying to use this module for oUF, however my last point for burning embers/soul shard always appears larger than the first 3.

Lua Code:
  1. lib.gen_warlock_bars = function(f)
  2.   local wb = CreateFrame("Frame", "WarlockSpecBars", f)
  3.   wb:SetPoint("BOTTOMLEFT", f.Health, "TOPLEFT", 0, 3)
  4.   wb:SetWidth(f.width)
  5.   wb:SetHeight(f.height/5)
  6.  
  7.   for i = 1, 4 do
  8.     wb[i] = CreateFrame("StatusBar", "WarlockSpecBars"..i, wb)
  9.  
  10.     lib.gen_backdrop(wb[i])
  11.  
  12.     wb[i]:SetHeight(6)
  13.     wb[i]:SetStatusBarTexture(cfg.statusbar_texture)
  14.  
  15.     wb[i].border = lib.gen_border(wb[i])
  16.  
  17.     local point = wb[i]
  18.  
  19.     if i == 1 then
  20.       point:SetWidth((f.width/4) - 2)
  21.       point:SetPoint("LEFT", wb, "LEFT", 0, 1)
  22.     else
  23.       point:SetWidth((f.width/4) - 1)
  24.       point:SetPoint("LEFT", wb[i-1], "RIGHT", 3, 0)
  25.     end
  26.   end
  27.  
  28.   f.WarlockSpecBars = wb
  29. end

Example:

riph is offline Report comment to moderator  
Reply With Quote
Unread 05-27-13, 12:29 PM  
Aerials
A Warpwood Thunder Caller
AddOn Author - Click to view AddOns

Forum posts: 92
File comments: 79
Uploads: 4
5.2 / 5.3 changes...

Hello, I hope you aren't upsetted by me posting this, but the addon is currently outdated... Here is what I've done to get it working properly for me, incase people want it to work properly until it gets updated (It's currently 2 patches behind the times).

my copy of oUF_WarlockSpecBars.lua:
Lua Code:
  1. local _, ns = ...
  2. local oUF = ns.oUF or oUF
  3. assert(oUF, "oUF_WarlockSpecBars was unable to locate oUF install")
  4.  
  5. if select(2, UnitClass("player")) ~= "WARLOCK" then return end
  6.  
  7. local MAX_POWER_PER_EMBER = 10
  8. local SPELL_POWER_DEMONIC_FURY = SPELL_POWER_DEMONIC_FURY
  9. local SPELL_POWER_BURNING_EMBERS = SPELL_POWER_BURNING_EMBERS
  10. local SPELL_POWER_SOUL_SHARDS = SPELL_POWER_SOUL_SHARDS
  11. local SPEC_WARLOCK_DESTRUCTION = SPEC_WARLOCK_DESTRUCTION
  12. -- local SPEC_WARLOCK_DESTRUCTION_GLYPH_EMBERS = 63304
  13. local SPEC_WARLOCK_AFFLICTION = SPEC_WARLOCK_AFFLICTION
  14. -- local SPEC_WARLOCK_AFFLICTION_GLYPH_SHARDS = 63302
  15. local SPEC_WARLOCK_DEMONOLOGY = SPEC_WARLOCK_DEMONOLOGY
  16. local LATEST_SPEC = 0
  17. local wasMax = false
  18.  
  19. local Colors = {
  20.     [1] = {148/255, 130/255, 201/255, 1}, -- Shards
  21.     [2] = {150/255, 50/255,  150/255, 1}, -- Fury
  22.     [3] = {222/255, 95/255,  95/255, 1}, -- Embers
  23.     [4] = {225/255, 115/255,  225/255, 1}, -- Full Fury 222 150 222
  24.     [5] = {95/255, 222/255,  95/255, 1}, -- Green Embers?
  25. }
  26.  
  27. local Update = function(self, event, unit, powerType)
  28.     if(self.unit ~= unit or (powerType and powerType ~= "BURNING_EMBERS" and powerType ~= "SOUL_SHARDS" and powerType ~= "DEMONIC_FURY")) then return end
  29.  
  30.     local wsb = self.WarlockSpecBars
  31.     if(wsb.PreUpdate) then wsb:PreUpdate(unit) end
  32.    
  33.     local spec = GetSpecialization()
  34.    
  35.     if spec then
  36.         if (spec == SPEC_WARLOCK_DESTRUCTION) then 
  37.             local maxPower = UnitPowerMax("player", SPELL_POWER_BURNING_EMBERS, true)
  38.             local power = UnitPower("player", SPELL_POWER_BURNING_EMBERS, true)
  39.             local numEmbers = power / MAX_POWER_PER_EMBER
  40.             local numBars = 4 --floor(maxPower / MAX_POWER_PER_EMBER)
  41.            
  42.             for i = 1, numBars do
  43.                 wsb[i]:SetMinMaxValues((MAX_POWER_PER_EMBER * i) - MAX_POWER_PER_EMBER, MAX_POWER_PER_EMBER * i)
  44.                 wsb[i]:SetValue(power)
  45.             end
  46.         elseif ( spec == SPEC_WARLOCK_AFFLICTION ) then
  47.             local numShards = UnitPower("player", SPELL_POWER_SOUL_SHARDS)
  48.             local maxShards = 4 --UnitPowerMax("player", SPELL_POWER_SOUL_SHARDS)
  49.            
  50.             for i = 1, maxShards do
  51.                 if i <= numShards then
  52.                     wsb[i]:SetAlpha(1)
  53.                 else
  54.                     wsb[i]:SetAlpha(.2)
  55.                 end
  56.             end
  57.         elseif spec == SPEC_WARLOCK_DEMONOLOGY then
  58.             local power = UnitPower("player", SPELL_POWER_DEMONIC_FURY)
  59.             local maxPower = UnitPowerMax("player", SPELL_POWER_DEMONIC_FURY)
  60.             wsb[1]:SetMinMaxValues(0, maxPower)
  61.             wsb[1]:SetValue(power)
  62.            
  63.             if power >= (maxPower - 20) then wasMax = true end
  64.             if power <= 20 then wasMax = false end
  65.             if wasMax == false then
  66.                 wsb[1]:SetStatusBarColor(unpack(Colors[SPEC_WARLOCK_DEMONOLOGY]))
  67.                 if wsb[1].bg then wsb[1].bg:SetAlpha(0.15) wsb[1].bg:SetTexture(unpack(Colors[SPEC_WARLOCK_DEMONOLOGY])) end
  68.             elseif wasMax == true then
  69.                 wsb[1]:SetStatusBarColor(unpack(Colors[SPEC_WARLOCK_DEMONOLOGY + 2]))
  70.                 if wsb[1].bg then wsb[1].bg:SetAlpha(0.15) wsb[1].bg:SetTexture(unpack(Colors[SPEC_WARLOCK_DEMONOLOGY + 2])) end
  71.             end
  72.         end
  73.     end
  74.  
  75.     if(wsb.PostUpdate) then
  76.         return wsb:PostUpdate(spec)
  77.     end
  78. end
  79.  
  80. local function Visibility(self, event, unit)
  81.     local wsb = self.WarlockSpecBars
  82.     local spacing = select(4, wsb[4]:GetPoint())
  83.     local w = wsb:GetWidth()
  84.     local s = 0
  85.    
  86.     local spec = GetSpecialization()
  87.     if spec then
  88.         if not wsb:IsShown() then
  89.             wsb:Show()
  90.         end
  91.        
  92.         if LATEST_SPEC ~= spec then
  93.             for i = 1, 4 do
  94.                 local max = select(2, wsb[i]:GetMinMaxValues())
  95.                 if spec == SPEC_WARLOCK_AFFLICTION then
  96.                     wsb[i]:SetValue(max)
  97.                 else
  98.                     wsb[i]:SetValue(0)
  99.                 end
  100.                 wsb[i]:Show()
  101.                 if wsb[i].bg then wsb[i].bg:SetAlpha(0.15) end
  102.             end
  103.         end
  104.        
  105.         if spec == SPEC_WARLOCK_DESTRUCTION then
  106.             local maxembers = 4 -- 3. They got rid of the glyph and made 4 baseline.
  107.             --[[
  108.             for i = 1, GetNumGlyphSockets() do
  109.                 local glyphID = select(4, GetGlyphSocketInfo(i))
  110.                 if glyphID == SPEC_WARLOCK_DESTRUCTION_GLYPH_EMBERS then maxembers = 4 end
  111.             end        
  112.             --]]
  113.             for i = 1, maxembers do
  114.                 if i ~= maxembers then
  115.                     wsb[i]:SetWidth(w / maxembers - spacing)
  116.                     s = s + (w / maxembers)
  117.                 else
  118.                     wsb[i]:SetWidth(w - s)
  119.                 end
  120.                 wsb[i]:SetStatusBarColor(unpack(Colors[SPEC_WARLOCK_DESTRUCTION]))
  121.                 if wsb[i].bg then wsb[i].bg:SetAlpha(0.15) wsb[i].bg:SetTexture(unpack(Colors[SPEC_WARLOCK_DESTRUCTION])) end
  122.             end
  123.            
  124.             if maxembers == 3 then wsb[4]:Hide() else wsb[4]:Show() end
  125.         elseif spec == SPEC_WARLOCK_AFFLICTION then
  126.             local maxshards = 4 -- 3. They got rid of the glyph and made 4 baseline.
  127.             --[[
  128.             for i = 1, GetNumGlyphSockets() do
  129.                 local glyphID = select(4, GetGlyphSocketInfo(i))
  130.                 if glyphID == SPEC_WARLOCK_AFFLICTION_GLYPH_SHARDS then maxshards = 4 end
  131.             end        
  132.             --]]
  133.             for i = 1, maxshards do
  134.                 if i ~= maxshards then
  135.                     wsb[i]:SetWidth(w / maxshards - spacing)
  136.                     s = s + (w / maxshards)
  137.                 else
  138.                     wsb[i]:SetWidth(w - s)
  139.                 end
  140.                 wsb[i]:SetStatusBarColor(unpack(Colors[SPEC_WARLOCK_AFFLICTION]))
  141.                 if wsb[i].bg then wsb[i].bg:SetAlpha(0) end
  142.             end
  143.            
  144.             if maxshards == 3 then wsb[4]:Hide() else wsb[4]:Show() end
  145.         elseif spec == SPEC_WARLOCK_DEMONOLOGY then
  146.             wsb[2]:Hide()
  147.             wsb[3]:Hide()
  148.             wsb[4]:Hide()
  149.             wsb[1]:SetWidth(wsb:GetWidth())
  150.             local power = UnitPower("player", SPELL_POWER_DEMONIC_FURY)
  151.             local maxPower = UnitPowerMax("player", SPELL_POWER_DEMONIC_FURY)
  152.             if power >= (maxPower - 20) then wasMax = true end
  153.             if power <= 20 then wasMax = false end
  154.            
  155.             if wasMax == false then
  156.                 wsb[1]:SetStatusBarColor(unpack(Colors[SPEC_WARLOCK_DEMONOLOGY]))
  157.                 if wsb[1].bg then wsb[1].bg:SetAlpha(0.15) wsb[1].bg:SetTexture(unpack(Colors[SPEC_WARLOCK_DEMONOLOGY])) end
  158.             elseif wasMax == true then
  159.                 wsb[1]:SetStatusBarColor(unpack(Colors[SPEC_WARLOCK_DEMONOLOGY + 2]))
  160.                 if wsb[1].bg then wsb[1].bg:SetAlpha(0.15) wsb[1].bg:SetTexture(unpack(Colors[SPEC_WARLOCK_DEMONOLOGY + 2])) end
  161.             end
  162.         end
  163.        
  164.         -- force an update each time we respec
  165.         Update(self, nil, "player")
  166.     else
  167.         if wsb:IsShown() then
  168.             wsb:Hide()
  169.         end
  170.     end
  171.    
  172.     LATEST_SPEC = spec
  173. end
  174.  
  175. local Path = function(self, ...)
  176.     return (self.WarlockSpecBars.Override or Update) (self, ...)
  177. end
  178.  
  179. local ForceUpdate = function(element)
  180.     return Path(element.__owner, "ForceUpdate", element.__owner.unit, "SOUL_SHARDS")
  181. end
  182.  
  183. local function Enable(self)
  184.     local wsb = self.WarlockSpecBars
  185.     if(wsb) then
  186.         wsb.__owner = self
  187.         wsb.ForceUpdate = ForceUpdate
  188.  
  189.         self:RegisterEvent("UNIT_POWER", Path)
  190.         self:RegisterEvent("UNIT_DISPLAYPOWER", Path)
  191.  
  192.         -- why the fuck does PLAYER_TALENT_UPDATE doesnt trigger on initial login if we register to: self or self.PluginName
  193.         wsb.Visibility = CreateFrame("Frame", nil, wsb)
  194.         wsb.Visibility:RegisterEvent("PLAYER_TALENT_UPDATE")
  195.         wsb.Visibility:RegisterEvent("PLAYER_ENTERING_WORLD")
  196.         wsb.Visibility:SetScript("OnEvent", function(frame, event, unit) Visibility(self, event, unit) end)
  197.  
  198.         for i = 1, 4 do
  199.             local Point = wsb[i]
  200.             if not Point:GetStatusBarTexture() then
  201.                 Point:SetStatusBarTexture([=[Interface\TargetingFrame\UI-StatusBar]=])
  202.             end
  203.            
  204.             Point:SetFrameLevel(wsb:GetFrameLevel() + 1)
  205.             Point:GetStatusBarTexture():SetHorizTile(false)
  206.            
  207.             if Point.bg then
  208.                 Point.bg:SetAllPoints()
  209.             end
  210.         end
  211.        
  212.         wsb:Hide()
  213.  
  214.         return true
  215.     end
  216. end
  217.  
  218. local function Disable(self)
  219.     local wsb = self.WarlockSpecBars
  220.     if(wsb) then
  221.         self:UnregisterEvent("UNIT_POWER", Path)
  222.         self:UnregisterEvent("UNIT_DISPLAYPOWER", Path)
  223.         wsb.Visibility:UnregisterEvent("PLAYER_TALENT_UPDATE")
  224.     end
  225. end
  226.  
  227. oUF:AddElement("WarlockSpecBars", Path, Enable, Disable)
Aerials is offline Report comment to moderator  
Reply With Quote
Unread 09-09-12, 10:07 PM  
siweia
A Deviate Faerie Dragon
AddOn Author - Click to view AddOns

Forum posts: 14
File comments: 36
Uploads: 3
Hello, thanks for your work.
But I just wonder that would you mind to add a percentage of currently "SPELL_POWER_DEMONIC_FURY"?
Just like the eclipsebar
siweia is offline Report comment to moderator  
Reply With Quote
Unread 09-02-12, 01:26 PM  
Sockz0r
A Defias Bandit
AddOn Author - Click to view AddOns

Forum posts: 2
File comments: 644
Uploads: 5
Originally Posted by siweia
Originally Posted by tukz
Originally Posted by Sockz0r
doesnt seem to appear when you log into the world or reload the UI. it does reappear when you change spec though, any ideas? or am i doing something wrong :P
This was fixed in my latest update made couple of hours ago, just download the updated zip.
still not work here.

but I added this
Code:
self:RegisterEvent("PLAYER_ENTERING_WORLD", Visibility)
and now it can appear when firstly entering world
excellent! <3
Sockz0r is offline Report comment to moderator  
Reply With Quote
Unread 09-02-12, 11:52 AM  
siweia
A Deviate Faerie Dragon
AddOn Author - Click to view AddOns

Forum posts: 14
File comments: 36
Uploads: 3
Originally Posted by tukz
Originally Posted by Sockz0r
doesnt seem to appear when you log into the world or reload the UI. it does reappear when you change spec though, any ideas? or am i doing something wrong :P
This was fixed in my latest update made couple of hours ago, just download the updated zip.
still not work here.

but I added this
Code:
self:RegisterEvent("PLAYER_ENTERING_WORLD", Visibility)
and now it can appear when firstly entering world
siweia is offline Report comment to moderator  
Reply With Quote
Unread 09-02-12, 04:12 AM  
badgery
A Kobold Labourer

Forum posts: 0
File comments: 19
Uploads: 0
How do you install this plug-in and make it work please?
badgery is offline Report comment to moderator  
Reply With Quote
Unread 08-27-12, 02:27 PM  
Sockz0r
A Defias Bandit
AddOn Author - Click to view AddOns

Forum posts: 2
File comments: 644
Uploads: 5
have done, no luck

version 1.03 according to the TOC file
Sockz0r is offline Report comment to moderator  
Reply With Quote
Unread 08-27-12, 08:31 AM  
tukz
A Fallenroot Satyr
 
tukz's Avatar
AddOn Author - Click to view AddOns

Forum posts: 20
File comments: 50
Uploads: 6
Originally Posted by Sockz0r
doesnt seem to appear when you log into the world or reload the UI. it does reappear when you change spec though, any ideas? or am i doing something wrong :P
This was fixed in my latest update made couple of hours ago, just download the updated zip.
tukz is offline Report comment to moderator  
Reply With Quote
Unread 08-27-12, 03:57 AM  
Sockz0r
A Defias Bandit
AddOn Author - Click to view AddOns

Forum posts: 2
File comments: 644
Uploads: 5
doesnt seem to appear when you log into the world or reload the UI. it does reappear when you change spec though, any ideas? or am i doing something wrong :P
Sockz0r is offline Report comment to moderator  
Reply With Quote
Unread 07-14-12, 01:29 AM  
Sockz0r
A Defias Bandit
AddOn Author - Click to view AddOns

Forum posts: 2
File comments: 644
Uploads: 5
awesome thanks! now i can finish off the unit frames

once i download the entire client again cause blizzard suck :<
Sockz0r is offline Report comment to moderator  
Reply With Quote
Unread 07-02-12, 06:47 AM  
Haleth
This Space For Rent
 
Haleth's Avatar
WoWInterface Super Moderator
AddOn Author - Click to view AddOns

Forum posts: 1163
File comments: 1108
Uploads: 29
Just what I needed.
Haleth is offline Report comment to moderator  
Reply With Quote
Post A Reply



Category Jump: