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