mirror of
https://github.com/brues-code/pfUI.git
synced 2026-09-21 23:26:56 +00:00
e017dbf515
* chat: detect whispers before the timestamp is prepended Whisper detection tests for the whisper colour code at position 1, but the timestamp is prepended first, so with timestamps enabled the code is no longer at position 1 and every whisper failed the test -- losing both the recolour and the correct chat-history entry. (cherry picked from commit 4b69d597631c422d9360a94ff129323288a28cc2) * macrotweak + libpredict: inverted install guard, misspelled globals macrotweak: _AddHistoryLine is the backup slot this block creates, so it is nil until line 18 runs. Guarding on its truthiness meant the chat-history filter never installed at all -- macro calls kept landing in chat input history. libpredict: UKNOWNBEING / UNKOWNBEING are misspelled, so both resolve to nil and the guards never matched the real UNKNOWNBEING. Neutral if the global is absent on this client, correct if present. Not needed: his libpredict already fixed the always-true 'event == "A" or "B"' condition (libs/libpredict.lua:828). (cherry picked from commit 4068110dc4134823f1c09f60ca5f8959302cd14f) * mapreveal: look the explore cache up by the key it is actually stored under explorecaches is keyed by the plain area name (line ~160), but the hover frame carried only a decorated 'mapFileName (area)' display string, so every lookup missed and the hover highlight never fired. Store the plain name alongside it and key off that; the tooltip keeps the decorated string. (cherry picked from commit 5e6fe969a03a88c68e28614548b9d44db562ab9a) * socialmod: don't clobber the friend-online match with the offline one The offline match was assigned unconditionally over the online match, so a friend coming online never had lastseen recorded. (cherry picked from commit ad927806c46042163f84bde4db1082726bedf28b) * swingtimer: off-hand weapons are inventory type 22, not 21 The off-hand slot accepts one-hand (13) and off-hand (22) weapons. Type 21 is INVTYPE_WEAPONMAINHAND and can never be equipped there, so the off-hand swing timer never recognised a real off-hand weapon. The other two swingtimer fixes are not needed here: his hunter check already uses UnitClassBase (locale-independent, better than our UnitClass second return), and his generic on-next-swing detection covers Raptor Strike without our hardcoded spell-id list. (cherry picked from commit 9ab7f5f7224d12361ca6cd5a49181cbb4bebd387) * superwow: compare the version numerically, not by exact string SUPERWOW_VERSION == "1.5" silently disables the GUID-to-name combat text hook on any release past 1.5. Currently 1.5 here, so this is forward-compat only. Not needed: the clickthrough slash commands already go through RegisterSlashCommand, which writes _G properly. (cherry picked from commit 82a37752a5782479849ce7e1304c24733c2ff97a) * api: measure a real pixel against UIParent, not the uiScale cvar The uiScale cvar caps at 1.0 while both the pixelperfect module and the firstrun slider push UIParent past it via SetScale, and it is ignored entirely while useUiScale is off, so borders came out the wrong thickness on the Huge/Large presets. Ask the frame for its effective scale instead, and guard an unparseable gxResolution. Also cache GetItemLinkByName and count its failures: the scan walked every id on each call with no memory, so an unresolvable name hitched on every tooltip hover. Raise the ceiling from 25818 to 61000 as well -- Octo/Turtle custom items live well past the vanilla range and never resolved. (cherry picked from commit dac2d3416aef85a4c4b71c0239d93d309e76e30b) * init: load pixelperfect first so GetPerfectPixel caches the right scale pixelperfect sets the UI scale that GetPerfectPixel measures against, and that value is cached on first use. Loading it 56th baked in the previous scale. (cherry picked from commit dd89a210330583f890a51a82b29e968f3ad36b34) * modules: route two global overrides through _G so they leave the sandbox pfUI.env has __index but no __newindex, so a bare global assignment inside a RegisterModule closure is written into the sandbox table and never reaches _G. unitxp's BattlefieldFrame_Show override therefore never fired the BG queue-pop notification, and RaidFrame.lua never saw GROUP_REPLACE_PARTY. The slash-command half of this fix is not needed here: RegisterSlashCommand already writes through _G. (cherry picked from commit 617c8320aca2465af62cf0ff5be7dceaed29a3b2) * bags: remove the duplicate search OnHide handler Two byte-identical frame.search OnHide handlers were installed back to back; the second overwrote the first, so the first was dead code. (cherry picked from commit e77650448b92e5d7f18ae58632e4531cb2813ea6) * buffwatch: invalidate the filter cache when a skill is listed fcache is built once per config table and never cleared, so ctrl/shift-clicking a skill onto the whitelist or blacklist had no effect until the next reload. * roll: actually capture the everyone-passed subject strfind(LOOT_ROLL_ALL_PASSED, LOOT_ROLL_PASSED) has no captures, so `everyone` was always nil, never reached the blacklist, and "Everyone has passed on: X" was recorded as a real player passing. Builds a sample from LOOT_ROLL_ALL_PASSED and runs the same LOOT_ROLL_PASSED match the scanner uses, so the subject is captured the way it will actually appear.
197 lines
7.7 KiB
Lua
197 lines
7.7 KiB
Lua
pfUI:RegisterModule("socialmod", function ()
|
|
local playerdb = _G.pfUI_playerDB
|
|
pfUI.socialmod = CreateFrame("Frame", "pfSocialMod", UIParent)
|
|
pfUI.socialmod:RegisterEvent("CHAT_MSG_SYSTEM")
|
|
pfUI.socialmod:SetScript("OnEvent", function()
|
|
local name = cmatch(arg1, _G.ERR_FRIEND_ONLINE_SS)
|
|
name = name or cmatch(arg1, _G.ERR_FRIEND_OFFLINE_S)
|
|
if name and playerdb[name] and playerdb[name].cname then
|
|
playerdb[name].lastseen = date("%a %d-%b-%Y")
|
|
end
|
|
end)
|
|
do -- add colors to guild list
|
|
hooksecurefunc("GuildStatus_Update", function()
|
|
local playerzone = GetRealZoneText()
|
|
local off = FauxScrollFrame_GetOffset(GuildListScrollFrame)
|
|
for i=1, GUILDMEMBERS_TO_DISPLAY, 1 do
|
|
local name, _, _, level, class, zone, _, _, online = GetGuildRosterInfo(off + i)
|
|
class = L["class"][class]
|
|
|
|
if name then
|
|
if class then
|
|
local color = PFUI_CLASS_COLORS[class]
|
|
local classicon = _G["GuildFrameButton"..i].classicon
|
|
local coords = CLASS_ICON_TCOORDS[class]
|
|
|
|
-- do we have classicons? (skin enabled?)
|
|
if classicon then
|
|
_G["GuildFrameButton"..i.."Class"]:SetTextColor(0,0,0,0)
|
|
|
|
if coords then
|
|
classicon:Show()
|
|
classicon:SetTexCoord(unpack(coords))
|
|
else
|
|
classicon:Hide()
|
|
end
|
|
|
|
if online then
|
|
_G["GuildFrameButton"..i.."Name"]:SetTextColor(color.r,color.g,color.b,1)
|
|
else
|
|
_G["GuildFrameButton"..i.."Name"]:SetTextColor(color.r,color.g,color.b,.5)
|
|
end
|
|
else
|
|
if online then
|
|
_G["GuildFrameButton"..i.."Class"]:SetTextColor(color.r,color.g,color.b,1)
|
|
else
|
|
_G["GuildFrameButton"..i.."Class"]:SetTextColor(color.r,color.g,color.b,.5)
|
|
end
|
|
end
|
|
end
|
|
|
|
if level then
|
|
local color = GetDifficultyColor(level)
|
|
if online then
|
|
_G["GuildFrameButton"..i.."Level"]:SetTextColor(color.r + .2, color.g + .2, color.b + .2, 1)
|
|
else
|
|
_G["GuildFrameButton"..i.."Level"]:SetTextColor(color.r + .2, color.g + .2, color.b + .2, .5)
|
|
end
|
|
end
|
|
|
|
if zone and zone == playerzone then
|
|
if online then
|
|
_G["GuildFrameButton"..i.."Zone"]:SetTextColor(.5, 1, 1, 1)
|
|
else
|
|
_G["GuildFrameButton"..i.."Zone"]:SetTextColor(.5, 1, 1, .5)
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end)
|
|
end
|
|
|
|
do -- add colors to friend list
|
|
hooksecurefunc("FriendsList_Update", function()
|
|
if GetNumFriends() == 0 then return end
|
|
|
|
local playerzone = GetRealZoneText()
|
|
local off = FauxScrollFrame_GetOffset(FriendsFrameFriendsScrollFrame)
|
|
|
|
for i=1, FRIENDS_TO_DISPLAY do
|
|
local info = C_FriendList.GetFriendInfoByIndex(off + i)
|
|
if not info or not info.name or info.name == _G.UNKNOWN then break end
|
|
local name = info.name
|
|
local friendName = _G["FriendsFrameFriendButton"..i.."ButtonTextName"]
|
|
local friendLoc = _G["FriendsFrameFriendButton"..i..FRIENDS_NAME_LOCATION]
|
|
local friendInfo = _G["FriendsFrameFriendButton"..i.."ButtonTextInfo"]
|
|
local caption = friendName or friendLoc
|
|
|
|
if info.connected then
|
|
local ccolor = PFUI_CLASS_COLORS[info.classFilename]
|
|
local status = info.afk and CHAT_FLAG_AFK or info.dnd and CHAT_FLAG_DND or ""
|
|
local zone = ( info.area == playerzone and "|cffffffff" or "|cffcccccc" ) .. info.area .. "|r"
|
|
local cname = ccolor:WrapTextInColorCode(name)
|
|
if playerdb[name] then
|
|
playerdb[name].lastseen = date("%a %d-%b-%Y")
|
|
playerdb[name].cname = cname
|
|
end
|
|
|
|
if friendName then
|
|
friendName:SetText(cname)
|
|
friendLoc:SetText(format(TEXT(FRIENDS_LIST_TEMPLATE), zone, status))
|
|
else
|
|
friendLoc:SetText(format(TEXT(FRIENDS_LIST_TEMPLATE), cname, zone, status))
|
|
end
|
|
|
|
friendInfo:SetText(format(TEXT(FRIENDS_LEVEL_TEMPLATE), info.level, info.className))
|
|
caption:SetVertexColor(1,1,1,.9)
|
|
friendInfo:SetVertexColor(1,1,1,.9)
|
|
else
|
|
if playerdb[name] and playerdb[name].cname and playerdb[name].level and playerdb[name].lastseen then
|
|
caption:SetText(format(TEXT(FRIENDS_LIST_OFFLINE_TEMPLATE), playerdb[name].cname))
|
|
friendInfo:SetText(format(TEXT(FRIENDS_LEVEL_TEMPLATE), playerdb[name].level, playerdb[name].lastseen))
|
|
else
|
|
caption:SetText(format(TEXT(FRIENDS_LIST_OFFLINE_TEMPLATE), name.."|r"))
|
|
friendInfo:SetText(TEXT(UNKNOWN))
|
|
end
|
|
|
|
caption:SetVertexColor(1,1,1,.4)
|
|
friendInfo:SetVertexColor(1,1,1,.4)
|
|
end
|
|
end
|
|
end)
|
|
end
|
|
|
|
do -- add colors to who list
|
|
hooksecurefunc("WhoList_Update", function()
|
|
local num, max = C_FriendList.GetNumWhoResults()
|
|
local off = FauxScrollFrame_GetOffset(WhoListScrollFrame)
|
|
|
|
local playerzone = GetRealZoneText()
|
|
local playerrace = UnitRace("player")
|
|
local playerguild = GetGuildInfo("player")
|
|
|
|
if num + 1 >= MAX_WHOS_FROM_SERVER then
|
|
WhoFrameTotals:SetText("|cffffffff" .. format(GetText("WHO_FRAME_TOTAL_TEMPLATE", nil, num), max).." |cffaaaaaa"..format(WHO_FRAME_SHOWN_TEMPLATE, MAX_WHOS_FROM_SERVER))
|
|
else
|
|
WhoFrameTotals:SetText("|cffffffff" .. format(GetText("WHO_FRAME_TOTAL_TEMPLATE", nil, num), num).." |cffaaaaaa"..format(WHO_FRAME_SHOWN_TEMPLATE, num))
|
|
end
|
|
|
|
for i=1, WHOS_TO_DISPLAY do
|
|
local info = C_FriendList.GetWhoInfo(off + i)
|
|
if info then
|
|
-- filename is the class token, so no L["class"] reversal is needed
|
|
local class = info.filename
|
|
|
|
_G["WhoFrameButton"..i.."Name"]:SetTextColor(NORMAL_FONT_COLOR.r, NORMAL_FONT_COLOR.g, NORMAL_FONT_COLOR.b)
|
|
|
|
if (UIDropDownMenu_GetSelectedID(WhoFrameDropDown) == 1) then
|
|
if (info.area == playerzone) then
|
|
_G["WhoFrameButton"..i.."Variable"]:SetTextColor(.5, 1, 1)
|
|
else
|
|
_G["WhoFrameButton"..i.."Variable"]:SetTextColor(1, 1, 1)
|
|
end
|
|
|
|
elseif (UIDropDownMenu_GetSelectedID(WhoFrameDropDown) == 2) then
|
|
if (info.fullGuildName == playerguild) then
|
|
_G["WhoFrameButton"..i.."Variable"]:SetTextColor(.5, 1, 1)
|
|
else
|
|
_G["WhoFrameButton"..i.."Variable"]:SetTextColor(1, 1, 1)
|
|
end
|
|
|
|
elseif (UIDropDownMenu_GetSelectedID(WhoFrameDropDown) == 3) then
|
|
if (info.raceStr == playerrace) then
|
|
_G["WhoFrameButton"..i.."Variable"]:SetTextColor(.5, 1, 1)
|
|
else
|
|
_G["WhoFrameButton"..i.."Variable"]:SetTextColor(1, 1, 1)
|
|
end
|
|
end
|
|
|
|
if class then
|
|
local classicon = _G["WhoFrameButton"..i].classicon
|
|
local coords = CLASS_ICON_TCOORDS[class]
|
|
local color = PFUI_CLASS_COLORS[class]
|
|
|
|
-- do we have classicons? (skin enabled?)
|
|
if classicon then
|
|
_G["WhoFrameButton"..i.."Class"]:SetTextColor(0,0,0,0)
|
|
_G["WhoFrameButton"..i.."Name"]:SetTextColor(color.r,color.g,color.b,1)
|
|
|
|
if coords then
|
|
classicon:Show()
|
|
classicon:SetTexCoord(unpack(coords))
|
|
else
|
|
classicon:Hide()
|
|
end
|
|
else
|
|
_G["WhoFrameButton"..i.."Class"]:SetTextColor(color.r,color.g,color.b,1)
|
|
end
|
|
end
|
|
|
|
local color = GetDifficultyColor(info.level)
|
|
_G["WhoFrameButton"..i.."Level"]:SetTextColor(color.r, color.g, color.b)
|
|
end
|
|
end
|
|
end)
|
|
end
|
|
end)
|