Quantcast

* reload unknown items on mouseover

ckaotik [12-01-10 - 00:35]
* reload unknown items on mouseover
Filename
Broker_Garbage.toc
helper.lua
options.lua
diff --git a/Broker_Garbage.toc b/Broker_Garbage.toc
index ac16baf..0934240 100644
--- a/Broker_Garbage.toc
+++ b/Broker_Garbage.toc
@@ -6,7 +6,7 @@

 ## Title: Broker_Garbage
 ## Notes: Full bags no more! Distinguish between junk and treasure, find items to drop quickly.
-## Notes-deDE: Endlich wieder Platz! Unterscheide Trödel von Schätzen und finde Items zum Wegwerfen.
+## Notes-deDE: Endlich wieder Platz! Unterscheide Trödel von Schätzen und finde billigen Müll.
 ## Author: ckaotik
 ## Version: 4.0v4
 ## X-Website: http://www.wowinterface.com/downloads/info15531-Broker_Garbage.html
diff --git a/helper.lua b/helper.lua
index a385454..3de577e 100644
--- a/helper.lua
+++ b/helper.lua
@@ -121,6 +121,7 @@ function BrokerGarbage:CreateDefaultLists(global)
 	local tradeSkills =  { GetProfessions() }
 	for i = 1, 6 do	-- we get at most 6 professions (2x primary, cooking, fishing, first aid, archeology)
 		local englishSkill, isGather = BrokerGarbage:UnLocalize(tradeSkills[i])
+		BrokerGarbage:Print("Found "..(englishSkill or "nil"))
 		if englishSkill then
 			if isGather then
 				BG_LocalDB.exclude["Tradeskill.Gather." .. englishSkill] = true
@@ -174,12 +175,15 @@ end

 -- returns original English names for non-English locales
 function BrokerGarbage:UnLocalize(skillName)
+	BrokerGarbage:Print("Checking "..(skillName or "nil"))
 	if not skillName then return nil, nil end
+	skillName = GetProfessionInfo(skillName)
+	BrokerGarbage:Print("Got name "..(skillName or "nil"))
 	if string.find(GetLocale(), "en") then return skillName end

 	-- crafting skills
 	local searchString = ""
-	for i = 2,12 do
+	for i = 2, 12 do
 		searchString = select(i, GetAuctionItemSubClasses(9))
 		if string.find(skillName, searchString) then
 			return BrokerGarbage.tradeSkills[i], false
diff --git a/options.lua b/options.lua
index 25f7aae..ca17efe 100644
--- a/options.lua
+++ b/options.lua
@@ -46,6 +46,7 @@ BrokerGarbage.listOptions.parent = "Broker_Garbage"
 -- button tooltip infos
 local function ShowTooltip(self)
 	GameTooltip:SetOwner(self, "ANCHOR_RIGHT")
+	-- LibPeriodicTable pretty tooltips
 	if self.tiptext and self:GetParent() == _G["BG_ListOptions_ScrollFrame"] and
 		not (self.itemID and string.find(self.tiptext, self.itemID)) then
 		local text = string.gsub(self.tiptext, "%.", " |cffffd200>|r ")
@@ -53,10 +54,17 @@ local function ShowTooltip(self)
 		GameTooltip:ClearLines()
 		GameTooltip:AddLine("LibPeriodicTable")
 		GameTooltip:AddLine(text, 1, 1, 1, true)
-	elseif self.tiptext then
-		GameTooltip:SetText(self.tiptext, nil, nil, nil, nil, true)
-	elseif self.itemLink then
-		GameTooltip:SetHyperlink(self.itemLink)
+	else	-- all other tooltips
+		local itemLink = self.itemLink or (self.itemID and select(2,GetItemInfo(self.itemID)))
+		if itemLink then
+			GameTooltip:SetHyperlink(itemLink)
+			if not self.itemLink and self:GetParent() == _G["BG_ListOptions_ScrollFrame"] then
+				-- we just got new data for this tooltip!
+				BrokerGarbage:ListOptionsUpdate()
+			end
+		elseif self.tiptext then
+			GameTooltip:SetText(self.tiptext, nil, nil, nil, nil, true)
+		end
 	end
 	GameTooltip:Show()
 end
@@ -1137,7 +1145,6 @@ local function ShowListOptions(frame)
 		else
 			BrokerGarbage:Print(string.format(BrokerGarbage.locale.itemAlreadyOnList, link))
 		end
-
 		BrokerGarbage:ScanInventory()
 		BrokerGarbage:UpdateRepairButton()
 	end