@@ -183,40 +183,29 @@ local function IsKnown(link, index)
183183 end
184184end
185185
186- local texCache , pendingUpdate = {}, {}
186+ local texCache = {}
187187
188- function AK :UpdateMerchantItemButton (button )
189- if not button or pendingUpdate [ button ] then
188+ function AK :UpdateMerchantItemButton (button , _ , _ , _ , skip )
189+ if skip or not button : IsShown () then
190190 return
191191 end
192192
193- pendingUpdate [button ] = true
194-
195- RunNextFrame (function ()
196- if not button :IsShown () then
197- pendingUpdate [button ] = nil
198- return
199- end
200-
201- local index = button :GetID ()
202- local tex = texCache [button ]
203- local info = C_MerchantFrame_GetItemInfo (index )
204- if info and info .isUsable and IsKnown (GetMerchantItemLink (index )) then
205- if self .db .mode == " MONOCHROME" then
206- tex :SetDesaturated (true )
207- else
208- local r , g , b = self .db .color .r , self .db .color .g , self .db .color .b
209- if info .numAvailable == 0 then
210- r , g , b = r * 0.5 , g * 0.5 , b * 0.5
211- end
212- button :SetItemButtonTextureVertexColor (0.9 * r , 0.9 * g , 0.9 * b , true )
193+ local tex = texCache [button ]
194+ local index = button :GetID ()
195+ local info = C_MerchantFrame_GetItemInfo (index )
196+ if info and info .isUsable and IsKnown (GetMerchantItemLink (index )) then
197+ if self .db .mode == " MONOCHROME" then
198+ tex :SetDesaturated (true )
199+ else
200+ local r , g , b = self .db .color .r , self .db .color .g , self .db .color .b
201+ if info .numAvailable == 0 then
202+ r , g , b = r * 0.5 , g * 0.5 , b * 0.5
213203 end
214- else -- Reset to original state
215- tex :SetDesaturated (false )
204+ button :SetItemButtonTextureVertexColor (0.9 * r , 0.9 * g , 0.9 * b , true )
216205 end
217-
218- pendingUpdate [ button ] = nil
219- end )
206+ else
207+ tex : SetDesaturated ( false )
208+ end
220209end
221210
222211function AK :Merchant ()
@@ -233,9 +222,9 @@ function AK:Merchant()
233222
234223 local itemButton = _G [" MerchantItem" .. i .. " ItemButton" ]
235224 local itemButtonTex = _G [" MerchantItem" .. i .. " ItemButtonIconTexture" ]
236- if itemButton and itemButtonTex and not self :IsHooked (itemButton , " SetID " ) then
225+ if itemButton and itemButtonTex and not self :IsHooked (itemButton , " SetItemButtonTextureVertexColor " ) then
237226 texCache [itemButton ] = itemButtonTex
238- self :SecureHook (itemButton , " SetID " , " UpdateMerchantItemButton" )
227+ self :SecureHook (itemButton , " SetItemButtonTextureVertexColor " , " UpdateMerchantItemButton" )
239228 self :UpdateMerchantItemButton (itemButton )
240229 end
241230 end
0 commit comments