from retail

This commit is contained in:
Bunny67
2020-07-11 00:19:17 +03:00
parent bbb4ac1c37
commit 6a7003b535
27 changed files with 2317 additions and 647 deletions
+65 -11
View File
@@ -190,7 +190,8 @@ function TestForMultiSelect(trigger, arg)
end
function ConstructTest(trigger, arg)
local test;
local test
local preamble
local name = arg.name;
if(arg.hidden or arg.type == "tristate" or arg.type == "toggle" or (arg.type == "multiselect" and trigger["use_"..name] ~= nil) or ((trigger["use_"..name] or arg.required) and trigger[name])) then
local number = tonumber(trigger[name]);
@@ -215,11 +216,15 @@ function ConstructTest(trigger, arg)
end
end
if (test == "(true)") then
return nil;
if arg.preamble then
preamble = arg.preamble:format(trigger[name] or "")
end
return test;
if (test == "(true)") then
return nil, preamble
end
return test, preamble
end
function ConstructFunction(prototype, trigger, inverse)
@@ -243,6 +248,7 @@ function ConstructFunction(prototype, trigger, inverse)
local debug = {};
local store = {};
local init;
local preambles = ""
if(prototype.init) then
init = prototype.init(trigger);
else
@@ -268,7 +274,7 @@ function ConstructFunction(prototype, trigger, inverse)
if (arg.store) then
tinsert(store, name);
end
local test = ConstructTest(trigger, arg);
local test, preamble = ConstructTest(trigger, arg);
if (test) then
if(arg.required) then
tinsert(required, test);
@@ -279,10 +285,13 @@ function ConstructFunction(prototype, trigger, inverse)
tinsert(debug, arg.debug:format(trigger[name]));
end
end
if (preamble) then
preambles = preambles .. "\n" .. preamble
end
end
end
end
local ret = "return function("..tconcat(input, ", ")..")\n";
local ret = preambles .. "return function("..tconcat(input, ", ")..")\n";
ret = ret..(init or "");
ret = ret..(#debug > 0 and tconcat(debug, "\n") or "");
@@ -558,6 +567,13 @@ local function RunTriggerFunc(allStates, data, id, triggernum, event, arg1, arg2
untriggerCheck = true;
end
elseif (data.statesParameter == "unit") then
if optionsEvent then
if WeakAuras.multiUnitUnits[data.trigger.unit] then
arg1 = next(WeakAuras.multiUnitUnits[data.trigger.unit])
else
arg1 = data.trigger.unit
end
end
if arg1 then
local unit, cloneId
if WeakAuras.multiUnitUnits[data.trigger.unit] then
@@ -2501,7 +2517,7 @@ end
local watchUnitChange
-- Nameplates only distinguish between friends and everyone else
function WeakAuras.GetPlayerReaciton(unit)
function WeakAuras.GetPlayerReaction(unit)
return UnitIsEnemy('player', unit) and 'hostile' or 'friendly'
end
@@ -3644,16 +3660,17 @@ function GenericTrigger.GetTriggerConditions(data, triggernum)
end
end
end
if (v.conditionPreamble) then
result[v.name].preamble = v.conditionPreamble;
end
if (v.conditionTest) then
result[v.name].test = v.conditionTest;
end
if (v.conditionEvents) then
result[v.name].events = v.conditionEvents;
end
if (v.operator_types_without_equal) then
result[v.name].operator_types_without_equal = true;
elseif (v.operator_types_only_equal) then
result[v.name].operator_types_only_equal = true;
if (v.operator_types) then
result[v.name].operator_types = v.operator_types;
end
end
end
@@ -3861,6 +3878,43 @@ function GenericTrigger.GetTriggerDescription(data, triggernum, namestable)
end
end
do
-- Based on Code by DejaCharacterStats. Ugly code to figure out the GCD
local GetCombatRatingBonus = GetCombatRatingBonus
local CR_HASTE_MELEE = CR_HASTE_MELEE
local CR_HASTE_RANGED = CR_HASTE_RANGED
local CR_HASTE_SPELL = CR_HASTE_SPELL
local class = select(2, UnitClass("player"))
if class == "DRUID" then
function WeakAuras.CalculatedGcdDuration()
local id = GetShapeshiftFormID()
local haste = GetHaste()
return id == 1 and 1 or max(0.75, 1.5 * 100 / (100 + GetCombatRatingBonus(CR_HASTE_SPELL)))
end
elseif class == "ROGUE" then
function WeakAuras.CalculatedGcdDuration()
return 1
end
else
local GetHaste
if class == "HUNTER" then
function GetHaste()
return GetCombatRatingBonus(CR_HASTE_RANGED)
end
elseif class == "DEATHKNIGHT" or class == "PALADIN" or class == "WARRIOR" then
function GetHaste()
return GetCombatRatingBonus(CR_HASTE_MELEE)
end
else
function GetHaste()
return GetCombatRatingBonus(CR_HASTE_SPELL)
end
end
function WeakAuras.CalculatedGcdDuration()
return max(0.75, 1.5 * 100 / (100 + GetHaste()))
end
end
end
WeakAuras.RegisterTriggerSystem({"event", "status", "custom"}, GenericTrigger);