38 lines
1.0 KiB
C#
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);
|
|
}
|
|
|
|
} |