diff --git a/Cauldron.toc b/Cauldron.toc index cdb44d7..07bd220 100755 --- a/Cauldron.toc +++ b/Cauldron.toc @@ -1,6 +1,6 @@ ## Interface: 30100 ## Title: Cauldron |cff7fff7f -Ace3-|r -## Version: 1.0.0.rc1.@project-revision@ +## Version: 1.0.0.rc2.@project-revision@ ## Author: Caendra of Silver Hand ## Notes: An improved interface for your trade skills ## RequiredDeps: diff --git a/CauldronMain.lua b/CauldronMain.lua index 675a047..51aaf5f 100644 --- a/CauldronMain.lua +++ b/CauldronMain.lua @@ -4,7 +4,7 @@ Cauldron = LibStub("AceAddon-3.0"):NewAddon("Cauldron", "AceEvent-3.0", "AceTimer-3.0", "AceConsole-3.0", "AceHook-3.0", "LibLogger-1.0"); local L = LibStub("AceLocale-3.0"):GetLocale("Cauldron"); -Cauldron.version = "1.0.0.rc1.@project-revision@"; +Cauldron.version = "1.0.0.rc2.@project-revision@"; Cauldron.date = string.sub("$Date$", 8, 17); -- key binding names diff --git a/CauldronQueue.lua b/CauldronQueue.lua index ede9aab..9f8054c 100644 --- a/CauldronQueue.lua +++ b/CauldronQueue.lua @@ -268,14 +268,17 @@ function CauldronQueue:AddIntermediate(queue, reagent, amount) -- it's there, so increase the amount item.amount = item.amount + amount; else - local skillInfo = Cauldron:GetSkillInfoForItem(reagent.name); - -- it's not there, so create a new instance if reagent.name then - queue.intermediate[reagent.name] = CauldronQueue:NewItem(reagent.name, reagent.icon, amount, nil, skillInfo.tradeskill, reagent.link); + local skillInfo = Cauldron:GetSkillInfoForItem(reagent.name); + if skillInfo then + queue.intermediate[reagent.name] = CauldronQueue:NewItem(reagent.name, reagent.icon, amount, nil, skillInfo.tradeskill, reagent.link); + else + Cauldron:error("AddIntermediate: no skill info found for reagent: "..reagent.name); + end else -- this shouldn't occur unless there's something wrong with the reagent info, but if it does, the user can report this error - Cauldron:error("AddIntermediate: reagent.name is nil!"); + Cauldron:error("AddIntermediate: reagent.name is nil! Please report this. (skillIndex: "..reagent.skillIndex..", index: "..reagent.index..")"); end end diff --git a/CauldronTradeskill.lua b/CauldronTradeskill.lua index b43056e..396acee 100644 --- a/CauldronTradeskill.lua +++ b/CauldronTradeskill.lua @@ -65,36 +65,9 @@ function Cauldron:UpdateSkills() SetTradeSkillItemLevelFilter(0, 0); - local category --[[ = self.skillCategory; - self:info("category="..tostring(category)); - if not category then - self:info("initialize category"); - category --]] = ""; - --[[ - end - - local first = self.skillStart; - self:info("first="..tostring(first)); - if not first then - self:info("initialize first to 1"); - first = 1; - end - local last = self.skillEnd; - self:info("last="..tostring(last)); - local total = GetNumTradeSkills(); - self:info("total="..tostring(total)); - local increment = 25; - self:info("increment="..tostring(increment)); - if not last then - self:info("initialize last value"); - last = math.min(increment, total); - self:info("last="..tostring(last)); - end - --]] + local category = ""; --- self:info("iterate over skills"); for i=1,GetNumTradeSkills() do --- for i=first,last do -- self:info("i="..tostring(i)); local name, difficulty, avail, expanded, verb = GetTradeSkillInfo(i); -- self:debug("UpdateSkills: name="..name.."; difficulty="..difficulty.."; avail="..avail); @@ -171,11 +144,9 @@ function Cauldron:UpdateSkills() -- populate the slot list Cauldron:debug("slot: "..tostring(slot)); if slot and (slot ~= "") then --- if not skillDB.window.slots[slot] then skillDB.window.slots[slot] = { checked = true, }; --- end else -- special slot representing items that don't have a slot skillDB.window.slots.none = { @@ -186,14 +157,18 @@ function Cauldron:UpdateSkills() -- populate the reagent list for j=1,GetTradeSkillNumReagents(i) do local rName, rIcon, rCount, _ = GetTradeSkillReagentInfo(i, j); +-- Cauldron:info("UpdateSkills: i="..i..", j="..j..", rName="..tostring(rName)..", rIcon="..tostring(rIcon)..", rCount="..tostring(rCount)); local rLink = GetTradeSkillReagentItemLink(i, j); +-- Cauldron:info("UpdateSkills: rLink="..tostring(rLink)); local rItemId = Cauldron:GetIdFromLink(rLink); --- local value, set = self.libs.PT:ItemInSet(rItemId, "Tradeskill.Mat.BySource.Vendor"); +-- Cauldron:info("UpdateSkills: rItemId="..tostring(rItemId)); local key = not Cauldron:IsVendorItem(rItemId); --- if value then --- key = false; --- end +-- Cauldron:info("UpdateSkills: key="..tostring(key)); + if (not rName) or (not rIcon) or (not rLink) then + Cauldron:error("Can't get name/icon/link for reagent! (skill: "..name..", reagentIndex: "..j..")"); + end + local r = { ["index"] = j, ["name"] = rName, @@ -207,7 +182,9 @@ function Cauldron:UpdateSkills() table.insert(skillDB.recipes[name].reagents, r); if rName then +-- Cauldron:info("adding to keywords: "..tostring(keywords)); keywords = keywords..","..rName; +-- Cauldron:info("keywords="..tostring(keywords)); end end @@ -227,28 +204,6 @@ function Cauldron:UpdateSkills() end end - --[[ - -- increment the counters - self:info("increment counters"); - first = first + increment; - self:info("first="..tostring(first)); - last = last + increment; - self:info("last="..tostring(last)); - -- check if we need to queue the next batch - if first < total then - self:info("first < total"); - -- update the counter storage variables - self.skillStart = first; - self.skillEnd = last; - self.skillCategory = category; - - -- set the timer - self:info("schedule timer for next run"); - self:ScheduleTimer(self.UpdateSkills,1,self); --- self:UpdateSkillList(); - end - --]] - self:debug("UpdateSkills exit"); end @@ -517,6 +472,11 @@ end function Cauldron:GetSkillInfoForItem(item) + if not item then + Cauldron:error("GetSkillInfoForItem: item is nil!"); + return nil; + end + for tradeskill, list in pairs(self.db.realm.userdata[self.vars.playername].skills) do -- skip linked skills if not (string.find(tradeskill, "Linked-")) then @@ -534,6 +494,11 @@ end function Cauldron:GetSkillInfoByIndex(itemIndex) + if not itemIndex then + Cauldron:error("GetSkillInfoByIndex: itemIndex is nil!"); + return nil; + end + for tradeskill, list in pairs(self.db.realm.userdata[self.vars.playername].skills) do -- skip linked skills if not (string.find(tradeskill, "Linked-")) then