From c706098d2ef51cbd1c471e9e62c3c8616bdc6244 Mon Sep 17 00:00:00 2001 From: Bitl Date: Sun, 22 Dec 2019 13:26:42 -0700 Subject: [PATCH] rich presence redo --- Graphics/discord/InCustomization_small.png | Bin 0 -> 3367 bytes Graphics/discord/InGame_small.png | Bin 0 -> 3706 bytes Graphics/discord/InLauncher_small.png | Bin 0 -> 2756 bytes Graphics/discord/InStudio_small.png | Bin 0 -> 3514 bytes NovetusLauncher/NovetusFuncs/GlobalVars.cs | 13 +- NovetusLauncher/NovetusFuncs/LauncherFuncs.cs | 119 ++++++++++++++++-- .../NovetusLauncher/CharacterCustomization.cs | 17 +-- .../NovetusLauncher/MainForm.Designer.cs | 55 +++++--- NovetusLauncher/NovetusLauncher/MainForm.cs | 104 +++++++-------- NovetusLauncher/NovetusLauncher/MainForm.resx | 8 +- .../NovetusLauncher/URI/LoaderForm.cs | 68 +++++++--- README.md | 19 ++- 12 files changed, 280 insertions(+), 123 deletions(-) create mode 100644 Graphics/discord/InCustomization_small.png create mode 100644 Graphics/discord/InGame_small.png create mode 100644 Graphics/discord/InLauncher_small.png create mode 100644 Graphics/discord/InStudio_small.png diff --git a/Graphics/discord/InCustomization_small.png b/Graphics/discord/InCustomization_small.png new file mode 100644 index 0000000000000000000000000000000000000000..b70ce80a99b62002ccbff618e7da1ce92a185586 GIT binary patch literal 3367 zcmd5*vXA|6XLV~fhi1SRUBAO_h`6j)`)mrw=0s(eZ5iqNTZW@CC9 zGZlysB|>SrVucnMSaf`JiUm;)s7e*;P*3Pt;V6`r?sbXDmi@T|d&%YQee+)OKELOA ze$RV9?b;b^KhI?z1VQ#8+k?U($QHcXLUU(>$0)DM2p%>W;lY8Bq}}y37|cu#*bx9h zQhdHCVHOzMrEdQ=1A-Pdy}xagDZ+gaw4fm*C?Jv-H{9EX_sv?`sxQ(kintv3B!GX_ z>E~)&eP97EV6oQLHZkUT>#5xdGrndoIDg&llh_+y{&wz^w~LQQbMrapL=pRo){949 z?f*OqeF9fU2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PwUv$`P;GV9_;W6gxjNpF}^8GGg Kr^xHb`F{W&ekz>+ literal 0 HcmV?d00001 diff --git a/Graphics/discord/InLauncher_small.png b/Graphics/discord/InLauncher_small.png new file mode 100644 index 0000000000000000000000000000000000000000..8dcdd5fc8f837c46187af5de327bf2ffbbdd5951 GIT binary patch literal 2756 zcmeAS@N?(olHy`uVBq!ia0y~yU;;9k7&zE~)R&4Yzkn2Dage(c!@6@aFM%AEbVpxD z28NCO+M1MG6B0SEQ$lV@O5Z+Z+C;mzK&N|G2X&EH!%J z#f+KW+0|mqjslK7Qn!=~E@nt27Ooa>VNLYw6>0qI=;L+xgX5V1!9>lYGtMq*Z8W`* zWDs?tcAZKcze3cR@QVF$vp?UQ`@1~$`JCTpOF<5#1pH&a9m~JJAn~nWd$IigYqOO9 z{d{lyKEC+KzV(JrD`Jw5+5P#q{P^XqX>X3-`r7pJA|1Ux39A`^t{gBv+-Kba(T<`Yb_564@_Xeox9C_{_oTKzI7abZ?{{F;f@V|+^?@u z#&tEHI&;qo&ZA%K!5xI0K(@^N^X2^STgr0#e{b8G)+6_Cf7}12m)sk2v(Nnads=@z z>zy3=-Jj2GO^ey_W%brHo6k4Y-Rl`_8R?SVu(}wO<}<7-ziq93E2#e5e#^C<-}-+` zb=CfSSlGYD^fCYXJ)5re9DcY#?8~07*P^q}?kM|NS+h5!-fO&qP@;%r~x0UUGJ_aV^$)D4&&)S%q&2!Uz{lDD@%xW0h?%#X9 zKJN#!!5`Kcc7I#DL5|+MzCP`X(7*@xQu)1`fWiIb&rNXZj!lSOpWK#z;Og~t>p)3+ z@8dpTqOJg^kpItqUYwuc4@_QkEK)I2%PqNI2j73&>TXl@{cZNyiWe{UuRq%2{r&!~ zYdzQF>uc9awjWN^eX+CduYC5|AAf|WU!V2yk?{Px*JK_JcmfgM_x&~~Q+~g*@7k2y zy?&B=|5RRI7Yj`14+|o=tM1i&J_`)&4{uKcUH)|P_r8D3pMXUX4eKk6z(ub!7rbp; zUbh*PKIZYSH%ZtqY2e^g32?$^2J@1l!a)al=vK#md a_?bOp(mj(aC!WiJ4D@vMb6Mw<&;$U;powGv literal 0 HcmV?d00001 diff --git a/Graphics/discord/InStudio_small.png b/Graphics/discord/InStudio_small.png new file mode 100644 index 0000000000000000000000000000000000000000..cc842158ff8d7ec7029ebad23395ae2519e0f5d6 GIT binary patch literal 3514 zcmd6q>r)d~7{-@NRYag8)8HrsrZDiqK~aoQa6v2zS_LY)zy?IYMoGf`q6P?F>ZOfk z+p#SOsI?RY!iI*p3CL}fONJs~OA;;`5K}Hj2}X?J5|W-U_JjX`@L~7tIkU5Kp7%WO z?|t{Xu#h0D)$3P75M;GCIPf3@nSw`CXw?cZyge=Q7zNC}Qghal?~<7FaFE2bzO;q-4JjzSi^lz1Hph z?Jf?khf9MkYX1y)yn7$VoW2=RpTB>l_)73ENf&>&jH%@pf8PFch})WsM9a3@+rus# z{(eoPOTs=^`k;%at7qM#lB+Q~{UtqVczmE?SbnU#q;tICLgwR>Sy}HYirh&gQd78~ zt&L+Rl3v~B=f@V(I9*HR!f*$?5+J{1Z@h;pDlDf_Y{J5I+;MwIdc&G zwGi}a@W)?RFBzb{53rqGbJSvhrz!`^D5m1}cDkmpu&`VjpO#jGU<5&+@YvWGUE_V` z&2gOU$kt2f>80Hyg+ehUWvWNUd(tV?S5HJ!9YyZTMH-#1q<4`pzqyGnNb;Krq3H9+{GVtmP64?+FTGe1qmC2oWr?*dIVc(ccJO^H$Sva=b_d4*9Jum7$sG z>kOi6mWMP7g#gmbY<746X(`?y{F#{qf^G0h0td7(r$OOg3knz@yYvP6=`@_|n^asa zjc1PQQJA-oU5Q{D$5#@pl5Bx?;Z!c6^?Lm>A}h9X;Gxyh;rxGe{PsZ54B1a=b+ZH?fH`{l9KQiW32OR%aOCvz9@=plf~x(GuQ zfXog5N~t0_eHtHbPFk9}`awCj%D4aGP242ui7;^C5T((XDBwM3~g_lY4H+?AFF3Oh~MRlWaw?lR*g2i*S?tM)Dj{cd9 zE|Rmeb2C2h{MmyG(-h~rWg+ZZSZ}jl34Ceem~#igyza6=ogO$9i%S(_^-W=1F)`gq zupTAr{^C%m(UGFjaSGMmCu2fWWS+JhkRRrDn?2joQzc=lTW#14w`rKBWj(A{|6>Vk z<&#^fv51t{8SYZ3IrDa*2A*qc>N44NlX|o(f-bB*)#v6VVe+*%Zvd9bGbW`)?z~2W tUds@kejSlqQe~0Tx(xc$)+mw6@GqB1{mjY48~krUdv}Kf@^&3P{~y<}q`?3H literal 0 HcmV?d00001 diff --git a/NovetusLauncher/NovetusFuncs/GlobalVars.cs b/NovetusLauncher/NovetusFuncs/GlobalVars.cs index 3d54629..441ae7f 100644 --- a/NovetusLauncher/NovetusFuncs/GlobalVars.cs +++ b/NovetusLauncher/NovetusFuncs/GlobalVars.cs @@ -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/"; diff --git a/NovetusLauncher/NovetusFuncs/LauncherFuncs.cs b/NovetusLauncher/NovetusFuncs/LauncherFuncs.cs index fe087df..886fccd 100644 --- a/NovetusLauncher/NovetusFuncs/LauncherFuncs.cs +++ b/NovetusLauncher/NovetusFuncs/LauncherFuncs.cs @@ -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); + } + } } diff --git a/NovetusLauncher/NovetusLauncher/CharacterCustomization.cs b/NovetusLauncher/NovetusLauncher/CharacterCustomization.cs index 9b7c949..bf5c449 100644 --- a/NovetusLauncher/NovetusLauncher/CharacterCustomization.cs +++ b/NovetusLauncher/NovetusLauncher/CharacterCustomization.cs @@ -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 diff --git a/NovetusLauncher/NovetusLauncher/MainForm.Designer.cs b/NovetusLauncher/NovetusLauncher/MainForm.Designer.cs index 5cfa4d6..af3f300 100644 --- a/NovetusLauncher/NovetusLauncher/MainForm.Designer.cs +++ b/NovetusLauncher/NovetusLauncher/MainForm.Designer.cs @@ -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; } } diff --git a/NovetusLauncher/NovetusLauncher/MainForm.cs b/NovetusLauncher/NovetusLauncher/MainForm.cs index c100b0a..46e2a3d 100644 --- a/NovetusLauncher/NovetusLauncher/MainForm.cs +++ b/NovetusLauncher/NovetusLauncher/MainForm.cs @@ -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."); + } + } } } diff --git a/NovetusLauncher/NovetusLauncher/MainForm.resx b/NovetusLauncher/NovetusLauncher/MainForm.resx index 0872f9c..fc43fb1 100644 --- a/NovetusLauncher/NovetusLauncher/MainForm.resx +++ b/NovetusLauncher/NovetusLauncher/MainForm.resx @@ -117,6 +117,10 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + 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. + + 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 @@ - - - - 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. diff --git a/NovetusLauncher/NovetusLauncher/URI/LoaderForm.cs b/NovetusLauncher/NovetusLauncher/URI/LoaderForm.cs index c93c185..6e576c3 100644 --- a/NovetusLauncher/NovetusLauncher/URI/LoaderForm.cs +++ b/NovetusLauncher/NovetusLauncher/URI/LoaderForm.cs @@ -21,7 +21,9 @@ namespace NovetusLauncher /// 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(); } diff --git a/README.md b/README.md index 3b3cad1..a7fccdc 100644 --- a/README.md +++ b/README.md @@ -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/. \ No newline at end of file +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 \ No newline at end of file