Example #1
0
        public static AmongUsClient getAmongUsClient()
        {
            AmongUsClient client = new AmongUsClient();

            byte[] clientAob  = Cheese.mem.ReadBytes(Pattern.AmongusClient_Pointer, Utils.SizeOf <AmongUsClient>());
            var    aobStr     = MakeAobString(clientAob, 4, "00 00 00 00 ?? ?? ?? ??");
            var    aobResults = Cheese.mem.AoBScan(aobStr, true, true);

            aobResults.Wait();
            foreach (var result in aobResults.Result)
            {
                byte[]        resultByte = Cheese.mem.ReadBytes(result.GetAddress(), Utils.SizeOf <AmongUsClient>());
                AmongUsClient resultInst = Utils.FromBytes <AmongUsClient>(resultByte);
                Console.WriteLine(result.GetAddress());
                Console.WriteLine(resultInst.timer + " | " + resultInst.IsGamePublic + " | " + ClientData.gameState(new IntPtr((int)result)) + " | " + resultInst.SpawnRadius + " | " + ClientData.state(new IntPtr((int)result)) + " | " + ClientData.gameMode(new IntPtr((int)result)) + " | " + (resultInst.allObjects != IntPtr.Zero));
                if (resultInst.SpawnRadius > 0.2)
                {
                    client        = resultInst;
                    amongUsClient = client;
                    //amongUsClientPtr = result.GetAddress();
                    amongUsClientPtr = new IntPtr((int)result);
                    //Console.WriteLine(result.GetAddress());
                }
            }
            return(client);
        }
        // Figure out which scanned 'AmongUsClients' is the actual one used
        public static AmongUsClient GetAmongUsClient()
        {
            AmongUsClient client = new AmongUsClient();

            byte[] clientAob = AmongUsMemory.Main.mem.ReadBytes(Pattern.AmongusClient_Pointer, Utils.SizeOf <AmongUsClient>());
            string aobStr    = AmongUsMemory.Main.MakeAobString(clientAob, 4, "?? ?? ?? ??");
            Task <IEnumerable <long> > aobResults = AmongUsMemory.Main.mem.AoBScan(aobStr, true, true);

            aobResults.Wait();
            foreach (long result in aobResults.Result)
            {
                byte[]        resultByte = AmongUsMemory.Main.mem.ReadBytes(result.GetAddress(), Utils.SizeOf <AmongUsClient>());
                AmongUsClient resultInst = Utils.FromBytes <AmongUsClient>(resultByte);
                client = resultInst;

                Type t = resultInst.GetType(); // Where obj is object whose properties you need.
                System.Reflection.PropertyInfo[] pi = t.GetProperties();
                Console.WriteLine(result.GetAddress());
                foreach (System.Reflection.PropertyInfo p in pi)
                {
                    System.Console.WriteLine(p.Name + " : " + p.GetValue(resultInst));
                }
            }
            return(client);
        }
Example #3
0
 public static void Postfix(AmongUsClient __instance, ref GameOverReason gameOverReason, bool showAd)
 {
     MuteBot.LogInfo("OnGameEndPatch");
     MuteBot.GetInstance().isGameEnded = true;
     Task.Run(() => MuteBot.UpdateStatus(GameStatus.Lobby));
     return;
 }
Example #4
0
        static void Main(string[] args)
        {
            // Cheat Init
            if (HamsterCheese.AmongUsMemory.Cheese.Init())
            {
                // Update Player Data When Every Game
                HamsterCheese.AmongUsMemory.Cheese.ObserveShipStatus((x) =>
                {
                    //stop observe state for init.
                    foreach (var player in playerDatas)
                    {
                        player.StopObserveState();
                    }


                    playerDatas        = HamsterCheese.AmongUsMemory.Cheese.GetAllPlayers();
                    client             = HamsterCheese.AmongUsMemory.Cheese.GetClient();
                    ship               = HamsterCheese.AmongUsMemory.Cheese.GetShipStatus();
                    gamecode           = HamsterCheese.AmongUsMemory.Cheese.GetGameCode();
                    old_meeting_status = HamsterCheese.AmongUsMemory.Cheese.GetMeetingStatus();
                });

                // Cheat Logic
                CancellationTokenSource cts = new CancellationTokenSource();
                Task.Factory.StartNew(
                    UpdateCheat
                    , cts.Token);
            }

            System.Threading.Thread.Sleep(1000000);
        }
