Quantcast

Signed-off-by: kibsgaard <kibsgaard@curseforge.com>

kibsgaard [11-04-14 - 16:22]
Signed-off-by: kibsgaard <kibsgaard@curseforge.com>
Filename
KibsItemLevel.lua
libs/LibItemUpgradeInfo-1.0/Changelog-LibItemUpgradeInfo-1.0-v1.0.6.txt
libs/LibItemUpgradeInfo-1.0/Changelog-LibItemUpgradeInfo-1.0-v1.0.7.txt
libs/LibItemUpgradeInfo-1.0/Core.lua
libs/LibItemUpgradeInfo-1.0/LibItemUpgradeInfo-1.0.toc
libs/LibItemUpgradeInfo-1.0/LibStub/LibStub.toc
diff --git a/KibsItemLevel.lua b/KibsItemLevel.lua
index c1052d3..6bc8c72 100644
--- a/KibsItemLevel.lua
+++ b/KibsItemLevel.lua
@@ -14,11 +14,44 @@ local ItemUpgradeInfo = LibStub("LibItemUpgradeInfo-1.0");
 local ilvlFrame = CreateFrame("frame");
 local iconSize = 16;
 local iconOffset = 18;
-local fontStyle = "SystemFont_Med1";
+local fontStyle = "SystemFont_Small";
 local UpdateInProgress = false;
 local UpdateInProgressInspect = false;
 ilvlFrame:RegisterEvent("VARIABLES_LOADED");

+--Layout Helpers
+local slotID = {1,2,3,15,5,4,18,9,10,6,7,8,11,12,13,14,16,17} ;
+
+local InvSlotID = { 1,2,3,6,5,10,11,12,8,9,13,14,15,16,4,17,18,7 };
+
+local slotAlign1 = {	"TOPLEFT","TOPLEFT","TOPLEFT","TOPLEFT","TOPLEFT","TOPLEFT","TOPLEFT","TOPLEFT",
+			"TOPRIGHT","TOPRIGHT","TOPRIGHT","TOPRIGHT","TOPRIGHT","TOPRIGHT","TOPRIGHT","TOPRIGHT",
+			"BOTTOMRIGHT","BOTTOMLEFT" }
+local slotAlign2 = {	"TOPRIGHT","TOPRIGHT","TOPRIGHT","TOPRIGHT","TOPRIGHT","TOPRIGHT","TOPRIGHT","TOPRIGHT",
+			"TOPLEFT","TOPLEFT","TOPLEFT","TOPLEFT","TOPLEFT","TOPLEFT","TOPLEFT","TOPLEFT",
+			"BOTTOMLEFT","BOTTOMRIGHT" }
+local slotOffsetx = { 10, 10, 10, 10, 10, 10, 10, 10,
+			-10, -10, -10, -10, -10, -10, -10, -10,
+			-7, 7 } ;
+
+local slotOffsety = { -5, -5, -5, -5, -5, -5, -5, 2,
+			-5, -5, -5, -5, -5, -5, -5, 2,
+			-7, -7 } ;
+
+local iconAlign1 = {	"TOPLEFT","TOPLEFT","TOPLEFT","TOPLEFT","TOPLEFT","TOPLEFT","TOPLEFT","TOPLEFT",
+			"TOPRIGHT","TOPRIGHT","TOPRIGHT","TOPRIGHT","TOPRIGHT","TOPRIGHT","TOPRIGHT","TOPRIGHT",
+			"BOTTOMRIGHT","BOTTOMLEFT" }
+local iconAlign2 = {	"BOTTOMLEFT","BOTTOMLEFT","BOTTOMLEFT","BOTTOMLEFT","BOTTOMLEFT","BOTTOMLEFT","BOTTOMLEFT","BOTTOMLEFT",
+			"BOTTOMRIGHT","BOTTOMRIGHT","BOTTOMRIGHT","BOTTOMRIGHT","BOTTOMRIGHT","BOTTOMRIGHT","BOTTOMRIGHT","BOTTOMRIGHT",
+			"TOPRIGHT","TOPLEFT" }
+local iconOffsetx = { iconOffset, iconOffset, iconOffset, iconOffset, iconOffset, iconOffset, iconOffset, iconOffset,
+			-iconOffset, -iconOffset, -iconOffset, -iconOffset, -iconOffset, -iconOffset, -iconOffset, -iconOffset,
+			-iconOffset, iconOffset } ;
+
+local iconOffsety = { -2, -2, -2, -2, -2, -2, -2, -2,
+			 -2, -2, -2, -2, -2, -2, -2, -2,
+			2, 2 } ;
+
 -- Globals
 KIL_UpdateInterval = 1.0;
 KibsItemLevel_variablesLoaded = false;
@@ -41,7 +74,7 @@ local emptySockets = { ["Meta "]    = "INTERFACE/ITEMSOCKETINGFRAME/UI-EmptySock
 					  ["Prismatic "]  = "INTERFACE/ITEMSOCKETINGFRAME/UI-EmptySocket-Prismatic",
                     } ;

