View Single Post
05-09-19, 11:50 PM   #3
gmarco
An Onyxian Warder
 
gmarco's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2009
Posts: 362
Hi,
thanks for the reply.

The only way I succeded in let things works is with code like this:

Lua Code:
  1. local function UpdatePg()
  2.  
  3.     if UnitLevel("player") == GetMaxPlayerLevel() then             
  4.    
  5.         -- Refresh the current player in the array
  6.         GMKEYSTONE_NAMES[realmName.."-"..playerName] = {}
  7.         GMKEYSTONE_NAMES[realmName.."-"..playerName]["NAME"] = realmName.."-"..playerName
  8.         GMKEYSTONE_NAMES[realmName.."-"..playerName]["CLASS"] = select(2,UnitClass("player"))
  9.         GMKEYSTONE_NAMES[realmName.."-"..playerName]["WEEKLYKEY"] = "-"
  10.         GMKEYSTONE_NAMES[realmName.."-"..playerName]["MYKEY"] = "-"
  11.        
  12.         if C_MythicPlus.GetOwnedKeystoneChallengeMapID() then
  13.             -- you have a keystone
  14.             GMKEYSTONE_NAMES[realmName.."-"..playerName]["MYKEY"] = C_ChallengeMode.GetMapUIInfo(C_MythicPlus.GetOwnedKeystoneChallengeMapID()) .. " (" .. C_MythicPlus.GetOwnedKeystoneLevel() ..")"
  15.             dataobj.text = short[C_MythicPlus.GetOwnedKeystoneChallengeMapID()] .. ":" .. C_MythicPlus.GetOwnedKeystoneLevel()
  16.            
  17.             -- you have done a dungeon+
  18.             if C_MythicPlus.GetWeeklyChestRewardLevel() ~= 0 then
  19.                 GMKEYSTONE_NAMES[realmName.."-"..playerName]["WEEKLYKEY"], _ = C_MythicPlus.GetWeeklyChestRewardLevel()
  20.             end
  21.  
  22.         else -- you don't have a keystone
  23.  
  24.             -- but you have a reward ready
  25.             if C_MythicPlus.IsWeeklyRewardAvailable() then
  26.                 GMKEYSTONE_NAMES[realmName.."-"..playerName]["WEEKLYKEY"] = "*"
  27.                 dataobj.text = "chest ready"           
  28.  
  29.             end
  30.             -- if you don't have a reward ready is already defined = "-" as default
  31.            
  32.         end
  33.        
  34.     end
  35. end
  36.  
  37.  
  38. -- code
  39.  
  40. local frame = CreateFrame("Frame")
  41. frame:RegisterEvent("PLAYER_ENTERING_WORLD")
  42. frame:SetScript("OnEvent", function(self, event, arg1)
  43.     UpdatePg()
  44. end)

Probably there will be a more correct way of doing thing but I was not able to find it
I use the idea that if I have a keystone in the bag I did at least a m+ dungeon. I hope that it is right


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

Last edited by gmarco : 05-10-19 at 12:08 AM.
  Reply With Quote