Skip to content
This repository has been archived by the owner on Oct 16, 2024. It is now read-only.

Commit

Permalink
Marseyfluff
Browse files Browse the repository at this point in the history
  • Loading branch information
misandrie committed Feb 14, 2024
1 parent 76073ef commit 3f0e6fc
Show file tree
Hide file tree
Showing 10 changed files with 210 additions and 57 deletions.
2 changes: 2 additions & 0 deletions Marsey/Game/Patches/Jammer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ namespace Marsey.Game.Patches;
/// <remarks><para>Not to be confused with Stealthsey.Redial.</para></remarks>
public static class Jammer
{
/// "Disabling engine redial instead of putting a check in Loader's RedialAPI actually doesnt let the client close"
/// Is, unfortunately, still just an excuse.
public static void Patch()
{
if (!MarseyConf.JamDials) return;
Expand Down
27 changes: 18 additions & 9 deletions SS14.Launcher/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@
using Avalonia.Platform;
using JetBrains.Annotations;
using Serilog;
using Splat;
using SS14.Launcher.Models.Data;
using SS14.Launcher.Models.OverrideAssets;
using SS14.Launcher.Utility;

namespace SS14.Launcher;

Expand Down Expand Up @@ -48,28 +51,34 @@ public override void Initialize()

private void LoadBaseAssets()
{
var loader = AvaloniaLocator.Current.GetService<IAssetLoader>()!;
DataManager _cfg = Locator.Current.GetRequiredService<DataManager>();
IAssetLoader loader = AvaloniaLocator.Current.GetService<IAssetLoader>()!;

var logoUris = loader.GetAssets(new Uri($"avares://SS14.Launcher/Assets/logos"), null);
var rand = new Random();
var logolist = new List<System.Uri>(logoUris);
IEnumerable<Uri> logoUris = loader.GetAssets(new Uri($"avares://SS14.Launcher/Assets/logos"), null);
Random rand = new Random();
List<Uri> logolist = new List<System.Uri>(logoUris);

foreach (var (name, (path, type)) in AssetDefs)
{
Uri assetUri;
if (name == "LogoLong" && logolist.Count > 0)
{
var randomIndex = rand.Next(logolist.Count);
var randomAsset = logolist[randomIndex];
assetUri = new Uri(randomAsset.AbsoluteUri);
if (_cfg.GetCVar(CVars.RandHeader))
{
int randomIndex = rand.Next(logolist.Count);
Uri randomAsset = logolist[randomIndex];
assetUri = new Uri(randomAsset.AbsoluteUri);
}
else
assetUri = new Uri($"avares://SS14.Launcher/Assets/logo-long.png");
}
else
{
assetUri = new Uri($"avares://SS14.Launcher/Assets/{path}");
}

using var dataStream = loader.Open(assetUri);
var asset = LoadAsset(type, dataStream);
using Stream dataStream = loader.Open(assetUri);
object asset = LoadAsset(type, dataStream);

_baseAssets.Add(name, asset);
Resources.Add(name, asset);
Expand Down
5 changes: 3 additions & 2 deletions SS14.Launcher/LauncherVersion.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
using System;
using Marsey.Config;

namespace SS14.Launcher;

public static class LauncherVersion
{
public const string Name = "SS14.Launcher";
public static Version? Version => typeof(LauncherVersion).Assembly.GetName().Version;
public const string Name = "Marseyloader";
public static Version? Version => MarseyVars.MarseyVersion;
}
25 changes: 25 additions & 0 deletions SS14.Launcher/MarseyFluff/TitleManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
using DynamicData;
using Marsey.Patches;
using Marsey.Subversion;
using Splat;
using SS14.Launcher.Models.Data;
using SS14.Launcher.Utility;

namespace SS14.Launcher.MarseyFluff;

Expand All @@ -19,6 +22,13 @@ public class TitleManager

public TitleManager()
{
DataManager cfg = Locator.Current.GetRequiredService<DataManager>(); // Thanks for inspiration.gif
if (!cfg.GetCVar(CVars.RandTitle))
{
RandomTitle = LauncherVersion.Name;
return;
}

List<TitleCondition> titleConditions = new List<TitleCondition>
{
new TitleCondition { Condition = () => OperatingSystem.IsWindows(), Message = "if (OperatingSystem.IsWindows()" },
Expand Down Expand Up @@ -60,6 +70,7 @@ public TitleManager()
[
"Marsey is the cutest cat", "Not a cheat loader",
"PR self-merging solutions", "RSHOE please come back",
"Today I learned RSHOE is datae, it has never been more over",
"As audited on discord.gg/ss14", "Leading disabler of engine signature checks",
"Sigmund Goldberg died for this", "Sandbox sidestep simulator", "DIY bomb tutorials",
"incel matchmaking service", "#1 ransomware provider", "God, King & Bussy",
Expand Down Expand Up @@ -99,9 +110,23 @@ public TitleManager()
"asking people to do the thug shaker"
];

private static readonly List<string> Actions =
[
"Pumping nitrous into distro", "Injecting plasma into batteries", "Slipcuffing hos", "Starting a cult", "Rolling for antag",
"Plasmaflooding station", "Declaring cargonia", "Evading bans", "Taking fuel tanks for a walk", "Gibbing for no reason",
"Bullying trialmins", "ANNOUNCING PRESENCE", "Petting Marsey", "Gossiping about spaceman drama", "Porting /vg/ to 14",
"Granting +HOST", "Playing Balalaika", "Anime past 2018 is slop", "Trading Oil", "Abusing Roskomnadzor", "Making fun of people on mastodon",
"Hacking the powernet", "Overthrowing the captain", "Building a mech", "Creating AI laws", "Running diagnostics on the engine",
"Upgrading the medbay", "Securing the armory", "Repairing hull breaches", "Conducting xenobio research", "Exploring lavaland",
"Mining for plasma", "Crafting improv shells", "Setting up the SM", "Breaching into secure areas", "Fighting syndicate operatives",
"Escaping on the shuttle", "Reviving dead crewmembers", "Cloning the clown", "Rushing the captain's spare ID", "Sabotaging telecomms",
"Disposal bypassing into armory", "Exploiting pulling"
];

public string RandomTitle { get; }

public static string RandTitle() => Titles[Random.Next(Titles.Count)];
public static string RandTagLine() => TagLines[Random.Next(TagLines.Count)];
public static string RandBanReason() => BanReasons[Random.Next(BanReasons.Count)];
public static string RandAction() => Actions[Random.Next(Actions.Count)];
}
29 changes: 27 additions & 2 deletions SS14.Launcher/Models/Data/CVars.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,6 @@ public static readonly CVarDef<bool> HasDismissedEarlyAccessWarning
/// </summary>
public static readonly CVarDef<string> SelectedLogin = CVarDef.Create("SelectedLogin", "");

//public static readonly CVarDef<string> Fingerprint = CVarDef.Create("Fingerprint", "");

/// <summary>
/// Maximum amount of TOTAL versions to keep in the content database.
/// </summary>
Expand Down Expand Up @@ -149,6 +147,11 @@ public static readonly CVarDef<bool> HasDismissedEarlyAccessWarning
/// </summary>
public static readonly CVarDef<bool> ForcingHWId = CVarDef.Create("ForcingHWId", false);

/// <summary>
/// Do not log in anywhere when starting the loader
/// </summary>
public static readonly CVarDef<bool> NoActiveInit = CVarDef.Create("NoActiveInit", false);

// HWID

/// <summary>
Expand All @@ -172,6 +175,28 @@ public static readonly CVarDef<bool> HasDismissedEarlyAccessWarning
/// MarseyApi endpoint url
/// </summary>
public static readonly CVarDef<string> MarseyApiEndpoint = CVarDef.Create("MarseyApiEndpoint", "https://fujo.love/api/v1");

/// <summary>
/// Ignore "Marsey-M" (required updates) releases
/// </summary>
public static readonly CVarDef<bool> MarseyApiIgnoreForced = CVarDef.Create("MarseyApiIgnoreForced", false);

// Fluff

/// <summary>
/// Use a random title and tagline combination
/// </summary>
public static readonly CVarDef<bool> RandTitle = CVarDef.Create("RandTitle", true);

/// <summary>
/// Use a random header image
/// </summary>
public static readonly CVarDef<bool> RandHeader = CVarDef.Create("RandHeader", true);

/// <summary>
/// Replace connection messages with a random (un)funny action
/// </summary>
public static readonly CVarDef<bool> RandConnAction = CVarDef.Create("RandConnAction", false);
}

/// <summary>
Expand Down
76 changes: 46 additions & 30 deletions SS14.Launcher/ViewModels/ConnectingViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using System.Threading;
using ReactiveUI;
using Splat;
using SS14.Launcher.MarseyFluff;
using SS14.Launcher.Models;
using SS14.Launcher.Utility;

Expand Down Expand Up @@ -147,38 +148,53 @@ public string SpeedText
}
}

public string StatusText =>
_connectorStatus switch
public string StatusText
{
get
{
Connector.ConnectionStatus.None => "Starting connection..." + _reasonSuffix,
Connector.ConnectionStatus.UpdateError =>
"There was an error while downloading server content. Please ask on Discord for support if the problem persists.",
Connector.ConnectionStatus.Updating => ("Updating: " + _updaterStatus switch
Random rnd = new Random();
if (rnd.Next(10) != 0 || _connectorStatus == Connector.ConnectionStatus.ConnectionFailed ||
_connectorStatus == Connector.ConnectionStatus.NotAContentBundle ||
_connectorStatus == Connector.ConnectionStatus.ClientExited)
{
Updater.UpdateStatus.CheckingClientUpdate => "Checking for server content update...",
Updater.UpdateStatus.DownloadingEngineVersion => "Downloading server content...",
Updater.UpdateStatus.DownloadingClientUpdate => "Downloading server content...",
Updater.UpdateStatus.FetchingClientManifest => "Fetching server manifest...",
Updater.UpdateStatus.Verifying => "Verifying download integrity...",
Updater.UpdateStatus.CullingEngine => "Clearing old content...",
Updater.UpdateStatus.CullingContent => "Clearing old server content...",
Updater.UpdateStatus.Ready => "Update done!",
Updater.UpdateStatus.CheckingEngineModules => "Checking for additional dependencies...",
Updater.UpdateStatus.DownloadingEngineModules => "Downloading extra dependencies...",
Updater.UpdateStatus.CommittingDownload => "Synchronizing to disk...",
Updater.UpdateStatus.LoadingIntoDb => "Storing assets in database...",
Updater.UpdateStatus.LoadingContentBundle => "Loading content bundle...",
_ => "You shouldn't see this"
}) + _reasonSuffix,
Connector.ConnectionStatus.Connecting => "Fetching connection info from server..." + _reasonSuffix,
Connector.ConnectionStatus.ConnectionFailed => "Failed to connect to server!",
Connector.ConnectionStatus.StartingClient => "Starting client..." + _reasonSuffix,
Connector.ConnectionStatus.NotAContentBundle => "File is not a valid content bundle!",
Connector.ConnectionStatus.ClientExited => _connector.ClientExitedBadly
? "Client seems to have crashed while starting. If this persists, please ask on Discord or GitHub for support."
: "",
_ => ""
};
return _connectorStatus switch
{
Connector.ConnectionStatus.None => "Starting connection..." + _reasonSuffix,
Connector.ConnectionStatus.UpdateError =>
"There was an error while downloading server content. Please ask on Discord for support if the problem persists.",
Connector.ConnectionStatus.Updating => ("Updating: " + _updaterStatus switch
{
Updater.UpdateStatus.CheckingClientUpdate => "Checking for server content update...",
Updater.UpdateStatus.DownloadingEngineVersion => "Downloading server content...",
Updater.UpdateStatus.DownloadingClientUpdate => "Downloading server content...",
Updater.UpdateStatus.FetchingClientManifest => "Fetching server manifest...",
Updater.UpdateStatus.Verifying => "Verifying download integrity...",
Updater.UpdateStatus.CullingEngine => "Clearing old content...",
Updater.UpdateStatus.CullingContent => "Clearing old server content...",
Updater.UpdateStatus.Ready => "Update done!",
Updater.UpdateStatus.CheckingEngineModules => "Checking for additional dependencies...",
Updater.UpdateStatus.DownloadingEngineModules => "Downloading extra dependencies...",
Updater.UpdateStatus.CommittingDownload => "Synchronizing to disk...",
Updater.UpdateStatus.LoadingIntoDb => "Storing assets in database...",
Updater.UpdateStatus.LoadingContentBundle => "Loading content bundle...",
_ => "You shouldn't see this"
}) + _reasonSuffix,
Connector.ConnectionStatus.Connecting => "Fetching connection info from server..." + _reasonSuffix,
Connector.ConnectionStatus.ConnectionFailed => "Failed to connect to server!",
Connector.ConnectionStatus.StartingClient => "Starting client..." + _reasonSuffix,
Connector.ConnectionStatus.NotAContentBundle => "File is not a valid content bundle!",
Connector.ConnectionStatus.ClientExited => _connector.ClientExitedBadly
? "Client seems to have crashed while starting. If this persists, please ask on Discord or GitHub for support."
: "",
_ => ""
};
}

// 10% to roll a random "Action" from the titlemanager
return TitleManager.RandAction();
}
}


