private static bool Prefix(ReversePlague.EventHandlers __instance, Exiled.Events.EventArgs.DyingEventArgs ev) { if (!ev.HitInformation.IsPlayer) { return(false); } Team team = ev.Target.Team; if (!__instance.infectable.Contains(ev.Target.ReferenceHub)) { return(false); } __instance.infectable.RemoveAll((ReferenceHub p) => p == ev.Target.ReferenceHub); foreach (Player player2 in from x in Player.List where x.Role == RoleType.Scp049 && !x.IsNPC() select x) { ReferenceHub referenceHub = player2.ReferenceHub; if (Vector3.Distance(ev.Target.GameObject.transform.position, referenceHub.transform.position) < RPPlugin.plugin.Config.range) { foreach (Inventory.SyncItemInfo syncItemInfo in ev.Target.ReferenceHub.inventory.items) { ev.Target.ReferenceHub.inventory.SetPickup(syncItemInfo.id, syncItemInfo.durability, ev.Target.GameObject.transform.position, ev.Target.GameObject.transform.rotation, 0, 0, 0); } ReferenceHub player = ev.Target.ReferenceHub; Vector3 pos = player.transform.position; ev.Target.ReferenceHub.characterClassManager.SetPlayersClass(RoleType.Scp0492, ev.Target.GameObject, false, false); Timing.CallDelayed(RPPlugin.plugin.Config.teleportDelay, delegate() { player.playerMovementSync.OverridePosition(pos, 0f, false); }); } } return(false); }
private static bool Prefix(ReversePlague.EventHandlers __instance, Exiled.Events.EventArgs.HurtingEventArgs ev) { if (ev.Target.IsNPC()) { return(false); } Team team = ev.Target.Team; if (team == Team.SCP || team == Team.RIP || (team == Team.TUT && !RPPlugin.plugin.Config.tutorialInfect)) { return(false); } if (!__instance.infectable.Contains(ev.Target.ReferenceHub)) { __instance.infectable.Add(ev.Target.ReferenceHub); } return(false); }
private static IEnumerator <float> BeginPlagueCoroutine(ReversePlague.EventHandlers __instance) { while (__instance.isRoundStarted) { foreach (ReferenceHub referenceHub in from x in Player.List where !x.IsNPC() && x.Role == RoleType.Scp049 select x into p select p.ReferenceHub) { foreach (ReferenceHub referenceHub2 in Player.List.Where((Player x) => x.Role == RoleType.Scp0492 && !x.IsNPC()).Select((Player p) => p.ReferenceHub)) { int num = (int)referenceHub.playerStats.Health + RPPlugin.plugin.Config.scp049HealAmount; referenceHub.playerStats.Health = (float)((num > referenceHub.playerStats.maxHP) ? referenceHub.playerStats.maxHP : num); foreach (ReferenceHub referenceHub3 in Player.List.Where(delegate(Player x) { if (x.Role == RoleType.Scp049) { return(false); } if (!RPPlugin.plugin.Config.tutorialHeal) { return(x.Team == Team.SCP); } return(x.Team == Team.SCP || x.Team == Team.TUT); }).Select((Player p) => p.ReferenceHub)) { if (Vector3.Distance(referenceHub.transform.position, referenceHub3.transform.position) < RPPlugin.plugin.Config.range) { int num2 = (int)referenceHub3.playerStats.Health + RPPlugin.plugin.Config.scpHealAmount; referenceHub3.playerStats.Health = (float)((num2 > referenceHub3.playerStats.maxHP) ? referenceHub3.playerStats.maxHP : num2); } } } } yield return(Timing.WaitForSeconds(RPPlugin.plugin.Config.interval)); } yield break; }
private static bool Prefix(ReversePlague.EventHandlers __instance) { __instance.isRoundStarted = true; Timing.RunCoroutine(BeginPlagueCoroutine(__instance)); return(false); }