rich presence redo

This commit is contained in:
Bitl 2019-12-22 13:26:42 -07:00
parent ddb79a6c8d
commit c706098d2e
12 changed files with 280 additions and 123 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

View File

@ -198,12 +198,17 @@ public static class GlobalVars
public static string ColorMenu_RightLegColor = "Color [A=255, R=164, G=189, B=71]";
public static bool AdminMode = false;
public static string important = "";
//discord
public static DiscordRpc.RichPresence presence;
//discord
public static bool DiscordPresence = true;
public static DiscordRpc.RichPresence presence;
public static string appid = "505955125727330324";
public static string imagekey_large = "novetus_large";
//webserver
public static string WebServerURI = "http://" + IP + ":" + (WebServer_Port).ToString();
public static string image_ingame = "ingame_small";
public static string image_inlauncher = "inlauncher_small";
public static string image_instudio = "instudio_small";
public static string image_incustomization = "incustomization_small";
//webserver
public static string WebServerURI = "http://" + IP + ":" + (WebServer_Port).ToString();
public static string LocalWebServerURI = "http://localhost:" + (WebServer_Port).ToString();
public static string WebServer_CustomPlayerDir = WebServerURI + "/charcustom/";
public static string WebServer_HatDir = WebServer_CustomPlayerDir + "hats/";

View File

