import "Turbine.UI";
import "Turbine.UI.Lotro";
import "Turbine.Gameplay";
import "DigitalUtopia.DUInterface";
import "DigitalUtopia.Utilsx";
import "DigitalUtopia.Palantir";
--import "DigitalUtopia.Utilsx.Class";
oM=OptionsManager();
local displayWidth, displayHeight = Turbine.UI.Display.GetSize();
local windowWidth,windowHeight = oM.mWindow:GetSize();
local width = (displayWidth-windowWidth)/2;
local height = (displayHeight-windowHeight)/2;
oM.defaultOptionsMain.PositionX=width;
oM.defaultOptionsMain.PositionY=height;
local pluginName = "Palantir";
local settingsOne = "Main";
local settingsTwo = "Color";
local settingsThree = "Text";
local settingsFour = "Quickslot";
player = Turbine.Gameplay.LocalPlayer.GetInstance();
local main={};
local color={};
local text={};
local qslot={};
function GetRealLocale()
if(Turbine.Shell.IsCommand("zusatzmodule")==true)then
return "de";
elseif(Turbine.Shell.IsCommand("conseil")==true)then
return "fr";
else
return "en";
end
end
function UnloadPlugin()
oM.mWindow.dbb.wqs:SetShortcut(nil);
oM.mWindow.dbb.fqs:SetShortcut(nil);
oM.mWindow.dbb.dqs:SetShortcut(nil);
oM.mWindow.dbb.pqs:SetShortcut(nil);
oM.mWindow.dbb.Refresh();
oM.SaveSettings();
end
window = Turbine.UI.Window();
window:SetWantsUpdates(true);
window.Update = function(sender,args)
if (Plugins[pluginName] ~= nil) then
Plugins[pluginName].Unload = function(self,sender,args)
UnloadPlugin();
end
window:SetWantsUpdates(false);
end
end
function loadHandle()
end
function qsHandle()
end
function settingsDecode(t)
local t2={};
for k,v in pairs(t) do
if(tonumber(v)~=nil and string.sub(v,1,2)~="0x")then
v=tonumber(v);
elseif (type(v)=="table")then
v=settingsDecode(v);
end
t2[k]=v;
end
return t2
end
local tempLoad = Turbine.PluginData.Load(Turbine.DataScope.Account,"Scope");
if(tempLoad~=nil)then
tempLoad=settingsDecode(tempLoad);
local scopeVal = tempLoad.Value;
local scope="";
if(scopeVal==1)then
scope=Turbine.DataScope.Account;
elseif(scopeVal==2)then
scope=Turbine.DataScope.Character;
else
scope=Turbine.DataScope.Server
end
tempLoad = Turbine.PluginData.Load(scope,settingsOne);
if (tempLoad~=nil)then
main=tempLoad;
color=Turbine.PluginData.Load(scope,settingsTwo);
text=Turbine.PluginData.Load(scope,settingsThree);
qslot = Turbine.PluginData.Load(Turbine.DataScope.Character,settingsFour);
oM.loadSettings(settingsDecode(main),settingsDecode(color),settingsDecode(text));
if(qslot ~= nil)then
oM.AddShortcuts(settingsDecode(qslot));
end
else
--use defaults;
Turbine.Shell.WriteLine(displayHeight);
main = oM.defaultOptionsMain;
color = oM.defaultOptionsColor;
text = oM.defaultOptionsText;
oM.loadSettings(main,color,text);
end
else
main = oM.defaultOptionsMain;
color = oM.defaultOptionsColor;
text = oM.defaultOptionsText;
oM.loadSettings(main,color,text);
end
optionsPanel = Turbine.UI.Control();
--optionsPanel:SetBackColor( Turbine.UI.Color( 0.3, 0.3, 0.3 ) );
optionsPanel:SetSize( 600, 600 );
optionsButton=Turbine.UI.Lotro.Button();
optionsButton:SetSize(200,30);
optionsButton:SetText("Show Options");
optionsButton:SetParent(optionsPanel);
optionsButton.MouseClick=function(sender,args)
if (oM.mWindow.holdSetup==false)then
oM.sw.showSetup();
else
oM.mWindow.setupPending=true;
end
end
if (plugin == nil)then
plugin = Turbine.UI.Control();
end
plugin.GetOptionsPanel = function( self )
return optionsPanel;
end
Turbine.Shell.WriteLine("Palantir v1.10.1 by Digital_Utopia");