From 915f9c696e478b317290654dec9a24b8d11b9875 Mon Sep 17 00:00:00 2001 From: kibsgaard Date: Sun, 17 Aug 2014 23:50:08 +0200 Subject: [PATCH] Fixed lag-issues when changing a lot of gear at once. Inspection now updates even more times and now over 6 seconds (as the INSPECT_READY event is fired way too early) Fixed a nil-error while reading enchants (thanks bljakk) To-do - Localization - Colors on ilvl depending on rarity of the items Signed-off-by: kibsgaard --- KibsItemLevel.lua | 32 +++++++++++++++++++++++++------- 1 file changed, 25 insertions(+), 7 deletions(-) diff --git a/KibsItemLevel.lua b/KibsItemLevel.lua index 4b7c019..9ccf694 100644 --- a/KibsItemLevel.lua +++ b/KibsItemLevel.lua @@ -15,6 +15,8 @@ local ilvlFrame = CreateFrame("frame"); local iconSize = 16; local iconOffset = 18; local fontStyle = "SystemFont_Med1"; +local UpdateInProgress = false; +local UpdateInProgressInspect = false; ilvlFrame:RegisterEvent("VARIABLES_LOADED"); -- Globals @@ -28,6 +30,7 @@ local KibsItemLevelConfig_defaultOn = true; local KibsItemLevelConfig_defaultUpgrades = false; local KibsItemLevelConfig_defaultCharacter = true; local KibsItemLevelConfig_defaultInspection = true; +local KibsItemLevelConfig_defaultColor = true; @@ -94,13 +97,23 @@ function eventHandler(self,event,...) if(KibsItemLevelConfig.on)then if (event == "INSPECT_READY" and KibsItemLevelConfig.Inspection) then if(InspectFrame.unit)then - findItemInfo(InspectFrame.unit); - KIL_wait(1.5,findItemInfo,InspectFrame.unit); - KIL_wait(3,findItemInfo,InspectFrame.unit); + 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); + UpdateInProgressInspect = true; + end end elseif(KibsItemLevelConfig.Character) then - findItemInfo("player"); - KIL_wait(5,findItemInfo,"player"); + + if(UpdateInProgress == false) then + UpdateInProgress = true; + --findItemInfo("player"); + KIL_wait(0.2,findItemInfo,"player"); + KIL_wait(3,findItemInfo,"player"); + + end end end end @@ -205,10 +218,12 @@ function findItemInfo(who) ActiveFontStrings = FontStrings; ActiveIcons = Icons; ActiveEnchantIcons = EnchantIcons; + UpdateInProgress = false; else ActiveFontStrings = InspectFontStrings; ActiveIcons = InspectIcons; ActiveEnchantIcons = InspectEnchantIcons; + UpdateInProgressInspect = false; end GameTooltip:Hide(); @@ -232,6 +247,7 @@ function findItemInfo(who) ActiveFontStrings[i]:SetText(ilvl .." ("..upgrade.."/"..max..")") else ActiveFontStrings[i]:SetText(ilvl) + end findSockets(who,i,slotID); if(ilvl)then @@ -245,8 +261,10 @@ function findItemInfo(who) line = _G[GameTooltip:GetName().."TextLeft"..i]; if (line) then line = line:GetText(); - if (line:find("Enchanted:")) then - enchantInfo = line; + if (line) then + if (line:find("Enchanted:")) then + enchantInfo = line; + end end end end -- 1.7.9.5