Skip to content

Commit d0e64fe

Browse files
New templates, userentries fix, new template action system
1 parent 4924d44 commit d0e64fe

6 files changed

Lines changed: 233 additions & 47 deletions

File tree

Main.cs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ public class Main : MelonMod
99
internal const string Description = "Adds splash text to Void G114's menu.";
1010
internal const string Author = "Mabel Amber";
1111
internal const string Company = "Weather Electric";
12-
internal const string Version = "2.1.1";
12+
internal const string Version = "2.2.0";
1313
internal const string DownloadLink = "https://bonelab.thunderstore.io/package/SoulWithMae/SplashText/";
1414

1515
public static Save SaveData;
@@ -20,6 +20,7 @@ public override void OnInitializeMelon()
2020
Preferences.Setup();
2121
BoneMenu.Setup();
2222
UserData.Setup();
23+
TemplateProcessing.CacheUserFiles();
2324

2425
SaveData = DataManager.Instance._activeSave;
2526

@@ -44,13 +45,21 @@ private static void OnUIRigCreated()
4445
var CPU = SystemInfo.processorType;
4546
var GPU = SystemInfo.graphicsDeviceName;
4647
var GPUVendor = SystemInfo.graphicsDeviceVendor;
48+
var fileCreate = "check your users folder [PlaceTxtFile]";
49+
fileCreate = TemplateProcessing.Process(fileCreate);
4750
string height;
4851
{
4952
var totalInches = SaveData.PlayerSettings.PlayerHeight * 0.393701;
5053
var feet = (int)(totalInches / 12);
5154
var inches = (int)Math.Round(totalInches % 12);
5255
height = $"{feet}'{inches}\"";
5356
}
57+
var randomPicture = "[RandomUserPicture]";
58+
randomPicture = TemplateProcessing.Process(randomPicture);
59+
var randomDocument = "[RandomUserDocument]";
60+
randomDocument = TemplateProcessing.Process(randomDocument);
61+
ModConsole.Msg($"Random picture: {randomPicture}", 1);
62+
ModConsole.Msg($"Random document: {randomDocument}", 1);
5463
ModConsole.Msg($"Test text 1: {testText1}", 1);
5564
ModConsole.Msg($"Test text 2: {testText2}", 1);
5665
ModConsole.Msg($"Test text 3: {testText3}", 1);
@@ -60,6 +69,7 @@ private static void OnUIRigCreated()
6069
ModConsole.Msg($"GPU: {GPU}", 1);
6170
ModConsole.Msg($"GPU Vendor: {GPUVendor}", 1);
6271
ModConsole.Msg($"Height: {height}", 1);
72+
ModConsole.Msg($"File creation: {fileCreate}", 1);
6373
#endif
6474
}
6575
}

README.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,10 @@ These templates get replaced with what their value is.
2525
* [RAM] = Your RAM amount
2626
* [OS] = Your OS
2727
* [GPUVendor] = Your GPU vendor
28-
* [MachineName] = Your machine name
28+
* [MachineName] = Your machine name
29+
* [TotalDiskSpace] = Your total disk space
30+
* [FreeDiskSpace] = Your free disk space
31+
* [RandomUserPicture] = A random picture from the user's pictures folder
32+
* [RandomUserDocument] = A random document from the user's documents folder
33+
* [RandomUserDownloadsFile] = A random file from the user's downloads folder
34+
* [RandomUserDesktopFile] = A random file from the user's desktop folder

Scripts/Helpers/TemplateProcessing.cs

Lines changed: 106 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,52 @@
22