Example #5
0
 public static void Prefix(AmongUsClient __instance, [HarmonyArgument(0)] ref GameOverReason reason, [HarmonyArgument(1)] bool showAd)
 {
     gameOverReason = reason;
     if ((int)reason >= 10)
     {
         reason = GameOverReason.ImpostorByKill;
     }
 }
Example #6
0
 public static void Postfix(AmongUsClient __instance, [HarmonyArgument(0)] GameOverReason reason, [HarmonyArgument(0)] bool showAd)
 {
     Utils.potentialWinners.Clear();
     foreach (var player in PlayerControl.AllPlayerControls)
     {
         Utils.potentialWinners.Add(new WinningPlayerData(player.Data));
     }
 }
Example #7
0
 public static void Prefix(AmongUsClient __instance, ref GameOverReason FCBGPMEMOJB, bool GKFHPFPIHGA)
 {
     gameOverReason = FCBGPMEMOJB;
     if ((int)FCBGPMEMOJB >= 10)
     {
         FCBGPMEMOJB = GameOverReason.ImpostorByKill;
     }
 }
        public static void Postfix(AmongUsClient __instance, ref GameOverReason NEPMFBMGGLF, bool FBEKDLNKNLL)
        {
            Recorder.LogInfo("OnGameEndPatch");
            GameOverReason gameOverReason = NEPMFBMGGLF;

            Task.Run(() => Recorder.EndGame(gameOverReason));
            return;
        }
Example #9
0
 public static void Postfix(AmongUsClient __instance, [HarmonyArgument(0)] ClientData client)
 {
     if (PlayerControl.LocalPlayer != null)
     {
         Helpers.shareGameVersion();
     }
     Logger.info($"Player \"{client.PlayerName}(ID:{client.Id})\" Joined", "Session");
 }
Example #10
0
 public static void Prefix(AmongUsClient __instance, ref GameOverReason OFLKLGMHBEL, bool JFFPAKGPNJA)
 {
     gameOverReason = OFLKLGMHBEL;
     if ((int)OFLKLGMHBEL >= 10)
     {
         OFLKLGMHBEL = GameOverReason.ImpostorByKill;
     }
 }
Example #11
0
 public static void Prefix(AmongUsClient __instance, ref GameOverReason NEPMFBMGGLF, bool FBEKDLNKNLL)
 {
     gameOverReason = NEPMFBMGGLF;
     if ((int)NEPMFBMGGLF >= 10)
     {
         NEPMFBMGGLF = GameOverReason.ImpostorByKill;
     }
 }
Example #12
0
 public static void Postfix(AmongUsClient __instance)
 {
     foreach (AssetReference objRef in __instance.ShipPrefabs)
     {
         GameObject obj = (GameObject)objRef.Asset;
         AssetDB.ImportMap(obj);
     }
     LILogger.LogInfo("Found and stored prefabs");
 }
Example #13
0
 public static void Postfix(AmongUsClient __instance)
 {
     LILogger.LogInfo("Loading Ship Prefabs...");
     foreach (AssetReference assetRef in __instance.ShipPrefabs)
     {
         assetRef.LoadAsset <GameObject>();
     }
     MapHandler.Load();
 }
Example #14
0
            public static void Postfix(AmongUsClient __instance, [HarmonyArgument(0)] ClientData data)
            {
                if (AmongUsClient.Instance.AmHost && __instance.GameState == InnerNetClient.GameStates.Started)
                {
                    PluginSingleton <TownOfUs> .Instance.Log.LogMessage($"Am host and clientId {data.Id} sent JoinGameResponse");

                    Coroutines.Start(WaitForHandshake(__instance, data.Id));
                }
            }
Example #15
0
 public static bool Prefix(AmongUsClient __instance, [HarmonyArgument(0)] ClientData client)
 {
     if (LobbyLimit < __instance.allClients.Count)   // TODO: Fix this canceling start
     {
         DisconnectPlayer(__instance, client.Id);
         return(false);
     }
     return(true);
 }
Example #16
0
 public static void Postfix(AmongUsClient __instance)
 {
     if (__instance.AmHost)
     {
         LILogger.LogInfo("Player Joined: Sending map checksum...");
         var writer = __instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, 42, SendOption.Reliable, -1);
         writer.Write(MapHandler.checksum);
         __instance.FinishRpcImmediately(writer);
     }
 }
