Ejemplo n.º 1
0
        public static void Postfix(KeyboardJoystick __instance)
        {
            if (AmongUsClient.Instance.AmHost && AmongUsClient.Instance.GameState == InnerNet.InnerNetClient.GameStates.Started)
            {
                //ゲーム強制終了
                if (Input.GetKey(KeyCode.LeftControl) && Input.GetKey(KeyCode.F5))
                {
                    MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.ForceEnd, Hazel.SendOption.Reliable, -1);
                    AmongUsClient.Instance.FinishRpcImmediately(writer);
                    RPCProcedure.forceEnd();
                }
            }

            if (!TheOtherRolesPlugin.DebugMode.Value)
            {
                return;
            }

            // Spawn dummys
            if (Input.GetKey(KeyCode.LeftControl) && Input.GetKeyDown(KeyCode.F))
            {
                var playerControl = UnityEngine.Object.Instantiate(AmongUsClient.Instance.PlayerPrefab);
                var i             = playerControl.PlayerId = (byte)GameData.Instance.GetAvailableId();

                bots.Add(playerControl);
                GameData.Instance.AddPlayer(playerControl);
                AmongUsClient.Instance.Spawn(playerControl, -2, InnerNet.SpawnFlags.None);

                // int hat = random.Next(HatManager.Instance.AllHats.Count);
                // int pet = random.Next(HatManager.Instance.AllPets.Count);
                // int skin = random.Next(HatManager.Instance.AllSkins.Count);
                // int visor = random.Next(HatManager.Instance.AllVisors.Count);
                // int color = random.Next(Palette.PlayerColors.Length);
                // int nameplate = random.Next(HatManager.Instance.AllNamePlates.Count);

                // playerControl.transform.position = PlayerControl.LocalPlayer.transform.position;
                // playerControl.GetComponent<DummyBehaviour>().enabled = true;
                // playerControl.NetTransform.enabled = false;
                // playerControl.SetName(RandomString(10));
                // playerControl.SetColor(color);
                // playerControl.SetHat(HatManager.Instance.AllHats[hat].ProductId, color);
                // playerControl.SetPet(HatManager.Instance.AllPets[pet].ProductId, color);
                // playerControl.SetVisor(HatManager.Instance.AllVisors[visor].ProductId);
                // playerControl.SetSkin(HatManager.Instance.AllSkins[skin].ProductId);
                // playerControl.SetNamePlate(HatManager.Instance.AllNamePlates[nameplate].ProductId);
                GameData.Instance.RpcSetTasks(playerControl.PlayerId, new byte[0]);
            }

            // ゲーム内ログ出力のトグル
            if (Input.GetKey(KeyCode.LeftControl) && Input.GetKeyDown(KeyCode.F2))
            {
                Logger.isAlsoInGame = !Logger.isAlsoInGame;
                Logger.SendInGame("isAlsoInGame: " + Logger.isAlsoInGame);
            }
        }
Ejemplo n.º 2
0
        public static void Postfix(KeyboardJoystick __instance)
        {
            if (!TheOtherRolesPlugin.DebugMode.Value)
            {
                return;
            }

            // Spawn dummys
            if (Input.GetKeyDown(KeyCode.F))
            {
                var playerControl = UnityEngine.Object.Instantiate(AmongUsClient.Instance.PlayerPrefab);
                var i             = playerControl.PlayerId = (byte)GameData.Instance.GetAvailableId();

                bots.Add(playerControl);
                GameData.Instance.AddPlayer(playerControl);
                AmongUsClient.Instance.Spawn(playerControl, -2, InnerNet.SpawnFlags.None);

                playerControl.transform.position = PlayerControl.LocalPlayer.transform.position;
                playerControl.GetComponent <DummyBehaviour>().enabled = true;
                playerControl.NetTransform.enabled = false;
                playerControl.SetName(RandomString(10));
                playerControl.SetColor((byte)random.Next(Palette.PlayerColors.Length));
                playerControl.SetHat((uint)random.Next(HatManager.Instance.AllHats.Count), playerControl.Data.ColorId);
                playerControl.SetPet((uint)random.Next(HatManager.Instance.AllPets.Count));
                playerControl.SetSkin((uint)random.Next(HatManager.Instance.AllSkins.Count));
                GameData.Instance.RpcSetTasks(playerControl.PlayerId, new byte[0]);
            }

            // Terminate round
            if (Input.GetKeyDown(KeyCode.L))
            {
                MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.ForceEnd, Hazel.SendOption.Reliable, -1);
                AmongUsClient.Instance.FinishRpcImmediately(writer);
                RPCProcedure.forceEnd();
            }
        }
