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 Devify REPO v0.2.30
plugins/Devify/DevifyRepo.dll
Decompiled 19 minutes ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Concurrent; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; using System.Net; using System.Net.Sockets; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security.Cryptography; using System.Text; using System.Threading; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using DevifyRepo.Core; using ExitGames.Client.Photon; using HarmonyLib; using Photon.Pun; using Photon.Realtime; using TMPro; using UnityEngine; using UnityEngine.AI; using UnityEngine.InputSystem; using UnityEngine.InputSystem.Controls; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("DevifyRepo")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("0.2.30.0")] [assembly: AssemblyInformationalVersion("0.2.30+0f5a2af8852516a77e889dbbc480a6ced1c28e22")] [assembly: AssemblyProduct("DevifyRepo")] [assembly: AssemblyTitle("DevifyRepo")] [assembly: AssemblyVersion("0.2.30.0")] namespace DevifyRepo { internal static class Effects { public static bool LevelReady() { if (SemiFunc.RunIsLevel() && (Object)(object)LevelGenerator.Instance != (Object)null) { return LevelGenerator.Instance.Generated; } return false; } public static string Run(CommandDef def, int amount, int actor, IList<int> parts = null, int second = 0) { EffectsLocal.LabelOverride = null; if (def.Scope != Scope.Local) { return EffectsHost.Run(def.Name, amount, actor); } return EffectsLocal.Run(def.Name, amount, parts, second); } } internal static class EffectsHost { private sealed class UpgradeKind { public string Name; public Func<PunManager, string, int, int> Apply; public Func<StatsManager, Dictionary<string, int>> Levels; } public sealed class Sent { public CommandDef Def; public int Amount; public int Actor; public int Target; public int Count = 1; public int Tries; public string Viewer; public string Streamer; public string TargetName; public double At; public int ReplyTo; public int ReplyId; public readonly List<int> Failed = new List<int>(); } private const float NearItem = 8f; private const float NearEnemy = 40f; private const float ValueCap = float.MaxValue; private const float ValueGuard = 1E+12f; private static readonly Stand.Fair killFair = new Stand.Fair(); private static readonly Random killRnd = new Random(); private static readonly UpgradeKind[] upgrades = new UpgradeKind[7] { new UpgradeKind { Name = "Health", Apply = (PunManager p, string s, int v) => p.UpgradePlayerHealth(s, v), Levels = (StatsManager m) => m.playerUpgradeHealth }, new UpgradeKind { Name = "Energy", Apply = (PunManager p, string s, int v) => p.UpgradePlayerEnergy(s, v), Levels = (StatsManager m) => m.playerUpgradeStamina }, new UpgradeKind { Name = "ExtraJump", Apply = (PunManager p, string s, int v) => p.UpgradePlayerExtraJump(s, v), Levels = (StatsManager m) => m.playerUpgradeExtraJump }, new UpgradeKind { Name = "SprintSpeed", Apply = (PunManager p, string s, int v) => p.UpgradePlayerSprintSpeed(s, v), Levels = (StatsManager m) => m.playerUpgradeSpeed }, new UpgradeKind { Name = "GrabStrength", Apply = (PunManager p, string s, int v) => p.UpgradePlayerGrabStrength(s, v), Levels = (StatsManager m) => m.playerUpgradeStrength }, new UpgradeKind { Name = "ThrowStrength", Apply = (PunManager p, string s, int v) => p.UpgradePlayerThrowStrength(s, v), Levels = (StatsManager m) => m.playerUpgradeThrow }, new UpgradeKind { Name = "GrabRange", Apply = (PunManager p, string s, int v) => p.UpgradePlayerGrabRange(s, v), Levels = (StatsManager m) => m.playerUpgradeRange } }; public static string Note; private static readonly Stand.Fair fair = new Stand.Fair(); private static readonly Random rnd = new Random(); public static readonly Dictionary<int, Sent> sent = new Dictionary<int, Sent>(); private static int nextSent = 1; private static bool StandInOn { get { if (Plugin.StandIn != null) { return Plugin.StandIn.Value; } return true; } } private static bool JailRedirectOn { get { if (Plugin.JailRedirect != null) { return Plugin.JailRedirect.Value; } return true; } } public static string Run(string name, int amount, int actor) { Note = null; try { if (!SemiFunc.IsMasterClientOrSingleplayer()) { return "HAZIR_DEGIL"; } return Apply(name, amount, actor); } catch (Exception ex) { Plugin.Log.LogError((object)("Host etkisi " + name + " çalışmadı: " + ex)); return "HATA"; } } private static string Apply(string name, int amount, int actor) { return name switch { "para_ver" => Money(amount), "para_al" => Money(-amount), "deger_artir" => RaiseValue(amount, actor), "kir" => BreakValuable(amount, actor), "dirilt" => ReviveAll(actor), "oldur" => KillSomeone(actor), "guclen" => Upgrade(actor, 1), "zayifla" => Upgrade(actor, -1), "esya_sil" => RemoveItems(amount, actor), "dusman_sil" => RemoveEnemies(amount, actor), "dusman" => HostSpawn.Enemies(amount, actor), "para" => HostSpawn.Valuables(amount, actor), "esya" => HostSpawn.Items(amount, actor), "jumpscare" => HostSpawn.Jumpscare(actor, amount), "hapis" => HostJail.Sentence(actor, amount), "isinla" => HostTeleport.Run(actor), "hapis_kisalt" => HostJail.Shorten(actor, amount), "hapis_kurtar" => HostJail.Free(actor), _ => "BILINMEYEN", }; } public static PlayerAvatar Target(int actor) { List<PlayerAvatar> list = SemiFunc.PlayerGetList(); if (list == null) { return null; } foreach (PlayerAvatar item in list) { if ((Object)(object)item == (Object)null) { continue; } bool num; if (actor >= 0) { if (!((Object)(object)item.photonView != (Object)null)) { continue; } num = item.photonView.OwnerActorNr == actor; } else { num = Game.IsLocal(item); } if (num) { return item; } } return null; } public static Vector3 Where(PlayerAvatar p) { //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) if (Game.DeadSet(p)) { PlayerDeathHead val = Game.DeathHead(p); if ((Object)(object)val != (Object)null) { return ((Component)val).transform.position; } } return ((Component)p).transform.position; } public static Vector3 Where(EnemyParent e) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) Enemy val = Game.EnemyOf(e); if (!((Object)(object)val != (Object)null)) { return ((Component)e).transform.position; } return ((Component)val).transform.position; } private static string Money(int delta) { int num = SemiFunc.StatGetRunCurrency(); int num2 = (int)Math.Max(0L, Math.Min(2147483647L, (long)num + (long)delta)); if (num2 == num) { Plugin.Log.LogInfo((object)("Para: değişmedi (" + num + ", istenen " + delta + ")")); return "YOK"; } if (SemiFunc.IsMultiplayer()) { if ((Object)(object)PunManager.instance == (Object)null) { return "HAZIR_DEGIL"; } PunManager.instance.SetRunStatSet("currency", num2); } else { SemiFunc.StatSetRunCurrency(num2); } try { SemiFunc.ShopUpdateCost(); } catch (Exception ex) { Plugin.Log.LogWarning((object)("Mağaza fiyatları güncellenemedi: " + ex.Message)); } Plugin.Log.LogInfo((object)("Para: " + num + " → " + num2 + " (istenen " + delta + ")")); return null; } private static List<ValuableObject> ValuablesNear(Vector3 at) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) List<ValuableObject> list = (((Object)(object)ValuableDirector.instance != (Object)null) ? ValuableDirector.instance.valuableList : null); if (list == null) { return new List<ValuableObject>(); } return (from v in list where (Object)(object)v != (Object)null && Vector3.Distance(((Component)v).transform.position, at) <= 8f orderby Vector3.Distance(((Component)v).transform.position, at) select v).ToList(); } private static string RaiseValue(int percent, int actor) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) if (!Effects.LevelReady()) { return "HAZIR_DEGIL"; } PlayerAvatar val = Target(actor); if ((Object)(object)val == (Object)null) { return "HAZIR_DEGIL"; } List<ValuableObject> list = ValuablesNear(Where(val)); if (list.Count == 0) { Plugin.Log.LogInfo((object)"Değer artır: yakında değerli eşya yok"); return "YOK"; } bool flag = SemiFunc.IsMultiplayer(); int num = 0; foreach (ValuableObject item in list) { float num2 = Game.DollarValue(item); float num3 = 1E+12f; float num4 = Mathf.Min(num2 * (1f + (float)percent / 100f), num3); if (num4 <= num2) { Plugin.Log.LogInfo((object)("Değer artır: " + ((Object)item).name + " zaten tavanda (" + num2 + ", tavan " + num3 + ")")); continue; } PhotonView val2 = (flag ? ((Component)item).GetComponent<PhotonView>() : null); if ((Object)(object)val2 != (Object)null) { val2.RPC("DollarValueSetRPC", (RpcTarget)0, new object[1] { num4 }); } else { Game.DollarValue(item) = num4; } num++; Plugin.Log.LogInfo((object)("Değer artır: " + ((Object)item).name + " " + num2 + " → " + num4 + (((Object)(object)val2 != (Object)null) ? " (RPC)" : ""))); } if (num == 0) { Plugin.Log.LogInfo((object)("Değer artır: yakındaki " + list.Count + " eşyanın hepsi tavanda")); return "YOK"; } return null; } private static string BreakValuable(int percent, int actor) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) if (!Effects.LevelReady()) { return "HAZIR_DEGIL"; } PlayerAvatar val = Target(actor); if ((Object)(object)val == (Object)null) { return "HAZIR_DEGIL"; } ValuableObject val2 = ValuablesNear(Where(val)).FirstOrDefault(); if ((Object)(object)val2 == (Object)null) { Plugin.Log.LogInfo((object)"Kır: yakında değerli eşya yok"); return "YOK"; } PhysGrabObjectImpactDetector val3 = Game.ImpactOf(val2); if ((Object)(object)val3 == (Object)null) { val3 = ((Component)val2).GetComponent<PhysGrabObjectImpactDetector>(); } if ((Object)(object)val3 == (Object)null) { return "HAZIR_DEGIL"; } float num = Game.DollarValue(val2); float num2 = Mathf.Clamp(num * (float)percent / 100f, 0f, Mathf.Max(0f, num)); if (!Game.Break(val3, num2, ((Component)val2).transform.position)) { return "HATA"; } Plugin.Log.LogInfo((object)("Kır: " + ((Object)val2).name + " " + num + " → " + (num - num2) + " (kayıp " + num2 + ")")); return null; } private static string ReviveAll(int actor) { if (!Effects.LevelReady()) { return "HAZIR_DEGIL"; } List<PlayerAvatar> list = SemiFunc.PlayerGetList(); if (list == null) { return "HAZIR_DEGIL"; } List<string> list2 = new List<string>(); PlayerAvatar val = Target(actor); List<PlayerAvatar> list3 = new List<PlayerAvatar>(); if ((Object)(object)val != (Object)null) { list3.Add(val); } foreach (PlayerAvatar item in list) { if ((Object)(object)item != (Object)null && (Object)(object)item != (Object)(object)val) { list3.Add(item); } } foreach (PlayerAvatar item2 in list3) { if (!((Object)(object)item2 == (Object)null) && Game.DeadSet(item2) && !((Object)(object)Game.DeathHead(item2) == (Object)null) && !HostJail.Reviving(item2)) { try { item2.Revive(false); list2.Add(Name(item2)); } catch (Exception ex) { Plugin.Log.LogWarning((object)("Dirilt: " + Name(item2) + " diriltilemedi: " + ex.Message)); } } } if (list2.Count == 0) { Plugin.Log.LogInfo((object)"Dirilt: ölü oyuncu yok"); return "YOK"; } Note = string.Join(", ", list2); Plugin.Log.LogInfo((object)("Dirilt: " + Note)); return null; } private static string KillSomeone(int actor) { //IL_015a: Unknown result type (might be due to invalid IL or missing references) if (!Effects.LevelReady()) { return "HAZIR_DEGIL"; } List<PlayerAvatar> list = SemiFunc.PlayerGetList(); if (list == null) { return "HAZIR_DEGIL"; } PlayerAvatar val = Target(actor); int num = 0; Dictionary<int, PlayerAvatar> dictionary = new Dictionary<int, PlayerAvatar>(); foreach (PlayerAvatar item in list) { if ((Object)(object)item == (Object)null) { continue; } if (Alive(item)) { num++; } if (!((Object)(object)item == (Object)(object)val) && Ready(item) && !HostJail.IsJailed(item)) { int num2 = ActorOf(item); if (num2 > 0 && !dictionary.ContainsKey(num2)) { dictionary[num2] = item; } } } List<int> list2 = Stand.Killable(new List<int>(dictionary.Keys), num); PlayerAvatar val2; if ((Object)(object)val != (Object)null && Alive(val)) { val2 = val; } else { if (list2.Count <= 0) { Plugin.Log.LogInfo((object)("Öldür: öldürülecek kimse yok (yaşayan " + num + ")")); return "YOK"; } val2 = dictionary[killFair.Pick(list2, killRnd)]; } PlayerHealth playerHealth = val2.playerHealth; if ((Object)(object)playerHealth == (Object)null) { return "HAZIR_DEGIL"; } if (Game.IsLocal(val2)) { playerHealth.Hurt(999, false, -1, false); } else { playerHealth.HurtOther(999, Vector3.zero, false, -1, false); } Note = Name(val2); Plugin.Log.LogInfo((object)("Öldür: " + Name(val2) + ((list2.Count > 0) ? (" (" + list2.Count + " adaydan rastgele)") : " (başka aday yok, yayıncı)"))); return null; } private static int Level(UpgradeKind k, string steamId) { Dictionary<string, int> dictionary = (((Object)(object)StatsManager.instance != (Object)null) ? k.Levels(StatsManager.instance) : null); if (dictionary == null || !dictionary.TryGetValue(steamId, out var value)) { return 0; } return value; } private static string Upgrade(int actor, int delta) { PlayerAvatar val = Target(actor); if ((Object)(object)val == (Object)null || (Object)(object)PunManager.instance == (Object)null || (Object)(object)StatsManager.instance == (Object)null) { return "HAZIR_DEGIL"; } string sid = SemiFunc.PlayerGetSteamID(val); if (string.IsNullOrEmpty(sid)) { return "HAZIR_DEGIL"; } UpgradeKind[] array = ((delta < 0) ? upgrades.Where((UpgradeKind k) => Level(k, sid) > 0).ToArray() : upgrades); if (array.Length == 0) { Plugin.Log.LogInfo((object)("Zayıfla: " + ((Object)val).name + " hiç yükseltmesi yok")); return "YOK"; } UpgradeKind upgradeKind = array[Random.Range(0, array.Length)]; int num = Level(upgradeKind, sid); int num2 = upgradeKind.Apply(PunManager.instance, sid, delta); Plugin.Log.LogInfo((object)("Yükseltme " + upgradeKind.Name + " " + ((delta > 0) ? "+1" : "-1") + ": " + ((Object)val).name + " " + num + " → " + Level(upgradeKind, sid) + " (dönen " + num2 + ")")); return null; } private static string RemoveItems(int count, int actor) { //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004e: 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_011c: Unknown result type (might be due to invalid IL or missing references) if (!Effects.LevelReady()) { return "HAZIR_DEGIL"; } PlayerAvatar val = Target(actor); List<ItemAttributes> list = (((Object)(object)ItemManager.instance != (Object)null) ? ItemManager.instance.spawnedItems : null); if ((Object)(object)val == (Object)null || list == null) { return "HAZIR_DEGIL"; } Vector3 at = Where(val); List<(ItemAttributes, PhysGrabObject)> list2 = (from i in list where (Object)(object)i != (Object)null && !Kept(i) && Vector3.Distance(((Component)i).transform.position, at) <= 8f orderby Vector3.Distance(((Component)i).transform.position, at) select (item: i, grab: ((Component)i).GetComponent<PhysGrabObject>()) into x where (Object)(object)x.grab != (Object)null select x).Take(count).ToList(); if (list2.Count == 0) { Plugin.Log.LogInfo((object)"Eşya sil: yakında eşya yok"); return "YOK"; } foreach (var item in list2) { string text = ((Object)item.Item1).name + " @ " + ((object)((Component)item.Item1).transform.position/*cast due to .constrained prefix*/).ToString(); item.Item2.DestroyPhysGrabObject(); Plugin.Log.LogInfo((object)("Eşya sil: " + text)); } return null; } private static bool Kept(ItemAttributes item) { try { ItemEquippable component = ((Component)item).GetComponent<ItemEquippable>(); bool hasCartPart = (Object)(object)((Component)item).GetComponent<PhysGrabCart>() != (Object)null || (Object)(object)((Component)item).GetComponentInChildren<PhysGrabCart>() != (Object)null; Traverse obj = Traverse.Create((object)item); string itemType = obj.Field("itemType").GetValue()?.ToString(); string text = obj.Field("itemName").GetValue() as string; bool equipped = (Object)(object)component != (Object)null && (Traverse.Create((object)component).Field("isEquipped").GetValue<bool>() || Traverse.Create((object)component).Field("isEquipping").GetValue<bool>()); return ItemKeep.Protected(itemType, text + " " + ((Object)item).name, equipped, hasCartPart); } catch { return true; } } private static string RemoveEnemies(int count, int actor) { //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) if (!Effects.LevelReady()) { return "HAZIR_DEGIL"; } PlayerAvatar val = Target(actor); List<EnemyParent> list = (((Object)(object)EnemyDirector.instance != (Object)null) ? EnemyDirector.instance.enemiesSpawned : null); if ((Object)(object)val == (Object)null || list == null) { return "HAZIR_DEGIL"; } Vector3 at = Where(val); List<(EnemyParent, float)> list2 = (from e in list where (Object)(object)e != (Object)null && Game.Spawned(e) && !HostSpawn.ScareOwned.Contains(e) select (enemy: e, d: Vector3.Distance(Where(e), at)) into x where x.d <= 40f orderby x.d select x).Take(count).ToList(); if (list2.Count == 0) { Plugin.Log.LogInfo((object)"Düşman sil: yakında düşman yok"); return "YOK"; } foreach (var item in list2) { item.Item1.Despawn(); Plugin.Log.LogInfo((object)("Düşman sil: " + ((Object)item.Item1).name + " (" + item.Item2.ToString("0.0") + " m)")); } return null; } public static bool Alive(PlayerAvatar p) { if ((Object)(object)p != (Object)null && !Game.DeadSet(p)) { return !Game.IsDisabled(p); } return false; } public static int ActorOf(PlayerAvatar p) { if (!((Object)(object)p != (Object)null) || !((Object)(object)p.photonView != (Object)null)) { return -1; } return p.photonView.OwnerActorNr; } public static PlayerAvatar Victim(int actor) { return Victim(actor, harmful: false); } public static PlayerAvatar Victim(int actor, bool harmful) { PlayerAvatar val = Target(actor); if ((Object)(object)val != (Object)null && harmful && Alive(val) && HostJail.IsJailed(val) && JailRedirectOn) { PlayerAvatar val2 = StandInFor(val); if ((Object)(object)val2 == (Object)null) { return val; } Note = Stand.JailNote(Name(val2)); return val2; } if ((Object)(object)val == (Object)null || Alive(val) || !StandInOn || HostJail.Reviving(val)) { return val; } PlayerAvatar val3 = StandInFor(val); if ((Object)(object)val3 == (Object)null) { return val; } Note = Stand.Note(Name(val3)); return val3; } public static PlayerAvatar StandInFor(PlayerAvatar dead, ICollection<int> not = null, CommandDef def = null) { List<PlayerAvatar> list = SemiFunc.PlayerGetList(); if (list == null || (Object)(object)dead == (Object)null) { return null; } Dictionary<int, PlayerAvatar> dictionary = new Dictionary<int, PlayerAvatar>(); foreach (PlayerAvatar item in list) { if (!((Object)(object)item == (Object)null) && !((Object)(object)item == (Object)(object)dead)) { int num = ActorOf(item); if (num > 0 && !dictionary.ContainsKey(num) && (not == null || !not.Contains(num)) && Ready(item) && (def == null || CanTake(item, def))) { dictionary[num] = item; } } } int num2 = fair.Pick(new List<int>(dictionary.Keys), rnd); if (num2 == 0) { return null; } Plugin.Log.LogInfo((object)("Vekil: " + Name(dead) + " için " + Name(dictionary[num2]) + " (aktör " + num2 + ", " + dictionary.Count + " hazır oyuncudan rastgele)")); return dictionary[num2]; } public static bool CanTake(PlayerAvatar p, CommandDef def) { if ((Object)(object)p == (Object)null || def == null) { return false; } if (Game.IsLocal(p) || Catalog.NativeForAnyone(def)) { return true; } try { Player obj = (((Object)(object)p.photonView != (Object)null) ? p.photonView.Owner : null); object value = null; if (obj != null) { ((Dictionary<object, object>)(object)obj.CustomProperties).TryGetValue((object)"devify.repo", out value); } int protocol; string version; bool accepting; return Wire.TryReadProperty(value, out protocol, out version, out accepting) && protocol == 1 && Wire.AtLeast(version, "0.2.11"); } catch { return false; } } public static bool Ready(PlayerAvatar p) { if (!Alive(p) || !Game.AvatarSpawned(p)) { return false; } if (Game.IsLocal(p)) { return true; } try { Player val = (((Object)(object)p.photonView != (Object)null) ? p.photonView.Owner : null); if (val == null) { return false; } if (!((Dictionary<object, object>)(object)val.CustomProperties).ContainsKey((object)"devify.repo")) { return true; } ((Dictionary<object, object>)(object)val.CustomProperties).TryGetValue((object)"devify.repo.hazir", out object value); return Wire.ReadReady(value); } catch { return false; } } public static string Name(PlayerAvatar p) { if ((Object)(object)p == (Object)null) { return ""; } try { Player val = (((Object)(object)p.photonView != (Object)null) ? p.photonView.Owner : null); if (val != null && !string.IsNullOrEmpty(val.NickName)) { return Command.CleanName(val.NickName); } } catch { } return Command.CleanName(((Object)p).name); } public static string StandIn(CommandDef def, int amount, IList<int> parts, int actor, string viewer, int replyTo = 0, int replyId = 0, int count = 1) { return StandIn(new Sent { Def = def, Amount = amount, Actor = actor, Viewer = viewer, ReplyTo = replyTo, ReplyId = replyId, Count = count }, parts); } public static string StandIn(Sent job, IList<int> parts) { //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_016c: Expected O, but got Unknown //IL_0180: Unknown result type (might be due to invalid IL or missing references) Note = null; CommandDef def = job.Def; int amount = job.Amount; try { if (!SemiFunc.IsMasterClientOrSingleplayer()) { return "HAZIR_DEGIL"; } PlayerAvatar val = Target(job.Actor); if ((Object)(object)val == (Object)null) { return "HAZIR_DEGIL"; } if (Alive(val) || HostJail.Reviving(val)) { return "VEKIL_YOK"; } PlayerAvatar val2 = StandInFor(val, job.Failed, def); if ((Object)(object)val2 == (Object)null) { return "VEKIL_YOK"; } string note = Stand.Note(Name(val2)); job.Streamer = Name(val); string result; if (Game.IsLocal(val2)) { result = EffectsLocal.Run(def.Name, amount, parts); } else { int num = ActorOf(val2); Player obj = ((PhotonNetwork.CurrentRoom != null) ? PhotonNetwork.CurrentRoom.GetPlayer(num, false) : null); object value = null; if (obj != null) { ((Dictionary<object, object>)(object)obj.CustomProperties).TryGetValue((object)"devify.repo", out value); } if (Wire.TryReadProperty(value, out var protocol, out var version, out var _) && protocol == 1 && Wire.AtLeast(version, "0.2.11")) { bool flag = Wire.AtLeast(version, "0.2.20"); int num2 = (flag ? nextSent++ : 0); object[] array = Wire.StandIn(def.Name, amount, job.Viewer, job.Streamer, num2); RaiseEventOptions val3 = new RaiseEventOptions(); val3.TargetActors = new int[1] { num }; PhotonNetwork.RaiseEvent((byte)146, (object)array, val3, SendOptions.SendReliable); Plugin.Log.LogInfo((object)("Vekil: " + def.Name + " " + amount + " → " + Name(val2) + (flag ? (" (yanıt bekleniyor, " + num2 + ")") : " (eski mod, yanıtsız)"))); if (flag) { job.Target = num; job.TargetName = Name(val2); job.At = Time.realtimeSinceStartupAsDouble; job.Tries++; sent[num2] = job; result = "GONDERILDI"; } else { result = null; } } else { result = Native(def.Name, amount, val2); } } Note = note; return result; } catch (Exception ex) { Plugin.Log.LogError((object)("Vekil etkisi " + def.Name + " çalışmadı: " + ex)); return "HATA"; } } public static bool Modless(PlayerAvatar p) { try { Player val = (((Object)(object)p != (Object)null && (Object)(object)p.photonView != (Object)null) ? p.photonView.Owner : null); if (val == null || Game.IsLocal(p)) { return false; } object value = null; ((Dictionary<object, object>)(object)val.CustomProperties).TryGetValue((object)"devify.repo", out value); int protocol; string version; bool accepting; return !Wire.TryReadProperty(value, out protocol, out version, out accepting) || !Wire.AtLeast(version, "0.2.20"); } catch { return false; } } public static void ModlessScreen(string name, int amount) { //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) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) if (!Effects.LevelReady() || (Object)(object)Runner.Instance == (Object)null) { return; } List<PlayerAvatar> list = SemiFunc.PlayerGetList(); if (list == null) { return; } List<PlayerAvatar> list2 = new List<PlayerAvatar>(); foreach (PlayerAvatar item in list) { if ((Object)(object)item != (Object)null && Alive(item) && Modless(item)) { list2.Add(item); } } if (list2.Count == 0) { return; } if (name == "karanlik") { ((MonoBehaviour)Runner.Instance).StartCoroutine(Flicker(list2, Math.Max(1, amount))); } else { if (!(name == "titret")) { return; } int num = Mathf.Clamp(amount, 1, 10); foreach (PlayerAvatar item2 in list2) { try { Vector2 insideUnitCircle = Random.insideUnitCircle; Vector2 normalized = ((Vector2)(ref insideUnitCircle)).normalized; item2.ForceImpulse(new Vector3(normalized.x, 0.3f, normalized.y) * ((float)num * 0.8f)); } catch (Exception ex) { Plugin.Log.LogWarning((object)("Modsuz titret: " + ex.Message)); } } Plugin.Log.LogInfo((object)("Modsuz titret (itme): " + list2.Count + " oyuncu")); } } private static IEnumerator Flicker(List<PlayerAvatar> targets, int seconds) { Plugin.Log.LogInfo((object)("Modsuz karanlık (fener titremesi): " + targets.Count + " oyuncu, " + seconds + " sn")); float until = Time.unscaledTime + (float)seconds; while (Time.unscaledTime < until && Effects.LevelReady()) { foreach (PlayerAvatar target in targets) { try { if ((Object)(object)target != (Object)null) { target.FlashlightFlicker(2.5f); } } catch { } } yield return (object)new WaitForSecondsRealtime(0.6f); } } private static string Native(string name, int amount, PlayerAvatar other) { //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_01fa: Unknown result type (might be due to invalid IL or missing references) PlayerHealth playerHealth = other.playerHealth; if ((Object)(object)playerHealth == (Object)null) { return "HAZIR_DEGIL"; } switch (name) { case "hasar": { int num2 = HealMath.SafeDamage(Game.Health(playerHealth), amount, doubled: false); playerHealth.HurtOther(num2, Vector3.zero, true, -1, false); Plugin.Log.LogInfo((object)("Vekil hasar: " + Name(other) + " " + num2 + " (can " + Game.Health(playerHealth) + ")")); return null; } case "iyilestir": playerHealth.HealOther(amount, true); Plugin.Log.LogInfo((object)("Vekil iyileştir: " + Name(other) + " +" + amount)); return null; case "yuvarla": case "kalk": { PlayerTumble val = Game.Tumble(other); if ((Object)(object)val == (Object)null) { return "HAZIR_DEGIL"; } string result = ((name == "kalk") ? EffectsLocal.StandUp(val) : EffectsLocal.Floor(val, amount)); Plugin.Log.LogInfo((object)("Vekil " + name + ": " + Name(other) + ((name == "yuvarla") ? (" " + amount + " sn") : ""))); return result; } case "oldur": { int num = 0; foreach (PlayerAvatar item in SemiFunc.PlayerGetList() ?? new List<PlayerAvatar>()) { if (Alive(item)) { num++; } } if (num < 2) { return "YOK"; } playerHealth.HurtOther(999, Vector3.zero, false, -1, false); return null; } default: Plugin.Log.LogInfo((object)("Vekil: " + name + " modsuz oyuncuya uygulanamaz (" + Name(other) + ")")); return "YOK"; } } } internal static class EffectsLocal { private sealed class Held { public float LightUntil; public float LightFactor = 1f; public float GlassUntil; public float EnergyUntil; public float WarpUntil; public float WarpFactor = 1f; public float ShakeUntil; public readonly Dictionary<Light, float> Saved = new Dictionary<Light, float>(); public Coroutine Tick; } private static readonly Held held = new Held(); public static string GiftViewer; public static string GiftWhat; private static float giftHarmUntil; private static string harmViewer; private static string harmWhat; public static string LabelOverride; private static readonly Dictionary<int, int> naturalMax = new Dictionary<int, int>(); private static Light darkBeam; private static float darkBeamIntensity; private static Behaviour darkHalo; private static bool darkHaloWas; private static int darkPercent; private static float nextJailLog; private static void GiftHarm() { giftHarmUntil = Time.unscaledTime + 1.5f; harmViewer = GiftViewer; harmWhat = GiftWhat; } private static string Heal(PlayerHealth ph, int amount) { if ((Object)(object)ph == (Object)null) { return "HAZIR_DEGIL"; } int instanceID = ((Object)ph).GetInstanceID(); if (!naturalMax.TryGetValue(instanceID, out var value)) { if (naturalMax.Count > 64) { naturalMax.Clear(); } value = (naturalMax[instanceID] = Game.MaxHealth(ph)); } int num2 = Game.Health(ph); int num3 = Game.MaxHealth(ph); HealMath.Plan(num2, num3, amount, value, out var newMax, out var newHealth); if (newHealth <= num2 && newMax <= num3) { return "YOK"; } Game.MaxHealth(ph) = newMax; ph.Heal(newHealth - num2, true); LabelOverride = HealMath.Label(Game.Health(ph) - num2, Game.MaxHealth(ph) - num3); Plugin.Log.LogInfo((object)("İyileştir: can " + num2 + "/" + num3 + " → " + Game.Health(ph) + "/" + Game.MaxHealth(ph) + " (istenen " + amount + ")")); return null; } public static string Run(string name, int amount, IList<int> parts = null, int second = 0) { LabelOverride = null; darkPercent = ((name == "karanlik") ? second : darkPercent); string text = Apply(name, amount, parts); if (text == null) { Plugin.Log.LogInfo((object)("Yerel etki: " + name + " " + amount)); } return text; } private static string Apply(string name, int amount, IList<int> parts) { switch (name) { case "karanlik": return Lights(amount, 1f - DarkStrength()); case "aydinlik": return Lights(amount, 2f); case "titret": return Shake(amount); case "sakin": return Calm(); default: { PlayerAvatar val = Me(); if ((Object)(object)val == (Object)null) { return "HAZIR_DEGIL"; } PlayerController instance = PlayerController.instance; switch (name) { case "iyilestir": return Heal(val.playerHealth, amount); case "hasar": { int num = Game.Health(val.playerHealth); bool doubled = Time.unscaledTime < held.GlassUntil; int num2 = ((parts != null && parts.Count > 1) ? HealMath.BurstDamage(num, parts, doubled) : HealMath.SafeDamage(num, amount, doubled)); bool flag = Game.Shielded(val.playerHealth); GiftHarm(); val.playerHealth.Hurt(num2, true, -1, false); int after = Game.Health(val.playerHealth); LabelOverride = HealMath.DamageLabel(amount, num2, num, after, flag); Plugin.Log.LogInfo((object)("Hasar: istenen " + amount + ", verilen " + num2 + " (can " + num + " → " + after + (flag ? ", kalkan" : "") + ")")); return null; } case "oldur": if (!AnyoneElseAlive(val)) { Plugin.Log.LogInfo((object)"Öldür: yayıncı son yaşayan; tur bitebilir"); } GiftHarm(); val.playerHealth.Hurt(999, false, -1, false); return null; case "kalkan": val.playerHealth.InvincibleSet((float)amount); return null; case "cam_kemik": if (!StartHold()) { return "HAZIR_DEGIL"; } held.GlassUntil = Mathf.Max(held.GlassUntil, Time.unscaledTime) + (float)amount; return null; case "enerji_doldur": if ((Object)(object)instance == (Object)null || !StartHold()) { return "HAZIR_DEGIL"; } held.EnergyUntil = Mathf.Max(held.EnergyUntil, Time.unscaledTime) + (float)amount; instance.EnergyCurrent = instance.EnergyStart; return null; case "enerji_bitir": if ((Object)(object)instance == (Object)null) { return "HAZIR_DEGIL"; } held.EnergyUntil = 0f; instance.EnergyCurrent = 0f; return null; case "hizlan": return Speed(instance, 2f, amount); case "yavasla": return Speed(instance, 0.4f, amount); case "zaman_hizli": return TimeScale(instance, 1.6f, amount); case "agir_cekim": return TimeScale(instance, 0.4f, amount); case "yuvarla": return Floor(Game.Tumble(val), amount); case "kalk": return StandUp(Game.Tumble(val)); case "sincap": return Pitch(instance, 1.8f, amount); case "dev": return Pitch(instance, 0.55f, amount); case "sustur": { PlayerVoiceChat instance2 = PlayerVoiceChat.instance; if ((Object)(object)instance2 == (Object)null) { return "HAZIR_DEGIL"; } instance2.OverrideMute((float)amount); return null; } default: return "BILINMEYEN"; } } } } public static string Floor(PlayerTumble tumble, int seconds) { //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0042: 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_0053: 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_0065: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)tumble == (Object)null) { return "HAZIR_DEGIL"; } bool num = SemiFunc.IsMasterClientOrSingleplayer(); if (num) { tumble.TumbleSet(true, false, false); } else { tumble.TumbleRequest(true, false); } Vector2 insideUnitCircle = Random.insideUnitCircle; Vector2 normalized = ((Vector2)(ref insideUnitCircle)).normalized; int num2 = Mathf.Min(seconds, 10); tumble.TumbleForce(new Vector3(normalized.x, 0f, normalized.y) * ((float)num2 * 2f) + Vector3.up * ((float)num2 * 3f)); if (num) { Game.OverrideTumbleHold(tumble, seconds); } tumble.TumbleOverrideTime((float)seconds); return null; } public static string StandUp(PlayerTumble tumble) { if ((Object)(object)tumble == (Object)null) { return "HAZIR_DEGIL"; } tumble.TumbleOverrideTime(0f); if (SemiFunc.IsMasterClientOrSingleplayer()) { Game.OverrideTumbleHold(tumble, 0f); tumble.TumbleSet(false, false, false); } else { tumble.TumbleRequest(false, false); } return null; } private static PlayerAvatar Me() { PlayerAvatar val = SemiFunc.PlayerAvatarLocal(); if ((Object)(object)val == (Object)null || (Object)(object)val.playerHealth == (Object)null || Game.IsDisabled(val) || Game.DeadSet(val)) { return null; } return val; } private static bool AnyoneElseAlive(PlayerAvatar me) { List<PlayerAvatar> list = SemiFunc.PlayerGetList(); if (list == null) { return false; } foreach (PlayerAvatar item in list) { if (!((Object)(object)item == (Object)null) && !((Object)(object)item == (Object)(object)me) && !Game.IsLocal(item) && !Game.DeadSet(item) && !Game.IsDisabled(item)) { return true; } } return false; } private static string Speed(PlayerController pc, float multi, int seconds) { if ((Object)(object)pc == (Object)null) { return "HAZIR_DEGIL"; } pc.OverrideSpeed(multi, (float)seconds, multi); return null; } private static string TimeScale(PlayerController pc, float multi, int seconds) { if ((Object)(object)pc == (Object)null || !StartHold()) { return "HAZIR_DEGIL"; } held.WarpUntil = TimeWarp.Extend(held.WarpUntil, held.WarpFactor, Time.unscaledTime, multi, seconds); held.WarpFactor = multi; ApplyWarp(pc); ((MonoBehaviour)Runner.Instance).StartCoroutine(LogWarp(pc, pc.MoveSpeed, multi)); return null; } private static IEnumerator LogWarp(PlayerController pc, float before, float multi) { yield return (object)new WaitForSecondsRealtime(0.5f); if ((Object)(object)pc != (Object)null) { Plugin.Log.LogInfo((object)("Zaman x" + multi.ToString("0.0") + ": yürüme hızı " + before.ToString("0.00") + " → " + pc.MoveSpeed.ToString("0.00"))); } } private static void ApplyWarp(PlayerController pc) { TimeWarp timeWarp = TimeWarp.Plan(held.WarpFactor); float num = 0.2f; pc.OverrideSpeed(timeWarp.Speed, num, timeWarp.Speed); if (timeWarp.Look.HasValue) { pc.OverrideLookSpeed(timeWarp.Look.Value, 2f, 1f, num); } pc.OverrideAnimationSpeed(timeWarp.Animation, 1f, 2f, num); if (timeWarp.TimeScale.HasValue) { pc.OverrideTimeScale(timeWarp.TimeScale.Value, num); } } private static string Pitch(PlayerController pc, float multi, int seconds) { if ((Object)(object)pc == (Object)null || (Object)(object)PlayerVoiceChat.instance == (Object)null) { return "HAZIR_DEGIL"; } try { pc.OverrideVoicePitch(multi, 0.2f, 0.2f, (float)seconds); return null; } catch (Exception ex) { Plugin.Log.LogError((object)("Ses perdesi değiştirilemedi: " + ex)); return "HATA"; } } private static string Shake(int amount) { if (!StartHold()) { return "HAZIR_DEGIL"; } float unscaledTime = Time.unscaledTime; held.ShakeUntil = (float)ShakeHold.Until(unscaledTime, held.ShakeUntil, amount); SemiFunc.CameraShakeImpact(7.5f, 0.3f); SemiFunc.CameraShake(5f, 0.25f); Plugin.Log.LogInfo((object)("Titret: " + (held.ShakeUntil - unscaledTime).ToString("0.0") + " sn")); return null; } public static void CalmScreen() { held.LightUntil = 0f; RestoreLights(); RestoreDark(); } private static string Calm() { held.ShakeUntil = 0f; held.LightUntil = 0f; held.GlassUntil = 0f; held.EnergyUntil = 0f; held.WarpUntil = 0f; RestoreLights(); RestoreDark(); PlayerController instance = PlayerController.instance; if ((Object)(object)instance != (Object)null) { instance.OverrideSpeed(1f, 0.1f, 1f); instance.OverrideTimeScale(1f, 0.1f); instance.OverrideVoicePitch(1f, 0.1f, 0.1f, 0.1f); } try { PlayerVoiceChat instance2 = PlayerVoiceChat.instance; if ((Object)(object)instance2 != (Object)null) { instance2.OverrideMute(0.01f); } } catch (Exception ex) { Plugin.Log.LogWarning((object)("Susturma kaldırılamadı: " + ex.Message)); } return null; } private static string Lights(int seconds, float factor) { LightManager instance = LightManager.instance; if ((Object)(object)instance == (Object)null || Game.PropLights(instance) == null || Game.PropLights(instance).Count == 0) { return "HAZIR_DEGIL"; } if (!StartHold()) { return "HAZIR_DEGIL"; } float unscaledTime = Time.unscaledTime; bool flag = held.LightFactor < 1f == factor < 1f; held.LightUntil = (flag ? (Mathf.Max(held.LightUntil, unscaledTime) + (float)seconds) : (unscaledTime + (float)seconds)); held.LightFactor = factor; HoldLights(instance); if (factor < 1f) { HoldDark(); } else { RestoreDark(); } return null; } private static float DarkStrength() { return Darkness.Strength((darkPercent > 0) ? ((float)darkPercent / 100f) : ((Plugin.DarkStrength != null) ? Plugin.DarkStrength.Value : 0.9f)); } private static void HoldDark() { //IL_002b: 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_0058: Unknown result type (might be due to invalid IL or missing references) float strength = DarkStrength(); try { EnvironmentDirector instance = EnvironmentDirector.Instance; if ((Object)(object)instance != (Object)null) { float num = Darkness.Ambient(strength); instance.OverrideAmbientColor(new Color(num, num, num * 1.1f, 1f), 0.3f); instance.OverrideFogColor(Color.black, 0.3f); float num2 = Darkness.FogEnd(strength); instance.OverrideFogDistance(new Vector2(0f, num2), 0.3f); } } catch (Exception ex) { Plugin.Log.LogWarning((object)("Karanlık: ortam ışığı değişmedi: " + ex.Message)); } if (Plugin.DarkFlashlight != null && !Plugin.DarkFlashlight.Value) { return; } try { FlashlightController instance2 = FlashlightController.Instance; if ((Object)(object)instance2 == (Object)null) { return; } if ((Object)(object)instance2.spotlight != (Object)null) { if ((Object)(object)darkBeam != (Object)(object)instance2.spotlight) { darkBeam = instance2.spotlight; darkBeamIntensity = instance2.spotlight.intensity; } instance2.spotlight.intensity = 0f; } if ((Object)(object)instance2.halo != (Object)null) { if ((Object)(object)darkHalo != (Object)(object)instance2.halo) { darkHalo = instance2.halo; darkHaloWas = instance2.halo.enabled; } instance2.halo.enabled = false; } } catch (Exception ex2) { Plugin.Log.LogWarning((object)("Karanlık: el feneri kapanmadı: " + ex2.Message)); } } private static void RestoreDark() { try { if ((Object)(object)darkBeam != (Object)null && darkBeam.intensity <= 0.001f) { darkBeam.intensity = darkBeamIntensity; } if ((Object)(object)darkHalo != (Object)null) { darkHalo.enabled = darkHaloWas; } } catch (Exception ex) { Plugin.Log.LogWarning((object)("Karanlık: el feneri geri gelmedi: " + ex.Message)); } darkBeam = null; darkHalo = null; } private static void HoldLights(LightManager lm) { List<PropLight> list = Game.PropLights(lm); if (list == null) { return; } foreach (PropLight item in list) { Light val = (((Object)(object)item == (Object)null) ? null : Game.LightOf(item)); if (!((Object)(object)val == (Object)null)) { if (!held.Saved.TryGetValue(val, out var value)) { value = (held.Saved[val] = val.intensity); } val.intensity = value * held.LightFactor; } } } private static void RestoreLights() { foreach (KeyValuePair<Light, float> item in held.Saved) { if ((Object)(object)item.Key != (Object)null) { item.Key.intensity = item.Value; } } held.Saved.Clear(); } private static bool StartHold() { Runner instance = Runner.Instance; if ((Object)(object)instance == (Object)null || !SemiFunc.RunIsLevel()) { return false; } if (held.Tick == null) { held.Tick = ((MonoBehaviour)instance).StartCoroutine(Tick()); } return true; } private static bool AnyHeld(float now) { if (!(now < held.ShakeUntil) && !(now < held.LightUntil) && !(now < held.GlassUntil) && !(now < held.EnergyUntil)) { return now < held.WarpUntil; } return true; } private static IEnumerator Tick() { try { yield return null; while (Step()) { yield return null; } } finally { held.Tick = null; held.LightUntil = (held.GlassUntil = (held.EnergyUntil = (held.WarpUntil = (held.ShakeUntil = 0f)))); held.WarpFactor = 1f; try { RestoreLights(); } catch (Exception ex) { Plugin.Log.LogError((object)("Işıklar geri yüklenemedi: " + ex.Message)); held.Saved.Clear(); } RestoreDark(); } } private static bool Step() { float unscaledTime = Time.unscaledTime; bool flag; try { flag = SemiFunc.RunIsLevel(); } catch { flag = false; } if (!flag || !AnyHeld(unscaledTime)) { return false; } try { if (unscaledTime < held.LightUntil && (Object)(object)LightManager.instance != (Object)null) { HoldLights(LightManager.instance); if (held.LightFactor < 1f) { HoldDark(); } } else { if (held.Saved.Count > 0) { RestoreLights(); } if ((Object)(object)darkBeam != (Object)null || (Object)(object)darkHalo != (Object)null) { RestoreDark(); } } if (ShakeHold.Running(unscaledTime, held.ShakeUntil)) { SemiFunc.CameraShake(5f, 0.25f); } PlayerController instance = PlayerController.instance; if (unscaledTime < held.EnergyUntil && (Object)(object)instance != (Object)null) { instance.EnergyCurrent = instance.EnergyStart; } if (unscaledTime < held.WarpUntil && (Object)(object)instance != (Object)null) { ApplyWarp(instance); } } catch (Exception ex) { Plugin.Log.LogError((object)("Süreli etki karesi çalışmadı: " + ex.Message)); } return true; } private static bool DeathPrefix(PlayerAvatar __instance) { if (!JailHud.Active || (Object)(object)__instance == (Object)null || !Game.IsLocal(__instance)) { return true; } if (Time.unscaledTime < giftHarmUntil) { try { JailOverlay.Died(harmViewer, harmWhat); } catch { } return true; } Plugin.Log.LogInfo((object)"Hapis koruması: ölüm engellendi"); return false; } private static bool VisionPrefix(PlayerAvatar __1) { return !HostJail.IsJailed(__1); } private static bool ChasePrefix(PlayerAvatar __0) { return !HostJail.IsJailed(__0); } private static void PatchJail(Harmony h) { One(typeof(PlayerAvatar), "PlayerDeath", new Type[1] { typeof(int) }, "DeathPrefix"); One(typeof(EnemyVision), "VisionTrigger", new Type[4] { typeof(int), typeof(PlayerAvatar), typeof(bool), typeof(bool) }, "VisionPrefix"); One(typeof(Enemy), "SetChaseTarget", new Type[1] { typeof(PlayerAvatar) }, "ChasePrefix"); Plugin.Log.LogInfo((object)"Hapis koruması yamaları uygulandı"); void One(Type t, string name, Type[] args, string prefix) { //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Expected O, but got Unknown try { MethodInfo methodInfo = AccessTools.Method(t, name, args, (Type[])null); if (methodInfo == null) { throw new MissingMethodException(t.Name + "." + name); } h.Patch((MethodBase)methodInfo, new HarmonyMethod(typeof(EffectsLocal), prefix, (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } catch (Exception ex) { Plugin.Log.LogWarning((object)("Hapis koruması eksik (" + t.Name + "." + name + "): " + ex.Message)); } } } public static void Patch() { //IL_0069: 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_0080: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Expected O, but got Unknown //IL_0094: Expected O, but got Unknown try { MethodInfo methodInfo = AccessTools.Method(typeof(PlayerHealth), "Hurt", new Type[4] { typeof(int), typeof(bool), typeof(int), typeof(bool) }, (Type[])null); if (methodInfo == null) { throw new MissingMethodException("PlayerHealth.Hurt(int, bool, int, bool)"); } Harmony val = new Harmony("net.devify.repo"); val.Patch((MethodBase)methodInfo, new HarmonyMethod(typeof(EffectsLocal), "HurtPrefix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); PatchJail(val); Plugin.Log.LogInfo((object)"cam_kemik yaması uygulandı"); } catch (Exception ex) { Plugin.Log.LogError((object)("cam_kemik yaması uygulanamadı; komut hasarı artırmayacak: " + ex.Message)); } } private static bool HurtPrefix(PlayerHealth __instance, ref int __0, int __2) { if (JailHud.Active && Time.unscaledTime >= giftHarmUntil) { PlayerAvatar val = SemiFunc.PlayerAvatarLocal(); if ((Object)(object)val != (Object)null && (Object)(object)val.playerHealth == (Object)(object)__instance) { if (Time.unscaledTime >= nextJailLog) { nextJailLog = Time.unscaledTime + 3f; Plugin.Log.LogInfo((object)("Hapis koruması: hasar engellendi (" + __0 + ", düşman " + __2 + ")")); } return false; } } bool num = Time.unscaledTime < held.GlassUntil; bool flag = ScareFx.ShieldActive && __2 >= 0; if (!num && !flag) { return true; } PlayerAvatar val2 = SemiFunc.PlayerAvatarLocal(); if ((Object)(object)val2 == (Object)null || (Object)(object)val2.playerHealth != (Object)(object)__instance) { return true; } if (flag) { if (!ScareFx.ShieldLogged) { ScareFx.ShieldLogged = true; Plugin.Log.LogInfo((object)("Jumpscare: düşman hasarı engellendi (" + __0 + ", düşman " + __2 + ")")); } return false; } __0 *= 2; return true; } } internal static class EnemyLook { private static readonly HashSet<int> enlarged = new HashSet<int>(); private static float nextScream; public static float Scale => Mathf.Clamp((Plugin.EnemyScale != null) ? Plugin.EnemyScale.Value : 1.4f, 1f, 1.6f); public static void Announce(EnemyParent parent, PlayerAvatar target, bool scream) { //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_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Expected O, but got Unknown if ((Object)(object)parent == (Object)null) { return; } float scale = Scale; Enlarge(parent, scale); bool flag = (Object)(object)target == (Object)null || !SemiFunc.IsMultiplayer() || Game.IsLocal(target); if (scream && flag) { Scream(); } if (!SemiFunc.IsMultiplayer()) { return; } try { Enemy val = Game.EnemyOf(parent); PhotonView val2 = (((Object)(object)val != (Object)null) ? (Game.ViewOf(val) ?? ((Component)val).GetComponent<PhotonView>()) : null); if (!((Object)(object)val2 == (Object)null) && val2.ViewID > 0) { int targetActor = ((scream && !flag && (Object)(object)target.photonView != (Object)null) ? target.photonView.OwnerActorNr : 0); PhotonNetwork.RaiseEvent((byte)144, (object)Wire.EnemyBig(val2.ViewID, scale, targetActor), new RaiseEventOptions { Receivers = (ReceiverGroup)0 }, SendOptions.SendReliable); } } catch (Exception ex) { Plugin.Log.LogWarning((object)("Düşman büyütme olayı gönderilemedi: " + ex.Message)); } } public static void Arrived(int viewId, float scale, bool scream) { try { PhotonView val = PhotonView.Find(viewId); EnemyParent val2 = (((Object)(object)val != (Object)null) ? ((Component)val).GetComponentInParent<EnemyParent>() : null); if ((Object)(object)val2 != (Object)null) { Enlarge(val2, scale); } else { Plugin.Log.LogInfo((object)("Düşman büyütme: görünüm " + viewId + " bulunamadı")); } } catch (Exception ex) { Plugin.Log.LogWarning((object)("Düşman büyütülemedi: " + ex.Message)); } if (scream) { Scream(); } } private static void Enlarge(EnemyParent parent, float scale) { if (scale <= 1.001f || (Object)(object)parent == (Object)null) { return; } if (enlarged.Count > 256) { enlarged.Clear(); } if (enlarged.Add(((Object)parent).GetInstanceID())) { List<string> list = new List<string>(); try { Visit(((Component)parent).transform, scale, list); } catch (Exception ex) { Plugin.Log.LogWarning((object)("Düşman büyütülemedi: " + ex.Message)); } Plugin.Log.LogInfo((object)("Düşman büyütüldü x" + scale.ToString("0.00") + ": " + ((Object)parent).name + " [" + string.Join(", ", list) + "]")); } } private static void Visit(Transform t, float scale, List<string> scaled) { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0027: 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_0059: Expected O, but got Unknown if ((Object)(object)((Component)t).GetComponentInChildren<Renderer>(true) == (Object)null) { return; } if ((Object)(object)((Component)t).GetComponentInChildren<Collider>(true) == (Object)null) { t.localScale *= scale; scaled.Add(((Object)t).name); return; } foreach (Transform item in t) { Visit(item, scale, scaled); } } private static void Scream() { if (Time.unscaledTime < nextScream) { return; } nextScream = Time.unscaledTime + 2f; try { if ((Object)(object)AudioScare.instance != (Object)null) { AudioScare.instance.PlayImpact(); } } catch (Exception ex) { Plugin.Log.LogWarning((object)("Düşman çığlığı çalmadı: " + ex.Message)); } try { SemiFunc.CameraShakeImpact(3f, 0.3f); } catch { } } } internal static class Game { private static readonly FieldRef<PlayerAvatar, bool> isLocal = AccessTools.FieldRefAccess<PlayerAvatar, bool>("isLocal"); private static readonly FieldRef<PlayerHealth, int> health = AccessTools.FieldRefAccess<PlayerHealth, int>("health"); private static readonly FieldRef<PlayerHealth, int> maxHealth = AccessTools.FieldRefAccess<PlayerHealth, int>("maxHealth"); private static readonly FieldRef<PlayerHealth, float> invincibleTimer = AccessTools.FieldRefAccess<PlayerHealth, float>("invincibleTimer"); private static readonly FieldRef<PlayerAvatar, bool> isDisabled = AccessTools.FieldRefAccess<PlayerAvatar, bool>("isDisabled"); private static readonly FieldRef<PlayerAvatar, bool> deadSet = AccessTools.FieldRefAccess<PlayerAvatar, bool>("deadSet"); private static readonly FieldRef<PlayerAvatar, PlayerTumble> tumble = AccessTools.FieldRefAccess<PlayerAvatar, PlayerTumble>("tumble"); private static readonly FieldRef<LightManager, List<PropLight>> propLights = AccessTools.FieldRefAccess<LightManager, List<PropLight>>("propLights"); private static readonly FieldRef<LevelPoint, bool> truck = AccessTools.FieldRefAccess<LevelPoint, bool>("Truck"); private static readonly FieldRef<LevelPoint, bool> inStartRoom = AccessTools.FieldRefAccess<LevelPoint, bool>("inStartRoom"); private static readonly FieldRef<PropLight, Light> lightComponent = AccessTools.FieldRefAccess<PropLight, Light>("lightComponent"); private static readonly FieldRef<PlayerAvatar, bool> avatarSpawned = TryField<PlayerAvatar, bool>("spawned"); private static readonly Action<PlayerTumble, float> overrideTumbleHold = TumbleHoldDelegate(); private static readonly FieldRef<PlayerAvatar, PlayerDeathHead> deathHead = AccessTools.FieldRefAccess<PlayerAvatar, PlayerDeathHead>("playerDeathHead"); private static readonly FieldRef<EnemyParent, bool> enemySpawned = AccessTools.FieldRefAccess<EnemyParent, bool>("Spawned"); private static readonly FieldRef<EnemyParent, Enemy> enemyOf = AccessTools.FieldRefAccess<EnemyParent, Enemy>("Enemy"); private static readonly FieldRef<ValuableObject, float> dollarValueCurrent = AccessTools.FieldRefAccess<ValuableObject, float>("dollarValueCurrent"); private static readonly FieldRef<ValuableObject, PhysGrabObjectImpactDetector> valuableImpact = AccessTools.FieldRefAccess<ValuableObject, PhysGrabObjectImpactDetector>("impactDetector"); private static readonly FieldRef<EnemyParent, bool> enemySetupDone = AccessTools.FieldRefAccess<EnemyParent, bool>("SetupDone"); private static readonly FieldRef<ValuableObject, float> dollarValueOriginal = AccessTools.FieldRefAccess<ValuableObject, float>("dollarValueOriginal"); private static readonly Action<PhysGrabObjectImpactDetector, float, Vector3, int, bool> breakObject = BreakDelegate(); private static readonly Action<EnemyParent> enemySpawn = EnemySpawnDelegate(); private static readonly FieldRef<Enemy, EnemyVision> enemyVision = TryField<Enemy, EnemyVision>("Vision"); private static readonly FieldRef<Enemy, EnemyRigidbody> enemyRigidbody = TryField<Enemy, EnemyRigidbody>("Rigidbody"); private static readonly FieldRef<Enemy, PhotonView> enemyView = TryField<Enemy, PhotonView>("PhotonView"); private static readonly FieldRef<EnemyRigidbody, Rigidbody> rigidbodyRb = TryField<EnemyRigidbody, Rigidbody>("rb"); private static readonly FieldRef<Enemy, EnemyNavMeshAgent> enemyNav = TryField<Enemy, EnemyNavMeshAgent>("NavMeshAgent"); public static ref int Health(PlayerHealth p) { return ref health.Invoke(p); } public static ref int MaxHealth(PlayerHealth p) { return ref maxHealth.Invoke(p); } public static bool Shielded(PlayerHealth p) { return invincibleTimer.Invoke(p) > 0f; } public static Light LightOf(PropLight p) { return lightComponent.Invoke(p); } public static bool IsLocal(PlayerAvatar p) { return isLocal.Invoke(p); } public static bool IsDisabled(PlayerAvatar p) { return isDisabled.Invoke(p); } public static bool DeadSet(PlayerAvatar p) { return deadSet.Invoke(p); } public static PlayerTumble Tumble(PlayerAvatar p) { return tumble.Invoke(p); } public static bool AvatarSpawned(PlayerAvatar p) { if ((Object)(object)p != (Object)null) { if (avatarSpawned != null) { return avatarSpawned.Invoke(p); } return true; } return false; } private static Action<PlayerTumble, float> TumbleHoldDelegate() { MethodInfo methodInfo = AccessTools.Method(typeof(PlayerTumble), "OverrideTumbleHold", new Type[1] { typeof(float) }, (Type[])null); if (methodInfo == null) { ManualLogSource log = Plugin.Log; if (log != null) { log.LogWarning((object)"PlayerTumble.OverrideTumbleHold(float) bulunamadı; yuvarla yerde tutmayacak"); } return null; } try { return (Action<PlayerTumble, float>)Delegate.CreateDelegate(typeof(Action<PlayerTumble, float>), methodInfo); } catch (Exception ex) { ManualLogSource log2 = Plugin.Log; if (log2 != null) { log2.LogWarning((object)("OverrideTumbleHold bağlanamadı: " + ex.Message)); } return null; } } public static bool OverrideTumbleHold(PlayerTumble t, float seconds) { if (overrideTumbleHold == null) { return false; } overrideTumbleHold(t, seconds); return true; } public static PlayerDeathHead DeathHead(PlayerAvatar p) { return deathHead.Invoke(p); } public static bool Spawned(EnemyParent e) { return enemySpawned.Invoke(e); } public static bool SetupDone(EnemyParent e) { return enemySetupDone.Invoke(e); } public static Enemy EnemyOf(EnemyParent e) { return enemyOf.Invoke(e); } public static ref float DollarValue(ValuableObject v) { return ref dollarValueCurrent.Invoke(v); } public static float OriginalValue(ValuableObject v) { return dollarValueOriginal.Invoke(v); } public static PhysGrabObjectImpactDetector ImpactOf(ValuableObject v) { return valuableImpact.Invoke(v); } private static Action<PhysGrabObjectImpactDetector, float, Vector3, int, bool> BreakDelegate() { MethodInfo methodInfo = AccessTools.Method(typeof(PhysGrabObjectImpactDetector), "Break", new Type[4] { typeof(float), typeof(Vector3), typeof(int), typeof(bool) }, (Type[])null); if (methodInfo == null) { ManualLogSource log = Plugin.Log; if (log != null) { log.LogWarning((object)"PhysGrabObjectImpactDetector.Break bulunamadı; kir çalışmayacak"); } return null; } try { return (Action<PhysGrabObjectImpactDetector, float, Vector3, int, bool>)Delegate.CreateDelegate(typeof(Action<PhysGrabObjectImpactDetector, float, Vector3, int, bool>), methodInfo); } catch (Exception ex) { ManualLogSource log2 = Plugin.Log; if (log2 != null) { log2.LogWarning((object)("Break bağlanamadı: " + ex.Message)); } return null; } } public static bool Break(PhysGrabObjectImpactDetector d, float valueLost, Vector3 at) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) if (breakObject == null) { return false; } breakObject(d, valueLost, at, 1, arg5: true); return true; } private static Action<EnemyParent> EnemySpawnDelegate() { MethodInfo methodInfo = AccessTools.Method(typeof(EnemyParent), "Spawn", Type.EmptyTypes, (Type[])null); if (methodInfo == null) { ManualLogSource log = Plugin.Log; if (log != null) { log.LogWarning((object)"EnemyParent.Spawn bulunamadı; düşmanlar görünmeyecek"); } return null; } try { return (Action<EnemyParent>)Delegate.CreateDelegate(typeof(Action<EnemyParent>), methodInfo); } catch (Exception ex) { ManualLogSource log2 = Plugin.Log; if (log2 != null) { log2.LogWarning((object)("EnemyParent.Spawn bağlanamadı: " + ex.Message)); } return null; } } public static bool ActivateEnemy(EnemyParent e) { if (enemySpawn == null) { return false; } enemySpawn(e); return true; } private static FieldRef<T, F> TryField<T, F>(string name) { try { return AccessTools.FieldRefAccess<T, F>(name); } catch (Exception ex) { ManualLogSource log = Plugin.Log; if (log != null) { log.LogWarning((object)(typeof(T).Name + "." + name + " bulunamadı: " + ex.Message)); } return null; } } public static EnemyVision VisionOf(Enemy e) { if (enemyVision == null || !((Object)(object)e != (Object)null)) { return null; } return enemyVision.Invoke(e); } public static EnemyRigidbody RigidbodyOf(Enemy e) { if (enemyRigidbody == null || !((Object)(object)e != (Object)null)) { return null; } return enemyRigidbody.Invoke(e); } public static PhotonView ViewOf(Enemy e) { if (enemyView == null || !((Object)(object)e != (Object)null)) { return null; } return enemyView.Invoke(e); } public static Rigidbody RbOf(EnemyRigidbody r) { if (rigidbodyRb == null || !((Object)(object)r != (Object)null)) { return null; } return rigidbodyRb.Invoke(r); } public static EnemyNavMeshAgent NavOf(Enemy e) { if (enemyNav == null || !((Object)(object)e != (Object)null)) { return null; } return enemyNav.Invoke(e); } public static List<PropLight> PropLights(LightManager m) { return propLights.Invoke(m); } public static bool Truck(LevelPoint p) { return truck.Invoke(p); } public static bool InStartRoom(LevelPoint p) { return inStartRoom.Invoke(p); } } internal static class HostJail { private sealed class Cell { public PlayerAvatar Who; public int Origin; public readonly JailTime Time = new JailTime(); public Vector3 Center; public Vector3 Back; public Quaternion BackTurn; public int LastSent = -1; public int Returns; public double DiedAt = double.NaN; public bool ReviveSent; public Vector3 BarsAt; public Vector3 Axis; public float Width; public float Height; public double SentAt; public double ScreenAt = double.NegativeInfinity; } private sealed class Check { public PlayerAvatar Who; public Vector3 Back; public Vector3 Cell; public Quaternion Turn; public double At; public int Tries; } private static TruckScreenText truckScreen; private static readonly List<Check> checks = new List<Check>(); private const double ReviveDelay = 1.5; private const double ReviveGiveUp = 6.0; private static readonly Dictionary<int, Cell> cells = new Dictionary<int, Cell>(); private static readonly Dictionary<int, (Vector3 at, Quaternion turn, PlayerAvatar who)> lastBack = new Dictionary<int, (Vector3, Quaternion, PlayerAvatar)>(); private static bool driving; private static double listSentAt; private static double Now => Time.realtimeSinceStartupAsDouble; private static void TruckLine(Cell cell, bool now) { if ((Object)(object)cell.Who == (Object)null || !EffectsHost.Modless(cell.Who) || (!now && Now - cell.ScreenAt < 15.0)) { return; } cell.ScreenAt = Now; try { if ((Object)(object)truckScreen == (Object)null) { truckScreen = Object.FindFirstObjectByType<TruckScreenText>(); } if (!((Object)(object)truckScreen == (Object)null)) { truckScreen.MessageSendCustom("", "HAPİS " + EffectsHost.Name(cell.Who) + " " + JailTime.Clock(cell.Time.SecondsLeftLong(Now)), 0); } } catch (Exception ex) { Plugin.Log.LogWarning((object)("Hapis: kamyon ekranına yazılamadı: " + ex.Message)); } } public static bool IsJailed(PlayerAvatar p) { if ((Object)(object)p == (Object)null || cells.Count == 0) { return false; } foreach (Cell value in cells.Values) { if ((Object)(object)value.Who == (Object)(object)p && value.Time.Active(Now)) { return true; } } return false; } public static bool Reviving(PlayerAvatar p) { if ((Object)(object)p == (Object)null) { return false; } foreach (Cell value in cells.Values) { if ((Object)(object)value.Who == (Object)(object)p && !double.IsNaN(value.DiedAt) && Now - value.DiedAt < 6.0) { return true; } } return false; } public static string Sentence(int actor, int seconds) { //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Unknown result type (might be due to invalid IL or missing references) //IL_0153: 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_0167: 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_01ba: Unknown result type (might be due to invalid IL or missing references) //IL_01c9: Unknown result type (might be due to invalid IL or missing references) //IL_01d8: 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) //IL_0237: Unknown result type (might be due to invalid IL or missing references) //IL_023c: Unknown result type (might be due to invalid IL or missing references) //IL_0207: Unknown result type (might be due to invalid IL or missing references) //IL_0255: Unknown result type (might be due to invalid IL or missing references) //IL_024c: Unknown result type (might be due to invalid IL or missing references) //IL_0219: Unknown result type (might be due to invalid IL or missing references) //IL_025a: Unknown result type (might be due to invalid IL or missing references) //IL_02ae: Unknown result type (might be due to invalid IL or missing references) //IL_02d3: Unknown result type (might be due to invalid IL or missing references) //IL_02d8: Unknown result type (might be due to invalid IL or missing references) //IL_02dd: Unknown result type (might be due to invalid IL or missing references) //IL_02cb: Unknown result type (might be due to invalid IL or missing references) if (!Effects.LevelReady()) { return "HAZIR_DEGIL"; } PlayerAvatar val = EffectsHost.Victim(actor); if ((Object)(object)val == (Object)null) { return "HAZIR_DEGIL"; } int key = EffectsHost.ActorOf(val); if (cells.TryGetValue(key, out var value) && (Object)(object)value.Who == (Object)(object)val) { value.Time.Add(Now, seconds); Plugin.Log.LogInfo((object)("Hapis: " + EffectsHost.Name(val) + " +" + seconds + " sn, kalan " + value.Time.SecondsLeft(Now) + ", dönüş " + ((object)Unsafe.As<Vector3, Vector3>(ref value.Back)/*cast due to .constrained prefix*/).ToString())); Send(value, now: true); return null; } if (!EffectsHost.Alive(val)) { return "YOK"; } Vector3? val2 = CellPoint(); if (!val2.HasValue) { return "HATA"; } value = new Cell { Who = val, Origin = actor, Center = val2.Value }; Layout(value); lastBack.TryGetValue(key, out (Vector3, Quaternion, PlayerAvatar) value2); bool flag = (Object)(object)value2.Item3 == (Object)(object)val; Vector3 position = ((Component)val).transform.position; float[] array = JailReturn.Choose(new float[3] { position.x, position.y, position.z }, new float[3] { value.Center.x, value.Center.y, value.Center.z }, (!flag) ? null : new float[3] { value2.Item1.x, value2.Item1.y, value2.Item1.z }, cellOpen: false); bool flag2 = flag && array[0] == value2.Item1.x && array[1] == value2.Item1.y && array[2] == value2.Item1.z; value.Back = new Vector3(array[0], array[1], array[2]); value.BackTurn = (flag2 ? value2.Item2 : ((Component)val).transform.rotation); if (flag2) { Plugin.Log.LogInfo((object)("Hapis: oyuncu hâlâ hücrede; dönüş noktası önceki hapisten (" + ((object)Unsafe.As<Vector3, Vector3>(ref value.Back)/*cast due to .constrained prefix*/).ToString() + ")")); } value.Time.Add(Now, seconds); cells[key] = value; Move(val, value.Center, (((Vector3)(ref value.Axis)).sqrMagnitude > 0.5f) ? Quaternion.LookRotation(value.Axis, Vector3.up) : ((Component)val).transform.rotation); SendBars(value, up: true); Plugin.Log.LogInfo((object)("Hapis: " + EffectsHost.Name(val) + " " + seconds + " sn, " + ((object)Unsafe.As<Vector3, Vector3>(ref value.Back)/*cast due to .constrained prefix*/).ToString() + " → " + ((object)Unsafe.As<Vector3, Vector3>(ref value.Center)/*cast due to .constrained prefix*/).ToString())); Send(value, now: true); if (!driving && (Object)(object)Runner.Instance != (Object)null) { ((MonoBehaviour)Runner.Instance).StartCoroutine(Drive()); } return null; } public static string Shorten(int actor, int seconds) { Cell cell = Find(actor); if (cell == null) { return "YOK"; } if (cell.Time.Shorten(Now, seconds)) { Release(cell, back: true); } else { Plugin.Log.LogInfo((object)("Hapis kısalt: " + EffectsHost.Name(cell.Who) + " -" + seconds + " sn, kalan " + cell.Time.SecondsLeft(Now))); Send(cell, now: true); } return null; } public static string Free(int actor) { Cell cell = Find(actor); if (cell == null) { return "YOK"; } cell.Time.Free(); Release(cell, back: true); return null; } private static Cell Find(int actor) { Cell value = null; PlayerAvatar val = EffectsHost.Victim(actor); if ((Object)(object)val != (Object)null) { cells.TryGetValue(EffectsHost.ActorOf(val), out value); } if (value == null || !value.Time.Active(Now)) { value = cells.Values.FirstOrDefault((Cell c) => c.Origin == actor && c.Time.Active(Now)); } if (value == null || !value.Time.Active(Now)) { return null; } return value; } private unsafe static void Layout(Cell cell) { //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_0030: 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_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_0045: 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_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0092: 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) //IL_009c: 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_00a0: 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) //IL_00a6: 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_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) //IL_00e5: 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_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: 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_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_010b: 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) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_0153: 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) //IL_0160: Unknown result type (might be due to invalid IL or missing references) //IL_0165: 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_016d: 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_0179: Unknown result type (might be due to invalid IL or missing references) //IL_017e: Unknown result type (might be due to invalid IL or missing references) //IL_0183: Unknown result type (might be due to invalid IL or missing references) //IL_01a3: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: Unknown result type (might be due to invalid IL or missing references) //IL_01ab: Unknown result type (might be due to invalid IL or missing references) //IL_01ac: 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_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) try { TruckDoor val = Object.FindFirstObjectByType<TruckDoor>(); if ((Object)(object)val == (Object)null) { Plugin.Log.LogWarning((object)"Hapis: kamyon kapısı yok, parmaklık yok"); return; } Vector3 center = cell.Center; Vector3 val2 = Vector3.ProjectOnPlane(((Component)val).transform.position - center, Vector3.up); if (!(((Vector3)(ref val2)).sqrMagnitude < 0.25f)) { ((Vector3)(ref val2)).Normalize(); Vector3 val3 = Vector3.up * 1f; float num = Ray(center + val3, -val2, 8f); Vector3 val4 = center - val2 * JailLayout.CellBack(num); float num2 = Ray(val4 + val3, Vector3.down, 3f); if (!float.IsNaN(num2)) { val4 += Vector3.down * (num2 - 1f); } cell.Center = val4; Vector3 val5 = val4 + val2 * 1.1f; Vector3 val6 = Vector3.Cross(Vector3.up, val2); Vector3 normalized = ((Vector3)(ref val6)).normalized; float right = Ray(val5 + val3, normalized, 4f); float left = Ray(val5 + val3, -normalized, 4f); cell.Width = JailLayout.HalfWidth(left, right) * 2f; val5 += normalized * JailLayout.Shift(left, right); cell.Height = JailLayout.Height(Ray(val5 + Vector3.up * 0.3f, Vector3.up, 4f) + 0.3f); cell.BarsAt = val5; cell.Axis = val2; Plugin.Log.LogInfo((object)("Hapis hücresi: arka duvar " + (float.IsNaN(num) ? "?" : num.ToString("0.0")) + " m, hücre " + ((object)(*(Vector3*)(&val4))/*cast due to .constrained prefix*/).ToString() + ", parmaklık " + cell.Width.ToString("0.0") + " × " + cell.Height.ToString("0.0") + " m")); } } catch (Exception ex) { Plugin.Log.LogWarning((object)("Hapis hücresi ölçülemedi: " + ex.Message)); cell.Width = 0f; } } private static float Ray(Vector3 from, Vector3 dir, float max) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: 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) RaycastHit[] array = Physics.RaycastAll(from, dir, max, -1, (QueryTriggerInteraction)1); float num = float.NaN; RaycastHit[] array2 = array; for (int i = 0; i < array2.Length; i++) { RaycastHit val = array2[i]; if (!((Object)(object)((RaycastHit)(ref val)).collider == (Object)null) && !((Object)(object)((Component)((RaycastHit)(ref val)).collider).GetComponentInParent<PlayerAvatar>() != (Object)null) && !((Object)(object)((Component)((RaycastHit)(ref val)).collider).GetComponentInParent<PlayerController>() != (Object)null)) { Rigidbody rigidbody = ((RaycastHit)(ref val)).rigidbody; if ((!((Object)(object)rigidbody != (Object)null) || rigidbody.isKinematic) && !((Object)(object)((Component)((RaycastHit)(ref val)).collider).GetComponentInParent<EnemyParent>() != (Object)null) && (float.IsNaN(num) || ((RaycastHit)(ref val)).distance < num)) { num = ((RaycastHit)(ref val)).distance; } } } return num; } private static void SendBars(Cell cell, bool up) { //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) //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_00c2: Expected O, but got Unknown //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) if (cell.Width <= 0f || (Object)(object)cell.Who == (Object)null) { return; } int prisoner = EffectsHost.ActorOf(cell.Who); try { if (!SemiFunc.IsMultiplayer()) { if (up) { JailBars.Show(cell.BarsAt, cell.Axis, cell.Width, cell.Height, solid: true); } else { JailBars.Hide(); } } else { PhotonNetwork.RaiseEvent((byte)147, (object)Wire.Bars(up, cell.BarsAt.x, cell.BarsAt.y, cell.BarsAt.z, cell.Axis.x, cell.Axis.z, cell.Width, cell.Height, prisoner), new RaiseEventOptions { Receivers = (ReceiverGroup)1 }, SendOptions.SendReliable); } } catch (Exception ex) { Plugin.Log.LogWarning((object)("Hapis parmaklığı gönderilemedi: " + ex.Message)); } } private static Vector3? CellPoint() { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_00be: 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_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: 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) try { TruckSafetySpawnPoint instance = TruckSafetySpawnPoint.instance; if ((Object)(object)instance != (Object)null) { return ((Component)instance).transform.position; } } catch (Exception ex) { Plugin.Log.LogWarning((object)("Hapis: kamyon noktası okunamadı: " + ex.Message)); } List<LevelPoint> list = (((Object)(object)LevelGenerator.Instance != (Object)null) ? LevelGenerator.Instance.LevelPathPoints : null)?.Where((LevelPoint p) => (Object)(object)p != (Object)null && Game.Truck(p)).ToList(); if (list == null || list.Count == 0) { Plugin.Log.LogWarning((object)"Hapis: kamyon bulunamadı"); return null; } Vector3 mid = list.Aggregate(Vector3.zero, (Vector3 s, LevelPoint p) => s + ((Component)p).transform.position) / (float)list.Count; return ((Component)list.OrderBy((LevelPoint p) => Vector3.Distance(((Component)p).transform.position, mid)).First()).transform.position; } private static void Move(PlayerAvatar who, Vector3 to, Quaternion turn) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: 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_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) try { who.Spawn(to + Vector3.up * 0.2f, turn, false); } catch (Exception ex) { Plugin.Log.LogWarning((object)("Hapis: oyuncu taşınamadı: " + ex.Message)); } } private static IEnumerator Drive() { driving = true; try { while (cells.Count > 0 || checks.Count > 0) { bool flag = Effects.LevelReady(); Recheck(flag); foreach (Cell item in cells.Values.ToList()) { if (!flag || (Object)(object)item.Who == (Object)null) { lastBack.Clear(); Plugin.Log.LogInfo((object)("Hapis bitti (" + (flag ? "oyuncu çıktı" : "seviye değişti") + ")")); item.Time.Free(); Release(item, back: false); continue; } if (!EffectsHost.Alive(item.Who)) { if (double.IsNaN(item.DiedAt)) { item.DiedAt = Now; Plugin.Log.LogInfo((object)("Hapis: " + EffectsHost.Name(item.Who) + " hapiste öldü, diriltilecek")); } if (!item.ReviveSent && Now - item.DiedAt >= 1.5 && Game.DeadSet(item.Who)) { item.ReviveSent = true; try { item.Who.Revive(true); Plugin.Log.LogInfo((object)("Hapis: " + EffectsHost.Name(item.Who) + " diriltildi")); } catch (Exception ex) { Plugin.Log.LogWarning((object)("Hapis: diriltilemedi: " + ex.Message)); } } if (Now - item.DiedAt >= 6.0) { Plugin.Log.LogWarning((object)("Hapis: " + EffectsHost.Name(item.Who) + " dirilmedi; hapis bitti")); item.Time.Free(); Release(item, back: false); } else { Send(item, now: false); } continue; } if (!double.IsNaN(item.DiedAt)) { item.DiedAt = double.NaN; item.ReviveSent = false; Plugin.Log.LogInfo((object)("Hapis: " + EffectsHost.Name(item.Who) + " hücrede dirildi; düşmanlar hapis bitince yeniden görür")); Move(item.Who, item.Center, ((Component)item.Who).transform.rotation); TopUp(item.Who); Send(item, now: true); } if (!item.Time.Active(Now)) { Release(item, back: true); continue; } Vector3 val = ((Component)item.Who).transform.position - item.Center; if (JailTime.Escaped(val.x, val.y, val.z)) { item.Returns++; Move(item.Who, item.Center, ((Component)item.Who).transform.rotation); if (item.Returns % 10 == 1) { Plugin.Log.LogInfo((object)("Hapis: " + EffectsHost.Name(item.Who) + " hücreye geri alındı (" + item.Returns + ")")); } } Send(item, now: false); } BroadcastList(clear: false); yield return (object)new WaitForSecondsRealtime(0.2f); } } finally { driving = false; BroadcastList(clear: true); } } private static void Release(Cell cell, bool back) { //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0062: 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_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Unknown result type (might be due to invalid IL or missing references) int key = cells.FirstOrDefault((KeyValuePair<int, Cell> kv) => kv.Value == cell).Key; cells.Remove(key); if ((Object)(object)cell.Who != (Object)null) { lastBack[key] = (cell.Back, cell.BackTurn, cell.Who); } if (back && (Object)(object)cell.Who != (Object)null && EffectsHost.Alive(cell.Who) && Effects.LevelReady()) { Move(cell.Who, SafeBack(cell.Back), cell.BackTurn); checks.Add(new Check { Who = cell.Who, Back = cell.Back, Cell = cell.Center, Turn = cell.BackTurn, At = Now }); if (!driving && (Object)(object)Runner.Instance != (Object)null) { ((MonoBehaviour)Runner.Instance).StartCoroutine(Drive()); } } Plugin.Log.LogInfo((object)("Hapis: " + EffectsHost.Name(cell.Who) + " serbest" + (back ? ", eski yerine döndü" : ""))); cell.LastSent = -1; SendRaw(cell.Who, 0, 0); SendBars(cell, up: false); } private static void Recheck(bool level) { //IL_007b: 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_0135: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) if (checks.Count == 0) { return; } if (!level) { checks.Clear(); return; } foreach (Check item in checks.ToList()) { if ((Object)(object)item.Who == (Object)null || !EffectsHost.Alive(item.Who)) { checks.Remove(item); continue; } bool flag = IsJailed(item.Who); float num = Vector3.Distance(((Component)item.Who).transform.position, item.Cell); if (flag || num >= 3.5f || item.Tries >= 3) { checks.Remove(item); } else if (JailSafety.MoveAgain(num, flag, Now - item.At, item.Tries)) { item.Tries++; item.At = Now; Plugin.Log.LogWarning((object)("Hapis: " + EffectsHost.Name(item.Who) + " çıkıştan sonra hâlâ hücrede, yeniden dışarı alınıyor (" + item.Tries + ")")); Move(item.Who, SafeBack(item.Back), item.Turn); } } } private unsafe static Vector3 SafeBack(Vector3 back) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0162: 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_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: 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_0118: 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_0138: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) try { NavMeshHit val = default(NavMeshHit); if (NavMesh.SamplePosition(back, ref val, 1.5f, -1) && !EnemyNear(((NavMeshHit)(ref val)).position)) { return ((NavMeshHit)(ref val)).position; } Vector3? val2 = (from v in (((Object)(object)LevelGenerator.Instance != (Object)null) ? LevelGenerator.Instance.LevelPathPoints : null)?.Where((LevelPoint p) => (Object)(object)p != (Object)null).Select((Func<LevelPoint, Vector3?>)((LevelPoint p) => ((Component)p).transform.position)) where !EnemyNear(v.Value) orderby Vector3.Distance(v.Value, back) select v).FirstOrDefault(); if (val2.HasValue) { Plugin.Log.LogInfo((object)("Hapis: eski yer güvenli değil (" + ((object)(*(Vector3*)(&back))/*cast due to .constrained prefix*/).ToString() + "), en yakın yol noktası " + ((object)val2.Value/*cast due to .constrained prefix*/).ToString())); return val2.Value; } } catch (Exception ex) { Plugin.Log.LogWarning((object)("Hapis: dönüş noktası denetlenemedi: " + ex.Message)); } return back; } private static bool EnemyNear(Vector3 at) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) return (((Object)(object)EnemyDirector.instance != (Object)null) ? EnemyDirector.instance.enemiesSpawned : null)?.Any((EnemyParent e) => (Object)(object)e != (Object)null && Game.Spawned(e) && Vector3.Distance(EffectsHost.Where(e), at) < 2.5f) ?? false; } private static void TopUp(PlayerAvatar who) { try { PlayerHealth playerHealth = who.playerHealth; if (!((Object)(object)playerHealth == (Object)null)) { int num = Game.MaxHealth(playerHealth) / 2 - Game.Health(playerHealth); if (num > 0) { playerHealth.HealOther(num, true); } } } catch (Exception ex) { Plugin.Log.LogWarning((object)("Hapis: can verilemedi: " + ex.Message)); } } private static void BroadcastList(bool clear) { //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Expected O, but got Unknown if (!clear && Now - listSentAt < 1.0) { return; } listSentAt = Now; List<Cell> source = (clear ? new List<Cell>() : cells.Values.Where((Cell c) => (Object)(object)c.Who != (Object)null && c.Time.Active(Now)).ToList()); int[] array = source.Select((Cell c) => EffectsHost.ActorOf(c.Who)).ToArray(); string[] array2 = source.Select((Cell c) => EffectsHost.Name(c.Who)).ToArray(); int[] array3 = source.Select((Cell c) => c.Time.SecondsLeft(Now)).ToArray(); JailList.Set(array, array2, array3); if (!SemiFunc.IsMultiplayer()) { return; } try { PhotonNetwork.RaiseEvent((byte)150, (object)Wire.JailList(array, array2, array3), new RaiseEventOptions { Receivers = (ReceiverGroup)0 }, SendOptions.SendReliable); } catch (Exception ex) { Plugin.Log.LogWarning((object)("Hapis listesi gönderilemedi: " + ex.Message)); } } private static void Send(Cell cell, bool now) { int num = cell.Time.SecondsLeft(Now); if (now || num != cell.LastSent || !(Now - cell.SentAt < 1.0)) { cell.LastSent = num; cell.SentAt = Now; TruckLine(cell, now); SendRaw(cell.Who, num, (int)Math.Ceiling(cell.Time.Span)); } } private static void SendRaw(PlayerAvatar who, int left, int span) { //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Expected O, but got Unknown //IL_0053: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)who == (Object)null) { return; } try { if (!SemiFunc.IsMultiplayer() || Game.IsLocal(who)) { JailHud.Set(left, span); return; } int num = EffectsHost.ActorOf(who); if (num > 0) { object[] array = Wire.Jail(left, span); RaiseEventOptions val = new RaiseEventOptions(); val.TargetActors = new int[1] { num }; PhotonNetwork.RaiseEvent((byte)145, (object)array, val, SendOptions.SendReliable); } } catch (Exception ex) { Plugin.Log.LogWarning((object)("Hapis sayacı gönderilemedi: " + ex.Message)); } } } internal static class JailList { private static int[] actors = new int[0]; private static string[] names = new string[0]; private static int[] seconds = new int[0]; private static double setAt; private static double heardAt; public static void Set(int[] a, string[] n, int[] s) { actors = a ?? new int[0]; names = n ?? new string[0]; seconds = s ?? new int[0]; setAt = (heardAt = Time.realtimeSinceStartupAsDouble); } public static List<string> Lines(int myActor) { List<string> list = new List<string>(); double realtimeSinceStartupAsDouble = Time.realtimeSinceStartupAsDouble; if (realtimeSinceStartupAsDouble - heardAt > 4.0) { return list; } double num = realtimeSinceStartupAsDouble - setAt; for (int i = 0; i < actors.Length; i++) { if (actors[i] != myActor) { long num2 = (long)Math.Ceiling((double)seconds[i] - num); if (num2 > 0) { list.Add(Command.CleanName(names[i]) + ": " + JailTime.Clock(num2)); } } } return list; } } internal static class JailHud { private static double until; private static double setAt; private static int span; public static bool Active => Time.realtimeSinceStartupAsDouble < until; public static long SecondsLeft { get { if (!Active) { return 0L; } return (long)Math.Ceiling(until - Time.realtimeSinceStartupAsDouble); } } public static double LastWord { get; private set; } public static float Share { get { if (span <= 0) { return 0f; } return Mathf.Clamp01((float)SecondsLeft / (float)span); } } public static void Clear() { until = 0.0; span = 0; } public static void Set(int secondsLeft, int sentence) { setAt = Time.realtimeSinceStartupAsDouble; LastWord = setAt; until = ((secondsLeft > 0) ? (setAt + (double)secondsLeft) : 0.0); span = Math.Max(secondsLef