33
public static class TemplateProcessing
44
{
5+
private static readonly List<string> UserPicturesFilenames = [];
6+
private static readonly List<string> UserDocumentsFilenames = [];
7+
private static readonly List<string> UserDownloadsFilenames = [];
8+
private static readonly List<string> UserDesktopFilenames = [];
9+
10+
internal static void CacheUserFiles()
11+
{
12+
// pictures
13+
var picturesFolder = Environment.GetFolderPath(Environment.SpecialFolder.MyPictures);
14+
var files = Directory.GetFiles(picturesFolder).ToList();
15+
foreach (var file in files)
16+
{
17+
UserPicturesFilenames.Add(Path.GetFileName(file));
18+
}
19+
20+
// documents
21+
var documentsFolder = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
22+
files = Directory.GetFiles(documentsFolder).ToList();
23+
foreach (var file in files)
24+
{
25+
UserDocumentsFilenames.Add(Path.GetFileName(file));
26+
}
27+
28+
// downloads
29+
var downloadsFolder = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile) + "\\Downloads";
30+
files = Directory.GetFiles(downloadsFolder).ToList();
31+
foreach (var file in files)
32+
{
33+
UserDownloadsFilenames.Add(Path.GetFileName(file));
34+
}
35+
var folders = Directory.GetDirectories(downloadsFolder).ToList();
36+
foreach (var folder in folders)
37+
{
38+
var cleanFolderName = folder.Replace(downloadsFolder + "\\", "");
39+
UserDownloadsFilenames.Add(cleanFolderName);
40+
}
41+
42+
// desktop
43+
var desktopFolder = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
44+
files = Directory.GetFiles(desktopFolder).ToList();
45+
foreach (var file in files)
46+
{
47+
UserDesktopFilenames.Add(Path.GetFileName(file));
48+
}
49+
}
50+
551
private static readonly Dictionary<string, Func<string>> Replacements = new()
652
{
753
{ "[UserName]", () => HelperMethods.IsAndroid() ? "Quest User" : Environment.UserName },
@@ -45,15 +91,63 @@ public static class TemplateProcessing
4591
}
4692
},
4793
{ "[OS]", () => SystemInfo.operatingSystem },
48-
{ "[MachineName]", () => HelperMethods.IsAndroid() ? "Oculus Quest" : Environment.MachineName }
94+
{ "[MachineName]", () => HelperMethods.IsAndroid() ? "Oculus Quest" : Environment.MachineName },
95+
{ "[TotalDiskSpace]", () =>
96+
{
97+
var drive = new DriveInfo("C");
98+
return drive.TotalSize / 1024 / 1024 / 1024 + " GB";
99+
}
100+
},
101+
{ "[FreeDiskSpace]", () =>
102+
{
103+
var drive = new DriveInfo("C");
104+
return drive.AvailableFreeSpace / 1024 / 1024 / 1024 + " GB";
105+
}
106+
},
107+
{ "[RandomUserPicture]", () =>
108+
{
109+
var rnd = new System.Random();
110+
return UserPicturesFilenames[rnd.Next(UserPicturesFilenames.Count)];
111+
}
112+
},
113+
{ "[RandomUserDocument]", () =>
114+
{
115+
var rnd = new System.Random();
116+
return UserDocumentsFilenames[rnd.Next(UserDocumentsFilenames.Count)];
117+
}
118+
},
119+
{ "[RandomUserDownloadsFile]", () =>
120+
{
121+
var rnd = new System.Random();
122+
return UserDownloadsFilenames[rnd.Next(UserDownloadsFilenames.Count)];
123+
}
124+
},
125+
{ "[RandomUserDesktopFile]", () =>
126+
{
127+
var rnd = new System.Random();
128+
return UserDesktopFilenames[rnd.Next(UserDesktopFilenames.Count)];
129+
}
130+
}
131+
};
132+
133+
private static readonly Dictionary<string, Func<string>> Actions = new()
134+
{
135+
{ "[PlaceTxtFile]", () =>
136+
{
137+
var userFolder = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile);
138+
var txtFile = Path.Combine(userFolder, "gift.txt");
139+
File.WriteAllText(txtFile, FileContents.GetRandomText());
140+
return "";
141+
}
142+
}
49143
};
50144

51145
public static void AddTemplate(string key, Func<string> value)
52146
{
53147
Replacements.Add(key, value);
54148
}
55149

56-
public static string Process(string text)
150+
public static string Process(string text, bool skipActions = false)
57151
{
58152
foreach (var replacement in Replacements)
59153
{
@@ -63,6 +157,16 @@ public static string Process(string text)
63157
}
64158
}
65159

160+
if (skipActions) return text;
161+
162+
foreach (var action in Actions)
163+
{
164+
if (text.Contains(action.Key))
165+
{
166+
text = text.Replace(action.Key, action.Value());
167+
}
168+
}
169+
66170
return text;
67171
}
68172
}

Scripts/Lists/BonelabSplashes.cs

