Exemple #1
0
            public static void Prefix([HarmonyArgument(0)] ref Il2CppReferenceArray <GameData.PlayerInfo> infected)
            {
                Utils.ShowDeadBodies = false;
                Role.NobodyWins      = false;
                CrewmateRoles.Clear();
                NeutralRoles.Clear();
                ImpostorRoles.Clear();
                CrewmateModifiers.Clear();
                ImpostorModifiers.Clear();
                GlobalModifiers.Clear();

                RecordRewind.points.Clear();
                Murder.KilledPlayers.Clear();
                KillButtonTarget.DontRevive = byte.MaxValue;

                var startWriter = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId,
                                                                             (byte)CustomRPC.Start, SendOption.Reliable, -1);

                AmongUsClient.Instance.FinishRpcImmediately(startWriter);


                LoversOn  = Check(CustomGameOptions.LoversOn);
                PhantomOn = Check(CustomGameOptions.PhantomOn);

                #region Crewmate Roles
                if (Check(CustomGameOptions.MayorOn))
                {
                    CrewmateRoles.Add((typeof(Mayor), CustomRPC.SetMayor, CustomGameOptions.MayorOn));
                }

                if (Check(CustomGameOptions.SheriffOn))
                {
                    CrewmateRoles.Add((typeof(Sheriff), CustomRPC.SetSheriff, CustomGameOptions.SheriffOn));
                }

                if (Check(CustomGameOptions.EngineerOn))
                {
                    CrewmateRoles.Add((typeof(Engineer), CustomRPC.SetEngineer, CustomGameOptions.EngineerOn));
                }

                if (Check(CustomGameOptions.SwapperOn))
                {
                    CrewmateRoles.Add((typeof(Swapper), CustomRPC.SetSwapper, CustomGameOptions.SwapperOn));
                }

                if (Check(CustomGameOptions.InvestigatorOn))
                {
                    CrewmateRoles.Add((typeof(Investigator), CustomRPC.SetInvestigator, CustomGameOptions.InvestigatorOn));
                }

                if (Check(CustomGameOptions.TimeLordOn))
                {
                    CrewmateRoles.Add((typeof(TimeLord), CustomRPC.SetTimeLord, CustomGameOptions.TimeLordOn));
                }

                if (Check(CustomGameOptions.MedicOn))
                {
                    CrewmateRoles.Add((typeof(Medic), CustomRPC.SetMedic, CustomGameOptions.MedicOn));
                }

                if (Check(CustomGameOptions.SeerOn))
                {
                    CrewmateRoles.Add((typeof(Seer), CustomRPC.SetSeer, CustomGameOptions.SeerOn));
                }

                if (Check(CustomGameOptions.SpyOn))
                {
                    CrewmateRoles.Add((typeof(Spy), CustomRPC.SetSpy, CustomGameOptions.SpyOn));
                }

                if (Check(CustomGameOptions.SnitchOn))
                {
                    CrewmateRoles.Add((typeof(Snitch), CustomRPC.SetSnitch, CustomGameOptions.SnitchOn));
                }

                if (Check(CustomGameOptions.AltruistOn))
                {
                    CrewmateRoles.Add((typeof(Altruist), CustomRPC.SetAltruist, CustomGameOptions.AltruistOn));
                }

                if (Check(CustomGameOptions.ProphetOn))
                {
                    CrewmateRoles.Add((typeof(Prophet), CustomRPC.SetProphet, CustomGameOptions.ProphetOn));
                }

                if (Check(CustomGameOptions.CovertOn))
                {
                    CrewmateRoles.Add((typeof(Covert), CustomRPC.SetCovert, CustomGameOptions.CovertOn));
                }
                #endregion
                #region Neutral Roles
                if (Check(CustomGameOptions.ArsonistOn))
                {
                    NeutralRoles.Add((typeof(Arsonist), CustomRPC.SetArsonist, CustomGameOptions.ArsonistOn));
                }

                if (Check(CustomGameOptions.ExecutionerOn))
                {
                    NeutralRoles.Add((typeof(Executioner), CustomRPC.SetExecutioner, CustomGameOptions.ExecutionerOn));
                }

                if (Check(CustomGameOptions.JesterOn))
                {
                    NeutralRoles.Add((typeof(Jester), CustomRPC.SetJester, CustomGameOptions.JesterOn));
                }

                if (Check(CustomGameOptions.ShifterOn))
                {
                    NeutralRoles.Add((typeof(Shifter), CustomRPC.SetShifter, CustomGameOptions.ShifterOn));
                }

                if (Check(CustomGameOptions.GlitchOn))
                {
                    NeutralRoles.Add((typeof(Glitch), CustomRPC.SetGlitch, CustomGameOptions.GlitchOn));
                }
                #endregion
                #region Impostor Roles
                if (Check(CustomGameOptions.UndertakerOn))
                {
                    ImpostorRoles.Add((typeof(Undertaker), CustomRPC.SetUndertaker, CustomGameOptions.UndertakerOn));
                }

                if (Check(CustomGameOptions.UnderdogOn))
                {
                    ImpostorRoles.Add((typeof(Underdog), CustomRPC.SetUnderdog, CustomGameOptions.UnderdogOn));
                }

                if (Check(CustomGameOptions.MorphlingOn))
                {
                    ImpostorRoles.Add((typeof(Morphling), CustomRPC.SetMorphling, CustomGameOptions.MorphlingOn));
                }

                if (Check(CustomGameOptions.CamouflagerOn))
                {
                    ImpostorRoles.Add((typeof(Camouflager), CustomRPC.SetCamouflager, CustomGameOptions.CamouflagerOn));
                }

                if (Check(CustomGameOptions.MinerOn))
                {
                    ImpostorRoles.Add((typeof(Miner), CustomRPC.SetMiner, CustomGameOptions.MinerOn));
                }

                if (Check(CustomGameOptions.SwooperOn))
                {
                    ImpostorRoles.Add((typeof(Swooper), CustomRPC.SetSwooper, CustomGameOptions.SwooperOn));
                }

                if (Check(CustomGameOptions.JanitorOn))
                {
                    ImpostorRoles.Add((typeof(Janitor), CustomRPC.SetJanitor, CustomGameOptions.JanitorOn));
                }

                if (Check(CustomGameOptions.TeleporterOn))
                {
                    ImpostorRoles.Add((typeof(Teleporter), CustomRPC.SetTeleporter, CustomGameOptions.TeleporterOn));
                }

                if (Check(CustomGameOptions.ConcealerOn))
                {
                    ImpostorRoles.Add((typeof(Concealer), CustomRPC.SetConcealer, CustomGameOptions.ConcealerOn));
                }

                if (Check(CustomGameOptions.GrenadierOn))
                {
                    ImpostorRoles.Add((typeof(Grenadier), CustomRPC.SetGrenadier, CustomGameOptions.GrenadierOn));
                }
                #endregion
                #region Crewmate Modifiers
                if (Check(CustomGameOptions.TorchOn))
                {
                    CrewmateModifiers.Add((typeof(Torch), CustomRPC.SetTorch, CustomGameOptions.TorchOn));
                }

                if (Check(CustomGameOptions.DiseasedOn))
                {
                    CrewmateModifiers.Add((typeof(Diseased), CustomRPC.SetDiseased, CustomGameOptions.DiseasedOn));
                }
                #endregion
                #region Global Modifiers
                if (Check(CustomGameOptions.TiebreakerOn))
                {
                    GlobalModifiers.Add((typeof(Tiebreaker), CustomRPC.SetTiebreaker, CustomGameOptions.TiebreakerOn));
                }

                if (Check(CustomGameOptions.FlashOn))
                {
                    GlobalModifiers.Add((typeof(Flash), CustomRPC.SetFlash, CustomGameOptions.FlashOn));
                }

                if (Check(CustomGameOptions.DrunkOn))
                {
                    GlobalModifiers.Add((typeof(Drunk), CustomRPC.SetDrunk, CustomGameOptions.DrunkOn));
                }

                if (Check(CustomGameOptions.BigBoiOn))
                {
                    GlobalModifiers.Add((typeof(BigBoiModifier), CustomRPC.SetBigBoi, CustomGameOptions.BigBoiOn));
                }

                if (Check(CustomGameOptions.ButtonBarryOn))
                {
                    GlobalModifiers.Add(
                        (typeof(ButtonBarry), CustomRPC.SetButtonBarry, CustomGameOptions.ButtonBarryOn));
                }

                if (Check(CustomGameOptions.AnthropomancerOn))
                {
                    GlobalModifiers.Add(
                        (typeof(Coroner), CustomRPC.SetCoroner, CustomGameOptions.AnthropomancerOn));
                }

                if (Check(CustomGameOptions.CarnivoreOn))
                {
                    ImpostorModifiers.Add(
                        (typeof(Carnivore), CustomRPC.SetCarnivore, CustomGameOptions.CarnivoreOn));
                }
                #endregion
                GenEachRole(infected.ToList());
            }
