59d9b1565e
Camelot 70450 donne une variante c60 à toutes les barres et à tous les voiles des cadres d'unité, et réimplante leur planche (uiunitframec60, 256 x 512 -> 1024 x 512). Les planches uiunitframec60, uipartyframec60 et uiroguecombopointsc60 de la 70450 (BGRA non compressé) remplacent ou rejoignent celles de l'atelier ; UIAtlas_04 prend leurs régions (feuilles 12 à 14), et les noms du groupe quittent UIAtlas_06. - Joueur : vie (87, -43), ressource (87, -61), nom centré de 116 en (149, -37), voile de menace centré ; ordre combat, liste de haine, repos. - Cible : barres identiques pour les créatures négligeables, vie (21, -41), ressource (17, -60), bandeau (-82, -26), nom centré, voile (-1, 1) ; cadre 194 x 68 (négligeable 163 x 57) par l'atlas. - Insigne JcJ du joueur et de la cible : plus de cercle, l'icône seule à l'échelle 0,8, environ 7 px plus bas. - Points de combo : l'arc de camelot (cinq points autour du portrait de la cible, rayon 39,6, de -10° par pas de 21°, depuis 2° avec l'insigne JcJ, remplis par le haut) remplace le ComboFrame du client. - Cible de la cible et familier : vie (45, -17,5), ressource (43, -29,5), nom centré. - Groupe : vie (47, -20), ressource (45, -31), nom (48, -7) de 55, rôle (-5, -7), voile (1, -1), statut (-1, -1) ; vie vide pour un membre déconnecté et mort. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
203 lines
6.3 KiB
Lua
203 lines
6.3 KiB
Lua
-- ForeverUI: player frame extras: PvP icon, raid group, play time and damage taken.
|
|
-- They live in ForeverUI.PlayerFrame's overlayHolder (above the art) and move with the frame.
|
|
-- Sizes and offsets: camelot PvP icon (scale 0.8, no circle since 70450) and mainline
|
|
-- PlayerFrame.xml (GroupIndicator, PlayerPlayTime, HitIndicator).
|
|
|
|
local frame = ForeverUI.PlayerFrame
|
|
local holder = frame.overlayHolder
|
|
|
|
local PVP_FFA = "ui-hud-unitframe-player-pvp-ffaicon"
|
|
local PVP_FACTION = {
|
|
Alliance = "ui-hud-unitframe-smallcircle-alliance",
|
|
Horde = "ui-hud-unitframe-smallcircle-horde",
|
|
}
|
|
local GROUP_LEFT = "ui-hud-unitframe-player-groupindicatorleft"
|
|
local GROUP_RIGHT = "ui-hud-unitframe-player-groupindicatorright"
|
|
local GROUP_MID = "_ui-hud-unitframe-player-groupindicatormid"
|
|
local PLAYTIME_TIRED_ATLAS = "ui-hud-unitframe-player-playtimetired"
|
|
local PLAYTIME_UNHEALTHY_ATLAS = "ui-hud-unitframe-player-playtimeunhealthy"
|
|
|
|
-- ------------------------------------------------------------------- PvP
|
|
-- camelot 70450 (PlayerPvpBackgroundIconTemplate, scale 0.8, UnitFramePvPIndicatorStyle): no
|
|
-- background circle any more; the icon alone, TOP at (22, -65) in its scaled units, so
|
|
-- (17.6, -52) in the frame's. Faction icons are 24 x 27, the FFA one keeps its atlas size
|
|
-- (28 x 44), both at 0.8.
|
|
local PVP_SCALE = 0.8
|
|
-- Under the level circle (ARTWORK) and its text, as in camelot (PvP in OVERLAY 3, level in
|
|
-- OVERLAY 4).
|
|
local pvpIcon = holder:CreateTexture(nil, "BORDER")
|
|
pvpIcon:SetPoint("TOP", frame, "TOPLEFT", 22 * PVP_SCALE, -65 * PVP_SCALE)
|
|
pvpIcon:Hide()
|
|
|
|
local function updatePvP()
|
|
local faction = UnitFactionGroup("player")
|
|
|
|
if UnitIsPVPFreeForAll("player") then
|
|
if ForeverUI.SetAtlas(pvpIcon, PVP_FFA) then
|
|
pvpIcon:SetWidth(28 * PVP_SCALE)
|
|
pvpIcon:SetHeight(44 * PVP_SCALE)
|
|
pvpIcon:Show()
|
|
return
|
|
end
|
|
elseif faction and faction ~= "Neutral" and UnitIsPVP("player") then
|
|
local atlas = PVP_FACTION[faction]
|
|
if atlas and ForeverUI.SetAtlas(pvpIcon, atlas) then
|
|
pvpIcon:SetWidth(24 * PVP_SCALE)
|
|
pvpIcon:SetHeight(27 * PVP_SCALE)
|
|
pvpIcon:Show()
|
|
return
|
|
end
|
|
end
|
|
|
|
pvpIcon:Hide()
|
|
end
|
|
|
|
-- ------------------------------------------------------------ raid group
|
|
local groupIndicator = CreateFrame("Frame", nil, holder)
|
|
groupIndicator:SetWidth(10)
|
|
groupIndicator:SetHeight(16)
|
|
groupIndicator:SetPoint("BOTTOMRIGHT", frame, "TOPLEFT", 210, -29)
|
|
groupIndicator:Hide()
|
|
|
|
local groupLeft = groupIndicator:CreateTexture(nil, "BACKGROUND")
|
|
ForeverUI.SetAtlas(groupLeft, GROUP_LEFT)
|
|
groupLeft:SetPoint("TOPLEFT")
|
|
|
|
local groupRight = groupIndicator:CreateTexture(nil, "BACKGROUND")
|
|
ForeverUI.SetAtlas(groupRight, GROUP_RIGHT)
|
|
groupRight:SetPoint("TOPRIGHT")
|
|
|
|
local groupMid = groupIndicator:CreateTexture(nil, "BACKGROUND")
|
|
ForeverUI.SetAtlas(groupMid, GROUP_MID, true)
|
|
groupMid:SetPoint("LEFT", groupLeft, "RIGHT")
|
|
groupMid:SetPoint("RIGHT", groupRight, "LEFT")
|
|
|
|
local groupText = groupIndicator:CreateFontString(nil, "OVERLAY", "GameFontHighlightSmall")
|
|
groupText:SetAlpha(0.7)
|
|
groupText:SetPoint("LEFT", 20, 2)
|
|
|
|
local function updateGroup()
|
|
local members = GetNumRaidMembers and GetNumRaidMembers() or 0
|
|
if members == 0 then
|
|
groupIndicator:Hide()
|
|
return
|
|
end
|
|
|
|
local playerName = UnitName("player")
|
|
for index = 1, members do
|
|
local name, _, subgroup = GetRaidRosterInfo(index)
|
|
if name == playerName and subgroup then
|
|
groupText:SetText(GROUP .. " " .. subgroup)
|
|
groupIndicator:SetWidth(groupText:GetWidth() + 40)
|
|
groupIndicator:Show()
|
|
return
|
|
end
|
|
end
|
|
|
|
groupIndicator:Hide()
|
|
end
|
|
|
|
-- ------------------------------------------------------------- play time
|
|
local playTime = CreateFrame("Frame", nil, holder)
|
|
playTime:SetWidth(29)
|
|
playTime:SetHeight(29)
|
|
playTime:SetPoint("TOPLEFT", frame, "TOPRIGHT", -21, -24)
|
|
playTime:EnableMouse(true)
|
|
playTime:Hide()
|
|
|
|
local playTimeIcon = playTime:CreateTexture(nil, "ARTWORK")
|
|
playTimeIcon:SetAllPoints(playTime)
|
|
|
|
playTime:SetScript("OnEnter", function(self)
|
|
if not self.tooltip then
|
|
return
|
|
end
|
|
GameTooltip:SetOwner(self, "ANCHOR_RIGHT")
|
|
GameTooltip:SetText(self.tooltip, nil, nil, nil, nil, true)
|
|
end)
|
|
playTime:SetScript("OnLeave", function()
|
|
GameTooltip:Hide()
|
|
end)
|
|
|
|
local function updatePlayTime()
|
|
if PartialPlayTime and PartialPlayTime() then
|
|
ForeverUI.SetAtlas(playTimeIcon, PLAYTIME_TIRED_ATLAS, true)
|
|
playTime.tooltip = PLAYTIME_TIRED
|
|
playTime:Show()
|
|
elseif NoPlayTime and NoPlayTime() then
|
|
ForeverUI.SetAtlas(playTimeIcon, PLAYTIME_UNHEALTHY_ATLAS, true)
|
|
playTime.tooltip = PLAYTIME_UNHEALTHY
|
|
playTime:Show()
|
|
else
|
|
playTime:Hide()
|
|
end
|
|
end
|
|
|
|
-- ---------------------------------------------------------- damage taken
|
|
local hitText = holder:CreateFontString(nil, "OVERLAY", "NumberFontNormalHuge")
|
|
hitText:SetPoint("CENTER", frame, "TOPLEFT", 54, -50)
|
|
hitText:Hide()
|
|
|
|
if CombatFeedback_Initialize then
|
|
CombatFeedback_Initialize(frame, hitText, 30)
|
|
end
|
|
|
|
-- ---------------------------------------------------------------- events
|
|
local extras = CreateFrame("Frame")
|
|
extras:RegisterEvent("PLAYER_ENTERING_WORLD")
|
|
extras:RegisterEvent("PLAYER_FLAGS_CHANGED")
|
|
extras:RegisterEvent("UNIT_FACTION")
|
|
extras:RegisterEvent("RAID_ROSTER_UPDATE")
|
|
extras:RegisterEvent("PARTY_MEMBERS_CHANGED")
|
|
extras:RegisterEvent("PLAYTIME_CHANGED")
|
|
extras:RegisterEvent("UNIT_COMBAT")
|
|
|
|
extras:SetScript("OnEvent", function(_self, event, unit, action, descriptor, damage, damageType)
|
|
if event == "UNIT_COMBAT" then
|
|
if unit == "player" and CombatFeedback_OnCombatEvent then
|
|
CombatFeedback_OnCombatEvent(frame, action, descriptor, damage, damageType)
|
|
end
|
|
return
|
|
end
|
|
|
|
if event == "PLAYTIME_CHANGED" then
|
|
updatePlayTime()
|
|
return
|
|
end
|
|
|
|
if event == "RAID_ROSTER_UPDATE" or event == "PARTY_MEMBERS_CHANGED" then
|
|
updateGroup()
|
|
return
|
|
end
|
|
|
|
if event == "UNIT_FACTION" and unit ~= "player" then
|
|
return
|
|
end
|
|
|
|
updatePvP()
|
|
if event == "PLAYER_ENTERING_WORLD" then
|
|
updateGroup()
|
|
updatePlayTime()
|
|
end
|
|
end)
|
|
|
|
-- The client's CombatFeedback code animates the damage text: UNIT_COMBAT feeds it (above)
|
|
-- and it runs every frame, as in PlayerFrame_OnUpdate.
|
|
extras:SetScript("OnUpdate", function(_self, elapsed)
|
|
if CombatFeedback_OnUpdate then
|
|
CombatFeedback_OnUpdate(frame, elapsed)
|
|
end
|
|
end)
|
|
|
|
ForeverUI.PlayerFrameExtras = {
|
|
pvpIcon = pvpIcon,
|
|
groupIndicator = groupIndicator,
|
|
groupText = groupText,
|
|
playTime = playTime,
|
|
playTimeIcon = playTimeIcon,
|
|
hitText = hitText,
|
|
updatePvP = updatePvP,
|
|
updateGroup = updateGroup,
|
|
updatePlayTime = updatePlayTime,
|
|
}
|