Ejemplo n.º 3
0
        static void Postfix(byte ACCJCEHMKLN, MessageReader HFPCBBHJIPJ)
        {
            byte          packetId = ACCJCEHMKLN;
            MessageReader reader   = HFPCBBHJIPJ;

            switch (packetId)
            {
            // Main Controls

            case (byte)CustomRPC.ResetVaribles:
                RPCProcedure.resetVariables();
                break;

            case (byte)CustomRPC.ForceEnd:
                RPCProcedure.forceEnd();
                break;

            case (byte)CustomRPC.SetRole:
                byte roleId   = HFPCBBHJIPJ.ReadByte();
                byte playerId = HFPCBBHJIPJ.ReadByte();
                RPCProcedure.setRole(roleId, playerId);
                break;


            // Role functionality

            case (byte)CustomRPC.JesterBountyHunterWin:
                RPCProcedure.jesterBountyHunterWin(HFPCBBHJIPJ.ReadByte());
                break;

            case (byte)CustomRPC.EngineerFixLights:
                RPCProcedure.engineerFixLights();
                break;

            case (byte)CustomRPC.EngineerUsedRepair:
                RPCProcedure.engineerUsedRepair();
                break;

            case (byte)CustomRPC.JanitorClean:
                RPCProcedure.janitorClean(HFPCBBHJIPJ.ReadByte());
                break;

            case (byte)CustomRPC.SheriffKill:
                RPCProcedure.sheriffKill(HFPCBBHJIPJ.ReadByte());
                break;

            case (byte)CustomRPC.TimeMasterRewindTime:
                RPCProcedure.timeMasterRewindTime();
                break;

            case (byte)CustomRPC.MedicSetShielded:
                RPCProcedure.medicSetShielded(HFPCBBHJIPJ.ReadByte());
                break;

            case (byte)CustomRPC.ShieldedMurderAttempt:
                RPCProcedure.shieldedMurderAttempt();
                break;

            case (byte)CustomRPC.TimeMasterRevive:
                RPCProcedure.timeMasterRevive(HFPCBBHJIPJ.ReadByte());
                break;

            case (byte)CustomRPC.ShifterShift:
                RPCProcedure.shifterShift(HFPCBBHJIPJ.ReadByte());
                break;

            case (byte)CustomRPC.SwapperSwap:
                byte playerId1 = HFPCBBHJIPJ.ReadByte();
                byte playerId2 = HFPCBBHJIPJ.ReadByte();
                RPCProcedure.swapperSwap(playerId1, playerId2);
                break;

            case (byte)CustomRPC.SeerReveal:
                byte targetId          = HFPCBBHJIPJ.ReadByte();
                byte targetOrMistakeId = HFPCBBHJIPJ.ReadByte();
                RPCProcedure.seerReveal(targetId, targetOrMistakeId);
                break;

            case (byte)CustomRPC.MorphlingMorph:
                RPCProcedure.morphlingMorph(HFPCBBHJIPJ.ReadByte());
                break;

            case (byte)CustomRPC.CamouflagerCamouflage:
                RPCProcedure.camouflagerCamouflage();
                break;

            case (byte)CustomRPC.LoverSuicide:
                RPCProcedure.loverSuicide(HFPCBBHJIPJ.ReadByte());
                break;

            case (byte)CustomRPC.SetBountyHunterTarget:
                RPCProcedure.setBountyHunterTarget(HFPCBBHJIPJ.ReadByte());
                break;

            case (byte)CustomRPC.VampireBiteNotification:
                RPCProcedure.vampireBiteNotification(HFPCBBHJIPJ.ReadByte());
                break;

            case (byte)CustomRPC.VampireTryKill:
                RPCProcedure.vampireTryKill();
                break;

            case (byte)CustomRPC.PlaceGarlic:
                RPCProcedure.placeGarlic(HFPCBBHJIPJ.ReadBytesAndSize());
                break;

            case (byte)CustomRPC.TrackerUsedTracker:
                RPCProcedure.trackerUsedTracker(HFPCBBHJIPJ.ReadByte());
                break;

            case (byte)CustomRPC.JackalKill:
                RPCProcedure.jackalKill(HFPCBBHJIPJ.ReadByte());
                break;

            case (byte)CustomRPC.SidekickKill:
                RPCProcedure.sidekickKill(HFPCBBHJIPJ.ReadByte());
                break;

            case (byte)CustomRPC.JackalCreatesSidekick:
                RPCProcedure.jackalCreatesSidekick(HFPCBBHJIPJ.ReadByte());
                break;

            case (byte)CustomRPC.SidekickPromotes:
                RPCProcedure.sidekickPromotes();
                break;
            }
        }
