# HG changeset patch # User Aaron@Aaron-PC # Date 1282346461 18000 # Node ID bc8c0631172bd5ee6aa2429fa38ec27e184d37c1 # Parent 53cdbf1c7fc2b3614c0f141d3569d6ee1b48d125 Count of items in inventory shown on minimap, colors changed to match. diff -r 53cdbf1c7fc2 -r bc8c0631172b core.lua --- a/core.lua Thu Aug 19 18:04:18 2010 -0500 +++ b/core.lua Fri Aug 20 18:21:01 2010 -0500 @@ -43,6 +43,7 @@ local db = {} local safeRecipes = {} local ids = {} +local nodeLookup = {} local profile @@ -57,6 +58,7 @@ get_note_title, get_next_texture_id, set_node_constants, + get_colored_note_name, inject_options; --[[ Deep table inspection for debugging ]] @@ -202,6 +204,18 @@ GatherMate:GetModule("Config"):UpdateConfig() GatherMate:GetModule("Config"):SendMessage("GatherMateConfigChanged") + + --[[ hook GetNameForNode for custom highlighting ]] + local oldFunction = GatherMate.GetNameForNode + + GatherMate.GetNameForNode = function(lself, type, nodeID) + if(type == "RecipeProfit") then + return get_colored_note_name(lself, nodeID) + else + return oldFunction(lself, type, nodeID) + end + end + end @@ -338,12 +352,16 @@ local nodes = GatherMate.nodeIDs["RecipeProfit"] for id, note in pairs(RECIPEPROFIT_alliance) do safeRecipes[note.item] = true; - nodes[get_note_title(note, "A")] = get_next_texture_id() + local id = get_next_texture_id(); + nodes[get_note_title(note, "A")] = id; + nodeLookup[id] = note; end for id, note in pairs(RECIPEPROFIT_horde) do safeRecipes[note.item] = true; - nodes[get_note_title(note, "H")] = get_next_texture_id() + local id = get_next_texture_id(); + nodes[get_note_title(note, "H")] = id; + nodeLookup[id] = note; end for i = 1, lastNodeTextureId, 1 do @@ -375,3 +393,23 @@ arg = "RecipeProfit", } end + +function get_colored_note_name(self, nodeID) + local text = self.reverseNodeIDs["RecipeProfit"][nodeID] + local sName, sLink, iRarity, iLevel, iMinLevel, sType, sSubType, iStackCount = GetItemInfo(nodeLookup[nodeID].itementry) + + if(not sLink) then + return text + end + + local count = GetItemCount(sLink, true) + local prefix = "|cFF888888(" .. count .. ") |cFF66DD66" + + if(count == 0) then + prefix = "|cFF00FFFF(" .. count .. ") |cFF66DD66" + elseif(count >= 5) then + prefix = "|cFFFF0000(" .. count .. ") |cFF66DD66" + end + + return prefix .. text +end diff -r 53cdbf1c7fc2 -r bc8c0631172b location_cache.lua --- a/location_cache.lua Thu Aug 19 18:04:18 2010 -0500 +++ b/location_cache.lua Fri Aug 20 18:21:01 2010 -0500 @@ -94,10 +94,12 @@ --[[ Overwrites RECIPEPROFIT_alliance and RECIPEPROFIT_horde dbs. ]] -for _, note in pairs(RECIPEPROFIT_alliance) do - fix_coords(note, RECIPEPROFIT_location_cache) +do + for _, note in pairs(RECIPEPROFIT_alliance) do + fix_coords(note, RECIPEPROFIT_location_cache) + end + + for _, note in pairs(RECIPEPROFIT_horde) do + fix_coords(note, RECIPEPROFIT_location_cache) + end end - -for _, note in pairs(RECIPEPROFIT_horde) do - fix_coords(note, RECIPEPROFIT_location_cache) -end