Closed jy04452927 closed 3 years ago
Hello. Can I get more info on how this bug happens? The fourth argument in the format function in that line is the character name. Can you figure out with which guild member (or maybe with one of your own chars?) this bug occurs? Before this line we truncate what we receive from blizzard (CharName-RealmName) into just CharName without -RealmName. I'm thinking maybe there's something wrong with a specific realm name or one of your members (or you) have a char with special characters that this function does not account for.
Edit: Since you posted this 10 hours ago and it was 15:10:25 for you at the time of the bug, i'm assuming you live in oceania / asia. I'm guessing japanese/chinese/korean signs are causing this?
you are the man.im grateful. yes,chinese it happens leave combat moment,but not always,i tried some,it found only happend when my target is the training dummy. sorry im not an IT guy,can't get more info professional T.T
Huh, I have no idea what's causing it and I can't replicate it myself. Download the latest version of XIV_Databar and let me know if it still happens. I made it so if that variable is nil for some reason, it'll just take the regular name (CharName-RealmName) in the tooltip. Let me know if this fixes it. Very weird bug. I'd like to see a screenshot of your guild tooltip with this (hopefully working) fix.
I am a simplified-Chinese client user.Maybe I found something related to this issue. I met an issue in Social tooltip. I made a little modification on that code block,so that I can colorize the character name of BNfriend with its class, and faction name with blue/red.
local factionColors = {
["Alliance"] = "ff008ee8",
["Horde"] = "ffc80000"
}
local classColors = {} --Wuhan.sysu: Initialize localization-independent class color table and faction color table
FillLocalizedClassList(classColors)
local classColorHex --Wuhan.sysu: Generate class color string from BNFriend's character
for k,v in pairs(classColors) do
if v == gameAccount.className then
classColorHex = RAID_CLASS_COLORS[k].colorStr
end
end
and charNameFormat expression is changed to this:
charNameFormat = "(|c" .. factionColors[faction] .. L["faction"] .. "|r|cffecd672 - |r" .. string.format("|c%s%s|r", classColorHex , charName) .. ")"
Of course I localized the faction name, that won't be a problem.
Yesterday I completed this task and it worked properly.
Today after I logged in, I found that the tooltip failed to show itself.
Error info said in this charNameFormat expression I got nil from the variable charName
.
Then I opened WowLua addon and typed some test code, and captured a screenshot of the result.
You can see the first guy in my BN friend list,he should have been in Dread Waste of Pandaria.
But comparing with the second one in friend list(A wow-classic player), his character name could not be obtained from API.
The same thing happened for his factionName, GUID, className and so on.
I am not sure what situation that is, and he didn't reply my whisper. So I have no answer.
In my opinion, this may not be a bug of this addon, it's just because of the mal-function of API or his account or character happens to be under some weird situations. Because when this guy went offline, the issue disappeared. And once again he logged in, the social tooltip worked properly as the screenshot shows below.
So maybe the author encountered the same issue? I know the author because I recommended him to report bug here. But the info he provided is not total, so I'm contacting him for further informations. Waiting for his reply.
Newest: He deleted the error info, so there's nothing more I can learn.
The author seemingly has a problem with the guild tooltip. You have a problem with the social tooltip. I don't think your issues are related (and you should be opening your own thread for this in the future). I think the issue with the classic player is that the code to determine whether someone plays classic WoW looks like this (github version, code block at lines 557 - 570, specifically line 561):
if richPresence:find("Classic") then
This looks like a hacky solution but the API call to get your friend's game client will return BNET_CLIENT_WOW
for both retail WoW and classic WoW, which means it's a little tricky to differentiate between the two. The richPresence variable will hold the "Dreadwastes in Pandaria" or whatever for a retail WoW player, but for a classic WoW player it will be "Classic - RealmName" instead (at least in the westerner client of the game). The code basically fails to realize this is a classic WoW player (and thus no charName is given via the API call), but the code executes line 602 nonetheless (where charName is utilized) because the "isClassic" check before in line 598 is false. I think this is what's causing the issue. A solution to this would be to change the line into:
if richPresence:find("Classic") or richPresence:find("...") then
Replace the "..." with whatever signs in the richPresence of the classic player means "Classic". You get the idea. Let me know if this fixes it and what the actual signs are so I can add it to the addon.
Edit: Your friend (the author) deleted the error info? Does that mean the fix I added worked for him?
Yes, thanks for your reminding, because I personally changed that line you mentioned to this
if richPresence:find(L["Classic"]) then
and added localized string in zhCN.lua for that word "Classic". And I just forget about it :(
I don't know if this is a good solution. Because this means several new localization strings should be added.
According to the latest reply I've got from the author, it seems that he hasn't met that issue since then.
Edit: I was considering opening a new thread to report this, but somehow I thought that both issues were caused by charName returning nil, so I guess maybe there is something in common.
If it's not the isClassic check then it might be related. Reading your post and the original author's post again, I think this might just be a borked API call in the chinese client. At first i thought "maybe if a player idles in the character selection screen he's shown as playing WoW but not logged into any character, resulting in a state of the API call returning WoW as the game but charName being nil", but if you're logged into just char select screen you don't show as playing any game, only when you actually log in. Also the player causing the issue is supposed to be logged into Dreadwastes.
I can't replicate this in any way. I've never had a scenario where a player is logged in but charName is nil. And it supposedly doesn't just happen with the social tooltip, but also the guild tooltip (both are using different API calls to get a friend's character name). I'm kind of lost on how to fix this or if it's even fixable and not just a straight up Blizzard problem in the chinese client.
Maybe add a check in there like if not charName then charName = "dummy value"
. This should prevent your social tooltip from getting error'd to death if it happens. It's not really a good solution but better than randomly not working API calls blowing up your addon. What a dumb bug.
Agreed, I also can't imagine how a player who can be located in certain zone but has a char name as nil and char level as 0. I have never seen this before, and I can't say its replicable.
Anyway, I put that charNameFormat block under if charName ~= nil then
and when this becomes false, let charNameFormat = "(|c|cffecd672" .. richPresence .. "|r)"
Just like you said, still better than not showing at all.
Thank you for your patience.
All good. I'm just sad that this seemingly isn't an issue with the addon. Nothing worse than shit being wrong at blizzard's side.
Message: Interface\AddOns\XIV_Databar\modules\micromenu.lua:762: bad argument #4 to 'format' (string expected, got nil) Time: Tue Nov 10 15:10:25 2020 Count: 1 Stack: Interface\AddOns\XIV_Databar\modules\micromenu.lua:762: bad argument #4 to 'format' (string expected, got nil)
Locals: