mirror of
https://github.com/ApeMV/AmongUsRevamped.git
synced 2026-10-19 15:51:59 +00:00
Finishing what was started I
This commit is contained in:
1 parent
6d0d80b736
commit
cd1de51a1f
8 files changed
+133
-19
No files matched your search
@@ -297,9 +297,12 @@ namespace AmongUsRevamped
|
||||
// Roles
|
||||
public static OptionItem TabGroupCrewmate;
|
||||
public static OptionItem MayorPerc;
|
||||
public static OptionItem MayorExtraVoteCount;
|
||||
public static OptionItem MayorVentToMeeting;
|
||||
|
||||
public static OptionItem TabGroupNeutral;
|
||||
public static OptionItem JesterPerc;
|
||||
public static OptionItem JesterCanVent;
|
||||
|
||||
public static OptionItem TabGroupImpostor;
|
||||
|
||||
@@ -379,15 +382,22 @@ namespace AmongUsRevamped
|
||||
// Custom role settings
|
||||
TabGroupCrewmate = TextOptionItem.Create(100000, Translator.Get("tabGroupCrewmate"), TabGroup.CustomRoleSettings)
|
||||
.SetColor(CL.Hex("#8cffff"));
|
||||
MayorPerc = IntegerOptionItem.Create(100001, Translator.Get("mayorPerc"), new(0, 100, 5), 0, TabGroup.CustomRoleSettings, false)
|
||||
MayorPerc = IntegerOptionItem.Create(100001, Translator.Get("Mayor"), new(0, 100, 5), 0, TabGroup.CustomRoleSettings, false)
|
||||
.SetValueFormat(OptionFormat.Percent)
|
||||
.SetColor(CL.Hex("#204d42"));
|
||||
MayorExtraVoteCount = IntegerOptionItem.Create(100002, Translator.Get("mayorExtraVoteCount"), new(1, 15, 1), 1, TabGroup.CustomRoleSettings, false)
|
||||
.SetValueFormat(OptionFormat.Level)
|
||||
.SetParent(MayorPerc);
|
||||
MayorVentToMeeting = BooleanOptionItem.Create(100003, Translator.Get("mayorVentToMeeting"), true, TabGroup.CustomRoleSettings, false)
|
||||
.SetParent(MayorPerc);
|
||||
|
||||
TabGroupNeutral = TextOptionItem.Create(101000, Translator.Get("tabGroupNeutral"), TabGroup.CustomRoleSettings)
|
||||
.SetColor(CL.Hex("#FFFF99"));
|
||||
JesterPerc = IntegerOptionItem.Create(101001, Translator.Get("jesterPerc"), new(0, 100, 5), 0, TabGroup.CustomRoleSettings, false)
|
||||
JesterPerc = IntegerOptionItem.Create(101001, Translator.Get("Jester"), new(0, 100, 5), 0, TabGroup.CustomRoleSettings, false)
|
||||
.SetValueFormat(OptionFormat.Percent)
|
||||
.SetColor(CL.Hex("#ec62a5"));
|
||||
JesterCanVent = BooleanOptionItem.Create(101002, Translator.Get("jesterCanVent"), false, TabGroup.CustomRoleSettings, false)
|
||||
.SetParent(MayorPerc);
|
||||
|
||||
TabGroupImpostor = TextOptionItem.Create(102000, Translator.Get("tabGroupImpostor"), TabGroup.CustomRoleSettings)
|
||||
.SetColor(CL.Hex("#ff1919"));
|
||||
|
||||
@@ -73,7 +73,7 @@ public static class CustomRoleManagement
|
||||
sb.Append(c);
|
||||
}
|
||||
return sb.ToString();
|
||||
}
|
||||
}
|
||||
|
||||
public static string GetActiveRoles()
|
||||
{
|
||||
@@ -123,7 +123,15 @@ public static class CustomRoleManagement
|
||||
PendingRoleMessages++;
|
||||
new LateTask(() =>
|
||||
{
|
||||
Utils.SendPrivateMessage(player, roleMessages[role]);
|
||||
if (Utils.InGame)
|
||||
{
|
||||
Utils.SendPrivateMessage(player, roleMessages[role]);
|
||||
}
|
||||
else
|
||||
{
|
||||
Logger.Info("Role sending was forcefully canceled. This should not happen.", "SendRoleMessages")
|
||||
}
|
||||
|
||||
PendingRoleMessages--;
|
||||
|
||||
if (PendingRoleMessages <= 0)
|
||||
|
||||
@@ -24,12 +24,18 @@ class ExileControllerWrapUpPatch
|
||||
|
||||
Logger.Info($" {ejectedPlayer.PlayerName} was ejected", "ExileController");
|
||||
|
||||
if (!CustomRoleManagement.PlayerRoles.TryGetValue(ejectedPlayer.PlayerId, out var role)) return;
|
||||
|
||||
if (role == "Jester")
|
||||
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())}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -15,15 +15,10 @@ internal static class CoShowIntroPatch
|
||||
|
||||
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", Translator.Get("JesterPriv")},
|
||||
{ "Mayor", Translator.Get("MayorPriv")}
|
||||
{ "Mayor", Translator.Get("MayorPriv", Options.MayorExtraVoteCount.GetInt())}
|
||||
});
|
||||
|
||||
if (Options.DisableAnnoyingMeetingCalls.GetBool())
|
||||
@@ -51,7 +46,7 @@ class BeginCrewmatePatch
|
||||
PlayerControl.LocalPlayer.CmdReportDeadBody(null);
|
||||
MeetingHud.Instance.RpcClose();
|
||||
|
||||
}, 6.5f, "SetChatVisible");
|
||||
}, 7f, "SetChatVisible");
|
||||
}
|
||||
|
||||
if (Main.GM.Value)
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
namespace AmongUsRevamped;
|
||||
|
||||
[HarmonyPatch(typeof(MeetingHud), nameof(MeetingHud.CheckForEndVoting))]
|
||||
public static class CheckForEndVotingPatch
|
||||
{
|
||||
public static bool Prefix(MeetingHud __instance)
|
||||
{
|
||||
if (!AmongUsClient.Instance.AmHost) return true;
|
||||
|
||||
if (!__instance.playerStates.All(ps => ps.AmDead || ps.DidVote)) return true;
|
||||
|
||||
var votes = __instance.CalculateVotes();
|
||||
var visualVotes = new List<MeetingHud.VoterState>();
|
||||
|
||||
foreach (var ps in __instance.playerStates)
|
||||
{
|
||||
if (ps == null) continue;
|
||||
|
||||
byte voterId = ps.TargetPlayerId;
|
||||
byte votedFor = ps.VotedFor;
|
||||
if (votedFor == byte.MaxValue) continue;
|
||||
|
||||
visualVotes.Add(new MeetingHud.VoterState { VoterId = voterId, VotedForId = votedFor });
|
||||
|
||||
if (CustomRoleManagement.PlayerRoles.TryGetValue(voterId, out string role) && role == "Mayor")
|
||||
{
|
||||
int extraVotes = Options.MayorExtraVoteCount.GetInt();
|
||||
if (!votes.TryGetValue(votedFor, out int currentVotes)) currentVotes = 0;
|
||||
votes[votedFor] = currentVotes + extraVotes;
|
||||
|
||||
for (int i = 0; i < extraVotes; i++)
|
||||
visualVotes.Add(new MeetingHud.VoterState { VoterId = voterId, VotedForId = votedFor });
|
||||
}
|
||||
}
|
||||
|
||||
var max = votes.MaxPair(out var tie);
|
||||
var exiled = GameData.Instance.AllPlayers.ToArray().FirstOrDefault(p => !tie && p.PlayerId == max.Key);
|
||||
var statesArray = visualVotes.ToArray();
|
||||
|
||||
__instance.RpcVotingComplete(statesArray, exiled, tie);
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -15,6 +15,10 @@ internal class CoStartGamePatch
|
||||
Logger.Info(" -------- GAME STARTED --------", "StartGame");
|
||||
Logger.Info($" Gamemode: {Options.Gamemode.GetValue()}", "StartGame");
|
||||
|
||||
if ((Options.Gamemode.GetValue() == 0 || Options.Gamemode.GetValue() == 1) && !Utils.isHideNSeek)
|
||||
{
|
||||
CustomRoleManagement.AssignRoles();
|
||||
}
|
||||
NormalGameEndChecker.imps.Clear();
|
||||
NormalGameEndChecker.LastWinReason = "";
|
||||
|
||||
@@ -40,6 +44,31 @@ class PlayerControlSetRolePatch
|
||||
roleType = RoleTypes.CrewmateGhost;
|
||||
}
|
||||
|
||||
if (CustomRoleManagement.PlayerRoles.TryGetValue(__instance.PlayerId, out var role) && role == "Mayor")
|
||||
{
|
||||
if (Options.MayorVentToMeeting.GetBool())
|
||||
{
|
||||
roleType = RoleTypes.Engineer;
|
||||
Logger.Info($"{__instance.Data.PlayerName} is Engineer due to being Mayor", "SetRolePatch");
|
||||
}
|
||||
else
|
||||
{
|
||||
roleType = RoleTypes.Crewmate;
|
||||
}
|
||||
}
|
||||
if (CustomRoleManagement.PlayerRoles.TryGetValue(__instance.PlayerId, out var r) && r == "Jester")
|
||||
{
|
||||
if (Options.JesterCanVent.GetBool())
|
||||
{
|
||||
roleType = RoleTypes.Engineer;
|
||||
Logger.Info($"{__instance.Data.PlayerName} is Engineer due to being Jester", "SetRolePatch");
|
||||
}
|
||||
else
|
||||
{
|
||||
roleType = RoleTypes.Crewmate;
|
||||
}
|
||||
}
|
||||
|
||||
if (Utils.isHideNSeek && i == 0)
|
||||
{
|
||||
int seekersCount = Options.NumSeekers.GetInt();
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
namespace AmongUsRevamped;
|
||||
|
||||
[HarmonyPatch(typeof(Vent), nameof(Vent.EnterVent))]
|
||||
class EnterVentPatch
|
||||
{
|
||||
public static void Postfix(Vent __instance, [HarmonyArgument(0)] PlayerControl pc)
|
||||
{
|
||||
if (!AmongUsClient.Instance.AmHost) return;
|
||||
|
||||
if (CustomRoleManagement.PlayerRoles.TryGetValue(pc.PlayerId, out var role) && role == "Mayor")
|
||||
{
|
||||
pc.CmdReportDeadBody(null);
|
||||
Logger.Info($" The Mayor, {pc.Data.PlayerName}, called a meeting by venting", "EnterVent");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -38,9 +38,7 @@
|
||||
"slashStartAndEndGameCmd": "Who Can Use /startgame And /endgame",
|
||||
|
||||
"tabGroupCrewmate": "Crewmate Roles",
|
||||
"mayorPerc": "PLACEHOLDER",
|
||||
"tabGroupNeutral": "Neutral Roles",
|
||||
"jesterPerc": "PLACEHOLDER",
|
||||
"tabGroupImpostor": "Impostor Roles",
|
||||
|
||||
"tabGroupStandard": "Standard",
|
||||
@@ -203,16 +201,24 @@
|
||||
|
||||
"noKcdMode": "0 Kill Cooldown:\n\nImpostors have no kill cooldown, Crewmates have low tasks\nThink fast and pay attention!",
|
||||
"SnSModeOne": "Shift and Seek:\n\nImpostors can only kill someone while shapeshifted as them\nEmergency Meetings = Off",
|
||||
"SnSModeTwo": "Crew wins by tasks/surviving {0}s\nImp wins by killing\nOne wrong kill = Can't kill for {1}s\n{2} wrong kills = suicide",
|
||||
"SnSModeTwo": "Crew wins by tasks/surviving {0}s\nImp wins by killing\nOne wrong kill = Can't kill for {1}s\n{2} wrong kill(s) = suicide",
|
||||
"speedrunMode": "Speedrun:\n\nEveryone is a crewmate. The 1st player to finish tasks wins the game. Game auto ends after {0}s",
|
||||
"allCommandsFull": "Commands:\n/r - Current mode description\n/0kc, /sns, /sp - Specific mode description\n/l - Shows last winner info\n/kick, /ban - Bans or kicks a player by name\n/ckick, /cban - Bans or kicks a player by color",
|
||||
"allCommandsOne": "Commands:\n/r - Current mode description\n/0kc, /sns, /sp - Specific mode description\n/l - Shows last winner info",
|
||||
"allCommandsTwo": "/kick, /ban - Bans or kicks a player by name\n/ckick, /cban - Bans or kicks a player by color",
|
||||
"socialsAll": "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",
|
||||
"translationReloaded": "Your file has successfully been reset.\nTo apply the changes, restart your game.",
|
||||
|
||||
"Mayor": "Mayor",
|
||||
"MayorPriv": "PRIVATE:\n\nYour role is Mayor!\n\nYou are a crewmate with i total votes. Use your voting power to eject Impostors.",
|
||||
"MayorPublic": "Mayor:\n\nThe Mayor is a crewmate with {0} extra vote(s). Depending on settings, they can vent to call a meeting.",
|
||||
"MayorPriv": "Your role is Mayor!\n\nYou are a crewmate with {0} extra vote(s). If you are an Engineer, vent to call a meeting.",
|
||||
"mayorExtraVoteCount": "Extra Votes",
|
||||
"mayorVentToMeeting": "Can Vent To Call Meetings",
|
||||
|
||||
"Jester": "Jester",
|
||||
"JesterPriv": "PRIVATE:\n\nYour role is Jester!\nYou are NOT a crewmate!\n\nYou win by getting voted. Act as suspicious as possible."
|
||||
"JesterPublic": "Jester:\n\nThe Jester wins alone by getting voted. Their goal is to act as suspicious as possible.",
|
||||
"JesterPriv": "Your role is Jester!\nYou are NOT a crewmate!\n\nYou win by getting voted. Act as suspicious as possible.",
|
||||
"jesterCanVent": "Can Vent",
|
||||
|
||||
"roleDescriptionHelp": "Your Role can be seen at the start of meetings. It is shown by a private text, looking like the host."
|
||||
}
|
||||
Reference in new issue
Block a user