diff --git a/TheOtherRoles/Buttons.cs b/TheOtherRoles/Buttons.cs index f1b3e9d..9a42890 100644 --- a/TheOtherRoles/Buttons.cs +++ b/TheOtherRoles/Buttons.cs @@ -496,7 +496,7 @@ public static void createButtonsPostfix(HudManager __instance) { } }, - () => { return Engineer.engineer != null && Engineer.engineer == CachedPlayer.LocalPlayer.PlayerControl && Engineer.remainingFixes > 0 && !CachedPlayer.LocalPlayer.PlayerControl.Data.IsDead; }, + () => { return Engineer.engineer != null && Engineer.engineer == CachedPlayer.LocalPlayer.PlayerControl && Engineer.remainingFixes > 0 && !CachedPlayer.LocalPlayer.Data.IsDead; }, () => { if (engineerRepairText != null) engineerRepairText.text = Engineer.remainingFixes.ToString(); bool sabotageActive = false; @@ -546,7 +546,7 @@ public static void createButtonsPostfix(HudManager __instance) { } } }, - () => { return Janitor.janitor != null && Janitor.janitor == CachedPlayer.LocalPlayer.PlayerControl && !CachedPlayer.LocalPlayer.PlayerControl.Data.IsDead; }, + () => { return Janitor.janitor != null && Janitor.janitor == CachedPlayer.LocalPlayer.PlayerControl && !CachedPlayer.LocalPlayer.Data.IsDead; }, () => { return __instance.ReportButton.graphic.color == Palette.EnabledColor && CachedPlayer.LocalPlayer.PlayerControl.CanMove; }, () => { janitorCleanButton.Timer = janitorCleanButton.MaxTimer; }, Janitor.getButtonSprite(), @@ -591,7 +591,7 @@ public static void createButtonsPostfix(HudManager __instance) { sheriffKillButton.Timer = sheriffKillButton.MaxTimer; Sheriff.currentTarget = null; }, - () => { return Sheriff.sheriff != null && Sheriff.sheriff == CachedPlayer.LocalPlayer.PlayerControl && !CachedPlayer.LocalPlayer.PlayerControl.Data.IsDead; }, + () => { return Sheriff.sheriff != null && Sheriff.sheriff == CachedPlayer.LocalPlayer.PlayerControl && !CachedPlayer.LocalPlayer.Data.IsDead; }, () => { return Sheriff.currentTarget && CachedPlayer.LocalPlayer.PlayerControl.CanMove; }, () => { sheriffKillButton.Timer = sheriffKillButton.MaxTimer;}, __instance.KillButton.graphic.sprite, @@ -619,7 +619,7 @@ public static void createButtonsPostfix(HudManager __instance) { SoundEffectsManager.play("deputyHandcuff"); }, - () => { return ((Deputy.deputy != null && Deputy.deputy == CachedPlayer.LocalPlayer.PlayerControl) || (Sheriff.sheriff != null && Sheriff.sheriff == CachedPlayer.LocalPlayer.PlayerControl && Sheriff.sheriff == Sheriff.formerDeputy && Deputy.keepsHandcuffsOnPromotion)) && !CachedPlayer.LocalPlayer.PlayerControl.Data.IsDead; }, + () => { return ((Deputy.deputy != null && Deputy.deputy == CachedPlayer.LocalPlayer.PlayerControl) || (Sheriff.sheriff != null && Sheriff.sheriff == CachedPlayer.LocalPlayer.PlayerControl && Sheriff.sheriff == Sheriff.formerDeputy && Deputy.keepsHandcuffsOnPromotion)) && !CachedPlayer.LocalPlayer.Data.IsDead; }, () => { if (deputyButtonHandcuffsText != null) deputyButtonHandcuffsText.text = $"{Deputy.remainingHandcuffs}"; return ((Deputy.deputy != null && Deputy.deputy == CachedPlayer.LocalPlayer.PlayerControl && Deputy.currentTarget) || (Sheriff.sheriff != null && Sheriff.sheriff == CachedPlayer.LocalPlayer.PlayerControl && Sheriff.sheriff == Sheriff.formerDeputy && Sheriff.currentTarget)) && Deputy.remainingHandcuffs > 0 && CachedPlayer.LocalPlayer.PlayerControl.CanMove; @@ -641,7 +641,7 @@ public static void createButtonsPostfix(HudManager __instance) { }, () => { return ((Jackal.jackal != null && Jackal.jackal == CachedPlayer.LocalPlayer.PlayerControl && Jackal.canSabotageLights) || - (Sidekick.sidekick != null && Sidekick.sidekick == CachedPlayer.LocalPlayer.PlayerControl && Sidekick.canSabotageLights)) && !CachedPlayer.LocalPlayer.PlayerControl.Data.IsDead + (Sidekick.sidekick != null && Sidekick.sidekick == CachedPlayer.LocalPlayer.PlayerControl && Sidekick.canSabotageLights)) && !CachedPlayer.LocalPlayer.Data.IsDead && (!Helpers.isFungle() || CustomOptionHolder.fungleElectrical.getBool()); }, () => { @@ -667,7 +667,7 @@ public static void createButtonsPostfix(HudManager __instance) { RPCProcedure.timeMasterShield(); SoundEffectsManager.play("timemasterShield"); }, - () => { return TimeMaster.timeMaster != null && TimeMaster.timeMaster == CachedPlayer.LocalPlayer.PlayerControl && !CachedPlayer.LocalPlayer.PlayerControl.Data.IsDead; }, + () => { return TimeMaster.timeMaster != null && TimeMaster.timeMaster == CachedPlayer.LocalPlayer.PlayerControl && !CachedPlayer.LocalPlayer.Data.IsDead; }, () => { return CachedPlayer.LocalPlayer.PlayerControl.CanMove; }, () => { timeMasterShieldButton.Timer = timeMasterShieldButton.MaxTimer; @@ -708,7 +708,7 @@ public static void createButtonsPostfix(HudManager __instance) { SoundEffectsManager.play("medicShield"); }, - () => { return Medic.medic != null && Medic.medic == CachedPlayer.LocalPlayer.PlayerControl && !CachedPlayer.LocalPlayer.PlayerControl.Data.IsDead; }, + () => { return Medic.medic != null && Medic.medic == CachedPlayer.LocalPlayer.PlayerControl && !CachedPlayer.LocalPlayer.Data.IsDead; }, () => { return !Medic.usedShield && Medic.currentTarget && CachedPlayer.LocalPlayer.PlayerControl.CanMove; }, () => {}, Medic.getButtonSprite(), @@ -735,7 +735,7 @@ public static void createButtonsPostfix(HudManager __instance) { RPCProcedure.setFutureShifted(Shifter.currentTarget.PlayerId); SoundEffectsManager.play("shifterShift"); }, - () => { return Shifter.shifter != null && Shifter.shifter == CachedPlayer.LocalPlayer.PlayerControl && !CachedPlayer.LocalPlayer.PlayerControl.Data.IsDead; }, + () => { return Shifter.shifter != null && Shifter.shifter == CachedPlayer.LocalPlayer.PlayerControl && !CachedPlayer.LocalPlayer.Data.IsDead; }, () => { return Shifter.currentTarget && Shifter.futureShift == null && CachedPlayer.LocalPlayer.PlayerControl.CanMove; }, () => { }, Shifter.getButtonSprite(), @@ -780,7 +780,7 @@ public static void createButtonsPostfix(HudManager __instance) { setButtonTargetDisplay(Morphling.sampledTarget, morphlingButton); } }, - () => { return Morphling.morphling != null && Morphling.morphling == CachedPlayer.LocalPlayer.PlayerControl && !CachedPlayer.LocalPlayer.PlayerControl.Data.IsDead; }, + () => { return Morphling.morphling != null && Morphling.morphling == CachedPlayer.LocalPlayer.PlayerControl && !CachedPlayer.LocalPlayer.Data.IsDead; }, () => { return (Morphling.currentTarget || Morphling.sampledTarget) && CachedPlayer.LocalPlayer.PlayerControl.CanMove && !Helpers.MushroomSabotageActive(); }, () => { morphlingButton.Timer = morphlingButton.MaxTimer; @@ -822,7 +822,7 @@ public static void createButtonsPostfix(HudManager __instance) { RPCProcedure.camouflagerCamouflage(); SoundEffectsManager.play("morphlingMorph"); }, - () => { return Camouflager.camouflager != null && Camouflager.camouflager == CachedPlayer.LocalPlayer.PlayerControl && !CachedPlayer.LocalPlayer.PlayerControl.Data.IsDead; }, + () => { return Camouflager.camouflager != null && Camouflager.camouflager == CachedPlayer.LocalPlayer.PlayerControl && !CachedPlayer.LocalPlayer.Data.IsDead; }, () => { return CachedPlayer.LocalPlayer.PlayerControl.CanMove; }, () => { camouflagerButton.Timer = camouflagerButton.MaxTimer; @@ -848,7 +848,7 @@ public static void createButtonsPostfix(HudManager __instance) { Hacker.hackerTimer = Hacker.duration; SoundEffectsManager.play("hackerHack"); }, - () => { return Hacker.hacker != null && Hacker.hacker == CachedPlayer.LocalPlayer.PlayerControl && !CachedPlayer.LocalPlayer.PlayerControl.Data.IsDead; }, + () => { return Hacker.hacker != null && Hacker.hacker == CachedPlayer.LocalPlayer.PlayerControl && !CachedPlayer.LocalPlayer.Data.IsDead; }, () => { return true; }, () => { hackerButton.Timer = hackerButton.MaxTimer; @@ -878,7 +878,7 @@ public static void createButtonsPostfix(HudManager __instance) { CachedPlayer.LocalPlayer.NetTransform.Halt(); // Stop current movement Hacker.chargesAdminTable--; }, - () => { return Hacker.hacker != null && Hacker.hacker == CachedPlayer.LocalPlayer.PlayerControl && !CachedPlayer.LocalPlayer.PlayerControl.Data.IsDead;}, + () => { return Hacker.hacker != null && Hacker.hacker == CachedPlayer.LocalPlayer.PlayerControl && !CachedPlayer.LocalPlayer.Data.IsDead;}, () => { if (hackerAdminTableChargesText != null) hackerAdminTableChargesText.text = $"{Hacker.chargesAdminTable} / {Hacker.toolsNumber}"; return Hacker.chargesAdminTable > 0; @@ -940,7 +940,7 @@ public static void createButtonsPostfix(HudManager __instance) { Hacker.chargesVitals--; }, - () => { return Hacker.hacker != null && Hacker.hacker == CachedPlayer.LocalPlayer.PlayerControl && !CachedPlayer.LocalPlayer.PlayerControl.Data.IsDead && GameOptionsManager.Instance.currentGameOptions.MapId != 0 && GameOptionsManager.Instance.currentNormalGameOptions.MapId != 3; }, + () => { return Hacker.hacker != null && Hacker.hacker == CachedPlayer.LocalPlayer.PlayerControl && !CachedPlayer.LocalPlayer.Data.IsDead && GameOptionsManager.Instance.currentGameOptions.MapId != 0 && GameOptionsManager.Instance.currentNormalGameOptions.MapId != 3; }, () => { if (hackerVitalsChargesText != null) hackerVitalsChargesText.text = $"{Hacker.chargesVitals} / {Hacker.toolsNumber}"; hackerVitalsButton.actionButton.graphic.sprite = Helpers.isMira() ? Hacker.getLogSprite() : Hacker.getVitalsSprite(); @@ -997,7 +997,7 @@ public static void createButtonsPostfix(HudManager __instance) { RPCProcedure.trackerUsedTracker(Tracker.currentTarget.PlayerId); SoundEffectsManager.play("trackerTrackPlayer"); }, - () => { return Tracker.tracker != null && Tracker.tracker == CachedPlayer.LocalPlayer.PlayerControl && !CachedPlayer.LocalPlayer.PlayerControl.Data.IsDead; }, + () => { return Tracker.tracker != null && Tracker.tracker == CachedPlayer.LocalPlayer.PlayerControl && !CachedPlayer.LocalPlayer.Data.IsDead; }, () => { return CachedPlayer.LocalPlayer.PlayerControl.CanMove && Tracker.currentTarget != null && !Tracker.usedTracker; }, () => { if(Tracker.resetTargetAfterMeeting) Tracker.resetTracked(); }, Tracker.getButtonSprite(), @@ -1011,7 +1011,7 @@ public static void createButtonsPostfix(HudManager __instance) { trackerTrackCorpsesButton = new CustomButton( () => { Tracker.corpsesTrackingTimer = Tracker.corpsesTrackingDuration; SoundEffectsManager.play("trackerTrackCorpses"); }, - () => { return Tracker.tracker != null && Tracker.tracker == CachedPlayer.LocalPlayer.PlayerControl && !CachedPlayer.LocalPlayer.PlayerControl.Data.IsDead && Tracker.canTrackCorpses; }, + () => { return Tracker.tracker != null && Tracker.tracker == CachedPlayer.LocalPlayer.PlayerControl && !CachedPlayer.LocalPlayer.Data.IsDead && Tracker.canTrackCorpses; }, () => { return CachedPlayer.LocalPlayer.PlayerControl.CanMove; }, () => { trackerTrackCorpsesButton.Timer = trackerTrackCorpsesButton.MaxTimer; @@ -1098,7 +1098,7 @@ public static void createButtonsPostfix(HudManager __instance) { vampireKillButton.HasEffect = false; } }, - () => { return Vampire.vampire != null && Vampire.vampire == CachedPlayer.LocalPlayer.PlayerControl && !CachedPlayer.LocalPlayer.PlayerControl.Data.IsDead; }, + () => { return Vampire.vampire != null && Vampire.vampire == CachedPlayer.LocalPlayer.PlayerControl && !CachedPlayer.LocalPlayer.Data.IsDead; }, () => { if (Vampire.targetNearGarlic && Vampire.canKillNearGarlics) { vampireKillButton.actionButton.graphic.sprite = __instance.KillButton.graphic.sprite; @@ -1172,7 +1172,7 @@ public static void createButtonsPostfix(HudManager __instance) { RPCProcedure.placePortal(buff); SoundEffectsManager.play("tricksterPlaceBox"); }, - () => { return Portalmaker.portalmaker != null && Portalmaker.portalmaker == CachedPlayer.LocalPlayer.PlayerControl && !CachedPlayer.LocalPlayer.PlayerControl.Data.IsDead && Portal.secondPortal == null; }, + () => { return Portalmaker.portalmaker != null && Portalmaker.portalmaker == CachedPlayer.LocalPlayer.PlayerControl && !CachedPlayer.LocalPlayer.Data.IsDead && Portal.secondPortal == null; }, () => { if (portalmakerButtonNumText != null) portalmakerButtonNumText.text = $"{(Portal.firstPortal == null ? 2 : 1)}"; @@ -1317,7 +1317,7 @@ public static void createButtonsPostfix(HudManager __instance) { RPCProcedure.jackalCreatesSidekick(Jackal.currentTarget.PlayerId); SoundEffectsManager.play("jackalSidekick"); }, - () => { return Jackal.canCreateSidekick && Jackal.jackal != null && Jackal.jackal == CachedPlayer.LocalPlayer.PlayerControl && !CachedPlayer.LocalPlayer.PlayerControl.Data.IsDead; }, + () => { return Jackal.canCreateSidekick && Jackal.jackal != null && Jackal.jackal == CachedPlayer.LocalPlayer.PlayerControl && !CachedPlayer.LocalPlayer.Data.IsDead; }, () => { return Jackal.canCreateSidekick && Jackal.currentTarget != null && CachedPlayer.LocalPlayer.PlayerControl.CanMove; }, () => { jackalSidekickButton.Timer = jackalSidekickButton.MaxTimer;}, Jackal.getSidekickButtonSprite(), @@ -1664,7 +1664,7 @@ public static void createButtonsPostfix(HudManager __instance) { sidekickKillButton.Timer = sidekickKillButton.MaxTimer; Sidekick.currentTarget = null; }, - () => { return Sidekick.canKill && Sidekick.sidekick != null && Sidekick.sidekick == CachedPlayer.LocalPlayer.PlayerControl && !CachedPlayer.LocalPlayer.PlayerControl.Data.IsDead; }, + () => { return Sidekick.canKill && Sidekick.sidekick != null && Sidekick.sidekick == CachedPlayer.LocalPlayer.PlayerControl && !CachedPlayer.LocalPlayer.Data.IsDead; }, () => { return Sidekick.currentTarget && CachedPlayer.LocalPlayer.PlayerControl.CanMove; }, () => { sidekickKillButton.Timer = sidekickKillButton.MaxTimer;}, __instance.KillButton.graphic.sprite, @@ -1695,7 +1695,7 @@ public static void createButtonsPostfix(HudManager __instance) { RPCProcedure.setFutureErased(Eraser.currentTarget.PlayerId); SoundEffectsManager.play("eraserErase"); }, - () => { return Eraser.eraser != null && Eraser.eraser == CachedPlayer.LocalPlayer.PlayerControl && !CachedPlayer.LocalPlayer.PlayerControl.Data.IsDead; }, + () => { return Eraser.eraser != null && Eraser.eraser == CachedPlayer.LocalPlayer.PlayerControl && !CachedPlayer.LocalPlayer.Data.IsDead; }, () => { return CachedPlayer.LocalPlayer.PlayerControl.CanMove && Eraser.currentTarget != null; }, () => { eraserButton.Timer = eraserButton.MaxTimer;}, Eraser.getButtonSprite(), @@ -1859,7 +1859,7 @@ public static void createButtonsPostfix(HudManager __instance) { RPCProcedure.placeJackInTheBox(buff); SoundEffectsManager.play("tricksterPlaceBox"); }, - () => { return Trickster.trickster != null && Trickster.trickster == CachedPlayer.LocalPlayer.PlayerControl && !CachedPlayer.LocalPlayer.PlayerControl.Data.IsDead && !JackInTheBox.hasJackInTheBoxLimitReached(); }, + () => { return Trickster.trickster != null && Trickster.trickster == CachedPlayer.LocalPlayer.PlayerControl && !CachedPlayer.LocalPlayer.Data.IsDead && !JackInTheBox.hasJackInTheBoxLimitReached(); }, () => { if (tricksterBoxesText != null) tricksterBoxesText.text = (JackInTheBox.JackInTheBoxLimit - JackInTheBox.AllJackInTheBoxes.Count).ToString(); @@ -1936,7 +1936,7 @@ public static void createButtonsPostfix(HudManager __instance) { } } }, - () => { return Cleaner.cleaner != null && Cleaner.cleaner == CachedPlayer.LocalPlayer.PlayerControl && !CachedPlayer.LocalPlayer.PlayerControl.Data.IsDead; }, + () => { return Cleaner.cleaner != null && Cleaner.cleaner == CachedPlayer.LocalPlayer.PlayerControl && !CachedPlayer.LocalPlayer.Data.IsDead; }, () => { return __instance.ReportButton.graphic.color == Palette.EnabledColor && CachedPlayer.LocalPlayer.PlayerControl.CanMove; }, () => { cleanerCleanButton.Timer = cleanerCleanButton.MaxTimer; }, Cleaner.getButtonSprite(), @@ -2008,7 +2008,7 @@ public static void createButtonsPostfix(HudManager __instance) { } }, - () => { return Warlock.warlock != null && Warlock.warlock == CachedPlayer.LocalPlayer.PlayerControl && !CachedPlayer.LocalPlayer.PlayerControl.Data.IsDead; }, + () => { return Warlock.warlock != null && Warlock.warlock == CachedPlayer.LocalPlayer.PlayerControl && !CachedPlayer.LocalPlayer.Data.IsDead; }, () => { return ((Warlock.curseVictim == null && Warlock.currentTarget != null) || (Warlock.curseVictim != null && Warlock.curseVictimTarget != null)) && CachedPlayer.LocalPlayer.PlayerControl.CanMove; }, () => { warlockCurseButton.Timer = warlockCurseButton.MaxTimer; @@ -2053,7 +2053,7 @@ public static void createButtonsPostfix(HudManager __instance) { SoundEffectsManager.play("securityGuardPlaceCam"); // Same sound used for both types (cam or vent)! securityGuardButton.Timer = securityGuardButton.MaxTimer; }, - () => { return SecurityGuard.securityGuard != null && SecurityGuard.securityGuard == CachedPlayer.LocalPlayer.PlayerControl && !CachedPlayer.LocalPlayer.PlayerControl.Data.IsDead && SecurityGuard.remainingScrews >= Mathf.Min(SecurityGuard.ventPrice, SecurityGuard.camPrice); }, + () => { return SecurityGuard.securityGuard != null && SecurityGuard.securityGuard == CachedPlayer.LocalPlayer.PlayerControl && !CachedPlayer.LocalPlayer.Data.IsDead && SecurityGuard.remainingScrews >= Mathf.Min(SecurityGuard.ventPrice, SecurityGuard.camPrice); }, () => { securityGuardButton.actionButton.graphic.sprite = (SecurityGuard.ventTarget == null && !Helpers.isMira() && !Helpers.isFungle() && GameOptionsManager.Instance.currentNormalGameOptions.MapId != 1 && !SubmergedCompatibility.IsSubmerged) ? SecurityGuard.getPlaceCameraButtonSprite() : SecurityGuard.getCloseVentButtonSprite(); if (SecurityGuard.ventTarget == null && !Helpers.isMira() && !Helpers.isFungle() && GameOptionsManager.Instance.currentNormalGameOptions.MapId != 1 && !SubmergedCompatibility.IsSubmerged) @@ -2120,7 +2120,7 @@ public static void createButtonsPostfix(HudManager __instance) { if (SecurityGuard.cantMove) CachedPlayer.LocalPlayer.PlayerControl.moveable = false; CachedPlayer.LocalPlayer.NetTransform.Halt(); // Stop current movement }, - () => { return SecurityGuard.securityGuard != null && SecurityGuard.securityGuard == CachedPlayer.LocalPlayer.PlayerControl && !CachedPlayer.LocalPlayer.PlayerControl.Data.IsDead && SecurityGuard.remainingScrews < Mathf.Min(SecurityGuard.ventPrice, SecurityGuard.camPrice) + () => { return SecurityGuard.securityGuard != null && SecurityGuard.securityGuard == CachedPlayer.LocalPlayer.PlayerControl && !CachedPlayer.LocalPlayer.Data.IsDead && SecurityGuard.remainingScrews < Mathf.Min(SecurityGuard.ventPrice, SecurityGuard.camPrice) && !SubmergedCompatibility.IsSubmerged; }, () => { if (securityGuardChargesText != null) securityGuardChargesText.text = $"{SecurityGuard.charges} / {SecurityGuard.maxCharges}"; @@ -2186,7 +2186,7 @@ public static void createButtonsPostfix(HudManager __instance) { SoundEffectsManager.play("arsonistDouse"); } }, - () => { return Arsonist.arsonist != null && Arsonist.arsonist == CachedPlayer.LocalPlayer.PlayerControl && !CachedPlayer.LocalPlayer.PlayerControl.Data.IsDead; }, + () => { return Arsonist.arsonist != null && Arsonist.arsonist == CachedPlayer.LocalPlayer.PlayerControl && !CachedPlayer.LocalPlayer.Data.IsDead; }, () => { bool dousedEveryoneAlive = Arsonist.dousedEveryoneAlive(); if (dousedEveryoneAlive) @@ -2698,7 +2698,7 @@ public static void createButtonsPostfix(HudManager __instance) { () => { noisemakerButton.Timer = noisemakerButton.MaxTimer = Noisemaker.cooldown; - Noisemaker.currentTarget = null; + Noisemaker.target = null; }, Noisemaker.getButtonSprite(), CustomButton.ButtonPositions.lowerRowRight, @@ -3509,7 +3509,7 @@ public static void createButtonsPostfix(HudManager __instance) { } } }, - () => { return Vulture.vulture != null && Vulture.vulture == CachedPlayer.LocalPlayer.PlayerControl && !CachedPlayer.LocalPlayer.PlayerControl.Data.IsDead; }, + () => { return Vulture.vulture != null && Vulture.vulture == CachedPlayer.LocalPlayer.PlayerControl && !CachedPlayer.LocalPlayer.Data.IsDead; }, () => { if (vultureRemainingText != null) vultureRemainingText.text = (Vulture.vultureNumberToWin - Vulture.eatenBodies).ToString(); @@ -3570,7 +3570,7 @@ public static void createButtonsPostfix(HudManager __instance) { SoundEffectsManager.play("mediumAsk"); } }, - () => { return Medium.medium != null && Medium.medium == CachedPlayer.LocalPlayer.PlayerControl && !CachedPlayer.LocalPlayer.PlayerControl.Data.IsDead; }, + () => { return Medium.medium != null && Medium.medium == CachedPlayer.LocalPlayer.PlayerControl && !CachedPlayer.LocalPlayer.Data.IsDead; }, () => { if (mediumButton.isEffectActive && Medium.target != Medium.soulTarget) { Medium.soulTarget = null; @@ -3844,7 +3844,7 @@ Func fortuneTellerCouldUse(byte index) } }, - () => { return Pursuer.pursuer != null && Pursuer.pursuer == CachedPlayer.LocalPlayer.PlayerControl && !CachedPlayer.LocalPlayer.PlayerControl.Data.IsDead && Pursuer.blanks < Pursuer.blanksNumber; }, + () => { return Pursuer.pursuer != null && Pursuer.pursuer == CachedPlayer.LocalPlayer.PlayerControl && !CachedPlayer.LocalPlayer.Data.IsDead && Pursuer.blanks < Pursuer.blanksNumber; }, () => { if (pursuerButtonBlanksText != null) pursuerButtonBlanksText.text = $"{Pursuer.blanksNumber - Pursuer.blanks}"; @@ -3876,7 +3876,7 @@ Func fortuneTellerCouldUse(byte index) SoundEffectsManager.play("witchSpell"); } }, - () => { return Witch.witch != null && Witch.witch == CachedPlayer.LocalPlayer.PlayerControl && !CachedPlayer.LocalPlayer.PlayerControl.Data.IsDead; }, + () => { return Witch.witch != null && Witch.witch == CachedPlayer.LocalPlayer.PlayerControl && !CachedPlayer.LocalPlayer.Data.IsDead; }, () => { if (witchSpellButton.isEffectActive && Witch.spellCastingTarget != Witch.currentTarget) { Witch.spellCastingTarget = null; @@ -4072,7 +4072,7 @@ Func fortuneTellerCouldUse(byte index) AmongUsClient.Instance.FinishRpcImmediately(writer); } }, - () => { return Assassin.assassin != null && Assassin.assassin == CachedPlayer.LocalPlayer.PlayerControl && !CachedPlayer.LocalPlayer.PlayerControl.Data.IsDead; }, + () => { return Assassin.assassin != null && Assassin.assassin == CachedPlayer.LocalPlayer.PlayerControl && !CachedPlayer.LocalPlayer.Data.IsDead; }, () => { // CouldUse assassinButton.Sprite = Assassin.assassinMarked != null ? Assassin.getKillButtonSprite() : Assassin.getMarkButtonSprite(); return (Assassin.currentTarget != null || (Assassin.assassinMarked != null && !TransportationToolPatches.isUsingTransportation(Assassin.assassinMarked))) && CachedPlayer.LocalPlayer.PlayerControl.CanMove; @@ -4106,7 +4106,7 @@ Func fortuneTellerCouldUse(byte index) AmongUsClient.Instance.FinishRpcImmediately(writer); mayorMeetingButton.Timer = 1f; }, - () => { return Mayor.mayor != null && Mayor.mayor == CachedPlayer.LocalPlayer.PlayerControl && !CachedPlayer.LocalPlayer.PlayerControl.Data.IsDead && Mayor.meetingButton; }, + () => { return Mayor.mayor != null && Mayor.mayor == CachedPlayer.LocalPlayer.PlayerControl && !CachedPlayer.LocalPlayer.Data.IsDead && Mayor.meetingButton; }, () => { mayorMeetingButton.actionButton.OverrideText(ModTranslation.getString("mayorEmergencyLeftText") + " (" + Mayor.remoteMeetingsLeft + ")"); bool sabotageActive = false; @@ -4341,7 +4341,7 @@ Func fortuneTellerCouldUse(byte index) RPCProcedure.uncheckedMurderPlayer(thief.PlayerId, target.PlayerId, byte.MaxValue); } }, - () => { return Thief.thief != null && CachedPlayer.LocalPlayer.PlayerControl == Thief.thief && !CachedPlayer.LocalPlayer.PlayerControl.Data.IsDead; }, + () => { return Thief.thief != null && CachedPlayer.LocalPlayer.PlayerControl == Thief.thief && !CachedPlayer.LocalPlayer.Data.IsDead; }, () => { return Thief.currentTarget != null && CachedPlayer.LocalPlayer.PlayerControl.CanMove; }, () => { thiefKillButton.Timer = thiefKillButton.MaxTimer; }, __instance.KillButton.graphic.sprite, @@ -4429,7 +4429,7 @@ Func fortuneTellerCouldUse(byte index) AmongUsClient.Instance.FinishRpcImmediately(writer); RPCProcedure.shareTimer(Hunter.AdminPunish); }, - () => { return HideNSeek.isHunter() && !CachedPlayer.LocalPlayer.PlayerControl.Data.IsDead; }, + () => { return HideNSeek.isHunter() && !CachedPlayer.LocalPlayer.Data.IsDead; }, () => { return true; }, () => { hunterAdminTableButton.Timer = hunterAdminTableButton.MaxTimer; @@ -4461,7 +4461,7 @@ Func fortuneTellerCouldUse(byte index) AmongUsClient.Instance.FinishRpcImmediately(writer); RPCProcedure.shareTimer(Hunter.ArrowPunish); }, - () => { return HideNSeek.isHunter() && !CachedPlayer.LocalPlayer.PlayerControl.Data.IsDead; }, + () => { return HideNSeek.isHunter() && !CachedPlayer.LocalPlayer.Data.IsDead; }, () => { return true; }, () => { hunterArrowButton.Timer = 30f; diff --git a/TheOtherRoles/Objects/CustomButton.cs b/TheOtherRoles/Objects/CustomButton.cs index 04abd18..450f2bd 100644 --- a/TheOtherRoles/Objects/CustomButton.cs +++ b/TheOtherRoles/Objects/CustomButton.cs @@ -181,8 +181,8 @@ public void setActive(bool isActive) { public void Update() { - var localPlayer = CachedPlayer.LocalPlayer.PlayerControl; - var moveable = localPlayer.moveable; + var localPlayer = CachedPlayer.LocalPlayer; + var moveable = localPlayer.PlayerControl.moveable; if (localPlayer.Data == null || MeetingHud.Instance || ExileController.Instance || !HasButton()) { setActive(false); @@ -193,7 +193,7 @@ public void Update() if (DeputyTimer >= 0) { // This had to be reordered, so that the handcuffs do not stop the underlying timers from running if (HasEffect && isEffectActive) DeputyTimer -= Time.deltaTime; - else if (!localPlayer.inVent && moveable) + else if (!localPlayer.PlayerControl.inVent && moveable) DeputyTimer -= Time.deltaTime; } @@ -237,7 +237,7 @@ public void Update() if (Timer <= 3f && Timer > 0f && shakeOnEnd) actionButton.graphic.transform.localPosition = actionButton.transform.localPosition + (Vector3)UnityEngine.Random.insideUnitCircle * 0.05f; } - else if (!localPlayer.inVent && moveable) + else if (!localPlayer.PlayerControl.inVent && moveable) Timer -= Time.deltaTime; } diff --git a/TheOtherRoles/Patches/ExileControllerPatch.cs b/TheOtherRoles/Patches/ExileControllerPatch.cs index d579283..2ba9f9e 100644 --- a/TheOtherRoles/Patches/ExileControllerPatch.cs +++ b/TheOtherRoles/Patches/ExileControllerPatch.cs @@ -437,6 +437,13 @@ static void WrapUpPostfix(NetworkedPlayerInfo exiled) // AntiTeleport set position AntiTeleport.setPosition(); + // Remove DeadBodys + DeadBody[] array = UnityEngine.Object.FindObjectsOfType(); + for (int i = 0; i < array.Length; i++) + { + UnityEngine.Object.Destroy(array[i].gameObject); + } + MapBehaviourPatch.resetRealTasks(); if (CustomOptionHolder.randomGameStartPosition.getBool() && (AntiTeleport.antiTeleport.FindAll(x => x.PlayerId == CachedPlayer.LocalPlayer.PlayerControl.PlayerId).Count == 0)) diff --git a/TheOtherRoles/Patches/MeetingPatch.cs b/TheOtherRoles/Patches/MeetingPatch.cs index 45d1e2c..cd49813 100644 --- a/TheOtherRoles/Patches/MeetingPatch.cs +++ b/TheOtherRoles/Patches/MeetingPatch.cs @@ -1028,6 +1028,8 @@ public static void Prefix(PlayerControl __instance, [HarmonyArgument(0)]Networke // Resett Bait list //Bait.active = new Dictionary(); // Save AntiTeleport position, if the player is able to move (i.e. not on a ladder or a gap thingy) + Bait.reported = true; + if (CachedPlayer.LocalPlayer.PlayerPhysics.enabled && (CachedPlayer.LocalPlayer.PlayerControl.moveable || CachedPlayer.LocalPlayer.PlayerControl.inVent || HudManagerStartPatch.hackerVitalsButton.isEffectActive || HudManagerStartPatch.hackerAdminTableButton.isEffectActive || HudManagerStartPatch.securityGuardCamButton.isEffectActive || Portal.isTeleporting && Portal.teleportedPlayers.Last().playerId == CachedPlayer.LocalPlayer.PlayerId)) diff --git a/TheOtherRoles/Patches/PlayerControlPatch.cs b/TheOtherRoles/Patches/PlayerControlPatch.cs index 35b9364..755c53e 100644 --- a/TheOtherRoles/Patches/PlayerControlPatch.cs +++ b/TheOtherRoles/Patches/PlayerControlPatch.cs @@ -554,7 +554,7 @@ static void baitUpdate() if (Bait.bait == null || Bait.bait != CachedPlayer.LocalPlayer.PlayerControl) return; // Bait report - if (Bait.bait.Data.IsDead && !Bait.reported && Bait.killed) + if (Bait.bait.Data.IsDead && !Bait.reported) { Bait.reportDelay -= Time.fixedDeltaTime; DeadPlayer deadPlayer = deadPlayers?.Where(x => x.player?.PlayerId == Bait.bait.PlayerId)?.FirstOrDefault(); @@ -1226,6 +1226,15 @@ static void bountyHunterUpdate() { } } + static void schrodingersCatUpdate() + { + if (SchrodingersCat.schrodingersCat == null || CachedPlayer.LocalPlayer.PlayerControl != SchrodingersCat.schrodingersCat) return; + if (SchrodingersCat.schrodingersCat.Data.IsDead || SchrodingersCat.hasTeam() || MeetingHud.Instance || ExileController.Instance) { + if (SchrodingersCat.shownMenu) SchrodingersCat.showMenu(); + return; + } + } + static void jekyllAndHydeSetTarget() { if (JekyllAndHyde.jekyllAndHyde == null || CachedPlayer.LocalPlayer.PlayerControl != JekyllAndHyde.jekyllAndHyde || JekyllAndHyde.jekyllAndHyde.Data.IsDead || JekyllAndHyde.isJekyll()) return; @@ -1615,9 +1624,7 @@ public static void cupidUpdate() { HudManagerStartPatch.cupidTimeRemainingText.text = TimeSpan.FromSeconds(Cupid.timeLeft).ToString(@"mm\:ss"); } - HudManagerStartPatch.cupidTimeRemainingText.enabled = !(MapBehaviour.Instance && MapBehaviour.Instance.IsOpen) && - !MeetingHud.Instance && - !ExileController.Instance; + HudManagerStartPatch.cupidTimeRemainingText.enabled = Helpers.ShowButtons; } else HudManagerStartPatch.cupidTimeRemainingText.enabled = false; } @@ -1646,9 +1653,7 @@ public static void akujoUpdate() { HudManagerStartPatch.akujoTimeRemainingText.text = TimeSpan.FromSeconds(Akujo.timeLeft).ToString(@"mm\:ss"); } - HudManagerStartPatch.akujoTimeRemainingText.enabled = !(MapBehaviour.Instance && MapBehaviour.Instance.IsOpen) && - !MeetingHud.Instance && - !ExileController.Instance; + HudManagerStartPatch.akujoTimeRemainingText.enabled = Helpers.ShowButtons; } else HudManagerStartPatch.akujoTimeRemainingText.enabled = false; } @@ -2125,6 +2130,8 @@ public static void Postfix(PlayerControl __instance) { // Cupid cupidSetTarget(); cupidUpdate(); + // Schrodinger's Cat + schrodingersCatUpdate(); // Blackmailer blackmailerSetTarget(); // Prophet @@ -2400,7 +2407,7 @@ public static void Postfix(PlayerControl __instance, [HarmonyArgument(0)]PlayerC // Show flash on bait kill to the killer if enabled if (Bait.bait != null && target == Bait.bait) { - Bait.killed = true; + Bait.reported = false; if (Bait.showKillFlash && __instance != Bait.bait && __instance == CachedPlayer.LocalPlayer.PlayerControl) { Helpers.showFlash(new Color(204f / 255f, 102f / 255f, 0f / 255f)); } @@ -3020,23 +3027,12 @@ public static void Postfix(PlayerControl __instance) if (NekoKabocha.nekoKabocha != null && __instance == NekoKabocha.nekoKabocha && NekoKabocha.meetingKiller != null) { PlayerControl killer = NekoKabocha.meetingKiller; - bool revengeFlag = (NekoKabocha.revengeCrew && (!Helpers.isNeutral(killer) && !killer.Data.Role.IsImpostor)) || + bool revengeFlag = (NekoKabocha.revengeCrew && !Helpers.isNeutral(killer) && !killer.Data.Role.IsImpostor) || (NekoKabocha.revengeNeutral && Helpers.isNeutral(killer)) || (NekoKabocha.revengeImpostor && killer.Data.Role.IsImpostor); - if (MeetingHud.Instance && revengeFlag) - { - foreach (PlayerVoteArea pva in MeetingHud.Instance.playerStates) - { - if (pva.VotedFor != killer.PlayerId) continue; - pva.UnsetVote(); - var voteAreaPlayer = Helpers.playerById(pva.TargetPlayerId); - if (!voteAreaPlayer.AmOwner) continue; - MeetingHud.Instance.ClearVote(); - } - - if (AmongUsClient.Instance.AmHost) - MeetingHud.Instance.CheckForEndVoting(); + if (MeetingHud.Instance && revengeFlag) { + RPCProcedure.updateMeeting(killer.PlayerId); } } @@ -3063,30 +3059,10 @@ public static void Postfix(PlayerControl __instance) } if (MeetingHud.Instance && otherLover != null) - { - foreach (PlayerVoteArea pva in MeetingHud.Instance.playerStates) - { - if (pva.VotedFor != otherLover.PlayerId) continue; - pva.UnsetVote(); - var voteAreaPlayer = Helpers.playerById(pva.TargetPlayerId); - if (!voteAreaPlayer.AmOwner) continue; - MeetingHud.Instance.ClearVote(); - } - - if (Cupid.cupid != null && !Cupid.cupid.Data.IsDead) - { - foreach (PlayerVoteArea pva in MeetingHud.Instance.playerStates) - { - if (pva.VotedFor != Cupid.cupid.PlayerId) continue; - pva.UnsetVote(); - var voteAreaPlayer = Helpers.playerById(pva.TargetPlayerId); - if (!voteAreaPlayer.AmOwner) continue; - MeetingHud.Instance.ClearVote(); - } - } - - if (AmongUsClient.Instance.AmHost) - MeetingHud.Instance.CheckForEndVoting(); + { + RPCProcedure.updateMeeting(otherLover.PlayerId); + if (Cupid.cupid != null && !Cupid.cupid.Data.IsDead) + RPCProcedure.updateMeeting(Cupid.cupid.PlayerId); } if (Cupid.cupid != null && !Cupid.cupid.Data.IsDead) @@ -3103,23 +3079,8 @@ public static void Postfix(PlayerControl __instance) if (MimicK.ifOneDiesBothDie && !otherMimic.Data.IsDead) { otherMimic.Exiled(); - GameHistory.overrideDeathReasonAndKiller(otherMimic, DeadPlayer.CustomDeathReason.Suicide); - } - - // Going to reset the votes here - if (MeetingHud.Instance && MimicK.ifOneDiesBothDie && otherMimic != null) - { - foreach (PlayerVoteArea pva in MeetingHud.Instance.playerStates) - { - if (pva.VotedFor != otherMimic.PlayerId) continue; - pva.UnsetVote(); - var voteAreaPlayer = Helpers.playerById(pva.TargetPlayerId); - if (!voteAreaPlayer.AmOwner) continue; - MeetingHud.Instance.ClearVote(); - } - - if (AmongUsClient.Instance.AmHost) - MeetingHud.Instance.CheckForEndVoting(); + GameHistory.overrideDeathReasonAndKiller(otherMimic, DeadPlayer.CustomDeathReason.Suicide); + RPCProcedure.updateMeeting(otherMimic.PlayerId); } } @@ -3130,22 +3091,8 @@ public static void Postfix(PlayerControl __instance) if (otherBomber != null && BomberA.ifOneDiesBothDie && !otherBomber.Data.IsDead) { otherBomber.Exiled(); - GameHistory.overrideDeathReasonAndKiller(otherBomber, DeadPlayer.CustomDeathReason.Suicide); - } - - if (MeetingHud.Instance && BomberA.ifOneDiesBothDie && otherBomber != null) - { - foreach (PlayerVoteArea pva in MeetingHud.Instance.playerStates) - { - if (pva.VotedFor != otherBomber.PlayerId) continue; - pva.UnsetVote(); - var voteAreaPlayer = Helpers.playerById(pva.TargetPlayerId); - if (!voteAreaPlayer.AmOwner) continue; - MeetingHud.Instance.ClearVote(); - } - - if (AmongUsClient.Instance.AmHost) - MeetingHud.Instance.CheckForEndVoting(); + GameHistory.overrideDeathReasonAndKiller(otherBomber, DeadPlayer.CustomDeathReason.Suicide); + RPCProcedure.updateMeeting(otherBomber.PlayerId); } } @@ -3157,22 +3104,8 @@ public static void Postfix(PlayerControl __instance) { if (NekoKabocha.nekoKabocha != null && akujoPartner == NekoKabocha.nekoKabocha) NekoKabocha.otherKiller = akujoPartner; akujoPartner.Exiled(); - GameHistory.overrideDeathReasonAndKiller(akujoPartner, DeadPlayer.CustomDeathReason.LoverSuicide); - } - - if (MeetingHud.Instance && akujoPartner != null) - { - foreach (PlayerVoteArea pva in MeetingHud.Instance.playerStates) - { - if (pva.VotedFor != akujoPartner.PlayerId) continue; - pva.UnsetVote(); - var voteAreaPlayer = Helpers.playerById(pva.TargetPlayerId); - if (!voteAreaPlayer.AmOwner) continue; - MeetingHud.Instance.ClearVote(); - } - - if (AmongUsClient.Instance.AmHost) - MeetingHud.Instance.CheckForEndVoting(); + GameHistory.overrideDeathReasonAndKiller(akujoPartner, DeadPlayer.CustomDeathReason.LoverSuicide); + RPCProcedure.updateMeeting(akujoPartner.PlayerId); } } diff --git a/TheOtherRoles/Patches/RoleAssignmentPatch.cs b/TheOtherRoles/Patches/RoleAssignmentPatch.cs index 1ba4e5f..d986165 100644 --- a/TheOtherRoles/Patches/RoleAssignmentPatch.cs +++ b/TheOtherRoles/Patches/RoleAssignmentPatch.cs @@ -586,11 +586,31 @@ private static void assignModifiers() { RoleId.Sunglasses, RoleId.Vip, RoleId.Invert, - RoleId.Chameleon, - RoleId.Madmate + RoleId.Chameleon //RoleId.Shifter }); + + if (rnd.Next(1, 101) <= CustomOptionHolder.madmateSpawnRate.getSelection() * 10) + { + var crewPlayerMadmate = new List(players); + crewPlayerMadmate.RemoveAll(x => x.Data.Role.IsImpostor || Helpers.isNeutral(x) || x == Spy.spy || x == FortuneTeller.fortuneTeller || x == Sprinter.sprinter || x == Veteran.veteran + || x == Deputy.deputy || x == Portalmaker.portalmaker || x == TaskMaster.taskMaster || x == Sherlock.sherlock || x == Snitch.snitch || x == Teleporter.teleporter || x == Prophet.prophet); + + // Always remember to remove the Mad Sheriff if Deputy is assigned + if (Deputy.deputy != null && Sheriff.sheriff != null) crewPlayerMadmate.RemoveAll(x => x == Sheriff.sheriff); + + int madmateCount = 0; + byte playerId; + while (madmateCount < CustomOptionHolder.madmateQuantity.getQuantity() && crewPlayerMadmate.Count > 0) + { + playerId = setModifierToRandomPlayer((byte)RoleId.Madmate, crewPlayerMadmate); + crewPlayerMadmate.RemoveAll(x => x.PlayerId == playerId); + madmateCount++; + modifierCount--; + } + } + if (rnd.Next(1, 101) <= CustomOptionHolder.modifierLover.getSelection() * 10) { // Assign lover bool isEvilLover = rnd.Next(1, 101) <= CustomOptionHolder.modifierLoverImpLoverRate.getSelection() * 10; byte firstLoverId; @@ -722,24 +742,6 @@ private static void assignModifiersToPlayers(List modifiers, List x.PlayerId == playerId); modifiers.RemoveAll(x => x == RoleId.Shifter); }*/ - if (modifiers.Contains(RoleId.Madmate)) - { - var crewPlayerMadmate = new List(crewPlayer); - crewPlayerMadmate.RemoveAll(x => x == Spy.spy || x == FortuneTeller.fortuneTeller || x == Sprinter.sprinter || x == Veteran.veteran - || x == Deputy.deputy || x == Portalmaker.portalmaker || x == TaskMaster.taskMaster || x == Sherlock.sherlock || x == Snitch.snitch || x == Teleporter.teleporter || x == Prophet.prophet); - - // Always remember to remove the Mad Sheriff if Deputy is assigned - if (Deputy.deputy != null && Sheriff.sheriff != null) crewPlayerMadmate.RemoveAll(x => x == Sheriff.sheriff); - - int madmateCount = 0; - while (madmateCount < modifiers.FindAll(x => x == RoleId.Madmate).Count) - { - playerId = setModifierToRandomPlayer((byte)RoleId.Madmate, crewPlayerMadmate); - crewPlayerMadmate.RemoveAll(x => x.PlayerId == playerId); - madmateCount++; - } - modifiers.RemoveAll(x => x == RoleId.Madmate); - } if (modifiers.Contains(RoleId.Sunglasses)) { int sunglassesCount = 0; while (sunglassesCount < modifiers.FindAll(x => x == RoleId.Sunglasses).Count) { diff --git a/TheOtherRoles/Players/CachedPlayer.cs b/TheOtherRoles/Players/CachedPlayer.cs index 39dcf97..6111d0b 100644 --- a/TheOtherRoles/Players/CachedPlayer.cs +++ b/TheOtherRoles/Players/CachedPlayer.cs @@ -19,7 +19,7 @@ public class CachedPlayer public PlayerControl PlayerControl; public PlayerPhysics PlayerPhysics; public CustomNetworkTransform NetTransform; - public NetworkedPlayerInfo Data; + public NetworkedPlayerInfo Data => PlayerControl.Data; public byte PlayerId; public static implicit operator bool(CachedPlayer player) @@ -105,7 +105,6 @@ public static void AddCachedDataOnDeserialize() { foreach (CachedPlayer cachedPlayer in CachedPlayer.AllPlayers) { - cachedPlayer.Data = cachedPlayer.PlayerControl.Data; cachedPlayer.PlayerId = cachedPlayer.PlayerControl.PlayerId; } } @@ -116,7 +115,6 @@ public static void AddCachedDataOnAddPlayer() { foreach (CachedPlayer cachedPlayer in CachedPlayer.AllPlayers) { - cachedPlayer.Data = cachedPlayer.PlayerControl.Data; cachedPlayer.PlayerId = cachedPlayer.PlayerControl.PlayerId; } } @@ -127,4 +125,4 @@ public static void SetCachedPlayerId(PlayerControl __instance) { CachedPlayer.PlayerPtrs[__instance.Pointer].PlayerId = __instance.PlayerId; } -} \ No newline at end of file +} diff --git a/TheOtherRoles/RPC.cs b/TheOtherRoles/RPC.cs index 5ab7518..d89d499 100644 --- a/TheOtherRoles/RPC.cs +++ b/TheOtherRoles/RPC.cs @@ -2004,7 +2004,7 @@ public static void cupidSuicide(byte cupidId, bool isScapegoat) cupid.MurderPlayer(cupid, MurderResultFlags.Succeeded); GameHistory.overrideDeathReasonAndKiller(cupid, isScapegoat ? DeadPlayer.CustomDeathReason.Scapegoat : DeadPlayer.CustomDeathReason.Suicide); if (MeetingHud.Instance) updateMeeting(cupidId); - if (CachedPlayer.LocalPlayer.PlayerControl == cupid) _ = new StaticAchievementToken("cupid.another1"); + if (CachedPlayer.LocalPlayer.PlayerControl == cupid && isScapegoat) _ = new StaticAchievementToken("cupid.another1"); } } diff --git a/TheOtherRoles/RoleInfo.cs b/TheOtherRoles/RoleInfo.cs index fffa8c7..44bb37d 100644 --- a/TheOtherRoles/RoleInfo.cs +++ b/TheOtherRoles/RoleInfo.cs @@ -325,11 +325,11 @@ public static List getRoleInfoForPlayer(PlayerControl p, bool showModi } if (p == TaskMaster.taskMaster) { - if (CachedPlayer.LocalPlayer.PlayerControl.Data.IsDead || includeHidden || !TaskMaster.becomeATaskMasterWhenCompleteAllTasks) infos.Add(taskMaster); + if (CachedPlayer.LocalPlayer.Data.IsDead || includeHidden || !TaskMaster.becomeATaskMasterWhenCompleteAllTasks) infos.Add(taskMaster); else infos.Add(TaskMaster.isTaskComplete ? taskMaster : crewmate); } if (p == PlagueDoctor.plagueDoctor) infos.Add(plagueDoctor); - if (p == SchrodingersCat.schrodingersCat || p == SchrodingersCat.formerSchrodingersCat) infos.Add(!SchrodingersCat.hideRole || includeHidden || CachedPlayer.LocalPlayer.PlayerControl.Data.IsDead + if (p == SchrodingersCat.schrodingersCat || p == SchrodingersCat.formerSchrodingersCat) infos.Add(!SchrodingersCat.hideRole || includeHidden || CachedPlayer.LocalPlayer.Data.IsDead || SchrodingersCat.hasTeam() || SchrodingersCat.tasksComplete(CachedPlayer.LocalPlayer.PlayerControl) ? schrodingersCat : crewmate); if (p == Opportunist.opportunist) infos.Add(opportunist); if (p == Shifter.shifter) infos.Add(Shifter.isNeutral ? chainshifter : niceshifter); @@ -425,7 +425,7 @@ public static String GetRolesString(PlayerControl p, bool useColors, bool showMo if (Arsonist.dousedPlayers.Contains(p)) roleName = Helpers.cs(Arsonist.color, "♨ ") + roleName; if (p == Arsonist.arsonist) - roleName += Helpers.cs(Arsonist.color, $" ({CachedPlayer.AllPlayers.Count(x => { return x.PlayerControl != Arsonist.arsonist && !x.PlayerControl.Data.IsDead && !x.PlayerControl.Data.Disconnected && !Arsonist.dousedPlayers.Any(y => y.PlayerId == x.PlayerControl.PlayerId); })} {ModTranslation.getString("roleInfoRemaining")})"); + roleName += Helpers.cs(Arsonist.color, $" ({CachedPlayer.AllPlayers.Count(x => { return x.PlayerControl != Arsonist.arsonist && !x.Data.IsDead && !x.Data.Disconnected && !Arsonist.dousedPlayers.Any(y => y.PlayerId == x.PlayerId); })} {ModTranslation.getString("roleInfoRemaining")})"); if (p == Jackal.fakeSidekick) roleName = Helpers.cs(Sidekick.color, ModTranslation.getString("roleInfoFakeSD")) + roleName; if (Akujo.keeps.Contains(p)) diff --git a/TheOtherRoles/TheOtherRoles.cs b/TheOtherRoles/TheOtherRoles.cs index 4e25ee6..bd147de 100644 --- a/TheOtherRoles/TheOtherRoles.cs +++ b/TheOtherRoles/TheOtherRoles.cs @@ -423,7 +423,7 @@ public static void setHandcuffedKnows(bool active = true, byte playerId = Byte.M playerId = CachedPlayer.LocalPlayer.PlayerId; if (active && playerId == CachedPlayer.LocalPlayer.PlayerId) { - MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(CachedPlayer.LocalPlayer.PlayerControl.NetId, (byte)CustomRPC.ShareGhostInfo, Hazel.SendOption.Reliable, -1); + MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(CachedPlayer.LocalPlayer.PlayerControl.NetId, (byte)CustomRPC.ShareGhostInfo, SendOption.Reliable, -1); writer.Write(CachedPlayer.LocalPlayer.PlayerId); writer.Write((byte)RPCProcedure.GhostInfoTypes.HandcuffNoticed); AmongUsClient.Instance.FinishRpcImmediately(writer); @@ -695,7 +695,7 @@ public static bool existingWithKiller() { } public static bool hasAliveKillingLover(this PlayerControl player) { - if (!Lovers.existingAndAlive() || !existingWithKiller()) + if (!existingAndAlive() || !existingWithKiller()) return false; return (player != null && (player == lover1 || player == lover2)); } @@ -1360,7 +1360,7 @@ public static void clearAndReload() { public static void resetCurse() { HudManagerStartPatch.warlockCurseButton.Timer = HudManagerStartPatch.warlockCurseButton.MaxTimer; - HudManagerStartPatch.warlockCurseButton.Sprite = Warlock.getCurseButtonSprite(); + HudManagerStartPatch.warlockCurseButton.Sprite = getCurseButtonSprite(); HudManagerStartPatch.warlockCurseButton.actionButton.cooldownTimerText.color = Palette.EnabledColor; currentTarget = null; curseVictim = null; @@ -1515,7 +1515,7 @@ public static Sprite getIgniteSprite() { } public static bool dousedEveryoneAlive() { - return CachedPlayer.AllPlayers.All(x => { return x.PlayerControl == Arsonist.arsonist || x.PlayerControl.Data.IsDead || x.PlayerControl.Data.Disconnected || Arsonist.dousedPlayers.Any(y => y.PlayerId == x.PlayerControl.PlayerId); }); + return CachedPlayer.AllPlayers.All(x => { return x.PlayerControl == arsonist || x.Data.IsDead || x.Data.Disconnected || dousedPlayers.Any(y => y.PlayerId == x.PlayerId); }); } public static void clearAndReload() { @@ -1796,7 +1796,7 @@ public static string getInfo(PlayerControl target, PlayerControl killer) { } else { int randomNumber = rnd.Next(4); string typeOfColor = Helpers.isLighterColor(Medium.target.killerIfExisting.Data.DefaultOutfit.ColorId) ? ModTranslation.getString("mediumSoulPlayerLighter") : ModTranslation.getString("mediumSoulPlayerDarker"); - float timeSinceDeath = ((float)(Medium.meetingStartTime - Medium.target.timeOfDeath).TotalMilliseconds); + float timeSinceDeath = ((float)(meetingStartTime - Medium.target.timeOfDeath).TotalMilliseconds); var roleString = RoleInfo.GetRolesString(Medium.target.player, false, includeHidden: true); var roleInfo = RoleInfo.getRoleInfoForPlayer(Medium.target.player); @@ -2308,7 +2308,7 @@ public static void divine(PlayerControl p) numUsed += 1; // 占いを実行したことで発火される処理を他クライアントに通知 - MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.FortuneTellerUsedDivine, Hazel.SendOption.Reliable, -1); + MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.FortuneTellerUsedDivine, SendOption.Reliable, -1); writer.Write(PlayerControl.LocalPlayer.PlayerId); writer.Write(p.PlayerId); AmongUsClient.Instance.FinishRpcImmediately(writer); @@ -2473,7 +2473,7 @@ public static void setTrap() byte[] buff = new byte[sizeof(float) * 2]; Buffer.BlockCopy(BitConverter.GetBytes(pos.x), 0, buff, 0 * sizeof(float), sizeof(float)); Buffer.BlockCopy(BitConverter.GetBytes(pos.y), 0, buff, 1 * sizeof(float), sizeof(float)); - MessageWriter writer = AmongUsClient.Instance.StartRpc(CachedPlayer.LocalPlayer.PlayerControl.NetId, (byte)CustomRPC.PlaceTrap, Hazel.SendOption.Reliable); + MessageWriter writer = AmongUsClient.Instance.StartRpc(CachedPlayer.LocalPlayer.PlayerControl.NetId, (byte)CustomRPC.PlaceTrap, SendOption.Reliable); writer.WriteBytesAndSize(buff); writer.EndMessage(); RPCProcedure.placeTrap(buff); @@ -2506,8 +2506,8 @@ public static class SchrodingersCat public static PoolablePlayer playerTemplate; public static GameObject parent; - private static List teams; - private static bool shownMenu = false; + public static List teams; + public static bool shownMenu = false; public static PlayerControl currentTarget; public enum Team @@ -2615,7 +2615,7 @@ public static void showMenu() parent.transform.localPosition = new Vector3(0, 0, 0); var impostor = createPoolable(parent, "impostor", 0, (UnityAction)((Action)(() => { - MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(CachedPlayer.LocalPlayer.PlayerControl.NetId, (byte)CustomRPC.SchrodingersCatSetTeam, Hazel.SendOption.Reliable, -1); + MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(CachedPlayer.LocalPlayer.PlayerControl.NetId, (byte)CustomRPC.SchrodingersCatSetTeam, SendOption.Reliable, -1); writer.Write((byte)Team.Impostor); AmongUsClient.Instance.FinishRpcImmediately(writer); RPCProcedure.schrodingersCatSetTeam((byte)Team.Impostor); @@ -2626,7 +2626,7 @@ public static void showMenu() { var jackal = createPoolable(parent, "jackal", 1, (UnityAction)((Action)(() => { - MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(CachedPlayer.LocalPlayer.PlayerControl.NetId, (byte)CustomRPC.SchrodingersCatSetTeam, Hazel.SendOption.Reliable, -1); + MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(CachedPlayer.LocalPlayer.PlayerControl.NetId, (byte)CustomRPC.SchrodingersCatSetTeam, SendOption.Reliable, -1); writer.Write((byte)Team.Jackal); AmongUsClient.Instance.FinishRpcImmediately(writer); RPCProcedure.schrodingersCatSetTeam((byte)Team.Jackal); @@ -2638,7 +2638,7 @@ public static void showMenu() { var moriarty = createPoolable(parent, "moriarty", 2, (UnityAction)((Action)(() => { - MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(CachedPlayer.LocalPlayer.PlayerControl.NetId, (byte)CustomRPC.SchrodingersCatSetTeam, Hazel.SendOption.Reliable, -1); + MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(CachedPlayer.LocalPlayer.PlayerControl.NetId, (byte)CustomRPC.SchrodingersCatSetTeam, SendOption.Reliable, -1); writer.Write((byte)Team.Moriarty); AmongUsClient.Instance.FinishRpcImmediately(writer); RPCProcedure.schrodingersCatSetTeam((byte)Team.Moriarty); @@ -2650,7 +2650,7 @@ public static void showMenu() { var jekyllAndHyde = createPoolable(parent, "jekyllAndHyde", 6, (UnityAction)((Action)(() => { - MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(CachedPlayer.LocalPlayer.PlayerControl.NetId, (byte)CustomRPC.SchrodingersCatSetTeam, Hazel.SendOption.Reliable, -1); + MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(CachedPlayer.LocalPlayer.PlayerControl.NetId, (byte)CustomRPC.SchrodingersCatSetTeam, SendOption.Reliable, -1); writer.Write((byte)Team.JekyllAndHyde); AmongUsClient.Instance.FinishRpcImmediately(writer); RPCProcedure.schrodingersCatSetTeam((byte)Team.JekyllAndHyde); @@ -2660,7 +2660,7 @@ public static void showMenu() } var crewmate = createPoolable(parent, "crewmate", 10, (UnityAction)((Action)(() => { - MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(CachedPlayer.LocalPlayer.PlayerControl.NetId, (byte)CustomRPC.SchrodingersCatSetTeam, Hazel.SendOption.Reliable, -1); + MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(CachedPlayer.LocalPlayer.PlayerControl.NetId, (byte)CustomRPC.SchrodingersCatSetTeam, SendOption.Reliable, -1); writer.Write((byte)Team.Crewmate); AmongUsClient.Instance.FinishRpcImmediately(writer); RPCProcedure.schrodingersCatSetTeam((byte)Team.Crewmate); @@ -2726,13 +2726,13 @@ public static bool isMoriartyButtonEnable() private static PoolablePlayer createPoolable(GameObject parent, string name, int color, UnityAction func) { - var poolable = GameObject.Instantiate(playerTemplate, parent.transform); + var poolable = UnityEngine.Object.Instantiate(playerTemplate, parent.transform); var actionButton = UnityEngine.Object.Instantiate(FastDestroyableSingleton.Instance.KillButton, poolable.gameObject.transform); SpriteRenderer spriteRenderer = actionButton.GetComponent(); spriteRenderer.sprite = null; actionButton.transform.localPosition = new Vector3(0, 0, 0); actionButton.gameObject.SetActive(true); - actionButton.gameObject.ForEachChild((Il2CppSystem.Action)((c) => { if (c.name.Equals("HotKeyGuide")) GameObject.Destroy(c); })); + actionButton.gameObject.ForEachChild((Il2CppSystem.Action)((c) => { if (c.name.Equals("HotKeyGuide")) UnityEngine.Object.Destroy(c); })); PassiveButton button = actionButton.GetComponent(); button.OnClick = new Button.ButtonClickedEvent(); button.OnClick.AddListener((UnityAction)func); @@ -2826,7 +2826,7 @@ public static Sprite getReleaseButtonSprite() public static void arrowUpdate() { - if ((BomberA.bombTarget == null || BomberB.bombTarget == null) && !alwaysShowArrow) return; + if ((bombTarget == null || BomberB.bombTarget == null) && !alwaysShowArrow) return; if (bomberA.Data.IsDead) { if (arrows.FirstOrDefault().arrow != null) UnityEngine.Object.Destroy(arrows.FirstOrDefault().arrow); @@ -2879,7 +2879,7 @@ public static void playerIconsUpdate() { foreach (PoolablePlayer pp in TORMapOptions.playerIcons.Values) pp.gameObject.SetActive(false); //foreach (PoolablePlayer pp in TORMapOptions.playerIcons.Values) pp.gameObject.SetActive(false); - if (BomberA.bomberA != null && BomberB.bomberB != null && !BomberB.bomberB.Data.IsDead && !BomberA.bomberA.Data.IsDead && !MeetingHud.Instance) + if (bomberA != null && BomberB.bomberB != null && !BomberB.bomberB.Data.IsDead && !bomberA.Data.IsDead && !MeetingHud.Instance) { if (bombTarget != null && TORMapOptions.playerIcons.ContainsKey(bombTarget.PlayerId) && TORMapOptions.playerIcons[bombTarget.PlayerId].gameObject != null) { @@ -2890,7 +2890,7 @@ public static void playerIconsUpdate() icon.transform.localScale = Vector3.one * 0.4f; if (targetText == null) { - targetText = GameObject.Instantiate(icon.cosmetics.nameText, icon.cosmetics.nameText.transform.parent); + targetText = UnityEngine.Object.Instantiate(icon.cosmetics.nameText, icon.cosmetics.nameText.transform.parent); targetText.enableWordWrapping = false; targetText.transform.localScale = Vector3.one * 1.5f; targetText.transform.localPosition += new Vector3(0f, 1.7f, 0); @@ -2909,7 +2909,7 @@ public static void playerIconsUpdate() icon.transform.localScale = Vector3.one * 0.4f; if (partnerTargetText == null) { - partnerTargetText = GameObject.Instantiate(icon.cosmetics.nameText, icon.cosmetics.nameText.transform.parent); + partnerTargetText = UnityEngine.Object.Instantiate(icon.cosmetics.nameText, icon.cosmetics.nameText.transform.parent); partnerTargetText.enableWordWrapping = false; partnerTargetText.transform.localScale = Vector3.one * 1.5f; partnerTargetText.transform.localPosition += new Vector3(0f, 1.7f, 0); @@ -2971,7 +2971,7 @@ public static void playerIconsUpdate() { foreach (PoolablePlayer pp in TORMapOptions.playerIcons.Values) pp.gameObject.SetActive(false); //foreach (PoolablePlayer pp in TORMapOptions.playerIcons.Values) pp.gameObject.SetActive(false); - if (BomberA.bomberA != null && BomberB.bomberB != null && !BomberB.bomberB.Data.IsDead && !BomberA.bomberA.Data.IsDead && !MeetingHud.Instance) + if (BomberA.bomberA != null && bomberB != null && !bomberB.Data.IsDead && !BomberA.bomberA.Data.IsDead && !MeetingHud.Instance) { if (bombTarget != null && TORMapOptions.playerIcons.ContainsKey(bombTarget.PlayerId) && TORMapOptions.playerIcons[bombTarget.PlayerId].gameObject != null) { @@ -2982,7 +2982,7 @@ public static void playerIconsUpdate() icon.transform.localScale = Vector3.one * 0.4f; if (targetText == null) { - targetText = GameObject.Instantiate(icon.cosmetics.nameText, icon.cosmetics.nameText.transform.parent); + targetText = UnityEngine.Object.Instantiate(icon.cosmetics.nameText, icon.cosmetics.nameText.transform.parent); targetText.enableWordWrapping = false; targetText.transform.localScale = Vector3.one * 1.5f; targetText.transform.localPosition += new Vector3(0f, 1.7f, 0); @@ -3001,7 +3001,7 @@ public static void playerIconsUpdate() icon.transform.localScale = Vector3.one * 0.4f; if (partnerTargetText == null) { - partnerTargetText = GameObject.Instantiate(icon.cosmetics.nameText, icon.cosmetics.nameText.transform.parent); + partnerTargetText = UnityEngine.Object.Instantiate(icon.cosmetics.nameText, icon.cosmetics.nameText.transform.parent); partnerTargetText.enableWordWrapping = false; partnerTargetText.transform.localScale = Vector3.one * 1.5f; partnerTargetText.transform.localPosition += new Vector3(0f, 1.7f, 0); @@ -3015,7 +3015,7 @@ public static void playerIconsUpdate() public static void arrowUpdate() { - if ((BomberA.bombTarget == null || BomberB.bombTarget == null) && !BomberA.alwaysShowArrow) return; + if ((BomberA.bombTarget == null || bombTarget == null) && !BomberA.alwaysShowArrow) return; if (bomberB.Data.IsDead) { if (arrows.FirstOrDefault().arrow != null) UnityEngine.Object.Destroy(arrows.FirstOrDefault().arrow); @@ -3215,7 +3215,7 @@ public static IEnumerator OpenSecondMenu() acTokenChallenge.Value.swapTime = DateTime.UtcNow; acTokenChallenge.Value.target1 = target1.PlayerId; acTokenChallenge.Value.target2 = target2.PlayerId; - MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(CachedPlayer.LocalPlayer.PlayerControl.NetId, (byte)CustomRPC.TeleporterTeleport, Hazel.SendOption.Reliable, -1); + MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(CachedPlayer.LocalPlayer.PlayerControl.NetId, (byte)CustomRPC.TeleporterTeleport, SendOption.Reliable, -1); writer.Write(target1.PlayerId); writer.Write(target2.PlayerId); AmongUsClient.Instance.FinishRpcImmediately(writer); @@ -3271,7 +3271,7 @@ public IEnumerator Open(float delay, bool includeDead = false) if (Camera.main == null) yield break; - Menu = GameObject.Instantiate(GetShapeshifterMenu(), Camera.main.transform, false); + Menu = UnityEngine.Object.Instantiate(GetShapeshifterMenu(), Camera.main.transform, false); } Menu.transform.SetParent(Camera.main.transform, false); @@ -3282,7 +3282,7 @@ public IEnumerator Open(float delay, bool includeDead = false) private static ShapeshifterMinigame GetShapeshifterMenu() { var rolePrefab = RoleManager.Instance.AllRoles.First(r => r.Role == RoleTypes.Shapeshifter); - return GameObject.Instantiate(rolePrefab?.Cast(), GameData.Instance.transform).ShapeshifterMenu; + return UnityEngine.Object.Instantiate(rolePrefab?.Cast(), GameData.Instance.transform).ShapeshifterMenu; } public void Clicked(PlayerControl player) @@ -3314,7 +3314,7 @@ public static bool Prefix(ShapeshifterMinigame __instance) player.Data.IsDead = false; var num = i % 3; var num2 = i / 3; - var panel = GameObject.Instantiate(__instance.PanelPrefab, __instance.transform); + var panel = UnityEngine.Object.Instantiate(__instance.PanelPrefab, __instance.transform); panel.transform.localScale *= PanelAreaScale[displayType]; panel.transform.localPosition = ToVoteAreaPos(__instance, i, displayType); panel.SetPlayer(i, player.Data, (Action)(() => menu.Clicked(player))); @@ -3350,7 +3350,7 @@ public static void Prefix(PlayerControl __instance) if (__instance == null) return; try { - PlayerMenu.singleton.Menu.Close(); + singleton.Menu.Close(); } catch { } } @@ -3794,7 +3794,7 @@ public static void investigateMessage(string message, float duration, Color colo public static int getNumInvestigate() { - int counter = Sherlock.sherlock.Data.Tasks.ToArray().Where(t => t.Complete).Count(); + int counter = sherlock.Data.Tasks.ToArray().Where(t => t.Complete).Count(); return (int)Math.Floor((float)counter / numTasks); } @@ -3979,7 +3979,7 @@ public static class Undertaker public static void RpcDropBody(Vector3 position) { if (undertaker == null) return; - var writer = AmongUsClient.Instance.StartRpcImmediately(CachedPlayer.LocalPlayer.PlayerControl.NetId, (byte)CustomRPC.UndertakerDropBody, Hazel.SendOption.Reliable, -1); + var writer = AmongUsClient.Instance.StartRpcImmediately(CachedPlayer.LocalPlayer.PlayerControl.NetId, (byte)CustomRPC.UndertakerDropBody, SendOption.Reliable, -1); writer.Write(position.x); writer.Write(position.y); writer.Write(position.z); @@ -3990,7 +3990,7 @@ public static void RpcDropBody(Vector3 position) public static void RpcDragBody(byte playerId) { if (undertaker == null) return; - var writer = AmongUsClient.Instance.StartRpcImmediately(CachedPlayer.LocalPlayer.PlayerControl.NetId, (byte)CustomRPC.UndertakerDragBody, Hazel.SendOption.Reliable, -1); + var writer = AmongUsClient.Instance.StartRpcImmediately(CachedPlayer.LocalPlayer.PlayerControl.NetId, (byte)CustomRPC.UndertakerDragBody, SendOption.Reliable, -1); writer.Write(playerId); AmongUsClient.Instance.FinishRpcImmediately(writer); DragBody(playerId); @@ -5243,7 +5243,7 @@ public static void checkWinStatus() if (winFlag) { - MessageWriter winWriter = AmongUsClient.Instance.StartRpcImmediately(CachedPlayer.LocalPlayer.PlayerControl.NetId, (byte)CustomRPC.PlagueDoctorWin, Hazel.SendOption.Reliable, -1); + MessageWriter winWriter = AmongUsClient.Instance.StartRpcImmediately(CachedPlayer.LocalPlayer.PlayerControl.NetId, (byte)CustomRPC.PlagueDoctorWin, SendOption.Reliable, -1); AmongUsClient.Instance.FinishRpcImmediately(winWriter); RPCProcedure.plagueDoctorWin(); } @@ -5315,28 +5315,28 @@ public static Sprite getButtonSprite() public static bool isStealthed(PlayerControl player) { - if (Ninja.ninja != null && !Ninja.ninja.Data.IsDead && Ninja.ninja == player) + if (ninja != null && !ninja.Data.IsDead && ninja == player) { - return Ninja.stealthed; + return stealthed; } return false; } public static float stealthFade(PlayerControl player) { - if (Ninja.ninja == player && fadeTime > 0 && !Ninja.ninja.Data.IsDead) + if (ninja == player && fadeTime > 0 && !ninja.Data.IsDead) { - return Mathf.Min(1.0f, (float)(DateTime.UtcNow - Ninja.stealthedAt).TotalSeconds / fadeTime); + return Mathf.Min(1.0f, (float)(DateTime.UtcNow - stealthedAt).TotalSeconds / fadeTime); } return 1.0f; } public static void setStealthed(PlayerControl player, bool stealthed = true) { - if (Ninja.ninja == player && Ninja.ninja != null) + if (ninja == player && ninja != null) { Ninja.stealthed = stealthed; - Ninja.stealthedAt = DateTime.UtcNow; + stealthedAt = DateTime.UtcNow; } } @@ -5381,7 +5381,7 @@ public static void Postfix(PlayerPhysics __instance) __instance.body.velocity *= (speedBonus + 1); } - if (__instance.myPlayer == Ninja.ninja) + if (__instance.myPlayer == ninja) { var ninja = __instance.myPlayer; if (ninja == null || ninja.Data.IsDead) return; @@ -5442,28 +5442,28 @@ public static Sprite getButtonSprite() public static float sprintFade(PlayerControl player) { - if (Sprinter.sprinter == player && fadeTime > 0 && !Sprinter.sprinter.Data.IsDead) + if (sprinter == player && fadeTime > 0 && !sprinter.Data.IsDead) { - return Mathf.Min(1.0f, (float)(DateTime.UtcNow - Sprinter.sprintAt).TotalSeconds / fadeTime); + return Mathf.Min(1.0f, (float)(DateTime.UtcNow - sprintAt).TotalSeconds / fadeTime); } return 1.0f; } public static bool isSprinting() { - if (CachedPlayer.LocalPlayer.PlayerControl == Sprinter.sprinter && !Sprinter.sprinter.Data.IsDead) + if (CachedPlayer.LocalPlayer.PlayerControl == sprinter && !sprinter.Data.IsDead) { - return Sprinter.sprinting; + return sprinting; } return false; } public static void setSprinting(PlayerControl player, bool sprinting = true) { - if (player == Sprinter.sprinter && !Sprinter.sprinter.Data.IsDead) + if (player == sprinter && !sprinter.Data.IsDead) { Sprinter.sprinting = sprinting; - Sprinter.sprintAt = DateTime.UtcNow; + sprintAt = DateTime.UtcNow; } } @@ -5494,7 +5494,7 @@ public static class PlayerPhysicsSprinterPatch { public static void Postfix(PlayerPhysics __instance) { - if (__instance.myPlayer == Sprinter.sprinter) + if (__instance.myPlayer == sprinter) { var sprinter = __instance.myPlayer; if (sprinter == null || sprinter.Data.IsDead) return; @@ -5507,7 +5507,7 @@ public static void Postfix(PlayerPhysics __instance) var opacity = canSee ? 0.5f : 0.0f; - if (Sprinter.sprinting) + if (sprinting) { opacity = Math.Max(opacity, 1.0f - sprintFade(sprinter)); sprinter.cosmetics.currentBodySprite.BodySprite.material.SetFloat("_Outline", 0f); @@ -5551,7 +5551,7 @@ public static void clearAndReload() { } public static bool isFailedThiefKill(PlayerControl target, PlayerControl killer, RoleInfo targetRole) { - return killer == Thief.thief && !target.Data.Role.IsImpostor && !new List { RoleInfo.jackal, canKillSheriff ? RoleInfo.sheriff : null, RoleInfo.sidekick, RoleInfo.moriarty, RoleInfo.jekyllAndHyde, SchrodingersCat.hasTeam() && SchrodingersCat.team != SchrodingersCat.Team.Crewmate ? RoleInfo.schrodingersCat : + return killer == thief && !target.Data.Role.IsImpostor && !new List { RoleInfo.jackal, canKillSheriff ? RoleInfo.sheriff : null, RoleInfo.sidekick, RoleInfo.moriarty, RoleInfo.jekyllAndHyde, SchrodingersCat.hasTeam() && SchrodingersCat.team != SchrodingersCat.Team.Crewmate ? RoleInfo.schrodingersCat : null}.Contains(targetRole); } }