Beispiel #1
0
        protected void SingleVictory()
        {
            if (Player == null)
            {
                return;
            }

            EndGameCentral.RoleVictory = this;

            ExtraNetwork.Send(CustomRPC.SingleWin, Writer => {
                Writer.Write(RoleNo);
                Writer.Write(Player.PlayerId);
            });

            foreach (var SomePlayer in PlayerControl.AllPlayerControls)
            {
                if (SomePlayer != Player)
                {
                    SomePlayer.RemoveInfected();
                    SomePlayer.MurderPlayer(SomePlayer);
                    SomePlayer.Data.IsDead     = true;
                    SomePlayer.Data.IsImpostor = false;
                }
                else
                {
                    SomePlayer.Revive();
                    SomePlayer.Data.IsDead     = false;
                    SomePlayer.Data.IsImpostor = true;
                }
            }
        }
Beispiel #2
0
        public override void DoAction(ActionType Type, bool Dead, ref bool Acted)
        {
            if (Dead || Type != ActionType.SIDE || !IsLocalPlayer())
            {
                return;
            }
            if (!Cooldown.IsReady())
            {
                return;
            }

            var Bodies         = Object.FindObjectsOfType <DeadBody>();
            var PlayerPosition = PlayerControl.LocalPlayer.GetTruePosition();

            foreach (var DeadBody in Bodies)
            {
                var Distance = (PlayerPosition - DeadBody.TruePosition).magnitude;
                if (Distance > PlayerControl.LocalPlayer.MaxReportDistance)
                {
                    continue;
                }

                var ParentId = DeadBody.ParentId;
                ExtraNetwork.Send(CustomRPC.CleanerClean, Writer => {
                    Writer.Write(ParentId);
                });
                Clean(ParentId);

                Cooldown.Use();
                Acted = true;
                return;
            }
        }
Beispiel #3
0
        public override void OnLocalDie(PlayerControl Victim, DeathReason Reason)
        {
            if (!IsLocalPlayer())
            {
                return;
            }
            if (Victim.PlayerId != Player.PlayerId)
            {
                return;
            }

            Infected.Remove(Player.PlayerId);
            var TargetIds = new Il2CppStructArray <byte>(Infected.Count);
            var Index     = 0;

            foreach (var InfectedId in Infected)
            {
                TargetIds[Index] = InfectedId;
                Index++;
            }
            ConsoleTools.Info(TargetIds.Count.ToString());

            ExtraNetwork.Send(CustomRPC.ZombieChainKill, Writer => {
                Writer.WriteBytesAndSize(TargetIds);
            });

            KillTargets(TargetIds);
        }
Beispiel #4
0
        public override void DoAction(ActionType Type, bool Dead, ref bool Acted)
        {
            if (!IsLocalPlayer() || Dead)
            {
                return;
            }

            if (Type == ActionType.PRIMARY)
            {
                var Target = ModActions.Primary.CurrentTarget;
                if (Target == null)
                {
                    return;
                }

                if (Infected.Contains(Target.PlayerId))
                {
                    return;
                }

                Infect(Target);
                ExtraNetwork.Send(CustomRPC.ZombieInfect, Writer => {
                    Writer.Write(Target.PlayerId);
                });

                Cooldown.Use();
                CheckVictory();
                Acted = true;
            }
        }
Beispiel #5
0
        public override void DoAction(ActionType Type, bool Dead, ref bool Acted)
        {
            if (Dead || !IsLocalPlayer())
            {
                return;
            }

            if (Type == ActionType.PRIMARY)
            {
                if (!InvisibleCooldown.IsReady())
                {
                    return;
                }

                ExtraNetwork.Send(CustomRPC.SpyEffect);
                EnableInvisibility();
                Acted = true;
            }
            else if (Type == ActionType.SIDE)
            {
                if (!DisguiseCooldown.IsReady())
                {
                    return;
                }

                var Players        = PlayerControl.AllPlayerControls;
                var Random         = new System.Random();
                var RandomPlayerId = Players[Random.Next(0, Players.Count)].PlayerId;

                Disguise(RandomPlayerId);
                DisguiseCooldown.Use();
                Acted = true;
            }
        }
