Skip to content

Commit

Permalink
Update Specimen version
Browse files Browse the repository at this point in the history
  • Loading branch information
EnoPM committed Dec 6, 2023
1 parent 7f5a825 commit e16ea8a
Show file tree
Hide file tree
Showing 133 changed files with 4,229 additions and 6,733 deletions.
2,292 changes: 69 additions & 2,223 deletions BetterOtherRoles/BetterOtherRoles.cs

Large diffs are not rendered by default.

10 changes: 7 additions & 3 deletions BetterOtherRoles/BetterOtherRoles.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<Version>1.5.2</Version>
<Version>1.6.0</Version>
<Description>BetterOtherRoles</Description>
<Authors>EnoPM</Authors>
<LangVersion>latest</LangVersion>
Expand All @@ -15,14 +15,18 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="AmongUs.GameLibs.Steam" Version="2023.10.24" />
<PackageReference Include="BepInEx.Unity.IL2CPP" Version="6.0.0-be.674" />
<PackageReference Include="AmongUs.GameLibs.Steam" Version="2023.11.28" />
<PackageReference Include="BepInEx.Unity.IL2CPP" Version="6.0.0-be.671" />
<PackageReference Include="BepInEx.IL2CPP.MSBuild" Version="2.1.0-rc.1" />
</ItemGroup>

<ItemGroup>
<Reference Include="AmongUsSpecimen">
<HintPath>libs\AmongUsSpecimen.dll</HintPath>
</Reference>
<Reference Include="UniverseLib.IL2CPP">
<HintPath>libs\UniverseLib.IL2CPP.dll</HintPath>
<HintPath>libs\AmongUsSpecimen.dll</HintPath>
</Reference>
</ItemGroup>
<Target Name="CopyPlugins" AfterTargets="AfterBuild">
Expand Down
164 changes: 12 additions & 152 deletions BetterOtherRoles/Buttons.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@
using BetterOtherRoles.Players;
using BetterOtherRoles.Utilities;
using BetterOtherRoles.CustomGameModes;
using BetterOtherRoles.Modifiers;
using BetterOtherRoles.Modules;
using BetterOtherRoles.Options;
using BetterOtherRoles.Roles;