@ -13,13 +13,23 @@ using System.IO;
public class LauncherFuncs
{
public LauncherFuncs()
public enum LauncherState
{
InLauncher = 0,
InMPGame = 1,
InSoloGame = 2,
InStudio = 3,
InCustomization = 4,
LoadingURI = 5
}
public LauncherFuncs()
{
}
public static void ReadConfigValues(string cfgpath)
{
string Decryptline1, Decryptline2, Decryptline3, Decryptline4, Decryptline5, Decryptline6, Decryptline7, Decryptline9, Decryptline10, Decryptline11, Decryptline12;
string Decryptline1, Decryptline2, Decryptline3, Decryptline4, Decryptline5, Decryptline6, Decryptline7, Decryptline9, Decryptline10, Decryptline11, Decryptline12, Decryptline13;
IniFile ini = new IniFile(cfgpath);
@ -29,66 +39,84 @@ public class LauncherFuncs
if (string.IsNullOrWhiteSpace(Decryptline1)) {
ini.IniWriteValue(section, "CloseOnLaunch", GlobalVars.CloseOnLaunch.ToString());
}
Decryptline1 = ini.IniReadValue(section, "CloseOnLaunch");
}
Decryptline2 = ini.IniReadValue(section, "UserID");
if (string.IsNullOrWhiteSpace(Decryptline2)) {
ini.IniWriteValue(section, "UserID", GlobalVars.UserID.ToString());
}
Decryptline2 = ini.IniReadValue(section, "UserID");
}
Decryptline3 = ini.IniReadValue(section, "PlayerName");
if (string.IsNullOrWhiteSpace(Decryptline3)) {
ini.IniWriteValue(section, "PlayerName", GlobalVars.PlayerName.ToString());
}
Decryptline3 = ini.IniReadValue(section, "PlayerName");
}
Decryptline4 = ini.IniReadValue(section, "SelectedClient");
if (string.IsNullOrWhiteSpace(Decryptline4)) {
ini.IniWriteValue(section, "SelectedClient", GlobalVars.SelectedClient.ToString());
}
Decryptline4 = ini.IniReadValue(section, "SelectedClient");
}
Decryptline5 = ini.IniReadValue(section, "Map");
if (string.IsNullOrWhiteSpace(Decryptline5)) {
ini.IniWriteValue(section, "Map", GlobalVars.Map.ToString());
}
Decryptline5 = ini.IniReadValue(section, "Map");
}
Decryptline6 = ini.IniReadValue(section, "RobloxPort");
if (string.IsNullOrWhiteSpace(Decryptline6)) {
ini.IniWriteValue(section, "RobloxPort", GlobalVars.RobloxPort.ToString());
}
Decryptline6 = ini.IniReadValue(section, "RobloxPort");
}
Decryptline7 = ini.IniReadValue(section, "PlayerLimit");
if (string.IsNullOrWhiteSpace(Decryptline7)) {
ini.IniWriteValue(section, "PlayerLimit", GlobalVars.PlayerLimit.ToString());
}
Decryptline7 = ini.IniReadValue(section, "PlayerLimit");
}
Decryptline9 = ini.IniReadValue(section, "ShowHatsOnExtra");
if (string.IsNullOrWhiteSpace(Decryptline9)) {
ini.IniWriteValue(section, "ShowHatsOnExtra", GlobalVars.Custom_Extra_ShowHats.ToString());
}
Decryptline9 = ini.IniReadValue(section, "ShowHatsOnExtra");
}
Decryptline10 = ini.IniReadValue(section, "UPnP");
if (string.IsNullOrWhiteSpace(Decryptline10)) {
ini.IniWriteValue(section, "UPnP", GlobalVars.UPnP.ToString());
}
Decryptline10 = ini.IniReadValue(section, "UPnP");
}
Decryptline11 = ini.IniReadValue(section, "ItemMakerDisableHelpMessage");
if (string.IsNullOrWhiteSpace(Decryptline11)) {
ini.IniWriteValue(section, "ItemMakerDisableHelpMessage", GlobalVars.DisabledHelp.ToString());
}
Decryptline11 = ini.IniReadValue(section, "ItemMakerDisableHelpMessage");
}
Decryptline12 = ini.IniReadValue(section, "PlayerTripcode");
if (string.IsNullOrWhiteSpace(Decryptline12)) {
ini.IniWriteValue(section, "PlayerTripcode", SecurityFuncs.Base64Encode(GlobalVars.PlayerTripcode.ToString()));
Decryptline12 = ini.IniReadValue(section, "PlayerTripcode");
}
Decryptline13 = ini.IniReadValue(section, "DiscordRichPresence");
if (string.IsNullOrWhiteSpace(Decryptline13)) {
ini.IniWriteValue(section, "DiscordRichPresence", GlobalVars.DiscordPresence.ToString());
Decryptline13 = ini.IniReadValue(section, "DiscordRichPresence");
}
bool bline1 = Convert.ToBoolean(Decryptline1);
@ -137,6 +165,9 @@ public class LauncherFuncs
GlobalVars.PlayerTripcode = sdecrypt12;
}
bool bline13 = Convert.ToBoolean(Decryptline13);
GlobalVars.DiscordPresence = bline13;
ReadCustomizationValues(GlobalVars.ConfigDir + "\\" + GlobalVars.ConfigNameCustomization);
}
@ -157,6 +188,7 @@ public class LauncherFuncs
ini.IniWriteValue(section, "UPnP", GlobalVars.UPnP.ToString());
ini.IniWriteValue(section, "ItemMakerDisableHelpMessage", GlobalVars.DisabledHelp.ToString());
ini.IniWriteValue(section, "PlayerTripcode", SecurityFuncs.Base64Encode(GlobalVars.PlayerTripcode.ToString()));
ini.IniWriteValue(section, "DiscordRichPresence", GlobalVars.DiscordPresence.ToString());
WriteCustomizationValues(GlobalVars.ConfigDir + "\\" + GlobalVars.ConfigNameCustomization);
}
@ -174,6 +206,7 @@ public class LauncherFuncs
GlobalVars.Custom_Extra_ShowHats = false;
GlobalVars.UPnP = false;
GlobalVars.DisabledHelp = false;
GlobalVars.DiscordPresence = true;
ResetCustomizationValues();
}
@ -633,4 +666,66 @@ public class LauncherFuncs
return image;
}
public static void UpdateRichPresence(LauncherState state, bool initial = false)
{
if (GlobalVars.DiscordPresence)
{
if (initial)
{
GlobalVars.presence.largeImageKey = GlobalVars.imagekey_large;
GlobalVars.presence.startTimestamp = SecurityFuncs.UnixTimeNow();
}
switch (state)
{
case LauncherState.InLauncher:
GlobalVars.presence.smallImageKey = GlobalVars.image_inlauncher;
GlobalVars.presence.state = "In Launcher";
GlobalVars.presence.details = "Selected " + GlobalVars.SelectedClient;
GlobalVars.presence.largeImageText = GlobalVars.PlayerName + " | Novetus " + GlobalVars.Version;
GlobalVars.presence.smallImageText = "In Launcher";
break;
case LauncherState.InMPGame:
GlobalVars.presence.smallImageKey = GlobalVars.image_ingame;
GlobalVars.presence.details = "";
GlobalVars.presence.state = "In " + GlobalVars.SelectedClient + " Game";
GlobalVars.presence.largeImageText = GlobalVars.PlayerName + " | Novetus " + GlobalVars.Version;
GlobalVars.presence.smallImageText = "In " + GlobalVars.SelectedClient + " Game";
break;
case LauncherState.InSoloGame:
GlobalVars.presence.smallImageKey = GlobalVars.image_ingame;
GlobalVars.presence.details = GlobalVars.Map;
GlobalVars.presence.state = "In " + GlobalVars.SelectedClient + " Solo Game";
GlobalVars.presence.largeImageText = GlobalVars.PlayerName + " | Novetus " + GlobalVars.Version;
GlobalVars.presence.smallImageText = "In " + GlobalVars.SelectedClient + " Solo Game";
break;
case LauncherState.InStudio:
GlobalVars.presence.smallImageKey = GlobalVars.image_instudio;
GlobalVars.presence.details = GlobalVars.Map;
GlobalVars.presence.state = "In " + GlobalVars.SelectedClient + " Studio";
GlobalVars.presence.largeImageText = GlobalVars.PlayerName + " | Novetus " + GlobalVars.Version;
GlobalVars.presence.smallImageText = "In " + GlobalVars.SelectedClient + " Studio";
break;
case LauncherState.InCustomization:
GlobalVars.presence.smallImageKey = GlobalVars.image_incustomization;
GlobalVars.presence.details = "Customizing " + GlobalVars.PlayerName;
GlobalVars.presence.state = "In Character Customization";
GlobalVars.presence.largeImageText = GlobalVars.PlayerName + " | Novetus " + GlobalVars.Version;
GlobalVars.presence.smallImageText = "In Character Customization";
break;
case LauncherState.LoadingURI:
GlobalVars.presence.smallImageKey = GlobalVars.image_ingame;
GlobalVars.presence.details = "";
GlobalVars.presence.state = "Joining a " + GlobalVars.SelectedClient + " Game";
GlobalVars.presence.largeImageText = GlobalVars.PlayerName + " | Novetus " + GlobalVars.Version;
GlobalVars.presence.smallImageText = "Joining a " + GlobalVars.SelectedClient + " Game";
break;
default:
break;
}
DiscordRpc.UpdatePresence(ref GlobalVars.presence);
}
}
}

