public
Description: WoW Addon - Prospecting and Disenchanting Aide
Homepage: http://www.tekkub.net
Clone URL: git://github.com/tekkub/panda.git
Click here to lend your support to: panda and make a donation at www.pledgie.com !
Add bag item counts to GemCutting frame
tekkub (author)
Wed Jan 30 22:14:32 -0800 2008
commit  c4a19191db6ba5f7fdbb3204f94def8fe2ae412d
tree    baf106022fe9534ea7fd68b5301ba931e7290fa9
parent  fc4bb8a6668ee9b7122fac9f58b40b783d049324
...
12
13
14
15
 
16
17
18
...
33
34
35
 
 
 
 
36
37
38
...
55
56
57
 
58
59
60
...
73
74
75
 
76
77
78
...
108
109
110
111
 
 
 
 
 
 
 
 
 
 
112
113
114
...
122
123
124
 
 
 
 
 
 
 
 
 
 
 
 
 
...
12
13
14
 
15
16
17
18
...
33
34
35
36
37
38
39
40
41
42
...
59
60
61
62
63
64
65
...
78
79
80
81
82
83
84
...
114
115
116
 
117
118
119
120
121
122
123
124
125
126
127
128
129
...
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
0
@@ -12,7 +12,7 @@ local frame
0
 for i,t in pairs(CUTS) do for _,id in pairs(t) do GameTooltip:SetHyperlink("item:"..id) end end
0
 
0
 
0
-local cutframes, knowncombines, frame = {}, {}
0
+local rawframes, cutframes, knowncombines, frame = {}, {}, {}
0
 function Panda:CreateCutGreenBluePanel()
0
   local function SetupFrame(f, id, secure)
0
     local name, link, _, _, _, _, _, _, _, texture = GetItemInfo(id)
0
@@ -33,6 +33,10 @@ function Panda:CreateCutGreenBluePanel()
0
     local price = Panda:GetAHBuyout(id)
0
     text:SetText(GS(price))
0
 
0
+ local count = f:CreateFontString(nil, "ARTWORK", "NumberFontNormalSmall")
0
+ count:SetPoint("BOTTOMRIGHT", icon, "BOTTOMRIGHT", -2, 2)
0
+ f.count = count
0
+
0
     if secure and self.canJC then
0
       f:SetAlpha(knowncombines[f.name] and 1 or 0.25)
0
       f:SetAttribute("type", "macro")
0
@@ -55,6 +59,7 @@ function Panda:CreateCutGreenBluePanel()
0
     end
0
     rowanchor = f
0
     lastframe = SetupFrame(f, rawid)
0
+ rawframes[rawid] = f
0
 
0
     for j,id in ipairs(CUTS[rawid]) do
0
       local f = CreateFrame("CheckButton", nil, frame, "SecureActionButtonTemplate")
0
@@ -73,6 +78,7 @@ function Panda:CreateCutGreenBluePanel()
0
     end
0
     rowanchor = f
0
     lastframe = SetupFrame(f, rawid)
0
+ rawframes[rawid] = f
0
 
0
     for j,id in ipairs(CUTS[rawid]) do
0
       local f = CreateFrame("CheckButton", nil, frame, "SecureActionButtonTemplate")
0
@@ -108,7 +114,16 @@ function Panda:CreateCutGreenBluePanel()
0
     b:SetAttribute("macrotext", "/run CloseTradeSkill()\n/cast Jewelcrafting\n/run CloseTradeSkill()")
0
   end
0
 
0
- frame:SetScript("OnShow", function() OpenBackpack() end)
0
+ frame:SetScript("OnShow", function()
0
+ OpenBackpack()
0
+ self:RegisterEvent("BAG_UPDATE", "GemCutBagUpdate")
0
+ self:GemCutBagUpdate()
0
+ end)
0
+ frame:SetScript("OnHide", function() self:UnregisterEvent("BAG_UPDATE") end)
0
+
0
+ OpenBackpack()
0
+ self:RegisterEvent("BAG_UPDATE", "GemCutBagUpdate")
0
+ self:GemCutBagUpdate()
0
 
0
   self.CreateCutGreenBluePanel = nil -- Don't need this function anymore!
0
   return frame
0
@@ -122,3 +137,16 @@ function Panda:TRADE_SKILL_SHOW()
0
   end
0
   for id,f in pairs(cutframes) do f:SetAlpha((not self.canJC or knowncombines[f.name]) and 1 or 0.25) end
0
 end
0
+
0
+
0
+function Panda:GemCutBagUpdate()
0
+ for id,f in pairs(cutframes) do
0
+ local count = GetItemCount(id)
0
+ f.count:SetText(count > 0 and count or "")
0
+ end
0
+
0
+ for id,f in pairs(rawframes) do
0
+ local count = GetItemCount(id)
0
+ f.count:SetText(count > 0 and count or "")
0
+ end
0
+end

Comments

    No one has commented yet.