namespace BetterOtherRoles
{
Expand Down Expand Up @@ -89,12 +92,12 @@ static HudManagerStartPatch()

private static void SetFirstCooldowns()
{
vampireKillButton.Timer = CustomOptionHolder.vampireFirstCooldown.getFloat();
ninjaButton.Timer = CustomOptionHolder.ninjaFirstCooldown.getFloat();
witchSpellButton.Timer = CustomOptionHolder.witchFirstCooldown.getFloat();
arsonistButton.Timer = CustomOptionHolder.arsonistFirstCooldown.getFloat();
warlockCurseButton.Timer = CustomOptionHolder.warlockFirstCooldown.getFloat();
stickyBomberButton.Timer = CustomOptionHolder.StickyBomberFirstCooldown.getFloat();
vampireKillButton.Timer = CustomOptionHolder.VampireFirstCooldown.GetFloat();
ninjaButton.Timer = CustomOptionHolder.NinjaFirstCooldown.GetFloat();
witchSpellButton.Timer = CustomOptionHolder.WitchFirstCooldown.GetFloat();
arsonistButton.Timer = CustomOptionHolder.ArsonistFirstCooldown.GetFloat();
warlockCurseButton.Timer = CustomOptionHolder.WarlockFirstCooldown.GetFloat();
stickyBomberButton.Timer = CustomOptionHolder.StickyBomberFirstCooldown.GetFloat();
}

public static void setCustomButtonCooldowns() {
Expand Down Expand Up @@ -147,10 +150,6 @@ public static void setCustomButtonCooldowns() {
mayorMeetingButton.MaxTimer = GameManager.Instance.LogicOptions.GetEmergencyCooldown();
trapperButton.MaxTimer = Trapper.cooldown;
bomberButton.MaxTimer = Bomber.bombCooldown;
hunterLighterButton.MaxTimer = Hunter.lightCooldown;
hunterAdminTableButton.MaxTimer = Hunter.AdminCooldown;
hunterArrowButton.MaxTimer = Hunter.ArrowCooldown;
huntedShieldButton.MaxTimer = Hunted.shieldCooldown;
defuseButton.MaxTimer = 0f;
defuseButton.Timer = 0f;
stickyBomberButton.MaxTimer = StickyBomber.BombCooldown;
Expand All @@ -170,9 +169,6 @@ public static void setCustomButtonCooldowns() {
trackerTrackCorpsesButton.EffectDuration = Tracker.corpsesTrackingDuration;
witchSpellButton.EffectDuration = Witch.spellCastingDuration;
securityGuardCamButton.EffectDuration = SecurityGuard.duration;
hunterLighterButton.EffectDuration = Hunter.lightDuration;
hunterArrowButton.EffectDuration = Hunter.ArrowDuration;
huntedShieldButton.EffectDuration = Hunted.shieldDuration;
defuseButton.EffectDuration = Bomber.defuseDuration;
bomberButton.EffectDuration = Bomber.destructionTime + Bomber.bombActiveAfter;
stickyBomberButton.EffectDuration = StickyBomber.Duration;
Expand Down Expand Up @@ -1883,7 +1879,7 @@ public static void createButtonsPostfix(HudManager __instance) {
() => { if (CachedPlayer.LocalPlayer.PlayerControl == null || !CachedPlayer.LocalPlayer.Data.IsDead || CachedPlayer.LocalPlayer.Data.Role.IsImpostor) return false;
var (playerCompleted, playerTotal) = TasksHandler.taskInfo(CachedPlayer.LocalPlayer.Data);
int numberOfLeftTasks = playerTotal - playerCompleted;
return numberOfLeftTasks <= 0 || !CustomOptionHolder.finishTasksBeforeHauntingOrZoomingOut.getBool();
return numberOfLeftTasks <= 0 || !CustomOptionHolder.FinishTasksBeforeHauntingOrZoomingOut.GetBool();
},
() => { return true; },
() => { return; },
Expand All @@ -1893,142 +1889,6 @@ public static void createButtonsPostfix(HudManager __instance) {
"ActionZoomOut"
);
zoomOutButton.Timer = 0f;


hunterLighterButton = new CustomButton(
() => {
Hunter.lightActive.Add(CachedPlayer.LocalPlayer.PlayerId);
SoundEffectsManager.play("lighterLight");

MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(CachedPlayer.LocalPlayer.PlayerControl.NetId, (byte)CustomRPC.ShareTimer, Hazel.SendOption.Reliable, -1);
writer.Write(Hunter.lightPunish);
AmongUsClient.Instance.FinishRpcImmediately(writer);
RPCProcedure.shareTimer(Hunter.lightPunish);
},
() => { return HideNSeek.isHunter() && !CachedPlayer.LocalPlayer.Data.IsDead; },
() => { return true; },
() => {
hunterLighterButton.Timer = 30f;
hunterLighterButton.isEffectActive = false;
hunterLighterButton.actionButton.graphic.color = Palette.EnabledColor;
},
Hunter.getLightSprite(),
CustomButton.ButtonPositions.upperRowFarLeft,
__instance,
"ActionQuaternary",
true,
Hunter.lightDuration,
() => {
Hunter.lightActive.Remove(CachedPlayer.LocalPlayer.PlayerId);
hunterLighterButton.Timer = hunterLighterButton.MaxTimer;
SoundEffectsManager.play("lighterLight");
}
);

hunterAdminTableButton = new CustomButton(
() => {
if (!MapBehaviour.Instance || !MapBehaviour.Instance.isActiveAndEnabled) {
HudManager __instance = FastDestroyableSingleton<HudManager>.Instance;
__instance.InitMap();
MapBehaviour.Instance.ShowCountOverlay(allowedToMove: true, showLivePlayerPosition: true, includeDeadBodies: false);
}

CachedPlayer.LocalPlayer.NetTransform.Halt(); // Stop current movement

MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(CachedPlayer.LocalPlayer.PlayerControl.NetId, (byte)CustomRPC.ShareTimer, Hazel.SendOption.Reliable, -1);
writer.Write(Hunter.AdminPunish);
AmongUsClient.Instance.FinishRpcImmediately(writer);
RPCProcedure.shareTimer(Hunter.AdminPunish);
},
() => { return HideNSeek.isHunter() && !CachedPlayer.LocalPlayer.Data.IsDead; },
() => { return true; },
() => {
hunterAdminTableButton.Timer = hunterAdminTableButton.MaxTimer;
hunterAdminTableButton.isEffectActive = false;
hunterAdminTableButton.actionButton.cooldownTimerText.color = Palette.EnabledColor;
},
Hacker.getAdminSprite(),
CustomButton.ButtonPositions.lowerRowCenter,
__instance,
"HunterAdmin",
true,
Hunter.AdminDuration,
() => {
hunterAdminTableButton.Timer = hunterAdminTableButton.MaxTimer;
if (MapBehaviour.Instance && MapBehaviour.Instance.isActiveAndEnabled) MapBehaviour.Instance.Close();
},
false,
"ADMIN"
);

hunterArrowButton = new CustomButton(
() => {
Hunter.arrowActive = true;
SoundEffectsManager.play("trackerTrackPlayer");

MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(CachedPlayer.LocalPlayer.PlayerControl.NetId, (byte)CustomRPC.ShareTimer, Hazel.SendOption.Reliable, -1);
writer.Write(Hunter.ArrowPunish);
AmongUsClient.Instance.FinishRpcImmediately(writer);
RPCProcedure.shareTimer(Hunter.ArrowPunish);
},
() => { return HideNSeek.isHunter() && !CachedPlayer.LocalPlayer.Data.IsDead; },
() => { return true; },
() => {
hunterArrowButton.Timer = 30f;
hunterArrowButton.isEffectActive = false;
hunterArrowButton.actionButton.graphic.color = Palette.EnabledColor;
},
Hunter.getArrowSprite(),
CustomButton.ButtonPositions.upperRowLeft,
__instance,
"HunterArrow",
true,
Hunter.ArrowDuration,
() => {
Hunter.arrowActive = false;
hunterArrowButton.Timer = hunterArrowButton.MaxTimer;
SoundEffectsManager.play("trackerTrackPlayer");
}
);

huntedShieldButton = new CustomButton(
() => {
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(CachedPlayer.LocalPlayer.PlayerControl.NetId, (byte)CustomRPC.HuntedShield, Hazel.SendOption.Reliable, -1);
writer.Write(CachedPlayer.LocalPlayer.PlayerId);
AmongUsClient.Instance.FinishRpcImmediately(writer);
RPCProcedure.huntedShield(CachedPlayer.LocalPlayer.PlayerId);
SoundEffectsManager.play("timemasterShield");

Hunted.shieldCount--;
},
() => { return HideNSeek.isHunted() && !CachedPlayer.LocalPlayer.Data.IsDead; },
() => {
if (huntedShieldCountText != null) huntedShieldCountText.text = $"{Hunted.shieldCount}";
return CachedPlayer.LocalPlayer.PlayerControl.CanMove && Hunted.shieldCount > 0;
},
() => {
huntedShieldButton.Timer = huntedShieldButton.MaxTimer;
huntedShieldButton.isEffectActive = false;
huntedShieldButton.actionButton.cooldownTimerText.color = Palette.EnabledColor;
},
TimeMaster.getButtonSprite(),
CustomButton.ButtonPositions.lowerRowRight,
__instance,
"ActionQuaternary",
true,
Hunted.shieldDuration,
() => {
huntedShieldButton.Timer = huntedShieldButton.MaxTimer;
SoundEffectsManager.stop("timemasterShield");

}
);

huntedShieldCountText = UnityEngine.Object.Instantiate(huntedShieldButton.actionButton.cooldownTimerText, huntedShieldButton.actionButton.cooldownTimerText.transform.parent);
huntedShieldCountText.text = "";
huntedShieldCountText.enableWordWrapping = false;
huntedShieldCountText.transform.localScale = Vector3.one * 0.5f;
huntedShieldCountText.transform.localPosition += new Vector3(-0.05f, 0.7f, 0);

undertakerDragButton = new CustomButton(
() =>
Expand Down Expand Up @@ -2107,7 +1967,7 @@ public static void createButtonsPostfix(HudManager __instance) {
__instance,
"ActionQuaternary",
true,
CustomOptionHolder.StickyBomberDuration.getFloat(),
CustomOptionHolder.StickyBomberDuration.GetFloat(),
() => {
stickyBomberButton.Timer = stickyBomberButton.MaxTimer;
stickyBomberButton.isEffectActive = false;
Expand All @@ -2130,7 +1990,7 @@ public static void createButtonsPostfix(HudManager __instance) {
RPCProcedure.placeGarlic(buff);
SoundEffectsManager.play("garlic");
},
() => { return !Vampire.localPlacedGarlic && !CachedPlayer.LocalPlayer.Data.IsDead && Vampire.garlicsActive && !HideNSeek.isHideNSeekGM; },
() => { return !Vampire.localPlacedGarlic && !CachedPlayer.LocalPlayer.Data.IsDead && Vampire.garlicsActive; },
() => { return CachedPlayer.LocalPlayer.PlayerControl.CanMove && !Vampire.localPlacedGarlic; },
() => { },
Vampire.getGarlicButtonSprite(),
Expand Down
5 changes: 3 additions & 2 deletions BetterOtherRoles/CustomGameModes/GuesserGM.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Collections.Generic;
using BetterOtherRoles.Options;
using UnityEngine;

namespace BetterOtherRoles.CustomGameModes {
Expand All @@ -7,7 +8,7 @@ class GuesserGM { // Guesser Gamemode
public static Color color = new Color32(255, 255, 0, byte.MaxValue);

public PlayerControl guesser = null;
public int shots = Mathf.RoundToInt(CustomOptionHolder.guesserGamemodeNumberOfShots.getFloat());
public int shots = Mathf.RoundToInt(CustomOptionHolder.GuesserModeNumberOfShots.GetFloat());
public GuesserGM(PlayerControl player) {
guesser = player;
guessers.Add(this);
Expand All @@ -25,7 +26,7 @@ public static void clear(byte playerId) {
var g = guessers.FindLast(x => x.guesser.PlayerId == playerId);
if (g == null) return;
g.guesser = null;
g.shots = Mathf.RoundToInt(CustomOptionHolder.guesserGamemodeNumberOfShots.getFloat());
g.shots = Mathf.RoundToInt(CustomOptionHolder.GuesserModeNumberOfShots.GetFloat());

guessers.Remove(g);
}
Expand Down
Loading

0 comments on commit e16ea8a

Please sign in to comment.