Skip to content

fix: CheaterReport.SubmitReport not working #623

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 11, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 53 additions & 0 deletions EXILED/Exiled.Events/Patches/Fixes/CheaterReportFix.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
// -----------------------------------------------------------------------
// <copyright file="CheaterReportFix.cs" company="ExMod Team">
// Copyright (c) ExMod Team. All rights reserved.
// Licensed under the CC BY-SA 3.0 license.
// </copyright>
// -----------------------------------------------------------------------

namespace Exiled.Events.Patches.Fixes
{
using System.Collections.Generic;
using System.Reflection.Emit;

using Exiled.API.Features;
using Exiled.API.Features.Pools;

using HarmonyLib;

/// <summary>
/// Patches <see cref="CheaterReport.SubmitReport"/>.
/// Fixes method not working.
/// Bug reported to NW (https://git.scpslgame.com/northwood-qa/scpsl-bug-reporting/-/issues/1814).
/// </summary>
[HarmonyPatch(typeof(CheaterReport), nameof(CheaterReport.SubmitReport))]
public class CheaterReportFix
{
private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
{
List<CodeInstruction> newInstructions = ListPool<CodeInstruction>.Pool.Get(instructions);

CodeInstruction instruction = newInstructions.Find(instruction => instruction.opcode == OpCodes.Ldstr);

// will notify devs of fix when NW fixes themselves, rather than another silent error
if (instruction.operand is not "payload_json=")
{
Log.Error($"{typeof(CheaterReportFix).FullName} failed to fix {typeof(CheaterReport).FullName}.{nameof(CheaterReport.SubmitReport)}, please verify this fix is still required and fix it if so.");

for (int index = 0; index < newInstructions.Count; index++)
yield return newInstructions[index];

ListPool<CodeInstruction>.Pool.Return(newInstructions);
yield break;
}

// easiest solution with minimal changes, but NW fixing it will make us cause issue.
instruction.operand = string.Empty;

for (int index = 0; index < newInstructions.Count; index++)
yield return newInstructions[index];

ListPool<CodeInstruction>.Pool.Return(newInstructions);
}
}
}
Loading