mirror of
https://github.com/brues-code/pfUI.git
synced 2026-09-22 07:36:56 +00:00
Compare commits
11 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| a3cfd711fe | |||
| a7ad1f073f | |||
| fe5b3b135b | |||
| 9c29f0c7d4 | |||
| 685ecb4a3e | |||
| 8cdaf1fc00 | |||
| bb39c9d94e | |||
| 18059ffbb7 | |||
| d75e280238 | |||
| 9eb34b8f0a | |||
| f8dde49f09 |
+10
@@ -204,6 +204,12 @@ function pfUI.api.UnitHasBuff(unit, name)
|
||||
return C_UnitAuras.GetAuraDataBySpellName(unit, name, "HELPFUL") ~= nil or nil
|
||||
end
|
||||
|
||||
-- [ IsPlayerGuid ]
|
||||
-- Returns whether a GUID or unit token refers to the local player.
|
||||
-- guid [string] A unit GUID (or unitID) to test.
|
||||
-- return: [bool] true if it is the player otherwise "false"
|
||||
pfUI.api.IsPlayerGuid = _G.IsPlayerGuid
|
||||
|
||||
-- [ GetUnbuffedRoster ]
|
||||
-- Returns a comma-joined, colored list of group members missing the named aura.
|
||||
-- name [string] the localized aura name to check for
|
||||
@@ -665,6 +671,10 @@ end
|
||||
function pfUI.api.CreateGoldString(money)
|
||||
if type(money) ~= "number" then return "-" end
|
||||
|
||||
if _G.GetCoinTextureString then
|
||||
return "|cffffffff" .. _G.GetCoinTextureString(money) .. "|r"
|
||||
end
|
||||
|
||||
local gold = floor(money/ 100 / 100)
|
||||
local silver = floor(mod((money/100),100))
|
||||
local copper = floor(mod(money,100))
|
||||
|
||||
+1
-1
@@ -223,7 +223,7 @@ function pfUI:LoadConfig()
|
||||
pfUI:UpdateConfig("unitframes", nil, "always2dportrait", "0")
|
||||
pfUI:UpdateConfig("unitframes", nil, "portraittexture", "1")
|
||||
pfUI:UpdateConfig("unitframes", nil, "layout", "default")
|
||||
pfUI:UpdateConfig("unitframes", nil, "rangecheck", "1")
|
||||
pfUI:UpdateConfig("unitframes", nil, "rangecheck", "0")
|
||||
pfUI:UpdateConfig("unitframes", nil, "rangecheck_mode", "vanilla")
|
||||
pfUI:UpdateConfig("unitframes", nil, "rangecheck_distance", "40")
|
||||
pfUI:UpdateConfig("unitframes", nil, "buffdetect", "0")
|
||||
|
||||
+31
-5
@@ -205,8 +205,13 @@ function pfUI.uf:UpdateVisibility()
|
||||
|
||||
-- cache result of strsub to avoid repeating calls
|
||||
if not self.cache_raid then
|
||||
if strsub(self:GetName(),0,6) == "pfRaid" then
|
||||
self.cache_raid = tonumber(strsub(self:GetName(),7,8)) or 0
|
||||
local name = self:GetName()
|
||||
if strsub(name,0,9) == "pfRaidPet" then
|
||||
-- pet grid slot (pfRaidPet1..40); used to mirror party pets below
|
||||
self.cache_raid = 0
|
||||
self.cache_raidpet = tonumber(strsub(name,10)) or 0
|
||||
elseif strsub(name,0,6) == "pfRaid" then
|
||||
self.cache_raid = tonumber(strsub(name,7,8)) or 0
|
||||
else
|
||||
self.cache_raid = 0
|
||||
end
|
||||
@@ -238,6 +243,26 @@ function pfUI.uf:UpdateVisibility()
|
||||
end
|
||||
end
|
||||
|
||||
-- show raidpet frames as party pets when a party is shown as a raid grid
|
||||
if self.cache_raidpet then
|
||||
if not IsInRaid() and IsInGroup() and C.unitframes.raidforgroup == "1" then
|
||||
local id = self.cache_raidpet
|
||||
if id == 1 then
|
||||
-- grid slot 1 mirrors the player, so its pet is the player's pet
|
||||
self.id = ""
|
||||
self.label = "pet"
|
||||
elseif id <= 5 then
|
||||
self.id = id - 1
|
||||
self.label = "partypet"
|
||||
end
|
||||
|
||||
-- reset to regular raidpet unitstrings after leaving party mode
|
||||
elseif self.label == "pet" or self.label == "partypet" then
|
||||
self.id = self.cache_raidpet
|
||||
self.label = "raidpet"
|
||||
end
|
||||
end
|
||||
|
||||
-- display every unit as player while pfUI.uf.showall is set
|
||||
if pfUI.uf.showall then
|
||||
self._label = self._label or self.label
|
||||
@@ -266,9 +291,10 @@ function pfUI.uf:UpdateVisibility()
|
||||
-- frame shall not be visible
|
||||
visibility = "hide"
|
||||
self.visible = nil
|
||||
elseif hide_group and self.cache_raid == 0 and self.label and strsub(self.label,0,5) == "party" then
|
||||
-- hide group while shown as a raid grid and option is set (raid frames
|
||||
-- carry label "party" under raidforgroup, so exclude them by cache_raid)
|
||||
elseif hide_group and self.cache_raid == 0 and not self.cache_raidpet and self.label and strsub(self.label,0,5) == "party" then
|
||||
-- hide group while shown as a raid grid and option is set (raid player
|
||||
-- frames carry label "party" and raid pet frames carry label "partypet"
|
||||
-- under raidforgroup, so exclude them by cache_raid / cache_raidpet)
|
||||
visibility = "hide"
|
||||
self.visible = nil
|
||||
elseif ( self.fname == "Group0" or self.fname == "PartyPet0" or self.fname == "Party0Target" )
|
||||
|
||||
+66
-26
@@ -1154,12 +1154,21 @@ nameplates:RegisterEvent("PLAYER_GUILD_UPDATE")
|
||||
plate.level:SetText(string.format("%s%s", level, (elitestrings[elite] or "")))
|
||||
end
|
||||
|
||||
-- Set level color from GetDifficultyColor when using DB level
|
||||
-- Set level color from GetDifficultyColor when using DB level.
|
||||
-- No brightening here: adding a flat offset to all three channels
|
||||
-- desaturates every tier toward white and collapses the boundaries
|
||||
-- (orange reads as yellow, red reads as orange). Use Blizzard's values.
|
||||
-- Clearing cache.levelcolor forces the sync block in OnUpdate to
|
||||
-- re-colour once the ?? resolves and it takes ownership again.
|
||||
if levelFromDB and type(level) == "number" then
|
||||
local color = GetDifficultyColor(level)
|
||||
plate.level:SetTextColor(color.r + 0.3, color.g + 0.3, color.b + 0.3, 1)
|
||||
plate.level:SetTextColor(color.r, color.g, color.b, 1)
|
||||
plate.cache.levelcolor = nil
|
||||
end
|
||||
|
||||
-- remember who owns the level colour so the two writers cannot fight
|
||||
plate.cache.levelfromdb = levelFromDB or nil
|
||||
|
||||
if guild and C.nameplates.showguildname == "1" then
|
||||
plate.guild:SetText(guild)
|
||||
if guild == myGuild then
|
||||
@@ -1251,9 +1260,32 @@ nameplates:RegisterEvent("PLAYER_GUILD_UPDATE")
|
||||
plate.cache.r, plate.cache.g, plate.cache.b = r, g, b
|
||||
end
|
||||
|
||||
if r + g + b ~= plate.cache.namecolor and unittype == "FRIENDLY_PLAYER" and C.nameplates["friendclassnamec"] == "1" and class and PFUI_CLASS_COLORS[class] then
|
||||
plate.name:SetTextColor(r, g, b, a)
|
||||
plate.cache.namecolor = r + g + b
|
||||
-- Friendly player names take this colour when friendclassnamec is on.
|
||||
-- Ownership is recorded so the OnUpdate sync below stands down rather than
|
||||
-- racing us: both writers used to share cache.namecolor despite storing
|
||||
-- unrelated quantities (this colour vs Blizzard's name FontString), so
|
||||
-- either could suppress the other -- and since nameplate.cache survives
|
||||
-- pool reuse, a recycled plate could keep the previous unit's name colour.
|
||||
local ownname = unittype == "FRIENDLY_PLAYER" and C.nameplates["friendclassnamec"] == "1"
|
||||
and class and true or nil
|
||||
|
||||
if plate.cache.ownname ~= ownname then
|
||||
plate.cache.ownname = ownname
|
||||
-- ownership flipped: whichever writer is now in charge must re-assert
|
||||
plate.cache.namecolor = nil
|
||||
plate.cache.ownnamecolor = nil
|
||||
end
|
||||
|
||||
-- read the class colour directly rather than reusing the bar's r,g,b: the
|
||||
-- bar only carries a class colour when friendclassc happens to be on, and
|
||||
-- it also picks up the tapped-grey and barcombatstate overrides, neither of
|
||||
-- which belongs on the name.
|
||||
if ownname then
|
||||
local cr, cg, cb, ca = PFUI_CLASS_COLORS[class]:GetRGBA()
|
||||
if cr + cg + cb ~= plate.cache.ownnamecolor then
|
||||
plate.cache.ownnamecolor = cr + cg + cb
|
||||
plate.name:SetTextColor(cr, cg, cb, ca)
|
||||
end
|
||||
end
|
||||
|
||||
if target and C.nameplates.cpdisplay == "1" then
|
||||
@@ -1521,33 +1553,41 @@ nameplates:RegisterEvent("PLAYER_GUILD_UPDATE")
|
||||
update = true
|
||||
end
|
||||
|
||||
-- trigger update when name color changed (includes combat state check)
|
||||
local r, g, b = original.name:GetTextColor()
|
||||
local inCombatWithPlayer = cfg.namefightcolor and UnitAffectingCombat(nameplate.unit) and UnitAffectingCombat("player")
|
||||
|
||||
if r + g + b ~= nameplate.cache.namecolor or (cfg.namefightcolor and nameplate.cache.inCombat ~= inCombatWithPlayer) then
|
||||
nameplate.cache.namecolor = r + g + b
|
||||
nameplate.cache.inCombat = inCombatWithPlayer
|
||||
-- trigger update when name color changed (includes combat state check).
|
||||
-- Skipped once OnDataChanged owns the name colour (class-coloured friendly
|
||||
-- players), so the two writers cannot overwrite each other.
|
||||
if not nameplate.cache.ownname then
|
||||
local r, g, b = original.name:GetTextColor()
|
||||
local inCombatWithPlayer = cfg.namefightcolor and UnitAffectingCombat(nameplate.unit) and UnitAffectingCombat("player")
|
||||
|
||||
if cfg.namefightcolor then
|
||||
if (r > .9 and g < .2 and b < .2) or inCombatWithPlayer then
|
||||
nameplate.name:SetTextColor(1,0.4,0.2,1)
|
||||
if r + g + b ~= nameplate.cache.namecolor or (cfg.namefightcolor and nameplate.cache.inCombat ~= inCombatWithPlayer) then
|
||||
nameplate.cache.namecolor = r + g + b
|
||||
nameplate.cache.inCombat = inCombatWithPlayer
|
||||
|
||||
if cfg.namefightcolor then
|
||||
if (r > .9 and g < .2 and b < .2) or inCombatWithPlayer then
|
||||
nameplate.name:SetTextColor(1,0.4,0.2,1)
|
||||
else
|
||||
nameplate.name:SetTextColor(r,g,b,1)
|
||||
end
|
||||
else
|
||||
nameplate.name:SetTextColor(r,g,b,1)
|
||||
nameplate.name:SetTextColor(1,1,1,1)
|
||||
end
|
||||
else
|
||||
nameplate.name:SetTextColor(1,1,1,1)
|
||||
update = true
|
||||
end
|
||||
update = true
|
||||
end
|
||||
|
||||
-- trigger update when level color changed
|
||||
local r, g, b = original.level:GetTextColor()
|
||||
r, g, b = r + .3, g + .3, b + .3
|
||||
if r + g + b ~= nameplate.cache.levelcolor then
|
||||
nameplate.cache.levelcolor = r + g + b
|
||||
nameplate.level:SetTextColor(r,g,b,1)
|
||||
update = true
|
||||
-- trigger update when level color changed. Skipped while the level came
|
||||
-- from the database (?? plates), where OnDataChanged owns the colour --
|
||||
-- otherwise both writers race and cache.levelcolor goes stale, which
|
||||
-- leaves a recycled plate wearing the previous unit's colour.
|
||||
if not nameplate.cache.levelfromdb then
|
||||
local r, g, b = original.level:GetTextColor()
|
||||
if r + g + b ~= nameplate.cache.levelcolor then
|
||||
nameplate.cache.levelcolor = r + g + b
|
||||
nameplate.level:SetTextColor(r,g,b,1)
|
||||
update = true
|
||||
end
|
||||
end
|
||||
|
||||
-- use timer based updates
|
||||
|
||||
+24
-2
@@ -125,6 +125,7 @@ pfUI:RegisterModule("raid", function ()
|
||||
local grid = self.petgrid
|
||||
|
||||
local function place(pet, cell, id)
|
||||
pet.label = "raidpet"
|
||||
pet.id = id
|
||||
local r, g = SlotToCoord(cell, grid.fill, grid.x, grid.y)
|
||||
pet:ClearAllPoints()
|
||||
@@ -140,6 +141,22 @@ pfUI:RegisterModule("raid", function ()
|
||||
return
|
||||
end
|
||||
|
||||
-- Party shown as a raid grid: mirror slots 1..5 (player + party members)
|
||||
-- into fixed cells. UpdateVisibility maps each slot to pet / partypet<N>.
|
||||
if not IsInRaid() and IsInGroup() and C.unitframes.raidforgroup == "1" then
|
||||
for id = 1, maxraid do
|
||||
if self.pets[id] then
|
||||
if id <= 5 then
|
||||
place(self.pets[id], id, id)
|
||||
else
|
||||
self.pets[id].id = 0
|
||||
self.pets[id]:Hide()
|
||||
end
|
||||
end
|
||||
end
|
||||
return
|
||||
end
|
||||
|
||||
if C.unitframes.raidpet.collapse == "1" then
|
||||
-- Pack the pets that exist into the leading cells, no gaps.
|
||||
local k = 0
|
||||
@@ -213,8 +230,13 @@ pfUI:RegisterModule("raid", function ()
|
||||
this.tick = GetTime() + 1.0
|
||||
this.pendingUpdate = nil
|
||||
|
||||
-- don't proceed without raid
|
||||
if not IsInRaid() then return end
|
||||
-- Without a raid there is nothing to sort, but a party shown as a raid
|
||||
-- grid still needs its pet frames placed and mapped to the party pets.
|
||||
if not IsInRaid() then
|
||||
this:LayoutPets()
|
||||
this:Hide()
|
||||
return
|
||||
end
|
||||
|
||||
-- clear all existing frames
|
||||
for i=1, maxraid do SetRaidIndex(pfUI.uf.raid[i], 0) end
|
||||
|
||||
@@ -372,6 +372,15 @@ pfUI:RegisterModule("tooltip", function ()
|
||||
caster = UnitNameFromGUID(aura.sourceGUID)
|
||||
end
|
||||
if caster and caster ~= "" then
|
||||
local classToken
|
||||
if aura.sourceUnit and UnitIsPlayer(aura.sourceUnit) then
|
||||
classToken = UnitClassBase(aura.sourceUnit)
|
||||
elseif aura.sourceGUID then
|
||||
classToken = select(2, GetPlayerInfoByGUID(aura.sourceGUID))
|
||||
end
|
||||
if classToken then
|
||||
caster = PFUI_CLASS_COLORS[classToken]:WrapTextInColorCode(caster)
|
||||
end
|
||||
self:AddLine(T["Cast by"] .. ": " .. caster, .25,.5,1)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -110,6 +110,14 @@ pfUI.movables = {}
|
||||
pfUI.version = {}
|
||||
pfUI.env = {}
|
||||
|
||||
-- Capability flag: this fork's pfActionBar buttons correctly handle the modern
|
||||
-- HookScript widget method, so ClassicAPI's AddOnCompat shim must NOT shadow
|
||||
-- HookScript during actionbar load (older forks branch on `if button.HookScript`
|
||||
-- and take a modern path they were never written for). This describes behavior,
|
||||
-- not identity: a fork that keeps the HookScript-correct actionbar code keeps
|
||||
-- the flag; one that lacks it should drop the flag and get the safe fallback.
|
||||
pfUI.handlesHookScript = true
|
||||
|
||||
if not pfUI.disabled then
|
||||
pfUI.events = Mixin({}, CallbackRegistryMixin)
|
||||
pfUI.events:OnLoad()
|
||||
@@ -293,6 +301,20 @@ function pfUI:GetEnvironment()
|
||||
pfUI.env.pfUI_throttle = _G.pfUI_throttle
|
||||
pfUI.env.L = (pfUI_locale[GetLocale()] or pfUI_locale["enUS"])
|
||||
pfUI.env.L["class"] = pfUI.env.L["class"] or tInvert(LOCALIZED_CLASS_NAMES_MALE)
|
||||
if not pfUI.env.L["race"] then
|
||||
pfUI.env.L["race"] = {}
|
||||
local i = 1
|
||||
local raceInfo = C_CreatureInfo.GetRaceInfo(i)
|
||||
while raceInfo ~= nil do
|
||||
pfUI.env.L["race"][raceInfo.clientFileString] = {
|
||||
raceName = raceInfo.raceName,
|
||||
raceID = raceInfo.raceID,
|
||||
faction = C_CreatureInfo.GetFactionInfo(i).groupTag,
|
||||
}
|
||||
i = i + 1
|
||||
raceInfo = C_CreatureInfo.GetRaceInfo(i)
|
||||
end
|
||||
end
|
||||
|
||||
return pfUI.env
|
||||
end
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
## Version: @project-version@
|
||||
## SavedVariables: pfUI_profiles, pfUI_addon_profiles, pfUI_cache, pfUI_throttle
|
||||
## SavedVariablesPerCharacter: pfUI_config, pfUI_init, pfUI_playerDB
|
||||
## Dependencies: !!!ClassicAPI
|
||||
## X-Website: https://github.com/brues-code/pfUI
|
||||
|
||||
pfUI.lua
|
||||
|
||||
Reference in New Issue
Block a user