From 206ccaa40345cb07d1ff1e92b8df5314965fde41 Mon Sep 17 00:00:00 2001 From: pschifferer Date: Fri, 6 Mar 2009 03:33:58 +0000 Subject: [PATCH] Added an option to display the skill list in a "compact" format. Added an "auto-buy" option to the shopping list window (but it doesn't do anything yet!). --- CauldronMain.lua | 10 +++- CauldronMain.xml | 1 + CauldronMainUI.lua | 109 ++++++++++++++++++++++++++++++-------------- CauldronShoppingList.lua | 3 ++ CauldronShoppingList.xml | 43 +++++++++++++++++ CauldronShoppingListUI.lua | 6 +++ Locale/Cauldron-enUS.lua | 5 ++ 7 files changed, 143 insertions(+), 34 deletions(-) diff --git a/CauldronMain.lua b/CauldronMain.lua index c09ba32..186e10b 100644 --- a/CauldronMain.lua +++ b/CauldronMain.lua @@ -111,6 +111,12 @@ function Cauldron:InitPlayer() if not self.db.realm.userdata[self.vars.playername].queue then self.db.realm.userdata[self.vars.playername].queue = CauldronQueue:NewQueue(); end + if not self.db.realm.userdata[self.vars.playername].options then + self.db.realm.userdata[self.vars.playername].options = { + autoBuy = false, + compactView = false, + }; + end if not self.db.realm.shopping then self.db.realm.shopping = CauldronShopping:NewList(); end @@ -401,7 +407,9 @@ function Cauldron:OnMerchantShow() self:debug("OnMerchantShow enter"); --@end-alpha@ --- TODO + if Cauldron.db.realm.userdata[Cauldron.vars.playername].options.autoBuy then + CauldronShopping:AutoBuyShoppingItems(Cauldron.db.realm.shopping, Cauldron.vars.playername); + end --@alpha@ self:debug("OnMerchantShow exit"); diff --git a/CauldronMain.xml b/CauldronMain.xml index 01af4f9..f44000e 100644 --- a/CauldronMain.xml +++ b/CauldronMain.xml @@ -105,6 +105,7 @@ + self.isCompact = false; -- self.hasItem = 1; diff --git a/CauldronMainUI.lua b/CauldronMainUI.lua index d880aef..4c6737b 100644 --- a/CauldronMainUI.lua +++ b/CauldronMainUI.lua @@ -91,7 +91,6 @@ function Cauldron:Frame_Update() --@alpha@ self:debug("Frame_Update numTradeSkills: ",numTradeSkills); --@end-alpha@ --- local skillOffset = FauxScrollFrame_GetOffset(TradeSkillListScrollFrame); local name, rank, maxRank = GetTradeSkillLine(); --@alpha@ self:debug("Frame_Update name: ",name,"; rank: ",rank,"; maxRank: ",maxRank); @@ -123,8 +122,8 @@ function Cauldron:Frame_Update() -- update the frame dimensions -- - CauldronFrame:SetHeight(465); - CauldronFrame:SetWidth(692); +-- CauldronFrame:SetHeight(465); +-- CauldronFrame:SetWidth(692); -- display skill name, level/progress --@alpha@ @@ -240,7 +239,7 @@ function Cauldron:UpdateSkillList() --@end-alpha@ local skillFrame = _G["CauldronSkillItem"..i]; - + -- check if we have a frame for this position if not skillFrame then -- create a new frame for the skill information @@ -249,6 +248,36 @@ function Cauldron:UpdateSkillList() CauldronSkillListFrameScrollFrameScrollChild, "CauldronSkillItemFrameTemplate"); end + + if self.db.realm.userdata[self.vars.playername].options.compactView then + -- set the height of frame + skillFrame:SetHeight(25); + _G["CauldronSkillItem"..i.."SkillCooldown"]:SetHeight(25); + + -- rescale the icon frame + _G["CauldronSkillItem"..i.."SkillIcon"]:SetWidth(18); + _G["CauldronSkillItem"..i.."SkillIcon"]:SetHeight(18); + + -- reposition the name + _G["CauldronSkillItem"..i.."SkillName"]:SetPoint("TOPLEFT", 43, -4); + + -- hide the category info + _G["CauldronSkillItem"..i.."SkillCategory"]:Hide(); + else + -- set the height of frame + skillFrame:SetHeight(50); + _G["CauldronSkillItem"..i.."SkillCooldown"]:SetHeight(50); + + -- rescale the icon frame + _G["CauldronSkillItem"..i.."SkillIcon"]:SetWidth(37); + _G["CauldronSkillItem"..i.."SkillIcon"]:SetHeight(37); + + -- reposition the name + _G["CauldronSkillItem"..i.."SkillName"]:SetPoint("TOPLEFT", 62, -4); + + -- show the category info + _G["CauldronSkillItem"..i.."SkillCategory"]:Show(); + end skillFrame:SetID(i); skillFrame.skillIndex = skillInfo.index; @@ -1074,7 +1103,8 @@ function Cauldron:OnCauldronUpdate() --@alpha@ self:debug("OnCauldronUpdate enter"); --@end-alpha@ - + + --[[ -- self:Search(); local selectionIndex if self.vars.selectionIndex == 0 then @@ -1082,6 +1112,7 @@ function Cauldron:OnCauldronUpdate() else selectionIndex = self.vars.selectionIndex; end + --]] --@alpha@ self:debug("OnCauldronUpdate exit"); @@ -1185,6 +1216,46 @@ function Cauldron:FilterDropDown_Initialize(level) notClickable = true, }); + if not IsTradeSkillLinked() then + local miscTitle = { + text = L["View"], + isTitle = true, + tooltipTitle = "", + tooltipText = "", + }; + UIDropDownMenu_AddButton(miscTitle); + + -- favorites + local compact = { + text = L["Compact"], + checked = Cauldron.db.realm.userdata[Cauldron.vars.playername].options.compactView, + tooltipTitle = L["Compact"], + tooltipText = L["Display a compacted view of the skill list"], + func = function(arg1, arg2) Cauldron.db.realm.userdata[Cauldron.vars.playername].options.compactView = not Cauldron.db.realm.userdata[Cauldron.vars.playername].options.compactView; Cauldron:UpdateSkillList(); end, + arg1 = "compact", + arg2 = "", + }; + UIDropDownMenu_AddButton(compact); + + -- favorites + local faves = { + text = L["Favorites"], + checked = Cauldron.db.realm.userdata[Cauldron.vars.playername].skills[skillName].window.filter.favorites, + tooltipTitle = L["Favorites"], + tooltipText = L["Display only favorite skills"], + func = function(arg1, arg2) Cauldron.db.realm.userdata[Cauldron.vars.playername].skills[skillName].window.filter.favorites = not Cauldron.db.realm.userdata[Cauldron.vars.playername].skills[skillName].window.filter.favorites; Cauldron:UpdateSkillList(); end, + arg1 = "favorite", + arg2 = "", + }; + UIDropDownMenu_AddButton(faves); + + -- spacer + UIDropDownMenu_AddButton({ + text = "", + notClickable = true, + }); + end + -- sorting local sortingTitle = { @@ -1323,34 +1394,6 @@ function Cauldron:FilterDropDown_Initialize(level) notClickable = true, }); - if not IsTradeSkillLinked() then - local miscTitle = { - text = L["Miscellaneous"], - isTitle = true, - tooltipTitle = "", - tooltipText = "", - }; - UIDropDownMenu_AddButton(miscTitle); - - -- favorites - local faves = { - text = L["Favorites"], - checked = Cauldron.db.realm.userdata[Cauldron.vars.playername].skills[skillName].window.filter.favorites, - tooltipTitle = L["Favorites"], - tooltipText = L["Display only favorite skills"], - func = function(arg1, arg2) Cauldron.db.realm.userdata[Cauldron.vars.playername].skills[skillName].window.filter.favorites = not Cauldron.db.realm.userdata[Cauldron.vars.playername].skills[skillName].window.filter.favorites; Cauldron:UpdateSkillList(); end, - arg1 = "favorite", - arg2 = "", - }; - UIDropDownMenu_AddButton(faves); - - -- spacer - UIDropDownMenu_AddButton({ - text = "", - notClickable = true, - }); - end - -- reagents availability local reagentsTitle = { diff --git a/CauldronShoppingList.lua b/CauldronShoppingList.lua index 153c79d..89882d1 100644 --- a/CauldronShoppingList.lua +++ b/CauldronShoppingList.lua @@ -143,3 +143,6 @@ function CauldronShopping:EmptyShoppingList(list, requestor) end end + +function CauldronShopping:AutoBuyShoppingItems(list, requestor) +end diff --git a/CauldronShoppingList.xml b/CauldronShoppingList.xml index e17dc5f..8a270db 100644 --- a/CauldronShoppingList.xml +++ b/CauldronShoppingList.xml @@ -190,6 +190,49 @@ + diff --git a/CauldronShoppingListUI.lua b/CauldronShoppingListUI.lua index 8e327aa..97eb169 100644 --- a/CauldronShoppingListUI.lua +++ b/CauldronShoppingListUI.lua @@ -179,3 +179,9 @@ function Cauldron:UpdateShoppingList() end end + +function Cauldron:AutoBuyShoppingList_OnClick(button) + local checked = button:GetChecked(); + Cauldron.db.realm.userdata[Cauldron.vars.playername].options.autoBuy = checked; +end + diff --git a/Locale/Cauldron-enUS.lua b/Locale/Cauldron-enUS.lua index be19c91..2ffdca0 100644 --- a/Locale/Cauldron-enUS.lua +++ b/Locale/Cauldron-enUS.lua @@ -20,6 +20,8 @@ L["Shopping list"] = true L["Open shopping list window"] = true L["Reset"] = true L["Resets Cauldron to a fresh state"] = true +L["Auto-buy?"] = true +L["If this option is checked, then any item that is in the list will be automatically purchased when a vendor window is opened, if that vendor has the items."] = true L["Player known"] = true L["Player can learn"] = true @@ -52,6 +54,9 @@ L["Set the sorting method to use on the skills list"] = true L["Reset filters"] = true L["Reset all filters on the skills list"] = true +L["View"] = true +L["Compact"] = true +L["Display a compacted view of the skill list"] = true L["Filters"] = true L["Difficulty"] = true L["Optimal"] = true -- 1.7.9.5