from retail
This commit is contained in:
@@ -1018,7 +1018,7 @@ local function AddFakeInformation(state, eventData)
|
||||
state.duration = 7
|
||||
end
|
||||
if eventData.prototype and eventData.prototype.GetNameAndIcon then
|
||||
local name, icon = Private.event_prototypes[eventData.event].GetNameAndIcon(eventData.trigger)
|
||||
local name, icon = eventData.prototype.GetNameAndIcon(eventData.trigger)
|
||||
if state.name == nil then
|
||||
state.name = name
|
||||
end
|
||||
@@ -3523,12 +3523,18 @@ function WeakAuras.GetUniqueCloneId()
|
||||
return uniqueId;
|
||||
end
|
||||
|
||||
function GenericTrigger.GetPrototype(trigger)
|
||||
if trigger.type and trigger.event then
|
||||
if Private.category_event_prototype[trigger.type] then
|
||||
return Private.event_prototypes[trigger.event]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function GenericTrigger.CanHaveDuration(data, triggernum)
|
||||
local trigger = data.triggers[triggernum].trigger
|
||||
|
||||
if (Private.category_event_prototype[trigger.type]) then
|
||||
if trigger.event then
|
||||
local prototype = Private.event_prototypes[trigger.event]
|
||||
local prototype = GenericTrigger.GetPrototype(trigger)
|
||||
if prototype then
|
||||
if prototype.durationFunc then
|
||||
if(type(prototype.init) == "function") then
|
||||
@@ -3547,8 +3553,6 @@ function GenericTrigger.CanHaveDuration(data, triggernum)
|
||||
elseif prototype.timedrequired then
|
||||
return "timed"
|
||||
end
|
||||
end
|
||||
end
|
||||
elseif (trigger.type == "custom") then
|
||||
if trigger.custom_type == "event" and trigger.custom_hide == "timed" and trigger.duration then
|
||||
return "timed";
|
||||
@@ -3563,8 +3567,8 @@ end
|
||||
|
||||
function GenericTrigger.GetDelay(data)
|
||||
if data.event then
|
||||
local prototype = Private.event_prototypes[data.event]
|
||||
if prototype and prototype.type == data.type and prototype.delayEvents then
|
||||
local prototype = GenericTrigger.GetPrototype(data.trigger)
|
||||
if prototype and prototype.delayEvents then
|
||||
local trigger = data.trigger
|
||||
if trigger.use_delay and type(trigger.delay) == "number" and trigger.delay > 0 then
|
||||
return trigger.delay
|
||||
@@ -3587,10 +3591,11 @@ function GenericTrigger.GetOverlayInfo(data, triggernum)
|
||||
|
||||
local trigger = data.triggers[triggernum].trigger
|
||||
|
||||
if (trigger.type ~= "custom" and trigger.event and Private.event_prototypes[trigger.event] and Private.event_prototypes[trigger.event].overlayFuncs) then
|
||||
local prototype = GenericTrigger.GetPrototype(trigger)
|
||||
if (prototype and prototype.overlayFuncs) then
|
||||
result = {};
|
||||
local dest = 1;
|
||||
for i, v in ipairs(Private.event_prototypes[trigger.event].overlayFuncs) do
|
||||
for i, v in ipairs(prototype.overlayFuncs) do
|
||||
local enable = true
|
||||
if type(v.enable) == "function" then
|
||||
enable = v.enable(trigger)
|
||||
@@ -3653,17 +3658,16 @@ end
|
||||
function GenericTrigger.GetNameAndIcon(data, triggernum)
|
||||
local trigger = data.triggers[triggernum].trigger
|
||||
local icon, name
|
||||
if (Private.category_event_prototype[trigger.type]) then
|
||||
if(trigger.event and Private.event_prototypes[trigger.event]) then
|
||||
if (Private.event_prototypes[trigger.event].GetNameAndIcon) then
|
||||
return Private.event_prototypes[trigger.event].GetNameAndIcon(trigger)
|
||||
local prototype = GenericTrigger.GetPrototype(trigger)
|
||||
if prototype then
|
||||
if prototype.GetNameAndIcon then
|
||||
return prototype.GetNameAndIcon(trigger)
|
||||
else
|
||||
if(Private.event_prototypes[trigger.event].iconFunc) then
|
||||
icon = Private.event_prototypes[trigger.event].iconFunc(trigger);
|
||||
end
|
||||
if(Private.event_prototypes[trigger.event].nameFunc) then
|
||||
name = Private.event_prototypes[trigger.event].nameFunc(trigger);
|
||||
if prototype.iconFunc then
|
||||
icon = prototype.iconFunc(trigger)
|
||||
end
|
||||
if prototype.nameFunc then
|
||||
name = prototype.nameFunc(trigger)
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -3677,15 +3681,14 @@ end
|
||||
-- @return string
|
||||
function GenericTrigger.CanHaveTooltip(data, triggernum)
|
||||
local trigger = data.triggers[triggernum].trigger
|
||||
if (Private.category_event_prototype[trigger.type]) then
|
||||
if (trigger.event and Private.event_prototypes[trigger.event]) then
|
||||
if(Private.event_prototypes[trigger.event].hasSpellID) then
|
||||
local prototype = GenericTrigger.GetPrototype(trigger)
|
||||
if prototype then
|
||||
if prototype.hasSpellID then
|
||||
return "spell";
|
||||
elseif(Private.event_prototypes[trigger.event].hasItemID) then
|
||||
elseif prototype.hasItemID then
|
||||
return "item";
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if (trigger.type == "custom") then
|
||||
if (trigger.custom_type == "stateupdate") then
|
||||
@@ -3726,49 +3729,46 @@ function GenericTrigger.SetToolTip(trigger, state)
|
||||
end
|
||||
end
|
||||
|
||||
if (Private.category_event_prototype[trigger.type]) then
|
||||
if (trigger.event and Private.event_prototypes[trigger.event]) then
|
||||
if(Private.event_prototypes[trigger.event].hasSpellID) then
|
||||
local prototype = GenericTrigger.GetPrototype(trigger)
|
||||
if prototype then
|
||||
if prototype.hasSpellID then
|
||||
GameTooltip:SetSpellByID(trigger.spellName);
|
||||
return true
|
||||
elseif(Private.event_prototypes[trigger.event].hasItemID) then
|
||||
elseif prototype.hasItemID then
|
||||
GameTooltip:SetHyperlink("item:"..trigger.itemName..":0:0:0:0:0:0:0")
|
||||
return true
|
||||
end
|
||||
end
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
function GenericTrigger.GetAdditionalProperties(data, triggernum)
|
||||
local trigger = data.triggers[triggernum].trigger
|
||||
local ret = "";
|
||||
if (Private.category_event_prototype[trigger.type]) then
|
||||
if (trigger.event and Private.event_prototypes[trigger.event]) then
|
||||
local prototype = GenericTrigger.GetPrototype(trigger)
|
||||
if prototype then
|
||||
local found = false;
|
||||
local additional = ""
|
||||
for _, v in pairs(Private.event_prototypes[trigger.event].args) do
|
||||
for _, v in pairs(prototype.args) do
|
||||
local enable = true
|
||||
if(type(v.enable) == "function") then
|
||||
enable = v.enable(trigger)
|
||||
elseif type(v.enable) == "boolean" then
|
||||
enable = v.enable
|
||||
end
|
||||
|
||||
if (enable and v.store and v.name and v.display) then
|
||||
found = true;
|
||||
additional = additional .. "|cFFFF0000%".. triggernum .. "." .. v.name .. "|r - " .. v.display .. "\n";
|
||||
end
|
||||
end
|
||||
|
||||
if Private.event_prototypes[trigger.event].countEvents then
|
||||
if prototype.countEvents then
|
||||
found = true;
|
||||
additional = additional .. "|cFFFF0000%".. triggernum .. ".count|r - " .. L["Count"] .. "\n";
|
||||
end
|
||||
|
||||
if (found) then
|
||||
ret = ret .. additional;
|
||||
end
|
||||
end
|
||||
else
|
||||
if (trigger.custom_type == "stateupdate") then
|
||||
local variables = GenericTrigger.GetTsuConditionVariables(data.id, triggernum)
|
||||
@@ -3845,8 +3845,8 @@ end
|
||||
function GenericTrigger.GetTriggerConditions(data, triggernum)
|
||||
local trigger = data.triggers[triggernum].trigger
|
||||
|
||||
if (Private.category_event_prototype[trigger.type]) then
|
||||
if (trigger.event and Private.event_prototypes[trigger.event]) then
|
||||
local prototype = GenericTrigger.GetPrototype(trigger)
|
||||
if prototype then
|
||||
local result = {};
|
||||
|
||||
local canHaveDuration = GenericTrigger.CanHaveDuration(data, triggernum);
|
||||
@@ -3869,15 +3869,15 @@ function GenericTrigger.GetTriggerConditions(data, triggernum)
|
||||
result.total = commonConditions.total;
|
||||
end
|
||||
|
||||
if (Private.event_prototypes[trigger.event].stacksFunc) then
|
||||
if prototype.stacksFunc then
|
||||
result.stacks = commonConditions.stacks;
|
||||
end
|
||||
|
||||
if (Private.event_prototypes[trigger.event].nameFunc) then
|
||||
if prototype.nameFunc then
|
||||
result.name = commonConditions.name;
|
||||
end
|
||||
|
||||
for _, v in pairs(Private.event_prototypes[trigger.event].args) do
|
||||
for _, v in pairs(prototype.args) do
|
||||
if (v.conditionType and v.name and v.display) then
|
||||
local enable = true;
|
||||
if (v.enable ~= nil) then
|
||||
@@ -3920,7 +3920,7 @@ function GenericTrigger.GetTriggerConditions(data, triggernum)
|
||||
end
|
||||
end
|
||||
|
||||
if Private.event_prototypes[trigger.event].countEvents then
|
||||
if prototype.countEvents then
|
||||
result.count = {
|
||||
display = L["Count"],
|
||||
type = "number"
|
||||
@@ -3928,7 +3928,6 @@ function GenericTrigger.GetTriggerConditions(data, triggernum)
|
||||
end
|
||||
|
||||
return result;
|
||||
end
|
||||
elseif(trigger.type == "custom") then
|
||||
if (trigger.custom_type == "status" or trigger.custom_type == "event") then
|
||||
local result = {};
|
||||
@@ -4096,8 +4095,9 @@ end
|
||||
|
||||
function GenericTrigger.GetTriggerDescription(data, triggernum, namestable)
|
||||
local trigger = data.triggers[triggernum].trigger
|
||||
if (Private.category_event_prototype[trigger.type]) then
|
||||
tinsert(namestable, {L["Trigger:"], (Private.event_prototypes[trigger.event].name or L["Undefined"])});
|
||||
local prototype = GenericTrigger.GetPrototype(trigger)
|
||||
if prototype then
|
||||
tinsert(namestable, {L["Trigger:"], (prototype.name or L["Undefined"])});
|
||||
if(trigger.event == "Combat Log" and trigger.subeventPrefix and trigger.subeventSuffix) then
|
||||
tinsert(namestable, {L["Message type:"], (Private.subevent_prefix_types[trigger.subeventPrefix] or L["Undefined"]).." "..(Private.subevent_suffix_types[trigger.subeventSuffix] or L["Undefined"])});
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user