Moved some more variables in vars.lua. Reformated main.lua a little for readability.
Cette révision appartient à :
Parent
0941d6e1e6
révision
d0b8ba397e
|
@ -4,22 +4,6 @@ QuestHelper_Loadtime["main.lua"] = GetTime()
|
||||||
local GetTime = QuestHelper_GetTime
|
local GetTime = QuestHelper_GetTime
|
||||||
local version_string = QuestHelper_File["main.lua"] -- we pretty much save this only so we can inform the user that they're using a beta version
|
local version_string = QuestHelper_File["main.lua"] -- we pretty much save this only so we can inform the user that they're using a beta version
|
||||||
|
|
||||||
-- Just to make sure it's always 'seen' (there's nothing that can be seen, but still...), and therefore always updating.
|
|
||||||
QuestHelper:SetFrameStrata("TOOLTIP")
|
|
||||||
|
|
||||||
QuestHelper.tooltip = CreateFrame("GameTooltip", "QuestHelperTooltip", nil, "GameTooltipTemplate")
|
|
||||||
QuestHelper.objective_objects = {}
|
|
||||||
QuestHelper.user_objectives = {}
|
|
||||||
QuestHelper.quest_objects = {}
|
|
||||||
QuestHelper.player_level = 1
|
|
||||||
QuestHelper.locale = QuestHelper_Locale
|
|
||||||
|
|
||||||
QuestHelper.faction = UnitFactionGroup("player")
|
|
||||||
|
|
||||||
--[[ assert(QuestHelper.faction) ]]
|
|
||||||
|
|
||||||
QuestHelper.font = {serif=GameFontNormal:GetFont(), sans=ChatFontNormal:GetFont(), fancy=QuestTitleFont:GetFont()}
|
|
||||||
|
|
||||||
function QuestHelper:GetFontPath(list_string, font)
|
function QuestHelper:GetFontPath(list_string, font)
|
||||||
if list_string then
|
if list_string then
|
||||||
for name in string.gmatch(list_string, "[^;]+") do
|
for name in string.gmatch(list_string, "[^;]+") do
|
||||||
|
@ -65,13 +49,6 @@ function QuestHelper:SetLocaleFonts()
|
||||||
-- what why did we ever do this
|
-- what why did we ever do this
|
||||||
end
|
end
|
||||||
|
|
||||||
QuestHelper.route = {}
|
|
||||||
QuestHelper.to_add = {}
|
|
||||||
QuestHelper.to_remove = {}
|
|
||||||
QuestHelper.quest_log = {}
|
|
||||||
QuestHelper.pos = {nil, {}, 0, 0, 1, "You are here.", 0}
|
|
||||||
QuestHelper.sharing = false -- Will be set to true when sharing with at least one user.
|
|
||||||
|
|
||||||
function QuestHelper.tooltip:GetPrevLines() -- Just a helper to make life easier.
|
function QuestHelper.tooltip:GetPrevLines() -- Just a helper to make life easier.
|
||||||
local last = self:NumLines()
|
local last = self:NumLines()
|
||||||
local name = self:GetName()
|
local name = self:GetName()
|
||||||
|
@ -122,42 +99,35 @@ local please_submit_initted = false
|
||||||
|
|
||||||
local spawned = false
|
local spawned = false
|
||||||
|
|
||||||
QHQuestsCompleted = false
|
local function QH_QueryQuestsCompletedHandler()
|
||||||
|
QHQuestsCompleted = GetQuestsCompleted()
|
||||||
|
end
|
||||||
|
|
||||||
QH_Event("ADDON_LOADED", function (addonid)
|
local function QH_QueryQuestsCompleted()
|
||||||
if addonid ~= "QuestHelper" then return end
|
|
||||||
|
|
||||||
-- ONLY FAST STUFF ALLOWED IN HERE
|
|
||||||
--[[
|
--[[
|
||||||
QH_Event("QUEST_QUERY_COMPLETE", function ()
|
QH_Event("QUEST_QUERY_COMPLETE", QH_QueryQuestsCompletedHandler)
|
||||||
QHQuestsCompleted = GetQuestsCompleted()
|
|
||||||
end)
|
|
||||||
|
|
||||||
QueryQuestsCompleted()
|
QueryQuestsCompleted()
|
||||||
--]]
|
--]]
|
||||||
|
end
|
||||||
|
|
||||||
-- Use DefaultPref as fallback for unset preference keys.
|
local function ShouldTrackingBeEnabled(yn)
|
||||||
setmetatable(QuestHelper_Pref, {__index=QuestHelper_DefaultPref})
|
DEFAULT_CHAT_FRAME:AddMessage("Tracking not currently available.")
|
||||||
QuestHelper: Assert(QuestHelper_Pref.perfload_scale) -- if this fails, something is very botched
|
if yn then
|
||||||
|
-- QuestHelper:ShowTracker() -- to respect the minimized setting
|
||||||
--[[
|
|
||||||
if not QuestHelper_Pref.track or QuestHelper_Pref.hide then
|
|
||||||
QuestHelper:HideTracker()
|
|
||||||
else
|
else
|
||||||
QuestHelper:ShowTracker() -- to respect the minimized setting
|
-- QuestHelper:HideTracker()
|
||||||
end
|
end
|
||||||
--]]
|
end
|
||||||
|
|
||||||
local self = QuestHelper -- whee hack hack hack
|
local function FileCheck()
|
||||||
|
|
||||||
QuestHelper_Loadtime["init2_start"] = GetTime()
|
|
||||||
|
|
||||||
local file_problem_version = false
|
local file_problem_version = false
|
||||||
|
|
||||||
local expected_version = GetAddOnMetadata("QuestHelper", "Version")
|
local expected_version = GetAddOnMetadata("QuestHelper", "Version")
|
||||||
|
|
||||||
-- Why are we checking to make sure these files load?
|
-- Why are we checking to make sure these files load?
|
||||||
-- Most if not all are named in the toc file.
|
-- Most if not all are named in the toc file.
|
||||||
|
-- Duh... There's a lot of files, ergo a method to make sure all expected files have been named in the toc file and check for files that are unexpected too.
|
||||||
local expected_files =
|
local expected_files =
|
||||||
{
|
{
|
||||||
["bst_pre.lua"] = true,
|
["bst_pre.lua"] = true,
|
||||||
|
@ -167,6 +137,8 @@ QH_Event("ADDON_LOADED", function (addonid)
|
||||||
["manager_completed.lua"] = true,
|
["manager_completed.lua"] = true,
|
||||||
|
|
||||||
-- ["upgrade.lua"] = true,
|
-- ["upgrade.lua"] = true,
|
||||||
|
["pref.lua"] = true,
|
||||||
|
["vars.lua"] = true,
|
||||||
["main.lua"] = true,
|
["main.lua"] = true,
|
||||||
["recycle.lua"] = true,
|
["recycle.lua"] = true,
|
||||||
["objective.lua"] = true,
|
["objective.lua"] = true,
|
||||||
|
@ -244,7 +216,7 @@ QH_Event("ADDON_LOADED", function (addonid)
|
||||||
["AstrolabeQH/Astrolabe.lua"] = true,
|
["AstrolabeQH/Astrolabe.lua"] = true,
|
||||||
["AstrolabeQH/AstrolabeMapMonitor.lua"] = true,
|
["AstrolabeQH/AstrolabeMapMonitor.lua"] = true,
|
||||||
}
|
}
|
||||||
|
|
||||||
local uninstallederr = ""
|
local uninstallederr = ""
|
||||||
|
|
||||||
for file, version in pairs(QuestHelper_File) do
|
for file, version in pairs(QuestHelper_File) do
|
||||||
|
@ -278,6 +250,10 @@ QH_Event("ADDON_LOADED", function (addonid)
|
||||||
-- Don't need this table anymore.
|
-- Don't need this table anymore.
|
||||||
QuestHelper_File = nil
|
QuestHelper_File = nil
|
||||||
|
|
||||||
|
return uninstallederr, file_problem_version
|
||||||
|
end
|
||||||
|
|
||||||
|
local function FinalProblemChecks(uninstallederr, file_problem_version)
|
||||||
if QuestHelper_StaticData and not QuestHelper_StaticData[GetLocale()] then
|
if QuestHelper_StaticData and not QuestHelper_StaticData[GetLocale()] then
|
||||||
local errmsg = "Static data does not seem to exist"
|
local errmsg = "Static data does not seem to exist"
|
||||||
DEFAULT_CHAT_FRAME:AddMessage(errmsg)
|
DEFAULT_CHAT_FRAME:AddMessage(errmsg)
|
||||||
|
@ -307,6 +283,29 @@ QH_Event("ADDON_LOADED", function (addonid)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
|
||||||
|
function QuestHelper_AddonLoadedHandler(addonid)
|
||||||
|
if addonid ~= "QuestHelper" then return end
|
||||||
|
|
||||||
|
-- ONLY FAST STUFF ALLOWED IN HERE
|
||||||
|
QH_QueryQuestsCompleted
|
||||||
|
|
||||||
|
-- Use DefaultPref as fallback for unset preference keys.
|
||||||
|
setmetatable(QuestHelper_Pref, {__index=QuestHelper_DefaultPref})
|
||||||
|
QuestHelper: Assert(QuestHelper_Pref.perfload_scale) -- if this fails, something is very botched
|
||||||
|
|
||||||
|
ShouldTrackingBeEnabled(QuestHelper_Pref.track and not QuestHelper_Pref.hide)
|
||||||
|
|
||||||
|
local self = QuestHelper -- whee hack hack hack
|
||||||
|
|
||||||
|
QuestHelper_Loadtime["init2_start"] = GetTime()
|
||||||
|
|
||||||
|
-- File Check
|
||||||
|
local uninstallederr, file_problem_version = FileCheck()
|
||||||
|
if not FinalProblemChecks(uninstallederr, file_problem_version) then return end -- Something is borked.
|
||||||
|
|
||||||
QuestHelper_ErrorCatcher_CompletelyStarted()
|
QuestHelper_ErrorCatcher_CompletelyStarted()
|
||||||
|
|
||||||
if not QuestHelper_StaticData then
|
if not QuestHelper_StaticData then
|
||||||
|
@ -317,8 +316,11 @@ QH_Event("ADDON_LOADED", function (addonid)
|
||||||
|
|
||||||
QHFormatSetLocale(QuestHelper_Pref.locale or GetLocale())
|
QHFormatSetLocale(QuestHelper_Pref.locale or GetLocale())
|
||||||
|
|
||||||
if not QuestHelper_UID then
|
if not QuestHelper_UID and not QuestHelper_Collector.UID then
|
||||||
QuestHelper_UID = self:CreateUID()
|
QuestHelper_Collector.UID = self:CreateUID()
|
||||||
|
elseif QuestHelper_UID then
|
||||||
|
QuestHelper_Collector.UID = QuestHelper_UID
|
||||||
|
QuestHelper_UID = nil -- We are moving this into Collector.
|
||||||
end
|
end
|
||||||
QuestHelper_SaveDate = time()
|
QuestHelper_SaveDate = time()
|
||||||
|
|
||||||
|
@ -534,8 +536,9 @@ QH_Event("ADDON_LOADED", function (addonid)
|
||||||
end, "preinit")
|
end, "preinit")
|
||||||
|
|
||||||
QuestHelper_Loadtime["init2_end"] = GetTime()
|
QuestHelper_Loadtime["init2_end"] = GetTime()
|
||||||
end)
|
end
|
||||||
|
|
||||||
|
QH_Event("ADDON_LOADED", QuestHelper_AddonLoadedHandler)
|
||||||
|
|
||||||
--[==[
|
--[==[
|
||||||
function QuestHelper:OnEvent(event)
|
function QuestHelper:OnEvent(event)
|
||||||
|
|
|
@ -3,7 +3,7 @@ QuestHelper_Loadtime["pref.lua"] = GetTime()
|
||||||
|
|
||||||
QuestHelper_Pref = {}
|
QuestHelper_Pref = {}
|
||||||
|
|
||||||
local QuestHelper_DefaultPref = {
|
QuestHelper_DefaultPref = {
|
||||||
filter_level = true,
|
filter_level = true,
|
||||||
filter_zone = false,
|
filter_zone = false,
|
||||||
filter_done = false,
|
filter_done = false,
|
||||||
|
|
|
@ -10,4 +10,29 @@ QuestHelper_FlightInstructors = {}
|
||||||
QuestHelper_FlightLinks = {}
|
QuestHelper_FlightLinks = {}
|
||||||
QuestHelper_FlightRoutes = {}
|
QuestHelper_FlightRoutes = {}
|
||||||
QuestHelper_KnownFlightRoutes = {}
|
QuestHelper_KnownFlightRoutes = {}
|
||||||
QuestHelper_SeenRealms = {}
|
QuestHelper_SeenRealms = {}
|
||||||
|
|
||||||
|
-- Just to make sure it's always 'seen' (there's nothing that can be seen, but still...), and therefore always updating.
|
||||||
|
QuestHelper:SetFrameStrata("TOOLTIP")
|
||||||
|
|
||||||
|
QuestHelper.tooltip = CreateFrame("GameTooltip", "QuestHelperTooltip", nil, "GameTooltipTemplate")
|
||||||
|
QuestHelper.objective_objects = {}
|
||||||
|
QuestHelper.user_objectives = {}
|
||||||
|
QuestHelper.quest_objects = {}
|
||||||
|
QuestHelper.player_level = 1
|
||||||
|
QuestHelper.locale = QuestHelper_Locale
|
||||||
|
|
||||||
|
QuestHelper.faction = UnitFactionGroup("player")
|
||||||
|
|
||||||
|
--[[ assert(QuestHelper.faction) ]]
|
||||||
|
|
||||||
|
QuestHelper.font = {serif=GameFontNormal:GetFont(), sans=ChatFontNormal:GetFont(), fancy=QuestTitleFont:GetFont()}
|
||||||
|
|
||||||
|
QuestHelper.route = {}
|
||||||
|
QuestHelper.to_add = {}
|
||||||
|
QuestHelper.to_remove = {}
|
||||||
|
QuestHelper.quest_log = {}
|
||||||
|
QuestHelper.pos = {nil, {}, 0, 0, 1, "You are here.", 0}
|
||||||
|
QuestHelper.sharing = false -- Will be set to true when sharing with at least one user.
|
||||||
|
|
||||||
|
QHQuestsCompleted = false
|
Référencer dans un nouveau ticket