server docs

This commit is contained in:
2025-08-12 22:54:54 -04:00
parent 7fc0d6c5b0
commit 45d844da18
4 changed files with 40 additions and 30 deletions

View File

@@ -2,8 +2,6 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Reflection; using System.Reflection;
using System.Security.Cryptography;
using System.Text;
using BepInEx.Configuration; using BepInEx.Configuration;
using HarmonyLib; using HarmonyLib;
using undead_universal_patch_il2cpp.Core.Config; using undead_universal_patch_il2cpp.Core.Config;

View File

@@ -21,12 +21,14 @@ namespace undead_universal_patch_il2cpp.Patches
static readonly Type requestType = AccessTools.TypeByName("BestHTTP.HTTPRequest"); static readonly Type requestType = AccessTools.TypeByName("BestHTTP.HTTPRequest");
static readonly MethodInfo getHeaderMethod = requestType?.GetMethod("GetFirstHeaderValue"); static readonly MethodInfo getHeaderMethod = requestType?.GetMethod("GetFirstHeaderValue");
static readonly MethodInfo addHeaderMethod = requestType?.GetMethod("AddHeader");
static readonly PropertyInfo methodTypeProp = requestType?.GetProperty("MethodType"); static readonly PropertyInfo methodTypeProp = requestType?.GetProperty("MethodType");
static readonly PropertyInfo uriProp = requestType?.GetProperty("Uri"); static readonly PropertyInfo uriProp = requestType?.GetProperty("Uri");
static readonly PropertyInfo customCertProp = requestType?.GetProperty("CustomCertificateVerifyer"); static readonly PropertyInfo customCertProp = requestType?.GetProperty("CustomCertificateVerifyer");
static bool Prepare() => Util.PostRequireTypes(patchResult, [ static bool Prepare() => Util.PostRequireTypes(patchResult, [
getHeaderMethod, getHeaderMethod,
addHeaderMethod,
methodTypeProp, methodTypeProp,
uriProp, uriProp,
customCertProp customCertProp
@@ -39,7 +41,7 @@ namespace undead_universal_patch_il2cpp.Patches
{ {
if (PatchConfig.CertificatePatch.Value) customCertProp.GetSetMethod().Invoke(request, [null]); if (PatchConfig.CertificatePatch.Value) customCertProp.GetSetMethod().Invoke(request, [null]);
string contentType = (string)getHeaderMethod.Invoke(request, ["Content-Type"]); var contentType = (string)getHeaderMethod.Invoke(request, ["Content-Type"]);
HTTPMethods method = (HTTPMethods)methodTypeProp.GetGetMethod().Invoke(request, []); HTTPMethods method = (HTTPMethods)methodTypeProp.GetGetMethod().Invoke(request, []);
var uriInstance = (Il2CppSystem.Uri)uriProp.GetValue(request, null); var uriInstance = (Il2CppSystem.Uri)uriProp.GetValue(request, null);
@@ -53,12 +55,12 @@ namespace undead_universal_patch_il2cpp.Patches
Il2CppSystem.Uri newUri = new(uriInstance.ToString()); Il2CppSystem.Uri newUri = new(uriInstance.ToString());
// Request changes below // Start request changes
if (newUri.ToString().Contains("ns.rec.net")) newUri = new Il2CppSystem.Uri(NameserverConfig.NewUrl.Value); if (newUri.Host.Contains("ns.rec.net")) newUri = new Il2CppSystem.Uri(NameserverConfig.NewUrl.Value);
// Finish request changes // Finish request changes
string afterUrl = newUri.ToString(); string afterUrl = newUri.ToString();
uriProp.SetValue(request, NameserverConfig.Rewrite.Value ? newUri : uriInstance, null); uriProp.SetValue(request, NameserverConfig.Rewrite.Value ? newUri : uriInstance, null);

View File

@@ -15,6 +15,10 @@ later)
levels enabled. You can do this by setting `Logging.Disk.LogLevels` in levels enabled. You can do this by setting `Logging.Disk.LogLevels` in
`BepInEx.cfg` to `All`. `BepInEx.cfg` to `All`.
## Server Developers
Hi developers. You can implement Undead patch configurations [here.](./SERVERS.md)
### Compiling ### Compiling
Unlike the Mono patch, some assemblies must be referenced. Unlike the Mono patch, some assemblies must be referenced.
@@ -45,35 +49,13 @@ If you're unsure how to start your build on linux:
- Use protontricks to add the doorstop DLL - Use protontricks to add the doorstop DLL
- Start Rec Room through Steam - Start Rec Room through Steam
### (AssetChanges) and (GameManager Patches) ### GameManager Patches
Properties of the object in the patch file will be used to set the properties of Properties of the object in the patch file will be used to set the properties of
the respective object in the game's assembly. the respective object in the game's assembly.
Each object type can be configured as follows: Each object type can be configured as follows:
- `AGRoomRuntimeConfig.Room` or `AGRoomRuntimeConfig.RoomScene` or
`AGRoomRuntimeConfig.Location`
- Set the key to the replicationId of the object you want to change
- Any object with a replicationId can be changed
- Objects in the list have properties "Key" and "Value"
- The key represents the name of the property to modify
- The value will replace the current value in the assembly
- Example:
```json
{
"76d98498-60a1-430c-ab76-b54a29b7a163": [
{
"Key": "ReleaseStatus",
"Value": 0
}
]
}
```
will prevent you from loading into the dorm, because you can't go to
editor-only rooms. You can set rooms with ReleaseStatus:0 to 2 if you'd like
to go to those rooms. This isn't very useful for most people. You _should_
set this when using `TeamConfiguration` below.
- `GameConfigurationAsset` - `GameConfigurationAsset`
- Dictionary of changes to the game configurations - Dictionary of changes to the game configurations
- Must use the entire game configuration when including one - Must use the entire game configuration when including one
@@ -281,4 +263,4 @@ Each object type can be configured as follows:
- Example: - Example:
```json ```json
["Crescendo Of The Blood Moon", "Paintball Capture The Flag"] ["Crescendo Of The Blood Moon", "Paintball Capture The Flag"]
``` ```

28
SERVERS.md Normal file
View File

@@ -0,0 +1,28 @@
# Server Developers
[<-- Back to README.md](./README.md)
Requests are sent after the game client authenticates with the server.
## Endpoints
### `API: GET "/api/undead/v1/emotes"`
Expects: `List<EmoteConfigDTO>`
[EmoteConfigDTO](#emoteconfigdto)
Replace existing emotes in the game with these, keyed by `UniqueName`.
See [the source](./Core/CustomRecNet/CustomEmotes/RecNetEmotes.cs) for more information.
## DTOs
### `EmoteConfigDTO`
```c#
public class EmoteConfigDTO
{
public string UniqueName { get; set; }
public string NewText { get; set; }
public string RoomChatText { get; set; }
public string FacialExpression { get; set; }
public bool ForceEmoteBubble { get; set; }
public bool OnlyBroadcastToTeam { get; set; }
}
```