diff --git a/KibsItemLevel.lua b/KibsItemLevel.lua
index 5f84ada..c1052d3 100644
--- a/KibsItemLevel.lua
+++ b/KibsItemLevel.lua
@@ -20,20 +20,20 @@ local UpdateInProgressInspect = false;
ilvlFrame:RegisterEvent("VARIABLES_LOADED");
-- Globals
+KIL_UpdateInterval = 1.0;
KibsItemLevel_variablesLoaded = false;
KibsItemLevel_details = {
name = "KibsItemLevel",
frame = "ilvlFrame",
optionsframe = "KibsItemLevelConfigFrame"
};
+
local KibsItemLevelConfig_defaultOn = true;
local KibsItemLevelConfig_defaultUpgrades = false;
local KibsItemLevelConfig_defaultCharacter = true;
local KibsItemLevelConfig_defaultInspection = true;
local KibsItemLevelConfig_defaultColor = true;
-
-
local emptySockets = { ["Meta "] = "INTERFACE/ITEMSOCKETINGFRAME/UI-EmptySocket-Meta",
["Red "] = "INTERFACE/ITEMSOCKETINGFRAME/UI-EmptySocket-Red",
["Blue "] = "INTERFACE/ITEMSOCKETINGFRAME/UI-EmptySocket-Blue",
@@ -61,6 +61,30 @@ local enchatableItems={ [ 1 ] = nil,
function KibsItemLevel_OnLoad()
createFontStrings();
createInspectFontStrings();
+
+end
+
+function KIL_OnShow(self,...)
+ if(KibsItemLevel_variablesLoaded)then
+ if(KibsItemLevelConfig.Character) then
+ findItemInfo("player");
+ end
+ end
+end
+
+function KIL_OnUpdate(self, elapsed)
+ self.TimeSinceLastUpdate = self.TimeSinceLastUpdate + elapsed;
+
+ if(self.TimeSinceLastUpdate > KIL_UpdateInterval) then
+ if not(UnitAffectingCombat("player")) then
+ findItemInfo("player");
+ print("Update");
+ else
+ print("In Combat");
+ end
+ self.TimeSinceLastUpdate = 0;
+ end
+
end
local waitTable = {};
@@ -95,6 +119,7 @@ function KIL_wait(delay, func, ...)
end
function eventHandler(self,event,...)
+ --print(UnitGroupRolesAssigned("target"));
if(KibsItemLevelConfig.on)then
if (event == "INSPECT_READY" and KibsItemLevelConfig.Inspection) then
if(InspectFrame.unit)then
@@ -103,6 +128,7 @@ function eventHandler(self,event,...)
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);
UpdateInProgressInspect = true;
end
end
@@ -110,9 +136,7 @@ function eventHandler(self,event,...)
if(UpdateInProgress == false) then
UpdateInProgress = true;
- --findItemInfo("player");
KIL_wait(0.2,findItemInfo,"player");
- KIL_wait(3,findItemInfo,"player");
end
end
@@ -131,8 +155,10 @@ function setupEventHandler(self,event,...)
ilvlFrame:RegisterEvent("PLAYER_ENTERING_WORLD");
ilvlFrame:RegisterEvent("INSPECT_READY");
ilvlFrame:SetScript("OnEvent",eventHandler);
- --KIL_wait(0.2,findItemInfo,"player");
- findItemInfo("player");
+ KILFrame:SetScript("OnShow",KIL_OnShow);
+ if(KibsItemLevelConfig.Character)then
+ KIL_wait(0.2,findItemInfo,"player");
+ end
end
end
ilvlFrame:SetScript("OnEvent",setupEventHandler);
@@ -142,19 +168,20 @@ function KibsItemLevelFrame_VARIABLES_LOADED()
return;
end
KibsItemLevel_variablesLoaded = true;
- if (not KibsItemLevelConfig) then
+ if (KibsItemLevelConfig == nil) then
KibsItemLevelConfig = {};
end
- if (not KibsItemLevelConfig.on) then
+
+ if (KibsItemLevelConfig.on == nil) then
KibsItemLevelConfig.on = KibsItemLevelConfig_defaultOn;
end
- if (not KibsItemLevelConfig.upgrades) then
+ if (KibsItemLevelConfig.upgrades == nil) then
KibsItemLevelConfig.upgrades = KibsItemLevelConfig_defaultUpgrades;
end
- if (not KibsItemLevelConfig.Character) then
+ if (KibsItemLevelConfig.Character == nil) then
KibsItemLevelConfig.Character = KibsItemLevelConfig_defaultCharacter;
end
- if (not KibsItemLevelConfig.Inspection) then
+ if (KibsItemLevelConfig.Inspection == nil) then
KibsItemLevelConfig.Inspection = KibsItemLevelConfig_defaultInspection;
end
@@ -165,25 +192,27 @@ function KibsItemLevelFrame_VARIABLES_LOADED()
b:SetPoint("TOPLEFT",ConfigPanel,"TOPLEFT",15,-15);
b:SetChecked(KibsItemLevelConfig.on);
_G[b:GetName() .. "Text"]:SetText("Enable Kibs Item Level");
- b:SetScript("OnClick", function(self, button, isDown) if ( self:GetChecked() ) then KibsItemLevelConfig.on = true; cleanUp(); else KibsItemLevelConfig.on = nil; cleanUp(); end end)
+ b:SetScript("OnClick", function(self, button, isDown) if ( self:GetChecked() ) then KibsItemLevelConfig.on = true; cleanUp(); else KibsItemLevelConfig.on = false; cleanUp(); end end)
local b1 = CreateFrame("CheckButton","Upgrades",ConfigPanel,"UICheckButtonTemplate");
b1:SetPoint("TOPLEFT",b,"BOTTOMLEFT",0,0);
b1:SetChecked(KibsItemLevelConfig.upgrades);
_G[b1:GetName() .. "Text"]:SetText("Show upgrades, e.g. (4/4)");
- b1:SetScript("OnClick", function(self, button, isDown) if ( self:GetChecked() ) then KibsItemLevelConfig.upgrades = true; cleanUp(); else KibsItemLevelConfig.upgrades = nil; cleanUp(); end end)
+ b1:SetScript("OnClick", function(self, button, isDown) if ( self:GetChecked() ) then KibsItemLevelConfig.upgrades = true; cleanUp(); else KibsItemLevelConfig.upgrades = false; cleanUp(); end end)
local b2 = CreateFrame("CheckButton","Char",ConfigPanel,"UICheckButtonTemplate");
b2:SetPoint("TOPLEFT",b1,"BOTTOMLEFT",0,0);
b2:SetChecked(KibsItemLevelConfig.Character);
_G[b2:GetName() .. "Text"]:SetText("Show on Character Sheet");
- b2:SetScript("OnClick", function(self, button, isDown) if ( self:GetChecked() ) then KibsItemLevelConfig.Character = true; cleanUp(); else KibsItemLevelConfig.Character = nil; cleanUp(); end end)
+ b2:SetScript("OnClick", function(self, button, isDown) if ( self:GetChecked() ) then KibsItemLevelConfig.Character = true; cleanUp(); else KibsItemLevelConfig.Character = false; cleanUp(); end end)
local b3 = CreateFrame("CheckButton","Insp",ConfigPanel,"UICheckButtonTemplate");
b3:SetPoint("TOPLEFT",b2,"BOTTOMLEFT",0,0);
b3:SetChecked(KibsItemLevelConfig.Inspection);
_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 = nil; cleanUp(); end end)
+ 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
diff --git a/KibsItemLevel.toc b/KibsItemLevel.toc
index fc1cb40..5df3cb1 100644
--- a/KibsItemLevel.toc
+++ b/KibsItemLevel.toc
@@ -1,7 +1,7 @@
-## Interface: 50400
+## Interface: 60000
## Version: @project-version@
## Author: Kibs
-## SavedVariables: KibsItemLevelConfig
+## SavedVariablesPerCharacter: KibsItemLevelConfig
Localization\enUS.lua
Localization\esES.lua
diff --git a/KibsItemLevel.xml b/KibsItemLevel.xml
index 2407612..0afbb99 100644
--- a/KibsItemLevel.xml
+++ b/KibsItemLevel.xml
@@ -7,7 +7,9 @@
<Scripts>
<OnLoad>
KibsItemLevel_OnLoad();
+ self.TimeSinceLastUpdate = 0;
</OnLoad>
+ <!-- <OnUpdate function="KIL_OnUpdate" /> -->
</Scripts>
</Frame>
</Ui>
\ No newline at end of file
diff --git a/libs/LibItemUpgradeInfo-1.0/Core.lua b/libs/LibItemUpgradeInfo-1.0/Core.lua
index b3f119a..8b9c458 100644
--- a/libs/LibItemUpgradeInfo-1.0/Core.lua
+++ b/libs/LibItemUpgradeInfo-1.0/Core.lua
@@ -65,7 +65,7 @@ end
-- Number - The upgrade ID (possibly 0), or nil if the input is invalid or
-- does not contain upgrade info
function lib:GetUpgradeID(itemString)
- return tonumber(itemString:match("item:%d+:%d+:%d+:%d+:%d+:%d+:%-?%d+:%-?%d+:%d+:%d+:(%d+)"))
+ return tonumber(itemString:match("item:%d+:%d+:%d+:%d+:%d+:%d+:%-?%d+:%-?%d+:%d+:(%d+)"))
end
-- GetCurrentUpgrade(id)
@@ -263,7 +263,7 @@ do
local itemLink = "|cff0070dd|Hitem:89551:0:0:0:0:0:0:0:90:0: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, 10000, 200
+ local count, max, batchsize = 0, 20000, 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 1162dab..35ad51e 100644
--- a/libs/LibItemUpgradeInfo-1.0/LibItemUpgradeInfo-1.0.toc
+++ b/libs/LibItemUpgradeInfo-1.0/LibItemUpgradeInfo-1.0.toc
@@ -1,4 +1,4 @@
-## Interface: 50400
+## Interface: 60000
## Title: Lib: ItemUpgradeInfo-1.0
## Notes: Database of item upgrade IDs
## Author: eridius