TradeSkillInfo

30 - Tradeskill Enhancement - Producer compatibility (patch included)

What does the provided patch do?
Producer is a relatively young tradeskill replacement. Only recently it gained support for hooks from other addons. The patch below will allow TradeSkillInfo to inject the skill levels of a single trade skill into Producer's view.

Please provide any additional information below.
The patch is written in contextual diff, versus SVN revision 352. I hope that's readable to you.

Index: TradeskillInfo.lua          
===================================================================
--- TradeskillInfo.lua 352)                             
+++ TradeskillInfo.lua copy)                             
@@ -237,7 +237,8 @@                                                
        elseif addon == "Blizzard_TradeSkillUI" or                 
               addon == "Skillet" or                               
               addon == "TradeskillHD" or                          
-                  addon == "AdvancedTradeSkillWindow" then        
+                  addon == "AdvancedTradeSkillWindow" or          
+           addon == "Producer" then                               
                self:HookTradeSkillUI();                           
        end                                                        
 end                                                               
@@ -378,6 +379,11 @@                                               
                        self:SecureHook("ATSWFrame_SetSelection")  
                end                                                
        end                                                        
+                                                                  
+    if Producer and not self:IsHooked(Producer.CraftFrame "AddTradeSkillLines") then
+        self:SecureHook(Producer.CraftFrame "AddTradeSkillLines")
+        assert(self:IsHooked(Producer.CraftFrame "AddTradeSkillLines"))
+    end
 end

 function TradeskillInfo:UpdateKnownRecipes()
@@ -579,6 +585,49 @@
        end
 end

+function TradeskillInfo:AddTradeSkillLines( _self, trade, grp )
+    if not trade.name then
+        return
+    end
+
+    local itemId = getIdFromLink(trade.link
+
+    if not self:CombineExists(itemId) then
+        local spellId = getIdFromLink(trade.recipe
+        itemId = self:MakeSpecialCase(itemId, spellId)
+    end
+
+    if self:CombineExists(itemId) then
+        local shown = false
+        if self:ShowingSkillLevel() then
+            -- Insert skill required.
+            local line = { text = self:GetColoredDifficulty(itemId) }
+            grp:AddLine( line )
+            shown = true
+       end
+
+       if self:ShowingSkillAuctioneerProfit() then
+            -- Insert item value and reagent costs
+            local value,cost,profit = self:GetCombineAuctioneerCost(itemId)
+            local line = { text = string.format("%s %s - %s = %s", SPELL_REAGENTS,
+                       self:GetMoneyString(value), self:GetMoneyString(cost), self:GetMoneyString(profit)) }
+            grp:AddLine( line )
+            shown = true
+       elseif self:ShowingSkillProfit() then
+            -- Insert item value and reagent costs
+            local value,cost,profit = self:GetCombineCost(itemId)
+            local line = { text = string.format("%s %s - %s = %s", SPELL_REAGENTS,
+                               self:GetMoneyString(value), self:GetMoneyString(cost), self:GetMoneyString(profit)) }
+            grp:AddLine( line )
+            shown = true
+        end
+
+        if shown then
+            grp:AddLine()
+        end
+    end
+end
+
 ----------------------------------------------------------------------
 -- OnClick hooks
 ----------------------------------------------------------------------

User When Change
EthanCentaurai Nov 27, 2010 at 22:28 UTC Changed assigned to from wmrojer to EthanCentaurai
CMTitan Dec 12, 2009 at 08:14 UTC Create

You must login to post a comment. Don't have an account? Register to get one!

Facts

Last updated
Mar 30, 2012
Reported
Dec 12, 2009
Status
New - Issue has not had initial review yet.
Type
Patch - Source code patch for review
Priority
Medium - Normal priority.
Votes
1

Reported by

Possible assignees