Fixing AlphaMap for 4.1
This thread is about discussion to fix the Addon AlphaMap3 for WoW 4.1. I suspect
the author has gone inactive (at least I could not manage to contact him) and this thread
so far discusses what I already fixed myselves (getting the Addon partially working again).
I am looking for help to get the remaining problems fixed.
You can also reach me at tirionareonwe@gmail.com, if you are interested to help working
on this. A contact to the original authors of AlphaMap3 also would be great!
Thanks to all in advance!
1. The lua Errors
This is the trivial part. In the File AlphaMap3\AlphaMap3.lua are two occurences of
Code:
for i = 1, NUM_WORLDMAP_DETAIL_TILES, 1 do
Both have to be changed into
Code:
for i = 1, GetNumberOfDetailTiles(), 1 do
After this change AlphaMap "principially" runs again.
2. The problem with TomTom\GetMapFile()
Currently AlphaMap3 uses (if TomTom is found installed) a method called GetMapFile().
The most recent version of TomTom does no longer support this method. Principially a
bugfix *would* be to just include the code part from old TomTom into AlphaMap3.lua.
Like including the following lines before
Code:
function AM_DrawTomToms(cont, zone)
in AlphaMap\AlphaMap3.lua:
Code:
do
local continentMapFile = {
[WORLDMAP_COSMIC_ID] = "Cosmic", -- That constant is -1
[0] = "World",
[1] = "Kalimdor",
[2] = "Azeroth",
[3] = "Expansion01",
[4] = "Northrend",
[5] = "TheMaelstromContinent",
}
local mapCZtoFile = {}
_G.mc = mapCZtoFile
local reverseMapFileC = {}
local reverseMapFileZ = {}
for cid, zlist in pairs{GetMapContinents()} do
for zid, zname in pairs{GetMapZones(cid)} do
SetMapZoom(cid, zid)
local mapFile = GetMapInfo()
reverseMapFileC[mapFile] = cid
reverseMapFileZ[mapFile] = zid
mapCZtoFile[cid] = mapCZtoFile[cid] or {}
mapCZtoFile[cid][zid] = mapCZtoFile[cid][zid] or {}
mapCZtoFile[cid][zid] = mapFile
end
end
for cid, mapFile in pairs(continentMapFile) do
reverseMapFileC[mapFile] = cid
reverseMapFileZ[mapFile] = 0
mapCZtoFile[cid] = mapCZtoFile[cid] or {}
mapCZtoFile[cid][0] = mapCZtoFile[cid][0] or {}
mapCZtoFile[cid][0] = mapFile
end
function GetMapFile(C, Z)
if not C or not Z then return end
local c = mapCZtoFile[C]
if c then
return c[Z]
end
end
function GetCZ(mapFile)
return reverseMapFileC[mapFile], reverseMapFileZ[mapFile]
end
end
The problem: This does not throw anymore lua errors, *but* it does not work either (see below).
3. The Problem with recent TomTom
On this problem I did not find a solution yet. If I use the "old TomTom" and am for example in Stormwind and then use the Selector to select the map of IronForge, I get the following code called *3* times:
Code:
if ( AlphaMapFrame:IsVisible() ) then
-- Suppress map changes caused by background Blizz map updates when trying to view instances... by re-passing the instance data
AlphaMapFrame_Update(amAlphaMapMap);
end
On the first call GetCurrentMapZone() is 14 -"Ironforge", on the second it is 26 - "Stormwind", on the third it is 14 - "Ironforge" again and everything is fine.
Now if I use the NEW TomTom, a FOURTH call happens, which gives a GetCurrentMapZone() of
"Stormwind" (or 26). And the map switches back to Stormwind. I noticed this only seems to happen in capital cities, outside it is fine.
This code seems to be related to a WORLD_MAP_UPDATE event which WoW regularly triggers.
AlphaMap as far as I understand uses this to refresh it's map (and "skips" events, if the user-selected mapchange would be overwritten by the "current" map). This skipping seems to no longer work if the most recent TomTom is installed. By introducing debug output I found out that
the
Code:
if ( AlphaMapFrame:IsVisible() ) then
in the above code snippet is entered a FOURTH TIME in case of the new TomTom, while the code piece is REACHED, but RETURNS FALSE (so is NOT entered) for the old version. I suspect
the whole thing has something to do with
Code:
AM_WorldMapSelected
in the AlphaMap code and especially with this code
Code:
if ( ( inBG ) or ( newMapFileName ~= prvMapFileName ) ) then
if ( not inBG ) then
AML.AM_ClearHighlights();
end
prvMapFileName = newMapFileName;
if ( not AM_WorldMapSelected ) then
currentArea = newMapFileName;
end
end
in the AlphaMapFrame_OnEvent which I suspect is the "skipping code" for the event. But I cannot
proof it, and do not understand the AlphaMap event code fully. Another option would be changes in how WoW handles the WORLD_MAP_UPDATE (but then it would be strange how this is influenced by the TomTom versions).
Any help/suggestions appreciated
4. The problem with QuestHelper2
If I - while inside a major city only !!!!!!!!!! - switch to a different map (some work, though not the one of another major city... switching in Stormwind to the Stranglethorn map for example works, despite problem 3) and mouseover a QuestHelper2 POI. You will notice the code SPAMMING
WORLD_MAP_UPDATE events. The context sensitive menu appears, to TomTom to the quest
location, but (!) is in a split-second overwritten by AlphaMap map refresh. This did not happen
before (I suspect a change in WORLD_MAP_UPDATE handling in WoW 4.1). This happens
no matter which TomTom version you have installed.
Interesting also, that for example if instead of sitting in Stormwind you sit in Zul'Gurrub, the
context sensitive menu appears just fine, with no extra WORLD_MAP_UPDATE spamming.
So it seems this is only in the main cities.
I did not fully understand this problem and could not find out anything more. I also found that
if I changed the timeout in AlphaMapFrame_OnEvent()
Code:
local t = GetTime();
if ( ( t - AML.multiTimer ) > 0.025 ) then
AML.multiCounter = 0;
AML.multiTimer = t;
else
AML.multiCounter = AML.multiCounter + 1;
if ( AML.multiCounter > 28 ) then
return;
end
end
from 0.025 to 3, I would get a "stable" display of the context sensitive menu. But 3 is too big,
as then if I switched a map manually the old map might still be displayed, so this is no solution
A different mechanism would be needed to exclude the spamming.
MagicSN