diff --git a/CauldronData.lua b/CauldronData.lua
index b963a9b..8144471 100644
--- a/CauldronData.lua
+++ b/CauldronData.lua
@@ -76,3 +76,9 @@ Cauldron.vars.vendoritems = {
39501, -- heavy parchment
39502, -- resilient parchment
};
+
+-- map of items that may result from a particular crafted item, e.g., perfect gem cuts,
+-- minor inscription research, alchemy discovery, etc.
+Cauldron.vars.results = {
+};
+
diff --git a/CauldronMain.lua b/CauldronMain.lua
index 4d416f3..a9529f7 100644
--- a/CauldronMain.lua
+++ b/CauldronMain.lua
@@ -76,6 +76,15 @@ function Cauldron:OnInitialize()
type = 'execute',
func = function() self:DisplayVersion() end,
},
+ logging = {
+ name = L["Logging"],
+ desc = L["Sets the logging level"],
+ type = 'select',
+ values = {
+ ['normal'] = function() Cauldron:SetLogLevel(Cauldron.logLevels.INFO); end,
+ ['debug'] = function() Cauldron:SetLogLevel(Cauldron.logLevels.DEBUG); end,
+ },
+ },
reset = {
name = L["Reset"],
desc = L["Resets Cauldron to a fresh state"],
@@ -158,6 +167,7 @@ function Cauldron:OnEnable()
-- scan bags
self:ScanBags();
+ -- register for events we're interested in
self:RegisterEvent("TRADE_SKILL_SHOW", "OnTradeShow");
self:RegisterEvent("TRADE_SKILL_UPDATE", "OnSkillUpdate");
self:RegisterEvent("TRADE_SKILL_CLOSE", "OnTradeClose");
@@ -183,6 +193,7 @@ function Cauldron:OnEnable()
-- self:RegisterEvent("PLAYER_LOGOUT");
self:RegisterEvent("UI_ERROR_MESSAGE", "OnError");
+ -- setup hooks for tooltips
self:HookTooltips();
--@alpha@
@@ -320,6 +331,9 @@ function Cauldron:OnTradeSkillRecast()
self:debug("OnTradeSkillRecast enter");
--@end-alpha@
+ -- keep the processing flag set
+ self.processing = true;
+
self:UpdateSkills();
CauldronAmountInputBox:SetNumber(GetTradeskillRepeatCount());
@@ -332,14 +346,10 @@ function Cauldron:OnTradeSkillRecast()
end
function Cauldron:OnBagUpdate(event, bagid)
---@alpha@
+ --@alpha@
self:debug("OnBagUpdate enter");
---@end-alpha@
+ --@end-alpha@
--- if (not CauldronFrame) and (not CauldronFrame:IsShown()) then
--- return;
--- end
-
-- make sure we're not reacting to initial bag update events when the DB isn't initialized yet
if (not Cauldron.db) or (not Cauldron.vars) then
return;
@@ -349,20 +359,20 @@ function Cauldron:OnBagUpdate(event, bagid)
local items = Cauldron:GetItemDeltas(bagid);
local recalc = false;
for item, itemCount in pairs(items) do
---@alpha@
+ --@alpha@
self:debug("OnBagUpdate: item="..tostring(item).."; itemCount="..itemCount);
---@end-alpha@
+ --@end-alpha@
if itemCount > 0 then
-- adjust shopping list
---@alpha@
+ --@alpha@
self:debug("OnBagUpdate: adjust shopping list");
---@end-alpha@
+ --@end-alpha@
-- CauldronShopping:RemoveFromList(self.db.realm.shopping, self.vars.playername, item, itemCount);
-- adjust intermediate list
---@alpha@
- self:debug("OnBagUpdate: adjust intermediate list");
---@end-alpha@
+ --@alpha@
+ self:debug("OnBagUpdate: adjust intermediate list");
+ --@end-alpha@
local queue = self.db.realm.userdata[self.vars.playername].queue;
local intItem = CauldronQueue:GetIntermediateItem(queue, item);
if intItem and (not recalc) then
@@ -378,19 +388,19 @@ function Cauldron:OnBagUpdate(event, bagid)
-- check if we were making something, and then update the queue
if self.makingItem then
---@alpha@
+ --@alpha@
self:debug("OnBagUpdate: self.makingItem="..self.makingItem);
---@end-alpha@
+ --@end-alpha@
local count = GetItemCount(self.makingItem);
---@alpha@
+ --@alpha@
self:debug("OnBagUpdate: count="..count);
self:debug("OnBagUpdate: self.itemCurrentCount="..self.itemCurrentCount);
---@end-alpha@
+ --@end-alpha@
if count ~= self.itemCurrentCount then
local delta = self.itemCurrentCount - count; -- TODO: is this necessary?
---@alpha@
+ --@alpha@
self:debug("OnBagUpdate: delta="..delta);
---@end-alpha@
+ --@end-alpha@
CauldronQueue:AdjustItemCount(Cauldron:GetQueue(), self.queueInfo.name, -1);
self.itemCurrentCount = count;
end
@@ -403,9 +413,9 @@ function Cauldron:OnBagUpdate(event, bagid)
self:Frame_Update();
Cauldron:UpdateShoppingList();
---@alpha@
+ --@alpha@
self:debug("OnBagUpdate exit");
---@end-alpha@
+ --@end-alpha@
end
function Cauldron:OnCraftShow()
diff --git a/CauldronMainUI.lua b/CauldronMainUI.lua
index b495dfd..d9854aa 100644
--- a/CauldronMainUI.lua
+++ b/CauldronMainUI.lua
@@ -6,101 +6,98 @@ local L = LibStub("AceLocale-3.0"):GetLocale("Cauldron")
-- CauldronUI = LibStub("AceAddon-3.0"):NewAddon("CauldronUI", "AceEvent-3.0", "AceConsole-3.0", "LibDebugLog-1.0")
function Cauldron:Frame_Show()
---@alpha@
+ --@alpha@
self:debug("Frame_Show enter");
---@end-alpha@
+ --@end-alpha@
if Cauldron.vars.enabled and not(IsShiftKeyDown() and IsControlKeyDown()) then
---@alpha@
+ --@alpha@
self:debug("Frame_Show: close dropdown menus");
---@end-alpha@
+ --@end-alpha@
CloseDropDownMenus();
--- self:UpdateFramePosition();
--- self:UpdateFrameStrata();
-
---@alpha@
+ --@alpha@
self:debug("Frame_Show: show our frame");
---@end-alpha@
+ --@end-alpha@
ShowUIPanel(CauldronFrame);
if TradeSkillFrame then
---@alpha@
+ --@alpha@
self:debug("Frame_Show: hide the original tradeskill frame");
---@end-alpha@
+ --@end-alpha@
-- hide the original tradeskill frame
+ Cauldron.vars.origFrameStrata = TradeSkillFrame:GetFrameStrata();
+ Cauldron.vars.origFrameLevel = TradeSkillFrame:GetFrameLevel();
+
TradeSkillFrame:SetAlpha(0);
TradeSkillFrame:ClearAllPoints();
TradeSkillFrame:SetPoint("TOPLEFT", 0, 900);
--- CauldronFrame:SetPoint("TOPLEFT", TradeSkillFrame, "TOPLEFT", 0, 0);
+ TradeSkillFrame:SetFrameStrata("BACKGROUND");
+ TradeSkillFrame:SetFrameLevel(1);
end
self:RegisterMessage("Cauldron_Update", "OnCauldronUpdate");
---@alpha@
+ --@alpha@
self:debug("Frame_Show: call Frame_Update()");
---@end-alpha@
+ --@end-alpha@
self:Frame_Update();
end
---@alpha@
+ --@alpha@
self:debug("Frame_Show exit");
---@end-alpha@
+ --@end-alpha@
end
function Cauldron:Frame_Hide()
---@alpha@
+ --@alpha@
self:debug("Frame_Hide enter");
---@end-alpha@
+ --@end-alpha@
self:UnregisterEvent("Cauldron_Update")
HideUIPanel(CauldronFrame);
if TradeSkillFrame then
TradeSkillFrame:SetAlpha(1.0);
+ TradeSkillFrame:SetFrameStrata(Cauldron.vars.origFrameStrata);
+ TradeSkillFrame:SetFrameLevel(Cauldron.vars.origFrameLevel);
end
---@alpha@
+ --@alpha@
self:debug("Frame_Hide exit");
---@end-alpha@
+ --@end-alpha@
end
function Cauldron:Frame_Toggle()
---@alpha@
+ --@alpha@
self:debug("Frame_Toggle enter");
---@end-alpha@
+ --@end-alpha@
if CauldronFrame:IsVisible() then
---@alpha@
+ --@alpha@
self:debug("Frame_Toggle: call Frame_Hide()");
---@end-alpha@
+ --@end-alpha@
Cauldron:Frame_Hide();
else
---@alpha@
+ --@alpha@
self:debug("Frame_Toggle: call Frame_Show()");
---@end-alpha@
+ --@end-alpha@
Cauldron:Frame_Show();
end
---@alpha@
+ --@alpha@
self:debug("Frame_Toggle exit");
---@end-alpha@
+ --@end-alpha@
end
function Cauldron:Frame_Update()
---@alpha@
+ --@alpha@
self:debug("Frame_Update enter");
---@end-alpha@
+ --@end-alpha@
local numTradeSkills = GetNumTradeSkills();
---@alpha@
- self:debug("Frame_Update numTradeSkills: ",numTradeSkills);
---@end-alpha@
local name, rank, maxRank = GetTradeSkillLine();
---@alpha@
- self:debug("Frame_Update name: ",name,"; rank: ",rank,"; maxRank: ",maxRank);
---@end-alpha@
if name == "UNKNOWN" then
return;
@@ -109,9 +106,9 @@ function Cauldron:Frame_Update()
Cauldron:UpdateSkills();
if CURRENT_TRADESKILL ~= name then
---@alpha@
+ --@alpha@
self:debug("Frame_Update: current skill changed");
---@end-alpha@
+ --@end-alpha@
StopTradeSkillRepeat();
@@ -126,56 +123,51 @@ function Cauldron:Frame_Update()
CURRENT_TRADESKILL = name;
end
- -- update the frame dimensions
- -- <Size x="692" y="465" />
--- CauldronFrame:SetHeight(465);
--- CauldronFrame:SetWidth(692);
-
-- display skill name, level/progress
---@alpha@
+ --@alpha@
self:debug("Frame_Update: display skill level/progress");
---@end-alpha@
+ --@end-alpha@
self:UpdateSkillInfo(name, rank, maxRank);
-- update search text box
---@alpha@
+ --@alpha@
self:debug("Frame_Update: display search text");
---@end-alpha@
+ --@end-alpha@
self:UpdateSearchText();
-- TODO: update dropdowns
---@alpha@
+ --@alpha@
self:debug("Frame_Update: update dropdowns");
---@end-alpha@
+ --@end-alpha@
self:UpdateFilterDropDowns();
-- display list of matching skills
---@alpha@
+ --@alpha@
self:debug("Frame_Update: display list of skills");
---@end-alpha@
+ --@end-alpha@
self:UpdateSkillList();
-- display queue
---@alpha@
+ --@alpha@
self:debug("Frame_Update: display queue");
---@end-alpha@
+ --@end-alpha@
self:UpdateQueue();
-- update buttons
---@alpha@
+ --@alpha@
self:debug("Frame_Update: update buttons");
---@end-alpha@
+ --@end-alpha@
self:UpdateButtons();
---@alpha@
+ --@alpha@
self:debug("Frame_Update exit");
---@end-alpha@
+ --@end-alpha@
end
function Cauldron:UpdateSkillInfo(skillName, rank, maxRank)
---@alpha@
+ --@alpha@
self:debug("UpdateSkillInfo enter");
---@end-alpha@
+ --@end-alpha@
CauldronRankFrameSkillName:SetText(skillName);
diff --git a/CauldronShoppingList.lua b/CauldronShoppingList.lua
index f07ad49..41ac79e 100644
--- a/CauldronShoppingList.lua
+++ b/CauldronShoppingList.lua
@@ -199,6 +199,21 @@ function CauldronShopping:BuyItem(item, merchInfo, amount)
local purchases = 1;
if amount > 1 then
+ --[[
+i="Arcane Powder"
+o=40-GetItemCount(i)
+b=o
+_,_,_,_,_,_,_,s=GetItemInfo(i)
+for c=1,GetMerchantNumItems() do
+n,_,_,q=GetMerchantItemInfo(c)
+if n==i then
+for r=1,ceil((o/s)/q) do
+BuyMerchantItem(c,b>=s and s/q or ceil(b/q))
+b=b-s
+end
+end
+end
+ --]]
end
local total = purchases * merchInfo.quantity;
diff --git a/CauldronUtil.lua b/CauldronUtil.lua
index 007b003..754a94d 100644
--- a/CauldronUtil.lua
+++ b/CauldronUtil.lua
@@ -193,9 +193,10 @@ function Cauldron:GetMerchantItems()
for i=1,GetMerchantNumItems() do
local name, _, price, quantity, avail, _, extCost = GetMerchantItemInfo(i);
+ Cauldron:info("MERCHANT: item="..name.."; price="..tostring(price).."; quantity="..tostring(quantity).."; avail="..tostring(avail).."; extCost="..tostring(extCost));
local maxStack = GetMerchantItemMaxStack(i);
- if avail > 0 then
+ if avail ~= 0 then
items[name] = {
['index'] = i,
['price'] = price,
diff --git a/Locale/Cauldron-enUS.lua b/Locale/Cauldron-enUS.lua
index 77f1468..05d66da 100644
--- a/Locale/Cauldron-enUS.lua
+++ b/Locale/Cauldron-enUS.lua
@@ -24,6 +24,8 @@ L["Enable Cauldron"] = true
L["Use Cauldron as your tradeskill interface"] = true
L["Disable Cauldron"] = true
L["Use the standard Blizzard window as your tradeskill interface"] = true
+L["Logging"] = true
+L["Sets the logging level"] = 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