This commit is contained in:
Bunny67
2020-09-14 10:12:22 +03:00
parent 6c3f9d925e
commit 0f4f16b6f0
71 changed files with 2302 additions and 2431 deletions
+14 -15
View File
@@ -4,8 +4,7 @@ local AddonName, Private = ...
-- Animations
local animations = {}
local pending_controls = {}
local anim_presets = WeakAuras.anim_presets;
local anim_function_strings = WeakAuras.anim_function_strings;
local anim_function_strings = Private.anim_function_strings;
local function noopErrorHandler() end
@@ -14,7 +13,7 @@ local frame = WeakAuras.frames["WeakAuras Main Frame"]
local updatingAnimations;
local last_update = GetTime();
local function UpdateAnimations()
WeakAuras.StartProfileSystem("animations");
Private.StartProfileSystem("animations");
local errorHandler = WeakAuras.IsOptionsOpen() and noopErrorHandler or geterrorhandler()
for groupUid, groupRegion in pairs(pending_controls) do
pending_controls[groupUid] = nil;
@@ -26,7 +25,7 @@ local function UpdateAnimations()
last_update = time;
local num = 0;
for key, anim in pairs(animations) do
WeakAuras.StartProfileUID(anim.auraUID);
Private.StartProfileUID(anim.auraUID);
num = num + 1;
local finished = false;
if(anim.duration_type == "seconds") then
@@ -168,15 +167,15 @@ local function UpdateAnimations()
end
if(anim.loop) then
WeakAuras.Animate(anim.namespace, anim.auraUID, anim.type, anim.anim, anim.region, anim.inverse, anim.onFinished, anim.loop, anim.region.cloneId);
Private.Animate(anim.namespace, anim.auraUID, anim.type, anim.anim, anim.region, anim.inverse, anim.onFinished, anim.loop, anim.region.cloneId);
elseif(anim.onFinished) then
anim.onFinished();
end
end
WeakAuras.StopProfileUID(anim.auraUID);
Private.StopProfileUID(anim.auraUID);
end
WeakAuras.StopProfileSystem("animations");
Private.StopProfileSystem("animations");
end
function Private.RegisterGroupForPositioning(uid, region)
@@ -185,14 +184,14 @@ function Private.RegisterGroupForPositioning(uid, region)
frame:SetScript("OnUpdate", UpdateAnimations)
end
function WeakAuras.Animate(namespace, uid, type, anim, region, inverse, onFinished, loop, cloneId)
local auraDisplayName = WeakAuras.UIDtoID(uid)
function Private.Animate(namespace, uid, type, anim, region, inverse, onFinished, loop, cloneId)
local auraDisplayName = Private.UIDtoID(uid)
local key = tostring(region);
local valid;
if(anim and anim.type == "custom" and (anim.use_translate or anim.use_alpha or (anim.use_scale and region.Scale) or (anim.use_rotate and region.Rotate) or (anim.use_color and region.Color))) then
valid = true;
elseif(anim and anim.type == "preset" and anim.preset and anim_presets[anim.preset]) then
anim = anim_presets[anim.preset];
elseif(anim and anim.type == "preset" and anim.preset and Private.anim_presets[anim.preset]) then
anim = Private.anim_presets[anim.preset];
valid = true;
end
if(valid) then
@@ -316,9 +315,9 @@ function WeakAuras.Animate(namespace, uid, type, anim, region, inverse, onFinish
elseif(region.ColorAnim) then
region:ColorAnim(nil);
end
easeFunc = WeakAuras.anim_ease_functions[anim.easeType or "none"]
easeFunc = Private.anim_ease_functions[anim.easeType or "none"]
duration = WeakAuras.ParseNumber(anim.duration) or 0;
duration = Private.ParseNumber(anim.duration) or 0;
progress = 0;
if(namespace == "display" and type == "main" and not onFinished and not anim.duration_type == "relative") then
local data = Private.GetDataByUID(uid);
@@ -387,14 +386,14 @@ function WeakAuras.Animate(namespace, uid, type, anim, region, inverse, onFinish
else
if(animations[key]) then
if(animations[key].type ~= type or loop) then
WeakAuras.CancelAnimation(region, true, true, true, true, true);
Private.CancelAnimation(region, true, true, true, true, true);
end
end
return false;
end
end
function WeakAuras.CancelAnimation(region, resetPos, resetAlpha, resetScale, resetRotation, resetColor, doOnFinished)
function Private.CancelAnimation(region, resetPos, resetAlpha, resetScale, resetRotation, resetColor, doOnFinished)
local key = tostring(region);
local anim = animations[key];
+76 -8
View File
@@ -3,7 +3,6 @@ local AddonName, Private = ...
local WeakAuras = WeakAuras
local L = WeakAuras.L
local prettyPrint = WeakAuras.prettyPrint
local UnitAura = UnitAura
-- Unit Aura functions that return info about the first Aura matching the spellName or spellID given on the unit.
@@ -55,7 +54,7 @@ local WA_ClassColorName = function(unit)
if not class then
return name
else
local classData = RAID_CLASS_COLORS[class]
local classData = (CUSTOM_CLASS_COLORS or RAID_CLASS_COLORS)[class]
local coloredName = ("|c%s%s|r"):format(classData.colorStr, name)
return coloredName
end
@@ -268,9 +267,9 @@ function Private.ActivateAuraEnvironment(id, cloneId, state, states, onlyConfig)
end
end
local function blocked()
local function blocked(key)
Private.AuraWarnings.UpdateWarning(current_uid, "SandboxForbidden", "error",
L["Forbidden function or table."])
string.format(L["Forbidden function or table: %s"], key))
end
local function MakeReadOnly(input, options)
@@ -278,9 +277,11 @@ local function MakeReadOnly(input, options)
{
__index = function(t, k)
if options.blockedFunctions[k] then
return options.blocked
options.blocked(k)
return function() end
elseif options.blockedTables[k] then
return options.blocked()
options.blocked(k)
return {}
elseif options.override[k] then
return options.override[k]
else
@@ -294,12 +295,79 @@ end
local FakeWeakAurasMixin = {
blockedFunctions = {
-- Other addons might use these, so before moving them to the Private space, we need
-- to discuss these. But Auras have no purpose for calling these
Add = true,
AddMany = true,
AddManyFromAddons = true,
Delete = true,
DeleteOption = true,
GetData = true,
HideOptions = true,
Rename = true,
Delete = true
NewAura = true,
OptionsFrame = true,
RegisterAddon = true,
RegisterDisplay = true,
RegisterRegionOptions = true,
RegisterSubRegionOptions = true,
RegisterSubRegionType = true,
RegisterRegionType = true,
RegisterTriggerSystem = true,
RegisterTriggerSystemOptions = true,
ShowOptions = true,
-- Note these shouldn't exist in the WeakAuras namespace, but moving them takes a bit of effort,
-- so for now just block them and clean them up later
CollisionResolved = true,
ClearAndUpdateOptions = true,
CloseCodeReview = true,
CloseImportExport = true,
CreateTemplateView = true,
DeleteOption = true,
DeleteCollapsedData = true,
DisplayToString = true,
FillOptions = true,
FindUnusedId = true,
GetMoverSizerId = true,
GetDisplayButton = true,
Import = true,
NewDisplayButton = true,
NewAura = true,
OpenTriggerTemplate = true,
OpenCodeReview = true,
PickDisplay = true,
RenameCollapsedData = true,
SetMoverSizer = true,
SetImporting = true,
SortDisplayButtons = true,
ShowOptions = true,
ToggleOptions = true,
UpdateDisplayButton = true,
UpdateGroupOrders = true,
UpdateThumbnail = true,
validate = true,
getDefaultGlow = true,
-- Note, I'm too lazy to move these to private because the code needs to deleted...
IsDefinedByAddon = true,
},
blockedTables = {
AuraWarnings = true
AuraWarnings = true,
ModelPaths = true,
regionPrototype = true,
-- Note these shouldn't exist in the WeakAuras namespace, but moving them takes a bit of effort,
-- so for now just block them and clean them up later
data_stub = true,
displayButtons = true,
regionTypes = true,
regionOptions = true,
spellCache = true,
triggerTemplates = true,
frames = true,
loadFrame = true,
unitLoadFrame = true,
importDisplayButtons = true
},
override = {
me = UnitName("player"),
+1 -1
View File
@@ -22,7 +22,7 @@ local function UpdateWarning(uid, key, severity, message, printOnConsole)
if printOnConsole then
printedWarnings[uid] = printedWarnings[uid] or {}
if printedWarnings[uid][key] == nil then
WeakAuras.prettyPrint(string.format(L["Aura '%s': %s"], WeakAuras.UIDtoID(uid), message))
WeakAuras.prettyPrint(string.format(L["Aura '%s': %s"], Private.UIDtoID(uid), message))
printedWarnings[uid][key] = true
end
end
+40 -70
View File
@@ -16,9 +16,6 @@ Unloads the aura ids, disabling all buff triggers in the aura.
UnloadAll()
Unloads all auras, disabling all buff triggers.
ScanAll()
Updates all triggers by checking all triggers.
Delete(id)
Removes all data for aura id.
@@ -92,7 +89,7 @@ local groupScanFuncs = {}
local activeGroupScanFuncs = {}
-- Mutli Target tracking
-- Multi Target tracking
local scanFuncNameMulti = {}
local scanFuncSpellIdMulti = {}
local cleanupTimerMulti = {}
@@ -237,10 +234,10 @@ local function UpdateMatchData(time, matchDataChanged, unit, index, filter, name
duration = duration,
expirationTime = expirationTime,
unitCaster = unitCaster,
casterName = unitCaster and UnitName(unitCaster) or "",
casterName = unitCaster and GetUnitName(unitCaster, false) or "",
spellId = spellId,
unit = unit,
unitName = UnitName(unit) or "",
unitName = GetUnitName(unit, false) or "",
isStealable = isStealable,
time = time,
lastChanged = time,
@@ -290,7 +287,7 @@ local function UpdateMatchData(time, matchDataChanged, unit, index, filter, name
changed = true
end
local casterName = unitCaster and UnitName(unitCaster) or ""
local casterName = unitCaster and GetUnitName(unitCaster, false) or ""
if data.casterName ~= casterName then
data.casterName = casterName
changed = true
@@ -306,7 +303,7 @@ local function UpdateMatchData(time, matchDataChanged, unit, index, filter, name
changed = true
end
local unitName = UnitName(unit) or ""
local unitName = GetUnitName(unit, false) or ""
if data.unitName ~= unitName then
data.unitName = unitName
changed = true
@@ -617,7 +614,7 @@ local function UpdateStateWithNoMatch(time, triggerStates, triggerInfo, cloneId,
affected = affected,
unaffected = unaffected,
unit = unit,
unitName = unit and UnitName(unit) or "",
unitName = unit and GetUnitName(unit, false) or "",
destName = "",
name = fallbackName,
icon = fallbackIcon,
@@ -669,7 +666,7 @@ local function UpdateStateWithNoMatch(time, triggerStates, triggerInfo, cloneId,
changed = true
end
local unitName = unit and UnitName(unit) or ""
local unitName = unit and GetUnitName(unit, false) or ""
if state.unitName ~= unitName then
state.unitName = unitName
changed = true
@@ -881,7 +878,7 @@ local function TriggerInfoApplies(triggerInfo, unit)
if triggerInfo.unit == "group" and triggerInfo.groupSubType == "party" then
if IsInRaid() then
-- Filter our player/party# while in raid and keep only raid units that are correct
if not WeakAuras.multiUnitUnits.raid[unit] or not UnitIsUnit("player", unit) then
if not Private.multiUnitUnits.raid[unit] or not UnitIsUnit("player", unit) then
return false
end
else
@@ -892,11 +889,11 @@ local function TriggerInfoApplies(triggerInfo, unit)
end
-- Filter our player/party# while in raid
if (triggerInfo.unit == "group" and triggerInfo.groupSubType == "group" and IsInRaid() and not WeakAuras.multiUnitUnits.raid[unit]) then
if (triggerInfo.unit == "group" and triggerInfo.groupSubType == "group" and IsInRaid() and not Private.multiUnitUnits.raid[unit]) then
return false
end
if triggerInfo.unit == "group" and triggerInfo.groupSubType == "raid" and not WeakAuras.multiUnitUnits.raid[unit] then
if triggerInfo.unit == "group" and triggerInfo.groupSubType == "raid" and not Private.multiUnitUnits.raid[unit] then
return false
end
@@ -917,9 +914,9 @@ local function FormatAffectedUnaffected(triggerInfo, matchedUnits)
for unit in GetAllUnits(triggerInfo.unit) do
if activeGroupScanFuncs[unit] and activeGroupScanFuncs[unit][triggerInfo] then
if matchedUnits[unit] then
affected = affected .. (UnitName(unit) or unit) .. ", "
affected = affected .. (GetUnitName(unit, false) or unit) .. ", "
else
unaffected = unaffected .. (UnitName(unit) or unit) .. ", "
unaffected = unaffected .. (GetUnitName(unit, false) or unit) .. ", "
end
end
end
@@ -1295,15 +1292,15 @@ end
local function UpdateStates(matchDataChanged, time)
for id, auraData in pairs(matchDataChanged) do
WeakAuras.StartProfileAura(id)
Private.StartProfileAura(id)
local updated = false
for triggernum in pairs(auraData) do
updated = UpdateTriggerState(time, id, triggernum) or updated
end
if updated then
WeakAuras.UpdatedTriggerState(id)
Private.UpdatedTriggerState(id)
end
WeakAuras.StopProfileAura(id)
Private.StopProfileAura(id)
end
end
@@ -1361,7 +1358,7 @@ end
local function ScanAllGroup(time, matchDataChanged)
-- We iterate over all raid/player unit ids here because ScanGroupUnit also
-- handles the cases where a unit existance changes.
-- handles the cases where a unit existence changes.
for unit in GetAllUnits("group") do
ScanGroupUnit(time, matchDataChanged, "group", unit)
end
@@ -1375,13 +1372,13 @@ end
local function ScanUnit(time, arg1)
if not arg1 then return end
if (WeakAuras.multiUnitUnits.raid[arg1] and IsInRaid()) then
if (Private.multiUnitUnits.raid[arg1] and IsInRaid()) then
ScanGroupUnit(time, matchDataChanged, "group", arg1)
elseif (WeakAuras.multiUnitUnits.party[arg1] and not IsInRaid()) then
elseif (Private.multiUnitUnits.party[arg1] and not IsInRaid()) then
ScanGroupUnit(time, matchDataChanged, "group", arg1)
elseif WeakAuras.multiUnitUnits.boss[arg1] then
elseif Private.multiUnitUnits.boss[arg1] then
ScanGroupUnit(time, matchDataChanged, "boss", arg1)
elseif WeakAuras.multiUnitUnits.arena[arg1] then
elseif Private.multiUnitUnits.arena[arg1] then
ScanGroupUnit(time, matchDataChanged, "arena", arg1)
else
ScanGroupUnit(time, matchDataChanged, nil, arg1)
@@ -1488,7 +1485,7 @@ WeakAuras.frames["WeakAuras Buff2 Frame"] = frame
local function EventHandler(frame, event, arg1, arg2, ...)
WeakAuras.StartProfileSystem("bufftrigger2")
Private.StartProfileSystem("bufftrigger2")
local deactivatedTriggerInfos = {}
local unitsToRemove = {}
@@ -1534,7 +1531,7 @@ local function EventHandler(frame, event, arg1, arg2, ...)
end
end
elseif event == "UNIT_FLAGS" or event == "UNIT_NAME_UPDATE" or event == "PLAYER_FLAGS_CHANGED" then
if WeakAuras.multiUnitUnits.group[arg1] then
if Private.multiUnitUnits.group[arg1] then
RecheckActiveForUnitType("group", arg1, deactivatedTriggerInfos)
end
elseif event == "UNIT_ENTERED_VEHICLE" or event == "UNIT_EXITED_VEHICLE" then
@@ -1560,7 +1557,7 @@ local function EventHandler(frame, event, arg1, arg2, ...)
matchDataUpToDate[unit] = nil
end
WeakAuras.StopProfileSystem("bufftrigger2")
Private.StopProfileSystem("bufftrigger2")
end
frame:RegisterEvent("UNIT_AURA")
@@ -1583,42 +1580,15 @@ frame:SetScript("OnUpdate", function()
if WeakAuras.IsPaused() then
return
end
WeakAuras.StartProfileSystem("bufftrigger2")
Private.StartProfileSystem("bufftrigger2")
if next(matchDataChanged) then
local time = GetTime()
UpdateStates(matchDataChanged, time)
wipe(matchDataChanged)
end
WeakAuras.StopProfileSystem("bufftrigger2")
Private.StopProfileSystem("bufftrigger2")
end)
function BuffTrigger.ScanAll()
local units = {}
local time = GetTime()
for unit in pairs(scanFuncName) do
units[unit] = true
end
for unit in pairs(scanFuncSpellId) do
units[unit] = true
end
for unit in pairs(scanFuncGeneral) do
units[unit] = true
end
for unit in pairs(units) do
if unit == "group" then
ScanAllGroup(time, matchDataChanged)
elseif unit == "boss" then
ScanAllBoss(time, matchDataChanged)
else
ScanGroupUnit(time, matchDataChanged, nil, unit)
end
end
end
local function UnloadAura(scanFuncName, id)
for unit, unitData in pairs(scanFuncName) do
for debuffType, debuffData in pairs(unitData) do
@@ -1909,7 +1879,7 @@ local function createScanFunc(trigger)
return false
end
]]
ret = ret .. ret2:format(trigger.debuffClass and type(trigger.debuffClass) == "table" and WeakAuras.SerializeTable(trigger.debuffClass) or "{}")
ret = ret .. ret2:format(trigger.debuffClass and type(trigger.debuffClass) == "table" and Private.SerializeTable(trigger.debuffClass) or "{}")
end
if trigger.ownOnly then
@@ -2088,7 +2058,7 @@ function BuffTrigger.Add(data)
local remFunc
if trigger.unit ~= "multi" and not IsSingleMissing(trigger) and trigger.useRem then
local remFuncStr = WeakAuras.function_strings.count:format(trigger.remOperator or ">=", tonumber(trigger.rem) or 0)
local remFuncStr = Private.function_strings.count:format(trigger.remOperator or ">=", tonumber(trigger.rem) or 0)
remFunc = WeakAuras.LoadFunction(remFuncStr)
end
@@ -2109,15 +2079,15 @@ function BuffTrigger.Add(data)
local groupCountFunc
if effectiveUseGroupCount then
local group_countFuncStr
local count, countType = WeakAuras.ParseNumber(trigger.group_count)
local count, countType = Private.ParseNumber(trigger.group_count)
if trigger.group_countOperator and count and countType then
if countType == "whole" then
group_countFuncStr = WeakAuras.function_strings.count:format(trigger.group_countOperator, count)
group_countFuncStr = Private.function_strings.count:format(trigger.group_countOperator, count)
else
group_countFuncStr = WeakAuras.function_strings.count_fraction:format(trigger.group_countOperator, count)
group_countFuncStr = Private.function_strings.count_fraction:format(trigger.group_countOperator, count)
end
else
group_countFuncStr = WeakAuras.function_strings.count:format(">", 0)
group_countFuncStr = Private.function_strings.count:format(">", 0)
end
groupCountFunc = WeakAuras.LoadFunction(group_countFuncStr)
end
@@ -2125,7 +2095,7 @@ function BuffTrigger.Add(data)
local matchCountFunc
if HasMatchCount(trigger) and trigger.match_countOperator and trigger.match_count then
local count = tonumber(trigger.match_count)
local match_countFuncStr = WeakAuras.function_strings.count:format(trigger.match_countOperator, count)
local match_countFuncStr = Private.function_strings.count:format(trigger.match_countOperator, count)
matchCountFunc = WeakAuras.LoadFunction(match_countFuncStr)
elseif IsGroupTrigger(trigger) then
if trigger.showClones and not trigger.combinePerUnit then
@@ -2369,7 +2339,7 @@ function BuffTrigger.GetTriggerConditions(data, triggernum)
result["debuffClass"] = {
display = L["Debuff Type"],
type = "select",
values = WeakAuras.debuff_class_types
values = Private.debuff_class_types
}
result["unitCaster"] = {
@@ -2475,7 +2445,7 @@ function BuffTrigger.GetName(triggerType)
end
end
function WeakAuras.CanConvertBuffTrigger2(trigger)
function Private.CanConvertBuffTrigger2(trigger)
if trigger.type ~= "aura" then
return false
end
@@ -2505,8 +2475,8 @@ function WeakAuras.CanConvertBuffTrigger2(trigger)
return true
end
function WeakAuras.ConvertBuffTrigger2(trigger)
if not WeakAuras.CanConvertBuffTrigger2(trigger) then
function Private.ConvertBuffTrigger2(trigger)
if not Private.CanConvertBuffTrigger2(trigger) then
return
end
trigger.type = "aura2"
@@ -2842,7 +2812,7 @@ local function AugmentMatchDataMultiWith(matchData, unit, name, icon, stacks, de
changed = true
end
local casterName = UnitName(unitCaster) or ""
local casterName = GetUnitName(unitCaster, false) or ""
if matchData.casterName ~= casterName then
matchData.casterName = casterName
changed = true
@@ -2853,7 +2823,7 @@ local function AugmentMatchDataMultiWith(matchData, unit, name, icon, stacks, de
changed = true
end
local unitName = UnitName(unit) or ""
local unitName = GetUnitName(unit, false) or ""
if matchData.unitName ~= unitName then
matchData.unitName = unitName
changed = true
@@ -3023,7 +2993,7 @@ function BuffTrigger.InitMultiAura()
end
function BuffTrigger.HandleMultiEvent(frame, event, ...)
WeakAuras.StartProfileSystem("bufftrigger2 - multi")
Private.StartProfileSystem("bufftrigger2 - multi")
if event == "COMBAT_LOG_EVENT_UNFILTERED" then
CombatLog(...)
elseif event == "UNIT_TARGET" then
@@ -3049,7 +3019,7 @@ function BuffTrigger.HandleMultiEvent(frame, event, ...)
end
wipe(matchDataMulti)
end
WeakAuras.StopProfileSystem("bufftrigger2 - multi")
Private.StopProfileSystem("bufftrigger2 - multi")
end
function BuffTrigger.GetTriggerDescription(data, triggernum, namestable)
+10 -10
View File
@@ -376,7 +376,7 @@ local function CreateActivateCondition(ret, id, condition, conditionNumber, prop
return ret;
end
function WeakAuras.GetProperties(data)
function Private.GetProperties(data)
local properties;
local propertiesFunction = WeakAuras.regionTypes[data.regionType] and WeakAuras.regionTypes[data.regionType].properties;
if (type(propertiesFunction) == "function") then
@@ -390,7 +390,7 @@ function WeakAuras.GetProperties(data)
if data.subRegions then
local subIndex = {}
for index, subRegion in ipairs(data.subRegions) do
local subRegionTypeData = WeakAuras.subRegionTypes[subRegion.type];
local subRegionTypeData = Private.subRegionTypes[subRegion.type];
local propertiesFunction = subRegionTypeData and subRegionTypeData.properties
local subProperties;
if (type(propertiesFunction) == "function") then
@@ -442,7 +442,7 @@ function Private.LoadConditionPropertyFunctions(data)
end
return change.value[fullKey]
end
local formatters = change.value and WeakAuras.CreateFormatters(change.value.message, getter)
local formatters = change.value and Private.CreateFormatters(change.value.message, getter)
WeakAuras.conditionTextFormatters[id] = WeakAuras.conditionTextFormatters[id] or {}
WeakAuras.conditionTextFormatters[id][conditionNumber] = WeakAuras.conditionTextFormatters[id][conditionNumber] or {};
WeakAuras.conditionTextFormatters[id][conditionNumber].changes = WeakAuras.conditionTextFormatters[id][conditionNumber].changes or {};
@@ -490,7 +490,7 @@ local globalConditions =
}
}
function WeakAuras.GetGlobalConditions()
function Private.GetGlobalConditions()
return globalConditions;
end
@@ -502,8 +502,8 @@ local function ConstructConditionFunction(data)
local usedProperties = {};
local allConditionsTemplate = WeakAuras.GetTriggerConditions(data);
allConditionsTemplate[-1] = WeakAuras.GetGlobalConditions();
local allConditionsTemplate = Private.GetTriggerConditions(data);
allConditionsTemplate[-1] = Private.GetGlobalConditions();
local ret = "";
ret = ret .. "local newActiveConditions = {};\n"
@@ -535,7 +535,7 @@ local function ConstructConditionFunction(data)
ret = ret .. " WeakAuras.scheduleConditionCheck(recheckTime, id, cloneId);\n"
ret = ret .. " end\n"
local properties = WeakAuras.GetProperties(data);
local properties = Private.GetProperties(data);
-- Now build a property + change list
-- Second Loop deals with conditions that are no longer active
@@ -605,7 +605,7 @@ local globalConditionAllState = {
local globalConditionState = globalConditionAllState[""];
function WeakAuras.GetGlobalConditionState()
function Private.GetGlobalConditionState()
return globalConditionAllState;
end
@@ -694,8 +694,8 @@ function Private.RegisterForGlobalConditions(id)
local register = {};
if (data.conditions) then
local allConditionsTemplate = WeakAuras.GetTriggerConditions(data);
allConditionsTemplate[-1] = WeakAuras.GetGlobalConditions();
local allConditionsTemplate = Private.GetTriggerConditions(data);
allConditionsTemplate[-1] = Private.GetGlobalConditions();
for conditionNumber, condition in ipairs(data.conditions) do
EvaluateCheckForRegisterForGlobalConditions(id, condition.check, allConditionsTemplate, register);
+133 -186
View File
@@ -21,9 +21,6 @@ Unloads all triggers.
UnloadDisplays(id)
Unloads all triggers of the display ids.
ScanAll
Resets the trigger state for all triggers.
Modernize(data)
Modernizes all generic triggers in data.
@@ -71,10 +68,9 @@ local WeakAuras = WeakAuras;
local L = WeakAuras.L;
local GenericTrigger = {};
local event_prototypes = WeakAuras.event_prototypes;
local event_prototypes = Private.event_prototypes;
local timer = WeakAuras.timer;
local debug = WeakAuras.debug;
local events = {}
local loaded_events = {}
@@ -327,7 +323,7 @@ function ConstructFunction(prototype, trigger, inverse)
return ret;
end
function WeakAuras.EndEvent(id, triggernum, force, state)
function Private.EndEvent(id, triggernum, force, state)
if state then
if (state.show ~= false and state.show ~= nil) then
state.show = false;
@@ -404,7 +400,7 @@ local function callFunctionForActivateEvent(func, trigger, fallback, errorHandle
end
end
function WeakAuras.ActivateEvent(id, triggernum, data, state, errorHandler)
function Private.ActivateEvent(id, triggernum, data, state, errorHandler)
local changed = state.changed or false;
if (state.show ~= true) then
state.show = true;
@@ -558,7 +554,7 @@ local function RunTriggerFunc(allStates, data, id, triggernum, event, arg1, arg2
elseif (ok and returnValue) or optionsEvent then
for id, state in pairs(allStates) do
if (state.changed) then
if (WeakAuras.ActivateEvent(id, triggernum, data, state, errorHandler)) then
if (Private.ActivateEvent(id, triggernum, data, state, errorHandler)) then
updateTriggerState = true;
end
end
@@ -568,15 +564,15 @@ local function RunTriggerFunc(allStates, data, id, triggernum, event, arg1, arg2
end
elseif (data.statesParameter == "unit") then
if optionsEvent then
if WeakAuras.multiUnitUnits[data.trigger.unit] then
arg1 = next(WeakAuras.multiUnitUnits[data.trigger.unit])
if Private.multiUnitUnits[data.trigger.unit] then
arg1 = next(Private.multiUnitUnits[data.trigger.unit])
else
arg1 = data.trigger.unit
end
end
if arg1 then
local unit, cloneId
if WeakAuras.multiUnitUnits[data.trigger.unit] then
if Private.multiUnitUnits[data.trigger.unit] then
unit = arg1
cloneId = arg1
else
@@ -589,7 +585,7 @@ local function RunTriggerFunc(allStates, data, id, triggernum, event, arg1, arg2
if not ok then
errorHandler(returnValue)
elseif (ok and returnValue) or optionsEvent then
if(WeakAuras.ActivateEvent(id, triggernum, data, state, errorHandler)) then
if(Private.ActivateEvent(id, triggernum, data, state, errorHandler)) then
updateTriggerState = true;
end
else
@@ -603,7 +599,7 @@ local function RunTriggerFunc(allStates, data, id, triggernum, event, arg1, arg2
if not ok then
errorHandler(returnValue)
elseif (ok and returnValue) or optionsEvent then
if(WeakAuras.ActivateEvent(id, triggernum, data, state, errorHandler)) then
if(Private.ActivateEvent(id, triggernum, data, state, errorHandler)) then
updateTriggerState = true;
end
else
@@ -616,7 +612,7 @@ local function RunTriggerFunc(allStates, data, id, triggernum, event, arg1, arg2
elseif (ok and returnValue) or optionsEvent then
allStates[""] = allStates[""] or {};
local state = allStates[""];
if(WeakAuras.ActivateEvent(id, triggernum, data, state, errorHandler)) then
if(Private.ActivateEvent(id, triggernum, data, state, errorHandler)) then
updateTriggerState = true;
end
else
@@ -632,7 +628,7 @@ local function RunTriggerFunc(allStates, data, id, triggernum, event, arg1, arg2
elseif (ok and returnValue) or optionsEvent then
for id, state in pairs(allStates) do
if (state.changed) then
if (WeakAuras.EndEvent(id, triggernum, nil, state)) then
if (Private.EndEvent(id, triggernum, nil, state)) then
updateTriggerState = true;
end
end
@@ -642,14 +638,14 @@ local function RunTriggerFunc(allStates, data, id, triggernum, event, arg1, arg2
elseif data.statesParameter == "unit" then
if data.untriggerFunc then
if arg1 then
local cloneId = WeakAuras.multiUnitUnits[data.trigger.unit] and arg1 or ""
local cloneId = Private.multiUnitUnits[data.trigger.unit] and arg1 or ""
local state = allStates[cloneId]
if state then
local ok, returnValue = pcall(data.untriggerFunc, state, event, arg1, arg2, ...);
if not ok then
errorHandler(returnValue)
elseif ok and returnValue then
if (WeakAuras.EndEvent(id, triggernum, nil, state)) then
if (Private.EndEvent(id, triggernum, nil, state)) then
updateTriggerState = true;
end
end
@@ -664,7 +660,7 @@ local function RunTriggerFunc(allStates, data, id, triggernum, event, arg1, arg2
if not ok then
errorHandler(returnValue)
elseif (ok and returnValue) then
if (WeakAuras.EndEvent(id, triggernum, nil, state)) then
if (Private.EndEvent(id, triggernum, nil, state)) then
updateTriggerState = true;
end
end
@@ -677,7 +673,7 @@ local function RunTriggerFunc(allStates, data, id, triggernum, event, arg1, arg2
elseif (ok and returnValue) then
allStates[""] = allStates[""] or {};
local state = allStates[""];
if(WeakAuras.EndEvent(id, triggernum, nil, state)) then
if(Private.EndEvent(id, triggernum, nil, state)) then
updateTriggerState = true;
end
end
@@ -690,40 +686,40 @@ end
function WeakAuras.ScanEvents(event, arg1, arg2, ...)
local orgEvent = event;
WeakAuras.StartProfileSystem("generictrigger " .. orgEvent )
Private.StartProfileSystem("generictrigger " .. orgEvent )
local event_list = loaded_events[event];
if (not event_list) then
WeakAuras.StopProfileSystem("generictrigger " .. orgEvent )
Private.StopProfileSystem("generictrigger " .. orgEvent )
return
end
if(event == "COMBAT_LOG_EVENT_UNFILTERED") then
event_list = event_list[arg2];
if (not event_list) then
WeakAuras.StopProfileSystem("generictrigger " .. orgEvent )
Private.StopProfileSystem("generictrigger " .. orgEvent )
return;
end
WeakAuras.ScanEventsInternal(event_list, event, arg1, arg2, ...);
Private.ScanEventsInternal(event_list, event, arg1, arg2, ...);
elseif (event == "COMBAT_LOG_EVENT_UNFILTERED_CUSTOM") then
-- This reverts the COMBAT_LOG_EVENT_UNFILTERED_CUSTOM workaround so that custom triggers that check the event argument will work as expected
if(event == "COMBAT_LOG_EVENT_UNFILTERED_CUSTOM") then
event = "COMBAT_LOG_EVENT_UNFILTERED";
end
WeakAuras.ScanEventsInternal(event_list, event, arg1, arg2, ...);
Private.ScanEventsInternal(event_list, event, arg1, arg2, ...);
else
WeakAuras.ScanEventsInternal(event_list, event, arg1, arg2, ...);
Private.ScanEventsInternal(event_list, event, arg1, arg2, ...);
end
WeakAuras.StopProfileSystem("generictrigger " .. orgEvent )
Private.StopProfileSystem("generictrigger " .. orgEvent )
end
function WeakAuras.ScanUnitEvents(event, unit, ...)
WeakAuras.StartProfileSystem("generictrigger " .. event .. " " .. unit)
Private.StartProfileSystem("generictrigger " .. event .. " " .. unit)
local unit_list = loaded_unit_events[unit]
if unit_list then
local event_list = unit_list[event]
if event_list then
for id, triggers in pairs(event_list) do
WeakAuras.StartProfileAura(id);
Private.StartProfileAura(id);
Private.ActivateAuraEnvironment(id);
local updateTriggerState = false;
for triggernum, data in pairs(triggers) do
@@ -733,19 +729,19 @@ function WeakAuras.ScanUnitEvents(event, unit, ...)
end
end
if (updateTriggerState) then
WeakAuras.UpdatedTriggerState(id);
Private.UpdatedTriggerState(id);
end
WeakAuras.StopProfileAura(id);
Private.StopProfileAura(id);
Private.ActivateAuraEnvironment(nil);
end
end
end
WeakAuras.StopProfileSystem("generictrigger " .. event .. " " .. unit)
Private.StopProfileSystem("generictrigger " .. event .. " " .. unit)
end
function WeakAuras.ScanEventsInternal(event_list, event, arg1, arg2, ... )
function Private.ScanEventsInternal(event_list, event, arg1, arg2, ... )
for id, triggers in pairs(event_list) do
WeakAuras.StartProfileAura(id);
Private.StartProfileAura(id);
Private.ActivateAuraEnvironment(id);
local updateTriggerState = false;
for triggernum, data in pairs(triggers) do
@@ -755,9 +751,9 @@ function WeakAuras.ScanEventsInternal(event_list, event, arg1, arg2, ... )
end
end
if (updateTriggerState) then
WeakAuras.UpdatedTriggerState(id);
Private.UpdatedTriggerState(id);
end
WeakAuras.StopProfileAura(id);
Private.StopProfileAura(id);
Private.ActivateAuraEnvironment(nil);
end
end
@@ -837,19 +833,13 @@ function GenericTrigger.ScanWithFakeEvent(id, fake)
end
if (updateTriggerState) then
WeakAuras.UpdatedTriggerState(id);
Private.UpdatedTriggerState(id);
end
Private.ActivateAuraEnvironment(nil);
end
function GenericTrigger.ScanAll()
for id, _ in pairs(loaded_auras) do
GenericTrigger.ScanWithFakeEvent(id);
end
end
function HandleEvent(frame, event, arg1, arg2, ...)
WeakAuras.StartProfileSystem("generictrigger " .. event);
Private.StartProfileSystem("generictrigger " .. event);
if not(WeakAuras.IsPaused()) then
if(event == "COMBAT_LOG_EVENT_UNFILTERED") then
WeakAuras.ScanEvents(event, arg1, arg2, ...);
@@ -862,38 +852,38 @@ function HandleEvent(frame, event, arg1, arg2, ...)
end
if (event == "PLAYER_ENTERING_WORLD") then
timer:ScheduleTimer(function()
WeakAuras.StartProfileSystem("generictrigger WA_DELAYED_PLAYER_ENTERING_WORLD");
Private.StartProfileSystem("generictrigger WA_DELAYED_PLAYER_ENTERING_WORLD");
HandleEvent(frame, "WA_DELAYED_PLAYER_ENTERING_WORLD");
WeakAuras.CheckCooldownReady();
WeakAuras.StopProfileSystem("generictrigger WA_DELAYED_PLAYER_ENTERING_WORLD");
WeakAuras.PreShowModels()
Private.CheckCooldownReady();
Private.StopProfileSystem("generictrigger WA_DELAYED_PLAYER_ENTERING_WORLD");
Private.PreShowModels()
end,
0.8); -- Data not available
timer:ScheduleTimer(function()
WeakAuras.PreShowModels()
Private.PreShowModels()
end,
4); -- Data not available
end
WeakAuras.StopProfileSystem("generictrigger " .. event);
Private.StopProfileSystem("generictrigger " .. event);
end
function HandleUnitEvent(frame, event, unit, ...)
if frame.unit ~= unit then return end
WeakAuras.StartProfileSystem("generictrigger " .. event .. " " .. unit);
Private.StartProfileSystem("generictrigger " .. event .. " " .. unit);
if not(WeakAuras.IsPaused()) then
if (UnitIsUnit(unit, frame.unit)) then
WeakAuras.ScanUnitEvents(event, frame.unit, ...);
end
end
WeakAuras.StopProfileSystem("generictrigger " .. event .. " " .. unit);
Private.StopProfileSystem("generictrigger " .. event .. " " .. unit);
end
function GenericTrigger.UnloadAll()
wipe(loaded_auras);
wipe(loaded_events);
wipe(loaded_unit_events);
WeakAuras.UnregisterAllEveryFrameUpdate();
Private.UnregisterAllEveryFrameUpdate();
end
function GenericTrigger.UnloadDisplays(toUnload)
@@ -913,7 +903,7 @@ function GenericTrigger.UnloadDisplays(toUnload)
auras[id] = nil;
end
end
WeakAuras.UnregisterEveryFrameUpdate(id);
Private.UnregisterEveryFrameUpdate(id);
end
end
@@ -953,7 +943,7 @@ function GenericTrigger.Rename(oldid, newid)
end
end
WeakAuras.EveryFrameUpdateRename(oldid, newid)
Private.EveryFrameUpdateRename(oldid, newid)
end
local function MultiUnitLoop(Func, unit, ...)
@@ -1077,9 +1067,9 @@ function GenericTrigger.LoadDisplays(toLoad, loadEvent, ...)
end
if(register_for_frame_updates) then
WeakAuras.RegisterEveryFrameUpdate(id);
Private.RegisterEveryFrameUpdate(id);
else
WeakAuras.UnregisterEveryFrameUpdate(id);
Private.UnregisterEveryFrameUpdate(id);
end
end
@@ -1160,7 +1150,7 @@ function GenericTrigger.Add(data, region)
if (not trigger.subeventSuffix) then
trigger.subeventSuffix = "";
end
if not(WeakAuras.subevent_actual_prefix_types[trigger.subeventPrefix]) then
if not(Private.subevent_actual_prefix_types[trigger.subeventPrefix]) then
trigger.subeventSuffix = "";
end
end
@@ -1169,8 +1159,6 @@ function GenericTrigger.Add(data, region)
triggerFuncStr = ConstructFunction(prototype, trigger);
statesParameter = prototype.statesParameter;
WeakAuras.debug(id.." - "..triggernum.." - Trigger", 1);
WeakAuras.debug(triggerFuncStr);
triggerFunc = WeakAuras.LoadFunction(triggerFuncStr, id);
durationFunc = prototype.durationFunc;
@@ -1198,7 +1186,7 @@ function GenericTrigger.Add(data, region)
if prototype.timedrequired(trigger) then
trigger.unevent = "timed"
else
if not(WeakAuras.eventend_types[trigger.unevent]) then
if not(Private.eventend_types[trigger.unevent]) then
trigger.unevent = "timed"
end
end
@@ -1206,11 +1194,11 @@ function GenericTrigger.Add(data, region)
trigger.unevent = "timed"
end
elseif prototype.automatic then
if not(WeakAuras.autoeventend_types[trigger.unevent]) then
if not(Private.autoeventend_types[trigger.unevent]) then
trigger.unevent = "auto"
end
else
if not(WeakAuras.eventend_types[trigger.unevent]) then
if not(Private.eventend_types[trigger.unevent]) then
trigger.unevent = "timed"
end
end
@@ -1223,8 +1211,6 @@ function GenericTrigger.Add(data, region)
end
if(untriggerFuncStr) then
WeakAuras.debug(id.." - "..triggernum.." - Untrigger", 1)
WeakAuras.debug(untriggerFuncStr);
untriggerFunc = WeakAuras.LoadFunction(untriggerFuncStr, id);
end
@@ -1309,7 +1295,7 @@ function GenericTrigger.Add(data, region)
isCLEU = trueEvent == "CLEU" or trueEvent == "COMBAT_LOG_EVENT_UNFILTERED"
elseif isCLEU then
local subevent = string.upper(i)
if WeakAuras.IsCLEUSubevent(subevent) then
if Private.IsCLEUSubevent(subevent) then
tinsert(trigger_subevents, subevent)
hasParam = true
end
@@ -1406,7 +1392,7 @@ do
WeakAuras.frames["Custom Trigger Every Frame Updater"] = update_frame;
local updating = false;
function WeakAuras.RegisterEveryFrameUpdate(id)
function Private.RegisterEveryFrameUpdate(id)
if not(update_clients[id]) then
update_clients[id] = true;
update_clients_num = update_clients_num + 1;
@@ -1424,12 +1410,12 @@ do
end
end
function WeakAuras.EveryFrameUpdateRename(oldid, newid)
function Private.EveryFrameUpdateRename(oldid, newid)
update_clients[newid] = update_clients[oldid];
update_clients[oldid] = nil;
end
function WeakAuras.UnregisterEveryFrameUpdate(id)
function Private.UnregisterEveryFrameUpdate(id)
if(update_clients[id]) then
update_clients[id] = nil;
update_clients_num = update_clients_num - 1;
@@ -1440,7 +1426,7 @@ do
end
end
function WeakAuras.UnregisterAllEveryFrameUpdate()
function Private.UnregisterAllEveryFrameUpdate()
if (not update_frame) then
return;
end
@@ -1471,38 +1457,6 @@ local oldPowerTriggers = {
["Shards"] = 7,
}
function GenericTrigger.AllAdded()
-- Remove GTFO options if GTFO isn't enabled and there are no saved GTFO auras
local hideGTFO = true;
local hideDBM = true;
if (GTFO) then
hideGTFO = false;
end
if (DBM) then
hideDBM = false;
end
for id, event in pairs(events) do
for triggernum, data in pairs(event) do
if (data.trigger.event == "GTFO") then
hideGTFO = false;
end
if (data.trigger.event == "DBM Announce" or data.trigger.event == "DBM Timer") then
hideDBM = false;
end
end
end
if (hideGTFO) then
WeakAuras.event_types["GTFO"] = nil;
end
if (hideDBM) then
WeakAuras.event_types["DBM Announce"] = nil;
WeakAuras.status_types["DBM Timer"] = nil;
end
end
--#############################
--# Support code for triggers #
--#############################
@@ -1563,7 +1517,7 @@ do
end
local function swingTimerCLEUCheck(ts, event, sourceGUID, _, _, destGUID, _, _, ...)
WeakAuras.StartProfileSystem("generictrigger swing");
Private.StartProfileSystem("generictrigger swing");
if(sourceGUID == selfGUID) then
if(event == "SWING_DAMAGE" or event == "SWING_MISSED") then
local isOffHand = select(event == "SWING_DAMAGE" and 10 or 2, ...);
@@ -1621,12 +1575,12 @@ do
end
end
end
WeakAuras.StopProfileSystem("generictrigger swing");
Private.StopProfileSystem("generictrigger swing");
end
local function swingTimerCheck(event, unit, guid, spell)
if unit ~= "player" then return end
WeakAuras.StartProfileSystem("generictrigger swing");
Private.StartProfileSystem("generictrigger swing");
if event == "UNIT_ATTACK_SPEED" then
local mainSpeedNew, offSpeedNew = UnitAttackSpeed("player")
offSpeedNew = offSpeedNew or 0
@@ -1654,7 +1608,7 @@ do
elseif casting and (event == "UNIT_SPELLCAST_INTERRUPTED" or event == "UNIT_SPELLCAST_FAILED") then
casting = false
elseif event == "UNIT_SPELLCAST_SUCCEEDED" then
if WeakAuras.reset_swing_spells[spell] or casting then
if Private.reset_swing_spells[spell] or casting then
if casting then
casting = false
end
@@ -1671,7 +1625,7 @@ do
end
mainTimer = timer:ScheduleTimer(swingEnd, mainSpeed, "main");
WeakAuras.ScanEvents(event);
elseif WeakAuras.reset_ranged_swing_spells[spell] then
elseif Private.reset_ranged_swing_spells[spell] then
local event;
local currentTime = GetTime();
local speed = UnitRangedDamage("player");
@@ -1693,7 +1647,7 @@ do
lastSwingOff, swingDurationOff = nil, nil
WeakAuras.ScanEvents("SWING_TIMER_END")
end
WeakAuras.StopProfileSystem("generictrigger swing");
Private.StopProfileSystem("generictrigger swing");
end
function WeakAuras.InitSwingTimer()
@@ -1805,7 +1759,7 @@ do
self.handles[id] = nil
self.expirationTime[id] = nil
CheckGCD();
WeakAuras.CheckSpellCooldown(id, GetRuneDuration())
Private.CheckSpellCooldown(id, GetRuneDuration())
end,
Schedule = function(self, expirationTime, id)
if (not self.expirationTime[id] or expirationTime < self.expirationTime[id]) and expirationTime > 0 then
@@ -1914,16 +1868,16 @@ do
cdReadyFrame:RegisterEvent("SPELLS_CHANGED");
cdReadyFrame:RegisterEvent("PLAYER_ENTERING_WORLD");
cdReadyFrame:SetScript("OnEvent", function(self, event, ...)
WeakAuras.StartProfileSystem("generictrigger cd tracking");
Private.StartProfileSystem("generictrigger cd tracking");
if not WeakAuras.IsPaused() then
if(event == "SPELL_UPDATE_COOLDOWN"
or event == "RUNE_POWER_UPDATE" or event == "RUNE_TYPE_UPDATE" or event == "ACTIONBAR_UPDATE_COOLDOWN"
or event == "PLAYER_TALENT_UPDATE"
or event == "CHARACTER_POINTS_CHANGED") then
WeakAuras.CheckCooldownReady();
Private.CheckCooldownReady();
elseif(event == "SPELLS_CHANGED") then
WeakAuras.CheckSpellKnown();
WeakAuras.CheckCooldownReady();
Private.CheckSpellKnown();
Private.CheckCooldownReady();
elseif(event == "UNIT_SPELLCAST_SENT") then
local unit, name, _ = ...;
if(unit == "player") then
@@ -1935,10 +1889,10 @@ do
end
end
elseif(event == "UNIT_INVENTORY_CHANGED" or event == "BAG_UPDATE_COOLDOWN" or event == "PLAYER_EQUIPMENT_CHANGED") then
WeakAuras.CheckItemSlotCooldowns();
Private.CheckItemSlotCooldowns();
end
end
WeakAuras.StopProfileSystem("generictrigger cd tracking");
Private.StopProfileSystem("generictrigger cd tracking");
end);
end
@@ -2054,7 +2008,7 @@ do
WeakAuras.ScanEvents("ITEM_SLOT_COOLDOWN_READY", id);
end
function WeakAuras.CheckRuneCooldown()
function Private.CheckRuneCooldown()
for id, _ in pairs(runes) do
local startTime, duration = GetRuneCooldown(id);
startTime = startTime or 0;
@@ -2134,7 +2088,7 @@ do
return startTimeCooldown, durationCooldown, unifiedCooldownBecauseRune, cooldownBecauseRune, GetSpellCount(id);
end
function WeakAuras.CheckSpellKnown()
function Private.CheckSpellKnown()
for id, _ in pairs(spells) do
local known = WeakAuras.IsSpellKnownIncludingPet(id);
if (known ~= spellKnown[id]) then
@@ -2144,7 +2098,7 @@ do
end
end
function WeakAuras.CheckSpellCooldown(id, runeDuration)
function Private.CheckSpellCooldown(id, runeDuration)
local startTimeCooldown, durationCooldown, unifiedCooldownBecauseRune, cooldownBecauseRune, spellCount = WeakAuras.GetSpellCooldownUnified(id, runeDuration);
local time = GetTime();
@@ -2184,13 +2138,13 @@ do
end
end
function WeakAuras.CheckSpellCooldows(runeDuration)
function Private.CheckSpellCooldows(runeDuration)
for id, _ in pairs(spells) do
WeakAuras.CheckSpellCooldown(id, runeDuration)
Private.CheckSpellCooldown(id, runeDuration)
end
end
function WeakAuras.CheckItemCooldowns()
function Private.CheckItemCooldowns()
for id, _ in pairs(items) do
local startTime, duration, enabled = GetItemCooldown(id);
if (duration == 0) then
@@ -2249,7 +2203,7 @@ do
end
end
function WeakAuras.CheckItemSlotCooldowns()
function Private.CheckItemSlotCooldowns()
for id, itemId in pairs(itemSlots) do
local startTime, duration, enable = GetInventoryItemCooldown("player", id);
itemSlotsEnable[id] = enable;
@@ -2300,12 +2254,12 @@ do
end
end
function WeakAuras.CheckCooldownReady()
function Private.CheckCooldownReady()
CheckGCD();
WeakAuras.CheckRuneCooldown();
WeakAuras.CheckSpellCooldows();
WeakAuras.CheckItemCooldowns();
WeakAuras.CheckItemSlotCooldowns();
Private.CheckRuneCooldown();
Private.CheckSpellCooldows();
Private.CheckItemCooldowns();
Private.CheckItemSlotCooldowns();
end
function WeakAuras.WatchGCD()
@@ -2455,7 +2409,7 @@ function WeakAuras.WatchUnitChange(unit)
watchUnitChange:RegisterEvent("PLAYER_ENTERING_WORLD")
watchUnitChange:SetScript("OnEvent", function(self, event, unit)
WeakAuras.StartProfileSystem("generictrigger unit change");
Private.StartProfileSystem("generictrigger unit change");
local inRaid = IsInRaid()
for unit, guid in pairs(watchUnitChange.unitChangeGUIDS) do
@@ -2463,7 +2417,7 @@ function WeakAuras.WatchUnitChange(unit)
if guid ~= newGuid or event == "PLAYER_ENTERING_WORLD" then
WeakAuras.ScanEvents("UNIT_CHANGED_" .. unit, unit)
watchUnitChange.unitChangeGUIDS[unit] = newGuid
elseif WeakAuras.multiUnitUnits.group[unit] then
elseif Private.multiUnitUnits.group[unit] then
-- If in raid changed we send a UNIT_CHANGED for the group units
if inRaid ~= watchUnitChange.inRaid then
WeakAuras.ScanEvents("UNIT_CHANGED_" .. unit, unit)
@@ -2471,7 +2425,7 @@ function WeakAuras.WatchUnitChange(unit)
end
end
watchUnitChange.inRaid = inRaid
WeakAuras.StopProfileSystem("generictrigger unit change");
Private.StopProfileSystem("generictrigger unit change");
end)
end
watchUnitChange.unitChangeGUIDS = watchUnitChange.unitChangeGUIDS or {}
@@ -2715,7 +2669,6 @@ do
local scheduled_scans = {}
local function doDbmScan(fireTime)
WeakAuras.debug("Performing dbm scan at "..fireTime.." ("..GetTime()..")")
scheduled_scans[fireTime] = nil
WeakAuras.ScanEvents("DBM_TimerUpdate")
end
@@ -2913,7 +2866,6 @@ do
local scheduled_scans = {}
local function doBigWigsScan(fireTime)
WeakAuras.debug("Performing BigWigs scan at "..fireTime.." ("..GetTime()..")")
scheduled_scans[fireTime] = nil
WeakAuras.ScanEvents("BigWigs_Timer_Update")
end
@@ -2921,7 +2873,6 @@ do
function WeakAuras.ScheduleBigWigsCheck(fireTime)
if not scheduled_scans[fireTime] then
scheduled_scans[fireTime] = timer:ScheduleTimer(doBigWigsScan, fireTime - GetTime() + 0.1, fireTime)
WeakAuras.debug("Scheduled BigWigs scan at "..fireTime)
end
end
end
@@ -2995,7 +2946,7 @@ do
end
local function tenchUpdate()
WeakAuras.StartProfileSystem("generictrigger");
Private.StartProfileSystem("generictrigger");
local _, mh_rem, oh_rem
_, mh_rem, mh_charges, _, oh_rem, oh_charges = GetWeaponEnchantInfo();
local time = GetTime();
@@ -3022,15 +2973,15 @@ do
oh_icon = GetInventoryItemTexture("player", oh)
end
WeakAuras.ScanEvents("TENCH_UPDATE");
WeakAuras.StopProfileSystem("generictrigger");
Private.StopProfileSystem("generictrigger");
end
tenchFrame:SetScript("OnEvent", function(self, event, arg1)
WeakAuras.StartProfileSystem("generictrigger");
Private.StartProfileSystem("generictrigger");
if (event == "UNIT_INVENTORY_CHANGED" and arg1 == "player") then
timer:ScheduleTimer(tenchUpdate, 0.1);
end
WeakAuras.StopProfileSystem("generictrigger");
Private.StopProfileSystem("generictrigger");
end);
tenchUpdate();
@@ -3056,9 +3007,9 @@ do
petFrame:RegisterEvent("UNIT_PET")
petFrame:SetScript("OnEvent", function(_, event, unit)
if unit ~= "player" then return end
WeakAuras.StartProfileSystem("generictrigger")
Private.StartProfileSystem("generictrigger")
WeakAuras.ScanEvents("PET_UPDATE", "pet")
WeakAuras.StopProfileSystem("generictrigger")
Private.StopProfileSystem("generictrigger")
end)
end
end
@@ -3072,7 +3023,7 @@ do
local isMounted = IsMounted();
local function checkForMounted(self, elaps)
WeakAuras.StartProfileSystem("generictrigger");
Private.StartProfileSystem("generictrigger");
elapsed = elapsed + elaps
if(isMounted ~= IsMounted()) then
isMounted = IsMounted();
@@ -3082,7 +3033,7 @@ do
if(elapsed > delay) then
mountedFrame:SetScript("OnUpdate", nil);
end
WeakAuras.StopProfileSystem("generictrigger");
Private.StopProfileSystem("generictrigger");
end
function WeakAuras.WatchForMounts()
@@ -3103,13 +3054,13 @@ do
local playerMovingFrame = nil
local function PlayerMoveSpeedUpdate()
WeakAuras.StartProfileSystem("generictrigger");
Private.StartProfileSystem("generictrigger");
local speed = GetUnitSpeed("player")
if speed ~= playerMovingFrame.speed then
playerMovingFrame.speed = speed
WeakAuras.ScanEvents("PLAYER_MOVE_SPEED_UPDATE")
end
WeakAuras.StopProfileSystem("generictrigger");
Private.StopProfileSystem("generictrigger");
end
function WeakAuras.WatchPlayerMoveSpeed()
@@ -3142,18 +3093,18 @@ do
local FSPAT = "%s*"..(gsub(gsub(FOREIGN_SERVER_LABEL, "^%s", ""), "[%*()]", "%%%1")).."$"
local function nameplateShow(self)
WeakAuras.StartProfileSystem("nameplatetrigger")
Private.StartProfileSystem("nameplatetrigger")
local name = gsub(self.nameText:GetText(), FSPAT, "")
visibleNameplates[self] = name
WeakAuras.ScanEvents("NP_SHOW", self, name)
WeakAuras.StopProfileSystem("nameplatetrigger")
Private.StopProfileSystem("nameplatetrigger")
end
local function nameplateHide(self)
WeakAuras.StartProfileSystem("nameplatetrigger")
Private.StartProfileSystem("nameplatetrigger")
visibleNameplates[self] = nil
WeakAuras.ScanEvents("NP_HIDE", self, gsub(self.nameText:GetText(), FSPAT, ""))
WeakAuras.StopProfileSystem("nameplatetrigger")
Private.StopProfileSystem("nameplatetrigger")
end
local function findNewPlate(...)
@@ -3174,9 +3125,9 @@ do
if lastUpdate < 1 then return end
numChildren = WorldGetNumChildren(WorldFrame)
if lastChildern ~= numChildren then
WeakAuras.StartProfileSystem("nameplatetrigger")
Private.StartProfileSystem("nameplatetrigger")
findNewPlate(WorldGetChildren(WorldFrame))
WeakAuras.StopProfileSystem("nameplatetrigger")
Private.StopProfileSystem("nameplatetrigger")
lastChildern = numChildren
end
lastUpdate = 0
@@ -3237,7 +3188,7 @@ do
end
queuedActionFrame:RegisterEvent("ACTIONBAR_SLOT_CHANGED")
queuedActionFrame:SetScript("OnEvent", function(_, _, slotID)
WeakAuras.StartProfileSystem("generictrigger");
Private.StartProfileSystem("generictrigger");
local spellID = GetActionSpellID(slotID)
if spellID then
buttonIDList[slotID] = spellID
@@ -3246,7 +3197,7 @@ do
spellIDList[buttonIDList[slotID]] = nil
buttonIDList[slotID] = nil
end
WeakAuras.StopProfileSystem("generictrigger");
Private.StopProfileSystem("generictrigger");
end)
end
@@ -3259,7 +3210,6 @@ do
local scheduled_scans = {};
local function doScan(fireTime, event)
WeakAuras.debug("Performing scan at "..fireTime.." ("..GetTime()..") " .. event);
scheduled_scans[event][fireTime] = nil;
WeakAuras.ScanEvents(event);
end
@@ -3267,7 +3217,6 @@ do
event = event or "COOLDOWN_REMAINING_CHECK"
scheduled_scans[event] = scheduled_scans[event] or {}
if not(scheduled_scans[event][fireTime]) then
WeakAuras.debug("Scheduled scan at " .. fireTime .. " for event " .. event);
scheduled_scans[event][fireTime] = timer:ScheduleTimer(doScan, fireTime - GetTime() + 0.1, fireTime, event);
end
end
@@ -3277,14 +3226,12 @@ do
local scheduled_scans = {};
local function doCastScan(firetime, unit)
WeakAuras.debug("Performing cast scan at "..firetime.." ("..GetTime()..")");
scheduled_scans[unit][firetime] = nil;
WeakAuras.ScanEvents("CAST_REMAINING_CHECK", unit);
end
function WeakAuras.ScheduleCastCheck(fireTime, unit)
scheduled_scans[unit] = scheduled_scans[unit] or {}
if not(scheduled_scans[unit][fireTime]) then
WeakAuras.debug("Scheduled cast scan at "..fireTime);
scheduled_scans[unit][fireTime] = timer:ScheduleTimer(doCastScan, fireTime - GetTime() + 0.1, fireTime, unit);
end
end
@@ -3300,12 +3247,12 @@ function GenericTrigger.CanHaveDuration(data, triggernum)
local trigger = data.triggers[triggernum].trigger
if (trigger.type == "event" or trigger.type == "status") then
if trigger.event and WeakAuras.event_prototypes[trigger.event] then
if WeakAuras.event_prototypes[trigger.event].durationFunc then
if(type(WeakAuras.event_prototypes[trigger.event].init) == "function") then
WeakAuras.event_prototypes[trigger.event].init(trigger);
if trigger.event and Private.event_prototypes[trigger.event] then
if Private.event_prototypes[trigger.event].durationFunc then
if(type(Private.event_prototypes[trigger.event].init) == "function") then
Private.event_prototypes[trigger.event].init(trigger);
end
local current, maximum, custom = WeakAuras.event_prototypes[trigger.event].durationFunc(trigger);
local current, maximum, custom = Private.event_prototypes[trigger.event].durationFunc(trigger);
current = type(current) ~= "number" and current or 0
maximum = type(maximum) ~= "number" and maximum or 0
if(custom) then
@@ -3313,8 +3260,8 @@ function GenericTrigger.CanHaveDuration(data, triggernum)
else
return "timed";
end
elseif WeakAuras.event_prototypes[trigger.event].canHaveDuration then
return WeakAuras.event_prototypes[trigger.event].canHaveDuration
elseif Private.event_prototypes[trigger.event].canHaveDuration then
return Private.event_prototypes[trigger.event].canHaveDuration
end
end
if trigger.unevent == "timed" and trigger.duration then
@@ -3340,10 +3287,10 @@ function GenericTrigger.GetOverlayInfo(data, triggernum)
local trigger = data.triggers[triggernum].trigger
if (trigger.type ~= "custom" and trigger.event and WeakAuras.event_prototypes[trigger.event] and WeakAuras.event_prototypes[trigger.event].overlayFuncs) then
if (trigger.type ~= "custom" and trigger.event and Private.event_prototypes[trigger.event] and Private.event_prototypes[trigger.event].overlayFuncs) then
result = {};
local dest = 1;
for i, v in ipairs(WeakAuras.event_prototypes[trigger.event].overlayFuncs) do
for i, v in ipairs(Private.event_prototypes[trigger.event].overlayFuncs) do
if (v.enable(trigger)) then
result[dest] = v.name;
dest = dest + 1;
@@ -3407,10 +3354,10 @@ function GenericTrigger.CanHaveAuto(data, triggernum)
or trigger.type == "status"
)
and trigger.event
and WeakAuras.event_prototypes[trigger.event]
and Private.event_prototypes[trigger.event]
and (
WeakAuras.event_prototypes[trigger.event].iconFunc
or WeakAuras.event_prototypes[trigger.event].canHaveAuto
Private.event_prototypes[trigger.event].iconFunc
or Private.event_prototypes[trigger.event].canHaveAuto
)
)
or (
@@ -3435,12 +3382,12 @@ function GenericTrigger.GetNameAndIcon(data, triggernum)
local trigger = data.triggers[triggernum].trigger
local icon, name
if (trigger.type == "event" or trigger.type == "status") then
if(trigger.event and WeakAuras.event_prototypes[trigger.event]) then
if(WeakAuras.event_prototypes[trigger.event].iconFunc) then
icon = WeakAuras.event_prototypes[trigger.event].iconFunc(trigger);
if(trigger.event and Private.event_prototypes[trigger.event]) then
if(Private.event_prototypes[trigger.event].iconFunc) then
icon = Private.event_prototypes[trigger.event].iconFunc(trigger);
end
if(WeakAuras.event_prototypes[trigger.event].nameFunc) then
name = WeakAuras.event_prototypes[trigger.event].nameFunc(trigger);
if(Private.event_prototypes[trigger.event].nameFunc) then
name = Private.event_prototypes[trigger.event].nameFunc(trigger);
end
end
end
@@ -3455,10 +3402,10 @@ end
function GenericTrigger.CanHaveTooltip(data, triggernum)
local trigger = data.triggers[triggernum].trigger
if (trigger.type == "event" or trigger.type == "status") then
if (trigger.event and WeakAuras.event_prototypes[trigger.event]) then
if(WeakAuras.event_prototypes[trigger.event].hasSpellID) then
if (trigger.event and Private.event_prototypes[trigger.event]) then
if(Private.event_prototypes[trigger.event].hasSpellID) then
return "spell";
elseif(WeakAuras.event_prototypes[trigger.event].hasItemID) then
elseif(Private.event_prototypes[trigger.event].hasItemID) then
return "item";
end
end
@@ -3501,11 +3448,11 @@ function GenericTrigger.SetToolTip(trigger, state)
end
if (trigger.type == "event" or trigger.type == "status") then
if (trigger.event and WeakAuras.event_prototypes[trigger.event]) then
if(WeakAuras.event_prototypes[trigger.event].hasSpellID) then
if (trigger.event and Private.event_prototypes[trigger.event]) then
if(Private.event_prototypes[trigger.event].hasSpellID) then
GameTooltip:SetSpellByID(trigger.spellName);
return true
elseif(WeakAuras.event_prototypes[trigger.event].hasItemID) then
elseif(Private.event_prototypes[trigger.event].hasItemID) then
GameTooltip:SetHyperlink("item:"..trigger.itemName..":0:0:0:0:0:0:0")
return true
end
@@ -3518,10 +3465,10 @@ function GenericTrigger.GetAdditionalProperties(data, triggernum)
local trigger = data.triggers[triggernum].trigger
local ret = "";
if (trigger.type == "event" or trigger.type == "status") then
if (trigger.event and WeakAuras.event_prototypes[trigger.event]) then
if (trigger.event and Private.event_prototypes[trigger.event]) then
local found = false;
local additional = ""
for _, v in pairs(WeakAuras.event_prototypes[trigger.event].args) do
for _, v in pairs(Private.event_prototypes[trigger.event].args) do
local enable = true
if(type(v.enable) == "function") then
enable = v.enable(trigger)
@@ -3574,7 +3521,7 @@ function GenericTrigger.GetTriggerConditions(data, triggernum)
local trigger = data.triggers[triggernum].trigger
if (trigger.type == "event" or trigger.type == "status") then
if (trigger.event and WeakAuras.event_prototypes[trigger.event]) then
if (trigger.event and Private.event_prototypes[trigger.event]) then
local result = {};
local canHaveDuration = GenericTrigger.CanHaveDuration(data, triggernum);
@@ -3596,15 +3543,15 @@ function GenericTrigger.GetTriggerConditions(data, triggernum)
result.total = commonConditions.total;
end
if (WeakAuras.event_prototypes[trigger.event].stacksFunc) then
if (Private.event_prototypes[trigger.event].stacksFunc) then
result.stacks = commonConditions.stacks;
end
if (WeakAuras.event_prototypes[trigger.event].nameFunc) then
if (Private.event_prototypes[trigger.event].nameFunc) then
result.name = commonConditions.name;
end
for _, v in pairs(WeakAuras.event_prototypes[trigger.event].args) do
for _, v in pairs(Private.event_prototypes[trigger.event].args) do
if (v.conditionType and v.name and v.display) then
local enable = true;
if (v.enable) then
@@ -3837,12 +3784,12 @@ function GenericTrigger.GetTriggerDescription(data, triggernum, namestable)
local trigger = data.triggers[triggernum].trigger
if(trigger.type == "event" or trigger.type == "status") then
if(trigger.type == "event") then
tinsert(namestable, {L["Trigger:"], (WeakAuras.event_types[trigger.event] or L["Undefined"])});
tinsert(namestable, {L["Trigger:"], (Private.event_types[trigger.event] or L["Undefined"])});
else
tinsert(namestable, {L["Trigger:"], (WeakAuras.status_types[trigger.event] or L["Undefined"])});
tinsert(namestable, {L["Trigger:"], (Private.status_types[trigger.event] or L["Undefined"])});
end
if(trigger.event == "Combat Log" and trigger.subeventPrefix and trigger.subeventSuffix) then
tinsert(namestable, {L["Message type:"], (WeakAuras.subevent_prefix_types[trigger.subeventPrefix] or L["Undefined"]).." "..(WeakAuras.subevent_suffix_types[trigger.subeventSuffix] or L["Undefined"])});
tinsert(namestable, {L["Message type:"], (Private.subevent_prefix_types[trigger.subeventPrefix] or L["Undefined"]).." "..(Private.subevent_suffix_types[trigger.subeventSuffix] or L["Undefined"])});
end
else
tinsert(namestable, {L["Trigger:"], L["Custom"]});
+8 -8
View File
@@ -18,7 +18,7 @@ local function loadMigrations()
return migrationRepo
end
function WeakAuras.CleanArchive(historyCutoff, migrationCutoff)
function Private.CleanArchive(historyCutoff, migrationCutoff)
if type(historyCutoff) == "number" then
local repo = loadHistory()
local cutoffTime = time() - (historyCutoff * 86400)
@@ -37,7 +37,7 @@ function WeakAuras.CleanArchive(historyCutoff, migrationCutoff)
end
end
function WeakAuras.SetHistory(uid, data, source, addon)
function Private.SetHistory(uid, data, source, addon)
if uid and data then
local repo = loadHistory()
data.source = source
@@ -47,28 +47,28 @@ function WeakAuras.SetHistory(uid, data, source, addon)
end
end
function WeakAuras.GetHistory(uid, load)
local function GetHistory(uid, load)
return loadHistory():Get(uid, load)
end
function WeakAuras.RemoveHistory(uid)
function Private.RemoveHistory(uid)
return loadHistory():Drop(uid)
end
function WeakAuras.RestoreFromHistory(uid)
local _, histData = WeakAuras.GetHistory(uid, true)
function Private.RestoreFromHistory(uid)
local _, histData = GetHistory(uid, true)
if histData then
WeakAuras.Add(histData)
end
end
function WeakAuras.SetMigrationSnapshot(uid, oldData)
function Private.SetMigrationSnapshot(uid, oldData)
if type(oldData) == "table" then
local repo = loadMigrations()
repo:Set(uid, oldData)
end
end
function WeakAuras.GetMigrationSnapshot(uid)
function Private.GetMigrationSnapshot(uid)
return loadMigrations():GetData(uid)
end
+9 -9
View File
@@ -1,3 +1,4 @@
local AddonName, Private = ...
WeakAuras = {}
WeakAuras.L = {}
WeakAuras.frames = {}
@@ -12,7 +13,6 @@ local buildTime = "20200802154726"
WeakAuras.versionString = versionStringFromToc
WeakAuras.buildTime = buildTime
WeakAuras.printPrefix = "|cff9900ffWeakAuras:|r "
WeakAuras.newFeatureString = "|TInterface\\OptionsFrame\\UI-OptionsFrame-NewFeatureIcon:0|t"
WeakAuras.BuildInfo = select(4, GetBuildInfo())
@@ -29,36 +29,36 @@ WeakAuras.prettyPrint = function(msg)
end
if versionString ~= versionStringFromToc and versionStringFromToc ~= "Dev" then
WeakAuras.prettyPrint("You need to restart your game client to complete the WeakAuras update!")
Private.prettyPrint("You need to restart your game client to complete the WeakAuras update!")
end
-- Force enable WeakAurasCompanion and Archive because some addon managers interfere with it
EnableAddOn("WeakAurasCompanion")
EnableAddOn("WeakAurasArchive")
--These function stubs are defined here to reduce the number of errors that occur if WeakAuras.lua fails to compile
-- These function stubs are defined here to reduce the number of errors that occur if WeakAuras.lua fails to compile
function WeakAuras.RegisterRegionType()
end
function WeakAuras.RegisterRegionOptions()
end
function WeakAuras.StartProfileSystem()
function Private.StartProfileSystem()
end
function WeakAuras.StartProfileAura()
function Private.StartProfileAura()
end
function WeakAuras.StopProfileSystem()
function Private.StopProfileSystem()
end
function WeakAuras.StopProfileAura()
function Private.StopProfileAura()
end
function WeakAuras.StartProfileUID()
function Private.StartProfileUID()
end
function WeakAuras.StopProfileUID()
function Private.StopProfileUID()
end
-- If WeakAuras shuts down due to being installed on the wrong target, keep the bindings from erroring
+19 -19
View File
@@ -45,7 +45,7 @@ function Private.Modernize(data)
end
end
-- Version 5 was introduced July 2018 in BFA
-- Version 5 was introduced July 2018 in BfA
if data.internalVersion < 5 then
-- this is to fix hybrid sorting
if data.sortHybridTable then
@@ -62,7 +62,7 @@ function Private.Modernize(data)
end
end
-- Version 6 was introduced July 30, 2018 in BFA
-- Version 6 was introduced July 30 2018 in BfA
if data.internalVersion < 6 then
if data.triggers then
for triggernum, triggerData in ipairs(data.triggers) do
@@ -85,7 +85,7 @@ function Private.Modernize(data)
end
end
-- Version 7 was introduced September 1, 2018 in BFA
-- Version 7 was introduced September 1 2018 in BfA
-- Triggers were cleaned up into a 1-indexed array
if data.internalVersion < 7 then
@@ -102,8 +102,8 @@ function Private.Modernize(data)
data.numTriggers = nil
data.triggers.customTriggerLogic = data.customTriggerLogic
data.customTriggerLogic = nil
local activeTriggerMode = data.activeTriggerMode or WeakAuras.trigger_modes.first_active
if activeTriggerMode ~= WeakAuras.trigger_modes.first_active then
local activeTriggerMode = data.activeTriggerMode or Private.trigger_modes.first_active
if activeTriggerMode ~= Private.trigger_modes.first_active then
activeTriggerMode = activeTriggerMode + 1
end
data.triggers.activeTriggerMode = activeTriggerMode
@@ -175,7 +175,7 @@ function Private.Modernize(data)
end
end
-- Version 13 was introduced March 2019 in BFA
-- Version 13 was introduced March 2019 in BfA
if data.internalVersion < 13 then
if data.regionType == "dynamicgroup" then
local selfPoints = {
@@ -245,7 +245,7 @@ function Private.Modernize(data)
end
end
-- Version 14 was introduced March 2019 in BFA
-- Version 14 was introduced March 2019 in BfA
if data.internalVersion < 14 then
if data.triggers then
for triggerId, triggerData in pairs(data.triggers) do
@@ -262,7 +262,7 @@ function Private.Modernize(data)
end
end
-- Version 15 was introduced April 2019 in BFA
-- Version 15 was introduced April 2019 in BfA
if data.internalVersion < 15 then
if data.triggers then
for triggerId, triggerData in ipairs(data.triggers) do
@@ -273,7 +273,7 @@ function Private.Modernize(data)
end
end
-- Version 16 was introduced May 2019 in BFA
-- Version 16 was introduced May 2019 in BfA
if data.internalVersion < 16 then
-- second conversion: migrate name/realm conditions to tristate
if data.load.use_name == false then
@@ -286,7 +286,7 @@ function Private.Modernize(data)
-- Version 18 was a migration for stance/form trigger, but deleted later because of migration issue
-- Version 20 was introduced July 2019 in BFA
-- Version 20 was introduced July 2019 in BfA
if data.internalVersion < 20 then
if data.regionType == "icon" then
local convertPoint = function(containment, point)
@@ -377,7 +377,7 @@ function Private.Modernize(data)
end
end
-- Version 20 was introduced May 2019 in BFA
-- Version 20 was introduced May 2019 in BfA
if data.internalVersion < 20 then
if data.regionType == "aurabar" then
local orientationToPostion = {
@@ -721,7 +721,7 @@ function Private.Modernize(data)
local totalPrecision = data.totalPrecision
if data.regionType == "text" then
local seenSymbols = {}
WeakAuras.ParseTextStr(data.displayText, function(symbol)
Private.ParseTextStr(data.displayText, function(symbol)
if not seenSymbols[symbol] then
local triggerNum, sym = string.match(symbol, "(.+)%.(.+)")
sym = sym or symbol
@@ -739,7 +739,7 @@ function Private.Modernize(data)
for index, subRegionData in ipairs(data.subRegions) do
if subRegionData.type == "subtext" then
local seenSymbols = {}
WeakAuras.ParseTextStr(subRegionData.text_text, function(symbol)
Private.ParseTextStr(subRegionData.text_text, function(symbol)
if not seenSymbols[symbol] then
local triggerNum, sym = string.match(symbol, "(.+)%.(.+)")
sym = sym or symbol
@@ -759,7 +759,7 @@ function Private.Modernize(data)
for _, when in ipairs{ "start", "finish" } do
if data.actions[when] then
local seenSymbols = {}
WeakAuras.ParseTextStr(data.actions[when].message, function(symbol)
Private.ParseTextStr(data.actions[when].message, function(symbol)
if not seenSymbols[symbol] then
local triggerNum, sym = string.match(symbol, "(.+)%.(.+)")
sym = sym or symbol
@@ -780,7 +780,7 @@ function Private.Modernize(data)
for changeIndex, change in ipairs(condition.changes) do
if change.property == "chat" and change.value then
local seenSymbols = {}
WeakAuras.ParseTextStr(change.value.message, function(symbol)
Private.ParseTextStr(change.value.message, function(symbol)
if not seenSymbols[symbol] then
local triggerNum, sym = string.match(symbol, "(.+)%.(.+)")
sym = sym or symbol
@@ -804,7 +804,7 @@ function Private.Modernize(data)
data.totalPrecision = nil
end
-- Introduced in June 2020 in Bfa
-- Introduced in June 2020 in BfA
if data.internalVersion < 31 then
local allowedNames
local ignoredNames
@@ -836,7 +836,7 @@ function Private.Modernize(data)
data.load.realm = nil
end
-- Introduced in June 2020 in Bfa
-- Introduced in June 2020 in BfA
if data.internalVersion < 32 then
local replacements = {}
local function repairCheck(replacements, check)
@@ -888,7 +888,7 @@ function Private.Modernize(data)
end
end
-- Introduced in July 2020 in Bfa
-- Introduced in July 2020 in BfA
if data.internalVersion < 33 then
data.load.use_ignoreNameRealm = data.load.use_namerealmblack
data.load.ignoreNameRealm = data.load.namerealmblack
@@ -912,7 +912,7 @@ function Private.Modernize(data)
end
-- Introduced in July 2020 in Shadolands
-- Introduced in July 2020 in Shadowlands
if data.internalVersion < 34 then
if data.regionType == 'dynamicgroup'
and (data.grow == "CIRCLE" or data.grow == "COUNTERCIRCLE") then
+19 -20
View File
@@ -24,9 +24,8 @@ RealTimeProfilingWindow:SetMovable(true)
RealTimeProfilingWindow:Hide()
WeakAuras.RealTimeProfilingWindow = RealTimeProfilingWindow
WeakAuras.profileData = profileData
WeakAuras.table_to_string = function(tbl, depth)
local table_to_string
table_to_string = function(tbl, depth)
if depth and depth >= 3 then
return "{ ... }"
end
@@ -34,7 +33,7 @@ WeakAuras.table_to_string = function(tbl, depth)
for k, v in pairs(tbl) do
if type(v) ~= "userdata" then
if type(v) == "table" then
v = WeakAuras.table_to_string(v, (depth and depth + 1 or 1))
v = table_to_string(v, (depth and depth + 1 or 1))
elseif type(v) == "function" then
v = "function"
elseif type(v) == "string" then
@@ -129,7 +128,7 @@ local function CreateProfilePopup()
m = m .. "|n"
end
if type(v) == "table" then
v = WeakAuras.table_to_string(v)
v = table_to_string(v)
end
popupFrame.originalText = m .. v
popupFrame:SetText(popupFrame.originalText)
@@ -273,14 +272,14 @@ local function StopProfileAura(id)
end
local function StartProfileUID(uid)
StartProfiling(profileData.auras, WeakAuras.UIDtoID(uid))
StartProfiling(profileData.auras, Private.UIDtoID(uid))
end
local function StopProfileUID(uid)
StopProfiling(profileData.auras, WeakAuras.UIDtoID(uid))
StopProfiling(profileData.auras, Private.UIDtoID(uid))
end
function WeakAuras.ProfileRenameAura(oldid, id)
function Private.ProfileRenameAura(oldid, id)
profileData.auras[id] = profileData.auras[id]
profileData.auras[oldid] = nil
end
@@ -330,12 +329,12 @@ function WeakAuras.StartProfile(startType)
profileData.systems.time.start = debugprofilestop()
profileData.systems.time.count = 1
WeakAuras.StartProfileSystem = StartProfileSystem
WeakAuras.StartProfileAura = StartProfileAura
WeakAuras.StartProfileUID = StartProfileUID
WeakAuras.StopProfileSystem = StopProfileSystem
WeakAuras.StopProfileAura = StopProfileAura
WeakAuras.StopProfileUID = StopProfileUID
Private.StartProfileSystem = StartProfileSystem
Private.StartProfileAura = StartProfileAura
Private.StartProfileUID = StartProfileUID
Private.StopProfileSystem = StopProfileSystem
Private.StopProfileAura = StopProfileAura
Private.StopProfileUID = StopProfileUID
end
local function doNothing()
@@ -352,12 +351,12 @@ function WeakAuras.StopProfile()
profileData.systems.time.elapsed = debugprofilestop() - profileData.systems.time.start
profileData.systems.time.count = 0
WeakAuras.StartProfileSystem = doNothing
WeakAuras.StartProfileAura = doNothing
WeakAuras.StartProfileUID = doNothing
WeakAuras.StopProfileSystem = doNothing
WeakAuras.StopProfileAura = doNothing
WeakAuras.StopProfileUID = doNothing
Private.StartProfileSystem = doNothing
Private.StartProfileAura = doNothing
Private.StartProfileUID = doNothing
Private.StopProfileSystem = doNothing
Private.StopProfileAura = doNothing
Private.StopProfileUID = doNothing
currentProfileState = nil
RealTimeProfilingWindow:UnregisterAllEvents()
+141 -44
View File
@@ -87,7 +87,7 @@ local constants = {
nameRealmFilterDesc = L[" Filter formats: 'Name', 'Name-Realm', '-Realm'. \n\nSupports multiple entries, separated by commas\n"],
}
WeakAuras.function_strings = {
Private.function_strings = {
count = [[
return function(count)
if(count %s %s) then
@@ -147,7 +147,7 @@ function WeakAuras.GetHSVTransition(perc, r1, g1, b1, a1, r2, g2, b2, a2)
end
WeakAuras.anim_function_strings = {
Private.anim_function_strings = {
straight = [[
function(progress, start, delta)
return start + (progress * delta)
@@ -330,7 +330,7 @@ WeakAuras.anim_function_strings = {
]]
};
WeakAuras.anim_presets = {
Private.anim_presets = {
-- Start and Finish
slidetop = {
type = "custom",
@@ -651,20 +651,6 @@ function WeakAuras.IsSpellKnownIncludingPet(spell)
end
end
local talent_types_specific = {}
local talents_ids = {
DEATHKNIGHT = {{48979,48997,49182,48978,49004,55107,48982,48987,49467,48985,49145,49015,48977,49006,49005,48988,53137,49027,49016,50365,62905,49018,55233,49189,55050,49023,61154,49028}, {49175,49455,49042,55061,49140,49226,50880,49039,51468,51123,49149,49137,49186,49471,49796,55610,49024,49188,50040,49203,50384,65661,54639,51271,49200,49143,50187,49202,49184}, {51745,48962,55129,49036,48963,49588,48965,49013,51459,49158,49146,49219,55620,49194,49220,49223,55666,49224,49208,52143,66799,51052,50391,63560,49032,49222,49217,51099,55090,50117,49206}},
DRUID = {{16814,57810,16845,35363,16821,16836,16880,57865,16819,16909,16850,33589,5570,57849,33597,16896,33592,24858,48384,33600,48389,33603,48516,50516,33831,48488,48506,48505}, {16934,16858,16947,16998,16929,17002,61336,16942,16966,16972,37116,48409,16940,49377,33872,57878,17003,33853,17007,34297,33851,57873,33859,48483,48492,33917,48532,48432,63503,50334}, {17050,17063,17056,17069,17118,16833,17106,16864,48411,24968,17111,17116,17104,17123,33879,17074,34151,18562,33881,33886,48496,48539,65139,48535,63410,51179,48438}},
HUNTER = {{19552,19583,35029,19549,19609,24443,19559,53265,19616,19572,19598,19578,19577,19590,34453,19621,34455,19574,34462,53252,34466,53262,34692,53256,56314,53270}, {19407,53620,19426,34482,19421,19485,34950,19454,19434,34948,19464,19416,35100,23989,19461,34475,19507,53234,19506,35104,34485,53228,53215,34490,53221,53241,53209}, {52783,19498,19159,19290,19184,19376,34494,19255,19503,19295,19286,56333,56342,56339,19370,19306,19168,34491,34500,19386,34497,34506,53295,53298,3674,53302,53290,53301}},
MAGE = {{11210,11222,11237,28574,29441,11213,11247,11242,44397,54646,11252,11255,18462,29447,31569,12043,11232,31574,15058,31571,31579,12042,44394,44378,31584,31589,44404,44400,35578,44425}, {11078,18459,11069,11119,54747,11108,11100,11103,11366,11083,11095,11094,29074,31638,11115,11113,31641,11124,34293,11129,31679,64353,31656,44442,31661,44445,44449,44457}, {11071,11070,31670,11207,11189,29438,11175,11151,12472,11185,16757,11160,11170,11958,11190,31667,55091,11180,44745,11426,31674,31682,44543,44546,31687,44557,44566,44572}},
PALADIN = {{20205,20224,20237,20257,9453,31821,20210,20234,20254,20244,53660,31822,20216,20359,31825,5923,31833,20473,31828,53551,31837,31842,53671,53569,53556,53563}, {63646,20262,31844,20174,20096,64205,20468,20143,53527,20487,20138,20911,20177,31848,20196,31785,20925,31850,20127,31858,53590,31935,53583,53709,53695,53595}, {20060,20101,25956,20335,20042,9452,20117,20375,26022,9799,32043,31866,20111,31869,20049,31871,53486,20066,31876,31879,53375,53379,35395,53501,53380,53385}},
PRIEST = {{14522,47586,14523,14747,14749,14531,14521,14751,14748,33167,14520,14750,33201,18551,63574,33186,34908,45234,10060,63504,57470,47535,47507,47509,33206,47516,52795,47540}, {14913,14908,14889,27900,18530,19236,27811,14892,27789,14912,14909,14911,20711,14901,33150,14898,34753,724,33142,64127,33158,63730,63534,34861,47558,47562,47788}, {15270,15337,15259,15318,15275,15260,15392,15273,15407,15274,17322,15257,15487,15286,27839,33213,14910,63625,15473,33221,47569,33191,64044,34914,47580,47573,47585}},
ROGUE = {{14162,14144,14138,14156,51632,13733,14983,14168,14128,16513,14113,31208,14177,14174,31244,14186,14158,51625,58426,31380,51634,31234,31226,1329,51627,51664,51662}, {13741,13732,13715,14165,13713,13705,13742,14251,13706,13754,13743,13712,18427,13709,13877,13960,30919,31124,31122,13750,31130,5952,35541,51672,32601,51682,51685,51690}, {14179,13958,14057,30892,14076,13975,13981,14278,14171,13983,13976,14079,30894,14185,14082,16511,31221,30902,31211,14183,31228,31216,51692,51698,36554,58414,51708,51713}},
SHAMAN = {{16039,16035,16038,28996,30160,16040,16164,16089,16086,29062,28999,16041,30664,30672,16578,16166,51483,63370,51466,30675,51474,30706,51480,62097,51490}, {16259,16043,17485,16258,16255,16262,16261,16266,43338,16254,16256,16252,29192,16268,51883,30802,29082,63373,30816,30798,17364,51525,60103,51521,30812,30823,51523,51528,51533}, {16182,16173,16184,29187,16179,16180,16181,55198,16176,16187,16194,29206,16188,30864,16178,30881,16190,51886,51554,30872,30867,51556,974,51560,51562,61295}},
WARLOCK = {{18827,18174,17810,18179,18213,18182,17804,53754,17783,18288,18218,18094,32381,32385,63108,18223,54037,18271,47195,30060,18220,30054,32477,47198,30108,58435,47201,48181}, {18692,18694,18697,47230,18703,18705,18731,18754,19028,18708,30143,18769,18709,30326,18767,23785,47245,30319,47193,35691,30242,63156,54347,30146,63117,47236,59672}, {17793,17788,18119,63349,17778,18126,17877,17959,18135,17917,17927,34935,17815,18130,30299,17954,17962,30293,18096,30288,54117,47258,30283,47220,47266,50796}},
WARRIOR = {{12282,16462,12286,12285,12300,12295,12290,12296,16493,12834,12163,56636,12700,12328,12284,12281,20504,12289,46854,29834,12294,46865,12862,64976,35446,46859,29723,29623,29836,46867,46924}, {61216,12321,12320,12324,12322,12329,12323,16487,12318,23584,20502,12317,29590,12292,29888,20500,12319,46908,23881,29721,46910,29759,60970,29801,46913,56927,46917}, {12301,12298,12287,50685,12297,12975,12797,29598,12299,59088,12313,12308,12312,12809,12311,16538,29593,50720,29787,29140,46945,57499,20243,47294,46951,58872,46968}}
}
local function valuesForTalentFunction(trigger)
return function()
local single_class;
@@ -689,27 +675,27 @@ local function valuesForTalentFunction(trigger)
end
-- If a single specific class was found, load the specific list for it
if single_class and talents_ids[single_class] then
if not talent_types_specific[single_class] then
talent_types_specific[single_class] = {}
for tab = 1, #talents_ids[single_class] do
for num_talent = 1, #talents_ids[single_class][tab] do
local spellName, _, spellIcon = GetSpellInfo(talents_ids[single_class][tab][num_talent])
if single_class and Private.talents_ids[single_class] then
if not Private.talent_types_specific[single_class] then
Private.talent_types_specific[single_class] = {}
for tab = 1, #Private.talents_ids[single_class] do
for num_talent = 1, #Private.talents_ids[single_class][tab] do
local spellName, _, spellIcon = GetSpellInfo(Private.talents_ids[single_class][tab][num_talent])
local talentId = (tab - 1) * MAX_NUM_TALENTS + num_talent
if spellName and spellIcon then
talent_types_specific[single_class][talentId] = ("|T%s:24|t %s"):format(spellIcon, spellName)
Private.talent_types_specific[single_class][talentId] = ("|T%s:24|t %s"):format(spellIcon, spellName)
end
end
end
end
return talent_types_specific[single_class];
return Private.talent_types_specific[single_class];
else
return WeakAuras.talent_types;
return Private.talent_types;
end
end
end
WeakAuras.load_prototype = {
Private.load_prototype = {
args = {
{
name = "combat",
@@ -887,8 +873,8 @@ local function AddUnitChangeInternalEvents(triggerUnit, t)
WeakAuras.WatchForPetDeath();
tinsert(t, "PET_UPDATE")
else
if WeakAuras.multiUnitUnits[triggerUnit] then
for unit in pairs(WeakAuras.multiUnitUnits[triggerUnit]) do
if Private.multiUnitUnits[triggerUnit] then
for unit in pairs(Private.multiUnitUnits[triggerUnit]) do
tinsert(t, "UNIT_CHANGED_" .. string.lower(unit))
WeakAuras.WatchUnitChange(unit)
end
@@ -919,8 +905,8 @@ end
local unitHelperFunctions = {
UnitChangedForceEvents = function(trigger)
local events = {}
if WeakAuras.multiUnitUnits[trigger.unit] then
for unit in pairs(WeakAuras.multiUnitUnits[trigger.unit]) do
if Private.multiUnitUnits[trigger.unit] then
for unit in pairs(Private.multiUnitUnits[trigger.unit]) do
tinsert(events, {"UNIT_CHANGED_" .. unit, unit})
end
else
@@ -946,7 +932,7 @@ local unitHelperFunctions = {
end
}
WeakAuras.event_prototypes = {
Private.event_prototypes = {
["Combo Points"] = {
type = "status",
events = {
@@ -1033,7 +1019,7 @@ WeakAuras.event_prototypes = {
store = true,
conditionType = "bool",
desc = function() return L["Can be used for e.g. checking if \"boss1target\" is the same as \"player\"."] end,
enable = function(trigger) return not WeakAuras.multiUnitUnits[trigger.unit] end
enable = function(trigger) return not Private.multiUnitUnits[trigger.unit] end
},
{
name = "name",
@@ -1163,6 +1149,115 @@ WeakAuras.event_prototypes = {
},
automaticrequired = true
},
["Experience"] = {
type = "status",
canHaveDuration = false,
events = {
["events"] = {
"PLAYER_XP_UPDATE",
}
},
internal_events = {"WA_DELAYED_PLAYER_ENTERING_WORLD"},
force_events = "PLAYER_XP_UPDATE",
name = L["Player Experience"],
init = function(trigger)
return ""
end,
statesParameter = "one",
args = {
{
name = "level",
display = L["Level"],
required = false,
type = "number",
store = true,
init = [[UnitLevel("player")]],
conditionType = "number",
},
{
name = "currentXP",
display = L["Current Experience"],
type = "number",
store = true,
init = [[UnitXP("player")]],
conditionType = "number",
},
{
name = "totalXP",
display = L["Total Experience"],
type = "number",
store = true,
init = [[UnitXPMax("player")]],
conditionType = "number",
},
{
name = "value",
type = "number",
store = true,
init = "currentXP",
hidden = true,
test = "true",
},
{
name = "total",
type = "number",
store = true,
init = "totalXP",
hidden = true,
test = "true",
},
{
name = "progressType",
hidden = true,
init = "'static'",
store = true,
test = "true"
},
{
name = "percentXP",
display = L["Experience (%)"],
type = "number",
init = "total ~= 0 and (value / total) * 100",
store = true,
conditionType = "number"
},
{
name = "showRested",
display = L["Show Rested Overlay"],
type = "toggle",
test = "true",
reloadOptions = true,
},
{
name = "restedXP",
display = L["Rested Experience"],
init = [[GetXPExhaustion() or 0]],
type = "number",
store = true,
conditionType = "number",
},
{
name = "percentrested",
display = L["Rested Experience (%)"],
init = "total ~= 0 and (restedXP / total) * 100",
type = "number",
store = true,
conditionType = "number",
},
},
overlayFuncs = {
{
name = L["Rested"],
func = function(trigger, state)
return "forward", state.restedXP
end,
enable = function(trigger)
return trigger.use_showRested
end
},
},
automaticrequired = true
},
["Health"] = {
type = "status",
canHaveDuration = true,
@@ -3713,10 +3808,10 @@ WeakAuras.event_prototypes = {
type = "multiselect",
values = function()
local class = select(2, UnitClass("player"));
if talent_types_specific[class] then
return talent_types_specific[class];
if Private.talent_types_specific[class] then
return Private.talent_types_specific[class];
else
return WeakAuras.talent_types;
return Private.talent_types;
end
end,
test = "active",
@@ -4472,8 +4567,10 @@ WeakAuras.event_prototypes = {
if not(trigger.use_inverse) then
startTime, duration = WeakAuras.GetRuneCooldown(trigger.rune);
end
startTime = startTime or 0;
duration = duration or 0;
return duration, startTime + duration;
else
return 1, 0;
@@ -4842,9 +4939,9 @@ WeakAuras.event_prototypes = {
init = "arg",
values = function(trigger)
if trigger.use_inverse then
return WeakAuras.actual_unit_types_with_specific
return Private.actual_unit_types_with_specific
else
return WeakAuras.actual_unit_types_cast
return Private.actual_unit_types_cast
end
end,
test = "true",
@@ -5266,7 +5363,7 @@ WeakAuras.event_prototypes = {
},
{
name = "moveSpeed",
display = L["Continously update Movement Speed"],
display = L["Continuously update Movement Speed"],
type = "boolean",
test = true,
width = WeakAuras.doubleWidth
@@ -5758,12 +5855,12 @@ WeakAuras.event_prototypes = {
};
WeakAuras.event_prototypes["DBM Announce"] = nil
WeakAuras.event_prototypes["DBM Timer"] = nil
WeakAuras.event_prototypes["BigWigs Message"] = nil
WeakAuras.event_prototypes["BigWigs Timer"] = nil
Private.event_prototypes["DBM Announce"] = nil
Private.event_prototypes["DBM Timer"] = nil
Private.event_prototypes["BigWigs Message"] = nil
Private.event_prototypes["BigWigs Timer"] = nil
WeakAuras.dynamic_texts = {
Private.dynamic_texts = {
["p"] = {
get = function(state)
if not state then return nil end
+12 -12
View File
@@ -117,7 +117,7 @@ local properties = {
display = L["Orientation"],
setter = "SetOrientation",
type = "list",
values = WeakAuras.orientation_types
values = Private.orientation_types
},
inverse = {
display = L["Inverse"],
@@ -129,10 +129,9 @@ local properties = {
WeakAuras.regionPrototype.AddProperties(properties, default);
local function GetProperties(data)
local overlayInfo = WeakAuras.GetOverlayInfo(data);
local overlayInfo = Private.GetOverlayInfo(data);
if (overlayInfo and next(overlayInfo)) then
local auraProperties = {};
WeakAuras.DeepCopy(properties, auraProperties);
local auraProperties = CopyTable(properties)
for id, display in ipairs(overlayInfo) do
auraProperties["overlays." .. id] = {
@@ -758,11 +757,11 @@ local funcs = {
selfPoint = selfPoint or "CENTER"
if not WeakAuras.point_types[selfPoint] then
if not Private.point_types[selfPoint] then
selfPoint = "CENTER"
end
if not WeakAuras.point_types[anchorPoint] then
if not Private.point_types[anchorPoint] then
anchorPoint = "CENTER"
end
@@ -988,7 +987,7 @@ local function modify(parent, region, data)
-- Localize
local bar, iconFrame, icon = region.bar, region.iconFrame, region.icon;
region.useAuto = data.auto and WeakAuras.CanHaveAuto(data);
region.useAuto = data.auto and Private.CanHaveAuto(data);
-- Adjust region size
region:SetWidth(data.width);
@@ -1012,9 +1011,10 @@ local function modify(parent, region, data)
region.desaturateIcon = data.desaturate
region.zoom = data.zoom
region.overlays = {};
if (data.overlays) then
WeakAuras.DeepCopy(data.overlays, region.overlays);
region.overlays = CopyTable(data.overlays);
else
region.overlays = {}
end
-- Update texture settings
@@ -1084,16 +1084,16 @@ local function modify(parent, region, data)
region:UpdateEffectiveOrientation()
-- Update tooltip availability
local tooltipType = WeakAuras.CanHaveTooltip(data);
local tooltipType = Private.CanHaveTooltip(data);
if tooltipType and data.useTooltip then
-- Create and enable tooltip-hover frame
if not region.tooltipFrame then
region.tooltipFrame = CreateFrame("frame", nil, region);
region.tooltipFrame:SetAllPoints(icon);
region.tooltipFrame:SetScript("OnEnter", function()
WeakAuras.ShowMouseoverTooltip(region, region.tooltipFrame);
Private.ShowMouseoverTooltip(region, region.tooltipFrame);
end);
region.tooltipFrame:SetScript("OnLeave", WeakAuras.HideTooltip);
region.tooltipFrame:SetScript("OnLeave", Private.HideTooltip);
end
region.tooltipFrame:EnableMouse(true);
+22 -22
View File
@@ -95,7 +95,7 @@ local function releaseControlPoint(self, controlPoint)
local regionData = controlPoint.regionData
if regionData then
if self.parent.anchorPerUnit == "UNITFRAME" then
WeakAuras.dyngroup_unitframe_monitor[regionData] = nil
Private.dyngroup_unitframe_monitor[regionData] = nil
end
controlPoint.regionData = nil
regionData.controlPoint = nil
@@ -760,7 +760,7 @@ local function SafeGetPos(region, func)
end
local function modify(parent, region, data)
WeakAuras.FixGroupChildrenOrderForGroup(data)
Private.FixGroupChildrenOrderForGroup(data)
-- Scale
region:SetScale(data.scale and data.scale > 0 and data.scale or 1)
WeakAuras.regionPrototype.modify(parent, region, data)
@@ -854,7 +854,7 @@ local function modify(parent, region, data)
local frameStrata = region:GetFrameStrata()
childRegion:SetFrameStrata(frameStrata ~= "UNKNOWN" and frameStrata or "BACKGROUND");
else
childRegion:SetFrameStrata(WeakAuras.frame_strata_types[childData.frameStrata]);
childRegion:SetFrameStrata(Private.frame_strata_types[childData.frameStrata]);
end
return regionData
end
@@ -877,8 +877,8 @@ local function modify(parent, region, data)
function region:ReloadControlledChildren()
-- 'forgets' about regions it controls and starts from scratch. Mostly useful when Add()ing the group
if not self:IsSuspended() then
WeakAuras.StartProfileSystem("dynamicgroup")
WeakAuras.StartProfileAura(data.id)
Private.StartProfileSystem("dynamicgroup")
Private.StartProfileAura(data.id)
self.needToReload = false
self.sortedChildren = {}
self.controlledChildren = {}
@@ -903,8 +903,8 @@ local function modify(parent, region, data)
end
end
end
WeakAuras.StopProfileSystem("dynamicgroup")
WeakAuras.StopProfileAura(data.id)
Private.StopProfileSystem("dynamicgroup")
Private.StopProfileAura(data.id)
self:SortUpdatedChildren()
else
self.needToReload = true
@@ -976,8 +976,8 @@ local function modify(parent, region, data)
-- Called when the Group is Resume()d
-- uses sort data to determine the correct spot
if not self:IsSuspended() then
WeakAuras.StartProfileSystem("dynamicgroup")
WeakAuras.StartProfileAura(data.id)
Private.StartProfileSystem("dynamicgroup")
Private.StartProfileAura(data.id)
self.needToSort = false
local i = 1
while self.sortedChildren[i] do
@@ -1006,8 +1006,8 @@ local function modify(parent, region, data)
end
end
self.updatedChildren = {}
WeakAuras.StopProfileSystem("dynamicgroup")
WeakAuras.StopProfileAura(data.id)
Private.StopProfileSystem("dynamicgroup")
Private.StopProfileAura(data.id)
self:PositionChildren()
else
self.needToSort = true
@@ -1063,10 +1063,10 @@ local function modify(parent, region, data)
controlPoint:SetWidth(regionData.dimensions.width)
controlPoint:SetHeight(regionData.dimensions.height)
if self.anchorPerUnit == "UNITFRAME" then
WeakAuras.dyngroup_unitframe_monitor[regionData] = frame
Private.dyngroup_unitframe_monitor[regionData] = frame
end
if animate then
WeakAuras.CancelAnimation(regionData.controlPoint, true)
Private.CancelAnimation(regionData.controlPoint, true)
local xPrev = regionData.xOffset or x
local yPrev = regionData.yOffset or y
local xDelta = xPrev - x
@@ -1137,7 +1137,7 @@ local function modify(parent, region, data)
}
end
-- update animated expand & collapse for this child
WeakAuras.Animate("controlPoint", data.uid, "controlPoint", anim, regionData.controlPoint, true)
Private.Animate("controlPoint", data.uid, "controlPoint", anim, regionData.controlPoint, true)
end
end
regionData.xOffset = x
@@ -1147,8 +1147,8 @@ local function modify(parent, region, data)
end
function region:DoPositionChildren()
WeakAuras.StartProfileSystem("dynamicgroup")
WeakAuras.StartProfileAura(data.id)
Private.StartProfileSystem("dynamicgroup")
Private.StartProfileAura(data.id)
local handledRegionData = {}
@@ -1179,8 +1179,8 @@ local function modify(parent, region, data)
end
end
WeakAuras.StopProfileSystem("dynamicgroup")
WeakAuras.StopProfileAura(data.id)
Private.StopProfileSystem("dynamicgroup")
Private.StopProfileAura(data.id)
self:Resize()
end
@@ -1190,8 +1190,8 @@ local function modify(parent, region, data)
if not self:IsSuspended() then
self.needToResize = false
-- if self.dynamicAnchor then self:UpdateBorder(); return end
WeakAuras.StartProfileSystem("dynamicgroup")
WeakAuras.StartProfileAura(data.id)
Private.StartProfileSystem("dynamicgroup")
Private.StartProfileAura(data.id)
local numVisible, minX, maxX, maxY, minY, minLevel = 0
for active, regionData in ipairs(self.sortedChildren) do
if regionData.shown then
@@ -1231,8 +1231,8 @@ local function modify(parent, region, data)
if WeakAuras.IsOptionsOpen() then
WeakAuras.OptionsFrame().moversizer:ReAnchor()
end
WeakAuras.StopProfileSystem("dynamicgroup")
WeakAuras.StopProfileAura(data.id)
Private.StopProfileSystem("dynamicgroup")
Private.StopProfileAura(data.id)
else
self.needToResize = true
end
+1 -1
View File
@@ -110,7 +110,7 @@ local function modify(parent, region, data)
region.try = highest;
-- Adjust frame-level sorting
WeakAuras.FixGroupChildrenOrderForGroup(data);
Private.FixGroupChildrenOrderForGroup(data);
-- Control children (does not happen with "group")
function region:UpdateBorder(childRegion)
+6 -6
View File
@@ -145,11 +145,11 @@ local function AnchorSubRegion(self, subRegion, anchorType, selfPoint, anchorPoi
anchorXOffset = anchorXOffset or 0
anchorYOffset = anchorYOffset or 0
if not WeakAuras.point_types[selfPoint] then
if not Private.point_types[selfPoint] then
selfPoint = "CENTER"
end
if not WeakAuras.point_types[anchorPoint] then
if not Private.point_types[anchorPoint] then
anchorPoint = "CENTER"
end
@@ -256,7 +256,7 @@ local function modify(parent, region, data)
local button, icon, cooldown = region.button, region.icon, region.cooldown;
region.useAuto = data.auto and WeakAuras.CanHaveAuto(data);
region.useAuto = data.auto and Private.CanHaveAuto(data);
if MSQ then
local masqueId = data.id:lower():gsub(" ", "_");
@@ -331,15 +331,15 @@ local function modify(parent, region, data)
region.zoom = data.zoom;
region:UpdateSize()
local tooltipType = WeakAuras.CanHaveTooltip(data);
local tooltipType = Private.CanHaveTooltip(data);
if(tooltipType and data.useTooltip) then
if not region.tooltipFrame then
region.tooltipFrame = CreateFrame("frame", nil, region);
region.tooltipFrame:SetAllPoints(region);
region.tooltipFrame:SetScript("OnEnter", function()
WeakAuras.ShowMouseoverTooltip(region, region);
Private.ShowMouseoverTooltip(region, region);
end);
region.tooltipFrame:SetScript("OnLeave", WeakAuras.HideTooltip);
region.tooltipFrame:SetScript("OnLeave", Private.HideTooltip);
end
region.tooltipFrame:EnableMouse(true);
elseif region.tooltipFrame then
+9 -9
View File
@@ -120,11 +120,11 @@ local function AcquireModel(region, data)
model:RegisterEvent("PLAYER_FOCUS_CHANGED");
end
model:SetScript("OnEvent", function(self, event, unitId)
WeakAuras.StartProfileSystem("model");
Private.StartProfileSystem("model");
if (event ~= "UNIT_MODEL_CHANGED" or UnitIsUnit(unitId, data.model_path)) then
WeakAuras.SetModel(model, data.model_path, data.modelIsUnit, data.modelDisplayInfo)
end
WeakAuras.StopProfileSystem("model");
Private.StopProfileSystem("model");
end
);
else
@@ -138,10 +138,10 @@ local function AcquireModel(region, data)
if(data.advance) then
local elapsed = 0;
model:SetScript("OnUpdate", function(self, elaps)
WeakAuras.StartProfileSystem("model");
Private.StartProfileSystem("model");
elapsed = elapsed + (elaps * 1000);
model:SetSequenceTime(data.sequence, elapsed);
WeakAuras.StopProfileSystem("model");
Private.StopProfileSystem("model");
end)
else
model:SetScript("OnUpdate", nil)
@@ -263,18 +263,18 @@ end
-- Work around for movies and world map hiding all models
do
function WeakAuras.PreShowModels(self, event)
WeakAuras.StartProfileSystem("model");
function Private.PreShowModels(self, event)
Private.StartProfileSystem("model");
for id, data in pairs(WeakAuras.regions) do
WeakAuras.StartProfileAura(id);
Private.StartProfileAura(id);
if data.region.toShow then
if (data.regionType == "model") then
data.region:PreShow();
end
end
WeakAuras.StopProfileAura(id);
Private.StopProfileAura(id);
end
WeakAuras.StopProfileSystem("model");
Private.StopProfileSystem("model");
end
end
+74 -74
View File
@@ -115,7 +115,7 @@ end
local screenWidth, screenHeight = math.ceil(GetScreenWidth() / 20) * 20, math.ceil(GetScreenHeight() / 20) * 20;
function WeakAuras.GetAnchorsForData(parentData, type)
function Private.GetAnchorsForData(parentData, type)
local result
if not parentData.controlledChildren then
if not WeakAuras.regionOptions[parentData.regionType] or not WeakAuras.regionOptions[parentData.regionType].getAnchors then
@@ -139,8 +139,8 @@ function WeakAuras.regionPrototype:AnchorSubRegion(subRegion, anchorType, selfPo
if anchorType == "point" then
local xOffset = anchorXOffset or 0
local yOffset = anchorYOffset or 0
subRegion:SetPoint(WeakAuras.point_types[selfPoint] and selfPoint or "CENTER",
self, WeakAuras.point_types[anchorPoint] and anchorPoint or "CENTER",
subRegion:SetPoint(Private.point_types[selfPoint] and selfPoint or "CENTER",
self, Private.point_types[anchorPoint] and anchorPoint or "CENTER",
xOffset, yOffset)
else
anchorXOffset = anchorXOffset or 0
@@ -203,46 +203,46 @@ function WeakAuras.regionPrototype.AddProperties(properties, defaultsForRegion)
end
local function SoundRepeatStop(self)
WeakAuras.StartProfileSystem("sound");
Private.StartProfileSystem("sound");
if (self.soundRepeatTimer) then
WeakAuras.timer:CancelTimer(self.soundRepeatTimer);
self.soundRepeatTimer = nil;
end
WeakAuras.StopProfileSystem("sound");
Private.StopProfileSystem("sound");
end
local function SoundPlayHelper(self)
WeakAuras.StartProfileSystem("sound");
Private.StartProfileSystem("sound");
local options = self.soundOptions;
if (not options or options.sound_type == "Stop") then
WeakAuras.StopProfileSystem("sound");
Private.StopProfileSystem("sound");
return;
end
if (WeakAuras.IsOptionsOpen() or WeakAuras.SquelchingActions()) then
WeakAuras.StopProfileSystem("sound");
if (WeakAuras.IsOptionsOpen() or Private.SquelchingActions()) then
Private.StopProfileSystem("sound");
return;
end
if (options.sound == " custom") then
if (options.sound_path) then
PlaySoundFile(options.sound_path, options.sound_channel or "Master");
pcall(PlaySoundFile, options.sound_path, options.sound_channel or "Master");
end
elseif (options.sound == " KitID") then
if (options.sound_kit_id) then
PlaySound(options.sound_kit_id, options.sound_channel or "Master");
pcall(PlaySound, options.sound_kit_id, options.sound_channel or "Master");
end
else
PlaySoundFile(options.sound, options.sound_channel or "Master");
pcall(PlaySoundFile, options.sound, options.sound_channel or "Master");
end
WeakAuras.StopProfileSystem("sound");
Private.StopProfileSystem("sound");
end
local function SoundPlay(self, options)
if (not options or WeakAuras.IsOptionsOpen()) then
return
end
WeakAuras.StartProfileSystem("sound");
Private.StartProfileSystem("sound");
self:SoundRepeatStop();
self.soundOptions = options;
@@ -252,7 +252,7 @@ local function SoundPlay(self, options)
if (loop and options.sound_repeat) then
self.soundRepeatTimer = WeakAuras.timer:ScheduleRepeatingTimer(SoundPlayHelper, options.sound_repeat, self);
end
WeakAuras.StopProfileSystem("sound");
Private.StopProfileSystem("sound");
end
local function SendChat(self, options)
@@ -260,7 +260,7 @@ local function SendChat(self, options)
return
end
WeakAuras.HandleChatAction(options.message_type, options.message, options.message_dest, options.message_channel, options.r, options.g, options.b, self, options.message_custom, nil, options.message_formaters);
Private.HandleChatAction(options.message_type, options.message, options.message_dest, options.message_channel, options.r, options.g, options.b, self, options.message_custom, nil, options.message_formaters);
end
local function RunCode(self, func)
@@ -275,7 +275,7 @@ local function GlowExternal(self, options)
if (not options or WeakAuras.IsOptionsOpen()) then
return
end
WeakAuras.HandleGlowAction(options, self)
Private.HandleGlowAction(options, self)
end
local function UpdatePosition(self)
@@ -423,11 +423,23 @@ local function UpdateRegionHasTimerTick(self)
self:UpdateTimerTick()
end
local function TimerTickForRegion(region)
Private.StartProfileSystem("timer tick")
Private.StartProfileAura(region.id);
if region.TimerTick then
region:TimerTick();
end
region.subRegionEvents:Notify("TimerTick")
Private.StopProfileAura(region.id);
Private.StopProfileSystem("timer tick")
end
local function UpdateTimerTick(self)
if self.triggerProvidesTimer and self.regionHasTimer then
if not self:GetScript("OnUpdate") then
self:SetScript("OnUpdate", function()
WeakAuras.TimerTick(self)
TimerTickForRegion(self)
end);
end
else
@@ -536,11 +548,11 @@ function WeakAuras.regionPrototype.modify(parent, region, data)
or data.regionType == "dynamicgroup"
or data.regionType == "group"
then
WeakAuras.AnchorFrame(data, region, parent);
Private.AnchorFrame(data, region, parent);
end
end
region.startFormatters = WeakAuras.CreateFormatters(data.actions.start.message, function(key, default)
region.startFormatters = Private.CreateFormatters(data.actions.start.message, function(key, default)
local fullKey = "message_format_" .. key
if data.actions.start[fullKey] == nil then
data.actions.start[fullKey] = default
@@ -548,7 +560,7 @@ function WeakAuras.regionPrototype.modify(parent, region, data)
return data.actions.start[fullKey]
end)
region.finishFormatters = WeakAuras.CreateFormatters(data.actions.finish.message, function(key, default)
region.finishFormatters = Private.CreateFormatters(data.actions.finish.message, function(key, default)
local fullKey = "message_format_" .. key
if data.actions.finish[fullKey] == nil then
data.actions.finish[fullKey] = default
@@ -561,7 +573,7 @@ function WeakAuras.regionPrototype.modifyFinish(parent, region, data)
-- Sync subRegions
if region.subRegions then
for index, subRegion in pairs(region.subRegions) do
WeakAuras.subRegionTypes[subRegion.type].release(subRegion)
Private.subRegionTypes[subRegion.type].release(subRegion)
end
wipe(region.subRegions)
@@ -571,12 +583,12 @@ function WeakAuras.regionPrototype.modifyFinish(parent, region, data)
region.subRegions = region.subRegions or {}
local subRegionTypes = {}
for index, subRegionData in pairs(data.subRegions) do
if WeakAuras.subRegionTypes[subRegionData.type] then
local subRegion = WeakAuras.subRegionTypes[subRegionData.type].acquire()
if Private.subRegionTypes[subRegionData.type] then
local subRegion = Private.subRegionTypes[subRegionData.type].acquire()
subRegion.type = subRegionData.type
if subRegion then
WeakAuras.subRegionTypes[subRegionData.type].modify(region, subRegion, data, subRegionData, not subRegionTypes[subRegionData.type])
Private.subRegionTypes[subRegionData.type].modify(region, subRegion, data, subRegionData, not subRegionTypes[subRegionData.type])
subRegionTypes[subRegionData.type] = true
end
@@ -587,7 +599,7 @@ function WeakAuras.regionPrototype.modifyFinish(parent, region, data)
region:UpdateRegionHasTimerTick()
WeakAuras.ApplyFrameLevel(region)
Private.ApplyFrameLevel(region)
end
local function SetProgressValue(region, value, total)
@@ -597,25 +609,29 @@ local function SetProgressValue(region, value, total)
region:SetValue(value - adjustMin, max - adjustMin);
end
function WeakAuras.TimerTick(region)
WeakAuras.StartProfileSystem("timer tick")
WeakAuras.StartProfileAura(region.id);
if region.TimerTick then
region:TimerTick();
end
region.subRegionEvents:Notify("TimerTick")
WeakAuras.StopProfileAura(region.id);
WeakAuras.StopProfileSystem("timer tick")
end
local regionsForFrameTick = {}
local frameForFrameTick = CreateFrame("FRAME");
WeakAuras.frames["Frame Tick Frame"] = frameForFrameTick
function WeakAuras.RegisterForFrameTick(region)
local function FrameTick()
if WeakAuras.IsOptionsOpen() then
return
end
Private.StartProfileSystem("frame tick")
for region in pairs(regionsForFrameTick) do
Private.StartProfileAura(region.id);
if region.FrameTick then
region.FrameTick()
end
region.subRegionEvents:Notify("FrameTick")
Private.StopProfileAura(region.id);
end
Private.StopProfileSystem("frame tick")
end
local function RegisterForFrameTick(region)
-- Check for a Frame Tick function
local hasFrameTick = region.FrameTick
if not hasFrameTick then
@@ -639,30 +655,14 @@ function WeakAuras.RegisterForFrameTick(region)
end
end
function WeakAuras.UnRegisterForFrameTick(region)
local function UnRegisterForFrameTick(region)
regionsForFrameTick[region] = nil
if not next(regionsForFrameTick) then
frameForFrameTick:SetScript("OnUpdate", nil)
end
end
function WeakAuras.FrameTick()
if WeakAuras.IsOptionsOpen() then
return
end
WeakAuras.StartProfileSystem("frame tick")
for region in pairs(regionsForFrameTick) do
WeakAuras.StartProfileAura(region.id);
if region.FrameTick then
region.FrameTick()
end
region.subRegionEvents:Notify("FrameTick")
WeakAuras.StopProfileAura(region.id);
end
WeakAuras.StopProfileSystem("frame tick")
end
local function TimerTick(self)
local function TimerTickForSetDuration(self)
local duration = self.duration
local adjustMin = self.adjustedMin or 0;
@@ -697,7 +697,7 @@ function WeakAuras.regionPrototype.AddSetDurationInfo(region)
local adjustMin = region.adjustedMin or 0;
region:SetTime((duration ~= 0 and region.adjustedMax or duration) - adjustMin, expirationTime - adjustMin, inverse);
region.TimerTick = TimerTick
region.TimerTick = TimerTickForSetDuration
region:UpdateRegionHasTimerTick()
end
end
@@ -714,7 +714,7 @@ function WeakAuras.regionPrototype.AddExpandFunction(data, region, cloneId, pare
local inGroup = parentRegionType == "group";
local startMainAnimation = function()
WeakAuras.Animate("display", data.uid, "main", data.animation.main, region, false, nil, true, cloneId);
Private.Animate("display", data.uid, "main", data.animation.main, region, false, nil, true, cloneId);
end
function region:OptionsClosed()
@@ -769,8 +769,8 @@ function WeakAuras.regionPrototype.AddExpandFunction(data, region, cloneId, pare
region.toShow = false;
region:SetScript("OnUpdate", nil)
WeakAuras.PerformActions(data, "finish", region);
if (not WeakAuras.Animate("display", data.uid, "finish", data.animation.finish, region, false, hideRegion, nil, cloneId)) then
Private.PerformActions(data, "finish", region);
if (not Private.Animate("display", data.uid, "finish", data.animation.finish, region, false, hideRegion, nil, cloneId)) then
hideRegion();
end
@@ -778,7 +778,7 @@ function WeakAuras.regionPrototype.AddExpandFunction(data, region, cloneId, pare
region:SoundRepeatStop();
end
WeakAuras.UnRegisterForFrameTick(region)
UnRegisterForFrameTick(region)
end
function region:Expand()
if (region.toShow) then
@@ -792,15 +792,15 @@ function WeakAuras.regionPrototype.AddExpandFunction(data, region, cloneId, pare
region.subRegionEvents:Notify("PreShow")
region.justCreated = nil;
WeakAuras.ApplyFrameLevel(region)
Private.ApplyFrameLevel(region)
region:Show();
WeakAuras.PerformActions(data, "start", region);
if not(WeakAuras.Animate("display", data.uid, "start", data.animation.start, region, true, startMainAnimation, nil, cloneId)) then
Private.PerformActions(data, "start", region);
if not(Private.Animate("display", data.uid, "start", data.animation.start, region, true, startMainAnimation, nil, cloneId)) then
startMainAnimation();
end
parent:ActivateChild(data.id, cloneId);
WeakAuras.RegisterForFrameTick(region)
RegisterForFrameTick(region)
region:UpdateTimerTick()
end
elseif not(data.controlledChildren) then
@@ -811,8 +811,8 @@ function WeakAuras.regionPrototype.AddExpandFunction(data, region, cloneId, pare
region.toShow = false;
region:SetScript("OnUpdate", nil)
WeakAuras.PerformActions(data, "finish", region);
if (not WeakAuras.Animate("display", data.uid, "finish", data.animation.finish, region, false, hideRegion, nil, cloneId)) then
Private.PerformActions(data, "finish", region);
if (not Private.Animate("display", data.uid, "finish", data.animation.finish, region, false, hideRegion, nil, cloneId)) then
hideRegion();
end
@@ -824,14 +824,14 @@ function WeakAuras.regionPrototype.AddExpandFunction(data, region, cloneId, pare
region:SoundRepeatStop();
end
WeakAuras.UnRegisterForFrameTick(region)
UnRegisterForFrameTick(region)
end
function region:Expand()
if data.anchorFrameType == "SELECTFRAME"
or data.anchorFrameType == "CUSTOM"
or data.anchorFrameType == "UNITFRAME"
then
WeakAuras.AnchorFrame(data, region, parent);
Private.AnchorFrame(data, region, parent);
end
if (region.toShow) then
@@ -846,10 +846,10 @@ function WeakAuras.regionPrototype.AddExpandFunction(data, region, cloneId, pare
region.subRegionEvents:Notify("PreShow")
WeakAuras.ApplyFrameLevel(region)
Private.ApplyFrameLevel(region)
region:Show();
WeakAuras.PerformActions(data, "start", region);
if not(WeakAuras.Animate("display", data.uid, "start", data.animation.start, region, true, startMainAnimation, nil, cloneId)) then
Private.PerformActions(data, "start", region);
if not(Private.Animate("display", data.uid, "start", data.animation.start, region, true, startMainAnimation, nil, cloneId)) then
startMainAnimation();
end
@@ -857,7 +857,7 @@ function WeakAuras.regionPrototype.AddExpandFunction(data, region, cloneId, pare
parent:UpdateBorder(region);
end
WeakAuras.RegisterForFrameTick(region)
RegisterForFrameTick(region)
region:UpdateTimerTick()
end
end
+6 -6
View File
@@ -274,13 +274,13 @@ local function modify(parent, region, data)
local function onUpdate()
if (not region.startTime) then return end
WeakAuras.StartProfileAura(region.id);
WeakAuras.StartProfileSystem("stopmotion")
Private.StartProfileAura(region.id);
Private.StartProfileSystem("stopmotion")
local timeSinceStart = (GetTime() - region.startTime);
local newCurrentFrame = floor(timeSinceStart * (data.frameRate or 15));
if (newCurrentFrame == region.currentFrame) then
WeakAuras.StopProfileAura(region.id);
WeakAuras.StopProfileSystem("stopmotion")
Private.StopProfileAura(region.id);
Private.StopProfileSystem("stopmotion")
return;
end
@@ -339,8 +339,8 @@ local function modify(parent, region, data)
end
region.foreground:SetFrame(data.foregroundTexture, frame);
WeakAuras.StopProfileAura(region.id);
WeakAuras.StopProfileSystem("stopmotion")
Private.StopProfileAura(region.id);
Private.StopProfileSystem("stopmotion")
end;
region.FrameTick = onUpdate;
+8 -8
View File
@@ -75,7 +75,7 @@ local function modify(parent, region, data)
WeakAuras.regionPrototype.modify(parent, region, data);
local text = region.text;
region.useAuto = WeakAuras.CanHaveAuto(data);
region.useAuto = Private.CanHaveAuto(data);
local fontPath = SharedMedia:Fetch("font", data.font);
text:SetFont(fontPath, data.fontSize < 33 and data.fontSize or 33, data.outline);
@@ -158,7 +158,7 @@ local function modify(parent, region, data)
end
local UpdateText
if WeakAuras.ContainsAnyPlaceHolders(data.displayText) then
if Private.ContainsAnyPlaceHolders(data.displayText) then
local getter = function(key, default)
local fullKey = "displayText_format_" .. key
if (data[fullKey] == nil) then
@@ -166,10 +166,10 @@ local function modify(parent, region, data)
end
return data[fullKey]
end
local formatters = WeakAuras.CreateFormatters(data.displayText, getter)
local formatters = Private.CreateFormatters(data.displayText, getter)
UpdateText = function()
local textStr = data.displayText;
textStr = WeakAuras.ReplacePlaceHolders(textStr, region, nil, false, formatters);
textStr = Private.ReplacePlaceHolders(textStr, region, nil, false, formatters);
if (textStr == nil or textStr == "") then
textStr = " ";
end
@@ -179,7 +179,7 @@ local function modify(parent, region, data)
end
local customTextFunc = nil
if(WeakAuras.ContainsCustomPlaceHolder(data.displayText) and data.customText) then
if(Private.ContainsCustomPlaceHolder(data.displayText) and data.customText) then
customTextFunc = WeakAuras.LoadFunction("return "..data.customText, region.id, "custom text")
end
@@ -187,7 +187,7 @@ local function modify(parent, region, data)
if customTextFunc then
if UpdateText then
Update = function()
region.values.custom = WeakAuras.RunCustomTextFunc(region, customTextFunc)
region.values.custom = Private.RunCustomTextFunc(region, customTextFunc)
UpdateText()
end
end
@@ -196,14 +196,14 @@ local function modify(parent, region, data)
end
local TimerTick
if WeakAuras.ContainsPlaceHolders(data.displayText, "p") then
if Private.ContainsPlaceHolders(data.displayText, "p") then
TimerTick = UpdateText
end
local FrameTick
if customTextFunc and data.customTextUpdate == "update" then
FrameTick = function()
region.values.custom = WeakAuras.RunCustomTextFunc(region, customTextFunc)
region.values.custom = Private.RunCustomTextFunc(region, customTextFunc)
UpdateText()
end
end
+1 -1
View File
@@ -44,7 +44,7 @@ local properties = {
display =L["Type"],
setter = "SetGlowType",
type = "list",
values = WeakAuras.glow_types,
values = Private.glow_types,
},
useGlowColor = {
display = L["Use Custom Color"],
+14 -14
View File
@@ -185,7 +185,7 @@ local function modify(parent, region, parentData, data, first)
if first then
local containsCustomText = false
for index, subRegion in ipairs(parentData.subRegions) do
if subRegion.type == "subtext" and WeakAuras.ContainsCustomPlaceHolder(subRegion.text_text) then
if subRegion.type == "subtext" and Private.ContainsCustomPlaceHolder(subRegion.text_text) then
containsCustomText = true
break
end
@@ -200,7 +200,7 @@ local function modify(parent, region, parentData, data, first)
end
local UpdateText
if data.text_text and WeakAuras.ContainsAnyPlaceHolders(data.text_text) then
if data.text_text and Private.ContainsAnyPlaceHolders(data.text_text) then
local getter = function(key, default)
local fullKey = "text_text_format_" .. key
if data[fullKey] == nil then
@@ -208,10 +208,10 @@ local function modify(parent, region, parentData, data, first)
end
return data[fullKey]
end
local formatters = WeakAuras.CreateFormatters(data.text_text, getter)
local formatters = Private.CreateFormatters(data.text_text, getter)
UpdateText = function()
local textStr = data.text_text or ""
textStr = WeakAuras.ReplacePlaceHolders(textStr, parent, nil, false, formatters)
textStr = Private.ReplacePlaceHolders(textStr, parent, nil, false, formatters)
if text:GetFont() then
text:SetText(WeakAuras.ReplaceRaidMarkerSymbols(textStr))
@@ -223,12 +223,12 @@ local function modify(parent, region, parentData, data, first)
if first and parent.customTextFunc then
if UpdateText then
Update = function()
parent.values.custom = WeakAuras.RunCustomTextFunc(parent, parent.customTextFunc)
parent.values.custom = Private.RunCustomTextFunc(parent, parent.customTextFunc)
UpdateText()
end
else
Update = function()
parent.values.custom = WeakAuras.RunCustomTextFunc(parent, parent.customTextFunc)
parent.values.custom = Private.RunCustomTextFunc(parent, parent.customTextFunc)
end
end
else
@@ -236,25 +236,25 @@ local function modify(parent, region, parentData, data, first)
end
local TimerTick
if WeakAuras.ContainsPlaceHolders(data.text_text, "p") then
if Private.ContainsPlaceHolders(data.text_text, "p") then
TimerTick = UpdateText
end
local FrameTick
if parent.customTextFunc and parentData.customTextUpdate == "update" then
if first then
if WeakAuras.ContainsCustomPlaceHolder(data.text_text) then
if Private.ContainsCustomPlaceHolder(data.text_text) then
FrameTick = function()
parent.values.custom = WeakAuras.RunCustomTextFunc(parent, parent.customTextFunc)
parent.values.custom = Private.RunCustomTextFunc(parent, parent.customTextFunc)
UpdateText()
end
else
FrameTick = function()
parent.values.custom = WeakAuras.RunCustomTextFunc(parent, parent.customTextFunc)
parent.values.custom = Private.RunCustomTextFunc(parent, parent.customTextFunc)
end
end
else
if WeakAuras.ContainsCustomPlaceHolder(data.text_text) then
if Private.ContainsCustomPlaceHolder(data.text_text) then
FrameTick = UpdateText
end
end
@@ -319,7 +319,7 @@ local function modify(parent, region, parentData, data, first)
selfPoint = anchorPoint:sub(7)
elseif anchorPoint:sub(1, 6) == "OUTER_" then
anchorPoint = anchorPoint:sub(7)
selfPoint = WeakAuras.inverse_point_types[anchorPoint] or "CENTER"
selfPoint = Private.inverse_point_types[anchorPoint] or "CENTER"
else
selfPoint = "CENTER"
end
@@ -330,9 +330,9 @@ local function modify(parent, region, parentData, data, first)
elseif selfPoint:sub(1, 6) == "INNER_" then
selfPoint = selfPoint:sub(7)
end
selfPoint = WeakAuras.point_types[selfPoint] and selfPoint or "CENTER"
selfPoint = Private.point_types[selfPoint] and selfPoint or "CENTER"
else
selfPoint = WeakAuras.inverse_point_types[data.text_anchorPoint or "CENTER"] or "CENTER"
selfPoint = Private.inverse_point_types[data.text_anchorPoint or "CENTER"] or "CENTER"
end
end
+1 -1
View File
@@ -40,7 +40,7 @@ local properties = {
display = L["Placement Mode"],
setter = "SetTickPlacementMode",
type = "list",
values = WeakAuras.tick_placement_modes,
values = Private.tick_placement_modes,
},
tick_placement = {
display = L["Placement"],
+59 -66
View File
@@ -39,8 +39,6 @@ local versionString = WeakAuras.versionString;
local regionOptions = WeakAuras.regionOptions;
local regionTypes = WeakAuras.regionTypes;
local event_types = WeakAuras.event_types;
local status_types = WeakAuras.status_types;
-- Local functions
local decodeB64, GenerateUniqueID
@@ -140,9 +138,8 @@ function CompressDisplay(data)
end
end
local copiedData = {}
WeakAuras.DeepCopy(data, copiedData)
stripNonTransmissableFields(copiedData, WeakAuras.non_transmissable_fields)
local copiedData = CopyTable(data)
stripNonTransmissableFields(copiedData, Private.non_transmissable_fields)
copiedData.tocversion = WeakAuras.BuildInfo
return copiedData;
end
@@ -224,11 +221,11 @@ showCodeButton:SetSize(90, 22)
local checkButtons, radioButtons, keyToButton, pendingData = {}, {}, {}, {}
for _, key in pairs(WeakAuras.internal_fields) do
for _, key in pairs(Private.internal_fields) do
keyToButton[key] = false
end
for index,category in pairs(WeakAuras.update_categories) do
for index,category in pairs(Private.update_categories) do
local button = CreateFrame("checkButton", "WeakAurasTooltipCheckButton"..index, buttonAnchor, "ChatConfigCheckButtonTemplate")
for k, v in pairs(category) do
button[k] = v
@@ -275,7 +272,7 @@ for index, button in ipairs(radioButtons) do
button:SetChecked(button == self)
end
pendingData.mode = index
WeakAuras.RefreshTooltipButtons()
Private.RefreshTooltipButtons()
end)
end
@@ -285,6 +282,36 @@ end
-- Such that all of the display tab settings are in their own subtable
setmetatable(keyToButton,{__index = function(_, key) return key and checkButtons.display end,})
local deleted = {} -- magic value
local function recurseUpdate(data, chunk)
for k,v in pairs(chunk) do
if v == deleted then
data[k] = nil
elseif type(v) == 'table' and type(data[k]) == 'table' then
recurseUpdate(data[k], v)
else
data[k] = v
end
end
end
local function Update(data, diff)
-- modifies the installed data such that it matches the pending import, sans user-specified options
-- diff is expected to be output generated by diff
if not diff then
WeakAuras.Add(data)
return
end
if data then
WeakAuras.DeleteOption(data)
else
return
end
recurseUpdate(data, diff)
WeakAuras.Add(data)
return data
end
local function install(data, oldData, patch, mode, isParent)
-- munch the provided data and add, update, or delete as appropriate
-- return the data which the SV knows about afterwards (if there is any)
@@ -343,13 +370,13 @@ local function install(data, oldData, patch, mode, isParent)
if data.uid and data.uid ~= oldData.uid then
oldData.uid = data.uid
end
WeakAuras.Update(oldData, patch)
Update(oldData, patch)
oldData.preferToUpdate = true
installedUID = oldData.uid
imported = data
end
-- if at this point, then some change has been made in the db. Update History to reflect the change
WeakAuras.SetHistory(installedUID, imported, "import")
Private.SetHistory(installedUID, imported, "import")
return Private.GetDataByUID(installedUID)
end
@@ -561,7 +588,7 @@ ItemRefTooltip:HookScript("OnHide", function(self)
end)
importButton:SetScript("OnClick", function()
WeakAuras.dynFrame:AddAction("import", coroutine.create(importPendingData))
Private.dynFrame:AddAction("import", coroutine.create(importPendingData))
end)
showCodeButton:SetScript("OnClick", function()
@@ -725,9 +752,6 @@ function WeakAuras.DisplayToString(id, forChat)
v = 1421, -- Version of Transmisson, won't change anymore.
s = versionString
};
if(WeakAuras.transmitCache and WeakAuras.transmitCache[id]) then
transmit.i = WeakAuras.transmitCache[id];
end
local firstTrigger = data.triggers[1].trigger
if(firstTrigger.type == "aura" and WeakAurasOptionsSaved and WeakAurasOptionsSaved.spellCache) then
transmit.a = {};
@@ -792,21 +816,21 @@ local function recurseStringify(data, level, lines)
end
end
function WeakAuras.DataToString(id)
function Private.DataToString(id)
local data = WeakAuras.GetData(id)
if data then
return WeakAuras.SerializeTable(data):gsub("|", "||")
return Private.SerializeTable(data):gsub("|", "||")
end
end
function WeakAuras.SerializeTable(data)
function Private.SerializeTable(data)
local lines = {"{"}
recurseStringify(data, 1, lines)
tinsert(lines, "}")
return table.concat(lines, "\n")
end
function WeakAuras.RefreshTooltipButtons()
function Private.RefreshTooltipButtons()
importButton:Disable()
importButton.tooltipText = nil
showCodeButton:Enable()
@@ -857,7 +881,7 @@ function WeakAuras.RefreshTooltipButtons()
local importWidth = WeakAurasTooltipImportButtonText:GetStringWidth()
importButton:SetWidth(importWidth + 30)
end
buttonAnchor:SetScript("OnEvent", WeakAuras.RefreshTooltipButtons)
buttonAnchor:SetScript("OnEvent", Private.RefreshTooltipButtons)
local function SetCheckButtonStates(radioButtonAnchor, activeCategories)
if activeCategories then
@@ -913,7 +937,7 @@ function ShowTooltip(lines, linesFromTop, activeCategories)
if pendingData.newData then
local checkButtonAnchor = _G["ItemRefTooltipTextLeft" .. (linesFromTop or 1)]
SetCheckButtonStates(checkButtonAnchor, activeCategories)
WeakAuras.RefreshTooltipButtons()
Private.RefreshTooltipButtons()
buttonAnchor:Show()
else
buttonAnchor:Hide()
@@ -1113,8 +1137,8 @@ local function scamCheck(codes, data)
end
end
local internalFields = WeakAuras.internal_fields
local nonTransmissableFields = WeakAuras.non_transmissable_fields
local internalFields = Private.internal_fields
local nonTransmissableFields = Private.non_transmissable_fields
local deleted = {} -- magic value
local function recurseDiff(ours, theirs)
local diff, seen, same = {}, {}, true
@@ -1163,7 +1187,7 @@ local function recurseSerial(lines, depth, chunk)
end
end
function WeakAuras.diff(ours, theirs)
local function diff(ours, theirs)
-- generates a diff which WeakAuras.Update can use
local debug = false
if not ours or not theirs then return end
@@ -1229,7 +1253,7 @@ local function findMatch(data, children)
return oldParent
end
function WeakAuras.MatchInfo(data, children, target)
local function MatchInfo(data, children, target)
-- match the parent/single aura (if no children)
local oldParent = target or findMatch(data, children)
if not oldParent then return nil end
@@ -1255,7 +1279,7 @@ function WeakAuras.MatchInfo(data, children, target)
info.mode = 2
end
info.newData[0] = data
info.diffs[0] = WeakAuras.diff(oldParent, data)
info.diffs[0] = diff(oldParent, data)
if info.diffs[0] then
info.modified = info.modified + 1
end
@@ -1358,7 +1382,7 @@ function WeakAuras.MatchInfo(data, children, target)
else
lastMatch = oldIndex
end
local childDiff = WeakAuras.diff(oldChild, newChild, true)
local childDiff = diff(oldChild, newChild, true)
if childDiff then
info.modified = info.modified + 1
info.diffs[newIndex] = childDiff
@@ -1393,37 +1417,7 @@ function WeakAuras.MatchInfo(data, children, target)
return modified and info or false
end
local function recurseUpdate(data, chunk)
for k,v in pairs(chunk) do
if v == deleted then
data[k] = nil
elseif type(v) == 'table' and type(data[k]) == 'table' then
recurseUpdate(data[k], v)
else
data[k] = v
end
end
end
function WeakAuras.Update(data, diff)
-- modifies the installed data such that it matches the pending import, sans user-specified options
-- diff is expected to be output generated by WeakAuras.diff
if not diff then
WeakAuras.Add(data)
return
end
if data then
WeakAuras.DeleteOption(data)
else
return
end
recurseUpdate(data, diff)
WeakAuras.Add(data)
return data
end
function WeakAuras.ShowDisplayTooltip(data, children, matchInfo, icon, icons, import, compressed)
local function ShowDisplayTooltip(data, children, matchInfo, icon, icons, import, compressed)
-- since we have new data, wipe the old pending data
wipe(pendingData)
@@ -1561,12 +1555,12 @@ function WeakAuras.ShowDisplayTooltip(data, children, matchInfo, icon, icons, im
tinsert(tooltip, {2, L["Trigger:"], L["Aura"], 1, 1, 1, 1, 1, 1});
elseif(trigger.type == "event" or trigger.type == "status") then
if(trigger.type == "event") then
tinsert(tooltip, {2, L["Trigger:"], (event_types[trigger.event] or L["Undefined"]), 1, 1, 1, 1, 1, 1});
tinsert(tooltip, {2, L["Trigger:"], (Private.event_types[trigger.event] or L["Undefined"]), 1, 1, 1, 1, 1, 1});
else
tinsert(tooltip, {2, L["Trigger:"], (status_types[trigger.event] or L["Undefined"]), 1, 1, 1, 1, 1, 1});
tinsert(tooltip, {2, L["Trigger:"], (Private.status_types[trigger.event] or L["Undefined"]), 1, 1, 1, 1, 1, 1});
end
if(trigger.event == "Combat Log" and trigger.subeventPrefix and trigger.subeventSuffix) then
tinsert(tooltip, {2, L["Message type:"], (WeakAuras.subevent_prefix_types[trigger.subeventPrefix] or L["Undefined"]).." "..(WeakAuras.subevent_suffix_types[trigger.subeventSuffix] or L["Undefined"]), 1, 1, 1, 1, 1, 1});
tinsert(tooltip, {2, L["Message type:"], (Private.subevent_prefix_types[trigger.subeventPrefix] or L["Undefined"]).." "..(Private.subevent_suffix_types[trigger.subeventSuffix] or L["Undefined"]), 1, 1, 1, 1, 1, 1});
end
else
tinsert(tooltip, {2, L["Trigger:"], L["Custom"], 1, 1, 1, 1, 1, 1});
@@ -1584,6 +1578,7 @@ function WeakAuras.ShowDisplayTooltip(data, children, matchInfo, icon, icons, im
if excessChildren <= 0 then
tinsert(tooltip, {2, " ", child.id, 1, 1, 1, 1, 1, 1})
end
tocversion = tocversion or child.tocversion
end
if excessChildren > 0 then
tinsert(tooltip, {2, " ", "[...]", 1, 1, 1, 1, 1, 1})
@@ -1632,8 +1627,6 @@ function WeakAuras.ShowDisplayTooltip(data, children, matchInfo, icon, icons, im
local i;
if(icon) then
i = icon;
elseif(WeakAuras.transmitCache and WeakAuras.transmitCache[data.id]) then
i = WeakAuras.transmitCache[data.id];
end
if (i) then
thumbnail:SetIcon(i);
@@ -1700,8 +1693,8 @@ function WeakAuras.Import(inData, target)
end
end
tooltipLoading = nil;
local matchInfo = WeakAuras.MatchInfo(data, children, target)
WeakAuras.ShowDisplayTooltip(data, children, matchInfo, icon, icons, "unknown")
local matchInfo = MatchInfo(data, children, target)
ShowDisplayTooltip(data, children, matchInfo, icon, icons, "unknown")
return status, msg
end
@@ -1808,8 +1801,8 @@ Comm:RegisterComm("WeakAuras", function(prefix, message, distribution, sender)
WeakAuras.PreAdd(child)
end
end
local matchInfo = WeakAuras.MatchInfo(data, children)
WeakAuras.ShowDisplayTooltip(data, children, matchInfo, icon, icons, sender, true)
local matchInfo = MatchInfo(data, children)
ShowDisplayTooltip(data, children, matchInfo, icon, icons, sender, true)
elseif(received.m == "dR") then
--if(WeakAuras.linked[received.d]) then
TransmitDisplay(received.d, sender);
+215 -197
View File
File diff suppressed because it is too large Load Diff
+291 -365
View File
File diff suppressed because it is too large Load Diff
@@ -50,32 +50,25 @@ local function copyAuraPart(source, destination, part)
end
end
if (part == "trigger" or all) and not IsRegionAGroup(source) then
destination.triggers = {};
WeakAuras.DeepCopy(source.triggers, destination.triggers);
destination.triggers = CopyTable(source.triggers);
end
if (part == "condition" or all) and not IsRegionAGroup(source) then
destination.conditions = {};
WeakAuras.DeepCopy(source.conditions, destination.conditions);
destination.conditions = CopyTable(source.conditions);
end
if (part == "load" or all) and not IsRegionAGroup(source) then
destination.load = {};
WeakAuras.DeepCopy(source.load, destination.load);
destination.load = CopyTable(source.load);
end
if (part == "action" or all) and not IsRegionAGroup(source) then
destination.actions = {};
WeakAuras.DeepCopy(source.actions, destination.actions);
destination.actions = CopyTable(source.actions);
end
if (part == "animation" or all) and not IsRegionAGroup(source) then
destination.animation = {};
WeakAuras.DeepCopy(source.animation, destination.animation);
destination.animation = CopyTable(source.animation);
end
if (part == "authorOptions" or all) and not IsRegionAGroup(source) then
destination.authorOptions = {};
WeakAuras.DeepCopy(source.authorOptions, destination.authorOptions);
destination.authorOptions = CopyTable(source.authorOptions);
end
if (part == "config" or all) and not IsRegionAGroup(source) then
destination.config = {};
WeakAuras.DeepCopy(source.config, destination.config);
destination.config = CopyTable(source.config);
end
end
@@ -83,8 +76,7 @@ end
local function CopyToClipboard(part, description)
clipboard.part = part;
clipboard.pasteText = description;
clipboard.source = {};
WeakAuras.DeepCopy(clipboard.current, clipboard.source);
clipboard.source = CopyTable(clipboard.current);
end
clipboard.pasteMenuEntry = {
@@ -106,7 +98,7 @@ clipboard.pasteMenuEntry = {
end
WeakAuras.FillOptions()
WeakAuras.ScanForLoads({[clipboard.current.id] = true});
OptionsPrivate.Private.ScanForLoads({[clipboard.current.id] = true});
WeakAuras.SortDisplayButtons();
WeakAuras.PickDisplay(clipboard.current.id);
WeakAuras.UpdateDisplayButton(clipboard.current.id);
@@ -466,7 +458,7 @@ local function GetDropTarget()
end
local function Show_DropIndicator(id)
local indicator = WeakAuras.DropIndicator()
local indicator = OptionsPrivate.DropIndicator()
local source = WeakAuras.GetDisplayButton(id)
local target, pos
if source then
@@ -517,10 +509,10 @@ local methods = {
function self.callbacks.OnClickNormal(_, mouseButton)
if(IsControlKeyDown() and not data.controlledChildren) then
if (WeakAuras.IsDisplayPicked(data.id)) then
WeakAuras.ClearPick(data.id);
if (OptionsPrivate.IsDisplayPicked(data.id)) then
OptionsPrivate.ClearPick(data.id);
else
WeakAuras.PickDisplayMultiple(data.id);
OptionsPrivate.PickDisplayMultiple(data.id);
end
self:ReloadTooltip();
elseif(IsShiftKeyDown()) then
@@ -537,23 +529,23 @@ local methods = {
editbox:Insert("[WeakAuras: "..fullName.." - "..data.id.."]");
elseif not data.controlledChildren then
-- select all buttons between 1st select and current
WeakAuras.PickDisplayMultipleShift(data.id)
OptionsPrivate.PickDisplayMultipleShift(data.id)
end
else
if(mouseButton == "RightButton") then
Hide_Tooltip();
if(WeakAuras.IsDisplayPicked(data.id) and WeakAuras.IsPickedMultiple()) then
EasyMenu(WeakAuras.MultipleDisplayTooltipMenu(), WeakAuras_DropDownMenu, self.frame, 0, 0, "MENU");
if(OptionsPrivate.IsDisplayPicked(data.id) and OptionsPrivate.IsPickedMultiple()) then
EasyMenu(OptionsPrivate.MultipleDisplayTooltipMenu(), WeakAuras_DropDownMenu, self.frame, 0, 0, "MENU");
else
UpdateClipboardMenuEntry(data);
EasyMenu(self.menu, WeakAuras_DropDownMenu, self.frame, 0, 0, "MENU");
if not(WeakAuras.IsDisplayPicked(data.id)) then
if not(OptionsPrivate.IsDisplayPicked(data.id)) then
WeakAuras.PickDisplay(data.id);
end
end
else
if (WeakAuras.IsDisplayPicked(data.id)) then
WeakAuras.ClearPicks();
if (OptionsPrivate.IsDisplayPicked(data.id)) then
OptionsPrivate.ClearPicks();
else
WeakAuras.PickDisplay(data.id);
end
@@ -602,46 +594,46 @@ local methods = {
WeakAuras.Add(data);
WeakAuras.ClearAndUpdateOptions(data.id)
self.callbacks.UpdateExpandButton();
WeakAuras.SetGrouping();
OptionsPrivate.SetGrouping();
WeakAuras.UpdateDisplayButton(data);
WeakAuras.ClearAndUpdateOptions(data.id);
WeakAuras.FillOptions();
WeakAuras.UpdateGroupOrders(data);
WeakAuras.SortDisplayButtons();
self:ReloadTooltip();
WeakAuras.ResetMoverSizer();
OptionsPrivate.ResetMoverSizer();
end
function self.callbacks.OnClickGroupingSelf()
WeakAuras.SetGrouping();
OptionsPrivate.SetGrouping();
self:ReloadTooltip();
end
function self.callbacks.OnGroupClick()
WeakAuras.SetGrouping(data);
OptionsPrivate.SetGrouping(data);
end
function self.callbacks.OnDeleteClick()
if (WeakAuras.IsImporting()) then return end;
local toDelete = {data}
local parents = data.parent and {[data.parent] = true}
WeakAuras.ConfirmDelete(toDelete, parents)
OptionsPrivate.ConfirmDelete(toDelete, parents)
end
function self.callbacks.OnDuplicateClick()
if (WeakAuras.IsImporting()) then return end;
if data.controlledChildren then
local new_idGroup = WeakAuras.DuplicateAura(data)
local new_idGroup = OptionsPrivate.DuplicateAura(data)
for index, childId in pairs(data.controlledChildren) do
local childData = WeakAuras.GetData(childId)
WeakAuras.DuplicateAura(childData, new_idGroup)
OptionsPrivate.DuplicateAura(childData, new_idGroup)
end
WeakAuras.SortDisplayButtons()
WeakAuras.PickAndEditDisplay(new_idGroup)
OptionsPrivate.PickAndEditDisplay(new_idGroup)
else
local new_id = WeakAuras.DuplicateAura(data)
local new_id = OptionsPrivate.DuplicateAura(data)
WeakAuras.SortDisplayButtons()
WeakAuras.PickAndEditDisplay(new_id)
OptionsPrivate.PickAndEditDisplay(new_id)
end
end
@@ -660,11 +652,11 @@ local methods = {
end
end
tinsert(toDelete, data)
WeakAuras.ConfirmDelete(toDelete);
OptionsPrivate.ConfirmDelete(toDelete);
end
function self.callbacks.OnUngroupClick()
WeakAuras.Ungroup(data);
OptionsPrivate.Ungroup(data);
end
function self.callbacks.OnUpGroupClick()
@@ -693,8 +685,8 @@ local methods = {
WeakAuras.SortDisplayButtons();
local updata = {duration = 0.15, type = "custom", use_translate = true, x = 0, y = -32};
local downdata = {duration = 0.15, type = "custom", use_translate = true, x = 0, y = 32};
WeakAuras.Animate("button", WeakAuras.GetData(parentData.controlledChildren[index-1]).uid, "main", updata, self.frame, true, function() WeakAuras.SortDisplayButtons() end);
WeakAuras.Animate("button", WeakAuras.GetData(parentData.controlledChildren[index]).uid, "main", downdata, otherbutton.frame, true, function() WeakAuras.SortDisplayButtons() end);
OptionsPrivate.Private.Animate("button", WeakAuras.GetData(parentData.controlledChildren[index-1]).uid, "main", updata, self.frame, true, function() WeakAuras.SortDisplayButtons() end);
OptionsPrivate.Private.Animate("button", WeakAuras.GetData(parentData.controlledChildren[index]).uid, "main", downdata, otherbutton.frame, true, function() WeakAuras.SortDisplayButtons() end);
WeakAuras.UpdateDisplayButton(parentData);
WeakAuras.FillOptions()
end
@@ -732,8 +724,8 @@ local methods = {
WeakAuras.SortDisplayButtons()
local updata = {duration = 0.15, type = "custom", use_translate = true, x = 0, y = -32};
local downdata = {duration = 0.15, type = "custom", use_translate = true, x = 0, y = 32};
WeakAuras.Animate("button", WeakAuras.GetData(parentData.controlledChildren[index+1]).uid, "main", downdata, self.frame, true, function() WeakAuras.SortDisplayButtons() end);
WeakAuras.Animate("button", WeakAuras.GetData(parentData.controlledChildren[index]).uid, "main", updata, otherbutton.frame, true, function() WeakAuras.SortDisplayButtons() end);
OptionsPrivate.Private.Animate("button", WeakAuras.GetData(parentData.controlledChildren[index+1]).uid, "main", downdata, self.frame, true, function() WeakAuras.SortDisplayButtons() end);
OptionsPrivate.Private.Animate("button", WeakAuras.GetData(parentData.controlledChildren[index]).uid, "main", updata, otherbutton.frame, true, function() WeakAuras.SortDisplayButtons() end);
WeakAuras.UpdateDisplayButton(parentData);
WeakAuras.FillOptions()
end
@@ -746,7 +738,7 @@ local methods = {
end
function self.callbacks.OnViewClick()
WeakAuras.PauseAllDynamicGroups();
OptionsPrivate.Private.PauseAllDynamicGroups();
if(self.view.func() == 2) then
for index, childId in ipairs(data.controlledChildren) do
@@ -758,7 +750,7 @@ local methods = {
end
end
WeakAuras.ResumeAllDynamicGroups();
OptionsPrivate.Private.ResumeAllDynamicGroups();
end
function self.callbacks.ViewTest()
@@ -807,26 +799,26 @@ local methods = {
local oldid = data.id;
if not(newid == oldid) then
WeakAuras.Rename(data, newid);
WeakAuras.HandleRename(data, oldid, newid)
OptionsPrivate.HandleRename(data, oldid, newid)
end
end
function self.callbacks.OnDragStart()
if WeakAuras.IsImporting() or self:IsGroup() then return end;
if #WeakAuras.tempGroup.controlledChildren == 0 then
if #OptionsPrivate.tempGroup.controlledChildren == 0 then
WeakAuras.PickDisplay(data.id);
end
WeakAuras.SetDragging(data);
OptionsPrivate.SetDragging(data);
end
function self.callbacks.OnDragStop()
if not self.dragging then return end
WeakAuras.SetDragging(data, true)
OptionsPrivate.SetDragging(data, true)
end
function self.callbacks.OnKeyDown(self, key)
if (key == "ESCAPE") then
WeakAuras.SetDragging();
OptionsPrivate.SetDragging();
end
end
@@ -906,7 +898,7 @@ local methods = {
text = regionData.displayName,
notCheckable = true,
func = function()
WeakAuras.ConvertDisplay(data, regionType);
OptionsPrivate.ConvertDisplay(data, regionType);
WeakAuras_DropDownMenu:Hide();
end
});
@@ -929,12 +921,12 @@ local methods = {
tinsert(self.menu, {
text = L["Export to string..."],
notCheckable = true,
func = function() WeakAuras.ExportToString(data.id) end
func = function() OptionsPrivate.ExportToString(data.id) end
});
tinsert(self.menu, {
text = L["Export to Lua table..."],
notCheckable = true,
func = function() WeakAuras.ExportToTable(data.id) end
func = function() OptionsPrivate.ExportToTable(data.id) end
});
if WeakAurasCompanion then
@@ -1060,14 +1052,14 @@ local methods = {
namestable[1] = L["No Children"];
end
else
WeakAuras.GetTriggerDescription(data, -1, namestable)
OptionsPrivate.Private.GetTriggerDescription(data, -1, namestable)
end
if(WeakAuras.CanHaveClones(data)) then
if(OptionsPrivate.Private.CanHaveClones(data)) then
tinsert(namestable, {" ", "|cFF00FF00"..L["Auto-cloning enabled"]})
end
if(WeakAuras.IsDefinedByAddon(data.id)) then
if(OptionsPrivate.Private.IsDefinedByAddon(data.id)) then
tinsert(namestable, " ");
tinsert(namestable, {" ", "|cFF00FFFF"..L["Addon"]..": "..WeakAuras.IsDefinedByAddon(data.id)});
tinsert(namestable, {" ", "|cFF00FFFF"..L["Addon"]..": "..OptionsPrivate.Private.IsDefinedByAddon(data.id)});
end
local hasDescription = data.desc and data.desc ~= "";
@@ -1102,8 +1094,8 @@ local methods = {
self:SetDescription({data.id, displayName}, unpack(namestable));
end,
["ReloadTooltip"] = function(self)if(
WeakAuras.IsPickedMultiple() and WeakAuras.IsDisplayPicked(self.data.id)) then
Show_Long_Tooltip(self.frame, WeakAuras.MultipleDisplayTooltipDesc());
OptionsPrivate.IsPickedMultiple() and OptionsPrivate.IsDisplayPicked(self.data.id)) then
Show_Long_Tooltip(self.frame, OptionsPrivate.MultipleDisplayTooltipDesc());
else
Show_Long_Tooltip(self.frame, self.frame.description);
end
@@ -1250,7 +1242,7 @@ local methods = {
end)
Show_DropIndicator(id)
end
WeakAuras.UpdateButtonsScroll()
OptionsPrivate.UpdateButtonsScroll()
end,
["Drop"] = function(self, reset)
Show_DropIndicator()
@@ -1281,7 +1273,7 @@ local methods = {
-- exit if we have no target or only want to reset
self.multi = nil
if reset or not target then
return WeakAuras.UpdateButtonsScroll()
return OptionsPrivate.UpdateButtonsScroll()
end
local action = GetAction(target, area, self)
if action then
@@ -1370,7 +1362,7 @@ local methods = {
end,
["Expand"] = function(self, reloadTooltip)
self.expand:Enable();
WeakAuras.SetCollapsed(self.data.id, "displayButton", "", false)
OptionsPrivate.SetCollapsed(self.data.id, "displayButton", "", false)
self.expand:SetNormalTexture("Interface\\BUTTONS\\UI-MinusButton-Up.blp");
self.expand:SetPushedTexture("Interface\\BUTTONS\\UI-MinusButton-Down.blp");
self.expand.title = L["Collapse"];
@@ -1384,7 +1376,7 @@ local methods = {
end,
["Collapse"] = function(self, reloadTooltip)
self.expand:Enable();
WeakAuras.SetCollapsed(self.data.id, "displayButton", "", true)
OptionsPrivate.SetCollapsed(self.data.id, "displayButton", "", true)
self.expand:SetNormalTexture("Interface\\BUTTONS\\UI-PlusButton-Up.blp");
self.expand:SetPushedTexture("Interface\\BUTTONS\\UI-PlusButton-Down.blp");
self.expand.title = L["Expand"];
@@ -1400,7 +1392,7 @@ local methods = {
self.expand.func = func;
end,
["GetExpanded"] = function(self)
return not WeakAuras.IsCollapsed(self.data.id, "displayButton", "", true)
return not OptionsPrivate.IsCollapsed(self.data.id, "displayButton", "", true)
end,
["DisableExpand"] = function(self)
self.expand:Disable();
@@ -1798,8 +1790,8 @@ local function Constructor()
button.description = {};
button:SetScript("OnEnter", function()
if(WeakAuras.IsPickedMultiple() and WeakAuras.IsDisplayPicked(button.id)) then
Show_Long_Tooltip(button, WeakAuras.MultipleDisplayTooltipDesc());
if(OptionsPrivate.IsPickedMultiple() and OptionsPrivate.IsDisplayPicked(button.id)) then
Show_Long_Tooltip(button, OptionsPrivate.MultipleDisplayTooltipDesc());
else
if not(button.terribleCodeOrganizationHackTable.IsGroupingOrCopying()) then
button.terribleCodeOrganizationHackTable.SetNormalTooltip();
@@ -1831,9 +1823,9 @@ local function Constructor()
if(priority >= self.visibility) then
self.visibility = priority;
if(self.region and self.region.Expand) then
WeakAuras.FakeStatesFor(self.region.id, true)
if (WeakAuras.mouseFrame) then
WeakAuras.mouseFrame:expand(self.region.id);
OptionsPrivate.Private.FakeStatesFor(self.region.id, true)
if (OptionsPrivate.Private.mouseFrame) then
OptionsPrivate.Private.mouseFrame:expand(self.region.id);
end
end
end
@@ -1848,9 +1840,9 @@ local function Constructor()
if(priority >= self.visibility) then
self.visibility = 0;
if(self.region and self.region.Collapse) then
WeakAuras.FakeStatesFor(self.region.id, false)
if (WeakAuras.mouseFrame) then
WeakAuras.mouseFrame:collapse(self.region.id);
OptionsPrivate.Private.FakeStatesFor(self.region.id, false)
if (OptionsPrivate.Private.mouseFrame) then
OptionsPrivate.Private.mouseFrame:collapse(self.region.id);
end
end
end
@@ -3,7 +3,7 @@ Button Widget for our Expand button
-------------------------------------------------------------------------------]]
if not WeakAuras.IsCorrectVersion() then return end
local Type, Version = "WeakAurasExpand", 1
local Type, Version = "WeakAurasExpand", 2
local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end
@@ -1,7 +1,9 @@
--[[-----------------------------------------------------------------------------
Anchor for a Expandable section
-------------------------------------------------------------------------------]]
local Type, Version = "WeakAurasExpandAnchor", 1
if not WeakAuras.IsCorrectVersion() then return end
local AddonName, OptionsPrivate = ...
local Type, Version = "WeakAurasExpandAnchor", 2
local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end
@@ -27,8 +29,8 @@ local function OnFrameShow(frame)
local self = frame.obj
local option = self.userdata.option
if option and option.arg and option.arg.expanderName then
WeakAuras.expanderAnchors[option.arg.expanderName] = self
local otherWidget = WeakAuras.expanderButtons[option.arg.expanderName]
OptionsPrivate.expanderAnchors[option.arg.expanderName] = self
local otherWidget = OptionsPrivate.expanderButtons[option.arg.expanderName]
if otherWidget then
otherWidget:SetAnchor(self)
end
@@ -39,9 +41,9 @@ local function OnFrameHide(frame)
local self = frame.obj
local option = self.userdata.option
if option and option.arg and option.arg.expanderName then
WeakAuras.expanderAnchors[option.arg.expanderName] = nil
OptionsPrivate.expanderAnchors[option.arg.expanderName] = nil
local otherWidget = WeakAuras.expanderButtons[option.arg.expanderName]
local otherWidget = OptionsPrivate.expanderButtons[option.arg.expanderName]
if otherWidget then
otherWidget:SetAnchor(nil)
end
@@ -2,8 +2,9 @@
Button Widget for our Expand button
-------------------------------------------------------------------------------]]
if not WeakAuras.IsCorrectVersion() then return end
local AddonName, OptionsPrivate = ...
local Type, Version = "WeakAurasExpandSmall", 1
local Type, Version = "WeakAurasExpandSmall", 2
local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end
@@ -144,9 +145,9 @@ local function OnFrameShow(frame)
local self = frame.obj
local option = self.userdata.option
if option and option.arg and option.arg.expanderName then
WeakAuras.expanderButtons[option.arg.expanderName] = self
OptionsPrivate.expanderButtons[option.arg.expanderName] = self
local otherWidget = WeakAuras.expanderAnchors[option.arg.expanderName]
local otherWidget = OptionsPrivate.expanderAnchors[option.arg.expanderName]
if otherWidget then
self:SetAnchor(otherWidget)
end
@@ -157,9 +158,9 @@ local function OnFrameHide(frame)
local self = frame.obj
local option = self.userdata.option
if option and option.arg and option.arg.expanderName then
WeakAuras.expanderButtons[option.arg.expanderName] = nil
OptionsPrivate.expanderButtons[option.arg.expanderName] = nil
local otherWidget = WeakAuras.expanderAnchors[option.arg.expanderName]
local otherWidget = OptionsPrivate.expanderAnchors[option.arg.expanderName]
if otherWidget then
self:SetAnchor(nil)
end
@@ -1,6 +1,6 @@
if not WeakAuras.IsCorrectVersion() then return end
local Type, Version = "WeakAurasMultiLineEditBox", 34
local Type, Version = "WeakAurasMultiLineEditBox", 35
local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end
@@ -234,4 +234,4 @@ local function Constructor()
return AceGUI:RegisterAsWidget(widget)
end
AceGUI:RegisterWidgetType(Type, Constructor, Version)
AceGUI:RegisterWidgetType(Type, Constructor, Version)
+41 -44
View File
@@ -3,19 +3,16 @@ local AddonName, OptionsPrivate = ...
local L = WeakAuras.L
local removeFuncs = WeakAuras.commonOptions.removeFuncs
local replaceNameDescFuncs = WeakAuras.commonOptions.replaceNameDescFuncs
local replaceImageFuncs = WeakAuras.commonOptions.replaceImageFuncs
local replaceValuesFuncs = WeakAuras.commonOptions.replaceValuesFuncs
local disabledAll = WeakAuras.commonOptions.CreateDisabledAll("action")
local hiddenAll = WeakAuras.commonOptions.CreateHiddenAll("action")
local getAll = WeakAuras.commonOptions.CreateGetAll("action")
local setAll = WeakAuras.commonOptions.CreateSetAll("action", getAll)
local removeFuncs = OptionsPrivate.commonOptions.removeFuncs
local replaceNameDescFuncs = OptionsPrivate.commonOptions.replaceNameDescFuncs
local replaceImageFuncs = OptionsPrivate.commonOptions.replaceImageFuncs
local replaceValuesFuncs = OptionsPrivate.commonOptions.replaceValuesFuncs
local disabledAll = OptionsPrivate.commonOptions.CreateDisabledAll("action")
local hiddenAll = OptionsPrivate.commonOptions.CreateHiddenAll("action")
local getAll = OptionsPrivate.commonOptions.CreateGetAll("action")
local setAll = OptionsPrivate.commonOptions.CreateSetAll("action", getAll)
local send_chat_message_types = WeakAuras.send_chat_message_types;
local sound_types = WeakAuras.sound_types;
function WeakAuras.GetActionOptions(data)
function OptionsPrivate.GetActionOptions(data)
local action = {
type = "group",
name = L["Actions"],
@@ -93,7 +90,7 @@ function WeakAuras.GetActionOptions(data)
width = WeakAuras.normalWidth,
name = L["Message Type"],
order = 2,
values = send_chat_message_types,
values = OptionsPrivate.Private.send_chat_message_types,
disabled = function() return not data.actions.start.do_message end,
control = "WeakAurasSortedDropdown"
},
@@ -135,7 +132,7 @@ function WeakAuras.GetActionOptions(data)
order = 4,
disabled = function() return not data.actions.start.do_message end,
desc = function()
return L["Dynamic text tooltip"] .. WeakAuras.GetAdditionalProperties(data)
return L["Dynamic text tooltip"] .. OptionsPrivate.Private.GetAdditionalProperties(data)
end,
},
-- texteditor added later
@@ -172,7 +169,7 @@ function WeakAuras.GetActionOptions(data)
width = WeakAuras.normalWidth,
name = L["Sound"],
order = 8.4,
values = sound_types,
values = OptionsPrivate.Private.sound_types,
disabled = function() return not data.actions.start.do_sound end,
control = "WeakAurasSortedDropdown"
},
@@ -181,7 +178,7 @@ function WeakAuras.GetActionOptions(data)
width = WeakAuras.normalWidth,
name = L["Sound Channel"],
order = 8.5,
values = WeakAuras.sound_channel_types,
values = OptionsPrivate.Private.sound_channel_types,
disabled = function() return not data.actions.start.do_sound end,
get = function() return data.actions.start.sound_channel or "Master" end
},
@@ -212,7 +209,7 @@ function WeakAuras.GetActionOptions(data)
width = WeakAuras.normalWidth,
name = L["Glow Action"],
order = 10.2,
values = WeakAuras.glow_action_types,
values = OptionsPrivate.Private.glow_action_types,
disabled = function() return not data.actions.start.do_glow end
},
start_glow_frame_type = {
@@ -248,7 +245,7 @@ function WeakAuras.GetActionOptions(data)
width = WeakAuras.normalWidth,
name = L["Glow Type"],
order = 10.4,
values = WeakAuras.glow_types,
values = OptionsPrivate.Private.glow_types,
hidden = function()
return not data.actions.start.do_glow
or data.actions.start.glow_action ~= "show"
@@ -274,9 +271,9 @@ function WeakAuras.GetActionOptions(data)
func = function()
if(data.controlledChildren and data.controlledChildren[1]) then
WeakAuras.PickDisplay(data.controlledChildren[1]);
WeakAuras.StartFrameChooser(WeakAuras.GetData(data.controlledChildren[1]), {"actions", "start", "glow_frame"});
OptionsPrivate.StartFrameChooser(WeakAuras.GetData(data.controlledChildren[1]), {"actions", "start", "glow_frame"});
else
WeakAuras.StartFrameChooser(data, {"actions", "start", "glow_frame"});
OptionsPrivate.StartFrameChooser(data, {"actions", "start", "glow_frame"});
end
end
},
@@ -465,7 +462,7 @@ function WeakAuras.GetActionOptions(data)
width = WeakAuras.normalWidth,
name = L["Message Type"],
order = 22,
values = send_chat_message_types,
values = OptionsPrivate.Private.send_chat_message_types,
disabled = function() return not data.actions.finish.do_message end,
control = "WeakAurasSortedDropdown"
},
@@ -507,7 +504,7 @@ function WeakAuras.GetActionOptions(data)
order = 24,
disabled = function() return not data.actions.finish.do_message end,
desc = function()
return L["Dynamic text tooltip"] .. WeakAuras.GetAdditionalProperties(data)
return L["Dynamic text tooltip"] .. OptionsPrivate.Private.GetAdditionalProperties(data)
end,
},
-- texteditor added below
@@ -522,7 +519,7 @@ function WeakAuras.GetActionOptions(data)
width = WeakAuras.normalWidth,
name = L["Sound"],
order = 28.1,
values = sound_types,
values = OptionsPrivate.Private.sound_types,
disabled = function() return not data.actions.finish.do_sound end,
control = "WeakAurasSortedDropdown"
},
@@ -531,7 +528,7 @@ function WeakAuras.GetActionOptions(data)
width = WeakAuras.normalWidth,
name = L["Sound Channel"],
order = 28.5,
values = WeakAuras.sound_channel_types,
values = OptionsPrivate.Private.sound_channel_types,
disabled = function() return not data.actions.finish.do_sound end,
get = function() return data.actions.finish.sound_channel or "Master" end
},
@@ -562,7 +559,7 @@ function WeakAuras.GetActionOptions(data)
width = WeakAuras.normalWidth,
name = L["Glow Action"],
order = 30.2,
values = WeakAuras.glow_action_types,
values = OptionsPrivate.Private.glow_action_types,
disabled = function() return not data.actions.finish.do_glow end
},
finish_glow_frame_type = {
@@ -598,7 +595,7 @@ function WeakAuras.GetActionOptions(data)
width = WeakAuras.normalWidth,
name = L["Glow Type"],
order = 30.4,
values = WeakAuras.glow_types,
values = OptionsPrivate.Private.glow_types,
hidden = function()
return not data.actions.finish.do_glow
or data.actions.finish.glow_action ~= "show"
@@ -624,9 +621,9 @@ function WeakAuras.GetActionOptions(data)
func = function()
if(data.controlledChildren and data.controlledChildren[1]) then
WeakAuras.PickDisplay(data.controlledChildren[1]);
WeakAuras.StartFrameChooser(WeakAuras.GetData(data.controlledChildren[1]), {"actions", "finish", "glow_frame"});
OptionsPrivate.StartFrameChooser(WeakAuras.GetData(data.controlledChildren[1]), {"actions", "finish", "glow_frame"});
else
WeakAuras.StartFrameChooser(data, {"actions", "finish", "glow_frame"});
OptionsPrivate.StartFrameChooser(data, {"actions", "finish", "glow_frame"});
end
end
},
@@ -810,18 +807,18 @@ function WeakAuras.GetActionOptions(data)
-- Text format option helpers
WeakAuras.commonOptions.AddCodeOption(action.args, data, L["Custom Code"], "init", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#on-init",
OptionsPrivate.commonOptions.AddCodeOption(action.args, data, L["Custom Code"], "init", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#on-init",
0.011, function() return not data.actions.init.do_custom end, {"actions", "init", "custom"}, true);
WeakAuras.commonOptions.AddCodeOption(action.args, data, L["Custom Code"], "start_message", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#chat-message---custom-code",
5, function() return not (data.actions.start.do_message and WeakAuras.ContainsCustomPlaceHolder(data.actions.start.message)) end, {"actions", "start", "message_custom"}, false);
OptionsPrivate.commonOptions.AddCodeOption(action.args, data, L["Custom Code"], "start_message", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#chat-message---custom-code",
5, function() return not (data.actions.start.do_message and OptionsPrivate.Private.ContainsCustomPlaceHolder(data.actions.start.message)) end, {"actions", "start", "message_custom"}, false);
local startHidden = function()
return WeakAuras.IsCollapsed("format_option", "actions", "start_message", true)
return OptionsPrivate.IsCollapsed("format_option", "actions", "start_message", true)
end
local startSetHidden = function(hidden)
WeakAuras.SetCollapsed("format_option", "actions", "start_message", hidden)
OptionsPrivate.SetCollapsed("format_option", "actions", "start_message", hidden)
end
local startGet = function(key)
@@ -863,25 +860,25 @@ function WeakAuras.GetActionOptions(data)
local startGet = function(key)
return childData.actions.start["message_format_" .. key]
end
WeakAuras.AddTextFormatOption(childData.actions and childData.actions.start.message, true, startGet, startAddOption, startHidden, startSetHidden)
OptionsPrivate.AddTextFormatOption(childData.actions and childData.actions.start.message, true, startGet, startAddOption, startHidden, startSetHidden)
end
else
WeakAuras.AddTextFormatOption(data.actions and data.actions.start.message, true, startGet, startAddOption, startHidden, startSetHidden)
OptionsPrivate.AddTextFormatOption(data.actions and data.actions.start.message, true, startGet, startAddOption, startHidden, startSetHidden)
end
WeakAuras.commonOptions.AddCodeOption(action.args, data, L["Custom Code"], "start", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#on-show",
OptionsPrivate.commonOptions.AddCodeOption(action.args, data, L["Custom Code"], "start", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#on-show",
13, function() return not data.actions.start.do_custom end, {"actions", "start", "custom"}, true);
WeakAuras.commonOptions.AddCodeOption(action.args, data, L["Custom Code"], "finish_message", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#chat-message---custom-code",
25, function() return not (data.actions.finish.do_message and WeakAuras.ContainsCustomPlaceHolder(data.actions.finish.message)) end, {"actions", "finish", "message_custom"}, false);
OptionsPrivate.commonOptions.AddCodeOption(action.args, data, L["Custom Code"], "finish_message", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#chat-message---custom-code",
25, function() return not (data.actions.finish.do_message and OptionsPrivate.Private.ContainsCustomPlaceHolder(data.actions.finish.message)) end, {"actions", "finish", "message_custom"}, false);
local finishHidden = function()
return WeakAuras.IsCollapsed("format_option", "actions", "finish_message", true)
return OptionsPrivate.IsCollapsed("format_option", "actions", "finish_message", true)
end
local finishSetHidden = function(hidden)
WeakAuras.SetCollapsed("format_option", "actions", "finish_message", hidden)
OptionsPrivate.SetCollapsed("format_option", "actions", "finish_message", hidden)
end
local finishGet = function(key)
@@ -922,13 +919,13 @@ function WeakAuras.GetActionOptions(data)
local finishGet = function(key)
return childData.actions.finish["message_format_" .. key]
end
WeakAuras.AddTextFormatOption(childData.actions and childData.actions.finish.message, true, finishGet, finishAddOption, finishHidden, finishSetHidden)
OptionsPrivate.AddTextFormatOption(childData.actions and childData.actions.finish.message, true, finishGet, finishAddOption, finishHidden, finishSetHidden)
end
else
WeakAuras.AddTextFormatOption(data.actions and data.actions.finish.message, true, finishGet, finishAddOption, finishHidden, finishSetHidden)
OptionsPrivate.AddTextFormatOption(data.actions and data.actions.finish.message, true, finishGet, finishAddOption, finishHidden, finishSetHidden)
end
WeakAuras.commonOptions.AddCodeOption(action.args, data, L["Custom Code"], "finish", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#on-hide",
OptionsPrivate.commonOptions.AddCodeOption(action.args, data, L["Custom Code"], "finish", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#on-hide",
32, function() return not data.actions.finish.do_custom end, {"actions", "finish", "custom"}, true);
if data.controlledChildren then
@@ -943,7 +940,7 @@ function WeakAuras.GetActionOptions(data)
if(type(data.id) == "string") then
WeakAuras.Add(data);
WeakAuras.UpdateThumbnail(data);
WeakAuras.ResetMoverSizer();
OptionsPrivate.ResetMoverSizer();
end
end
action.hidden = function(info, ...) return hiddenAll(data, info, ...); end;
+47 -47
View File
@@ -3,27 +3,14 @@ local AddonName, OptionsPrivate = ...
local L = WeakAuras.L
local removeFuncs = WeakAuras.commonOptions.removeFuncs
local replaceNameDescFuncs = WeakAuras.commonOptions.replaceNameDescFuncs
local replaceImageFuncs = WeakAuras.commonOptions.replaceImageFuncs
local replaceValuesFuncs = WeakAuras.commonOptions.replaceValuesFuncs
local disabledAll = WeakAuras.commonOptions.CreateDisabledAll("animation")
local hiddenAll = WeakAuras.commonOptions.CreateHiddenAll("animation")
local getAll = WeakAuras.commonOptions.CreateGetAll("animation")
local setAll = WeakAuras.commonOptions.CreateSetAll("animation", getAll)
local anim_types = WeakAuras.anim_types;
local anim_translate_types = WeakAuras.anim_translate_types;
local anim_scale_types = WeakAuras.anim_scale_types;
local anim_alpha_types = WeakAuras.anim_alpha_types;
local anim_rotate_types = WeakAuras.anim_rotate_types;
local anim_color_types = WeakAuras.anim_color_types;
local anim_start_preset_types = WeakAuras.anim_start_preset_types;
local anim_main_preset_types = WeakAuras.anim_main_preset_types;
local anim_finish_preset_types = WeakAuras.anim_finish_preset_types;
local duration_types = WeakAuras.duration_types;
local duration_types_no_choice = WeakAuras.duration_types_no_choice;
local anim_ease_types = WeakAuras.anim_ease_types;
local removeFuncs = OptionsPrivate.commonOptions.removeFuncs
local replaceNameDescFuncs = OptionsPrivate.commonOptions.replaceNameDescFuncs
local replaceImageFuncs = OptionsPrivate.commonOptions.replaceImageFuncs
local replaceValuesFuncs = OptionsPrivate.commonOptions.replaceValuesFuncs
local disabledAll = OptionsPrivate.commonOptions.CreateDisabledAll("animation")
local hiddenAll = OptionsPrivate.commonOptions.CreateHiddenAll("animation")
local getAll = OptionsPrivate.commonOptions.CreateGetAll("animation")
local setAll = OptionsPrivate.commonOptions.CreateSetAll("animation", getAll)
local function filterAnimPresetTypes(intable, id)
local ret = {};
@@ -32,7 +19,7 @@ local function filterAnimPresetTypes(intable, id)
local data = WeakAuras.GetData(id);
if(region and regionType and data) then
for key, value in pairs(intable) do
local preset = WeakAuras.anim_presets[key];
local preset = OptionsPrivate.Private.anim_presets[key];
if(preset) then
if(regionType == "group" or regionType == "dynamicgroup") then
local valid = true;
@@ -56,7 +43,20 @@ local function filterAnimPresetTypes(intable, id)
return ret;
end
function WeakAuras.GetAnimationOptions(data)
function OptionsPrivate.GetAnimationOptions(data)
local anim_types = OptionsPrivate.Private.anim_types
local anim_translate_types = OptionsPrivate.Private.anim_translate_types;
local anim_scale_types = OptionsPrivate.Private.anim_scale_types;
local anim_alpha_types = OptionsPrivate.Private.anim_alpha_types;
local anim_rotate_types = OptionsPrivate.Private.anim_rotate_types;
local anim_color_types = OptionsPrivate.Private.anim_color_types;
local anim_start_preset_types = OptionsPrivate.Private.anim_start_preset_types;
local anim_main_preset_types = OptionsPrivate.Private.anim_main_preset_types;
local anim_finish_preset_types = OptionsPrivate.Private.anim_finish_preset_types;
local duration_types = OptionsPrivate.Private.duration_types;
local duration_types_no_choice = OptionsPrivate.Private.duration_types_no_choice;
local anim_ease_types = OptionsPrivate.Private.anim_ease_types;
local id = data.id
local animation = {
type = "group",
@@ -85,10 +85,10 @@ function WeakAuras.GetAnimationOptions(data)
data.animation[field] = data.animation[field] or {};
data.animation[field][value] = v;
if(field == "main") then
WeakAuras.Animate("display", data.uid, "main", data.animation.main, WeakAuras.regions[id].region, false, nil, true);
OptionsPrivate.Private.Animate("display", data.uid, "main", data.animation.main, WeakAuras.regions[id].region, false, nil, true);
if(WeakAuras.clones[id]) then
for cloneId, cloneRegion in pairs(WeakAuras.clones[id]) do
WeakAuras.Animate("display", data.uid, "main", data.animation.main, cloneRegion, false, nil, true, cloneId);
OptionsPrivate.Private.Animate("display", data.uid, "main", data.animation.main, cloneRegion, false, nil, true, cloneId);
end
end
end
@@ -154,7 +154,7 @@ function WeakAuras.GetAnimationOptions(data)
order = 33,
values = duration_types_no_choice,
disabled = true,
hidden = function() return data.animation.start.type ~= "custom" or WeakAuras.CanHaveDuration(data) end,
hidden = function() return data.animation.start.type ~= "custom" or OptionsPrivate.Private.CanHaveDuration(data) end,
get = function() return "seconds" end
},
start_duration_type = {
@@ -163,7 +163,7 @@ function WeakAuras.GetAnimationOptions(data)
name = L["Time in"],
order = 33,
values = duration_types,
hidden = function() return data.animation.start.type ~= "custom" or not WeakAuras.CanHaveDuration(data) end
hidden = function() return data.animation.start.type ~= "custom" or not OptionsPrivate.Private.CanHaveDuration(data) end
},
start_duration = {
type = "input",
@@ -400,7 +400,7 @@ function WeakAuras.GetAnimationOptions(data)
order = 53,
values = duration_types_no_choice,
disabled = true,
hidden = function() return data.animation.main.type ~= "custom" or WeakAuras.CanHaveDuration(data) end,
hidden = function() return data.animation.main.type ~= "custom" or OptionsPrivate.Private.CanHaveDuration(data) end,
get = function() return "seconds" end
},
main_duration_type = {
@@ -409,7 +409,7 @@ function WeakAuras.GetAnimationOptions(data)
name = L["Time in"],
order = 53,
values = duration_types,
hidden = function() return data.animation.main.type ~= "custom" or not WeakAuras.CanHaveDuration(data) end
hidden = function() return data.animation.main.type ~= "custom" or not OptionsPrivate.Private.CanHaveDuration(data) end
},
main_duration = {
type = "input",
@@ -843,10 +843,10 @@ function WeakAuras.GetAnimationOptions(data)
}
local function extraSetFunction()
WeakAuras.Animate("display", data.uid, "main", data.animation.main, WeakAuras.regions[id].region, false, nil, true);
OptionsPrivate.Private.Animate("display", data.uid, "main", data.animation.main, WeakAuras.regions[id].region, false, nil, true);
if(WeakAuras.clones[id]) then
for cloneId, cloneRegion in pairs(WeakAuras.clones[id]) do
WeakAuras.Animate("display", data.uid, "main", data.animation.main, cloneRegion, false, nil, true, cloneId);
OptionsPrivate.Private.Animate("display", data.uid, "main", data.animation.main, cloneRegion, false, nil, true, cloneId);
end
end
end
@@ -855,93 +855,93 @@ function WeakAuras.GetAnimationOptions(data)
local function hideStartAlphaFunc()
return data.animation.start.type ~= "custom" or data.animation.start.alphaType ~= "custom" or not data.animation.start.use_alpha
end
WeakAuras.commonOptions.AddCodeOption(animation.args, data, L["Custom Function"], "start_alphaFunc", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#alpha-opacity",
OptionsPrivate.commonOptions.AddCodeOption(animation.args, data, L["Custom Function"], "start_alphaFunc", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#alpha-opacity",
35.3, hideStartAlphaFunc, {"animation", "start", "alphaFunc"}, false);
local function hideStartTranslate()
return data.animation.start.type ~= "custom" or data.animation.start.translateType ~= "custom" or not data.animation.start.use_translate
end
WeakAuras.commonOptions.AddCodeOption(animation.args, data, L["Custom Function"], "start_translateFunc", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#translate-position",
OptionsPrivate.commonOptions.AddCodeOption(animation.args, data, L["Custom Function"], "start_translateFunc", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#translate-position",
39.3, hideStartTranslate, {"animation", "start", "translateFunc"}, false);
local function hideStartScale()
return data.animation.start.type ~= "custom" or data.animation.start.scaleType ~= "custom" or not (data.animation.start.use_scale and WeakAuras.regions[id].region.Scale)
end
WeakAuras.commonOptions.AddCodeOption(animation.args, data, L["Custom Function"], "start_scaleFunc", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#scale-size",
OptionsPrivate.commonOptions.AddCodeOption(animation.args, data, L["Custom Function"], "start_scaleFunc", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#scale-size",
43.3, hideStartScale, {"animation", "start", "scaleFunc"}, false);
local function hideStartRotateFunc()
return data.animation.start.type ~= "custom" or data.animation.start.rotateType ~= "custom" or not (data.animation.start.use_rotate and WeakAuras.regions[id].region.Rotate)
end
WeakAuras.commonOptions.AddCodeOption(animation.args, data, L["Custom Function"], "start_rotateFunc", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#rotate",
OptionsPrivate.commonOptions.AddCodeOption(animation.args, data, L["Custom Function"], "start_rotateFunc", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#rotate",
47.3, hideStartRotateFunc, {"animation", "start", "rotateFunc"}, false);
local function hideStartColorFunc()
return data.animation.start.type ~= "custom" or data.animation.start.colorType ~= "custom" or not (data.animation.start.use_color and WeakAuras.regions[id].region.Color)
end
WeakAuras.commonOptions.AddCodeOption(animation.args, data, L["Custom Function"], "start_colorFunc", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#color",
OptionsPrivate.commonOptions.AddCodeOption(animation.args, data, L["Custom Function"], "start_colorFunc", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#color",
48.7, hideStartColorFunc, {"animation", "start", "colorFunc"}, false);
-- Text Editors for "main"
local function hideMainAlphaFunc()
return data.animation.main.type ~= "custom" or data.animation.main.alphaType ~= "custom" or not data.animation.main.use_alpha
end
WeakAuras.commonOptions.AddCodeOption(animation.args, data, L["Custom Function"], "main_alphaFunc", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#alpha-opacity",
OptionsPrivate.commonOptions.AddCodeOption(animation.args, data, L["Custom Function"], "main_alphaFunc", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#alpha-opacity",
55.3, hideMainAlphaFunc, {"animation", "main", "alphaFunc"}, false, nil, extraSetFunction);
local function hideMainTranslate()
return data.animation.main.type ~= "custom" or data.animation.main.translateType ~= "custom" or not data.animation.main.use_translate
end
WeakAuras.commonOptions.AddCodeOption(animation.args, data, L["Custom Function"], "main_translateFunc", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#translate-position",
OptionsPrivate.commonOptions.AddCodeOption(animation.args, data, L["Custom Function"], "main_translateFunc", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#translate-position",
59.3, hideMainTranslate, {"animation", "main", "translateFunc"}, false, nil, extraSetFunction);
local function hideMainScale()
return data.animation.main.type ~= "custom" or data.animation.main.scaleType ~= "custom" or not (data.animation.main.use_scale and WeakAuras.regions[id].region.Scale)
end
WeakAuras.commonOptions.AddCodeOption(animation.args, data, L["Custom Function"], "main_scaleFunc", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#scale-sizes",
OptionsPrivate.commonOptions.AddCodeOption(animation.args, data, L["Custom Function"], "main_scaleFunc", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#scale-sizes",
63.3, hideMainScale, {"animation", "main", "scaleFunc"}, false, nil, extraSetFunction);
local function hideMainRotateFunc()
return data.animation.main.type ~= "custom" or data.animation.main.rotateType ~= "custom" or not (data.animation.main.use_rotate and WeakAuras.regions[id].region.Rotate)
end
WeakAuras.commonOptions.AddCodeOption(animation.args, data, L["Custom Function"], "main_rotateFunc", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#rotate",
OptionsPrivate.commonOptions.AddCodeOption(animation.args, data, L["Custom Function"], "main_rotateFunc", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#rotate",
67.3, hideMainRotateFunc, {"animation", "main", "rotateFunc"}, false, nil, extraSetFunction);
local function hideMainColorFunc()
return data.animation.main.type ~= "custom" or data.animation.main.colorType ~= "custom" or not (data.animation.main.use_color and WeakAuras.regions[id].region.Color)
end
WeakAuras.commonOptions.AddCodeOption(animation.args, data, L["Custom Function"], "main_colorFunc", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#color",
OptionsPrivate.commonOptions.AddCodeOption(animation.args, data, L["Custom Function"], "main_colorFunc", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#color",
68.7, hideMainColorFunc, {"animation", "main", "colorFunc"}, false, nil, extraSetFunction);
-- Text Editors for "finish"
local function hideFinishAlphaFunc()
return data.animation.finish.type ~= "custom" or data.animation.finish.alphaType ~= "custom" or not data.animation.finish.use_alpha
end
WeakAuras.commonOptions.AddCodeOption(animation.args, data, L["Custom Function"], "finish_alphaFunc", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#alpha-opacity",
OptionsPrivate.commonOptions.AddCodeOption(animation.args, data, L["Custom Function"], "finish_alphaFunc", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#alpha-opacity",
75.3, hideFinishAlphaFunc, {"animation", "finish", "alphaFunc"}, false);
local function hideFinishTranslate()
return data.animation.finish.type ~= "custom" or data.animation.finish.translateType ~= "custom" or not data.animation.finish.use_translate
end
WeakAuras.commonOptions.AddCodeOption(animation.args, data, L["Custom Function"], "finish_translateFunc", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#translate-position",
OptionsPrivate.commonOptions.AddCodeOption(animation.args, data, L["Custom Function"], "finish_translateFunc", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#translate-position",
79.3, hideFinishTranslate, {"animation", "finish", "translateFunc"}, false);
local function hideFinishScale()
return data.animation.finish.type ~= "custom" or data.animation.finish.scaleType ~= "custom" or not (data.animation.finish.use_scale and WeakAuras.regions[id].region.Scale)
end
WeakAuras.commonOptions.AddCodeOption(animation.args, data, L["Custom Function"], "finish_scaleFunc", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#scale-size",
OptionsPrivate.commonOptions.AddCodeOption(animation.args, data, L["Custom Function"], "finish_scaleFunc", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#scale-size",
83.3, hideFinishScale, {"animation", "finish", "scaleFunc"}, false);
local function hideFinishRotateFunc()
return data.animation.finish.type ~= "custom" or data.animation.finish.rotateType ~= "custom" or not (data.animation.finish.use_rotate and WeakAuras.regions[id].region.Rotate)
end
WeakAuras.commonOptions.AddCodeOption(animation.args, data, L["Custom Function"], "finish_rotateFunc", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#rotate",
OptionsPrivate.commonOptions.AddCodeOption(animation.args, data, L["Custom Function"], "finish_rotateFunc", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#rotate",
87.3, hideFinishRotateFunc, {"animation", "finish", "rotateFunc"}, false);
local function hideFinishColorFunc()
return data.animation.finish.type ~= "custom" or data.animation.finish.colorType ~= "custom" or not (data.animation.finish.use_color and WeakAuras.regions[id].region.Color)
end
WeakAuras.commonOptions.AddCodeOption(animation.args, data, L["Custom Function"], "finish_colorFunc", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#color",
OptionsPrivate.commonOptions.AddCodeOption(animation.args, data, L["Custom Function"], "finish_colorFunc", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#color",
88.7, hideFinishColorFunc, {"animation", "finish", "colorFunc"}, false);
if(data.controlledChildren) then
@@ -956,7 +956,7 @@ function WeakAuras.GetAnimationOptions(data)
if(type(data.id) == "string") then
WeakAuras.Add(data);
WeakAuras.UpdateThumbnail(data);
WeakAuras.ResetMoverSizer();
OptionsPrivate.ResetMoverSizer();
end
end
animation.hidden = function(info, ...) return hiddenAll(data, info, ...); end;
+44 -46
View File
@@ -68,8 +68,6 @@ local tinsert, tremove, tconcat = table.insert, table.remove, table.concat
local conflictBlue = "|cFF4080FF"
local conflict = {} -- magic value
local optionClasses = WeakAuras.author_option_classes
local function atLeastOneSet(references, key)
for id, optionData in pairs(references) do
local childOption = optionData.options[optionData.index]
@@ -539,7 +537,7 @@ typeControlAdders = {
name = name(option, "default", L["Default"]),
desc = desc(option, "default"),
order = order(),
values = WeakAuras.bool_types,
values = OptionsPrivate.Private.bool_types,
get = function()
if option.default == nil then
return
@@ -740,7 +738,7 @@ typeControlAdders = {
name = name(option, "fontSize", L["Font Size"]),
desc = desc(option, "fontSize"),
order = order(),
values = WeakAuras.font_sizes,
values = OptionsPrivate.Private.font_sizes,
get = get(option, "fontSize"),
set = set(data, option, "fontSize")
}
@@ -1111,7 +1109,7 @@ typeControlAdders = {
name = name(option, "groupType", L["Group Type"]),
order = order(),
width = WeakAuras.doubleWidth,
values = WeakAuras.group_option_types,
values = OptionsPrivate.Private.group_option_types,
get = get(option, "groupType"),
set = function(_, value)
for id, optionData in pairs(option.references) do
@@ -1144,7 +1142,7 @@ typeControlAdders = {
local childOption = optionData.options[optionData.index]
local childData = optionData.data
childOption.collapse = value
WeakAuras.SetCollapsed(id, "config", optionData.path, value)
OptionsPrivate.SetCollapsed(id, "config", optionData.path, value)
WeakAuras.Add(childData)
end
WeakAuras.ClearAndUpdateOptions(data.id, true)
@@ -1158,7 +1156,7 @@ typeControlAdders = {
desc = desc(option, "limitType", L["Determines how many entries can be in the table."]),
order = order(),
width = WeakAuras.normalWidth,
values = WeakAuras.group_limit_types,
values = OptionsPrivate.Private.group_limit_types,
get = get(option, "limitType"),
set = function(_, value)
for id, optionData in pairs(option.references) do
@@ -1220,8 +1218,8 @@ typeControlAdders = {
return option.nameSource == -1
end,
}
local nameSources = CopyTable(WeakAuras.array_entry_name_types)
local validNameSourceTypes = WeakAuras.name_source_option_types
local nameSources = CopyTable(OptionsPrivate.Private.array_entry_name_types)
local validNameSourceTypes = OptionsPrivate.Private.name_source_option_types
if option.limitType ~= "fixed" then
nameSources[-1] = nil
end
@@ -1320,7 +1318,7 @@ typeControlAdders = {
width = 1,
useDesc = false,
}
WeakAuras.SetCollapsed(id, "author", path, false)
OptionsPrivate.SetCollapsed(id, "author", path, false)
WeakAuras.Add(childData)
end
WeakAuras.ClearAndUpdateOptions(data.id, true)
@@ -1349,7 +1347,7 @@ local function up(data, options, index)
local optionID = optionData.index
local childData = optionData.data
local childOptions = optionData.options
WeakAuras.MoveCollapseDataUp(id, "author", path)
OptionsPrivate.MoveCollapseDataUp(id, "author", path)
childOptions[optionID], childOptions[optionID - 1] = childOptions[optionID - 1], childOptions[optionID]
WeakAuras.Add(childData)
end
@@ -1372,7 +1370,7 @@ local function down(data, options, index)
local optionID = optionData.index
local childData = optionData.data
local childOptions = optionData.options
WeakAuras.MoveCollapseDataUp(id, "author", path)
OptionsPrivate.MoveCollapseDataDown(id, "author", path)
childOptions[optionID], childOptions[optionID + 1] = childOptions[optionID + 1], childOptions[optionID]
WeakAuras.Add(childData)
end
@@ -1389,7 +1387,7 @@ local function duplicate(data, options, index)
local childData = optionData.data
local path = optionData.path
path[#path] = path[#path] + 1 -- this data is being regenerated very soon
WeakAuras.InsertCollapsed(id, "author", optionData.path, false)
OptionsPrivate.InsertCollapsed(id, "author", optionData.path, false)
local newOption = CopyTable(childOptions[optionID])
if newOption.key then
local existingKeys = {}
@@ -1436,7 +1434,7 @@ function addAuthorModeOption(options, args, data, order, prefix, i)
local collapsed = false
for id, optionData in pairs(option.references) do
if WeakAuras.IsCollapsed(id, "author", optionData.path, true) then
if OptionsPrivate.IsCollapsed(id, "author", optionData.path, true) then
collapsed = true
break
end
@@ -1450,18 +1448,18 @@ function addAuthorModeOption(options, args, data, order, prefix, i)
end
local optionBelow = options[i + 1]
local isAboveGroup = optionBelow and optionClasses[optionBelow.type] == "group"
local isAboveGroup = optionBelow and OptionsPrivate.Private.author_option_classes[optionBelow.type] == "group"
if isAboveGroup then
buttonWidth = buttonWidth + 0.15
end
local optionAbove = options[i - 1]
local isBelowGroup = optionAbove and optionClasses[optionAbove.type] == "group"
local isBelowGroup = optionAbove and OptionsPrivate.Private.author_option_classes[optionAbove.type] == "group"
if isBelowGroup then
buttonWidth = buttonWidth + 0.15
end
local optionClass = optionClasses[option.type]
local optionName = optionClass == "noninteractive" and WeakAuras.author_option_types[option.type]
local optionClass = OptionsPrivate.Private.author_option_classes[option.type]
local optionName = optionClass == "noninteractive" and OptionsPrivate.Private.author_option_types[option.type]
or option.name
args[prefix .. "collapse"] = {
@@ -1471,7 +1469,7 @@ function addAuthorModeOption(options, args, data, order, prefix, i)
width = WeakAuras.doubleWidth - buttonWidth,
func = function()
for id, optionData in pairs(option.references) do
WeakAuras.SetCollapsed(id, "author", optionData.path, not collapsed)
OptionsPrivate.SetCollapsed(id, "author", optionData.path, not collapsed)
end
WeakAuras.ClearAndUpdateOptions(data.id, true)
end,
@@ -1493,11 +1491,11 @@ function addAuthorModeOption(options, args, data, order, prefix, i)
local groupData = optionAbove.references[id]
if groupData then
local childGroup = groupData.options[groupData.index]
local childCollapsed = WeakAuras.IsCollapsed(id, "author", optionData.path, true)
WeakAuras.RemoveCollapsed(id, "author", optionData.path)
local childCollapsed = OptionsPrivate.IsCollapsed(id, "author", optionData.path, true)
OptionsPrivate.RemoveCollapsed(id, "author", optionData.path)
local newPath = groupData.path
tinsert(newPath, #childGroup.subOptions + 1)
WeakAuras.InsertCollapsed(id, "author", newPath, childCollapsed)
OptionsPrivate.InsertCollapsed(id, "author", newPath, childCollapsed)
local childOption = tremove(optionData.options, optionData.index)
local childData = optionData.data
tinsert(childGroup.subOptions, childOption)
@@ -1522,11 +1520,11 @@ function addAuthorModeOption(options, args, data, order, prefix, i)
local groupData = optionBelow.references[id]
if groupData then
local childGroup = groupData.options[groupData.index]
local childCollapsed = WeakAuras.IsCollapsed(id, "author", optionData.path, true)
WeakAuras.RemoveCollapsed(id, "author", optionData.path)
local childCollapsed = OptionsPrivate.IsCollapsed(id, "author", optionData.path, true)
OptionsPrivate.RemoveCollapsed(id, "author", optionData.path)
local newPath = groupData.path
tinsert(newPath, 1)
WeakAuras.InsertCollapsed(id, "author", newPath, childCollapsed)
OptionsPrivate.InsertCollapsed(id, "author", newPath, childCollapsed)
local childOption = tremove(optionData.options, optionData.index)
local childData = optionData.data
tinsert(childGroup.subOptions, 1, childOption)
@@ -1553,11 +1551,11 @@ function addAuthorModeOption(options, args, data, order, prefix, i)
local parent = optionData.parent
local parentOptions = parent and parent.references[id].options or optionData.data.authorOptions
local childOption = tremove(optionData.options, optionData.index)
local childCollapsed = WeakAuras.IsCollapsed(id, "author", optionData.path, true)
WeakAuras.RemoveCollapsed(id, "author", optionData.path)
local childCollapsed = OptionsPrivate.IsCollapsed(id, "author", optionData.path, true)
OptionsPrivate.RemoveCollapsed(id, "author", optionData.path)
tinsert(parentOptions, path[#path - 1], childOption)
path[#path] = nil
WeakAuras.InsertCollapsed(id, "author", path)
OptionsPrivate.InsertCollapsed(id, "author", path)
WeakAuras.Add(optionData.data)
end
WeakAuras.ClearAndUpdateOptions(data.id, true)
@@ -1579,12 +1577,12 @@ function addAuthorModeOption(options, args, data, order, prefix, i)
local parent = optionData.parent
local parentOptions = parent and parent.references[id].options or optionData.data.authorOptions
local childOption = tremove(optionData.options, optionData.index)
local childCollapsed = WeakAuras.IsCollapsed(id, "author", optionData.path, true)
WeakAuras.RemoveCollapsed(id, "author", optionData.path)
local childCollapsed = OptionsPrivate.IsCollapsed(id, "author", optionData.path, true)
OptionsPrivate.RemoveCollapsed(id, "author", optionData.path)
tinsert(parentOptions, path[#path - 1] + 1, childOption)
path[#path] = nil
path[#path] = path[#path] + 1
WeakAuras.InsertCollapsed(id, "author", path)
OptionsPrivate.InsertCollapsed(id, "author", path)
WeakAuras.Add(optionData.data)
end
WeakAuras.ClearAndUpdateOptions(data.id, true)
@@ -1645,7 +1643,7 @@ function addAuthorModeOption(options, args, data, order, prefix, i)
local optionIndex = optionData.index
local childData = optionData.data
local parentOption = optionData.parent
WeakAuras.RemoveCollapsed(id, "author", optionData.path)
OptionsPrivate.RemoveCollapsed(id, "author", optionData.path)
tremove(childOptions, optionIndex)
if parentOption and parentOption.groupType == "array" then
local dereferencedParent = parentOption.references[id]
@@ -1671,15 +1669,15 @@ function addAuthorModeOption(options, args, data, order, prefix, i)
name = L["Option Type"],
desc = descType(option),
order = order(),
values = WeakAuras.author_option_types,
values = OptionsPrivate.Private.author_option_types,
get = get(option, "type"),
set = function(_, value)
if value == option.type then
return
end
local author_option_fields = WeakAuras.author_option_fields
local author_option_fields = OptionsPrivate.Private.author_option_fields
local commonFields, newFields = author_option_fields.common, author_option_fields[value]
local newClass = optionClasses[value]
local newClass = OptionsPrivate.Private.author_option_classes[value]
for id, optionData in pairs(option.references) do
local childOption = optionData.options[optionData.index]
local childData = optionData.data
@@ -1723,7 +1721,7 @@ function addAuthorModeOption(options, args, data, order, prefix, i)
childOption.key = newKey
end
end
if parentOption and parentOption.groupType == "array" and not WeakAuras.array_entry_name_types[value] then
if parentOption and parentOption.groupType == "array" and not OptionsPrivate.Private.array_entry_name_types[value] then
local dereferencedParent = parentOption.references[id]
if dereferencedParent.nameSource == optionData.index then
dereferencedParent.nameSource = 0
@@ -1839,7 +1837,7 @@ end
local function addUserModeOption(options, args, data, order, prefix, i)
local option = options[i]
local optionType = option.type
local optionClass = optionClasses[optionType]
local optionClass = OptionsPrivate.Private.author_option_classes[optionType]
local userOption
if optionClass == "simple" then
@@ -1867,7 +1865,7 @@ local function addUserModeOption(options, args, data, order, prefix, i)
defaultCollapsed = option.collapse
end
for id, optionData in pairs(option.references) do
if WeakAuras.IsCollapsed(id, "config", optionData.path, defaultCollapsed) then
if OptionsPrivate.IsCollapsed(id, "config", optionData.path, defaultCollapsed) then
collapsed = true
break
end
@@ -1879,7 +1877,7 @@ local function addUserModeOption(options, args, data, order, prefix, i)
width = WeakAuras.doubleWidth,
func = function()
for id, optionData in pairs(option.references) do
WeakAuras.SetCollapsed(id, "config", optionData.path, not collapsed)
OptionsPrivate.SetCollapsed(id, "config", optionData.path, not collapsed)
end
WeakAuras.ClearAndUpdateOptions(data.id, true)
end,
@@ -2405,7 +2403,7 @@ local function valuesAreEqual(t1, t2)
end
local function allChoicesAreDefault(option, config, id, path)
local optionClass = optionClasses[option.type]
local optionClass = OptionsPrivate.Private.author_option_classes[option.type]
if optionClass == "simple" then
return valuesAreEqual(option.default, config[option.key])
elseif optionClass == "group" then
@@ -2432,7 +2430,7 @@ local function allChoicesAreDefault(option, config, id, path)
path[#path] = nil
end
if option.useCollapse then
local isCollapsed = WeakAuras.IsCollapsed(id, "config", path, option.collapse)
local isCollapsed = OptionsPrivate.IsCollapsed(id, "config", path, option.collapse)
if isCollapsed ~= option.collapse then
return false
end
@@ -2449,7 +2447,7 @@ local function createorder(startorder)
end
end
function WeakAuras.GetAuthorOptions(data)
function OptionsPrivate.GetAuthorOptions(data)
-- initialize the process
local authorOptions = {
type = "group",
@@ -2519,7 +2517,7 @@ function WeakAuras.GetAuthorOptions(data)
width = 1,
useDesc = false,
}
WeakAuras.SetCollapsed(childData.id, "author", i, false)
OptionsPrivate.SetCollapsed(childData.id, "author", i, false)
WeakAuras.Add(childData)
end
else
@@ -2532,7 +2530,7 @@ function WeakAuras.GetAuthorOptions(data)
width = 1,
useDesc = false,
}
WeakAuras.SetCollapsed(data.id, "author", i, false)
OptionsPrivate.SetCollapsed(data.id, "author", i, false)
WeakAuras.Add(data)
end
WeakAuras.ClearAndUpdateOptions(data.id, true)
@@ -2557,13 +2555,13 @@ function WeakAuras.GetAuthorOptions(data)
if data.controlledChildren then
for _, id in pairs(data.controlledChildren) do
local childData = WeakAuras.GetData(id)
WeakAuras.ResetCollapsed(id, "config")
OptionsPrivate.ResetCollapsed(id, "config")
childData.config = {} -- config validation in Add() will set all the needed keys to their defaults
WeakAuras.Add(childData)
end
else
data.config = {}
WeakAuras.ResetCollapsed(data.id, "config")
OptionsPrivate.ResetCollapsed(data.id, "config")
WeakAuras.Add(data)
end
WeakAuras.ClearAndUpdateOptions(data.id, true)
+44 -36
View File
@@ -3,14 +3,6 @@ local AddonName, OptionsPrivate = ...
local L = WeakAuras.L;
local operator_types = WeakAuras.operator_types;
local debuff_types = WeakAuras.debuff_types;
local tooltip_count = WeakAuras.tooltip_count;
local unit_types = WeakAuras.unit_types;
local actual_unit_types_with_specific = WeakAuras.actual_unit_types_with_specific;
local group_aura_name_info_types = WeakAuras.group_aura_name_info_types;
local group_aura_stack_info_types = WeakAuras.group_aura_stack_info_types;
local function getAuraMatchesLabel(name)
local ids = WeakAuras.spellCache.GetSpellsMatching(name)
if(ids) then
@@ -58,6 +50,22 @@ end
local noop = function() end
local function CanShowNameInfo(data)
if(data.regionType == "aurabar" or data.regionType == "icon" or data.regionType == "text") then
return true;
else
return false;
end
end
local function CanShowStackInfo(data)
if(data.regionType == "aurabar" or data.regionType == "icon" or data.regionType == "text") then
return true;
else
return false;
end
end
local function GetBuffTriggerOptions(data, triggernum)
local trigger = data.triggers[triggernum].trigger
trigger.names = trigger.names or {}
@@ -82,10 +90,10 @@ local function GetBuffTriggerOptions(data, triggernum)
width = WeakAuras.doubleWidth - 0.8,
order = 8.2,
name = function()
if (not WeakAuras.CanConvertBuffTrigger2) then
if (not OptionsPrivate.Private.CanConvertBuffTrigger2) then
return "";
end
local _, err = WeakAuras.CanConvertBuffTrigger2(trigger);
local _, err = OptionsPrivate.Private.CanConvertBuffTrigger2(trigger);
return err or "";
end,
},
@@ -107,20 +115,20 @@ local function GetBuffTriggerOptions(data, triggernum)
name = L["Convert to New Aura Trigger"],
order = 8.5,
disabled = function()
if (not WeakAuras.CanConvertBuffTrigger2) then
if (not OptionsPrivate.Private.CanConvertBuffTrigger2) then
return true;
end
if (not WeakAuras.CanConvertBuffTrigger2(trigger)) then
if (not OptionsPrivate.Private.CanConvertBuffTrigger2(trigger)) then
return true;
end
return false;
end,
desc = function()
local _, err = WeakAuras.CanConvertBuffTrigger2(trigger);
local _, err = OptionsPrivate.Private.CanConvertBuffTrigger2(trigger);
return err or ""
end,
func = function()
WeakAuras.ConvertBuffTrigger2(trigger);
OptionsPrivate.Private.ConvertBuffTrigger2(trigger);
WeakAuras.Add(data);
WeakAuras.UpdateDisplayButton(data)
WeakAuras.ClearAndUpdateOptions(data.id);
@@ -173,7 +181,7 @@ local function GetBuffTriggerOptions(data, triggernum)
order = 11,
disabled = function() return not trigger.use_name end,
hidden = function() return not (trigger.type == "aura" and trigger.fullscan); end,
values = WeakAuras.string_operator_types,
values = OptionsPrivate.Private.string_operator_types,
set = noop
},
name = {
@@ -200,7 +208,7 @@ local function GetBuffTriggerOptions(data, triggernum)
order = 14,
disabled = function() return not trigger.use_tooltip end,
hidden = function() return not (trigger.type == "aura" and trigger.fullscan and trigger.unit ~= "multi"); end,
values = WeakAuras.string_operator_types,
values = OptionsPrivate.Private.string_operator_types,
set = noop
},
tooltip = {
@@ -263,7 +271,7 @@ local function GetBuffTriggerOptions(data, triggernum)
order = 20,
disabled = function() return not trigger.use_debuffClass end,
hidden = function() return not (trigger.type == "aura" and trigger.fullscan); end,
values = WeakAuras.debuff_class_types,
values = OptionsPrivate.Private.debuff_class_types,
set = noop
},
multiuse_name = {
@@ -579,9 +587,9 @@ local function GetBuffTriggerOptions(data, triggernum)
order = 41,
values = function()
if(trigger.fullscan) then
return actual_unit_types_with_specific;
return OptionsPrivate.Private.actual_unit_types_with_specific;
else
return unit_types;
return OptionsPrivate.Private.unit_types;
end
end,
hidden = function() return not (trigger.type == "aura"); end,
@@ -627,7 +635,7 @@ local function GetBuffTriggerOptions(data, triggernum)
name = L["Operator"],
order = 46,
width = WeakAuras.halfWidth,
values = operator_types,
values = OptionsPrivate.Private.operator_types,
hidden = function() return not (trigger.type == "aura" and trigger.unit == "group"); end,
get = function() return trigger.group_countOperator; end,
set = noop
@@ -636,7 +644,7 @@ local function GetBuffTriggerOptions(data, triggernum)
type = "input",
name = L["Count"],
desc = function()
local groupType = unit_types[trigger.unit or "group"] or "|cFFFF0000error|r";
local groupType = OptionsPrivate.Private.unit_types[trigger.unit or "group"] or "|cFFFF0000error|r";
return L["Group aura count description"]:format(groupType, groupType, groupType, groupType, groupType, groupType, groupType);
end,
order = 47,
@@ -667,15 +675,15 @@ local function GetBuffTriggerOptions(data, triggernum)
name = L["Name Info"],
order = 47.5,
hidden = function() return not (trigger.type == "aura" and trigger.unit == "group" and not trigger.groupclone); end,
disabled = function() return not WeakAuras.CanShowNameInfo(data); end,
disabled = function() return not CanShowNameInfo(data); end,
get = function()
if(WeakAuras.CanShowNameInfo(data)) then
if(CanShowNameInfo(data)) then
return trigger.name_info;
else
return nil;
end
end,
values = group_aura_name_info_types,
values = OptionsPrivate.Private.group_aura_name_info_types,
set = noop
},
stack_info = {
@@ -684,15 +692,15 @@ local function GetBuffTriggerOptions(data, triggernum)
name = L["Stack Info"],
order = 47.6,
hidden = function() return not (trigger.type == "aura" and trigger.unit == "group" and not trigger.groupclone); end,
disabled = function() return not WeakAuras.CanShowStackInfo(data); end,
disabled = function() return not CanShowStackInfo(data); end,
get = function()
if(WeakAuras.CanShowStackInfo(data)) then
if(CanShowStackInfo(data)) then
return trigger.stack_info;
else
return nil;
end
end,
values = group_aura_stack_info_types,
values = OptionsPrivate.Private.group_aura_stack_info_types,
set = noop
},
hideAlone = {
@@ -718,7 +726,7 @@ local function GetBuffTriggerOptions(data, triggernum)
width = WeakAuras.normalWidth,
name = L["Aura Type"],
order = 51,
values = debuff_types,
values = OptionsPrivate.Private.debuff_types,
hidden = function() return not (trigger.type == "aura"); end,
set = noop
},
@@ -732,7 +740,7 @@ local function GetBuffTriggerOptions(data, triggernum)
},
subcountCount = {
type = "select",
values = tooltip_count,
values = OptionsPrivate.Private.tooltip_count,
width = WeakAuras.doubleWidth,
name = L["Use nth value from tooltip:"],
hidden = function() return not (trigger.type == "aura" and trigger.fullscan and trigger.subcount) end,
@@ -752,7 +760,7 @@ local function GetBuffTriggerOptions(data, triggernum)
name = L["Operator"],
order = 57,
width = WeakAuras.halfWidth,
values = operator_types,
values = OptionsPrivate.Private.operator_types,
disabled = function() return not trigger.useRem; end,
hidden = function() return not (trigger.type == "aura" and trigger.unit ~= "multi"); end,
get = function() return trigger.useRem and trigger.remOperator or nil end,
@@ -782,7 +790,7 @@ local function GetBuffTriggerOptions(data, triggernum)
name = L["Operator"],
order = 62,
width = WeakAuras.halfWidth,
values = operator_types,
values = OptionsPrivate.Private.operator_types,
disabled = function() return not trigger.useCount; end,
hidden = function() return not (trigger.type == "aura" and trigger.unit ~= "multi"); end,
get = function() return trigger.useCount and trigger.countOperator or nil end,
@@ -840,7 +848,7 @@ local function GetBuffTriggerOptions(data, triggernum)
type = "select",
width = WeakAuras.normalWidth,
name = "",
values = WeakAuras.bufftrigger_progress_behavior_types,
values = OptionsPrivate.Private.bufftrigger_progress_behavior_types,
order = 71.1,
get = function() return trigger.buffShowOn end,
hidden = function()
@@ -869,15 +877,15 @@ local function GetBuffTriggerOptions(data, triggernum)
name = "",
hidden = function()
-- For those that update without restarting
return not WeakAuras.CanConvertBuffTrigger2
return not OptionsPrivate.Private.CanConvertBuffTrigger2
end,
},
};
WeakAuras.commonOptions.AddCommonTriggerOptions(aura_options, data, triggernum)
WeakAuras.commonOptions.AddTriggerGetterSetter(aura_options, data, triggernum)
WeakAuras.AddTriggerMetaFunctions(aura_options, data, triggernum)
OptionsPrivate.commonOptions.AddCommonTriggerOptions(aura_options, data, triggernum)
OptionsPrivate.commonOptions.AddTriggerGetterSetter(aura_options, data, triggernum)
OptionsPrivate.AddTriggerMetaFunctions(aura_options, data, triggernum)
return {
["trigger." .. triggernum .. ".legacy_aura_options"] = aura_options
+20 -23
View File
@@ -3,9 +3,6 @@ local AddonName, OptionsPrivate = ...
local L = WeakAuras.L
local operator_types = WeakAuras.operator_types
local debuff_types = WeakAuras.debuff_types
local function getAuraMatchesLabel(name)
local ids = WeakAuras.spellCache.GetSpellsMatching(name)
if ids then
@@ -217,7 +214,7 @@ local function GetBuffTriggerOptions(data, triggernum)
name = L["Unit"],
order = 10.1,
values = function()
return WeakAuras.unit_types_bufftrigger_2
return OptionsPrivate.Private.unit_types_bufftrigger_2
end,
hidden = function() return not trigger.type == "aura2" end
},
@@ -261,7 +258,7 @@ local function GetBuffTriggerOptions(data, triggernum)
width = WeakAuras.normalWidth,
name = L["Aura Type"],
order = 11.1,
values = debuff_types,
values = OptionsPrivate.Private.debuff_types,
hidden = function() return not trigger.type == "aura2" end
},
use_debuffClass = {
@@ -281,7 +278,7 @@ local function GetBuffTriggerOptions(data, triggernum)
and not IsSingleMissing(trigger)
and trigger.use_debuffClass)
end,
values = WeakAuras.debuff_class_types,
values = OptionsPrivate.Private.debuff_class_types,
},
debuffClassSpace = {
type = "description",
@@ -371,7 +368,7 @@ local function GetBuffTriggerOptions(data, triggernum)
name = L["Operator"],
order = 55.1,
hidden = function() return not (trigger.type == "aura2" and trigger.unit ~= "multi" and trigger.useNamePattern) end,
values = WeakAuras.string_operator_types
values = OptionsPrivate.Private.string_operator_types
},
namePattern_name = {
type = "input",
@@ -392,7 +389,7 @@ local function GetBuffTriggerOptions(data, triggernum)
name = L["Operator"],
order = 60.1,
width = WeakAuras.halfWidth,
values = operator_types,
values = OptionsPrivate.Private.operator_types,
disabled = function() return not trigger.useStacks end,
hidden = function() return not (trigger.type == "aura2" and trigger.unit ~= "multi" and not IsSingleMissing(trigger) and trigger.useStacks) end,
get = function() return trigger.useStacks and trigger.stacksOperator or nil end
@@ -425,7 +422,7 @@ local function GetBuffTriggerOptions(data, triggernum)
name = L["Operator"],
order = 61.1,
width = WeakAuras.halfWidth,
values = operator_types,
values = OptionsPrivate.Private.operator_types,
disabled = function() return not trigger.useRem end,
hidden = function() return not (trigger.type == "aura2" and trigger.unit ~= "multi" and not IsSingleMissing(trigger) and trigger.useRem) end,
get = function() return trigger.useRem and trigger.remOperator or nil end
@@ -458,7 +455,7 @@ local function GetBuffTriggerOptions(data, triggernum)
name = L["Operator"],
order = 61.5,
width = WeakAuras.halfWidth,
values = operator_types,
values = OptionsPrivate.Private.operator_types,
disabled = function() return not trigger.useTotal end,
hidden = function() return not (trigger.type == "aura2" and trigger.unit ~= "multi" and not IsSingleMissing(trigger) and trigger.useTotal) end,
get = function() return trigger.useTotal and trigger.totalOperator or nil end
@@ -508,7 +505,7 @@ local function GetBuffTriggerOptions(data, triggernum)
order = 62.3,
disabled = function() return not trigger.use_tooltip end,
hidden = function() return not (trigger.type == "aura2" and trigger.unit ~= "multi" and not IsSingleMissing(trigger) and trigger.use_tooltip and trigger.fetchTooltip) end,
values = WeakAuras.string_operator_types
values = OptionsPrivate.Private.string_operator_types
},
tooltip = {
type = "input",
@@ -531,7 +528,7 @@ local function GetBuffTriggerOptions(data, triggernum)
name = L["Tooltip Value #"],
order = 63.2,
hidden = function() return not (trigger.type == "aura2" and trigger.unit ~= "multi" and not IsSingleMissing(trigger) and trigger.use_tooltipValue and trigger.fetchTooltip) end,
values = WeakAuras.tooltip_count
values = OptionsPrivate.Private.tooltip_count
},
use_tooltipValueSpace = {
type = "description",
@@ -546,7 +543,7 @@ local function GetBuffTriggerOptions(data, triggernum)
name = L["Operator"],
order = 63.3,
hidden = function() return not (trigger.type == "aura2" and trigger.unit ~= "multi" and not IsSingleMissing(trigger) and trigger.use_tooltipValue and trigger.fetchTooltip) end,
values = WeakAuras.operator_types
values = OptionsPrivate.Private.operator_types
},
tooltipValue = {
type = "input",
@@ -735,13 +732,13 @@ local function GetBuffTriggerOptions(data, triggernum)
if (trigger.unit == "multi") then
return L["Compare against the number of units affected."]
else
local groupType = WeakAuras.unit_types_bufftrigger_2[trigger.unit or "group"] or "|cFFFF0000Error|r"
local groupType = OptionsPrivate.Private.unit_types_bufftrigger_2[trigger.unit or "group"] or "|cFFFF0000Error|r"
return L["Group aura count description"]:format(groupType, groupType, groupType, groupType, groupType, groupType, groupType)
end
end,
order = 70.2,
width = WeakAuras.halfWidth,
values = operator_types,
values = OptionsPrivate.Private.operator_types,
hidden = function() return not (trigger.type == "aura2" and IsGroupTrigger(trigger) and trigger.useGroup_count) end,
get = function() return trigger.group_countOperator end
},
@@ -752,7 +749,7 @@ local function GetBuffTriggerOptions(data, triggernum)
if (trigger.unit == "multi") then
return L["Compare against the number of units affected."]
else
local groupType = WeakAuras.unit_types_bufftrigger_2[trigger.unit or "group"] or "|cFFFF0000Error|r"
local groupType = OptionsPrivate.Private.unit_types_bufftrigger_2[trigger.unit or "group"] or "|cFFFF0000Error|r"
return L["Group aura count description"]:format(groupType, groupType, groupType, groupType, groupType, groupType, groupType)
end
end,
@@ -774,7 +771,7 @@ local function GetBuffTriggerOptions(data, triggernum)
type = "select",
width = WeakAuras.normalWidth,
name = L["Show On"],
values = WeakAuras.bufftrigger_2_progress_behavior_types,
values = OptionsPrivate.Private.bufftrigger_2_progress_behavior_types,
order = 71.1,
hidden = function() return not (trigger.type == "aura2" and not IsGroupTrigger(trigger)) end,
get = function()
@@ -809,7 +806,7 @@ local function GetBuffTriggerOptions(data, triggernum)
name = L["Operator"],
order = 71.4,
width = WeakAuras.halfWidth,
values = operator_types,
values = OptionsPrivate.Private.operator_types,
hidden = function() return not (trigger.type == "aura2" and HasMatchCount(trigger)) end,
desc = L["Counts the number of matches over all units."]
},
@@ -856,7 +853,7 @@ local function GetBuffTriggerOptions(data, triggernum)
perUnitMode = {
type = "select",
name = L["Show Matches for"],
values = WeakAuras.bufftrigger_2_per_unit_mode,
values = OptionsPrivate.Private.bufftrigger_2_per_unit_mode,
order = 72.4,
width = WeakAuras.normalWidth,
hidden = function()
@@ -891,7 +888,7 @@ local function GetBuffTriggerOptions(data, triggernum)
combineMode = {
type = "select",
name = L["Preferred Match"],
values = WeakAuras.bufftrigger_2_preferred_match_types,
values = OptionsPrivate.Private.bufftrigger_2_preferred_match_types,
order = 72.6,
width = WeakAuras.normalWidth,
hidden = function()
@@ -948,9 +945,9 @@ local function GetBuffTriggerOptions(data, triggernum)
true, true, "ignorespellid", 42, "useIgnoreExactSpellId", "ignoreAuraSpellids",
L["Ignored Spell ID"], L["Enter a Spell ID"])
WeakAuras.commonOptions.AddCommonTriggerOptions(aura_options, data, triggernum)
WeakAuras.commonOptions.AddTriggerGetterSetter(aura_options, data, triggernum)
WeakAuras.AddTriggerMetaFunctions(aura_options, data, triggernum)
OptionsPrivate.commonOptions.AddCommonTriggerOptions(aura_options, data, triggernum)
OptionsPrivate.commonOptions.AddTriggerGetterSetter(aura_options, data, triggernum)
OptionsPrivate.AddTriggerMetaFunctions(aura_options, data, triggernum)
return {
+1 -2
View File
@@ -15,7 +15,6 @@ WeakAuras.spellCache = spellCache
local cache
local metaData
local bestIcon = {}
local dynFrame = WeakAuras.dynFrame
-- Builds a cache of name/icon pairs from existing spell data
-- This is a rather slow operation, so it's only done once, and the result is subsequently saved
@@ -76,7 +75,7 @@ function spellCache.Build()
metaData.needsRebuild = false
end)
dynFrame:AddAction("spellCache", co)
OptionsPrivate.Private.dynFrame:AddAction("spellCache", co)
end
function spellCache.GetIcon(name)
+56 -58
View File
@@ -3,7 +3,6 @@ local AddonName, OptionsPrivate = ...
local L = WeakAuras.L
local regionOptions = WeakAuras.regionOptions
local point_types = WeakAuras.point_types;
local parsePrefix = function(input, data, create)
local subRegionIndex, property = string.match(input, "^sub%.(%d+)%..-%.(.+)")
@@ -67,15 +66,15 @@ local function addCollapsibleHeader(options, key, input, order, isGroupTab)
width = titleWidth,
func = function(info, button, secondCall)
if not nooptions and not secondCall then
local isCollapsed = WeakAuras.IsCollapsed("collapse", "region", key, false)
WeakAuras.SetCollapsed("collapse", "region", key, not isCollapsed)
local isCollapsed = OptionsPrivate.IsCollapsed("collapse", "region", key, false)
OptionsPrivate.SetCollapsed("collapse", "region", key, not isCollapsed)
end
end,
image = function()
if nooptions then
return "Interface\\AddOns\\WeakAuras\\Media\\Textures\\bullet1", 18, 18
else
local isCollapsed = WeakAuras.IsCollapsed("collapse", "region", key, false)
local isCollapsed = OptionsPrivate.IsCollapsed("collapse", "region", key, false)
return isCollapsed and "Interface\\AddOns\\WeakAuras\\Media\\Textures\\expand" or "Interface\\AddOns\\WeakAuras\\Media\\Textures\\collapse", 18, 18
end
end,
@@ -175,18 +174,17 @@ local function addCollapsibleHeader(options, key, input, order, isGroupTab)
if hiddenFunc then
return function()
return hiddenFunc() or WeakAuras.IsCollapsed("collapse", "region", key, false)
return hiddenFunc() or OptionsPrivate.IsCollapsed("collapse", "region", key, false)
end
else
return function()
return WeakAuras.IsCollapsed("collapse", "region", key, false)
return OptionsPrivate.IsCollapsed("collapse", "region", key, false)
end
end
end
local function copyOptionTable(input, orderAdjustment, collapsedFunc)
local resultOption = {};
WeakAuras.DeepCopy(input, resultOption);
local resultOption = CopyTable(input);
resultOption.order = orderAdjustment + resultOption.order;
if collapsedFunc then
local oldHidden = resultOption.hidden;
@@ -315,7 +313,7 @@ local function CreateHiddenAll(subOption)
for index, childId in ipairs(data.controlledChildren) do
local childData = WeakAuras.GetData(childId);
if(childData) then
local childOptions = WeakAuras.EnsureOptions(childData, subOption)
local childOptions = OptionsPrivate.EnsureOptions(childData, subOption)
local childOption = childOptions;
local childOptionTable = {[0] = childOption};
for i=1,#info do
@@ -352,7 +350,7 @@ local function CreateDisabledAll(subOption)
for index, childId in ipairs(data.controlledChildren) do
local childData = WeakAuras.GetData(childId);
if(childData) then
local childOptions = WeakAuras.EnsureOptions(childData, subOption);
local childOptions = OptionsPrivate.EnsureOptions(childData, subOption);
local childOption = childOptions;
local childOptionTable = {[0] = childOption};
for i=1,#info do
@@ -422,7 +420,7 @@ local function replaceNameDescFuncs(intable, data, subOption)
for index, childId in ipairs(data.controlledChildren) do
local childData = WeakAuras.GetData(childId);
if(childData) then
local values = getValueFor(WeakAuras.EnsureOptions(childData, subOption), info, "values");
local values = getValueFor(OptionsPrivate.EnsureOptions(childData, subOption), info, "values");
if (values) then
if (type(values) == "function") then
values = values(info);
@@ -458,7 +456,7 @@ local function replaceNameDescFuncs(intable, data, subOption)
for index, childId in ipairs(data.controlledChildren) do
if isToggle == nil then
local childData = WeakAuras.GetData(childId)
local childOption = getChildOption(WeakAuras.EnsureOptions(childData, subOption), info)
local childOption = getChildOption(OptionsPrivate.EnsureOptions(childData, subOption), info)
isToggle = childOption and childOption.type == "toggle"
end
@@ -466,7 +464,7 @@ local function replaceNameDescFuncs(intable, data, subOption)
local regionType = regionPrefix(info[#info]);
if(childData and (not regionType or childData.regionType == regionType or regionType == "sub")) then
local childOptions = WeakAuras.EnsureOptions(childData, subOption)
local childOptions = OptionsPrivate.EnsureOptions(childData, subOption)
local get = getValueFor(childOptions, info, "get");
if (combinedKeys) then
for key, _ in pairs(combinedKeys) do
@@ -513,7 +511,7 @@ local function replaceNameDescFuncs(intable, data, subOption)
for index, childId in ipairs(data.controlledChildren) do
local childData = WeakAuras.GetData(childId);
if(childData) then
local childOption = getChildOption(WeakAuras.EnsureOptions(childData, subOption), info);
local childOption = getChildOption(OptionsPrivate.EnsureOptions(childData, subOption), info);
if (childOption) then
local name;
if(type(childOption.name) == "function") then
@@ -552,7 +550,7 @@ local function replaceNameDescFuncs(intable, data, subOption)
for index, childId in ipairs(data.controlledChildren) do
local childData = WeakAuras.GetData(childId);
if(childData) then
local childOption = getChildOption(WeakAuras.EnsureOptions(childData, subOption), info);
local childOption = getChildOption(OptionsPrivate.EnsureOptions(childData, subOption), info);
if (childOption) then
local desc;
if(type(childOption.desc) == "function") then
@@ -600,7 +598,7 @@ local function replaceNameDescFuncs(intable, data, subOption)
for index, childId in ipairs(data.controlledChildren) do
local childData = WeakAuras.GetData(childId);
if(childData) then
local childOptions = WeakAuras.EnsureOptions(childData, subOption)
local childOptions = OptionsPrivate.EnsureOptions(childData, subOption)
local childOption = childOptions;
local childOptionTable = {[0] = childOption};
for i=1,#info do
@@ -683,7 +681,7 @@ local function replaceImageFuncs(intable, data, subOption)
for index, childId in ipairs(data.controlledChildren) do
local childData = WeakAuras.GetData(childId);
if(childData) then
local childOption = WeakAuras.EnsureOptions(childData, subOption)
local childOption = OptionsPrivate.EnsureOptions(childData, subOption)
if not(childOption) then
return "error"
end
@@ -725,7 +723,7 @@ local function replaceValuesFuncs(intable, data, subOption)
for index, childId in ipairs(data.controlledChildren) do
local childData = WeakAuras.GetData(childId);
if(childData) then
local childOption = WeakAuras.EnsureOptions(childData, subOption)
local childOption = OptionsPrivate.EnsureOptions(childData, subOption)
if not(childOption) then
return "error"
end
@@ -828,14 +826,14 @@ local function CreateGetAll(subOption)
for index, childId in ipairs(data.controlledChildren) do
if isToggle == nil then
local childData = WeakAuras.GetData(childId)
local childOptions = getChildOption(WeakAuras.EnsureOptions(childData, subOption), info)
local childOptions = getChildOption(OptionsPrivate.EnsureOptions(childData, subOption), info)
isToggle = childOptions and childOptions.type == "toggle"
end
local childData = WeakAuras.GetData(childId);
if(childData) then
local childOptions = WeakAuras.EnsureOptions(childData, subOption)
local childOptions = OptionsPrivate.EnsureOptions(childData, subOption)
local childOption = childOptions;
local childOptionTable = {[0] = childOption};
for i=1,#info do
@@ -875,13 +873,13 @@ end
local function CreateSetAll(subOption, getAll)
return function(data, info, ...)
WeakAuras.pauseOptionsProcessing(true);
WeakAuras.PauseAllDynamicGroups()
OptionsPrivate.Private.pauseOptionsProcessing(true);
OptionsPrivate.Private.PauseAllDynamicGroups()
local before = getAll(data, info, ...)
for index, childId in ipairs(data.controlledChildren) do
local childData = WeakAuras.GetData(childId);
if(childData) then
local childOptions = WeakAuras.EnsureOptions(childData, subOption)
local childOptions = OptionsPrivate.EnsureOptions(childData, subOption)
local childOption = childOptions;
local childOptionTable = {[0] = childOption};
for i=1,#info do
@@ -904,11 +902,11 @@ local function CreateSetAll(subOption, getAll)
end
end
WeakAuras.ResumeAllDynamicGroups()
WeakAuras.pauseOptionsProcessing(false);
WeakAuras.ScanForLoads();
OptionsPrivate.Private.ResumeAllDynamicGroups()
OptionsPrivate.Private.pauseOptionsProcessing(false);
OptionsPrivate.Private.ScanForLoads();
WeakAuras.SortDisplayButtons();
WeakAuras.UpdateOptions()
OptionsPrivate.UpdateOptions()
end
end
@@ -918,7 +916,7 @@ local function CreateExecuteAll(subOption)
for index, childId in ipairs(data.controlledChildren) do
local childData = WeakAuras.GetData(childId);
if(childData) then
local childOptions = WeakAuras.EnsureOptions(childData, subOption)
local childOptions = OptionsPrivate.EnsureOptions(childData, subOption)
local childOption = childOptions;
local childOptionTable = {[0] = childOption};
for i=1,#info do
@@ -985,7 +983,7 @@ local function PositionOptions(id, data, _, hideWidthHeight, disableSelfPoint)
data.xOffset = v;
WeakAuras.Add(data);
WeakAuras.UpdateThumbnail(data);
WeakAuras.ResetMoverSizer();
OptionsPrivate.ResetMoverSizer();
if(data.parent) then
local parentData = WeakAuras.GetData(data.parent);
if(parentData) then
@@ -1007,7 +1005,7 @@ local function PositionOptions(id, data, _, hideWidthHeight, disableSelfPoint)
data.yOffset = v;
WeakAuras.Add(data);
WeakAuras.UpdateThumbnail(data);
WeakAuras.ResetMoverSizer();
OptionsPrivate.ResetMoverSizer();
if(data.parent) then
local parentData = WeakAuras.GetData(data.parent);
if(parentData) then
@@ -1022,7 +1020,7 @@ local function PositionOptions(id, data, _, hideWidthHeight, disableSelfPoint)
name = L["Anchor"],
order = 70,
hidden = IsParentDynamicGroup,
values = point_types,
values = OptionsPrivate.Private.point_types,
disabled = disableSelfPoint,
},
anchorFrameType = {
@@ -1031,7 +1029,7 @@ local function PositionOptions(id, data, _, hideWidthHeight, disableSelfPoint)
name = L["Anchored To"],
order = 72,
hidden = IsParentDynamicGroup,
values = (data.regionType == "group" or data.regionType == "dynamicgroup") and WeakAuras.anchor_frame_types_group or WeakAuras.anchor_frame_types,
values = (data.regionType == "group" or data.regionType == "dynamicgroup") and OptionsPrivate.Private.anchor_frame_types_group or OptionsPrivate.Private.anchor_frame_types,
},
-- Input field to select frame to anchor on
anchorFrameFrame = {
@@ -1059,7 +1057,7 @@ local function PositionOptions(id, data, _, hideWidthHeight, disableSelfPoint)
return not (data.anchorFrameType == "SELECTFRAME")
end,
func = function()
WeakAuras.StartFrameChooser(data, {"anchorFrameFrame"});
OptionsPrivate.StartFrameChooser(data, {"anchorFrameFrame"});
end
},
anchorPoint = {
@@ -1085,7 +1083,7 @@ local function PositionOptions(id, data, _, hideWidthHeight, disableSelfPoint)
return data.anchorFrameType == "MOUSE";
end
end,
values = point_types
values = OptionsPrivate.Private.point_types
},
anchorPointGroup = {
type = "select",
@@ -1123,7 +1121,7 @@ local function PositionOptions(id, data, _, hideWidthHeight, disableSelfPoint)
width = WeakAuras.normalWidth,
name = L["Frame Strata"],
order = 78,
values = WeakAuras.frame_strata_types
values = OptionsPrivate.Private.frame_strata_types
},
anchorFrameSpace = {
type = "execute",
@@ -1136,7 +1134,7 @@ local function PositionOptions(id, data, _, hideWidthHeight, disableSelfPoint)
end
},
};
WeakAuras.commonOptions.AddCodeOption(positionOptions, data, L["Custom Anchor"], "custom_anchor", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#custom-anchor-function",
OptionsPrivate.commonOptions.AddCodeOption(positionOptions, data, L["Custom Anchor"], "custom_anchor", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#custom-anchor-function",
72.1, function() return not(data.anchorFrameType == "CUSTOM" and not IsParentDynamicGroup()) end, {"customAnchor"}, nil, nil, nil, nil, nil, true)
return positionOptions;
end
@@ -1264,7 +1262,7 @@ local function AddCodeOption(args, data, name, prefix, url, order, hiddenFunc, p
tinsert(extraFunctions, 1, {
buttonLabel = L["Expand"],
func = function(info)
WeakAuras.OpenTextEditor(WeakAuras.GetPickedDisplay(), path, encloseInFunction, multipath, reloadOptions, setOnParent, url)
OptionsPrivate.OpenTextEditor(OptionsPrivate.GetPickedDisplay(), path, encloseInFunction, multipath, reloadOptions, setOnParent, url)
end
});
@@ -1293,7 +1291,7 @@ local function AddCodeOption(args, data, name, prefix, url, order, hiddenFunc, p
extraSetFunction();
end
if (reloadOptions) then
WeakAuras.ClearOptions(data.id)
OptionsPrivate.ClearOptions(data.id)
end
end,
get = function(info)
@@ -1355,7 +1353,7 @@ local function AddCommonTriggerOptions(options, data, triggernum)
local trigger = data.triggers[triggernum].trigger
local trigger_types = {};
for type, triggerSystem in pairs(WeakAuras.triggerTypes) do
for type, triggerSystem in pairs(OptionsPrivate.Private.triggerTypes) do
trigger_types[type] = triggerSystem.GetName(type);
end
@@ -1379,7 +1377,7 @@ local function AddCommonTriggerOptions(options, data, triggernum)
end,
set = function(info, v)
trigger.type = v;
local prototype = trigger.event and WeakAuras.event_prototypes[trigger.event];
local prototype = trigger.event and OptionsPrivate.Private.event_prototypes[trigger.event];
if v == "status" and (not prototype or prototype.type == "event") then
trigger.event = "Cooldown Progress (Spell)"
elseif v == "event" and (not prototype or prototype.type == "status") then
@@ -1447,23 +1445,23 @@ local function AddTriggerGetterSetter(options, data, triggernum)
end
WeakAuras.commonOptions = {}
WeakAuras.commonOptions.parsePrefix = parsePrefix
WeakAuras.commonOptions.flattenRegionOptions = flattenRegionOptions
WeakAuras.commonOptions.fixMetaOrders = fixMetaOrders
WeakAuras.commonOptions.removeFuncs = removeFuncs
WeakAuras.commonOptions.CreateHiddenAll = CreateHiddenAll
WeakAuras.commonOptions.CreateDisabledAll = CreateDisabledAll
WeakAuras.commonOptions.replaceNameDescFuncs = replaceNameDescFuncs
WeakAuras.commonOptions.replaceImageFuncs = replaceImageFuncs
WeakAuras.commonOptions.replaceValuesFuncs = replaceValuesFuncs
WeakAuras.commonOptions.CreateGetAll = CreateGetAll
WeakAuras.commonOptions.CreateSetAll = CreateSetAll
WeakAuras.commonOptions.CreateExecuteAll = CreateExecuteAll
OptionsPrivate.commonOptions = {}
OptionsPrivate.commonOptions.parsePrefix = parsePrefix
OptionsPrivate.commonOptions.flattenRegionOptions = flattenRegionOptions
OptionsPrivate.commonOptions.fixMetaOrders = fixMetaOrders
OptionsPrivate.commonOptions.removeFuncs = removeFuncs
OptionsPrivate.commonOptions.CreateHiddenAll = CreateHiddenAll
OptionsPrivate.commonOptions.CreateDisabledAll = CreateDisabledAll
OptionsPrivate.commonOptions.replaceNameDescFuncs = replaceNameDescFuncs
OptionsPrivate.commonOptions.replaceImageFuncs = replaceImageFuncs
OptionsPrivate.commonOptions.replaceValuesFuncs = replaceValuesFuncs
OptionsPrivate.commonOptions.CreateGetAll = CreateGetAll
OptionsPrivate.commonOptions.CreateSetAll = CreateSetAll
OptionsPrivate.commonOptions.CreateExecuteAll = CreateExecuteAll
WeakAuras.commonOptions.PositionOptions = PositionOptions
WeakAuras.commonOptions.BorderOptions = BorderOptions
WeakAuras.commonOptions.AddCodeOption = AddCodeOption
OptionsPrivate.commonOptions.PositionOptions = PositionOptions
OptionsPrivate.commonOptions.BorderOptions = BorderOptions
OptionsPrivate.commonOptions.AddCodeOption = AddCodeOption
WeakAuras.commonOptions.AddCommonTriggerOptions = AddCommonTriggerOptions
WeakAuras.commonOptions.AddTriggerGetterSetter = AddTriggerGetterSetter
OptionsPrivate.commonOptions.AddCommonTriggerOptions = AddCommonTriggerOptions
OptionsPrivate.commonOptions.AddTriggerGetterSetter = AddTriggerGetterSetter
+61 -69
View File
@@ -249,8 +249,7 @@ local function addControlsForChange(args, order, data, conditionVariable, condit
local change = {};
change.property = conditions[i].changes[j].property;
if (type(conditions[i].changes[j].value) == "table") then
change.value = {};
WeakAuras.DeepCopy(conditions[i].changes[j].value, change.value)
change.value = CopyTable(conditions[i].changes[j].value)
else
change.value = conditions[i].changes[j].value;
end
@@ -501,9 +500,9 @@ local function addControlsForChange(args, order, data, conditionVariable, condit
args["condition" .. i .. "value" .. j .. "sound_type"] = {
type = "select",
width = WeakAuras.normalWidth,
values = WeakAuras.sound_condition_types,
values = OptionsPrivate.Private.sound_condition_types,
name = blueIfNoValue2(data, conditions[i].changes[j], "value", "sound_type", L["Differences"]),
desc = descIfNoValue2(data, conditions[i].changes[j], "value", "sound_type", propertyType, WeakAuras.sound_condition_types),
desc = descIfNoValue2(data, conditions[i].changes[j], "value", "sound_type", propertyType, OptionsPrivate.Private.sound_condition_types),
order = order,
get = function()
return type(conditions[i].changes[j].value) == "table" and conditions[i].changes[j].value.sound_type;
@@ -530,9 +529,9 @@ local function addControlsForChange(args, order, data, conditionVariable, condit
args["condition" .. i .. "value" .. j .. "sound"] = {
type = "select",
width = WeakAuras.normalWidth,
values = WeakAuras.sound_types,
values = OptionsPrivate.Private.sound_types,
name = blueIfNoValue2(data, conditions[i].changes[j], "value", "sound", L["Differences"]),
desc = descIfNoValue2(data, conditions[i].changes[j], "value", "sound", propertyType, WeakAuras.sound_types),
desc = descIfNoValue2(data, conditions[i].changes[j], "value", "sound", propertyType, OptionsPrivate.Private.sound_types),
order = order,
get = function()
return type(conditions[i].changes[j].value) == "table" and conditions[i].changes[j].value.sound;
@@ -546,9 +545,9 @@ local function addControlsForChange(args, order, data, conditionVariable, condit
args["condition" .. i .. "value" .. j .. "sound_channel"] = {
type = "select",
width = WeakAuras.normalWidth,
values = WeakAuras.sound_channel_types,
values = OptionsPrivate.Private.sound_channel_types,
name = blueIfNoValue2(data, conditions[i].changes[j], "value", "sound_channel", L["Sound Channel"], L["Sound Channel"]),
desc = descIfNoValue2(data, conditions[i].changes[j], "value", "sound_channel", propertyType, WeakAuras.sound_channel_types),
desc = descIfNoValue2(data, conditions[i].changes[j], "value", "sound_channel", propertyType, OptionsPrivate.Private.sound_channel_types),
order = order,
get = function()
return type(conditions[i].changes[j].value) == "table" and conditions[i].changes[j].value.sound_channel;
@@ -633,9 +632,9 @@ local function addControlsForChange(args, order, data, conditionVariable, condit
args["condition" .. i .. "value" .. j .. "message type"] = {
type = "select",
width = WeakAuras.normalWidth,
values = WeakAuras.send_chat_message_types,
values = OptionsPrivate.Private.send_chat_message_types,
name = blueIfNoValue2(data, conditions[i].changes[j], "value", "message_type", L["Differences"]),
desc = descIfNoValue2(data, conditions[i].changes[j], "value", "message_type", propertyType, WeakAuras.send_chat_message_types),
desc = descIfNoValue2(data, conditions[i].changes[j], "value", "message_type", propertyType, OptionsPrivate.Private.send_chat_message_types),
order = order,
get = function()
return type(conditions[i].changes[j].value) == "table" and conditions[i].changes[j].value.message_type;
@@ -677,8 +676,8 @@ local function addControlsForChange(args, order, data, conditionVariable, condit
order = order + 1;
local descMessage = descIfNoValue2(data, conditions[i].changes[j], "value", "message", propertyType);
if (not descMessage and data ~= WeakAuras.tempGroup) then
descMessage = L["Dynamic text tooltip"] .. WeakAuras.GetAdditionalProperties(data)
if (not descMessage and data ~= OptionsPrivate.tempGroup) then
descMessage = L["Dynamic text tooltip"] .. OptionsPrivate.Private.GetAdditionalProperties(data)
end
local message_getter = function()
@@ -728,21 +727,21 @@ local function addControlsForChange(args, order, data, conditionVariable, condit
local hasTextFormatOption
local hidden = function()
return WeakAuras.IsCollapsed("format_option", "conditions", i .. "#" .. j , true)
return OptionsPrivate.IsCollapsed("format_option", "conditions", i .. "#" .. j , true)
end
local setHidden = function(hidden)
WeakAuras.SetCollapsed("format_option", "conditions", i .. "#" .. j, hidden)
OptionsPrivate.SetCollapsed("format_option", "conditions", i .. "#" .. j, hidden)
end
if data.controlledChildren then
for id, reference in pairs(conditions[i].changes[j].references) do
local input = reference.value and reference.value.message
hasTextFormatOption = WeakAuras.AddTextFormatOption(input, true, formatGet, addOption, hidden, setHidden)
hasTextFormatOption = OptionsPrivate.AddTextFormatOption(input, true, formatGet, addOption, hidden, setHidden)
end
else
local input = type(conditions[i].changes[j].value) == "table" and conditions[i].changes[j].value["message"]
hasTextFormatOption = WeakAuras.AddTextFormatOption(input, true, formatGet, addOption, hidden, setHidden)
hasTextFormatOption = OptionsPrivate.AddTextFormatOption(input, true, formatGet, addOption, hidden, setHidden)
end
if hasTextFormatOption then
@@ -757,7 +756,7 @@ local function addControlsForChange(args, order, data, conditionVariable, condit
local function customHidden()
local message = type(conditions[i].changes[j].value) == "table" and conditions[i].changes[j].value.message;
if (not message) then return true; end
return not WeakAuras.ContainsCustomPlaceHolder(message);
return not OptionsPrivate.Private.ContainsCustomPlaceHolder(message);
end
args["condition" .. i .. "value" .. j .. "custom"] = {
@@ -786,9 +785,9 @@ local function addControlsForChange(args, order, data, conditionVariable, condit
local changeIndex = reference.changeIndex;
multipath[id] = {"conditions", conditionIndex, "changes", changeIndex, "value", "custom"};
end
WeakAuras.OpenTextEditor(data, multipath, nil, true, nil, nil, "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#custom-check");
OptionsPrivate.OpenTextEditor(data, multipath, nil, true, nil, nil, "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#custom-check");
else
WeakAuras.OpenTextEditor(data, {"conditions", i, "changes", j, "value", "custom"}, nil, nil, nil, nil, "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#custom-check");
OptionsPrivate.OpenTextEditor(data, {"conditions", i, "changes", j, "value", "custom"}, nil, nil, nil, nil, "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#custom-check");
end
end
}
@@ -815,7 +814,7 @@ local function addControlsForChange(args, order, data, conditionVariable, condit
if (not message) then
return true;
end
if (not WeakAuras.ContainsPlaceHolders(message, "c")) then
if (not OptionsPrivate.Private.ContainsPlaceHolders(message, "c")) then
return true;
end
@@ -865,10 +864,10 @@ local function addControlsForChange(args, order, data, conditionVariable, condit
childData.conditions[conditionIndex].changes[changeIndex].value = childData.conditions[conditionIndex].changes[changeIndex].value or {};
multipath[id] = {"conditions", conditionIndex, "changes", changeIndex, "value", "custom"};
end
WeakAuras.OpenTextEditor(data, multipath, true, true, nil, nil, "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#run-custom-code");
OptionsPrivate.OpenTextEditor(data, multipath, true, true, nil, nil, "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#run-custom-code");
else
data.conditions[i].changes[j].value = data.conditions[i].changes[j].value or {};
WeakAuras.OpenTextEditor(data, {"conditions", i, "changes", j, "value", "custom"}, true, nil, nil, nil, "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#run-custom-code");
OptionsPrivate.OpenTextEditor(data, {"conditions", i, "changes", j, "value", "custom"}, true, nil, nil, nil, "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#run-custom-code");
end
end
}
@@ -932,15 +931,15 @@ local function addControlsForChange(args, order, data, conditionVariable, condit
return false
end
local glowTypesExcepButtonOverlay = CopyTable(WeakAuras.glow_types)
local glowTypesExcepButtonOverlay = CopyTable(OptionsPrivate.Private.glow_types)
glowTypesExcepButtonOverlay["buttonOverlay"] = nil
args["condition" .. i .. "value" .. j .. "glow_action"] = {
type = "select",
values = WeakAuras.glow_action_types,
values = OptionsPrivate.Private.glow_action_types,
width = WeakAuras.normalWidth,
name = blueIfNoValue2(data, conditions[i].changes[j], "value", "glow_action", L["Glow Action"], L["Glow Action"]),
desc = descIfNoValue2(data, conditions[i].changes[j], "value", "glow_action", propertyType, WeakAuras.glow_action_types),
desc = descIfNoValue2(data, conditions[i].changes[j], "value", "glow_action", propertyType, OptionsPrivate.Private.glow_action_types),
order = order,
get = function()
return type(conditions[i].changes[j].value) == "table" and conditions[i].changes[j].value.glow_action;
@@ -950,7 +949,7 @@ local function addControlsForChange(args, order, data, conditionVariable, condit
order = order + 1
args["condition" .. i .. "value" .. j .. "glow_frame_type"] = {
type = "select",
values = WeakAuras.glow_frame_types,
values = OptionsPrivate.Private.glow_frame_types,
width = WeakAuras.normalWidth,
name = blueIfNoValue2(data, conditions[i].changes[j], "value", "glow_frame_type", L["Glow Frame Type"], L["Glow Frame Type"]),
desc = descIfNoValue2(data, conditions[i].changes[j], "value", "glow_frame_type", propertyType, {
@@ -961,23 +960,23 @@ local function addControlsForChange(args, order, data, conditionVariable, condit
get = function()
return type(conditions[i].changes[j].value) == "table" and conditions[i].changes[j].value.glow_frame_type;
end,
hidden = function() return not anyGlowExternal("glow_action", WeakAuras.glow_action_types) end,
hidden = function() return not anyGlowExternal("glow_action", OptionsPrivate.Private.glow_action_types) end,
set = setValueComplex("glow_frame_type")
}
order = order + 1
args["condition" .. i .. "value" .. j .. "glow_type"] = {
type = "select",
values = WeakAuras.glow_types,
values = OptionsPrivate.Private.glow_types,
width = WeakAuras.normalWidth,
name = blueIfNoValue2(data, conditions[i].changes[j], "value", "glow_type", L["Glow Type"], L["Glow Type"]),
desc = descIfNoValue2(data, conditions[i].changes[j], "value", "glow_type", propertyType, WeakAuras.glow_types),
desc = descIfNoValue2(data, conditions[i].changes[j], "value", "glow_type", propertyType, OptionsPrivate.Private.glow_types),
order = order,
get = function()
return type(conditions[i].changes[j].value) == "table" and conditions[i].changes[j].value.glow_type;
end,
set = setValueComplex("glow_type"),
hidden = function()
return not (anyGlowExternal("glow_action", "show") and anyGlowExternal("glow_frame_type", WeakAuras.glow_frame_types))
return not (anyGlowExternal("glow_action", "show") and anyGlowExternal("glow_frame_type", OptionsPrivate.Private.glow_frame_types))
end
}
order = order + 1
@@ -1003,7 +1002,7 @@ local function addControlsForChange(args, order, data, conditionVariable, condit
desc = descIfNoValue2(data, conditions[i].changes[j], "value", "glow_frame", propertyType),
order = order,
func = function()
WeakAuras.StartFrameChooser(data, {"conditions", i, "changes", j, "value", "glow_frame"});
OptionsPrivate.StartFrameChooser(data, {"conditions", i, "changes", j, "value", "glow_frame"});
end,
hidden = function()
return not anyGlowExternal("glow_frame_type", "FRAMESELECTOR")
@@ -1021,7 +1020,7 @@ local function addControlsForChange(args, order, data, conditionVariable, condit
end,
set = setValueComplex("use_glow_color"),
hidden = function()
return not (anyGlowExternal("glow_action", "show") and anyGlowExternal("glow_type", WeakAuras.glow_types))
return not (anyGlowExternal("glow_action", "show") and anyGlowExternal("glow_type", OptionsPrivate.Private.glow_types))
end
}
order = order + 1
@@ -1040,8 +1039,8 @@ local function addControlsForChange(args, order, data, conditionVariable, condit
set = setValueColorComplex("glow_color"),
hidden = function()
return not (anyGlowExternal("glow_action", "show")
and anyGlowExternal("glow_frame_type", WeakAuras.glow_frame_types)
and anyGlowExternal("glow_type", WeakAuras.glow_types))
and anyGlowExternal("glow_frame_type", OptionsPrivate.Private.glow_frame_types)
and anyGlowExternal("glow_type", OptionsPrivate.Private.glow_types))
end,
disabled = function() return not anyGlowExternal("use_glow_color", true) end
}
@@ -1368,8 +1367,7 @@ local function addControlsForIfLine(args, order, data, conditionVariable, condit
local copy = {};
copy.property = change.property;
if (type(change.value) == "table") then
copy.value = {};
WeakAuras.DeepCopy(change.value, copy.value);
copy.value = CopyTable(change.value);
else
copy.value = change.value;
end
@@ -1510,11 +1508,11 @@ local function addControlsForIfLine(args, order, data, conditionVariable, condit
end
if (currentConditionTemplate.type == "number" or currentConditionTemplate.type == "timer") then
local opTypes = WeakAuras.operator_types
local opTypes = OptionsPrivate.Private.operator_types
if currentConditionTemplate.operator_types == "without_equal" then
opTypes = WeakAuras.operator_types_without_equal
opTypes = OptionsPrivate.Private.operator_types_without_equal
elseif currentConditionTemplate.operator_types == "only_equal" then
opTypes = WeakAuras.equality_operator_types
opTypes = OptionsPrivate.Private.equality_operator_types
end
args["condition" .. i .. tostring(path) .. "_op"] = {
@@ -1552,7 +1550,7 @@ local function addControlsForIfLine(args, order, data, conditionVariable, condit
type = "select",
width = WeakAuras.normalWidth,
order = order,
values = WeakAuras.equality_operator_types,
values = OptionsPrivate.Private.equality_operator_types,
get = function()
return check.op;
end,
@@ -1615,7 +1613,7 @@ local function addControlsForIfLine(args, order, data, conditionVariable, condit
name = blueIfNoValue(data, conditions[i].check, "value", L["Differences"]),
desc = descIfNoValue(data, conditions[i].check, "value", currentConditionTemplate.type),
order = order,
values = WeakAuras.bool_types,
values = OptionsPrivate.Private.bool_types,
get = function()
return check and check.value;
end,
@@ -1630,7 +1628,7 @@ local function addControlsForIfLine(args, order, data, conditionVariable, condit
type = "select",
width = WeakAuras.normalWidth,
order = order,
values = WeakAuras.string_operator_types,
values = OptionsPrivate.Private.string_operator_types,
get = function()
return check and check.op;
end,
@@ -1699,7 +1697,7 @@ local function addControlsForIfLine(args, order, data, conditionVariable, condit
end
tinsert(multipath[id], "value")
end
WeakAuras.OpenTextEditor(data, multipath, nil, true, nil, nil, "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#custom-check");
OptionsPrivate.OpenTextEditor(data, multipath, nil, true, nil, nil, "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#custom-check");
else
for i, v in ipairs(path) do
print(i, v)
@@ -1712,7 +1710,7 @@ local function addControlsForIfLine(args, order, data, conditionVariable, condit
end
tinsert(fullPath, "value")
WeakAuras.OpenTextEditor(data, fullPath, nil, nil, nil, nil, "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#custom-check");
OptionsPrivate.OpenTextEditor(data, fullPath, nil, nil, nil, nil, "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#custom-check");
end
end
}
@@ -1772,13 +1770,13 @@ local function addControlsForCondition(args, order, data, conditionVariable, con
if data.controlledChildren then
for id, reference in pairs(conditions[i].check.references) do
local index = reference.conditionIndex;
if WeakAuras.IsCollapsed(id, "condition", index, false) then
if OptionsPrivate.IsCollapsed(id, "condition", index, false) then
collapsed = true;
break;
end
end
else
collapsed = WeakAuras.IsCollapsed(data.id, "condition", i, false);
collapsed = OptionsPrivate.IsCollapsed(data.id, "condition", i, false);
end
args["condition" .. i .. "header"] = {
@@ -1790,10 +1788,10 @@ local function addControlsForCondition(args, order, data, conditionVariable, con
if data.controlledChildren then
for id, reference in pairs(conditions[i].check.references) do
local index = reference.conditionIndex
WeakAuras.SetCollapsed(id, "condition", index, not collapsed);
OptionsPrivate.SetCollapsed(id, "condition", index, not collapsed);
end
else
WeakAuras.SetCollapsed(data.id, "condition", i, not collapsed);
OptionsPrivate.SetCollapsed(data.id, "condition", i, not collapsed);
end
WeakAuras.ClearAndUpdateOptions(data.id, true)
end,
@@ -2041,8 +2039,7 @@ local function mergeConditionTemplates(allConditionTemplates, auraConditionsTemp
allConditionTemplates[triggernum] = allConditionTemplates[triggernum] or {};
for conditionName in pairs(auraTemplatesForTrigger) do
if not allConditionTemplates[triggernum][conditionName] then
allConditionTemplates[triggernum][conditionName] = {};
WeakAuras.DeepCopy(auraTemplatesForTrigger[conditionName], allConditionTemplates[triggernum][conditionName]);
allConditionTemplates[triggernum][conditionName] = CopyTable(auraTemplatesForTrigger[conditionName]);
else
if (allConditionTemplates[triggernum][conditionName].type ~= auraTemplatesForTrigger[conditionName].type) then
-- Two different trigger types have a condition of the same name, with incompatible types
@@ -2126,11 +2123,11 @@ local function createConditionTemplates(data)
local data = WeakAuras.GetData(id);
numTriggers = max(numTriggers, #data.triggers);
local auraConditionsTemplate = WeakAuras.GetTriggerConditions(data);
local auraConditionsTemplate = OptionsPrivate.Private.GetTriggerConditions(data);
mergeConditionTemplates(allConditionTemplates, auraConditionsTemplate, numTriggers)
end
else
allConditionTemplates = WeakAuras.GetTriggerConditions(data);
allConditionTemplates = OptionsPrivate.Private.GetTriggerConditions(data);
numTriggers = #data.triggers;
end
@@ -2144,13 +2141,12 @@ local function createConditionTemplates(data)
type = "combination"
}
}
allConditionTemplates[-1] = WeakAuras.GetGlobalConditions();
allConditionTemplates[-1] = OptionsPrivate.Private.GetGlobalConditions();
local conditionTemplates = createConditionTemplatesValueList(allConditionTemplates, numTriggers);
if (data.controlledChildren) then
conditionTemplates.displayWithCopy = {};
WeakAuras.DeepCopy(conditionTemplates.display, conditionTemplates.displayWithCopy);
conditionTemplates.displayWithCopy = CopyTable(conditionTemplates.display);
conditionTemplates.displayWithCopy[9998] = "" .. L["Copy to all auras"] .. "";
conditionTemplates.indexToTrigger[9998] = "COPY";
@@ -2168,7 +2164,7 @@ local function buildAllPotentialProperties(data, category)
if (data.controlledChildren) then
for _, id in ipairs(data.controlledChildren) do
local auradata = WeakAuras.GetData(id);
local regionProperties = WeakAuras.GetProperties(auradata);
local regionProperties = OptionsPrivate.Private.GetProperties(auradata);
if (regionProperties) then
for k, v in pairs(regionProperties) do
if (v.category == category) then
@@ -2186,15 +2182,14 @@ local function buildAllPotentialProperties(data, category)
end
end
else
allProperties.propertyMap[k] = {};
WeakAuras.DeepCopy(v, allProperties.propertyMap[k])
allProperties.propertyMap[k] = CopyTable(v)
end
end
end
end
end
else
local regionProperties = WeakAuras.GetProperties(data);
local regionProperties = OptionsPrivate.Private.GetProperties(data);
if (regionProperties) then
for k, v in pairs(regionProperties) do
if (v.category == category) then
@@ -2231,8 +2226,7 @@ local function buildAllPotentialProperties(data, category)
allProperties.indexToProperty[9999] = "DELETE";
if (data.controlledChildren) then
allProperties.displayWithCopy = {};
WeakAuras.DeepCopy(allProperties.display, allProperties.displayWithCopy);
allProperties.displayWithCopy = CopyTable(allProperties.display);
allProperties.displayWithCopy[9998] = "" .. L["Copy to all auras"] .. "";
allProperties.indexToProperty[9998] = "COPY";
@@ -2346,7 +2340,7 @@ local function SubPropertiesForChange(change)
local getter = function(key)
return change.value["message_format_" .. key]
end
WeakAuras.AddTextFormatOption(input, false, getter, function(key)
OptionsPrivate.AddTextFormatOption(input, false, getter, function(key)
tinsert(result, "message_format_" .. key)
end)
end
@@ -2426,8 +2420,7 @@ local function mergeCondition(all, aura, id, conditionIndex, allProperties)
for changeIndex, change in ipairs(aura.changes) do
local matchIndex = findMatchingProperty(all.changes, change, id);
if (not matchIndex) then
local copy = {};
WeakAuras.DeepCopy(change, copy);
local copy = CopyTable(change);
local propertyType = change.property and allProperties.propertyMap[change.property] and allProperties.propertyMap[change.property].type;
if (propertyType == "chat" or propertyType == "sound" or propertyType == "customcode" or propertyType == "glowexternal") then
@@ -2463,8 +2456,7 @@ local function mergeConditions(all, aura, id, allConditionTemplates, propertyTyp
for conditionIndex, condition in ipairs(aura) do
local match = findMatchingCondition(all, condition, currentInsertPoint, allConditionTemplates);
if (not match) then
local copy = {};
WeakAuras.DeepCopy(condition, copy);
local copy = CopyTable(condition);
copy.check.samevalue = true;
copy.check.sameop = true;
copy.check.references = {};
@@ -2504,7 +2496,7 @@ local function mergeConditions(all, aura, id, allConditionTemplates, propertyTyp
end
end
function WeakAuras.GetConditionOptions(data)
function OptionsPrivate.GetConditionOptions(data)
local options = {
type = "group",
name = L["Conditions"],
@@ -2557,7 +2549,7 @@ function WeakAuras.GetConditionOptions(data)
aura[conditionVariable][#aura[conditionVariable]].changes = {};
aura[conditionVariable][#aura[conditionVariable]].changes[1] = {}
aura[conditionVariable][#aura[conditionVariable]].category = category;
WeakAuras.SetCollapsed(id, "condition", #aura[conditionVariable], false);
OptionsPrivate.SetCollapsed(id, "condition", #aura[conditionVariable], false);
WeakAuras.Add(aura);
end
WeakAuras.ClearAndUpdateOptions(data.id, true)
@@ -2567,7 +2559,7 @@ function WeakAuras.GetConditionOptions(data)
conditions[#conditions].changes = {};
conditions[#conditions].changes[1] = {}
conditions[#conditions].category = category;
WeakAuras.SetCollapsed(data.id, "condition", #conditions, false);
OptionsPrivate.SetCollapsed(data.id, "condition", #conditions, false);
WeakAuras.Add(data);
WeakAuras.ClearAndUpdateOptions(data.id, true)
end
+26 -27
View File
@@ -1,26 +1,25 @@
if not WeakAuras.IsCorrectVersion() then return end
local AddonName, OptionsPrivate = ...
local L = WeakAuras.L
local regionOptions = WeakAuras.regionOptions
local flattenRegionOptions = WeakAuras.commonOptions.flattenRegionOptions
local fixMetaOrders = WeakAuras.commonOptions.fixMetaOrders
local parsePrefix = WeakAuras.commonOptions.parsePrefix
local removeFuncs = WeakAuras.commonOptions.removeFuncs
local replaceNameDescFuncs = WeakAuras.commonOptions.replaceNameDescFuncs
local replaceImageFuncs = WeakAuras.commonOptions.replaceImageFuncs
local replaceValuesFuncs = WeakAuras.commonOptions.replaceValuesFuncs
local disabledAll = WeakAuras.commonOptions.CreateDisabledAll("region")
local hiddenAll = WeakAuras.commonOptions.CreateHiddenAll("region")
local getAll = WeakAuras.commonOptions.CreateGetAll("region")
local setAll = WeakAuras.commonOptions.CreateSetAll("region", getAll)
local flattenRegionOptions = OptionsPrivate.commonOptions.flattenRegionOptions
local fixMetaOrders = OptionsPrivate.commonOptions.fixMetaOrders
local parsePrefix = OptionsPrivate.commonOptions.parsePrefix
local removeFuncs = OptionsPrivate.commonOptions.removeFuncs
local replaceNameDescFuncs = OptionsPrivate.commonOptions.replaceNameDescFuncs
local replaceImageFuncs = OptionsPrivate.commonOptions.replaceImageFuncs
local replaceValuesFuncs = OptionsPrivate.commonOptions.replaceValuesFuncs
local disabledAll = OptionsPrivate.commonOptions.CreateDisabledAll("region")
local hiddenAll = OptionsPrivate.commonOptions.CreateHiddenAll("region")
local getAll = OptionsPrivate.commonOptions.CreateGetAll("region")
local setAll = OptionsPrivate.commonOptions.CreateSetAll("region", getAll)
local function AddSubRegionImpl(data, subRegionName)
data.subRegions = data.subRegions or {}
if WeakAuras.subRegionTypes[subRegionName] and WeakAuras.subRegionTypes[subRegionName] then
if WeakAuras.subRegionTypes[subRegionName].supports(data.regionType) then
local default = WeakAuras.subRegionTypes[subRegionName].default
if OptionsPrivate.Private.subRegionTypes[subRegionName] and OptionsPrivate.Private.subRegionTypes[subRegionName] then
if OptionsPrivate.Private.subRegionTypes[subRegionName].supports(data.regionType) then
local default = OptionsPrivate.Private.subRegionTypes[subRegionName].default
local subRegionData = type(default) == "function" and default(data.regionType) or CopyTable(default)
subRegionData.type = subRegionName
tinsert(data.subRegions, subRegionData)
@@ -31,7 +30,7 @@ local function AddSubRegionImpl(data, subRegionName)
end
local function AddSubRegion(data, subRegionName)
if (WeakAuras.ApplyToDataOrChildData(data, AddSubRegionImpl, subRegionName)) then
if (OptionsPrivate.Private.ApplyToDataOrChildData(data, AddSubRegionImpl, subRegionName)) then
WeakAuras.ClearAndUpdateOptions(data.id)
end
end
@@ -48,7 +47,7 @@ local function AddOptionsForSupportedSubRegion(regionOption, data, supported)
result.__title = L["Add Extra Elements"]
result.__topLine = true
for subRegionType in pairs(supported) do
if WeakAuras.subRegionTypes[subRegionType].supportsAdd then
if OptionsPrivate.Private.subRegionTypes[subRegionType].supportsAdd then
hasSubRegions = true
result[subRegionType .. "space"] = {
type = "description",
@@ -60,7 +59,7 @@ local function AddOptionsForSupportedSubRegion(regionOption, data, supported)
result[subRegionType] = {
type = "execute",
width = WeakAuras.normalWidth,
name = string.format(L["Add %s"], WeakAuras.subRegionTypes[subRegionType].displayName),
name = string.format(L["Add %s"], OptionsPrivate.Private.subRegionTypes[subRegionType].displayName),
order = order,
func = function()
AddSubRegion(data, subRegionType)
@@ -84,7 +83,7 @@ local function union(table1, table2)
return meta;
end
function WeakAuras.GetDisplayOptions(data)
function OptionsPrivate.GetDisplayOptions(data)
local id = data.id
if not data.controlledChildren then
@@ -100,10 +99,10 @@ function WeakAuras.GetDisplayOptions(data)
local subIndex = {}
for index, subRegionData in ipairs(data.subRegions) do
local subRegionType = subRegionData.type
if WeakAuras.subRegionOptions[subRegionType] then
if OptionsPrivate.Private.subRegionOptions[subRegionType] then
hasSubElements = true
subIndex[subRegionType] = subIndex[subRegionType] and subIndex[subRegionType] + 1 or 1
local options, common = WeakAuras.subRegionOptions[subRegionType].create(data, subRegionData, index, subIndex[subRegionType])
local options, common = OptionsPrivate.Private.subRegionOptions[subRegionType].create(data, subRegionData, index, subIndex[subRegionType])
options.__order = 200 + index
regionOption["sub." .. index .. "." .. subRegionType] = options
commonOption[subRegionType] = common
@@ -119,7 +118,7 @@ function WeakAuras.GetDisplayOptions(data)
end
local supported = {}
for subRegionName, subRegionType in pairs(WeakAuras.subRegionTypes) do
for subRegionName, subRegionType in pairs(OptionsPrivate.Private.subRegionTypes) do
if subRegionType.supports(data.regionType) then
supported[subRegionName] = true
end
@@ -189,7 +188,7 @@ function WeakAuras.GetDisplayOptions(data)
WeakAuras.Add(parentData);
end
end
WeakAuras.ResetMoverSizer();
OptionsPrivate.ResetMoverSizer();
end,
args = options
};
@@ -227,7 +226,7 @@ function WeakAuras.GetDisplayOptions(data)
},
}
end
for subRegionName, subRegionType in pairs(WeakAuras.subRegionTypes) do
for subRegionName, subRegionType in pairs(OptionsPrivate.Private.subRegionTypes) do
if subRegionType.supports(childData.regionType) then
supportedSubRegions[subRegionName] = true
end
@@ -238,13 +237,13 @@ function WeakAuras.GetDisplayOptions(data)
for index, subRegionData in ipairs(childData.subRegions) do
local subRegionType = subRegionData.type
local alreadyHandled = handledSubRegionTypes[index] and handledSubRegionTypes[index][subRegionType]
if WeakAuras.subRegionOptions[subRegionType] and not alreadyHandled then
if OptionsPrivate.Private.subRegionOptions[subRegionType] and not alreadyHandled then
handledSubRegionTypes[index] = handledSubRegionTypes[index] or {}
handledSubRegionTypes[index][subRegionType] = true
hasSubElements = true
subIndex[subRegionType] = subIndex[subRegionType] and subIndex[subRegionType] + 1 or 1
local options, common = WeakAuras.subRegionOptions[subRegionType].create(data, nil, index, subIndex[subRegionType])
local options, common = OptionsPrivate.Private.subRegionOptions[subRegionType].create(data, nil, index, subIndex[subRegionType])
options.__order = 200 + index
allOptions["sub." .. index .. "." .. subRegionType] = options
@@ -295,7 +294,7 @@ function WeakAuras.GetDisplayOptions(data)
if(type(data.id) == "string") then
WeakAuras.Add(data);
WeakAuras.UpdateThumbnail(data);
WeakAuras.ResetMoverSizer();
OptionsPrivate.ResetMoverSizer();
end
end
region.hidden = function(info, ...) return hiddenAll(data, info, ...); end;
+23 -26
View File
@@ -7,18 +7,16 @@ local pairs = pairs
local AceGUI = LibStub("AceGUI-3.0")
local collisions = WeakAuras.collisions
local displayButtons = WeakAuras.displayButtons
local savedVars = WeakAuras.savedVars
local importAddonButtons = {}
local importDisplayButtons = {}
WeakAuras.importDisplayButtons = importDisplayButtons
function WeakAuras.CreateImportButtons()
function OptionsPrivate.CreateImportButtons()
wipe(importAddonButtons);
wipe(importDisplayButtons);
for addonName, addonData in pairs(WeakAuras.addons) do
for addonName, addonData in pairs(OptionsPrivate.Private) do
local addonButton = AceGUI:Create("WeakAurasImportButton");
importAddonButtons[addonName] = addonButton;
addonButton:SetTitle(addonData.displayName);
@@ -56,7 +54,7 @@ function WeakAuras.CreateImportButtons()
end
end
end
WeakAuras.ResolveCollisions(function()
OptionsPrivate.Private.ResolveCollisions(function()
for groupId, dataFromAddon in pairs(addonData.displays) do
if(dataFromAddon.controlledChildren) then
local data = WeakAuras.GetData(groupId);
@@ -75,7 +73,7 @@ function WeakAuras.CreateImportButtons()
end
end
WeakAuras.ScanForLoads();
OptionsPrivate.Private.ScanForLoads();
WeakAuras.SortDisplayButtons();
end);
end);
@@ -83,7 +81,7 @@ function WeakAuras.CreateImportButtons()
local function UpdateAddonChecked()
local shouldBeChecked = true;
for id, data in pairs(addonData.displays) do
if not(WeakAuras.IsDefinedByAddon(id)) then
if not(OptionsPrivate.Private.IsDefinedByAddon(id)) then
shouldBeChecked = false;
break;
end
@@ -106,7 +104,7 @@ function WeakAuras.CreateImportButtons()
local function UpdateGroupChecked()
local shouldBeChecked = true;
for index, childId in pairs(data.controlledChildren) do
if not(WeakAuras.IsDefinedByAddon(childId)) then
if not(OptionsPrivate.Private.IsDefinedByAddon(childId)) then
shouldBeChecked = false;
break;
end
@@ -121,7 +119,7 @@ function WeakAuras.CreateImportButtons()
local childButton = AceGUI:Create("WeakAurasImportButton");
importDisplayButtons[childId] = childButton;
local data = WeakAuras.addons[addonName].displays[childId];
local data = OptionsPrivate.Private[addonName].displays[childId];
childButton:SetTitle(childId);
childButton:SetDescription(data.desc);
@@ -134,14 +132,14 @@ function WeakAuras.CreateImportButtons()
else
WeakAuras.DisableAddonDisplay(childId);
end
WeakAuras.ResolveCollisions(function()
WeakAuras.ScanForLoads();
OptionsPrivate.Private.ResolveCollisions(function()
OptionsPrivate.Private.ScanForLoads();
WeakAuras.SortDisplayButtons();
UpdateGroupChecked();
end);
end);
childButton.updateChecked = UpdateGroupChecked;
childButton.checkbox:SetChecked(WeakAuras.IsDefinedByAddon(childId));
childButton.checkbox:SetChecked(OptionsPrivate.Private.IsDefinedByAddon(childId));
end
groupButton:SetClick(function()
@@ -160,7 +158,7 @@ function WeakAuras.CreateImportButtons()
WeakAuras.DisableAddonDisplay(childId);
end
end
WeakAuras.ResolveCollisions(function()
OptionsPrivate.Private.ResolveCollisions(function()
local data = WeakAuras.GetData(id);
if(data) then
for index, childId in pairs(data.controlledChildren) do
@@ -175,7 +173,7 @@ function WeakAuras.CreateImportButtons()
WeakAuras.ClearAndUpdateOptions(data.id);
end
WeakAuras.ScanForLoads();
OptionsPrivate.Private.ScanForLoads();
WeakAuras.SortDisplayButtons();
UpdateAddonChecked();
end);
@@ -204,13 +202,13 @@ function WeakAuras.CreateImportButtons()
else
WeakAuras.DisableAddonDisplay(id);
end
WeakAuras.ResolveCollisions(function()
OptionsPrivate.Private.ResolveCollisions(function()
WeakAuras.SortDisplayButtons()
UpdateAddonChecked();
end);
end);
displayButton.updateChecked = UpdateAddonChecked;
displayButton.checkbox:SetChecked(WeakAuras.IsDefinedByAddon(id));
displayButton.checkbox:SetChecked(OptionsPrivate.Private.IsDefinedByAddon(id));
end
end
@@ -229,7 +227,7 @@ function WeakAuras.SortImportButtons(newContainer)
container = newContainer or container;
wipe(container.children);
local toSort = {};
for addon, addonData in pairs(WeakAuras.addons) do
for addon, addonData in pairs(OptionsPrivate.Private) do
container:AddChild(importAddonButtons[addon]);
wipe(toSort);
for id, data in pairs(addonData.displays) do
@@ -262,29 +260,28 @@ function WeakAuras.SortImportButtons(newContainer)
end
function WeakAuras.EnableAddonDisplay(id)
local db = savedVars.db
local db = OptionsPrivate.savedVars.db
if not(db.registered[id]) then
local addon, data;
for addonName, addonData in pairs(WeakAuras.addons) do
for addonName, addonData in pairs(OptionsPrivate.Private) do
if(addonData.displays[id]) then
addon = addonName;
data = {}
WeakAuras.DeepCopy(addonData.displays[id], data);
data = CopyTable(addonData.displays[id]);
break;
end
end
if(db.displays[id]) then
-- ID collision
collisions[id] = {addon, data};
OptionsPrivate.Private.collisions[id] = {addon, data};
else
db.registered[id] = addon;
if(data.controlledChildren) then
wipe(data.controlledChildren);
end
WeakAuras.Add(data);
WeakAuras.SyncParentChildRelationships(true);
WeakAuras.AddDisplayButton(data);
OptionsPrivate.Private.SyncParentChildRelationships(true);
OptionsPrivate.AddDisplayButton(data);
end
end
end
@@ -297,7 +294,7 @@ end
function WeakAuras.DisableAddonDisplay(id)
local frame = WeakAuras.OptionsFrame()
local db = savedVars.db
local db = OptionsPrivate.savedVars.db
db.registered[id] = false;
local data = WeakAuras.GetData(id);
if(data) then
@@ -320,7 +317,7 @@ function WeakAuras.DisableAddonDisplay(id)
end
WeakAuras.Delete(data);
WeakAuras.SyncParentChildRelationships(true);
OptionsPrivate.Private.SyncParentChildRelationships(true);
frame.buttonsScroll:DeleteChild(displayButtons[id]);
displayButtons[id] = nil;
+28 -37
View File
@@ -3,15 +3,6 @@ local AddonName, OptionsPrivate = ...
local L = WeakAuras.L;
local event_types = WeakAuras.event_types;
local status_types = WeakAuras.status_types;
local check_types = WeakAuras.check_types;
local subevent_prefix_types = WeakAuras.subevent_prefix_types;
local subevent_actual_prefix_types = WeakAuras.subevent_actual_prefix_types;
local subevent_suffix_types = WeakAuras.subevent_suffix_types;
local custom_trigger_types = WeakAuras.custom_trigger_types;
local eventend_types = WeakAuras.eventend_types;
local function GetCustomTriggerOptions(data, triggernum)
local id = data.id;
local trigger = data.triggers[triggernum].trigger
@@ -38,7 +29,7 @@ local function GetCustomTriggerOptions(data, triggernum)
name = L["Event Type"],
order = 7,
width = WeakAuras.doubleWidth,
values = custom_trigger_types,
values = OptionsPrivate.Private.custom_trigger_types,
hidden = function() return not (trigger.type == "custom") end,
get = function(info)
return trigger.custom_type
@@ -55,7 +46,7 @@ local function GetCustomTriggerOptions(data, triggernum)
name = L["Check On..."],
width = WeakAuras.doubleWidth / 3,
order = 8,
values = check_types,
values = OptionsPrivate.Private.check_types,
hidden = function() return not (trigger.type == "custom"
and (trigger.custom_type == "status" or trigger.custom_type == "stateupdate")
and trigger.check ~= "update")
@@ -72,7 +63,7 @@ local function GetCustomTriggerOptions(data, triggernum)
name = L["Check On..."],
order = 9,
width = WeakAuras.doubleWidth,
values = check_types,
values = OptionsPrivate.Private.check_types,
hidden = function() return not (trigger.type == "custom"
and (trigger.custom_type == "status" or trigger.custom_type == "stateupdate")
and trigger.check == "update")
@@ -125,12 +116,12 @@ local function GetCustomTriggerOptions(data, triggernum)
trueEvent = string.upper(i)
elseif trueEvent == "CLEU" or trueEvent == "COMBAT_LOG_EVENT_UNFILTERED" then
local subevent = string.upper(i)
if not WeakAuras.IsCLEUSubevent(subevent) then
if not OptionsPrivate.Private.IsCLEUSubevent(subevent) then
return "|cFFFF0000"..L["%s is not a valid SubEvent for COMBAT_LOG_EVENT_UNFILTERED"]:format(subevent)
end
elseif trueEvent:match("^UNIT_") then
local unit = string.lower(i)
if not WeakAuras.baseUnitId[unit] and not WeakAuras.multiUnitId[unit] then
if not OptionsPrivate.Private.baseUnitId[unit] and not OptionsPrivate.Private.multiUnitId[unit] then
return "|cFFFF0000"..L["Unit %s is not a valid unit for RegisterUnitEvent"]:format(unit)
end
end
@@ -156,12 +147,12 @@ local function GetCustomTriggerOptions(data, triggernum)
if not trueEvent then
trueEvent = string.upper(i)
elseif trueEvent == "CLEU" or trueEvent == "COMBAT_LOG_EVENT_UNFILTERED" then
if not WeakAuras.IsCLEUSubevent(string.upper(i)) then
if not OptionsPrivate.Private.IsCLEUSubevent(string.upper(i)) then
return false
end
elseif trueEvent:match("^UNIT_") then
local unit = string.lower(i)
if not WeakAuras.baseUnitId[unit] then
if not OptionsPrivate.Private.baseUnitId[unit] then
return false
end
end
@@ -177,7 +168,7 @@ local function GetCustomTriggerOptions(data, triggernum)
name = L["Hide"],
order = 12,
hidden = function() return not (trigger.type == "custom" and trigger.custom_type == "event" and trigger.custom_hide ~= "custom") end,
values = eventend_types,
values = OptionsPrivate.Private.eventend_types,
get = function() trigger.custom_hide = trigger.custom_hide or "timed"; return trigger.custom_hide end,
set = function(info, v)
trigger.custom_hide = v;
@@ -191,7 +182,7 @@ local function GetCustomTriggerOptions(data, triggernum)
order = 12,
width = WeakAuras.doubleWidth,
hidden = function() return not (trigger.type == "custom" and trigger.custom_type == "event" and trigger.custom_hide == "custom") end,
values = eventend_types,
values = OptionsPrivate.Private.eventend_types,
get = function() return trigger.custom_hide end,
set = function(info, v)
trigger.custom_hide = v;
@@ -275,21 +266,21 @@ local function GetCustomTriggerOptions(data, triggernum)
local function hideCustomTrigger()
return not (trigger.type == "custom")
end
WeakAuras.commonOptions.AddCodeOption(customOptions, data, L["Custom Trigger"], "custom_trigger", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#custom-trigger",
OptionsPrivate.commonOptions.AddCodeOption(customOptions, data, L["Custom Trigger"], "custom_trigger", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#custom-trigger",
10, hideCustomTrigger, appendToTriggerPath("custom"), false, true, extraSetFunction, nil, true);
local function hideCustomVariables()
return not (trigger.type == "custom" and trigger.custom_type == "stateupdate");
end
WeakAuras.commonOptions.AddCodeOption(customOptions, data, L["Custom Variables"], "custom_variables", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#custom-variables",
OptionsPrivate.commonOptions.AddCodeOption(customOptions, data, L["Custom Variables"], "custom_variables", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#custom-variables",
11, hideCustomVariables, appendToTriggerPath("customVariables"), false, true, extraSetFunctionReload, nil, true);
local function hideCustomUntrigger()
return not (trigger.type == "custom"
and (trigger.custom_type == "status" or (trigger.custom_type == "event" and trigger.custom_hide == "custom")))
end
WeakAuras.commonOptions.AddCodeOption(customOptions, data, L["Custom Untrigger"], "custom_untrigger", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#custom-untrigger",
OptionsPrivate.commonOptions.AddCodeOption(customOptions, data, L["Custom Untrigger"], "custom_untrigger", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#custom-untrigger",
14, hideCustomUntrigger, appendToUntriggerPath("custom"), false, true, extraSetFunction);
local function hideCustomDuration()
@@ -297,7 +288,7 @@ local function GetCustomTriggerOptions(data, triggernum)
and (trigger.custom_type == "status"
or (trigger.custom_type == "event" and (trigger.custom_hide ~= "timed" or trigger.dynamicDuration))))
end
WeakAuras.commonOptions.AddCodeOption(customOptions, data, L["Duration Info"], "custom_duration", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#duration-info",
OptionsPrivate.commonOptions.AddCodeOption(customOptions, data, L["Duration Info"], "custom_duration", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#duration-info",
16, hideCustomDuration, appendToTriggerPath("customDuration"), false, true, extraSetFunctionReload);
local function hideIfTriggerStateUpdate()
@@ -328,17 +319,17 @@ local function GetCustomTriggerOptions(data, triggernum)
}
}
WeakAuras.commonOptions.AddCodeOption(customOptions, data, string.format(L["Overlay %s Info"], i), "custom_overlay" .. i, "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#overlay-info",
OptionsPrivate.commonOptions.AddCodeOption(customOptions, data, string.format(L["Overlay %s Info"], i), "custom_overlay" .. i, "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#overlay-info",
17 + i / 10, hideOverlay, appendToTriggerPath("customOverlay" .. i), false, true, extraSetFunctionReload, extraFunctions);
end
WeakAuras.commonOptions.AddCodeOption(customOptions, data, L["Name Info"], "custom_name", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#name-info",
OptionsPrivate.commonOptions.AddCodeOption(customOptions, data, L["Name Info"], "custom_name", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#name-info",
18, hideIfTriggerStateUpdate, appendToTriggerPath("customName"), false, true, extraSetFunctionReload);
WeakAuras.commonOptions.AddCodeOption(customOptions, data, L["Icon Info"], "custom_icon", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#icon-info",
OptionsPrivate.commonOptions.AddCodeOption(customOptions, data, L["Icon Info"], "custom_icon", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#icon-info",
20, hideIfTriggerStateUpdate, appendToTriggerPath("customIcon"), false, true, extraSetFunction);
WeakAuras.commonOptions.AddCodeOption(customOptions, data, L["Texture Info"], "custom_texture", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#texture-info",
OptionsPrivate.commonOptions.AddCodeOption(customOptions, data, L["Texture Info"], "custom_texture", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#texture-info",
22, hideIfTriggerStateUpdate, appendToTriggerPath("customTexture"), false, true, extraSetFunction);
WeakAuras.commonOptions.AddCodeOption(customOptions, data, L["Stack Info"], "custom_stacks", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#stack-info",
OptionsPrivate.commonOptions.AddCodeOption(customOptions, data, L["Stack Info"], "custom_stacks", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#stack-info",
23, hideIfTriggerStateUpdate, appendToTriggerPath("customStacks"), false, true, extraSetFunctionReload);
return customOptions;
@@ -365,9 +356,9 @@ local function GetGenericTriggerOptions(data, triggernum)
values = function()
local type= trigger.type;
if(type == "event") then
return event_types;
return OptionsPrivate.Private.event_types;
elseif(type == "status") then
return status_types;
return OptionsPrivate.Private.status_types;
end
end,
get = function(info)
@@ -375,7 +366,7 @@ local function GetGenericTriggerOptions(data, triggernum)
end,
set = function(info, v)
trigger.event = v
local prototype = WeakAuras.event_prototypes[v];
local prototype = OptionsPrivate.Private.event_prototypes[v];
if(prototype) then
if(prototype.automaticrequired) then
trigger.unevent = "auto";
@@ -391,8 +382,8 @@ local function GetGenericTriggerOptions(data, triggernum)
},
}
WeakAuras.commonOptions.AddCommonTriggerOptions(options, data, triggernum)
WeakAuras.AddTriggerMetaFunctions(options, data, triggernum)
OptionsPrivate.commonOptions.AddCommonTriggerOptions(options, data, triggernum)
OptionsPrivate.AddTriggerMetaFunctions(options, data, triggernum)
local combatLogOptions =
{
@@ -401,7 +392,7 @@ local function GetGenericTriggerOptions(data, triggernum)
name = L["Message Prefix"],
width = WeakAuras.normalWidth,
order = 8,
values = subevent_prefix_types,
values = OptionsPrivate.Private.subevent_prefix_types,
control = "WeakAurasSortedDropdown",
hidden = function() return not (trigger.type == "event" and trigger.event == "Combat Log"); end,
get = function(info)
@@ -417,9 +408,9 @@ local function GetGenericTriggerOptions(data, triggernum)
width = WeakAuras.normalWidth,
name = L["Message Suffix"],
order = 9,
values = subevent_suffix_types,
values = OptionsPrivate.Private.subevent_suffix_types,
control = "WeakAurasSortedDropdown",
hidden = function() return not (trigger.type == "event" and trigger.event == "Combat Log" and subevent_actual_prefix_types[trigger.subeventPrefix]); end,
hidden = function() return not (trigger.type == "event" and trigger.event == "Combat Log" and OptionsPrivate.Private.subevent_actual_prefix_types[trigger.subeventPrefix]); end,
get = function(info)
return trigger.subeventSuffix
end,
@@ -441,8 +432,8 @@ local function GetGenericTriggerOptions(data, triggernum)
elseif (triggerType == "status" or triggerType == "event") then
local prototypeOptions;
local trigger, untrigger = data.triggers[triggernum].trigger, data.triggers[triggernum].untrigger;
if(WeakAuras.event_prototypes[trigger.event]) then
prototypeOptions = WeakAuras.ConstructOptions(WeakAuras.event_prototypes[trigger.event], data, 10, triggernum);
if(OptionsPrivate.Private.event_prototypes[trigger.event]) then
prototypeOptions = OptionsPrivate.ConstructOptions(OptionsPrivate.Private.event_prototypes[trigger.event], data, 10, triggernum);
if (trigger.event == "Combat Log") then
WeakAuras.Mixin(prototypeOptions, combatLogOptions);
end
+4 -4
View File
@@ -3,10 +3,10 @@ local AddonName, OptionsPrivate = ...
local L = WeakAuras.L
local regionOptions = WeakAuras.regionOptions;
local parsePrefix = WeakAuras.commonOptions.parsePrefix
local flattenRegionOptions = WeakAuras.commonOptions.flattenRegionOptions
local parsePrefix = OptionsPrivate.commonOptions.parsePrefix
local flattenRegionOptions = OptionsPrivate.commonOptions.flattenRegionOptions
function WeakAuras.GetGroupOptions(data)
function OptionsPrivate.GetGroupOptions(data)
local regionOption;
local id = data.id
if (regionOptions[data.regionType]) then
@@ -54,7 +54,7 @@ function WeakAuras.GetGroupOptions(data)
end
WeakAuras.Add(data);
WeakAuras.UpdateThumbnail(data);
WeakAuras.ResetMoverSizer();
OptionsPrivate.ResetMoverSizer();
end,
hidden = function() return false end,
disabled = function() return false end,
+3 -3
View File
@@ -3,7 +3,7 @@ local AddonName, OptionsPrivate = ...
local L = WeakAuras.L
function WeakAuras.GetInformationOptions(data)
function OptionsPrivate.GetInformationOptions(data)
local isGroup = data.controlledChildren
local isTmpGroup = type(data.id) == "table"
@@ -35,7 +35,7 @@ function WeakAuras.GetInformationOptions(data)
if data.id ~= newid and not WeakAuras.GetData(newid) then
local oldid = data.id
WeakAuras.Rename(data, newid);
WeakAuras.HandleRename(data, oldid, newid)
OptionsPrivate.HandleRename(data, oldid, newid)
end
end
}
@@ -85,7 +85,7 @@ function WeakAuras.GetInformationOptions(data)
local childData = WeakAuras.GetData(childId)
childData.url = v
WeakAuras.Add(childData)
WeakAuras.ClearOptions(childData.id)
OptionsPrivate.ClearOptions(childData.id)
end
end
+56 -55
View File
@@ -3,23 +3,16 @@ local AddonName, OptionsPrivate = ...
local L = WeakAuras.L
local removeFuncs = WeakAuras.commonOptions.removeFuncs
local replaceNameDescFuncs = WeakAuras.commonOptions.replaceNameDescFuncs
local replaceImageFuncs = WeakAuras.commonOptions.replaceImageFuncs
local replaceValuesFuncs = WeakAuras.commonOptions.replaceValuesFuncs
local disabledAll = WeakAuras.commonOptions.CreateDisabledAll("load")
local hiddenAll = WeakAuras.commonOptions.CreateHiddenAll("load")
local getAll = WeakAuras.commonOptions.CreateGetAll("load")
local setAll = WeakAuras.commonOptions.CreateSetAll("load", getAll)
local removeFuncs = OptionsPrivate.commonOptions.removeFuncs
local replaceNameDescFuncs = OptionsPrivate.commonOptions.replaceNameDescFuncs
local replaceImageFuncs = OptionsPrivate.commonOptions.replaceImageFuncs
local replaceValuesFuncs = OptionsPrivate.commonOptions.replaceValuesFuncs
local disabledAll = OptionsPrivate.commonOptions.CreateDisabledAll("load")
local hiddenAll = OptionsPrivate.commonOptions.CreateHiddenAll("load")
local getAll = OptionsPrivate.commonOptions.CreateGetAll("load")
local setAll = OptionsPrivate.commonOptions.CreateSetAll("load", getAll)
local operator_types = WeakAuras.operator_types;
local operator_types_without_equal = WeakAuras.operator_types_without_equal;
local string_operator_types = WeakAuras.string_operator_types;
local ValidateNumeric = WeakAuras.ValidateNumeric;
local eventend_types = WeakAuras.eventend_types;
local timedeventend_types = WeakAuras.timedeventend_types;
local autoeventend_types = WeakAuras.autoeventend_types;
local spellCache = WeakAuras.spellCache;
@@ -73,7 +66,7 @@ local function CorrectItemName(input)
end
-- Also used by the GenericTrigger
function WeakAuras.ConstructOptions(prototype, data, startorder, triggernum, triggertype, unevent)
function OptionsPrivate.ConstructOptions(prototype, data, startorder, triggernum, triggertype, unevent)
local trigger, untrigger;
if(data.controlledChildren) then
trigger, untrigger = {}, {};
@@ -118,15 +111,15 @@ function WeakAuras.ConstructOptions(prototype, data, startorder, triggernum, tri
name = type(arg.display) == "function" and arg.display(trigger) or arg.display,
order = order,
image = function()
local collapsed = WeakAuras.IsCollapsed("trigger", name, "", true)
local collapsed = OptionsPrivate.IsCollapsed("trigger", name, "", true)
return collapsed and "collapsed" or "expanded"
end,
imageWidth = 15,
imageHeight = 15,
func = function(info, button, secondCall)
if not secondCall then
local collapsed = WeakAuras.IsCollapsed("trigger", name, "", true)
WeakAuras.SetCollapsed("trigger", name, "", not collapsed)
local collapsed = OptionsPrivate.IsCollapsed("trigger", name, "", true)
OptionsPrivate.SetCollapsed("trigger", name, "", not collapsed)
end
end,
arg = {
@@ -137,7 +130,7 @@ function WeakAuras.ConstructOptions(prototype, data, startorder, triggernum, tri
isCollapsedFunctions = isCollapsedFunctions or {};
isCollapsedFunctions[name] = function()
return WeakAuras.IsCollapsed("trigger", name, "", true);
return OptionsPrivate.IsCollapsed("trigger", name, "", true);
end
elseif(name and not arg.hidden) then
local realname = name;
@@ -187,7 +180,7 @@ function WeakAuras.ConstructOptions(prototype, data, startorder, triggernum, tri
if (reloadOptions) then
WeakAuras.ClearAndUpdateOptions(data.id)
end
WeakAuras.ScanForLoads({[data.id] = true});
OptionsPrivate.Private.ScanForLoads({[data.id] = true});
WeakAuras.UpdateThumbnail(data);
WeakAuras.UpdateDisplayButton(data);
WeakAuras.SortDisplayButtons();
@@ -236,7 +229,7 @@ function WeakAuras.ConstructOptions(prototype, data, startorder, triggernum, tri
if (reloadOptions) then
WeakAuras.ClearAndUpdateOptions(data.id)
end
WeakAuras.ScanForLoads({[data.id] = true});
OptionsPrivate.Private.ScanForLoads({[data.id] = true});
WeakAuras.UpdateThumbnail(data);
WeakAuras.UpdateDisplayButton(data);
WeakAuras.SortDisplayButtons();
@@ -284,7 +277,7 @@ function WeakAuras.ConstructOptions(prototype, data, startorder, triggernum, tri
if (reloadOptions) then
WeakAuras.ClearAndUpdateOptions(data.id)
end
WeakAuras.ScanForLoads({[data.id] = true});
OptionsPrivate.Private.ScanForLoads({[data.id] = true});
WeakAuras.UpdateThumbnail(data);
WeakAuras.UpdateDisplayButton(data);
WeakAuras.SortDisplayButtons();
@@ -315,7 +308,7 @@ function WeakAuras.ConstructOptions(prototype, data, startorder, triggernum, tri
name = L["Operator"],
order = order,
hidden = hidden,
values = arg.operator_types == "without_equal" and operator_types_without_equal or operator_types,
values = arg.operator_types == "without_equal" and OptionsPrivate.Private.operator_types_without_equal or OptionsPrivate.Private.operator_types,
disabled = function() return not trigger["use_"..realname]; end,
get = function() return trigger["use_"..realname] and trigger[realname.."_operator"] or nil; end,
set = function(info, v)
@@ -324,7 +317,7 @@ function WeakAuras.ConstructOptions(prototype, data, startorder, triggernum, tri
if (reloadOptions) then
WeakAuras.ClearAndUpdateOptions(data.id)
end
WeakAuras.ScanForLoads({[data.id] = true});
OptionsPrivate.Private.ScanForLoads({[data.id] = true});
WeakAuras.UpdateThumbnail(data);
WeakAuras.UpdateDisplayButton(data);
WeakAuras.SortDisplayButtons();
@@ -338,7 +331,7 @@ function WeakAuras.ConstructOptions(prototype, data, startorder, triggernum, tri
if (reloadOptions) then
WeakAuras.ClearAndUpdateOptions(data.id)
end
WeakAuras.ScanForLoads({[data.id] = true});
OptionsPrivate.Private.ScanForLoads({[data.id] = true});
WeakAuras.SortDisplayButtons();
end
elseif(arg.required and triggertype == "untrigger") then
@@ -363,7 +356,7 @@ function WeakAuras.ConstructOptions(prototype, data, startorder, triggernum, tri
if (reloadOptions) then
WeakAuras.ClearAndUpdateOptions(data.id)
end
WeakAuras.ScanForLoads({[data.id] = true});
OptionsPrivate.Private.ScanForLoads({[data.id] = true});
WeakAuras.UpdateThumbnail(data);
WeakAuras.UpdateDisplayButton(data);
WeakAuras.SortDisplayButtons();
@@ -377,7 +370,7 @@ function WeakAuras.ConstructOptions(prototype, data, startorder, triggernum, tri
if (reloadOptions) then
WeakAuras.ClearAndUpdateOptions(data.id)
end
WeakAuras.ScanForLoads({[data.id] = true});
OptionsPrivate.Private.ScanForLoads({[data.id] = true});
WeakAuras.SortDisplayButtons();
end
elseif(arg.required and triggertype == "untrigger") then
@@ -400,7 +393,7 @@ function WeakAuras.ConstructOptions(prototype, data, startorder, triggernum, tri
if (reloadOptions) then
WeakAuras.ClearAndUpdateOptions(data.id)
end
WeakAuras.ScanForLoads({[data.id] = true});
OptionsPrivate.Private.ScanForLoads({[data.id] = true});
WeakAuras.UpdateThumbnail(data);
WeakAuras.UpdateDisplayButton(data);
WeakAuras.SortDisplayButtons();
@@ -423,7 +416,7 @@ function WeakAuras.ConstructOptions(prototype, data, startorder, triggernum, tri
if (reloadOptions) then
WeakAuras.ClearAndUpdateOptions(data.id)
end
WeakAuras.ScanForLoads({[data.id] = true});
OptionsPrivate.Private.ScanForLoads({[data.id] = true});
WeakAuras.SortDisplayButtons();
end
elseif(arg.required and triggertype == "untrigger") then
@@ -438,7 +431,7 @@ function WeakAuras.ConstructOptions(prototype, data, startorder, triggernum, tri
name = L["Operator"],
order = order,
hidden = hidden,
values = string_operator_types,
values = OptionsPrivate.Private.string_operator_types,
disabled = function() return not trigger["use_"..realname]; end,
get = function() return trigger["use_"..realname] and trigger[realname.."_operator"] or nil; end,
set = function(info, v)
@@ -447,7 +440,7 @@ function WeakAuras.ConstructOptions(prototype, data, startorder, triggernum, tri
if (reloadOptions) then
WeakAuras.ClearAndUpdateOptions(data.id)
end
WeakAuras.ScanForLoads({[data.id] = true});
OptionsPrivate.Private.ScanForLoads({[data.id] = true});
WeakAuras.UpdateThumbnail(data);
WeakAuras.UpdateDisplayButton(data);
WeakAuras.SortDisplayButtons();
@@ -461,7 +454,7 @@ function WeakAuras.ConstructOptions(prototype, data, startorder, triggernum, tri
if (reloadOptions) then
WeakAuras.ClearAndUpdateOptions(data.id)
end
WeakAuras.ScanForLoads({[data.id] = true});
OptionsPrivate.Private.ScanForLoads({[data.id] = true});
WeakAuras.SortDisplayButtons();
end
elseif(arg.required and triggertype == "untrigger") then
@@ -484,7 +477,7 @@ function WeakAuras.ConstructOptions(prototype, data, startorder, triggernum, tri
if (reloadOptions) then
WeakAuras.ClearAndUpdateOptions(data.id)
end
WeakAuras.ScanForLoads({[data.id] = true});
OptionsPrivate.Private.ScanForLoads({[data.id] = true});
WeakAuras.UpdateThumbnail(data);
WeakAuras.UpdateDisplayButton(data);
WeakAuras.SortDisplayButtons();
@@ -498,7 +491,7 @@ function WeakAuras.ConstructOptions(prototype, data, startorder, triggernum, tri
if (reloadOptions) then
WeakAuras.ClearAndUpdateOptions(data.id)
end
WeakAuras.ScanForLoads({[data.id] = true});
OptionsPrivate.Private.ScanForLoads({[data.id] = true});
WeakAuras.SortDisplayButtons();
end
elseif(arg.required and triggertype == "untrigger") then
@@ -521,7 +514,7 @@ function WeakAuras.ConstructOptions(prototype, data, startorder, triggernum, tri
set = function(info, v)
trigger["use_exact_"..realname] = v;
WeakAuras.Add(data);
WeakAuras.ScanForLoads({[data.id] = true});
OptionsPrivate.Private.ScanForLoads({[data.id] = true});
WeakAuras.UpdateThumbnail(data);
WeakAuras.UpdateDisplayButton(data);
WeakAuras.SortDisplayButtons();
@@ -616,7 +609,7 @@ function WeakAuras.ConstructOptions(prototype, data, startorder, triggernum, tri
if (reloadOptions) then
WeakAuras.ClearAndUpdateOptions(data.id)
end
WeakAuras.ScanForLoads({[data.id] = true});
OptionsPrivate.Private.ScanForLoads({[data.id] = true});
WeakAuras.UpdateThumbnail(data);
WeakAuras.UpdateDisplayButton(data);
WeakAuras.SortDisplayButtons();
@@ -629,7 +622,11 @@ function WeakAuras.ConstructOptions(prototype, data, startorder, triggernum, tri
if(type(arg.values) == "function") then
values = arg.values(trigger);
else
values = WeakAuras[arg.values];
if OptionsPrivate.Private[arg.values] then
values = OptionsPrivate.Private[arg.values]
else
values = WeakAuras[arg.values];
end
end
options[name] = {
type = "select",
@@ -667,7 +664,7 @@ function WeakAuras.ConstructOptions(prototype, data, startorder, triggernum, tri
if (reloadOptions) then
WeakAuras.ClearAndUpdateOptions(data.id)
end
WeakAuras.ScanForLoads({[data.id] = true});
OptionsPrivate.Private.ScanForLoads({[data.id] = true});
WeakAuras.UpdateThumbnail(data);
WeakAuras.UpdateDisplayButton(data);
WeakAuras.SortDisplayButtons();
@@ -691,7 +688,7 @@ function WeakAuras.ConstructOptions(prototype, data, startorder, triggernum, tri
if (reloadOptions) then
WeakAuras.ClearAndUpdateOptions(data.id)
end
WeakAuras.ScanForLoads({[data.id] = true});
OptionsPrivate.Private.ScanForLoads({[data.id] = true});
WeakAuras.UpdateThumbnail(data);
WeakAuras.UpdateDisplayButton(data);
WeakAuras.SortDisplayButtons();
@@ -745,7 +742,11 @@ function WeakAuras.ConstructOptions(prototype, data, startorder, triggernum, tri
if(type(arg.values) == "function") then
values = arg.values(trigger);
else
values = WeakAuras[arg.values];
if OptionsPrivate.Private[arg.values] then
values = OptionsPrivate.Private[arg.values]
else
values = WeakAuras[arg.values];
end
end
options[name] = {
type = "select",
@@ -766,7 +767,7 @@ function WeakAuras.ConstructOptions(prototype, data, startorder, triggernum, tri
if (reloadOptions) then
WeakAuras.ClearAndUpdateOptions(data.id)
end
WeakAuras.ScanForLoads({[data.id] = true});
OptionsPrivate.Private.ScanForLoads({[data.id] = true});
WeakAuras.UpdateThumbnail(data);
WeakAuras.UpdateDisplayButton(data);
WeakAuras.SortDisplayButtons();
@@ -780,7 +781,7 @@ function WeakAuras.ConstructOptions(prototype, data, startorder, triggernum, tri
if (reloadOptions) then
WeakAuras.ClearAndUpdateOptions(data.id)
end
WeakAuras.ScanForLoads({[data.id] = true});
OptionsPrivate.Private.ScanForLoads({[data.id] = true});
WeakAuras.UpdateThumbnail(data);
WeakAuras.UpdateDisplayButton(data);
WeakAuras.SortDisplayButtons();
@@ -812,7 +813,7 @@ function WeakAuras.ConstructOptions(prototype, data, startorder, triggernum, tri
if (reloadOptions) then
WeakAuras.ClearAndUpdateOptions(data.id)
end
WeakAuras.ScanForLoads({[data.id] = true});
OptionsPrivate.Private.ScanForLoads({[data.id] = true});
WeakAuras.UpdateThumbnail(data);
WeakAuras.UpdateDisplayButton(data);
WeakAuras.SortDisplayButtons();
@@ -834,7 +835,7 @@ function WeakAuras.ConstructOptions(prototype, data, startorder, triggernum, tri
if (reloadOptions) then
WeakAuras.ClearAndUpdateOptions(data.id)
end
WeakAuras.ScanForLoads({[data.id] = true});
OptionsPrivate.Private.ScanForLoads({[data.id] = true});
WeakAuras.UpdateThumbnail(data);
WeakAuras.UpdateDisplayButton(data);
WeakAuras.SortDisplayButtons();
@@ -887,7 +888,7 @@ function WeakAuras.ConstructOptions(prototype, data, startorder, triggernum, tri
end
if(unevent == "custom") then
local unevent_options = WeakAuras.ConstructOptions(prototype, data, order, triggernum, "untrigger");
local unevent_options = OptionsPrivate.ConstructOptions(prototype, data, order, triggernum, "untrigger");
options = union(options, unevent_options);
end
if (prototype.timedrequired) then
@@ -895,18 +896,18 @@ function WeakAuras.ConstructOptions(prototype, data, startorder, triggernum, tri
local func = prototype.timedrequired
options.unevent.values = function()
if func(trigger) then
return timedeventend_types
return OptionsPrivate.Private.timedeventend_types
else
return eventend_types
return OptionsPrivate.Private.eventend_types
end
end
else
options.unevent.values = timedeventend_types;
options.unevent.values = OptionsPrivate.Private.timedeventend_types;
end
elseif (prototype.automatic) then
options.unevent.values = autoeventend_types;
options.unevent.values = OptionsPrivate.Private.autoeventend_types;
else
options.unevent.values = eventend_types;
options.unevent.values = OptionsPrivate.Private.eventend_types;
end
end
@@ -926,7 +927,7 @@ function WeakAuras.ConstructOptions(prototype, data, startorder, triggernum, tri
return options;
end
function WeakAuras.GetLoadOptions(data)
function OptionsPrivate.GetLoadOptions(data)
local load = {
type = "group",
name = L["Load"],
@@ -936,13 +937,13 @@ function WeakAuras.GetLoadOptions(data)
data.load[info[#info]] = (v ~= "" and v) or nil;
WeakAuras.Add(data);
WeakAuras.UpdateThumbnail(data);
WeakAuras.ScanForLoads({[data.id] = true});
OptionsPrivate.Private.ScanForLoads({[data.id] = true});
WeakAuras.SortDisplayButtons();
end,
args = {}
}
load.args = WeakAuras.ConstructOptions(WeakAuras.load_prototype, data, 10, nil, "load");
load.args = OptionsPrivate.ConstructOptions(OptionsPrivate.Private.load_prototype, data, 10, nil, "load");
if(data.controlledChildren) then
removeFuncs(load);
@@ -956,7 +957,7 @@ function WeakAuras.GetLoadOptions(data)
if(type(data.id) == "string") then
WeakAuras.Add(data);
WeakAuras.UpdateThumbnail(data);
WeakAuras.ResetMoverSizer();
OptionsPrivate.ResetMoverSizer();
end
end
load.hidden = function(info, ...) return hiddenAll(data, info, ...); end;
@@ -1,4 +1,5 @@
if not WeakAuras.IsCorrectVersion() then return end
local AddonName, OptionsPrivate = ...
-- Lua APIs
local pairs = pairs
@@ -117,7 +118,7 @@ local function ConstructCodeReview(frame)
return group
end
function WeakAuras.CodeReview(frame)
function OptionsPrivate.CodeReview(frame)
codeReview = codeReview or ConstructCodeReview(frame)
return codeReview
end
@@ -13,15 +13,12 @@ local AceConfigDialog = LibStub("AceConfigDialog-3.0")
local WeakAuras = WeakAuras
local L = WeakAuras.L
local valueFromPath = WeakAuras.ValueFromPath
local valueToPath = WeakAuras.ValueToPath
local frameChooserFrame
local frameChooserBox
local oldFocus
local oldFocusName
function WeakAuras.StartFrameChooser(data, path)
function OptionsPrivate.StartFrameChooser(data, path)
local frame = WeakAuras.OptionsFrame();
if not(frameChooserFrame) then
frameChooserFrame = CreateFrame("frame");
@@ -35,15 +32,15 @@ function WeakAuras.StartFrameChooser(data, path)
frameChooserBox:SetBackdropBorderColor(0, 1, 0);
frameChooserBox:Hide();
end
local givenValue = valueFromPath(data, path);
local givenValue = OptionsPrivate.Private.ValueFromPath(data, path);
frameChooserFrame:SetScript("OnUpdate", function()
if(IsMouseButtonDown("RightButton")) then
valueToPath(data, path, givenValue);
WeakAuras.StopFrameChooser(data);
OptionsPrivate.Private.ValueToPath(data, path, givenValue);
OptionsPrivate.StopFrameChooser(data);
WeakAuras.FillOptions()
elseif(IsMouseButtonDown("LeftButton") and oldFocusName) then
WeakAuras.StopFrameChooser(data);
OptionsPrivate.StopFrameChooser(data);
else
SetCursor("CAST_CURSOR");
@@ -76,7 +73,7 @@ function WeakAuras.StartFrameChooser(data, path)
end
if(focusName ~= oldFocusName) then
valueToPath(data, path, focusName);
OptionsPrivate.Private.ValueToPath(data, path, focusName);
oldFocusName = focusName;
WeakAuras.FillOptions()
end
@@ -91,7 +88,7 @@ function WeakAuras.StartFrameChooser(data, path)
end);
end
function WeakAuras.StopFrameChooser(data)
function OptionsPrivate.StopFrameChooser(data)
if(frameChooserFrame) then
frameChooserFrame:SetScript("OnUpdate", nil);
frameChooserBox:Hide();
@@ -202,7 +202,7 @@ local function ConstructIconPicker(frame)
return group
end
function WeakAuras.IconPicker(frame)
function OptionsPrivate.IconPicker(frame)
iconPicker = iconPicker or ConstructIconPicker(frame)
return iconPicker
end
@@ -52,7 +52,7 @@ local function ConstructImportExport(frame)
if(mode == "export") then
displayStr = WeakAuras.DisplayToString(id, true);
elseif(mode == "table") then
displayStr = WeakAuras.DataToString(id);
displayStr = OptionsPrivate.Private.DataToString(id);
end
input.editBox:SetScript("OnEscapePressed", function() group:Close(); end);
input.editBox:SetScript("OnChar", function() input:SetText(displayStr); input.editBox:HighlightText(); end);
@@ -92,7 +92,7 @@ local function ConstructImportExport(frame)
return group
end
function WeakAuras.ImportExport(frame)
function OptionsPrivate.ImportExport(frame)
importexport = importexport or ConstructImportExport(frame)
return importexport
end
@@ -204,7 +204,7 @@ local function ConstructModelPicker(frame)
return group
end
function WeakAuras.ModelPicker(frame)
function OptionsPrivate.ModelPicker(frame)
modelPicker = modelPicker or ConstructModelPicker(frame)
return modelPicker
end
+11 -13
View File
@@ -14,8 +14,6 @@ local WeakAuras = WeakAuras
local moversizer
local mover
local savedVars = WeakAuras.savedVars
local function EnsureTexture(self, texture)
if texture then
return texture
@@ -45,7 +43,7 @@ local function moveOnePxl(direction)
end
WeakAuras.Add(data, nil, true)
WeakAuras.UpdateThumbnail(data)
WeakAuras.ResetMoverSizer()
OptionsPrivate.ResetMoverSizer()
if data.parent then
local parentData = WeakAuras.GetData(data.parent)
if parentData then
@@ -494,14 +492,14 @@ local function ConstructMoverSizer(parent)
frame:ScaleCorners(region:GetWidth(), region:GetHeight())
local regionStrata = region:GetFrameStrata()
if regionStrata then
local strata = math.min(tIndexOf(WeakAuras.frame_strata_types, regionStrata) + 1, 9)
frame:SetFrameStrata(WeakAuras.frame_strata_types[strata])
mover:SetFrameStrata(WeakAuras.frame_strata_types[strata])
local strata = math.min(tIndexOf(OptionsPrivate.Private.frame_strata_types, regionStrata) + 1, 9)
frame:SetFrameStrata(OptionsPrivate.Private.frame_strata_types[strata])
mover:SetFrameStrata(OptionsPrivate.Private.frame_strata_types[strata])
end
local db = savedVars.db
local db = OptionsPrivate.savedVars.db
mover.startMoving = function()
WeakAuras.CancelAnimation(region, true, true, true, true, true)
OptionsPrivate.Private.CancelAnimation(region, true, true, true, true, true)
mover:ClearAllPoints()
if data.regionType == "group" then
mover:SetPoint(mover.selfPoint, region, mover.anchorPoint, region.blx * scale, region.bly * scale)
@@ -617,7 +615,7 @@ local function ConstructMoverSizer(parent)
end
end
WeakAuras.FillOptions()
WeakAuras.Animate("display", data.uid, "main", data.animation.main, WeakAuras.regions[data.id].region, false, nil, true)
OptionsPrivate.Private.Animate("display", data.uid, "main", data.animation.main, WeakAuras.regions[data.id].region, false, nil, true)
-- hide alignment lines
frame.lineY:Hide()
frame.lineX:Hide()
@@ -639,7 +637,7 @@ local function ConstructMoverSizer(parent)
if region:IsResizable() then
frame.startSizing = function(point)
mover.isMoving = true
WeakAuras.CancelAnimation(region, true, true, true, true, true)
OptionsPrivate.Private.CancelAnimation(region, true, true, true, true, true)
local rSelfPoint, rAnchor, rAnchorPoint, rXOffset, rYOffset = region:GetPoint(1)
region:StartSizing(point)
frame.text:ClearAllPoints()
@@ -737,7 +735,7 @@ local function ConstructMoverSizer(parent)
frame.text:Hide()
frame:SetScript("OnUpdate", nil)
WeakAuras.FillOptions()
WeakAuras.Animate("display", data.uid, "main", data.animation.main, WeakAuras.regions[data.id].region, false, nil, true)
OptionsPrivate.Private.Animate("display", data.uid, "main", data.animation.main, WeakAuras.regions[data.id].region, false, nil, true)
-- hide alignment lines
frame.lineY:Hide()
frame.lineX:Hide()
@@ -835,7 +833,7 @@ local function ConstructMoverSizer(parent)
self.alignCurrentAlpha = newAlpha
end
local db = savedVars.db
local db = OptionsPrivate.savedVars.db
local region = self.moving.region
local data = self.moving.data
if not self.isMoving then
@@ -974,7 +972,7 @@ local function ConstructMoverSizer(parent)
return frame, mover
end
function WeakAuras.MoverSizer(parent)
function OptionsPrivate.MoverSizer(parent)
if not moversizer or not mover then
moversizer, mover = ConstructMoverSizer(parent)
end
+46 -58
View File
@@ -18,12 +18,10 @@ local WeakAuras = WeakAuras
local L = WeakAuras.L
local displayButtons = WeakAuras.displayButtons
local loaded = WeakAuras.loaded
local regionOptions = WeakAuras.regionOptions
local savedVars = WeakAuras.savedVars
local tempGroup = WeakAuras.tempGroup
local tempGroup = OptionsPrivate.tempGroup
local prettyPrint = WeakAuras.prettyPrint
local aceOptions = WeakAuras.aceOptions
local aceOptions = {}
local function CreateDecoration(frame)
local deco = CreateFrame("Frame", nil, frame)
@@ -135,11 +133,11 @@ local defaultHeight = 665
local minWidth = 750
local minHeight = 240
function WeakAuras.CreateFrame()
function OptionsPrivate.CreateFrame()
local WeakAuras_DropDownMenu = CreateFrame("frame", "WeakAuras_DropDownMenu", nil, "UIDropDownMenuTemplate")
local frame
local db = savedVars.db
local odb = savedVars.odb
local db = OptionsPrivate.savedVars.db
local odb = OptionsPrivate.savedVars.odb
-------- Mostly Copied from AceGUIContainer-Frame--------
frame = CreateFrame("FRAME", "WeakAurasOptions", UIParent)
tinsert(UISpecialFrames, frame:GetName())
@@ -173,15 +171,10 @@ function WeakAuras.CreateFrame()
frame:Hide()
frame:SetScript("OnHide", function()
WeakAuras.ClearFakeStates()
WeakAuras.SetDragging()
OptionsPrivate.Private.ClearFakeStates()
OptionsPrivate.SetDragging()
local tutFrame = WeakAuras.TutorialsFrame and WeakAuras.TutorialsFrame()
if tutFrame and tutFrame:IsVisible() then
tutFrame:Hide()
end
WeakAuras.PauseAllDynamicGroups()
OptionsPrivate.Private.PauseAllDynamicGroups()
for id, data in pairs(WeakAuras.regions) do
data.region:Collapse()
@@ -194,12 +187,11 @@ function WeakAuras.CreateFrame()
end
end
WeakAuras.ResumeAllDynamicGroups()
WeakAuras.ReloadAll()
WeakAuras.Resume()
OptionsPrivate.Private.ResumeAllDynamicGroups()
OptionsPrivate.Private.Resume()
if WeakAuras.mouseFrame then
WeakAuras.mouseFrame:OptionsClosed()
if OptionsPrivate.Private.mouseFrame then
OptionsPrivate.Private.mouseFrame:OptionsClosed()
end
end)
@@ -537,14 +529,14 @@ function WeakAuras.CreateFrame()
container.content:SetPoint("BOTTOMRIGHT", 0, 0)
frame.container = container
frame.texturePicker = WeakAuras.TexturePicker(frame)
frame.iconPicker = WeakAuras.IconPicker(frame)
frame.modelPicker = WeakAuras.ModelPicker(frame)
frame.importexport = WeakAuras.ImportExport(frame)
frame.texteditor = WeakAuras.TextEditor(frame)
frame.codereview = WeakAuras.CodeReview(frame)
frame.texturePicker = OptionsPrivate.TexturePicker(frame)
frame.iconPicker = OptionsPrivate.IconPicker(frame)
frame.modelPicker = OptionsPrivate.ModelPicker(frame)
frame.importexport = OptionsPrivate.ImportExport(frame)
frame.texteditor = OptionsPrivate.TextEditor(frame)
frame.codereview = OptionsPrivate.CodeReview(frame)
frame.moversizer, frame.mover = WeakAuras.MoverSizer(frame)
frame.moversizer, frame.mover = OptionsPrivate.MoverSizer(frame)
-- filter line
local filterInput = CreateFrame("editbox", "WeakAurasFilterInput", frame, "InputBoxTemplate")
@@ -609,7 +601,7 @@ function WeakAuras.CreateFrame()
local importButton = AceGUI:Create("WeakAurasToolbarButton")
importButton:SetText(L["Import"])
importButton:SetTexture("Interface\\AddOns\\WeakAuras\\Media\\Textures\\importsmall")
importButton:SetCallback("OnClick", WeakAuras.ImportFromString)
importButton:SetCallback("OnClick", OptionsPrivate.ImportFromString)
toolbarContainer:AddChild(importButton)
local magnetButton = AceGUI:Create("WeakAurasToolbarButton")
@@ -701,7 +693,7 @@ function WeakAuras.CreateFrame()
local numAddons = 0
for addon, addonData in pairs(WeakAuras.addons) do
for addon, addonData in pairs(OptionsPrivate.Private) do
numAddons = numAddons + 1
end
@@ -733,26 +725,26 @@ function WeakAuras.CreateFrame()
loadedButton:SetExpandDescription(L["Expand all loaded displays"])
loadedButton:SetCollapseDescription(L["Collapse all loaded displays"])
loadedButton:SetViewClick(function()
WeakAuras.PauseAllDynamicGroups()
OptionsPrivate.Private.PauseAllDynamicGroups()
if loadedButton.view.func() == 2 then
for id, child in pairs(displayButtons) do
if loaded[id] ~= nil then
if OptionsPrivate.Private.loaded[id] ~= nil then
child:PriorityHide(2)
end
end
else
for id, child in pairs(displayButtons) do
if loaded[id] ~= nil then
if OptionsPrivate.Private.loaded[id] ~= nil then
child:PriorityShow(2)
end
end
end
WeakAuras.ResumeAllDynamicGroups()
OptionsPrivate.Private.ResumeAllDynamicGroups()
end)
loadedButton:SetViewTest(function()
local none, all = true, true
for id, child in pairs(displayButtons) do
if loaded[id] ~= nil then
if OptionsPrivate.Private.loaded[id] ~= nil then
if child:GetVisibility() ~= 2 then
all = false
end
@@ -794,13 +786,13 @@ function WeakAuras.CreateFrame()
unloadedButton:SetViewClick(function()
if unloadedButton.view.func() == 2 then
for id, child in pairs(displayButtons) do
if loaded[id] == nil then
if OptionsPrivate.Private.loaded[id] == nil then
child:PriorityHide(2)
end
end
else
for id, child in pairs(displayButtons) do
if loaded[id] == nil then
if OptionsPrivate.Private.loaded[id] == nil then
child:PriorityShow(2)
end
end
@@ -809,7 +801,7 @@ function WeakAuras.CreateFrame()
unloadedButton:SetViewTest(function()
local none, all = true, true
for id, child in pairs(displayButtons) do
if loaded[id] == nil then
if OptionsPrivate.Private.loaded[id] == nil then
if child:GetVisibility() ~= 2 then
all = false
end
@@ -893,25 +885,21 @@ function WeakAuras.CreateFrame()
end
end
frame.GetSubOptions = function(self, id, tab)
return aceOptions[id] and aceOptions[id][tab]
end
frame.EnsureOptions = function(self, data, tab)
local id = data.id
aceOptions[id] = aceOptions[id] or {}
if not aceOptions[id][tab] then
local optionsGenerator =
{
group = WeakAuras.GetGroupOptions,
region = WeakAuras.GetDisplayOptions,
trigger = WeakAuras.GetTriggerOptions,
conditions = WeakAuras.GetConditionOptions,
load = WeakAuras.GetLoadOptions,
action = WeakAuras.GetActionOptions,
animation = WeakAuras.GetAnimationOptions,
authorOptions = WeakAuras.GetAuthorOptions,
information = WeakAuras.GetInformationOptions,
group = OptionsPrivate.GetGroupOptions,
region = OptionsPrivate.GetDisplayOptions,
trigger = OptionsPrivate.GetTriggerOptions,
conditions = OptionsPrivate.GetConditionOptions,
load = OptionsPrivate.GetLoadOptions,
action = OptionsPrivate.GetActionOptions,
animation = OptionsPrivate.GetAnimationOptions,
authorOptions = OptionsPrivate.GetAuthorOptions,
information = OptionsPrivate.GetInformationOptions,
}
if optionsGenerator[tab] then
aceOptions[id][tab] = optionsGenerator[tab](data)
@@ -996,7 +984,7 @@ function WeakAuras.CreateFrame()
end
frame.ClearPicks = function(self, noHide)
WeakAuras.PauseAllDynamicGroups()
OptionsPrivate.Private.PauseAllDynamicGroups()
frame.pickedDisplay = nil
frame.pickedOption = nil
@@ -1013,7 +1001,7 @@ function WeakAuras.CreateFrame()
container:ReleaseChildren()
self.moversizer:Hide()
WeakAuras.ResumeAllDynamicGroups()
OptionsPrivate.Private.ResumeAllDynamicGroups()
end
local function GetTarget(pickedDisplay)
@@ -1154,7 +1142,7 @@ function WeakAuras.CreateFrame()
importButton:SetIcon(frame.importThumbnail)
importButton:SetDescription(L["Import a display from an encoded string"])
importButton:SetClick(WeakAuras.ImportFromString)
importButton:SetClick(OptionsPrivate.ImportFromString)
containerScroll:AddChild(importButton)
end
@@ -1177,7 +1165,7 @@ function WeakAuras.CreateFrame()
container:SetLayout("fill")
container:AddChild(containerScroll)
WeakAuras.CreateImportButtons()
OptionsPrivate.CreateImportButtons()
WeakAuras.SortImportButtons(containerScroll)
else
error("An options button other than New or Addons was selected... but there are no other options buttons!")
@@ -1199,7 +1187,7 @@ function WeakAuras.CreateFrame()
displayButtons[data.parent]:Expand()
end
end
if loaded[id] ~= nil then
if OptionsPrivate.Private.loaded[id] ~= nil then
-- Under loaded
if not loadedButton:GetExpanded() then
loadedButton:Expand()
@@ -1260,17 +1248,17 @@ function WeakAuras.CreateFrame()
if type(self.pickedDisplay) == "string" then
if WeakAuras.GetData(self.pickedDisplay).controlledChildren then
wasGroup = true
elseif not WeakAuras.IsDisplayPicked(id) then
elseif not OptionsPrivate.IsDisplayPicked(id) then
tinsert(tempGroup.controlledChildren, self.pickedDisplay)
end
end
if wasGroup then
self:PickDisplay(id)
elseif not WeakAuras.IsDisplayPicked(id) then
elseif not OptionsPrivate.IsDisplayPicked(id) then
self.pickedDisplay = tempGroup
displayButtons[id]:Pick()
tinsert(tempGroup.controlledChildren, id)
WeakAuras.ClearOptions(tempGroup.id)
OptionsPrivate.ClearOptions(tempGroup.id)
self:FillOptions()
end
end
+37 -41
View File
@@ -17,9 +17,6 @@ local L = WeakAuras.L
local textEditor
local valueFromPath = WeakAuras.ValueFromPath
local valueToPath = WeakAuras.ValueToPath
local editor_themes = {
["Standard"] = {
["Table"] = "|c00ff3333",
@@ -149,36 +146,6 @@ end]=]
},
}
local function settings_dropdown_initialize(frame, level, menu)
for k, v in pairs(editor_themes) do
local item = {
text = k,
isNotRadio = false,
checked = function()
return WeakAurasSaved.editor_theme == k
end,
func = function()
WeakAurasSaved.editor_theme = k
set_scheme()
WeakAuras.editor.editBox:SetText(WeakAuras.editor.editBox:GetText())
end
}
UIDropDownMenu_AddButton(item)
end
UIDropDownMenu_AddButton(
{
text = L["Bracket Matching"],
isNotRadio = true,
checked = function()
return WeakAurasSaved.editor_bracket_matching
end,
func = function()
WeakAurasSaved.editor_bracket_matching = not WeakAurasSaved.editor_bracket_matching
end
}
)
end
local function ConstructTextEditor(frame)
local group = AceGUI:Create("InlineGroup")
group.frame:SetParent(frame)
@@ -260,6 +227,36 @@ local function ConstructTextEditor(frame)
urlText:SetPoint("RIGHT", settings_frame, "LEFT")
local dropdown = CreateFrame("Frame", "SettingsMenuFrame", settings_frame, "UIDropDownMenuTemplate")
local function settings_dropdown_initialize(frame, level, menu)
for k, v in pairs(editor_themes) do
local item = {
text = k,
isNotRadio = false,
checked = function()
return WeakAurasSaved.editor_theme == k
end,
func = function()
WeakAurasSaved.editor_theme = k
set_scheme()
editor.editBox:SetText(editor.editBox:GetText())
end
}
UIDropDownMenu_AddButton(item)
end
UIDropDownMenu_AddButton(
{
text = L["Bracket Matching"],
isNotRadio = true,
checked = function()
return WeakAurasSaved.editor_bracket_matching
end,
func = function()
WeakAurasSaved.editor_bracket_matching = not WeakAurasSaved.editor_bracket_matching
end
}
)
end
UIDropDownMenu_Initialize(dropdown, settings_dropdown_initialize, "MENU")
settings_frame:SetScript(
@@ -331,8 +328,8 @@ local function ConstructTextEditor(frame)
button:SetCallback(
"OnClick",
function()
WeakAuras.editor.editBox:Insert(snippet.snippet)
WeakAuras.editor:SetFocus()
editor.editBox:Insert(snippet.snippet)
editor:SetFocus()
end
)
button.deleteButton:SetScript(
@@ -635,7 +632,7 @@ local function ConstructTextEditor(frame)
local combinedText = ""
for index, childId in pairs(data.controlledChildren) do
local childData = WeakAuras.GetData(childId)
local text = valueFromPath(childData, multipath and path[childId] or path)
local text = OptionsPrivate.Private.ValueFromPath(childData, multipath and path[childId] or path)
if text then
if not (singleText) then
singleText = text
@@ -661,7 +658,7 @@ local function ConstructTextEditor(frame)
editor.combinedText = true
end
else
editor:SetText(valueFromPath(data, path) or "")
editor:SetText(OptionsPrivate.Private.ValueFromPath(data, path) or "")
end
editor:SetFocus()
end
@@ -716,11 +713,11 @@ local function ConstructTextEditor(frame)
for index, childId in pairs(self.data.controlledChildren) do
local text = editor.combinedText and (textById[childId] or "") or editor:GetText()
local childData = WeakAuras.GetData(childId)
valueToPath(childData, self.multipath and self.path[childId] or self.path, text)
OptionsPrivate.Private.ValueToPath(childData, self.multipath and self.path[childId] or self.path, text)
WeakAuras.Add(childData)
end
else
valueToPath(self.data, self.path, editor:GetText())
OptionsPrivate.Private.ValueToPath(self.data, self.path, editor:GetText())
WeakAuras.Add(self.data)
end
if (self.reloadOptions) then
@@ -742,12 +739,11 @@ local function ConstructTextEditor(frame)
frame:UpdateFrameVisible()
WeakAuras.FillOptions()
end
WeakAuras.editor = editor
return group
end
function WeakAuras.TextEditor(frame)
function OptionsPrivate.TextEditor(frame)
textEditor = textEditor or ConstructTextEditor(frame)
return textEditor
end
@@ -221,7 +221,6 @@ local function ConstructTexturePicker(frame)
else
_, givenPath = next(self.givenPath);
end
WeakAuras.debug(givenPath, 3);
for categoryName, category in pairs(self.textures) do
if not(picked) then
for texturePath, textureName in pairs(category) do
@@ -279,7 +278,7 @@ local function ConstructTexturePicker(frame)
return group
end
function WeakAuras.TexturePicker(frame)
function OptionsPrivate.TexturePicker(frame)
texturePicker = texturePicker or ConstructTexturePicker(frame)
return texturePicker
end
+18 -18
View File
@@ -24,7 +24,7 @@ local function createOptions(id, data)
width = WeakAuras.normalWidth,
name = L["Orientation"],
order = 25,
values = WeakAuras.orientation_types,
values = OptionsPrivate.Private.orientation_types,
set = function(info, v)
if(
(
@@ -58,7 +58,7 @@ local function createOptions(id, data)
data.orientation = v;
WeakAuras.Add(data);
WeakAuras.UpdateThumbnail(data);
WeakAuras.ResetMoverSizer();
OptionsPrivate.ResetMoverSizer();
end
},
inverse = {
@@ -71,7 +71,7 @@ local function createOptions(id, data)
type = "toggle",
width = WeakAuras.normalWidth,
name = L["Tooltip on Mouseover"],
hidden = function() return not WeakAuras.CanHaveTooltip(data) end,
hidden = function() return not OptionsPrivate.Private.CanHaveTooltip(data) end,
order = 38
},
bar_header = {
@@ -120,15 +120,15 @@ local function createOptions(id, data)
name = L["Auto"],
desc = L["Choose whether the displayed icon is automatic or defined manually"],
order = 40.3,
disabled = function() return not WeakAuras.CanHaveAuto(data); end,
get = function() return WeakAuras.CanHaveAuto(data) and data.auto end,
disabled = function() return not OptionsPrivate.Private.CanHaveAuto(data); end,
get = function() return OptionsPrivate.Private.CanHaveAuto(data) and data.auto end,
hidden = function() return not data.icon end,
},
displayIcon = {
type = "input",
width = WeakAuras.normalWidth,
name = L["Display Icon"],
hidden = function() return WeakAuras.CanHaveAuto(data) and data.auto or not data.icon; end,
hidden = function() return OptionsPrivate.Private.CanHaveAuto(data) and data.auto or not data.icon; end,
disabled = function() return not data.icon end,
order = 40.4,
get = function()
@@ -144,16 +144,16 @@ local function createOptions(id, data)
type = "execute",
width = WeakAuras.normalWidth,
name = L["Choose"],
hidden = function() return WeakAuras.CanHaveAuto(data) and data.auto or not data.icon; end,
hidden = function() return OptionsPrivate.Private.CanHaveAuto(data) and data.auto or not data.icon; end,
disabled = function() return not data.icon end,
order = 40.5,
func = function() WeakAuras.OpenIconPicker(data, "displayIcon"); end
func = function() OptionsPrivate.OpenIconPicker(data, "displayIcon"); end
},
icon_side = {
type = "select",
width = WeakAuras.normalWidth,
name = L["Icon Position"],
values = WeakAuras.icon_side_types,
values = OptionsPrivate.Private.icon_side_types,
hidden = function() return data.orientation:find("VERTICAL") or not data.icon end,
order = 40.6,
},
@@ -161,7 +161,7 @@ local function createOptions(id, data)
type = "select",
width = WeakAuras.normalWidth,
name = L["Icon Position"],
values = WeakAuras.rotated_icon_side_types,
values = OptionsPrivate.Private.rotated_icon_side_types,
hidden = function() return data.orientation:find("HORIZONTAL") or not data.icon end,
order = 40.7,
get = function()
@@ -241,7 +241,7 @@ local function createOptions(id, data)
width = WeakAuras.halfWidth,
order = 44.3,
func = function()
WeakAuras.OpenTexturePicker(data, data, "sparkTexture", WeakAuras.texture_types);
OptionsPrivate.OpenTexturePicker(data, data, "sparkTexture", OptionsPrivate.Private.texture_types);
end,
disabled = function() return not data.spark end,
hidden = function() return not data.spark end,
@@ -260,7 +260,7 @@ local function createOptions(id, data)
width = WeakAuras.normalWidth,
name = L["Blend Mode"],
order = 44.5,
values = WeakAuras.blend_types,
values = OptionsPrivate.Private.blend_types,
disabled = function() return not data.spark end,
hidden = function() return not data.spark end,
},
@@ -311,7 +311,7 @@ local function createOptions(id, data)
sparkRotationMode = {
type = "select",
width = WeakAuras.normalWidth,
values = WeakAuras.spark_rotation_types,
values = OptionsPrivate.Private.spark_rotation_types,
name = L["Rotation Mode"],
order = 45,
disabled = function() return not data.spark end,
@@ -339,7 +339,7 @@ local function createOptions(id, data)
sparkHidden = {
type = "select",
width = WeakAuras.normalWidth,
values = WeakAuras.spark_hide_types,
values = OptionsPrivate.Private.spark_hide_types,
name = L["Hide on"],
order = 45.3,
disabled = function() return not data.spark end,
@@ -354,7 +354,7 @@ local function createOptions(id, data)
options = WeakAuras.regionPrototype.AddAdjustedDurationOptions(options, data, 36.5);
local overlayInfo = WeakAuras.GetOverlayInfo(data);
local overlayInfo = OptionsPrivate.Private.GetOverlayInfo(data);
if (overlayInfo and next(overlayInfo)) then
options["overlayheader"] = {
type = "header",
@@ -397,7 +397,7 @@ local function createOptions(id, data)
return {
aurabar = options,
position = WeakAuras.commonOptions.PositionOptions(id, data),
position = OptionsPrivate.commonOptions.PositionOptions(id, data),
};
end
@@ -734,12 +734,12 @@ local function subCreateOptions(parentData, data, index, subIndex)
__title = L["Foreground"],
__order = 1,
__up = function()
if (WeakAuras.ApplyToDataOrChildData(parentData, WeakAuras.MoveSubRegionUp, index, "aurabar_bar")) then
if (OptionsPrivate.Private.ApplyToDataOrChildData(parentData, OptionsPrivate.MoveSubRegionUp, index, "aurabar_bar")) then
WeakAuras.ClearAndUpdateOptions(parentData.id)
end
end,
__down = function()
if (WeakAuras.ApplyToDataOrChildData(parentData, WeakAuras.MoveSubRegionDown, index, "aurabar_bar")) then
if (OptionsPrivate.Private.ApplyToDataOrChildData(parentData, OptionsPrivate.MoveSubRegionDown, index, "aurabar_bar")) then
WeakAuras.ClearAndUpdateOptions(parentData.id, parentData)
end
end,
+19 -19
View File
@@ -98,7 +98,7 @@ local function createOptions(id, data)
width = WeakAuras.normalWidth,
name = L["Choose"],
order = 0.51,
func = function() WeakAuras.OpenIconPicker(data, "groupIcon", true) end
func = function() OptionsPrivate.OpenIconPicker(data, "groupIcon", true) end
},
-- grow options
grow = {
@@ -106,7 +106,7 @@ local function createOptions(id, data)
width = WeakAuras.doubleWidth,
name = L["Grow"],
order = 1,
values = WeakAuras.grow_types,
values = OptionsPrivate.Private.grow_types,
set = function(info, v)
data.grow = v
local selfPoint = selfPoints[data.grow] or selfPoints.default
@@ -116,7 +116,7 @@ local function createOptions(id, data)
data.selfPoint = selfPoint
WeakAuras.Add(data)
WeakAuras.ClearAndUpdateOptions(data.id)
WeakAuras.ResetMoverSizer()
OptionsPrivate.ResetMoverSizer()
end,
},
useAnchorPerUnit = {
@@ -150,7 +150,7 @@ local function createOptions(id, data)
width = WeakAuras.normalWidth,
name = L["Align"],
order = 2,
values = WeakAuras.align_types,
values = OptionsPrivate.Private.align_types,
set = function(info, v)
data.align = v
local selfPoint = selfPoints[data.grow] or selfPoints.default
@@ -160,7 +160,7 @@ local function createOptions(id, data)
data.selfPoint = selfPoint
WeakAuras.Add(data)
WeakAuras.ClearAndUpdateOptions(data.id)
WeakAuras.ResetMoverSizer()
OptionsPrivate.ResetMoverSizer()
end,
hidden = function() return (data.grow == "CUSTOM" or data.grow == "LEFT" or data.grow == "RIGHT" or data.grow == "HORIZONTAL" or data.grow == "CIRCLE" or data.grow == "COUNTERCIRCLE" or data.grow == "GRID") end,
disabled = function() return data.grow == "CIRCLE" or data.grow == "COUNTERCIRCLE" end
@@ -170,7 +170,7 @@ local function createOptions(id, data)
width = WeakAuras.normalWidth,
name = L["Align"],
order = 3,
values = WeakAuras.rotated_align_types,
values = OptionsPrivate.Private.rotated_align_types,
hidden = function() return (data.grow == "CUSTOM" or data.grow == "UP" or data.grow == "DOWN" or data.grow == "VERTICAL" or data.grow == "CIRCLE" or data.grow == "COUNTERCIRCLE" or data.grow == "GRID") end,
get = function() return data.align; end,
set = function(info, v)
@@ -182,7 +182,7 @@ local function createOptions(id, data)
data.selfPoint = selfPoint
WeakAuras.Add(data)
WeakAuras.ClearAndUpdateOptions(data.id)
WeakAuras.ResetMoverSizer()
OptionsPrivate.ResetMoverSizer()
end,
},
-- circle grow options
@@ -191,7 +191,7 @@ local function createOptions(id, data)
width = WeakAuras.normalWidth,
name = L["Constant Factor"],
order = 4,
values = WeakAuras.circular_group_constant_factor_types,
values = OptionsPrivate.Private.circular_group_constant_factor_types,
hidden = function() return data.grow ~= "CIRCLE" and data.grow ~= "COUNTERCIRCLE" end
},
rotation = {
@@ -238,13 +238,13 @@ local function createOptions(id, data)
width = WeakAuras.normalWidth,
name = L["Grid direction"],
order = 8,
values = WeakAuras.grid_types,
values = OptionsPrivate.Private.grid_types,
hidden = function() return data.grow ~= "GRID" end,
set = function(info, value)
data.selfPoint = gridSelfPoints[value]
data.gridType = value
WeakAuras.Add(data)
WeakAuras.ResetMoverSizer()
OptionsPrivate.ResetMoverSizer()
end,
},
gridWidth = {
@@ -321,7 +321,7 @@ local function createOptions(id, data)
width = WeakAuras.doubleWidth,
name = L["Sort"],
order = 20,
values = WeakAuras.group_sort_types
values = OptionsPrivate.Private.group_sort_types
},
-- custom sort option added below
hybridPosition = {
@@ -329,7 +329,7 @@ local function createOptions(id, data)
width = WeakAuras.normalWidth,
name = L["Hybrid Position"],
order = 21,
values = WeakAuras.group_hybrid_position_types,
values = OptionsPrivate.Private.group_hybrid_position_types,
hidden = function() return not(data.sort == "hybrid") end,
},
hybridSortMode = {
@@ -337,7 +337,7 @@ local function createOptions(id, data)
width = WeakAuras.normalWidth,
name = L["Hybrid Sort Mode"],
order = 22,
values = WeakAuras.group_hybrid_sort_types,
values = OptionsPrivate.Private.group_hybrid_sort_types,
hidden = function() return not(data.sort == "hybrid") end,
},
sortHybrid = {
@@ -409,7 +409,7 @@ local function createOptions(id, data)
data.yOffset = data.yOffset/(1-change)
data.scale = v
WeakAuras.Add(data);
WeakAuras.ResetMoverSizer();
OptionsPrivate.ResetMoverSizer();
end
},
endHeader = {
@@ -419,23 +419,23 @@ local function createOptions(id, data)
},
};
WeakAuras.commonOptions.AddCodeOption(options, data, L["Custom Grow"], "custom_grow", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#grow",
OptionsPrivate.commonOptions.AddCodeOption(options, data, L["Custom Grow"], "custom_grow", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#grow",
2, function() return data.grow ~= "CUSTOM" end, {"customGrow"}, nil, nil, nil, nil, nil, true)
WeakAuras.commonOptions.AddCodeOption(options, data, L["Custom Sort"], "custom_sort", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#custom-sort",
OptionsPrivate.commonOptions.AddCodeOption(options, data, L["Custom Sort"], "custom_sort", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#custom-sort",
21, function() return data.sort ~= "custom" end, {"customSort"}, nil, nil, nil, nil, nil, true)
WeakAuras.commonOptions.AddCodeOption(options, data, L["Custom Anchor"], "custom_anchor_per_unit", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#group-by-frame",
OptionsPrivate.commonOptions.AddCodeOption(options, data, L["Custom Anchor"], "custom_anchor_per_unit", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#group-by-frame",
1.7, function() return not(data.grow ~= "CUSTOM" and data.useAnchorPerUnit and data.anchorPerUnit == "CUSTOM") end, {"customAnchorPerUnit"}, nil, nil, nil, nil, nil, true)
local borderHideFunc = function() return data.useAnchorPerUnit or data.grow == "CUSTOM" end
local disableSelfPoint = function() return data.grow ~= "CUSTOM" and data.grow ~= "GRID" and not data.useAnchorPerUnit end
for k, v in pairs(WeakAuras.commonOptions.BorderOptions(id, data, nil, borderHideFunc, 70)) do
for k, v in pairs(OptionsPrivate.commonOptions.BorderOptions(id, data, nil, borderHideFunc, 70)) do
options[k] = v
end
return {
dynamicgroup = options,
position = WeakAuras.commonOptions.PositionOptions(id, data, nil, true, disableSelfPoint),
position = OptionsPrivate.commonOptions.PositionOptions(id, data, nil, true, disableSelfPoint),
};
end
+12 -12
View File
@@ -80,14 +80,14 @@ local function createOptions(id, data)
width = WeakAuras.normalWidth,
name = L["Choose"],
order = 0.51,
func = function() WeakAuras.OpenIconPicker(data, "groupIcon", true) end
func = function() OptionsPrivate.OpenIconPicker(data, "groupIcon", true) end
},
align_h = {
type = "select",
width = WeakAuras.normalWidth,
name = L["Horizontal Align"],
order = 10,
values = WeakAuras.align_types,
values = OptionsPrivate.Private.align_types,
get = function()
if(#data.controlledChildren < 1) then
return nil;
@@ -145,7 +145,7 @@ local function createOptions(id, data)
end
end
WeakAuras.Add(data);
WeakAuras.ResetMoverSizer();
OptionsPrivate.ResetMoverSizer();
end
},
align_v = {
@@ -153,7 +153,7 @@ local function createOptions(id, data)
width = WeakAuras.normalWidth,
name = L["Vertical Align"],
order = 15,
values = WeakAuras.rotated_align_types,
values = OptionsPrivate.Private.rotated_align_types,
get = function()
if(#data.controlledChildren < 1) then
return nil;
@@ -211,7 +211,7 @@ local function createOptions(id, data)
end
end
WeakAuras.Add(data);
WeakAuras.ResetMoverSizer();
OptionsPrivate.ResetMoverSizer();
end
},
distribute_h = {
@@ -294,7 +294,7 @@ local function createOptions(id, data)
end
WeakAuras.Add(data);
WeakAuras.ResetMoverSizer();
OptionsPrivate.ResetMoverSizer();
end
},
distribute_v = {
@@ -377,7 +377,7 @@ local function createOptions(id, data)
end
WeakAuras.Add(data);
WeakAuras.ResetMoverSizer();
OptionsPrivate.ResetMoverSizer();
end
},
space_h = {
@@ -460,7 +460,7 @@ local function createOptions(id, data)
end
WeakAuras.Add(data);
WeakAuras.ResetMoverSizer();
OptionsPrivate.ResetMoverSizer();
end
},
space_v = {
@@ -543,7 +543,7 @@ local function createOptions(id, data)
end
WeakAuras.Add(data);
WeakAuras.ResetMoverSizer();
OptionsPrivate.ResetMoverSizer();
end
},
scale = {
@@ -564,7 +564,7 @@ local function createOptions(id, data)
data.yOffset = data.yOffset/(1-change)
data.scale = v
WeakAuras.Add(data);
WeakAuras.ResetMoverSizer();
OptionsPrivate.ResetMoverSizer();
end
},
endHeader = {
@@ -574,13 +574,13 @@ local function createOptions(id, data)
},
};
for k, v in pairs(WeakAuras.commonOptions.BorderOptions(id, data, nil, nil, 70)) do
for k, v in pairs(OptionsPrivate.commonOptions.BorderOptions(id, data, nil, nil, 70)) do
options[k] = v
end
return {
group = options,
position = WeakAuras.commonOptions.PositionOptions(id, data, nil, true, true),
position = OptionsPrivate.commonOptions.PositionOptions(id, data, nil, true, true),
};
end
+17 -17
View File
@@ -6,7 +6,7 @@ local L = WeakAuras.L
local function createOptions(id, data)
local hiddenIconExtra = function()
return WeakAuras.IsCollapsed("icon", "icon", "iconextra", true);
return OptionsPrivate.IsCollapsed("icon", "icon", "iconextra", true);
end
local indentWidth = 0.15
@@ -25,14 +25,14 @@ local function createOptions(id, data)
width = WeakAuras.normalWidth,
name = L["Automatic Icon"],
order = 2,
disabled = function() return not WeakAuras.CanHaveAuto(data); end,
get = function() return WeakAuras.CanHaveAuto(data) and data.auto; end
disabled = function() return not OptionsPrivate.Private.CanHaveAuto(data); end,
get = function() return OptionsPrivate.Private.CanHaveAuto(data) and data.auto; end
},
displayIcon = {
type = "input",
width = WeakAuras.normalWidth,
name = L["Display Icon"],
hidden = function() return WeakAuras.CanHaveAuto(data) and data.auto; end,
hidden = function() return OptionsPrivate.Private.CanHaveAuto(data) and data.auto; end,
order = 3,
get = function()
return data.displayIcon and tostring(data.displayIcon) or "";
@@ -47,9 +47,9 @@ local function createOptions(id, data)
type = "execute",
width = WeakAuras.normalWidth,
name = L["Choose"],
hidden = function() return WeakAuras.CanHaveAuto(data) and data.auto; end,
hidden = function() return OptionsPrivate.Private.CanHaveAuto(data) and data.auto; end,
order = 4,
func = function() WeakAuras.OpenIconPicker(data, "displayIcon"); end
func = function() OptionsPrivate.OpenIconPicker(data, "displayIcon"); end
},
desaturate = {
type = "toggle",
@@ -61,7 +61,7 @@ local function createOptions(id, data)
type = "toggle",
width = WeakAuras.normalWidth,
name = L["Tooltip on Mouseover"],
hidden = function() return not WeakAuras.CanHaveTooltip(data) end,
hidden = function() return not OptionsPrivate.Private.CanHaveTooltip(data) end,
order = 6
},
iconExtraDescription = {
@@ -94,14 +94,14 @@ local function createOptions(id, data)
width = WeakAuras.doubleWidth,
order = 7,
image = function()
local collapsed = WeakAuras.IsCollapsed("icon", "icon", "iconextra", true);
local collapsed = OptionsPrivate.IsCollapsed("icon", "icon", "iconextra", true);
return collapsed and "collapsed" or "expanded"
end,
imageWidth = 15,
imageHeight = 15,
func = function(info, button)
local collapsed = WeakAuras.IsCollapsed("icon", "icon", "iconextra", true);
WeakAuras.SetCollapsed("icon", "icon", "iconextra", not collapsed);
local collapsed = OptionsPrivate.IsCollapsed("icon", "icon", "iconextra", true);
OptionsPrivate.SetCollapsed("icon", "icon", "iconextra", not collapsed);
end,
arg = {
expanderName = "icon"
@@ -183,16 +183,16 @@ local function createOptions(id, data)
width = WeakAuras.normalWidth,
name = L["Show Cooldown"],
order = 11.1,
disabled = function() return not WeakAuras.CanHaveDuration(data); end,
get = function() return WeakAuras.CanHaveDuration(data) and data.cooldown; end
disabled = function() return not OptionsPrivate.Private.CanHaveDuration(data); end,
get = function() return OptionsPrivate.Private.CanHaveDuration(data) and data.cooldown; end
},
inverse = {
type = "toggle",
width = WeakAuras.normalWidth,
name = L["Inverse"],
order = 11.2,
disabled = function() return not (WeakAuras.CanHaveDuration(data) and data.cooldown); end,
get = function() return data.inverse and WeakAuras.CanHaveDuration(data) and data.cooldown; end,
disabled = function() return not (OptionsPrivate.Private.CanHaveDuration(data) and data.cooldown); end,
get = function() return data.inverse and OptionsPrivate.Private.CanHaveDuration(data) and data.cooldown; end,
hidden = function() return not data.cooldown end
},
cooldownEdge = {
@@ -200,7 +200,7 @@ local function createOptions(id, data)
width = WeakAuras.normalWidth,
name = L["Cooldown Edge"],
order = 11.3,
disabled = function() return not WeakAuras.CanHaveDuration(data) end,
disabled = function() return not OptionsPrivate.Private.CanHaveDuration(data) end,
hidden = function() return not data.cooldown end,
},
endHeader = {
@@ -212,7 +212,7 @@ local function createOptions(id, data)
return {
icon = options,
position = WeakAuras.commonOptions.PositionOptions(id, data),
position = OptionsPrivate.commonOptions.PositionOptions(id, data),
};
end
@@ -236,7 +236,7 @@ local function modifyThumbnail(parent, frame, data)
end
if data then
local name, icon = WeakAuras.GetNameAndIcon(data);
local name, icon = OptionsPrivate.Private.GetNameAndIcon(data);
frame:SetIcon(icon)
end
end
+3 -3
View File
@@ -31,7 +31,7 @@ local function createOptions(id, data)
name = L["Choose"],
order = 2,
func = function()
WeakAuras.OpenModelPicker(data);
OptionsPrivate.OpenModelPicker(data);
end,
hidden = function() return data.modelIsUnit end
},
@@ -116,13 +116,13 @@ local function createOptions(id, data)
}
end
for k, v in pairs(WeakAuras.commonOptions.BorderOptions(id, data, nil, nil, 70)) do
for k, v in pairs(OptionsPrivate.commonOptions.BorderOptions(id, data, nil, nil, 70)) do
options[k] = v
end
return {
model = options,
position = WeakAuras.commonOptions.PositionOptions(id, data, nil, nil, nil),
position = OptionsPrivate.commonOptions.PositionOptions(id, data, nil, nil, nil),
};
end
@@ -34,7 +34,7 @@ local function createOptions(id, data)
width = WeakAuras.halfWidth,
order = 12,
func = function()
WeakAuras.OpenTexturePicker(data, data, "foregroundTexture", WeakAuras.texture_types);
OptionsPrivate.OpenTexturePicker(data, data, "foregroundTexture", OptionsPrivate.Private.texture_types);
end
},
sameTexture = {
@@ -49,7 +49,7 @@ local function createOptions(id, data)
width = WeakAuras.halfWidth,
order = 17,
func = function()
WeakAuras.OpenTexturePicker(data, data, "backgroundTexture", WeakAuras.texture_types);
OptionsPrivate.OpenTexturePicker(data, data, "backgroundTexture", OptionsPrivate.Private.texture_types);
end,
disabled = function() return data.sameTexture; end
},
@@ -70,7 +70,7 @@ local function createOptions(id, data)
width = WeakAuras.normalWidth,
name = L["Blend Mode"],
order = 20,
values = WeakAuras.blend_types
values = OptionsPrivate.Private.blend_types
},
backgroundOffset = {
type = "range",
@@ -86,7 +86,7 @@ local function createOptions(id, data)
width = WeakAuras.normalWidth,
name = L["Orientation"],
order = 35,
values = WeakAuras.orientation_with_circle_types
values = OptionsPrivate.Private.orientation_with_circle_types
},
compress = {
type = "toggle",
@@ -175,7 +175,7 @@ local function createOptions(id, data)
WeakAuras.Add(parentData);
end
end
WeakAuras.ResetMoverSizer();
OptionsPrivate.ResetMoverSizer();
end,
},
crop_y = {
@@ -198,7 +198,7 @@ local function createOptions(id, data)
WeakAuras.Add(parentData);
end
end
WeakAuras.ResetMoverSizer();
OptionsPrivate.ResetMoverSizer();
end,
},
rotation = {
@@ -250,7 +250,7 @@ local function createOptions(id, data)
name = L["Slant Mode"],
order = 55.5,
hidden = function() return not data.slanted or data.orientation == "CLOCKWISE" or data.orientation == "ANTICLOCKWISE" end,
values = WeakAuras.slant_mode
values = OptionsPrivate.Private.slant_mode
},
spacer = {
type = "header",
@@ -265,7 +265,7 @@ local function createOptions(id, data)
};
options = WeakAuras.regionPrototype.AddAdjustedDurationOptions(options, data, 57);
local overlayInfo = WeakAuras.GetOverlayInfo(data);
local overlayInfo = OptionsPrivate.Private.GetOverlayInfo(data);
if (overlayInfo and next(overlayInfo)) then
options["overlayheader"] = {
type = "header",
@@ -307,7 +307,7 @@ local function createOptions(id, data)
return {
progresstexture = options,
position = WeakAuras.commonOptions.PositionOptions(id, data),
position = OptionsPrivate.commonOptions.PositionOptions(id, data),
};
end
@@ -773,7 +773,7 @@ local templates = {
}
local function GetAnchors(data)
return WeakAuras.default_types_for_anchor
return OptionsPrivate.Private.default_types_for_anchor
end
WeakAuras.RegisterRegionOptions("progresstexture", createOptions, createIcon, L["Progress Texture"], createThumbnail, modifyThumbnail, L["Shows a texture that changes based on duration"], templates, GetAnchors);
@@ -68,7 +68,7 @@ local function createOptions(id, data)
name = L["Choose"],
order = 12,
func = function()
WeakAuras.OpenTexturePicker(data, data, "foregroundTexture", texture_types, setTextureFunc);
OptionsPrivate.OpenTexturePicker(data, data, "foregroundTexture", texture_types, setTextureFunc);
end
},
sameTexture = {
@@ -203,7 +203,7 @@ local function createOptions(id, data)
width = WeakAuras.normalWidth,
name = L["Blend Mode"],
order = 20,
values = WeakAuras.blend_types
values = OptionsPrivate.Private.blend_types
},
animationType = {
type = "select",
@@ -283,10 +283,10 @@ local function createOptions(id, data)
},
};
if WeakAuras.commonOptions then
if OptionsPrivate.commonOptions then
return {
stopmotion = options,
position = WeakAuras.commonOptions.PositionOptions(id, data, 2),
position = OptionsPrivate.commonOptions.PositionOptions(id, data, 2),
};
else
return {
+20 -20
View File
@@ -8,7 +8,7 @@ local screenWidth, screenHeight = math.ceil(GetScreenWidth() / 20) * 20, math.ce
local indentWidth = 0.15
local hiddenFontExtra = function()
return WeakAuras.IsCollapsed("text", "text", "fontflags", true)
return OptionsPrivate.IsCollapsed("text", "text", "fontflags", true)
end
local function createOptions(id, data)
@@ -19,7 +19,7 @@ local function createOptions(id, data)
type = "input",
width = WeakAuras.doubleWidth,
desc = function()
return L["Dynamic text tooltip"] .. WeakAuras.GetAdditionalProperties(data)
return L["Dynamic text tooltip"] .. OptionsPrivate.Private.GetAdditionalProperties(data)
end,
multiline = true,
name = L["Display Text"],
@@ -28,19 +28,19 @@ local function createOptions(id, data)
return data.displayText;
end,
set = function(info, v)
data.displayText = WeakAuras.ReplaceLocalizedRaidMarkers(v);
data.displayText = OptionsPrivate.Private.ReplaceLocalizedRaidMarkers(v);
WeakAuras.Add(data);
WeakAuras.ClearAndUpdateOptions(data.id)
WeakAuras.UpdateThumbnail(data);
WeakAuras.ResetMoverSizer();
OptionsPrivate.ResetMoverSizer();
end,
},
customTextUpdate = {
type = "select",
width = WeakAuras.doubleWidth,
hidden = function() return not WeakAuras.ContainsCustomPlaceHolder(data.displayText); end,
hidden = function() return not OptionsPrivate.Private.ContainsCustomPlaceHolder(data.displayText); end,
name = L["Update Custom Text On..."],
values = WeakAuras.text_check_types,
values = OptionsPrivate.Private.text_check_types,
order = 36
},
-- code editor added below
@@ -76,7 +76,7 @@ local function createOptions(id, data)
type = "execute",
control = "WeakAurasExpandSmall",
name = function()
local textFlags = WeakAuras.font_flags[data.outline]
local textFlags = OptionsPrivate.Private.font_flags[data.outline]
local color = format("%02x%02x%02x%02x",
data.shadowColor[4] * 255, data.shadowColor[1] * 255,
data.shadowColor[2] * 255, data.shadowColor[3]*255)
@@ -106,11 +106,11 @@ local function createOptions(id, data)
return secondline
end,
func = function(info, button)
local collapsed = WeakAuras.IsCollapsed("text", "text", "fontflags", true)
WeakAuras.SetCollapsed("text", "text", "fontflags", not collapsed)
local collapsed = OptionsPrivate.IsCollapsed("text", "text", "fontflags", true)
OptionsPrivate.SetCollapsed("text", "text", "fontflags", not collapsed)
end,
image = function()
local collapsed = WeakAuras.IsCollapsed("text", "text", "fontflags", true)
local collapsed = OptionsPrivate.IsCollapsed("text", "text", "fontflags", true)
return collapsed and "collapsed" or "expanded"
end,
imageWidth = 15,
@@ -132,7 +132,7 @@ local function createOptions(id, data)
width = WeakAuras.normalWidth - indentWidth,
name = L["Outline"],
order = 48.2,
values = WeakAuras.font_flags,
values = OptionsPrivate.Private.font_flags,
hidden = hiddenFontExtra
},
shadowColor = {
@@ -184,7 +184,7 @@ local function createOptions(id, data)
width = WeakAuras.normalWidth - indentWidth,
name = L["Justify"],
order = 48.8,
values = WeakAuras.justify_types,
values = OptionsPrivate.Private.justify_types,
hidden = hiddenFontExtra,
},
text_font_space55 = {
@@ -207,7 +207,7 @@ local function createOptions(id, data)
width = WeakAuras.normalWidth - indentWidth,
name = L["Width"],
order = 49,
values = WeakAuras.text_automatic_width,
values = OptionsPrivate.Private.text_automatic_width,
hidden = hiddenFontExtra,
},
fixedWidth = {
@@ -232,7 +232,7 @@ local function createOptions(id, data)
width = WeakAuras.normalWidth - indentWidth,
name = L["Overflow"],
order = 49.4,
values = WeakAuras.text_word_wrap,
values = OptionsPrivate.Private.text_word_wrap,
hidden = function() return hiddenFontExtra() or data.automaticWidth ~= "Fixed" end
},
@@ -254,17 +254,17 @@ local function createOptions(id, data)
},
};
WeakAuras.commonOptions.AddCodeOption(options, data, L["Custom Function"], "customText", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#custom-text",
37, function() return not WeakAuras.ContainsCustomPlaceHolder(data.displayText) end, {"customText"}, false);
OptionsPrivate.commonOptions.AddCodeOption(options, data, L["Custom Function"], "customText", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#custom-text",
37, function() return not OptionsPrivate.Private.ContainsCustomPlaceHolder(data.displayText) end, {"customText"}, false);
-- Add Text Format Options
local input = data.displayText
local hidden = function()
return WeakAuras.IsCollapsed("format_option", "text", "displayText", true)
return OptionsPrivate.IsCollapsed("format_option", "text", "displayText", true)
end
local setHidden = function(hidden)
WeakAuras.SetCollapsed("format_option", "text", "displayText", hidden)
OptionsPrivate.SetCollapsed("format_option", "text", "displayText", hidden)
end
local get = function(key)
@@ -286,7 +286,7 @@ local function createOptions(id, data)
options["displayText_format_" .. key] = option
end
WeakAuras.AddTextFormatOption(input, true, get, addOption, hidden, setHidden)
OptionsPrivate.AddTextFormatOption(input, true, get, addOption, hidden, setHidden)
addOption("footer", {
type = "description",
name = "",
@@ -296,7 +296,7 @@ local function createOptions(id, data)
return {
text = options;
position = WeakAuras.commonOptions.PositionOptions(id, data, nil, true);
position = OptionsPrivate.commonOptions.PositionOptions(id, data, nil, true);
};
end
+4 -4
View File
@@ -32,7 +32,7 @@ local function createOptions(id, data)
width = WeakAuras.halfWidth,
order = 7,
func = function()
WeakAuras.OpenTexturePicker(data, data, "texture", WeakAuras.texture_types);
OptionsPrivate.OpenTexturePicker(data, data, "texture", OptionsPrivate.Private.texture_types);
end
},
color = {
@@ -47,7 +47,7 @@ local function createOptions(id, data)
width = WeakAuras.normalWidth,
name = L["Blend Mode"],
order = 12,
values = WeakAuras.blend_types
values = OptionsPrivate.Private.blend_types
},
mirror = {
type = "toggle",
@@ -101,7 +101,7 @@ local function createOptions(id, data)
return {
texture = options,
position = WeakAuras.commonOptions.PositionOptions(id, data),
position = OptionsPrivate.commonOptions.PositionOptions(id, data),
};
end
@@ -230,7 +230,7 @@ local templates = {
}
local function GetAnchors(data)
return WeakAuras.default_types_for_anchor
return OptionsPrivate.Private.default_types_for_anchor
end
WeakAuras.RegisterRegionOptions("texture", createOptions, createIcon, L["Texture"], createThumbnail, modifyThumbnail, L["Shows a custom texture"], templates, GetAnchors);
@@ -1,4 +1,5 @@
if not WeakAuras.IsCorrectVersion() then return end
local AddonName, OptionsPrivate = ...
local SharedMedia = LibStub("LibSharedMedia-3.0");
local L = WeakAuras.L;
@@ -8,22 +9,22 @@ local function createOptions(parentData, data, index, subIndex)
__title = L["Model %s"]:format(subIndex),
__order = 1,
__up = function()
if (WeakAuras.ApplyToDataOrChildData(parentData, WeakAuras.MoveSubRegionUp, index, "subbarmodel")) then
if (OptionsPrivate.Private.ApplyToDataOrChildData(parentData, OptionsPrivate.MoveSubRegionUp, index, "subbarmodel")) then
WeakAuras.ClearAndUpdateOptions(parentData.id)
end
end,
__down = function()
if (WeakAuras.ApplyToDataOrChildData(parentData, WeakAuras.MoveSubRegionDown, index, "subbarmodel")) then
if (OptionsPrivate.Private.ApplyToDataOrChildData(parentData, OptionsPrivate.MoveSubRegionDown, index, "subbarmodel")) then
WeakAuras.ClearAndUpdateOptions(parentData.id)
end
end,
__duplicate = function()
if (WeakAuras.ApplyToDataOrChildData(parentData, WeakAuras.DuplicateSubRegion, index, "subbarmodel")) then
if (OptionsPrivate.Private.ApplyToDataOrChildData(parentData, OptionsPrivate.DuplicateSubRegion, index, "subbarmodel")) then
WeakAuras.ClearAndUpdateOptions(parentData.id)
end
end,
__delete = function()
if (WeakAuras.ApplyToDataOrChildData(parentData, WeakAuras.DeleteSubRegion, index, "subbarmodel")) then
if (OptionsPrivate.Private.ApplyToDataOrChildData(parentData, WeakAuras.DeleteSubRegion, index, "subbarmodel")) then
WeakAuras.ClearAndUpdateOptions(parentData.id)
end
end,
@@ -45,7 +46,7 @@ local function createOptions(parentData, data, index, subIndex)
name = L["Choose"],
order = 11,
func = function()
WeakAuras.OpenModelPicker(data, parentData);
OptionsPrivate.OpenModelPicker(data, parentData);
end,
},
bar_model_clip = {
+6 -5
View File
@@ -1,4 +1,5 @@
if not WeakAuras.IsCorrectVersion() then return end
local AddonName, OptionsPrivate = ...
local SharedMedia = LibStub("LibSharedMedia-3.0");
local L = WeakAuras.L;
@@ -10,22 +11,22 @@ local function createOptions(parentData, data, index, subIndex)
__title = L["Border %s"]:format(subIndex),
__order = 1,
__up = function()
if (WeakAuras.ApplyToDataOrChildData(parentData, WeakAuras.MoveSubRegionUp, index, "subborder")) then
if (OptionsPrivate.Private.ApplyToDataOrChildData(parentData, OptionsPrivate.MoveSubRegionUp, index, "subborder")) then
WeakAuras.ClearAndUpdateOptions(parentData.id)
end
end,
__down = function()
if (WeakAuras.ApplyToDataOrChildData(parentData, WeakAuras.MoveSubRegionDown, index, "subborder")) then
if (OptionsPrivate.Private.ApplyToDataOrChildData(parentData, OptionsPrivate.MoveSubRegionDown, index, "subborder")) then
WeakAuras.ClearAndUpdateOptions(parentData.id)
end
end,
__duplicate = function()
if (WeakAuras.ApplyToDataOrChildData(parentData, WeakAuras.DuplicateSubRegion, index, "subtext")) then
if (OptionsPrivate.Private.ApplyToDataOrChildData(parentData, OptionsPrivate.DuplicateSubRegion, index, "subtext")) then
WeakAuras.ClearAndUpdateOptions(parentData.id)
end
end,
__delete = function()
if (WeakAuras.ApplyToDataOrChildData(parentData, WeakAuras.DeleteSubRegion, index, "subborder")) then
if (OptionsPrivate.Private.ApplyToDataOrChildData(parentData, WeakAuras.DeleteSubRegion, index, "subborder")) then
WeakAuras.ClearAndUpdateOptions(parentData.id)
end
end,
@@ -73,7 +74,7 @@ local function createOptions(parentData, data, index, subIndex)
width = WeakAuras.normalWidth,
name = L["Border Anchor"],
order = 7,
values = WeakAuras.aurabar_anchor_areas,
values = OptionsPrivate.Private.aurabar_anchor_areas,
hidden = function() return parentData.regionType ~= "aurabar" end
}
}
+11 -10
View File
@@ -1,4 +1,5 @@
if not WeakAuras.IsCorrectVersion() then return end
local AddonName, OptionsPrivate = ...
local SharedMedia = LibStub("LibSharedMedia-3.0");
local L = WeakAuras.L;
@@ -12,29 +13,29 @@ local indentWidth = 0.15
local function createOptions(parentData, data, index, subIndex)
local hiddenGlowExtra = function()
return WeakAuras.IsCollapsed("glow", "glow", "glowextra" .. index, true);
return OptionsPrivate.IsCollapsed("glow", "glow", "glowextra" .. index, true);
end
local options = {
__title = L["Glow %s"]:format(subIndex),
__order = 1,
__up = function()
if (WeakAuras.ApplyToDataOrChildData(parentData, WeakAuras.MoveSubRegionUp, index, "subglow")) then
if (OptionsPrivate.Private.ApplyToDataOrChildData(parentData, OptionsPrivate.MoveSubRegionUp, index, "subglow")) then
WeakAuras.ClearAndUpdateOptions(parentData.id)
end
end,
__down = function()
if (WeakAuras.ApplyToDataOrChildData(parentData, WeakAuras.MoveSubRegionDown, index, "subglow")) then
if (OptionsPrivate.Private.ApplyToDataOrChildData(parentData, OptionsPrivate.MoveSubRegionDown, index, "subglow")) then
WeakAuras.ClearAndUpdateOptions(parentData.id)
end
end,
__duplicate = function()
if (WeakAuras.ApplyToDataOrChildData(parentData, WeakAuras.DuplicateSubRegion, index, "subglow")) then
if (OptionsPrivate.Private.ApplyToDataOrChildData(parentData, OptionsPrivate.DuplicateSubRegion, index, "subglow")) then
WeakAuras.ClearAndUpdateOptions(parentData.id)
end
end,
__delete = function()
if (WeakAuras.ApplyToDataOrChildData(parentData, WeakAuras.DeleteSubRegion, index, "subglow")) then
if (OptionsPrivate.Private.ApplyToDataOrChildData(parentData, WeakAuras.DeleteSubRegion, index, "subglow")) then
WeakAuras.ClearAndUpdateOptions(parentData.id)
end
end,
@@ -49,14 +50,14 @@ local function createOptions(parentData, data, index, subIndex)
width = WeakAuras.normalWidth,
name = L["Type"],
order = 2,
values = WeakAuras.glow_types,
values = OptionsPrivate.Private.glow_types,
},
glow_anchor = {
type = "select",
width = WeakAuras.normalWidth,
name = L["Glow Anchor"],
order = 3,
values = WeakAuras.aurabar_anchor_areas,
values = OptionsPrivate.Private.aurabar_anchor_areas,
hidden = function() return parentData.regionType ~= "aurabar" end
},
glowExtraDescription = {
@@ -107,14 +108,14 @@ local function createOptions(parentData, data, index, subIndex)
width = WeakAuras.doubleWidth,
order = 4,
image = function()
local collapsed = WeakAuras.IsCollapsed("glow", "glow", "glowextra" .. index, true);
local collapsed = OptionsPrivate.IsCollapsed("glow", "glow", "glowextra" .. index, true);
return collapsed and "collapsed" or "expanded"
end,
imageWidth = 15,
imageHeight = 15,
func = function(info, button)
local collapsed = WeakAuras.IsCollapsed("glow", "glow", "glowextra" .. index, true);
WeakAuras.SetCollapsed("glow", "glow", "glowextra" .. index, not collapsed);
local collapsed = OptionsPrivate.IsCollapsed("glow", "glow", "glowextra" .. index, true);
OptionsPrivate.SetCollapsed("glow", "glow", "glowextra" .. index, not collapsed);
end,
arg = {
expanderName = "glow" .. index .. "#" .. subIndex
@@ -1,4 +1,5 @@
if not WeakAuras.IsCorrectVersion() then return end
local AddonName, OptionsPrivate = ...
-- Magic constant
local deleteCondition = {}
@@ -44,7 +45,7 @@ function WeakAuras.DeleteSubRegion(data, index, regionType)
end
end
function WeakAuras.MoveSubRegionUp(data, index, regionType)
function OptionsPrivate.MoveSubRegionUp(data, index, regionType)
if not data.subRegions or index <= 1 then
return
end
@@ -63,7 +64,7 @@ function WeakAuras.MoveSubRegionUp(data, index, regionType)
end
end
function WeakAuras.MoveSubRegionDown(data, index, regionType)
function OptionsPrivate.MoveSubRegionDown(data, index, regionType)
if not data.subRegions then
return
end
@@ -82,7 +83,7 @@ function WeakAuras.MoveSubRegionDown(data, index, regionType)
end
end
function WeakAuras.DuplicateSubRegion(data, index, regionType)
function OptionsPrivate.DuplicateSubRegion(data, index, regionType)
if not data.subRegions then
return
end
+29 -28
View File
@@ -1,4 +1,5 @@
if not WeakAuras.IsCorrectVersion() then return end
local AddonName, OptionsPrivate = ...
local SharedMedia = LibStub("LibSharedMedia-3.0")
local L = WeakAuras.L
@@ -22,7 +23,7 @@ local function createOptions(parentData, data, index, subIndex)
-- The toggles for font flags is intentionally not keyed on the id
-- So that all auras share the state of that toggle
local hiddenFontExtra = function()
return WeakAuras.IsCollapsed("subtext", "subtext", "fontflags" .. index, true)
return OptionsPrivate.IsCollapsed("subtext", "subtext", "fontflags" .. index, true)
end
local indentWidth = 0.15
@@ -31,22 +32,22 @@ local function createOptions(parentData, data, index, subIndex)
__title = L["Text %s"]:format(subIndex),
__order = 1,
__up = function()
if (WeakAuras.ApplyToDataOrChildData(parentData, WeakAuras.MoveSubRegionUp, index, "subtext")) then
if (OptionsPrivate.Private.ApplyToDataOrChildData(parentData, OptionsPrivate.MoveSubRegionUp, index, "subtext")) then
WeakAuras.ClearAndUpdateOptions(parentData.id)
end
end,
__down = function()
if (WeakAuras.ApplyToDataOrChildData(parentData, WeakAuras.MoveSubRegionDown, index, "subtext")) then
if (OptionsPrivate.Private.ApplyToDataOrChildData(parentData, OptionsPrivate.MoveSubRegionDown, index, "subtext")) then
WeakAuras.ClearAndUpdateOptions(parentData.id)
end
end,
__duplicate = function()
if (WeakAuras.ApplyToDataOrChildData(parentData, WeakAuras.DuplicateSubRegion, index, "subtext")) then
if (OptionsPrivate.Private.ApplyToDataOrChildData(parentData, OptionsPrivate.DuplicateSubRegion, index, "subtext")) then
WeakAuras.ClearAndUpdateOptions(parentData.id)
end
end,
__delete = function()
if (WeakAuras.ApplyToDataOrChildData(parentData, WeakAuras.DeleteSubRegion, index, "subtext")) then
if (OptionsPrivate.Private.ApplyToDataOrChildData(parentData, WeakAuras.DeleteSubRegion, index, "subtext")) then
WeakAuras.ClearAndUpdateOptions(parentData.id)
end
end,
@@ -67,12 +68,12 @@ local function createOptions(parentData, data, index, subIndex)
type = "input",
width = WeakAuras.normalWidth,
desc = function()
return L["Dynamic text tooltip"] .. WeakAuras.GetAdditionalProperties(parentData)
return L["Dynamic text tooltip"] .. OptionsPrivate.Private.GetAdditionalProperties(parentData)
end,
name = L["Display Text"],
order = 11,
set = function(info, v)
data.text_text = WeakAuras.ReplaceLocalizedRaidMarkers(v)
data.text_text = OptionsPrivate.Private.ReplaceLocalizedRaidMarkers(v)
WeakAuras.Add(parentData)
WeakAuras.ClearAndUpdateOptions(parentData.id)
end
@@ -98,7 +99,7 @@ local function createOptions(parentData, data, index, subIndex)
type = "execute",
control = "WeakAurasExpandSmall",
name = function()
local textFlags = WeakAuras.font_flags[data.text_fontType]
local textFlags = OptionsPrivate.Private.font_flags[data.text_fontType]
local color = format("%02x%02x%02x%02x",
data.text_shadowColor[4] * 255, data.text_shadowColor[1] * 255,
data.text_shadowColor[2] * 255, data.text_shadowColor[3]*255)
@@ -130,11 +131,11 @@ local function createOptions(parentData, data, index, subIndex)
width = WeakAuras.doubleWidth,
order = 44,
func = function(info, button)
local collapsed = WeakAuras.IsCollapsed("subtext", "subtext", "fontflags" .. index, true)
WeakAuras.SetCollapsed("subtext", "subtext", "fontflags" .. index, not collapsed)
local collapsed = OptionsPrivate.IsCollapsed("subtext", "subtext", "fontflags" .. index, true)
OptionsPrivate.SetCollapsed("subtext", "subtext", "fontflags" .. index, not collapsed)
end,
image = function()
local collapsed = WeakAuras.IsCollapsed("subtext", "subtext", "fontflags" .. index, true)
local collapsed = OptionsPrivate.IsCollapsed("subtext", "subtext", "fontflags" .. index, true)
return collapsed and "collapsed" or "expanded"
end,
imageWidth = 15,
@@ -157,7 +158,7 @@ local function createOptions(parentData, data, index, subIndex)
width = WeakAuras.normalWidth - indentWidth,
name = L["Outline"],
order = 46,
values = WeakAuras.font_flags,
values = OptionsPrivate.Private.font_flags,
hidden = hiddenFontExtra
},
text_shadowColor = {
@@ -208,7 +209,7 @@ local function createOptions(parentData, data, index, subIndex)
type = "select",
width = WeakAuras.normalWidth - indentWidth,
name = L["Alignment"],
values = WeakAuras.justify_types,
values = OptionsPrivate.Private.justify_types,
order = 50,
hidden = hiddenFontExtra
},
@@ -224,7 +225,7 @@ local function createOptions(parentData, data, index, subIndex)
width = WeakAuras.normalWidth - indentWidth,
name = L["Width"],
order = 51.5,
values = WeakAuras.text_automatic_width,
values = OptionsPrivate.Private.text_automatic_width,
hidden = hiddenFontExtra
},
text_font_space6 = {
@@ -256,7 +257,7 @@ local function createOptions(parentData, data, index, subIndex)
width = WeakAuras.normalWidth,
name = L["Overflow"],
order = 54,
values = WeakAuras.text_word_wrap,
values = OptionsPrivate.Private.text_word_wrap,
hidden = function() return hiddenFontExtra() or data.text_automaticWidth ~= "Fixed" end
},
@@ -282,10 +283,10 @@ local function createOptions(parentData, data, index, subIndex)
anchors = {}
for index, childId in ipairs(parentData.controlledChildren) do
local childData = WeakAuras.GetData(childId)
WeakAuras.Mixin(anchors, WeakAuras.GetAnchorsForData(childData, "point"))
WeakAuras.Mixin(anchors, OptionsPrivate.Private.GetAnchorsForData(childData, "point"))
end
else
anchors = WeakAuras.GetAnchorsForData(parentData, "point")
anchors = OptionsPrivate.Private.GetAnchorsForData(parentData, "point")
end
-- Anchor Options
options.text_anchorsDescription = {
@@ -319,14 +320,14 @@ local function createOptions(parentData, data, index, subIndex)
width = WeakAuras.doubleWidth,
order = 60,
image = function()
local collapsed = WeakAuras.IsCollapsed("subregion", "text_anchors", tostring(index), true)
local collapsed = OptionsPrivate.IsCollapsed("subregion", "text_anchors", tostring(index), true)
return collapsed and "collapsed" or "expanded"
end,
imageWidth = 15,
imageHeight = 15,
func = function(info, button)
local collapsed = WeakAuras.IsCollapsed("subregion", "text_anchors", tostring(index), true)
WeakAuras.SetCollapsed("subregion", "text_anchors", tostring(index), not collapsed)
local collapsed = OptionsPrivate.IsCollapsed("subregion", "text_anchors", tostring(index), true)
OptionsPrivate.SetCollapsed("subregion", "text_anchors", tostring(index), not collapsed)
end,
arg = {
expanderName = "subtext_anchor" .. index .. "#" .. subIndex
@@ -335,7 +336,7 @@ local function createOptions(parentData, data, index, subIndex)
local hiddenFunction = function()
return WeakAuras.IsCollapsed("subregion", "text_anchors", tostring(index), true)
return OptionsPrivate.IsCollapsed("subregion", "text_anchors", tostring(index), true)
end
options.text_anchor_space = {
@@ -414,7 +415,7 @@ local function createOptions(parentData, data, index, subIndex)
end
for index, subRegion in ipairs(parentData.subRegions) do
if subRegion.type == "subtext" and WeakAuras.ContainsCustomPlaceHolder(subRegion.text_text) then
if subRegion.type == "subtext" and OptionsPrivate.Private.ContainsCustomPlaceHolder(subRegion.text_text) then
return false
end
end
@@ -429,7 +430,7 @@ local function createOptions(parentData, data, index, subIndex)
width = WeakAuras.doubleWidth,
hidden = hideCustomTextOption,
name = L["Update Custom Text On..."],
values = WeakAuras.text_check_types,
values = OptionsPrivate.Private.text_check_types,
order = 3,
get = function() return parentData.customTextUpdate or "event" end,
set = function(info, v)
@@ -440,16 +441,16 @@ local function createOptions(parentData, data, index, subIndex)
},
}
WeakAuras.commonOptions.AddCodeOption(commonTextOptions, parentData, L["Custom Function"], "customText", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#custom-text",
OptionsPrivate.commonOptions.AddCodeOption(commonTextOptions, parentData, L["Custom Function"], "customText", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#custom-text",
4, hideCustomTextOption, {"customText"}, false)
-- Add Text Format Options
local hidden = function()
return WeakAuras.IsCollapsed("format_option", "text", "text_text", true)
return OptionsPrivate.IsCollapsed("format_option", "text", "text_text", true)
end
local setHidden = function(hidden)
WeakAuras.SetCollapsed("format_option", "text", "text_text", hidden)
OptionsPrivate.SetCollapsed("format_option", "text", "text_text", hidden)
end
local order = 12
@@ -478,7 +479,7 @@ local function createOptions(parentData, data, index, subIndex)
return childData["text_text_format_" .. key]
end
local input = childData["text_text"]
WeakAuras.AddTextFormatOption(input, true, get, addOption, hidden, setHidden)
OptionsPrivate.AddTextFormatOption(input, true, get, addOption, hidden, setHidden)
end
end
end
@@ -487,7 +488,7 @@ local function createOptions(parentData, data, index, subIndex)
return data["text_text_format_" .. key]
end
local input = data["text_text"]
WeakAuras.AddTextFormatOption(input, true, get, addOption, hidden, setHidden)
OptionsPrivate.AddTextFormatOption(input, true, get, addOption, hidden, setHidden)
end
addOption("footer", {
+17 -16
View File
@@ -1,4 +1,5 @@
if not WeakAuras.IsCorrectVersion() then return end
local AddonName, OptionsPrivate = ...
local SharedMedia = LibStub("LibSharedMedia-3.0");
local L = WeakAuras.L;
@@ -7,29 +8,29 @@ local indentWidth = WeakAuras.normalWidth * 0.06
local function createOptions(parentData, data, index, subIndex)
local hiddentickextras = function()
return WeakAuras.IsCollapsed("subtext", "subtext", "tickextras" .. index, true)
return OptionsPrivate.IsCollapsed("subtext", "subtext", "tickextras" .. index, true)
end
local options = {
__title = L["Tick %s"]:format(subIndex),
__order = 1,
__up = function()
if (WeakAuras.ApplyToDataOrChildData(parentData, WeakAuras.MoveSubRegionUp, index, "subtick")) then
WeakAuras.ReloadOptions2(parentData.id, parentData)
if (OptionsPrivate.Private.ApplyToDataOrChildData(parentData, OptionsPrivate.MoveSubRegionUp, index, "subtick")) then
WeakAuras.ClearAndUpdateOptions(parentData.id)
end
end,
__down = function()
if (WeakAuras.ApplyToDataOrChildData(parentData, WeakAuras.MoveSubRegionDown, index, "subtick")) then
WeakAuras.ReloadOptions2(parentData.id, parentData)
if (OptionsPrivate.Private.ApplyToDataOrChildData(parentData, OptionsPrivate.MoveSubRegionDown, index, "subtick")) then
WeakAuras.ClearAndUpdateOptions(parentData.id)
end
end,
__duplicate = function()
if (WeakAuras.ApplyToDataOrChildData(parentData, WeakAuras.DuplicateSubRegion, index, "subtick")) then
WeakAuras.ReloadOptions2(parentData.id, parentData)
if (OptionsPrivate.Private.ApplyToDataOrChildData(parentData, OptionsPrivate.DuplicateSubRegion, index, "subtick")) then
WeakAuras.ClearAndUpdateOptions(parentData.id)
end
end,
__delete = function()
if (WeakAuras.ApplyToDataOrChildData(parentData, WeakAuras.DeleteSubRegion, index, "subtick")) then
WeakAuras.ReloadOptions2(parentData.id, parentData)
if (OptionsPrivate.Private.ApplyToDataOrChildData(parentData, WeakAuras.DeleteSubRegion, index, "subtick")) then
WeakAuras.ClearAndUpdateOptions(parentData.id)
end
end,
tick_visible = {
@@ -50,7 +51,7 @@ local function createOptions(parentData, data, index, subIndex)
width = WeakAuras.normalWidth,
name = L["Tick Mode"],
order = 3,
values = WeakAuras.tick_placement_modes,
values = OptionsPrivate.Private.tick_placement_modes,
},
tick_placement = {
type = "input",
@@ -83,7 +84,7 @@ local function createOptions(parentData, data, index, subIndex)
local texturetext = ""
if data.use_texture then
local desaturatetext = data.tick_desaturate and L["|cFFFF0000desaturated|r "] or ""
local blendtext = WeakAuras.blend_types[data.tick_blend_mode]
local blendtext = OptionsPrivate.Private.blend_types[data.tick_blend_mode]
local rotationtext = data.tick_rotation ~= 0 and L[" rotated |cFFFF0000%s|r degrees"]:format(data.tick_rotation) or ""
local mirrortext = data.tick_mirror and L[" and |cFFFF0000mirrored|r"] or ""
texturetext = L["%s|cFFFF0000custom|r texture with |cFFFF0000%s|r blend mode%s%s"]:format(desaturatetext, blendtext, rotationtext, mirrortext)
@@ -103,11 +104,11 @@ local function createOptions(parentData, data, index, subIndex)
width = WeakAuras.doubleWidth,
order = 6,
func = function(info, button)
local collapsed = WeakAuras.IsCollapsed("subtext", "subtext", "tickextras" .. index, true)
WeakAuras.SetCollapsed("subtext", "subtext", "tickextras" .. index, not collapsed)
local collapsed = OptionsPrivate.IsCollapsed("subtext", "subtext", "tickextras" .. index, true)
OptionsPrivate.SetCollapsed("subtext", "subtext", "tickextras" .. index, not collapsed)
end,
image = function()
local collapsed = WeakAuras.IsCollapsed("subtext", "subtext", "tickextras" .. index, true)
local collapsed = OptionsPrivate.IsCollapsed("subtext", "subtext", "tickextras" .. index, true)
return collapsed and "collapsed" or "expanded"
end,
imageWidth = 15,
@@ -147,7 +148,7 @@ local function createOptions(parentData, data, index, subIndex)
width = WeakAuras.normalWidth,
name = L["Blend Mode"],
order = 10,
values = WeakAuras.blend_types,
values = OptionsPrivate.Private.blend_types,
disabled = function() return not data.use_texture end,
hidden = hiddentickextras,
},
@@ -172,7 +173,7 @@ local function createOptions(parentData, data, index, subIndex)
width = WeakAuras.normalWidth,
order = 13,
func = function()
WeakAuras.OpenTexturePicker(data, "tick_texture", WeakAuras.texture_types);
OptionsPrivate.OpenTexturePicker(data, "tick_texture", OptionsPrivate.Private.texture_types);
end,
disabled = function() return not data.use_texture end,
hidden = hiddentickextras,
+21 -22
View File
@@ -3,20 +3,19 @@ local AddonName, OptionsPrivate = ...
local L = WeakAuras.L
local removeFuncs = WeakAuras.commonOptions.removeFuncs
local replaceNameDescFuncs = WeakAuras.commonOptions.replaceNameDescFuncs
local replaceImageFuncs = WeakAuras.commonOptions.replaceImageFuncs
local replaceValuesFuncs = WeakAuras.commonOptions.replaceValuesFuncs
local disabledAll = WeakAuras.commonOptions.CreateDisabledAll("trigger")
local hiddenAll = WeakAuras.commonOptions.CreateHiddenAll("trigger")
local getAll = WeakAuras.commonOptions.CreateGetAll("trigger")
local setAll = WeakAuras.commonOptions.CreateSetAll("trigger", getAll)
local executeAll = WeakAuras.commonOptions.CreateExecuteAll("trigger")
local removeFuncs = OptionsPrivate.commonOptions.removeFuncs
local replaceNameDescFuncs = OptionsPrivate.commonOptions.replaceNameDescFuncs
local replaceImageFuncs = OptionsPrivate.commonOptions.replaceImageFuncs
local replaceValuesFuncs = OptionsPrivate.commonOptions.replaceValuesFuncs
local disabledAll = OptionsPrivate.commonOptions.CreateDisabledAll("trigger")
local hiddenAll = OptionsPrivate.commonOptions.CreateHiddenAll("trigger")
local getAll = OptionsPrivate.commonOptions.CreateGetAll("trigger")
local setAll = OptionsPrivate.commonOptions.CreateSetAll("trigger", getAll)
local executeAll = OptionsPrivate.commonOptions.CreateExecuteAll("trigger")
local flattenRegionOptions = WeakAuras.commonOptions.flattenRegionOptions
local fixMetaOrders = WeakAuras.commonOptions.fixMetaOrders
local flattenRegionOptions = OptionsPrivate.commonOptions.flattenRegionOptions
local fixMetaOrders = OptionsPrivate.commonOptions.fixMetaOrders
local subevent_actual_prefix_types = WeakAuras.subevent_actual_prefix_types;
local spellCache = WeakAuras.spellCache
local function union(table1, table2)
@@ -43,9 +42,9 @@ local function GetGlobalOptions(data)
order = 2,
values = function()
if #data.triggers > 1 then
return WeakAuras.trigger_require_types;
return OptionsPrivate.Private.trigger_require_types;
else
return WeakAuras.trigger_require_types_one;
return OptionsPrivate.Private.trigger_require_types_one;
end
end,
get = function()
@@ -68,14 +67,14 @@ local function GetGlobalOptions(data)
order = 2.3,
values = function()
local vals = {};
vals[WeakAuras.trigger_modes.first_active] = L["Dynamic information from first active trigger"];
vals[OptionsPrivate.Private.trigger_modes.first_active] = L["Dynamic information from first active trigger"];
for i = 1, #data.triggers do
vals[i] = L["Dynamic information from Trigger %i"]:format(i);
end
return vals;
end,
get = function()
return data.triggers.activeTriggerMode or WeakAuras.trigger_modes.first_active;
return data.triggers.activeTriggerMode or OptionsPrivate.Private.trigger_modes.first_active;
end,
set = function(info, v)
data.triggers.activeTriggerMode = v;
@@ -90,7 +89,7 @@ local function GetGlobalOptions(data)
local function hideTriggerCombiner()
return not (data.triggers.disjunctive == "custom")
end
WeakAuras.commonOptions.AddCodeOption(globalTriggerOptions, data, L["Custom"], "custom_trigger_combination", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#custom-activation",
OptionsPrivate.commonOptions.AddCodeOption(globalTriggerOptions, data, L["Custom"], "custom_trigger_combination", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#custom-activation",
2.4, hideTriggerCombiner, {"triggers", "customTriggerLogic"}, false);
return {
@@ -103,13 +102,13 @@ local function AddOptions(allOptions, data)
local triggerOptions = {}
for index, trigger in ipairs(data.triggers) do
local triggerSystemOptionsFunction = trigger.trigger.type and WeakAuras.triggerTypesOptions[trigger.trigger.type]
local triggerSystemOptionsFunction = trigger.trigger.type and OptionsPrivate.Private.triggerTypesOptions[trigger.trigger.type]
if (triggerSystemOptionsFunction) then
triggerOptions = union(triggerOptions, triggerSystemOptionsFunction(data, index))
else
local options = {};
WeakAuras.commonOptions.AddCommonTriggerOptions(options, data, index)
WeakAuras.AddTriggerMetaFunctions(options, data, index)
OptionsPrivate.commonOptions.AddCommonTriggerOptions(options, data, index)
OptionsPrivate.AddTriggerMetaFunctions(options, data, index)
triggerOptions = union(triggerOptions, {
["trigger." .. index .. ".unknown"] = options
})
@@ -119,7 +118,7 @@ local function AddOptions(allOptions, data)
return union(allOptions, triggerOptions)
end
function WeakAuras.GetTriggerOptions(data)
function OptionsPrivate.GetTriggerOptions(data)
local allOptions = {}
if data.controlledChildren then
for index, childId in pairs(data.controlledChildren) do
@@ -223,7 +222,7 @@ local function moveTriggerDownImpl(data, i)
return true;
end
function WeakAuras.AddTriggerMetaFunctions(options, data, triggernum)
function OptionsPrivate.AddTriggerMetaFunctions(options, data, triggernum)
options.__title = L["Trigger %s"]:format(triggernum)
options.__order = triggernum * 10
options.__add = function()
File diff suppressed because it is too large Load Diff