shagu / pfUI

A User Interface Replacement for World of Warcraft: Vanilla & TBC
https://shagu.org/pfUI
MIT License
345 stars 116 forks source link

Pull who information for players with unknown classes #1134

Closed xIGBClutchIx closed 1 year ago

xIGBClutchIx commented 1 year ago

Same as pull request #1132 just added a new branch for local development of features.

This allows for the saving of class/level information for unknown players in other chats like global. So on the next chat message, they will actually have a class color.

This patch is a bit hacky but seems to be fine and been testing and have yet to encounter any issues. Got the idea from CleanChat.

shagu commented 1 year ago

I had something similar on a local branch for a while. But never made it to the main repository, because it broke on several servers. I remember on Kronos launch, the social window became completely defunct as they time-limited the /who queries. On another realm i got disconnects for sending too many /who-queries on peak hours.

So I can't merge it as is. But I'd be fine if you add an option for it, which is disabled by default.

Also the WHO_RESULTS_TOTAL_PATTERN is locale dependent (enUS-only) which doesn't follow the goals of pfUI to run on every client locale (as mentioned in the README)

xIGBClutchIx commented 1 year ago

Sounds good, I just added an option for that with disable by default.

As for the pattern, I guess we can add that into the locales but I was assuming those were generated somehow?

shagu commented 1 year ago

Some are auto-generated, some are manual. However, I don't think it is needed at all. I used things like that on my branch:

local nothing = function() return end
local original = FriendsFrame_OnEvent

local who_query = CreateFrame("Frame")
who_query:RegisterEvent("WHO_LIST_UPDATE")
who_query:SetScript("OnEvent", function()
  if this.pending then
    -- restore everything once a query is received
    _G.FriendsFrame_OnEvent = original  
    this.pending = nil
    SetWhoToUI(0)
  end
end)

local scan_name = function(name)
  -- abort if another query is ongoing
  if who_query.pending then return end
  who_query.pending = true

  -- prepare and send the who query
  _G.FriendsFrame_OnEvent = nothing
  SetWhoToUI(1)
  SendWho("n-"..name)
end
xIGBClutchIx commented 1 year ago

Love it so much cleaner and easier