Mercurial > wow > recipeprofit
comparison 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 |
comparison
equal
deleted
inserted
replaced
| 23:53cdbf1c7fc2 | 24:bc8c0631172b |
|---|---|
| 41 local GatherMate = LibStub("AceAddon-3.0"):GetAddon("GatherMate") | 41 local GatherMate = LibStub("AceAddon-3.0"):GetAddon("GatherMate") |
| 42 local tabletest = {} | 42 local tabletest = {} |
| 43 local db = {} | 43 local db = {} |
| 44 local safeRecipes = {} | 44 local safeRecipes = {} |
| 45 local ids = {} | 45 local ids = {} |
| 46 local nodeLookup = {} | |
| 46 | 47 |
| 47 local profile | 48 local profile |
| 48 | 49 |
| 49 RecipeProfit.db = db; | 50 RecipeProfit.db = db; |
| 50 | 51 |
| 55 find_good_id, | 56 find_good_id, |
| 56 safe_cache_vendor, | 57 safe_cache_vendor, |
| 57 get_note_title, | 58 get_note_title, |
| 58 get_next_texture_id, | 59 get_next_texture_id, |
| 59 set_node_constants, | 60 set_node_constants, |
| 61 get_colored_note_name, | |
| 60 inject_options; | 62 inject_options; |
| 61 | 63 |
| 62 --[[ Deep table inspection for debugging ]] | 64 --[[ Deep table inspection for debugging ]] |
| 63 function debugprint(val, indent) | 65 function debugprint(val, indent) |
| 64 indent = indent or ""; | 66 indent = indent or ""; |
| 200 set_node_constants() | 202 set_node_constants() |
| 201 inject_options() | 203 inject_options() |
| 202 | 204 |
| 203 GatherMate:GetModule("Config"):UpdateConfig() | 205 GatherMate:GetModule("Config"):UpdateConfig() |
| 204 GatherMate:GetModule("Config"):SendMessage("GatherMateConfigChanged") | 206 GatherMate:GetModule("Config"):SendMessage("GatherMateConfigChanged") |
| 207 | |
| 208 --[[ hook GetNameForNode for custom highlighting ]] | |
| 209 local oldFunction = GatherMate.GetNameForNode | |
| 210 | |
| 211 GatherMate.GetNameForNode = function(lself, type, nodeID) | |
| 212 if(type == "RecipeProfit") then | |
| 213 return get_colored_note_name(lself, nodeID) | |
| 214 else | |
| 215 return oldFunction(lself, type, nodeID) | |
| 216 end | |
| 217 end | |
| 218 | |
| 205 end | 219 end |
| 206 | 220 |
| 207 | 221 |
| 208 function RecipeProfit:OnEnable() | 222 function RecipeProfit:OnEnable() |
| 209 | 223 |
| 336 GatherMate.nodeMinHarvest["RecipeProfit"] = {} | 350 GatherMate.nodeMinHarvest["RecipeProfit"] = {} |
| 337 | 351 |
| 338 local nodes = GatherMate.nodeIDs["RecipeProfit"] | 352 local nodes = GatherMate.nodeIDs["RecipeProfit"] |
| 339 for id, note in pairs(RECIPEPROFIT_alliance) do | 353 for id, note in pairs(RECIPEPROFIT_alliance) do |
| 340 safeRecipes[note.item] = true; | 354 safeRecipes[note.item] = true; |
| 341 nodes[get_note_title(note, "A")] = get_next_texture_id() | 355 local id = get_next_texture_id(); |
| 356 nodes[get_note_title(note, "A")] = id; | |
| 357 nodeLookup[id] = note; | |
| 342 end | 358 end |
| 343 | 359 |
| 344 for id, note in pairs(RECIPEPROFIT_horde) do | 360 for id, note in pairs(RECIPEPROFIT_horde) do |
| 345 safeRecipes[note.item] = true; | 361 safeRecipes[note.item] = true; |
| 346 nodes[get_note_title(note, "H")] = get_next_texture_id() | 362 local id = get_next_texture_id(); |
| 363 nodes[get_note_title(note, "H")] = id; | |
| 364 nodeLookup[id] = note; | |
| 347 end | 365 end |
| 348 | 366 |
| 349 for i = 1, lastNodeTextureId, 1 do | 367 for i = 1, lastNodeTextureId, 1 do |
| 350 GatherMate.nodeTextures["RecipeProfit"][i] = "Interface\\Icons\\INV_Scroll_05" | 368 GatherMate.nodeTextures["RecipeProfit"][i] = "Interface\\Icons\\INV_Scroll_05" |
| 351 end | 369 end |
| 373 type = "color", | 391 type = "color", |
| 374 hasAlpha = true, | 392 hasAlpha = true, |
| 375 arg = "RecipeProfit", | 393 arg = "RecipeProfit", |
| 376 } | 394 } |
| 377 end | 395 end |
| 396 | |
| 397 function get_colored_note_name(self, nodeID) | |
| 398 local text = self.reverseNodeIDs["RecipeProfit"][nodeID] | |
| 399 local sName, sLink, iRarity, iLevel, iMinLevel, sType, sSubType, iStackCount = GetItemInfo(nodeLookup[nodeID].itementry) | |
| 400 | |
| 401 if(not sLink) then | |
| 402 return text | |
| 403 end | |
| 404 | |
| 405 local count = GetItemCount(sLink, true) | |
| 406 local prefix = "|cFF888888(" .. count .. ") |cFF66DD66" | |
| 407 | |
| 408 if(count == 0) then | |
| 409 prefix = "|cFF00FFFF(" .. count .. ") |cFF66DD66" | |
| 410 elseif(count >= 5) then | |
| 411 prefix = "|cFFFF0000(" .. count .. ") |cFF66DD66" | |
| 412 end | |
| 413 | |
| 414 return prefix .. text | |
| 415 end |