public static void StartConnect(MainWindowViewModel windowVm, string address, string? givenReason = null)
{
Expand Down
2 changes: 1 addition & 1 deletion SS14.Launcher/ViewModels/MainWindowLoginViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public MainWindowLoginViewModel()
SwitchToLogin();
}

public string Version => $"v{LauncherVersion.Version}";
public string Version => $"{LauncherVersion.Name}/v{LauncherVersion.Version}";

public void SwitchToLogin()
{
Expand Down
55 changes: 53 additions & 2 deletions SS14.Launcher/ViewModels/MainWindowTabs/OptionsTabViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@ public OptionsTabViewModel()
}

#if RELEASE
public bool HideDisableSigning => true;
public bool HideDebugKnobs => true;
#else
public bool HideDisableSigning => false;
public bool HideDebugKnobs => false;
#endif

public override string Name => "Options";
Expand Down Expand Up @@ -176,6 +176,7 @@ public bool MarseyApi
set
{
Cfg.SetCVar(CVars.MarseyApi, value);
OnPropertyChanged(nameof(MarseyApi));
Cfg.CommitConfig();
}
}
Expand All @@ -186,7 +187,27 @@ public string MarseyApiEndpoint
get => Cfg.GetCVar(CVars.MarseyApiEndpoint);
set => _endpoint = value;
}