Ejemplo n.º 4
0
        static void Postfix([HarmonyArgument(0)] byte callId, [HarmonyArgument(1)] MessageReader reader)
        {
            byte packetId = callId;

            switch (packetId)
            {
            // Main Controls

            case (byte)CustomRPC.ResetVaribles:
                RPCProcedure.resetVariables();
                break;

            case (byte)CustomRPC.ShareOptionSelection:
                uint id        = reader.ReadPackedUInt32();
                uint selection = reader.ReadPackedUInt32();
                RPCProcedure.shareOptionSelection(id, selection);
                break;

            case (byte)CustomRPC.ForceEnd:
                RPCProcedure.forceEnd();
                break;

            case (byte)CustomRPC.SetRole:
                byte roleId   = reader.ReadByte();
                byte playerId = reader.ReadByte();
                RPCProcedure.setRole(roleId, playerId);
                break;

            case (byte)CustomRPC.SetUncheckedColor:
                byte c = reader.ReadByte();
                byte p = reader.ReadByte();
                RPCProcedure.setUncheckedColor(c, p);
                break;

            case (byte)CustomRPC.VersionHandshake:
                byte major          = reader.ReadByte();
                byte minor          = reader.ReadByte();
                byte patch          = reader.ReadByte();
                int  versionOwnerId = reader.ReadPackedInt32();
                RPCProcedure.versionHandshake(major, minor, patch, versionOwnerId);
                break;

            case (byte)CustomRPC.UseUncheckedVent:
                int  ventId        = reader.ReadPackedInt32();
                byte ventingPlayer = reader.ReadByte();
                byte isEnter       = reader.ReadByte();
                RPCProcedure.useUncheckedVent(ventId, ventingPlayer, isEnter);
                break;

            case (byte)CustomRPC.UncheckedMurderPlayer:
                byte source = reader.ReadByte();
                byte target = reader.ReadByte();
                RPCProcedure.uncheckedMurderPlayer(source, target);
                break;

            // Role functionality

            case (byte)CustomRPC.EngineerFixLights:
                RPCProcedure.engineerFixLights();
                break;

            case (byte)CustomRPC.EngineerUsedRepair:
                RPCProcedure.engineerUsedRepair();
                break;

            case (byte)CustomRPC.CleanBody:
                RPCProcedure.cleanBody(reader.ReadByte());
                break;

            case (byte)CustomRPC.SheriffKill:
                RPCProcedure.sheriffKill(reader.ReadByte());
                break;

            case (byte)CustomRPC.TimeMasterRewindTime:
                RPCProcedure.timeMasterRewindTime();
                break;

            case (byte)CustomRPC.TimeMasterShield:
                RPCProcedure.timeMasterShield();
                break;

            case (byte)CustomRPC.MedicSetShielded:
                RPCProcedure.medicSetShielded(reader.ReadByte());
                break;

            case (byte)CustomRPC.ShieldedMurderAttempt:
                RPCProcedure.shieldedMurderAttempt();
                break;

            case (byte)CustomRPC.ShifterShift:
                RPCProcedure.shifterShift(reader.ReadByte());
                break;

            case (byte)CustomRPC.SwapperSwap:
                byte playerId1 = reader.ReadByte();
                byte playerId2 = reader.ReadByte();
                RPCProcedure.swapperSwap(playerId1, playerId2);
                break;

            case (byte)CustomRPC.MorphlingMorph:
                RPCProcedure.morphlingMorph(reader.ReadByte());
                break;

            case (byte)CustomRPC.CamouflagerCamouflage:
                RPCProcedure.camouflagerCamouflage();
                break;

            case (byte)CustomRPC.LoverSuicide:
                RPCProcedure.loverSuicide(reader.ReadByte());
                break;

            case (byte)CustomRPC.VampireSetBitten:
                byte bittenId = reader.ReadByte();
                byte reset    = reader.ReadByte();
                RPCProcedure.vampireSetBitten(bittenId, reset);
                break;

            case (byte)CustomRPC.VampireTryKill:
                RPCProcedure.vampireTryKill();
                break;

            case (byte)CustomRPC.PlaceGarlic:
                RPCProcedure.placeGarlic(reader.ReadBytesAndSize());
                break;

            case (byte)CustomRPC.TrackerUsedTracker:
                RPCProcedure.trackerUsedTracker(reader.ReadByte());
                break;

            case (byte)CustomRPC.JackalKill:
                RPCProcedure.jackalKill(reader.ReadByte());
                break;

            case (byte)CustomRPC.SidekickKill:
                RPCProcedure.sidekickKill(reader.ReadByte());
                break;

            case (byte)CustomRPC.JackalCreatesSidekick:
                RPCProcedure.jackalCreatesSidekick(reader.ReadByte());
                break;

            case (byte)CustomRPC.SidekickPromotes:
                RPCProcedure.sidekickPromotes();
                break;

            case (byte)CustomRPC.ErasePlayerRole:
                RPCProcedure.erasePlayerRole(reader.ReadByte());
                break;

            case (byte)CustomRPC.SetFutureErased:
                RPCProcedure.setFutureErased(reader.ReadByte());
                break;

            case (byte)CustomRPC.SetFutureShifted:
                RPCProcedure.setFutureShifted(reader.ReadByte());
                break;

            case (byte)CustomRPC.PlaceJackInTheBox:
                RPCProcedure.placeJackInTheBox(reader.ReadBytesAndSize());
                break;

            case (byte)CustomRPC.LightsOut:
                RPCProcedure.lightsOut();
                break;

            case (byte)CustomRPC.WarlockCurseKill:
                RPCProcedure.warlockCurseKill(reader.ReadByte());
                break;
            }
        }