Exemple #2
0
            public static void Prefix([HarmonyArgument(0)] Il2CppReferenceArray <GameData.PlayerInfo> infected)
            {
                //System.Console.WriteLine("REACHED HERE");
                Utils.ShowDeadBodies = false;
                Role.NobodyWins      = false;
                CrewmateRoles.Clear();
                NeutralRoles.Clear();
                ImpostorRoles.Clear();
                CrewmateModifiers.Clear();
                GlobalModifiers.Clear();



                //TODO - Instantiate role-specific stuff

                /*EngineerMod.PerformKill.UsedThisRound = false;
                 * EngineerMod.PerformKill.SabotageTime = DateTime.UtcNow.AddSeconds(-100);*/
                TimeLordMod.RecordRewind.points.Clear();
                MedicMod.Murder.KilledPlayers.Clear();
                AltruistMod.KillButtonTarget.DontRevive = byte.MaxValue;

                var startWriter = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId,
                                                                             (byte)CustomRPC.Start, SendOption.Reliable, -1);

                AmongUsClient.Instance.FinishRpcImmediately(startWriter);

                var crewmates = Utils.getCrewmates(infected);


                LoversOn = Check(CustomGameOptions.LoversOn);


                if (Check(CustomGameOptions.MayorOn))
                {
                    CrewmateRoles.Add((typeof(Mayor), CustomRPC.SetMayor));
                }

                if (Check(CustomGameOptions.JesterOn))
                {
                    NeutralRoles.Add((typeof(Jester), CustomRPC.SetJester));
                }

                if (Check(CustomGameOptions.SheriffOn))
                {
                    CrewmateRoles.Add((typeof(Sheriff), CustomRPC.SetSheriff));
                }

                if (Check(CustomGameOptions.EngineerOn))
                {
                    CrewmateRoles.Add((typeof(Engineer), CustomRPC.SetEngineer));
                }

                if (Check(CustomGameOptions.SwapperOn))
                {
                    CrewmateRoles.Add((typeof(Swapper), CustomRPC.SetSwapper));
                }

                if (Check(CustomGameOptions.ShifterOn))
                {
                    NeutralRoles.Add((typeof(Shifter), CustomRPC.SetShifter));
                }

                if (Check(CustomGameOptions.InvestigatorOn) && PlayerControl.GameOptions.MapId != 4)
                {
                    CrewmateRoles.Add((typeof(Investigator), CustomRPC.SetInvestigator));
                }

                if (Check(CustomGameOptions.TimeLordOn))
                {
                    CrewmateRoles.Add((typeof(TimeLord), CustomRPC.SetTimeLord));
                }

                if (Check(CustomGameOptions.MedicOn))
                {
                    CrewmateRoles.Add((typeof(Medic), CustomRPC.SetMedic));
                }

                if (Check(CustomGameOptions.GlitchOn))
                {
                    NeutralRoles.Add((typeof(Glitch), CustomRPC.SetGlitch));
                }

                if (Check(CustomGameOptions.SeerOn))
                {
                    CrewmateRoles.Add((typeof(Seer), CustomRPC.SetSeer));
                }

                if (Check(CustomGameOptions.TorchOn))
                {
                    CrewmateModifiers.Add((typeof(Torch), CustomRPC.SetTorch));
                }

                if (Check(CustomGameOptions.DiseasedOn))
                {
                    CrewmateModifiers.Add((typeof(Diseased), CustomRPC.SetDiseased));
                }

                if (Check(CustomGameOptions.MorphlingOn))
                {
                    ImpostorRoles.Add((typeof(Morphling), CustomRPC.SetMorphling));
                }

                if (Check(CustomGameOptions.ChildOn))
                {
                    CrewmateRoles.Add((typeof(Child), CustomRPC.SetChild));
                }

                if (Check(CustomGameOptions.CamouflagerOn))
                {
                    ImpostorRoles.Add((typeof(Camouflager), CustomRPC.SetCamouflager));
                }

                if (Check(CustomGameOptions.SpyOn))
                {
                    CrewmateRoles.Add((typeof(Spy), CustomRPC.SetSpy));
                }

                if (Check(CustomGameOptions.SnitchOn))
                {
                    CrewmateRoles.Add((typeof(Snitch), CustomRPC.SetSnitch));
                }

                if (Check(CustomGameOptions.MinerOn))
                {
                    ImpostorRoles.Add((typeof(Miner), CustomRPC.SetMiner));
                }

                if (Check(CustomGameOptions.SwooperOn))
                {
                    ImpostorRoles.Add((typeof(Swooper), CustomRPC.SetSwooper));
                }

                if (Check(CustomGameOptions.TiebreakerOn))
                {
                    GlobalModifiers.Add((typeof(Tiebreaker), CustomRPC.SetTiebreaker));
                }

                if (Check(CustomGameOptions.FlashOn))
                {
                    GlobalModifiers.Add((typeof(Flash), CustomRPC.SetFlash));
                }

                if (Check(CustomGameOptions.JanitorOn))
                {
                    ImpostorRoles.Add((typeof(Janitor), CustomRPC.SetJanitor));
                }

                if (Check(CustomGameOptions.DrunkOn))
                {
                    GlobalModifiers.Add((typeof(Drunk), CustomRPC.SetDrunk));
                }

                if (Check(CustomGameOptions.ArsonistOn))
                {
                    NeutralRoles.Add((typeof(Arsonist), CustomRPC.SetArsonist));
                }

                if (Check(CustomGameOptions.ExecutionerOn))
                {
                    NeutralRoles.Add((typeof(Executioner), CustomRPC.SetExecutioner));
                }

                if (Check(CustomGameOptions.AltruistOn))
                {
                    CrewmateRoles.Add((typeof(Altruist), CustomRPC.SetAltruist));
                }

                if (Check(CustomGameOptions.BigBoiOn))
                {
                    GlobalModifiers.Add((typeof(BigBoi), CustomRPC.SetBigBoi));
                }

                if (Check(CustomGameOptions.ButtonBarryOn))
                {
                    GlobalModifiers.Add((typeof(ButtonBarry), CustomRPC.SetButtonBarry));
                }

                GenEachRole(infected.ToList());
            }