Mercurial > wow > reagentmaker
diff EnchantOnScroll.lua @ 91:d2b4b378bea4 v1.0beta7
Add number of scrolls on the enchant button
author | contrebasse |
---|---|
date | Tue, 17 May 2011 18:35:06 +0200 |
parents | cd36938d2a48 |
children | b980c00affcd 4d376d031f8d |
line wrap: on
line diff
--- a/EnchantOnScroll.lua Sun May 15 12:56:13 2011 +0200 +++ b/EnchantOnScroll.lua Tue May 17 18:35:06 2011 +0200 @@ -19,8 +19,7 @@ -- Check that the selected recipe can be crafted, and the crafted thing is an enchant local index = GetTradeSkillSelectionIndex() if not index then - btn:Disable() - btn:Show() + btn:Hide() return end local _, _, numAvailable, _, serviceType = GetTradeSkillInfo(index) @@ -30,20 +29,23 @@ btn:Hide() return end - if numAvailable==0 or not serviceType then + + -- Check that there's scrolls in the bags + local itemCount = GetItemCount(SCROLL_ID) + if not itemCount or itemCount==0 then + btn:Disable() + btn:Show() + btn:SetText(A.L["Enchant a scroll (0)"]) + return + end + btn:SetText(A.L["Enchant a scroll (%d)"]:format(itemCount)) + + if numAvailable==0 then btn:Disable() btn:Show() return end - -- Check that there's scrolls in the bags - local itemCount = GetItemCount(SCROLL_ID) - if not itemCount or itemCount==0 then - btn:Disable() - btn:Show() - return - end - -- It passed the tests btn:Enable() btn:Show()