Example #17
0
 public static bool Prefix1(AmongUsClient __instance, AMGMAKBHCMN NEPMFBMGGLF, bool FBEKDLNKNLL)
 {
     if (FBEKDLNKNLL)
     {
         LoveCoupleMod.log.LogInfo("Love couple wins");
         PlayerControlPatch.LoveCoupleWins();
         FBEKDLNKNLL = false;
     }
     return(true);
 }
Example #18
0
        public static void Postfix([HarmonyArgument(0)] byte callId, [HarmonyArgument(1)] MessageReader reader)
        {
            if (callId != 42)
            {
                return;
            }

            string checksum = reader.ReadString();

            if (checksum != MapHandler.checksum)
            {
                LILogger.LogWarn("Received map checksum does not match! (" + checksum + " => " + MapHandler.checksum + ")");

                AmongUsClient client = AmongUsClient.Instance;
                client.LastDisconnectReason = DisconnectReasons.Custom;
                client.LastCustomDisconnect = "Host is using a different map than client";
                client.HandleDisconnect(client.LastDisconnectReason, client.LastCustomDisconnect);
            }
        }
Example #19
0
        public static AmongUsClient GetClient()
        {
            AmongUsClient amongUsClient = new AmongUsClient();

            byte[] clientAob  = Cheese.mem.ReadBytes(Pattern.AmongusClient_Pointer, Utils.SizeOf <AmongUsClient>());
            var    aobStr     = MakeAobString(clientAob, 4, "00 00 00 00 ?? ?? ?? ??");
            var    aobResults = Cheese.mem.AoBScan(aobStr, true, true);

            aobResults.Wait();
            foreach (var result in aobResults.Result)
            {
                byte[]        resultByte = Cheese.mem.ReadBytes(result.GetAddress(), Utils.SizeOf <ShipStatus>());
                AmongUsClient resultInst = Utils.FromBytes <AmongUsClient>(resultByte);
                if (resultInst.connection != IntPtr.Zero && resultInst.GameId != 0 && resultInst.GameState < 1000)
                {
                    amongUsClient = resultInst;
                    //Console.WriteLine($"AmongUsClient selected {result.GetAddress()}");
                }
            }
            return(amongUsClient);
        }
Example #20
0
        public static void Postfix1(AmongUsClient __instance, ClientData MLPPNIKICPC, GABADEGMIHF AMGCOJNIHLM)
        {
            MLPPNIKICPC.Character.FIMGDJOCIGD.IAGJEKLJCCI = true;

            if (PlayerController.players != null)
            {
                if (AmongUsClient.Instance.ClientId == AmongUsClient.Instance.HostId)
                {
                    EndReason reason = Love.CheckWin();

                    if (reason == EndReason.LoveWin)
                    {
                        MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(InnerPlayerControl.LocalPlayer.NetId, (byte)CustomRPC.LoveWin, Hazel.SendOption.Reliable, -1);
                        writer.Write((byte)reason);
                        AmongUsClient.Instance.FinishRpcImmediately(writer);

                        PlayerControlPatch.LoveCoupleWins();
                        ShipStatus.EABBNOODFGL(AMGMAKBHCMN.ImpostorByVote, false);
                    }
                }
            }
        }
Example #21
0
        public static async Task Connect(string ipAddress, string Lobby)
        {
            Client = new AmongUsClient();

            Client.OnConnect    += () => WriteMessage(new { type = "connect" });
            Client.OnDisconnect += () =>
            {
                WriteMessage(new { type = "disconnect" });
                Environment.Exit(0);
            };
            Client.OnTalkingEnd       += () => WriteMessage(new { type = "talkingEnd" });
            Client.OnTalkingStart     += () => WriteMessage(new { type = "talkingStart" });
            Client.OnGameEnd          += () => WriteMessage(new { type = "gameEnd" });
            Client.OnPlayerDataUpdate += data => WriteMessage(new { type = "gameData", data });

            try
            {
                await Client.Connect(IPAddress.Parse(ipAddress), Lobby);
            }
            catch (AUException ex)
            {
                WriteMessage(new { type = "error", message = ex.Message });
                return;
            }

            // Trap ctrlc (SIGINT) to disconnect before terminating.
            Console.CancelKeyPress += (sender, ev) =>
            {
                ev.Cancel = true; // cancel direct shutdown, so we can disconnect and then kill ourselves
                Client.DisconnectAndExit();
            };

            // Idle endlessly.
            // while (true)
            //{
            //  await Task.Delay(30000);
            //}
        }
