sylvanaar / prat-3-0

Prat-3.0 is a chat enhancement addon for world of warcraft
https://www.curseforge.com/wow/addons/prat-3-0
GNU General Public License v3.0
25 stars 45 forks source link

Missing Chat Icons #148

Closed djayk85 closed 3 years ago

djayk85 commented 3 years ago

Prat isn't compatible with the new mentor system. It doesn't show the Murloc or Flag Icons in the chat window

WanderingFox commented 3 years ago

Worth noting that the icon renders fine (it shows up in the "you've joined newplayer chat" message, but I can confirm that prat is eating the flag/murloc icons that are supposed to be in front of players names in the actual chat messages.

WanderingFox commented 3 years ago

Edit: Swapped this to the proper way to handle it. See the linked PR for the proper fix.

Here's a really quick hack that should get the special icons showing up in chat again in the same way that blizzard does it. I haven't really tested it extensively, but it appears to work.

The channel is pretty quiet atm, but some quick contrived testing says this should do the trick...

Changes: in modules/PlayerNames.lua

find:

Prat.RegisterChatEvent(self, "Prat_Ready")

add after:

Prat.RegisterMessageItem("SPECIALFLAG", "PLAYER", "before")

find:

    -- Add level information if needed
    if level and self.db.profile.level then
      message.PLAYERLEVEL = CLR:Level(tostring(level), level, Name, class)
      message.PREPLAYERDELIM = ":"
    end

add after:

    -- Add special chat icon
    -- see: framexml ChatFrame.lua lines ~3394-3415
    local specialFlag = message.ORG.ARGS[6]
    if specialFlag ~= "" then
      if specialFlag == "GM" or specialFlag == "DEV" then
        -- Add Blizzard Icon if  this was sent by a GM/DEV
       message.SPECIALFLAG = "|TInterface\\ChatFrame\\UI-ChatIcon-Blizz:12:20:0:0:32:16:4:28:0:16|t "
      elseif specialFlag == "GUIDE" then
        if C_PlayerMentorship.IsActivePlayerConsideredNewcomer() then
          message.SPECIALFLAG = NPEV2_CHAT_USER_TAG_GUIDE .. " "
        end
      elseif specialFlag == "NEWCOMER" then
        if IsActivePlayerMentor() then
          message.SPECIALFLAG = NPEV2_CHAT_USER_TAG_NEWCOMER
        end
      else
          message.SPECIALFLAG = _G["CHAT_FLAG_"..specialFlag]
      end
    end

Patch:

@@ -419,9 +419,11 @@
     Prat.RegisterChatEvent(self, "Prat_FrameMessage")
     Prat.RegisterChatEvent(self, "Prat_Ready")

+    Prat.RegisterMessageItem("SPECIALFLAG", "PLAYER", "before")
+
     Prat.RegisterMessageItem("PREPLAYERDELIM", "PLAYER", "before")
     Prat.RegisterMessageItem("POSTPLAYERDELIM", "Ss", "after")

@@ -900,6 +902,26 @@
       message.PREPLAYERDELIM = ":"
     end

+    -- Add special chat icon
+    -- see: framexml ChatFrame.lua lines ~3394-3415
+    local specialFlag = message.ORG.ARGS[6]
+    if specialFlag ~= "" then
+      if specialFlag == "GM" or specialFlag == "DEV" then
+        -- Add Blizzard Icon if  this was sent by a GM/DEV
+      message.SPECIALFLAG = "|TInterface\\ChatFrame\\UI-ChatIcon-Blizz:12:20:0:0:32:16:4:28:0:16|t "
+      elseif specialFlag == "GUIDE" then
+        if C_PlayerMentorship.IsActivePlayerConsideredNewcomer() then
+          message.SPECIALFLAG = NPEV2_CHAT_USER_TAG_GUIDE .. " "
+        end
+      elseif specialFlag == "NEWCOMER" then
+        if IsActivePlayerMentor() then
+          message.SPECIALFLAG = NPEV2_CHAT_USER_TAG_NEWCOMER
+        end
+      else
+          message.SPECIALFLAG = _G["CHAT_FLAG_"..specialFlag]
+      end
+    end
+
     -- Add raid subgroup information if needed
     if subgroup and self.db.profile.subgroup and (GetNumRaidMembers() > 0) then
       message.POSTPLAYERDELIM = ":"

edit: Submitted the above patch as PR #156

bread24 commented 3 years ago

I did what you suggested but now I'm getting this error message.

1x Prat-3.0-3.9.0-5-g0faef9a\modules\PlayerNames.lua:1609: attempt to index field 'ARGS' (a nil value) [string "@Prat-3.0-3.9.0-5-g0faef9a\modules\PlayerNames.lua"]:1609: in function FormatPlayer' [string "@Prat-3.0-3.9.0-5-g0faef9a\modules\PlayerNames.lua"]:1766: in function?' [string "@Ace3\CallbackHandler-1.0\CallbackHandler-1.0-7.lua"]:119: in function <...Ons\Ace3\CallbackHandler-1.0\CallbackHandler-1.0.lua:119>

[string "@Ace3\CallbackHandler-1.0\CallbackHandler-1.0-7.lua"]:29: in function <...Ons\Ace3\CallbackHandler-1.0\CallbackHandler-1.0.lua:25> [string "@Ace3\CallbackHandler-1.0\CallbackHandler-1.0-7.lua"]:64: in function `Fire' [string "@Prat-3.0-3.9.0-5-g0faef9a\addon\addon.lua"]:673: in function <Prat-3.0\addon\addon.lua:613>

[string "@FrameXML\ChatFrame.lua"]:3031: in function `ChatFrame_OnEvent'

WanderingFox commented 3 years ago

Did you make the edits yourself? Could you try the copy from the pr?

Ill try the patch again from the new version and see if something is wrong as well.

I've been running the above for a week now with no troubles...

bread24 commented 3 years ago

I copied from your fork of the project, but my newcomer chat is pretty quiet so I can't test it at the moment.

WanderingFox commented 3 years ago

If that doesn't work I think I might know what's up.

When I can get back into the game I'm going to take a different approach to the patch (doing it in chatsections.lua where Prat's original code resides, rather than in playernames.lua)

