Thread Tools Display Modes
Prev Previous Post   Next Post Next
02-17-17, 09:41 PM   #1
Mythricia
A Murloc Raider
 
Mythricia's Avatar
Join Date: Feb 2017
Posts: 6
Angry Programmatically determine instance expansion?

Heyo, new-ish addon dev here wading my way through the WoW API and Lua.

So far so good, although today I spent basically the entire day trying to do what the title suggests: Determine which expansion the instance you're currently inside, belongs to.

Somewhat of a mouthful of a sentence, but the idea seems simple enough. Or so I thought, but I've yet to find a way.

I got close using some of the Encounter Journal API: EJ_GetTierInfo() returns the full written name of the expansion, provided a "tier", such as 1 (Classic), 2 (Burning Crusade) and so on. And, you can use EJ_GetCurrentTier() to get the tier of the current instance... Except not really.

For some bizarre reason, despite GetCurrentInstance returning the current instance that the player is actually inside, GetCurrentTier doesn't. It returns the "tier" selected in the Encounter Journal! And that, in turn, is sadly not consistent. If you enter an instance, it does not change - meaning something like;
Lua Code:
  1. local instanceExp = EJ_GetTierInfo(EJ_GetCurrentTier())
^ Doesn't return the expected expansion, although it does return an expansion, just not related at all to the instance you're currently inside. And as far as I know, there's no way to force the EJ to set itself to the current instance tier, so there's no way to force an update the same way we do with the world map to get current player position for example... I looked at Blizzards own EJ code, and they do exactly the above query to initialize the EJ interface, but I suspect they have the same results and just don't worry about it.

TL;DR - I can't for the life of me figure out a way to do this. I really, really really really really don't want to have to maintain a hand-written table of Instance ID/Name -> Expansion relations... Prone to typos, mis-spellings, needs to be updated by hand every time something changes or new content comes out.. Just no. I auto-generate a table of continent names purely programmatically due to this exact reason :\

Anybody has any secret sauce that could help this?
  Reply With Quote
 

WoWInterface » Developer Discussions » Lua/XML Help » Programmatically determine instance expansion?


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