Example #22
0
            public static void Postfix(AmongUsClient __instance)
            {
                if (AmongUsClient.Instance.AmHost)
                {
                    return;
                }

                // If I am client, send handshake
                PluginSingleton <TownOfUs> .Instance.Log.LogMessage($"AmongUsClient.OnGameJoined.Postfix - Am client, sending handshake");

                var messageWriter = MessageWriter.Get(SendOption.Reliable);

                messageWriter.StartMessage(6);
                messageWriter.Write(__instance.GameId);
                messageWriter.WritePacked(__instance.HostId);
                messageWriter.StartMessage(TOU_ROOT_HANDSHAKE_TAG);
                messageWriter.Write(AmongUsClient.Instance.ClientId);
                messageWriter.Write(TownOfUs.GetVersion());
                messageWriter.EndMessage();
                messageWriter.EndMessage();
                __instance.SendOrDisconnect(messageWriter);
                messageWriter.Recycle();
            }
Example #23
0
 public static void Prefix(AmongUsClient __instance, ref GameOverReason gameOverReason, bool showAd)
 {
     return;
 }
Example #24
0
        public static void Postfix(AmongUsClient __instance, [HarmonyArgument(0)] ref GameOverReason reason, [HarmonyArgument(1)] bool showAd)
        {
            AdditionalTempData.clear();

            // Remove Jester from winners (on Jester win he will be added again, see below)
            if (Jester.jester != null)
            {
                WinningPlayerData jesterWinner = null;
                foreach (WinningPlayerData winner in  TempData.winners)
                {
                    if (winner.Name == Jester.jester.Data.PlayerName)
                    {
                        jesterWinner = winner;
                    }
                }

                if (jesterWinner != null)
                {
                    TempData.winners.Remove(jesterWinner);
                }
            }
            // Remove Jackal and Sidekick from winners (on Jackal win he will be added again, see below)
            if (Jackal.jackal != null || Sidekick.sidekick != null)
            {
                List <WinningPlayerData> winnersToRemove = new List <WinningPlayerData>();
                foreach (WinningPlayerData winner in TempData.winners)
                {
                    if (winner.Name == Jackal.jackal?.Data?.PlayerName)
                    {
                        winnersToRemove.Add(winner);
                    }
                    if (winner.Name == Sidekick.sidekick?.Data?.PlayerName)
                    {
                        winnersToRemove.Add(winner);
                    }
                    foreach (var player in Jackal.formerJackals)
                    {
                        if (winner.Name == player.Data.PlayerName)
                        {
                            winnersToRemove.Add(winner);
                        }
                    }
                }

                foreach (var winner in winnersToRemove)
                {
                    TempData.winners.Remove(winner);
                }
            }

            bool jesterWin     = Jester.jester != null && gameOverReason == (GameOverReason)CustomGameOverReason.JesterWin;
            bool childLose     = Child.child != null && gameOverReason == (GameOverReason)CustomGameOverReason.ChildLose;
            bool loversWin     = Lovers.existingAndAlive() && (gameOverReason == (GameOverReason)CustomGameOverReason.LoversWin || (TempData.DidHumansWin(gameOverReason) && Lovers.existingAndCrewLovers())); // Either they win if they are among the last 3 players, or they win if they are both Crewmates and both alive and the Crew wins (Team Imp/Jackal Lovers can only win solo wins)
            bool teamJackalWin = gameOverReason == (GameOverReason)CustomGameOverReason.TeamJackalWin && ((Jackal.jackal != null && !Jackal.jackal.Data.IsDead) || (Sidekick.sidekick != null && !Sidekick.sidekick.Data.IsDead));

            // Child lose
            if (childLose)
            {
                TempData.winners = new Il2CppSystem.Collections.Generic.List <WinningPlayerData>();
                WinningPlayerData wpd = new WinningPlayerData(Child.child.Data);
                wpd.IsYou = false; // If "no one is the Child", it will display the Child, but also show defeat to everyone
                TempData.winners.Add(wpd);
                AdditionalTempData.winCondition = WinCondition.ChildLose;
            }

            // Jester win
            else if (jesterWin)
            {
                TempData.winners = new Il2CppSystem.Collections.Generic.List <WinningPlayerData>();
                WinningPlayerData wpd = new WinningPlayerData(Jester.jester.Data);
                TempData.winners.Add(wpd);
                AdditionalTempData.winCondition = WinCondition.JesterWin;
            }

            // Lovers win conditions
            else if (loversWin)
            {
                AdditionalTempData.localIsLover = (PlayerControl.LocalPlayer == Lovers.lover1 || PlayerControl.LocalPlayer == Lovers.lover2);
                // Double win for lovers, crewmates also win
                if (Lovers.existingAndCrewLovers())
                {
                    AdditionalTempData.winCondition = WinCondition.LoversTeamWin;
                    TempData.winners = new Il2CppSystem.Collections.Generic.List <WinningPlayerData>();
                    foreach (PlayerControl p in PlayerControl.AllPlayerControls)
                    {
                        if (p == null)
                        {
                            continue;
                        }
                        if (p == Lovers.lover1 || p == Lovers.lover2)
                        {
                            TempData.winners.Add(new WinningPlayerData(p.Data));
                        }
                        else if (p != Jester.jester && p != Jackal.jackal && p != Sidekick.sidekick && !p.Data.IsImpostor)
                        {
                            TempData.winners.Add(new WinningPlayerData(p.Data));
                        }
                    }
                }
                // Lovers solo win
                else
                {
                    AdditionalTempData.winCondition = WinCondition.LoversSoloWin;
                    TempData.winners = new Il2CppSystem.Collections.Generic.List <WinningPlayerData>();
                    TempData.winners.Add(new WinningPlayerData(Lovers.lover1.Data));
                    TempData.winners.Add(new WinningPlayerData(Lovers.lover2.Data));
                }
            }

            // Jackal win condition (should be implemented using a proper GameOverReason in the future)
            else if (teamJackalWin)
            {
                // Jackal wins if nobody except jackal is alive
                AdditionalTempData.winCondition = WinCondition.JackalWin;
                TempData.winners = new Il2CppSystem.Collections.Generic.List <WinningPlayerData>();
                WinningPlayerData wpd = new WinningPlayerData(Jackal.jackal.Data);
                wpd.IsImpostor = false;
                TempData.winners.Add(wpd);
                // If there is a sidekick. The sidekick also wins
                if (Sidekick.sidekick != null)
                {
                    WinningPlayerData wpdSidekick = new WinningPlayerData(Sidekick.sidekick.Data);
                    wpdSidekick.IsImpostor = false;
                    TempData.winners.Add(wpdSidekick);
                }
                foreach (var player in Jackal.formerJackals)
                {
                    WinningPlayerData wpdFormerJackal = new WinningPlayerData(player.Data);
                    wpdFormerJackal.IsImpostor = false;
                    TempData.winners.Add(wpdFormerJackal);
                }
            }

            // Reset Settings
            RPCProcedure.resetVariables();
        }
