Mercurial > wow > recipeprofit
changeset 1:dceccfaf0a50
Added highlighting of recipeprofit recipes to main build. Recipes now show with a blueish background and have cyan text if you do not have any of them in your backpack or bank, magenta text if you have less than 5, and red text if you have 5 or more. This makes it easy to avoid buying items you don't want.
| author | Aaron Bregger |
|---|---|
| date | Wed, 11 Aug 2010 23:40:11 -0500 |
| parents | 25906be72a8b |
| children | 050ca47f9138 |
| files | RecipeProfit.toc core.lua |
| diffstat | 2 files changed, 70 insertions(+), 20 deletions(-) [+] |
line wrap: on
line diff
--- a/RecipeProfit.toc Wed Aug 11 12:01:21 2010 -0500 +++ b/RecipeProfit.toc Wed Aug 11 23:40:11 2010 -0500 @@ -1,12 +1,16 @@ -## Interface: 30300 -## Title: |cffCCCC88!RECIPEPROFIT!|r -## Notes: Adds a crapload of map notes to your minimap. yep. -## Author: Vertebrate -## Version: 3.3.5 -## Dependencies: GatherMate -## SavedVariables: profile - -core.lua - -alliance.lua -horde.lua +## Interface: 30300 +## Title: |cffCCCC88!RECIPEPROFIT!|r +## Notes: Adds a crapload of map notes to your minimap. yep. +## Author: Vertebrate +## Version: 3.3.5 +## Dependencies: GatherMate +## SavedVariables: profile +## X-Curse-Packaged-Version: r0 +## X-Curse-Project-Name: RecipeProfit +## X-Curse-Project-ID: recipeprofit +## X-Curse-Repository-ID: wow/recipeprofit/mainline + +core.lua + +alliance.lua +horde.lua
--- a/core.lua Wed Aug 11 12:01:21 2010 -0500 +++ b/core.lua Wed Aug 11 23:40:11 2010 -0500 @@ -2,8 +2,11 @@ local GatherMate = LibStub("AceAddon-3.0"):GetAddon("GatherMate") local tabletest = {} local db = {} +local safeRecipes = {} +safer = safeRecipes RecipeProfit.db = db; + function debugprint(val, indent) indent = indent or ""; if not(type(val) == "table") then @@ -34,7 +37,7 @@ handler = {}, disabled = false, args = { - faction = { + opt = { order = 1, name = "Select Database", desc = "Show a different database", @@ -49,12 +52,24 @@ values = { ["Alliance"] = "Alliance", ["Horde"] = "Horde", - ["default"] = "Default (Determined By Character)", + ["default"] = "Default", }, arg = "faction", }, + + safeBuy = { + order = 1, + name = "Safe Recipe Buy", + desc = "Warn when buying a recipe not on the RecipeProfit list.", + type = "select", + values = { + ["on"] = "On", + ["off"]= "Off", + }, + arg = "safebuy", + }, }, - get = function(k) print(k); return db.profile[k.arg]; end, + get = function(k) return db.profile[k.arg]; end, set = function(k, v) db.profile[k.arg] = v; RecipeProfit:DoMerge(); end, }, loadData = { @@ -70,11 +85,16 @@ } local defaults = { - faction = nil, + faction = "default", + safebuy = "on", } function RecipeProfit:OnInitialize() profile = profile or defaults + for k, v in pairs(defaults) do + profile[k] = profile[k] or v; + end + db.profile = profile db.storage = {} @@ -87,11 +107,13 @@ nodes = GatherMate.nodeIDs["RecipeProfit"] for id, note in pairs(RECIPEPROFIT_alliance) do + safeRecipes[note.item] = true; nodes[note.item.." - ("..note.vendor.." A)"] = id * 10 GatherMate.nodeTextures["RecipeProfit"][id * 10] = "Interface\\Icons\\INV_Scroll_05" end for id, note in pairs(RECIPEPROFIT_horde) do + safeRecipes[note.item] = true; nodes[note.item.." - ("..note.vendor.." H)"] = id * 10 + 1 GatherMate.nodeTextures["RecipeProfit"][id * 10 + 1] = "Interface\\Icons\\INV_Scroll_05" end @@ -103,9 +125,30 @@ end function RecipeProfit:OnEnable() - db.profile.faction = db.profile.faction or UnitFactionGroup("player") - - RecipeProfit:DoMerge() + for i=1, MERCHANT_ITEMS_PER_PAGE, 1 do + local buttonframe = _G["MerchantItem"..i]; + buttonframe:HookScript("OnUpdate", function(self) + local buttonName = _G[self:GetName().."Name"]; + local link = GetMerchantItemLink(_G[self:GetName().."ItemButton"]:GetID()); + local sName, sLink, iRarity, iLevel, iMinLevel, sType, sSubType, iStackCount = GetItemInfo(link) + + if(sType == "Recipe" and safeRecipes[sName]) then + SetItemButtonNameFrameVertexColor(self, 0, 0, 1.0); + SetItemButtonSlotVertexColor(self, 0, 0, 0.5); + if(GetItemCount(link, true) == 0) then + buttonName:SetTextColor(0,1,1); + elseif(GetItemCount(link, true) < 5) then + buttonName:SetTextColor(1,0,1); + else + buttonName:SetTextColor(1,0,0); + end + else + buttonName:SetTextColor(GameFontHighlightSmallOutline:GetTextColor()); + end + end) + + RecipeProfit:DoMerge() + end end local ids = {} @@ -120,8 +163,11 @@ function RecipeProfit:DoMerge() ids = {} + selectedDB = db.profile.faction == "Alliance" and RECIPEPROFIT_alliance or + db.profile.faction == "default" and UnitFactionGroup("player") == "Alliance" and + RECIPEPROFIT_alliance or RECIPEPROFIT_horde GatherMate:ClearDB("RecipeProfit") - for id, note in pairs(db.profile.faction == "Alliance" and RECIPEPROFIT_alliance or RECIPEPROFIT_horde) do + for id, note in pairs(selectedDB) do x, y = findGoodId(note.x, note.y) GatherMate:AddNode(note.map, x / 100, y / 100, "RecipeProfit", note.item.." - ("..note.vendor.." ".. (db.profile.faction == "Alliance" and "A" or "H") ..")")