View File

@ -133,12 +133,9 @@ namespace NovetusLauncher
textBox1.Text = GlobalVars.CharacterID;
checkBox1.Checked = GlobalVars.Custom_Extra_ShowHats;
//discord
GlobalVars.presence.details = "Customizing " + GlobalVars.PlayerName;
GlobalVars.presence.state = "In Character Customization";
GlobalVars.presence.largeImageText = GlobalVars.PlayerName + " | In Character Customization";
DiscordRpc.UpdatePresence(ref GlobalVars.presence);
//discord
LauncherFuncs.UpdateRichPresence(LauncherFuncs.LauncherState.InCustomization);
LauncherFuncs.ReloadLoadtextValue();
}
@ -444,12 +441,8 @@ namespace NovetusLauncher
void CharacterCustomizationClose(object sender, CancelEventArgs e)
{
GlobalVars.presence.state = "In Launcher";
GlobalVars.presence.details = "Selected " + GlobalVars.SelectedClient;
GlobalVars.presence.largeImageText = GlobalVars.PlayerName + " | In Launcher";
DiscordRpc.UpdatePresence(ref GlobalVars.presence);
LauncherFuncs.ReloadLoadtextValue();
LauncherFuncs.UpdateRichPresence(LauncherFuncs.LauncherState.InLauncher);
LauncherFuncs.ReloadLoadtextValue();
}
// hats

View File

