import "Thurallor.SequenceBars";
--Puts("--------------------------------------");
math.randomseed(Turbine.Engine.GetGameTime());
theManager = Manager();
Turbine.Plugin.Unload = function(sender, args)
theManager:Unload();
end
--Turbine.Plugin.Load = function(sender, args)
-- import "Equendil.Utils";
-- import "Equendil.LuaExplorer.Browser";
-- function BrowseTable(name, t)
-- local b = Equendil.LuaExplorer.Browser("Browsing: " .. name);
-- b:Add(name, t, true, false);
-- b:SetVisible( true );
-- b:SetPosition(0, 0);
-- b:Activate();
-- end
-- BrowseTable("_G", _G);
--end
local hello = L:GetText("/HelloMessage");
hello = string.gsub(hello, "<version>", plugin:GetVersion());
Turbine.Shell.WriteLine(hello);
_G.PutsPrefix = "<rgb=#DAA520>SequenceBars:</rgb> ";
sbCmd = Turbine.ShellCommand();
function sbCmd:Execute(cmd, args)
if (args == "help") then
Turbine.Shell.WriteLine(sbCmd.GetHelp());
else
theManager:ShellCommand(cmd, args);
end
end
sbCmd.GetHelp = function()
return L:GetText("/ShellCommand/LongHelp");
end
sbCmd.GetShortHelp = function()
return L:GetText("/ShellCommand/ShortHelp");
end
Turbine.Shell.AddCommand(L:GetText("/ShellCommand/Command"), sbCmd);
--[[
indent = ""; count = 0;
makeCmd = Turbine.ShellCommand();
function insertBuilder(bar, builder, list)
local builders = {
["spear"] = "0x7000E867",
["shield"] = "0x7000ED0E",
["fist"] = "0x7000EECF",
["spear-spear"] = "0x7002850A",
["fist-fist"] = "0x7002850C",
["fist-shield"] = "0x7001509C",
["fist-spear"] = "0x7001509A",
["shield-fist"] = "0x7001509B",
["shield-shield"] = "0x7002850B",
["shield-spear"] = "0x7001509D",
["spear-fist"] = "0x70015098",
["spear-shield"] = "0x70015099"
};
table.insert(list, {
class = "Turbine.UI.Lotro.Quickslot";
type = Turbine.UI.Lotro.ShortcutType.Skill;
Data = builders[builder]
});
count = count + 1;
Puts(count .. ". " .. indent .. builder);
end
function insertIf(bar, mastery, list)
local skillIcons = {
["spear-spear"] = 1091659088,
["fist-fist"] = 1091659089,
["fist-shield"] = 1091471243,
["fist-spear"] = 1091471240,
["shield-fist"] = 1091471231,
["shield-shield"] = 1091659090,
["shield-spear"] = 1091471250,
["spear-fist"] = 1091471238,
["spear-shield"] = 1091471246
}
table.insert(list, {
class = "Turbine.UI.Control";
type = "If";
toolTip = "IF";
automatic = true;
background = "Thurallor/SequenceBars/Images/if.tga";
condName = "SkillReady";
condArgs = { skill = skillIcons[mastery] };
condExpr = "local item = ...; return (item.bar.manager:SkillReady(<skill>));";
});
count = count + 1;
Puts(count .. ". " .. indent .. "If skill ready: " .. mastery);
end
function insertElse(bar, list)
table.insert(list, {
class = "Turbine.UI.Control";
type = "Else";
toolTip = "ELSE";
automatic = true;
background = "Thurallor/SequenceBars/Images/else.tga";
});
count = count + 1;
Puts(count .. ". " .. indent .. "Else");
end
function insertEnd(bar, list)
table.insert(list, {
class = "Turbine.UI.Control";
type = "EndIf";
toolTip = "END-IF";
automatic = true;
background = "Thurallor/SequenceBars/Images/end-if.tga";
});
count = count + 1;
Puts(count .. ". " .. indent .. "End-If");
end
function insertDoGambit(bar, list)
table.insert(list, {
class = "Turbine.UI.Lotro.Quickslot";
type = Turbine.UI.Lotro.ShortcutType.Skill;
Data ="0x70015F56"
});
count = count + 1;
Puts(count .. ". " .. indent .. "Do gambit");
end
function insertMastery(bar, builders, list)
if (#builders == 1) then
insertBuilder(bar, builders[1], list);
return;
end
local mastery = builders[1] .. "-" .. builders[2];
insertIf(bar, mastery, list);
local prevIndent = indent;
indent = indent .. " ";
insertBuilder(bar, mastery, list);
if (#builders > 2) then
local remainingBuilders = { builders[3]; builders[4]; builders[5] };
insertMastery(bar, remainingBuilders, list);
end
indent = prevIndent;
insertElse(bar, list);
prevIndent = indent;
indent = indent .. " ";
insertBuilder(bar, builders[1], list);
if (#builders == 2) then
insertBuilder(bar, builders[2], list);
else
local remainingBuilders = { builders[2]; builders[3]; builders[4]; builders[5] };
insertMastery(bar, remainingBuilders, list);
end
indent = prevIndent;
insertEnd(bar, list);
end
function makeCmd:Execute(cmd, args)
local newBar = theManager:CreateBar();
newBar:SetName(args);
local builders = {};
for arg in string.gmatch(args, "%S+") do
table.insert(builders, arg);
end
local sequenceItemInfo = {};
insertMastery(bar, builders, sequenceItemInfo);
insertDoGambit(bar, sequenceItemInfo);
newBar.settings.sequenceItemInfo = sequenceItemInfo;
newBar:GetQuickSlots();
newBar:FindHiddenSlots();
newBar:Redraw();
newBar:EditSequence();
end
Turbine.Shell.AddCommand("make", makeCmd);
Puts("Remember, you will need to manually tweak gambits with repeated masteries.");
]]