Originally Posted by Fizzlemizz
A lot of the "how" your logic might work would depend on if the addon is solely for your own use or not (you did say "I frequently").
You can make a lot of assumtions about the definition of how "useful" an addon is if it is just for your own use.
Some addon configs are seperate addons that are LOD but may be "useful" occaisionally.
Addons that are tagged "LoadWith" might not load every time but might still be "useful".
Every addon that loads by default may not be "useful".
Sorry, it's the devil's advocate in me, you may well have this covered.
|
Heh, I like playing devil's advocate. I have thought of some of these situations. The LOD and LoadWith I did not.
Do variables created inside a local function need the local?
My thought for the date is compare current addon load state with the savedvariable and update if it is different (i.e. loaded and not loaded). I'll worry about the LOD and LoadWith later. If they are both disabled, do not update the date/time. This will give me a semi accurate idea of when it was last loaded. For the most part, this should work except for what we mentioned.
I'm trying this code for the logic, but I'm not quite getting it right.
Lua Code:
local addonlistdb
local function PLAYER_LOGOUT()
AddonListDB = {}
local addcount = GetNumAddOns()
for i = 1,addcount do
local name, title, notes, loadable, reason, security, newVersion = GetAddOnInfo(i)
loaded, finished = IsAddOnLoaded(i)
local dep1, dep2, dep3 = GetAddOnDependencies(i)
local odep1 = GetAddOnOptionalDependencies(i)
local ldemand = IsAddOnLoadOnDemand(i)
if (loaded ~= AddonListDB[i].Loaded) or ((loaded == true) and (AddonListDB[i].Loaded == true)) then
AddonListDB[i] = {
Title=title,
Loaded=loaded or false,
Dependencies=dep1 or false,
OptionalDependencies=odep1 or false,
LoadOnDemand=ldemand or false,
DateTime=date("%m/%d/%y %H:%M:%S")
};
elseif (loaded == nil) and (AddonListDB[i].Loaded) == false then
AddonListDB[i] = {
Title=title,
Loaded=loaded or false,
Dependencies=dep1 or false,
OptionalDependencies=odep1 or false,
LoadOnDemand=ldemand or false
};
end
end
end
local JWFrame = CreateFrame("Frame");
JWFrame:RegisterEvent("PLAYER_LOGOUT");
JWFrame:SetScript("OnEvent", PLAYER_LOGOUT)