fix: fully clear learned data buckets
This commit is contained in:
@@ -501,9 +501,9 @@ function QuestieOptions.tabs.database:Initialize()
|
|||||||
confirm = true,
|
confirm = true,
|
||||||
confirmText = "Are you sure? This cannot be undone.",
|
confirmText = "Are you sure? This cannot be undone.",
|
||||||
func = function()
|
func = function()
|
||||||
if Questie.db and Questie.db.global then
|
local QuestieLearner = QuestieLoader:ImportModule("QuestieLearner")
|
||||||
Questie.dbLearner.global = nil
|
if QuestieLearner and QuestieLearner.ClearAllData then
|
||||||
Questie:Print("|cFFFF4444[Questie-X]|r All learned data has been reset.")
|
QuestieLearner:ClearAllData()
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ local string_trim = string.trim
|
|||||||
local string_sub = string.sub
|
local string_sub = string.sub
|
||||||
local string_len = string.len
|
local string_len = string.len
|
||||||
local string_upper = string.upper
|
local string_upper = string.upper
|
||||||
|
local AceConfigRegistry = LibStub and LibStub("AceConfigRegistry-3.0", true)
|
||||||
|
|
||||||
local function IsAscensionProtected(dbType, id, key)
|
local function IsAscensionProtected(dbType, id, key)
|
||||||
local mode = GetDataSourceMode and GetDataSourceMode() or "auto"
|
local mode = GetDataSourceMode and GetDataSourceMode() or "auto"
|
||||||
@@ -486,6 +487,12 @@ function QuestieLearner:IsEnabled()
|
|||||||
return Questie.dbLearner.global.settings.enabled
|
return Questie.dbLearner.global.settings.enabled
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local function NotifyLearnerOptionsChanged()
|
||||||
|
if AceConfigRegistry and AceConfigRegistry.NotifyChange then
|
||||||
|
AceConfigRegistry:NotifyChange("Questie")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
function QuestieLearner:GetSettings()
|
function QuestieLearner:GetSettings()
|
||||||
if not EnsureLearnedData() then return {} end
|
if not EnsureLearnedData() then return {} end
|
||||||
return Questie.dbLearner.global.settings
|
return Questie.dbLearner.global.settings
|
||||||
@@ -2585,11 +2592,23 @@ end
|
|||||||
|
|
||||||
function QuestieLearner:ClearAllData()
|
function QuestieLearner:ClearAllData()
|
||||||
if not EnsureLearnedData() then return end
|
if not EnsureLearnedData() then return end
|
||||||
Questie.dbLearner.global.npcs = {}
|
local learned = Questie.dbLearner.global
|
||||||
Questie.dbLearner.global.quests = {}
|
local settings = learned.settings or {}
|
||||||
Questie.dbLearner.global.items = {}
|
|
||||||
Questie.dbLearner.global.objects = {}
|
for key in pairs(learned) do
|
||||||
|
if key ~= "settings" then
|
||||||
|
learned[key] = nil
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
learned.settings = settings
|
||||||
|
learned.npcs = {}
|
||||||
|
learned.quests = {}
|
||||||
|
learned.items = {}
|
||||||
|
learned.objects = {}
|
||||||
|
|
||||||
self:ApplyDataSourceMode()
|
self:ApplyDataSourceMode()
|
||||||
|
NotifyLearnerOptionsChanged()
|
||||||
Questie:Print("Cleared all learned data.")
|
Questie:Print("Cleared all learned data.")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user