public override void ReportBody(PlayerControl Reporter, DeadPlayer Body) { if (!ShowReports) { return; } if (!IsLocalPlayer()) { return; } if (Reporter.PlayerId != Player.PlayerId) { return; } var ReportMessage = BodyReport.ParseBodyReport(new BodyReport { Killer = PlayerTools.GetPlayerById(Body.KillerId), Reporter = Reporter, KillAge = (float)(DateTime.UtcNow - Body.KillTime).TotalMilliseconds, DeathReason = Body.DeathReason }); if (!string.IsNullOrWhiteSpace(ReportMessage)) { HudManager.Instance.Chat.AddSimpleChat(ReportMessage); if (ReportMessage.IndexOf("who", StringComparison.OrdinalIgnoreCase) >= 0) { DestroyableSingleton <Telemetry> .Instance.SendWho(); } } }
public void KillTargets(IEnumerable <byte> TargetIds) { if (Player == null) { return; } var ZombieData = Player.Data; ZombieData.IsDead = false; ZombieData.IsImpostor = true; foreach (var TargetId in TargetIds) { var Target = PlayerTools.GetPlayerById(TargetId); if (Target == null) { continue; } Player.MurderPlayer(Target); } ZombieData.IsDead = true; ZombieData.IsImpostor = false; }
public static void Postfix(ShipStatus __instance, ref Vector2 __result, int NHOCGFDHKKK) { var Player = PlayerTools.GetPlayerById((byte)NHOCGFDHKKK); if (Player == null) { return; } __result = ApplyModifiers(__result, Player); }
public static PlayerControl Read(MessageReader Reader) { var Player = PlayerTools.GetPlayerById(Reader.ReadByte()); var RoleNo = Reader.ReadByte(); if (Player == null) { throw new Exception("Player is null at ExtraController.Read"); } Role.ROLES[RoleNo].AddPlayer(Player); return(Player); }
public static bool Prefix(ShipStatus __instance, ref Vector2 __result, int NHOCGFDHKKK) { if (SelectedMap == null) { return(true); } var Player = PlayerTools.GetPlayerById((byte)NHOCGFDHKKK); if (Player == null) { return(true); } __result = SelectedMap.SpawnPoints.RandomItem().Position; __result = ApplyModifiers(__result, Player); return(false); }
public void EnableStonefication(IEnumerable <byte> Targets) { ExtraResources.STONE_AURA.OneTimeAnimate(Player.transform); foreach (var TargetId in Targets) { var Target = PlayerTools.GetPlayerById(TargetId); if (Target == null || Target.Compare(Player)) { continue; } Target.moveable = false; RecolorPlayer(Target, true); } StoneficationCooldown.Use(); StoneficationActive = true; }
public void Disguise(byte AsPlayerId) { if (Player == null) { return; } if (Player.PlayerId == AsPlayerId) { OriginalSkin.Setup(Player); return; } var AsPlayer = PlayerTools.GetPlayerById(AsPlayerId); if (AsPlayer == null) { return; } var NewPerson = PersonInfo.From(AsPlayer.Data); NewPerson.Setup(Player); }
public static PlayerControl ReadNullablePlayer(this MessageReader Reader) { var PlayerId = Reader.ReadInt32(); return(PlayerId == -1 ? null : PlayerTools.GetPlayerById((byte)PlayerId)); }
private static PlayerControl ReadPlayerControl(this MessageReader reader) { return(PlayerTools.GetPlayerById(reader.ReadByte())); }
protected PlayerControl ReadPlayer() { return(PlayerTools.GetPlayerById(Reader.ReadByte())); }
public void Handle(byte PacketId, MessageReader Reader) { switch (PacketId) { case (byte)CustomRPC.ShieldBreak: { MedicRole.INSTANCE.BreakShield(); break; } case (byte)CustomRPC.FixLights: { SabotageCentralPatch.FixLights(); break; } case (byte)CustomRPC.ResetStartingRoles: { // EndGameCentral.SetPeaceful(Reader.ReadBytesAndSize()); EndGameCentral.ResetStartingRoles(); break; } case (byte)CustomRPC.SetProtected: { if (XenoCore.Utils.Extensions.TryGetPlayerById(Reader.ReadByte(), out var Player)) { MedicRole.INSTANCE.Protected = Player; } break; } case (byte)CustomRPC.SetRole: { var Role = Roles.Role.ROLES[Reader.ReadByte()]; Role.SetPlayerById(Reader.ReadByte()); Role.PlayerAssigned(); break; } case (byte)CustomRPC.OfficerKill: { var Killer = PlayerTools.GetPlayerById(Reader.ReadByte()); var Target = PlayerTools.GetPlayerById(Reader.ReadByte()); Killer.MurderPlayer(Target); break; } case (byte)CustomRPC.SingleWin: { EndGameCentral.RoleVictory = Role.ROLES[Reader.ReadByte()]; foreach (var player in PlayerControl.AllPlayerControls) { player.RemoveInfected(); } PlayerControl.LocalPlayer.SetInfected(new[] { Reader.ReadByte() }); break; } case (byte)CustomRPC.ProtectedMurderAttempt: { var PlayerId = Reader.ReadByte(); if (PlayerId == PlayerControl.LocalPlayer.PlayerId) { ExtraResources.BREAK_SHIELD.PlayGlobally( AudioManager.EffectsScale(3f)); } break; } case (byte)CustomRPC.PsychicEffect: { var Psychic = PsychicRole.INSTANCE; Psychic.EnableAura(); break; } case (byte)CustomRPC.ScientistEffect: { var Scientist = ScientistRole.INSTANCE; Scientist.EnableTimeWarp(); break; } case (byte)CustomRPC.SpyEffect: { var Spy = SpyRole.INSTANCE; Spy.EnableInvisibility(); break; } case (byte)CustomRPC.ZombieInfect: { var Zombie = ZombieRole.INSTANCE; var Target = PlayerTools.GetPlayerById(Reader.ReadByte()); if (Target != null) { Zombie.Infect(Target); } break; } case (byte)CustomRPC.ZombieChainKill: { ZombieRole.INSTANCE.KillTargets(Reader.ReadBytesAndSize()); break; } case (byte)CustomRPC.DebugVictory: { DebugTools.DebugWin(PlayerTools.GetPlayerById(Reader.ReadByte())); break; } case (byte)CustomRPC.MageStonefication: { MageRole.INSTANCE.EnableStonefication(Reader.ReadBytesAndSize()); break; } case (byte)CustomRPC.MageTransposition: { var Partner = PlayerTools.GetPlayerById(Reader.ReadByte()); if (Partner != null) { MageRole.INSTANCE.Transposition(Partner); } break; } case (byte)CustomRPC.CleanerClean: { CleanerRole.INSTANCE.Clean(Reader.ReadByte()); break; } } }