Lighting the stars + like so many other stuff

This commit is contained in:
Ape committed 2026-02-01 20:19:24 +01:00
1 parent a6c3220892
commit e9f1c1aaf1
11 files changed
+284 -139

No files matched your search

+1 -1
View File
@@ -14,7 +14,7 @@
<PackageReference Include="BepInEx.Unity.IL2CPP" Version="6.0.0-be.735" ExcludeAssets="runtime;native" />
<PackageReference Include="AmongUs.GameLibs.Steam" Version="2025.11.18" PrivateAssets="all" Condition="'$(Configuration)' == 'Release'"/>
<PackageReference Include="AmongUs.GameLibs.Android" Version="2025.11.18" PrivateAssets="all" Condition="'$(Configuration)' == 'Android'"/>
<PackageReference Include="AmongUs.GameLibs.Android" Version="2025.10.14" PrivateAssets="all" Condition="'$(Configuration)' == 'Android'"/>
<PackageReference Include="BepInEx.AutoPlugin" Version="1.1.0" PrivateAssets="all" />
<PackageReference Include="BepInEx.IL2CPP.MSBuild" Version="2.1.0-rc.1" PrivateAssets="all" ExcludeAssets="runtime" />
-62
View File
@@ -1,62 +0,0 @@
using AmongUs.GameOptions;
using System;
using InnerNet;
using UnityEngine;
namespace AmongUsRevamped;
public static class CustomRolesAssigner
{
private static readonly System.Random random = new System.Random();
public static void AssignRoles()
{
List<(string roleName, int percentage)> crewmateRoles = new List<(string, int)>
{
("Jester", Options.JesterPerc.GetInt()),
("Mayor", Options.MayorPerc.GetInt())
};
List<(string roleName, int percentage)> impostorRoles = new List<(string, int)>
{
};
List<PlayerControl> availablePlayers = new List<PlayerControl>();
foreach (var player in PlayerControl.AllPlayerControls)
{
availablePlayers.Add(player);
}
availablePlayers = availablePlayers.OrderBy(x => random.Next()).ToList();
Dictionary<PlayerControl, string> playerRoles = new Dictionary<PlayerControl, string>();
HashSet<string> assignedRoles = new HashSet<string>();
foreach (var player in availablePlayers)
{
bool isCrewmate = !player.Data.Role.IsImpostor;
List<(string roleName, int percentage)> rolesToAssign = isCrewmate ? crewmateRoles : impostorRoles;
foreach (var (roleName, percentage) in rolesToAssign)
{
if (assignedRoles.Contains(roleName))
continue;
int randomValue = random.Next(0, 101);
Logger.Info($"{roleName}, Value: {randomValue}, Percentage: {percentage}", "StartGameCustomRole1");
if (randomValue <= percentage && !playerRoles.ContainsKey(player))
{
playerRoles[player] = roleName;
assignedRoles.Add(roleName);
Logger.Info($"({player.PlayerId}) {player.Data.PlayerName} -> {roleName}", "StartGameCustomRole2");
break;
}
}
}
}
}
+115
View File
@@ -0,0 +1,115 @@
using AmongUs.GameOptions;
using System;
using InnerNet;
using UnityEngine;
namespace AmongUsRevamped;
public static class CustomRoleManagement
{
public static Dictionary<byte, string> PlayerRoles = new Dictionary<byte, string>();
private static readonly System.Random random = new System.Random();
public static void AssignRoles()
{
// crewmateRoles = assigned with crewmate role base
// impostorRoles = assigned with impostor role base
List<(string roleName, int percentage)> crewmateRoles = new List<(string, int)>
{
("Jester", Options.JesterPerc.GetInt()),
("Mayor", Options.MayorPerc.GetInt())
};
List<(string roleName, int percentage)> impostorRoles = new List<(string, int)>
{
};
List<PlayerControl> availablePlayers = new List<PlayerControl>();
foreach (var player in PlayerControl.AllPlayerControls)
{
availablePlayers.Add(player);
}
availablePlayers = availablePlayers.OrderBy(x => random.Next()).ToList();
PlayerRoles.Clear();
HashSet<string> assignedRoles = new HashSet<string>();
foreach (var player in availablePlayers)
{
bool isCrewmate = !player.Data.Role.IsImpostor;
List<(string roleName, int percentage)> rolesToAssign = isCrewmate ? crewmateRoles : impostorRoles;
foreach (var (roleName, percentage) in rolesToAssign)
{
if (assignedRoles.Contains(roleName))
continue;
int randomValue = random.Next(0, 101);
Logger.Info($"{roleName}, Value: {randomValue}, Percentage: {percentage}", "StartGameCustomRole1");
if (randomValue <= percentage && !PlayerRoles.ContainsKey(player.PlayerId))
{
PlayerRoles[player.PlayerId] = roleName;
assignedRoles.Add(roleName);
Logger.Info($"({player.PlayerId}) {player.Data.PlayerName} -> {roleName}", "StartGameCustomRole2");
break;
}
}
}
}
public static string GetActiveRoles()
{
var crewmateRoles = new List<string>();
var neutralRoles = new List<string>();
var impostorRoles = new List<string>();
var lines = new List<string>();
if (Options.MayorPerc.GetInt() > 1) crewmateRoles.Add($"Mayor ({Options.MayorPerc.GetInt()}%)");
if (Options.JesterPerc.GetInt() > 1) neutralRoles.Add($"Jester ({Options.JesterPerc.GetInt()})%");
void AddCategory(string header, List<string> roles)
{
if (roles.Count == 0) return;
if (lines.Count > 0) lines.Add("");
lines.Add(header);
lines.AddRange(roles);
}
AddCategory("Crewmate:", crewmateRoles);
AddCategory("Neutral:", neutralRoles);
AddCategory("Impostor:", impostorRoles);
return lines.Count > 0 ? string.Join("\n", lines) : string.Empty;
}
public static void SendRoleMessages(Dictionary<string, string> roleMessages)
{
HashSet<string> sentRoles = new HashSet<string>();
var players = PlayerControl.AllPlayerControls.ToArray().ToList();
float delay = 0f;
foreach (var player in players)
{
if (!PlayerRoles.TryGetValue(player.PlayerId, out string role)) continue;
if (!roleMessages.ContainsKey(role)) continue;
if (sentRoles.Contains(role)) continue;
new LateTask(() =>
{
Utils.SendPrivateMessage(player, roleMessages[role]);
}, delay, "SendRoleMessage");
sentRoles.Add(role);
delay += 2.2f;
}
}
}
+15 -7
View File
@@ -134,9 +134,16 @@ public static class Utils
string name = region.Name;
// Joining games shows incorrect regions
if (!AmongUsClient.Instance.AmHost)
{
name = "";
return name;
}
if (AmongUsClient.Instance.NetworkMode != NetworkModes.OnlineGame)
{
name = "Local Game";
name = "Server: Local Game";
return name;
}
@@ -145,9 +152,9 @@ public static class Utils
// Official servers
name = name switch
{
"North America" => "NA",
"Europe" => "EU",
"Asia" => "AS",
"North America" => "Server: NA",
"Europe" => "Server: EU",
"Asia" => "Server: AS",
_ => name
};
@@ -160,11 +167,11 @@ public static class Utils
{
// Modded Servers
if (ip.Contains("au-eu"))
name = "MEU";
name = "Server: MEU";
else if (ip.Contains("au-as"))
name = "MAS";
name = "Server: MAS";
else
name = "MNA";
name = "Server: MNA";
return name;
}
@@ -191,6 +198,7 @@ public static class Utils
LateTask.Tasks.Clear();
FixedUpdateInGamePatch.ProcessedModerators.Clear();
NormalGameEndChecker.ImpCheckComplete = false;
CreateOptionsPickerPatch.SetDleks2 = false;
}
public static PlayerControl[] AllAlivePlayerControls
+5 -5
View File
@@ -113,7 +113,7 @@ internal static class SendChatPatch
return false;
}
if (text == "/aur" || text == "/amongusrevamped")
if (text == "/aur" || text == "/amongusrevamped" || text == "/socials" || text == "/github" || text == "/discord")
{
Utils.ChatCommand(__instance, $"{String.SocialsAll}", "", false);
return false;
@@ -142,10 +142,7 @@ internal static class SendChatPatch
switch (Options.Gamemode.GetValue())
{
case 0:
PlayerControl.LocalPlayer.RpcSendChat($"Custom roles:\nThere are no custom roles.");
__instance.timeSinceLastMessage = 0.8f;
__instance.freeChatField.textArea.Clear();
__instance.freeChatField.textArea.SetText(string.Empty);
Utils.ChatCommand(__instance, $"CUSTOM ROLES:\n\n{CustomRoleManagement.GetActiveRoles()}", "", false);
break;
case 1:
@@ -161,6 +158,9 @@ internal static class SendChatPatch
break;
}
__instance.timeSinceLastMessage = 0.8f;
__instance.freeChatField.textArea.Clear();
__instance.freeChatField.textArea.SetText(string.Empty);
return false;
}
+44 -3
View File
@@ -1,7 +1,9 @@
using System;
using System.Text;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using TMPro;
using UnityEngine;
using UnityEngine.SceneManagement;
//https://github.com/Gurge44/EndlessHostRoles/blob/main/Patches/CredentialsPatch.cs
namespace AmongUsRevamped
@@ -123,8 +125,12 @@ namespace AmongUsRevamped
Sb.Append(Utils.InGame ? " - " : "\r\n");
Sb.Append($"<color={color}>Ping: {ping}</color>");
AppendSeparator();
Sb.Append($"Server: {Utils.GetRegionName()}");
if (Utils.GetRegionName() != "")
{
AppendSeparator();
Sb.Append(Utils.GetRegionName());
}
if (Main.ShowFps.Value && LastFPS.Count > 0)
{
@@ -244,4 +250,39 @@ public static class MainMenuManagerStartPatch
}
}
}
}
}
#if !ANDROID
[HarmonyPatch(typeof(ServerDropdown), nameof(ServerDropdown.FillServerOptions))]
public static class ServerDropdownPatch
{
public static bool Prefix(ServerDropdown __instance)
{
if (SceneManager.GetActiveScene().name == "FindAGame") return true;
SpriteRenderer bg = __instance.background;
bg.size = new Vector2(4, 1);
ServerManager sm = ServerManager.Instance;
TranslationController tc = TranslationController.Instance;
int totalCols = Mathf.Max(1, Mathf.CeilToInt(sm.AvailableRegions.Length / (float)5));
int rowLimit = Mathf.Min(sm.AvailableRegions.Length, 5);
for (var index = 0; index < sm.AvailableRegions.Length; index++)
{
IRegionInfo ri = sm.AvailableRegions[index];
var b = __instance.ButtonPool.Get<ServerListButton>();
b.transform.localPosition = new Vector3(((index / 5) - ((totalCols - 1) / 2f)) * 3.15f, __instance.y_posButton - (0.5f * (index % 5)), -1f);
b.Text.text = tc.GetStringWithDefault(ri.TranslateName, ri.Name, new Il2CppReferenceArray<Il2CppSystem.Object>(0));
b.Text.ForceMeshUpdate();
b.Button.OnClick.RemoveAllListeners();
b.Button.OnClick.AddListener((Action)(() => __instance.ChooseOption(ri)));
__instance.controllerSelectable.Add(b.Button);
}
float h = 1.2f + (0.5f * (rowLimit - 1));
float w = totalCols > 1 ? (3.15f * (totalCols - 1)) + bg.size.x : bg.size.x;
bg.transform.localPosition = new Vector3(0f, __instance.initialYPos - ((h - 1.2f) / 2f), 0f);
bg.size = new Vector2(w, h);
return false;
}
}
#endif
+65 -51
View File
@@ -30,77 +30,91 @@ class CreateOptionsPickerPatch
[HarmonyPostfix]
public static void Postfix_Initialize(CreateGameMapPicker __instance)
{
float delay = SceneManager.GetActiveScene().name == "MainMenu" ? 0.2f : 0f;
if (SceneManager.GetActiveScene().name == "FindAGame") return;
if (SetDleks2 && SceneManager.GetActiveScene().name == "MainMenu") return;
new LateTask(() =>
{
SetDleks2 = true;
int DleksPos = 3;
MapSelectButton[] AllMapButton = __instance.transform.GetComponentsInChildren<MapSelectButton>();
int DleksPos = 3;
MapSelectButton[] AllMapButton = __instance.transform.GetComponentsInChildren<MapSelectButton>();
AllMapButton = AllMapButton.Where(x => x.gameObject.name != "DleksButton").ToArray();
if (AllMapButton != null)
{
GameObject dlekS_ehT = UnityEngine.Object.Instantiate(AllMapButton[0].gameObject, __instance.transform);
dlekS_ehT.transform.position = AllMapButton[DleksPos].transform.position;
dlekS_ehT.transform.SetSiblingIndex(DleksPos + 2);
MapSelectButton dlekS_ehT_MapButton = dlekS_ehT.GetComponent<MapSelectButton>();
DleksButton = dlekS_ehT_MapButton;
foreach (var icon in dlekS_ehT_MapButton.MapIcon)
if (AllMapButton != null)
{
if (icon == null || icon.transform == null) continue;
icon.flipX = true;
}
dlekS_ehT_MapButton.Button.OnClick.RemoveAllListeners();
dlekS_ehT_MapButton.Button.OnClick.AddListener((UnityEngine.Events.UnityAction)(() =>
{
__instance.SelectMap(__instance.AllMapIcons[0]);
if (__instance.selectedButton)
GameObject dlekS_ehT = null;
if (!SetDleks2 || SceneManager.GetActiveScene().name != "MainMenu")
{
__instance.selectedButton.Button.SelectButton(false);
dlekS_ehT = UnityEngine.Object.Instantiate(AllMapButton[0].gameObject, __instance.transform);
dlekS_ehT.name = "DleksButton";
SetDleks2 = true;
}
__instance.selectedButton = dlekS_ehT_MapButton;
__instance.selectedButton.Button.SelectButton(true);
__instance.selectedMapId = 3;
if (!Utils.isHideNSeek)
Main.NormalOptions.MapId = 0;
else if (Utils.isHideNSeek)
Main.HideNSeekOptions.MapId = 0;
__instance.MapImage.sprite = Utils.LoadSprite($"AmongUsRevamped.Resources.Images.DleksBanner.png", 100f);
__instance.MapName.sprite = Utils.LoadSprite($"AmongUsRevamped.Resources.Images.DleksBanner-Wordart.png", 100f);
}));
for (int i = DleksPos; i < AllMapButton.Length; i++)
{
AllMapButton[i].transform.localPosition += new Vector3(0.625f, 0f, 0f);
}
if (DleksButton != null)
{
if (SetDleks)
else
{
dlekS_ehT = __instance.transform.Find("DleksButton")?.gameObject;
}
if (dlekS_ehT == null) return;
dlekS_ehT.name = "DleksButton";
dlekS_ehT.transform.position = AllMapButton[DleksPos].transform.position;
dlekS_ehT.transform.SetSiblingIndex(DleksPos + 2);
MapSelectButton dlekS_ehT_MapButton = dlekS_ehT.GetComponent<MapSelectButton>();
DleksButton = dlekS_ehT_MapButton;
foreach (var icon in dlekS_ehT_MapButton.MapIcon)
{
if (icon == null || icon.transform == null) continue;
icon.flipX = true;
}
dlekS_ehT_MapButton.Button.OnClick.RemoveAllListeners();
dlekS_ehT_MapButton.Button.OnClick.AddListener((UnityEngine.Events.UnityAction)(() =>
{
__instance.SelectMap(__instance.AllMapIcons[0]);
if (__instance.selectedButton)
{
__instance.selectedButton.Button.SelectButton(false);
}
DleksButton.Button.SelectButton(true);
__instance.selectedButton = DleksButton;
__instance.selectedButton = dlekS_ehT_MapButton;
__instance.selectedButton.Button.SelectButton(true);
__instance.selectedMapId = 3;
if (!Utils.isHideNSeek)
Main.NormalOptions.MapId = 0;
else if (Utils.isHideNSeek)
Main.HideNSeekOptions.MapId = 0;
__instance.MapImage.sprite = Utils.LoadSprite($"AmongUsRevamped.Resources.Images.DleksBanner.png", 100f);
__instance.MapName.sprite = Utils.LoadSprite($"AmongUsRevamped.Resources.Images.DleksBanner-Wordart.png", 100f);
}
else
}));
for (int i = DleksPos; i < AllMapButton.Length; i++)
{
DleksButton.Button.SelectButton(false);
AllMapButton[i].transform.localPosition += new Vector3(0.625f, 0f, 0f);
}
if (DleksButton != null)
{
if (SetDleks)
{
if (__instance.selectedButton)
{
__instance.selectedButton.Button.SelectButton(false);
}
DleksButton.Button.SelectButton(true);
__instance.selectedButton = DleksButton;
__instance.selectedMapId = 3;
__instance.MapImage.sprite = Utils.LoadSprite($"AmongUsRevamped.Resources.Images.DleksBanner.png", 100f);
__instance.MapName.sprite = Utils.LoadSprite($"AmongUsRevamped.Resources.Images.DleksBanner-Wordart.png", 100f);
}
else
{
DleksButton.Button.SelectButton(false);
}
}
}
}
}, 0.2f, "ApplyDleks");
}, delay, "ApplyDleks");
}
[HarmonyPatch(typeof(GameOptionsMapPicker), nameof(GameOptionsMapPicker.FixedUpdate))]
+28
View File
@@ -0,0 +1,28 @@
using Hazel;
using InnerNet;
using System;
using UnityEngine;
namespace AmongUsRevamped;
[HarmonyPatch(typeof(HudManager), nameof(HudManager.CoShowIntro))]
internal static class CoShowIntroPatch
{
public static void Postfix(IntroCutscene __instance)
{
Logger.Info("Intro initiated", "d");
if (!AmongUsClient.Instance.AmHost) return;
if ((Options.Gamemode.GetValue() == 0 || Options.Gamemode.GetValue() == 1) && !Utils.isHideNSeek)
{
CustomRoleManagement.AssignRoles();
}
CustomRoleManagement.SendRoleMessages(new Dictionary<string, string>
{
{ "Jester", $"{String.Jester}"},
{ "Mayor", $"{String.Mayor}"}
});
}
}
+3 -3
View File
@@ -11,7 +11,7 @@ public static class NumberOption_Increase
{
if (ModGameOptionsMenu.TabIndex >= 3) return true;
if (Utils.isHideNSeek || Utils.InGame && !Utils.isHideNSeek && __instance.Title != StringNames.GameNumImpostors && __instance.Title != StringNames.GamePlayerSpeed)
if (Utils.isHideNSeek || Utils.IsLobby && !Utils.isHideNSeek && __instance.Title != StringNames.GameNumImpostors && __instance.Title != StringNames.GamePlayerSpeed)
{
__instance.Value += __instance.Increment;
__instance.UpdateValue();
@@ -30,7 +30,7 @@ public static class NumberOption_Decrease
{
if (ModGameOptionsMenu.TabIndex >= 3) return true;
if (Utils.isHideNSeek || Utils.InGame && !Utils.isHideNSeek && __instance.Title != StringNames.GameNumImpostors && __instance.Title != StringNames.GamePlayerSpeed)
if (Utils.isHideNSeek || Utils.IsLobby && !Utils.isHideNSeek && __instance.Title != StringNames.GameNumImpostors && __instance.Title != StringNames.GamePlayerSpeed)
{
__instance.Value -= __instance.Increment;
__instance.UpdateValue();
@@ -49,7 +49,7 @@ public static class NumberOption_Initialize
{
if (ModGameOptionsMenu.TabIndex >= 3) return;
if (Utils.isHideNSeek || Utils.InGame && !Utils.isHideNSeek && __instance.Title != StringNames.GameNumImpostors && __instance.Title != StringNames.GamePlayerSpeed)
if (Utils.isHideNSeek || Utils.IsLobby && !Utils.isHideNSeek && __instance.Title != StringNames.GameNumImpostors && __instance.Title != StringNames.GamePlayerSpeed)
{
__instance.ValidRange = new FloatRange(-900f, 900f);
}
+1 -6
View File
@@ -5,7 +5,7 @@ using UnityEngine;
namespace AmongUsRevamped;
[HarmonyPatch(typeof(AmongUsClient), nameof(AmongUsClient.CoStartGame))]
internal class ApplyCustomImpostorCount
internal class CoStartGamePatch
{
public static void Postfix(AmongUsClient __instance)
{
@@ -16,11 +16,6 @@ internal class ApplyCustomImpostorCount
NormalGameEndChecker.imps.Clear();
NormalGameEndChecker.LastWinReason = "";
if ((Options.Gamemode.GetValue() == 0 || Options.Gamemode.GetValue() == 1) && !Utils.isHideNSeek)
{
CustomRolesAssigner.AssignRoles();
}
if (Main.GM.Value)
{
if (Options.Gamemode.GetValue() == 3)
+7 -1
View File
@@ -33,5 +33,11 @@ public static class String
return $"/kick, /ban - Bans or kicks a player by name\n/ckick, /cban - Bans or kicks a player by color";}}
public static string SocialsAll{get{
return $"AUR socials:\n\ng i t h u b . c o m /\nApeMV/AmongUsRevamped\n\nd i s c o r d . g g / 83Zhzhyhya";}}
return $"AUR socials:\n\ng i t h u b . c o m /\nApeMV/AmongUsRevamped\n\nd i s c o r d . g g /\n83Zhzhyhya";}}
public static string Mayor{get{
return $"PRIVATE:\n\nYour role is Mayor!\n\nYou are a crewmate with i total votes. Use your voting power to eject Impostors.";}}
public static string Jester{get{
return $"PRIVATE:\n\nYour role is Jester!\nYou are NOT a crewmate!\n\nYou win by getting voted. Act as suspicious as possible.";}}
}