Example #25
0
 public static void Prefix(AmongUsClient __instance)
 {
     Reset();
 }
Example #26
0
        public static void Postfix(AmongUsClient __instance, GameOverReason OFLKLGMHBEL, bool JFFPAKGPNJA)
        {
            AdditionalTempData.clear();

            // Remove shifter from winners
            if (Shifter.shifter != null)
            {
                WinningPlayerData shifterWinner = null;
                foreach (WinningPlayerData winner in  TempData.winners)
                {
                    if (winner.Name == Shifter.shifter.Data.PlayerName)
                    {
                        shifterWinner = winner;
                    }
                }

                if (shifterWinner != null)
                {
                    TempData.winners.Remove(shifterWinner);
                }
            }
            // Remove Jester from winners (on Jester win he will be added again, see below)
            if (Jester.jester != null)
            {
                WinningPlayerData jesterWinner = null;
                foreach (WinningPlayerData winner in  TempData.winners)
                {
                    if (winner.Name == Jester.jester.Data.PlayerName)
                    {
                        jesterWinner = winner;
                    }
                }

                if (jesterWinner != null)
                {
                    TempData.winners.Remove(jesterWinner);
                }
            }


            // Child win condition (should be implemented using a proper GameOverReason in the future)
            if (Child.child != null && Child.child.Data.IsImpostor)
            {
                AdditionalTempData.winCondition = WinCondition.ChildWin;
                TempData.winners = new Il2CppSystem.Collections.Generic.List <WinningPlayerData>();
                WinningPlayerData wpd = new WinningPlayerData(Child.child.Data);
                wpd.IsImpostor = false;
                TempData.winners.Add(wpd);
            }

            // Jester win condition (should be implemented using a proper GameOverReason in the future)
            else if (Jester.jester != null && Jester.jester.Data.IsImpostor)
            {
                AdditionalTempData.winCondition = WinCondition.JesterWin;
                TempData.winners = new Il2CppSystem.Collections.Generic.List <WinningPlayerData>();
                WinningPlayerData wpd = new WinningPlayerData(Jester.jester.Data);
                wpd.IsImpostor = false;
                TempData.winners.Add(wpd);
            }

            // Lovers win conditions (should be implemented using a proper GameOverReason in the future)
            else if (Lovers.existingAndAlive())
            {
                AdditionalTempData.localIsLover = (PlayerControl.LocalPlayer == Lovers.lover1 || PlayerControl.LocalPlayer == Lovers.lover2);
                // Double win for lovers, crewmates also win
                if (TempData.DidHumansWin(OFLKLGMHBEL))
                {
                    AdditionalTempData.winCondition = WinCondition.LoversTeamWin;
                }
                // Lovers solo win
                else if (Lovers.existingWithImpLover())
                {
                    AdditionalTempData.winCondition = WinCondition.LoversSoloWin;
                    TempData.winners = new Il2CppSystem.Collections.Generic.List <WinningPlayerData>();
                    TempData.winners.Add(new WinningPlayerData(Lovers.lover1.Data));
                    TempData.winners.Add(new WinningPlayerData(Lovers.lover2.Data));
                }
            }

            // Reset Bonus Roles Settings
            clearAndReloadRoles();
            clearGameHistory();
        }
 public static void Prefix(AmongUsClient __instance, ref GameOverReason NEPMFBMGGLF, bool FBEKDLNKNLL)
 {
     return;
 }
