diff --git a/GemIds.lua b/GemIds.lua
index dbbc3cc..bd3b8ed 100644
--- a/GemIds.lua
+++ b/GemIds.lua
@@ -35,7 +35,7 @@ WeightsWatcher = AceLibrary("AceAddon-2.0"):new("AceEvent-2.0", "AceHook-2.1")
-- 6: wrath blue
-- 7: wrath epic
-GemIds = {
+ww_gems = {
["Vendor"] = {
["Normal"] = {
[1] = {
@@ -3039,7 +3039,7 @@ GemIds = {
local GemQualities = {}
-for gemSource, gems in pairs(GemIds) do
+for gemSource, gems in pairs(ww_gems) do
for gemType, gems in pairs(gems) do
for gemQuality, gems in pairs(gems) do
for gemId, gemInfo in pairs(gems) do
diff --git a/Regexps.lua b/Regexps.lua
index 8f561b2..7456293 100644
--- a/Regexps.lua
+++ b/Regexps.lua
@@ -19,13 +19,13 @@ local function makePatternTables()
ww_regexes[category].SingleStat = {}
end
local pattern, func, categories
- for _, regex in ipairs(MultipleStatLines) do
+ for _, regex in ipairs(ww_MultipleStatLines) do
pattern, func, categories = unpack(regex)
for _, category in ipairs(categories) do
table.insert(ww_regexes[category].MultipleStat, {pattern, func})
end
end
- for _, regex in ipairs(SingleStatLines) do
+ for _, regex in ipairs(ww_SingleStatLines) do
pattern, func, categories = unpack(regex)
for _, category in ipairs(categories) do
table.insert(ww_regexes[category].SingleStat, {pattern, func})
@@ -42,11 +42,11 @@ local function makePatternTables()
break
end
if empty then
- for _, regex in ipairs(MultipleStatLines) do
+ for _, regex in ipairs(ww_MultipleStatLines) do
pattern, func = unpack(regex)
table.insert(ww_regexes[category].MultipleStat, {pattern, func})
end
- for _, regex in ipairs(SingleStatLines) do
+ for _, regex in ipairs(ww_SingleStatLines) do
pattern, func = unpack(regex)
table.insert(ww_regexes[category].SingleStat, {pattern, func})
end
@@ -54,7 +54,7 @@ local function makePatternTables()
end
end
-function initializeParser()
+function ww_initializeParser()
makePatternTables()
end
@@ -499,7 +499,7 @@ local function parseStackingEquipEffectTriggers(trigger)
if subType == "" then
trigger = trigger:sub(1, 1):lower() .. trigger:sub(2)
end
- for _, group in ipairs(triggerGroups[subType .. trigger]) do
+ for _, group in ipairs(ww_triggerGroups[subType .. trigger]) do
triggers[group] = true
end
end
@@ -585,7 +585,7 @@ local function parseSocketBonusStat(text, section)
return {socketBonusStat = stats.stats}
end
-EffectHandlers = {
+ww_EffectHandlers = {
{EquipStatsMatchLines, {}, EquipStatsUnweightedLines, EquipStatsPreprocessLines, EquipStatsAffixes, parseStats, "equipEffect"},
{{" socket$"}, {}, {}, {}, {" socket$"}, function(text) return {socket = text} end, "socket"},
{{"^[^:]+$"}, {}, {}, {}, {}, parseStats, "generic"},
@@ -732,19 +732,19 @@ function WeightsWatcher.useEffect(text)
end
end
-Preprocess = {
+ww_Preprocess = {
{"|c[a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9]([^|]+)|r", "%1"},
{" +$", ""},
}
-ignoredInvalidStats = {
+ww_ignoredInvalidStats = {
"item level",
"requires level",
"all stats",
"all resistances",
}
-IgnoredLines = {
+ww_IgnoredLines = {
"^$",
-- Reputation and materials requirements
"^requires ",
@@ -776,7 +776,7 @@ IgnoredLines = {
"^zul'aman$",
}
-TempIgnoredLines = {
+ww_TempIgnoredLines = {
"^item level %d+$",
"^use: restores %d+ to %d+ %a+",
"^use: teaches .* %(rank %d+%)%.$",
@@ -805,7 +805,7 @@ TempIgnoredLines = {
"^use: teaches you how to turn ",
}
-UnweightedLines = {
+ww_UnweightedLines = {
"^%(%d%) set: ",
"^set: ", -- In-game only?
-- Some relics that boost stats for certain abilities only
@@ -818,7 +818,7 @@ UnweightedLines = {
"^equip: causes your ",
}
-MultipleStatLines = {
+ww_MultipleStatLines = {
{"^([^,]+) and ([^,]+)$", WeightsWatcher.twoStats, {"elixir", "enchant", "food", "generic", "useEffect"}},
{"^([+-]?%d+ )(%a[%a ]+%a) and (%a[%a ]+%a)$", WeightsWatcher.multipleStatsOneNumber, {"elixir", "food"}},
{"^([%a%d][%a%d ]+[%a%d]), ([%a%d][%a%d ]+[%a%d]),? and ([%a%d][%a%d ]+[%a%d])$",
@@ -983,7 +983,7 @@ MultipleStatLines = {
},
}
-SingleStatLines = {
+ww_SingleStatLines = {
{"^([+-]?%d+) (armor)$", WeightsWatcher.statNumFirst, {"elixir", "enchant", "equipEffect", "generic", "useEffect"}},
{"^([+-]?%d+) (agility)$", WeightsWatcher.statNumFirst, {"elixir", "enchant", "food", "generic", "socketBonus", "useEffect"}},
{"^([+-]?%d+) (intellect)$", WeightsWatcher.statNumFirst, {"elixir", "enchant", "food", "generic", "socketBonus", "useEffect"}},
@@ -1383,7 +1383,7 @@ SingleStatLines = {
},
}
-ItemInfoLines = {
+ww_ItemInfoLines = {
"^binds ",
"^unique",
"^soulbound$",
@@ -1391,7 +1391,7 @@ ItemInfoLines = {
"^quest item$",
}
-DoubleSlotLines = {
+ww_DoubleSlotLines = {
"^head$",
"^shoulder$",
"^chest$",
@@ -1410,7 +1410,7 @@ DoubleSlotLines = {
"^projectile$",
}
-SingleSlotLines = {
+ww_SingleSlotLines = {
"^finger$",
"^back$",
"^neck$",
diff --git a/Upgrade.lua b/Upgrade.lua
index 2f36d76..56f4c02 100644
--- a/Upgrade.lua
+++ b/Upgrade.lua
@@ -1,4 +1,4 @@
-function deepTableCopy(object)
+function ww_deepTableCopy(object)
local lookup_table = {}
local function _copy(object)
if type(object) ~= "table" then
@@ -648,7 +648,7 @@ end
local function upgradeAccountToHandleModifierKeys(vars)
if not vars.options.tooltip then
- vars.options.tooltip = deepTableCopy(defaultVars.options.tooltip)
+ vars.options.tooltip = ww_deepTableCopy(ww_defaultVars.options.tooltip)
end
vars.dataMinorVersion = 5
@@ -766,7 +766,7 @@ local function upgradeAccountToNormalization(vars)
end
function copyDefaultAccountVars()
- return deepTableCopy(defaultVars)
+ return ww_deepTableCopy(ww_defaultVars)
end
local function createActiveWeights(class)
@@ -783,7 +783,7 @@ end
local function copyDefaultCharVars()
local charVars
- charVars = deepTableCopy(defaultCharVars)
+ charVars = ww_deepTableCopy(ww_defaultCharVars)
charVars.activeWeights = createActiveWeights(WeightsWatcher.playerClass)
return charVars
end
@@ -873,14 +873,14 @@ function WeightsWatcher.Upgrade(dataType)
if dataType == "account" then
vars = ww_vars
- newMinorVersion = defaultVars.dataMinorVersion
- newMajorVersion = defaultVars.dataMajorVersion
+ newMinorVersion = ww_defaultVars.dataMinorVersion
+ newMajorVersion = ww_defaultVars.dataMajorVersion
funcTable = upgradeAccountFunctions
downgradeFunctions = downgradeAccountFunctions
elseif dataType == "character" then
vars = ww_charVars
- newMinorVersion = defaultCharVars.dataMinorVersion
- newMajorVersion = defaultCharVars.dataMajorVersion
+ newMinorVersion = ww_defaultCharVars.dataMinorVersion
+ newMajorVersion = ww_defaultCharVars.dataMajorVersion
funcTable = upgradeCharFunctions
downgradeFunctions = downgradeCharFunctions
else
@@ -921,7 +921,7 @@ function WeightsWatcher.Upgrade(dataType)
print("WeightsWatcher: attempting to " .. direction .. "grade " .. dataType .. " data from version " .. oldMajorVersion .. "." .. oldMinorVersion .. " to " .. newMajorVersion .. "." .. newMinorVersion .. ".")
end
- local newVars = deepTableCopy(vars)
+ local newVars = ww_deepTableCopy(vars)
while oldMajorVersion ~= newMajorVersion or oldMinorVersion ~= newMinorVersion do
if not funcTable[oldMajorVersion] or not funcTable[oldMajorVersion][oldMinorVersion] then
diff --git a/WeightsWatcher.lua b/WeightsWatcher.lua
index fd34779..613fe92 100644
--- a/WeightsWatcher.lua
+++ b/WeightsWatcher.lua
@@ -255,15 +255,15 @@ function WeightsWatcher.OnInitialize()
return
end
- initializeParser()
+ ww_initializeParser()
- initializeWeightsConfig()
+ ww_initializeWeightsConfig()
SLASH_WEIGHTSWATCHER1="/ww"
SLASH_WEIGHTSWATCHER2="/weightswatcher"
SlashCmdList["WEIGHTSWATCHER"] =
function(msg)
- commandHandler(msg)
+ ww_commandHandler(msg)
end
end
@@ -275,7 +275,7 @@ StaticPopupDialogs["WW_INVALID_ACCOUNT_DATA"] = {
if not upgradeData("character", "ww_charVars") then
return
end
- initializeWeightsConfig()
+ ww_initializeWeightsConfig()
end,
OnCancel = function(self, func)
DisableAddOn("WeightsWatcher")
@@ -293,7 +293,7 @@ StaticPopupDialogs["WW_INVALID_CHARACTER_DATA"] = {
button2 = "Disable WeightsWatcher",
OnAccept = function(self, func)
ww_charVars = copyDefaultCharVars()
- initializeWeightsConfig()
+ ww_initializeWeightsConfig()
end,
OnCancel = function(self, func)
DisableAddOn("WeightsWatcher")
@@ -540,12 +540,12 @@ function WeightsWatcher.displayItemStats(tooltip, ttname)
bareLink = splitItemLink(link)
local bareItemInfo = ww_bareItemCache[bareLink]
- showDebugInfo = keyDetectors[ww_vars.options.tooltip.showDebugInfo]()
- showWeights = keyDetectors[ww_vars.options.tooltip.showWeights]()
- showIdealWeights = keyDetectors[ww_vars.options.tooltip.showIdealWeights]()
- showIdealGems = keyDetectors[ww_vars.options.tooltip.showIdealGems]()
- showIdealGemStats = keyDetectors[ww_vars.options.tooltip.showIdealGemStats]()
- showAlternateGems = keyDetectors[ww_vars.options.tooltip.showAlternateGems]()
+ showDebugInfo = ww_keyDetectors[ww_vars.options.tooltip.showDebugInfo]()
+ showWeights = ww_keyDetectors[ww_vars.options.tooltip.showWeights]()
+ showIdealWeights = ww_keyDetectors[ww_vars.options.tooltip.showIdealWeights]()
+ showIdealGems = ww_keyDetectors[ww_vars.options.tooltip.showIdealGems]()
+ showIdealGemStats = ww_keyDetectors[ww_vars.options.tooltip.showIdealGemStats]()
+ showAlternateGems = ww_keyDetectors[ww_vars.options.tooltip.showAlternateGems]()
if ttname ~= "ShoppingTooltip1" and ttname ~= "ShoppingTooltip2" and ww_vars.options.tooltip.showDifferences then
local currentSlot, compareSlot, compareSlot2, currentSubslot, compareSubslot, compareSubslot2
@@ -640,7 +640,7 @@ function WeightsWatcher.displayItemStats(tooltip, ttname)
local compareScore, compareScore2, compareBareScore, compareBareScore2
str = weight
if ww_vars.options.tooltip.showClassNames == "Always" or (ww_vars.options.tooltip.showClassNames == "Others" and class ~= WeightsWatcher.playerClass) then
- str = str .. " - " .. classNames[class]
+ str = str .. " - " .. ww_classDisplayNames[class]
end
if compareLink then
compareScore = ww_weightCache[class][weight][compareLink]
@@ -685,7 +685,7 @@ function WeightsWatcher.displayItemStats(tooltip, ttname)
end
if showIdealGemStats then
for stat, value in pairs(gem[3]) do
- tooltip:AddDoubleLine(" " .. statNames[stat] .. ": " .. value, " ")
+ tooltip:AddDoubleLine(" " .. ww_statNames[stat] .. ": " .. value, " ")
end
end
if not showAlternateGems then
@@ -779,10 +779,10 @@ end
function WeightsWatcher.bestGemForSocket(socketColor, weightScale, qualityLimit)
local bestGem, bestWeight, weight = {}, 0
if not qualityLimit then
- qualityLimit = #(GemIds["Normal"])
+ qualityLimit = #(ww_gems["Normal"])
end
- for gemSource, gems in pairs(GemIds) do
+ for gemSource, gems in pairs(ww_gems) do
if ww_vars.options.gems.sources[gemSource] then
for gemType, gems in pairs(gems) do
if ww_vars.options.gems.types[gemType] then
@@ -961,24 +961,24 @@ function WeightsWatcher.getGemStats(...)
end
function WeightsWatcher.parseLine(textL, textR, link)
- for _, regex in ipairs(IgnoredLines) do
+ for _, regex in ipairs(ww_IgnoredLines) do
if string.find(textL, regex) then
ww_ignored_lines[textL][regex] = true
return
end
end
- for _, regex in ipairs(TempIgnoredLines) do
+ for _, regex in ipairs(ww_TempIgnoredLines) do
if string.find(textL, regex) then
ww_temp_ignored_lines[textL][regex] = true
return
end
end
- for _, regex in ipairs(ItemInfoLines) do
+ for _, regex in ipairs(ww_ItemInfoLines) do
if string.find(textL, regex) then
return {info = {[textL] = true}}
end
end
- for _, regex in ipairs(DoubleSlotLines) do
+ for _, regex in ipairs(ww_DoubleSlotLines) do
if string.find(textL, regex) then
local nonStats = {}
nonStats["slot"] = textL
@@ -986,7 +986,7 @@ function WeightsWatcher.parseLine(textL, textR, link)
return {info = nonStats}
end
end
- for _, regex in ipairs(SingleSlotLines) do
+ for _, regex in ipairs(ww_SingleSlotLines) do
if string.find(textL, regex) then
return {info = {["slot"] = textL}}
end
@@ -996,7 +996,7 @@ function WeightsWatcher.parseLine(textL, textR, link)
return {stats = stats}
end
- for _, args in ipairs(EffectHandlers) do
+ for _, args in ipairs(ww_EffectHandlers) do
local stats = WeightsWatcher.handleEffects(textL, unpack(args))
if stats then
if stats == true then
@@ -1006,7 +1006,7 @@ function WeightsWatcher.parseLine(textL, textR, link)
end
end
- for _, regex in ipairs(UnweightedLines) do
+ for _, regex in ipairs(ww_UnweightedLines) do
if string.find(textL, regex) then
ww_unweighted_lines[textL][regex] = true
return
@@ -1081,7 +1081,7 @@ function WeightsWatcher.getItemStats(link)
end
function WeightsWatcher.preprocess(text)
- for _, regex in ipairs(Preprocess) do
+ for _, regex in ipairs(ww_Preprocess) do
local pattern, replacement = unpack(regex)
if string.find(text, pattern) then
text = string.gsub(text, pattern, replacement)
diff --git a/config.lua b/config.lua
index cf988e4..9047495 100644
--- a/config.lua
+++ b/config.lua
@@ -7,7 +7,7 @@ local function printHelp()
print(" help displays this message")
end
-function commandHandler(msg)
+function ww_commandHandler(msg)
if msg == "config" then
ww_weights:Hide()
-- TODO: make this work better with the confirmDiscardChanges dialog
@@ -44,12 +44,12 @@ local function GemQualityDropDownOnClick(choice, dropdown)
ww_weightIdealCache = setmetatable({}, ww_weightIdealCacheMetatable)
end
-function GemQualityDropDownInitialize(dropdown)
+function ww_GemQualityDropDownInitialize(dropdown)
local info = {}
info.func = GemQualityDropDownOnClick
info.arg1 = dropdown
- for num, name in ipairs(gemQualityNames) do
+ for num, name in ipairs(ww_gemQualityNames) do
info.text = name
info.value = num
info.checked = nil
@@ -62,12 +62,12 @@ local function ModifierKeyDropDownOnClick(choice, dropdown)
ww_vars.options.tooltip[dropdown:GetText()] = choice.value
end
-function ModifierKeyDropDownInitialize(dropdown)
+function ww_ModifierKeyDropDownInitialize(dropdown)
local info = {}
info.func = ModifierKeyDropDownOnClick
info.arg1 = dropdown
- for _, value in ipairs(keyDetectors) do
+ for _, value in ipairs(ww_keyDetectors) do
info.text = value
info.value = value
info.checked = nil
@@ -80,13 +80,13 @@ local function ShowClassNameDropDownOnClick(choice, dropdown)
ww_vars.options.tooltip.showClassNames = choice.value
end
-function ShowClassNameDropDownInitialize(dropdown)
+function ww_ShowClassNameDropDownInitialize(dropdown)
local info = {}
info.func = ShowClassNameDropDownOnClick
info.arg1 = dropdown
- for _, value in ipairs(classNameOptions) do
- info.text = classNameOptions[value]
+ for _, value in ipairs(ww_classNameOptions) do
+ info.text = ww_classNameOptions[value]
info.value = value
info.checked = nil
UIDropDownMenu_AddButton(info)
diff --git a/config.xml b/config.xml
index af44756..4f06421 100644
--- a/config.xml
+++ b/config.xml
@@ -51,7 +51,7 @@
UIDropDownMenu_JustifyText(self, "LEFT")
</OnLoad>
<OnShow>
- UIDropDownMenu_Initialize(self, ModifierKeyDropDownInitialize)
+ UIDropDownMenu_Initialize(self, ww_ModifierKeyDropDownInitialize)
UIDropDownMenu_SetSelectedValue(self, ww_vars.options.tooltip[self:GetText()])
</OnShow>
</Scripts>
@@ -177,7 +177,7 @@
UIDropDownMenu_JustifyText(self, "LEFT")
</OnLoad>
<OnShow>
- UIDropDownMenu_Initialize(self, GemQualityDropDownInitialize)
+ UIDropDownMenu_Initialize(self, ww_GemQualityDropDownInitialize)
UIDropDownMenu_SetSelectedValue(self, ww_vars.options.gems.qualityLimit)
</OnShow>
</Scripts>
@@ -461,7 +461,7 @@
end
</OnTextChanged>
<OnChar>
- if validateNumber(text, self:GetText()) then
+ if ww_validateNumber(text, self:GetText()) then
self.number = self:GetText()
ww_vars.options.useEffects.uptimeRatio = self:GetNumber() / 100
ww_weightCache = setmetatable({}, ww_weightCacheMetatable)
@@ -627,7 +627,7 @@
UIDropDownMenu_JustifyText(self, "LEFT")
</OnLoad>
<OnShow>
- UIDropDownMenu_Initialize(self, ShowClassNameDropDownInitialize)
+ UIDropDownMenu_Initialize(self, ww_ShowClassNameDropDownInitialize)
UIDropDownMenu_SetSelectedValue(self, ww_vars.options.tooltip.showClassNames)
</OnShow>
</Scripts>
diff --git a/defaults.lua b/defaults.lua
index 3868e6d..a4a561b 100644
--- a/defaults.lua
+++ b/defaults.lua
@@ -1,4 +1,4 @@
-trackedStats = {
+ww_trackedStats = {
[1] = "General",
[2] = "Tanking",
[3] = "Melee",
@@ -93,7 +93,7 @@ trackedStats = {
["Triggers"] = {}
}
-triggerGroups = {
+ww_triggerGroups = {
["meleeDamageDealt"] = {"meleeDamage"},
["rangedDamageDealt"] = {"rangedDamage"},
["spellDamageDealt"] = {"harmfulSpell"},
@@ -104,7 +104,7 @@ triggerGroups = {
["helpfulSpellCast"] = {"helpfulSpell"},
}
-triggerNames = {
+ww_triggerNames = {
[1] = "meleeDamage",
[2] = "rangedDamage",
[3] = "harmfulSpell",
@@ -115,7 +115,7 @@ triggerNames = {
["helpfulSpell"] = "Helpful spell cast",
}
-classNames = {
+ww_classDisplayNames = {
["DEATHKNIGHT"] = "Death Knight",
["DRUID"] = "Druid",
["HUNTER"] = "Hunter",
@@ -128,7 +128,7 @@ classNames = {
["WARRIOR"] = "Warrior",
}
-gemQualityNames = {
+ww_gemQualityNames = {
[1] = "Burning Crusade common",
[2] = "Burning Crusade uncommon",
[3] = "Burning Crusade rare",
@@ -138,7 +138,7 @@ gemQualityNames = {
[7] = "Wrath epic",
}
-statNames = {
+ww_statNames = {
["stamina"] = "Stamina",
["critical strike rating"] = "Critical Strike Rating",
["haste rating"] = "Haste Rating",
@@ -196,7 +196,7 @@ statNames = {
["shadow resistance"] = "Shadow Resistance",
}
-keyDetectors = {
+ww_keyDetectors = {
[1] = "Always",
[2] = "Never",
[3] = "Shift",
@@ -221,7 +221,7 @@ keyDetectors = {
["Control"] = IsControlKeyDown,
}
-classNameOptions = {
+ww_classNameOptions = {
[1] = "Always",
[2] = "Others",
[3] = "Never",
@@ -230,7 +230,7 @@ classNameOptions = {
["Never"] = "Never",
}
-defaultVars = {
+ww_defaultVars = {
dataMajorVersion = 1,
dataMinorVersion = 14,
weightsList = {
@@ -760,7 +760,7 @@ defaultVars = {
},
}
-defaultCharVars = {
+ww_defaultCharVars = {
dataMajorVersion = 1,
dataMinorVersion = 0,
activeWeights = {},
diff --git a/future-features b/future-features
index 981b273..ee84418 100644
--- a/future-features
+++ b/future-features
@@ -1,6 +1,6 @@
Weighted total of a character's gear (like GearScore), but using the default weights for that class/spec
add option to use an alternate weight instead/in addition to the default
- default here is from defaultVars, NOT just the weight with the default's name in ww_vars
+ default here is from ww_defaultVars, NOT just the weight with the default's name in ww_vars
import/export from/to wowhead weights
diff --git a/weights.lua b/weights.lua
index eb2c3e2..6813f15 100644
--- a/weights.lua
+++ b/weights.lua
@@ -1,4 +1,4 @@
-function validateNumber(newChar, newText)
+function ww_validateNumber(newChar, newText)
if string.find(newChar, "^%d$") then
return true
elseif newChar == '.' then
@@ -15,7 +15,7 @@ function validateNumber(newChar, newText)
return false
end
-function scrollBarUpdate(scrollFrame, scrolledFrame, buttonHeight, initialOffset, numShown)
+function ww_scrollBarUpdate(scrollFrame, scrolledFrame, buttonHeight, initialOffset, numShown)
local i
local offset = FauxScrollFrame_GetOffset(scrollFrame)
offset = offset / 5
@@ -42,7 +42,7 @@ function scrollBarUpdate(scrollFrame, scrolledFrame, buttonHeight, initialOffset
end
--moves the editbox focus to the next available edit box
-function changeFocus(currentStatFrame)
+function ww_changeFocus(currentStatFrame)
local frame, offset
local timesLooped = 0
local elements = ww_weights.rightPanel.scrollFrame.shown
@@ -84,7 +84,7 @@ function changeFocus(currentStatFrame)
end
end
-function configDiscardChanges(func)
+function ww_configDiscardChanges(func)
if ww_weights.rightPanel:IsShown() and ww_weights.rightPanel.changedStats then
for _, _ in pairs(ww_weights.rightPanel.changedStats) do
local popup = StaticPopup_Show("WW_CONFIRM_DISCARD_CHANGES")
@@ -95,18 +95,18 @@ function configDiscardChanges(func)
func()
end
-function selectWeight(class, name)
+function ww_selectWeight(class, name)
for _, classFrame in ipairs(ww_weights.leftPanel.scrollFrame.categories) do
if classFrame.class == class then
local children = {classFrame:GetChildren()}
- configSelectWeight(children[classFrame:GetNumChildren()])
+ ww_configSelectWeight(children[classFrame:GetNumChildren()])
break
end
end
end
--opens a new config pane to edit stat weights
-function configSelectWeight(weightFrame)
+function ww_configSelectWeight(weightFrame)
if ww_weights.rightPanel.weightFrame then
ww_weights.rightPanel.weightFrame.text.highlightFrame:Hide()
end
@@ -118,7 +118,7 @@ function configSelectWeight(weightFrame)
ww_weights.rightPanel.changedTriggers = {}
-- Fills the right panel with the current weight's stats
- configResetWeight()
+ ww_configResetWeight()
for _, categoryFrame in ipairs(ww_weights.rightPanel.scrollFrame.categories) do
local empty = true
@@ -150,7 +150,7 @@ function configSelectWeight(weightFrame)
ww_weights.rightPanel:Show()
end
-function configResetWeight()
+function ww_configResetWeight()
local value
local changed = false
@@ -197,11 +197,11 @@ function configResetWeight()
ww_weights.rightPanel.resetButton:Disable()
end
-function configDeleteWeight()
+function ww_configDeleteWeight()
StaticPopup_Show("WW_CONFIRM_WEIGHT_DELETE", ww_weights.rightPanel.weightFrame.category.name, ww_weights.rightPanel.weightFrame.name)
end
-function configSaveWeight()
+function ww_configSaveWeight()
local number
local weightFrame = ww_weights.rightPanel.weightFrame
@@ -298,8 +298,8 @@ local function deleteWeight()
ww_weights.leftPanel.scrollFrame:GetScript("OnShow")(ww_weights.leftPanel.scrollFrame)
end
-function configNewWeight(class, weight, statList)
- configDiscardChanges(function()
+function ww_configNewWeight(class, weight, statList)
+ ww_configDiscardChanges(function()
-- Need to call show first to re-initialize the dropdown
ww_newWeight:Show()
if class then
@@ -318,7 +318,7 @@ function configNewWeight(class, weight, statList)
end)
end
-function setWeight(class, weight, statList)
+function ww_setWeight(class, weight, statList)
local weightFrame, position
if not ww_vars.weightsList[class][weight] then
@@ -331,7 +331,7 @@ function setWeight(class, weight, statList)
weightFrame.text:SetText(weight)
weightFrame.name = weight
weightFrame:SetPoint("TOPLEFT", 0, -22 * position)
- if defaultVars.weightsList[class] and defaultVars.weightsList[class][weight] then
+ if ww_defaultVars.weightsList[class] and ww_defaultVars.weightsList[class][weight] then
local fontString = weightFrame.text:GetFontString()
fontString:SetTextColor(1, 1, 1)
weightFrame.text:SetFontString(fontString)
@@ -354,7 +354,7 @@ function setWeight(class, weight, statList)
table.insert(ww_vars.weightsList[class], weight)
ww_weights.leftPanel.scrollFrame:GetScript("OnShow")(ww_weights.leftPanel.scrollFrame)
end
- ww_vars.weightsList[class][weight] = deepTableCopy(statList)
+ ww_vars.weightsList[class][weight] = ww_deepTableCopy(statList)
end
-- Creates a tiered list that can be scrolled
@@ -405,7 +405,7 @@ local function loadClassButtons()
local classes, revClassLookup, newClass = {}, {}
for i, class in ipairs(ww_vars.weightsList) do
- newClass = classNames[class]
+ newClass = ww_classDisplayNames[class]
revClassLookup[newClass] = class
classes[i] = newClass
classes[newClass] = {}
@@ -430,7 +430,7 @@ local function loadClassButtons()
end
end
end
- if defaultVars.weightsList[classFrame.class] and defaultVars.weightsList[classFrame.class][weightFrame.name] then
+ if ww_defaultVars.weightsList[classFrame.class] and ww_defaultVars.weightsList[classFrame.class][weightFrame.name] then
local fontString = weightFrame.text:GetFontString()
fontString:SetTextColor(1, 1, 1)
weightFrame.text:SetFontString(fontString)
@@ -446,15 +446,15 @@ end
local function loadStatButtons()
local stats = {}
- createScrollableTieredList(trackedStats, ww_weights.rightPanel.scrollFrame, ww_weights.rightPanel.scrollContainer, "ww_statFrame", 22)
+ createScrollableTieredList(ww_trackedStats, ww_weights.rightPanel.scrollFrame, ww_weights.rightPanel.scrollContainer, "ww_statFrame", 22)
for _, categoryFrame in ipairs(ww_weights.rightPanel.scrollFrame.categories) do
if categoryFrame.name == "Triggers" then
- for i, trigger in ipairs(triggerNames) do
+ for i, trigger in ipairs(ww_triggerNames) do
local triggerFrame = CreateFrame("Frame", "WW_" .. trigger, categoryFrame, "ww_triggerFrame")
triggerFrame.position = i
triggerFrame.category = categoryFrame
- triggerFrame.text:SetText(triggerNames[trigger])
+ triggerFrame.text:SetText(ww_triggerNames[trigger])
triggerFrame.active:SetText(trigger)
triggerFrame.name = trigger
triggerFrame:SetPoint("TOPLEFT", 0, -ww_weights.rightPanel.scrollFrame.elementHeight * i)
@@ -478,12 +478,12 @@ local function loadStatButtons()
end
-- initializes weights config frames and variables
-function initializeWeightsConfig()
+function ww_initializeWeightsConfig()
loadClassButtons()
loadStatButtons()
end
-function toggleCollapse(categoryFrame, scrollFrame)
+function ww_toggleCollapse(categoryFrame, scrollFrame)
if categoryFrame.length == 1 then
return
end
@@ -522,12 +522,12 @@ local function DropDownOnClick(choice, dropdown)
UIDropDownMenu_SetSelectedValue(dropdown, choice.value, false)
end
-function ClassDropDownInitialize(dropdown)
+function ww_ClassDropDownInitialize(dropdown)
local info = {}
info.func = DropDownOnClick
info.arg1 = dropdown
- for class, name in pairs(classNames) do
+ for class, name in pairs(ww_classDisplayNames) do
info.text = name
info.value = class
info.checked = nil
@@ -544,7 +544,7 @@ StaticPopupDialogs["WW_CONFIRM_DISCARD_CHANGES"] = {
func()
end,
OnAlt = function(self, func)
- configSaveWeight()
+ ww_configSaveWeight()
func()
end,
showAlert = true,
@@ -571,15 +571,15 @@ StaticPopupDialogs["WW_CONFIRM_RESTORE_DEFAULTS"] = {
button1 = "Restore Defaults",
button2 = "Cancel",
OnAccept = function()
- for _, class in ipairs(defaultVars.weightsList) do
- for _, weight in ipairs(defaultVars.weightsList[class]) do
- setWeight(class, weight, defaultVars.weightsList[class][weight])
+ for _, class in ipairs(ww_defaultVars.weightsList) do
+ for _, weight in ipairs(ww_defaultVars.weightsList[class]) do
+ ww_setWeight(class, weight, ww_defaultVars.weightsList[class][weight])
ww_weightCache[class][weight] = nil
ww_weightIdealCache[class][weight] = nil
end
end
if ww_weights.rightPanel:IsShown() then
- configSelectWeight(ww_weights.rightPanel.weightFrame)
+ ww_configSelectWeight(ww_weights.rightPanel.weightFrame)
end
end,
showAlert = true,
diff --git a/weights.xml b/weights.xml
index b14c545..91f2d24 100644
--- a/weights.xml
+++ b/weights.xml
@@ -102,7 +102,7 @@
self:SetFontString(fontString)
</OnLoad>
<OnClick>
- toggleCollapse(self:GetParent(), self:GetParent():GetParent():GetParent().scrollFrame)
+ ww_toggleCollapse(self:GetParent(), self:GetParent():GetParent():GetParent().scrollFrame)
if self:GetParent().collapsed then
self:SetNormalTexture("Interface\\Buttons\\UI-PlusButton-UP")
self:SetPushedTexture("Interface\\Buttons\\UI-PlusButton-DOWN")
@@ -212,7 +212,7 @@
end
</OnTextChanged>
<OnChar>
- if validateNumber(text, self:GetText()) then
+ if ww_validateNumber(text, self:GetText()) then
self.number = self:GetText()
else
local cursorPosition = self:GetCursorPosition() - 1
@@ -229,7 +229,7 @@
self:HighlightText(0,0)
</OnEditFocusLost>
<OnTabPressed>
- changeFocus(self:GetParent())
+ ww_changeFocus(self:GetParent())
</OnTabPressed>
<OnEscapePressed>
self:ClearFocus()
@@ -399,8 +399,8 @@
</Frames>
<Scripts>
<OnClick>
- configDiscardChanges(function()
- configSelectWeight(self:GetParent())
+ ww_configDiscardChanges(function()
+ ww_configSelectWeight(self:GetParent())
end)
</OnClick>
<OnLoad>
@@ -477,7 +477,7 @@
</Anchors>
<Scripts>
<OnShow>
- scrollBarUpdate(self, ww_weights.leftPanel.scrollContainer, 22, 0, 25)
+ ww_scrollBarUpdate(self, ww_weights.leftPanel.scrollContainer, 22, 0, 25)
</OnShow>
<OnVerticalScroll>
FauxScrollFrame_OnVerticalScroll(self, offset, 22, self:GetScript("OnShow"))
@@ -540,7 +540,7 @@
</Anchors>
<Scripts>
<OnClick>
- configSaveWeight()
+ ww_configSaveWeight()
</OnClick>
</Scripts>
</Button>
@@ -558,7 +558,7 @@
</Anchors>
<Scripts>
<OnClick>
- configNewWeight(self:GetParent().weightFrame.category.class, "Copy of " .. self:GetParent().weightFrame.name, self:GetParent().statList)
+ ww_configNewWeight(self:GetParent().weightFrame.category.class, "Copy of " .. self:GetParent().weightFrame.name, self:GetParent().statList)
</OnClick>
</Scripts>
</Button>
@@ -576,7 +576,7 @@
</Anchors>
<Scripts>
<OnClick>
- configResetWeight()
+ ww_configResetWeight()
</OnClick>
</Scripts>
</Button>
@@ -594,7 +594,7 @@
</Anchors>
<Scripts>
<OnClick>
- configDeleteWeight()
+ ww_configDeleteWeight()
</OnClick>
</Scripts>
</Button>
@@ -617,7 +617,7 @@
</Anchors>
<Scripts>
<OnShow>
- scrollBarUpdate(self, ww_weights.rightPanel.scrollContainer, 22, -30, 22)
+ ww_scrollBarUpdate(self, ww_weights.rightPanel.scrollContainer, 22, -30, 22)
</OnShow>
<OnVerticalScroll>
FauxScrollFrame_OnVerticalScroll(self, offset, 22, self:GetScript("OnShow"))
@@ -628,7 +628,7 @@
<Scripts>
<OnShow>
if not ww_weights.popup then
- changeFocus(self.scrollFrame.stats[#(self.scrollFrame.stats)])
+ ww_changeFocus(self.scrollFrame.stats[#(self.scrollFrame.stats)])
end
</OnShow>
</Scripts>
@@ -649,10 +649,10 @@
</Anchors>
<Scripts>
<OnClick>
- if ww_weights.rightPanel.weightFrame and defaultVars.weightsList[ww_weights.rightPanel.weightFrame.category.class][ww_weights.rightPanel.weightFrame.name] then
+ if ww_weights.rightPanel.weightFrame and ww_defaultVars.weightsList[ww_weights.rightPanel.weightFrame.category.class][ww_weights.rightPanel.weightFrame.name] then
StaticPopup_Show("WW_CONFIRM_RESTORE_DEFAULTS")
else
- configDiscardChanges(function()
+ ww_configDiscardChanges(function()
StaticPopup_Show("WW_CONFIRM_RESTORE_DEFAULTS")
end)
end
@@ -669,7 +669,7 @@
</Anchors>
<Scripts>
<OnClick>
- configNewWeight()
+ ww_configNewWeight()
</OnClick>
</Scripts>
</Button>
@@ -684,11 +684,11 @@
else
self.popup = true
self:Show()
- configDiscardChanges(function()
+ ww_configDiscardChanges(function()
self.reallyClose = true
- <!-- Safe because configDiscardChanges will save the weight first -->
+ <!-- Safe because ww_configDiscardChanges will save the weight first -->
if self.rightPanel:IsShown() then
- configResetWeight()
+ ww_configResetWeight()
end
self:Hide()
end)
@@ -844,10 +844,10 @@
local class = UIDropDownMenu_GetSelectedValue(self:GetParent().dropdown)
local name = self:GetParent().editBox:GetText()
if ww_vars.weightsList[class][name] then
- local error = StaticPopup_Show("WW_WEIGHT_EXISTS", classNames[class], name)
+ local error = StaticPopup_Show("WW_WEIGHT_EXISTS", ww_classDisplayNames[class], name)
else
- setWeight(class, name, self:GetParent().statList)
- selectWeight(class, name)
+ ww_setWeight(class, name, self:GetParent().statList)
+ ww_selectWeight(class, name)
self:GetParent():Hide()
end
</OnClick>