Mercurial > wow > inventory
changeset 106:d3fbb5676a5e
Added tooltips to the item refill window headers.
Now color coding the availibility of items at the item refill window.
Added a hide help text option (which is off by default).
Renamed all premade groups to a new naming pattern; ?Profession - Category - Detail?, e.g. ?Inscription - Glyphs by class - Death Knight?. To continue getting notified about updates to a selected premade group, you must re-add them.
Repositioned elements of the item refill frame to fit better.
No longer using colorsargs to remember the index of a queued move, but instead providing a reference to the move itself in the new ?rowData? property of each row.
Added tooltips to the headers of the sort table.
Merged missing and available columns together (showing available / missing) and sorting on available now sorts on percentage of how many of the missing items are available.
Moving and available columns are now aligned to the right.
Added an ?extra? config group which contains the additional (but completely optional) settings. Moved color codes adjustments, forget character, auto refill skip confirm and hide help info options to this group.
author | Zerotorescue |
---|---|
date | Wed, 12 Jan 2011 19:58:39 +0100 |
parents | 4efbaf069ddb |
children | aa675033abdc |
files | Core.lua Data/PremadeGroups.lua Frames.lua Modules/Config.lua Modules/Scanner.lua Modules/Summary.lua |
diffstat | 6 files changed, 289 insertions(+), 246 deletions(-) [+] |
line wrap: on
line diff
--- a/Core.lua Wed Jan 12 14:15:50 2011 +0100 +++ b/Core.lua Wed Jan 12 19:58:39 2011 +0100 @@ -10,7 +10,7 @@ --@end-non-debug@]===] local _G = _G; -local print, pairs, tonumber = _G.print, _G.pairs, _G.tonumber; +local sformat, print, pairs, tonumber = _G.string.format, _G.print, _G.pairs, _G.tonumber; -- All modules must be able to retrieve our supported addons database, thus keep it a part of the addon object rather than local addon.supportedAddons = {}; @@ -42,6 +42,7 @@ bonusQueue = 0.1, priceThreshold = 0, summaryHidePriceThreshold = false, + hideHelp = false, trackAtCharacters = { }, localItemData = { @@ -325,6 +326,32 @@ +function addon:ColorCode(num, required) + local percentage = ( num / required ); + + if percentage >= addon.db.profile.defaults.colors.green then + return sformat("|cff00ff00%d|r", num); + elseif percentage >= addon.db.profile.defaults.colors.yellow then + return sformat("|cffffff00%d|r", num); + elseif percentage >= addon.db.profile.defaults.colors.orange then + return sformat("|cffff9933%d|r", num); + elseif percentage >= addon.db.profile.defaults.colors.red then + return sformat("|cffff0000%d|r", num); + else + return num; + end +end + +function addon:DisplayItemCount(value, minimumStock) + if value == -1 then + return "|cffffff00Unknown|r"; + elseif value == -3 then + return "|cffffff00Unknown|r"; + else + return sformat("%s / %d", self:ColorCode(value, minimumStock), minimumStock); + end +end + -- Readable money local goldText = "%s%d|cffffd700g|r "; @@ -336,19 +363,19 @@ local gold = floor( copper / COPPER_PER_GOLD ); if gold > 0 then - text = goldText:format(text, gold); + text = sformat(goldText, text, gold); end if not clean or (not gold or gold < 10) then local silver = floor( ( copper % COPPER_PER_GOLD ) / COPPER_PER_SILVER ); if silver > 0 then - text = silverText:format(text, silver); + text = sformat(silverText, text, silver); end if not clean or (not gold or gold < 1) then local copper = floor( copper % COPPER_PER_SILVER ); if copper > 0 or text == "" then - text = copperText:format(text, copper); + text = sformat(copperText, text, copper); end end end @@ -467,6 +494,6 @@ end if self.debugChannel then - self.debugChannel:AddMessage(t:format(...)); + self.debugChannel:AddMessage(sformat(t, ...)); end end
--- a/Data/PremadeGroups.lua Wed Jan 12 14:15:50 2011 +0100 +++ b/Data/PremadeGroups.lua Wed Jan 12 19:58:39 2011 +0100 @@ -17,7 +17,7 @@ addon.defaultGroups = { -- Glyphs by class -- Source: http://www.wowhead.com/items=16.6?filter=cr=87;crs=12;crv=0 - ["Glyphs (Death Knight)"] = { + ["Inscription - Glyphs by class - Death Knight"] = { version = 1, items = { [43533] = 1, -- Glyph of Anti-Magic Shell @@ -51,7 +51,7 @@ [45806] = 1, -- Glyph of Howling Blast }, }, - ["Glyphs (Druid)"] = { + ["Inscription - Glyphs by class - Druid"] = { version = 1, items = { [45604] = 1, -- Glyph of Savage Roar @@ -96,7 +96,7 @@ [67487] = 1, -- Glyph of Tiger's Fury }, }, - ["Glyphs (Hunter)"] = { + ["Inscription - Glyphs by class - Hunter"] = { version = 1, items = { [42904] = 1, -- Glyph of Disengage @@ -132,7 +132,7 @@ [45735] = 1, -- Glyph of Raptor Strike }, }, - ["Glyphs (Mage)"] = { + ["Inscription - Glyphs by class - Mage"] = { version = 1, items = { [45739] = 1, -- Glyph of Mirror Image @@ -170,7 +170,7 @@ [44955] = 1, -- Glyph of Arcane Blast }, }, - ["Glyphs (Paladin)"] = { + ["Inscription - Glyphs by class - Paladin"] = { version = 1, items = { [41102] = 1, -- Glyph of Turn Evil @@ -210,7 +210,7 @@ [66918] = 1, -- Glyph of the Long Word }, }, - ["Glyphs (Priest)"] = { + ["Inscription - Glyphs by class - Priest"] = { version = 1, items = { [42404] = 1, -- Glyph of Mass Dispel @@ -248,7 +248,7 @@ [45758] = 1, -- Glyph of Divine Accuracy }, }, - ["Glyphs (Rogue)"] = { + ["Inscription - Glyphs by class - Rogue"] = { version = 1, items = { [45766] = 1, -- Glyph of Fan of Knives @@ -289,7 +289,7 @@ [63420] = 1, -- Glyph of Vanish }, }, - ["Glyphs (Shaman)"] = { + ["Inscription - Glyphs by class - Shaman"] = { version = 1, items = { [45777] = 1, -- Glyph of Hex @@ -329,7 +329,7 @@ [45775] = 1, -- Glyph of Earth Shield }, }, - ["Glyphs (Warlock)"] = { + ["Inscription - Glyphs by class - Warlock"] = { version = 1, items = { [45782] = 1, -- Glyph of Demonic Circle @@ -368,7 +368,7 @@ [50077] = 1, -- Glyph of Lash of Pain }, }, - ["Glyphs (Warrior)"] = { + ["Inscription - Glyphs by class - Warrior"] = { version = 1, items = { [63481] = 1, -- Glyph of Colossus Smash @@ -412,13 +412,13 @@ -- Glyphs by inks -- Exported with a PHP script - ["Glyphs (Blackfallow Ink)"] = { + ["Inscription - Glyphs by ink - Blackfallow Ink"] = { version = 1, items = { [63481] = 1, -- Glyph of Colossus Smash }, }, - ["Glyphs (Midnight Ink)"] = { + ["Inscription - Glyphs by ink - Midnight Ink"] = { version = 1, items = { [43418] = 1, -- Glyph of Heroic Throw @@ -467,7 +467,7 @@ [43361] = 1, -- Glyph of the Penguin }, }, - ["Glyphs (Ink of the Sea)"] = { + ["Inscription - Glyphs by ink - Ink of the Sea"] = { version = 1, items = { [43419] = 1, -- Glyph of Intervene @@ -578,7 +578,7 @@ [42753] = 1, -- Glyph of Cone of Cold }, }, - ["Glyphs (Ethereal Ink)"] = { + ["Inscription - Glyphs by ink - Ethereal Ink"] = { version = 1, items = { [45790] = 1, -- Glyph of Bladestorm @@ -650,7 +650,7 @@ [44955] = 1, -- Glyph of Arcane Blast }, }, - ["Glyphs (Lion's Ink)"] = { + ["Inscription - Glyphs by ink - Lion's Ink"] = { version = 1, items = { [43398] = 1, -- Glyph of Demoralizing Shout @@ -702,7 +702,7 @@ [43360] = 1, -- Glyph of the Monkey }, }, - ["Glyphs (Shimmering Ink)"] = { + ["Inscription - Glyphs by ink - Shimmering Ink"] = { version = 1, items = { [67482] = 1, -- Glyph of Intercept @@ -726,7 +726,7 @@ [45804] = 1, -- Glyph of Death Coil }, }, - ["Glyphs (Jadefire Ink)"] = { + ["Inscription - Glyphs by ink - Jadefire Ink"] = { version = 1, items = { [43424] = 1, -- Glyph of Revenge @@ -764,7 +764,7 @@ [42746] = 1, -- Glyph of Icy Veins }, }, - ["Glyphs (Celestial Ink)"] = { + ["Inscription - Glyphs by ink - Celestial Ink"] = { version = 1, items = { [43414] = 1, -- Glyph of Cleaving @@ -796,7 +796,7 @@ -- Rare gems (Cataclysm) -- Source: http://www.wowhead.com/items=3.0?filter=qu=3;minle=81;maxle=90;cr=87;crs=12;crv=0 - ["Cata Rare Gems (Inferno Ruby)"] = { + ["Jewelcrafting - Cata Rare Gems (Inferno Ruby)"] = { version = 1, items = { [52206] = 1, -- Bold Inferno Ruby @@ -806,7 +806,7 @@ [52230] = 1, -- Precise Inferno Ruby }, }, - ["Cata Rare Gems (Ocean Sapphire)"] = { + ["Jewelcrafting - Cata Rare Gems (Ocean Sapphire)"] = { version = 1, items = { [52235] = 1, -- Rigid Ocean Sapphire @@ -815,7 +815,7 @@ [52246] = 1, -- Stormy Ocean Sapphire }, }, - ["Cata Rare Gems (Amberjewel)"] = { + ["Jewelcrafting - Cata Rare Gems (Amberjewel)"] = { version = 1, items = { [52219] = 1, -- Fractured Amberjewel @@ -825,7 +825,7 @@ [52247] = 1, -- Subtle Amberjewel }, }, - ["Cata Rare Gems (Demonseye)"] = { + ["Jewelcrafting - Cata Rare Gems (Demonseye)"] = { version = 1, items = { [52203] = 1, -- Accurate Demonseye @@ -841,7 +841,7 @@ [52248] = 1, -- Timeless Demonseye }, }, - ["Cata Rare Gems (Dream Emerald)"] = { + ["Jewelcrafting - Cata Rare Gems (Dream Emerald)"] = { version = 1, items = { [52218] = 1, -- Forceful Dream Emerald @@ -856,7 +856,7 @@ [52250] = 1, -- Zen Dream Emerald }, }, - ["Cata Rare Gems (Ember Topaz)"] = { + ["Jewelcrafting - Cata Rare Gems (Ember Topaz)"] = { version = 1, items = { [52204] = 1, -- Adept Ember Topaz @@ -877,7 +877,7 @@ [68358] = 1, -- Resplendent Ember Topaz }, }, - ["Cata Meta Gems (Shadowspirit Diamond)"] = { + ["Jewelcrafting - Cata Meta Gems (Shadowspirit Diamond)"] = { version = 1, items = { [52289] = 1, -- Fleet Shadowspirit Diamond @@ -900,7 +900,7 @@ -- Common gems (Cataclysm) -- Source: http://www.wowhead.com/items=3?filter=na=Nightstone;cr=87;crs=12;crv=0 - ["Cata Common Gems (Nightstone)"] = { + ["Jewelcrafting - Cata Common Gems (Nightstone)"] = { version = 1, items = { [52152] = 1, -- Perfect Accurate Nightstone @@ -927,7 +927,7 @@ [52105] = 1, -- Accurate Nightstone }, }, - ["Cata Common Gems (Hessonite)"] = { + ["Jewelcrafting - Cata Common Gems (Hessonite)"] = { version = 1, items = { [52139] = 1, -- Perfect Keen Hessonite @@ -958,7 +958,7 @@ [52118] = 1, -- Keen Hessonite }, }, - ["Cata Common Gems (Jasper)"] = { + ["Jewelcrafting - Cata Common Gems (Jasper)"] = { version = 1, items = { [52129] = 1, -- Perfect Sensei's Jasper @@ -983,7 +983,7 @@ [52128] = 1, -- Sensei's Jasper }, }, - ["Cata Common Gems (Alicite)"] = { + ["Jewelcrafting - Cata Common Gems (Alicite)"] = { version = 1, items = { [52163] = 1, -- Perfect Fractured Alicite @@ -998,7 +998,7 @@ [52094] = 1, -- Fractured Alicite }, }, - ["Cata Common Gems (Carnelian)"] = { + ["Jewelcrafting - Cata Common Gems (Carnelian)"] = { version = 1, items = { [52172] = 1, -- Perfect Precise Carnelian @@ -1013,7 +1013,7 @@ [52085] = 1, -- Precise Carnelian }, }, - ["Cata Common Gems (Zephyrite)"] = { + ["Jewelcrafting - Cata Common Gems (Zephyrite)"] = { version = 1, items = { [52168] = 1, -- Perfect Rigid Zephyrite @@ -1031,7 +1031,7 @@ -- Epic gems (WotLK) -- Source: http://www.wowhead.com/items=3?filter=na=Ametrine;cr=87;crs=12;crv=0 - ["Epic Gems (Ametrine)"] = { + ["Jewelcrafting - Epic Gems (Ametrine)"] = { version = 1, items = { [40142] = 1, -- Inscribed Ametrine @@ -1052,7 +1052,7 @@ [40163] = 1, -- Resolute Ametrine }, }, - ["Epic Gems (Cardinal Ruby)"] = { + ["Jewelcrafting - Epic Gems (Cardinal Ruby)"] = { version = 1, items = { [40111] = 1, -- Bold Cardinal Ruby @@ -1064,7 +1064,7 @@ [40123] = 1, -- Brilliant Cardinal Ruby }, }, - ["Epic Gems (Dreadstone)"] = { + ["Jewelcrafting - Epic Gems (Dreadstone)"] = { version = 1, items = { [40129] = 1, -- Sovereign Dreadstone @@ -1089,7 +1089,7 @@ [40175] = 1, -- Purified Dreadstone }, }, - ["Epic Gems (Eye of Zul)"] = { + ["Jewelcrafting - Epic Gems (Eye of Zul)"] = { version = 1, items = { [40138] = 1, -- Regal Eye of Zul @@ -1112,7 +1112,7 @@ [40182] = 1, -- Shattered Eye of Zul }, }, - ["Epic Gems (King's Amber)"] = { + ["Jewelcrafting - Epic Gems (King's Amber)"] = { version = 1, items = { [40115] = 1, -- Subtle King's Amber @@ -1123,7 +1123,7 @@ [40128] = 1, -- Quick King's Amber }, }, - ["Epic Gems (Majestic Zircon)"] = { + ["Jewelcrafting - Epic Gems (Majestic Zircon)"] = { version = 1, items = { [40119] = 1, -- Solid Majestic Zircon @@ -1140,7 +1140,7 @@ -- Enchants (WotLK) -- Enchants (Heirlooms) -- Source: manual retrieved from Wowhead - ["Enchants (Heirlooms)"] = { + ["Enchanting - Enchants - Heirlooms"] = { version = 1, items = { [38873] = 1, -- Enchant Weapon - Crusader @@ -1162,7 +1162,7 @@ }, }, -- Source: http://www.wowhead.com/items=0.6?filter=na=enchant;cr=82;crs=1;crv=30300 - ["Enchants (Cataclysm)"] = { + ["Enchanting - Enchants - Cataclysm"] = { version = 2, items = { [52747] = 1, -- Enchant Weapon - Mending
--- a/Frames.lua Wed Jan 12 14:15:50 2011 +0100 +++ b/Frames.lua Wed Jan 12 19:58:39 2011 +0100 @@ -4,6 +4,8 @@ -- If this function is called from a widget, self is the widget and self.frame the actual frame local this = self.frame or self; + if not this.tooltipTitle then return; end + GameTooltip:SetOwner(this, "ANCHOR_NONE"); if this.tooltipLocation and this.tooltipLocation == "BOTTOM" then GameTooltip:SetPoint("TOP", this, "BOTTOM"); @@ -120,7 +122,7 @@ -- Description local lblDescription = frame:CreateFontString(nil, "OVERLAY", "GameFontNormal"); - lblDescription:SetPoint("TOPLEFT", frame, "TOPLEFT", 15, -25); + lblDescription:SetPoint("TOPLEFT", frame, "TOPLEFT", 15, -27); lblDescription:SetWidth(frameWidth - 15 - 15); -- 10 margin left & 10 margin right lblDescription:SetJustifyH("LEFT"); lblDescription:SetJustifyV("TOP"); @@ -138,8 +140,8 @@ btnMove:SetScript("OnClick", onAccept); btnMove:SetScript("OnEnter", ShowTooltip); btnMove:SetScript("OnLeave", HideTooltip); - btnMove.tooltipTitle = "Move Items"; - btnMove.tooltip = "Start moving these items from the bank."; + btnMove.tooltipTitle = (not addon.db.profile.defaults.hideHelp and "Move Items"); + btnMove.tooltip = (not addon.db.profile.defaults.hideHelp and "Start moving these items from the bank."); frame.btnMove = btnMove; @@ -152,29 +154,29 @@ btnCancel:SetScript("OnClick", onCancel); btnCancel:SetScript("OnEnter", ShowTooltip); btnCancel:SetScript("OnLeave", HideTooltip); - btnCancel.tooltipTitle = "Cancel"; - btnCancel.tooltip = "Do not move anything and close the window."; + btnCancel.tooltipTitle = (not addon.db.profile.defaults.hideHelp and "Cancel"); + btnCancel.tooltip = (not addon.db.profile.defaults.hideHelp and "Do not move anything and close the window."); frame.btnCancel = btnCancel; -- Because the scrolling table code-behind will change this element's height, we can't rely on that. Make a dummy frame which we can measure local frmMeasureDummy = CreateFrame("Frame", nil, frame); - frmMeasureDummy:SetPoint("TOP", frame.lblDescription, "BOTTOM", 0, -20); - frmMeasureDummy:SetPoint("LEFT", frame.lblDescription, "LEFT", 15, 0); + frmMeasureDummy:SetPoint("TOP", frame.lblDescription, "BOTTOM", 0, -18); + frmMeasureDummy:SetPoint("LEFT", frame, "LEFT", 15, 0); frmMeasureDummy:SetPoint("BOTTOMRIGHT", frame, "BOTTOMRIGHT", -15, 35); frame.frmMeasureDummy = frmMeasureDummy; -- Scrolling table with a list of items to be moved - local scrollTableWidth = ( frame.frmMeasureDummy:GetWidth() - 20 ); -- adjust width by the scrollbar size + local scrollTableWidth = ( frame.frmMeasureDummy:GetWidth() - 30 ); -- adjust width by the scrollbar size local headers = { { ["name"] = "Item", - ["width"] = (scrollTableWidth * .5), + ["width"] = (scrollTableWidth * .60), ["defaultsort"] = "asc", ["comparesort"] = function(this, aRow, bRow, column) - local aName, _, aRarity = GetItemInfo(this:GetRow(aRow).colorargs[2]); - local bName, _, bRarity = GetItemInfo(this:GetRow(bRow).colorargs[2]); + local aName, _, aRarity = GetItemInfo(this:GetRow(aRow).rowData.id); + local bName, _, bRarity = GetItemInfo(this:GetRow(bRow).rowData.id); local template = "%d%s"; aName = template:format((10 - (aRarity or 10)), (aName or ""):lower()); bName = template:format((10 - (bRarity or 10)), (bName or ""):lower()); @@ -186,55 +188,86 @@ end end, ["sort"] = "asc", -- when the data is set, use this column so sort the default data + ["tooltipTitle"] = (not addon.db.profile.defaults.hideHelp and "Item"), + ["tooltip"] = (not addon.db.profile.defaults.hideHelp and "Click to sort the list by item quality then item name."), }, { ["name"] = "Moving", ["width"] = (scrollTableWidth * .15), + ["align"] = "RIGHT", ["defaultsort"] = "dsc", - }, - { - ["name"] = "Missing", - ["width"] = (scrollTableWidth * .15), - ["defaultsort"] = "dsc", + ["sortnext"] = 1, + ["tooltipTitle"] = (not addon.db.profile.defaults.hideHelp and "Moving"), + ["tooltip"] = (not addon.db.profile.defaults.hideHelp and "Click to sort the list by the amount of movable items."), }, { ["name"] = "Available", - ["width"] = (scrollTableWidth * .2), + ["width"] = (scrollTableWidth * .25), + ["align"] = "RIGHT", ["defaultsort"] = "dsc", + ["sortnext"] = 1, + ["comparesort"] = function(this, aRow, bRow, column) + local aAvailablePercent = (this:GetRow(aRow).rowData.available / this:GetRow(aRow).rowData.missing); + local bAvailablePercent = (this:GetRow(bRow).rowData.available / this:GetRow(bRow).rowData.missing); + + if this.cols[column].sort == "dsc" then + return aAvailablePercent > bAvailablePercent; + else + return aAvailablePercent < bAvailablePercent; + end + end, + ["tooltipTitle"] = (not addon.db.profile.defaults.hideHelp and "Item"), + ["tooltip"] = (not addon.db.profile.defaults.hideHelp and "Click to sort the list by the availibility percentage."), }, }; local ScrollingTable = LibStub("ScrollingTable"); local table = ScrollingTable:CreateST(headers, 3, 15, nil, frame); + -- When moving over a row, provide a tooltip for the item table:RegisterEvents({ ["OnEnter"] = function(rowFrame, cellFrame, data, cols, row, realrow, column, scrollingTable, ...) - if row and realrow and data[realrow] and data[realrow].colorargs and data[realrow].colorargs[2] then - GameTooltip:SetOwner(rowFrame, "ANCHOR_NONE"); - GameTooltip:SetPoint("TOPLEFT", rowFrame, "BOTTOMLEFT"); - GameTooltip:SetHyperlink(("item:%d"):format(data[realrow].colorargs[2])); - GameTooltip:Show(); + if row and realrow then + -- Data row + + if data[realrow] and data[realrow].rowData and data[realrow].rowData.id then + GameTooltip:SetOwner(rowFrame, "ANCHOR_NONE"); + GameTooltip:SetPoint("TOPLEFT", rowFrame, "BOTTOMLEFT"); + GameTooltip:SetHyperlink(("item:%d"):format(data[realrow].rowData.id)); + GameTooltip:Show(); + end + else + -- Header row + + if cols[column].tooltipTitle and type(cols[column].tooltipTitle) == "string" then + cellFrame.tooltipTitle = cols[column].tooltipTitle; + if cols[column].tooltip then + cellFrame.tooltip = cols[column].tooltip; -- Optional + else + cellFrame.tooltip = nil; + end + + ShowTooltip(cellFrame); + end end end, ["OnLeave"] = function(rowFrame, cellFrame, data, cols, row, realrow, column, scrollingTable, ...) - if row and realrow then - HideTooltip(); - end + HideTooltip(); end, }); frame.scrollTable = table; - table.frame:SetPoint("TOP", frame.lblDescription, "BOTTOM", 0, -20); + table.frame:SetPoint("TOP", frame.lblDescription, "BOTTOM", 0, -18); table.frame:SetPoint("LEFT", frame, "LEFT", 15, 0); table.frame:SetPoint("BOTTOMRIGHT", frame, "BOTTOMRIGHT", -15, 35); - -- Change the amount of displayed rows based on the size of the frame - frame.AdjustScrollTableRows = function(this) - local newRows = math.floor(( this.frmMeasureDummy:GetHeight() - 5 ) / 15); - newRows = (newRows < 3 and 3) or newRows; - - this.scrollTable:SetDisplayRows(newRows, 15); - end; - frame:SetScript("OnSizeChanged", frame.AdjustScrollTableRows); + -- Change the amount of displayed rows based on the size of the frame + frame.AdjustScrollTableRows = function(this) + local newRows = math.floor(( this.frmMeasureDummy:GetHeight() - 5 ) / 15); + newRows = (newRows < 3 and 3) or newRows; + + this.scrollTable:SetDisplayRows(newRows, 15); + end; + frame:SetScript("OnSizeChanged", frame.AdjustScrollTableRows); end function addon:SetMoverFrameData(data)
--- a/Modules/Config.lua Wed Jan 12 14:15:50 2011 +0100 +++ b/Modules/Config.lua Wed Jan 12 19:58:39 2011 +0100 @@ -282,7 +282,10 @@ name = function(info) local groupName = groupIdToName[info[2]]; - local t = "Here you can set general settings for the currently selected group. If you do not wish to override a setting, the default setting specified in the general group will be used.\n\n"; + local t = ""; + if not addon.db.profile.defaults.hideHelp then + t = "Here you can set general settings for the currently selected group. If you do not wish to override a setting, the default setting specified in the general group will be used.\n\n"; + end local currentAddon, selectedAddonName = addon:GetItemCountAddon(groupName); local preferedAddon = addon:GetOptionByKey(groupName, "itemCountAddon"); @@ -312,6 +315,7 @@ order = 5, type = "header", name = "", + hidden = function() return addon.db.profile.defaults.hideHelp; end, }, overrideAuctionPricingAddon = { order = 9, @@ -473,11 +477,13 @@ order = 0, type = "description", name = "Here you can specify the minimum amount of items you wish to keep in stock and related settings for the currently selected group. Please note the values entered here do not affect the queued quantities, you must set settings for that in the area below.", + hidden = function() return addon.db.profile.defaults.hideHelp; end, }, header = { order = 5, type = "header", name = "", + hidden = function() return addon.db.profile.defaults.hideHelp; end, }, overrideMinLocalStock = { @@ -631,11 +637,13 @@ return r; end, + hidden = function() return addon.db.profile.defaults.hideHelp; end, }, header = { order = 5, type = "header", name = "", + hidden = function() return addon.db.profile.defaults.hideHelp; end, }, overrideRestockTarget = { order = 9, @@ -860,6 +868,7 @@ order = 10, type = "description", name = "You can add a single item to this group at a time by pasting the item-id or an item-link in the field to the left or you can also import multiple items at once by pasting exported item data in the field to the right. Scroll further down to add items based on your inventory contents.", + hidden = function() return addon.db.profile.defaults.hideHelp; end, }, itemLink = { order = 20, @@ -943,6 +952,7 @@ importPremadeData = { order = 40, type = "select", + width = "double", name = "Import premade data", desc = "Import item data from a premade item-group. Any items already grouped will be skipped.", values = function() @@ -1000,6 +1010,7 @@ order = 10, type = "description", name = "Click the items you wish to add to this group or add multiple of these items at once by providing a name filter in the field below.", + hidden = function() return addon.db.profile.defaults.hideHelp; end, }, massAdd = { order = 20, @@ -1092,13 +1103,14 @@ order = 10, type = "group", inline = true, - name = "Help", + name = "Remove items", hidden = false, args = { help = { order = 10, type = "description", name = "Click the items you wish to remove from this group.", + hidden = function() return addon.db.profile.defaults.hideHelp; end, }, massRemove = { order = 20, @@ -1136,6 +1148,7 @@ premadeGroups = { order = 30, type = "select", + width = "double", name = "Imported premade groups", desc = "This is a list of all premade groups that were imported into this group. You will be notified when any of these premade groups have changed and you will be able to import these changes.\n\nSelect a group to stop reminding you of changes to the premade group (the item list will be unaffected). Doing so will require you to manually update this when new items are added to the game.", values = function(info) @@ -1306,6 +1319,9 @@ options.args.profiles = LibStub("AceDBOptions-3.0"):GetOptionsTable(addon.db, true); options.args.profiles.order = 200; + -- Extra + self:FillExtraOptions(); + -- Groups self:MakeGroupOptions(); @@ -1330,7 +1346,10 @@ order = 0, type = "description", name = function() - local t = "Here you can set general settings. The settings entered here will be used when you choose not to override the settings within an individual group.\n\n"; + local t = ""; + if not addon.db.profile.defaults.hideHelp then + t = "Here you can set general settings. The settings entered here will be used when you choose not to override the settings within an individual group.\n\n"; + end local currentAddon, selectedAddonName = addon:GetItemCountAddon(); local preferedAddon = addon.db.profile.defaults.itemCountAddon; @@ -1452,11 +1471,13 @@ order = 0, type = "description", name = "Here you can specify the default minimum amount of items you wish to keep in stock and related settings. The settings entered here will be used when you choose not to override the settings within an individual group.", + hidden = function() return addon.db.profile.defaults.hideHelp; end, }, header = { order = 5, type = "header", name = "", + hidden = function() return addon.db.profile.defaults.hideHelp; end, }, minLocalStock = { order = 10, @@ -1486,14 +1507,6 @@ get = function() return addon.db.profile.defaults.autoRefill; end, set = function(i, v) addon.db.profile.defaults.autoRefill = v; end, }, - autoRefillSkipConfirm = { - order = 13, - type = "toggle", - name = "Skip confirmation", - desc = "Automatically start moving items from the (guild) bank without showing the confirmation window.\n\n|cfffed000This option can not be overridden.|r", - get = function() return addon.db.profile.defaults.autoRefillSkipConfirm; end, - set = function(i, v) addon.db.profile.defaults.autoRefillSkipConfirm = v; end, - }, minGlobalStock = { order = 20, type = "range", @@ -1566,11 +1579,13 @@ return r; end, + hidden = function() return addon.db.profile.defaults.hideHelp; end, }, header = { order = 5, type = "header", name = "", + hidden = function() return addon.db.profile.defaults.hideHelp; end, }, restockTarget = { order = 10, @@ -1635,92 +1650,46 @@ }, }, }, - colorCodes = { - order = 30, + }, + }; +end + +function mod:FillExtraOptions() + options.args.extra = { + order = 300, + type = "group", + name = "Extra", + desc = "Change additional (but completely optional) settings.", + args = { + misc = { + order = 10, type = "group", inline = true, - name = "Color codes", + name = "Miscellaneous", args = { - description = { - order = 0, - type = "description", - name = "Change the color code thresholds based on the current stock remaining of the required minimum stock.", + hideHelp = { + order = 10, + type = "toggle", + width = "full", + name = "Hide any help tooltips, descriptions and the help config category", + desc = "Hide any optional help tooltips, descriptions and the help config category.\n\nPlease note some tooltips may not disappear until next login.", + get = function() return addon.db.profile.defaults.hideHelp; end, + set = function(i, v) addon.db.profile.defaults.hideHelp = v; end, }, - header = { - order = 5, - type = "header", - name = "", - }, - green = { - order = 10, - type = "range", - min = 0, - max = 1, - step = 0.01, - isPercent = true, - name = "|cff00ff00Green|r", - desc = "Show quantity in green when at least this much of the minimum stock is available.\n\n|cfffed000This option can not be overridden.|r", - get = function() return addon.db.profile.defaults.colors.green; end, - set = function(i, v) addon.db.profile.defaults.colors.green = v; end, - }, - yellow = { + autoRefillSkipConfirm = { order = 20, - type = "range", - min = 0, - max = 1, - step = 0.01, - isPercent = true, - name = "|cffffff00Yellow|r", - desc = "Show quantity in yellow when at least this much of the minimum stock is available.\n\n|cfffed000This option can not be overridden.|r", - get = function() return addon.db.profile.defaults.colors.yellow; end, - set = function(i, v) addon.db.profile.defaults.colors.yellow = v; end, - }, - orange = { - order = 30, - type = "range", - min = 0, - max = 1, - step = 0.01, - isPercent = true, - name = "|cffff9933Orange|r", - desc = "Show quantity in orange when at least this much of the minimum stock is available.\n\n|cfffed000This option can not be overridden.|r", - get = function() return addon.db.profile.defaults.colors.orange; end, - set = function(i, v) addon.db.profile.defaults.colors.orange = v; end, - }, - red = { - order = 40, - type = "range", - min = 0, - max = 1, - step = 0.01, - isPercent = true, - name = "|cffff0000Red|r", - desc = "Show quantity in red when at least this much of the minimum stock is available.\n\n|cfffed000This option can not be overridden.|r", - get = function() return addon.db.profile.defaults.colors.red; end, - set = function(i, v) addon.db.profile.defaults.colors.red = v; end, - }, - }, - }, - extra = { - order = 40, - type = "group", - inline = true, - name = "Extra", - args = { - description = { - order = 0, - type = "description", - name = "Additional optional settings.", - }, - header = { - order = 5, - type = "header", - name = "", + type = "toggle", + width = "full", + name = "Skip the confirmation window for (guild) bank refilling", + desc = "Automatically start moving items from the (guild) bank without showing the confirmation window.", + get = function() return addon.db.profile.defaults.autoRefillSkipConfirm; end, + set = function(i, v) addon.db.profile.defaults.autoRefillSkipConfirm = v; end, }, removeCharacter = { - order = 40, + order = 30, type = "select", - name = "Forget character", + width = "double", + name = "Remove a character from Inventorium's memory", desc = "Select a character to remove all traces of it from Inventorium's memory.\n\nYour current character can not be removed, you must login to a different character to do so.", values = function() local temp = {}; @@ -1750,6 +1719,74 @@ }, }, }, + colorCodes = { + order = 30, + type = "group", + inline = true, + name = "Color codes", + args = { + description = { + order = 0, + type = "description", + name = "Change the color code thresholds based on the current stock remaining of the required minimum stock.", + hidden = function() return addon.db.profile.defaults.hideHelp; end, + }, + header = { + order = 5, + type = "header", + name = "", + hidden = function() return addon.db.profile.defaults.hideHelp; end, + }, + green = { + order = 10, + type = "range", + min = 0, + max = 1, + step = 0.01, + isPercent = true, + name = "|cff00ff00Green|r", + desc = "Show quantity in green when at least this much of the minimum stock is available.", + get = function() return addon.db.profile.defaults.colors.green; end, + set = function(i, v) addon.db.profile.defaults.colors.green = v; end, + }, + yellow = { + order = 20, + type = "range", + min = 0, + max = 1, + step = 0.01, + isPercent = true, + name = "|cffffff00Yellow|r", + desc = "Show quantity in yellow when at least this much of the minimum stock is available.", + get = function() return addon.db.profile.defaults.colors.yellow; end, + set = function(i, v) addon.db.profile.defaults.colors.yellow = v; end, + }, + orange = { + order = 30, + type = "range", + min = 0, + max = 1, + step = 0.01, + isPercent = true, + name = "|cffff9933Orange|r", + desc = "Show quantity in orange when at least this much of the minimum stock is available.", + get = function() return addon.db.profile.defaults.colors.orange; end, + set = function(i, v) addon.db.profile.defaults.colors.orange = v; end, + }, + red = { + order = 40, + type = "range", + min = 0, + max = 1, + step = 0.01, + isPercent = true, + name = "|cffff0000Red|r", + desc = "Show quantity in red when at least this much of the minimum stock is available.", + get = function() return addon.db.profile.defaults.colors.red; end, + set = function(i, v) addon.db.profile.defaults.colors.red = v; end, + }, + }, + }, }, }; end @@ -1758,6 +1795,7 @@ options.args.help = { order = 150, type = "group", + hidden = function() return addon.db.profile.defaults.hideHelp; end, childGroups = "tab", name = "Help", desc = "Useful information for if you're unfamiliar with a part of the addon.",
--- a/Modules/Scanner.lua Wed Jan 12 14:15:50 2011 +0100 +++ b/Modules/Scanner.lua Wed Jan 12 19:58:39 2011 +0100 @@ -172,66 +172,39 @@ if addon.db.profile.defaults.autoRefillSkipConfirm then OnMoveAccept(true); else - local data = {}; - + -- This table is never copied, just referenced. It is the same for every row. local columns = { { - value = function(d, cols, realrow, column, table) - return IdToItemLink(d[realrow].colorargs[2]); + value = function(data, cols, realrow, column, table) + return IdToItemLink(data[realrow].rowData.id); end, }, -- item { - value = function(d, cols, realrow, column, table) - local queue = Mover:GetMoves(); - return queue[d[realrow].colorargs[1]].num; + value = function(data, cols, realrow, column, table) + return data[realrow].rowData.num; end, }, -- moving { - value = function(d, cols, realrow, column, table) - local queue = Mover:GetMoves(); - return queue[d[realrow].colorargs[1]].missing; + value = function(data, cols, realrow, column, table) + return addon:DisplayItemCount(data[realrow].rowData.available, data[realrow].rowData.missing); -- available / missing end, - }, -- missing - { - value = function(d, cols, realrow, column, table) - local queue = Mover:GetMoves(); - return queue[d[realrow].colorargs[1]].available; + color = function(data, cols, realrow, column, table) + return ((data[realrow].rowData.available < data[realrow].rowData.missing) and { r = 1, g = 0, b = 0, a = 1 }) or { r = 1, g = 1, b = 1, a = 1 }; end, - color = function(d, cols, realrow, column, table) - local queue = Mover:GetMoves(); - return ((queue[d[realrow].colorargs[1]].available < queue[d[realrow].colorargs[1]].missing) and { r = 1, g = 0, b = 0, a = 1 }) or { r = 1, g = 1, b = 1, a = 1 }; - end, - }, -- available + }, -- missing / available }; - local queue = Mover:GetMoves(); + -- Store the list with rows in this + local data = {}; for i, move in pairs(Mover:GetMoves()) do - local row = { - ["colorargs"] = { i, queue[i].id }, + table.insert(data, { + ["rowData"] = move, -- this is not a key usually found in a row item and ignored by the library ["cols"] = columns, - }; - - table.insert(data, row); + }); end addon:SetMoverFrameData(data); - - --[[ - StaticPopupDialogs["InventoriumRefill"] = { - text = "There are items that can be refilled from this location, do you wish to proceed?", - button1 = YES, - button2 = NO, - OnAccept = function() - mod:Pause(); - Mover:BeginMove(location, self.Unpause); - end, - timeout = 0, - whileDead = 1, - hideOnEscape = 1, - exclusive = 1, - }; - StaticPopup_Show("InventoriumRefill");]] end end end @@ -258,7 +231,6 @@ mod:UnregisterEvent("BANKFRAME_CLOSED"); - --StaticPopup_Hide("InventoriumRefill"); InventoriumItemMover:Hide(); Mover:ResetQueue(); end @@ -295,7 +267,6 @@ self:CancelTimer(tmrScanGuild, true); -- silent - --StaticPopup_Hide("InventoriumRefill"); InventoriumItemMover:Hide(); Mover:ResetQueue(); end
--- a/Modules/Summary.lua Wed Jan 12 14:15:50 2011 +0100 +++ b/Modules/Summary.lua Wed Jan 12 19:58:39 2011 +0100 @@ -7,7 +7,7 @@ local AceGUI, cacheStart; local _G = _G; -- prevent looking up of the global table -local printf, sgsub, supper, tinsert, pairs, ceil, GetItemInfo = _G.string.format, _G.string.gsub, _G.string.upper, _G.table.insert, _G.pairs, _G.ceil, _G.GetItemInfo; -- prevent looking up of the most used globals all the time +local sformat, sgsub, supper, tinsert, pairs, ceil, GetItemInfo = _G.string.format, _G.string.gsub, _G.string.upper, _G.table.insert, _G.pairs, _G.ceil, _G.GetItemInfo; -- prevent looking up of the most used globals all the time function mod:OnEnable() -- Register the summary specific widget @@ -352,8 +352,8 @@ -- Do a name-compare for items of the same rarity -- Otherwise epics first, then junk - local aName = a.name or printf(unknownItemName, a.id); - local bName = b.name or printf(unknownItemName, b.id); + local aName = a.name or sformat(unknownItemName, a.id); + local bName = b.name or sformat(unknownItemName, b.id); if sortDirectory == "ASC" then return supper(aName) < supper(bName); @@ -422,14 +422,14 @@ -- Local quantity local lblLocal = AceGUI:Create("Label"); - lblLocal:SetText(self:DisplayItemCount(item.localCount, minLocalStock)); + lblLocal:SetText(addon:DisplayItemCount(item.localCount, minLocalStock)); lblLocal:SetRelativeWidth(.099); iGroup:AddChild(lblLocal); -- Current quantity local lblQuantity = AceGUI:Create("Label"); - lblQuantity:SetText(self:DisplayItemCount(item.globalCount, minGlobalStock)); + lblQuantity:SetText(addon:DisplayItemCount(item.globalCount, minGlobalStock)); lblQuantity:SetRelativeWidth(.099); iGroup:AddChild(lblQuantity); @@ -487,7 +487,7 @@ -- Only if item count was queued, update it item.globalCount = addon:GetItemCount(item.id, groupName); if item.set.globalCount and item.set.globalCount.SetText then - item.set.globalCount:SetText(self:DisplayItemCount(item.globalCount, minGlobalStock)); + item.set.globalCount:SetText(addon:DisplayItemCount(item.globalCount, minGlobalStock)); end end @@ -495,7 +495,7 @@ -- Only if item count was queued, update it item.localCount = addon:GetLocalItemCount(item.id, groupName); if item.set.localCount and item.set.localCount.SetText then - item.set.localCount:SetText(self:DisplayItemCount(item.localCount, minLocalStock)); + item.set.localCount:SetText(addon:DisplayItemCount(item.localCount, minLocalStock)); end end @@ -517,7 +517,7 @@ CACHE_ITEMS_CURRENT = CACHE_ITEMS_CURRENT + 1; if mod.frame then - mod.frame:SetStatusText(printf("Caching auction values and item-counts... %d%% has already been processed.", floor(CACHE_ITEMS_CURRENT / CACHE_ITEMS_TOTAL * 100))); + mod.frame:SetStatusText(sformat("Caching auction values and item-counts... %d%% has already been processed.", floor(CACHE_ITEMS_CURRENT / CACHE_ITEMS_TOTAL * 100))); end if i >= addon.db.profile.defaults.summary.speed then @@ -544,22 +544,6 @@ cacheStart = nil; end -function mod:ColorCode(num, required) - local percentage = ( num / required ); - - if percentage >= addon.db.profile.defaults.colors.green then - return printf("|cff00ff00%d|r", num); - elseif percentage >= addon.db.profile.defaults.colors.yellow then - return printf("|cffffff00%d|r", num); - elseif percentage >= addon.db.profile.defaults.colors.orange then - return printf("|cffff9933%d|r", num); - elseif percentage >= addon.db.profile.defaults.colors.red then - return printf("|cffff0000%d|r", num); - else - return num; - end -end - function mod:DisplayMoney(value, priceThreshold) if value == -1 then return "|cff0000ffNone up|r"; @@ -572,22 +556,12 @@ elseif value == -5 then return "|cffff9933Error|r"; elseif priceThreshold and value < priceThreshold then - return printf("|cffaaaaaa%s|r", sgsub(addon:ReadableMoney(value or 0, true), "|([a-fA-F0-9]+)([gsc]+)|r", "%2")); + return sformat("|cffaaaaaa%s|r", sgsub(addon:ReadableMoney(value or 0, true), "|([a-fA-F0-9]+)([gsc]+)|r", "%2")); else return addon:ReadableMoney(value or 0, true); end end -function mod:DisplayItemCount(value, minimumStock) - if value == -1 then - return "|cffffff00Unknown|r"; - elseif value == -3 then - return "|cffffff00Unknown|r"; - else - return printf("%s / %d", self:ColorCode(value, minimumStock), minimumStock); - end -end - function mod:NumberFormat(num) local formatted = sgsub(num, "(%d)(%d%d%d)$", "%1,%2", 1);