From 3e090c579ecf1efba25ea16af7d5f569fdafb0ca Mon Sep 17 00:00:00 2001 From: Bitl Date: Sat, 10 Sep 2022 13:12:51 -0700 Subject: [PATCH] add %generatescript% --- .../StorageAndFunctions/GlobalFuncs.cs | 52 ++++++++++++++----- .../StorageAndFunctions/ScriptFuncs.cs | 6 +++ .../Forms/SDK/ClientinfoCreator.Designer.cs | 44 ++++++++++------ 3 files changed, 72 insertions(+), 30 deletions(-) diff --git a/Novetus/NovetusCore/StorageAndFunctions/GlobalFuncs.cs b/Novetus/NovetusCore/StorageAndFunctions/GlobalFuncs.cs index 2e21176..238e407 100644 --- a/Novetus/NovetusCore/StorageAndFunctions/GlobalFuncs.cs +++ b/Novetus/NovetusCore/StorageAndFunctions/GlobalFuncs.cs @@ -1898,6 +1898,31 @@ public class GlobalFuncs } } + public static string GetGenLuaFileName(string ClientName, ScriptType type) + { + string luafile = ""; + + bool rbxasset = GlobalVars.SelectedClientInfo.CommandLineArgs.Contains("%userbxassetforgeneration%"); + + if (!rbxasset) + { + if (GlobalVars.SelectedClientInfo.SeperateFolders) + { + luafile = GlobalPaths.ClientDir + @"\\" + ClientName + @"\\" + GetClientSeperateFolderName(type) + @"\\content\\scripts\\" + GlobalPaths.ScriptGenName + ".lua"; + } + else + { + luafile = GlobalPaths.ClientDir + @"\\" + ClientName + @"\\content\\scripts\\" + GlobalPaths.ScriptGenName + ".lua"; + } + } + else + { + luafile = @"rbxasset://scripts\\" + GlobalPaths.ScriptGenName + ".lua"; + } + + return luafile; + } + public static string GetLuaFileName(ScriptType type) { return GetLuaFileName(GlobalVars.UserConfiguration.SelectedClient, type); @@ -1909,28 +1934,29 @@ public class GlobalFuncs if (!GlobalVars.SelectedClientInfo.Fix2007) { - luafile = "rbxasset://scripts\\\\" + GlobalPaths.ScriptName + ".lua"; - } - else - { - bool rbxasset = GlobalVars.SelectedClientInfo.CommandLineArgs.Contains("%userbxassetforgeneration%"); + bool HasGenerateScript = false; - if (!rbxasset) + foreach (string line in GlobalVars.SelectedClientInfo.CommandLineArgs.Split(new string[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries)) { - if (GlobalVars.SelectedClientInfo.SeperateFolders) + if (line.Contains("%generatescript%")) { - luafile = GlobalPaths.ClientDir + @"\\" + ClientName + @"\\" + GetClientSeperateFolderName(type) + @"\\content\\scripts\\" + GlobalPaths.ScriptGenName + ".lua"; - } - else - { - luafile = GlobalPaths.ClientDir + @"\\" + ClientName + @"\\content\\scripts\\" + GlobalPaths.ScriptGenName + ".lua"; + HasGenerateScript = true; } } + + if (HasGenerateScript) + { + luafile = ScriptFuncs.Generator.GetGeneratedScriptName(ClientName, type); + } else { - luafile = @"rbxasset://scripts\\" + GlobalPaths.ScriptGenName + ".lua"; + luafile = "rbxasset://scripts\\\\" + GlobalPaths.ScriptName + ".lua"; } } + else + { + luafile = GetGenLuaFileName(ClientName, type); + } return luafile; } diff --git a/Novetus/NovetusCore/StorageAndFunctions/ScriptFuncs.cs b/Novetus/NovetusCore/StorageAndFunctions/ScriptFuncs.cs index 9b4427b..06981b6 100644 --- a/Novetus/NovetusCore/StorageAndFunctions/ScriptFuncs.cs +++ b/Novetus/NovetusCore/StorageAndFunctions/ScriptFuncs.cs @@ -193,6 +193,12 @@ public class ScriptFuncs SignGeneratedScript(outputPath, shouldUseNewSigFormat); } } + + public static string GetGeneratedScriptName(string ClientName, ScriptType type) + { + GenerateScriptForClient(ClientName, type); + return GlobalFuncs.GetGenLuaFileName(ClientName, type); + } } #endregion diff --git a/Novetus/NovetusLauncher/Forms/SDK/ClientinfoCreator.Designer.cs b/Novetus/NovetusLauncher/Forms/SDK/ClientinfoCreator.Designer.cs index 79afdee..17870df 100644 --- a/Novetus/NovetusLauncher/Forms/SDK/ClientinfoCreator.Designer.cs +++ b/Novetus/NovetusLauncher/Forms/SDK/ClientinfoCreator.Designer.cs @@ -165,6 +165,7 @@ partial class ClientinfoEditor this.checkBox8 = new System.Windows.Forms.CheckBox(); this.textBox2 = new System.Windows.Forms.TextBox(); this.label3 = new System.Windows.Forms.Label(); + this.generatescriptToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.menuStrip1.SuspendLayout(); this.SuspendLayout(); // @@ -366,42 +367,42 @@ partial class ClientinfoEditor // clientToolStripMenuItem // this.clientToolStripMenuItem.Name = "clientToolStripMenuItem"; - this.clientToolStripMenuItem.Size = new System.Drawing.Size(131, 22); + this.clientToolStripMenuItem.Size = new System.Drawing.Size(180, 22); this.clientToolStripMenuItem.Text = ""; this.clientToolStripMenuItem.Click += new System.EventHandler(this.clientToolStripMenuItem_Click); // // serverToolStripMenuItem // this.serverToolStripMenuItem.Name = "serverToolStripMenuItem"; - this.serverToolStripMenuItem.Size = new System.Drawing.Size(131, 22); + this.serverToolStripMenuItem.Size = new System.Drawing.Size(180, 22); this.serverToolStripMenuItem.Text = ""; this.serverToolStripMenuItem.Click += new System.EventHandler(this.serverToolStripMenuItem_Click); // // soloToolStripMenuItem // this.soloToolStripMenuItem.Name = "soloToolStripMenuItem"; - this.soloToolStripMenuItem.Size = new System.Drawing.Size(131, 22); + this.soloToolStripMenuItem.Size = new System.Drawing.Size(180, 22); this.soloToolStripMenuItem.Text = ""; this.soloToolStripMenuItem.Click += new System.EventHandler(this.soloToolStripMenuItem_Click); // // studioToolStripMenuItem // this.studioToolStripMenuItem.Name = "studioToolStripMenuItem"; - this.studioToolStripMenuItem.Size = new System.Drawing.Size(131, 22); + this.studioToolStripMenuItem.Size = new System.Drawing.Size(180, 22); this.studioToolStripMenuItem.Text = ""; this.studioToolStripMenuItem.Click += new System.EventHandler(this.studioToolStripMenuItem_Click); // // no3dToolStripMenuItem // this.no3dToolStripMenuItem.Name = "no3dToolStripMenuItem"; - this.no3dToolStripMenuItem.Size = new System.Drawing.Size(131, 22); + this.no3dToolStripMenuItem.Size = new System.Drawing.Size(180, 22); this.no3dToolStripMenuItem.Text = ""; this.no3dToolStripMenuItem.Click += new System.EventHandler(this.no3dToolStripMenuItem_Click); // // sharedToolStripMenuItem // this.sharedToolStripMenuItem.Name = "sharedToolStripMenuItem"; - this.sharedToolStripMenuItem.Size = new System.Drawing.Size(131, 22); + this.sharedToolStripMenuItem.Size = new System.Drawing.Size(180, 22); this.sharedToolStripMenuItem.Text = ""; this.sharedToolStripMenuItem.Click += new System.EventHandler(this.sharedToolStripMenuItem_Click); // @@ -410,7 +411,7 @@ partial class ClientinfoEditor this.validateToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.addValidateTagsForRelativePathToolStripMenuItem}); this.validateToolStripMenuItem.Name = "validateToolStripMenuItem"; - this.validateToolStripMenuItem.Size = new System.Drawing.Size(131, 22); + this.validateToolStripMenuItem.Size = new System.Drawing.Size(180, 22); this.validateToolStripMenuItem.Text = ""; this.validateToolStripMenuItem.Click += new System.EventHandler(this.validateToolStripMenuItem_Click); // @@ -452,7 +453,8 @@ partial class ClientinfoEditor this.signgeneratedjoinscriptToolStripMenuItem, this.usenewsignformatToolStripMenuItem, this.useloadfileToolStripMenuItem, - this.userbxassetforgenerationToolStripMenuItem}); + this.userbxassetforgenerationToolStripMenuItem, + this.generatescriptToolStripMenuItem}); this.generalToolStripMenuItem.Name = "generalToolStripMenuItem"; this.generalToolStripMenuItem.Size = new System.Drawing.Size(180, 22); this.generalToolStripMenuItem.Text = "General"; @@ -617,49 +619,49 @@ partial class ClientinfoEditor // md5launcherToolStripMenuItem // this.md5launcherToolStripMenuItem.Name = "md5launcherToolStripMenuItem"; - this.md5launcherToolStripMenuItem.Size = new System.Drawing.Size(180, 22); + this.md5launcherToolStripMenuItem.Size = new System.Drawing.Size(164, 22); this.md5launcherToolStripMenuItem.Text = "%md5launcher%"; this.md5launcherToolStripMenuItem.Click += new System.EventHandler(this.variableToolStripMenuItem_Click); // // md5scriptToolStripMenuItem // this.md5scriptToolStripMenuItem.Name = "md5scriptToolStripMenuItem"; - this.md5scriptToolStripMenuItem.Size = new System.Drawing.Size(180, 22); + this.md5scriptToolStripMenuItem.Size = new System.Drawing.Size(164, 22); this.md5scriptToolStripMenuItem.Text = "%md5script%"; this.md5scriptToolStripMenuItem.Click += new System.EventHandler(this.variableToolStripMenuItem_Click); // // md5exeToolStripMenuItem // this.md5exeToolStripMenuItem.Name = "md5exeToolStripMenuItem"; - this.md5exeToolStripMenuItem.Size = new System.Drawing.Size(180, 22); + this.md5exeToolStripMenuItem.Size = new System.Drawing.Size(164, 22); this.md5exeToolStripMenuItem.Text = "%md5exe%"; this.md5exeToolStripMenuItem.Click += new System.EventHandler(this.variableToolStripMenuItem_Click); // // md5scriptdToolStripMenuItem // this.md5scriptdToolStripMenuItem.Name = "md5scriptdToolStripMenuItem"; - this.md5scriptdToolStripMenuItem.Size = new System.Drawing.Size(180, 22); + this.md5scriptdToolStripMenuItem.Size = new System.Drawing.Size(164, 22); this.md5scriptdToolStripMenuItem.Text = "%md5scriptd%"; this.md5scriptdToolStripMenuItem.Click += new System.EventHandler(this.variableToolStripMenuItem_Click); // // md5exedToolStripMenuItem // this.md5exedToolStripMenuItem.Name = "md5exedToolStripMenuItem"; - this.md5exedToolStripMenuItem.Size = new System.Drawing.Size(180, 22); + this.md5exedToolStripMenuItem.Size = new System.Drawing.Size(164, 22); this.md5exedToolStripMenuItem.Text = "%md5exed%"; this.md5exedToolStripMenuItem.Click += new System.EventHandler(this.variableToolStripMenuItem_Click); // // md5sToolStripMenuItem // this.md5sToolStripMenuItem.Name = "md5sToolStripMenuItem"; - this.md5sToolStripMenuItem.Size = new System.Drawing.Size(180, 22); + this.md5sToolStripMenuItem.Size = new System.Drawing.Size(164, 22); this.md5sToolStripMenuItem.Text = "%md5s%"; this.md5sToolStripMenuItem.Click += new System.EventHandler(this.variableToolStripMenuItem_Click); // // md5sdToolStripMenuItem // this.md5sdToolStripMenuItem.Name = "md5sdToolStripMenuItem"; - this.md5sdToolStripMenuItem.Size = new System.Drawing.Size(180, 22); + this.md5sdToolStripMenuItem.Size = new System.Drawing.Size(164, 22); this.md5sdToolStripMenuItem.Text = "%md5sd%"; this.md5sdToolStripMenuItem.Click += new System.EventHandler(this.variableToolStripMenuItem_Click); // @@ -1090,14 +1092,14 @@ partial class ClientinfoEditor // donothingToolStripMenuItem // this.donothingToolStripMenuItem.Name = "donothingToolStripMenuItem"; - this.donothingToolStripMenuItem.Size = new System.Drawing.Size(180, 22); + this.donothingToolStripMenuItem.Size = new System.Drawing.Size(150, 22); this.donothingToolStripMenuItem.Text = "%donothing%"; this.donothingToolStripMenuItem.Click += new System.EventHandler(this.variableToolStripMenuItem_Click); // // disabledToolStripMenuItem // this.disabledToolStripMenuItem.Name = "disabledToolStripMenuItem"; - this.disabledToolStripMenuItem.Size = new System.Drawing.Size(180, 22); + this.disabledToolStripMenuItem.Size = new System.Drawing.Size(150, 22); this.disabledToolStripMenuItem.Text = "%disabled%"; this.disabledToolStripMenuItem.Click += new System.EventHandler(this.variableToolStripMenuItem_Click); // @@ -1268,6 +1270,13 @@ partial class ClientinfoEditor this.label3.TabIndex = 37; this.label3.Text = "EXE Name:"; // + // generatescriptToolStripMenuItem + // + this.generatescriptToolStripMenuItem.Name = "generatescriptToolStripMenuItem"; + this.generatescriptToolStripMenuItem.Size = new System.Drawing.Size(227, 22); + this.generatescriptToolStripMenuItem.Text = "%generatescript%"; + this.generatescriptToolStripMenuItem.Click += new System.EventHandler(this.variableToolStripMenuItem_Click); + // // ClientinfoEditor // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -1438,4 +1447,5 @@ partial class ClientinfoEditor private System.Windows.Forms.ToolStripMenuItem usenewsignformatToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem useloadfileToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem userbxassetforgenerationToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem generatescriptToolStripMenuItem; }