Originally Posted by
Triemer
If it is to any help of you I made a ticket about this function at wowace.com.
Sorry, by "we" I meant me and you. I don't know any of the WA authors, lol
If you want, see if this plugin works for you...
http://www.mmo-champion.com/threads/...lve-easy-steps
(Ignore the code for what should be in your .toc file)
Interface\AddOns\WeakAuras_MultipleTalentLoad\WeakAuras_MultipleTalentLoad.toc:
Code:
## Interface: 50400
## Title: WeakAuras MultipleTalentLoad
## Author: pnutbutter
## RequiredDeps: WeakAuras
## Description: Allows you to choose multiple talents that will cause a region to load
WeakAuras_MultipleTalentLoad.lua
Interface\AddOns\WeakAuras_MultipleTalentLoad\WeakAuras_MultipleTalentLoad.lua:
Code:
local tinsert,tconcat=table.insert,table.concat
do
local args=WeakAuras.load_prototype.args
for i=1,#args do
if args[i].name=="talent" then
args[i].type="multiselect"
break
end
end
end
WeakAuras.ConstructFunction = function(prototype, data, triggernum, subPrefix, subSuffix, field, inverse)
local trigger;
if(field == "load") then
trigger = data.load;
elseif(field == "untrigger") then
if(triggernum == 0) then
data.untrigger = data.untrigger or {};
trigger = data.untrigger;
else
trigger = data.additional_triggers[triggernum].untrigger;
end
else
if(triggernum == 0) then
trigger = data.trigger;
else
trigger = data.additional_triggers[triggernum].trigger;
end
end
local input = {"event"};
local required = {};
local tests = {};
local init;
if(prototype.init) then
init = prototype.init(trigger);
else
init = "";
end
for index, arg in pairs(prototype.args) do
local enable = true;
if(type(arg.enable) == "function") then
enable = arg.enable(trigger);
end
if(enable) then
local name = arg.name;
if not(arg.name or arg.hidden) then
tinsert(input, "_");
else
if(arg.init == "arg") then
tinsert(input, name);
end
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
if(arg.init and arg.init ~= "arg") then
init = init.."local "..name.." = "..arg.init.."\n";
end
local number = tonumber(trigger[name]);
local test;
if(arg.type == "tristate") then
if(trigger["use_"..name] == false) then
test = "(not "..name..")";
elseif(trigger["use_"..name]) then
if(arg.test) then
test = "("..arg.test:format(trigger[name])..")";
else
test = name;
end
end
elseif(arg.type == "multiselect") then
if(trigger["use_"..name] == false) then
test = "(";
local any = false;
for value, _ in pairs(trigger[name].multi) do
if not arg.test then
test = test..name.."=="..(tonumber(value) or "\""..value.."\"").." or ";
else
test = test..arg.test:format(tonumber(value) or "\""..value.."\"").." or ";
end
any = true;
end
if(any) then
test = test:sub(0, -5);
else
test = "(false";
end
test = test..")";
elseif(trigger["use_"..name]) then
local value = trigger[name].single;
if not arg.test then
test = trigger[name].single and "("..name.."=="..(tonumber(value) or "\""..value.."\"")..")";
else
test = trigger[name].single and "("..arg.test:format(tonumber(value) or "\""..value.."\"")..")";
end
end
elseif(arg.type == "toggle") then
if(trigger["use_"..name]) then
if(arg.test) then
test = "("..arg.test:format(trigger[name])..")";
else
test = name;
end
end
elseif(arg.test) then
test = "("..arg.test:format(trigger[name])..")";
elseif(arg.type == "longstring" and trigger[name.."_operator"]) then
if(trigger[name.."_operator"] == "==") then
test = "("..name.."==\""..trigger[name].."\")";
else
test = "("..name..":"..trigger[name.."_operator"]:format(trigger[name])..")";
end
else
if(type(trigger[name]) == "table") then
trigger[name] = "error";
end
-- if arg.type == "number" and (trigger[name]) and not number then trigger[name] = 0 number = 0 end -- fix corrupt data, ticket #366
test = "("..name..(trigger[name.."_operator"] or "==")..(number or "\""..(trigger[name] or "").."\"")..")";
end
if(arg.required) then
tinsert(required, test);
else
tinsert(tests, test);
end
end
end
end
end
local ret = "return function("..tconcat(input, ", ")..")\n";
ret = ret..(init or "");
ret = ret.."if(";
ret = ret..((#required > 0) and tconcat(required, " and ").." and " or "");
if(inverse) then
ret = ret.."not ("..(#tests > 0 and tconcat(tests, " and ") or "true")..")";
else
ret = ret..(#tests > 0 and tconcat(tests, " and ") or "true");
end
ret = ret..") then\nreturn true else return false end end";
return ret;
end