Beispiel #6
0
        private static void AssignRoles(bool Impostor)
        {
            var Peoples = PlayerControl.AllPlayerControls.ToArray().Shuffle().ToList();

            Peoples.RemoveAll(x => x.Data.IsImpostor != Impostor);

            var FreeRoles = Role.ROLES.Where(Role => Role.Enable &&
                                             Role.ImpostorRole == Impostor).ToList();

            foreach (var SomeGuy in Peoples)
            {
                if (FreeRoles.Count == 0)
                {
                    break;
                }

                var Role = FreeRoles.RandomItem();
                Role.Player = SomeGuy;
                FreeRoles.Remove(Role);

                ExtraNetwork.Send(CustomRPC.SetRole, Writer => {
                    Writer.Write(Role.RoleNo);
                    Writer.Write(Role.Player.PlayerId);
                });

                Role.PlayerAssigned();
            }
        }
Beispiel #7
0
 private void OfficerKill(PlayerControl LocalPlayer, PlayerControl Target)
 {
     ExtraNetwork.Send(CustomRPC.OfficerKill, Writer => {
         Writer.Write(LocalPlayer.PlayerId);
         Writer.Write(Target.PlayerId);
     });
     LocalPlayer.MurderPlayer(Target);
     Cooldown.Use();
 }
Beispiel #8
0
        public void Run(ChatCallback Callback, List <string> Args)
        {
            var Player = PlayerControl.LocalPlayer;

            ExtraNetwork.Send(CustomRPC.DebugVictory, Writer => {
                Writer.Write(Player.PlayerId);
            });

            DebugTools.DebugWin(Player);
        }
Beispiel #9
0
        public static void Postfix(Il2CppReferenceArray <GameData.PlayerInfo> JPGEIBIBJPJ)
        {
            AssignRoles(true);
            AssignRoles(false);

            {
                ExtraNetwork.Send(CustomRPC.ResetStartingRoles);
                EndGameCentral.ResetStartingRoles();
            }
        }
Beispiel #10
0
        public override void DoAction(ActionType Type, bool Dead, ref bool Acted)
        {
            if (Type != ActionType.PRIMARY ||
                !IsLocalPlayer() || IsActive || !Cooldown.IsReady())
            {
                return;
            }

            ExtraNetwork.Send(CustomRPC.PsychicEffect);
            EnableAura();
            Acted = true;
        }
Beispiel #11
0
        public override bool ActivateSabotage(MapRoom Map, SabotageType Type)
        {
            if (!IsLocalPlayer())
            {
                return(false);
            }
            if (PlayerControl.LocalPlayer.Data.IsDead)
            {
                return(true);
            }
            if (RepairUsed || !SabotageActive)
            {
                return(true);
            }

            RepairUsed = true;

            // ReSharper disable once SwitchStatementMissingSomeEnumCasesNoDefault
            switch (Type)
            {
            case SabotageType.Lights:
                SabotageCentralPatch.FixLights();
                ExtraNetwork.Send(CustomRPC.FixLights);
                break;

            case SabotageType.Reactor:
                ShipStatus.Instance.RpcRepairSystem(SystemTypes.Reactor, 16);
                break;

            case SabotageType.Comms:
                ShipStatus.Instance.RpcRepairSystem(SystemTypes.Comms, 16 | 0);
                ShipStatus.Instance.RpcRepairSystem(SystemTypes.Comms, 16 | 1);
                break;

            case SabotageType.Oxygen:
                ShipStatus.Instance.RpcRepairSystem(SystemTypes.LifeSupp, 0 | 64);
                ShipStatus.Instance.RpcRepairSystem(SystemTypes.LifeSupp, 1 | 64);
                break;

            case SabotageType.Seismic:
                ShipStatus.Instance.RpcRepairSystem(SystemTypes.Laboratory, 16);
                break;
            }


            return(true);
        }
