08-18-12, 07:33 PM | #1 |
Player Frame Holy Power
tryd to work with this element, knocked it under modules.. got art section done.. need to console reload atleast once ingame to get them to work
here's the code of core this is where i added icons and artwork for now, i know this is where it bugs hp , mana bars show white at first load no hp power at kick off it does work perfect after i do the console reload , just not on first kick off i know its in there where its bugging element i used (and included in toc) https://github.com/haste/oUF/blob/ma.../holypower.lua Code:
-- // BurlexUI_Player --get the addon namespace local addon, ns = ... local base_player = [[Interface\AddOns\BurlexUI_Player\media\base_player]] local holy_pawer = [[Interface\AddOns\BurlexUI_Player\media\hpawer]] local holy_power = [[Interface\AddOns\BurlexUI_Player\media\hpower]] --get the config values local cfg = ns.cfg --get the library local frame_player = ns.libply --fix oUF mana color oUF.colors.power["MANA"] = {0, 0.4, 0.9} ----------------------------- -- STYLE FUNCTIONS ----------------------------- --init func local initHeader = function(self) self.menu = frame_player.menu self:RegisterForClicks("AnyUp") self:SetAttribute("*type2", "menu") self:SetScript("OnEnter", UnitFrame_OnEnter) self:SetScript("OnLeave", UnitFrame_OnLeave) if self.mystyle == "player" then frame_player.gen_hpbar(self) frame_player.gen_hpstrings(self) frame_player.gen_ppbar(self) elseif self.mystyle == "target" then frame_target.gen_hpbar(self) frame_target.gen_hpstrings(self) frame_target.gen_ppbar(self) elseif self.mystyle == "tot" then frame_tot.gen_hpbar(self) frame_tot.gen_hpstrings(self) frame_tot.gen_ppbar(self) elseif self.mystyle == "focus" then frame_focus.gen_hpbar(self) frame_focus.gen_hpstrings(self) frame_focus.gen_ppbar(self) elseif self.mystyle == "pet" then frame_pet.gen_hpbar(self) frame_pet.gen_hpstrings(self) frame_pet.gen_ppbar(self) elseif self.mystyle == "party" then frame_party.gen_hpbar(self) frame_party.gen_hpstrings(self) frame_party.gen_ppbar(self) elseif self.mystyle == "raid" then frame_raid.gen_hpbar(self) frame_raid.gen_hpstrings(self) frame_raid.gen_ppbar(self) end end --init func local init = function(self) self:SetSize(self.width, self.height) self:SetPoint("CENTER",UIParent,"CENTER",0,0) initHeader(self) end -------------------------------------------------------------------------------------------------------------------- -- Player Frame -------------------------------------------------------------------------------------------------------------------- local function CreatePlayerStyle(self) self:SetWidth(256); self:SetHeight(128); -- artwork do -- setup base artwork local artwork = CreateFrame("Frame", nil, self); artwork:SetFrameStrata("BACKGROUND"); artwork:SetFrameLevel(0); artwork:SetAllPoints(self); artwork.bg = artwork:CreateTexture(nil, "BACKGROUND"); artwork.bg:SetPoint("CENTER"); artwork.bg:SetTexture(base_player); end do -- art icons local articon = CreateFrame("Frame", nil, self); articon:SetFrameStrata("BACKGROUND"); articon:SetFrameLevel(3); articon:SetAllPoints(self); -- Party Leader Icon self.Leader = articon:CreateTexture(nil,"BORDER"); self.Leader:SetWidth(18); self.Leader:SetHeight(18); self.Leader:SetPoint("CENTER",articon,"CENTER",-72,51); -- Master Looter Icon self.MasterLooter = articon:CreateTexture(nil,"BORDER"); self.MasterLooter:SetWidth(16); self.MasterLooter:SetHeight(16); self.MasterLooter:SetPoint("CENTER",articon,"CENTER",-54,51); -- PvP Icon self.PvP = articon:CreateTexture(nil,"BORDER"); self.PvP:SetWidth(40); self.PvP:SetHeight(40); self.PvP:SetPoint("CENTER",articon,"CENTER",-92,-5); -- Class Icon local class = self:CreateTexture(nil, "BORDER") class:SetHeight(16) class:SetWidth(16) class:SetPoint("CENTER",articon,"CENTER",-99,-27); self.ClassIcon = class -- Raid Icon local RaidIcon = self:CreateTexture(nil, "BORDER") RaidIcon:SetSize(16, 16) RaidIcon:SetPoint("CENTER",articon,"CENTER",97,51); self.RaidIcon = RaidIcon -- Rested Icon local Resting = self:CreateTexture(nil, 'OVERLAY') Resting:SetSize(24, 24) Resting:SetPoint("RIGHT",articon,"RIGHT",-5,0); self.Resting = Resting -- Holy Power if(select(2, UnitClass('player')) == 'PALADIN') then local HolyPower = {} local HolyWidth = 38 local maxHolyPower = UnitPowerMax('player', SPELL_POWER_HOLY_POWER) local HolyCalcy = HolyWidth * maxHolyPower for index = 1, maxHolyPower do -- background image local arthaly = CreateFrame("Frame", nil, self); arthaly:SetFrameStrata("BACKGROUND"); arthaly:SetFrameLevel(0); arthaly:SetAllPoints(self); arthaly.bg = arthaly:CreateTexture(nil, "BORDER"); arthaly.bg:SetPoint('TOPRIGHT', articon, 'TOPRIGHT', ((index * HolyWidth) - HolyCalcy) + 13, 25) arthaly.bg:SetTexture(holy_pawer); -- top image local artholy = CreateFrame("Frame", nil, self); artholy.bg = artholy:CreateTexture(nil, "BORDER"); artholy.bg:SetPoint('TOPRIGHT', articon, 'TOPRIGHT', ((index * HolyWidth) - HolyCalcy) + 13, 25) artholy.bg:SetTexture(holy_power); local Texture = self:CreateTexture(nil, 'BACKGROUND') Texture:SetWidth(HolyWidth) Texture:SetHeight(10) Texture:SetTexture(1, 1, 0) Texture:SetPoint('TOPRIGHT', articon, 'TOPRIGHT', (index * Texture:GetWidth()) - HolyCalcy, 12) HolyPower[index] = Texture; end self.HolyPower = HolyPower end end self.width = 224 self.height = 122 self.mystyle = "player" init(self) self.Health.colorClass = false self.Health.colorHealth = true self.Health.bg.multiplier = 0.3 self.Power.colorPower = true self.Power.bg.multiplier = 0.3 frame_player.gen_castbar(self) frame_player.gen_portrait(self) frame_player.createBuffs(self) frame_player.createDebuffs(self) end if cfg.showplayer then oUF:RegisterStyle("BUF_SimplePlayer", CreatePlayerStyle) oUF:SetActiveStyle("BUF_SimplePlayer") local meplayer = oUF:Spawn("player") meplayer:SetPoint("TOPLEFT", self, "TOPLEFT", 25, -50); do -- relocate the death knight rune frame hooksecurefunc(RuneFrame,"SetPoint",function(_,_,parent) if (parent ~= meplayer) then RuneFrame:ClearAllPoints(); RuneFrame:SetPoint("CENTER",meplayer,"CENTER", 40, 140); end end); RuneFrame:SetFrameStrata("BACKGROUND"); RuneFrame:SetFrameLevel(4); RuneFrame:SetScale(0.8); RuneFrame:ClearAllPoints(); RuneFrame:SetPoint("CENTER",meplayer,"CENTER", 18, 83); end end just would like hpower to get fixxed at the moment |
|
08-19-12, 12:59 PM | #2 |
found it
SPELL_POWER_HOLY_POWER does not register of the start UnitPowerMax('player', SPELL_POWER_HOLY_POWER) = 0 on first initialize fast solution Code:
local SPELL_POWER_HOLY_POWER = SPELL_POWER_HOLY_POWER; -- print(SPELL_POWER_HOLY_POWER); local maxHolyPower = UnitPowerMax('player', SPELL_POWER_HOLY_POWER) -- print(maxHolyPower); if (maxHolyPower == 0) then local expac = GetAccountExpansionLevel(); -- print(expac); if (expac ~= 5) then maxHolyPower = 3; else maxHolyPower = 5; end end -- print(maxHolyPower); Last edited by Sentacursa : 08-19-12 at 01:36 PM. |
|
08-19-12, 01:16 PM | #3 |
That variable is gone in Mists, just set it to 5.
|
|
08-19-12, 06:50 PM | #4 |
Which variable are you talking about? SPELL_POWER_HOLY_POWER is still very much present in the latest beta build, and its value is 9, not 5. See FrameXML/Constants.lua:
Code:
-- Power Types SPELL_POWER_MANA = 0; SPELL_POWER_RAGE = 1; SPELL_POWER_FOCUS = 2; SPELL_POWER_ENERGY = 3; --SPELL_POWER_CHI = 4; This is obsolete now. SPELL_POWER_RUNES = 5; SPELL_POWER_RUNIC_POWER = 6; SPELL_POWER_SOUL_SHARDS = 7; SPELL_POWER_ECLIPSE = 8; SPELL_POWER_HOLY_POWER = 9; SPELL_POWER_ALTERNATE_POWER = 10; SPELL_POWER_DARK_FORCE = 11; SPELL_POWER_LIGHT_FORCE = 12; SPELL_POWER_SHADOW_ORBS = 13; SPELL_POWER_BURNING_EMBERS = 14; SPELL_POWER_DEMONIC_FURY = 15;
__________________
Retired author of too many addons. Message me if you're interested in taking over one of my addons. Don’t message me about addon bugs or programming questions. Last edited by Phanx : 08-19-12 at 06:53 PM. |
|
08-20-12, 01:20 AM | #5 |
You're right, I was thinking about MAX_HOLY_POWER.
In which case, hardcode it. oUF hides anything you don't have, atleast should be. |
|
08-20-12, 07:28 AM | #6 | |
phanx ty: GetBuildInfo; if it's >= 50000 k ty here's the final. for if someone else wants to use it as a reference Code:
-- Paladin if (select(2, UnitClass('player')) == 'PALADIN') then local HolyPower = {} local HolyWidth = 38 local SPELL_POWER_HOLY_POWER = SPELL_POWER_HOLY_POWER; local maxHolyPower = UnitPowerMax('player', SPELL_POWER_HOLY_POWER) -- OMG Holy Power BUG ... YAY ! -- time to wrap it up fast. local HPv, HPb, HPd, HPt = GetBuildInfo(); if (maxHolyPower == 0) then if (HPt >= 50000) then maxHolyPower = 5; else maxHolyPower = 3; end end -- done wrapping :P local HolyCalcy = HolyWidth * maxHolyPower; -- Background Image -> start for index = 1, maxHolyPower do local arthaly = CreateFrame("Frame", nil, self); arthaly:SetFrameStrata("BACKGROUND"); arthaly:SetFrameLevel(0); arthaly:SetAllPoints(self); arthaly.bg = arthaly:CreateTexture(nil, "BORDER"); arthaly.bg:SetPoint('TOPRIGHT', articon, 'TOPRIGHT', ((index * HolyWidth) - HolyCalcy) + 13, 25) arthaly.bg:SetTexture(holy_pawer); end -- Background Image -> end -- Overlay Image -> start for indox = 1, maxHolyPower do local artholy = CreateFrame("Frame", nil, self); artholy.bg = artholy:CreateTexture(nil, "BORDER"); artholy.bg:SetPoint('TOPRIGHT', articon, 'TOPRIGHT', ((indox * HolyWidth) - HolyCalcy) + 13, 25) artholy.bg:SetTexture(holy_power); end -- Overlay Image -> end -- Loading Holy Power -> Start for indax = 1, maxHolyPower do local Texture = self:CreateTexture(nil, 'BACKGROUND') Texture:SetWidth(HolyWidth) Texture:SetHeight(10) Texture:SetTexture(0.96 , 0.55, 0.73) Texture:SetPoint('TOPRIGHT', articon, 'TOPRIGHT', (indax * Texture:GetWidth()) - HolyCalcy, 12) HolyPower[indax] = Texture; end -- Loading Holy Power -> End self.HolyPower = HolyPower end -- End Paladin Last edited by Sentacursa : 08-20-12 at 07:52 AM. |
||
08-20-12, 08:32 AM | #7 |
ty guys added u 2 in credit notes
Last edited by Sentacursa : 08-21-12 at 03:36 PM. |
|
WoWInterface » Featured Projects » oUF (Otravi Unit Frames) » Player Frame Holy Power |
«
Previous Thread
|
Next Thread
»
|
Display Modes |
Linear Mode |
Switch to Hybrid Mode |
Switch to Threaded Mode |
|
|