correct the conditions and spell known prototype

This commit is contained in:
Bunny67
2020-06-03 20:48:23 +03:00
parent a8e5f5b975
commit 6f83c0121f
+14 -38
View File
@@ -5382,7 +5382,7 @@ WeakAuras.event_prototypes = {
tinsert(events, "PLAYER_ENTERING_WORLD") tinsert(events, "PLAYER_ENTERING_WORLD")
end end
if trigger.use_mounted ~= nil then if trigger.use_mounted ~= nil then
tinsert(events, "PLAYER_MOUNT_DISPLAY_CHANGED") tinsert(events, "COMPANION_UPDATE")
tinsert(events, "PLAYER_ENTERING_WORLD") tinsert(events, "PLAYER_ENTERING_WORLD")
end end
local unit_events = {} local unit_events = {}
@@ -5424,10 +5424,6 @@ WeakAuras.event_prototypes = {
internal_events = function(trigger, untrigger) internal_events = function(trigger, untrigger)
local events = { "CONDITIONS_CHECK"}; local events = { "CONDITIONS_CHECK"};
if (trigger.use_ismoving ~= nil) then
tinsert(events, "PLAYER_MOVING_UPDATE");
end
if (trigger.use_HasPet ~= nil) then if (trigger.use_HasPet ~= nil) then
AddUnitChangeInternalEvents("pet", events) AddUnitChangeInternalEvents("pet", events)
end end
@@ -5436,11 +5432,6 @@ WeakAuras.event_prototypes = {
end, end,
force_events = "CONDITIONS_CHECK", force_events = "CONDITIONS_CHECK",
name = L["Conditions"], name = L["Conditions"],
loadFunc = function(trigger)
if (trigger.use_ismoving ~= nil) then
WeakAuras.WatchForPlayerMoving();
end
end,
init = function(trigger) init = function(trigger)
return ""; return "";
end, end,
@@ -5493,12 +5484,6 @@ WeakAuras.event_prototypes = {
type = "tristate", type = "tristate",
init = "UnitExists('pet') and not UnitIsDead('pet')" init = "UnitExists('pet') and not UnitIsDead('pet')"
}, },
--{
-- name = "ismoving",
-- display = L["Is Moving"],
-- type = "tristate",
-- init = "IsPlayerMoving()"
--},
{ {
name = "ingroup", name = "ingroup",
display = L["In Group"], display = L["In Group"],
@@ -5543,31 +5528,22 @@ WeakAuras.event_prototypes = {
force_events = "SPELLS_CHANGED", force_events = "SPELLS_CHANGED",
name = L["Spell Known"], name = L["Spell Known"],
init = function(trigger) init = function(trigger)
local spellName; local spellId = trigger.spellId or "";
if (trigger.use_exact_spellName) then local ret = [[
spellName = trigger.spellName or ""; local spellId = tonumber(%q);
local ret = [[ local usePet = %s;
local spellName = tonumber(%q); ]]
local usePet = %s; return ret:format(spellId, trigger.use_petspell and "true" or "false");
]]
return ret:format(spellName, trigger.use_petspell and "true" or "false");
else
local name = type(trigger.spellName) == "number" and GetSpellInfo(trigger.spellName) or trigger.spellName or "";
local ret = [[
local spellName = select(7, GetSpellInfo(%q));
local usePet = %s;
]]
return ret:format(name, trigger.use_petspell and "true" or "false");
end
end, end,
args = { args = {
{ {
name = "spellName", name = "spellId",
required = true, required = true,
display = L["Spell"], display = L["Spell Id"],
type = "spell", type = "spell",
test = "true", test = "true",
showExactOption = true, conditionType = "number",
forceExactOption = true
}, },
{ {
name = "petspell", name = "petspell",
@@ -5577,14 +5553,14 @@ WeakAuras.event_prototypes = {
}, },
{ {
hidden = true, hidden = true,
test = "spellName and WeakAuras.IsSpellKnown(spellName, usePet)"; test = "spellId and WeakAuras.IsSpellKnown(spellId, usePet)";
} }
}, },
nameFunc = function(trigger) nameFunc = function(trigger)
return GetSpellInfo(trigger.spellName or 0) return GetSpellInfo(trigger.spellId or 0)
end, end,
iconFunc = function(trigger) iconFunc = function(trigger)
local _, _, icon = GetSpellInfo(trigger.spellName or 0); local _, _, icon = GetSpellInfo(trigger.spellId or 0);
return icon; return icon;
end, end,
automaticrequired = true automaticrequired = true