mirror of
https://github.com/ApeMV/AmongUsRevamped.git
synced 2026-10-20 01:46:28 +00:00
1.8.3
This commit is contained in:
1 parent
cbc66948c0
commit
8ad59ca207
15 files changed
+926
-95
No files matched your search
@@ -53,7 +53,7 @@ namespace AmongUsRevamped
|
||||
|
||||
public static readonly string[] accessLevels =
|
||||
{
|
||||
"Everyone", "<color=yellow>VIP</color> And Above", "<color=purple>Moderator</color> And Above", "<color=red>Admin</color>", "Only You"
|
||||
Translator.Get("everyone"), Translator.Get("vipAndAbove"), Translator.Get("moderatorAndAbove"), Translator.Get("admin"), Translator.Get("onlyYou")
|
||||
};
|
||||
|
||||
public static readonly string[] crewmateAbilities =
|
||||
@@ -65,11 +65,6 @@ namespace AmongUsRevamped
|
||||
"Tyrant", "Stealer", "Juggernaut", "None"
|
||||
};
|
||||
|
||||
public static readonly string[] languages =
|
||||
{
|
||||
"English", "French"
|
||||
};
|
||||
|
||||
//System
|
||||
public static OptionItem Language;
|
||||
|
||||
|
||||
@@ -148,73 +148,35 @@ public static class AbilityManagement
|
||||
else Utils.ChatCommand(c, first, second, true);
|
||||
}
|
||||
|
||||
public static string RoleInfoString(PlayerControl player)
|
||||
{
|
||||
if (!AmongUsClient.Instance.AmHost) return "";
|
||||
if (IsMayor(player)) return $"Your Ability: Mayor\n\nYou are a Crewmate with {Options.ExtraVotesCrewmate.GetInt()} additional vote(s). Use them wisely.";
|
||||
if (IsWorkhorse(player)) return $"Your Ability: Workhorse\n\nYou gain {Options.ExtraVotesPerTask.GetFloat()} additional vote(s) per completed task. Votes are rounded down.";
|
||||
if (IsJester(player)) return "Your Ability: Jester\n\nYou can optionally win alone by getting voted, you are still a Crewmate.";
|
||||
if (IsSpeedrunner(player)) return "Your Ability: Tasker\n\nThe Crewmates win if you complete tasks while being alive. You have more tasks.";
|
||||
if (IsTyrant(player)) return $"Your Ability: Tyrant\n\nYou are an Impostor with {Options.ExtraVotesImpostor.GetInt()} additional vote(s). Use them wisely.";
|
||||
if (IsStealer(player)) return $"Your Ability: Stealer\n\nYou gain {Options.ExtraVotesPerKill.GetFloat()} additional vote(s) per killed player. Votes are rounded down.";
|
||||
if (IsJuggernaut(player)) return $"Your Ability: Juggernaut\n\nThe Impostor team instantly wins if you gain {Options.KillsNeededForJuggernaut.GetInt()} kills.";
|
||||
else return "";
|
||||
}
|
||||
|
||||
public static bool HandlingRoleMessages = false;
|
||||
private static int PendingRoleMessages = 0;
|
||||
public static void SendRoleMessages()
|
||||
{
|
||||
if (!AmongUsClient.Instance.AmHost || Options.Gamemode.GetValue() > 1) return;
|
||||
if (!AmongUsClient.Instance.AmHost || Options.Gamemode.GetValue() > 1 || Utils.isHideNSeek) return;
|
||||
|
||||
if (string.IsNullOrEmpty(RoleList()) || PlayerControl.LocalPlayer.Data.IsDead)
|
||||
{
|
||||
HandlingRoleMessages = false;
|
||||
PendingRoleMessages = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
var players = PlayerControl.AllPlayerControls.ToArray().ToList();
|
||||
float delay = 6.6f;
|
||||
|
||||
PendingRoleMessages = 0;
|
||||
HandlingRoleMessages = true;
|
||||
|
||||
SendRoleList(DestroyableSingleton<HudManager>.Instance.Chat, AbilityManagement.RoleList(), true);
|
||||
|
||||
foreach (var player in players)
|
||||
new LateTask(() =>
|
||||
{
|
||||
if (string.IsNullOrEmpty(RoleInfoString(player))) continue;
|
||||
|
||||
PendingRoleMessages++;
|
||||
|
||||
new LateTask(() =>
|
||||
if (Utils.InGame)
|
||||
{
|
||||
if (Utils.InGame)
|
||||
{
|
||||
Utils.SendPrivateMessage(player, RoleInfoString(player));
|
||||
}
|
||||
else
|
||||
{
|
||||
Logger.Info("Role sending was forcefully canceled. This should not happen.", "SendRoleMessages");
|
||||
}
|
||||
Utils.ChatCommand(DestroyableSingleton<HudManager>.Instance.Chat, "Custom Abilities are on!\n\nIf you have one of the roles above, you also have the Ability next to it.", "", false);
|
||||
}
|
||||
else
|
||||
{
|
||||
Logger.Info("Role sending was forcefully canceled. This should not happen.", "SendRoleMessages");
|
||||
}
|
||||
|
||||
PendingRoleMessages--;
|
||||
|
||||
if (PendingRoleMessages <= 0)
|
||||
{
|
||||
PendingRoleMessages = 0;
|
||||
HandlingRoleMessages = false;
|
||||
}
|
||||
}, delay, "SendRoleMessage");
|
||||
|
||||
delay += 2.2f;
|
||||
}
|
||||
|
||||
if (PendingRoleMessages == 0)
|
||||
{
|
||||
HandlingRoleMessages = false;
|
||||
}
|
||||
|
||||
}, 6.6f, "SendRoleMessage");
|
||||
}
|
||||
}
|
||||
/*
|
||||
|
||||
+17
-1
@@ -11,7 +11,9 @@ public static class Translator
|
||||
public enum SupportedLangs
|
||||
{
|
||||
English,
|
||||
French
|
||||
Italian,
|
||||
SimplifiedChinese,
|
||||
Spanish
|
||||
}
|
||||
|
||||
private static readonly Dictionary<SupportedLangs, Dictionary<string, string>> _languages = new();
|
||||
@@ -21,6 +23,20 @@ public static class Translator
|
||||
public static void Init()
|
||||
{
|
||||
Logger.Info($" Among Us Revamped {Main.ModVersion}", "Init");
|
||||
|
||||
string path = $"{BanManager.DataPath}/Language/YourLanguage.txt";
|
||||
|
||||
if (!File.Exists(path))
|
||||
{
|
||||
Logger.Warn($" Creating a new language file", "Translator");
|
||||
File.WriteAllText(path, "# In this file you can set your Among Us Revamped language.\n# To set the language, replace the 'English' text below with the language you want to select.\n# Supported languages: English, Spanish, SimplifiedChinese, Italian\n\nEnglish");
|
||||
}
|
||||
|
||||
string l = File.ReadAllLines(path).FirstOrDefault(x => !string.IsNullOrWhiteSpace(x) && !x.StartsWith("#"))?.Trim() ?? "English";
|
||||
|
||||
if (Enum.TryParse(l, true, out SupportedLangs lang)) _currentLang = lang;
|
||||
else _currentLang = SupportedLangs.English;
|
||||
|
||||
CheckLanguageFile(_currentLang);
|
||||
LoadLanguage(_currentLang);
|
||||
}
|
||||
|
||||
+4
-21
@@ -72,17 +72,13 @@ public static class Utils
|
||||
switch (tab)
|
||||
{
|
||||
case TabGroup.SystemSettings:
|
||||
return "System Settings";
|
||||
/*
|
||||
case TabGroup.CustomRoleSettings:
|
||||
return "Custom Roles";
|
||||
*/
|
||||
return Translator.Get("systemSettings");
|
||||
case TabGroup.AbilitySettings:
|
||||
return "Ability Settings";
|
||||
return Translator.Get("abilitySettings");
|
||||
case TabGroup.ModSettings:
|
||||
return "Gameplay Settings";
|
||||
return Translator.Get("gameplaySettings");
|
||||
case TabGroup.GamemodeSettings:
|
||||
return "Gamemode Settings";
|
||||
return Translator.Get("gamemodeSettings");
|
||||
default:
|
||||
return "";
|
||||
}
|
||||
@@ -369,19 +365,6 @@ public static class Utils
|
||||
return false;
|
||||
}
|
||||
|
||||
public static void SendPrivateMessage(PlayerControl target, string message)
|
||||
{
|
||||
if (!AmongUsClient.Instance.AmHost || PlayerControl.LocalPlayer == null || target == null || target.Data.ClientId == 255) return;
|
||||
|
||||
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, 13, SendOption.Reliable, target.Data.ClientId);
|
||||
|
||||
writer.Write(message);
|
||||
writer.Write(PlayerControl.LocalPlayer.PlayerId);
|
||||
|
||||
AmongUsClient.Instance.FinishRpcImmediately(writer);
|
||||
|
||||
}
|
||||
|
||||
public static void ChatCommand(ChatController __instance, string msg, string msg2, bool multi)
|
||||
{
|
||||
if (OnGameJoinedPatch.WaitingForChat) return;
|
||||
|
||||
Reference in new issue
Block a user