Example #28
0
        public static void Postfix(AmongUsClient __instance, GameOverReason FCBGPMEMOJB, bool GKFHPFPIHGA)
        {
            AdditionalTempData.clear();

            // Remove Jester from winners (on Jester win he will be added again, see below)
            if (Jester.jester != null)
            {
                WinningPlayerData jesterWinner = null;
                foreach (WinningPlayerData winner in  TempData.BDGOKPKHCNB)
                {
                    if (winner.GEDNCGBDPKC == Jester.jester.IDOFAMCIJKE.HGGCLJHCDBM)
                    {
                        jesterWinner = winner;
                    }
                }

                if (jesterWinner != null)
                {
                    TempData.BDGOKPKHCNB.Remove(jesterWinner);
                }
            }
            // Remove Jackal and Sidekick from winners (on Jackal win he will be added again, see below)
            if (Jackal.jackal != null || Sidekick.sidekick != null)
            {
                List <WinningPlayerData> winnersToRemove = new List <WinningPlayerData>();
                foreach (WinningPlayerData winner in TempData.BDGOKPKHCNB)
                {
                    if (winner.GEDNCGBDPKC == Jackal.jackal?.IDOFAMCIJKE?.HGGCLJHCDBM)
                    {
                        winnersToRemove.Add(winner);
                    }
                    if (winner.GEDNCGBDPKC == Sidekick.sidekick?.IDOFAMCIJKE?.HGGCLJHCDBM)
                    {
                        winnersToRemove.Add(winner);
                    }
                    foreach (var player in Jackal.formerJackals)
                    {
                        if (winner.GEDNCGBDPKC == player.IDOFAMCIJKE.HGGCLJHCDBM)
                        {
                            winnersToRemove.Add(winner);
                        }
                    }
                }

                foreach (var winner in winnersToRemove)
                {
                    TempData.BDGOKPKHCNB.Remove(winner);
                }
            }

            bool childLose = Child.child != null && gameOverReason == (GameOverReason)CustomGameOverReason.ChildLose;
            bool jesterWin = Jester.jester != null && gameOverReason == (GameOverReason)CustomGameOverReason.JesterWin;

            // Child lose
            if (childLose)
            {
                TempData.BDGOKPKHCNB = new Il2CppSystem.Collections.Generic.List <WinningPlayerData>();
                WinningPlayerData wpd = new WinningPlayerData(Child.child.IDOFAMCIJKE);
                wpd.KCEFGIGGLHM = false; // If "no one is the Child", it will display the Child, but also show defeat to everyone
                TempData.BDGOKPKHCNB.Add(wpd);
                AdditionalTempData.winCondition = WinCondition.ChildLose;
            }

            // Jester win
            else if (jesterWin)
            {
                TempData.BDGOKPKHCNB = new Il2CppSystem.Collections.Generic.List <WinningPlayerData>();
                WinningPlayerData wpd = new WinningPlayerData(Jester.jester.IDOFAMCIJKE);
                TempData.BDGOKPKHCNB.Add(wpd);
                AdditionalTempData.winCondition = WinCondition.JesterWin;
            }

            // Lovers win conditions
            else if (Lovers.existingAndAlive() && gameOverReason == (GameOverReason)CustomGameOverReason.LoversWin)
            {
                AdditionalTempData.localIsLover = (PlayerControl.LocalPlayer == Lovers.lover1 || PlayerControl.LocalPlayer == Lovers.lover2);
                // Double win for lovers, crewmates also win
                if (!Lovers.existingWithImpLover())
                {
                    AdditionalTempData.winCondition = WinCondition.LoversTeamWin;
                    TempData.BDGOKPKHCNB            = new Il2CppSystem.Collections.Generic.List <WinningPlayerData>();
                    foreach (PlayerControl p in PlayerControl.AllPlayerControls)
                    {
                        if (p == null)
                        {
                            continue;
                        }
                        if (p == Lovers.lover1 || p == Lovers.lover2)
                        {
                            TempData.BDGOKPKHCNB.Add(new WinningPlayerData(p.IDOFAMCIJKE));
                        }
                        else if (p != Jester.jester && p != Jackal.jackal && p != Sidekick.sidekick && !p.IDOFAMCIJKE.CIDDOFDJHJH)
                        {
                            TempData.BDGOKPKHCNB.Add(new WinningPlayerData(p.IDOFAMCIJKE));
                        }
                    }
                }
                // Lovers solo win
                else
                {
                    AdditionalTempData.winCondition = WinCondition.LoversSoloWin;
                    TempData.BDGOKPKHCNB            = new Il2CppSystem.Collections.Generic.List <WinningPlayerData>();
                    TempData.BDGOKPKHCNB.Add(new WinningPlayerData(Lovers.lover1.IDOFAMCIJKE));
                    TempData.BDGOKPKHCNB.Add(new WinningPlayerData(Lovers.lover2.IDOFAMCIJKE));
                }
            }

            // Jackal win condition (should be implemented using a proper GameOverReason in the future)
            else if (gameOverReason == (GameOverReason)CustomGameOverReason.TeamJackalWin && (Jackal.jackal != null && !Jackal.jackal.IDOFAMCIJKE.FGNJJFABIHJ || Sidekick.sidekick != null && !Sidekick.sidekick.IDOFAMCIJKE.FGNJJFABIHJ))
            {
                // Jackal wins if nobody except jackal is alive
                AdditionalTempData.winCondition = WinCondition.JackalWin;
                TempData.BDGOKPKHCNB            = new Il2CppSystem.Collections.Generic.List <WinningPlayerData>();
                WinningPlayerData wpd = new WinningPlayerData(Jackal.jackal.IDOFAMCIJKE);
                wpd.CIDDOFDJHJH = false;
                TempData.BDGOKPKHCNB.Add(wpd);
                // If there is a sidekick. The sidekick also wins
                if (Sidekick.sidekick != null)
                {
                    WinningPlayerData wpdSidekick = new WinningPlayerData(Sidekick.sidekick.IDOFAMCIJKE);
                    wpdSidekick.CIDDOFDJHJH = false;
                    TempData.BDGOKPKHCNB.Add(wpdSidekick);
                }
                foreach (var player in Jackal.formerJackals)
                {
                    WinningPlayerData wpdFormerJackal = new WinningPlayerData(player.IDOFAMCIJKE);
                    wpdFormerJackal.CIDDOFDJHJH = false;
                    TempData.BDGOKPKHCNB.Add(wpdFormerJackal);
                }
            }

            // Reset Settings
            RPCProcedure.resetVariables();
        }
Example #29
0
 public static void Prefix(AmongUsClient __instance, [HarmonyArgument(0)] ref EndGameResult endGameResult)
 {
     Munou.endGameFlag = true;
 }
Example #30
0
 public static void Prefix(AmongUsClient __instance)
 {
     EndGameCommons.ResetGlobalVariable();
 }