diff --git a/Artwork/Cauldron-Main-BottomLeft.tga b/Artwork/Cauldron-Main-BottomLeft.tga deleted file mode 100644 index e186b35..0000000 Binary files a/Artwork/Cauldron-Main-BottomLeft.tga and /dev/null differ diff --git a/Artwork/Cauldron-Main-BottomMiddle.tga b/Artwork/Cauldron-Main-BottomMiddle.tga deleted file mode 100644 index 47d3d6e..0000000 Binary files a/Artwork/Cauldron-Main-BottomMiddle.tga and /dev/null differ diff --git a/Artwork/Cauldron-Main-BottomRight.tga b/Artwork/Cauldron-Main-BottomRight.tga deleted file mode 100644 index ee8538d..0000000 Binary files a/Artwork/Cauldron-Main-BottomRight.tga and /dev/null differ diff --git a/Artwork/Cauldron-Main-TopLeft.tga b/Artwork/Cauldron-Main-TopLeft.tga deleted file mode 100644 index dbfdc5e..0000000 Binary files a/Artwork/Cauldron-Main-TopLeft.tga and /dev/null differ diff --git a/Artwork/Cauldron-Main-TopMiddle.tga b/Artwork/Cauldron-Main-TopMiddle.tga deleted file mode 100644 index a3d03f6..0000000 Binary files a/Artwork/Cauldron-Main-TopMiddle.tga and /dev/null differ diff --git a/Artwork/Cauldron-Main-TopRight.tga b/Artwork/Cauldron-Main-TopRight.tga deleted file mode 100644 index 9a56932..0000000 Binary files a/Artwork/Cauldron-Main-TopRight.tga and /dev/null differ diff --git a/Artwork/Cauldron-QueueFrame.tga b/Artwork/Cauldron-QueueFrame.tga deleted file mode 100644 index edcef6e..0000000 Binary files a/Artwork/Cauldron-QueueFrame.tga and /dev/null differ diff --git a/CauldronMain.lua b/CauldronMain.lua index 54d6334..6a700d1 100644 --- a/CauldronMain.lua +++ b/CauldronMain.lua @@ -299,7 +299,7 @@ function Cauldron:OnEnable() self:RegisterEvent("BAG_UPDATE", "OnBagUpdate"); -- self:RegisterEvent("TRAINER_CLOSED"); -- self:RegisterEvent("PLAYER_REGEN_DISABLED"); --- self:RegisterEvent("PLAYER_REGEN_ENABLED"); +-- self:RegisterEvent("PLAYER_REGEN_ENABLED", "PlayerRegenEnabled"); -- self:RegisterEvent("AUCTION_HOUSE_CLOSED"); -- self:RegisterEvent("AUCTION_HOUSE_SHOW"); self:RegisterEvent("CRAFT_SHOW", "OnCraftShow"); @@ -381,6 +381,7 @@ function Cauldron:OnTradeShow() -- show the UI frame self:debug("OnTradeShow: show the UI"); +-- Cauldron.needsRedraw = true; self:Frame_Show(); self:debug("OnTradeShow exit"); @@ -433,6 +434,7 @@ function Cauldron:OnSkillUpdate() CauldronQueue:CalculateAllRequiredItems(Cauldron.db.realm.userdata[Cauldron.vars.playername].queue); end + Cauldron.needsRedraw = true; self:Frame_Update(); end @@ -446,6 +448,7 @@ function Cauldron:OnTradeSkillRecast() -- CauldronAmountInputBox:SetNumber(GetTradeskillRepeatCount()); + Cauldron.needsRedraw = true; self:Frame_Update(); end @@ -962,6 +965,22 @@ function Cauldron:IncreaseItemCount(name) CauldronQueue:AdjustItemCount(Cauldron:GetQueue(), name, 1); end +function Cauldron:FirstPage() + + local skillName = CURRENT_TRADESKILL; + if skillName == "UNKNOWN" then + return; + end + if IsTradeSkillLinked() then + skillName = "Linked-"..skillName; + end + if IsTradeSkillGuild() then + skillName = "Guild-"..skillName; + end + + self.db.realm.userdata[self.vars.playername].skills[skillName].window.offset = 0; +end + function Cauldron:PrevPage() local skillName = CURRENT_TRADESKILL; @@ -997,7 +1016,8 @@ function Cauldron:NextPage() end local offset = self.db.realm.userdata[self.vars.playername].skills[skillName].window.offset; - local numSkills = self.db.realm.userdata[self.vars.playername].skills[skillName].skillCount or 0; + local numSkills = table.getn(Cauldron:GetSkillList(self.vars.playername, skillName)); +-- local numSkills = self.db.realm.userdata[self.vars.playername].skills[skillName].skillCount or 0; if not offset then self.db.realm.userdata[self.vars.playername].skills[skillName].window.offset = CAULDRON_SKILL_LIST_MAX; else @@ -1007,6 +1027,23 @@ function Cauldron:NextPage() end end +function Cauldron:LastPage() + + local skillName = CURRENT_TRADESKILL; + if skillName == "UNKNOWN" then + return; + end + if IsTradeSkillLinked() then + skillName = "Linked-"..skillName; + end + if IsTradeSkillGuild() then + skillName = "Guild-"..skillName; + end + + local numSkills = table.getn(Cauldron:GetSkillList(self.vars.playername, skillName)); + self.db.realm.userdata[self.vars.playername].skills[skillName].window.offset = math.floor(numSkills / CAULDRON_SKILL_LIST_MAX) * CAULDRON_SKILL_LIST_MAX; +end + function Cauldron:GetQueue(player) if not player then @@ -1052,6 +1089,22 @@ function Cauldron:UpdateShoppingListFromQueue() end end +function Cauldron:SetWindowOffset(offset) + + local skillName = CURRENT_TRADESKILL; + if skillName == "UNKNOWN" then + return; + end + if IsTradeSkillLinked() then + skillName = "Linked-"..skillName; + end + if IsTradeSkillGuild() then + skillName = "Guild-"..skillName; + end + + Cauldron.db.realm.userdata[Cauldron.vars.playername].skills[skillName].window.offset = offset; +end + function Cauldron:LocaleString(str) return L[str]; end diff --git a/CauldronMain.xml b/CauldronMain.xml index f0a1aef..7fc6701 100755 --- a/CauldronMain.xml +++ b/CauldronMain.xml @@ -660,7 +660,10 @@ CloseDropDownMenus(); --]] Cauldron:FilterDropDown_Reset(); + Cauldron:SetWindowOffset(0); + Cauldron:UpdateSkillList(); Cauldron:UpdateStatus(); + Cauldron:UpdatePageInfo(); </OnClick> </Scripts> </Button> @@ -881,7 +884,11 @@ <Scripts> <OnClick> PlaySound("igMainMenuOptionCheckBoxOn"); - Cauldron:PrevPage(); + if IsShiftKeyDown() then + Cauldron:FirstPage(); + else + Cauldron:PrevPage(); + end Cauldron:UpdateSkillList(); Cauldron:UpdatePageInfo(); </OnClick> @@ -911,7 +918,11 @@ <Scripts> <OnClick> PlaySound("igMainMenuOptionCheckBoxOn"); - Cauldron:NextPage(); + if IsShiftKeyDown() then + Cauldron:LastPage(); + else + Cauldron:NextPage(); + end Cauldron:UpdateSkillList(); Cauldron:UpdatePageInfo(); </OnClick> diff --git a/CauldronMainUI.lua b/CauldronMainUI.lua index 0e74d1a..e0cadc0 100644 --- a/CauldronMainUI.lua +++ b/CauldronMainUI.lua @@ -63,6 +63,7 @@ self:debug("frame show: "..tostring(CauldronQueueWindowFrame)); self:RegisterMessage("Cauldron_Update", "OnCauldronUpdate"); + Cauldron.needsRedraw = true; self:Frame_Update(); else -- show the Blizzard frame @@ -100,6 +101,7 @@ function Cauldron:Frame_Toggle() end function CauldronFrame_Update() + Cauldron.needsRedraw = true; Cauldron:Frame_Update(); end @@ -300,7 +302,7 @@ function Cauldron:UpdateSkillList() Cauldron.updatingSkillList = true; -local startTime = GetTime(); + local startTime = GetTime(); local offset = self.db.realm.userdata[self.vars.playername].skills[skillName].window.offset or 0; local lastFrameIndex = 0; @@ -629,8 +631,8 @@ local startTime = GetTime(); -- j = j + 1; end -local endTime = GetTime(); --- Cauldron:info("draw skill list: "..tostring(endTime-startTime).."ms"); + local endTime = GetTime(); + Cauldron:info("draw skill list: "..tostring(endTime-startTime).."ms"); Cauldron.updatingSkillList = false; @@ -729,10 +731,16 @@ function Cauldron:UpdatePageInfo() local offset = self.db.realm.userdata[self.vars.playername].skills[skillName].window.offset or 0; local firstIndex = 1 + offset; - local numSkills = self.db.realm.userdata[self.vars.playername].skills[skillName].skillCount or 0; + local numSkills = table.getn(Cauldron:GetSkillList(self.vars.playername, skillName)); +-- local numSkills = self.db.realm.userdata[self.vars.playername].skills[skillName].skillCount or 0; local lastIndex = math.min(50 + offset, numSkills); - local pageInfo = string.format(L["Showing %1$d - %2$d of %3$d items."], firstIndex, lastIndex, numSkills); + local pageInfo = ""; + if numSkills > 0 then + pageInfo = string.format(L["Showing %1$d - %2$d of %3$d items."], firstIndex, lastIndex, numSkills); + else + pageInfo = L["No items."]; + end CauldronPageInfoText:SetText(pageInfo); -- enable/disable navigation buttons @@ -825,8 +833,10 @@ function CauldronFilterDropDown_Initialize(self, level) -- tooltipText = L["Display only favorite skills"], favorites.func = function() 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.db.realm.userdata[Cauldron.vars.playername].skills[skillName].window.offset = 0; Cauldron:UpdateSkillList(); Cauldron:UpdateStatus(); + Cauldron:UpdatePageInfo(); end; -- arg1 = "favorite", -- arg2 = "", @@ -842,8 +852,10 @@ function CauldronFilterDropDown_Initialize(self, level) -- tooltipText = L["Display only skills for achievements"], achievements.func = function() Cauldron.db.realm.userdata[Cauldron.vars.playername].skills[skillName].window.filter.achievements = not Cauldron.db.realm.userdata[Cauldron.vars.playername].skills[skillName].window.filter.achievements; + Cauldron.db.realm.userdata[Cauldron.vars.playername].skills[skillName].window.offset = 0; Cauldron:UpdateSkillList(); Cauldron:UpdateStatus(); + Cauldron:UpdatePageInfo(); end; -- arg1 = "achievement", -- arg2 = "", @@ -927,7 +939,10 @@ function CauldronFilterDropDown_Initialize(self, level) difficultyOptimal.tooltipText = L["Set whether items of this difficulty level should be shown"]; difficultyOptimal.func = function(arg1, arg2) Cauldron:FilterDropDown_ToggleDifficulty(arg1); + Cauldron.db.realm.userdata[Cauldron.vars.playername].skills[skillName].window.offset = 0; + Cauldron:UpdateSkillList(); Cauldron:UpdateStatus(); + Cauldron:UpdatePageInfo(); end; difficultyOptimal.arg1 = "optimal"; difficultyOptimal.arg2 = ""; @@ -946,7 +961,10 @@ function CauldronFilterDropDown_Initialize(self, level) difficultyMedium.tooltipText = L["Set whether items of this difficulty level should be shown"]; difficultyMedium.func = function(arg1, arg2) Cauldron:FilterDropDown_ToggleDifficulty(arg1); + Cauldron.db.realm.userdata[Cauldron.vars.playername].skills[skillName].window.offset = 0; + Cauldron:UpdateSkillList(); Cauldron:UpdateStatus(); + Cauldron:UpdatePageInfo(); end; difficultyMedium.arg1 = "medium"; difficultyMedium.arg2 = ""; @@ -965,7 +983,10 @@ function CauldronFilterDropDown_Initialize(self, level) difficultyEasy.tooltipText = L["Set whether items of this difficulty level should be shown"]; difficultyEasy.func = function(arg1, arg2) Cauldron:FilterDropDown_ToggleDifficulty(arg1); + Cauldron.db.realm.userdata[Cauldron.vars.playername].skills[skillName].window.offset = 0; + Cauldron:UpdateSkillList(); Cauldron:UpdateStatus(); + Cauldron:UpdatePageInfo(); end; difficultyEasy.arg1 = "easy"; difficultyEasy.arg2 = ""; @@ -984,7 +1005,10 @@ function CauldronFilterDropDown_Initialize(self, level) difficultyTrivial.tooltipText = L["Set whether items of this difficulty level should be shown"]; difficultyTrivial.func = function(arg1, arg2) Cauldron:FilterDropDown_ToggleDifficulty(arg1); + Cauldron.db.realm.userdata[Cauldron.vars.playername].skills[skillName].window.offset = 0; + Cauldron:UpdateSkillList(); Cauldron:UpdateStatus(); + Cauldron:UpdatePageInfo(); end; difficultyTrivial.arg1 = "trivial"; difficultyTrivial.arg2 = ""; @@ -1022,8 +1046,11 @@ function CauldronFilterDropDown_Initialize(self, level) normal.tooltipTitle = L["Reagents"]; normal.tooltipText = L["Display the normal list of skills"]; normal.func = function(arg1, arg2) - Cauldron:FilterDropDown_SetReagentFilter(arg1) + Cauldron:FilterDropDown_SetReagentFilter(arg1); + Cauldron.db.realm.userdata[Cauldron.vars.playername].skills[skillName].window.offset = 0; + Cauldron:UpdateSkillList(); Cauldron:UpdateStatus(); + Cauldron:UpdatePageInfo(); end; normal.arg1 = "normal"; normal.arg2 = ""; @@ -1040,7 +1067,10 @@ function CauldronFilterDropDown_Initialize(self, level) haveAllReagents.tooltipText = L["Set whether skills for which you have all the required reagents are shown in the list"]; haveAllReagents.func = function(arg1, arg2) Cauldron:FilterDropDown_SetReagentFilter(arg1); + Cauldron.db.realm.userdata[Cauldron.vars.playername].skills[skillName].window.offset = 0; + Cauldron:UpdateSkillList(); Cauldron:UpdateStatus(); + Cauldron:UpdatePageInfo(); end; haveAllReagents.arg1 = "all"; haveAllReagents.arg2 = ""; @@ -1055,7 +1085,10 @@ function CauldronFilterDropDown_Initialize(self, level) haveKeyReagents.tooltipText = L["Set whether skills for which you have all key reagents (non-vendor available) are shown in the list"]; haveKeyReagents.func = function(arg1, arg2) Cauldron:FilterDropDown_SetReagentFilter(arg1); + Cauldron.db.realm.userdata[Cauldron.vars.playername].skills[skillName].window.offset = 0; + Cauldron:UpdateSkillList(); Cauldron:UpdateStatus(); + Cauldron:UpdatePageInfo(); end; haveKeyReagents.arg1 = "key"; haveKeyReagents.arg2 = ""; @@ -1070,7 +1103,10 @@ function CauldronFilterDropDown_Initialize(self, level) haveAnyReagents.tooltipText = L["Set whether skills for which you have any reagents are shown in the list"]; haveAnyReagents.func = function(arg1, arg2) Cauldron:FilterDropDown_SetReagentFilter(arg1); + Cauldron.db.realm.userdata[Cauldron.vars.playername].skills[skillName].window.offset = 0; + Cauldron:UpdateSkillList(); Cauldron:UpdateStatus(); + Cauldron:UpdatePageInfo(); end; haveAnyReagents.arg1 = "any"; haveAnyReagents.arg2 = ""; @@ -1096,7 +1132,10 @@ function CauldronFilterDropDown_Initialize(self, level) resetFilters.tooltipText = L["Reset all filters on the skills list"]; resetFilters.func = function(arg1, arg2) Cauldron:FilterDropDown_Reset(); + Cauldron.db.realm.userdata[Cauldron.vars.playername].skills[skillName].window.offset = 0; + Cauldron:UpdateSkillList(); Cauldron:UpdateStatus(); + Cauldron:UpdatePageInfo(); end; UIDropDownMenu_AddButton(resetFilters, level); @@ -1116,7 +1155,10 @@ function CauldronFilterDropDown_Initialize(self, level) info.func = function() Cauldron:FilterDropDown_SetSlot(slots[i]); -- TradeSkillSetFilter(0, i, "", slots[i]); - Cauldron:UpdateSkillList(); + Cauldron.db.realm.userdata[Cauldron.vars.playername].skills[skillName].window.offset = 0; + Cauldron:UpdateSkillList(); + Cauldron:UpdateStatus(); + Cauldron:UpdatePageInfo(); end; info.notCheckable = false; info.checked = slotInfo.checked; @@ -1130,7 +1172,10 @@ function CauldronFilterDropDown_Initialize(self, level) info.text = L["All"]; info.func = function() Cauldron:FilterDropDown_SetSubclass("all", ""); - Cauldron:UpdateSkillList(); + Cauldron.db.realm.userdata[Cauldron.vars.playername].skills[skillName].window.offset = 0; + Cauldron:UpdateSkillList(); + Cauldron:UpdateStatus(); + Cauldron:UpdatePageInfo(); end; info.notCheckable = true; info.hasArrow = false; @@ -1143,7 +1188,10 @@ function CauldronFilterDropDown_Initialize(self, level) info.text = L["None"]; info.func = function() Cauldron:FilterDropDown_SetSubclass("none", ""); - Cauldron:UpdateSkillList(); + Cauldron.db.realm.userdata[Cauldron.vars.playername].skills[skillName].window.offset = 0; + Cauldron:UpdateSkillList(); + Cauldron:UpdateStatus(); + Cauldron:UpdatePageInfo(); end; info.notCheckable = true; info.hasArrow = false; @@ -1161,7 +1209,10 @@ function CauldronFilterDropDown_Initialize(self, level) info.func = function() Cauldron:FilterDropDown_SetSubclass(subClasses[i], ""); -- TradeSkillSetFilter(i, 0, subClasses[i], ""); - Cauldron:UpdateSkillList(); + Cauldron.db.realm.userdata[Cauldron.vars.playername].skills[skillName].window.offset = 0; + Cauldron:UpdateSkillList(); + Cauldron:UpdateStatus(); + Cauldron:UpdatePageInfo(); end subslots = { GetTradeSkillSubClassFilteredSlots(i) }; if #subslots > 1 then @@ -1197,7 +1248,10 @@ function CauldronFilterDropDown_Initialize(self, level) --[[ TradeSkillSetFilter(UIDROPDOWNMENU_MENU_VALUE, i, subClasses[UIDROPDOWNMENU_MENU_VALUE], subslots[i]); --]] - Cauldron:UpdateSkillList(); + Cauldron.db.realm.userdata[Cauldron.vars.playername].skills[skillName].window.offset = 0; + Cauldron:UpdateSkillList(); + Cauldron:UpdateStatus(); + Cauldron:UpdatePageInfo(); end; local catInfo = Cauldron.db.realm.userdata[Cauldron.vars.playername].skills[skillName].window.categories[subClasses[UIDROPDOWNMENU_MENU_VALUE]..";"..subslots[i]]; if not catInfo then @@ -1792,9 +1846,6 @@ function Cauldron:FilterDropDown_Reset() Cauldron.db.realm.userdata[Cauldron.vars.playername].skills[skillName].window.filter.haveKeyReagents = false; Cauldron.db.realm.userdata[Cauldron.vars.playername].skills[skillName].window.filter.haveAnyReagents = false; - -- update the UI - Cauldron:UpdateSkillList(); - end function Cauldron:FilterDropDown_SetSort(sort) @@ -1868,10 +1919,6 @@ function Cauldron:FilterDropDown_SetSort(sort) filter.sortBenefit = false; end - -- update the UI - Cauldron:UpdateSkillList(); - Cauldron:UpdateStatus(); - end function Cauldron:FilterDropDown_SetSlot(slot) @@ -2098,9 +2145,6 @@ function Cauldron:FilterDropDown_ToggleDifficulty(info) Cauldron.db.realm.userdata[Cauldron.vars.playername].skills[skillName].window.filter[info.arg1] = not Cauldron.db.realm.userdata[Cauldron.vars.playername].skills[CURRENT_TRADESKILL].window.filter[info.arg1]; - -- update the UI - Cauldron:UpdateSkillList(); - end --[====[ diff --git a/CauldronTradeskill.lua b/CauldronTradeskill.lua index 89981e1..8ed1c25 100644 --- a/CauldronTradeskill.lua +++ b/CauldronTradeskill.lua @@ -87,7 +87,7 @@ function Cauldron:UpdateSkills(firstIndex, lastIndex) -- Cauldron:info("scanningSkills="..tostring(self.scanningSkills)); if not Cauldron.scanningSkills then -local startTime = GetTime(); + local startTime = GetTime(); Cauldron.scanningSkills = true; Cauldron:Print("Scanning recipes..."); -- TODO: remove @@ -214,14 +214,6 @@ local startTime = GetTime(); r.skillIndex = i; end else - if rescan then - -- local msg = string.format(L["Rescanning recipe: %1$s..."], name); - -- Cauldron:Print(msg); - - -- remove it from the list (we're optimistic!) - skillDB.rescan.failedRecipes[name] = nil; - end - -- add the recipe info and other miscellaneous info local itemLink = GetTradeSkillItemLink(i); local recipeLink = GetTradeSkillRecipeLink(i); @@ -229,123 +221,154 @@ local startTime = GetTime(); local keywords = name; - -- fill in the db entry - skillDB.recipes[name] = { - ['index'] = i, - ['name'] = name, - ['description'] = GetTradeSkillDescription(i), - ['itemLink'] = itemLink, - ['recipeLink'] = recipeLink, - ['icon'] = GetTradeSkillIcon(i), - ['tradeskill'] = baseSkillName, - ['difficulty'] = difficulty, - ['available'] = avail, - ['minMade'] = minMade, - ['maxMade'] = maxMade, - ['numSkillUps'] = numSkillUps, - - -- filter information - ['slot'] = _G[slot], - ['defaultCategory'] = category, - ['type'] = itemType, - ['subtype'] = itemSubType, - - ['reagents'] = {}, - }; - - -- set the action verb for this skill - skillDB.recipes[name].verb = verb; - - -- make sure the skill window info is initialized - if not skillDB.window.skills[name] then - skillDB.window.skills[name] = { - ['expanded'] = false, - ['favorite'] = false, + if rescan then + -- local msg = string.format(L["Rescanning recipe: %1$s..."], name); + -- Cauldron:Print(msg); + + -- populate the reagent list + local num = GetTradeSkillNumReagents(i); + for j=1,num do + local rName, rIcon, rCount, _ = GetTradeSkillReagentInfo(i, j); + local rLink = GetTradeSkillReagentItemLink(i, j); + local rItemId = Cauldron:GetIdFromLink(rLink); + local key = not Cauldron:IsVendorItem(rItemId); + + if not skillDB.recipes[name].reagents[j].name then + if (not rName) or (not rIcon) or (not rLink) then +-- Cauldron:MarkRecipeForRescan(skillDB, name); +-- rescanCount = rescanCount + 1; + else + local r = { + ["index"] = j, + ["name"] = rName, + ["numRequired"] = rCount, + ["skillIndex"] = i, + ["icon"] = rIcon, + ["link"] = rLink, + ["key"] = key, + }; + + -- remove it from the list + skillDB.rescan.failedRecipes[name] = nil; + + skillDB.recipes[name].reagents[j] = r; + + if not self.db.realm.userdata[self.vars.playername].reagentMap[rName] then + self.db.realm.userdata[self.vars.playername].reagentMap[rName] = {}; + end + table.insert(self.db.realm.userdata[self.vars.playername].reagentMap[rName], skillName..";"..recipeLink); + + skillDB.recipes[name].keywords = skillDB.recipes[name].keywords..","..rName; + end + end + end + else + -- fill in the db entry + skillDB.recipes[name] = { + ['index'] = i, + ['name'] = name, + ['description'] = GetTradeSkillDescription(i), + ['itemLink'] = itemLink, + ['recipeLink'] = recipeLink, + ['icon'] = GetTradeSkillIcon(i), + ['tradeskill'] = baseSkillName, + ['difficulty'] = difficulty, + ['available'] = avail, + ['minMade'] = minMade, + ['maxMade'] = maxMade, + ['numSkillUps'] = numSkillUps, + ['verb'] = verb, + + -- filter information + ['slot'] = _G[slot], + ['defaultCategory'] = category, + ['type'] = itemType, + ['subtype'] = itemSubType, + + ['reagents'] = {}, }; - end - -- make sure the category for the window is initialized - if category ~= "" then - if not skillDB.window.categories[category] then - skillDB.window.categories[category] = { - ['shown'] = true, - ['expanded'] = true, + -- set the action verb for this skill + -- skillDB.recipes[name].verb = verb; + + -- make sure the skill window info is initialized + if not skillDB.window.skills[name] then + skillDB.window.skills[name] = { + ['expanded'] = false, + ['favorite'] = false, }; end - end - - -- populate the slot list - Cauldron:debug("slot: "..tostring(slot)); - if slot and (slot ~= "") then - skillDB.window.slots[slot] = { - checked = true, - }; - else - -- special slot representing items that don't have a slot - skillDB.window.slots.none = { - checked = true, - }; - end - - -- populate the reagent list - local num = GetTradeSkillNumReagents(i); - for j=1,num do - local rName, rIcon, rCount, _ = GetTradeSkillReagentInfo(i, j); - local rLink = GetTradeSkillReagentItemLink(i, j); - local rItemId = Cauldron:GetIdFromLink(rLink); - local key = not Cauldron:IsVendorItem(rItemId); - - if (not rName) or (not rIcon) or (not rLink) then - rescanNotify = true; - - -- store the info if it's not already from rescanning - if not rescan then - -- Cauldron:error("Failed to retrieve reagent info; marking recipe for rescan: "..name); - Cauldron:MarkRecipeForRescan(skillDB, name); - rescanCount = rescanCount + 1; - end - --[[ - Cauldron:debug("First attempt to get reagent info failed. Trying again. (skill: "..name..", reagentIndex: "..j..", name: "..tostring(rName)..", icon: "..tostring(rIcon)..", link: "..tostring(rLink)..")"); - -- be persisent about getting the info - rName, rIcon, _, _ = GetTradeSkillReagentInfo(i, j); - rLink = GetTradeSkillReagentItemLink(i, j); - ]] + -- make sure the category for the window is initialized + if category ~= "" then + if not skillDB.window.categories[category] then + skillDB.window.categories[category] = { + ['shown'] = true, + ['expanded'] = true, + }; + end end - - --[[ - if (not rName) or (not rIcon) or (not rLink) then - -- be persisent about getting the info - Cauldron:error("Can't get name/icon/link for reagent! (skill: "..name..", reagentIndex: "..j..", name: "..tostring(rName)..", icon: "..tostring(rIcon)..", link: "..tostring(rLink)..")"); + + --[[ + -- populate the slot list + Cauldron:debug("slot: "..tostring(slot)); + if slot and (slot ~= "") then + skillDB.window.slots[slot] = { + checked = true, + }; + else + -- special slot representing items that don't have a slot + skillDB.window.slots.none = { + checked = true, + }; end --]] - - local r = { - ["index"] = j, - ["name"] = rName, - ["numRequired"] = rCount, - ["skillIndex"] = i, - ["icon"] = rIcon, - ["link"] = rLink, - ["key"] = key, - }; - - table.insert(skillDB.recipes[name].reagents, r); - -- add the reagent to the reagent map - - if rName then - if not self.db.realm.userdata[self.vars.playername].reagentMap[rName] then - self.db.realm.userdata[self.vars.playername].reagentMap[rName] = {}; + -- populate the reagent list + local num = GetTradeSkillNumReagents(i); + for j=1,num do + local rName, rIcon, rCount, _ = GetTradeSkillReagentInfo(i, j); + local rLink = GetTradeSkillReagentItemLink(i, j); + local rItemId = Cauldron:GetIdFromLink(rLink); + local key = not Cauldron:IsVendorItem(rItemId); + + if (not rName) or (not rIcon) or (not rLink) then + rescanNotify = true; + + -- store the info if it's not already from rescanning + if not rescan then + -- Cauldron:error("Failed to retrieve reagent info; marking recipe for rescan: "..name); + Cauldron:MarkRecipeForRescan(skillDB, name); + rescanCount = rescanCount + 1; + end + end + + local r = { + ["index"] = j, + ["name"] = rName, + ["numRequired"] = rCount, + ["skillIndex"] = i, + ["icon"] = rIcon, + ["link"] = rLink, + ["key"] = key, + }; + + table.insert(skillDB.recipes[name].reagents, r); + + -- add the reagent to the reagent map + if rName then + if not self.db.realm.userdata[self.vars.playername].reagentMap[rName] then + self.db.realm.userdata[self.vars.playername].reagentMap[rName] = {}; + end + table.insert(self.db.realm.userdata[self.vars.playername].reagentMap[rName], skillName..";"..recipeLink); + + keywords = keywords..","..rName; end - table.insert(self.db.realm.userdata[self.vars.playername].reagentMap[rName], skillName..";"..recipeLink); - - keywords = keywords..","..rName; end + + -- fill in the keywords db entry + skillDB.recipes[name].keywords = keywords; end - - -- fill in the keywords db entry - skillDB.recipes[name].keywords = keywords; end else -- save the header name @@ -364,8 +387,8 @@ local startTime = GetTime(); Cauldron.scanningSkills = false; -local endTime = GetTime(); --- Cauldron:info("scan time: "..tostring(endTime-startTime).."ms"); + local endTime = GetTime(); + Cauldron:info("scan time: "..tostring(endTime-startTime).."ms"); if rescanCount > 0 then Cauldron:Print(rescanCount.." recipes marked for rescan."); @@ -495,7 +518,7 @@ function Cauldron:GetSkillList(playername, skillName) local skills = {}; -local startTime = GetTime(); + local startTime = GetTime(); for name, recipe in pairs(self.db.realm.userdata[playername].skills[skillName].recipes) do self:debug("GetSkillList: name="..name); @@ -631,10 +654,10 @@ local startTime = GetTime(); end end -local endTime = GetTime(); --- Cauldron:info("get skill list: "..tostring(endTime-startTime).."ms"); + local endTime = GetTime(); + Cauldron:info("get skill list: "..tostring(endTime-startTime).."ms"); -startTime = GetTime(); + startTime = GetTime(); -- sort the list table.sort(skills, function(r1, r2) @@ -720,8 +743,8 @@ startTime = GetTime(); return true; end); -local endTime = GetTime(); --- Cauldron:info("sort skill list: "..tostring(endTime-startTime).."ms"); + endTime = GetTime(); + Cauldron:info("sort skill list: "..tostring(endTime-startTime).."ms"); --@alpha@ self:debug("GetSkillList exit"); diff --git a/Locale/Cauldron-enUS.lua b/Locale/Cauldron-enUS.lua index 291b000..f6cec19 100644 --- a/Locale/Cauldron-enUS.lua +++ b/Locale/Cauldron-enUS.lua @@ -167,6 +167,7 @@ L["Needed for %1$d skills for leveling"] = true L["Needed for leveling:"] = true L["Showing %1$d - %2$d of %3$d items."] = true +L["No items."] = true L["Click to increase crafted amount"] = true L["Shift-click to decrease crafted amount"] = true