From c1a1ac9a76b1c836258cdd66cd64a6c983f3ea74 Mon Sep 17 00:00:00 2001 From: Peter Eliasson Date: Fri, 5 Aug 2016 22:45:58 +0200 Subject: [PATCH] Added a button to remove all parses to config. --- src/main.lua | 12 ++++++++---- src/options.lua | 24 ++++++++++++++++++++++++ 2 files changed, 32 insertions(+), 4 deletions(-) diff --git a/src/main.lua b/src/main.lua index fc85eda..98b0e74 100644 --- a/src/main.lua +++ b/src/main.lua @@ -122,6 +122,13 @@ function addon:IsInMyGuild(playerName) end end +-- Creates the "database" via AceDB +function addon:SetupDatabase() + self.db = LibStub("AceDB-3.0"):New("GuildSkadaHighScoreDB", addon.dbDefaults, true) + -- Make sure db version is in sync + self.migrate:DoMigration(); +end + -- Method called when ENCOUNTER_END was called and the success -- status was true. -- This method uses the parse module to get a list of all valid @@ -193,10 +200,7 @@ function addon:ZONE_CHANGED_NEW_AREA(evt) end function addon:OnInitialize() - self.db = LibStub("AceDB-3.0"):New("GuildSkadaHighScoreDB", addon.dbDefaults, true) - - -- Make sure db version is in sync - self.migrate:DoMigration(); + self:SetupDatabase(); end function addon:OnEnable() diff --git a/src/options.lua b/src/options.lua index e10ac2f..8a25bf8 100644 --- a/src/options.lua +++ b/src/options.lua @@ -40,6 +40,30 @@ local function createOptionsTable() name = format("Version: %s", addon.versionName), width = "Full", }, + actions = { + name = "Actions", + type = "group", + inline = true, + order = 10, + args = { + RemoveParses = { + order = 10, + type = 'execute', + name = 'Remove All Parses', + desc = 'Removes ALL stored parses.', + confirm = function() + return 'Are you sure you want to remove ALL stored parses?' + .. ' This cannot be undone!'; + end, + func = function() + local highscoreDb = addon.highscore:GetDB(); + highscoreDb = nil; + addon:SetupDatabase(); + addon:Print("All parses have been removed."); + end, + }, + }, + }, purgeSettings = { name = "Purge Settings", type = "group", -- 1.7.9.5