Ejemplo n.º 5
0
        static void Postfix(byte GIICFHKILOB, MessageReader DOOILGKLBBF)
        {
            byte          packetId = GIICFHKILOB;
            MessageReader reader   = DOOILGKLBBF;

            switch (packetId)
            {
            // Main Controls

            case (byte)CustomRPC.ResetVaribles:
                RPCProcedure.resetVariables();
                break;

            case (byte)CustomRPC.ShareOptionSelection:
                uint id        = DOOILGKLBBF.ReadPackedUInt32();
                uint selection = DOOILGKLBBF.ReadPackedUInt32();
                RPCProcedure.shareOptionSelection(id, selection);
                break;

            case (byte)CustomRPC.ForceEnd:
                RPCProcedure.forceEnd();
                break;

            case (byte)CustomRPC.SetRole:
                byte roleId   = DOOILGKLBBF.ReadByte();
                byte playerId = DOOILGKLBBF.ReadByte();
                RPCProcedure.setRole(roleId, playerId);
                break;


            // Role functionality

            case (byte)CustomRPC.EngineerFixLights:
                RPCProcedure.engineerFixLights();
                break;

            case (byte)CustomRPC.EngineerUsedRepair:
                RPCProcedure.engineerUsedRepair();
                break;

            case (byte)CustomRPC.JanitorClean:
                RPCProcedure.janitorClean(DOOILGKLBBF.ReadByte());
                break;

            case (byte)CustomRPC.SheriffKill:
                RPCProcedure.sheriffKill(DOOILGKLBBF.ReadByte());
                break;

            case (byte)CustomRPC.TimeMasterRewindTime:
                RPCProcedure.timeMasterRewindTime();
                break;

            case (byte)CustomRPC.TimeMasterShield:
                RPCProcedure.timeMasterShield();
                break;

            case (byte)CustomRPC.MedicSetShielded:
                RPCProcedure.medicSetShielded(DOOILGKLBBF.ReadByte());
                break;

            case (byte)CustomRPC.ShieldedMurderAttempt:
                RPCProcedure.shieldedMurderAttempt();
                break;

            case (byte)CustomRPC.ShifterShift:
                RPCProcedure.shifterShift(DOOILGKLBBF.ReadByte());
                break;

            case (byte)CustomRPC.SwapperSwap:
                byte playerId1 = DOOILGKLBBF.ReadByte();
                byte playerId2 = DOOILGKLBBF.ReadByte();
                RPCProcedure.swapperSwap(playerId1, playerId2);
                break;

            case (byte)CustomRPC.MorphlingMorph:
                RPCProcedure.morphlingMorph(DOOILGKLBBF.ReadByte());
                break;

            case (byte)CustomRPC.CamouflagerCamouflage:
                RPCProcedure.camouflagerCamouflage();
                break;

            case (byte)CustomRPC.LoverSuicide:
                RPCProcedure.loverSuicide(DOOILGKLBBF.ReadByte());
                break;

            case (byte)CustomRPC.VampireSetBitten:
                byte bittenId = DOOILGKLBBF.ReadByte();
                byte reset    = DOOILGKLBBF.ReadByte();
                RPCProcedure.vampireSetBitten(bittenId, reset);
                break;

            case (byte)CustomRPC.VampireTryKill:
                RPCProcedure.vampireTryKill();
                break;

            case (byte)CustomRPC.PlaceGarlic:
                RPCProcedure.placeGarlic(DOOILGKLBBF.ReadBytesAndSize());
                break;

            case (byte)CustomRPC.TrackerUsedTracker:
                RPCProcedure.trackerUsedTracker(DOOILGKLBBF.ReadByte());
                break;

            case (byte)CustomRPC.JackalKill:
                RPCProcedure.jackalKill(DOOILGKLBBF.ReadByte());
                break;

            case (byte)CustomRPC.SidekickKill:
                RPCProcedure.sidekickKill(DOOILGKLBBF.ReadByte());
                break;

            case (byte)CustomRPC.JackalCreatesSidekick:
                RPCProcedure.jackalCreatesSidekick(DOOILGKLBBF.ReadByte());
                break;

            case (byte)CustomRPC.SidekickPromotes:
                RPCProcedure.sidekickPromotes();
                break;

            case (byte)CustomRPC.ErasePlayerRole:
                RPCProcedure.erasePlayerRole(DOOILGKLBBF.ReadByte());
                break;

            case (byte)CustomRPC.SetFutureErased:
                RPCProcedure.setFutureErased(DOOILGKLBBF.ReadByte());
                break;

            case (byte)CustomRPC.SetFutureShifted:
                RPCProcedure.setFutureShifted(DOOILGKLBBF.ReadByte());
                break;
            }
        }