I think that's probably the more "right" way to do it from Prat's perspective. I'll update the PR once I can get on to test and hopefully that does it in a way that is less conflict-inducing.

WanderingFox commented 3 years ago

Okay I reimplemented this in the same area as the original prat code.

Could you give https://github.com/WanderingFox/prat-3-0 another shot?

I'm testing it currently. If it looks good I'll re-open the PR.

So far it's not erroring, and it should do the same exact thing that Prat currently does with the blizz icon (mirroring how Blizzard does it in ChatFrame.lua).

WanderingFox commented 3 years ago

Some initial testing shows that this works a treat and should replicate the existing functionality without having to mess with PlayerNames.lua.

See PR #175

bread24 commented 3 years ago

I still don't see the icons after using the new version of the fork, but I might not have the icons turned on, because all I see is this Screenshot 2020-10-25 160619 Newcomer Chat got auto assigned to /4 for me

WanderingFox commented 3 years ago

Strange it's working for me. When did you grab the fork? I just updated it like 10 minutes ago to fix a bug.

Also, are you sure they're newcomers and not other guides?

The way the system is implemented (at least in the default blizzard chat frame) is that guides do not see icons for other guides, only for newcomers (and vice versa, newcomers don't see other newcomers, just guides).

bread24 commented 3 years ago

I just redownloaded your fork, and reloaded wow, I'll wait a bit and see if they pop up. It's a bit hard to tell at the moment, as the people that are using it are not from my server cluster.

WanderingFox commented 3 years ago

Spun up a trail account to make sure it's working and it seems to work just fine for me, at least in whispers. There might be a problem explicitly with the newcomer chat channel, but like you I can't really get a consistent test for it.

Keep me posted though!

I'm committed to finding the solution for this one :)

image image

bread24 commented 3 years ago

looks like it's working for me now 👍 Screenshot 2020-10-25 163446