diff --git a/Core/Util.cs b/Core/Util.cs index 7f6b8cf..0b4ebaf 100644 --- a/Core/Util.cs +++ b/Core/Util.cs @@ -2,8 +2,6 @@ using System.Collections.Generic; using System.Linq; using System.Reflection; -using System.Security.Cryptography; -using System.Text; using BepInEx.Configuration; using HarmonyLib; using undead_universal_patch_il2cpp.Core.Config; diff --git a/Patches/BestHTTP.cs b/Patches/BestHTTP.cs index 39b7fd8..30a1e7c 100644 --- a/Patches/BestHTTP.cs +++ b/Patches/BestHTTP.cs @@ -21,12 +21,14 @@ namespace undead_universal_patch_il2cpp.Patches static readonly Type requestType = AccessTools.TypeByName("BestHTTP.HTTPRequest"); static readonly MethodInfo getHeaderMethod = requestType?.GetMethod("GetFirstHeaderValue"); + static readonly MethodInfo addHeaderMethod = requestType?.GetMethod("AddHeader"); static readonly PropertyInfo methodTypeProp = requestType?.GetProperty("MethodType"); static readonly PropertyInfo uriProp = requestType?.GetProperty("Uri"); static readonly PropertyInfo customCertProp = requestType?.GetProperty("CustomCertificateVerifyer"); static bool Prepare() => Util.PostRequireTypes(patchResult, [ getHeaderMethod, + addHeaderMethod, methodTypeProp, uriProp, customCertProp @@ -39,7 +41,7 @@ namespace undead_universal_patch_il2cpp.Patches { 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, []); var uriInstance = (Il2CppSystem.Uri)uriProp.GetValue(request, null); @@ -53,12 +55,12 @@ namespace undead_universal_patch_il2cpp.Patches 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 - + string afterUrl = newUri.ToString(); uriProp.SetValue(request, NameserverConfig.Rewrite.Value ? newUri : uriInstance, null); diff --git a/README.md b/README.md index 8f06e11..769367b 100644 --- a/README.md +++ b/README.md @@ -15,6 +15,10 @@ later) levels enabled. You can do this by setting `Logging.Disk.LogLevels` in `BepInEx.cfg` to `All`. +## Server Developers + +Hi developers. You can implement Undead patch configurations [here.](./SERVERS.md) + ### Compiling 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 - 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 the respective object in the game's assembly. 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` - Dictionary of changes to the game configurations - Must use the entire game configuration when including one @@ -281,4 +263,4 @@ Each object type can be configured as follows: - Example: ```json ["Crescendo Of The Blood Moon", "Paintball Capture The Flag"] - ``` + ``` \ No newline at end of file diff --git a/SERVERS.md b/SERVERS.md new file mode 100644 index 0000000..8cbfd02 --- /dev/null +++ b/SERVERS.md @@ -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) + +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; } +} +``` \ No newline at end of file