diff --git a/QuestHelper/LibMapDataInit.lua b/QuestHelper/LibMapDataInit.lua new file mode 100644 index 0000000..eecfaea --- /dev/null +++ b/QuestHelper/LibMapDataInit.lua @@ -0,0 +1,3 @@ +assert(QuestHelper and type(QuestHelper) == "table", "Ooops, can't load right now.") + +QuestHelper.LibMapData = LibStub("LibMapData-1.0") diff --git a/QuestHelper/QuestHelper.toc b/QuestHelper/QuestHelper.toc index 69b82cd..33f5451 100644 --- a/QuestHelper/QuestHelper.toc +++ b/QuestHelper/QuestHelper.toc @@ -62,6 +62,8 @@ libs\AceConfig-3.0\AceConfig-3.0.xml bst_astrolabe.lua libs\AstrolabeQH\Load.xml +#MapMonitor.lua +#AstroLabeToLibMapDataConversionStub.lua bst_ctl.lua libs\ChatThrottleLib\ChatThrottleLib.xml @@ -70,6 +72,11 @@ bst_range.lua libs\LibRangeCheck-2.0\CallbackHandler-1.0\CallbackHandler-1.0.xml libs\LibRangeCheck-2.0\LibRangeCheck-2.0.lua +bst_mapdata.lua +libs\LibMapData-1.0\Libs\CallbackHandler-1.0 +libs\LibMapData-1.0\library.lua +LibMapDataInit.lua + changes.lua lang.lua diff --git a/QuestHelper/arrow.lua b/QuestHelper/arrow.lua index c49649c..f142380 100644 --- a/QuestHelper/arrow.lua +++ b/QuestHelper/arrow.lua @@ -198,6 +198,7 @@ OnUpdate = function() self:Show() local dist, dx, dy = QuestHelper.Astrolabe:ComputeDistance(QuestHelper.collect_rc, QuestHelper.collect_rz, QuestHelper.collect_rx, QuestHelper.collect_ry, active_point.c, active_point.z, active_point.x, active_point.y) + --print(QuestHelper.collect_rc, QuestHelper.collect_rz, QuestHelper.collect_rx, QuestHelper.collect_ry, active_point.c, active_point.z, active_point.x, active_point.y) local text = "" diff --git a/QuestHelper/collect_location.lua b/QuestHelper/collect_location.lua index bc966b4..853b063 100644 --- a/QuestHelper/collect_location.lua +++ b/QuestHelper/collect_location.lua @@ -13,11 +13,63 @@ local function signed(c) --return strchar(c) end +local dec2hex = {[0] = "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F"} + +local hex2dec = {} + +for k, v in pairs(dec2hex) do hex2dec[v] = k end + +local function tohex(c) + return dec2hex[c] +end + +local function lgToDec(c, pos) + if not c or c == "" then return 0 end + + local ret = 0 + + pos = pos or 0 + + if pos == 0 then c = string.reverse(c) end + + ret = todec(string.sub(c,1,1)) * math.pow(16, pos) + lgToDec(string.sub(c, 2), pos + 1) + + return ret +end + +local function lgToHex(c, pos) + local ret, rem, hex + + pos = pos or 0 + c = c or 0 + local minVal = math.pow(16, pos) + local maxVal = math.pow(16, pos+1) - 1 + + if c > maxVal then + rem, hex = lgToHex(c, pos + 1) + else + rem, hex = c, "" + end + + local mult = 0 + + while rem >= minVal do + mult = mult + 1 + rem = rem - minVal + end + + return rem, hex .. tohex(mult) +end + +local function todec(c) + return hex2dec[c] +end + local function float(c) -- if not c then c = -128 end -- QuestHelper: Assert( c >= -128, string.format("c is too small. It is %s.", tostring(c))) -- QuestHelper: Assert( c < 128, string.format("c is too big. It is %s.", tostring(c))) - local ret = tostring(c):gsub(",",".") -- eliminate issues with locales that use a comma as the decimal separator. + local ret = tohex(math.floor(128 * c)) return ret end @@ -26,9 +78,10 @@ local function BolusizeLocation(delayed, c, z, x, y, dl, mid, mf, f) -- x and y are floating-point values, generally between 0 and 1. We'll dedicate 24 bits to the fractional part, largely because we can. -- Overall we're using a weird 11 bytes on this. Meh. -- Also, any nil values are being turned into MIN_WHATEVER. - local float_x = float(x) - local float_y = float(y) + local float_x = x + local float_y = y local loc = {} + --local locStr = (delayed and 1 or 0) .. lgToHex(mid) .. tohex(dl) .. float(x) .. float(y) loc["delayed"] = (delayed and 1 or 0) loc["c"] = c loc["z"] = z diff --git a/QuestHelper/db_get.lua b/QuestHelper/db_get.lua index 8ed5677..4147ba3 100644 --- a/QuestHelper/db_get.lua +++ b/QuestHelper/db_get.lua @@ -143,52 +143,158 @@ function DB_HasItem(group, id) return false end - -local function GetZonePOIs(c, z) - SetMapZoom(c, z) - local pois = {} - local count = 1 - local hasQuests = false - local numEntries = QuestMapUpdateAllQuests() +local function GetBlizzardQuestInfoFrameMainLoop(qid) + local POIFrame, questFrame + QuestMapUpdateAllQuests() QuestPOIUpdateIcons() - local numCompleteedQuests = 0 - local mapID = GetMapInfo() - for i = 1, numEntries do - local questId, questLogIndex = QuestPOIGetQuestIDByVisibleIndex(i) - local _, x, y, objective = QuestPOIGetIconInfo(questId) - if x and y then - local questTitle, level, questTag, suggestedGroup, isHeader, isCollapsed, isComplete, isDaily = GetQuestLogTitle(questLogIndex) - numObjectives = GetNumQuestLeaderBoards(questLogIndex) - if isComplete and isComplete < 0 then - isComplete = false - elseif numObjectives == 0 then - isComplete = true - end - local poi = {} - if pois[questId] then poi = pois[questId] - else pois[questId] = poi end + WorldMapFrame_UpdateQuests() - if not poi.questLogIndex then - poi.questLogIndex = questLogIndex - poi.questId = questId - poi.name = questTitle - poi.criteria = {} - poi.criteria.loc = {} + for i = 1, MAX_NUM_QUESTS do + questFrame = _G["WorldMapQuestFrame" .. i] + if questFrame then + if questFrame.questId == qid then + POIFrame = questFrame.poiIcon + break end - - local loc = {} - loc.c = c - loc.x = x - loc.y = y - loc.p = mapID - loc.completed = isComplete - poi.criteria.loc:insert(loc) - count = count+1 - hasQuests = true end end - return pois, hasQuests + return questFrame, POIFrame +end + +local function GetBlizzardQuestInfoFrame(qid, map) + if map then SetMapByID(map) end + QuestMapUpdateAllQuests() + QuestPOIUpdateIcons() + WorldMapFrame_UpdateQuests() + + local POIFrame + local questFrame + local dLvl + + if map and GetNumDungeonMapLevels() > 0 then -- Suspicion is that each dungeon level has to be iterated. + for i = 1, GetNumDungeonMapLevels() do + SetDungeonMapLevel(i) + questFrame, POIFrame = GetBlizzardQuestInfoFrameMainLoop(qid) + if POIFrame then + dLvl = i + break + end + end + else -- Only need to call once + questFrame, POIFrame = GetBlizzardQuestInfoFrameMainLoop(qid) + end + + return questFrame, POIFrame, dLvl or 0 +end + +local function GetBlizzardQuestInfo(qid) + local questFrame, POIFrame, qdLvl = GetBlizzardQuestInfoFrame(qid) + local mapId = GetCurrentMapAreaID() + local c, z + local dLvl = false + local qMapId + + if GetNumDungeonMapLevels() > 0 then dLvl = GetCurrentMapDungeonLevel() end + + if not POIFrame then + -- Iterate over all maps to try and find it (we are of course assuming that the player has the quest, otherwise we will be SOL. + local maps = QuestHelper.LibMapData:GetAllMapIDs() + for _, map in pairs(maps) do + if map >= 0 and not QuestHelper.LibMapData:IsContinentMap(map) then + + questFrame, POIFrame, qdLvl = GetBlizzardQuestInfoFrame(qid, map) + + if POIFrame then + qMapId = map + break + end + end + end + c, z = GetCurrentMapContinent(), GetCurrentMapZone() + SetMapByID(mapId) + if not POIFrame then return nil end -- At this point we either have the quest or we are SOL. + else + qMapId = mapId + c, z = GetCurrentMapContinent(), GetCurrentMapZone() + end + + local _, _, _, x, y = POIFrame:GetPoint() + + if not x or not y then return nil end + + local frame = WorldMapDetailFrame + local width, height = frame:GetWidth(), frame:GetHeight() + local wm_scale, poi_scale = frame:GetScale(), POIFrame:GetScale() + + -- Convert from yards to % + local cx = ((x / (wm_scale / poi_scale)) / width) + local cy = ((-y / (wm_scale / poi_scale)) / height) + + + if cx < 0 or cx > 1 or cy < 0 or cy > 1 then return nil end + + -- Now we want to convert to proper format for QH. + -- Look at WoWPro:findBlizzCoords(qid) for remainder + local _, contX, contY = QuestHelper.Astrolabe:GetAbsoluteContinentPosition(c, z, cx, cy) + --contX, contY = contX / QuestHelper.Astrolabe:GetZoneWidth(c, 0), contY / QuestHelper.Astrolabe:GetZoneHeight(c, 0) + + local solid = { ["continent"] = c, contX - 10, contY - 10, contX + 10, contY - 10, contX + 10, contY + 10, contX - 10, contY + 10 } + local ret = {} + + ret.solid = solid + ret.criteria = {} + + local questIdx = GetQuestLogIndexByID(qid) + local numCrit = GetNumQuestLeaderBoards(questIdx) + local loc = { ["loc"] = { { ["p"] = qMapId, ["x"] = contX, ["y"] = contY} } } + for i = 1, numCrit do + table.insert(ret.criteria, loc) + end + + ret.name = GetQuestLogTitle(questIdx) + ret.Blizzard = true + return ret +end + +local function GetLightHeadedQuestInfo(qid) + if not LightHeaded or type(LightHeaded) ~= "table" then return nil end -- LH not loaded + + local npcid, npcname, stype + local coords = {} + + _, _, _, _, _, _, _, stype, npcname, npcid = LightHeaded:GetQuestInfo(qid) + + -- Note: If we want the quest giver, we need fields 5, 6 and 7 above, rather than what we have gotten. + -- + if stype == "npc" then + local data = LightHeaded:LoadNPCData(tonumber(npcid)) + if not data then return end -- LightHeaded has no clue about the given NPC, despite giving us the id. + for zid,x,y in data:gmatch("([^,]+),([^,]+),([^:]+):") do + table.insert(coords, {["p"] = zid, ["x"] = x, ["y"] = y}) + end + end + + --can't return coordinates until we know more about what we are getting and then convert accordingly. + for k, v in pairs(coords) do for k1, v1 in pairs(v) do print(k, k1, v1) end end + --return coords + return nil +end + +local function GetSelfQuestInfo(qid) + return nil +end + +-- Returns x and y in yards relative to something... Continent? +local function GetQuestInfo(qid) + assert(type(qid) == "number") + local coords = GetSelfQuestInfo(qid) + --if not coords then coords = GetLightHeadedQuestInfo(qid) end + if not coords then + coords = GetBlizzardQuestInfo(qid) + end + + return coords -- Might still be nil, but if we don't have anything from Blizz, prolly nothing can be done. end function DB_GetItem(group, id, silent, register) @@ -204,25 +310,7 @@ function DB_GetItem(group, id, silent, register) -- Loop over zones AND floors -- see QuestRouterLite.lua for specific calls. -- In the end, the item returned MUST be "formatted" the same as a true QHDB item. - ite = {} - local origC = GetCurrentMapContinent() - local origZ = GetCurrentMapZone() - - local myPois = {} - local myCount = 1 - for c, cname in ipairs({GetMapContinents()}) do - for z, zname in ipairs({GetMapZones(c)}) do - local pois, zoneHasQuests = GetZonePOIs(c, z) - if zoneHasQuests and pois[id] then - ite:insert(pois[id]) - end - end - end - - SetMapZoom(origC, origZ) - - -- Convert POIs appropriately. - -- Set ite to the correctly formatted POIs. + ite = GetQuestInfo(id) end if not ite then @@ -312,7 +400,9 @@ function DB_ReleaseItem(ite) if frequencies[ite] == 0 then --print("incinerating", freq_group[ite], freq_id[ite]) - cache[freq_group[ite]][freq_id[ite]] = nil + if cache[freq_group[ite]] then + cache[freq_group[ite]][freq_id[ite]] = nil + end freq_group[ite] = nil freq_id[ite] = nil diff --git a/QuestHelper/director_quest.lua b/QuestHelper/director_quest.lua index d348327..8ef125b 100644 --- a/QuestHelper/director_quest.lua +++ b/QuestHelper/director_quest.lua @@ -134,12 +134,14 @@ local function GetQuestMetaobjective(questid, lbcount, qindex) -- just doublechecking here if not QuestCriteriaWarningBroadcast and q and q.criteria then for k, v in pairs(q.criteria) do if type(k) == "number" and k > lbcount then - --QuestHelper:TextOut(string.format("Too many stored objectives for this quest, please report on the Questhelper homepage (%s %s %s)", questid, lbcount, k)) -- we're just going to hide this for now + QuestHelper:TextOut(string.format("Too many stored objectives for this quest, please report on the Questhelper homepage (%s %s %s)", questid, lbcount, k)) -- we're just going to hide this for now + --[==[ if qindex then QuestHelper_ErrorCatcher_ExplicitError(false, string.format("Too many stored objectives (%s %s %s %s)", questid, lbcount, k, select(1, GetQuestLogTitle(qindex)))) else QuestHelper_ErrorCatcher_ExplicitError(false, string.format("Too many stored objectives (%s %s %s %s)", questid, lbcount, k, v)) end + --]==] QuestCriteriaWarningBroadcast = true end end end @@ -172,7 +174,7 @@ local function GetQuestMetaobjective(questid, lbcount, qindex) end if #ttx == 0 then - table.insert(ttx, {loc = {x = 5000, y = 5000, c = 0, p = 2}, icon_id = 7, type_quest_unknown = true, map_desc = {"Unknown"}}) -- this is Ashenvale, for no particularly good reason + table.insert(ttx, {loc = {x = 5000, y = 5000, c = 0, p = 43}, icon_id = 7, type_quest_unknown = true, map_desc = {"Unknown"}}) -- this is Ashenvale, for no particularly good reason ttx.type_quest_unknown = true end @@ -192,28 +194,29 @@ local function GetQuestMetaobjective(questid, lbcount, qindex) end do - local ttx = {type_quest_finish = true} - --QuestHelper:TextOut(string.format("finny %d", q.finish.loc and #q.finish.loc or -1)) - if q and q.finish and q.finish.loc then - ttx.solid = horribledupe(q.finish.solid) - for m, v in ipairs(q.finish.loc) do - --print(v.rc, v.rz) - --print(QuestHelper_IndexLookup[v.rc]) - --print(QuestHelper_IndexLookup[v.rc][v.rz]) - table.insert(ttx, {desc = "Turn in quest", why = ite, loc = {x = v.x, y = v.y, c = QuestHelper_ParentLookup[v.p], p = v.p}, tracker_hidden = true, cluster = ttx, icon_id = 7, type_quest = ite.type_quest}) + if q and q.finish and q.loc then + local ttx = {type_quest_finish = true} + --QuestHelper:TextOut(string.format("finny %d", q.finish.loc and #q.finish.loc or -1)) + if q and q.finish and q.finish.loc then + ttx.solid = horribledupe(q.finish.solid) + for m, v in ipairs(q.finish.loc) do + --print(v.rc, v.rz) + --print(QuestHelper_IndexLookup[v.rc]) + --print(QuestHelper_IndexLookup[v.rc][v.rz]) + table.insert(ttx, {desc = "Turn in quest", why = ite, loc = {x = v.x, y = v.y, c = QuestHelper_ParentLookup[v.p], p = v.p}, tracker_hidden = true, cluster = ttx, icon_id = 7, type_quest = ite.type_quest}) + end end - end - if #ttx == 0 then - table.insert(ttx, {desc = "Turn in quest", why = ite, loc = {x = 5000, y = 5000, c = 0, p = 2}, tracker_hidden = true, cluster = ttx, icon_id = 7, type_quest = ite.type_quest, type_quest_unknown = true}) -- this is Ashenvale, for no particularly good reason - ttx.type_quest_unknown = true - end + if #ttx == 0 then + table.insert(ttx, {desc = "Turn in quest", why = ite, loc = {x = 5000, y = 5000, c = 0, p = 43}, tracker_hidden = true, cluster = ttx, icon_id = 7, type_quest = ite.type_quest, type_quest_unknown = true}) -- this is Ashenvale, for no particularly good reason + ttx.type_quest_unknown = true + end - ite.finish = ttx + ite.finish = ttx + end end quest_list[questid] = ite - if q then DB_ReleaseItem(q) end end @@ -799,7 +802,9 @@ function QH_UpdateQuests(force) end end - db.finish.tooltip_defer_questname = title -- we're using this as our fallback right now + if db.finish then + db.finish.tooltip_defer_questname = title -- we're using this as our fallback right now + end next_chunks[id] = chunk diff --git a/QuestHelper/dodads.lua b/QuestHelper/dodads.lua index 5898d8d..0ad4957 100644 --- a/QuestHelper/dodads.lua +++ b/QuestHelper/dodads.lua @@ -427,6 +427,26 @@ local function rightclick_menu(obj) end end +function QuestHelper:PlaceIconOnWorldMap( worldMapFrame, icon, map, dLvl, xPos, yPos ) + assert(type(worldMapFrame) == "table") + assert(worldMapFrame.GetWidth and worldmapFrame.GetHeight) + assert(type(icon) == "table") + assert(icon.SetPoint and icon.ClearAllPoints) + assert(type(map) == "number") + assert(type(dLvl) == "number" or dLvl == nil) + assert(type(xPos) == "number") + assert(type(yPos) == "number") + + if dLvl == nil then dLvl = 0 end + if map == -1 then return end -- Can't do anything without continent knowledge + + local nMap, nFloor = GetCurrentMapAreaID(), GetCurrentMapDungeonLevel() or 0 + + local nCont + + if nMap == -1 then cont = GetCurrentMapContinent() end +end + function QuestHelper:CreateWorldMapDodad(objective, nxt) local icon = CreateFrame("Button", nil, QuestHelper.map_overlay) icon:SetFrameStrata("FULLSCREEN") diff --git a/QuestHelper/libs/AstrolabeQH/Astrolabe.lua b/QuestHelper/libs/AstrolabeQH/Astrolabe.lua index 9de5234..012d6b3 100644 --- a/QuestHelper/libs/AstrolabeQH/Astrolabe.lua +++ b/QuestHelper/libs/AstrolabeQH/Astrolabe.lua @@ -289,6 +289,8 @@ function Astrolabe:ComputeDistance( c1, z1, x1, y1, c2, z2, x2, y2 ) return dist, xDelta, yDelta; end +local yards + function Astrolabe:TranslateWorldMapPosition( C, Z, xPos, yPos, nC, nZ ) --[[ argcheck(C, 2, "number"); @@ -325,7 +327,7 @@ function Astrolabe:TranslateWorldMapPosition( C, Z, xPos, yPos, nC, nZ ) zoneData = WorldMapSize[C]; local parentContinent = zoneData.parentContinent; xPos, yPos = getContPosition(zoneData, Z, xPos, yPos); - if not xPos or not yPos then return end -- there is no such zone. why are you asking me such silly things? you are a terrible person. leave me in my despair. + if not xPos or not yPos then return end -- there is no such zone. why are you asking me such silly things? you are a terrible person. leave me in my despair. if ( C ~= parentContinent ) then -- translate up to world map if we aren't there already xPos = xPos + zoneData.xOffset; @@ -379,6 +381,14 @@ function Astrolabe:GetZoneWidth(c, z) end end +function Astrolabe:GetZoneHeight(c, z) + if z ~= 0 then + return WorldMapSize[c][z].height + else + return WorldMapSize[c].height + end +end + --***************************************************************************** -- This function will do its utmost to retrieve some sort of valid position -- for the specified unit, including changing the current map zoom (if needed). @@ -1196,8 +1206,8 @@ WorldMapSize = { AhnQirajTheFallenKingdom = { height = 2700.0, width = 4049.99983215332, - xOffset = 0, - yOffset = 0, + xOffset = -3891.6665, + yOffset = -8033.333, mapID = 772 }, Ashenvale = { @@ -1222,8 +1232,8 @@ WorldMapSize = { mapID = 3524, }, Barrens = { - height = 6756.202067150937, - width = 10133.44343943073, + height = 3831.24987792969, + width = 5745.83332824707, xOffset = 14443.84117394525, yOffset = 11187.32013604393, mapID = 17, @@ -1287,15 +1297,15 @@ WorldMapSize = { Hyjal = { height = 2831.24975585938, width = 4245.83337402344, - xOffset = 0, - yOffset = 0, + xOffset = 929.167, + yOffset = 6195.833, mapID = 606 }, Hyjal_terrain1 = { height = 2831.24975585938, width = 4245.83337402344, - xOffset = 0, - yOffset = 0, + xOffset = 929.167, + yOffset = 6195.833, mapID = 683 }, Moonglade = { @@ -1329,8 +1339,8 @@ WorldMapSize = { SouthernBarrens = { height = 4941.66665649414, width = 7412.5, - xOffset = 0, - yOffset = 0, + xOffset = -1356.25, + yOffset = 204.167, mapID = 607 }, StonetalonMountains = { @@ -1378,8 +1388,8 @@ WorldMapSize = { Uldum = { height = 4129.16650390625, width = 6193.74975585938, - xOffset = 0, - yOffset = 0, + xOffset = -2441.667, + yOffset = -8029.1665, mapID = 720 }, UngoroCrater = { @@ -1519,17 +1529,17 @@ WorldMapSize = { mapID = 44, }, RuinsofGilneas = { - height = 889.583251953125, - width = 593.749877929688, - xOffset = 0, - yOffset = 0, + height = 2097.916668701172, + width = 3145.83325195312, + xOffset = -3439.583, + yOffset = -533.333, mapID = 611 }, RuinsofGilneasCity = { height = 889.583251953125, width = 593.749877929688, - xOffset = 0, - yOffset = 0, + xOffset = -1933.333, + yOffset = -1306.25, mapID = 685 }, SearingGorge = { @@ -1561,8 +1571,8 @@ WorldMapSize = { mapID = 1519, }, StranglethornVale = { -- Split to Vale, Jungle and Cape - height = 4254.18312444072, - width = 6381.248484543122, + height = 4368.75, + width = 6552.0830078125, xOffset = 15951.13375783437, yOffset = 22345.18258706305, mapID = 33, @@ -1570,8 +1580,8 @@ WorldMapSize = { StranglethornJungle = { height = 2733.3330078125, width = 4099.99987792969, - xOffset = 0, - yOffset = 0, + xOffset = -1743.750, + yOffset = -11016.666, mapID = 37 }, Sunwell = { @@ -1591,8 +1601,8 @@ WorldMapSize = { TheCapeOfStranglethorn = { height = 2631.25, width = 3945.83312988281, - xOffset = 0, - yOffset = 0, + xOffset = -2108.333, + yOffset = -12516.666, mapID = 673 }, Tirisfal = { @@ -1605,29 +1615,29 @@ WorldMapSize = { TolBarad = { height = 1343.75, width = 2014.58329248428, - xOffset = 0, - yOffset = 0, + xOffset = -2010.417, + yOffset = -560.417, mapID = 708 }, TolBaradDailyArea = { height = 1224.99993896484, width = 1837.5, - xOffset = 0, - yOffset = 0, + xOffset = -2412.5, + yOffset = 377.083, mapID = 709 }, TwilightHighlands = { height = 3514.5830078125, width = 5270.8330078125, - xOffset = 0, - yOffset = 0, + xOffset = 2437.5, + yOffset = -2156.25, mapID = 700 }, TwilightHighlands_terrain1 = { height = 3514.5830078125, width = 5270.8330078125, - xOffset = 0, - yOffset = 0, + xOffset = 2437.5, + yOffset = -2156.25, mapID = 770 }, Undercity = { @@ -1640,29 +1650,29 @@ WorldMapSize = { Vashjir = { height = 4631.24975585938, width = 6945.83276367188, - xOffset = 0, - yOffset = 0, + xOffset = -8754.166, + yOffset = -3720.833, mapID = 613 }, VashjirDepths = { height = 2716.66650390625, width = 4075.0, - xOffset = 0, - yOffset = 0, + xOffset = -8233.333, + yOffset = -4906.25, mapID = 614 }, VashjirKelpForest = { height = 1868.75024414062, width = 2802.0830078125, - xOffset = 0, - yOffset = 0, + xOffset = -5070.833, + yOffset = -4018.75, mapID = 610 }, VashjirRuins = { height = 3233.3330078125, width = 4849.99963378906, - xOffset = 0, - yOffset = 0, + xOffset = -6681.25, + yOffset = -4756.25, mapID = 615 }, WesternPlaguelands = { @@ -1840,10 +1850,10 @@ WorldMapSize = { mapID = 66, }, HrothgarsLanding = { - height = 2452.7, - width = 2452.7*1.5, - xOffset = 23967.599 - 17549.182, - yOffset = 1027.392 - 1215.431, + height = 2452.083984375, + width = 3677.08312988281, + xOffset = 6418.417, + yOffset = -188.039, } }, }, @@ -1855,12 +1865,12 @@ WorldMapSize = { xOffset = 0.0, yOffset = 0.0, zoneData = { - Deepholm = { height = 3399.999877929688, width = 5099.9987792969, xOffset = 0, yOffset = 0, mapID = 640 }, - Kezan = { height = 900.00048828125, width = 1352.08319091797, xOffset = 0, yOffset = 0, mapID = 605 }, - TheLostIsles = { height = 3010.41665649414, width = 4514.5830078125, xOffset = 0, yOffset = 0, mapID = 544 }, - TheLostIsles_terrain1 = { height = 3010.41665649414, width = 4514.5830078125, xOffset = 0, yOffset = 0, mapID = 681 }, - TheLostIsles_terrain2 = { height = 3010.41665649414, width = 4514.5830078125, xOffset = 0, yOffset = 0, mapID = 682 }, - TheMaelstrom = { height = 1033.33325195312, width = 1550.0, xOffset = 0, yOffset = 0, mapID = 737 } + Deepholm = { height = 3399.999877929688, width = 5099.9987792969, xOffset = -3052.083, yOffset = 2795.833, mapID = 640 }, + Kezan = { height = 900.00048828125, width = 1352.08319091797, xOffset = -2129.167, yOffset = -7731.25, mapID = 605 }, + TheLostIsles = { height = 3010.41665649414, width = 4514.5830078125, xOffset = -4383.333, yOffset = 2881.25, mapID = 544 }, + TheLostIsles_terrain1 = { height = 3010.41665649414, width = 4514.5830078125, xOffset = -4383.333, yOffset = 2881.25, mapID = 681 }, + TheLostIsles_terrain2 = { height = 3010.41665649414, width = 4514.5830078125, xOffset = -4383.333, yOffset = 2881.25, mapID = 682 }, + TheMaelstrom = { height = 1033.33325195312, width = 1550.0, xOffset = -1556.25, yOffset = 1370.833, mapID = 737 } } } } diff --git a/QuestHelper/libs/LibMapData-1.0/Changelog-LibMapData-1.0-0.21-release.txt b/QuestHelper/libs/LibMapData-1.0/Changelog-LibMapData-1.0-0.21-release.txt new file mode 100644 index 0000000..80783cb --- /dev/null +++ b/QuestHelper/libs/LibMapData-1.0/Changelog-LibMapData-1.0-0.21-release.txt @@ -0,0 +1,25 @@ +------------------------------------------------------------------------ +r100 | kagaro | 2011-12-02 00:28:58 +0000 (Fri, 02 Dec 2011) | 1 line +Changed paths: + A /tags/0.21-release (from /trunk:99) + +Tagging as 0.21-release +------------------------------------------------------------------------ +r99 | kagaro | 2011-12-02 00:27:41 +0000 (Fri, 02 Dec 2011) | 1 line +Changed paths: + M /trunk/library.lua + +Updated lib from forum tests that shows game data incorrect +------------------------------------------------------------------------ +r97 | kagaro | 2011-11-29 12:06:46 +0000 (Tue, 29 Nov 2011) | 1 line +Changed paths: + M /trunk/LibMapData-1.0.toc + +toc bump +------------------------------------------------------------------------ +r96 | kagaro | 2011-11-28 13:01:19 +0000 (Mon, 28 Nov 2011) | 1 line +Changed paths: + M /trunk/library.lua + +Adding 4.3 zone data +------------------------------------------------------------------------ diff --git a/QuestHelper/libs/LibMapData-1.0/LibMapData-1.0.toc b/QuestHelper/libs/LibMapData-1.0/LibMapData-1.0.toc new file mode 100644 index 0000000..a15d536 --- /dev/null +++ b/QuestHelper/libs/LibMapData-1.0/LibMapData-1.0.toc @@ -0,0 +1,14 @@ +## Interface: 40300 +## Title: Lib: MapData-1.0 +## Notes: Static library of wow map data +## Version: 1.0.99 +## Author: kagaro +## X-Category: Library +## X-Curse-Packaged-Version: 0.21-release +## X-Curse-Project-Name: LibMapData-1.0 +## X-Curse-Project-ID: libmapdata-1-0 +## X-Curse-Repository-ID: wow/libmapdata-1-0/mainline + +library.lua +Libs/LibStub/LibStub.lua +Libs/CallbackHandler-1.0/CallbackHandler-1.0.xml diff --git a/QuestHelper/libs/LibMapData-1.0/Libs/CallbackHandler-1.0/CallbackHandler-1.0.lua b/QuestHelper/libs/LibMapData-1.0/Libs/CallbackHandler-1.0/CallbackHandler-1.0.lua new file mode 100644 index 0000000..e0fe1af --- /dev/null +++ b/QuestHelper/libs/LibMapData-1.0/Libs/CallbackHandler-1.0/CallbackHandler-1.0.lua @@ -0,0 +1,240 @@ +--[[ $Id: CallbackHandler-1.0.lua 14 2010-08-09 00:43:38Z mikk $ ]] +local MAJOR, MINOR = "CallbackHandler-1.0", 6 +local CallbackHandler = LibStub:NewLibrary(MAJOR, MINOR) + +if not CallbackHandler then return end -- No upgrade needed + +local meta = {__index = function(tbl, key) tbl[key] = {} return tbl[key] end} + +-- Lua APIs +local tconcat = table.concat +local assert, error, loadstring = assert, error, loadstring +local setmetatable, rawset, rawget = setmetatable, rawset, rawget +local next, select, pairs, type, tostring = next, select, pairs, type, tostring + +-- Global vars/functions that we don't upvalue since they might get hooked, or upgraded +-- List them here for Mikk's FindGlobals script +-- GLOBALS: geterrorhandler + +local xpcall = xpcall + +local function errorhandler(err) + return geterrorhandler()(err) +end + +local function CreateDispatcher(argCount) + local code = [[ + local next, xpcall, eh = ... + + local method, ARGS + local function call() method(ARGS) end + + local function dispatch(handlers, ...) + local index + index, method = next(handlers) + if not method then return end + local OLD_ARGS = ARGS + ARGS = ... + repeat + xpcall(call, eh) + index, method = next(handlers, index) + until not method + ARGS = OLD_ARGS + end + + return dispatch + ]] + + local ARGS, OLD_ARGS = {}, {} + for i = 1, argCount do ARGS[i], OLD_ARGS[i] = "arg"..i, "old_arg"..i end + code = code:gsub("OLD_ARGS", tconcat(OLD_ARGS, ", ")):gsub("ARGS", tconcat(ARGS, ", ")) + return assert(loadstring(code, "safecall Dispatcher["..argCount.."]"))(next, xpcall, errorhandler) +end + +local Dispatchers = setmetatable({}, {__index=function(self, argCount) + local dispatcher = CreateDispatcher(argCount) + rawset(self, argCount, dispatcher) + return dispatcher +end}) + +-------------------------------------------------------------------------- +-- CallbackHandler:New +-- +-- target - target object to embed public APIs in +-- RegisterName - name of the callback registration API, default "RegisterCallback" +-- UnregisterName - name of the callback unregistration API, default "UnregisterCallback" +-- UnregisterAllName - name of the API to unregister all callbacks, default "UnregisterAllCallbacks". false == don't publish this API. + +function CallbackHandler:New(target, RegisterName, UnregisterName, UnregisterAllName, OnUsed, OnUnused) + -- TODO: Remove this after beta has gone out + assert(not OnUsed and not OnUnused, "ACE-80: OnUsed/OnUnused are deprecated. Callbacks are now done to registry.OnUsed and registry.OnUnused") + + RegisterName = RegisterName or "RegisterCallback" + UnregisterName = UnregisterName or "UnregisterCallback" + if UnregisterAllName==nil then -- false is used to indicate "don't want this method" + UnregisterAllName = "UnregisterAllCallbacks" + end + + -- we declare all objects and exported APIs inside this closure to quickly gain access + -- to e.g. function names, the "target" parameter, etc + + + -- Create the registry object + local events = setmetatable({}, meta) + local registry = { recurse=0, events=events } + + -- registry:Fire() - fires the given event/message into the registry + function registry:Fire(eventname, ...) + if not rawget(events, eventname) or not next(events[eventname]) then return end + local oldrecurse = registry.recurse + registry.recurse = oldrecurse + 1 + + Dispatchers[select('#', ...) + 1](events[eventname], eventname, ...) + + registry.recurse = oldrecurse + + if registry.insertQueue and oldrecurse==0 then + -- Something in one of our callbacks wanted to register more callbacks; they got queued + for eventname,callbacks in pairs(registry.insertQueue) do + local first = not rawget(events, eventname) or not next(events[eventname]) -- test for empty before. not test for one member after. that one member may have been overwritten. + for self,func in pairs(callbacks) do + events[eventname][self] = func + -- fire OnUsed callback? + if first and registry.OnUsed then + registry.OnUsed(registry, target, eventname) + first = nil + end + end + end + registry.insertQueue = nil + end + end + + -- Registration of a callback, handles: + -- self["method"], leads to self["method"](self, ...) + -- self with function ref, leads to functionref(...) + -- "addonId" (instead of self) with function ref, leads to functionref(...) + -- all with an optional arg, which, if present, gets passed as first argument (after self if present) + target[RegisterName] = function(self, eventname, method, ... --[[actually just a single arg]]) + if type(eventname) ~= "string" then + error("Usage: "..RegisterName.."(eventname, method[, arg]): 'eventname' - string expected.", 2) + end + + method = method or eventname + + local first = not rawget(events, eventname) or not next(events[eventname]) -- test for empty before. not test for one member after. that one member may have been overwritten. + + if type(method) ~= "string" and type(method) ~= "function" then + error("Usage: "..RegisterName.."(\"eventname\", \"methodname\"): 'methodname' - string or function expected.", 2) + end + + local regfunc + + if type(method) == "string" then + -- self["method"] calling style + if type(self) ~= "table" then + error("Usage: "..RegisterName.."(\"eventname\", \"methodname\"): self was not a table?", 2) + elseif self==target then + error("Usage: "..RegisterName.."(\"eventname\", \"methodname\"): do not use Library:"..RegisterName.."(), use your own 'self'", 2) + elseif type(self[method]) ~= "function" then + error("Usage: "..RegisterName.."(\"eventname\", \"methodname\"): 'methodname' - method '"..tostring(method).."' not found on self.", 2) + end + + if select("#",...)>=1 then -- this is not the same as testing for arg==nil! + local arg=select(1,...) + regfunc = function(...) self[method](self,arg,...) end + else + regfunc = function(...) self[method](self,...) end + end + else + -- function ref with self=object or self="addonId" or self=thread + if type(self)~="table" and type(self)~="string" and type(self)~="thread" then + error("Usage: "..RegisterName.."(self or \"addonId\", eventname, method): 'self or addonId': table or string or thread expected.", 2) + end + + if select("#",...)>=1 then -- this is not the same as testing for arg==nil! + local arg=select(1,...) + regfunc = function(...) method(arg,...) end + else + regfunc = method + end + end + + + if events[eventname][self] or registry.recurse<1 then + -- if registry.recurse<1 then + -- we're overwriting an existing entry, or not currently recursing. just set it. + events[eventname][self] = regfunc + -- fire OnUsed callback? + if registry.OnUsed and first then + registry.OnUsed(registry, target, eventname) + end + else + -- we're currently processing a callback in this registry, so delay the registration of this new entry! + -- yes, we're a bit wasteful on garbage, but this is a fringe case, so we're picking low implementation overhead over garbage efficiency + registry.insertQueue = registry.insertQueue or setmetatable({},meta) + registry.insertQueue[eventname][self] = regfunc + end + end + + -- Unregister a callback + target[UnregisterName] = function(self, eventname) + if not self or self==target then + error("Usage: "..UnregisterName.."(eventname): bad 'self'", 2) + end + if type(eventname) ~= "string" then + error("Usage: "..UnregisterName.."(eventname): 'eventname' - string expected.", 2) + end + if rawget(events, eventname) and events[eventname][self] then + events[eventname][self] = nil + -- Fire OnUnused callback? + if registry.OnUnused and not next(events[eventname]) then + registry.OnUnused(registry, target, eventname) + end + end + if registry.insertQueue and rawget(registry.insertQueue, eventname) and registry.insertQueue[eventname][self] then + registry.insertQueue[eventname][self] = nil + end + end + + -- OPTIONAL: Unregister all callbacks for given selfs/addonIds + if UnregisterAllName then + target[UnregisterAllName] = function(...) + if select("#",...)<1 then + error("Usage: "..UnregisterAllName.."([whatFor]): missing 'self' or \"addonId\" to unregister events for.", 2) + end + if select("#",...)==1 and ...==target then + error("Usage: "..UnregisterAllName.."([whatFor]): supply a meaningful 'self' or \"addonId\"", 2) + end + + + for i=1,select("#",...) do + local self = select(i,...) + if registry.insertQueue then + for eventname, callbacks in pairs(registry.insertQueue) do + if callbacks[self] then + callbacks[self] = nil + end + end + end + for eventname, callbacks in pairs(events) do + if callbacks[self] then + callbacks[self] = nil + -- Fire OnUnused callback? + if registry.OnUnused and not next(callbacks) then + registry.OnUnused(registry, target, eventname) + end + end + end + end + end + end + + return registry +end + + +-- CallbackHandler purposefully does NOT do explicit embedding. Nor does it +-- try to upgrade old implicit embeds since the system is selfcontained and +-- relies on closures to work. + diff --git a/QuestHelper/libs/LibMapData-1.0/Libs/CallbackHandler-1.0/CallbackHandler-1.0.xml b/QuestHelper/libs/LibMapData-1.0/Libs/CallbackHandler-1.0/CallbackHandler-1.0.xml new file mode 100644 index 0000000..1aad3a2 --- /dev/null +++ b/QuestHelper/libs/LibMapData-1.0/Libs/CallbackHandler-1.0/CallbackHandler-1.0.xml @@ -0,0 +1,4 @@ + +