• 0

    posted a message on Importer for MapNotes addon
    If you take a close look at some SavedVariables/MapNotes.lua you'll see that MapNotes_Data is nil.
    Mapnotes seems to store data in MapNotes_Data_Notes nowadays.

    I tried to come up with a working importer. Please test and decide yourselves, i don't have svn write access.
    Index: Import.lua
    ===================================================================
    --- Import.lua (revision 46854)
    +++ Import.lua (working copy)
    @@ -409,36 +409,81 @@
     end
     
     function Cartographer_Import:TryImportMapNotes()
    -    if MapNotes_Data then
    -        for continent, cdata in pairs(MapNotes_Data) do
    -            for zone, zdata in pairs(cdata) do
    -                local zone = zones[continent][zone]
    -
    -                --appears there may be some corrupt zones in the SV file. so zone will be nil here. we just skip those since there is no notes in these anyway.
    -                if zone then
    -                    local zname = BZ:GetReverseTranslation(zone)
    -                    for item, idata in pairs(zdata) do
    -                        local note = {}
    -                        note.icon = "Square"
    -                        if idata.name and idata.name ~= "" then
    -                            note.title = idata.name
    -                        else
    -                            note.title = "Imported note"
    -                        end
    -                        if idata.inf1 and idata.inf1 ~= "" then
    -                            note.info = idata.inf1
    -                        end
    -                        if idata.inf2 and idata.inf2 ~= "" then
    -                            note.info2 = idata.inf2
    -                        end
    -                        note.manual = true
    -
    -                        if Cartographer_Notes:SetNote(zname, idata.xPos, idata.yPos, note.icon, idata.creator, note) then
    -                            self:Print(L["Added %s %s to %s at %.2f, %.2f from %s"], note.title, note.icon, zname, idata.xPos, idata.yPos, "MapNotes")
    -                        end
    -                    end
    -                end
    -            end
    +  local zone2zone = {
    +        ["Elwynn"] = "Elwynn Forest",
    +    ["Aszhara"] = "Azshara",
    +    ["Hinterlands"] = "The Hinterlands",
    +    ["WesternPlaguelands"] = "Western Plaguelands",
    +    ["Silverpine"] = "Silverpine Forest",
    +    ["BlastedLands"] = "Blasted Lands",
    +    ["AzuremystIsle"] = "Azuremyst Isle",
    +    ["BladesEdgeMountains"] = "Blade's Edge Mountains",
    +    ["Barrens"] = "The Barrens",
    +    ["Alterac"] = "Alterac Mountains",
    +    ["Arathi"] = "Arathi Highlands",
    +    ["ArathiBasin"] = "Arathi Basin",
    +    ["BloodmystIsle"] = "Bloodmyst Isle",
    +    ["BurningSteppes"] = "Burning Steppes",
    +    ["Darnassis"] = "Darnassus",
    +    ["EasternPlaguelands"] = "Eastern Plaguelands",
    +    ["EversongWoods"] = "Eversong Woods",
    +    ["Hilsbrad"] = "Hillsbrad Foothills",
    +    ["OldHilsbrad"] = "Old Hillsbrad Foothills",
    +    ["Hellfire"] = "Hellfire Peninsula",
    +    ["LochModan"] = "Loch Modan",
    +    ["Redridge"] = "Redridge Mountains",
    +    ["SearingGorge"] = "Searing Gorge",
    +    ["TheUnderbog"] = "The Underbog",
    +    ["ShattrathCity"] = "Shattrath City",
    +    ["SilvermoonCity"] = "Silvermoon City",
    +    ["StonetalonMountains"] = "Stonetalon Mountains",
    +    ["ShadowmoonValley"] = "Shadowmoon Valley",
    +    ["Stormwind"] = "Stormwind City",
    +    ["Stranglethorn"] = "Stranglethorn Vale",
    +    ["TerokkarForest"] = "Terokkar Forest",
    +    ["SwampOfSorrows"] = "Swamp of Sorrows",
    +    ["DeadwindPass"] = "Deadwind Pass",
    +    ["TheExodar"] = "The Exodar",
    +    ["ThousandNeedles"] = "Thousand Needles",
    +    ["UngoroCrater"] = "Un'Goro Crater",
    +        ["Dustwallow"] = "Dustwallow Marsh",
    +  }
    +  local MapIconToCartographer = {
    +    [0] = "Yellow Square",
    +    [1] = "Red Square",
    +    [2] = "Purple Square",
    +    [3] = "Green Square",
    +    [4] = "Pink Square",
    +    [5] = "Yellow Star",
    +    [6] = "Red Star",
    +    [7] = "Purple Star",
    +    [8] = "Green Star",
    +    [9] = "Pink Star",
    +  }
    +    if MapNotes_Data_Notes then
    +        for zone, cdata in pairs(MapNotes_Data_Notes) do
    +      --self:Print ("import from %s", zone)
    +      s,e = string.find(zone, " ")
    +      local zname = string.sub(zone, s+1)
    +      if (zone2zone[zname] ~= nil) then
    +        zname = zone2zone[zname]
    +      end
    +      if ((not BZ:HasTranslation(zname)) and (not BZ:HasReverseTranslation(zname))) then
    +        self:Print("unknown zone on import: %s",zname)
    +      else
    +        for i in pairs(cdata) do
    +          idata = cdata[i]
    +          local note = {}
    +          note.icon = MapIconToCartographer[idata.icon] .."metamap_iconpack" -- Yellow Square Red Star Green Star
    +          note.title=idata['name'] or "Imported Note";
    +          note.info=idata['inf1'] or "";
    +          note.info2=idata['inf2'] or "";
    +          note.manual = true
    +          if Cartographer_Notes:SetNote(zname, idata.xPos, idata.yPos, note.icon, idata.creator, note) then
    +            --self:Print(L["Added %s %s to %s at %.2f, %.2f from %s"], note.title, note.icon, zname, idata.xPos, idata.yPos, "MapNotes")
    +          end
    +        end
    +      end
            end
        end
     end
    Posted in: Map/Minimap AddOns
  • To post a comment, please or register a new account.