Originally Posted by Ulostthegame
I've actually been looking into several solutions for Runic Power placement.
|
Recently dabbled with oUF_Hank, and wanted to move my power above my health as well, so I came up with this little custom modification. Just pace in custom_modifications.lua
Code:
-- Create new Power tag
oUF.TagEvents["ppSimple"] = oUF.TagEvents["curpp"]
oUF.Tags["ppSimple"] = function(unit)
local _, pType = UnitPowerType(unit)
local color = cfg.colors.power[pType] or cfg.colors.power["FUEL"]
local CurPower = UnitPower(unit)
if pType == "RUNIC_POWER" or pType == "FOCUS" or pType == "RAGE" or pType == "ENERGY" then
return ("|cFF%.2x%.2x%.2x%s|r"):format(color[1] * 255, color[2] * 255, color[3] * 255, valShort(UnitPower(unit)))
else
local MaxPower = UnitPowerMax(unit)
return ("|cFF%.2x%.2x%.2x%d%%|r"):format(color[1] * 255, color[2] * 255, color[3] * 255, math.floor(CurPower/MaxPower*100+.5))
end
end
-- Move Player Power
oUF_Hank_hooks.PlayerPowerPosition = {
UpdateHealth = function(self)
local status = (not UnitIsConnected(self.unit) or nil) and "Off" or UnitIsGhost(self.unit) and "G" or UnitIsDead(self.unit) and "X"
if self == oUF_player then
self.power:SetPoint("BOTTOMRIGHT", self.health[4], "TOPRIGHT", 0, 2)
if not status then
if not self.power:IsShown() then self.power:Show() end
else
self.power:Hide()
end
end
end,
}
-- Move Player Status icons
oUF_Hank_hooks.PlayerStatusPosition = {
UpdateStatus = function(self)
-- Attach the first icon to the right border of self.power
local lastElement = {"BOTTOMRIGHT", self.health[4], "BOTTOMLEFT", -86, -2}
-- Status icon texture names and conditions
local icons = {
["C"] = {"Combat", UnitAffectingCombat("player")},
["R"] = {"Resting", IsResting()},
["L"] = {"Leader", IsPartyLeader()},
["M"] = {"MasterLooter", ({GetLootMethod()})[1] == "master" and (
(({GetLootMethod()})[2]) == 0 or
((({GetLootMethod()})[2]) and UnitIsUnit("player", "party" .. ({GetLootMethod()})[2])) or
((({GetLootMethod()})[3]) and UnitIsUnit("player", "raid" .. ({GetLootMethod()})[3]))
)},
["P"] = {"PvP", UnitIsPVPFreeForAll("player") or UnitIsPVP("player")},
["A"] = {"Assistant", UnitInRaid("player") and UnitIsRaidOfficer("player") and not UnitIsPartyLeader("player")},
}
for i = -1, -string.len(cfg.StatusIcons), -1 do
if icons[string.sub(cfg.StatusIcons, i, i)][2] then
self[icons[string.sub(cfg.StatusIcons, i, i)][1]]:ClearAllPoints()
self[icons[string.sub(cfg.StatusIcons, i, i)][1]]:SetPoint(unpack(lastElement))
self[icons[string.sub(cfg.StatusIcons, i, i)][1]]:Show()
-- Arrange any successive icon to the last one
lastElement = {"RIGHT", self[icons[string.sub(cfg.StatusIcons, i, i)][1]], "LEFT"}
else
-- Condition for displaying the icon not met
self[icons[string.sub(cfg.StatusIcons, i, i)][1]]:Hide()
end
end
end,
}
-- Move Player Raid Icon, change Player Power text, move Pet text
oUF_Hank_hooks.PlayerRaidIconPower = {
sharedStyle = function(self, unit)
-- Modify Power and Raid icons
if unit == "player" then
self:Tag(self.power, "[ppSimple]")
self.power:SetFont("Interface\\AddOns\\oUF_Hank_v3\\fonts\\din1451e.ttf", 32, "THICKOUTLINE")
self.power:SetTextColor(unpack(cfg.colors.text))
self.power.frequentUpdates = 0.1
self.RaidIcon:SetPoint("RIGHT", self.power, "LEFT", -175, -30)
end
-- Move Pet text
if unit == "pet" then
self.name:SetPoint("RIGHT", 0, 30)
end
end,
}