@ -120,6 +120,7 @@ namespace NovetusLauncher
this.label11 = new System.Windows.Forms.Label();
this.label12 = new System.Windows.Forms.Label();
this.label16 = new System.Windows.Forms.Label();
this.checkBox2 = new System.Windows.Forms.CheckBox();
this.tabControl1.SuspendLayout();
this.tabPage1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).BeginInit();
@ -758,6 +759,7 @@ namespace NovetusLauncher
//
// tabPage5
//
this.tabPage5.Controls.Add(this.checkBox2);
this.tabPage5.Controls.Add(this.label18);
this.tabPage5.Controls.Add(this.button26);
this.tabPage5.Controls.Add(this.button25);
@ -790,19 +792,19 @@ namespace NovetusLauncher
//
// button26
//
this.button26.Location = new System.Drawing.Point(262, 24);
this.button26.Location = new System.Drawing.Point(176, 29);
this.button26.Name = "button26";
this.button26.Size = new System.Drawing.Size(133, 19);
this.button26.Size = new System.Drawing.Size(77, 21);
this.button26.TabIndex = 57;
this.button26.Text = "Clear Local Asset Cache";
this.button26.Text = "Clear Cache";
this.button26.UseVisualStyleBackColor = true;
this.button26.Click += new System.EventHandler(this.button26_Click);
//
// button25
//
this.button25.Location = new System.Drawing.Point(13, 24);
this.button25.Location = new System.Drawing.Point(6, 29);
this.button25.Name = "button25";
this.button25.Size = new System.Drawing.Size(76, 19);
this.button25.Size = new System.Drawing.Size(76, 21);
this.button25.TabIndex = 56;
this.button25.Text = "Install Addon";
this.button25.UseVisualStyleBackColor = true;
@ -836,7 +838,7 @@ namespace NovetusLauncher
//
// label6
//
this.label6.Location = new System.Drawing.Point(158, 59);
this.label6.Location = new System.Drawing.Point(160, 67);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(85, 15);
this.label6.TabIndex = 46;
@ -845,7 +847,7 @@ namespace NovetusLauncher
//
// label5
//
this.label5.Location = new System.Drawing.Point(6, 74);
this.label5.Location = new System.Drawing.Point(6, 82);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(389, 18);
this.label5.TabIndex = 45;
@ -854,9 +856,9 @@ namespace NovetusLauncher
//
// button21
//
this.button21.Location = new System.Drawing.Point(12, 3);
this.button21.Location = new System.Drawing.Point(6, 3);
this.button21.Name = "button21";
this.button21.Size = new System.Drawing.Size(77, 19);
this.button21.Size = new System.Drawing.Size(77, 21);
this.button21.TabIndex = 44;
this.button21.Text = "Install URI";
this.button21.UseVisualStyleBackColor = true;
@ -874,9 +876,9 @@ namespace NovetusLauncher
// button9
//
this.button9.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.button9.Location = new System.Drawing.Point(174, 24);
this.button9.Location = new System.Drawing.Point(89, 29);
this.button9.Name = "button9";
this.button9.Size = new System.Drawing.Size(82, 19);
this.button9.Size = new System.Drawing.Size(83, 21);
this.button9.TabIndex = 37;
this.button9.Text = "Reset Config";
this.button9.UseVisualStyleBackColor = true;
@ -884,11 +886,11 @@ namespace NovetusLauncher
//
// checkBox3
//
this.checkBox3.Location = new System.Drawing.Point(286, 4);
this.checkBox3.Location = new System.Drawing.Point(317, 7);
this.checkBox3.Name = "checkBox3";
this.checkBox3.Size = new System.Drawing.Size(109, 19);
this.checkBox3.Size = new System.Drawing.Size(77, 19);
this.checkBox3.TabIndex = 22;
this.checkBox3.Text = "Local Play Mode";
this.checkBox3.Text = "Local Play";
this.checkBox3.UseVisualStyleBackColor = true;
this.checkBox3.CheckedChanged += new System.EventHandler(this.CheckBox3CheckedChanged);
//
@ -896,11 +898,11 @@ namespace NovetusLauncher
//
this.checkBox1.Checked = true;
this.checkBox1.CheckState = System.Windows.Forms.CheckState.Checked;
this.checkBox1.Location = new System.Drawing.Point(95, 5);
this.checkBox1.Location = new System.Drawing.Point(270, 32);
this.checkBox1.Name = "checkBox1";
this.checkBox1.Size = new System.Drawing.Size(185, 17);
this.checkBox1.Size = new System.Drawing.Size(124, 17);
this.checkBox1.TabIndex = 5;
this.checkBox1.Text = "Minimize Launcher on Launch";
this.checkBox1.Text = "Minimize on Launch";
this.checkBox1.UseCompatibleTextRendering = true;
this.checkBox1.UseVisualStyleBackColor = true;
this.checkBox1.CheckedChanged += new System.EventHandler(this.CheckBox1CheckedChanged);
@ -908,9 +910,9 @@ namespace NovetusLauncher
// button5
//
this.button5.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.button5.Location = new System.Drawing.Point(95, 24);
this.button5.Location = new System.Drawing.Point(89, 3);
this.button5.Name = "button5";
this.button5.Size = new System.Drawing.Size(73, 19);
this.button5.Size = new System.Drawing.Size(73, 21);
this.button5.TabIndex = 10;
this.button5.Text = "Save Config";
this.button5.UseVisualStyleBackColor = true;
@ -1055,6 +1057,19 @@ namespace NovetusLauncher
this.label16.Size = new System.Drawing.Size(2, 65);
this.label16.TabIndex = 51;
//
// checkBox2
//
this.checkBox2.AutoSize = true;
this.checkBox2.Checked = true;
this.checkBox2.CheckState = System.Windows.Forms.CheckState.Checked;
this.checkBox2.Location = new System.Drawing.Point(176, 8);
this.checkBox2.Name = "checkBox2";
this.checkBox2.Size = new System.Drawing.Size(135, 17);
this.checkBox2.TabIndex = 59;
this.checkBox2.Text = "Discord Rich Presence";
this.checkBox2.UseVisualStyleBackColor = true;
this.checkBox2.CheckedChanged += new System.EventHandler(this.checkBox2_CheckedChanged);
//
// MainForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@ -1100,6 +1115,7 @@ namespace NovetusLauncher
this.tabPage7.ResumeLayout(false);
this.tabPage8.ResumeLayout(false);
this.tabPage5.ResumeLayout(false);
this.tabPage5.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
@ -1189,5 +1205,6 @@ namespace NovetusLauncher
private System.Windows.Forms.Button button25;
private System.Windows.Forms.Button button26;
private System.Windows.Forms.Label label18;
private System.Windows.Forms.CheckBox checkBox2;
}
}

