diff --git a/CauldronMain.lua b/CauldronMain.lua
index 4845c99..9556efb 100644
--- a/CauldronMain.lua
+++ b/CauldronMain.lua
@@ -123,6 +123,7 @@ function Cauldron:OnEnable()
--@end-alpha@
self:InitPlayer();
+
self:RegisterEvent("TRADE_SKILL_SHOW", "OnTradeShow");
self:RegisterEvent("TRADE_SKILL_UPDATE", "OnSkillUpdate");
self:RegisterEvent("TRADE_SKILL_CLOSE", "OnTradeClose");
@@ -147,6 +148,7 @@ function Cauldron:OnEnable()
self:RegisterEvent("CRAFT_CLOSE", "OnCraftClose");
-- self:RegisterEvent("PLAYER_LOGOUT");
self:RegisterEvent("UI_ERROR_MESSAGE", "OnError");
+
self:HookTooltips();
--@alpha@
@@ -303,18 +305,24 @@ function Cauldron:OnBagUpdate(event, bagid)
return;
end
- -- check if the item acquired is in the intermediate list
+ -- check if the item acquired is in the intermediate list or shopping list
local items = Cauldron:GetItemDeltas(bagid);
+ local recalc = false;
for item, itemCount in pairs(items) do
if itemCount > 0 then
+ -- adjust shopping list
+ CauldronShopping:RemoveFromList(self.db.realm.shopping, self.vars.playername, item, itemCount);
+
+ -- adjust intermediate list
local queue = self.db.realm.userdata[self.vars.playername].queue;
local intItem = CauldronQueue:GetIntermediateItem(queue, item);
- if intItem then
+ if intItem and (not recalc) then
-- the item is found in the intermediate list, so recalculate the queue
CauldronQueue:CalculateAllRequiredItems(queue);
Cauldron:UpdateQueue();
-
- return;
+
+ recalc = true;
+-- return;
end
end
end
@@ -663,7 +671,10 @@ function Cauldron:GetQueue(player)
return queue;
end
-function Cauldron:AddItemToShoppingList(itemName, amount)
+function Cauldron:AddItemToShoppingList(itemName, amount, replace)
+ if replace then
+ CauldronShopping:RemoveFromList(self.db.realm.shopping, self.vars.playername, itemName);
+ end
CauldronShopping:AddToList(self.db.realm.shopping, self.vars.playername, itemName, amount);
Cauldron:ShowShoppingList();
end
diff --git a/CauldronMain.xml b/CauldronMain.xml
index 6fb5708..bfa0cbc 100644
--- a/CauldronMain.xml
+++ b/CauldronMain.xml
@@ -107,7 +107,7 @@
-- self.hasItem = 1;
</OnLoad>
<OnClick>
- HandleModifiedItemClick(GetTradeSkillItemLink(self.skillIndex));
+ HandleModifiedItemClick(self.itemLink);
Cauldron:SkillItem_OnClick(self, button, down);
</OnClick>
<OnEnter>
@@ -145,7 +145,7 @@
</OnClick>
</Scripts>
</Button>
- <CheckButton name="$parentFavoriteButton" hidden="false" inherits="UICheckButtonTemplate">
+ <CheckButton name="$parentFavoriteButton" hidden="false" inherits="UICheckButtonTemplate" text="">
<Size x="20" y="22"/>
<Anchors>
<Anchor point="TOPRIGHT">
@@ -155,7 +155,7 @@
<Scripts>
<OnLoad>
self:SetScale(0.625);
- getglobal(self:GetName()):SetText(Cauldron:LocaleString("Favorite?"));
+ self:SetText(Cauldron:LocaleString("Favorite?"));
</OnLoad>
<OnEnter>
GameTooltip:SetOwner(self, "ANCHOR_RIGHT");
@@ -266,6 +266,9 @@
</Frame>
</Frames>
<Scripts>
+ <OnClick>
+ HandleModifiedItemClick(GetTradeSkillRecipeLink(self.skillIndex));
+ </OnClick>
<OnEnter>
Cauldron:SkillItem_OnEnter(self);
</OnEnter>
@@ -400,6 +403,7 @@
GameTooltip:SetOwner(self, "ANCHOR_RIGHT");
GameTooltip:ClearLines();
GameTooltip:AddLine(Cauldron:LocaleString("Add this item to the shopping list"));
+ GameTooltip:AddLine(Cauldron:LocaleString("Shift-click will replace the count in the shopping list with this amount"));
GameTooltip:Show();
CursorUpdate(self);
</OnEnter>
@@ -410,7 +414,7 @@
ResetCursor();
</OnLeave>
<OnClick>
- Cauldron:AddItemToShoppingList(self:GetParent().itemName, self:GetParent().needAmount);
+ Cauldron:AddItemToShoppingList(self:GetParent().itemName, self:GetParent().needAmount, IsShiftKeyDown());
Cauldron:UpdateShoppingList();
</OnClick>
</Scripts>
@@ -770,10 +774,10 @@
end
</OnEditFocusLost>
<OnEditFocusGained>
- self:HighlightText();
if self:GetText() == SEARCH then
self:SetText("");
end
+ self:HighlightText();
</OnEditFocusGained>
</Scripts>
<FontString inherits="ChatFontSmall"/>
diff --git a/CauldronMainUI.lua b/CauldronMainUI.lua
index 368d9c8..d480b7f 100644
--- a/CauldronMainUI.lua
+++ b/CauldronMainUI.lua
@@ -315,6 +315,7 @@ function Cauldron:UpdateSkillList()
-- set the icon
frame = _G["CauldronSkillItem"..i.."SkillIcon"];
frame:SetNormalTexture(skillInfo.icon);
+ frame.itemLink = skillInfo.link;
frame.skillIndex = skillInfo.index;
-- set the craft count
@@ -1104,6 +1105,24 @@ function Cauldron:FilterDropDown_Initialize(level)
UIDropDownMenu_SetText(CauldronFiltersFilterDropDown, L["Filters"]);
+ -- reset item
+ local resetFilters = {
+ text = L["Reset filters"],
+ checked = false,
+ tooltipTitle = L["Reset filters"],
+ tooltipText = L["Reset all filters on the skills list"],
+ func = function(arg1, arg2) Cauldron:FilterDropDown_Reset(arg1) end,
+ arg1 = "",
+ arg2 = "",
+ };
+ UIDropDownMenu_AddButton(resetFilters);
+
+ -- spacer
+ UIDropDownMenu_AddButton({
+ text = "",
+ notClickable = true,
+ });
+
-- sorting
local sortingTitle = {
@@ -1342,6 +1361,31 @@ function Cauldron:FilterDropDown_Initialize(level)
--@end-alpha@
end
+function Cauldron:FilterDropDown_Reset()
+
+ -- sorting
+ Cauldron.db.realm.userdata[Cauldron.vars.playername].skills[CURRENT_TRADESKILL].window.filter.sortDefault = true;
+ Cauldron.db.realm.userdata[Cauldron.vars.playername].skills[CURRENT_TRADESKILL].window.filter.sortAlpha = false;
+ Cauldron.db.realm.userdata[Cauldron.vars.playername].skills[CURRENT_TRADESKILL].window.filter.sortDifficulty = false;
+ Cauldron.db.realm.userdata[Cauldron.vars.playername].skills[CURRENT_TRADESKILL].window.filter.sortBenefit = false;
+
+ -- difficulty
+ Cauldron.db.realm.userdata[Cauldron.vars.playername].skills[CURRENT_TRADESKILL].window.filter.optimal = true;
+ Cauldron.db.realm.userdata[Cauldron.vars.playername].skills[CURRENT_TRADESKILL].window.filter.medium = true;
+ Cauldron.db.realm.userdata[Cauldron.vars.playername].skills[CURRENT_TRADESKILL].window.filter.easy = true;
+ Cauldron.db.realm.userdata[Cauldron.vars.playername].skills[CURRENT_TRADESKILL].window.filter.trivial = true;
+
+ -- favorites
+ Cauldron.db.realm.userdata[Cauldron.vars.playername].skills[CURRENT_TRADESKILL].window.filter.favorites = false;
+ Cauldron.db.realm.userdata[Cauldron.vars.playername].skills[CURRENT_TRADESKILL].window.filter.favoritesAtTop = false;
+
+ -- availability
+ Cauldron.db.realm.userdata[Cauldron.vars.playername].skills[CURRENT_TRADESKILL].window.filter.haveAllReagents = false;
+ Cauldron.db.realm.userdata[Cauldron.vars.playername].skills[CURRENT_TRADESKILL].window.filter.haveKeyReagents = false;
+ Cauldron.db.realm.userdata[Cauldron.vars.playername].skills[CURRENT_TRADESKILL].window.filter.haveAnyReagents = false;
+
+end
+
function Cauldron:FilterDropDown_SetSort(info)
--@alpha@
self:debug("FilterDropDown_SetSort enter");
diff --git a/CauldronShoppingList.lua b/CauldronShoppingList.lua
index 50299c8..153c79d 100644
--- a/CauldronShoppingList.lua
+++ b/CauldronShoppingList.lua
@@ -27,7 +27,7 @@ function CauldronShopping:AddToList(list, requestor, itemName, quantity)
-- sanity checks
if (not list) and (not requestor) and (not itemName) then
- -- TODO: display error
+ Cauldron:error("No shopping list available!");
return;
end
@@ -49,7 +49,7 @@ end
function CauldronShopping:RemoveFromList(list, requestor, itemName, quantity)
-- sanity checks
if not list then
- -- TODO: display error
+ Cauldron:error("No shopping list available!");
return;
end
@@ -73,7 +73,7 @@ end
function CauldronShopping:GetRequestors(list)
if not list then
- -- TODO: display error
+ Cauldron:error("No shopping list available!");
return;
end
diff --git a/Locale/Cauldron-enUS.lua b/Locale/Cauldron-enUS.lua
index 37e15cf..e54feee 100644
--- a/Locale/Cauldron-enUS.lua
+++ b/Locale/Cauldron-enUS.lua
@@ -50,6 +50,8 @@ L["By difficulty"] = true
L["By benefit"] = true
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["Filters"] = true
L["Difficulty"] = true
L["Optimal"] = true
@@ -98,6 +100,7 @@ L["Shift-click to move to the top of the queue"] = true
L["Decrease the priority of this item"] = true
L["Shift-click to move to the bottom of the queue"] = true
L["Add this item to the shopping list"] = true
+L["Shift-click will replace the count in the shopping list with this amount"] = true
L["Decrease the amount of this item"] = true
L["Remove this item from the shopping list"] = true