This commit is contained in:
Bunny67
2020-09-22 17:50:02 +03:00
parent e455eaa4a9
commit ce5da4dc3e
17 changed files with 357 additions and 197 deletions
-1
View File
@@ -302,7 +302,6 @@ local FakeWeakAurasMixin = {
AddManyFromAddons = true,
Delete = true,
DeleteOption = true,
GetData = true,
HideOptions = true,
Rename = true,
NewAura = true,
+3 -2
View File
@@ -536,7 +536,7 @@ end
local function RunTriggerFunc(allStates, data, id, triggernum, event, arg1, arg2, ...)
local optionsEvent = event == "OPTIONS";
local errorHandler = optionsEvent and ignoreErrorHandler or geterrorhandler()
local errorHandler = (optionsEvent and data.ignoreOptionsEventErrors) and ignoreErrorHandler or geterrorhandler()
local updateTriggerState = false;
if(data.triggerFunc) then
local untriggerCheck = false;
@@ -1376,7 +1376,8 @@ function GenericTrigger.Add(data, region)
duration = duration,
automaticAutoHide = automaticAutoHide,
tsuConditionVariables = tsuConditionVariables,
prototype = prototype
prototype = prototype,
ignoreOptionsEventErrors = data.ignoreOptionsEventErrors
};
end
end
+3
View File
@@ -924,6 +924,9 @@ function Private.Modernize(data)
end
end
if data.internalVersion < 36 then
data.ignoreOptionsEventErrors = true
end
data.internalVersion = max(data.internalVersion or 0, WeakAuras.InternalVersion());
end
+49 -45
View File
@@ -4178,7 +4178,7 @@ Private.event_prototypes = {
"TENCH_UPDATE",
},
force_events = "TENCH_UPDATE",
name = L["Weapon Enchant"],
name = L["Weapon Enchant / Fishing Lure"],
init = function(trigger)
WeakAuras.TenchInit();
@@ -4188,12 +4188,12 @@ Private.event_prototypes = {
local triggerStack = %s
local triggerRemaining = %s
local triggerShowOn = %q
local _, expirationTime, duration, name, stack
local expirationTime, duration, name, icon, stack
if triggerWeaponType == "main" then
expirationTime, duration, name, shortenedName, _, stack = WeakAuras.GetMHTenchInfo()
expirationTime, duration, name, shortenedName, icon, stack = WeakAuras.GetMHTenchInfo()
else
expirationTime, duration, name, shortenedName, _, stack = WeakAuras.GetOHTenchInfo()
expirationTime, duration, name, shortenedName, icon, stack = WeakAuras.GetOHTenchInfo()
end
local remaining = expirationTime and expirationTime - GetTime()
@@ -4203,6 +4203,11 @@ Private.event_prototypes = {
local remainingCheck = not triggerRemaining or remaining and remaining %s triggerRemaining
local found = expirationTime and nameCheck and stackCheck and remainingCheck
if not found then
expirationTime = nil
duration = nil
end
if(triggerRemaining and remaining and remaining >= triggerRemaining and remaining > 0) then
WeakAuras.ScheduleScan(expirationTime - triggerRemaining, "TENCH_UPDATE");
end
@@ -4238,6 +4243,42 @@ Private.event_prototypes = {
display = L["Stack Count"],
type = "number",
test = "true",
store = true
},
{
name = "duration",
hidden = true,
init = "duration",
test = "true",
store = true
},
{
name = "expirationTime",
init = "expirationTime",
hidden = true,
test = "true",
store = true
},
{
name = "progressType",
hidden = true,
init = "'timed'",
test = "true",
store = true
},
{
name = "name",
hidden = true,
init = "spell",
test = "true",
store = true
},
{
name = "icon",
hidden = true,
init = "icon or 'Interface\\AddOns\\WeakAuras\\Media\\Textures\\icon'",
test = "true",
store = true
},
{
name = "remaining",
@@ -4261,47 +4302,10 @@ Private.event_prototypes = {
"or (triggerShowOn == 'showAlways')"
}
},
durationFunc = function(trigger)
local expirationTime, duration;
if(trigger.weapon == "main") then
expirationTime, duration = WeakAuras.GetMHTenchInfo();
elseif(trigger.weapon == "off") then
expirationTime, duration = WeakAuras.GetOHTenchInfo();
end
if(expirationTime) then
return duration, expirationTime;
else
return 0, math.huge;
end
end,
nameFunc = function(trigger)
local _, name;
if(trigger.weapon == "main") then
_, _, name = WeakAuras.GetMHTenchInfo();
elseif(trigger.weapon == "off") then
_, _, name = WeakAuras.GetOHTenchInfo();
end
return name;
end,
iconFunc = function(trigger)
local _, icon;
if(trigger.weapon == "main") then
_, _, _, _, icon = WeakAuras.GetMHTenchInfo();
elseif(trigger.weapon == "off") then
_, _, _, _, icon = WeakAuras.GetOHTenchInfo();
end
return icon;
end,
stacksFunc = function(trigger)
local _, charges;
if(trigger.weapon == "main") then
_, _, _, _, _, charges = WeakAuras.GetMHTenchInfo();
elseif(trigger.weapon == "off") then
_, _, _, _, _, charges = WeakAuras.GetOHTenchInfo();
end
return charges;
end,
automaticrequired = true
automaticrequired = true,
canHaveDuration = true,
canHaveAuto = true,
statesParameter = "one"
},
["Chat Message"] = {
type = "event",
+1 -1
View File
@@ -6,7 +6,7 @@ local L = WeakAuras.L;
-- Default settings
local default = {
icon = true,
icon = false,
desaturate = false,
auto = true,
texture = "Blizzard",
+1 -1
View File
@@ -651,7 +651,7 @@ local function RegisterForFrameTick(region)
regionsForFrameTick[region] = true
if not frameForFrameTick:GetScript("OnUpdate") then
frameForFrameTick:SetScript("OnUpdate", WeakAuras.FrameTick);
frameForFrameTick:SetScript("OnUpdate", FrameTick);
end
end
+1 -1
View File
@@ -779,7 +779,7 @@ Private.text_check_types = {
}
Private.check_types = {
update = L["Every Frame"],
update = L["Every Frame (High CPU usage)"],
event = L["Event(s)"]
}
+27 -8
View File
@@ -1,6 +1,6 @@
local AddonName, Private = ...
local internalVersion = 33;
local internalVersion = 36
-- Lua APIs
local insert = table.insert
@@ -1657,6 +1657,21 @@ function Private.Convert(data, newType)
end
end
-- The default mixin doesn't recurse, this does
function WeakAuras.DeepMixin(dest, source)
local function recurse(source, dest)
for i,v in pairs(source) do
if(type(v) == "table") then
dest[i] = type(dest[i]) == "table" and dest[i] or {};
recurse(v, dest[i]);
else
dest[i] = v;
end
end
end
recurse(source, dest);
end
function WeakAuras.RegisterAddon(addon, displayName, description, icon)
if(addons[addon]) then
addons[addon].displayName = displayName;
@@ -2371,7 +2386,7 @@ local function pAdd(data, simpleChange)
if simpleChange then
db.displays[id] = data
Private.SetRegion(data)
WeakAuras.SetRegion(data)
Private.UpdatedTriggerState(id)
else
if (data.controlledChildren) then
@@ -2380,7 +2395,7 @@ local function pAdd(data, simpleChange)
Private.ClearAuraEnvironment(data.parent);
end
db.displays[id] = data;
Private.SetRegion(data);
WeakAuras.SetRegion(data);
else
local visible
if (WeakAuras.IsOptionsOpen()) then
@@ -2446,7 +2461,7 @@ local function pAdd(data, simpleChange)
timers[id] = nil;
end
local region = Private.SetRegion(data);
local region = WeakAuras.SetRegion(data);
triggerState[id] = {
disjunctive = data.triggers.disjunctive or "all",
@@ -2485,10 +2500,10 @@ function WeakAuras.Add(data, takeSnapshot, simpleChange)
end
end
function Private.SetRegion(data, cloneId)
function WeakAuras.SetRegion(data, cloneId)
local regionType = data.regionType;
if not(regionType) then
error("Improper arguments to Private.SetRegion - regionType not defined");
error("Improper arguments to WeakAuras.SetRegion - regionType not defined");
else
if(not regionTypes[regionType]) then
regionType = "fallback";
@@ -2497,7 +2512,7 @@ function Private.SetRegion(data, cloneId)
local id = data.id;
if not(id) then
error("Improper arguments to Private.SetRegion - id not defined");
error("Improper arguments to WeakAuras.SetRegion - id not defined");
else
local region;
if(cloneId) then
@@ -2585,7 +2600,7 @@ local function EnsureClone(id, cloneId)
clones[id] = clones[id] or {};
if not(clones[id][cloneId]) then
local data = WeakAuras.GetData(id);
Private.SetRegion(data, cloneId);
WeakAuras.SetRegion(data, cloneId);
clones[id][cloneId].justCreated = true;
end
return clones[id][cloneId];
@@ -4588,3 +4603,7 @@ function WeakAuras.ParseNameCheck(name)
return matches
end
function WeakAuras.IsAuraLoaded(id)
return Private.loaded[id]
end