View File

@ -150,21 +150,19 @@ namespace NovetusLauncher
void StartDiscord()
{
handlers = new DiscordRpc.EventHandlers();
handlers.readyCallback = ReadyCallback;
handlers.disconnectedCallback += DisconnectedCallback;
handlers.errorCallback += ErrorCallback;
handlers.joinCallback += JoinCallback;
handlers.spectateCallback += SpectateCallback;
handlers.requestCallback += RequestCallback;
DiscordRpc.Initialize(GlobalVars.appid, ref handlers, true, "");
GlobalVars.presence.largeImageKey = GlobalVars.imagekey_large;
GlobalVars.presence.state = "In Launcher";
GlobalVars.presence.details = "Selected " + GlobalVars.SelectedClient;
GlobalVars.presence.startTimestamp = SecurityFuncs.UnixTimeNow();
GlobalVars.presence.largeImageText = GlobalVars.PlayerName + " | In Launcher";
DiscordRpc.UpdatePresence(ref GlobalVars.presence);
if (GlobalVars.DiscordPresence)
{
handlers = new DiscordRpc.EventHandlers();
handlers.readyCallback = ReadyCallback;
handlers.disconnectedCallback += DisconnectedCallback;
handlers.errorCallback += ErrorCallback;
handlers.joinCallback += JoinCallback;
handlers.spectateCallback += SpectateCallback;
handlers.requestCallback += RequestCallback;
DiscordRpc.Initialize(GlobalVars.appid, ref handlers, true, "");
LauncherFuncs.UpdateRichPresence(LauncherFuncs.LauncherState.InLauncher, true);
}
}
void StartWebServer()
@ -355,15 +353,18 @@ namespace NovetusLauncher
StartDiscord();
StartWebServer();
}
void MainFormClose(object sender, CancelEventArgs e)
void MainFormClose(object sender, CancelEventArgs e)
{
if (GlobalVars.LocalPlayMode != true)
{
WriteConfigValues();
}
DiscordRpc.Shutdown();
if (GlobalVars.IsWebServerOn == true)
if (GlobalVars.DiscordPresence)
{
DiscordRpc.Shutdown();
}
if (GlobalVars.IsWebServerOn)
{
StopWebServer();
}
@ -372,16 +373,8 @@ namespace NovetusLauncher
void ReadConfigValues()
{
LauncherFuncs.ReadConfigValues(GlobalVars.ConfigDir + "\\" + GlobalVars.ConfigName);
if (GlobalVars.CloseOnLaunch == true)
{
checkBox1.Checked = true;
}
else if (GlobalVars.CloseOnLaunch == false)
{
checkBox1.Checked = false;
}
checkBox1.Checked = GlobalVars.CloseOnLaunch;
textBox5.Text = GlobalVars.UserID.ToString();
label18.Text = GlobalVars.PlayerTripcode.ToString();
numericUpDown3.Value = Convert.ToDecimal(GlobalVars.PlayerLimit);
@ -395,6 +388,7 @@ namespace NovetusLauncher
label37.Text = GlobalVars.IP;
label38.Text = GlobalVars.RobloxPort.ToString();
checkBox4.Checked = GlobalVars.UPnP;
checkBox2.Checked = GlobalVars.DiscordPresence;
ConsolePrint("Config loaded.", 3);
ReadClientValues(GlobalVars.SelectedClient);
}
@ -517,11 +511,8 @@ namespace NovetusLauncher
{
GlobalVars.SelectedClient = listBox2.SelectedItem.ToString();
ReadClientValues(GlobalVars.SelectedClient);
GlobalVars.presence.state = "In Launcher";
GlobalVars.presence.details = "Selected " + GlobalVars.SelectedClient;
GlobalVars.presence.largeImageText = GlobalVars.PlayerName + " | In Launcher";
DiscordRpc.UpdatePresence(ref GlobalVars.presence);
}
LauncherFuncs.UpdateRichPresence(LauncherFuncs.LauncherState.InLauncher);
}
void CheckBox3CheckedChanged(object sender, EventArgs e)
{
@ -864,18 +855,12 @@ namespace NovetusLauncher
client.Exited += new EventHandler(ClientExited);
client.Start();
SecurityFuncs.RenameWindow(client, ScriptGenerator.ScriptType.Client);
GlobalVars.presence.details = "";
GlobalVars.presence.state = "In " + GlobalVars.SelectedClient + " Game";
GlobalVars.presence.largeImageText = GlobalVars.PlayerName + " | In " + GlobalVars.SelectedClient + " Game";
DiscordRpc.UpdatePresence(ref GlobalVars.presence);
}
LauncherFuncs.UpdateRichPresence(LauncherFuncs.LauncherState.InMPGame);
}
void ClientExited(object sender, EventArgs e)
{
GlobalVars.presence.state = "In Launcher";
GlobalVars.presence.details = "Selected " + GlobalVars.SelectedClient;
GlobalVars.presence.largeImageText = GlobalVars.PlayerName + " | In Launcher";
DiscordRpc.UpdatePresence(ref GlobalVars.presence);
LauncherFuncs.UpdateRichPresence(LauncherFuncs.LauncherState.InLauncher);
if (GlobalVars.CloseOnLaunch == true)
{
this.Visible = true;
@ -916,11 +901,8 @@ namespace NovetusLauncher
client.Exited += new EventHandler(StudioExited);
client.Start();
SecurityFuncs.RenameWindow(client, ScriptGenerator.ScriptType.Solo);
GlobalVars.presence.details = GlobalVars.Map;
GlobalVars.presence.state = "In " + GlobalVars.SelectedClient + " Solo Game";
GlobalVars.presence.largeImageText = GlobalVars.PlayerName + " | In " + GlobalVars.SelectedClient + " Solo Game";
DiscordRpc.UpdatePresence(ref GlobalVars.presence);
}
LauncherFuncs.UpdateRichPresence(LauncherFuncs.LauncherState.InSoloGame);
}
catch (Exception ex) when (!Env.Debugging)
{
ConsolePrint("ERROR 2 - Failed to launch Novetus. (" + ex.Message + ")", 2);
@ -1020,11 +1002,8 @@ namespace NovetusLauncher
client.Exited += new EventHandler(StudioExited);
client.Start();
SecurityFuncs.RenameWindow(client, ScriptGenerator.ScriptType.Studio);
GlobalVars.presence.details = GlobalVars.Map;
GlobalVars.presence.state = "In " + GlobalVars.SelectedClient + " Studio";
GlobalVars.presence.largeImageText = GlobalVars.PlayerName + " | In " + GlobalVars.SelectedClient + " Studio";
DiscordRpc.UpdatePresence(ref GlobalVars.presence);
}
LauncherFuncs.UpdateRichPresence(LauncherFuncs.LauncherState.InStudio);
}
catch (Exception ex) when (!Env.Debugging)
{
ConsolePrint("ERROR 2 - Failed to launch Novetus. (" + ex.Message + ")", 2);
@ -1034,10 +1013,7 @@ namespace NovetusLauncher
void StudioExited(object sender, EventArgs e)
{
GlobalVars.presence.state = "In Launcher";
GlobalVars.presence.details = "Selected " + GlobalVars.SelectedClient;
GlobalVars.presence.largeImageText = GlobalVars.PlayerName + " | In Launcher";
DiscordRpc.UpdatePresence(ref GlobalVars.presence);
LauncherFuncs.UpdateRichPresence(LauncherFuncs.LauncherState.InLauncher);
if (GlobalVars.CloseOnLaunch == true)
{
this.Visible = true;
@ -1522,5 +1498,19 @@ namespace NovetusLauncher
MessageBox.Show("There is no asset cache to clear.");
}
}
private void checkBox2_CheckedChanged(object sender, EventArgs e)
{
if (checkBox2.Checked == true && GlobalVars.DiscordPresence == false)
{
GlobalVars.DiscordPresence = true;
MessageBox.Show("Restart the launcher to apply changes.");
}
else if (checkBox2.Checked == false && GlobalVars.DiscordPresence == true)
{
GlobalVars.DiscordPresence = false;
MessageBox.Show("Restart the launcher to apply changes.");
}
}
}
}

