Quantcast

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

kibsgaard [11-20-14 - 16:49]
Signed-off-by: kibsgaard <kibsgaard@curseforge.com>
Filename
KibsItemLevel.lua
diff --git a/KibsItemLevel.lua b/KibsItemLevel.lua
index 4fa2052..e6c4c14 100644
--- a/KibsItemLevel.lua
+++ b/KibsItemLevel.lua
@@ -331,6 +331,7 @@ function cleanUp()
 	eventHandler(self,"PLAYER_EQUIPMENT_CHANGED");
 end

+local ActiveEnchantableItems;
 function findItemInfo(who)
 	if not (who) then
 		return
@@ -341,13 +342,22 @@ function findItemInfo(who)
 		ActiveIcons = Icons;
 		ActiveEnchantIcons = EnchantIcons;
 		UpdateInProgress = false;
+		if(UnitLevel(who) < 91) then
+			ActiveEnchantableItems = enchantableItems90;
+		else
+			ActiveEnchantableItems = enchantableItems;
+		end
 	else
 		ActiveFontStrings = InspectFontStrings;
 		ActiveIcons = InspectIcons;
 		ActiveEnchantIcons = InspectEnchantIcons;
 		UpdateInProgressInspect = false;
+		ActiveEnchantableItems = enchantableItems;
 	end

+
+
+
 	local tilvl = 0;
 	local numItems = 15;

@@ -368,8 +378,8 @@ function findItemInfo(who)
 				GameTooltip:SetHyperlink(itemlink);

 				--Find Enchants
-				if(enchantableItems[i]) then
-					getEnchant(i);
+				if(ActiveEnchantableItems[i]) then
+					getEnchant(i,itemlink);
 				end

 				--Find Gems
@@ -409,7 +419,7 @@ function findItemInfo(who)
 			else
 				if(FontStrings[i])then
 					ActiveFontStrings[i]:SetText("");
-					if (enchantableItems[i]) then
+					if (ActiveEnchantableItems[i]) then
 						ActiveEnchantIcons[i].texture:SetAlpha(0.0);
 						ActiveEnchantIcons[i]:SetScript("OnEnter",nil);
 					end
@@ -430,7 +440,7 @@ function findItemInfo(who)
 	GameTooltip:Hide();
 end

-function getEnchant(i)
+function getEnchant(i,itemlink)

 	--Look for enchants
 	local enchantInfo;
@@ -442,22 +452,39 @@ function getEnchant(i)
 			if (line) then
 				if (line:find(ENCHANTED)) then
 					enchantInfo = line;
+
 					break;
 				end
 			end
 		end
 	end
+
+	local enchantID;
+
+	--if(enchantInfo) then
+ 	--	local _, _, Color, Ltype, Id, Enchant, Gem1, Gem2, Gem3, Gem4, Suffix, Unique, LinkLvl, Name =  string.find(itemlink,"|?c?f?f?(%x*)|?H?([^:]*):?(%d+):?(%d*):?(%d*):?(%d*):?(%d*):?(%d*):?(%-?%d*):?(%-?%d*):?(%d*):?(%d*):?(%-?%d*)|?h?%[?([^%[%]]*)%]?|?h?|?r?")
+	--	enchantID = Enchant;
+	--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);
+
+		--if(enchantID == "4442") then
+		--	ActiveEnchantIcons[i]:SetScript("OnEnter",function(s,m)
+		--		GameTooltip:SetOwner(UIParent, "ANCHOR_CURSOR");
+		--		GameTooltip:SetHyperlink("item:74724:0:0:0:0:0:0:0");
+		--		GameTooltip:Show();
+		--		end);
+		--else
+			ActiveEnchantIcons[i]:SetScript("OnEnter",function(s,m)
+				GameTooltip:SetOwner(UIParent, "ANCHOR_CURSOR");
+				GameTooltip:ClearLines();
+				GameTooltip:AddLine(enchantInfo);
+				GameTooltip:Show();
+				end);
+		--end
 		ActiveEnchantIcons[i]:SetScript("OnLeave",function(s,m)
 			GameTooltip:Hide();
 			end);
@@ -561,6 +588,13 @@ end
 --Create Font Strings and Icons
 function createFontStrings()
 	local kids = { PaperDollItemsFrame:GetChildren() };
+
+	if(UnitLevel("player") < 91) then
+		ActiveEnchantableItems = enchantableItems90;
+	else
+		ActiveEnchantableItems = enchantableItems;
+	end
+
 	for i = 1, 17 do
 		if not (i == 4) then --exclude 4 and 18, shirt and tabard
 			local SlotID = InvSlotID[i];
@@ -572,7 +606,7 @@ function createFontStrings()

 			local offset = 0;

-			if(enchantableItems[i]) then
+			if(ActiveEnchantableItems[i]) then
 				--Offset gems to make space for enchants;
 				offset = iconOffsetx[SlotID];