Quantcast

another try on fixing the auto sell button not showing up. fixed default list creation on first logon. it does not find your tradeskills yet, but you can still have them set up manually (via the default list button and/or via right click on the+ icon

ckaotik [06-29-10 - 16:52]
another try on fixing the auto sell button not showing up. fixed default list creation on first logon. it does not find your tradeskills yet, but you can still have them set up manually (via the default list button and/or via right click on the+ icon
Filename
constants.lua
core.lua
helper.lua
options.lua
diff --git a/constants.lua b/constants.lua
index 5c89733..24dd98c 100644
--- a/constants.lua
+++ b/constants.lua
@@ -98,6 +98,7 @@ BrokerGarbage.quality = {
 	[4] = select(4,GetItemQualityColor(4))..ITEM_QUALITY4_DESC.."|r",	-- purple
 	[5] = select(4,GetItemQualityColor(5))..ITEM_QUALITY5_DESC.."|r",	-- legendary
 	[6] = select(4,GetItemQualityColor(6))..ITEM_QUALITY6_DESC.."|r",	-- heirloom
+	[7] = select(4,GetItemQualityColor(7))..ITEM_QUALITY6_DESC.."|r",	-- artifact
 }

 BrokerGarbage.tradeSkills = {
diff --git a/core.lua b/core.lua
index 3aead83..ca38894 100644
--- a/core.lua
+++ b/core.lua
@@ -69,6 +69,7 @@ local function eventHandler(self, event, ...)
 	elseif event == "MERCHANT_SHOW" then
 		BrokerGarbage.isAtVendor = true

+		BrokerGarbage:UpdateRepairButton()
 		local disable = BrokerGarbage.disableKey[BG_GlobalDB.disableKey]
 		if not (disable and disable()) then
 			BrokerGarbage:AutoRepair()
@@ -463,19 +464,25 @@ function BrokerGarbage:GetSingleItemValue(item)
 				end
 				DEMats = Enchantrix.Constants.baseDisenchantTable[itemQuality][itemType][itemLevel]

-				local item, chance, amount, itemVal
-				for i = 1, #DEMats do
-					item = DEMats[i][1]
-					chance = DEMats[i][2]
-					amount = DEMats[i][3]
-
-					itemVal = select(2, GetItemInfo(item))
-					itemVal = AucAdvanced.API.GetMarketValue(itemVal) or 0
-
-					disenchantPrice = disenchantPrice + (itemVal * chance * amount)
+				if DEMats then
+					local item, chance, amount, itemVal
+					for i = 1, #DEMats do
+						item = DEMats[i][1]
+						chance = DEMats[i][2]
+						amount = DEMats[i][3]
+
+						itemVal = select(2, GetItemInfo(item))
+						itemVal = AucAdvanced.API.GetMarketValue(itemLink) or 0
+
+						disenchantPrice = disenchantPrice + (itemVal * chance * amount)
+					end
+					disenchantPrice = math.floor(disenchantPrice)
+				else
+					BrokerGarbage:Debug("Tried to get Enchantrix value of " .. itemLink .. " but failed.")
+					disenchantPrice = nil
 				end
-				disenchantPrice = math.floor(disenchantPrice)
 			else
+				BrokerGarbage:Debug("Invalid item quality for Enchantrix values of " .. itemLink .. ".")
 				disenchantPrice = nil
 			end
 		end
diff --git a/helper.lua b/helper.lua
index 8dea1d1..b78d3ee 100644
--- a/helper.lua
+++ b/helper.lua
@@ -85,7 +85,10 @@ function BrokerGarbage:CheckSettings()
 		end
 	end

-	if not BG_LocalDB then BG_LocalDB = {}; first = false end
+	if not BG_LocalDB then
+		BG_LocalDB = {}
+		if not first then first = false end
+	end
 	for key, value in pairs(BrokerGarbage.defaultLocalSettings) do
 		if BG_LocalDB[key] == nil then
 			BG_LocalDB[key] = value
diff --git a/options.lua b/options.lua
index 72311b6..3abf2b6 100644
--- a/options.lua
+++ b/options.lua
@@ -420,7 +420,7 @@ local function ShowOptions(frame)
 		BG_GlobalDB.showEarned = not BG_GlobalDB.showEarned
 	end)

-	local quality = LibStub("tekKonfig-Slider").new(BrokerGarbage.basicOptions, BrokerGarbage.locale.dropQualityTitle, 0, 6, "TOPLEFT", showlost, "BOTTOMLEFT", 5, -10)
+	local quality = LibStub("tekKonfig-Slider").new(BrokerGarbage.basicOptions, BrokerGarbage.locale.dropQualityTitle, 0, 7, "TOPLEFT", showlost, "BOTTOMLEFT", 5, -10)
 	quality.tiptext = BrokerGarbage.locale.dropQualityText
 	quality:SetWidth(200)
 	quality:SetValueStep(1)