This repository has been archived on 2026-05-30. You can view files and clone it, but cannot push or open issues or pull requests.
Files
2025-09-11 19:54:25 -04:00

38 lines
1.0 KiB
C#

using BestHTTP;
using System.Collections.Generic;
using undead_universal_patch_il2cpp.Core.Config;
using undead_universal_patch_il2cpp.Patches;
using UnityEngine;
namespace undead_universal_patch_il2cpp.Core.Content.CustomRecNet.CheatManager;
public class CustomCheatManager : MonoBehaviour
{
public void Start()
{
if (ServerPatchesConfig.CustomKnownDlls.Value) RecNetInteractions.postNameServerActions.Add(DownloadKnownDlls);
}
void Patch(HTTPResponse _res, List<string> dlls)
{
UniversalPatchPlugin.Log.LogInfo("Setting new KnownDlls (server)");
HilePatch.Patch([.. dlls]);
}
void OnFailed(HTTPResponse _res)
{
if (PatchConfig.HilePatch.Value)
{
UniversalPatchPlugin.Log.LogInfo("Setting new KnownDlls (local fallback)");
HilePatch.Patch();
}
}
void DownloadKnownDlls()
{
RecNetInteractions.SendRequest<List<string>>(HTTPMethods.Get, RecNet.Service.API, "/api/undead/v1/knowndlls", Patch, OnFailed);
}
}