Mercurial > wow > wowdb-profiler
diff Main.lua @ 143:15ff29752523
Workaround for strange WoW client handling of Micro Dungeons.
author | James D. Callahan III <jcallahan@curse.com> |
---|---|
date | Tue, 02 Oct 2012 10:58:33 -0500 |
parents | 2c2b7d91ca19 |
children | ba5422e37516 |
line wrap: on
line diff
--- a/Main.lua Thu Sep 27 08:33:48 2012 -0500 +++ b/Main.lua Tue Oct 02 10:58:33 2012 -0500 @@ -312,6 +312,7 @@ if map_id < 0 then empty_count = empty_count + 1 + empty_count = empty_count + 1 end end @@ -575,13 +576,42 @@ end -- do-block -function WDP:SetCurrentAreaID(event_name) - local map_area_id = _G.GetCurrentMapAreaID() - _G.SetMapToCurrentZone() +do + -- MapFileName = MapAreaID + local MICRO_DUNGEON_IDS = { + ShrineofTwoMoons = 903, + ShrineofSevenStars = 905, + } - current_area_id = _G.GetCurrentMapAreaID() - _G.SetMapByID(map_area_id) -end + -- Contains a dirty hack due to Blizzard's strange handling of Micro Dungeons; GetMapInfo() will not return correct information + -- unless the WorldMapFrame is shown. + function WDP:SetCurrentAreaID(event_name) + local world_map = _G.WorldMapFrame + local map_visible = world_map:IsVisible() + local sfx_value = _G.tonumber(_G.GetCVar("Sound_EnableSFX")) + + if not map_visible then + _G.SetCVar("Sound_EnableSFX", 0) + world_map:Show() + end + local micro_dungeon_id = MICRO_DUNGEON_IDS[select(5, _G.GetMapInfo())] + + if micro_dungeon_id then + current_area_id = micro_dungeon_id + else + local map_area_id = _G.GetCurrentMapAreaID() + _G.SetMapToCurrentZone() + + current_area_id = _G.GetCurrentMapAreaID() + _G.SetMapByID(map_area_id) + end + + if not map_visible then + world_map:Hide() + _G.SetCVar("Sound_EnableSFX", sfx_value) + end + end +end -- do-block -----------------------------------------------------------------------