View File

@ -117,6 +117,10 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="label9.Text" xml:space="preserve">
<value>ROBLOX and the ROBLOX Clients were made by the ROBLOX Corporation. The ROBLOX Corporation does not support or endorse the creation of Novetus. Bitl is not affiliated with the ROBLOX Corporation or its subsidiaries. Bitl does not own any of the content included with Novetus. LUA scripts were used to build a client that can connect to LAN and the Internet. The LUA scripts used were borrowed from the RBXPri client and modified for this project. All credit for the LUA code included with the RBXPri client goes to the RBXPri team. All credit for the LUA code used with "non-modern" clients goes to Scripter John and EnergyCell. All credit for the LUA code used for character customization goes to RBXBanLand.
</value>
</data>
<data name="label4.Text" xml:space="preserve">
<value>NOTE:
- If you have a problem where you can't see your character, REGENERATE YOUR PLAYER ID THEN REJOIN THE SERVER.
@ -126,10 +130,6 @@
</value>
</data>
<data name="label9.Text" xml:space="preserve">
<value>ROBLOX and the ROBLOX Clients were made by the ROBLOX Corporation. The ROBLOX Corporation does not support or endorse the creation of Novetus. Bitl is not affiliated with the ROBLOX Corporation or its subsidiaries. Bitl does not own any of the content included with Novetus. LUA scripts were used to build a client that can connect to LAN and the Internet. The LUA scripts used were borrowed from the RBXPri client and modified for this project. All credit for the LUA code included with the RBXPri client goes to the RBXPri team. All credit for the LUA code used with "non-modern" clients goes to Scripter John and EnergyCell. All credit for the LUA code used for character customization goes to RBXBanLand.
</value>
</data>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />

