Skip to content
This repository was archived by the owner on Jun 5, 2024. It is now read-only.

Commit 3c97ad8

Browse files
authored
Add 1.0.0
1 parent a4d30d3 commit 3c97ad8

File tree

1 file changed

+74
-0
lines changed

1 file changed

+74
-0
lines changed

karlsonmod.cs

+74
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
using MelonLoader;
2+
using System.Collections.Generic;
3+
using System;
4+
5+
[assembly: MelonInfo(typeof(MyProject.MyMod), "KarlsonRPC", "1.0.0", "Dark42ed#4572")]
6+
[assembly: MelonGame("Dani", "Karlson")]
7+
8+
9+
namespace MyProject
10+
{
11+
12+
public class MyMod : MelonMod
13+
{
14+
15+
public Dictionary<int, string> leveldict = new Dictionary<int, string>
16+
{
17+
{1, "Main Menu"},
18+
{2, "Tutorial"},
19+
{3, "Sandbox 0"},
20+
{4, "Sandbox 1"},
21+
{5, "Sandbox 2"},
22+
{6, "Escape 0"},
23+
{7, "Escape 1"},
24+
{8, "Escape 2"},
25+
{9, "Escape 3" },
26+
{10, "Sky 0"},
27+
{11, "Sky 1"},
28+
{12, "Sky 2"}
29+
};
30+
31+
public Discord.Discord discord = new Discord.Discord(798687396148281404, (ulong)Discord.CreateFlags.NoRequireDiscord);
32+
33+
public override void OnUpdate()
34+
{
35+
discord.RunCallbacks();
36+
}
37+
38+
public override void OnLevelWasInitialized(int level)
39+
{
40+
if (level == 0)
41+
{
42+
return;
43+
}
44+
var activityManager = discord.GetActivityManager();
45+
string leveltxt = "";
46+
if (level == 1)
47+
{
48+
leveltxt = "In Main Menu";
49+
}
50+
else
51+
{
52+
leveltxt = "Playing " + leveldict[level];
53+
54+
}
55+
TimeSpan t = DateTime.UtcNow - new DateTime(1970, 1, 1);
56+
57+
var activity = new Discord.Activity
58+
{
59+
Details = leveltxt,
60+
Timestamps =
61+
{
62+
Start = (int)t.TotalSeconds
63+
},
64+
Assets =
65+
{
66+
LargeImage = leveldict[level].Replace(" ", "").ToLower(),
67+
LargeText = leveldict[level]
68+
}
69+
};
70+
activityManager.UpdateActivity(activity, (res) => { });
71+
72+
}
73+
}
74+
}

0 commit comments

Comments
 (0)