From 1e85a7583276277aea7acba8c6dc8b6e9d112c09 Mon Sep 17 00:00:00 2001 From: Paul Schifferer Date: Sun, 5 Dec 2010 20:35:54 -0800 Subject: [PATCH] Skill list updates. --- CauldronMain.xml | 170 ++++++++++++++++++++++++++++++++++----------------- CauldronMainUI.lua | 67 ++++++++++++++++++-- CauldronQueue.xml | 37 +++++++---- CauldronQueueUI.lua | 2 +- CauldronUtil.lua | 16 +++++ 5 files changed, 217 insertions(+), 75 deletions(-) diff --git a/CauldronMain.xml b/CauldronMain.xml index c9cbaee..277e23e 100755 --- a/CauldronMain.xml +++ b/CauldronMain.xml @@ -62,8 +62,7 @@ - @@ -242,22 +242,23 @@ - + - + - - + - + - - + + - - + + - - - + + + + + + + + + + + + + + + + + + + @@ -832,17 +845,20 @@ - - + + - + - - + + + + + @@ -852,6 +868,49 @@ + + + @@ -984,12 +1043,13 @@ - + + diff --git a/CauldronMainUI.lua b/CauldronMainUI.lua index a824951..1093fbd 100644 --- a/CauldronMainUI.lua +++ b/CauldronMainUI.lua @@ -25,6 +25,7 @@ function CauldronFrame_OnHide() end function CauldronSearch_OnTextChanged() + Cauldron:TradeSkillFilter_OnTextChanged(CauldronSearchBox); end function CauldronFrame_Update() @@ -186,11 +187,12 @@ function Cauldron:Frame_Update() -- display skill name, level/progress self:UpdateSkillInfo(name, rank, maxRank); ---[==[ -- update search text box self:UpdateSearchText(); - -- TODO: update dropdowns +--[==[ + -- TODO: update filter information + self:UpdateStatus(); self:UpdateFilterDropDowns(); --]==] @@ -233,7 +235,6 @@ end function Cauldron:UpdateSearchText() ---[==[ local skillName = CURRENT_TRADESKILL; if IsTradeSkillLinked() then skillName = "Linked-"..skillName; @@ -250,9 +251,64 @@ function Cauldron:UpdateSearchText() if searchText == "" then searchText = SEARCH; end - CauldronFiltersSearchEditBox:SetText(searchText); ---]==] + CauldronSearchBox:SetText(searchText); + +end +function Cauldron:UpdateStatus() + + local filters = {}; + + local filterTable = Cauldron.db.realm.userdata[Cauldron.vars.playername].skills[skillName].window.filter; + --[[ + ["sortAlpha"] = false, -- should the list be sorted alphabetically (mutually-exclusive to "sortDifficulty" and "sortBenefit") + ["sortDifficulty"] = true, -- should the list be sorted by difficulty (mutually-exclusive to "sortAlpha" and "sortBenefit") + ["sortBenefit"] = false, -- should the list be sorted by potentcy of the benefit the crafted item/enchantment grants (mutually-exclusive to "sortDifficulty" and "sortAlpha") UNUSED + ["haveAllReagents"] = false, -- should only items with all required reagents be shown in the list? + ["haveKeyReagents"] = false, -- should only items with all key reagents be shown in the list? + ["haveAnyReagents"] = false, -- should only items with any reagents be shown in the list? + ["optimal"] = true, -- should optimal skills be shown? + ["medium"] = true, -- should medium skills be shown? + ["easy"] = true, -- should easy skills be shown? + ["trivial"] = false, -- should trivial skills be shown? + ["favorites"] = false, -- should only favorite skills be shown? + --]] + if filterTable.haveAllReagents then + table.insert(filters, "All reagents"); + elseif filterTable.haveKeyReagents then + table.insert(filters, "Key reagents"); + elseif filterTable.haveAnyReagents then + table.insert(filters, "Any reagents"); + end + + local difficulties = {}; + if filterTable.optimal then + table.insert(difficulties, "optimal"); + end + if filterTable.medium then + table.insert(difficulties, "medium"); + end + if filterTable.easy then + table.insert(difficulties, "easy"); + end + if filterTable.trivial then + table.insert(difficulties, "trivial"); + end + if #difficulties > 0 then + table.insert(filters, Cauldron:JoinStrings(difficulties, ",")); + end + + if filterTable.favorites then + table.insert(filters, "Favorites"); + end + + if #filters > 0 then + local statusText = Cauldron:JoinStrings(filters, "; "); + CauldronStatusText:SetText(statusText); + CauldronStatusText:Show(); + else + CauldronStatusText:Hide(); + end end function Cauldron:UpdateFilterDropDowns() @@ -467,7 +523,6 @@ function Cauldron:UpdateSkillList() local reagentNameFrame = _G["CauldronSkillItem"..i.."ReagentsItemDetail"..j.."Name"]; local reagentIconFrame = _G["CauldronSkillItem"..i.."ReagentsItemDetail"..j.."IconTexture"]; - Cauldron:info("reagentIconFrame="..tostring(reagentIconFrame)); local reagentCountFrame = _G["CauldronSkillItem"..i.."ReagentsItemDetail"..j.."Count"]; -- PARANOIA: check if the reagent name, icon, or link are missing diff --git a/CauldronQueue.xml b/CauldronQueue.xml index 08a50c5..17d0a67 100644 --- a/CauldronQueue.xml +++ b/CauldronQueue.xml @@ -420,7 +420,7 @@ - + @@ -428,13 +428,18 @@ - + + + + + - + @@ -448,7 +453,7 @@ - + @@ -456,15 +461,18 @@ - - + + + + + - + @@ -478,7 +486,7 @@ - + @@ -486,15 +494,18 @@ - - + + + + + - + diff --git a/CauldronQueueUI.lua b/CauldronQueueUI.lua index 8d42ce5..a54e710 100644 --- a/CauldronQueueUI.lua +++ b/CauldronQueueUI.lua @@ -181,7 +181,7 @@ function Cauldron:UpdateQueue() CauldronQueueFrameScrollFrameQueueSectionsSecondaryItemsHeaderText:SetText(""); CauldronQueueFrameScrollFrameQueueSectionsSecondaryItems:SetHeight(1); else - CauldronQueueFrameScrollFrameQueueSectionsSecondaryItemsHeader:SetHeight(12); + CauldronQueueFrameScrollFrameQueueSectionsSecondaryItemsHeader:SetHeight(16); CauldronQueueFrameScrollFrameQueueSectionsSecondaryItemsHeaderText:SetText(L["You first have to make:"]); CauldronQueueFrameScrollFrameQueueSectionsSecondaryItems:SetHeight(#intQueue * itemFrameHeight); diff --git a/CauldronUtil.lua b/CauldronUtil.lua index 4bb5262..d953fc0 100644 --- a/CauldronUtil.lua +++ b/CauldronUtil.lua @@ -328,3 +328,19 @@ function Cauldron:MarkRecipeForRescan(skillDB, name) -- record the failed recipe skillDB.rescan.failedRecipes[name] = true; end + +function Cauldron:JoinStrings(strings, sep) + + local joinedStr = ""; + + for i,str in ipairs(strings) do + if i > 0 then + joinedStr = joinedStr..sep; + end + + joinedStr = joinedStr..str; + end + + return joinedStr; +end + -- 1.7.9.5