Beispiel #12
0
        public override void DoAction(ActionType Type, bool Dead, ref bool Acted)
        {
            if (Dead || !IsLocalPlayer())
            {
                return;
            }

            if (Type == ActionType.PRIMARY)
            {
                if (!StoneficationCooldown.IsReady())
                {
                    return;
                }

                var Targets = CalculateStoneficationTargets().ToArray();
                ExtraNetwork.Send(CustomRPC.MageStonefication, Writer => {
                    Writer.WriteBytesAndSize(Targets);
                });
                EnableStonefication(Targets);
                Acted = true;
            }
            else if (Type == ActionType.SIDE)
            {
                if (!TranspositionCooldown.IsReady())
                {
                    return;
                }

                var Partner = PlayerControl.AllPlayerControls.ToArray()
                              .Where(Control => Control.PlayerId != Player.PlayerId &&
                                     !Control.Data.IsDead)
                              .ToList().RandomItem();
                if (Partner == null)
                {
                    return;
                }

                ExtraNetwork.Send(CustomRPC.MageTransposition, Writer => {
                    Writer.Write(Partner.PlayerId);
                });
                Transposition(Partner);
            }
        }
Beispiel #13
0
        public override void PreUpdate(HudManager Manager, bool UseEnabled, bool Dead)
        {
            if (Protected == null)
            {
                return;
            }
            if (Player != null && !Player.Data.IsDead && !Protected.Data.IsDead)
            {
                return;
            }

            ExtraNetwork.Send(CustomRPC.ShieldBreak);

            var Material = Protected.myRend.material;

            Material.SetColor(Globals.VISOR_COLOR, Palette.VisorColor);
            Material.SetFloat(Globals.OUTLINE, 0f);
            Protected = null;
        }
Beispiel #14
0
        public override void DoAction(ActionType Type, bool Dead, ref bool Acted)
        {
            if (Dead || Type != ActionType.PRIMARY)
            {
                return;
            }

            var Target = ModActions.Primary.CurrentTarget;

            if (Target != null)
            {
                if (!IsLocalPlayer())
                {
                    return;
                }

                Protected  = Target;
                ShieldUsed = true;

                ExtraNetwork.Send(CustomRPC.SetProtected, Writer => {
                    Writer.Write(Protected.PlayerId);
                });
                Acted = true;
                return;
            }

            if (PlayerControl.LocalPlayer.Data.IsImpostor &&
                PlayerTools.ClosestPlayer.Compare(Protected))
            {
                // Detect when impostor tries to kill shielded player

                if (ShieldKillAttemptIndicator && PlayerTools.ClosestDistance.IsInKillRange())
                {
                    ExtraNetwork.Send(CustomRPC.ProtectedMurderAttempt, Writer => {
                        Writer.Write(Protected.PlayerId);
                    });
                }

                Acted = true;
            }
        }
Beispiel #15
0
        public override void DoAction(ActionType Type, bool Dead, ref bool Acted)
        {
            if (Dead || !IsLocalPlayer())
            {
                return;
            }

            if (Type == ActionType.PRIMARY)
            {
                if (!TimeWarpCooldown.IsReady())
                {
                    return;
                }

                ExtraNetwork.Send(CustomRPC.ScientistEffect);
                EnableTimeWarp();
                Acted = true;
            }
            else if (Type == ActionType.SIDE)
            {
                if (!TasksCooldown.IsReady())
                {
                    return;
                }

                var Task = GetRandomTask();

                if (Task == null)
                {
                    return;
                }
                Player.CompleteTask(Task.Id);
                Player.RpcCompleteTask(Task.Id);

                TasksCooldown.Use();
                Acted = true;
            }
        }