mirror of
https://github.com/ApeMV/AmongUsRevamped.git
synced 2026-10-19 15:51:59 +00:00
41 lines
1.4 KiB
C#
41 lines
1.4 KiB
C#
namespace AmongUsRevamped;
|
|
|
|
class ExileControllerWrapUpPatch
|
|
{
|
|
[HarmonyPatch(typeof(ExileController), nameof(ExileController.WrapUp))]
|
|
class ExileControllerPatch
|
|
{
|
|
public static void Postfix(ExileController __instance)
|
|
{
|
|
if (!AmongUsClient.Instance.AmHost) return;
|
|
|
|
var ejectedPlayer = __instance.initData?.networkedPlayer;
|
|
if (ejectedPlayer == null) return;
|
|
|
|
PlayerControl pc = null;
|
|
foreach (var p in PlayerControl.AllPlayerControls)
|
|
{
|
|
if (p.PlayerId == ejectedPlayer.PlayerId)
|
|
{
|
|
pc = p;
|
|
break;
|
|
}
|
|
}
|
|
|
|
Logger.Info($" {ejectedPlayer.PlayerName} was ejected", "ExileController");
|
|
|
|
if (CustomRoleManagement.PlayerRoles.TryGetValue(ejectedPlayer.PlayerId, out var role) && role == "Jester")
|
|
{
|
|
Utils.CustomWinnerEndGame(pc, 1);
|
|
NormalGameEndChecker.LastWinReason = $"Jester wins! (Voted)\n\nImpostors: {impostorList}" + (string.IsNullOrEmpty(customRoles) ? "" : "\n\n" + customRoles);
|
|
return;
|
|
}
|
|
|
|
CustomRoleManagement.SendRoleMessages(new Dictionary<string, string>
|
|
{
|
|
{ "Jester", Translator.Get("JesterPriv")},
|
|
{ "Mayor", Translator.Get("MayorPriv", Options.MayorExtraVoteCount.GetInt())}
|
|
});
|
|
}
|
|
}
|
|
} |