From e5b571d5ab4951e0807dfa108b23bcf78255a5f8 Mon Sep 17 00:00:00 2001 From: Kevin Lyles Date: Fri, 9 Oct 2009 02:14:39 -0500 Subject: [PATCH] Restoring default weights works --- WeightsWatcher.xml | 2 +- config.lua | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/WeightsWatcher.xml b/WeightsWatcher.xml index 074ed9d..a01044a 100644 --- a/WeightsWatcher.xml +++ b/WeightsWatcher.xml @@ -325,7 +325,7 @@ - print("Restore defaults not yet implemented") + StaticPopup_Show("WW_CONFIRM_RESTORE_DEFAULTS") diff --git a/config.lua b/config.lua index 9b78534..8e7aa4c 100644 --- a/config.lua +++ b/config.lua @@ -21,6 +21,24 @@ StaticPopupDialogs["WW_CONFIRM_WEIGHT_DELETE"] = { hideOnEscape = true, } +StaticPopupDialogs["WW_CONFIRM_RESTORE_DEFAULTS"] = { + text = "Are you sure you want to restore default weights? This will overwrite any weights with the default names (but leave others alone).", + button1 = "Restore Defaults", + button2 = "Cancel", + OnAccept = function() + for class, weights in pairs(defaultVars.weightsList) do + for weight, stats in pairs(weights) do + setWeight(class, weight, stats) + end + end + ww_config.rightPanel:Hide() + end, + showAlert = true, + timeout = 0, + whileDead = true, + hideOnEscape = true, +} + StaticPopupDialogs["WW_WEIGHT_EXISTS"] = { text = "The %s weight named \"%s\" already exists. Pick a different name.", button1 = "Okay", -- 1.7.9.5