Routes

68 - Import the database GathererDB_Wowhead from Routes addon

What is the issue?
Routes addon doesnt import the database GathererDB_Wowhead; http://www.wowinterface.com/downloads/info11707-GathererDBWoWHead.html
same with database of Gatherer.
Can you fix it?

Regards

User When Change
ULTIMATESEVEN Oct 23, 2012 at 20:51 UTC Create

You must login to post a comment. Don't have an account? Register to get one!

  • 7 comments
  • Avatar of wardjp wardjp Dec 12, 2013 at 01:05 UTC - 0 likes

    @LaoTseu: Go

    Confirmed as well! Just open up your Gatherer.lua in the Plugins folder of Routes using Notepad, "Select All" And just copy/paste the code from LaoTseu into that file and save, works like a charm! Thank you so much, Lao!!

  • Avatar of animasola animasola Aug 19, 2013 at 16:51 UTC - 0 likes

    @LaoTseu thanks, just found this fix today and it's working great :D

  • Avatar of Fonjask Fonjask Jul 23, 2013 at 14:57 UTC - 0 likes

    @LaoTseu: Go

    Can confirm this works, thanks a lot you legend!

  • Avatar of LaoTseu LaoTseu Jun 04, 2013 at 12:16 UTC - 2 likes

    The Gatherer API changed a little bit a while ago so the existing code in Routes no longer work.

    I've hacked the Gatherer.lua module to make it work again and also to catch and add any new nodes to Routes when it is added to Gatherer.

    Here's the code I used:

    local _G = getfenv(0)
    
    local tostring = _G.tostring
    local wipe = _G.wipe
    local select = _G.select
    local pairs = _G.pairs
    local tonumber = _G.tonumber
    local tinsert = _G.tinsert
    local floor = _G.floor
    
    local function err(msg,...) geterrorhandler()(msg:format(tostringall(...)) .. " - " .. time()) end
    
    local Routes = LibStub("AceAddon-3.0"):GetAddon("Routes", 1)
    if not Routes then return end
    
    local SourceName = "Gatherer"
    local L = LibStub("AceLocale-3.0"):GetLocale("Routes")
    
    ------------------------------------------
    -- setup
    Routes.plugins[SourceName] = {}
    local source = Routes.plugins[SourceName]
    
    do
    	local loaded = true
    	local function IsActive() -- Can we gather data?
          return _G.Gatherer and loaded
    	end
    	source.IsActive = IsActive
    
    	-- stop loading if the addon is not enabled, or
    	-- stop loading if there is a reason why it can't be loaded ("MISSING" or "DISABLED")
    	local name, title, notes, enabled, loadable, reason, security = GetAddOnInfo(SourceName)
    	if not enabled or (reason ~= nil) then
    		loaded = false
    		return
    	end
    end
    
    ------------------------------------------
    -- functions
    
    local function Summarize(data, zone)
    	local amount_of = {}
    	local db_type_of = {}
    	--local continent = Routes.LZName[zone][3]
    	local zone_id = Routes.LZName[zone][2]
    
    	-- This loop works only because of a bug in Gatherer.
    	-- Gatherer may be fixed in the future and break this loop.
       for _, node, db_type in _G.Gatherer.Storage.ZoneGatherNames(zone_id) do
    		amount_of[node] = (amount_of[node] or 0) + 1
    		db_type_of[node] = db_type
    	end
    	for node, count in pairs(amount_of) do
    		local db_type = db_type_of[node]
          local translatednode = _G.Gatherer.Util.GetNodeName(node)
    		data[ ("%s;%s;%s;%s"):format(SourceName, db_type, node, count) ] = ("%s - %s (%d)"):format(L[SourceName..db_type], translatednode, count)
    	end
    
    	return data
    end
    source.Summarize = Summarize
    
    -- returns the english name, translated name for the node so we can store it was being requested
    -- also returns the type of db for use with auto show/hide route
    local translate_db_type = {
    	["HERB"] = "Herbalism",
    	["MINE"] = "Mining",
    	["OPEN"] = "Treasure",
    	["ARCH"] = "Archaeology",
    }
    local function AppendNodes(node_list, zone, db_type, node_type)
    	--local continent = Routes.LZName[zone][3]
    	local zone_id = Routes.LZName[zone][2]
    	node_type = tonumber(node_type)
    
    	-- posX, posY, timesGathered, indoors, harvested, inspected, source = GetGatherInfo(C, Z, node_type, db_type, index)
       for index, posX, posY, inspected, indoors in _G.Gatherer.Storage.ZoneGatherNodes(zone_id, db_type) do
          if _G.Gatherer.Storage.GetGatherInfo(zone_id, node_type, db_type, index) then
    			tinsert( node_list, floor(posX * 10000 + 0.5) * 10000 + floor(posY * 10000 + 0.5) )
    		end
    	end
    
    
    	-- return the node_type for auto-adding
       local translatednode = _G.Gatherer.Util.GetNodeName(node_type)
    	return translatednode, translatednode, translate_db_type[db_type]
    end
    source.AppendNodes = AppendNodes
    
    -- continent/zone - GetMapZones() stuff
    -- nodeType - HERB/MINE/OPEN
    -- x, y - the coordinate [0,1]
    -- node_name - the node being removed, can be an ID, as long as I can convert this to a localized or english string of the node such as "Copper Vein"
    local function InsertNode(continent, zone, nodeType, x, y, node_name)
    	--Routes:InsertNode(zone, coord, node_name)
    end
    
    local function DeleteNode(continent, zone, nodeType, x, y, node_name)
    	--Routes:DeleteNode(zone, coord, node_name)
    end
    
    local idToName = nil
    local mapNameToRealName = nil
    local function getZoneNameFromIds(cId, zId)
       if not idToName then
          -- build the table to get the zone name from the continentId and the ZoneId
          idToName = {}
          mapNameToRealName = {}
          for zoneName, zoneTable in pairs(Routes.LZName) do
             local continentId, zoneId = zoneTable[3], zoneTable[4]
             idToName[continentId] = idToName[continentId] or {}
             idToName[continentId][zoneId] = zoneName
    
             mapNameToRealName[zoneTable[1]] = zoneName
          end
       end
    
       return idToName[cId] and idToName[cId][zId] or ""
    end
    
    if _G.Gatherer and _G.Gatherer.Api.AddGather then
       local origAddGather = _G.Gatherer.Api.AddGather
       _G.Gatherer.Api.AddGather = function(objectId, gatherType, indoorNode, gatherSource, gatherCoins, gatherLoot, wasGathered, gatherC, gatherZ, gatherX, gatherY, ...)
          -- Only add route for successful addition in Gatherer
          if origAddGather(objectId, gatherType, indoorNode, gatherSource, gatherCoins, gatherLoot, wasGathered, gatherC, gatherZ, gatherX, gatherY, ...) then
             -- When we do the gathering ourselves
             local gatherZone
             if not (gatherC and gatherZ and gatherX and gatherY) then
                gatherZone, gatherX, gatherY = _G.Gatherer.Util.GetPositionInCurrentZone()
             end
    
             local nodeName = _G.Gatherer.Util.GetNodeName(objectId)
             local newCoord = Routes:getID(gatherX, gatherY)
             Routes:InsertNode(gatherZone or getZoneNameFromIds(gatherC, gatherZ), newCoord, nodeName)
    --         Routes:InsertNode(gatherZone, newCoord, nodeName)
          end
       end
    end
    
    local lastTime
    local function RefreshZoneNodes(mapName)
       if not mapNameToRealName then getZoneNameFromIds(1, 1) end -- Build mapNameToRealName is needed
       local zoneName = mapNameToRealName[mapName] or "error"
       if zoneName == "error" then return end
    
       -- Thurttle
    	if lastTime and lastTime < time() + 30 then return end
    	lastTime = time()
    
       local continentId = zoneName and Routes.LZName[zoneName][3] or _G.SetMapToCurrentZone() or _G.GetCurrentMapZone()
       local zoneId = zoneName and Routes.LZName[zoneName][4] or _G.GetCurrentMapContinent()
       zoneName = zoneName or getZoneNameFromIds(continentId, zoneId)
    
    -- err("continentId = %s, zoneId = %s, zoneName =%s", continentId, zoneId, zoneName )
    -- local err_trace = 0
    
       for index, objectId, gType in _G.Gatherer.Storage.ZoneGatherNames( zoneId ) do
          local x, y = _G.Gatherer.Storage.GetGatherInfo( zoneId, objectId, gType, index)
          if x and y then
             local newCoord = Routes:getID(x, y)
             local nodeName = _G.Gatherer.Util.GetNodeName(objectId)
    --       if err_trace < 10 and gType == "MINE" then
    --          err_trace = err_trace + 1
    --          err("%s: zoneName = %s, nodeName = %s, x =%s, y = %s", err_trace, zoneName, nodeName, x, y )
    --       end
             Routes:InsertNode(zoneName, newCoord, nodeName)
          end
       end
    end
    source.RefreshZoneNodes = RefreshZoneNodes
    -- /spew Routes.plugins["Gatherer"].RefreshZoneNodes()
    
    local function AddCallbacks()
    	--Functions to add Gatherer callbacks
    end
    source.AddCallbacks = AddCallbacks
    
    local function RemoveCallbacks()
    	--Functions to remove Gatherer callbacks
    end
    source.RemoveCallbacks = RemoveCallbacks
    
  • Avatar of Kilau Kilau Nov 10, 2012 at 16:43 UTC - 0 likes

    There seem to be several zones where Routes reports "No Data Found" from Gatherer. For me it includes several zones where I have previously inported data and created a route. The routes I previously made still exist, but if I wanted to create a new route, the Gatherer import is blank.

  • Avatar of ULTIMATESEVEN ULTIMATESEVEN Nov 09, 2012 at 18:10 UTC - 0 likes

    Hi, I kindly ask you to answer the question, just have a moment of time. Currently the database of wowhead is not usable by routes v1.4.2-4-gafa7d39. There is a solution to the problem? If the answer is yes, you can direct us or tell us how to use it? Thank you in advance for your reply Sincerely

    Seven

  • Avatar of Dlama Dlama Oct 27, 2012 at 19:49 UTC - 1 like

    I'm having the same problem where I can not chose nodes form gatherer to create a route.

  • 7 comments

Facts

Last updated
Oct 29, 2012
Reported
Oct 23, 2012
Status
New - Issue has not had initial review yet.
Type
Other - Some other kind of issue
Priority
Medium - Normal priority.
Votes
1

Reported by

Possible assignees