Lines changed: 12 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,17 @@ public static class BonelabSplashes
8888
":3",
8989
"fuck you, i'm a bonelab splash",
9090
"fuckin [UserName] is here",
91-
"do you think steam would take down bonelab's page because the game uses AI in some places"
91+
"do you think steam would take down bonelab's page because the game uses AI in some places",
92+
"my mom asked me if i did the dishes. i yelled \"StressLevelZero!” and she smiled. she knew it was washed.",
93+
"the hands will get you.",
94+
"fuck you [UserName]",
95+
"SLZ PLEAS make hotmk and b-side for just PC",
96+
"Quest: A Detriment To VR!",
97+
"<color=\"yellow\">and when you return to the place that you call home, <color=\"green\">he <color=\"yellow\">will be there, <color=\"green\">he <color=\"yellow\">will be there.",
98+
"if this game had wallrunning it'd be peak",
99+
"this mod is loaded by an actually good modloader!",
100+
"<color=\"green\">Ford",
101+
"get pink screen of death'd, idiot"
92102
];
93103

94104
private const string SplashAPI = "https://splashtext.weatherelectric.xyz/";
@@ -137,45 +147,7 @@ public static string GetRandomOfflineSplash()
137147
var rnd = new System.Random();
138148
var randomSplash = Splashes[rnd.Next(Splashes.Length)];
139149

140-
if (randomSplash.Contains("[PalletCount]"))
141-
{
142-
randomSplash = randomSplash.Replace("[PalletCount]", AssetWarehouse.Instance.GetPallets().Count.ToString());
143-
}
144-
145-
if (randomSplash.Contains("[CurrentAvatar]"))
146-
{
147-
var crateRef = new AvatarCrateReference(Main.SaveData.PlayerSettings.CurrentAvatar);
148-
randomSplash = randomSplash.Replace("[CurrentAvatar]", crateRef.Crate.Title);
149-
}
150-
151-
if (randomSplash.Contains("[Height"))
152-
{
153-
var height = Main.SaveData.PlayerSettings.PlayerHeight;
154-
var feet = (int)height;
155-
var inches = height - feet;
156-
randomSplash = randomSplash.Replace("[Height]", $"{feet}'{inches}\"");
157-
}
158-
159-
if (randomSplash.Contains("[UserName]"))
160-
{
161-
randomSplash = randomSplash.Replace("[UserName]", Environment.UserName);
162-
}
163-
164-
// It's gonna say this has errors: it does not. it builds fine, il2cpp just sucks
165-
if (randomSplash.Contains("[RandomFavoriteSpawnable]"))
166-
{
167-
var spawnable = Main.SaveData.PlayerSettings.FavoriteSpawnables[(Index)rnd.Next(Main.SaveData.PlayerSettings.FavoriteSpawnables.Count)];
168-
var crateRef = new SpawnableCrateReference((Barcode)spawnable);
169-
randomSplash = randomSplash.Replace("[RandomFavoriteSpawnable]", crateRef.Crate.Title);
170-
}
171-
172-
if (randomSplash.Contains("[RandomFavoriteAvatar]"))
173-
{
174-
175-
var avatar = Main.SaveData.PlayerSettings.FavoriteAvatars[(Index)rnd.Next(Main.SaveData.PlayerSettings.FavoriteAvatars.Count)];
176-
var crateRef = new AvatarCrateReference((Barcode)avatar);
177-
randomSplash = randomSplash.Replace("[RandomFavoriteAvatar]", crateRef.Crate.Title);
178-
}
150+
randomSplash = TemplateProcessing.Process(randomSplash);
179151

180152
return randomSplash;
181153
}

