From 23d7b8297942b49c33cbc78dc3473edf8a4be727 Mon Sep 17 00:00:00 2001 From: Kevin Lyles Date: Tue, 13 Oct 2009 04:39:08 -0500 Subject: [PATCH] Resetting individual weights works --- WeightsWatcher.xml | 9 +++++++++ config.lua | 25 ++++++++++++++++++------- 2 files changed, 27 insertions(+), 7 deletions(-) diff --git a/WeightsWatcher.xml b/WeightsWatcher.xml index e977d27..27752f5 100644 --- a/WeightsWatcher.xml +++ b/WeightsWatcher.xml @@ -248,6 +248,15 @@ + + diff --git a/config.lua b/config.lua index 0b29fe8..5211306 100644 --- a/config.lua +++ b/config.lua @@ -54,6 +54,24 @@ end function configSelectWeight(weightFrame) ww_config.rightPanel.statList = ww_vars.weightsList[weightFrame.category.class][weightFrame.name] + -- Fills the right panel with the current weight's stats + configResetWeight(weightFrame) + + ww_config.rightPanel.header:SetText(weightFrame.name) + ww_config.rightPanel.saveButton:SetScript("OnClick", + function() + configSaveWeight(weightFrame) + end) + ww_config.rightPanel.resetButton:SetScript("OnClick", + function() + configResetWeight(weightFrame) + end) + ww_config.rightPanel:Show() +end + +function configResetWeight(weight) + local value + for _, frame in pairs(ww_statFrameTable) do if frame.statName then value = ww_config.rightPanel.statList[frame.statName] @@ -63,13 +81,6 @@ function configSelectWeight(weightFrame) frame.statValue:SetText(value) end end - - ww_config.rightPanel.header:SetText(weightFrame.name) - ww_config.rightPanel.saveButton:SetScript("OnClick", - function() - configSaveWeight(weightFrame) - end) - ww_config.rightPanel:Show() end function configSaveWeight(weight) -- 1.7.9.5