Mercurial > wow > recipeprofit
diff core.lua @ 24:bc8c0631172b v1.04
Count of items in inventory shown on minimap, colors changed to match.
| author | Aaron@Aaron-PC |
|---|---|
| date | Fri, 20 Aug 2010 18:21:01 -0500 |
| parents | 1da3cd643786 |
| children | 19e007e5eca9 |
line wrap: on
line diff
--- 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
