Quantcast

More bugs found & hopefully fixed. Added minimum item value option

ckaotik [03-13-10 - 16:56]
More bugs found & hopefully fixed. Added minimum item value option
Filename
core.lua
deDE.lua
enUS.lua
lootmanager.lua
lootmanager_options.lua
options.lua
readme.txt
diff --git a/core.lua b/core.lua
index accdeb2..46b0002 100644
--- a/core.lua
+++ b/core.lua
@@ -75,6 +75,7 @@ BrokerGarbage.defaultLocalSettings = {
 	-- behavior
 	neverRepairGuildBank = false,
 	selectiveLooting = false,
+	itemMinValue = 0,

 	-- default values
 	moneyLostByDeleting = 0,
@@ -82,7 +83,7 @@ BrokerGarbage.defaultLocalSettings = {
 }

 -- internal locals
-local debug = false
+local debug = true
 local locked = false
 local loaded = false
 local sellValue = 0		-- represents the actual value that we sold stuff for, opposed to BrokerGarbage.toSellValue which shows the maximum we could sell - imagine someone closing the merchant window. sellValue will then hold the real value we're interested in
@@ -540,13 +541,14 @@ function BrokerGarbage:CheckSkills()
 	if result == {} then return nil else return result end
 end

+local scanTooltip = CreateFrame('GameTooltip', 'BGItemScanTooltip', UIParent, 'GameTooltipTemplate')
 function BrokerGarbage:CanDisenchant(itemLink)
 	if (itemLink) then
-		local _, _, quality, level, _, _, _, count, slot = GetItemInfo(itemLink)
+		local _, _, quality, level, _, _, _, count, bagSlot = GetItemInfo(itemLink)

 		-- stackables are not DE-able
 		if quality and quality >= 2 and
-			string.find(slot, "INVTYPE") and not string.find(slot, "BAG")
+			string.find(bagSlot, "INVTYPE") and not string.find(bagSlot, "BAG")
 			and (not count or count == 1) then

 			-- can we DE ourself?
@@ -577,8 +579,39 @@ function BrokerGarbage:CanDisenchant(itemLink)
 				-- if skill is too low, still check if we can send it
 			end

-			-- so we can't DE, but can we send it to someone who may? i.e. is the item soulbound?
-
+			-- so we can't DE, but can we send it to someone who may? i.e. is the item not soulbound?
+			if BrokerGarbage.checkItem then
+				return not BrokerGarbage:IsItemSoulbound(itemLink, BrokerGarbage.checkItem.bag, BrokerGarbage.checkItem.slot)
+			else
+				return not BrokerGarbage:IsItemSoulbound(itemLink)
+			end
+		end
+	end
+	return false
+end
+
+-- returns true if the given item is soulbound
+function BrokerGarbage:IsItemSoulbound(itemLink, bag, slot)
+	scanTooltip:SetOwner(UIParent, 'ANCHOR_NONE')
+	local searchString
+
+	if not (bag and slot) then
+		-- check if item is BOP
+		scanTooltip:SetHyperlink(itemLink)
+		searchString = ITEM_BIND_ON_PICKUP
+	else
+		-- check if item is soulbound
+		scanTooltip:SetBagItem(bag, slot)
+		searchString = ITEM_SOULBOUND
+	end
+
+	local numLines = scanTooltip:NumLines()
+	for i = 1, numLines do
+		local leftLine = getglobal("BGItemScanTooltip".."TextLeft"..i)
+		local leftLineText = leftLine:GetText()
+
+		if string.find(leftLineText, searchString) then
+			return true
 		end
 	end
 	return false
@@ -925,7 +958,13 @@ function BrokerGarbage:ScanInventory()
 						-- ----------------------------------------------------------------------

 						-- get price and tag
-						local value, source = BrokerGarbage:GetItemValue(itemLink,count)
+						BrokerGarbage.checkItem = {
+							bag = container,
+							slot = slot,
+							itemID = itemID,
+						}
+						local value, source = BrokerGarbage:GetItemValue(itemLink, count)
+						BrokerGarbage.checkItem = nil
 						if isInclude or BG_GlobalDB.include[itemID] or BG_LocalDB.include[itemID] then
 							-- Include List item
 							force = true
@@ -1011,9 +1050,9 @@ function BrokerGarbage:ScanInventory()

 	local cheapestItem = BrokerGarbage:GetCheapest()

-	if cheapestItem ~= {} then
+	if cheapestItem[1] then
 		LDB.text = format(BG_GlobalDB.LDBformat,
-			(cheapestItem ~= {} and select(2,GetItemInfo(cheapestItem[1].itemID)) or BrokerGarbage.locale.label),
+			select(2,GetItemInfo(cheapestItem[1].itemID)),
 			cheapestItem[1].count,
 			BrokerGarbage:FormatMoney(cheapestItem[1].value),
 			BrokerGarbage.totalFreeSlots,
diff --git a/deDE.lua b/deDE.lua
index f1d1b1e..9492f19 100644
--- a/deDE.lua
+++ b/deDE.lua
@@ -20,9 +20,13 @@ BrokerGarbage.locale = {

 	openPlease = "Bitte öffne %s - es nimmt unnötig Platz weg.",
 	openClams = "Du hast eine %s im Inventar!",
-	couldNotLoot = "%s wurde nicht geplündert, da es zu billig ist.",
-	slashCommandHelp = "Nutze |cffc0c0c0/garbage config|r um die Einstellungen zu öffnen oder |cffc0c0c0/garbage format |cffc0c0ffformatstring|r um das Format der LDB Anzeige anzupassen. |cffc0c0c0/garbage format reset|r setzt das LDB Format zurück. Für Statistiken, gib |cffc0c0c0/garbage stats|r ein.",
+	couldNotLootValue = "%s wurde nicht geplündert, da es zu billig ist.",
+	couldNotLootLocked = "Konnte %s nicht plündern, da es gesperrt ist. Bitte plündere es manuell.",
+	couldNotLootSpace = "Konnte %s nicht plündern, da dein Inventar voll ist.",
+	couldNotLootLM = "%s wurde nicht geplündert. Du bist Plündermeister, bitte verteile es manuell.",
+	slashCommandHelp = "Folgende Kommandos werden unterstützt: |cffc0c0c0/garbage|r\n|cffc0c0c0 config|r öffnet die Optionen.\n|cffc0c0c0format |cffc0c0ffformatstring|r lässt dich das Format der LDB Anzeige anpassen, |cffc0c0c0 format reset|r setzt es zurück.\n|cffc0c0c0stats|r gibt dir eine Kurzstatistik aus.\n|cffc0c0c0limit |cffc0c0ffitemLink/ID Anzahl|r setzt ein Limit für das gewählte Item für den aktuellen Charakter.\n|cffc0c0c0globallimit |cffc0c0ffitemLink/ID Anzahl|r setzt ein Limit für alle Charaktere.\n|cffc0c0c0value |cffc0c0ffWertInKupfer|r setzt den Itemwert, ab dem Items gelootet werden.",
 	statistics = "Statistik:\nGesamtverdienst (alle Charaktere): %1$s\nGesamtverlust (alle Charaktere): %2$s",
+	minValueSet = "Mindestwert für items wurde auf %s gesetzt.",

 	-- Tooltip
 	headerRightClick = "Rechts-Klick: Optionen",
@@ -162,7 +166,6 @@ BrokerGarbage.locale = {

 	-- Loot Manager
 	CreatureTypeBeast = "Wildtier",
-	Quest = "Quest",
 	You = "Ihr",

 	LMTitle = "Loot Manager",
@@ -203,6 +206,8 @@ 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.",
+
+	LMItemMinValue = "Mindestwert zum Looten",
 }

 end
\ No newline at end of file
diff --git a/enUS.lua b/enUS.lua
index ba69718..1957e27 100644
--- a/enUS.lua
+++ b/enUS.lua
@@ -20,9 +20,13 @@ BrokerGarbage.locale = {

 	openPlease = "Please open your %s. It's in your bags, stealing your space!",
 	openClams = "You own a %s. Maybe consider opening it.",
-	couldNotLoot = "I did not loot %s because it's too cheap.",
-	slashCommandHelp = "Use |cffc0c0c0/garbage config|r to open the config menu or |cffc0c0c0/garbage format |cc0c0c0ffformatstring|r to change the LDB display style or |cffc0c0c0/garbage format reset|r to reset it. For statistics type |cffc0c0c0/garbage stats|r.",
+	couldNotLootValue = "Did not loot %s because it's too cheap.",
+	couldNotLootLocked = "Could not loot %s because it is locked. Please loot manually.",
+	couldNotLootSpace = "Could not loot %s because your inventory is full.",
+	couldNotLootLM = "%s was not looted. You are the Loot Master so please distrivute the item manually.",
+	slashCommandHelp = "The following commands are available: |cffc0c0c0/garbage|r\n|cffc0c0c0 config|r opens the options panel.\n|cffc0c0c0format |cffc0c0ffformatstring|r lets you customize the LDB display text, |cffc0c0c0 format reset|r resets it.\n|cffc0c0c0stats|r returns some statistics.\n|cffc0c0c0limit |cffc0c0ffitemLink/ID count|r sets a limit for the given item on the current character.\n|cffc0c0c0globallimit |cffc0c0ffitemLink/ID count|r sets a limit for all characters.\n|cffc0c0c0value |cffc0c0ffvalueInCopper|r sets the minimum value for items to be looted.",
 	statistics = "Statistics:\nTotal earnings (all characters): %1$s\nTotal losses (all characters): %2$s",
+	minValueSet = "Items with a value less than %s will not be looted anymore.",

 	-- Tooltip
 	headerRightClick = "Right-Click for options",
@@ -162,7 +166,6 @@ BrokerGarbage.locale = {

 	-- Loot Manager
 	CreatureTypeBeast = "Beast",
-	Quest = "Quest",
 	You = "You",			-- as in "You receive ..."

 	LMTitle = "Loot Manager",
@@ -203,5 +206,7 @@ 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.",
+
+	LMItemMinValue = "Minimum item value",
 }

diff --git a/lootmanager.lua b/lootmanager.lua
index 4057302..c5b3bdc 100644
--- a/lootmanager.lua
+++ b/lootmanager.lua
@@ -349,150 +349,117 @@ function BrokerGarbage:SelectiveLooting(autoloot)
 	if IsShiftKeyDown() then return end
 	local numItems = GetNumLootItems()
 	local texture, quantity, quality, locked, itemLink
-	local trouble, looted
+	local manage, loot, close = false, false, true
+
 	local mobLevel = UnitExists("target") and UnitIsDead("target") and UnitLevel("target")
 	local mobType = UnitCreatureType("target") == BrokerGarbage.locale.CreatureTypeBeast
+	local autoLoot = autoloot ~= 0 or BG_GlobalDB.autoLoot

-	if autoloot ~= 0 or BG_GlobalDB.autoLoot or (BG_GlobalDB.autoLootPickpocket and BrokerGarbage.playerClass == "ROGUE" and IsStealthed()) or (BG_GlobalDB.autoLootFishing and IsFishingLoot()) then
-		BrokerGarbage:Debug("Autoloot (selectiveLooting)")
+	if autoLoot
+		or (BG_GlobalDB.autoLootPickpocket and BrokerGarbage.playerClass == "ROGUE" and IsStealthed())
+		or (BG_GlobalDB.autoLootFishing and IsFishingLoot())
+		or (BG_GlobalDB.autoLootSkinning and mobType and CanSkin(mobLevel)) then
+
+		BrokerGarbage:Debug("Clearing mob")
+		manage = true
+
 		for slot = 1,numItems do
-			if LootSlotIsItem(slot) then
+			if LootSlotIsCoin(slot) then
+				-- take money
+				loot = true
+			else
+				-- check items
 				_, _, quantity,  quality, locked = GetLootSlotInfo(slot)
 				itemLink = GetLootSlotLink(slot)
+				local value = BrokerGarbage:GetItemValue(itemLink, quantity)

-				-- check if we even want this!
-				if BrokerGarbage:IsInteresting(itemLink) then
-					BrokerGarbage:Debug("Interesting Item", itemLink)
-					if not locked then
-						if BrokerGarbage.totalFreeSlots <= BG_GlobalDB.tooFewSlots then
-							BrokerGarbage:Debug("We're out of space!")
-							-- try to compress and make room
-							local itemID = BrokerGarbage:GetItemID(itemLink)
-							local maxStack = select(8, GetItemInfo(itemID))
-							local inBags = mod(GetItemCount(itemID), maxStack)
-							local compareTo = BrokerGarbage:GetCheapest()
+				if BrokerGarbage:IsInteresting(itemLink)
+					and (not value or value >= BG_LocalDB.itemMinValue) then
+
+					if BrokerGarbage.totalFreeSlots <= BG_GlobalDB.tooFewSlots then
+						-- try to compress and make room
+						BrokerGarbage:Debug("We're out of space!")
+
+						local itemID = BrokerGarbage:GetItemID(itemLink)
+						local maxStack = select(8, GetItemInfo(itemID))
+						local inBags = mod(GetItemCount(itemID), maxStack)
+						local compareTo = BrokerGarbage:GetCheapest()
+
+						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
+							-- we can fit x more in ... *squeeze*
+							BrokerGarbage:Debug("Item can be made to fit.", itemLink)

-							if inBags > 0 and inBags + quantity > maxStack and BG_GlobalDB.autoDestroy then
-								-- we can fit x more in ... *squeeze*
-								local amount = quantity + inBags - maxStack
-								if compareTo[1] and (BrokerGarbage:GetItemValue(itemLink, (quantity-amount)) or 0) < compareTo[1].value then
-									BrokerGarbage:DeletePartialStack(itemID, amount)
-									BrokerGarbage:Debug("Item can be made to fit.", itemLink)
-									looted = true
-								end
-							elseif inBags > 0 and maxStack <= (inBags + quantity) then
-								-- this item fits without us doing anything
-								BrokerGarbage:Debug("Item stacks.", itemLink)
-								looted = true
+							local amount = quantity + inBags - maxStack
+							if compareTo[1] and
+								(BrokerGarbage:GetItemValue(itemLink, (quantity-amount)) or 0) < compareTo[1].value then
+
+								BrokerGarbage:DeletePartialStack(itemID, amount)
+								loot = true
 							end
+
+						elseif BG_GlobalDB.autoDestroy and compareTo[1] then
+							-- delete cheaper item
+							BrokerGarbage:Debug("Check for items to throw away for", itemLink)

-							-- bad luck :/ maybe delete stuff that's worth less? always loot quest items
-							if BG_GlobalDB.autoDestroy and not looted and compareTo[1]
-								and ((BrokerGarbage:GetItemValue(itemLink, quantity) or 0) > compareTo[1].value
-									or select(6,GetItemInfo(itemLink)) == BrokerGarbage.locale.Quest) then
+							if (BrokerGarbage:GetItemValue(itemLink, quantity) or 0) > compareTo[1].value
+								or select(6,GetItemInfo(itemLink)) == select(12, GetAuctionItemClasses()) then

+								-- this item is worth more or it is a quest item
 								BrokerGarbage:Debug("Delete item to make room.", itemLink)
-								BrokerGarbage:Delete(select(2,GetItemInfo(compareTo[1].itemID)), compareTo[1].bag, compareTo[1].slot)
-								LootSlot(slot)
-							elseif looted then
-								-- regular looting
-								LootSlot(slot)
-							else
-								BrokerGarbage:Debug("What do we have here?", itemLink)
-								if mobType and BrokerGarbage:CanSkin(mobLevel) then
-									-- hrmpf, it's skinnable
-									BrokerGarbage:Debug("Still looting, for skinning", itemLink)
-									BrokerGarbage:Debug()
-									BrokerGarbage:Delete(select(2,GetItemInfo(compareTo[1].itemID)), compareTo[1].bag, compareTo[1].slot)
-									LootSlot(slot)
-								else
-									-- something is in there, but not valuable enough for us to take it
-									BrokerGarbage:Print(format(BrokerGarbage.locale.couldNotLoot, itemLink))
-								end
+
+								BrokerGarbage:Delete(select(2,GetItemInfo(compareTo[1].itemID)),
+									compareTo[1].bag, compareTo[1].slot)
+								loot = true
+
+							elseif BG_GlobalDB.autoLootSkinning and mobType and CanSkin(mobLevel) and compareTo[1] then
+								-- we are skinning
+								BrokerGarbage:Debug("Looting for skinning", itemLink)
+
+								BrokerGarbage:Delete(select(2,GetItemInfo(compareTo[1].itemID)),
+									compareTo[1].bag, compareTo[1].slot)
+								loot = true
 							end
-						else
-							-- just loot normally
-							LootSlot(slot)
-							BrokerGarbage:Debug("Item taken.", itemLink)
 						end
 					else
-						-- we should be able to loot this, but we are not. somebody set up us the bomb!
-						trouble = true
-						BrokerGarbage:Debug("Ooops! Something went wrong there. Item is locked", itemLink)
+						-- enough bag space
+						loot = true
 					end
 				end
-			else
-				-- always take money
-				LootSlot(slot)
 			end
-		end
-		if (GetNumLootItems() ~= 0 and not trouble) or GetNumLootItems() == 0 then
-			CloseLoot()
-		end
-
-	elseif BG_GlobalDB.autoLootSkinning and mobType and BrokerGarbage:CanSkin(mobLevel) then
-		-- clear the mob for skinning
-		BrokerGarbage:Debug("Clearing for Skinning")
-
-		if numItems > BrokerGarbage.totalFreeSlots then
-			-- this might be too much for our inventory to take
-			for slot = 1,numItems do
-				if numItems > BrokerGarbage.totalFreeSlots then
-					_, _, quantity,  quality, locked = GetLootSlotInfo(slot)
-					itemLink = GetLootSlotLink(slot)
-
-					local itemID = BrokerGarbage:GetItemID(itemLink)
-					local maxStack = select(8, GetItemInfo(itemID))
-					local inBags = mod(GetItemCount(itemID), maxStack)
-					local compareTo = BrokerGarbage:GetCheapest()
+
+			-- take loot if we can
+			if locked and quality < GetLootThreshold() then
+				BrokerGarbage:Print(format(BrokerGarbage.locale.couldNotLootLocked, itemLink))
+			elseif not loot and not BG_GlobalDB.autoDestroy then
+				BrokerGarbage:Print(format(BrokerGarbage.locale.couldNotLootSpace, itemLink))
+			elseif not loot then
+				BrokerGarbage:Print(format(BrokerGarbage.locale.couldNotLootValue, itemLink))
+			else
+				-- check if we are allowed to loot this
+				if (GetNumPartyMembers() > 0 or GetNumRaidMembers() > 1)
+					and GetLootMethod() ~= "freeforall" and quality >= GetLootThreshold() then

-					if inBags > 0 and inBags + quantity <= maxStack then
-						-- it stacks
-						LootSlot(slot)
-						numItems = numItems - 1
-
-					elseif not IsInteresting(itemLink) then
-						-- loot and immediately destroy
-						LootSlot(slot)
-						numItems = numItems - 1
-						if BG_GlobalDB.autoDestroy then BrokerGarbage:AntiCrap() end
+					-- ignore item as it is still being rolled for / loot master's job
+					if GetNumRaidMembers() > 1 and select(3,GetLootMethod())
+						and UnitIsUnit("raid"..select(3,GetLootMethod()), "player") then

-					elseif BG_GlobalDB.autoDestroy then
-						if inBags > 0 and inBags + quantity > maxStack then
-							-- squeeze
-							local amount = quantity + inBags - maxStack
-							if compareTo[1]
-								and (BrokerGarbage:GetItemValue(itemLink, (quantity-amount)) or 0) < compareTo[1].value then
-
-								BrokerGarbage:DeletePartialStack(itemID, amount)
-								LootSlot(slot)
-								numItems = numItems - 1
-							else
-								-- must... delete... cheap... item
-								BrokerGarbage:Delete(compareTo)
-								LootSlot(slot)
-								numItems = numItems - 1
-							end
-						else
-							-- must delete cheap item
-							BrokerGarbage:Delete(compareTo)
-							LootSlot(slot)
-							numItems = numItems - 1
-						end
+						BrokerGarbage:Print(format(BrokerGarbage.locale.couldNotLootLM, itemLink))
+						close = false
 					end
 				else
-					-- lucky, something stacked and there's no more trouble
+					-- loot normally
 					LootSlot(slot)
-					numItems = numItems - 1
 				end
 			end
-
-		else
-			-- loot & check later
-			for slot = 1,numItems do
-				LootSlot(slot)
-			end
 		end
+	end
+
+	if manage and (close or GetNumLootItems() == 0) then
 		CloseLoot()
 	end
 end
diff --git a/lootmanager_options.lua b/lootmanager_options.lua
index 4e29f9b..fbf43d8 100644
--- a/lootmanager_options.lua
+++ b/lootmanager_options.lua
@@ -82,7 +82,7 @@ local function ShowOptions(frame)
 		Update()
 	end)

-	local minFreeSlots = LibStub("tekKonfig-Slider").new(BrokerGarbage.lootManagerOptions, BrokerGarbage.locale.LMFreeSlotsTitle, 0, 30, "TOPLEFT", autoDestroy, "BOTTOMLEFT", 14, -20)
+	local minFreeSlots = LibStub("tekKonfig-Slider").new(BrokerGarbage.lootManagerOptions, BrokerGarbage.locale.LMFreeSlotsTitle, 0, 30, "TOPLEFT", autoDestroy, "BOTTOMLEFT", 0, -20)
 	minFreeSlots.tiptext = BrokerGarbage.locale.LMFreeSlotsTooltip
 	minFreeSlots:SetWidth(200)
 	minFreeSlots:SetValueStep(1)
@@ -96,6 +96,7 @@ local function ShowOptions(frame)
 		BrokerGarbage:ScanInventory()
 	end)

+
 	-- -- Restack -----------------------------------------------------------------
 	local restack = LibStub("tekKonfig-Checkbox").new(BrokerGarbage.lootManagerOptions, nil, BrokerGarbage.locale.LMRestackTitle, "TOPLEFT", selective, "TOPLEFT", 200, 0)
 	restack.tiptext = BrokerGarbage.locale.LMRestackTooltip
@@ -115,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, -20)
+	local openContainers = LibStub("tekKonfig-Checkbox").new(BrokerGarbage.lootManagerOptions, nil, BrokerGarbage.locale.LMOpenContainersTitle, "TOPLEFT", fullRestack, "BOTTOMLEFT", -14, -10)
 	openContainers.tiptext = BrokerGarbage.locale.LMOpenContainersTooltip
 	openContainers:SetChecked(BG_GlobalDB.openContainers)
 	openContainers:SetScript("OnClick", function(openContainers)
@@ -131,6 +132,51 @@ local function ShowOptions(frame)
 		BG_GlobalDB.openClams = not BG_GlobalDB.openClams
 	end)

+
+	-- -- Loot Treshold -----------------------------------------------------------
+	local editbox = CreateFrame("EditBox", nil, BrokerGarbage.lootManagerOptions)
+	editbox:SetAutoFocus(false)
+	editbox:SetWidth(100); editbox:SetHeight(32)
+	editbox:SetFontObject("GameFontHighlightSmall")
+	editbox:SetText(BrokerGarbage:FormatMoney(BG_LocalDB.itemMinValue))
+	local left = editbox:CreateTexture(nil, "BACKGROUND")
+	left:SetWidth(8) left:SetHeight(20)
+	left:SetPoint("LEFT", -5, 0)
+	left:SetTexture("Interface\\Common\\Common-Input-Border")
+	left:SetTexCoord(0, 0.0625, 0, 0.625)
+	local right = editbox:CreateTexture(nil, "BACKGROUND")
+	right:SetWidth(8) right:SetHeight(20)
+	right:SetPoint("RIGHT", 0, 0)
+	right:SetTexture("Interface\\Common\\Common-Input-Border")
+	right:SetTexCoord(0.9375, 1, 0, 0.625)
+	local center = editbox:CreateTexture(nil, "BACKGROUND")
+	center:SetHeight(20)
+	center:SetPoint("RIGHT", right, "LEFT", 0, 0)
+	center:SetPoint("LEFT", left, "RIGHT", 0, 0)
+	center:SetTexture("Interface\\Common\\Common-Input-Border")
+	center:SetTexCoord(0.0625, 0.9375, 0, 0.625)
+
+	local minvalue = editbox:CreateFontString(nil, "ARTWORK", "GameFontHighlight")
+	minvalue:SetPoint("TOPLEFT", openClams, "BOTTOMLEFT", 0, -10)
+	minvalue:SetText(BrokerGarbage.locale.LMItemMinValue)
+	editbox:SetPoint("TOP", minvalue, "BOTTOM", 0, 0)
+	local function ResetEditBox(self)
+		self:SetText(BrokerGarbage:FormatMoney(BG_LocalDB.itemMinValue))
+		self:ClearFocus()
+	end
+	local function UnFormatEditBox(self)
+		self:SetText(BG_LocalDB.itemMinValue)
+	end
+	local function SubmitEditBox()
+		BG_LocalDB.itemMinValue = tonumber(editbox:GetText())
+		editbox:SetText(BrokerGarbage:FormatMoney(BG_LocalDB.itemMinValue))
+		editbox:ClearFocus()
+	end
+	editbox:SetScript("OnEscapePressed", ResetEditBox)
+	editbox:SetScript("OnEnterPressed", SubmitEditBox)
+	editbox:SetScript("OnEditFocusGained", UnFormatEditBox)
+
+
 	function BrokerGarbage.lootManagerOptionsUpdate(self)
 		if BG_GlobalDB.useLootManager then
 			restack:Enable()
diff --git a/options.lua b/options.lua
index 267a530..829c534 100644
--- a/options.lua
+++ b/options.lua
@@ -1359,6 +1359,13 @@ function SlashCmdList.BROKERGARBAGE(msg, editbox)
 		BrokerGarbage:Print(format(BrokerGarbage.locale.limitSet, itemLink, count))
 		BrokerGarbage:ListOptionsUpdate("include")

+	elseif command == "value" or command == "minvalue" then
+		rest = tonumber(rest)
+		if not rest then return end
+
+		BG_LocalDB.itemMinValue = rest
+		BrokerGarbage:Print(format(BrokerGarbage.locale.minValueSet, BrokerGarbage:FormatMoney(BG_LocalDB.itemMinValue)))
+
 	else
 		BrokerGarbage:Print(BrokerGarbage.locale.slashCommandHelp)
 	end
diff --git a/readme.txt b/readme.txt
index 1d15de8..a4d1b23 100644
--- a/readme.txt
+++ b/readme.txt
@@ -107,6 +107,9 @@ This will add the corresponding item to the character's include list and add a l
 	/garb glimit -or- /garb globallimit
 Same as the above, just adds the item to the global include list.

+	/garb value <value in copper> -or- /garb minvalue <value in copper>
+Sets the minimum item value in order for the item to be looted. '0' means every item may be looted.
+
 9. How you can help
 -----------------
 I still need a few translations to get done. If you would like to help me with that, please do so on http://wow.curseforge.com/addons/broker_garbage/localization/  .