Scripts/Lists/FileContents.cs

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
namespace WeatherElectric.SplashText.Scripts.Lists;
2+
3+
public static class FileContents
4+
{
5+
private static readonly string[] Texts =
6+
[
7+
"fish",
8+
"PREPARE THYSELF",
9+
"JUDGEMENT!",
10+
11+
#region V1
12+
13+
"WARNING: EXTREME DAMAGE SUSTAINED." +
14+
"RUNNING DIAGNOSTIC" +
15+
"ERROR: ARM CORE MODULE #1 NOT RESPONDING" +
16+
"ERROR: ARM CORE MODULE #2 NOT RESPONDING" +
17+
"WARNING: COMBAT SYSTEMS INOPERABLE" +
18+
"ATTEMTPING RECONSTRUCTION" +
19+
"ERROR: SELF-REPAIR NEXUS NOT RESPONDING" +
20+
"INSUFFICIENT BLOOD" +
21+
"INSUFFICIENT BLOOD" +
22+
"INITIATING ESCAPE PROTOCOL" +
23+
"ATTEMTPING CONNECTION WITH LIMBIC MODULES" +
24+
"ERROR: LEG CORE MODULE #1 NOT RESPONDING" +
25+
"ERROR: LEG CORE MODULE #2 NOT RESPONDING" +
26+
"WARNING: UNABLE TO SUSTAIN MOTOR FUNCTIONS" +
27+
"ERROR: VISUAL CORTEX MALFUNCTION" +
28+
"ERROR: LIMBIC FUNCTION NOT RESPONDING" +
29+
"INSUFFICIENT BLOOD" +
30+
"INSUFFICIENT BLOOD" +
31+
"WARNING: UNABLE TO SUSTAIN INTERNAL ORGANS" +
32+
"! PULSE FAILURE !" +
33+
"! PULSE FAILURE !" +
34+
"! PULSE FAILURE !" +
35+
"-!- SHUTDOWN IMMINENT -!-" +
36+
"ERROR: NO VOCAL INTERFACE DETECTED. UNABLE TO COMPLETE TASK" +
37+
"! PULSE FAILURE !" +
38+
"! PULSE FAILURE !" +
39+
"INSUFFICIENT BLOOD" +
40+
"INSUFFICIENT BLOOD" +
41+
"WARNING: UNABLE TO SUSTAIN BASIC FUNCTIONS" +
42+
"-!- SHUTDOWN IMMINENT -!-" +
43+
"-!- SHUTDOWN IMMINENT -!-" +
44+
"I DON'T WANT TO DIE." +
45+
"I DON'T WANT TO DIE." +
46+
"I DON'T WANT TO DIE." +
47+
"I DON'T WANT T",
48+
49+
#endregion
50+
51+
"hi :3",
52+
"hi [UserName]",
53+
"[CPU]",
54+
"hey man, nice shot!",
55+
"no not now",
56+
"maybe later",
57+
"it's the only way to live, in cars",
58+
"oh no, not me, i never lost control",
59+
"always on about the day it should have flown",
60+
"you can't stake your lives on a savior machine",
61+
"go play titanfall 2",
62+
"we should kill elon musk", // COPILOT WROTE THIS??????
63+
"yt-dlp is better than youtube-dl",
64+
"kill john lennon",
65+
"the grabbing hands grab all they can",
66+
"blank stare, disrepair, there's a big black hole gonna eat me up someday",
67+
"and when you return to the place that you call home, we will be there. we will be there.",
68+
"nico you're blue",
69+
"[FreeDiskSpace] out of [TotalDiskSpace], and this file is taking up just a LITTLE bit more :3",
70+
"you know what that means, FISH!",
71+
"[RandomFavoriteSpawnable] stinks",
72+
"hi [CurrentAvatar]",
73+
"my name is david, dad, i want some ice cream, david, that is my name, david, i want another, david, where is my ball? i'm running out on the road, there is a car, and it is going to hit me",
74+
"gomer",
75+
"d'oh",
76+
"bitch",
77+
"jake get a job, jake get a job, jake get a job, a job jake get",
78+
"go play littlebigplanet 2",
79+
"A small tit arrives, Jesus is within us all. Crap, I can't bottle.",
80+
"rip scrieel scrieq squirel rip rrelq quis squer reuq rille skin skin squiriel",
81+
"nba a afas"
82+
];
83+
84+
public static string GetRandomText()
85+
{
86+
var rnd = new System.Random();
87+
var randomSplash = Texts[rnd.Next(Texts.Length)];
88+
TemplateProcessing.Process(randomSplash, true);
89+
return randomSplash;
90+
}
91+
}

SplashText.csproj

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,15 @@
88
<LangVersion>default</LangVersion>
99
<IsPackable>false</IsPackable>
1010
<Company>Weather Electric</Company>
11-
<AssemblyVersion>2.1.1.0</AssemblyVersion>
12-
<FileVersion>2.1.1.0</FileVersion>
11+
<AssemblyVersion>2.2.0.0</AssemblyVersion>
12+
<FileVersion>2.2.0.0</FileVersion>
1313
<NeutralLanguage>en-US</NeutralLanguage>
1414
<AssemblyName>SplashText</AssemblyName>
15-
<Version>2.1.1</Version>
15+
<Version>2.2.0</Version>
1616
<Authors>Mabel Amber</Authors>
17+
<Title>SplashText</Title>
18+
<Description>Adds splash text to Void G114's menu.</Description>
19+
<Copyright>Mabel Amber</Copyright>
1720
</PropertyGroup>
1821

1922
<PropertyGroup>

0 commit comments

Comments
 (0)