View Single Post
08-13-18, 06:58 AM   #11
cokedrivers
A Rage Talon Dragon Guard
 
cokedrivers's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2009
Posts: 325
Originally Posted by thomasjohnshannon View Post
A little off topic but you can replace the max level bit with IsPlayerAtEffectiveMaxLevel(). They just added it to the api recently. They added that one and a few others.

Lua Code:
  1. -- takes into account the current expansion
  2.  -- NOTE: it's not safe to cache this value as it could change in the middle of the session
  3. function GetEffectivePlayerMaxLevel()
  4.   return MAX_PLAYER_LEVEL_TABLE[GetExpansionLevel()];
  5. end
  6.  
  7. function IsLevelAtEffectiveMaxLevel(level)
  8.   return level >= GetEffectivePlayerMaxLevel();
  9. end
  10.  
  11. function IsPlayerAtEffectiveMaxLevel()
  12.   return IsLevelAtEffectiveMaxLevel(UnitLevel("player"));
  13. end
thank you for this
  Reply With Quote