fix ricxh presence. change OpenedGame to a ScriptType
This commit is contained in:
parent
5c18a023d6
commit
06d4d6771d
|
|
@ -317,7 +317,7 @@ namespace NovetusCMD
|
|||
|
||||
static void ServerExited(object sender, EventArgs e)
|
||||
{
|
||||
GlobalVars.GameOpened = GlobalVars.OpenedGame.None;
|
||||
GlobalVars.GameOpened = ScriptType.None;
|
||||
GlobalFuncs.PingMasterServer(0, "The server has removed itself from the master server list.");
|
||||
Environment.Exit(0);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -155,14 +155,14 @@ class CharacterCustomizationShared
|
|||
}
|
||||
|
||||
//discord
|
||||
GlobalFuncs.UpdateRichPresence(GlobalVars.LauncherState.InCustomization, GlobalVars.UserConfiguration.Map);
|
||||
GlobalFuncs.UpdateRichPresence(GlobalVars.LauncherState.InCustomization);
|
||||
|
||||
GlobalFuncs.ReloadLoadoutValue();
|
||||
}
|
||||
|
||||
public void CloseEvent()
|
||||
{
|
||||
GlobalFuncs.UpdateRichPresence(GlobalVars.LauncherState.InLauncher, "");
|
||||
GlobalFuncs.UpdateRichPresence(GlobalFuncs.GetStateForType(GlobalVars.GameOpened));
|
||||
GlobalFuncs.ReloadLoadoutValue();
|
||||
SaveOutfit(false);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1205,6 +1205,17 @@ public class GlobalFuncs
|
|||
}
|
||||
}
|
||||
|
||||
public static void UpdateRichPresence(GlobalVars.LauncherState state, bool initial = false)
|
||||
{
|
||||
string mapname = "";
|
||||
if (GlobalVars.GameOpened != ScriptType.Client)
|
||||
{
|
||||
mapname = GlobalVars.UserConfiguration.Map;
|
||||
}
|
||||
|
||||
UpdateRichPresence(state, GlobalVars.UserConfiguration.SelectedClient, mapname, initial);
|
||||
}
|
||||
|
||||
public static void UpdateRichPresence(GlobalVars.LauncherState state, string mapname, bool initial = false)
|
||||
{
|
||||
UpdateRichPresence(state, GlobalVars.UserConfiguration.SelectedClient, mapname, initial);
|
||||
|
|
@ -1812,13 +1823,13 @@ public class GlobalFuncs
|
|||
switch (type)
|
||||
{
|
||||
case ScriptType.Client:
|
||||
if (!GlobalVars.LocalPlayMode && GlobalVars.GameOpened != GlobalVars.OpenedGame.Server)
|
||||
if (!GlobalVars.LocalPlayMode && GlobalVars.GameOpened != ScriptType.Server)
|
||||
{
|
||||
goto default;
|
||||
}
|
||||
break;
|
||||
case ScriptType.Server:
|
||||
if (GlobalVars.GameOpened == GlobalVars.OpenedGame.Server)
|
||||
if (GlobalVars.GameOpened == ScriptType.Server)
|
||||
{
|
||||
#if LAUNCHER
|
||||
if (box != null)
|
||||
|
|
@ -1844,9 +1855,19 @@ public class GlobalFuncs
|
|||
#endif
|
||||
GlobalVars.UserConfiguration.FirstServerLaunch = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
goto default;
|
||||
}
|
||||
break;
|
||||
case ScriptType.Solo:
|
||||
if (GlobalVars.GameOpened != ScriptType.Studio)
|
||||
{
|
||||
goto default;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
if (GlobalVars.GameOpened == GlobalVars.OpenedGame.Client)
|
||||
if (GlobalVars.GameOpened != ScriptType.None)
|
||||
{
|
||||
#if LAUNCHER
|
||||
if (box != null)
|
||||
|
|
@ -2038,13 +2059,18 @@ public class GlobalFuncs
|
|||
switch (type)
|
||||
{
|
||||
case ScriptType.Client:
|
||||
if (!GlobalVars.LocalPlayMode && GlobalVars.GameOpened != GlobalVars.OpenedGame.Server)
|
||||
if (!GlobalVars.LocalPlayMode && GlobalVars.GameOpened != ScriptType.Server)
|
||||
{
|
||||
goto default;
|
||||
}
|
||||
break;
|
||||
case ScriptType.Solo:
|
||||
if (GlobalVars.GameOpened != ScriptType.Studio)
|
||||
{
|
||||
goto default;
|
||||
}
|
||||
break;
|
||||
case ScriptType.Server:
|
||||
GlobalVars.GameOpened = GlobalVars.OpenedGame.Server;
|
||||
#if LAUNCHER
|
||||
if (box != null)
|
||||
{
|
||||
|
|
@ -2053,9 +2079,9 @@ public class GlobalFuncs
|
|||
#elif CMD
|
||||
PingMasterServer(1, "Server will now display on the defined master server.");
|
||||
#endif
|
||||
break;
|
||||
goto default;
|
||||
default:
|
||||
GlobalVars.GameOpened = GlobalVars.OpenedGame.Client;
|
||||
GlobalVars.GameOpened = type;
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -12,6 +12,18 @@ using System.Collections.Generic;
|
|||
using System.Windows.Forms;
|
||||
#endregion
|
||||
|
||||
#region Script Type
|
||||
public enum ScriptType
|
||||
{
|
||||
Client = 0,
|
||||
Server = 1,
|
||||
Solo = 2,
|
||||
Studio = 3,
|
||||
EasterEgg = 4,
|
||||
None = 5
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Global Variables
|
||||
public static class GlobalVars
|
||||
{
|
||||
|
|
@ -28,15 +40,6 @@ public static class GlobalVars
|
|||
}
|
||||
#endregion
|
||||
|
||||
#region
|
||||
public enum OpenedGame
|
||||
{
|
||||
None = 0,
|
||||
Client = 1,
|
||||
Server = 2
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Class definitions
|
||||
public static FileFormat.ProgramInfo ProgramInformation = new FileFormat.ProgramInfo();
|
||||
public static FileFormat.Config UserConfiguration = new FileFormat.Config();
|
||||
|
|
@ -51,7 +54,7 @@ public static class GlobalVars
|
|||
public static string ExternalIP = SecurityFuncs.GetExternalIPAddress();
|
||||
public static int DefaultRobloxPort = 53640;
|
||||
public static int JoinPort = DefaultRobloxPort;
|
||||
public static OpenedGame GameOpened = OpenedGame.None;
|
||||
public static ScriptType GameOpened = ScriptType.None;
|
||||
#endregion
|
||||
|
||||
#region NovetusCMD
|
||||
|
|
|
|||
|
|
@ -7,18 +7,6 @@ using System.Text.RegularExpressions;
|
|||
using System.Windows.Forms;
|
||||
#endregion
|
||||
|
||||
#region Script Type
|
||||
public enum ScriptType
|
||||
{
|
||||
Client = 0,
|
||||
Server = 1,
|
||||
Solo = 2,
|
||||
Studio = 3,
|
||||
EasterEgg = 4,
|
||||
None = 5
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Script Functions
|
||||
public class ScriptFuncs
|
||||
{
|
||||
|
|
|
|||
|
|
@ -192,7 +192,7 @@ namespace NovetusLauncher
|
|||
handlers.requestCallback += RequestCallback;
|
||||
DiscordRPC.Initialize(GlobalVars.appid, ref handlers, true, "");
|
||||
|
||||
GlobalFuncs.UpdateRichPresence(GlobalVars.LauncherState.InLauncher, "", true);
|
||||
GlobalFuncs.UpdateRichPresence(GlobalFuncs.GetStateForType(GlobalVars.GameOpened), true);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
|
@ -291,14 +291,14 @@ namespace NovetusLauncher
|
|||
|
||||
public void CloseEvent(CancelEventArgs e)
|
||||
{
|
||||
if (GlobalVars.GameOpened != GlobalVars.OpenedGame.None)
|
||||
if (GlobalVars.GameOpened != ScriptType.None)
|
||||
{
|
||||
switch (GlobalVars.GameOpened)
|
||||
{
|
||||
case GlobalVars.OpenedGame.Client:
|
||||
case ScriptType.Client:
|
||||
ShowCloseError("A game is open.", "Game", e);
|
||||
break;
|
||||
case GlobalVars.OpenedGame.Server:
|
||||
case ScriptType.Server:
|
||||
ShowCloseError("A server is open.", "Server", e);
|
||||
break;
|
||||
default:
|
||||
|
|
@ -503,7 +503,7 @@ namespace NovetusLauncher
|
|||
GlobalFuncs.LaunchRBXClient(ScriptType.Server, no3d, false, new EventHandler(ServerExited), ConsoleBox);
|
||||
break;
|
||||
case ScriptType.Solo:
|
||||
GlobalFuncs.LaunchRBXClient(ScriptType.Solo, false, false, new EventHandler(ClientExited), ConsoleBox);
|
||||
GlobalFuncs.LaunchRBXClient(ScriptType.Solo, false, false, new EventHandler(SoloExited), ConsoleBox);
|
||||
break;
|
||||
case ScriptType.Studio:
|
||||
GlobalFuncs.LaunchRBXClient(ScriptType.Studio, false, nomap, new EventHandler(ClientExited), ConsoleBox);
|
||||
|
|
@ -554,25 +554,35 @@ namespace NovetusLauncher
|
|||
|
||||
void ClientExited(object sender, EventArgs e)
|
||||
{
|
||||
if (!GlobalVars.LocalPlayMode && GlobalVars.GameOpened != GlobalVars.OpenedGame.Server)
|
||||
if (!GlobalVars.LocalPlayMode && GlobalVars.GameOpened != ScriptType.Server)
|
||||
{
|
||||
GlobalVars.GameOpened = GlobalVars.OpenedGame.None;
|
||||
GlobalVars.GameOpened = ScriptType.None;
|
||||
}
|
||||
GlobalFuncs.UpdateRichPresence(GlobalVars.LauncherState.InLauncher, "");
|
||||
GlobalFuncs.UpdateRichPresence(GlobalFuncs.GetStateForType(GlobalVars.GameOpened));
|
||||
ClientExitedBase(sender, e);
|
||||
}
|
||||
|
||||
void SoloExited(object sender, EventArgs e)
|
||||
{
|
||||
if (GlobalVars.GameOpened != ScriptType.Studio)
|
||||
{
|
||||
GlobalVars.GameOpened = ScriptType.None;
|
||||
}
|
||||
GlobalFuncs.UpdateRichPresence(GlobalFuncs.GetStateForType(GlobalVars.GameOpened));
|
||||
ClientExitedBase(sender, e);
|
||||
}
|
||||
|
||||
void ServerExited(object sender, EventArgs e)
|
||||
{
|
||||
GlobalVars.GameOpened = GlobalVars.OpenedGame.None;
|
||||
GlobalVars.GameOpened = ScriptType.None;
|
||||
GlobalFuncs.PingMasterServer(0, "The server has removed itself from the master server list.", ConsoleBox);
|
||||
ClientExitedBase(sender, e);
|
||||
}
|
||||
|
||||
void EasterEggExited(object sender, EventArgs e)
|
||||
{
|
||||
GlobalVars.GameOpened = GlobalVars.OpenedGame.None;
|
||||
GlobalFuncs.UpdateRichPresence(GlobalVars.LauncherState.InLauncher, "");
|
||||
GlobalVars.GameOpened = ScriptType.None;
|
||||
GlobalFuncs.UpdateRichPresence(GlobalFuncs.GetStateForType(GlobalVars.GameOpened));
|
||||
SplashLabel.Text = LocalVars.prevsplash;
|
||||
if (GlobalVars.AdminMode)
|
||||
{
|
||||
|
|
@ -1062,7 +1072,7 @@ namespace NovetusLauncher
|
|||
|
||||
public void RestartLauncherAfterSetting(bool check, string title, string subText)
|
||||
{
|
||||
if (GlobalVars.GameOpened != GlobalVars.OpenedGame.None)
|
||||
if (GlobalVars.GameOpened != ScriptType.None)
|
||||
{
|
||||
MessageBox.Show("You must close the currently open client before this setting can be applied.", "Novetus - Client is Open Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
|
|
@ -1190,7 +1200,7 @@ namespace NovetusLauncher
|
|||
|
||||
public void ChangeClient()
|
||||
{
|
||||
if (GlobalVars.GameOpened != GlobalVars.OpenedGame.None)
|
||||
if (GlobalVars.GameOpened != ScriptType.None)
|
||||
{
|
||||
MessageBox.Show("You must close the currently open client before changing clients.", "Novetus - Client is Open Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
|
|
@ -1233,7 +1243,7 @@ namespace NovetusLauncher
|
|||
return;
|
||||
}
|
||||
|
||||
GlobalFuncs.UpdateRichPresence(GlobalVars.LauncherState.InLauncher, "");
|
||||
GlobalFuncs.UpdateRichPresence(GlobalFuncs.GetStateForType(GlobalVars.GameOpened));
|
||||
|
||||
FormCollection fc = Application.OpenForms;
|
||||
|
||||
|
|
|
|||
|
|
@ -129,7 +129,7 @@ namespace NovetusLauncher
|
|||
if (!IsLoaded)
|
||||
return;
|
||||
|
||||
if (GlobalVars.GameOpened != GlobalVars.OpenedGame.None)
|
||||
if (GlobalVars.GameOpened != ScriptType.None)
|
||||
{
|
||||
System.Windows.Forms.MessageBox.Show("You must close the currently open client before changing clients.", "Novetus - Client is Open Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
|
|
@ -178,7 +178,7 @@ namespace NovetusLauncher
|
|||
GlobalVars.UserConfiguration.SelectedClient + " | MAP: " +
|
||||
GlobalVars.UserConfiguration.Map + "]";
|
||||
|
||||
GlobalFuncs.UpdateRichPresence(GlobalVars.LauncherState.InLauncher, "");
|
||||
GlobalFuncs.UpdateRichPresence(GlobalFuncs.GetStateForType(GlobalVars.GameOpened));
|
||||
|
||||
FormCollection fc = System.Windows.Forms.Application.OpenForms;
|
||||
|
||||
|
|
@ -455,7 +455,7 @@ namespace NovetusLauncher
|
|||
if (LocalVars.launcherInitState)
|
||||
return;
|
||||
|
||||
if (GlobalVars.GameOpened != GlobalVars.OpenedGame.None)
|
||||
if (GlobalVars.GameOpened != ScriptType.None)
|
||||
{
|
||||
System.Windows.Forms.MessageBox.Show("You must close the currently open client before changing styles.", "Novetus - Client is Open Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -111,7 +111,7 @@ public partial class NovetusSDK : Form
|
|||
#else
|
||||
GlobalFuncs.LaunchRBXClient("ClientScriptTester", ScriptType.Client, false, false, null);
|
||||
#endif
|
||||
GlobalVars.GameOpened = GlobalVars.OpenedGame.None;
|
||||
GlobalVars.GameOpened = ScriptType.None;
|
||||
break;
|
||||
case SDKApps.XMLContentEditor:
|
||||
XMLContentEditor xml = new XMLContentEditor();
|
||||
|
|
|
|||
|
|
@ -65,11 +65,11 @@ namespace NovetusLauncher
|
|||
|
||||
void ClientExited(object sender, EventArgs e)
|
||||
{
|
||||
if (!GlobalVars.LocalPlayMode && GlobalVars.GameOpened != GlobalVars.OpenedGame.Server)
|
||||
if (!GlobalVars.LocalPlayMode && GlobalVars.GameOpened != ScriptType.Server)
|
||||
{
|
||||
GlobalVars.GameOpened = GlobalVars.OpenedGame.None;
|
||||
GlobalVars.GameOpened = ScriptType.None;
|
||||
}
|
||||
GlobalFuncs.UpdateRichPresence(GlobalVars.LauncherState.InLauncher, "");
|
||||
GlobalFuncs.UpdateRichPresence(GlobalFuncs.GetStateForType(GlobalVars.GameOpened));
|
||||
GlobalVars.IP = oldIP;
|
||||
GlobalVars.JoinPort = oldPort;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ namespace NovetusURI
|
|||
handlers.requestCallback += RequestCallback;
|
||||
DiscordRPC.Initialize(GlobalVars.appid, ref handlers, true, "");
|
||||
|
||||
GlobalFuncs.UpdateRichPresence(GlobalVars.LauncherState.LoadingURI, "", true);
|
||||
GlobalFuncs.UpdateRichPresence(GlobalVars.LauncherState.LoadingURI, true);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
|
@ -81,11 +81,11 @@ namespace NovetusURI
|
|||
|
||||
void ClientExited(object sender, EventArgs e)
|
||||
{
|
||||
if (!GlobalVars.LocalPlayMode && GlobalVars.GameOpened != GlobalVars.OpenedGame.Server)
|
||||
if (!GlobalVars.LocalPlayMode && GlobalVars.GameOpened != ScriptType.Server)
|
||||
{
|
||||
GlobalVars.GameOpened = GlobalVars.OpenedGame.None;
|
||||
GlobalVars.GameOpened = ScriptType.None;
|
||||
}
|
||||
GlobalFuncs.UpdateRichPresence(GlobalVars.LauncherState.InLauncher, "");
|
||||
GlobalFuncs.UpdateRichPresence(GlobalFuncs.GetStateForType(GlobalVars.GameOpened));
|
||||
Close();
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue