Mercurial > wow > reagentmaker
diff utils.lua @ 82:cf1da2654dc6 v1.0beta3
Expand headers when needed. Not heavily tested, could fail on a slow computer...
author | contrebasse |
---|---|
date | Sun, 15 May 2011 09:23:15 +0200 |
parents | 9d487333bf10 |
children | 996aaa818d04 |
line wrap: on
line diff
--- a/utils.lua Sun May 15 01:35:38 2011 +0200 +++ b/utils.lua Sun May 15 09:23:15 2011 +0200 @@ -56,7 +56,7 @@ -- Find the first tradeskill index of the recipe to make an item function A.findSkillIndex(itemID) for i = 1,GetNumTradeSkills() do - local skillName, skillType = GetTradeSkillInfo(i) + local _, skillType = GetTradeSkillInfo(i) if skillType == "header" then else local ID = A.link2ID(GetTradeSkillItemLink(i)) @@ -65,7 +65,6 @@ end -- if end -- if end -- for - --A.Error(A.L["Tradeskill not found for %d, is the recipe hidden ?"]:format(itemID)) end -- function end -- do @@ -113,8 +112,12 @@ end end - function A.SaveActiveFilters() + function A.SaveActiveFilters(headerName) + A.blockScan = true + + --[[ print("save") + print(GetNumTradeSkills()) selectedTradeSkillIndex = GetTradeSkillSelectionIndex() subClasses = { GetTradeSkillSubClasses() } @@ -127,12 +130,14 @@ if TradeSkillSubClassDropDown then UIDropDownMenu_SetSelectedID(TradeSkillSubClassDropDown, 1) end + print(GetNumTradeSkills()) -- Inventory slots SetTradeSkillInvSlotFilter(0, 1, 1) -- this checks "All slots" if TradeSkillInvSlotDropDown then UIDropDownMenu_SetSelectedID(TradeSkillInvSlotDropDown, 1) end + print(GetNumTradeSkills()) -- Have Materials if TradeSkillFrameAvailableFilterCheckButton then @@ -140,25 +145,31 @@ TradeSkillFrameAvailableFilterCheckButton:SetChecked(false) end TradeSkillOnlyShowMakeable(false) + print(GetNumTradeSkills()) + --]] -- Headers - local headerCount = 0 -- use a counter to avoid being bound to header names, which might not be unique. - + --local headerCount = 0 -- use a counter to avoid being bound to header names, which might not be unique. for i = GetNumTradeSkills(), 1, -1 do -- 1st pass, expand all categories - local _, skillType, _, isExpanded = GetTradeSkillInfo(i) + local skillName, skillType, _, isExpanded = GetTradeSkillInfo(i) if (skillType == "header") then - headerCount = headerCount + 1 - if not isExpanded then + --headerCount = headerCount + 1 + if not isExpanded and skillName==headerName then ExpandTradeSkillSubClass(i) - headersState[headerCount] = true + --print(GetNumTradeSkills()) + --headersState[headerCount] = true end end end - print("saved") + --print("saved") + + A.blockScan = nil end function A.RestoreActiveFilters() + A.blockScan = true + print("restore") -- Subclasses SetTradeSkillSubClassFilter(subClassID-1, 1, 1) -- this checks the previously checked value @@ -213,6 +224,8 @@ wipe(headersState) end print("restored") + + A.blockScan = nil end function A.isRecipeUnique(itemData)