Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of Chats Revenge REPO v1.9.0
plugins/ChatsRevenge/chatsRevenge.dll
Decompiled a year agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Net; using System.Net.Sockets; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text; using System.Threading; using BepInEx; using BepInEx.Logging; using ChatsRevenge; using ChatsRevenge.Patches; using ChatsRevenge.Utils; using HarmonyLib; using Newtonsoft.Json; using Photon.Pun; using Photon.Realtime; using UnityEngine; using UnityEngine.Networking; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("chatsRevenge")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("chatsRevenge")] [assembly: AssemblyCopyright("Copyright © 2025")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("75d93849-215e-4a79-a691-6b62346e18e9")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] public class CoroutineRunner : MonoBehaviour { public string functionName; public float delaySeconds; public object[] parameters = new object[0]; private bool isready = false; public void Update() { if (isready) { isready = false; ((MonoBehaviour)this).Invoke("callFunction", delaySeconds); } } public void delayedFunction(string _functionName, float _delaySeconds, object[] _parameters) { parameters = _parameters; delaySeconds = _delaySeconds; functionName = _functionName; isready = true; } private void callFunction() { string text = functionName; object[] array = parameters; functionName = ""; Plugin.Instance.log("DelayedInvoke"); MethodInfo method = ((object)Plugin.Instance).GetType().GetMethod(text, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (method != null) { method.Invoke(Plugin.Instance, array); return; } Plugin.Instance.logError("Function '" + text + "' not found in " + ((object)this).GetType().Name + "."); } } public class ParticleFollower : MonoBehaviour { public Transform target; public Vector3 offset; private void Update() { //IL_001d: 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_0028: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)target != (Object)null) { ((Component)this).transform.position = target.position + offset; } } } namespace ChatsRevenge { [BepInPlugin("ChatsRevenge", "ChatsRevenge", "1.9.0")] public class Plugin : BaseUnityPlugin { private const string PluginName = "ChatsRevenge"; public const string VersionString = "1.9.0"; public string version = "1.9.0"; private static readonly Harmony Harmony = new Harmony("ChatsRevenge"); public GameDirector currentRound; private bool loaded = false; public static ManualLogSource Log = new ManualLogSource("ChatsRevenge"); public PlayerController _localController; public PlayerAvatar _localAvatar; public IDictionary<string, AudioClip> clips = new Dictionary<string, AudioClip>(); private string itemName; public static Plugin Instance { get; private set; } private void Awake() { if ((Object)(object)Instance == (Object)null) { Instance = this; } else { Object.Destroy((Object)(object)((Component)this).gameObject); } Instance = this; ((BaseUnityPlugin)this).Logger.LogInfo((object)"PluginName: ChatsRevenge, VersionString: 1.9.0 is loading..."); ((BaseUnityPlugin)this).Logger.LogInfo((object)"PluginName: ChatsRevenge, VersionString: 1.9.0 is loaded."); Log = ((BaseUnityPlugin)this).Logger; Harmony.PatchAll(typeof(ModUtils)); Harmony.PatchAll(typeof(PlayerPatches)); pythonSocket.Instance.start(); log("CHATSREVENGE AWKAKE"); loaded = true; } public bool pluginLoaded() { return loaded; } public void preAction() { if ((Object)(object)Instance == (Object)null) { Instance = this; } currentRound = GameDirector.instance; _localController = API.getLocalPlayerController(); _localAvatar = _localController.playerAvatarScript; if (!clips.ContainsKey("mario")) { AudioClip audioFromFile = API.GetAudioFromFile("https://audio.jukehost.co.uk/Bp1CR9Ccf7XIBN99pFWWnTLdG73ZpQXL"); clips["mario"] = audioFromFile; } if (!clips.ContainsKey("nether portal")) { AudioClip audioFromFile2 = API.GetAudioFromFile("https://audio.jukehost.co.uk/UrLqB7v8BasXza3Kq1FNKiE2uhVdbUkz"); clips["nether portal"] = audioFromFile2; } if (!clips.ContainsKey("gamble")) { AudioClip audioFromFile3 = API.GetAudioFromFile("https://audio.jukehost.co.uk/Pm6dtuoWyUr16onL9zlIraAWKPZS6Xvj"); clips["gamble"] = audioFromFile3; } if (!clips.ContainsKey("buzz")) { AudioClip audioFromFile4 = API.GetAudioFromFile("https://audio.jukehost.co.uk/wSEs8YhBQ0A8MP1bIp2WqzFrjAzNEev0"); clips["buzz"] = audioFromFile4; } } public void sendNotification(string message) { sendNotificationRPC(message); API.CallRPCOtherClients("sendNotificationRPC", message); } public void sendNotificationRPC(string message) { //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) SemiFunc.UIBigMessage(message, "{!}", 25f, Color.white, Color.white); BigMessageUI.instance.bigMessageTimer = 3f; } public void log(string message) { ((BaseUnityPlugin)this).Logger.LogInfo((object)message); } public void logError(string message) { ((BaseUnityPlugin)this).Logger.LogError((object)message); } public void giveImmunityRPC(string data) { giveImmunity(int.Parse(data)); } public void giveImmunity(int duration) { if (duration < 0) { duration = 1; } PlayerPatches.immune = true; PlayerPatches.immuneEndTime = Time.realtimeSinceStartup + (float)duration; string targetedPlayer = API.getTargetedPlayer(); immunityEffectRPC($"{targetedPlayer}#{duration}"); API.CallRPCOtherClients("immunityEffectRPC", $"{targetedPlayer}#{duration}"); } public void immunityEffectRPC(string data) { //IL_0078: 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_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) string[] array = data.Split(new char[1] { '#' }); string steamid = array[0]; int num = int.Parse(array[1]); PlayerAvatar playerAvatar = API.getPlayerAvatar(steamid); GameObject val = Resources.Load<GameObject>(API.getItemPath("Mine Stun")); if ((Object)(object)val != (Object)null) { ItemMineStun componentInChildren = val.GetComponentInChildren<ItemMineStun>(); if ((Object)(object)componentInChildren != (Object)null) { ParticleSystem val2 = Object.Instantiate<ParticleSystem>(componentInChildren.particleFlash, ((Component)playerAvatar).transform); MainModule main = val2.main; ((MainModule)(ref main)).loop = true; ParticleFollower particleFollower = ((Component)val2).gameObject.AddComponent<ParticleFollower>(); particleFollower.target = ((Component)playerAvatar).transform; particleFollower.offset = new Vector3(0f, 1f, 0f); val2.Play(); API.delayedFunction(this, "stopParticles", num, val2); } if ((Object)(object)componentInChildren != (Object)null) { ParticleSystem val3 = Object.Instantiate<ParticleSystem>(componentInChildren.particleLightning, ((Component)playerAvatar).transform); MainModule main2 = val3.main; ((MainModule)(ref main2)).loop = true; ParticleFollower particleFollower2 = ((Component)val3).gameObject.AddComponent<ParticleFollower>(); particleFollower2.target = ((Component)playerAvatar).transform; particleFollower2.offset = new Vector3(0f, 1f, 0f); val3.Play(); API.delayedFunction(this, "stopParticles", num, val3); } } PlaySoundlinkTargetLocationLoopLocal("mario", ((Component)playerAvatar).gameObject, num, 0.3f); } public void teleportPlayer() { //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: 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_00c0: 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_00ff: Unknown result type (might be due to invalid IL or missing references) if (!API.isDead(_localAvatar)) { List<LevelPoint> source = SemiFunc.LevelPointsGetAll(); source = source.OrderBy((LevelPoint temppoint) => Vector3.Distance(((Component)temppoint).transform.position, ((Component)_localAvatar).transform.position)).ToList(); Random random = new Random(); int index = random.Next(source.Count() / 4, source.Count()); LevelPoint val = source[index]; Vector3 position = ((Component)val).transform.position; for (float num = Vector3.Distance(((Component)val).transform.position, ((Component)_localAvatar).transform.position); num < 30f; num = Vector3.Distance(((Component)val).transform.position, ((Component)_localAvatar).transform.position)) { random = new Random(); index = random.Next(source.Count() / 4, source.Count()); val = source[index]; position = ((Component)val).transform.position; } API.delayedFunction(this, "setPlayerLocation", PlayerPatches.teleportDuration, position); string targetedPlayer = API.getTargetedPlayer(); teleportEffect(targetedPlayer); API.CallRPCOtherClients("teleportEffect", targetedPlayer ?? ""); } } public void setPlayerLocation(Vector3 location) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) if (!API.isDead(_localAvatar)) { ((Component)_localController).transform.position = location; } } public void teleportEffect(string steamid) { //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_0108: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) PlayerAvatar playerAvatar = API.getPlayerAvatar(steamid); GameObject val = Resources.Load<GameObject>("Valuables/03 Medium/valuable wizard time glass"); if ((Object)(object)val != (Object)null) { log("WizardGlass != null"); ParticleSystem particleSystemSwirl = val.GetComponent<ValuableWizardTimeGlass>().particleSystemSwirl; if ((Object)(object)particleSystemSwirl != (Object)null) { ParticleSystem val2 = Object.Instantiate<ParticleSystem>(particleSystemSwirl, ((Component)playerAvatar).transform); ParticleFollower particleFollower = ((Component)val2).gameObject.AddComponent<ParticleFollower>(); particleFollower.target = ((Component)playerAvatar).transform; particleFollower.offset = new Vector3(0f, 1f, 0f); val2.Play(); API.delayedFunction(this, "stopParticles", PlayerPatches.teleportDuration, val2); } ParticleSystem particleSystemGlitter = val.GetComponent<ValuableWizardTimeGlass>().particleSystemGlitter; if ((Object)(object)particleSystemGlitter != (Object)null) { ParticleSystem val3 = Object.Instantiate<ParticleSystem>(particleSystemGlitter, ((Component)playerAvatar).transform); ParticleFollower particleFollower2 = ((Component)val3).gameObject.AddComponent<ParticleFollower>(); particleFollower2.target = ((Component)playerAvatar).transform; particleFollower2.offset = new Vector3(0f, 1f, 0f); val3.Play(); API.delayedFunction(this, "stopParticles", PlayerPatches.teleportDuration, val3); } } PlaySoundPlayerLocationLocal("nether portal", steamid, PlayerPatches.teleportDuration, 0.1f); } public void stopParticles(ParticleSystem particle) { particle.Stop(); Object.Destroy((Object)(object)particle); } public void spawnMine(string filler = "") { if (API.isHost()) { spawnMineRPC(API.getSteamID(_localAvatar)); } else { API.CallRPC("spawnMineRPC", API.getSteamID(_localAvatar)); } } public void spawnMineRPC(string steamid) { //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_0021: 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) //IL_002a: 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) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0081: 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) //IL_009f: Unknown result type (might be due to invalid IL or missing references) preAction(); PlayerAvatar playerAvatar = API.getPlayerAvatar(steamid); Vector3 position = ((Component)playerAvatar).transform.position; Quaternion rotation = ((Component)playerAvatar).transform.rotation; float num = (float)((double)((Quaternion)(ref rotation)).eulerAngles.y * 3.14 / 180.0); position.x += 3f * Mathf.Sin(num); position.z += 3f * Mathf.Cos(num); position.y += 2f; string itemPath = API.getItemPath("Mine Stun"); GameObject val = API.NetworkInstantiate(itemPath, position, Quaternion.identity, 0); ItemMine component = val.GetComponent<ItemMine>(); API.delayedFunction(this, "armMine", 0.1f, component); } private void armMine(ItemMine mine) { ItemToggle itemToggle = mine.itemToggle; itemToggle.ToggleItem(true, -1); MethodInfo method = ((object)mine).GetType().GetMethod("StateSet", BindingFlags.Instance | BindingFlags.NonPublic); method.Invoke(mine, new object[1] { (object)(States)2 }); } public void spawnGrenade(string filler = "") { if (API.isHost()) { spawnGrenadeRPC(API.getSteamID(_localAvatar)); } else { API.CallRPC("spawnGrenadeRPC", API.getSteamID(_localAvatar)); } } public void spawnGrenadeRPC(string steamid) { //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_001d: 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) preAction(); PlayerAvatar playerAvatar = API.getPlayerAvatar(steamid); Vector3 position = ((Component)playerAvatar).transform.position; position.y += 2f; string itemPath = API.getItemPath("Grenade Explosive"); GameObject val = API.NetworkInstantiate(itemPath, position, Quaternion.identity, 0); ItemGrenade component = val.GetComponent<ItemGrenade>(); API.delayedFunction(this, "armGrenade", 0.1f, component); } private void armGrenade(ItemGrenade grenade) { ItemToggle itemToggle = grenade.itemToggle; itemToggle.ToggleItem(true, -1); } public void revive(string filler = "") { if (API.isDead(_localAvatar)) { _localAvatar.Revive(false); return; } foreach (PlayerAvatar player in GameDirector.instance.PlayerList) { if (API.isDead(player)) { player.Revive(false); break; } } } public void reviveAll(string filler = "") { foreach (PlayerAvatar player in GameDirector.instance.PlayerList) { if (API.isDead(player)) { player.Revive(false); } } } public void reviveRPC(string steamid) { API.getPlayerAvatar(steamid).Revive(false); } public void PlaySoundPlayerLocation(string clipName, string steamid, float stopTime = 9999f, float volume = 10f) { API.CallRPCOtherClients("PlaySoundPlayerLocationRPC", $"{clipName}#{steamid}#{stopTime}#{volume}"); PlaySoundPlayerLocationLocal(clipName, steamid, stopTime, volume); } public void PlaySoundPlayerLocationRPC(string data) { string[] array = data.Split(new char[1] { '#' }); string clipName = array[0]; string steamid = array[1]; float stopTime = float.Parse(array[2]); float num = float.Parse(array[3]); PlaySoundPlayerLocationLocal(clipName, steamid, stopTime); } public void PlaySoundPlayerLocationLocal(string clipName, string steamid, float stopTime = 9999f, float volume = 10f) { //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Expected O, but got Unknown //IL_005a: Unknown result type (might be due to invalid IL or missing references) PlayerAvatar playerAvatar = API.getPlayerAvatar(steamid); try { AudioClip val = clips[clipName]; AudioSource val2 = (AudioSource)((Component)playerAvatar).gameObject.AddComponent(typeof(AudioSource)); val2.clip = val; val2.spatialBlend = 1f; val2.volume = volume; ((Component)val2).transform.position = ((Component)playerAvatar).transform.position; val2.Play(); float num = val.length * ((Time.timeScale < 0.01f) ? 0.01f : Time.timeScale); if (num > stopTime) { num = stopTime; } API.delayedFunction(this, "stopAudio", num, val2); } catch { } } public void PlaySoundlinkTargetLocationLoopLocal(string clipName, GameObject target, float stopTime, float volume) { AudioSource val = target.gameObject.AddComponent<AudioSource>(); val.clip = clips[clipName]; float num = val.clip.length * ((Time.timeScale < 0.01f) ? 0.01f : Time.timeScale); if (num != 0f) { val.volume = volume; val.Play(); if (stopTime < num) { API.delayedFunction(this, "stopAudio", stopTime, val); return; } stopTime -= num; API.delayedFunction(this, "stopAudio", num, val); API.delayedFunction(this, "PlaySoundlinkTargetLocationLoopLocal", num, clipName, target, stopTime, volume); } } public void PlaySoundsourcePlayerLocationLoopLocal(Sound source, GameObject target, string steamid, float stopTime = 5f, float volume = 0.5f) { AudioSource val = target.gameObject.AddComponent<AudioSource>(); val.clip = source.Sounds[Random.Range(0, source.Sounds.Length)]; float num = val.clip.length * ((Time.timeScale < 0.01f) ? 0.01f : Time.timeScale); val.volume = volume; val.spatialBlend = source.SpatialBlend; val.Play(); stopTime -= num; API.delayedFunction(this, "stopAudio", num, val); if (stopTime > 0f) { API.delayedFunction(this, "PlaySoundsourcePlayerLocationLoopLocal", num, source, target, steamid, stopTime, volume); } } public void stopAudio(AudioSource audioSource) { audioSource.Stop(); Object.Destroy((Object)(object)audioSource); } public void destroyMostValuedFountItem() { //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) List<GameObject> valuableItmes = API.GetValuableItmes(); if (valuableItmes.Count == 0) { return; } float num = 0f; GameObject val = valuableItmes[0]; foreach (GameObject item in valuableItmes) { ValuableObject component = item.GetComponent<ValuableObject>(); bool flag = (bool)API.GetInternalField<ValuableObject>(component, "discovered"); if (component.dollarValueCurrent > num && flag) { num = component.dollarValueCurrent; val = item; } } ValuableObject component2 = val.GetComponent<ValuableObject>(); PhysGrabObjectImpactDetector component3 = val.GetComponent<PhysGrabObjectImpactDetector>(); log($"breaking {((Object)val).name} worth {num}"); string data = $"{((Object)val).name}#{component2.dollarValueOriginal}#{val.transform.position.x}#{val.transform.position.y}#{val.transform.position.z}"; destroyItemRPC(data); API.CallRPC("destroyItemRPC", data); } public void destroyClosest() { //IL_002f: 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_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) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0114: 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_0144: Unknown result type (might be due to invalid IL or missing references) List<GameObject> valuableItmes = API.GetValuableItmes(); if (valuableItmes.Count == 0) { return; } PlayerAvatar targetedPlayerAvatar = API.getTargetedPlayerAvatar(); GameObject val = valuableItmes[0]; Vector3 val2 = val.transform.position - ((Component)targetedPlayerAvatar).transform.position; float num = ((Vector3)(ref val2)).magnitude; foreach (GameObject item in valuableItmes) { val2 = item.transform.position - ((Component)targetedPlayerAvatar).transform.position; float magnitude = ((Vector3)(ref val2)).magnitude; ValuableObject component = item.GetComponent<ValuableObject>(); if (num > magnitude) { num = magnitude; val = item; } } ValuableObject component2 = val.GetComponent<ValuableObject>(); PhysGrabObjectImpactDetector component3 = val.GetComponent<PhysGrabObjectImpactDetector>(); log("breaking " + ((Object)val).name); string data = $"{((Object)val).name}#{component2.dollarValueOriginal}#{val.transform.position.x}#{val.transform.position.y}#{val.transform.position.z}"; destroyItemRPC(data); API.CallRPC("destroyItemRPC", data); } public void destroyItemRPC(string data) { //IL_00aa: 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_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Expected O, but got Unknown //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_0166: 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) //IL_0185: Unknown result type (might be due to invalid IL or missing references) preAction(); string[] array = data.Split(new char[1] { '#' }); string text = array[0]; float num = float.Parse(array[1]); Vector3 val = default(Vector3); ((Vector3)(ref val))..ctor(float.Parse(array[2]), float.Parse(array[3]), float.Parse(array[4])); List<GameObject> valuableItmes = API.GetValuableItmes(); foreach (GameObject item in valuableItmes) { if (((Object)item).name != text || Math.Abs(item.GetComponent<ValuableObject>().dollarValueOriginal - num) > 5f) { continue; } Vector3 val2 = item.transform.position - val; if (((Vector3)(ref val2)).magnitude > 5f) { continue; } PhysGrabObjectImpactDetector component = item.GetComponent<PhysGrabObjectImpactDetector>(); PhysAudio impactAudio = component.impactAudio; Sound val3 = new Sound(); val3 = impactAudio.breakMedium; val3.Play(item.transform.position, 1f, 1f, 1f, 1f); GameObject val4 = Resources.Load<GameObject>("Enemies/Enemy - Beamer"); if ((Object)(object)val4 != (Object)null) { EnemyBeamer componentInChildren = val4.GetComponentInChildren<EnemyBeamer>(); if ((Object)(object)componentInChildren != (Object)null) { ParticleSystem val5 = Object.Instantiate<ParticleSystem>(componentInChildren.particleDeathBody, item.transform.position, Quaternion.identity); ParticleSystem val6 = Object.Instantiate<ParticleSystem>(componentInChildren.particleDeathSmoke, item.transform.position, Quaternion.identity); val5.Play(); val6.Play(); API.delayedFunction(this, "stopParticles", 1f, val5); API.delayedFunction(this, "stopParticles", 1f, val6); } } if (API.isHost()) { API.delayedFunction(this, "destroyItemServer", 0.1f, item); } break; } } public void destroyItemServer(GameObject item) { if (API.isHost()) { PhotonNetwork.Destroy(item); } } public void antiGravity(float time) { if (!API.isHost()) { _localController.AntiGravity(time); } } public void antiGravityRPC(string time) { antiGravity(float.Parse(time)); } public void healPlayer(string filler = "") { healRPC(); } public void healRPC(string data = "") { int maxHealth = _localAvatar.playerHealth.maxHealth; ((Component)_localAvatar).GetComponent<PlayerHealth>().Heal(maxHealth, true); } public void discountRPC(string data) { ItemAttributes[] array = Object.FindObjectsOfType<ItemAttributes>(); foreach (ItemAttributes val in array) { int num = (val.value /= 2); val.photonView.RPC("GetValueRPC", (RpcTarget)1, new object[1] { num }); } ShopManager.instance.ShopCheck(); } public void lootbox() { string targetedPlayer = API.getTargetedPlayer(); lootboxRPC(targetedPlayer); API.CallRPCOtherClients("lootboxRPC", targetedPlayer); } public void lootboxRPC(string steamid) { PlaySoundPlayerLocation("gamble", steamid, 9999f, 0.2f); API.delayedFunction(this, "spawnMyteryItem", 4f, steamid); } public void giveweapon() { string targetedPlayer = API.getTargetedPlayer(); weaponRPC(targetedPlayer); API.CallRPCOtherClients("weaponRPC", targetedPlayer); } public void weaponRPC(string steamid) { PlaySoundPlayerLocation("gamble", steamid, 9999f, 0.2f); API.delayedFunction(this, "spawnWeaponServer", 4f, steamid); } public void spawnWeaponServer(string steamid) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0013: 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_001f: 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_0046: 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) //IL_007a: 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) //IL_0181: 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_00c3: Unknown result type (might be due to invalid IL or missing references) PlayerAvatar playerAvatar = API.getPlayerAvatar(steamid); Vector3 position = ((Component)playerAvatar).transform.position; Quaternion rotation = ((Component)playerAvatar).transform.rotation; float num = (float)((double)((Quaternion)(ref rotation)).eulerAngles.y * 3.14 / 180.0); position.x += 3f * Mathf.Sin(num); position.z += 3f * Mathf.Cos(num); position.y += 0.5f; GameObject val = Resources.Load<GameObject>("Enemies/Enemy - Beamer"); if ((Object)(object)val != (Object)null) { EnemyBeamer componentInChildren = val.GetComponentInChildren<EnemyBeamer>(); if ((Object)(object)componentInChildren != (Object)null) { ParticleSystem val2 = Object.Instantiate<ParticleSystem>(componentInChildren.particleDeathSmoke, position, Quaternion.identity); val2.Play(); API.delayedFunction(this, "stopParticles", 1f, val2); } } if (API.isHost()) { List<string> list = new List<string> { "Item Melee Frying Pan", "Item Melee Baseball Bat", "Item Melee Inflatable Hammer", "Item Melee Sledge Hammer", "Item Melee Sword", "Item Gun Handgun", "Item Gun Shotgun" }; int index = Random.Range(0, list.Count); string itemPath = API.getItemPath(list[index]); API.NetworkInstantiate(itemPath, position, Quaternion.identity, 0); } } public void spawnMyteryItem(string steamid) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0013: 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_001f: 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_0046: 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) //IL_007a: 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_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_01f4: Unknown result type (might be due to invalid IL or missing references) //IL_01f5: Unknown result type (might be due to invalid IL or missing references) PlayerAvatar playerAvatar = API.getPlayerAvatar(steamid); Vector3 position = ((Component)playerAvatar).transform.position; Quaternion rotation = ((Component)playerAvatar).transform.rotation; float num = (float)((double)((Quaternion)(ref rotation)).eulerAngles.y * 3.14 / 180.0); position.x += 3f * Mathf.Sin(num); position.z += 3f * Mathf.Cos(num); position.y += 0.5f; GameObject val = Resources.Load<GameObject>("Enemies/Enemy - Beamer"); if ((Object)(object)val != (Object)null) { EnemyBeamer componentInChildren = val.GetComponentInChildren<EnemyBeamer>(); if ((Object)(object)componentInChildren != (Object)null) { ParticleSystem val2 = Object.Instantiate<ParticleSystem>(componentInChildren.particleDeathSmoke, position, Quaternion.identity); val2.Play(); API.delayedFunction(this, "stopParticles", 1f, val2); } } if (!API.isHost()) { return; } List<Item> list = new List<Item>(StatsManager.instance.itemDictionary.Values); List<GameObject> list2 = new List<GameObject>(); foreach (Item item in list) { list2.Add(item.prefab); } List<GameObject> list3 = new List<GameObject>(); list3.AddRange(list2); list3.AddRange(ValuableDirector.instance.tinyValuables); list3.AddRange(ValuableDirector.instance.smallValuables); list3.AddRange(ValuableDirector.instance.mediumValuables); list3.AddRange(ValuableDirector.instance.bigValuables); list3.AddRange(ValuableDirector.instance.wideValuables); int index = Random.Range(0, list3.Count); GameObject val3 = list3[index]; string itemPath = API.getItemPath(((Object)val3).name); API.NetworkInstantiate(itemPath, position, Quaternion.identity, 0); } public void lightsOff(int duration) { if (duration < 0) { duration = 1; } API.CallRPCOtherClients("lightsOffRPC", $"{duration}"); lightsOffRPC($"{duration}"); } public void lightsOffRPC(string data) { //IL_0089: Unknown result type (might be due to invalid IL or missing references) foreach (PlayerAvatar player in GameDirector.instance.PlayerList) { ((Behaviour)player.flashlightController.spotlight).enabled = false; player.flashlightController.halo.enabled = false; player.flashlightController.LightActive = false; player.flashlightController.stateTimer = float.Parse(data) * Time.deltaTime; player.flashlightController.Outro(); player.flashlightController.lightOffAudio.Play(((Component)player.flashlightController).transform.position, 1f, 1f, 1f, 1f); PlayerPatches.lightsoff = true; PlayerPatches.lightsEndTime = Time.realtimeSinceStartup + float.Parse(data); } } public void gnomeInfestation() { //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0048: 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) PlayerAvatar avatar = API.getTargetedPlayerAvatar(); List<LevelPoint> source = SemiFunc.LevelPointsGetAll(); source = source.OrderBy((LevelPoint point) => Vector3.Distance(((Component)point).transform.position, ((Component)avatar).transform.position)).ToList(); int num = 2; for (int i = 0; i < num; i++) { Vector3 position = ((Component)source[i]).transform.position; spawnEnemy("Gnome", position); } } public void spawnEnemy(string name) { //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_0060: Unknown result type (might be due to invalid IL or missing references) if (SemiFunc.RunIsShop()) { return; } PlayerAvatar avatar = API.getTargetedPlayerAvatar(); List<LevelPoint> list = SemiFunc.LevelPointsGetAll(); if (list.Count != 0) { list = list.OrderBy((LevelPoint point) => Vector3.Distance(((Component)point).transform.position, ((Component)avatar).transform.position)).ToList(); Vector3 position = ((Component)list[0]).transform.position; spawnEnemy(name, position); } } public void spawnEnemy(string name, Vector3 location) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0020: 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) string text = $"{name}#{location.x}#{location.y}#{location.z}"; if (API.isHost()) { API.bufferedCMD.Add("spawnEnemyRPC#" + text); } else { API.CallRPC("spawnEnemyRPC", text); } } public void spawnEnemyRPC(string data) { //IL_0038: Unknown result type (might be due to invalid IL or missing references) string[] array = data.Split(new char[1] { '#' }); string enemyType = array[0]; Vector3 location = default(Vector3); ((Vector3)(ref location))..ctor(float.Parse(array[1]), float.Parse(array[2]), float.Parse(array[3])); spawnEnemyServer(enemyType, location); } public void spawnEnemyServer(string enemyType, Vector3 location) { //IL_0121: Unknown result type (might be due to invalid IL or missing references) List<EnemySetup> list = EnemyDirector.instance.enemiesDifficulty1.Concat(EnemyDirector.instance.enemiesDifficulty2).Concat(EnemyDirector.instance.enemiesDifficulty3).ToList(); EnemySetup val = null; foreach (EnemySetup item in list) { bool flag = false; foreach (GameObject spawnObject in item.spawnObjects) { log(((Object)spawnObject).name); if (((Object)spawnObject).name.Contains(enemyType)) { log(((Object)spawnObject).name); flag = true; val = item; break; } } if (flag) { break; } } if ((Object)(object)val != (Object)null) { PlayerPatches.AboutToSpawn = true; RunManager.instance.EnemiesSpawnedRemoveStart(); if ((Object)(object)LevelGenerator.Instance == (Object)null) { log("LevelGenerator.Instance is null"); } LevelGenerator.Instance.EnemySpawn(val, location); EnemyDirector.instance.DebugResult(); RunManager.instance.EnemiesSpawnedRemoveEnd(); } } public void selfDestruct() { int maxHealth = _localAvatar.playerHealth.maxHealth; _localAvatar.playerHealth.Hurt(maxHealth, false, -1); } public void hurtPlayer() { _localAvatar.playerHealth.Hurt(10, false, -1); } public void killNearestEnemy() { //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) string targetedPlayer = API.getTargetedPlayer(); PlayerAvatar avatar = API.getTargetedPlayerAvatar(); GameObject obj = GameObject.Find("Level Generator/Enemies"); Transform val = ((obj != null) ? obj.transform : null); List<Enemy> list = new List<Enemy>(); if ((Object)(object)val != (Object)null) { Enemy[] componentsInChildren = ((Component)val).GetComponentsInChildren<Enemy>(); Enemy[] array = componentsInChildren; foreach (Enemy item in array) { list.Add(item); } } if (list.Count == 0) { log("no enemies found"); return; } list = list.OrderBy((Enemy tempenemy) => Vector3.Distance(((Component)tempenemy).transform.position, ((Component)avatar).transform.position)).ToList(); Enemy val2 = list[0]; string data = $"{((Object)val2.EnemyParent).name}#{((Component)val2).transform.position.x}#{((Component)val2).transform.position.y}#{((Component)val2).transform.position.z}#{targetedPlayer}"; killNearestEnemyRPC(data); API.CallRPCOtherClients("killNearestEnemyRPC", data); } public void killNearestEnemyRPC(string data) { //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) //IL_01be: 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_01cf: Unknown result type (might be due to invalid IL or missing references) //IL_0245: Unknown result type (might be due to invalid IL or missing references) //IL_024a: Unknown result type (might be due to invalid IL or missing references) log("killNearestEnemyRPC " + data); string[] array = data.Split(new char[1] { '#' }); string text = array[0]; Vector3 location = new Vector3(float.Parse(array[1]), float.Parse(array[2]), float.Parse(array[3])); string text2 = array[4]; PlayerAvatar playerAvatar = API.getPlayerAvatar(text2); GameObject obj = GameObject.Find("Level Generator/Enemies"); Transform val = ((obj != null) ? obj.transform : null); List<Enemy> list = new List<Enemy>(); if ((Object)(object)val != (Object)null) { Enemy[] componentsInChildren = ((Component)val).GetComponentsInChildren<Enemy>(); Enemy[] array2 = componentsInChildren; foreach (Enemy item in array2) { list.Add(item); } } else { log("no Level Generator/Enemies"); } if (list.Count == 0) { log("no enemies found"); return; } log("1"); list = list.OrderBy((Enemy tempenemy) => Vector3.Distance(((Component)tempenemy).transform.position, location)).ToList(); log("2"); int num = -1; for (int j = 0; j < list.Count; j++) { if (((Object)list[j].EnemyParent).name == text) { log($"enemy {text} found index={j}"); num = j; break; } } if (num == -1) { return; } if (API.isHost()) { API.delayedFunction(this, "killEnemyServer", 5f, list[num], location - ((Component)playerAvatar).transform.position); } GameObject val2 = Resources.Load<GameObject>(API.getItemPath("Mine Stun")); if ((Object)(object)val2 != (Object)null) { ItemMineStun componentInChildren = val2.GetComponentInChildren<ItemMineStun>(); if ((Object)(object)componentInChildren != (Object)null) { ParticleSystem val3 = Object.Instantiate<ParticleSystem>(componentInChildren.particleLightning, ((Component)list[num]).transform); val3.Play(); MainModule main = val3.main; ((MainModule)(ref main)).loop = true; API.delayedFunction(this, "stopParticles", PlayerPatches.enemykillDuration, val3); PlaySoundsourcePlayerLocationLoopLocal(componentInChildren.soundElectricity, ((Component)list[num]).gameObject, text2, PlayerPatches.enemykillDuration, 0.4f); API.delayedFunction(this, "PlaySoundsourcePlayerLocationLoopLocal", 0.33f, componentInChildren.soundElectricity, ((Component)list[num]).gameObject, text2, PlayerPatches.enemykillDuration, 0.4f); API.delayedFunction(this, "PlaySoundsourcePlayerLocationLoopLocal", 0.66f, componentInChildren.soundElectricity, ((Component)list[num]).gameObject, text2, PlayerPatches.enemykillDuration, 0.4f); } } } public void killEnemyServer(Enemy enemy, Vector3 direction) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) if (enemy.HasHealth) { enemy.Health.Hurt(enemy.Health.healthCurrent, direction); } else { PhotonNetwork.Destroy(((Component)enemy).gameObject); } } } } namespace ChatsRevenge.Utils { internal class API { [CompilerGenerated] private sealed class <DelayedInvoke>d__20<T> : IEnumerator<object>, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public T instance; public string functionName; public float delaySeconds; public object[] parameters; private MethodInfo <method>5__1; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <DelayedInvoke>d__20(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <method>5__1 = null; <>1__state = -2; } private bool MoveNext() { //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; Plugin.Instance.log("DelayedInvoke"); <>2__current = (object)new WaitForSeconds(delaySeconds); <>1__state = 1; return true; case 1: <>1__state = -1; <method>5__1 = instance.GetType().GetMethod(functionName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (<method>5__1 != null) { <method>5__1.Invoke(instance, parameters); } else { Plugin.Instance.logError("Function '" + functionName + "' not found in " + instance.GetType().Name + "."); } 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(); } } public static PlayerController _localController { get; set; } public static PlayerAvatar _localAvatar { get; set; } public static List<string> bufferedCMD { get; set; } = new List<string>(); public static AudioClip GetAudioFromFile(string audiopath) { UnityWebRequest audioClip = UnityWebRequestMultimedia.GetAudioClip(audiopath, (AudioType)13); audioClip.SendWebRequest(); while (!audioClip.isDone) { } return DownloadHandlerAudioClip.GetContent(audioClip); } public static void ProcessInput(string input) { string[] array = input.Split(new char[1] { ';' }); int num = int.Parse(array[0]); string text = array[1]; string text2 = array[2]; string text3 = array[3]; string text4 = array[4]; int num2 = int.Parse(array[5]); bool flag = true; Plugin.Instance.log(input); PlayerAvatar targetedPlayerAvatar = getTargetedPlayerAvatar(); string playerName = targetedPlayerAvatar.playerName; if (text == "REPO_immunity") { Plugin.Instance.sendNotification("<b>ChatsRevenge > </b>" + text2 + " gave " + playerName + " immunity"); if (flag) { if ((Object)(object)targetedPlayerAvatar != (Object)(object)_localAvatar) { CallRPC("giveImmunityRPC", num2.ToString()); } else { Plugin.Instance.giveImmunity(num2); } } } if (text == "REPO_spawnMine") { Plugin.Instance.sendNotification("<b>ChatsRevenge > </b>" + text2 + " spawned a mine"); if (!isDead(_localAvatar)) { Plugin.Instance.spawnMine(); } else { CallRPCClient(targetedPlayerAvatar.photonView.Owner, "spawnMine", ""); } } if (text == "REPO_spawnGrenade") { Plugin.Instance.sendNotification("<b>ChatsRevenge > </b>" + text2 + " spawned a grenade"); if (!isDead(_localAvatar)) { Plugin.Instance.spawnGrenade(); } else { CallRPCClient(targetedPlayerAvatar.photonView.Owner, "spawnGrenade", ""); } } if (text == "REPO_revive") { Plugin.Instance.sendNotification("<b>ChatsRevenge > </b>" + text2 + " revived " + playerName); if (flag) { Plugin.Instance.revive(); } } if (text == "REPO_reviveAll") { Plugin.Instance.sendNotification("<b>ChatsRevenge > </b>" + text2 + " revived everyone"); if (isHost()) { Plugin.Instance.reviveAll(); } else { CallRPC("reviveAll", ""); } } if (text == "REPO_teleport") { Plugin.Instance.sendNotification("<b>ChatsRevenge > </b>" + text2 + " teleported " + playerName); if (!isDead(_localAvatar)) { Plugin.Instance.teleportPlayer(); } else { CallRPCClient(targetedPlayerAvatar.photonView.Owner, "teleportPlayer", ""); } } if (text == "REPO_destroyexpensive") { Plugin.Instance.sendNotification("<b>ChatsRevenge > </b>" + text2 + " destroyed the best loot"); Plugin.Instance.destroyMostValuedFountItem(); } if (text == "REPO_destroyClosest") { Plugin.Instance.sendNotification("<b>ChatsRevenge > </b>" + text2 + " destroyed the closest loot"); Plugin.Instance.destroyClosest(); } if (text == "REPO_antiGravity") { Plugin.Instance.sendNotification($"<b>ChatsRevenge > </b>{text2} removed gravity for {num2}"); Plugin.Instance.antiGravity(num2); CallRPCOtherClients("antiGravityRPC", num2.ToString()); } if (text == "REPO_heal") { Plugin.Instance.sendNotification("<b>ChatsRevenge > </b>" + text2 + " healed " + playerName); if (!isDead(_localAvatar)) { Plugin.Instance.healPlayer(); } else { CallRPCClient(targetedPlayerAvatar.photonView.Owner, "healRPC", ""); } } if (text == "REPO_healAll") { Plugin.Instance.sendNotification("<b>ChatsRevenge > </b>" + text2 + " healed everyone"); Plugin.Instance.healPlayer(); CallRPCOtherClients("healRPC", ""); } if (text == "REPO_discount") { Plugin.Instance.sendNotification("<b>ChatsRevenge > </b>" + text2 + " gave you a shop discount"); if (isHost()) { Plugin.Instance.discountRPC(""); } else { CallRPC("discountRPC", ""); } } if (text == "REPO_lootbox") { Plugin.Instance.sendNotification("<b>ChatsRevenge > </b>" + text2 + " gave " + playerName + " a random item"); Plugin.Instance.lootbox(); } if (text == "REPO_weapon") { Plugin.Instance.sendNotification("<b>ChatsRevenge > </b>" + text2 + " gave " + playerName + " a random weapon"); Plugin.Instance.giveweapon(); } if (text == "REPO_lightsOff") { Plugin.Instance.sendNotification($"<b>ChatsRevenge > </b>{text2} turned your flashlight off for {num2}s"); Plugin.Instance.lightsOff(num2); } if (text == "REPO_gnomeInfestation") { Plugin.Instance.sendNotification("<b>ChatsRevenge > </b>" + text2 + " summoned a hoarde of gnomes"); Plugin.Instance.gnomeInfestation(); } if (text == "REPO_head") { delayedFunction(Plugin.Instance, "sendNotification", 1f, "<b>ChatsRevenge > </b>" + text2 + " summoned a massive fucking head"); Plugin.Instance.spawnEnemy("Head"); } if (text == "REPO_eye") { delayedFunction(Plugin.Instance, "sendNotification", 1f, "<b>ChatsRevenge > </b>" + text2 + ". Dont look up"); Plugin.Instance.spawnEnemy("Ceiling Eye"); } if (text == "REPO_runner") { delayedFunction(Plugin.Instance, "sendNotification", 1f, "<b>ChatsRevenge > </b>" + text2 + " called a reaper. RUN!!!"); Plugin.Instance.spawnEnemy("Runner"); } if (text == "REPO_clown") { delayedFunction(Plugin.Instance, "sendNotification", 1f, "<b>ChatsRevenge > </b>" + text2 + " called the circus"); Plugin.Instance.spawnEnemy("Beamer"); } if (text == "REPO_hunter") { delayedFunction(Plugin.Instance, "sendNotification", 1f, "<b>ChatsRevenge > </b>SSSHHHH " + text2 + " summoned a hunstman"); Plugin.Instance.spawnEnemy("Hunter"); } if (text == "REPO_duck") { delayedFunction(Plugin.Instance, "sendNotification", 1f, "<b>ChatsRevenge > </b>" + text2 + " summoned a duck. quack!"); Plugin.Instance.spawnEnemy("Duck"); } if (text == "REPO_hidden") { delayedFunction(Plugin.Instance, "sendNotification", 1f, "<b>ChatsRevenge > </b>" + text2 + " summoned a hidden."); Plugin.Instance.spawnEnemy("Hidden"); } if (text == "REPO_robe") { delayedFunction(Plugin.Instance, "sendNotification", 1f, "<b>ChatsRevenge > </b>" + text2 + " summoned a robe."); Plugin.Instance.spawnEnemy("Robe"); } if (text == "REPO_blowtie") { delayedFunction(Plugin.Instance, "sendNotification", 1f, "<b>ChatsRevenge > </b>" + text2 + " summoned a blowtie."); Plugin.Instance.spawnEnemy("Bowtie"); } if (text == "REPO_upscream") { delayedFunction(Plugin.Instance, "sendNotification", 1f, "<b>ChatsRevenge > </b>" + text2 + " summoned an upscream."); Plugin.Instance.spawnEnemy("Upscream"); } if (text == "REPO_mouth") { delayedFunction(Plugin.Instance, "sendNotification", 1f, "<b>ChatsRevenge > </b>" + text2 + " summoned a spewer."); Plugin.Instance.spawnEnemy("Slow Mouth"); } if (text == "REPO_trudge") { delayedFunction(Plugin.Instance, "sendNotification", 1f, "<b>ChatsRevenge > </b>" + text2 + " summoned a trudge."); Plugin.Instance.spawnEnemy("Slow Walker"); } if (text == "REPO_alien") { delayedFunction(Plugin.Instance, "sendNotification", 1f, "<b>ChatsRevenge > </b>" + text2 + " summoned an alien."); Plugin.Instance.spawnEnemy("Floater"); } if (text == "REPO_frog") { delayedFunction(Plugin.Instance, "sendNotification", 1f, "<b>ChatsRevenge > </b>" + text2 + " summoned a chef frog."); Plugin.Instance.spawnEnemy("Tumbler"); } if (text == "REPO_animal") { delayedFunction(Plugin.Instance, "sendNotification", 1f, "<b>ChatsRevenge > </b>" + text2 + " summoned an animal."); Plugin.Instance.spawnEnemy("Animal"); } if (text == "REPO_rugrat") { delayedFunction(Plugin.Instance, "sendNotification", 1f, "<b>ChatsRevenge > </b>" + text2 + " summoned a demon baby."); Plugin.Instance.spawnEnemy("Valuable Thrower"); } if (text == "REPO_thinman") { delayedFunction(Plugin.Instance, "sendNotification", 1f, "<b>ChatsRevenge > </b>" + text2 + " summoned a shadow man"); Plugin.Instance.spawnEnemy("Thin Man"); } if (text == "REPO_selfDestruct") { Plugin.Instance.sendNotification("<b>ChatsRevenge > </b>" + text2 + " caused " + playerName + " to destruct"); if (!isDead(_localAvatar)) { Plugin.Instance.selfDestruct(); } else { CallRPCClient(targetedPlayerAvatar.photonView.Owner, "ProcessInput", input); } } if (text == "REPO_killememy") { Plugin.Instance.sendNotification("<b>ChatsRevenge > </b>" + text2 + " killed the nearest monster to " + playerName); Plugin.Instance.killNearestEnemy(); } if (text == "REPO_hurt") { Plugin.Instance.sendNotification("<b>ChatsRevenge > </b>" + text2 + " damaged " + playerName); if (!isDead(_localAvatar)) { Plugin.Instance.hurtPlayer(); } else { CallRPCClient(targetedPlayerAvatar.photonView.Owner, "ProcessInput", input); } } } public static bool inGame() { try { if (!Plugin.Instance.pluginLoaded()) { Plugin.Instance.log("Plugin not initialized yet, waiting..."); return false; } } catch (Exception) { Debug.Log((object)"Plugin not initialized yet, waiting..."); return false; } if (!Plugin.Instance.pluginLoaded()) { Debug.Log((object)"Plugin not initialized yet, waiting..."); return false; } if (SemiFunc.RunIsLobbyMenu() || SemiFunc.RunIsLobby() || SemiFunc.RunIsRecording()) { return false; } return true; } public static void CallRPC(string functionName, string data) { if (PhotonNetwork.IsConnected && !PhotonNetwork.IsMasterClient) { _localAvatar.photonView.RPC("AddToStatsManagerRPC", (RpcTarget)2, new object[2] { functionName, data }); } } public static void CallRPCOtherClients(string functionName, string data) { if (PhotonNetwork.IsConnected) { _localAvatar.photonView.RPC("AddToStatsManagerRPC", (RpcTarget)1, new object[2] { functionName, data }); } } public static void CallRPCClient(Player target, string functionName, string data) { if (PhotonNetwork.IsConnected && target != _localAvatar.photonView.Owner) { _localAvatar.photonView.RPC("AddToStatsManagerRPC", target, new object[2] { functionName, data }); } } public static bool HandleRPC(string functionName, string data) { Plugin.Instance.log("HandleRPC " + functionName + " " + data); if (functionName == "ProcessInput") { bufferedCMD.Add("ProcessInput#" + data); return false; } MethodInfo method = GetMethod(typeof(Plugin), functionName); if (method != null) { bufferedCMD.Add(functionName + "#" + data); return false; } return true; } public static void delayedFunction<T>(T instance, string functionName, float delaySeconds, params object[] parameters) { Plugin.Instance.log("StartDelayedFunction"); PlayerAvatar targetedPlayerAvatar = getTargetedPlayerAvatar(); ((MonoBehaviour)targetedPlayerAvatar).StartCoroutine(DelayedInvoke(instance, functionName, delaySeconds, parameters)); } [IteratorStateMachine(typeof(<DelayedInvoke>d__20<>))] private static IEnumerator DelayedInvoke<T>(T instance, string functionName, float delaySeconds, object[] parameters) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <DelayedInvoke>d__20<T>(0) { instance = instance, functionName = functionName, delaySeconds = delaySeconds, parameters = parameters }; } public static object GetInternalField<T>(T instance, string fieldName) { FieldInfo field = typeof(T).GetField(fieldName, BindingFlags.Instance | BindingFlags.NonPublic); if (field != null) { return field.GetValue(instance); } Debug.LogWarning((object)("Field '" + fieldName + "' not found in " + typeof(T).Name)); return null; } public static GameObject NetworkInstantiate(string prefabName, Vector3 position, Quaternion rotation, byte group = 0, object[] data = null) { //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0048: 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) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Expected O, but got Unknown if (PhotonNetwork.CurrentRoom == null) { Debug.LogError((object)"Can not Instantiate before the client joined/created a room."); return null; } try { return (GameObject)GetMethod(typeof(PhotonNetwork), "NetworkInstantiate", typeof(InstantiateParameters)).Invoke(null, new object[3] { (object)new InstantiateParameters(prefabName, position, rotation, group, data, (byte)0, (int[])null, PhotonNetwork.LocalPlayer, PhotonNetwork.ServerTimestamp), true, false }); } catch (Exception ex) { Debug.LogError((object)ex); return null; } } public static MethodInfo GetMethod(Type type, string name, Type uniqueParamType) { return (from x in type.GetRuntimeMethods() where x.Name.Equals(name) select x into r let p = r.GetParameters() where p.Any((ParameterInfo o) => uniqueParamType.IsAssignableFrom(o.ParameterType)) select r).ToList()[0]; } public static MethodInfo GetMethod(Type type, string functionName) { return type.GetMethod(functionName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); } public static void InvokeMethod<T>(T instance, string functionName, params object[] parameters) { MethodInfo method = typeof(T).GetMethod(functionName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (method != null) { method.Invoke(instance, parameters); } else { Debug.LogError((object)("Function " + functionName + " not found!")); } } public static bool ItemMatches(Item item, string name) { return string.Equals(item.itemAssetName, name, StringComparison.OrdinalIgnoreCase) || string.Equals(item.itemName, name, StringComparison.OrdinalIgnoreCase); } public static string getSteamID(PlayerAvatar avatar) { try { return SemiFunc.PlayerGetSteamID(avatar); } catch { return ""; } } public static string getSteamID(PlayerController controller) { return getSteamID(controller.playerAvatarScript); } public static string getSteamID(PlayerHealth __instance) { //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Expected O, but got Unknown FieldInfo field = typeof(PlayerHealth).GetField("playerAvatar", BindingFlags.Instance | BindingFlags.NonPublic); string result = ""; if (field != null) { PlayerAvatar avatar = (PlayerAvatar)field.GetValue(__instance); result = getSteamID(avatar); } return result; } public static PlayerController getLocalPlayerController() { try { _localController = PlayerController.instance; _localAvatar = _localController.playerAvatarScript; PlayerPatches.clientID = getSteamID(_localAvatar); return _localController; } catch { return null; } } public static bool isDead(PlayerAvatar avatar) { return (bool)GetInternalField<PlayerAvatar>(avatar, "deadSet"); } public static string getTargetedPlayer() { //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Expected O, but got Unknown if ((Object)(object)_localController == (Object)null) { getLocalPlayerController(); } PlayerAvatar val = _localAvatar; if (isDead(_localAvatar)) { foreach (PlayerAvatar item in SemiFunc.PlayerGetList()) { if (!isDead(item)) { val = item; break; } } if (Object.op_Implicit((Object)(object)SpectateCamera.instance)) { PlayerAvatar val2 = (PlayerAvatar)GetInternalField<SpectateCamera>(SpectateCamera.instance, "player"); if ((Object)(object)val2 != (Object)null) { val = val2; } } } string text = (string)GetInternalField<PlayerAvatar>(val, "playerName"); string steamID = getSteamID(val); Plugin.Instance.log("Spectating " + text + " " + steamID); return steamID; } public static PlayerAvatar getTargetedPlayerAvatar() { string targetedPlayer = getTargetedPlayer(); PlayerAvatar val = SemiFunc.PlayerGetFromSteamID(targetedPlayer); if (isDead(val)) { foreach (PlayerAvatar item in SemiFunc.PlayerGetList()) { if (!isDead(item)) { val = item; break; } } } return val; } public static PlayerAvatar getPlayerAvatar(string steamid) { return SemiFunc.PlayerGetFromSteamID(steamid); } public static bool isHost() { return SemiFunc.IsMasterClientOrSingleplayer(); } public static List<GameObject> GetValuableItmes() { GameObject[] array = GameObject.FindGameObjectsWithTag("Phys Grab Object"); List<GameObject> list = new List<GameObject>(); if (array == null || array.Length == 0) { Plugin.Instance.log("Unable to locate items"); } else { GameObject[] array2 = array; foreach (GameObject val in array2) { if ((Object)(object)val.GetComponent<ValuableObject>() != (Object)null) { list.Add(val); } else if ((Object)(object)val.GetComponentInChildren<ValuableObject>() != (Object)null) { list.Add(val); } } } return list; } public static string getItemPath(string searchName) { //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Expected O, but got Unknown string[] array = new string[11] { "Items/", "Items/Items/", "Items/Removed Items/", "Valuables/", "Valuables/01 Tiny/", "Valuables/02 Small/", "Valuables/03 Medium/", "Valuables/04 Big/", "Valuables/05 Wide/", "Valuables/06 Tall/", "Valuables/07 Very Tall/" }; string[] array2 = new string[4] { "", "Item ", "Valuable ", "Enemy Valuable - " }; string[] array3 = array; foreach (string text in array3) { string[] array4 = array2; foreach (string text2 in array4) { string text3 = text + text2 + searchName; GameObject val = Resources.Load<GameObject>(text3); if ((Object)val != (Object)null) { return text3; } } } return ""; } } public class CustomPrefabPool : MonoBehaviour, IPunPrefabPool { public static Dictionary<string, GameObject> prefabDict = new Dictionary<string, GameObject>(); public static void RegisterPrefab(string itemName, GameObject prefab) { if (!prefabDict.ContainsKey(itemName)) { prefabDict[itemName] = prefab; } } public GameObject Instantiate(string prefabId, Vector3 position, Quaternion rotation) { //IL_0014: 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) if (prefabDict.TryGetValue(prefabId, out var value)) { return Object.Instantiate<GameObject>(value, position, rotation); } Debug.LogError((object)("Prefab '" + prefabId + "' not found in CustomPrefabPool!")); return null; } public void Destroy(GameObject gameObject) { Object.Destroy((Object)(object)gameObject); } } internal static class ModUtils { } [JsonObject] internal class broadcastData { [JsonProperty] public string command { get; set; } [JsonProperty] public string text { get; set; } [JsonProperty] public bool BOOL { get; set; } public int INT { get; set; } [JsonProperty] public float x { get; set; } [JsonProperty] public float y { get; set; } [JsonProperty] public float z { get; set; } [JsonProperty] public float eulerY { get; set; } [JsonProperty] public ulong clientId { get; set; } } public class pythonSocket { private static pythonSocket _instance; [SerializeField] private string IP = "127.0.0.1"; [SerializeField] private int rxPort = 7885; [SerializeField] private int txPort = 7886; private int indx = -1; private UdpClient client; private IPEndPoint pythonHost; private Thread readDataThread; public static pythonSocket Instance { get { if (_instance == null) { _instance = new pythonSocket(); } return _instance; } } public static Plugin plugin { get; set; } private pythonSocket() { } public void SendData(string message) { try { byte[] bytes = Encoding.UTF8.GetBytes(message); client.Send(bytes, bytes.Length, pythonHost); } catch (Exception ex) { Plugin.Instance.log(ex.ToString()); } } public void start() { pythonHost = new IPEndPoint(IPAddress.Parse(IP), txPort); client = new UdpClient(rxPort); readDataThread = new Thread(readData); readDataThread.IsBackground = true; readDataThread.Start(); } public void OnDestroy() { client.Close(); } private void readData() { while (true) { try { IPEndPoint remoteEP = new IPEndPoint(IPAddress.Any, 0); byte[] bytes = client.Receive(ref remoteEP); string @string = Encoding.UTF8.GetString(bytes); string[] array = @string.Split(new char[1] { ';' }); int num = int.Parse(array[0]); string text = array[1]; string text2 = array[2]; string text3 = array[3]; if (text.Contains("REPO")) { if (indx == -1 || (indx != num && num == 0)) { indx = num; SendData("REPO " + Plugin.Instance.version); } else if (num != indx) { Plugin.Instance.log("received"); indx = num; API.bufferedCMD.Add("ProcessInput#" + @string); } } } catch (Exception ex) { Plugin.Instance.log(ex.ToString()); } } } } } namespace ChatsRevenge.Patches { [HarmonyPatch(typeof(PlayerController))] internal class PlayerPatches { public static bool immune { get; set; } = false; public static string clientID { get; set; } = ""; public static float immuneEndTime { get; set; } public static float teleportDuration { get; set; } = 5f; public static float enemykillDuration { get; set; } = 5f; public static float overrideEnergy { get; set; } = 0f; public static bool lightsoff { get; set; } = false; public static float lightsEndTime { get; set; } public static bool AboutToSpawn { get; set; } = false; [HarmonyPatch(typeof(PlayerAvatar), "AddToStatsManagerRPC")] [HarmonyPrefix] public static bool RPCTrigger(ref string _playerName, ref string _steamID) { Plugin.Instance.log("AddToStatsManagerRPC " + _playerName + " " + _steamID); return API.HandleRPC(_playerName, _steamID); } [HarmonyPatch(typeof(GameDirector), "gameStateStart")] [HarmonyPostfix] public static void gameStarted() { Plugin.Instance.preAction(); } [HarmonyPatch(typeof(PlayerAvatar), "PlayerDeath")] [HarmonyPrefix] private static bool PlayerDeath_Prefix(PlayerAvatar __instance) { string steamID = API.getSteamID(__instance); if (steamID == clientID && immune) { return false; } return true; } [HarmonyPatch(typeof(PlayerHealth), "Hurt")] [HarmonyPrefix] public static void Hurt_Prefix(PlayerHealth __instance, ref int damage) { if (!((Object)(object)__instance == (Object)null)) { string steamID = API.getSteamID(__instance); if (steamID == clientID && immune) { damage = 0; } } } [HarmonyPatch(typeof(PlayerController), "Update")] [HarmonyPrefix] private static void Update_prefix(PlayerController __instance) { if (API.inGame() && !((Object)(object)__instance == (Object)null)) { string steamID = API.getSteamID(__instance); if (steamID == clientID) { overrideEnergy = __instance.EnergyCurrent; } } } [HarmonyPatch(typeof(PlayerController), "Update")] [HarmonyPostfix] private static void Update_postfix(PlayerController __instance) { if (!API.inGame() || (Object)(object)__instance == (Object)null) { return; } string steamID = API.getSteamID(__instance); if (steamID == clientID) { float realtimeSinceStartup = Time.realtimeSinceStartup; if (realtimeSinceStartup > immuneEndTime) { immune = false; } } } [HarmonyPatch(typeof(PlayerController), "FixedUpdate")] [HarmonyPostfix] private static void FixedUpdate_postfix(PlayerController __instance) { if (API.inGame() && !((Object)(object)__instance == (Object)null)) { string steamID = API.getSteamID(__instance); if (steamID == clientID && immune && overrideEnergy > __instance.EnergyCurrent) { __instance.EnergyCurrent = overrideEnergy; } } } [HarmonyPatch(typeof(FlashlightController), "Update")] [HarmonyPrefix] private static bool flashlight_update(FlashlightController __instance) { if (!lightsoff) { return true; } float realtimeSinceStartup = Time.realtimeSinceStartup; if (realtimeSinceStartup > lightsEndTime) { lightsoff = false; return true; } API.InvokeMethod<FlashlightController>(__instance, "Outro", Array.Empty<object>()); return false; } [HarmonyPatch(typeof(SemiFunc), "EnemySpawn")] [HarmonyPrefix] private static bool EnemySpawn_Prefix(ref bool __result) { if (AboutToSpawn) { AboutToSpawn = false; __result = true; return false; } return true; } [HarmonyPatch(typeof(ChatManager), "Update")] [HarmonyPrefix] private static void MessageSend_Prefix(ChatManager __instance) { if (API.bufferedCMD.Count > 0) { string text = API.bufferedCMD[0]; API.bufferedCMD.RemoveAt(0); string[] array = text.Split(new char[1] { '#' }); string text2 = array[0]; string text3 = string.Join("#", array.Skip(1)); if (text2 == "ProcessInput") { API.ProcessInput(text3); } else if (array.Length > 1) { API.InvokeMethod(Plugin.Instance, text2, text3); } else { API.InvokeMethod(Plugin.Instance, text2, null); } } } [HarmonyPatch(typeof(EnemyGnome), "Update")] [HarmonyPrefix] private static void Update_gnome_prefix(EnemyGnome __instance) { //IL_00e4: Unknown result type (might be due to invalid IL or missing references) if (__instance.directorIndex < EnemyGnomeDirector.instance.destinations.Count && EnemyGnomeDirector.instance.gnomes.Contains(__instance)) { return; } EnemyGnome[] array = Object.FindObjectsOfType<EnemyGnome>(); foreach (EnemyGnome val in array) { if (Object.op_Implicit((Object)(object)val) && (val.directorIndex >= EnemyGnomeDirector.instance.destinations.Count || !EnemyGnomeDirector.instance.gnomes.Contains(val))) { EnemyGnomeDirector.instance.gnomes.Add(val); val.directorIndex = EnemyGnomeDirector.instance.gnomes.IndexOf(val); if (EnemyGnomeDirector.instance.destinations.Count < EnemyGnomeDirector.instance.gnomes.Count) { EnemyGnomeDirector.instance.destinations.Add(Vector3.zero); } } } } } }