Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local _, ns = ...
- if ns.unitframesEnable ~= true then return end
- _G["PlayerName"]:SetFont([[Interface\AddOns\CokeUI\Media\Expressway_Rg _BOLD.ttf]], 16)
- _G["TargetFrameTextureFrameName"]:SetFont([[Interface\AddOns\CokeUI\Media\Expressway_Rg _BOLD.ttf]], 16)
- _G["FocusFrameTextureFrameName"]:SetFont([[Interface\AddOns\CokeUI\Media\Expressway_Rg _BOLD.ttf]], 16)
- local CUSTOM_FACTION_BAR_COLORS = {
- [1] = {r = 1, g = 0, b = 0},
- [2] = {r = 1, g = 0, b = 0},
- [3] = {r = 1, g = 1, b = 0},
- [4] = {r = 1, g = 1, b = 0},
- [5] = {r = 0, g = 1, b = 0},
- [6] = {r = 0, g = 1, b = 0},
- [7] = {r = 0, g = 1, b = 0},
- [8] = {r = 0, g = 1, b = 0},
- }
- -- Font Style
- local shorts = {
- { 1e10, 1e9, "%.0fB" }, -- 10b+ as 12B
- { 1e9, 1e9, "%.1fB" }, -- 1b+ as 8.3B
- { 1e7, 1e6, "%.0fM" }, -- 10m+ as 14M
- { 1e6, 1e6, "%.1fM" }, -- 1m+ as 7.4M
- { 1e5, 1e3, "%.0fK" }, -- 100k+ as 840K
- { 1e3, 1e3, "%.1fK" }, -- 1k+ as 2.5K
- { 0, 1, "%d" }, -- < 1k as 974
- }
- for i = 1, #shorts do
- shorts[i][4] = shorts[i][3] .. " (%.0f%%)"
- end
- -- Change other frames' name backgrounds to match player frame
- for _, region in pairs({
- TargetFrameNameBackground,
- FocusFrameNameBackground,
- Boss1TargetFrameNameBackground,
- Boss2TargetFrameNameBackground,
- Boss3TargetFrameNameBackground,
- Boss4TargetFrameNameBackground,
- Boss5TargetFrameNameBackground,
- }) do
- region:SetTexture(0, 0, 0, 0.5)
- end
- -- Font Style / Color thanks to Phanx from WoWinterface.
- hooksecurefunc("TextStatusBar_UpdateTextStringWithValues", function(statusBar, textString, value, valueMin, valueMax)
- if value == 0 then
- return textString:SetText("")
- end
- local style = GetCVar("statusTextDisplay")
- if style == "PERCENT" then
- return textString:SetFormattedText("%.0f%%", value / valueMax * 100)
- end
- for i = 1, #shorts do
- local t = shorts[i]
- if value >= t[1] then
- if style == "BOTH" then
- return textString:SetFormattedText(t[4], value / t[2], value / valueMax * 100)
- else
- if value < valueMax then
- for j = 1, #shorts do
- local v = shorts[j]
- if valueMax >= v[1] then
- return textString:SetFormattedText(t[3] .. " / " .. v[3], value / t[2], valueMax / v[2])
- end
- end
- end
- return textString:SetFormattedText(t[3], value / t[2])
- end
- end
- end
- end)
- -- Font Color
- hooksecurefunc("UnitFrame_Update", function(self, isParty)
- if not self.name or not self:IsShown() then return end
- local PET_COLOR = { r = 157/255, g = 197/255, b = 255/255 }
- local unit, color = self.unit
- if UnitPlayerControlled(unit) then
- if UnitIsPlayer(unit) then
- local _, class = UnitClass(unit)
- color = (CUSTOM_CLASS_COLORS or RAID_CLASS_COLORS)[class]
- else
- color = PET_COLOR
- end
- elseif UnitIsDeadOrGhost(unit) or UnitIsTapped(unit) and not UnitIsTappedByPlayer(unit) then
- color = GRAY_FONT_COLOR
- else
- color = CUSTOM_FACTION_BAR_COLORS[UnitIsEnemy(unit, "player") and 1 or UnitReaction(unit, "player") or 5]
- end
- if not color then
- color = (CUSTOM_CLASS_COLORS or RAID_CLASS_COLORS)["PRIEST"]
- end
- self.name:SetTextColor(color.r, color.g, color.b)
- if isParty then
- self.name:SetText(GetUnitName(self.overrideName or unit))
- end
- end)
- -- Player Frame
- CastingBarFrame:SetScale(ns.unitframesCastbarScale)
- PlayerFrame:SetScale(ns.unitframesPlayerScale)
- PlayerLevelText:ClearAllPoints()
- PlayerLevelText:SetPoint('CENTER', PlayerFrame, -61, -16)
- -- Target Frame
- TargetFrame:SetScale(ns.unitframesTargetScale)
- TargetFrameLevelText:ClearAllPoints()
- TargetFrameLevelText:SetPoint('CENTER', TargetFrameTextureFrame, 61, 16)
- -- Focus Frame
- FocusFrame:SetScale(ns.unitframesFocusScale)
- FocusFrameLevelText:ClearAllPoints()
- FocusFrameLevelText:SetPoint('CENTER', FocusFrameTextureFrame, 61, 16)
- if not ArenaEnemyFrame1 then
- return true
- end
- -- Arena
- for i = 1, MAX_ARENA_ENEMIES do
- _G["ArenaPrepFrame"..i]:SetScale(ns.unitframesArenaScale)
- _G["ArenaEnemyFrame"..i]:SetScale(ns.unitframesArenaScale)
- end
- -- Boss
- SecureHandlerWrapScript(Boss1TargetFrame, 'OnShow', Boss1TargetFrame, 'self:SetScale('..ns.unitframesBossScale..')')
- SecureHandlerWrapScript(Boss2TargetFrame, 'OnShow', Boss2TargetFrame, 'self:SetScale('..ns.unitframesBossScale..')')
- SecureHandlerWrapScript(Boss3TargetFrame, 'OnShow', Boss3TargetFrame, 'self:SetScale('..ns.unitframesBossScale..')')
- SecureHandlerWrapScript(Boss4TargetFrame, 'OnShow', Boss4TargetFrame, 'self:SetScale('..ns.unitframesBossScale..')')
- SecureHandlerWrapScript(Boss5TargetFrame, 'OnShow', Boss5TargetFrame, 'self:SetScale('..ns.unitframesBossScale..')')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement