public static void Prefix(ref GameData.OFKOJOKOOAK KLHCDCKJHKC, bool EMLKEPIBJLK) { // Shifter shift if (Shifter.shifter != null && AmongUsClient.Instance.CBKCIKKEJHI && Shifter.futureShift != null) // We need to send the RPC from the host here, to make sure that the order of shifting and erasing is correct (for that reason the futureShifted and futureErased are being synced) { MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.ShifterShift, Hazel.SendOption.Reliable, -1); writer.Write(Shifter.futureShift.PlayerId); AmongUsClient.Instance.FinishRpcImmediately(writer); RPCProcedure.shifterShift(Shifter.futureShift.PlayerId); } Shifter.futureShift = null; // Eraser erase if (Eraser.eraser != null && AmongUsClient.Instance.CBKCIKKEJHI && Eraser.futureErased != null) // We need to send the RPC from the host here, to make sure that the order of shifting and erasing is correct (for that reason the futureShifted and futureErased are being synced) { foreach (PlayerControl target in Eraser.futureErased) { if (target != null) { MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.ErasePlayerRole, Hazel.SendOption.Reliable, -1); writer.Write(target.PlayerId); AmongUsClient.Instance.FinishRpcImmediately(writer); RPCProcedure.erasePlayerRole(target.PlayerId); } } } Eraser.futureErased = new List <PlayerControl>(); }
public static void Prefix(ref GameData.LGBOMGHJELL EAFLJGMBLCH, bool EMBDDLIPBME) { // Shifter shift if (Shifter.shifter != null && AmongUsClient.Instance.HHBLOCGKFAB && Shifter.futureShift != null) // We need to send the RPC from the host here, to make sure that the order of shifting and erasing is correct (for that reason the futureShifted and futureErased are being synced) { MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.ShifterShift, Hazel.SendOption.Reliable, -1); writer.Write(Shifter.futureShift.PlayerId); AmongUsClient.Instance.FinishRpcImmediately(writer); RPCProcedure.shifterShift(Shifter.futureShift.PlayerId); } Shifter.futureShift = null; // Eraser erase if (Eraser.eraser != null && AmongUsClient.Instance.HHBLOCGKFAB && Eraser.futureErased != null) // We need to send the RPC from the host here, to make sure that the order of shifting and erasing is correct (for that reason the futureShifted and futureErased are being synced) { foreach (PlayerControl target in Eraser.futureErased) { if (target != null) { MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.ErasePlayerRole, Hazel.SendOption.Reliable, -1); writer.Write(target.PlayerId); AmongUsClient.Instance.FinishRpcImmediately(writer); RPCProcedure.erasePlayerRole(target.PlayerId); } } } Eraser.futureErased = new List <PlayerControl>(); // Trickster boxes if (Trickster.trickster != null && JackInTheBox.hasJackInTheBoxLimitReached()) { JackInTheBox.convertToVents(); } }
public static void Prefix(ExileController __instance, [HarmonyArgument(0)] ref GameData.PlayerInfo exiled, [HarmonyArgument(1)] bool tie) { // Shifter shift if (Shifter.shifter != null && AmongUsClient.Instance.AmHost && Shifter.futureShift != null) // We need to send the RPC from the host here, to make sure that the order of shifting and erasing is correct (for that reason the futureShifted and futureErased are being synced) { MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.ShifterShift, Hazel.SendOption.Reliable, -1); writer.Write(Shifter.futureShift.PlayerId); AmongUsClient.Instance.FinishRpcImmediately(writer); RPCProcedure.shifterShift(Shifter.futureShift.PlayerId); } Shifter.futureShift = null; // Eraser erase if (Eraser.eraser != null && AmongUsClient.Instance.AmHost && Eraser.futureErased != null) // We need to send the RPC from the host here, to make sure that the order of shifting and erasing is correct (for that reason the futureShifted and futureErased are being synced) { foreach (PlayerControl target in Eraser.futureErased) { if (target != null) { MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.ErasePlayerRole, Hazel.SendOption.Reliable, -1); writer.Write(target.PlayerId); AmongUsClient.Instance.FinishRpcImmediately(writer); RPCProcedure.erasePlayerRole(target.PlayerId); } } } Eraser.futureErased = new List <PlayerControl>(); // Trickster boxes if (Trickster.trickster != null && JackInTheBox.hasJackInTheBoxLimitReached()) { JackInTheBox.convertToVents(); } // SecurityGuard vents and cameras var allCameras = ShipStatus.Instance.AllCameras.ToList(); MapOptions.camerasToAdd.ForEach(camera => { camera.gameObject.SetActive(true); camera.gameObject.GetComponent <SpriteRenderer>().color = Color.white; allCameras.Add(camera); }); ShipStatus.Instance.AllCameras = allCameras.ToArray(); MapOptions.camerasToAdd = new List <SurvCamera>(); foreach (Vent vent in MapOptions.ventsToSeal) { PowerTools.SpriteAnim animator = vent.GetComponent <PowerTools.SpriteAnim>(); animator?.Stop(); vent.EnterVentAnim = vent.ExitVentAnim = null; vent.myRend.sprite = animator == null?SecurityGuard.getStaticVentSealedSprite() : SecurityGuard.getAnimatedVentSealedSprite(); vent.myRend.color = Color.white; vent.name = "SealedVent_" + vent.name; } MapOptions.ventsToSeal = new List <Vent>(); }
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; } }
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; } }