Quantcast

Use the continent for the odd place without instanceIDs

Adrian L Lange [08-27-14 - 13:19]
Use the continent for the odd place without instanceIDs
Filename
BonusRollPreview.lua
encounters/Pandaria.lua
diff --git a/BonusRollPreview.lua b/BonusRollPreview.lua
index 897a509..bb134e0 100644
--- a/BonusRollPreview.lua
+++ b/BonusRollPreview.lua
@@ -1,9 +1,6 @@
 local WoD = select(4, GetBuildInfo()) >= 6e4

 local _, ns = ...
-local encounterIDs = ns.encounterIDs
-local itemBlacklist = ns.itemBlacklist
-
 local currentEncounterID
 local itemButtons = {}

@@ -245,7 +242,7 @@ function Container:Populate()
 	local numItems = 0
 	for index = 1, EJ_GetNumLoot() do
 		local name, texture, slot, itemClass, itemID, itemLink, encounterID = EJ_GetLootInfoByIndex(index)
-		if(encounterID == currentEncounterID and not itemBlacklist[itemID]) then
+		if(encounterID == currentEncounterID and not ns.itemBlacklist[itemID]) then
 			numItems = numItems + 1

 			local ItemButton = GetItemLine(numItems)
@@ -303,7 +300,14 @@ function Container:Update()
 	EJ_SetDifficulty(difficulty > 0 and difficulty or 4)

 	local currentInstance = EJ_GetCurrentInstance()
-	EJ_SelectInstance(currentInstance > 0 and currentInstance or 322)
+	if(not currentInstance or currentInstance == 0) then
+		local oldMap = GetCurrentMapAreaID()
+		SetMapToCurrentZone()
+		currentInstance = ns.continents[GetCurrentMapContinent()]
+		SetMapByID(oldMap)
+	end
+
+	EJ_SelectInstance(currentInstance)
 	EJ_SelectEncounter(currentEncounterID)

 	local _, _, classID = UnitClass('player')
@@ -327,7 +331,7 @@ end

 function Container:SPELL_CONFIRMATION_PROMPT(event, spellID, confirmType)
 	if(confirmType == CONFIRMATION_PROMPT_BONUS_ROLL) then
-		currentEncounterID = encounterIDs[spellID]
+		currentEncounterID = ns.encounterIDs[spellID]

 		if(currentEncounterID) then
 			self:RegisterEvent('EJ_LOOT_DATA_RECIEVED')
diff --git a/encounters/Pandaria.lua b/encounters/Pandaria.lua
index 2ae0ab0..684ab9f 100644
--- a/encounters/Pandaria.lua
+++ b/encounters/Pandaria.lua
@@ -1,6 +1,8 @@

 local _, ns = ...
-ns.encounterIDs = {}
+ns.encounterIDs = ns.encounterIDs or {}
+ns.itemBlacklist = ns.itemBlacklist or {}
+ns.continents = ns.continents or {}

 -- http://www.wowhead.com/spells=0?filter=na=Bonus;cr=84:109:16;crs=1:6:5
 for spellID, encounterID in next, {
@@ -77,7 +79,6 @@ Handler:SetScript('OnEvent', function()
 	ns.encounterIDs[145913] = (select(3, EJ_GetEncounterInfoByIndex(5)))
 end)

-ns.itemBlacklist = {}
 for _, itemID in next, {
 	-- Mounts
 	87777, -- Reins of the Astral Cloud Serpent
@@ -100,3 +101,5 @@ for _, itemID in next, {
 } do
 	ns.itemBlacklist[itemID] = true
 end
+
+ns.continents[6] = 322