major fix

This commit is contained in:
Gurge44 committed 2025-09-28 10:57:49 +02:00
1 parent 7a3c502ade
commit b8532d4e97
6 files changed
+35 -25

No files matched your search

+2 -2
View File
@@ -8,8 +8,8 @@
<Description>EHR</Description>
<Authors>Gurge44</Authors>
<langVersion>preview</langVersion>
<AmongUs>D:\SteamLibrary\steamapps\common\Among Us</AmongUs>
<!--<AmongUs>C:\Program Files\Epic Games\AmongUs</AmongUs>-->
<!--<AmongUs>D:\SteamLibrary\steamapps\common\Among Us</AmongUs>-->
<AmongUs>C:\Program Files\Epic Games\AmongUs</AmongUs>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<Optimize>True</Optimize>
<AssemblyName>$(MSBuildProjectName)</AssemblyName>
+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.4.1";
public const string PluginDisplayVersion = "6.4.1";
public const string PluginVersion = "6.4.2";
public const string PluginDisplayVersion = "6.4.2";
public const bool TestBuild = false;
public const string NeutralColor = "#ffab1b";
+2 -1
View File
@@ -66,6 +66,7 @@ public static class Options
public static Dictionary<TabGroup, OptionItem[]> GroupedOptions = [];
public static Dictionary<AddonTypes, List<CustomRoles>> GroupedAddons = [];
public static OptionItem Preset;
public static OptionItem GameMode;
private static readonly string[] GameModes =
@@ -1266,7 +1267,7 @@ public static class Options
int defaultPresetNumber = OptionSaver.GetDefaultPresetNumber();
_ = new PresetOptionItem(defaultPresetNumber, TabGroup.SystemSettings)
Preset = new PresetOptionItem(defaultPresetNumber, TabGroup.SystemSettings)
.SetColor(new Color32(255, 235, 4, byte.MaxValue))
.SetHidden(true);
+12 -9
View File
@@ -455,17 +455,18 @@ internal static class RPCHandlerPatch
if (AmongUsClient.Instance.AmHost) break;
int startIndex = reader.ReadPackedInt32();
if (startIndex == 2)
{
Options.Preset.SetValue(9);
Options.GameMode.SetValue(reader.ReadPackedInt32());
}
for (int i = startIndex; i < OptionItem.AllOptions.Count; ++i)
{
if (reader.BytesRemaining == 0) break;
var option = OptionItem.AllOptions[i];
if (option.Id == 0)
{
option.SetValue(9);
continue;
}
if (option is TextOptionItem) continue;
option.SetValue(reader.ReadPackedInt32());
}
@@ -1352,13 +1353,15 @@ internal static class RPC
if (!AmongUsClient.Instance.AmHost || PlayerControl.AllPlayerControls.Count <= 1) return;
Logger.Msg(" Starting from 0", "SyncCustomSettings");
Logger.Msg(" Starting from 2", "SyncCustomSettings");
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.SyncCustomSettings, SendOption.Reliable, targetId);
writer.WritePacked(0);
writer.WritePacked(2);
writer.WritePacked(Options.GameMode.GetValue());
for (int i = 0; i < OptionItem.AllOptions.Count; ++i)
for (int i = 2; i < OptionItem.AllOptions.Count; ++i)
{
var option = OptionItem.AllOptions[i];
if (option is TextOptionItem) continue;
if (writer.Length > 500)
{
+16 -9
View File
@@ -1687,16 +1687,20 @@ internal static class FixedUpdatePatch
string roleText;
bool hideRoleText = false;
if (Options.CurrentGameMode is not CustomGameMode.Standard and not CustomGameMode.HideAndSeek || !IsRoleTextEnabled(__instance))
{
roleText = string.Empty;
hideRoleText = true;
}
else
{
(string, Color) roleTextData = GetRoleText(lpId, playerId, seeTargetBetrayalAddons: shouldSeeTargetAddons);
roleText = ColorString(roleTextData.Item2, roleTextData.Item1);
}
if (PlayerControl.LocalPlayer.IsAlive() && PlayerControl.LocalPlayer.IsRevealedPlayer(__instance) && __instance.Is(CustomRoles.Trickster))
if (!hideRoleText && PlayerControl.LocalPlayer.IsAlive() && PlayerControl.LocalPlayer.IsRevealedPlayer(__instance) && __instance.Is(CustomRoles.Trickster))
{
roleText = Farseer.RandomRole[lpId];
roleText += Farseer.GetTaskState();
@@ -1705,6 +1709,7 @@ internal static class FixedUpdatePatch
if (!AmongUsClient.Instance.IsGameStarted && AmongUsClient.Instance.NetworkMode != NetworkModes.FreePlay)
{
roleText = string.Empty;
hideRoleText = true;
if (!__instance.AmOwner) __instance.cosmetics.nameText.text = __instance?.Data?.PlayerName;
}
@@ -1715,7 +1720,7 @@ internal static class FixedUpdatePatch
bool moveandstop = Options.CurrentGameMode == CustomGameMode.MoveAndStop;
if (Main.VisibleTasksCount)
if (!hideRoleText && Main.VisibleTasksCount)
{
if (moveandstop) roleText = roleText.Insert(0, progressText);
else roleText += progressText;
@@ -1960,18 +1965,20 @@ internal static class FixedUpdatePatch
if (!self && Options.CurrentGameMode == CustomGameMode.KingOfTheZones && Main.IntroDestroyed && !KingOfTheZones.GameGoing)
realName = EmptyMessage;
if (!Options.LargerRoleTextSize.GetBool())
roleText = $"<size=1.7>{roleText}</size>\n";
if (!hideRoleText)
{
if (!Options.LargerRoleTextSize.GetBool())
roleText = $"<size=1.7>{roleText}</size>\n";
else
roleText += "\n";
}
else
roleText += "\n";
roleText = string.Empty;
string newLineBeforeSuffix = !(Options.CurrentGameMode == CustomGameMode.BedWars && !self && GameStates.InGame) ? "\r\n" : " - ";
string deathReason = !seer.IsAlive() && seer.KnowDeathReason(target) ? $"{newLineBeforeSuffix}<size=1.5>『{ColorString(GetRoleColor(CustomRoles.Doctor), GetVitalText(target.PlayerId))}』</size>" : string.Empty;
string currentText = target.cosmetics.nameText.text;
var changeTo = $"{roleText}{realName}{deathReason}{Mark}{newLineBeforeSuffix}{Suffix}";
bool needUpdate = currentText != changeTo;
if (needUpdate) target.cosmetics.nameText.text = changeTo;
target.cosmetics.nameText.text = $"{roleText}{realName}{deathReason}{Mark}{newLineBeforeSuffix}{Suffix}";
}
}
+1 -2
View File
@@ -88,8 +88,7 @@ public class Venerer : RoleBase
switch (Stage)
{
case 1:
var o = pc.CurrentOutfit;
var outfit = new NetworkedPlayerInfo.PlayerOutfit().Set(o.PlayerName, o.ColorId, o.HatId, o.SkinId, o.VisorId, o.PetId, o.NamePlateId);
var outfit = Camouflage.PlayerSkins[pc.PlayerId];
Utils.RpcChangeSkin(pc, new NetworkedPlayerInfo.PlayerOutfit().Set("", 15, "", "", "", "", ""));
ChangedSkin = true;
LateTask.New(() =>