using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Net;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Text;
using System.Threading;
using BepInEx;
using HarmonyLib;
using Newtonsoft.Json;
using Patching;
using Photon.Pun;
using Photon.Realtime;
using UnityEngine;
using UnityEngine.SceneManagement;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("s2e-repo")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("s2e-repo")]
[assembly: AssemblyCopyright("Copyright © 2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("29f01461-f3b6-4126-894d-91c44cc8aecb")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
public static class PlayerUtilities
{
[CompilerGenerated]
private sealed class <NextFrame>d__5 : IEnumerator<object>, IDisposable, IEnumerator
{
private int <>1__state;
private object <>2__current;
public Action a;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <NextFrame>d__5(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
<>2__current = null;
<>1__state = 1;
return true;
case 1:
<>1__state = -1;
a();
return false;
}
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
[CompilerGenerated]
private sealed class <SpeedBonusCoroutine>d__28 : IEnumerator<object>, IDisposable, IEnumerator
{
private int <>1__state;
private object <>2__current;
public PlayerController player;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <SpeedBonusCoroutine>d__28(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
player.MoveSpeed = originalMoveSpeed * 2f;
player.SprintSpeed = originalSprintSpeed * 2f;
break;
case 1:
<>1__state = -1;
break;
}
if (speedBonusTimer > 0f)
{
speedBonusTimer -= Time.deltaTime;
<>2__current = null;
<>1__state = 1;
return true;
}
player.MoveSpeed = originalMoveSpeed;
player.SprintSpeed = originalSprintSpeed;
isSpeedBonusActive = false;
return false;
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
[CompilerGenerated]
private sealed class <StaminaBonusCoroutine>d__16 : IEnumerator<object>, IDisposable, IEnumerator
{
private int <>1__state;
private object <>2__current;
public PlayerController player;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <StaminaBonusCoroutine>d__16(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
break;
case 1:
<>1__state = -1;
break;
}
if (staminaBonusTimer > 0f)
{
player.EnergyCurrent = 40f;
staminaBonusTimer -= Time.deltaTime;
<>2__current = null;
<>1__state = 1;
return true;
}
isStaminaBonusActive = false;
return false;
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
private static float staminaBonusTimer;
private static bool isStaminaBonusActive;
private static float speedBonusTimer;
private static bool isSpeedBonusActive;
private static float originalMoveSpeed;
private static float originalSprintSpeed;
private static void SendTikTokMessage(string nameTikTok, string message)
{
if (!((Object)(object)TruckScreenText.instance == (Object)null))
{
string[] array = new string[10] { ":)", ":D", ":P", "eyes", ":o", "heart", ":(", ":’(", "heartbreak", "fedup" };
string text = "{" + array[Random.Range(0, array.Length)] + "}";
string text2 = "{" + array[Random.Range(0, array.Length)] + "}";
string text3 = text + " " + nameTikTok + " " + message + " " + text2;
TruckScreenText.instance.MessageSendCustom("", text3, 0);
}
}
private static string GetLocalSteamID()
{
if (GameManager.Multiplayer())
{
if (PhotonNetwork.LocalPlayer == null)
{
return string.Empty;
}
return PhotonNetwork.LocalPlayer.UserId;
}
PlayerAvatar val = Object.FindObjectOfType<PlayerAvatar>();
if (!((Object)(object)val != (Object)null))
{
return string.Empty;
}
return SemiFunc.PlayerGetSteamID(val);
}
public static void SpawnEnemyRandomLocation(string enemyName, string nameTikTok)
{
//IL_0058: Unknown result type (might be due to invalid IL or missing references)
//IL_005d: Unknown result type (might be due to invalid IL or missing references)
//IL_006e: Unknown result type (might be due to invalid IL or missing references)
//IL_0073: 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_0082: Unknown result type (might be due to invalid IL or missing references)
//IL_0087: Unknown result type (might be due to invalid IL or missing references)
//IL_0096: Unknown result type (might be due to invalid IL or missing references)
//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
//IL_00af: 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_00ba: Unknown result type (might be due to invalid IL or missing references)
//IL_015d: Unknown result type (might be due to invalid IL or missing references)
//IL_017b: Unknown result type (might be due to invalid IL or missing references)
//IL_0180: Unknown result type (might be due to invalid IL or missing references)
GameObject player = GameObject.FindWithTag("Player");
if ((Object)(object)player == (Object)null)
{
return;
}
RoomVolume val = ((IEnumerable<RoomVolume>)Object.FindObjectsOfType<RoomVolume>()).FirstOrDefault((Func<RoomVolume, bool>)delegate(RoomVolume rv)
{
//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)
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
Collider component2 = ((Component)rv).GetComponent<Collider>();
if (component2 == null)
{
return false;
}
Bounds bounds2 = component2.bounds;
return ((Bounds)(ref bounds2)).Contains(player.transform.position);
});
if ((Object)(object)val == (Object)null)
{
return;
}
Collider component = ((Component)val).GetComponent<Collider>();
Vector3 val2 = player.transform.position;
for (int i = 0; i < 10; i++)
{
Vector3 val3 = player.transform.position + Random.insideUnitSphere * 3f;
val3.y = player.transform.position.y;
Bounds bounds = component.bounds;
if (((Bounds)(ref bounds)).Contains(val3))
{
val2 = val3;
break;
}
}
EnemyDirector instance = EnemyDirector.instance;
if ((Object)(object)instance == (Object)null)
{
return;
}
EnemySetup val4 = FindEnemyByName(instance.enemiesDifficulty1, enemyName) ?? FindEnemyByName(instance.enemiesDifficulty2, enemyName) ?? FindEnemyByName(instance.enemiesDifficulty3, enemyName);
if ((Object)(object)val4 == (Object)null)
{
return;
}
LevelGenerator val5 = Object.FindObjectOfType<LevelGenerator>();
if (!((Object)(object)val5 == (Object)null))
{
MethodInfo method = typeof(LevelGenerator).GetMethod("EnemySpawn", BindingFlags.Instance | BindingFlags.NonPublic);
if (!(method == null))
{
method.Invoke(val5, new object[2] { val4, val2 });
SemiFunc.UIFocusText(nameTikTok + " spawned '" + enemyName + "'", Color.white, Color.red, 3f);
SendTikTokMessage(nameTikTok, "spawned '" + enemyName + "'");
}
}
}
internal static List<LevelPoint> GetLevelPoints(bool excludePlayerRooms)
{
List<LevelPoint> list = SemiFunc.LevelPointsGetAll();
if (!excludePlayerRooms)
{
return list;
}
List<LevelPoint> playerRoomPoints = SemiFunc.LevelPointsGetInPlayerRooms();
return list.Where((LevelPoint p) => !playerRoomPoints.Contains(p)).ToList();
}
public static void SpawnSpecificEnemyByName(string enemyName, string nameTikTok)
{
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: 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)
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_0034: Unknown result type (might be due to invalid IL or missing references)
//IL_0082: Unknown result type (might be due to invalid IL or missing references)
//IL_00de: Unknown result type (might be due to invalid IL or missing references)
//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
PlayerController val = Object.FindObjectOfType<PlayerController>();
if ((Object)(object)val == (Object)null)
{
return;
}
Vector3 position = ((Component)val).transform.position;
Vector3 spawnPos = GetClosestSpawnPointTo(position);
spawnPos.y = position.y;
if ((Object)(object)(FindEnemyByName(EnemyDirector.instance.enemiesDifficulty1, enemyName) ?? FindEnemyByName(EnemyDirector.instance.enemiesDifficulty2, enemyName) ?? FindEnemyByName(EnemyDirector.instance.enemiesDifficulty3, enemyName)) == (Object)null)
{
return;
}
Enemy val2 = SpawnEnemyInternal(enemyName, spawnPos);
if ((Object)(object)val2 == (Object)null)
{
return;
}
EnemyStateInvestigate inv = ((Component)val2).GetComponent<EnemyStateInvestigate>();
if ((Object)(object)inv != (Object)null)
{
((MonoBehaviour)CoroutineRunner.Instance).StartCoroutine(NextFrame(delegate
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
inv.Set(spawnPos);
}));
}
SemiFunc.UIFocusText(nameTikTok + " spawned '" + enemyName + "'", Color.white, Color.red, 3f);
SendTikTokMessage(nameTikTok, "spawned '" + enemyName + "'");
}
[IteratorStateMachine(typeof(<NextFrame>d__5))]
private static IEnumerator NextFrame(Action a)
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <NextFrame>d__5(0)
{
a = a
};
}
private static Enemy SpawnEnemyInternal(string enemyName, Vector3 spawnPoint)
{
//IL_0043: Unknown result type (might be due to invalid IL or missing references)
//IL_0044: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
//IL_009e: Unknown result type (might be due to invalid IL or missing references)
string text = "Enemies/Enemy - " + enemyName;
GameObject val = Resources.Load<GameObject>(text);
if ((Object)(object)val == (Object)null)
{
return null;
}
RunManager.instance.EnemiesSpawnedRemoveStart();
GameObject obj = ((GameManager.instance.gameMode != 0) ? PhotonNetwork.InstantiateRoomObject(text, spawnPoint, Quaternion.identity, (byte)0, (object[])null) : Object.Instantiate<GameObject>(val, spawnPoint, Quaternion.identity));
EnemyParent component = obj.GetComponent<EnemyParent>();
Enemy componentInChildren = obj.GetComponentInChildren<Enemy>();
if ((Object)(object)component == (Object)null || (Object)(object)componentInChildren == (Object)null)
{
RunManager.instance.EnemiesSpawnedRemoveEnd();
return componentInChildren;
}
typeof(EnemyParent).GetField("SetupDone", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(component, true);
componentInChildren.EnemyTeleported(spawnPoint);
LevelGenerator instance = LevelGenerator.Instance;
FieldInfo field = typeof(LevelGenerator).GetField("EnemiesSpawnTarget", BindingFlags.Instance | BindingFlags.NonPublic);
field.SetValue(instance, (int)field.GetValue(instance) + 1);
EnemyDirector.instance.FirstSpawnPointAdd(component);
SemiFunc_EnemySpawnPatcher.Block(componentInChildren);
component.DespawnedTimer = 999f;
RunManager.instance.EnemiesSpawnedRemoveEnd();
return componentInChildren;
}
private static Vector3 GetClosestSpawnPointTo(Vector3 start)
{
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
//IL_003a: Unknown result type (might be due to invalid IL or missing references)
//IL_003b: Unknown result type (might be due to invalid IL or missing references)
//IL_0040: Unknown result type (might be due to invalid IL or missing references)
//IL_0079: Unknown result type (might be due to invalid IL or missing references)
//IL_005a: Unknown result type (might be due to invalid IL or missing references)
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
List<LevelPoint> list = SemiFunc.LevelPointsGetAll();
List<LevelPoint> list2 = SemiFunc.LevelPointsGetInPlayerRooms();
Vector3 result = start;
float num = float.MaxValue;
foreach (LevelPoint item in list)
{
if (!list2.Contains(item))
{
Vector3 val = ((Component)item).transform.position - start;
float sqrMagnitude = ((Vector3)(ref val)).sqrMagnitude;
if (sqrMagnitude < num)
{
num = sqrMagnitude;
result = ((Component)item).transform.position;
}
}
}
return result;
}
private static EnemySetup FindEnemyByName(List<EnemySetup> list, string name)
{
return list?.Find((EnemySetup e) => (Object)(object)e != (Object)null && ((Object)e).name.Equals("Enemy - " + name, StringComparison.OrdinalIgnoreCase));
}
public static void SpawnItem(string itemName, string nameTikTok)
{
//IL_0128: Unknown result type (might be due to invalid IL or missing references)
//IL_012f: Unknown result type (might be due to invalid IL or missing references)
//IL_0143: Unknown result type (might be due to invalid IL or missing references)
//IL_0148: Unknown result type (might be due to invalid IL or missing references)
//IL_014f: Unknown result type (might be due to invalid IL or missing references)
//IL_0163: 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_016d: Unknown result type (might be due to invalid IL or missing references)
//IL_0173: Unknown result type (might be due to invalid IL or missing references)
//IL_01a7: Unknown result type (might be due to invalid IL or missing references)
//IL_01a9: Unknown result type (might be due to invalid IL or missing references)
//IL_01c5: Unknown result type (might be due to invalid IL or missing references)
//IL_01ca: Unknown result type (might be due to invalid IL or missing references)
//IL_008f: Unknown result type (might be due to invalid IL or missing references)
//IL_0095: Unknown result type (might be due to invalid IL or missing references)
//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
//IL_00d2: 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_00f7: Unknown result type (might be due to invalid IL or missing references)
//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
string text = (itemName.StartsWith("Item ") ? itemName : ("Item " + itemName));
if (GameManager.Multiplayer())
{
if ((Object)(object)Resources.Load<GameObject>("Items/" + text) == (Object)null)
{
return;
}
string localSteamID = GetLocalSteamID();
if (string.IsNullOrEmpty(localSteamID) || PhotonNetwork.CurrentRoom == null)
{
return;
}
PlayerController val = ((IEnumerable<PlayerController>)Object.FindObjectsOfType<PlayerController>()).FirstOrDefault((Func<PlayerController, bool>)delegate(PlayerController p)
{
PhotonView component = ((Component)p).GetComponent<PhotonView>();
return (Object)(object)component != (Object)null && component.Owner != null && component.Owner.UserId == localSteamID;
});
if ((Object)(object)val == (Object)null)
{
return;
}
Transform transform = ((Component)val).transform;
Vector3 val2 = transform.position + transform.forward * Random.Range(2f, 3f) + transform.right * Random.Range(-1f, 1f);
val2.y = transform.position.y + 0.5f;
PhotonNetwork.Instantiate("Items/" + text, val2, Quaternion.identity, (byte)0, (object[])null);
}
else
{
PlayerController val3 = Object.FindObjectOfType<PlayerController>();
if ((Object)(object)val3 == (Object)null)
{
return;
}
Transform transform2 = ((Component)val3).transform;
Vector3 val4 = transform2.position + transform2.forward * Random.Range(2f, 3f) + transform2.right * Random.Range(-1f, 1f);
val4.y = transform2.position.y + 0.5f;
GameObject val5 = Resources.Load<GameObject>("Items/" + text);
if ((Object)(object)val5 == (Object)null)
{
return;
}
Object.Instantiate<GameObject>(val5, val4, Quaternion.identity);
}
SemiFunc.UIFocusText(nameTikTok + " spawn item '" + itemName + "'", Color.white, Color.red, 3f);
SendTikTokMessage(nameTikTok, "spawn item '" + itemName + "'");
}
public static void SpawnValuableItem(string itemName, string nameTikTok)
{
//IL_0089: Unknown result type (might be due to invalid IL or missing references)
//IL_008f: Unknown result type (might be due to invalid IL or missing references)
//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
//IL_0170: Unknown result type (might be due to invalid IL or missing references)
//IL_0171: Unknown result type (might be due to invalid IL or missing references)
//IL_0196: Unknown result type (might be due to invalid IL or missing references)
//IL_0197: Unknown result type (might be due to invalid IL or missing references)
//IL_01b3: Unknown result type (might be due to invalid IL or missing references)
//IL_01b8: Unknown result type (might be due to invalid IL or missing references)
string text = (itemName.StartsWith("Valuable ") ? itemName : ("Valuable " + itemName));
PlayerController val = null;
if (GameManager.Multiplayer())
{
string localSteamID = GetLocalSteamID();
if (string.IsNullOrEmpty(localSteamID) || PhotonNetwork.CurrentRoom == null)
{
return;
}
val = ((IEnumerable<PlayerController>)Object.FindObjectsOfType<PlayerController>()).FirstOrDefault((Func<PlayerController, bool>)delegate(PlayerController p)
{
PhotonView component = ((Component)p).GetComponent<PhotonView>();
return (Object)(object)component != (Object)null && component.Owner != null && component.Owner.UserId == localSteamID;
});
if ((Object)(object)val == (Object)null)
{
return;
}
}
else
{
val = Object.FindObjectOfType<PlayerController>();
if ((Object)(object)val == (Object)null)
{
return;
}
}
Transform transform = ((Component)val).transform;
Vector3 val2 = transform.position + transform.forward * Random.Range(2f, 3f) + transform.right * Random.Range(-1f, 1f);
val2.y = transform.position.y + 0.5f;
string[] obj = new string[7] { "Valuables/01 Tiny", "Valuables/02 Small", "Valuables/03 Medium", "Valuables/04 Big", "Valuables/05 Wide", "Valuables/06 Tall", "Valuables/07 Very Tall" };
string text2 = null;
string[] array = obj;
for (int i = 0; i < array.Length; i++)
{
string text3 = array[i] + "/" + text;
if ((Object)(object)Resources.Load<GameObject>(text3) != (Object)null)
{
text2 = text3;
break;
}
}
if (text2 == null)
{
return;
}
if (GameManager.Multiplayer())
{
PhotonNetwork.Instantiate(text2, val2, Quaternion.identity, (byte)0, (object[])null);
}
else
{
GameObject val3 = Resources.Load<GameObject>(text2);
if ((Object)(object)val3 == (Object)null)
{
return;
}
Object.Instantiate<GameObject>(val3, val2, Quaternion.identity);
}
SemiFunc.UIFocusText(nameTikTok + " spawn item '" + itemName + "'", Color.white, Color.red, 3f);
SendTikTokMessage(nameTikTok, "spawn item '" + itemName + "'");
}
public static void AddHeal(int amountHeal, string nameTikTok)
{
if (GameManager.Multiplayer())
{
string localSteamID = GetLocalSteamID();
if (string.IsNullOrEmpty(localSteamID))
{
return;
}
PlayerHealth[] array = Object.FindObjectsOfType<PlayerHealth>();
PlayerHealth val = null;
PlayerHealth[] array2 = array;
foreach (PlayerHealth val2 in array2)
{
PhotonView component = ((Component)val2).GetComponent<PhotonView>();
if ((Object)(object)component != (Object)null && component.Owner != null && component.Owner.UserId == localSteamID)
{
val = val2;
break;
}
}
if ((Object)(object)val != (Object)null)
{
int playerHealth = StatsManager.instance.GetPlayerHealth(localSteamID);
int num = 100 + StatsManager.instance.GetPlayerMaxHealth(localSteamID);
int num2 = Mathf.Clamp(playerHealth + amountHeal, 0, num);
val.UpdateHealthRPC(num2, num, true);
}
return;
}
PlayerHealth val3 = Object.FindObjectOfType<PlayerHealth>();
if (!((Object)(object)val3 == (Object)null) && !((Object)(object)((Component)val3).GetComponent<PlayerAvatar>() == (Object)null))
{
string localSteamID2 = GetLocalSteamID();
if (!string.IsNullOrEmpty(localSteamID2))
{
int playerHealth2 = StatsManager.instance.GetPlayerHealth(localSteamID2);
int num3 = 100 + StatsManager.instance.GetPlayerMaxHealth(localSteamID2);
int num4 = Mathf.Clamp(playerHealth2 + amountHeal, 0, num3);
val3.UpdateHealthRPC(num4, num3, true);
}
}
}
public static void AddStamina(int amountStamina, string nameTikTok)
{
//IL_0087: Unknown result type (might be due to invalid IL or missing references)
//IL_008c: Unknown result type (might be due to invalid IL or missing references)
if (GameManager.Multiplayer())
{
string localSteamID = GetLocalSteamID();
if (string.IsNullOrEmpty(localSteamID))
{
return;
}
PlayerController val = ((IEnumerable<PlayerController>)Object.FindObjectsOfType<PlayerController>()).FirstOrDefault((Func<PlayerController, bool>)delegate(PlayerController controller)
{
PhotonView component = ((Component)controller).GetComponent<PhotonView>();
return (Object)(object)component != (Object)null && component.Owner != null && component.Owner.UserId == localSteamID;
});
if ((Object)(object)val != (Object)null)
{
val.EnergyCurrent += (float)amountStamina;
}
}
else
{
PlayerController val2 = Object.FindObjectOfType<PlayerController>();
if ((Object)(object)val2 == (Object)null)
{
return;
}
val2.EnergyCurrent += (float)amountStamina;
}
SemiFunc.UIFocusText($"{nameTikTok} added stamina {amountStamina}", Color.white, Color.red, 3f);
SendTikTokMessage(nameTikTok, $"added stamina {amountStamina}");
}
public static void ActivateStaminaInfinity(string nameTikTok)
{
//IL_008e: Unknown result type (might be due to invalid IL or missing references)
//IL_0093: Unknown result type (might be due to invalid IL or missing references)
PlayerController val = null;
if (GameManager.Multiplayer())
{
string localSteamID = GetLocalSteamID();
if (string.IsNullOrEmpty(localSteamID))
{
return;
}
val = ((IEnumerable<PlayerController>)Object.FindObjectsOfType<PlayerController>()).FirstOrDefault((Func<PlayerController, bool>)delegate(PlayerController controller)
{
PhotonView component = ((Component)controller).GetComponent<PhotonView>();
return (Object)(object)component != (Object)null && component.Owner != null && component.Owner.UserId == localSteamID;
});
if ((Object)(object)val == (Object)null)
{
return;
}
}
else
{
val = Object.FindObjectOfType<PlayerController>();
if ((Object)(object)val == (Object)null)
{
return;
}
}
staminaBonusTimer += 20f;
if (!isStaminaBonusActive)
{
isStaminaBonusActive = true;
((MonoBehaviour)val).StartCoroutine(StaminaBonusCoroutine(val));
}
SemiFunc.UIFocusText(nameTikTok + " activated infinite stamina", Color.white, Color.red, 3f);
SendTikTokMessage(nameTikTok, "activated infinite stamina");
}
[IteratorStateMachine(typeof(<StaminaBonusCoroutine>d__16))]
private static IEnumerator StaminaBonusCoroutine(PlayerController player)
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <StaminaBonusCoroutine>d__16(0)
{
player = player
};
}
public static PlayerController GetLocalPlayer()
{
if (GameManager.Multiplayer())
{
string localSteamID = GetLocalSteamID();
if (string.IsNullOrEmpty(localSteamID))
{
return null;
}
return ((IEnumerable<PlayerController>)Object.FindObjectsOfType<PlayerController>()).FirstOrDefault((Func<PlayerController, bool>)delegate(PlayerController p)
{
PhotonView component = ((Component)p).GetComponent<PhotonView>();
return (Object)(object)component != (Object)null && component.Owner != null && component.Owner.UserId == localSteamID;
});
}
return Object.FindObjectOfType<PlayerController>();
}
public static ValuableObject GetClosestValuable()
{
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
//IL_002b: Unknown result type (might be due to invalid IL or missing references)
//IL_0044: Unknown result type (might be due to invalid IL or missing references)
//IL_004c: Unknown result type (might be due to invalid IL or missing references)
ValuableObject[] array = Object.FindObjectsOfType<ValuableObject>();
if (array == null || array.Length == 0)
{
return null;
}
PlayerController localPlayer = GetLocalPlayer();
if ((Object)(object)localPlayer == (Object)null)
{
return null;
}
Vector3 position = ((Component)localPlayer).transform.position;
ValuableObject result = null;
float num = float.MaxValue;
ValuableObject[] array2 = array;
foreach (ValuableObject val in array2)
{
float num2 = Vector3.Distance(position, ((Component)val).transform.position);
if (num2 < num)
{
num = num2;
result = val;
}
}
return result;
}
public static void RandomDeleteItem(string nameTikTok)
{
//IL_0048: Unknown result type (might be due to invalid IL or missing references)
//IL_004d: Unknown result type (might be due to invalid IL or missing references)
if (GameManager.Multiplayer())
{
ValuableObject closestValuable = GetClosestValuable();
if ((Object)(object)closestValuable != (Object)null)
{
PhotonNetwork.Destroy(((Component)closestValuable).gameObject);
}
}
else
{
ValuableObject closestValuable2 = GetClosestValuable();
if ((Object)(object)closestValuable2 != (Object)null)
{
Object.Destroy((Object)(object)((Component)closestValuable2).gameObject);
}
}
SemiFunc.UIFocusText(nameTikTok + " activated random delete item", Color.white, Color.red, 3f);
SendTikTokMessage(nameTikTok, "activated random delete item");
}
public static void RandomCostRemoveItem(string nameTikTok)
{
//IL_005b: Unknown result type (might be due to invalid IL or missing references)
//IL_0060: Unknown result type (might be due to invalid IL or missing references)
ValuableObject closestValuable = GetClosestValuable();
if ((Object)(object)closestValuable != (Object)null)
{
float num = 0f;
if (GameManager.Multiplayer())
{
PhotonView component = ((Component)closestValuable).GetComponent<PhotonView>();
if ((Object)(object)component != (Object)null)
{
component.RPC("DollarValueSetRPC", (RpcTarget)0, new object[1] { num });
}
}
else
{
closestValuable.dollarValueCurrent = num;
}
}
SemiFunc.UIFocusText(nameTikTok + " activated random cost item removed", Color.white, Color.red, 3f);
SendTikTokMessage(nameTikTok, "activated random cost item removed");
}
public static void ChangeCostUp(string nameTikTok)
{
//IL_0062: Unknown result type (might be due to invalid IL or missing references)
//IL_0067: Unknown result type (might be due to invalid IL or missing references)
ValuableObject closestValuable = GetClosestValuable();
if ((Object)(object)closestValuable != (Object)null)
{
float num = closestValuable.dollarValueCurrent * 1.2f;
if (GameManager.Multiplayer())
{
PhotonView component = ((Component)closestValuable).GetComponent<PhotonView>();
if ((Object)(object)component != (Object)null)
{
component.RPC("DollarValueSetRPC", (RpcTarget)0, new object[1] { num });
}
}
else
{
closestValuable.dollarValueCurrent = num;
}
}
SemiFunc.UIFocusText(nameTikTok + " activated change cost UP", Color.white, Color.red, 3f);
SendTikTokMessage(nameTikTok, "activated change cost UP");
}
public static void ChangeCostDown(string nameTikTok)
{
//IL_0062: Unknown result type (might be due to invalid IL or missing references)
//IL_0067: Unknown result type (might be due to invalid IL or missing references)
ValuableObject closestValuable = GetClosestValuable();
if ((Object)(object)closestValuable != (Object)null)
{
float num = closestValuable.dollarValueCurrent * 0.8f;
if (GameManager.Multiplayer())
{
PhotonView component = ((Component)closestValuable).GetComponent<PhotonView>();
if ((Object)(object)component != (Object)null)
{
component.RPC("DollarValueSetRPC", (RpcTarget)0, new object[1] { num });
}
}
else
{
closestValuable.dollarValueCurrent = num;
}
}
SemiFunc.UIFocusText(nameTikTok + " activated change cost DOWN", Color.white, Color.red, 3f);
SendTikTokMessage(nameTikTok, "activated change cost DOWN");
}
public static void ChangeSpeed(string nameTikTok)
{
//IL_009c: Unknown result type (might be due to invalid IL or missing references)
//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
PlayerController val = null;
if (GameManager.Multiplayer())
{
string localSteamID = GetLocalSteamID();
if (string.IsNullOrEmpty(localSteamID))
{
return;
}
val = ((IEnumerable<PlayerController>)Object.FindObjectsOfType<PlayerController>()).FirstOrDefault((Func<PlayerController, bool>)delegate(PlayerController controller)
{
PhotonView component = ((Component)controller).GetComponent<PhotonView>();
return (Object)(object)component != (Object)null && component.Owner != null && component.Owner.UserId == localSteamID;
});
}
else
{
val = Object.FindObjectOfType<PlayerController>();
}
if (!((Object)(object)val == (Object)null))
{
speedBonusTimer += 20f;
if (!isSpeedBonusActive)
{
isSpeedBonusActive = true;
originalMoveSpeed = val.MoveSpeed;
originalSprintSpeed = val.SprintSpeed;
((MonoBehaviour)val).StartCoroutine(SpeedBonusCoroutine(val));
}
SemiFunc.UIFocusText(nameTikTok + " activated speed boost", Color.white, Color.red, 3f);
SendTikTokMessage(nameTikTok, "activated speed boost");
}
}
[IteratorStateMachine(typeof(<SpeedBonusCoroutine>d__28))]
private static IEnumerator SpeedBonusCoroutine(PlayerController player)
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <SpeedBonusCoroutine>d__28(0)
{
player = player
};
}
public static void ApplyRandomUpgrade(string nameTikTok)
{
//IL_01b4: Unknown result type (might be due to invalid IL or missing references)
//IL_01b9: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)Object.FindObjectOfType<PlayerController>() == (Object)null)
{
return;
}
string empty = string.Empty;
if (GameManager.Multiplayer())
{
string localSteamID = GetLocalSteamID();
if (string.IsNullOrEmpty(localSteamID))
{
return;
}
Room currentRoom = PhotonNetwork.CurrentRoom;
if (currentRoom == null)
{
return;
}
Player val = ((IEnumerable<Player>)currentRoom.Players.Values).FirstOrDefault((Func<Player, bool>)((Player p) => p.UserId == localSteamID));
if (val == null)
{
return;
}
empty = val.UserId;
}
else
{
empty = SemiFunc.PlayerGetSteamID(PlayerAvatar.instance);
}
Action<string>[] array = new Action<string>[8]
{
delegate(string id)
{
PunManager.instance.UpgradePlayerEnergy(id);
},
delegate(string id)
{
PunManager.instance.UpgradePlayerExtraJump(id);
},
delegate(string id)
{
PunManager.instance.UpgradePlayerGrabRange(id);
},
delegate(string id)
{
PunManager.instance.UpgradePlayerGrabStrength(id);
},
delegate(string id)
{
PunManager.instance.UpgradePlayerThrowStrength(id);
},
delegate(string id)
{
PunManager.instance.UpgradePlayerHealth(id);
},
delegate(string id)
{
PunManager.instance.UpgradePlayerSprintSpeed(id);
},
delegate(string id)
{
PunManager.instance.UpgradePlayerTumbleLaunch(id);
}
};
int num = Random.Range(0, array.Length);
array[num](empty);
SemiFunc.UIFocusText(nameTikTok + " applied random upgrade", Color.white, Color.red, 3f);
SendTikTokMessage(nameTikTok, "applied random upgrade");
}
public static void ReviveRandomPlayer(string nameTikTok)
{
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
if (GameManager.Multiplayer())
{
List<PlayerAvatar> list = GameDirector.instance.PlayerList.Where((PlayerAvatar av) => (Object)(object)av != (Object)null && !((Component)av).gameObject.activeSelf).ToList();
if (list.Count != 0)
{
list[Random.Range(0, list.Count)].Revive(false);
SemiFunc.UIFocusText(nameTikTok + " revived a random player", Color.white, Color.red, 3f);
SendTikTokMessage(nameTikTok, "revived a random player");
}
}
}
public static void SpawnActivatedMine(string nameTikTok)
{
//IL_0090: Unknown result type (might be due to invalid IL or missing references)
//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
//IL_0192: Unknown result type (might be due to invalid IL or missing references)
//IL_0193: Unknown result type (might be due to invalid IL or missing references)
//IL_0209: Unknown result type (might be due to invalid IL or missing references)
//IL_020e: Unknown result type (might be due to invalid IL or missing references)
PlayerController val = null;
if (GameManager.Multiplayer())
{
string localSteamID = GetLocalSteamID();
if (string.IsNullOrEmpty(localSteamID))
{
return;
}
Room currentRoom = PhotonNetwork.CurrentRoom;
if (currentRoom == null || ((IEnumerable<Player>)currentRoom.Players.Values).FirstOrDefault((Func<Player, bool>)((Player p) => p.UserId == localSteamID)) == null)
{
return;
}
val = ((IEnumerable<PlayerController>)Object.FindObjectsOfType<PlayerController>()).FirstOrDefault((Func<PlayerController, bool>)delegate(PlayerController p)
{
PhotonView component5 = ((Component)p).GetComponent<PhotonView>();
return (Object)(object)component5 != (Object)null && component5.Owner != null && component5.Owner.UserId == localSteamID;
});
if ((Object)(object)val == (Object)null)
{
return;
}
}
else
{
val = Object.FindObjectOfType<PlayerController>();
if ((Object)(object)val == (Object)null)
{
return;
}
}
Vector3 val2 = ((Component)val).transform.position + new Vector3(0f, 0.1f, 0f);
string[] array = new string[2] { "Item Mine Explosive", "Item Mine Shockwave" };
int num = Random.Range(0, array.Length);
string text = array[num];
if (GameManager.Multiplayer())
{
GameObject val3 = PhotonNetwork.Instantiate("Items/" + text, val2, Quaternion.identity, (byte)0, (object[])null);
if ((Object)(object)val3 == (Object)null)
{
return;
}
ItemMine component = val3.GetComponent<ItemMine>();
if ((Object)(object)component != (Object)null)
{
component.destroyAfterTimer = true;
component.destroyTimer = 0f;
if (text == "Item Mine Shockwave")
{
ItemGrenadeShockwave component2 = val3.GetComponent<ItemGrenadeShockwave>();
if ((Object)(object)component2 != (Object)null)
{
component2.Explosion();
}
}
else
{
val3.AddComponent<MineExplosionTrigger>().Initialize(component);
}
}
}
else
{
GameObject val4 = Resources.Load<GameObject>("Items/" + text);
if ((Object)(object)val4 == (Object)null)
{
return;
}
GameObject val5 = Object.Instantiate<GameObject>(val4, val2, Quaternion.identity);
ItemMine component3 = val5.GetComponent<ItemMine>();
if ((Object)(object)component3 != (Object)null)
{
component3.destroyAfterTimer = true;
component3.destroyTimer = 0f;
if (text == "Item Mine Shockwave")
{
ItemGrenadeShockwave component4 = val5.GetComponent<ItemGrenadeShockwave>();
if ((Object)(object)component4 != (Object)null)
{
component4.Explosion();
}
}
else
{
val5.AddComponent<MineExplosionTrigger>().Initialize(component3);
}
}
}
SemiFunc.UIFocusText(nameTikTok + " spawned activated mine", Color.white, Color.red, 3f);
SendTikTokMessage(nameTikTok, "spawned activated mine");
}
public static void SpawnRandomActivatedGrenade(string nameTikTok)
{
//IL_0192: Unknown result type (might be due to invalid IL or missing references)
//IL_019e: Unknown result type (might be due to invalid IL or missing references)
//IL_01b2: Unknown result type (might be due to invalid IL or missing references)
//IL_01b7: Unknown result type (might be due to invalid IL or missing references)
//IL_01c3: Unknown result type (might be due to invalid IL or missing references)
//IL_01d7: Unknown result type (might be due to invalid IL or missing references)
//IL_01dc: Unknown result type (might be due to invalid IL or missing references)
//IL_01e1: Unknown result type (might be due to invalid IL or missing references)
//IL_01ec: Unknown result type (might be due to invalid IL or missing references)
//IL_0220: Unknown result type (might be due to invalid IL or missing references)
//IL_0222: Unknown result type (might be due to invalid IL or missing references)
//IL_025d: Unknown result type (might be due to invalid IL or missing references)
//IL_0262: Unknown result type (might be due to invalid IL or missing references)
//IL_009c: Unknown result type (might be due to invalid IL or missing references)
//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
//IL_00e1: 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_00eb: Unknown result type (might be due to invalid IL or missing references)
//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
//IL_0116: Unknown result type (might be due to invalid IL or missing references)
//IL_0118: Unknown result type (might be due to invalid IL or missing references)
string[] array = new string[5] { "Item Grenade Duct Taped", "Item Grenade Explosive", "Item Grenade Human", "Item Grenade Shockwave", "Item Grenade Stun" };
string text = array[Random.Range(0, array.Length)];
GameObject val = null;
if (GameManager.Multiplayer())
{
Player localPlayer = PhotonNetwork.LocalPlayer;
string localId = ((localPlayer != null) ? localPlayer.UserId : null);
if (string.IsNullOrEmpty(localId))
{
return;
}
PlayerController val2 = ((IEnumerable<PlayerController>)Object.FindObjectsOfType<PlayerController>()).FirstOrDefault((Func<PlayerController, bool>)delegate(PlayerController c)
{
PhotonView component3 = ((Component)c).GetComponent<PhotonView>();
return (Object)(object)component3 != (Object)null && component3.Owner != null && component3.Owner.UserId == localId;
});
if ((Object)(object)val2 == (Object)null)
{
return;
}
Vector3 val3 = ((Component)val2).transform.position + ((Component)val2).transform.forward * Random.Range(2f, 3f) + ((Component)val2).transform.right * Random.Range(-1f, 1f);
val3.y = ((Component)val2).transform.position.y + 0.5f;
val = PhotonNetwork.Instantiate("Items/" + text, val3, Quaternion.identity, (byte)0, (object[])null);
if ((Object)(object)val != (Object)null)
{
PhotonView component = val.GetComponent<PhotonView>();
if ((Object)(object)component != (Object)null)
{
component.RPC("ToggleItemRPC", (RpcTarget)0, new object[2]
{
true,
PhotonNetwork.LocalPlayer.ActorNumber
});
}
}
}
else
{
PlayerController val4 = Object.FindObjectOfType<PlayerController>();
if ((Object)(object)val4 == (Object)null)
{
return;
}
Vector3 val5 = ((Component)val4).transform.position + ((Component)val4).transform.forward * Random.Range(2f, 3f) + ((Component)val4).transform.right * Random.Range(-1f, 1f);
val5.y = ((Component)val4).transform.position.y + 0.5f;
GameObject val6 = Resources.Load<GameObject>("Items/" + text);
if ((Object)(object)val6 == (Object)null)
{
return;
}
val = Object.Instantiate<GameObject>(val6, val5, Quaternion.identity);
if ((Object)(object)val != (Object)null)
{
ItemToggle component2 = val.GetComponent<ItemToggle>();
if ((Object)(object)component2 != (Object)null)
{
component2.ToggleItem(true, 0);
}
}
}
SemiFunc.UIFocusText(nameTikTok + " spawned & activated " + text, Color.white, Color.red, 3f);
SendTikTokMessage(nameTikTok, "spawned & activated '" + text + "'");
}
public static void KnockdownPlayer(string nameTikTok)
{
//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: 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)
//IL_0049: Unknown result type (might be due to invalid IL or missing references)
//IL_0097: Unknown result type (might be due to invalid IL or missing references)
PlayerAvatar instance = PlayerAvatar.instance;
if ((Object)(object)instance != (Object)null)
{
PlayerTumble tumble = instance.tumble;
Vector3 val = instance.localCameraTransform.forward * 5f;
float num = 10f;
tumble.TumbleForce(val);
tumble.TumbleTorque(((Component)tumble).transform.right * num);
MethodInfo method = ((object)tumble).GetType().GetMethod("BreakFree", BindingFlags.Instance | BindingFlags.NonPublic, null, new Type[1] { typeof(Vector3) }, null);
if (method != null)
{
method.Invoke(tumble, new object[1] { instance.localCameraTransform.forward });
}
tumble.TumbleSet(true, false);
}
SemiFunc.UIFocusText(nameTikTok + " knockdown player", Color.white, Color.red, 3f);
SendTikTokMessage(nameTikTok, "knockdown player");
}
public static void ShakeCartItem(string nameTikTok)
{
//IL_0187: Unknown result type (might be due to invalid IL or missing references)
//IL_018c: Unknown result type (might be due to invalid IL or missing references)
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
//IL_0040: Unknown result type (might be due to invalid IL or missing references)
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
//IL_0046: Unknown result type (might be due to invalid IL or missing references)
//IL_004b: Unknown result type (might be due to invalid IL or missing references)
//IL_0155: Unknown result type (might be due to invalid IL or missing references)
PlayerAvatar instance = PlayerAvatar.instance;
if ((Object)(object)instance != (Object)null)
{
Vector3 position = ((Component)instance).transform.position;
PhysGrabInCart val = null;
float num = float.MaxValue;
PhysGrabInCart[] array = Object.FindObjectsOfType<PhysGrabInCart>();
foreach (PhysGrabInCart val2 in array)
{
Vector3 val3 = ((Component)val2).transform.position - position;
float sqrMagnitude = ((Vector3)(ref val3)).sqrMagnitude;
if (sqrMagnitude < num)
{
num = sqrMagnitude;
val = val2;
}
}
if ((Object)(object)val != (Object)null)
{
FieldInfo field = typeof(PhysGrabInCart).GetField("inCartObjects", BindingFlags.Instance | BindingFlags.NonPublic);
if (field != null && field.GetValue(val) is List<CartObject> list)
{
foreach (CartObject item in list)
{
PhysGrabObject physGrabObject = item.physGrabObject;
Rigidbody val4 = ((physGrabObject != null) ? ((Component)physGrabObject).GetComponent<Rigidbody>() : null);
if ((Object)(object)val4 != (Object)null)
{
float num2 = Random.Range(5f, 10f) * ((Random.value < 0.5f) ? (-1f) : 1f);
float num3 = Random.Range(5f, 20f);
float num4 = Random.Range(5f, 10f) * ((Random.value < 0.5f) ? (-1f) : 1f);
val4.AddForce(new Vector3(num2, num3, num4), (ForceMode)1);
}
}
}
}
}
SemiFunc.UIFocusText(nameTikTok + " shaked cart item", Color.white, Color.red, 3f);
SendTikTokMessage(nameTikTok, "shaked cart item");
}
public static void StunEnemies(string nameTikTok)
{
//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)
float num = 5f;
EnemyStateStunned[] array = Object.FindObjectsOfType<EnemyStateStunned>();
foreach (EnemyStateStunned val in array)
{
if ((Object)(object)val != (Object)null)
{
val.Set(num);
}
}
SemiFunc.UIFocusText(nameTikTok + " stunned all enemies", Color.white, Color.red, 3f);
SendTikTokMessage(nameTikTok, "stunned all enemies");
}
public static void PlayerDead(string nameTikTok)
{
//IL_0094: Unknown result type (might be due to invalid IL or missing references)
//IL_0099: Unknown result type (might be due to invalid IL or missing references)
//IL_0053: Unknown result type (might be due to invalid IL or missing references)
//IL_0058: Unknown result type (might be due to invalid IL or missing references)
if (GameManager.Multiplayer())
{
Player master = PhotonNetwork.MasterClient;
if (master != null)
{
PlayerAvatar val = ((IEnumerable<PlayerAvatar>)Object.FindObjectsOfType<PlayerAvatar>()).FirstOrDefault((Func<PlayerAvatar, bool>)delegate(PlayerAvatar av)
{
PhotonView component = ((Component)av).GetComponent<PhotonView>();
return (Object)(object)component != (Object)null && component.Owner != null && component.Owner.UserId == master.UserId;
});
if ((Object)(object)val != (Object)null)
{
val.PlayerDeath(-1);
SemiFunc.UIFocusText(nameTikTok + " killed you", Color.white, Color.red, 3f);
SendTikTokMessage(nameTikTok, "killed you");
}
}
}
else
{
PlayerAvatar instance = PlayerAvatar.instance;
if ((Object)(object)instance != (Object)null)
{
instance.PlayerDeath(-1);
SemiFunc.UIFocusText(nameTikTok + " killed you", Color.white, Color.red, 3f);
SendTikTokMessage(nameTikTok, "killed you");
}
}
}
public static void PushPlayerForward(string nameTikTok)
{
//IL_0037: Unknown result type (might be due to invalid IL or missing references)
//IL_003c: Unknown result type (might be due to invalid IL or missing references)
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_001f: 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)
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
PlayerAvatar instance = PlayerAvatar.instance;
if ((Object)(object)instance != (Object)null)
{
Vector3 val = instance.localCameraTransform.forward * 30f;
instance.ForceImpulse(val);
}
SemiFunc.UIFocusText(nameTikTok + " pushed forward", Color.white, Color.red, 3f);
SendTikTokMessage(nameTikTok, "pushed forward");
}
public static void PushPlayerBackward(string nameTikTok)
{
//IL_003c: Unknown result type (might be due to invalid IL or missing references)
//IL_0041: Unknown result type (might be due to invalid IL or missing references)
//IL_0015: 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)
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_002b: Unknown result type (might be due to invalid IL or missing references)
PlayerAvatar instance = PlayerAvatar.instance;
if ((Object)(object)instance != (Object)null)
{
Vector3 val = -instance.localCameraTransform.forward * 30f;
instance.ForceImpulse(val);
}
SemiFunc.UIFocusText(nameTikTok + " pushed backward", Color.white, Color.red, 3f);
SendTikTokMessage(nameTikTok, "pushed backward");
}
public static void KillAllEnemies(string nameTikTok)
{
//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
EnemyParent[] array = Object.FindObjectsOfType<EnemyParent>();
foreach (EnemyParent val in array)
{
if (GameManager.Multiplayer())
{
PhotonNetwork.Destroy(((Component)val).gameObject);
}
else
{
Object.Destroy((Object)(object)((Component)val).gameObject);
}
}
if ((Object)(object)EnemyDirector.instance != (Object)null)
{
FieldInfo fieldInfo = typeof(EnemyDirector).GetField("enemies", BindingFlags.Instance | BindingFlags.NonPublic) ?? typeof(EnemyDirector).GetField("enemies", BindingFlags.Instance | BindingFlags.Public);
if (fieldInfo != null && fieldInfo.GetValue(EnemyDirector.instance) is IList list)
{
for (int num = list.Count - 1; num >= 0; num--)
{
if (list[num] == null)
{
list.RemoveAt(num);
}
}
}
}
SemiFunc.UIFocusText(nameTikTok + " killed all enemies", Color.white, Color.red, 3f);
SendTikTokMessage(nameTikTok, "killed all enemies");
}
public static void RequestTeleportToRandomRoom(string nameTikTok)
{
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_0034: 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_0082: Unknown result type (might be due to invalid IL or missing references)
//IL_008c: Unknown result type (might be due to invalid IL or missing references)
//IL_0091: Unknown result type (might be due to invalid IL or missing references)
//IL_0096: Unknown result type (might be due to invalid IL or missing references)
//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
PlayerController val = Object.FindObjectOfType<PlayerController>();
if ((Object)(object)val == (Object)null)
{
return;
}
List<LevelPoint> list = SemiFunc.LevelPointsGetAll();
if (list != null && list.Count != 0)
{
Vector3 currentPos = ((Component)val).transform.position;
float minDistance = 8f;
List<LevelPoint> list2 = list.Where((LevelPoint p) => Vector3.Distance(currentPos, ((Component)p).transform.position) >= minDistance).ToList();
if (list2.Count == 0)
{
list2 = list;
}
TeleportRequest.TargetPosition = ((Component)list2[Random.Range(0, list2.Count)]).transform.position + Vector3.up * 1.5f;
TeleportRequest.Requested = true;
SemiFunc.UIFocusText(nameTikTok + " teleported to random room", Color.white, Color.red, 3f);
SendTikTokMessage(nameTikTok, "teleported to random room");
}
}
public static void TeleportCartsByNameToRandomRooms(string nameTikTok)
{
//IL_0112: Unknown result type (might be due to invalid IL or missing references)
//IL_0117: Unknown result type (might be due to invalid IL or missing references)
//IL_015b: Unknown result type (might be due to invalid IL or missing references)
//IL_0160: Unknown result type (might be due to invalid IL or missing references)
//IL_016a: 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)
//IL_0174: Unknown result type (might be due to invalid IL or missing references)
//IL_021b: Unknown result type (might be due to invalid IL or missing references)
//IL_0220: 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_019f: Unknown result type (might be due to invalid IL or missing references)
//IL_01b9: Unknown result type (might be due to invalid IL or missing references)
//IL_01bd: Unknown result type (might be due to invalid IL or missing references)
PhysGrabInCart[] array = Object.FindObjectsOfType<PhysGrabInCart>();
if (array == null || array.Length == 0)
{
return;
}
string[] source = new string[2] { "Cart Medium", "Cart Small" };
HashSet<Transform> hashSet = new HashSet<Transform>();
PhysGrabInCart[] array2 = array;
foreach (PhysGrabInCart val in array2)
{
Transform t = ((Component)val).transform;
while ((Object)(object)t != (Object)null && !source.Any((string n) => ((Object)t).name.Contains(n)))
{
t = t.parent;
}
if ((Object)(object)t != (Object)null && source.Any((string n) => ((Object)t).name.Contains(n)))
{
hashSet.Add(t);
}
}
if (hashSet.Count == 0)
{
return;
}
List<LevelPoint> list = SemiFunc.LevelPointsGetAll();
if (list == null || list.Count == 0)
{
return;
}
int num = 0;
foreach (Transform item in hashSet)
{
Vector3 oldPos = ((Component)item).transform.position;
List<LevelPoint> list2 = list.Where((LevelPoint p) => Vector3.Distance(oldPos, ((Component)p).transform.position) >= 8f).ToList();
if (list2.Count == 0)
{
list2 = list;
}
Vector3 val2 = ((Component)list2[Random.Range(0, list2.Count)]).transform.position + Vector3.up * 1.5f;
Rigidbody[] componentsInChildren = ((Component)item).GetComponentsInChildren<Rigidbody>();
Rigidbody[] array3 = componentsInChildren;
foreach (Rigidbody obj in array3)
{
obj.isKinematic = true;
obj.velocity = Vector3.zero;
obj.angularVelocity = Vector3.zero;
}
item.SetPositionAndRotation(val2, item.rotation);
Physics.SyncTransforms();
array3 = componentsInChildren;
for (int i = 0; i < array3.Length; i++)
{
array3[i].isKinematic = false;
}
num++;
}
SemiFunc.UIFocusText(nameTikTok + ": random teleported cart", Color.white, Color.red, 3f);
SendTikTokMessage(nameTikTok, " random teleported cart");
}
public static void RequestTeleportPlayerToNearestCart(string nameTikTok)
{
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_011d: Unknown result type (might be due to invalid IL or missing references)
//IL_0122: Unknown result type (might be due to invalid IL or missing references)
//IL_012c: Unknown result type (might be due to invalid IL or missing references)
//IL_0131: Unknown result type (might be due to invalid IL or missing references)
//IL_0136: Unknown result type (might be due to invalid IL or missing references)
//IL_014c: Unknown result type (might be due to invalid IL or missing references)
//IL_0151: Unknown result type (might be due to invalid IL or missing references)
//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
//IL_00db: 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_00e1: Unknown result type (might be due to invalid IL or missing references)
PlayerController val = Object.FindObjectOfType<PlayerController>();
if ((Object)(object)val == (Object)null)
{
return;
}
Vector3 position = ((Component)val).transform.position;
PhysGrabInCart[] array = Object.FindObjectsOfType<PhysGrabInCart>();
if (array == null || array.Length == 0)
{
return;
}
string[] source = new string[2] { "Cart Medium", "Cart Small" };
Transform val2 = null;
float num = float.MaxValue;
PhysGrabInCart[] array2 = array;
foreach (PhysGrabInCart val3 in array2)
{
Transform t = ((Component)val3).transform;
while ((Object)(object)t != (Object)null && !source.Any((string n) => ((Object)t).name.Contains(n)))
{
t = t.parent;
}
if ((Object)(object)t != (Object)null && source.Any((string n) => ((Object)t).name.Contains(n)))
{
Vector3 val4 = t.position - position;
float sqrMagnitude = ((Vector3)(ref val4)).sqrMagnitude;
if (sqrMagnitude < num)
{
num = sqrMagnitude;
val2 = t;
}
}
}
if (!((Object)(object)val2 == (Object)null))
{
TeleportRequest.TargetPosition = val2.position + Vector3.up * 1.5f;
TeleportRequest.Requested = true;
SemiFunc.UIFocusText(nameTikTok + ": teleporting to cart", Color.white, Color.red, 3f);
SendTikTokMessage(nameTikTok, "teleported to cart");
}
}
public static void RequestTeleportPlayerToTruckSpawn(string nameTikTok)
{
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
//IL_0044: Unknown result type (might be due to invalid IL or missing references)
TruckSafetySpawnPoint instance = TruckSafetySpawnPoint.instance;
if (!((Object)(object)instance == (Object)null))
{
Vector3 position = ((Component)instance).transform.position;
_ = ((Component)instance).transform.rotation;
TeleportRequest.TargetPosition = position;
TeleportRequest.Requested = true;
SemiFunc.UIFocusText(nameTikTok + ": teleporting to truck", Color.white, Color.red, 3f);
SendTikTokMessage(nameTikTok, "teleported to truck");
}
}
}
public class MineExplosionTrigger : MonoBehaviour
{
[CompilerGenerated]
private sealed class <TriggerRoutine>d__2 : IEnumerator<object>, IDisposable, IEnumerator
{
private int <>1__state;
private object <>2__current;
public MineExplosionTrigger <>4__this;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <TriggerRoutine>d__2(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Expected O, but got Unknown
int num = <>1__state;
MineExplosionTrigger mineExplosionTrigger = <>4__this;
switch (num)
{
default:
return false;
case 0:
<>1__state = -1;
<>2__current = (object)new WaitForSeconds(0.1f);
<>1__state = 1;
return true;
case 1:
<>1__state = -1;
mineExplosionTrigger.mine.onTriggered.Invoke();
Object.Destroy((Object)(object)mineExplosionTrigger);
return false;
}
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
private ItemMine mine;
public void Initialize(ItemMine _mine)
{
mine = _mine;
((MonoBehaviour)this).StartCoroutine(TriggerRoutine());
}
[IteratorStateMachine(typeof(<TriggerRoutine>d__2))]
private IEnumerator TriggerRoutine()
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <TriggerRoutine>d__2(0)
{
<>4__this = this
};
}
}
public static class TeleportRequest
{
public static bool Requested = false;
public static Vector3 TargetPosition = Vector3.zero;
}
public class CoroutineRunner : MonoBehaviour
{
private static CoroutineRunner _instance;
public static CoroutineRunner Instance => _instance ?? (_instance = new GameObject("CoroutineRunner").AddComponent<CoroutineRunner>());
}
public class REPOTikTok : MonoBehaviour
{
[CompilerGenerated]
private sealed class <InitializeHttpServerCoroutine>d__3 : IEnumerator<object>, IDisposable, IEnumerator
{
private int <>1__state;
private object <>2__current;
public REPOTikTok <>4__this;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <InitializeHttpServerCoroutine>d__3(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
int num = <>1__state;
REPOTikTok rEPOTikTok = <>4__this;
switch (num)
{
default:
return false;
case 0:
<>1__state = -1;
rEPOTikTok.InitializeHttpServer();
<>2__current = null;
<>1__state = 1;
return true;
case 1:
<>1__state = -1;
return false;
}
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
private HttpListener listener;
private bool isStopping;
private void Start()
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
new Harmony("streamtoearn.io").PatchAll();
Debug.Log((object)"Mod s2e_REPO has been loaded!");
((MonoBehaviour)this).StartCoroutine(InitializeHttpServerCoroutine());
}
[IteratorStateMachine(typeof(<InitializeHttpServerCoroutine>d__3))]
private IEnumerator InitializeHttpServerCoroutine()
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <InitializeHttpServerCoroutine>d__3(0)
{
<>4__this = this
};
}
private void InitializeHttpServer()
{
//IL_004f: 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_0060: Expected O, but got Unknown
try
{
listener = new HttpListener();
listener.Prefixes.Add("http://127.0.0.1:55001/");
listener.Start();
ThreadPool.QueueUserWorkItem(delegate
{
while (listener.IsListening && !isStopping)
{
try
{
HttpListenerContext context = listener.GetContext();
HttpListenerRequest request = context.Request;
HttpListenerResponse response = context.Response;
response.Headers.Add("Access-Control-Allow-Origin", "*");
response.Headers.Add("Access-Control-Allow-Methods", "GET, POST, OPTIONS");
response.Headers.Add("Access-Control-Allow-Headers", "Content-Type, Superdupertoken");
if (request.HttpMethod == "OPTIONS")
{
response.StatusCode = 200;
response.Close();
}
else
{
if (request.HttpMethod == "POST")
{
string requestBody;
using (StreamReader streamReader = new StreamReader(request.InputStream, request.ContentEncoding))
{
requestBody = streamReader.ReadToEnd();
}
UnityMainThreadDispatcher.Enqueue(delegate
{
RequestHandler.HandleRequest(request.Url.AbsolutePath, requestBody);
});
string s = "OTVET";
byte[] bytes = Encoding.UTF8.GetBytes(s);
response.ContentLength64 = bytes.Length;
response.OutputStream.Write(bytes, 0, bytes.Length);
}
response.Close();
}
}
catch (Exception ex2)
{
if (!isStopping)
{
Debug.LogError((object)("Error processing request: " + ex2));
}
}
}
});
if ((Object)(object)Object.FindObjectOfType<UnityMainThreadDispatcher>() == (Object)null)
{
GameObject val = new GameObject("UnityMainThreadDispatcher");
val.AddComponent<UnityMainThreadDispatcher>();
Object.DontDestroyOnLoad((Object)val);
}
}
catch (Exception ex)
{
Debug.LogError((object)("Error initializing HTTP Server: " + ex));
}
}
private void StopHttpServer()
{
try
{
if (listener != null && listener.IsListening)
{
isStopping = true;
listener.Stop();
listener.Close();
}
}
catch (Exception ex)
{
Debug.LogError((object)("Error stopping HTTP Server: " + ex));
}
}
private void OnApplicationQuit()
{
StopHttpServer();
}
}
public static class RequestHandler
{
public static void HandleRequest(string path, string requestBody)
{
try
{
Dictionary<string, string> dictionary = JsonConvert.DeserializeObject<Dictionary<string, string>>(requestBody);
string text = path.Split(new char[1] { '/' })[^1].ToLower();
string text2 = (dictionary.ContainsKey("effect") ? dictionary["effect"] : null);
string nameTikTok = (dictionary.ContainsKey("name") ? dictionary["name"] : "");
switch (text)
{
case "spawnenemy":
if (!string.IsNullOrEmpty(text2))
{
if (text2.Equals("Gnome", StringComparison.OrdinalIgnoreCase))
{
PlayerUtilities.SpawnEnemyRandomLocation(text2, nameTikTok);
}
else
{
PlayerUtilities.SpawnSpecificEnemyByName(text2, nameTikTok);
}
}
break;
case "spawnenemyrandomlocation":
if (!string.IsNullOrEmpty(text2))
{
PlayerUtilities.SpawnEnemyRandomLocation(text2, nameTikTok);
}
break;
case "spawnitem":
if (!string.IsNullOrEmpty(text2))
{
PlayerUtilities.SpawnItem(text2, nameTikTok);
}
break;
case "spawnvaluableitem":
if (!string.IsNullOrEmpty(text2))
{
PlayerUtilities.SpawnValuableItem(text2, nameTikTok);
}
break;
case "heal":
{
int amountHeal = 100;
if (!string.IsNullOrEmpty(text2) && int.TryParse(text2, out var result2))
{
amountHeal = result2;
}
PlayerUtilities.AddHeal(amountHeal, nameTikTok);
break;
}
case "stamina":
{
int amountStamina = 100;
if (!string.IsNullOrEmpty(text2) && int.TryParse(text2, out var result))
{
amountStamina = result;
}
PlayerUtilities.AddStamina(amountStamina, nameTikTok);
break;
}
case "changecostup":
PlayerUtilities.ChangeCostUp(nameTikTok);
break;
case "changecostdown":
PlayerUtilities.ChangeCostDown(nameTikTok);
break;
case "removecost":
PlayerUtilities.RandomCostRemoveItem(nameTikTok);
break;
case "destroyitem":
PlayerUtilities.RandomDeleteItem(nameTikTok);
break;
case "infinitystamina":
PlayerUtilities.ActivateStaminaInfinity(nameTikTok);
break;
case "bonusspeed":
PlayerUtilities.ChangeSpeed(nameTikTok);
break;
case "randomupgrade":
PlayerUtilities.ApplyRandomUpgrade(nameTikTok);
break;
case "revive":
PlayerUtilities.ReviveRandomPlayer(nameTikTok);
break;
case "spawnmine":
PlayerUtilities.SpawnActivatedMine(nameTikTok);
break;
case "spawngrenade":
PlayerUtilities.SpawnRandomActivatedGrenade(nameTikTok);
break;
case "knockdown":
PlayerUtilities.KnockdownPlayer(nameTikTok);
break;
case "shakecartitem":
PlayerUtilities.ShakeCartItem(nameTikTok);
break;
case "stunenemies":
PlayerUtilities.StunEnemies(nameTikTok);
break;
case "kill":
PlayerUtilities.PlayerDead(nameTikTok);
break;
case "pushplayerforward":
PlayerUtilities.PushPlayerForward(nameTikTok);
break;
case "pushplayerbackward":
PlayerUtilities.PushPlayerBackward(nameTikTok);
break;
case "killallenemies":
PlayerUtilities.KillAllEnemies(nameTikTok);
break;
case "randomteleport":
PlayerUtilities.RequestTeleportToRandomRoom(nameTikTok);
break;
case "randomteleportcart":
PlayerUtilities.TeleportCartsByNameToRandomRooms(nameTikTok);
break;
case "teleporttocart":
PlayerUtilities.RequestTeleportPlayerToNearestCart(nameTikTok);
break;
case "teleporttotruck":
PlayerUtilities.RequestTeleportPlayerToTruckSpawn(nameTikTok);
break;
default:
Debug.Log((object)("Unknown command: " + text));
break;
case "test":
break;
}
}
catch (Exception ex)
{
Debug.LogError((object)("Error in HandleRequest: " + ex));
}
}
}
public class UnityMainThreadDispatcher : MonoBehaviour
{
private static readonly Queue<Action> executionQueue = new Queue<Action>();
private static float lastExecutionTime = 0f;
private const float delayBetweenCommands = 0.1f;
public static void Enqueue(Action action)
{
if (action == null)
{
return;
}
lock (executionQueue)
{
executionQueue.Enqueue(action);
}
}
private void Update()
{
lock (executionQueue)
{
if (executionQueue.Count > 0 && Time.time - lastExecutionTime >= 0.1f)
{
try
{
executionQueue.Dequeue()?.Invoke();
}
catch (Exception ex)
{
Debug.LogError((object)("Error executing queued action: " + ex));
}
lastExecutionTime = Time.time;
}
}
}
}
namespace S2EREPOTikTok
{
[BepInPlugin("com.streamtoearn.repotiktok", "REPOTikTok", "1.0.0")]
public class REPOTikTokPlugin : BaseUnityPlugin
{
private void Awake()
{
SceneManager.sceneLoaded += OnSceneLoaded;
}
private void OnSceneLoaded(Scene scene, LoadSceneMode mode)
{
if (((Scene)(ref scene)).name != "InitialScene")
{
InitializeMod();
SceneManager.sceneLoaded -= OnSceneLoaded;
}
}
private void InitializeMod()
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
//IL_0016: Expected O, but got Unknown
GameObject val = new GameObject("REPOTikTok");
val.AddComponent<REPOTikTok>();
Object.DontDestroyOnLoad((Object)val);
}
}
}
namespace Patching
{
[HarmonyPatch(typeof(SemiFunc), "EnemySpawn")]
internal class SemiFunc_EnemySpawnPatcher
{
private static readonly HashSet<Enemy> _blocked = new HashSet<Enemy>();
public static void Block(Enemy e)
{
if ((Object)(object)e != (Object)null)
{
_blocked.Add(e);
}
}
private static bool Prefix(Enemy enemy, ref bool __result)
{
if (!_blocked.Remove(enemy))
{
return true;
}
__result = false;
return false;
}
}
[HarmonyPatch(typeof(PlayerController), "FixedUpdate")]
internal class TeleportPlayerPatch
{
private static void Prefix(PlayerController __instance)
{
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_0047: Unknown result type (might be due to invalid IL or missing references)
if (TeleportRequest.Requested)
{
((Component)__instance).transform.position = TeleportRequest.TargetPosition;
CharacterController component = ((Component)__instance).GetComponent<CharacterController>();
if ((Object)(object)component != (Object)null)
{
((Collider)component).enabled = false;
}
Rigidbody component2 = ((Component)__instance).GetComponent<Rigidbody>();
if ((Object)(object)component2 != (Object)null)
{
component2.isKinematic = true;
component2.velocity = Vector3.zero;
}
if ((Object)(object)component != (Object)null)
{
((Collider)component).enabled = true;
}
if ((Object)(object)component2 != (Object)null)
{
component2.isKinematic = false;
}
TeleportRequest.Requested = false;
}
}
}
}