WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   General Authoring Discussion (https://www.wowinterface.com/forums/forumdisplay.php?f=20)
-   -   How to detect if the client is WotLK? (https://www.wowinterface.com/forums/showthread.php?t=17735)

Duugu 08-16-08 08:17 AM

How to detect if the client is WotLK?
 
See topic. Any idea?

Mikord 08-16-08 08:28 AM

There are several ways you can do it.

One of the easiest is to check the TOC version via GetBuildInfo.

http://www.wowwiki.com/API_GetBuildInfo


Code:

local tocVersion = select(4, GetBuildInfo())
if tocVersion >= 30000 then
 -- It's WotLK....
end


Duugu 08-16-08 11:22 AM

This will do the job. Thanks a lot Mikord.

Tekkub 08-16-08 01:52 PM

I toss this in any addon that needs to do different things in wrath than live, then just test against the global...

Code:

if IS_WRATH_BUILD == nil then IS_WRATH_BUILD = (select(4, GetBuildInfo()) >= 30000) end

dafire 08-16-08 03:21 PM

some just do

Code:

local WotLK = not not ToggleAchievementFrame

Tekkub 08-16-08 04:02 PM

GetBuildInfo is much cleaner, what if they remove that toggle function and use something else? I saw them add a togglepanel function of some sort recently, they might decide they should use that.

Fritos 08-16-08 04:48 PM

They have added a function for this specifically:

GetAccountExpansionLevel()

1 = Classic Wow
2 = The Burning Crusade
3 = Wrath of the Lich King

It'll return the value based on the level of expansions the user has.

Tekkub 08-16-08 04:56 PM

What about users that have the new client, but have not purchased the expansion? It's possible for the user to have 2.4.3, but not BC.

Fritos 08-16-08 05:04 PM

Oh I know, was giving another alternative if they are just looking to see if a specific expansion is installed.

I currently use the same code as GetBuildInfo() in my mod, was just snooping through the Interface Kit files and saw this.

Duugu 08-16-08 05:42 PM

Thanks again for all the replies. There are much more way than expected. :)

Although it doesn't really matter right now (it's all about the different UIDropDown parameters and the UnitAura function) I'll use the patch level (GetBuildInfo). Seems to be most future-proof.


All times are GMT -6. The time now is 03:33 PM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI