Compare commits

...
3 Commits
Author SHA1 Message Date
Gurge44 cd9635477b a 2025-08-30 11:02:43 +02:00
Gurge44 047c38210b ver 2025-08-30 10:54:56 +02:00
Gurge44 dc87aa11ef fix 2025-08-30 10:46:43 +02:00
8 changed files with 101 additions and 56 deletions

No files matched your search

+2 -2
View File
@@ -42,8 +42,8 @@ public class Main : BasePlugin
private const string DebugKeyHash = "c0fd562955ba56af3ae20d7ec9e64c664f0facecef4b3e366e109306adeae29d";
private const string DebugKeySalt = "59687b";
private const string PluginGuid = "com.gurge44.endlesshostroles";
public const string PluginVersion = "6.2.0";
public const string PluginDisplayVersion = "6.2.0";
public const string PluginVersion = "6.2.1";
public const string PluginDisplayVersion = "6.2.1";
public const bool TestBuild = false;
public const string NeutralColor = "#ffab1b";
+1 -1
View File
@@ -352,7 +352,7 @@ internal static class ExtendedPlayerControl
}
// If you use vanilla RpcSetRole, it will block further SetRole calls until the next game starts.
private static void RpcSetRoleGlobal(this PlayerControl player, RoleTypes roleTypes)
public static void RpcSetRoleGlobal(this PlayerControl player, RoleTypes roleTypes)
{
if (AmongUsClient.Instance.AmClient) player.StartCoroutine(player.CoSetRole(roleTypes, true));
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(player.NetId, (byte)RpcCalls.SetRole, SendOption.Reliable);
+10
View File
@@ -14,6 +14,8 @@ public static class FixedUpdateCaller
{
private static int NonLowLoadPlayerIndex;
private static long LastFileLoadTS;
// ReSharper disable once UnusedMember.Global
public static void Postfix()
{
@@ -38,6 +40,14 @@ public static class FixedUpdateCaller
{
LobbyFixedUpdatePatch.Postfix();
LobbyBehaviourUpdatePatch.Postfix(lobbyBehaviour);
long now = Utils.TimeStamp;
if (now - LastFileLoadTS > 10)
{
LastFileLoadTS = now;
Options.LoadUserData();
}
}
HudManager hudManager = FastDestroyableSingleton<HudManager>.Instance;
+18 -2
View File
@@ -983,7 +983,19 @@ internal static class MeetingHudStartPatch
LateTask.New(() =>
{
if (!MeetingHud.Instance || MeetingHud.Instance.state is MeetingHud.VoteStates.Results or MeetingHud.VoteStates.Proceeding) return;
Main.AllAlivePlayerControls.DoIf(x => x.UsesMeetingShapeshift(), x => x.RpcSetRoleDesync(RoleTypes.Shapeshifter, x.OwnerId));
PlayerControl[] aapc = Main.AllAlivePlayerControls;
foreach (PlayerControl pc in aapc)
{
if (pc.UsesMeetingShapeshift())
{
var sender = CustomRpcSender.Create($"RpcSetRoleDesync for meeting shapeshift ({Main.AllPlayerNames.GetValueOrDefault(pc.PlayerId, "Someone")})", SendOption.Reliable);
sender.RpcSetRole(pc, RoleTypes.Shapeshifter, pc.OwnerId);
aapc.DoIf(x => x.IsImpostor(), x => sender.RpcSetRole(x, RoleTypes.Crewmate, pc.OwnerId));
sender.SendMessage();
}
}
}, 8f, "Set Shapeshifter Role For Meeting Use");
}
}
@@ -1254,7 +1266,11 @@ internal static class MeetingHudOnDestroyPatch
Main.LastVotedPlayerInfo = null;
if (meetingSS && !AntiBlackout.SkipTasks)
Main.AllAlivePlayerControls.DoIf(x => x.UsesMeetingShapeshift(), x => x.RpcSetRoleDesync(x.GetRoleTypes(), x.OwnerId));
{
PlayerControl[] aapc = Main.AllAlivePlayerControls;
aapc.DoIf(x => x.UsesMeetingShapeshift(), x => x.RpcSetRoleDesync(x.GetRoleTypes(), x.OwnerId));
aapc.DoIf(x => x.IsImpostor(), x => x.RpcSetRoleGlobal(x.GetRoleTypes()));
}
}
}
}
+1
View File
@@ -281,6 +281,7 @@ internal static class ChangeRoleSettings
Main.IntroDestroyed = false;
ShipStatusBeginPatch.RolesIsAssigned = false;
GameEndChecker.Ended = false;
ReportDeadBodyPatch.MeetingStarted = false;
HudSpritePatch.ResetButtonIcons = true;
+34 -23
View File
@@ -1194,6 +1194,7 @@ internal static class ReportDeadBodyPatch
if (MeetingStarted) return;
MeetingStarted = true;
LateTask.New(() => MeetingStarted = false, 1f, "ResetMeetingStarted");
CustomNetObject.OnMeeting();
@@ -1349,35 +1350,45 @@ internal static class ReportDeadBodyPatch
NameNotifyManager.Reset();
NotifyRoles(true, ForceLoop: true, CamouflageIsForMeeting: true, GuesserIsForMeeting: true);
Main.ProcessShapeshifts = false;
foreach (PlayerControl pc in Main.AllPlayerControls)
try
{
if (pc.IsAlive())
Main.ProcessShapeshifts = false;
foreach (PlayerControl pc in Main.AllPlayerControls)
{
if (Camouflage.IsCamouflage && !Magistrate.CallCourtNextMeeting)
Camouflage.RpcSetSkin(pc, revertToDefault: true, forceRevert: true);
if (Magistrate.CallCourtNextMeeting)
try
{
string name = pc.GetRealName();
RpcChangeSkin(pc, new NetworkedPlayerInfo.PlayerOutfit().Set(name, 15, "", "", "", "", ""));
if (pc.IsAlive())
{
if (Camouflage.IsCamouflage && !Magistrate.CallCourtNextMeeting)
Camouflage.RpcSetSkin(pc, revertToDefault: true, forceRevert: true);
if (Magistrate.CallCourtNextMeeting)
{
string name = pc.GetRealName();
RpcChangeSkin(pc, new NetworkedPlayerInfo.PlayerOutfit().Set(name, 15, "", "", "", "", ""));
}
if (pc.IsShifted()) pc.RpcShapeshift(pc, false);
}
else if (!pc.Data.IsDead)
pc.RpcExileV2();
}
if (pc.IsShifted()) pc.RpcShapeshift(pc, false);
catch (Exception e) { ThrowException(e); }
}
else if (!pc.Data.IsDead)
pc.RpcExileV2();
RPCHandlerPatch.RemoveExpiredWhiteList();
Camouflage.CamoTimesThisRound = 0;
NumSnapToCallsThisRound = 0;
if (HudManagerPatch.AchievementUnlockedText == string.Empty)
HudManagerPatch.ClearLowerInfoText();
Logger.Info("AfterReportTasks finished", "ReportDeadBody");
}
RPCHandlerPatch.RemoveExpiredWhiteList();
Camouflage.CamoTimesThisRound = 0;
NumSnapToCallsThisRound = 0;
if (HudManagerPatch.AchievementUnlockedText == string.Empty)
HudManagerPatch.ClearLowerInfoText();
catch (Exception e) { ThrowException(e); }
}
}
+2 -1
View File
@@ -32,7 +32,8 @@ public class Deadlined : IAddon
foreach (PlayerControl pc in Main.AllPlayerControls)
{
TaskState ts = pc.GetTaskState();
if (pc.Is(CustomRoles.Deadlined) && (!pc.IsAlive() || ts.IsTaskFinished || (!ts.HasTasks && !pc.CanUseKillButton()))) Main.PlayerStates[pc.PlayerId].RemoveSubRole(CustomRoles.Deadlined);
if (pc.Is(CustomRoles.Deadlined) && (!pc.IsAlive() || ts.IsTaskFinished || (!ts.HasTasks && !pc.CanUseKillButton())))
Main.PlayerStates[pc.PlayerId].RemoveSubRole(CustomRoles.Deadlined);
}
}
+33 -27
View File
@@ -4,8 +4,6 @@ using AmongUs.GameOptions;
using EHR.Modules;
using Hazel;
using UnityEngine;
using static EHR.Options;
using static EHR.Translator;
namespace EHR.Neutral;
@@ -50,54 +48,54 @@ public class Romantic : RoleBase
public override void SetupCustomOption()
{
SetupSingleRoleOptions(Id, TabGroup.NeutralRoles, CustomRoles.Romantic);
Options.SetupSingleRoleOptions(Id, TabGroup.NeutralRoles, CustomRoles.Romantic);
BetCooldown = new FloatOptionItem(Id + 10, "RomanticBetCooldown", new(0f, 60f, 1f), 7f, TabGroup.NeutralRoles)
.SetParent(CustomRoleSpawnChances[CustomRoles.Romantic])
.SetParent(Options.CustomRoleSpawnChances[CustomRoles.Romantic])
.SetValueFormat(OptionFormat.Seconds);
ProtectCooldown = new FloatOptionItem(Id + 11, "RomanticProtectCooldown", new(0f, 60f, 0.5f), 25f, TabGroup.NeutralRoles)
.SetParent(CustomRoleSpawnChances[CustomRoles.Romantic])
.SetParent(Options.CustomRoleSpawnChances[CustomRoles.Romantic])
.SetValueFormat(OptionFormat.Seconds);
ProtectDuration = new FloatOptionItem(Id + 12, "RomanticProtectDuration", new(0f, 60f, 0.5f), 10f, TabGroup.NeutralRoles)
.SetParent(CustomRoleSpawnChances[CustomRoles.Romantic])
.SetParent(Options.CustomRoleSpawnChances[CustomRoles.Romantic])
.SetValueFormat(OptionFormat.Seconds);
KnowTargetRole = new BooleanOptionItem(Id + 13, "RomanticKnowTargetRole", true, TabGroup.NeutralRoles)
.SetParent(CustomRoleSpawnChances[CustomRoles.Romantic]);
.SetParent(Options.CustomRoleSpawnChances[CustomRoles.Romantic]);
BetTargetKnowRomantic = new BooleanOptionItem(Id + 14, "RomanticBetTargetKnowRomantic", true, TabGroup.NeutralRoles)
.SetParent(CustomRoleSpawnChances[CustomRoles.Romantic]);
.SetParent(Options.CustomRoleSpawnChances[CustomRoles.Romantic]);
RomanticGetsPartnerConvertedAddons = new BooleanOptionItem(Id + 15, "RomanticGetsPartnerConvertedAddons", true, TabGroup.NeutralRoles)
.SetParent(CustomRoleSpawnChances[CustomRoles.Romantic]);
.SetParent(Options.CustomRoleSpawnChances[CustomRoles.Romantic]);
Arrows = new BooleanOptionItem(Id + 16, "RomanticArrows", true, TabGroup.NeutralRoles)
.SetParent(CustomRoleSpawnChances[CustomRoles.Romantic]);
.SetParent(Options.CustomRoleSpawnChances[CustomRoles.Romantic]);
PartnerHasArrows = new BooleanOptionItem(Id + 17, "RomanticPartnerHasArrows", true, TabGroup.NeutralRoles)
.SetParent(CustomRoleSpawnChances[CustomRoles.Romantic]);
.SetParent(Options.CustomRoleSpawnChances[CustomRoles.Romantic]);
VengefulKCD = new FloatOptionItem(Id + 18, "VengefulKCD", new(0f, 60f, 0.5f), 22.5f, TabGroup.NeutralRoles)
.SetParent(CustomRoleSpawnChances[CustomRoles.Romantic])
.SetParent(Options.CustomRoleSpawnChances[CustomRoles.Romantic])
.SetValueFormat(OptionFormat.Seconds);
VengefulCanVent = new BooleanOptionItem(Id + 19, "VengefulCanVent", true, TabGroup.NeutralRoles)
.SetParent(CustomRoleSpawnChances[CustomRoles.Romantic]);
.SetParent(Options.CustomRoleSpawnChances[CustomRoles.Romantic]);
VengefulHasImpVision = new BooleanOptionItem(Id + 20, "VengefulHasImpVision", true, TabGroup.NeutralRoles)
.SetParent(CustomRoleSpawnChances[CustomRoles.Romantic]);
.SetParent(Options.CustomRoleSpawnChances[CustomRoles.Romantic]);
RuthlessKCD = new FloatOptionItem(Id + 21, "RuthlessKCD", new(0f, 60f, 0.5f), 22.5f, TabGroup.NeutralRoles)
.SetParent(CustomRoleSpawnChances[CustomRoles.Romantic])
.SetParent(Options.CustomRoleSpawnChances[CustomRoles.Romantic])
.SetValueFormat(OptionFormat.Seconds);
RuthlessCanVent = new BooleanOptionItem(Id + 22, "RuthlessCanVent", true, TabGroup.NeutralRoles)
.SetParent(CustomRoleSpawnChances[CustomRoles.Romantic]);
.SetParent(Options.CustomRoleSpawnChances[CustomRoles.Romantic]);
RuthlessHasImpVision = new BooleanOptionItem(Id + 23, "RuthlessHasImpVision", true, TabGroup.NeutralRoles)
.SetParent(CustomRoleSpawnChances[CustomRoles.Romantic]);
.SetParent(Options.CustomRoleSpawnChances[CustomRoles.Romantic]);
}
public override void Init()
@@ -169,8 +167,8 @@ public class Romantic : RoleBase
RomanticPC.SetKillCooldown();
RomanticPC.RPCPlayCustomSound("Bet");
RomanticPC.Notify(GetString("RomanticBetPlayer"));
if (BetTargetKnowRomantic.GetBool()) target.Notify(Utils.ColorString(Utils.GetRoleColor(CustomRoles.Romantic), GetString("RomanticBetOnYou")));
RomanticPC.Notify(Translator.GetString("RomanticBetPlayer"));
if (BetTargetKnowRomantic.GetBool()) target.Notify(Utils.ColorString(Utils.GetRoleColor(CustomRoles.Romantic), Translator.GetString("RomanticBetOnYou")));
if (RomanticGetsPartnerConvertedAddons.GetBool() && Partner.IsConverted()) Partner.GetCustomSubRoles().DoIf(x => x.IsConverted() && !RomanticPC.Is(x), x => RomanticPC.RpcSetCustomRole(x));
@@ -190,8 +188,8 @@ public class Romantic : RoleBase
RomanticPC.SetKillCooldown();
RomanticPC.RPCPlayCustomSound("Shield");
RomanticPC.Notify(GetString("RomanticProtectPartner"));
Partner.Notify(GetString("RomanticIsProtectingYou"));
RomanticPC.Notify(Translator.GetString("RomanticProtectPartner"));
Partner.Notify(Translator.GetString("RomanticIsProtectingYou"));
LateTask.New(() =>
{
@@ -201,8 +199,8 @@ public class Romantic : RoleBase
if (!GameStates.IsInTask) return;
RomanticPC.Notify(GetString("ProtectingOver"));
Partner.Notify(GetString("ProtectingOver"));
RomanticPC.Notify(Translator.GetString("ProtectingOver"));
Partner.Notify(Translator.GetString("ProtectingOver"));
RomanticPC.SetKillCooldown();
}, ProtectDuration.GetFloat(), "RomanticProtecting");
@@ -241,7 +239,7 @@ public class Romantic : RoleBase
if (seer.PlayerId != RomanticId || !seer.Is(CustomRoles.Romantic)) return string.Empty;
Color color = !HasPickedPartner ? Color.white : Utils.GetRoleColor(CustomRoles.Romantic);
string text = !HasPickedPartner ? GetString("Romantic.PickPartnerText") : "♥";
string text = !HasPickedPartner ? Translator.GetString("Romantic.PickPartnerText") : "♥";
if (Arrows.GetBool()) text += TargetArrow.GetArrows(seer, PartnerId);
return Utils.ColorString(color, text);
@@ -264,7 +262,15 @@ public class Romantic : RoleBase
private static void ChangeRole()
{
if (Partner == null || RomanticPC == null || !RomanticPC.Is(CustomRoles.Romantic)) return;
if (RomanticPC == null || !RomanticPC.Is(CustomRoles.Romantic)) return;
if (Partner == null)
{
Logger.Info("Romantic Partner is null => Changing to Ruthless Romantic", "Romantic");
RomanticPC.RpcSetCustomRole(CustomRoles.RuthlessRomantic);
RomanticPC.SetKillCooldown();
return;
}
CustomRoles partnerRole = Partner.GetCustomRole();
PlayerControl killer = Partner.GetRealKiller();
@@ -326,7 +332,7 @@ public class Romantic : RoleBase
public override void SetButtonTexts(HudManager hud, byte id)
{
hud.KillButton?.OverrideText(!HasPickedPartner ? GetString("RomanticKillButtonText") : GetString("MedicalerButtonText"));
hud.KillButton?.OverrideText(!HasPickedPartner ? Translator.GetString("RomanticKillButtonText") : Translator.GetString("MedicalerButtonText"));
}
}
@@ -406,7 +412,7 @@ public class VengefulRomantic : RoleBase
public override void SetButtonTexts(HudManager hud, byte id)
{
hud.KillButton?.OverrideText(GetString("VengefulRomanticKillButtonText"));
hud.KillButton?.OverrideText(Translator.GetString("VengefulRomanticKillButtonText"));
}
public override void ApplyGameOptions(IGameOptions opt, byte playerId)