View File

@ -21,7 +21,9 @@ namespace NovetusLauncher
/// </summary>
public partial class LoaderForm : Form
{
public LoaderForm()
DiscordRpc.EventHandlers handlers;
public LoaderForm()
{
//
// The InitializeComponent() call is required for Windows Forms designer support.
@ -32,11 +34,36 @@ namespace NovetusLauncher
// TODO: Add constructor code after the InitializeComponent() call.
//
}
void LoaderFormLoad(object sender, EventArgs e)
public void ReadyCallback()
{
}
public void DisconnectedCallback(int errorCode, string message)
{
}
public void ErrorCallback(int errorCode, string message)
{
}
public void JoinCallback(string secret)
{
}
public void SpectateCallback(string secret)
{
}
public void RequestCallback(DiscordRpc.JoinRequest request)
{
}
void LoaderFormLoad(object sender, EventArgs e)
{
string[] lines = File.ReadAllLines(GlobalVars.ConfigDir + "\\info.txt");
GlobalVars.DefaultClient = lines[1];
GlobalVars.Version = lines[0];
GlobalVars.DefaultClient = lines[1];
GlobalVars.DefaultMap = lines[2];
GlobalVars.SelectedClient = GlobalVars.DefaultClient;
GlobalVars.Map = GlobalVars.DefaultMap;
@ -44,8 +71,22 @@ namespace NovetusLauncher
main.ShowDialog();
System.Threading.Timer timer = new System.Threading.Timer(new TimerCallback(CheckIfFinished), null, 1, 0);
}
void StartGame()
void StartDiscord()
{
handlers = new DiscordRpc.EventHandlers();
handlers.readyCallback = ReadyCallback;
handlers.disconnectedCallback += DisconnectedCallback;
handlers.errorCallback += ErrorCallback;
handlers.joinCallback += JoinCallback;
handlers.spectateCallback += SpectateCallback;
handlers.requestCallback += RequestCallback;
DiscordRpc.Initialize(GlobalVars.appid, ref handlers, true, "");
LauncherFuncs.UpdateRichPresence(LauncherFuncs.LauncherState.LoadingURI, true);
}
void StartGame()
{
string ExtractedArg = GlobalVars.SharedArgs.Replace("novetus://", "").Replace("novetus", "").Replace(":", "").Replace("/", "").Replace("?", "");
string ConvertedArg = SecurityFuncs.Base64Decode(ExtractedArg);
@ -139,19 +180,13 @@ namespace NovetusLauncher
clientproc.Exited += new EventHandler(ClientExited);
clientproc.Start();
SecurityFuncs.RenameWindow(clientproc, ScriptGenerator.ScriptType.Client);
GlobalVars.presence.details = "";
GlobalVars.presence.state = "In " + GlobalVars.SelectedClient + " Game";
GlobalVars.presence.largeImageText = GlobalVars.PlayerName + " | In " + GlobalVars.SelectedClient + " Game";
DiscordRpc.UpdatePresence(ref GlobalVars.presence);
LauncherFuncs.UpdateRichPresence(LauncherFuncs.LauncherState.InMPGame);
this.Visible = false;
}
void ClientExited(object sender, EventArgs e)
{
GlobalVars.presence.state = "In Launcher";
GlobalVars.presence.details = "Selected " + GlobalVars.SelectedClient;
GlobalVars.presence.largeImageText = GlobalVars.PlayerName + " | In Launcher";
DiscordRpc.UpdatePresence(ref GlobalVars.presence);
LauncherFuncs.UpdateRichPresence(LauncherFuncs.LauncherState.InLauncher);
this.Close();
}
@ -163,6 +198,11 @@ namespace NovetusLauncher
}
else
{
if (GlobalVars.DiscordPresence)
{
label1.Text = "Starting Discord Rich Presence...";
StartDiscord();
}
label1.Text = "Launching Game...";
StartGame();
}

View File

@ -3,6 +3,21 @@
Source code for Novetus' launcher, installer, LUA scripts, and server.
ROBLOX and the ROBLOX Clients were made by the ROBLOX Corporation.
The ROBLOX Corporation does not support or endorse the creation of Novetus.
Bitl is not affiliated with the ROBLOX Corporation or its subsidiaries.
Bitl does not own any of the content included with Novetus.
LUA scripts were used to build a client that can connect to LAN and the Internet.
The LUA scripts used were borrowed from the RBXPri client and merged into 1 single script.
All credit for the LUA code included with the RBXPri client goes to the RBXPri team.
All credit for the LUA code used with "non-modern" clients goes to Scripter John and EnergyCell.
All credit for the LUA code used for character customization goes to RBXBanLand.
The Discord Rich Presence icons used for this application use Mark James' Silk icon set 1.3.
http://www.famfamfam.com/lab/icons/silk/
This product includes PHP, freely available from http://www.php.net/
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
@ -14,4 +29,6 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see http://www.gnu.org/licenses/.
along with this program. If not, see http://www.gnu.org/licenses/.
TL,DR version here: https://github.com/Bitl/Novetus_src/blob/master/LICENCE.MD