Thread Tools Display Modes
04-23-22, 07:09 AM   #1
gmarco
An Onyxian Warder
 
gmarco's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2009
Posts: 362
Is it possible for others players ?

Hi all,

I am trying to put a m+ score in the tooltip, using the function:

C_PlayerInfo.GetPlayerMythicPlusRatingSummary(name).currentSeasonScore

But it works only for me



The code is:

Lua Code:
  1. if event == "UPDATE_MOUSEOVER_UNIT" then
  2.         if (UnitIsPlayer("mouseover")) then
  3.             local name,realm = UnitFullName("mouseover")
  4.            
  5.             -- realm is needed ?
  6.             if realm == nil then
  7.                 realm = GetRealmName()
  8.             end
  9.            
  10.             local score = C_PlayerInfo.GetPlayerMythicPlusRatingSummary(name).currentSeasonScore
  11.             local r, g, b = C_ChallengeMode.GetDungeonScoreRarityColor(C_PlayerInfo.GetPlayerMythicPlusRatingSummary(name).currentSeasonScore):GetRGB()
  12.    
  13.             GameTooltip:AddLine(" ")
  14.             GameTooltip:AddDoubleLine("Mythic+ score",score,1,1,0,r,g,b)       
  15.             GameTooltip:Show()
  16.         end
  17.     end

The links to the function on wowpedia is this:
https://wowpedia.fandom.com/wiki/API...sRatingSummary

and it states:
Returns the players mythic+ rating summary which includes the runs they've completed as well as their current season m+ rating

Now I am not a native speakers but this could be understood also as other players as well ...

Thanks for any help
__________________
This is Unix-Land. In quiet nights, you can hear the Windows machines reboot.
  Reply With Quote
04-23-22, 10:20 PM   #2
Ketho
A Pyroguard Emberseer
 
Ketho's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 1,026
You need to use the unit id
  Reply With Quote
04-24-22, 10:01 AM   #3
gmarco
An Onyxian Warder
 
gmarco's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2009
Posts: 362
Hi Ketho,

now it works thanks to your input and tips.

I have tried also with unitid in my past tries but I use in a wrongly way.

I used:

Lua Code:
  1. guid = UnitGUID("unit")

and then that value in the function to calculate the score.
But it doesn't work.

Now following your suggest I change the code in this way and it works nicely:

Lua Code:
  1. if event == "UPDATE_MOUSEOVER_UNIT" then
  2.         if (UnitIsPlayer("mouseover")) then
  3.             local score = C_PlayerInfo.GetPlayerMythicPlusRatingSummary("mouseover").currentSeasonScore
  4.             local r, g, b = C_ChallengeMode.GetDungeonScoreRarityColor(C_PlayerInfo.GetPlayerMythicPlusRatingSummary("mouseover").currentSeasonScore):GetRGB()
  5.             GameTooltip:AddLine(" ")
  6.             GameTooltip:AddDoubleLine("Mythic+ score",score,1,1,0,r,g,b)       
  7.             GameTooltip:Show()
  8.         end
  9.     end

Don't know why it didn't work in other way :/
But now it works and I am happy




Thanks so much for you tips.
__________________
This is Unix-Land. In quiet nights, you can hear the Windows machines reboot.

Last edited by gmarco : 04-24-22 at 10:05 AM.
  Reply With Quote
04-27-22, 06:26 PM   #4
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 10,860
Because "unit" isn't a valid UnitID. https://wowpedia.fandom.com/wiki/UnitId
__________________
"You'd be surprised how many people violate this simple principle every day of their lives and try to fit square pegs into round holes, ignoring the clear reality that Things Are As They Are." -Benjamin Hoff, The Tao of Pooh

  Reply With Quote
04-27-22, 08:56 PM   #5
SDPhantom
A Pyroguard Emberseer
 
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 2,313
A note to add, player names are valid UnitIDs as long as they're in your party/raid.
__________________
WoWInterface AddOns
"All I want is a pretty girl, a decent meal, and the right to shoot lightning at fools."
-Anders (Dragon Age: Origins - Awakening)
  Reply With Quote
04-30-22, 11:52 PM   #6
gmarco
An Onyxian Warder
 
gmarco's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2009
Posts: 362
Good Morning.

Ah thanks all for the usual kind replies.
Now I explain why sometime it works with player names sometimes not

Thanks so much to everyone and especially to SDPhantom for let me clarify this oddity
__________________
This is Unix-Land. In quiet nights, you can hear the Windows machines reboot.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Is it possible for others players ?

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off