This repository has been archived by the owner on Dec 20, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cs
165 lines (152 loc) · 6.87 KB
/
main.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
using System;
using System.Linq;
using System.Reflection;
using System.Threading;
using System.Text;
using System.Runtime.InteropServices;
using MelonLoader;
using DiscordRichPresense;
using Harmony;
using UnityEngine.UI;
using UnityEngine;
namespace Mod
{
public static class BuildInfo
{
public const string Name = "PhasmodHandler"; // Name of the Mod. (MUST BE SET)
public const string Description = "Mod for handling specific Phasmophobia mods"; // Description for the Mod. (Set as null if none)
public const string Author = "seppdroid"; // Author of the Mod. (Set as null if none)
public const string Company = null; // Company that made the Mod. (Set as null if none)
public const string Version = "1.0.3"; // Version of the Mod. (MUST BE SET)
public const string DownloadLink = null; // Download Link for the Mod. (Set as null if none)
}
public class Mod : MelonMod
{
private const string DiscordAppID = "767737509656002601";
public static readonly DiscordRpc.RichPresence Presence = new DiscordRpc.RichPresence();
public override void OnApplicationStart() // Runs after Game Initialization.
{
var handlers = new DiscordRpc.EventHandlers();
DiscordRpc.Initialize(DiscordAppID, ref handlers, false, string.Empty);
Presence.state = "Starting game...";
Presence.details = "Playing PhasMODphobia";
Presence.startTimestamp = default(long);
Presence.largeImageKey = "phasmod";
Presence.largeImageText = "Phasmodphobia";
Presence.smallImageKey = "phasmod";
Presence.smallImageText = "phasmomod";
DiscordRpc.UpdatePresence(Presence);
MelonLogger.Log("[log] Phasmophobia Mod Handler has started");
}
public override void OnLevelIsLoading() // Runs when a Scene is Loading or when a Loading Screen is Shown. Currently only runs if the Mod is used in BONEWORKS.
{
MelonLogger.Log("[log] Loading level");
}
public override void OnLevelWasLoaded(int level) // Runs when a Scene has Loaded.
{
if (level == 1)
{
Presence.state = "In Main Menu Lobby";
Presence.details = "Playing PhasMODphobia";
Presence.largeImageKey = "lobby";
Presence.largeImageText = "Phasmodphobia";
Presence.smallImageKey = "phasmod";
Presence.smallImageText = "phasmomod";
DiscordRpc.UpdatePresence(Presence);
MelonLogger.Log("[log] RPC Status changed");
}
if (level == 2)
{
Presence.state = "In Tanglewood Street";
Presence.details = "Playing PhasMODphobia";
Presence.largeImageKey = "tanglewood";
Presence.largeImageText = "Tanglewood Street House";
Presence.smallImageKey = "phasmod";
Presence.smallImageText = "phasmomod";
DiscordRpc.UpdatePresence(Presence);
MelonLogger.Log("[log] RPC Status changed");
}
if (level == 3)
{
Presence.state = "In Asylum";
Presence.details = "Playing PhasMODphobia";
Presence.largeImageKey = "asylum";
Presence.largeImageText = "Asylum";
Presence.smallImageKey = "phasmod";
Presence.smallImageText = "phasmomod";
DiscordRpc.UpdatePresence(Presence);
MelonLogger.Log("[log] RPC Status changed");
}
if (level == 4)
{
Presence.state = "In Edgefield Street House";
Presence.details = "Playing PhasMODphobia";
Presence.largeImageKey = "streethouse";
Presence.largeImageText = "Edgefield Street House";
Presence.smallImageKey = "phasmod";
Presence.smallImageText = "phasmomod";
DiscordRpc.UpdatePresence(Presence);
MelonLogger.Log("[log] RPC Status changed");
}
if (level == 5)
{
Presence.state = "In Ridgefield Road House";
Presence.details = "Playing PhasMODphobia";
Presence.largeImageKey = "ridgefield";
Presence.largeImageText = "Ridgefield Road House";
Presence.smallImageKey = "phasmod";
Presence.smallImageText = "phasmomod";
DiscordRpc.UpdatePresence(Presence);
MelonLogger.Log("[log] RPC Status changed");
}
if (level == 6)
{
Presence.state = "In Brownstone Highschool";
Presence.details = "Playing PhasMODphobia";
Presence.largeImageKey = "brownstone";
Presence.largeImageText = "Brownstone Highschool";
Presence.smallImageKey = "phasmod";
Presence.smallImageText = "phasmomod";
DiscordRpc.UpdatePresence(Presence);
MelonLogger.Log("[log] RPC Status changed");
}
if (level == 7)
{
Presence.state = "In Bleasdale Farmhouse";
Presence.details = "Playing PhasMODphobia";
Presence.largeImageKey = "bleasdale";
Presence.largeImageText = "Bleasdale Farmhouse";
Presence.smallImageKey = "phasmod";
Presence.smallImageText = "phasmomod";
DiscordRpc.UpdatePresence(Presence);
MelonLogger.Log("[log] RPC Status changed");
}
if (level == 8)
{
Presence.state = "In Grafton Farmhouse";
Presence.details = "Playing PhasMODphobia";
Presence.largeImageKey = "grafton";
Presence.largeImageText = "Grafton Farmhouse";
Presence.smallImageKey = "phasmod";
Presence.smallImageText = "phasmomod";
DiscordRpc.UpdatePresence(Presence);
MelonLogger.Log("[log] RPC Status changed");
}
// else and set an undefined level so you wont be in the main lobby if you play a map above 8?
MelonLogger.Log("[log] loadedlevel: " + level.ToString());
}
public override void OnLevelWasInitialized(int level) // Runs when a Scene has Initialized.
{
MelonLogger.Log("[log] initlevel: " + level.ToString());
}
public override void OnUpdate()
{
DiscordRpc.RunCallbacks(); // for if we are going to handle invites...
}
public override void OnApplicationQuit() // Runs when the Game is told to Close.
{
DiscordRpc.Shutdown();
MelonLogger.Log("[log] Phasmophobia closed");
}
}
}