diff --git a/core.lua b/core.lua index 4d6277c..74fb124 100644 --- a/core.lua +++ b/core.lua @@ -43,12 +43,14 @@ BrokerGarbage.defaultGlobalSettings = { tooFewSlots = 0, openContainers = true, openClams = true, + warnLM = true, -- default values tooltipMaxHeight = 220, tooltipNumItems = 9, dropQuality = 0, showMoney = 2, + hasEnchanter = true, -- statistic values moneyLostByDeleting = 0, @@ -62,7 +64,6 @@ BrokerGarbage.defaultGlobalSettings = { showLost = true, showEarned = true, LDBformat = "%1$sx%2$d (%3$s)", - -- showWarnings = true, -- TODO showSource = false, } @@ -91,7 +92,6 @@ local cost = 0 local lastReminder = time() BrokerGarbage.tt = nil -BrokerGarbage.warnings = {} BrokerGarbage.tagAuction = "|cFF2bff58A" -- green BrokerGarbage.tagVendor = "|cFFff9c5aV" -- orange BrokerGarbage.tagVendorList = "|cFFff592dV" -- slightly darker orange @@ -580,6 +580,7 @@ function BrokerGarbage:CanDisenchant(itemLink) end -- so we can't DE, but can we send it to someone who may? i.e. is the item not soulbound? + if not BG_GlobalDB.hasEnchanter then return false end if BrokerGarbage.checkItem then return not BrokerGarbage:IsItemSoulbound(itemLink, BrokerGarbage.checkItem.bag, BrokerGarbage.checkItem.slot) else @@ -915,12 +916,6 @@ function BrokerGarbage:ScanInventory() itemID = itemID, clam = isClam, }) - if BG_GlobalDB.showWarnings then - local notice = format(BrokerGarbage.locale.openPlease, select(2,GetItemInfo(itemID))) - if not BrokerGarbage:Find(BrokerGarbage.warnings, notice) then - tinsert(BrokerGarbage.warnings, notice) - end - end end -- check if this item belongs to an excluded category @@ -1016,10 +1011,7 @@ function BrokerGarbage:ScanInventory() -- AutoSell List item value = select(11,GetItemInfo(itemID)) source = BrokerGarbage.tagVendorList - - --elseif quality and quality <= BG_GlobalDB.dropQuality then - -- regular gray/junk treshold item - --force = false + end if value then @@ -1062,8 +1054,6 @@ function BrokerGarbage:ScanInventory() LDB.text = BrokerGarbage.locale.label BrokerGarbage.cheapestItem = nil end - - return warnings end -- returns the n cheapest items in your bags in a table @@ -1203,9 +1193,5 @@ end -- Wishlist -- --------------------------------------------------------- --- tooltip: if item has a count treshold set, don't show if we're below that treshold --- show lootable containers in your bag! make "open items" not as spammy -- increase/decrease loot treshold with mousewheel on LDB --- restack if necessary -> PickupContainerItem // SplitContainerItem --- fubar_garbagefu: Soulbound, Quest, Bind on Pickup, Bind on Equip/Use. -- ignore special bags \ No newline at end of file diff --git a/deDE.lua b/deDE.lua index 9492f19..cca085b 100644 --- a/deDE.lua +++ b/deDE.lua @@ -111,6 +111,9 @@ BrokerGarbage.locale = { maxHeightTitle = "Max. Höhe", maxHeightText = "Lege fest, wie hoch der Tooltip sein darf. Standard: 220", + enchanterTitle = "Verzauberer", + enchanterTooltip = "Setze das Häkchen, wenn du einen Verzauberer besitzt/kennst. Wenn aktiviert, wird Broker_Garbage Entzauberpreise verwenden, welche in der Regel höher sind als Händlerpreise.", + rescanInventory = "Inventar neu scannen", rescanInventoryText = "Klicke um dein Inventar neu zu scannen. Dies sollte normalerweise nicht nötig sein!", @@ -207,6 +210,9 @@ BrokerGarbage.locale = { LMOpenClamsTitle = "Warne: Muscheln", LMOpenClamsTooltip = "Wenn ausgewählt, wird Broker_Garbage eine Warnung ausgeben, wenn du ungeöffnete Muscheln im Inventar hast. Da diese aber nun stapelbar sind, verlierst du durch deaktivieren dieser Option keinen Taschenplatz.", + LMWarnLMTitle = "Warne: Plündermeister", + LMWarnLMTooltip = "Wenn ausgewählt, wird Broker_Garbage eine Meldung zeigen, die dich auffordert, die Beute zu verteilen.", + LMItemMinValue = "Mindestwert zum Looten", } diff --git a/enUS.lua b/enUS.lua index 1957e27..a076769 100644 --- a/enUS.lua +++ b/enUS.lua @@ -111,6 +111,9 @@ BrokerGarbage.locale = { maxHeightTitle = "Max. Height", maxHeightText = "Set the height of the tooltip. Default: 220", + enchanterTitle = "Enchanter", + enchanterTooltip = "Check this if you have/know an enchanter. When checked, Broker_Garbage will use disenchant values for disenchantable items, which are usually higher than vendor prices.", + rescanInventory = "Rescan Inventory", rescanInventoryText = "Click to manually rescan you inventory. Should generally not be needed.", @@ -207,6 +210,9 @@ BrokerGarbage.locale = { LMOpenClamsTitle = "Warn: Clams", LMOpenClamsTooltip = "When checked, Broker_Garbage will warn you when you have clams in you inventory. As these now do stack, you are not wasting any slots by unchecking this.", + LMWarnLMTitle = "Warn: Loot Master", + LMWarnLMTooltip = "When checked, Broker_Garbage will print a notice reminding you to assign loot.", + LMItemMinValue = "Minimum item value", } diff --git a/lootmanager.lua b/lootmanager.lua index 45da941..d654348 100644 --- a/lootmanager.lua +++ b/lootmanager.lua @@ -278,10 +278,12 @@ end -- determines if an item should be lootet function BrokerGarbage:IsInteresting(itemLink) local itemID = BrokerGarbage:GetItemID(itemLink) + local alwaysLoot = false + -- items we don't want local negativeList = BrokerGarbage:JoinTables(BG_GlobalDB.include, BG_LocalDB.include) if negativeList[itemID] then - return false + return false, false else -- check if the item belongs to a category local inCategory @@ -289,13 +291,32 @@ function BrokerGarbage:IsInteresting(itemLink) if type(setName) == "string" then _, inCategory = BrokerGarbage.PT:ItemInSet(itemID, setName) end - if inCategory then return false end + if inCategory then + return false, false + end end end - return true + -- items we always want + local positiveList = BrokerGarbage:JoinTables(BG_GlobalDB.exclude, BG_LocalDB.exclude) + if positiveList[itemID] then + alwaysLoot = true + else + -- check if the item belongs to a category + local inCategory + for setName,_ in pairs(positiveList) do + if type(setName) == "string" then + _, inCategory = BrokerGarbage.PT:ItemInSet(itemID, setName) + end + if inCategory then + alwaysLoot = true + end + end + end + + -- items we don't care about + return true, alwaysLoot - --local positiveList = BrokerGarbage:JoinTables(BG_GlobalDB.exclude, BG_LocalDB.exclude) --local sellList = BrokerGarbage:JoinTables(BG_GlobalDB.forceVendorPrice, BG_GlobalDB.autoSellList, BG_LocalDB.autoSellList) end @@ -364,6 +385,7 @@ function BrokerGarbage:SelectiveLooting(autoloot) manage = true for slot = 1,numItems do + loot = false if LootSlotIsCoin(slot) then -- take money loot = true @@ -372,8 +394,9 @@ function BrokerGarbage:SelectiveLooting(autoloot) _, _, quantity, quality, locked = GetLootSlotInfo(slot) itemLink = GetLootSlotLink(slot) local value = BrokerGarbage:GetItemValue(itemLink, quantity) + local isInteresting, alwaysLoot = BrokerGarbage:IsInteresting(itemLink) - if BrokerGarbage:IsInteresting(itemLink) + if isInteresting and (not value or value >= BG_LocalDB.itemMinValue) then if BrokerGarbage.totalFreeSlots <= BG_GlobalDB.tooFewSlots then @@ -385,18 +408,22 @@ function BrokerGarbage:SelectiveLooting(autoloot) local inBags = mod(GetItemCount(itemID), maxStack) local compareTo = BrokerGarbage:GetCheapest() + local prepareSkinning = (autoLoot or BG_GlobalDB.autoLootSkinning) and mobType and BrokerGarbage:CanSkin(mobLevel) + if inBags > 0 and maxStack >= (inBags + quantity) then -- this item fits without us doing anything BrokerGarbage:Debug("Item stacks.", itemLink) loot = true - elseif BG_GlobalDB.autoDestroy and inBags > 0 and inBags + quantity > maxStack then + elseif BG_GlobalDB.autoDestroy and not alwaysLoot and inBags > 0 + and (inBags < maxStack or prepareSkinning) and inBags + quantity > maxStack then + -- we can fit x more in ... *squeeze* BrokerGarbage:Debug("Item can be made to fit.", itemLink) local amount = quantity + inBags - maxStack - if compareTo[1] and - (BrokerGarbage:GetItemValue(itemLink, (quantity-amount)) or 0) < compareTo[1].value then + if not compareTo[1] + or (BrokerGarbage:GetItemValue(itemLink, quantity) or 0) < compareTo[1].value then BrokerGarbage:DeletePartialStack(itemID, amount) loot = true @@ -416,7 +443,7 @@ function BrokerGarbage:SelectiveLooting(autoloot) compareTo[1].bag, compareTo[1].slot) loot = true - elseif BG_GlobalDB.autoLootSkinning and mobType and BrokerGarbage:CanSkin(mobLevel) and compareTo[1] then + elseif prepareSkinning and compareTo[1] then -- we are skinning BrokerGarbage:Debug("Looting for skinning", itemLink) @@ -448,7 +475,9 @@ function BrokerGarbage:SelectiveLooting(autoloot) if GetNumRaidMembers() > 1 and select(3,GetLootMethod()) and UnitIsUnit("raid"..select(3,GetLootMethod()), "player") then - BrokerGarbage:Print(format(BrokerGarbage.locale.couldNotLootLM, itemLink)) + if BG_GlobalDB.warnLM then + BrokerGarbage:Print(format(BrokerGarbage.locale.couldNotLootLM, itemLink)) + end close = false end else diff --git a/lootmanager_options.lua b/lootmanager_options.lua index fbf43d8..9f042af 100644 --- a/lootmanager_options.lua +++ b/lootmanager_options.lua @@ -116,7 +116,7 @@ local function ShowOptions(frame) end) -- -- Opening Items ----------------------------------------------------------- - local openContainers = LibStub("tekKonfig-Checkbox").new(BrokerGarbage.lootManagerOptions, nil, BrokerGarbage.locale.LMOpenContainersTitle, "TOPLEFT", fullRestack, "BOTTOMLEFT", -14, -10) + local openContainers = LibStub("tekKonfig-Checkbox").new(BrokerGarbage.lootManagerOptions, nil, BrokerGarbage.locale.LMOpenContainersTitle, "TOPLEFT", fullRestack, "BOTTOMLEFT", -14, 0) openContainers.tiptext = BrokerGarbage.locale.LMOpenContainersTooltip openContainers:SetChecked(BG_GlobalDB.openContainers) openContainers:SetScript("OnClick", function(openContainers) @@ -132,6 +132,13 @@ local function ShowOptions(frame) BG_GlobalDB.openClams = not BG_GlobalDB.openClams end) + local warnLM = LibStub("tekKonfig-Checkbox").new(BrokerGarbage.lootManagerOptions, nil, BrokerGarbage.locale.LMWarnLMTitle, "TOPLEFT", openClams, "BOTTOMLEFT", 0, 0) + warnLM.tiptext = BrokerGarbage.locale.LMWarnLMTooltip + warnLM:SetChecked(BG_GlobalDB.warnLM) + warnLM:SetScript("OnClick", function(warnLM) + checksound(warnLM) + BG_GlobalDB.warnLM = not BG_GlobalDB.warnLM + end) -- -- Loot Treshold ----------------------------------------------------------- local editbox = CreateFrame("EditBox", nil, BrokerGarbage.lootManagerOptions) @@ -157,7 +164,7 @@ local function ShowOptions(frame) center:SetTexCoord(0.0625, 0.9375, 0, 0.625) local minvalue = editbox:CreateFontString(nil, "ARTWORK", "GameFontHighlight") - minvalue:SetPoint("TOPLEFT", openClams, "BOTTOMLEFT", 0, -10) + minvalue:SetPoint("TOPLEFT", warnLM, "BOTTOMLEFT", 0, -20) minvalue:SetText(BrokerGarbage.locale.LMItemMinValue) editbox:SetPoint("TOP", minvalue, "BOTTOM", 0, 0) local function ResetEditBox(self) @@ -188,6 +195,7 @@ local function ShowOptions(frame) openContainers:Enable() openClams:Enable() + warnLM:Enable() selective:Enable() if BG_LocalDB.selectiveLooting then @@ -224,6 +232,7 @@ local function ShowOptions(frame) openContainers:Disable() openClams:Disable() + warnLM:Disable() selective:Disable() autoLoot:Disable() diff --git a/options.lua b/options.lua index 829c534..1eb3d48 100644 --- a/options.lua +++ b/options.lua @@ -397,6 +397,15 @@ local function ShowOptions(frame) BG_LocalDB.neverRepairGuildBank = not BG_LocalDB.neverRepairGuildBank end) + local showsource = LibStub("tekKonfig-Checkbox").new(BrokerGarbage.basicOptions, nil, BrokerGarbage.locale.showSourceTitle, "TOPLEFT", guildrepair, "BOTTOMLEFT", -14, 0) + showsource.tiptext = BrokerGarbage.locale.showSourceText + showsource:SetChecked(BG_GlobalDB.showSource) + local checksound = showsource:GetScript("OnClick") + showsource:SetScript("OnClick", function(showsource) + checksound(showsource) + BG_GlobalDB.showSource = not BG_GlobalDB.showSource + end) + local showlost = LibStub("tekKonfig-Checkbox").new(BrokerGarbage.basicOptions, nil, BrokerGarbage.locale.showLostTitle, "TOPLEFT", nothingtext, "BOTTOMLEFT", -14, -10) showlost.tiptext = BrokerGarbage.locale.showLostText showlost:SetChecked(BG_GlobalDB.showLost) @@ -469,24 +478,7 @@ local function ShowOptions(frame) ttMaxHeight.text:SetText(ttMaxHeight:GetValue()) end) - local rescan = LibStub("tekKonfig-Button").new(BrokerGarbage.basicOptions, "TOPLEFT", ttMaxItems, "BOTTOMLEFT", 0, -20) - rescan:SetText(BrokerGarbage.locale.rescanInventory) - rescan.tiptext = BrokerGarbage.locale.rescanInventoryText - rescan:SetWidth(150) - rescan:SetScript("OnClick", function() - BrokerGarbage:ScanInventory() - end) - - local showsource = LibStub("tekKonfig-Checkbox").new(BrokerGarbage.basicOptions, nil, BrokerGarbage.locale.showSourceTitle, "TOPLEFT", rescan, "TOPRIGHT", 50, 0) - showsource.tiptext = BrokerGarbage.locale.showSourceText - showsource:SetChecked(BG_GlobalDB.showSource) - local checksound = showsource:GetScript("OnClick") - showsource:SetScript("OnClick", function(showsource) - checksound(showsource) - BG_GlobalDB.showSource = not BG_GlobalDB.showSource - end) - - local resetexclude = LibStub("tekKonfig-Button").new(BrokerGarbage.basicOptions, "TOPLEFT", rescan, "BOTTOMLEFT", 0, -10) + local resetexclude = LibStub("tekKonfig-Button").new(BrokerGarbage.basicOptions, "TOPLEFT", ttMaxItems, "BOTTOMLEFT", 0, -20) resetexclude:SetText(BrokerGarbage.locale.emptyExcludeList) resetexclude.tiptext = BrokerGarbage.locale.emptyExcludeListText resetexclude:SetWidth(150) @@ -494,7 +486,7 @@ local function ShowOptions(frame) BrokerGarbage:ResetList("exclude") end) - local resetinclude = LibStub("tekKonfig-Button").new(BrokerGarbage.basicOptions, "TOPLEFT", showsource, "BOTTOMLEFT", 0, -10) + local resetinclude = LibStub("tekKonfig-Button").new(BrokerGarbage.basicOptions, "TOPLEFT", resetexclude, "BOTTOMLEFT", 0, -10) resetinclude:SetText(BrokerGarbage.locale.emptyIncludeList) resetinclude.tiptext = BrokerGarbage.locale.emptyIncludeListText resetinclude:SetWidth(150) @@ -502,6 +494,22 @@ local function ShowOptions(frame) BrokerGarbage:ResetList("include") end) + local enchanter = LibStub("tekKonfig-Checkbox").new(BrokerGarbage.basicOptions, nil, BrokerGarbage.locale.enchanterTitle, "LEFT", resetexclude, "LEFT", 200, 0) + enchanter.tiptext = BrokerGarbage.locale.enchanterTooltip + enchanter:SetChecked(BG_GlobalDB.hasEnchanter) + enchanter:SetScript("OnClick", function(enchanter) + checksound(enchanter) + BG_GlobalDB.hasEnchanter = not BG_GlobalDB.hasEnchanter + end) + + local rescan = LibStub("tekKonfig-Button").new(BrokerGarbage.basicOptions, "TOPLEFT", enchanter, "BOTTOMLEFT", 0, -6) + rescan:SetText(BrokerGarbage.locale.rescanInventory) + rescan.tiptext = BrokerGarbage.locale.rescanInventoryText + rescan:SetWidth(150) + rescan:SetScript("OnClick", function() + BrokerGarbage:ScanInventory() + end) + local editbox = CreateFrame("EditBox", nil, BrokerGarbage.basicOptions) editbox:SetAutoFocus(false) editbox:SetWidth(150); editbox:SetHeight(32) @@ -525,7 +533,7 @@ local function ShowOptions(frame) center:SetTexCoord(0.0625, 0.9375, 0, 0.625) local LDBtext = editbox:CreateFontString(nil, "ARTWORK", "GameFontHighlight") - LDBtext:SetPoint("TOPLEFT", resetexclude, "BOTTOMLEFT", 0, -20) + LDBtext:SetPoint("TOPLEFT", resetinclude, "BOTTOMLEFT", 0, -20) LDBtext:SetText(BrokerGarbage.locale.LDBDisplayTextTitle) editbox:SetPoint("LEFT", LDBtext, "RIGHT", 20, 0) local function ResetEditBox(self)