public bool MarseyApiIgnoreForced
{
get => Cfg.GetCVar(CVars.MarseyApiIgnoreForced);
set
{
Cfg.SetCVar(CVars.MarseyApiIgnoreForced, value);
Cfg.CommitConfig();
}
}

public bool NoActiveInit
{
get => Cfg.GetCVar(CVars.NoActiveInit);
set
{
Cfg.SetCVar(CVars.NoActiveInit, value);
Cfg.CommitConfig();
}
}

public bool DisableRPC
{
get => Cfg.GetCVar(CVars.DisableRPC);
Expand Down Expand Up @@ -254,6 +275,36 @@ public bool MarseyHole
Cfg.CommitConfig();
}
}

public bool RandTitle
{
get => Cfg.GetCVar(CVars.RandTitle);
set
{
Cfg.SetCVar(CVars.RandTitle, value);
Cfg.CommitConfig();
}
}

public bool RandHeader
{
get => Cfg.GetCVar(CVars.RandHeader);
set
{
Cfg.SetCVar(CVars.RandHeader, value);
Cfg.CommitConfig();
}
}

public bool RandConnAction
{
get => Cfg.GetCVar(CVars.RandConnAction);
set
{
Cfg.SetCVar(CVars.RandConnAction, value);
Cfg.CommitConfig();
}
}

public string Current => MarseyVars.MarseyVersion.ToString();

Expand Down
5 changes: 4 additions & 1 deletion SS14.Launcher/ViewModels/MainWindowViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,9 @@ public MainWindowViewModel()
AccountDropDown = new AccountDropDownViewModel(this);
LoginViewModel = new MainWindowLoginViewModel();

if (_cfg.GetCVar(CVars.NoActiveInit))
_loginMgr.ActiveAccount = null;

this.WhenAnyValue(x => x._loginMgr.ActiveAccount)
.Subscribe(s =>
{
Expand Down Expand Up @@ -196,7 +199,7 @@ private void CheckLauncherUpdate()
}

int comp = MarseyVars.MarseyVersion.CompareTo(minimum);
if (comp < 0) OutOfDate = true;
if (comp < 0 && _cfg.GetCVar(CVars.MarseyApiIgnoreForced)) OutOfDate = true;
}
catch (HttpRequestException e)
{
Expand Down
Loading

0 comments on commit 3f0e6fc

Please sign in to comment.