-local enchatableItems={ [ 1  ] = nil,
+local enchantableItems={ [ 1  ] = nil,
 						[ 2  ] = nil,
 						[ 3  ] = true,
 						[ 15 ] = true,
@@ -67,11 +100,22 @@ end
 function KIL_OnShow(self,...)
 	if(KibsItemLevel_variablesLoaded)then
 		if(KibsItemLevelConfig.Character) then
-			findItemInfo("player");
+			UpdateInProgress = true;
+			updatePlayer();
 		end
 	end
 end

+function updatePlayer()
+	if (KibsItemLevelConfig.Character) then
+		findItemInfo("player");
+	end
+end
+
+function updateInspect()
+	findItemInfo(InspectFrame.unit);
+end
+
 function KIL_OnUpdate(self, elapsed)
 	self.TimeSinceLastUpdate = self.TimeSinceLastUpdate + elapsed;

@@ -120,31 +164,32 @@ end

 function eventHandler(self,event,...)
 	--print(UnitGroupRolesAssigned("target"));
+
+
 	if(KibsItemLevelConfig.on)then
 		if (event == "INSPECT_READY" and KibsItemLevelConfig.Inspection) then
 			if(InspectFrame.unit)then
 				if(UpdateInProgressInspect == false) then
-					findItemInfo(InspectFrame.unit);
-					KIL_wait(1.5,findItemInfo,InspectFrame.unit);
-					KIL_wait(3,findItemInfo,InspectFrame.unit);
-					KIL_wait(5,findItemInfo,InspectFrame.unit);
-					KIL_wait(8,findItemInfo,InspectFrame.unit);
+					C_Timer.After(0.5,updateInspect);
+					C_Timer.After(1.5,updateInspect);
+					C_Timer.After(3,updateInspect);
+					C_Timer.After(5,updateInspect);
+					C_Timer.After(8,updateInspect);
 					UpdateInProgressInspect = true;
 				end
 			end
 		elseif(KibsItemLevelConfig.Character) then

 			if(UpdateInProgress == false) then
-			UpdateInProgress = true;
-			KIL_wait(0.2,findItemInfo,"player");
+				UpdateInProgress = true;
+				C_Timer.After(0.2,updatePlayer);

 			end
 		end
 	end
 end
---Register Event Handler
-

+--Register Event Handler
 function setupEventHandler(self,event,...)
 	if (event == "VARIABLES_LOADED") then
 		KibsItemLevelFrame_VARIABLES_LOADED();
@@ -157,12 +202,13 @@ function setupEventHandler(self,event,...)
 		ilvlFrame:SetScript("OnEvent",eventHandler);
 		KILFrame:SetScript("OnShow",KIL_OnShow);
 		if(KibsItemLevelConfig.Character)then
-			KIL_wait(0.2,findItemInfo,"player");
+			C_Timer.After(0.2,updatePlayer);
 		end
 	end
 end
 ilvlFrame:SetScript("OnEvent",setupEventHandler);

+--Create Config Panel
 function KibsItemLevelFrame_VARIABLES_LOADED()
 	if(KibsItemLevel_variablesLoaded)then
 		return;
@@ -212,31 +258,35 @@ function KibsItemLevelFrame_VARIABLES_LOADED()
 	_G[b3:GetName() .. "Text"]:SetText("Show on Inspection Frame");
 	b3:SetScript("OnClick", function(self, button, isDown) if ( self:GetChecked() ) then KibsItemLevelConfig.Inspection = true; cleanUp(); else KibsItemLevelConfig.Inspection = false; cleanUp(); end end)

+
 	cleanUp();

 	InterfaceOptions_AddCategory(ConfigPanel);
 end

 function cleanUp()
-	for i = 1, 17 do
-		if(FontStrings[i])then
-			FontStrings[i]:SetText("");
-			EnchantIcons[i].texture:SetAlpha(0.0);
-			EnchantIcons[i]:SetScript("OnEnter",nil);
+
+	--No need to clean up anymore. It is now done per-item when needed.
+
+	--for i = 1, 17 do
+		--if(FontStrings[i])then
+			--FontStrings[i]:SetText("");
+			--EnchantIcons[i].texture:SetAlpha(0.0);
+			--EnchantIcons[i]:SetScript("OnEnter",nil);

-			InspectFontStrings[i]:SetText("");
-			InspectEnchantIcons[i].texture:SetAlpha(0.0);
-			InspectEnchantIcons[i]:SetScript("OnEnter",nil);
+			--InspectFontStrings[i]:SetText("");
+			--InspectEnchantIcons[i].texture:SetAlpha(0.0);
+			--InspectEnchantIcons[i]:SetScript("OnEnter",nil);

-			local slotID = (i - 1) * 3 + 1;
-			for j = slotID, slotID + 2 do
-				Icons[j].texture:SetAlpha(0.0);
-				Icons[j]:SetScript("OnEnter",nil);
-				InspectIcons[j].texture:SetAlpha(0.0);
-				InspectIcons[j]:SetScript("OnEnter",nil);
-			end
-		end
-	end
+		--	local slotID = (i - 1) * 3 + 1;
+		--	for j = slotID, slotID + 2 do
+				--Icons[j].texture:SetAlpha(0.0);
+				--Icons[j]:SetScript("OnEnter",nil);
+				--InspectIcons[j].texture:SetAlpha(0.0);
+				--InspectIcons[j]:SetScript("OnEnter",nil);
+		--	end
+		--end
+	--end

 	eventHandler(self,"PLAYER_EQUIPMENT_CHANGED");
 end
@@ -245,8 +295,7 @@ function findItemInfo(who)
 	if not (who) then
 		return
 	end
-	local tilvl = 0;
-	local numItems = 0;
+
 	if (who == "player") then
 		ActiveFontStrings = FontStrings;
 		ActiveIcons = Icons;
@@ -259,55 +308,42 @@ function findItemInfo(who)
 		UpdateInProgressInspect = false;
 	end

+	local tilvl = 0;
+	local numItems = 15;
+
 	GameTooltip:Hide();
+
 	for i = 1, 17 do
+
 		if (ActiveFontStrings[i]) then
-			local slotID = (i - 1) * 3 + 1;
-			for i = slotID, slotID + 2 do
-				ActiveIcons[i].texture:SetAlpha(0.0);
-				ActiveIcons[i]:SetScript("OnEnter",nil);
-			end
-			ActiveEnchantIcons[i].texture:SetAlpha(0.0);
-			ActiveEnchantIcons[i]:SetScript("OnEnter",nil);
-
-			local itemlink=GetInventoryItemLink(who,i)
-			local enchantInfo;
+			local itemlink = GetInventoryItemLink(who,i)
+
 			if (itemlink) then
-				local upgrade, max, delta = ItemUpgradeInfo:GetItemUpgradeInfo(itemlink)
-				local ilvl = ItemUpgradeInfo:GetUpgradedItemLevel(itemlink)
-				if not(ilvl) then ilvl = 0; end
-
-				findSockets(who,i,slotID);
+
+				if(i == 17) then
+					numItems = numItems + 1;
+				end

-				numItems = numItems + 1;
-				local line = "";
 				GameTooltip:SetOwner(ilvlFrame,"CENTER");
 				GameTooltip:SetHyperlink(itemlink);
-				for i = 2, GameTooltip:NumLines() do
-					line = _G[GameTooltip:GetName().."TextLeft"..i];
-					if (line) then
-						line = line:GetText();
-						if (line) then
-							if (line:find(ENCHANTED)) then
-								enchantInfo = line;
-							elseif(ilvl == 1) then
-								if(line:match("Requires level")) then
-									local n = line:sub(line:find("%(") + 1,line:find("%)") - 1);
-									if n then
-										n = tonumber(n);
-										if n > 80 then
-											n = (( n - 80) * 26.6) + 200;
-										elseif n > 70 then
-											n = (( n - 70) * 10) + 100;
-										elseif n > 60 then
-											n = (( n - 60) * 4) + 60;
-										end
-										ilvl = n ;
-									end
-								end
-							end
-						end
-					end
+
+				--Find Enchants
+				if(enchantableItems[i]) then
+					getEnchant(i);
+				end
+
+				--Find Gems
+				findSockets(who,i);
+
+				--Find ilvl
+				local upgrade, max, delta = ItemUpgradeInfo:GetItemUpgradeInfo(itemlink)
+				local ilvl = ItemUpgradeInfo:GetUpgradedItemLevel(itemlink)
+				if not(ilvl) then
+					ilvl = 0;
+				end
+
+				if (ilvl == 1) then
+					ilvl = findHeirloomilvl();
 				end

 				if (upgrade and KibsItemLevelConfig.upgrades) then
@@ -320,40 +356,86 @@ function findItemInfo(who)
 					tilvl = tilvl + ilvl;
 				end

-				if(enchantInfo) then
-					ActiveEnchantIcons[i].texture:SetTexture("INTERFACE/ICONS/INV_Jewelry_Talisman_08");
-					ActiveEnchantIcons[i].texture:SetAlpha(1.0);
-					ActiveEnchantIcons[i]:SetScript("OnEnter",function(s,m)
-						GameTooltip:SetOwner(UIParent, "ANCHOR_CURSOR");
-						GameTooltip:ClearLines();
-						GameTooltip:AddLine(enchantInfo);
-						GameTooltip:Show();
-						end);
-					ActiveEnchantIcons[i]:SetScript("OnLeave",function(s,m)
-						GameTooltip:Hide();
-						end);
-
-				elseif (enchatableItems[i]) then
-					ActiveEnchantIcons[i].texture:SetTexture("INTERFACE/ICONS/INV_Jewelry_Talisman_08");
-					ActiveEnchantIcons[i].texture:SetAlpha(0.5);
-				else
-					ActiveEnchantIcons[i].texture:SetTexture(0,0,0,0);
-				end
 			else
-				ActiveFontStrings[i]:SetText("")
-				if(i ~= 17) then
-					numItems = numItems + 1;
+				if(FontStrings[i])then
+					ActiveFontStrings[i]:SetText("");
+					if (enchantableItems[i]) then
+						ActiveEnchantIcons[i].texture:SetAlpha(0.0);
+						ActiveEnchantIcons[i]:SetScript("OnEnter",nil);
+					end
+					local slotID = (i - 1) * 3 + 1;
+					for j = slotID, slotID + 2 do
+						ActiveIcons[j].texture:SetAlpha(0.0);
+						ActiveIcons[j]:SetScript("OnEnter",nil);
+					end
 				end
-			end
+			end
 		end
 	end
+
 	if(who ~= "player") then
 		InspectAilvl:SetText("ilvl: "..math.floor(tilvl / numItems));
 	end
+
 	GameTooltip:Hide();
 end

-function findSockets(who,slot,slotID)
+function getEnchant(i)
+
+	--Look for enchants
+	local enchantInfo;
+	local line = "";
+	for i = 2, GameTooltip:NumLines() do
+		line = _G[GameTooltip:GetName().."TextLeft"..i];
+		if (line) then
+			line = line:GetText();
+			if (line) then
+				if (line:find(ENCHANTED)) then
+					enchantInfo = line;
+					break;
+				end
+			end
+		end
+	end
+
+	--Did we find any enchants?
+	if(enchantInfo) then
+		ActiveEnchantIcons[i].texture:SetTexture("INTERFACE/ICONS/INV_Jewelry_Talisman_08");
+		ActiveEnchantIcons[i].texture:SetAlpha(1.0);
+		ActiveEnchantIcons[i]:SetScript("OnEnter",function(s,m)
+			GameTooltip:SetOwner(UIParent, "ANCHOR_CURSOR");
+			GameTooltip:ClearLines();
+			GameTooltip:AddLine(enchantInfo);
+			GameTooltip:Show();
+			end);
+		ActiveEnchantIcons[i]:SetScript("OnLeave",function(s,m)
+			GameTooltip:Hide();
+			end);
+	else
+		ActiveEnchantIcons[i].texture:SetAlpha(0.3);
+		ActiveEnchantIcons[i]:SetScript("OnEnter",nil);
+		ActiveEnchantIcons[i]:SetScript("OnLeave",nil);
+	end
+
+end
+
+function findHeirloomilvl()
+	local line = "";
+	for i = 2, GameTooltip:NumLines() do
+		line = _G[GameTooltip:GetName().."TextLeft"..i];
+		if (line) then
+			line = line:GetText();
+			if (line) then
+				if(line:match("Item Level")) then
+					return tonumber(line:match("%d+"));
+				end
+			end
+		end
+	end
+
+end
+
+function findSockets(who,slot)

 	local itemLink = GetInventoryItemLink(who,slot);
 	local _, _, Color, Ltype, itemID = string.find(itemLink, "|?c?f?f?(%x*)|?H?([^:]*):?(%d+):?(%d*):?(%d*):?(%d*):?(%d*):?(%d*):?(%-?%d*):?(%-?%d*):?(%d*):?(%d*)|?h?%[?([^%[%]]*)%]?|?h?|?r?")
@@ -367,7 +449,13 @@ function findSockets(who,slot,slotID)
 			GameTooltip:SetHyperlink(cleanItemLink);
 			local line;
 			local texturePath;
-			local sockets = slotID;
+			local GemSocketID = (slot - 1) * 3 + 1;
+			local sockets = GemSocketID;
+
+			for i = 1, 3 do
+				ActiveIcons[i+GemSocketID-1].texture:SetAlpha(0.0);
+			end
+
 			for i = 2, GameTooltip:NumLines() do
 				line = _G[GameTooltip:GetName().."TextLeft"..i];
 				if (line) then
@@ -386,7 +474,6 @@ function findSockets(who,slot,slotID)
 							--ActiveIcons[sockets].texture:SetAlpha(1.0);
 							--sockets = sockets + 1;
 						--end
-
 					end
 				end
 			end
@@ -395,14 +482,14 @@ function findSockets(who,slot,slotID)
 			for i = 1, 3 do
 				local _, itemLink = GetItemGem(GetInventoryItemLink(who,slot),i);
 				if (itemLink) then
-					ActiveIcons[i+slotID-1].texture:SetTexture(GetItemIcon(itemLink));
-					ActiveIcons[i+slotID-1].texture:SetAlpha(1.0);
-					ActiveIcons[i+slotID-1]:SetScript("OnEnter",function(s,m)
+					ActiveIcons[i+GemSocketID-1].texture:SetTexture(GetItemIcon(itemLink));
+					ActiveIcons[i+GemSocketID-1].texture:SetAlpha(1.0);
+					ActiveIcons[i+GemSocketID-1]:SetScript("OnEnter",function(s,m)
 						GameTooltip:SetOwner(UIParent, "ANCHOR_CURSOR");
 						GameTooltip:SetHyperlink(itemLink);
 						GameTooltip:Show();
 						end);
-					ActiveIcons[i+slotID-1]:SetScript("OnLeave",function(s,m)
+					ActiveIcons[i+GemSocketID-1]:SetScript("OnLeave",function(s,m)
 						GameTooltip:Hide();
 						end);
 				end
@@ -412,106 +499,95 @@ function findSockets(who,slot,slotID)

 end

---Layout Helpers
-local slotID = {1,2,3,15,5,4,18,9,10,6,7,8,11,12,13,14,16,17} ;
-local slotAlign1 = {	"TOPLEFT","TOPLEFT","TOPLEFT","TOPLEFT","TOPLEFT","TOPLEFT","TOPLEFT","TOPLEFT",
-			"TOPRIGHT","TOPRIGHT","TOPRIGHT","TOPRIGHT","TOPRIGHT","TOPRIGHT","TOPRIGHT","TOPRIGHT",
-			"BOTTOMRIGHT","BOTTOMLEFT" }
-local slotAlign2 = {	"TOPRIGHT","TOPRIGHT","TOPRIGHT","TOPRIGHT","TOPRIGHT","TOPRIGHT","TOPRIGHT","TOPRIGHT",
-			"TOPLEFT","TOPLEFT","TOPLEFT","TOPLEFT","TOPLEFT","TOPLEFT","TOPLEFT","TOPLEFT",
-			"BOTTOMLEFT","BOTTOMRIGHT" }
-local slotOffsetx = { 10, 10, 10, 10, 10, 10, 10, 10,
-			-10, -10, -10, -10, -10, -10, -10, -10,
-			-7, 7 } ;
-
-local slotOffsety = { -5, -5, -5, -5, -5, -5, -5, 2,
-			-5, -5, -5, -5, -5, -5, -5, 2,
-			-7, -7 } ;
-
-local iconAlign1 = {	"TOPLEFT","TOPLEFT","TOPLEFT","TOPLEFT","TOPLEFT","TOPLEFT","TOPLEFT","TOPLEFT",
-			"TOPRIGHT","TOPRIGHT","TOPRIGHT","TOPRIGHT","TOPRIGHT","TOPRIGHT","TOPRIGHT","TOPRIGHT",
-			"BOTTOMRIGHT","BOTTOMLEFT" }
-local iconAlign2 = {	"BOTTOMLEFT","BOTTOMLEFT","BOTTOMLEFT","BOTTOMLEFT","BOTTOMLEFT","BOTTOMLEFT","BOTTOMLEFT","BOTTOMLEFT",
-			"BOTTOMRIGHT","BOTTOMRIGHT","BOTTOMRIGHT","BOTTOMRIGHT","BOTTOMRIGHT","BOTTOMRIGHT","BOTTOMRIGHT","BOTTOMRIGHT",
-			"TOPRIGHT","TOPLEFT" }
-local iconOffsetx = { iconOffset, iconOffset, iconOffset, iconOffset, iconOffset, iconOffset, iconOffset, iconOffset,
-			-iconOffset, -iconOffset, -iconOffset, -iconOffset, -iconOffset, -iconOffset, -iconOffset, -iconOffset,
-			-iconOffset, iconOffset } ;
-
-local iconOffsety = { -2, -2, -2, -2, -2, -2, -2, -2,
-			 -2, -2, -2, -2, -2, -2, -2, -2,
-			2, 2 } ;
-
---Create Font Strings
+--Create Font Strings and Icons
 function createFontStrings()
 	local kids = { PaperDollItemsFrame:GetChildren() };
-	for i = 1, 18 do
-		if not (i == 6 or i == 7) then --exclude 6 and 7, shirt and tabard
-			local ID = slotID[i];
-			FontStrings[ID] = kids[i]:CreateFontString("KILFrame_"..slotID[i], "OVERLAY", fontStyle)
-			--FontStrings[ID]:SetParent(PaperDollItemsFrame)
-			FontStrings[ID]:SetText(ID)
-			FontStrings[ID]:SetPoint(slotAlign1[i], kids[i], slotAlign2[i] , slotOffsetx[i], slotOffsety[i])
+	for i = 1, 17 do
+		if not (i == 4) then --exclude 4 and 18, shirt and tabard
+			local SlotID = InvSlotID[i];
+			FontStrings[i] = kids[SlotID]:CreateFontString("KILFrame_"..SlotID, "OVERLAY", fontStyle)
+			--FontStrings[i]:SetParent(PaperDollItemsFrame)
+			FontStrings[i]:SetText("")
+			FontStrings[i]:SetPoint(slotAlign1[SlotID], kids[SlotID], slotAlign2[SlotID] , slotOffsetx[SlotID], slotOffsety[SlotID])
+

+			local offset = 0;

-			EnchantIcons[ID] = CreateFrame("Frame","EnchantIcon"..i,kids[i]);
-			EnchantIcons[ID]:SetPoint(iconAlign1[i],FontStrings[ID],iconAlign2[i], 0, iconOffsety[i]);
-			EnchantIcons[ID]:SetSize(iconSize,iconSize);
-			local texture = EnchantIcons[ID]:CreateTexture("EnchantIconTex"..i,"OVERLAY");
-			texture:SetAllPoints();
-			EnchantIcons[ID].texture = texture;
-			--EnchantIcons[ID].texture:SetTexture(1,1,0,1);
+			if(enchantableItems[i]) then
+				--Offset gems to make space for enchants;
+				offset = iconOffsetx[SlotID];
+
+				EnchantIcons[i] = CreateFrame("Frame","EnchantIcon"..i,kids[SlotID]);
+				EnchantIcons[i]:SetPoint(iconAlign1[SlotID],FontStrings[i],iconAlign2[SlotID], 0, iconOffsety[SlotID]);
+				EnchantIcons[i]:SetSize(iconSize,iconSize);
+
+				local texture = EnchantIcons[i]:CreateTexture("EnchantIconTex"..i,"OVERLAY");
+				texture:SetAllPoints();
+				EnchantIcons[i].texture = texture;
+				EnchantIcons[i].texture:SetTexture("INTERFACE/ICONS/INV_Jewelry_Talisman_08");
+				EnchantIcons[i].texture:SetAlpha(0.0);
+			end

-			local offset = iconOffsetx[i];
-			local iconSlotID = (ID-1) * 3 + 1;
+			local iconSlotID = (i-1) * 3 + 1;
 			for j = iconSlotID, iconSlotID + 2 do
-				Icons[j] = CreateFrame("Frame","GemIcon"..j,kids[i]);
-				Icons[j]:SetPoint(iconAlign1[i],FontStrings[ID],iconAlign2[i], offset, iconOffsety[i]);
+				Icons[j] = CreateFrame("Frame","GemIcon"..j,kids[SlotID]);
+				Icons[j]:SetPoint(iconAlign1[SlotID],FontStrings[i],iconAlign2[SlotID], offset, iconOffsety[SlotID]);
 				Icons[j]:SetSize(iconSize,iconSize);
 				local texture = Icons[j]:CreateTexture("GemIconTex"..j,"OVERLAY");
 				texture:SetAllPoints();
 				Icons[j].texture = texture;
-				--Icons[j].texture:SetTexture(1,1,0,1);
-				offset = offset + iconOffsetx[i];
+				Icons[j].texture:SetTexture(emptySockets["Prismatic "]);
+				Icons[j].texture:SetAlpha(0.0);
+				offset = offset + iconOffsetx[SlotID];
 			end
-
-
 		end
 	end
 end

+--Create Font Strings and Icons for the Inspection Window
 function createInspectFontStrings()
 	local kids = { InspectPaperDollItemsFrame:GetChildren() };
-	for i = 1, 18 do
-		if not (i == 6 or i == 7) then --exclude 6 and 7, shirt and tabard
-			local ID = slotID[i];
-			InspectFontStrings[ID] = kids[i]:CreateFontString("KILFrame_Inspect_"..slotID[i], "OVERLAY", fontStyle)
-			--FontStrings[ID]:SetParent(PaperDollItemsFrame)
-			InspectFontStrings[ID]:SetText(ID)
-			InspectFontStrings[ID]:SetPoint(slotAlign1[i], kids[i], slotAlign2[i] , slotOffsetx[i], slotOffsety[i])
+	for i = 1, 17 do
+		if not (i == 4) then --exclude 4 and 18, shirt and tabard
+			local SlotID = InvSlotID[i];
+			InspectFontStrings[i] = kids[SlotID]:CreateFontString("KILFrame_"..SlotID, "OVERLAY", fontStyle)
+			--InspectFontStrings[i]:SetParent(PaperDollItemsFrame)
+			InspectFontStrings[i]:SetText("")
+			InspectFontStrings[i]:SetPoint(slotAlign1[SlotID], kids[SlotID], slotAlign2[SlotID] , slotOffsetx[SlotID], slotOffsety[SlotID])
+

-			InspectEnchantIcons[ID] = CreateFrame("Frame","InspectEnchantIcon"..i,kids[i]);
-			InspectEnchantIcons[ID]:SetPoint(iconAlign1[i],InspectFontStrings[ID],iconAlign2[i], 0, iconOffsety[i]);
-			InspectEnchantIcons[ID]:SetSize(iconSize,iconSize);
-			local texture = InspectEnchantIcons[ID]:CreateTexture("InspectEnchantIconTex"..i,"OVERLAY");
-			texture:SetAllPoints();
-			InspectEnchantIcons[ID].texture = texture;
-			--InspectEnchantIcons[ID].texture:SetTexture(1,1,0,1);
-
-			local iconSlotID = (ID-1) * 3 + 1;
-			local offset = iconOffsetx[i];
+			local offset = 0;
+
+			if(enchantableItems[i]) then
+				--Offset gems to make space for enchants;
+				offset = iconOffsetx[SlotID];
+
+				InspectEnchantIcons[i] = CreateFrame("Frame","EnchantIcon"..i,kids[SlotID]);
+				InspectEnchantIcons[i]:SetPoint(iconAlign1[SlotID],InspectFontStrings[i],iconAlign2[SlotID], 0, iconOffsety[SlotID]);
+				InspectEnchantIcons[i]:SetSize(iconSize,iconSize);
+
+				local texture = InspectEnchantIcons[i]:CreateTexture("EnchantIconTex"..i,"OVERLAY");
+				texture:SetAllPoints();
+				InspectEnchantIcons[i].texture = texture;
+				InspectEnchantIcons[i].texture:SetTexture("INTERFACE/ICONS/INV_Jewelry_Talisman_08");
+				InspectEnchantIcons[i].texture:SetAlpha(0.0);
+			end
+
+			local iconSlotID = (i-1) * 3 + 1;
 			for j = iconSlotID, iconSlotID + 2 do
-				InspectIcons[j] = CreateFrame("Frame","InspectGemIcon"..j,kids[i]);
-				InspectIcons[j]:SetPoint(iconAlign1[i],InspectFontStrings[ID],iconAlign2[i], offset, iconOffsety[i]);
+				InspectIcons[j] = CreateFrame("Frame","GemIcon"..j,kids[SlotID]);
+				InspectIcons[j]:SetPoint(iconAlign1[SlotID],InspectFontStrings[i],iconAlign2[SlotID], offset, iconOffsety[SlotID]);
 				InspectIcons[j]:SetSize(iconSize,iconSize);
-				local texture = InspectIcons[j]:CreateTexture("InspectGemIconTex"..j,"OVERLAY");
+				local texture = InspectIcons[j]:CreateTexture("GemIconTex"..j,"OVERLAY");
 				texture:SetAllPoints();
 				InspectIcons[j].texture = texture;
-				--InspectIcons[j].texture:SetTexture(1,1,0,1);
-				offset = offset + iconOffsetx[i];
+				InspectIcons[j].texture:SetTexture(emptySockets["Prismatic "]);
+				InspectIcons[j].texture:SetAlpha(0.0);
+
+				offset = offset + iconOffsetx[SlotID];
 			end
 		end
-	end
+	end

 	InspectAilvl = InspectPaperDollItemsFrame:CreateFontString("KILFrame_Inspect_Ailvl", "OVERLAY", fontStyle);
 	InspectAilvl:SetText("ilvl: 0");
diff --git a/libs/LibItemUpgradeInfo-1.0/Changelog-LibItemUpgradeInfo-1.0-v1.0.6.txt b/libs/LibItemUpgradeInfo-1.0/Changelog-LibItemUpgradeInfo-1.0-v1.0.6.txt
deleted file mode 100644
index 3020055..0000000
--- a/libs/LibItemUpgradeInfo-1.0/Changelog-LibItemUpgradeInfo-1.0-v1.0.6.txt
+++ /dev/null
@@ -1,13 +0,0 @@
-tag v1.0.6
-f0f2c50a2e359738133297add375a1e734eac3b3
-Kevin Ballard <kevin@sb.org>
-2014-05-20 18:14:03 -0700
-
-Tagging as v1.0.6
-
-
---------------------
-
-Kevin Ballard:
-	- Add upgrade info for 5.4.8
-	Bump version to v1.0.6.
diff --git a/libs/LibItemUpgradeInfo-1.0/Changelog-LibItemUpgradeInfo-1.0-v1.0.7.txt b/libs/LibItemUpgradeInfo-1.0/Changelog-LibItemUpgradeInfo-1.0-v1.0.7.txt
new file mode 100644
index 0000000..26cd3aa
--- /dev/null
+++ b/libs/LibItemUpgradeInfo-1.0/Changelog-LibItemUpgradeInfo-1.0-v1.0.7.txt
@@ -0,0 +1,14 @@
+tag v1.0.7
+71a6a7eb54d261e2d57c7b056305a71a5ceaaf56
+Kevin Ballard <kevin@sb.org>
+2014-10-17 00:59:32 -0700
+
+Tagging as v1.0.7
+
+
+--------------------
+
+Kevin Ballard:
+	- Bump TOC for 6.0 and version to 1.0.7
+	- Update item upgrade table for 6.0
+	- Update itemlink parsing for 6.0
diff --git a/libs/LibItemUpgradeInfo-1.0/Core.lua b/libs/LibItemUpgradeInfo-1.0/Core.lua
index 8b9c458..1c674aa 100644
--- a/libs/LibItemUpgradeInfo-1.0/Core.lua
+++ b/libs/LibItemUpgradeInfo-1.0/Core.lua
@@ -1,12 +1,12 @@
-local MAJOR, MINOR = "LibItemUpgradeInfo-1.0", 4
+local MAJOR, MINOR = "LibItemUpgradeInfo-1.0", 5

 local lib = _G.LibStub:NewLibrary(MAJOR, MINOR)
 if not lib then return end

 local upgradeTable = {
 	[  1] = { upgrade = 1, max = 1, ilevel = 8 },
-	[373] = { upgrade = 1, max = 2, ilevel = 4 },
-	[374] = { upgrade = 2, max = 2, ilevel = 8 },
+	[373] = { upgrade = 1, max = 3, ilevel = 4 },
+	[374] = { upgrade = 2, max = 3, ilevel = 8 },
 	[375] = { upgrade = 1, max = 3, ilevel = 4 },
 	[376] = { upgrade = 2, max = 3, ilevel = 4 },
 	[377] = { upgrade = 3, max = 3, ilevel = 4 },
@@ -44,6 +44,7 @@ local upgradeTable = {
 	[496] = { upgrade = 2, max = 6, ilevel = 8 },
 	[497] = { upgrade = 3, max = 6, ilevel = 12 },
 	[498] = { upgrade = 4, max = 6, ilevel = 16 },
+	[503] = { upgrade = 3, max = 3, ilevel = 1 },
 	[504] = { upgrade = 3, max = 4, ilevel = 12 },
 	[505] = { upgrade = 4, max = 4, ilevel = 16 },
 	[506] = { upgrade = 5, max = 6, ilevel = 20 },
@@ -260,10 +261,10 @@ do
 			debugTooltip:SetOwner(_G.WorldFrame, "ANCHOR_NONE")
 		end
 		newTable = {}
-		local itemLink = "|cff0070dd|Hitem:89551:0:0:0:0:0:0:0:90:0:0|h[Aspirant's Staff of Harmony]|h|r"
+		local itemLink = "|cff0070dd|Hitem:89551:0:0:0:0:0:0:0:90:0|h[Aspirant's Staff of Harmony]|h|r"
 		local itemLevel = select(4, _G.GetItemInfo(itemLink))
 		assert(itemLevel, "Can't find item level for itemLink")
-		local count, max, batchsize = 0, 20000, 200
+		local count, max, batchsize = 0, 10000, 200
 		worker = function()
 			for i = count, math.min(max, count+batchsize) do
 				local link = itemLink:gsub("%d+|h", i.."|h")
diff --git a/libs/LibItemUpgradeInfo-1.0/LibItemUpgradeInfo-1.0.toc b/libs/LibItemUpgradeInfo-1.0/LibItemUpgradeInfo-1.0.toc
index 35ad51e..c037b14 100644
--- a/libs/LibItemUpgradeInfo-1.0/LibItemUpgradeInfo-1.0.toc
+++ b/libs/LibItemUpgradeInfo-1.0/LibItemUpgradeInfo-1.0.toc
@@ -2,9 +2,9 @@
 ## Title: Lib: ItemUpgradeInfo-1.0
 ## Notes: Database of item upgrade IDs
 ## Author: eridius
-## Version: 1.0.6
+## Version: 1.0.7
 ## X-Category: Library
-## X-Curse-Packaged-Version: v1.0.6
+## X-Curse-Packaged-Version: v1.0.7
 ## X-Curse-Project-Name: LibItemUpgradeInfo-1.0
 ## X-Curse-Project-ID: libitemupgradeinfo-1-0
 ## X-Curse-Repository-ID: wow/libitemupgradeinfo-1-0/mainline
diff --git a/libs/LibItemUpgradeInfo-1.0/LibStub/LibStub.toc b/libs/LibItemUpgradeInfo-1.0/LibStub/LibStub.toc
index f3dd6d7..8c6e39f 100644
--- a/libs/LibItemUpgradeInfo-1.0/LibStub/LibStub.toc
+++ b/libs/LibItemUpgradeInfo-1.0/LibStub/LibStub.toc
@@ -5,7 +5,7 @@
 ## X-Website: http://www.wowace.com/addons/libstub/
 ## X-Category: Library
 ## X-License: Public Domain
-## X-Curse-Packaged-Version: v1.0.6
+## X-Curse-Packaged-Version: v1.0.7
 ## X-Curse-Project-Name: LibItemUpgradeInfo-1.0
 ## X-Curse-Project-ID: libitemupgradeinfo-1-0
 ## X-Curse-Repository-ID: wow/libitemupgradeinfo-1-0/mainline