Mercurial > wow > recipeprofit
comparison core.lua @ 9:20e2aefac1b0
Bugfix involving highlight of merchant frame text
| author | Aaron Bregger |
|---|---|
| date | Thu, 12 Aug 2010 17:43:48 -0500 |
| parents | 5a0fa30712da |
| children | 5ae9ffe0cc2d |
comparison
equal
deleted
inserted
replaced
| 8:5a0fa30712da | 9:20e2aefac1b0 |
|---|---|
| 9 | 9 |
| 10 http://www.wrathguides.com/ | 10 http://www.wrathguides.com/ |
| 11 | 11 |
| 12 --]]--))--))--))--))--))--))--))--))--))--))--))--))--))--))--))--))--))--))--)) | 12 --]]--))--))--))--))--))--))--))--))--))--))--))--))--))--))--))--))--))--))--)) |
| 13 | 13 |
| 14 local RecipeProfit = LibStub("AceAddon-3.0"):NewAddon("RecipeProfit") | 14 local RecipeProfit = LibStub("AceAddon-3.0"):NewAddon("RecipeProfit", "AceEvent-3.0") |
| 15 local GatherMate = LibStub("AceAddon-3.0"):GetAddon("GatherMate") | 15 local GatherMate = LibStub("AceAddon-3.0"):GetAddon("GatherMate") |
| 16 local tabletest = {} | 16 local tabletest = {} |
| 17 db = {} | 17 db = {} |
| 18 local safeRecipes = {} | 18 local safeRecipes = {} |
| 19 safer = safeRecipes | 19 safer = safeRecipes |
| 203 | 203 |
| 204 GatherMate:GetModule("Config"):UpdateConfig() | 204 GatherMate:GetModule("Config"):UpdateConfig() |
| 205 GatherMate:GetModule("Config"):SendMessage("GatherMateConfigChanged") | 205 GatherMate:GetModule("Config"):SendMessage("GatherMateConfigChanged") |
| 206 end | 206 end |
| 207 | 207 |
| 208 function RecipeProfit:OnEnable() | 208 function button_update(self) |
| 209 local buttonName = _G[self:GetName().."Name"]; | |
| 210 local link = GetMerchantItemLink(_G[self:GetName().."ItemButton"]:GetID()); | |
| 211 if(not link) then | |
| 212 return; | |
| 213 end | |
| 214 | |
| 215 local sName, sLink, iRarity, iLevel, iMinLevel, sType, sSubType, iStackCount = GetItemInfo(link) | |
| 216 | |
| 217 if(sType == "Recipe" and safeRecipes[sName]) then | |
| 218 SetItemButtonNameFrameVertexColor(self, 0, 0, 1.0); | |
| 219 SetItemButtonSlotVertexColor(self, 0, 0, 0.5); | |
| 220 buttonName:SetText("* " .. sName) | |
| 221 if(GetItemCount(link, true) == 0) then | |
| 222 buttonName:SetTextColor(0,1,1); | |
| 223 elseif(GetItemCount(link, true) < 5) then | |
| 224 buttonName:SetTextColor(1,0,1); | |
| 225 else | |
| 226 buttonName:SetTextColor(1,0,0); | |
| 227 end | |
| 228 else | |
| 229 buttonName:SetTextColor(GameFontNormalSmall:GetTextColor()); | |
| 230 end | |
| 231 end | |
| 232 | |
| 233 function RecipeProfit:UpdateButtons(event) | |
| 234 --print("UpdateButtons", event) | |
| 209 for i=1, MERCHANT_ITEMS_PER_PAGE, 1 do | 235 for i=1, MERCHANT_ITEMS_PER_PAGE, 1 do |
| 210 local buttonframe = _G["MerchantItem"..i]; | 236 local buttonframe = _G["MerchantItem"..i]; |
| 211 buttonframe:HookScript("OnUpdate", function(self) | 237 local index = (((MerchantFrame.page - 1) * MERCHANT_ITEMS_PER_PAGE) + i); |
| 212 local buttonName = _G[self:GetName().."Name"]; | 238 --print(index) |
| 213 local link = GetMerchantItemLink(_G[self:GetName().."ItemButton"]:GetID()); | 239 if index <= GetMerchantNumItems() then |
| 214 if(not link) then | 240 button_update(buttonframe) |
| 215 return; | 241 else |
| 216 end | 242 --print(i, index, GetMerchantNumItems()) |
| 217 | 243 local itemButton = _G["MerchantItem"..i.."ItemButton"]; |
| 218 local sName, sLink, iRarity, iLevel, iMinLevel, sType, sSubType, iStackCount = GetItemInfo(link) | 244 local merchantButton = _G["MerchantItem"..i]; |
| 219 | 245 itemButton.price = nil; |
| 220 if(sType == "Recipe" and safeRecipes[sName]) then | 246 itemButton.hasItem = nil; |
| 221 SetItemButtonNameFrameVertexColor(self, 0, 0, 1.0); | 247 itemButton:Hide(); |
| 222 SetItemButtonSlotVertexColor(self, 0, 0, 0.5); | 248 SetItemButtonNameFrameVertexColor(merchantButton, 0.5, 0.5, 0.5); |
| 223 buttonName:SetText("* " .. sName) | 249 SetItemButtonSlotVertexColor(merchantButton,0.4, 0.4, 0.4); |
| 224 if(GetItemCount(link, true) == 0) then | 250 _G["MerchantItem"..i.."Name"]:SetText(""); |
| 225 buttonName:SetTextColor(0,1,1); | 251 _G["MerchantItem"..i.."MoneyFrame"]:Hide(); |
| 226 elseif(GetItemCount(link, true) < 5) then | 252 _G["MerchantItem"..i.."AltCurrencyFrame"]:Hide(); |
| 227 buttonName:SetTextColor(1,0,1); | 253 end |
| 228 else | 254 end |
| 229 buttonName:SetTextColor(1,0,0); | 255 end |
| 230 end | 256 |
| 231 else | |
| 232 buttonName:SetTextColor(GameFontHighlightSmallOutline:GetTextColor()); | |
| 233 end | |
| 234 end) | |
| 235 | 257 |
| 236 | 258 function RecipeProfit:OnEnable() |
| 237 end | 259 |
| 260 _G["MerchantPrevPageButton"]:HookScript("OnClick", self.UpdateButtons) | |
| 261 _G["MerchantNextPageButton"]:HookScript("OnClick", self.UpdateButtons) | |
| 262 | |
| 263 self:RegisterEvent("MERCHANT_SHOW", "UpdateButtons") | |
| 264 self:RegisterEvent("MERCHANT_UPDATE", "UpdateButtons") | |
| 238 | 265 |
| 239 RecipeProfit:DoMerge() | 266 RecipeProfit:DoMerge() |
| 240 end | 267 end |
| 241 | 268 |
| 242 local ids = {} | 269 local ids = {} |
