using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("CN CheatMenu")]
[assembly: AssemblyDescription("中文管理员作弊面板 (Crime Simulator)")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("CN CheatMenu")]
[assembly: AssemblyCopyright("")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("7c1f6d1e-8f6e-4a2b-9c3d-5b4a2e1f0c9a")]
[assembly: AssemblyFileVersion("2.0.0.0")]
[assembly: AssemblyVersion("2.0.0.0")]
namespace CN_CheatMenu;
public class GuiBehaviour : MonoBehaviour
{
private static int _lastKeyFrame = -1;
private static bool _cursorFreed;
private static CursorLockMode _prevLock;
private static bool _prevVisible;
private void Awake()
{
Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject);
((Object)this).hideFlags = (HideFlags)61;
}
private bool AltHeld()
{
if (!Input.GetKey((KeyCode)308))
{
return Input.GetKey((KeyCode)307);
}
return true;
}
private void Update()
{
//IL_0048: Unknown result type (might be due to invalid IL or missing references)
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
if (MenuBehaviour.enableMenu && AltHeld())
{
if (!_cursorFreed)
{
_prevLock = Cursor.lockState;
_prevVisible = Cursor.visible;
Cursor.lockState = (CursorLockMode)0;
Cursor.visible = true;
_cursorFreed = true;
}
}
else if (_cursorFreed)
{
Cursor.lockState = _prevLock;
Cursor.visible = _prevVisible;
_cursorFreed = false;
}
if (Time.frameCount == _lastKeyFrame)
{
return;
}
_lastKeyFrame = Time.frameCount;
bool keyDown = Input.GetKeyDown((KeyCode)286);
if (Plugin.TogglePressed() || keyDown || Input.GetKeyDown((KeyCode)285) || Input.GetKeyDown((KeyCode)287) || Input.GetKeyDown((KeyCode)289) || Input.GetKeyDown((KeyCode)293))
{
MenuBehaviour.enableMenu = !MenuBehaviour.enableMenu;
}
if (MenuBehaviour.enableMenu && Input.GetKeyDown((KeyCode)27))
{
MenuBehaviour.enableMenu = false;
}
if (Input.GetKeyDown((KeyCode)283))
{
MenuBehaviour.MarkLoots();
}
if (Input.GetKeyDown((KeyCode)98))
{
MenuBehaviour.SendAllLoot();
}
if (Input.GetKeyDown((KeyCode)105))
{
FPP_Player val = Hacks.Player();
if ((Object)(object)val != (Object)null)
{
bool flag = !val.isInvisible;
val.RPC_ActivateInvisibility(flag, flag ? 99999f : 0f);
MenuBehaviour.PlayerInvisible = flag;
}
}
}
private void OnGUI()
{
if (MenuBehaviour.enableMenu)
{
MenuBehaviour.DrawWindow();
}
}
}
[HarmonyPatch]
public static class Hacks
{
[HarmonyPatch(typeof(CursorLockManager), "ApplyCursorLock")]
private static class CursorUnlockPatch
{
private static bool Prefix()
{
return !MenuBehaviour.enableMenu;
}
}
[HarmonyPatch(typeof(FPP_Player), "DealDamageToPlayer")]
private static class GodModePatch
{
private static bool Prefix(FPP_Player __instance, ref float dmg)
{
if (!MenuBehaviour.GodMode || !IsLocal(__instance))
{
return true;
}
dmg = 0f;
return false;
}
}
[HarmonyPatch(typeof(FPP_Player), "CheckMovementDirection")]
private static class NoFallPatch
{
private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
{
foreach (CodeInstruction instruction in instructions)
{
if (CodeInstructionExtensions.Calls(instruction, AccessTools.Method(typeof(FPP_Player), "RPC_DealDamage", new Type[1] { typeof(float) }, (Type[])null)))
{
yield return new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(NoFallPatch), "HandleFallDamage", (Type[])null, (Type[])null));
}
else
{
yield return instruction;
}
}
}
private static void HandleFallDamage(FPP_Player player, float dmg)
{
if (!MenuBehaviour.NoFall || !IsLocal(player))
{
player.RPC_DealDamage(dmg);
}
}
}
[HarmonyPatch(typeof(FPP_Player), "StaminaControl")]
private static class StaminaPatch
{
private static void Postfix(FPP_Player __instance)
{
if (MenuBehaviour.InfiniteStamina && IsLocal(__instance))
{
__instance.currentStamina = __instance.maxStamina;
__instance.staminaCooldown = false;
__instance.staminaRegenDelay = false;
__instance.staminaRunMulti = 1f;
__instance.staminaAttackMulti = 1f;
}
}
}
[HarmonyPatch(typeof(FPP_Player), "RPC_ActivateInvisibility")]
private static class CameraInvisiblePatch
{
private static void Postfix(FPP_Player __instance, bool tru)
{
if (!IsLocal(__instance))
{
return;
}
if (MenuBehaviour.CameraInvisible)
{
Renderer[] componentsInChildren = ((Component)__instance).GetComponentsInChildren<Renderer>(true);
for (int i = 0; i < componentsInChildren.Length; i++)
{
componentsInChildren[i].enabled = !tru;
}
SkinnedMeshRenderer[] componentsInChildren2 = ((Component)__instance).GetComponentsInChildren<SkinnedMeshRenderer>(true);
for (int j = 0; j < componentsInChildren2.Length; j++)
{
((Renderer)componentsInChildren2[j]).enabled = !tru;
}
}
else if (!tru)
{
Renderer[] componentsInChildren3 = ((Component)__instance).GetComponentsInChildren<Renderer>(true);
for (int k = 0; k < componentsInChildren3.Length; k++)
{
componentsInChildren3[k].enabled = true;
}
SkinnedMeshRenderer[] componentsInChildren4 = ((Component)__instance).GetComponentsInChildren<SkinnedMeshRenderer>(true);
for (int l = 0; l < componentsInChildren4.Length; l++)
{
((Renderer)componentsInChildren4[l]).enabled = true;
}
}
MenuBehaviour.PlayerInvisible = tru;
}
}
[HarmonyPatch(typeof(PlayerSkills), "ReceiveXP")]
private static class XPgainPatch
{
private static void Prefix(ref int amount)
{
if (MenuBehaviour.XPgain)
{
amount *= 99999;
}
}
}
[HarmonyPatch(typeof(PlayerInventory), "PickedItem")]
private static class PickedItemPatch
{
private static void Prefix(Pickupable item)
{
if (!((Object)(object)item == (Object)null))
{
if (MenuBehaviour.NoDamagedLoots)
{
item.currentDamage = 0f;
}
if (MenuBehaviour.BigCash && (Object)(object)item.assignedItem != (Object)null && item.assignedItem.isMoney)
{
item.addAmount *= 10000;
}
}
}
}
[HarmonyPatch(typeof(PlayerInventory), "AddDamageToCurrentItem")]
private static class ToolsAutoFixPatch
{
private static bool Prefix(PlayerInventory __instance, float dmg)
{
if (!MenuBehaviour.ToolsAutoFix)
{
return true;
}
if ((Object)(object)__instance.player == (Object)null || (Object)(object)__instance.player.WM == (Object)null)
{
return true;
}
if ((Object)(object)__instance.player.WM.tutorialJobs != (Object)null && __instance.player.WM.tutorialJobs.tutorialActive)
{
return false;
}
ItemSlot val = __instance.itemSlots[__instance.currentItemIndex];
if ((Object)(object)val == (Object)null || (Object)(object)val.assignedItem == (Object)null)
{
return false;
}
float num = 1f;
if (!val.assignedItem.isLoot && (Object)(object)__instance.player.skillManager != (Object)null)
{
num = __instance.player.skillManager.toolDamageMulti;
}
val.AddDamage(dmg * num);
if (val.ReturnCurrentDamage() >= 100f)
{
val.AddDamage(-100f);
__instance.player.ShowMessage("工具已自动修复", 3f, "good", false);
}
return false;
}
}
[HarmonyPatch(typeof(PlayerInventory), "AddAmmo")]
private static class UnlimitedAmmoPatch
{
private static bool Prefix(PlayerInventory __instance, Item ammoItem)
{
if (!MenuBehaviour.UnlimitedAmmo || (Object)(object)__instance.weaponManager == (Object)null)
{
return true;
}
foreach (Weapon weapon in __instance.weaponManager.weapons)
{
if (weapon.ammoTypes.Count <= 0)
{
continue;
}
for (int i = 0; i < weapon.ammoTypes.Count; i++)
{
if ((Object)(object)weapon.ammoTypes[i].ammoItem == (Object)(object)ammoItem)
{
weapon.ammoTypes[i].amountInInventory = 88888888;
return false;
}
}
}
return true;
}
}
[HarmonyPatch(typeof(PlayerInventory), "InstallArmor")]
private static class UltraArmorPatch
{
private static bool Prefix(PlayerInventory __instance)
{
if (!MenuBehaviour.UltraArmor || (Object)(object)__instance.player == (Object)null)
{
return true;
}
__instance.player.hasArmor = true;
__instance.player.armorHealth = 99999f;
__instance.player.sfxSource.PlayOneShot(__instance.upgradeClip, 0.6f);
__instance.player.ShowMessage("超级护甲已安装", 3f, "good", false);
return false;
}
}
[HarmonyPatch(typeof(InvisibilityTool), "Activate")]
private static class InvisibilityNoCDPatch
{
private static void Postfix(InvisibilityTool __instance)
{
if (MenuBehaviour.InvisibilityNoCD && !((Object)(object)__instance.player == (Object)null))
{
AccessTools.Field(typeof(InvisibilityTool), "isOnCooldown").SetValue(__instance, false);
__instance.cooldownTime = 0f;
__instance.ResetColor();
}
}
}
[HarmonyPatch(typeof(BlowtorchObject), "AddDamage")]
private static class BlowtorchInstantPatch
{
private static bool Prefix(BlowtorchObject __instance)
{
if (!MenuBehaviour.BlowtorchInstantUnlock)
{
return true;
}
if (!__instance.destroyed)
{
__instance.RPC_DestroyLock();
}
return false;
}
}
[HarmonyPatch(typeof(ComputerStore), "ReturnItemValue")]
private static class FreeShopPatch
{
private static bool Prefix(ref int __result)
{
if (!MenuBehaviour.FreeShop)
{
return true;
}
__result = 0;
return false;
}
}
[HarmonyPatch(typeof(FurnitureManager), "AmountOfFurniture")]
private static class OverFurnishedPatch
{
private static bool Prefix(ref int __result)
{
if (!MenuBehaviour.OverFurnished)
{
return true;
}
__result = 0;
return false;
}
}
[HarmonyPatch(typeof(PoliceManager), "PoliceCalled")]
private static class NoPolicePatch
{
private static bool Prefix(PoliceManager __instance)
{
if (!MenuBehaviour.NoPolice)
{
return true;
}
__instance.currentChaseLevel = 0;
return false;
}
}
[HarmonyPatch(typeof(PoliceManager), "TrySpawnPolice")]
private static class NoPoliceSpawnPatch
{
private static bool Prefix()
{
return !MenuBehaviour.NoPolice;
}
}
[HarmonyPatch(typeof(NPC), "RPC_AlertToLocation")]
private static class NPCAlertPatch
{
private static bool Prefix()
{
return !MenuBehaviour.NPCBlind;
}
}
[HarmonyPatch(typeof(NPC), "Sight")]
private static class NPCSightPatch
{
private static void Postfix(NPC __instance)
{
if (MenuBehaviour.NPCBlind)
{
__instance.seesPlayer = false;
}
}
}
[HarmonyPatch(typeof(SecurityCamera), "Update")]
private static class SecurityCameraBlindPatch
{
private static void Prefix(SecurityCamera __instance)
{
if (MenuBehaviour.SecurityCameraBlind)
{
__instance.playerInCameraRange = false;
}
}
}
internal static FPP_Player Player()
{
WorldManager instance = WorldManager.Instance;
if ((Object)(object)instance != (Object)null && (Object)(object)instance.localPlayer != (Object)null)
{
return instance.localPlayer;
}
return Object.FindObjectOfType<FPP_Player>();
}
internal static void Show(string msg)
{
FPP_Player val = Player();
if ((Object)(object)val != (Object)null)
{
val.ShowMessage(msg, 3f, "good", false);
}
}
private static bool IsLocal(FPP_Player p)
{
if ((Object)(object)p != (Object)null)
{
return (Object)(object)p == (Object)(object)Player();
}
return false;
}
}
public static class MenuBehaviour
{
internal static bool GodMode;
internal static bool NoFall;
internal static bool InfiniteStamina;
internal static bool CameraInvisible;
internal static bool PlayerInvisible;
internal static bool UnlimitedAmmo;
internal static bool UltraArmor;
internal static bool NoDamagedLoots;
internal static bool ToolsAutoFix;
internal static bool BlowtorchInstantUnlock;
internal static bool InvisibilityNoCD;
internal static bool FreeShop;
internal static bool BigCash;
internal static bool OverFurnished;
internal static bool NoPolice;
internal static bool XPgain;
internal static bool NPCBlind;
internal static bool SecurityCameraBlind;
internal static bool enableMenu;
private static Rect _win = new Rect(40f, 40f, 400f, 560f);
private static int _tab;
private static string _moneyInput = "";
private static string _skillInput = "";
private static GUIStyle _titleStyle;
private static GUIStyle _toggleOnStyle;
private static GUIStyle _toggleOffStyle;
private static GUIStyle _sectionStyle;
private static int _lastClickFrame = -1;
private static bool Held
{
get
{
if (!Input.GetKey((KeyCode)308))
{
return Input.GetKey((KeyCode)307);
}
return true;
}
}
internal static void DrawWindow()
{
//IL_0049: Unknown result type (might be due to invalid IL or missing references)
//IL_006c: Unknown result type (might be due to invalid IL or missing references)
//IL_0094: Unknown result type (might be due to invalid IL or missing references)
//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
//IL_012d: Unknown result type (might be due to invalid IL or missing references)
InitStyles();
GUI.skin.label.fontSize = 15;
GUI.skin.button.fontSize = 15;
GUI.skin.toggle.fontSize = 15;
GUI.skin.textField.fontSize = 15;
GUI.Box(_win, GUIContent.none);
GUI.Label(PR(0f, 6f, 400f, 30f), "CN 作弊面板 v2.0", _titleStyle);
ManualTab(PR(10f, 42f, 124f, 24f), 0, "玩家");
ManualTab(PR(138f, 42f, 124f, 24f), 1, "物品");
ManualTab(PR(266f, 42f, 124f, 24f), 2, "世界");
switch (_tab)
{
case 0:
DrawPlayer();
break;
case 1:
DrawItems();
break;
case 2:
DrawWorld();
break;
}
GUI.Label(PR(10f, 540f, 380f, 18f), "Alt + 鼠标点击操作面板,F5 键开关本面板,I 键开关隐身", GUI.skin.label);
}
private static Rect PR(float x, float y, float w, float h)
{
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
return new Rect(((Rect)(ref _win)).x + x, ((Rect)(ref _win)).y + y, w, h);
}
private static void InitStyles()
{
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_0031: Expected O, but got Unknown
//IL_004a: Unknown result type (might be due to invalid IL or missing references)
//IL_0065: Unknown result type (might be due to invalid IL or missing references)
//IL_006a: Unknown result type (might be due to invalid IL or missing references)
//IL_0072: Unknown result type (might be due to invalid IL or missing references)
//IL_007e: Expected O, but got Unknown
//IL_0097: Unknown result type (might be due to invalid IL or missing references)
//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
//IL_00bc: Expected O, but got Unknown
//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
//IL_0113: Unknown result type (might be due to invalid IL or missing references)
//IL_011d: Expected O, but got Unknown
//IL_0136: Unknown result type (might be due to invalid IL or missing references)
if (_titleStyle == null)
{
_titleStyle = new GUIStyle(GUI.skin.label)
{
fontSize = 19,
fontStyle = (FontStyle)1,
alignment = (TextAnchor)4
};
_titleStyle.normal.textColor = new Color(0.4f, 0.85f, 1f);
}
if (_sectionStyle == null)
{
_sectionStyle = new GUIStyle(GUI.skin.label)
{
fontSize = 14,
fontStyle = (FontStyle)1
};
_sectionStyle.normal.textColor = new Color(0.95f, 0.8f, 0.35f);
}
if (_toggleOnStyle == null)
{
_toggleOnStyle = new GUIStyle(GUI.skin.toggle);
_toggleOnStyle.normal.textColor = new Color(0.4f, 1f, 0.55f);
_toggleOnStyle.onNormal.textColor = new Color(0.4f, 1f, 0.55f);
}
if (_toggleOffStyle == null)
{
_toggleOffStyle = new GUIStyle(GUI.skin.toggle);
_toggleOffStyle.normal.textColor = new Color(0.85f, 0.85f, 0.85f);
}
}
private static bool WasClicked(Rect r)
{
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
//IL_0031: Unknown result type (might be due to invalid IL or missing references)
//IL_0043: Unknown result type (might be due to invalid IL or missing references)
if (!Held || !Input.GetMouseButtonDown(0))
{
return false;
}
if (Time.frameCount == _lastClickFrame)
{
return false;
}
Vector2 val = default(Vector2);
((Vector2)(ref val))..ctor(Input.mousePosition.x, (float)Screen.height - Input.mousePosition.y);
if (!((Rect)(ref r)).Contains(val))
{
return false;
}
_lastClickFrame = Time.frameCount;
return true;
}
private static bool ManualToggle(Rect r, bool val, string text)
{
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
GUIStyle val2 = (val ? _toggleOnStyle : _toggleOffStyle);
GUI.Toggle(r, val, " " + text, val2);
if (WasClicked(r))
{
val = !val;
Hacks.Show((val ? "开启" : "关闭 ") + text.Trim());
}
return val;
}
private static void ManualTab(Rect r, int idx, string label)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
GUI.Toggle(r, _tab == idx, label, GUI.skin.button);
if (WasClicked(r))
{
_tab = idx;
}
}
private static void ManualButton(Rect r, string text, Action act)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
GUI.Button(r, text);
if (WasClicked(r))
{
act();
}
}
private static string ManualTextField(Rect r, string val, int len, string name)
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
GUI.SetNextControlName(name);
string result = GUI.TextField(r, val, len);
if (WasClicked(r))
{
GUI.FocusControl(name);
}
return result;
}
private static void Section(float y, string text)
{
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
GUI.Label(PR(10f, y, 380f, 20f), text, _sectionStyle);
}
private static void DrawPlayer()
{
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
//IL_007d: Unknown result type (might be due to invalid IL or missing references)
//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
//IL_010e: Unknown result type (might be due to invalid IL or missing references)
//IL_013b: Unknown result type (might be due to invalid IL or missing references)
//IL_0168: Unknown result type (might be due to invalid IL or missing references)
//IL_0195: Unknown result type (might be due to invalid IL or missing references)
//IL_01d1: Unknown result type (might be due to invalid IL or missing references)
//IL_01fe: Unknown result type (might be due to invalid IL or missing references)
//IL_022c: Unknown result type (might be due to invalid IL or missing references)
//IL_026e: Unknown result type (might be due to invalid IL or missing references)
//IL_029b: Unknown result type (might be due to invalid IL or missing references)
//IL_02ca: Unknown result type (might be due to invalid IL or missing references)
Section(74f, "玩家");
GodMode = ManualToggle(PR(14f, 98f, 360f, 22f), GodMode, "上帝模式(无敌)");
NoFall = ManualToggle(PR(14f, 124f, 360f, 22f), NoFall, "无摔落伤害");
InfiniteStamina = ManualToggle(PR(14f, 150f, 360f, 22f), InfiniteStamina, "无限耐力");
bool playerInvisible = PlayerInvisible;
PlayerInvisible = ManualToggle(PR(14f, 176f, 360f, 22f), playerInvisible, "隐身(I 键开关)");
if (PlayerInvisible != playerInvisible)
{
FPP_Player val = Hacks.Player();
if ((Object)(object)val != (Object)null)
{
val.RPC_ActivateInvisibility(PlayerInvisible, PlayerInvisible ? 99999f : 0f);
}
}
CameraInvisible = ManualToggle(PR(14f, 202f, 360f, 22f), CameraInvisible, "监控隐身(配合隐身工具)");
InvisibilityNoCD = ManualToggle(PR(14f, 228f, 360f, 22f), InvisibilityNoCD, "隐身工具无冷却");
XPgain = ManualToggle(PR(14f, 254f, 360f, 22f), XPgain, "超级经验倍率");
UltraArmor = ManualToggle(PR(14f, 280f, 360f, 22f), UltraArmor, "超级护甲");
Section(312f, "加点 & 加钱");
GUI.Label(PR(10f, 336f, 55f, 22f), "技能点", GUI.skin.label);
_skillInput = ManualTextField(PR(70f, 334f, 120f, 24f), _skillInput, 8, "skillInput");
ManualButton(PR(200f, 334f, 40f, 24f), "+", delegate
{
AddSkillPoints(Parse(_skillInput));
});
GUI.Label(PR(10f, 366f, 55f, 22f), "加钱", GUI.skin.label);
_moneyInput = ManualTextField(PR(70f, 364f, 120f, 24f), _moneyInput, 10, "moneyInput");
ManualButton(PR(200f, 364f, 40f, 24f), "+", delegate
{
AddMoney(Parse(_moneyInput));
});
}
private static void DrawItems()
{
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
//IL_007d: Unknown result type (might be due to invalid IL or missing references)
//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
//IL_0115: Unknown result type (might be due to invalid IL or missing references)
//IL_0144: Unknown result type (might be due to invalid IL or missing references)
Section(74f, "物品");
ToolsAutoFix = ManualToggle(PR(14f, 98f, 360f, 22f), ToolsAutoFix, "工具自动修复");
NoDamagedLoots = ManualToggle(PR(14f, 124f, 360f, 22f), NoDamagedLoots, "战利品无损坏");
BlowtorchInstantUnlock = ManualToggle(PR(14f, 150f, 360f, 22f), BlowtorchInstantUnlock, "喷枪秒开锁");
UnlimitedAmmo = ManualToggle(PR(14f, 176f, 360f, 22f), UnlimitedAmmo, "无限弹药");
Section(208f, "一键操作");
ManualButton(PR(14f, 232f, 360f, 30f), "修好所有物品并解锁", RepairAll);
ManualButton(PR(14f, 270f, 360f, 30f), "解锁全部技能", LearnAllSkills);
ManualButton(PR(14f, 308f, 360f, 30f), "发送背包战利品到卡车", SendAllLoot);
}
private static void DrawWorld()
{
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
//IL_007d: Unknown result type (might be due to invalid IL or missing references)
//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
//IL_0104: Unknown result type (might be due to invalid IL or missing references)
//IL_0140: Unknown result type (might be due to invalid IL or missing references)
//IL_016f: Unknown result type (might be due to invalid IL or missing references)
Section(74f, "世界");
BigCash = ManualToggle(PR(14f, 98f, 360f, 22f), BigCash, "钱掉得多(×10000)");
FreeShop = ManualToggle(PR(14f, 124f, 360f, 22f), FreeShop, "商店免费");
OverFurnished = ManualToggle(PR(14f, 150f, 360f, 22f), OverFurnished, "家具无限摆放");
NoPolice = ManualToggle(PR(14f, 176f, 360f, 22f), NoPolice, "无警察");
NPCBlind = ManualToggle(PR(14f, 202f, 360f, 22f), NPCBlind, "NPC 视而不见");
SecurityCameraBlind = ManualToggle(PR(14f, 228f, 360f, 22f), SecurityCameraBlind, "摄像头失效");
Section(260f, "一键操作");
ManualButton(PR(14f, 284f, 360f, 30f), "标记全部战利品", MarkLoots);
ManualButton(PR(14f, 322f, 360f, 30f), "传送全部战利品到卡车", TeleportLoots);
}
private static int Parse(string s)
{
if (!int.TryParse(s, out var result))
{
return 0;
}
return result;
}
private static void AddMoney(int amount)
{
FPP_Player val = Hacks.Player();
if (!((Object)(object)val == (Object)null) && !((Object)(object)val.WM == (Object)null) && amount > 0)
{
val.WM.RPC_AddMoney(amount);
val.ShowMessage("已加钱 " + amount, 3f, "good", false);
}
}
private static void AddSkillPoints(int amount)
{
FPP_Player val = Hacks.Player();
if (!((Object)(object)val == (Object)null) && !((Object)(object)val.skillManager == (Object)null) && amount > 0)
{
PlayerSkills skillManager = val.skillManager;
skillManager.skillPoints += amount;
val.ShowMessage("技能点 +" + amount, 3f, "good", false);
}
}
internal static void MarkLoots()
{
//IL_0039: Unknown result type (might be due to invalid IL or missing references)
//IL_003e: Unknown result type (might be due to invalid IL or missing references)
//IL_0043: Unknown result type (might be due to invalid IL or missing references)
GameObject[] array = GameObject.FindGameObjectsWithTag("Pickupable");
int num = 0;
for (int i = 0; i < array.Length; i++)
{
Pickupable component = array[i].GetComponent<Pickupable>();
if (!((Object)(object)component == (Object)null) && !((Object)(object)component.assignedItem == (Object)null))
{
component.alwaysSpawnMarker = true;
component.markerColor = Color32.op_Implicit(Color.yellow);
component.SpawnMarker();
num++;
}
}
Hacks.Show("已标记战利品: " + num);
}
private static void TeleportLoots()
{
//IL_006e: Unknown result type (might be due to invalid IL or missing references)
GameObject[] array = GameObject.FindGameObjectsWithTag("Pickupable");
GameObject val = GameObject.FindGameObjectWithTag("SpawnLootTruck");
int num = 0;
if ((Object)(object)val == (Object)null)
{
Hacks.Show("没找到卡车");
return;
}
for (int i = 0; i < array.Length; i++)
{
Pickupable component = array[i].GetComponent<Pickupable>();
if (!((Object)(object)component == (Object)null) && !((Object)(object)component.assignedItem == (Object)null) && component.assignedItem.isLoot)
{
((Component)component).transform.position = val.transform.position;
num++;
}
}
Hacks.Show("已传送战利品: " + num);
}
private static void RepairAll()
{
FPP_Player val = Hacks.Player();
if (!((Object)(object)val == (Object)null) && !((Object)(object)val.inventory == (Object)null))
{
val.inventory.RepairAndUnlockAllItems();
Hacks.Show("已修复并解锁全部物品");
}
}
private static void LearnAllSkills()
{
FPP_Player val = Hacks.Player();
if ((Object)(object)val == (Object)null || (Object)(object)val.skillManager == (Object)null || val.skillManager.skills == null)
{
return;
}
int num = 0;
for (int i = 0; i < val.skillManager.skills.Count; i++)
{
Skill val2 = val.skillManager.skills[i];
if (!((Object)(object)val2 == (Object)null) && !val2.isLearned)
{
val2.isLearned = true;
num++;
}
}
val.skillManager.CheckSkills();
val.CalculateBonusesToPlayer();
val.inventory.CheckSlots(false);
val.ShowMessage("已解锁技能 " + num, 3f, "good", false);
}
internal static void SendAllLoot()
{
FPP_Player val = Hacks.Player();
if (!((Object)(object)val == (Object)null) && !((Object)(object)val.inventory == (Object)null))
{
val.inventory.SendLootToTruck();
Hacks.Show("已发送战利品到卡车");
}
}
}
[BepInPlugin("com.cn.cheatmenu", "CN CheatMenu 中文作弊面板", "2.0.1")]
public class Plugin : BaseUnityPlugin
{
private static ConfigEntry<KeyboardShortcut> _toggleKey;
private static ManualLogSource _log;
private void Awake()
{
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_0054: Unknown result type (might be due to invalid IL or missing references)
//IL_0059: Unknown result type (might be due to invalid IL or missing references)
//IL_005f: Expected O, but got Unknown
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
_log = ((BaseUnityPlugin)this).Logger;
_toggleKey = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("General", "MenuHotkey", new KeyboardShortcut((KeyCode)286, Array.Empty<KeyCode>()), "开关作弊面板的快捷键(另外 F4 / F6 / F8 / F12 也可用)");
Harmony.CreateAndPatchAll(typeof(Plugin).Assembly, (string)null);
GameObject val = new GameObject("CN_CheatMenu_Gui");
Object.DontDestroyOnLoad((Object)val);
((Object)val).hideFlags = (HideFlags)61;
val.AddComponent<GuiBehaviour>();
((BaseUnityPlugin)this).Logger.LogInfo((object)"CN CheatMenu 2.0.1 加载完成");
}
internal static void LogInfo(string msg)
{
if (_log != null)
{
_log.LogInfo((object)msg);
}
}
internal static bool TogglePressed()
{
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
if (_toggleKey != null)
{
KeyboardShortcut value = _toggleKey.Value;
return ((KeyboardShortcut)(ref value)).IsDown();
}
return false;
}
}