# HG changeset patch # User contrebasse # Date 1305650106 -7200 # Node ID d2b4b378bea46074467cc4298a399e92ec141a40 # Parent cedd0ab21580723658d27c3f1e4941bb1a2d4272 Add number of scrolls on the enchant button diff -r cedd0ab21580 -r d2b4b378bea4 EnchantOnScroll.lua --- 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()