mirror of
https://github.com/Gurge44/EndlessHostRoles.git
synced 2026-10-20 01:46:25 +00:00
mono port 🔥
This commit is contained in:
1 parent
79a0b23a65
commit
97aa6333fd
273 files changed
+2020
-1684
No files matched your search
@@ -74,10 +74,10 @@ public static class BedWars
|
||||
private static OptionItem AllBedsBrokenAfterTimeOption;
|
||||
|
||||
private static readonly StringBuilder HudText = new();
|
||||
private static readonly BedWarsTeam[] AllBedWarsTeam = Enum.GetValues<BedWarsTeam>();
|
||||
private static readonly Item[] Selections = Enum.GetValues<Item>();
|
||||
private static readonly ItemCategory[] Categories = Enum.GetValues<ItemCategory>()[1..];
|
||||
private static readonly Upgrade[] AllUpgrade = Enum.GetValues<Upgrade>();
|
||||
private static readonly BedWarsTeam[] AllBedWarsTeam = EnumHelper.GetValues<BedWarsTeam>();
|
||||
private static readonly Item[] Selections = EnumHelper.GetValues<Item>();
|
||||
private static readonly ItemCategory[] Categories = EnumHelper.GetValues<ItemCategory>()[1..];
|
||||
private static readonly Upgrade[] AllUpgrade = EnumHelper.GetValues<Upgrade>();
|
||||
public static (UnityEngine.Color Color, string Team) WinnerData = (Color.white, "No one wins");
|
||||
|
||||
public static void SetupCustomOption()
|
||||
@@ -661,7 +661,7 @@ public static class BedWars
|
||||
{
|
||||
PlainShipRoom room = __instance.GetPlainShipRoom();
|
||||
|
||||
bool allowed = (room && data.Base.Room == room.RoomId) || (Main.CurrentMap, data.Base.Room) switch
|
||||
bool allowed = room && data.Base.Room == room.RoomId || (Main.CurrentMap, data.Base.Room) switch
|
||||
{
|
||||
(MapNames.Skeld, SystemTypes.Nav) => pos.x > 13f,
|
||||
(MapNames.Dleks, SystemTypes.Nav) => pos.x < -13f,
|
||||
@@ -670,7 +670,7 @@ public static class BedWars
|
||||
(MapNames.MiraHQ, SystemTypes.Balcony) => pos.y < 2f,
|
||||
(MapNames.Polus, SystemTypes.LifeSupp) => room && room.RoomId == SystemTypes.BoilerRoom,
|
||||
(MapNames.Airship, SystemTypes.CargoBay) => room && room.RoomId == SystemTypes.Ventilation,
|
||||
(MapNames.Airship, SystemTypes.MeetingRoom) => (room && room.RoomId == SystemTypes.GapRoom) || __instance.inMovingPlat || __instance.onLadder || __instance.MyPhysics.Animations.IsPlayingAnyLadderAnimation(),
|
||||
(MapNames.Airship, SystemTypes.MeetingRoom) => room && room.RoomId == SystemTypes.GapRoom || __instance.inMovingPlat || __instance.onLadder || __instance.MyPhysics.Animations.IsPlayingAnyLadderAnimation(),
|
||||
(MapNames.Fungle, SystemTypes.Kitchen) => room && room.RoomId == SystemTypes.FishingDock,
|
||||
(MapNames.Fungle, SystemTypes.Comms) => pos is { y: > 8f, x: > 19f },
|
||||
(MapNames.Fungle, SystemTypes.Jungle) => pos is { x: > 10f, y: < -11f },
|
||||
@@ -1845,7 +1845,7 @@ public static class BedWars
|
||||
{
|
||||
lastNotify = Utils.TimeStamp;
|
||||
var left = (int)Math.Ceiling(timer / totalTime * progressDisplayParts);
|
||||
string progress = Utils.ColorString(layerDisplay.Color, $"{new('\u25a0', progressDisplayParts - left)}{new('\u25a1', left)}");
|
||||
string progress = Utils.ColorString(layerDisplay.Color, $"{new string('\u25a0', progressDisplayParts - left)}{new string('\u25a1', left)}");
|
||||
string newStr = string.Format(Translator.GetString("Bedwars.BedStatus.Breaking"), layerName, progress);
|
||||
if (newStr != str) pc.Notify(newStr, 100f, true);
|
||||
}
|
||||
|
||||
@@ -85,7 +85,7 @@ internal static class CustomHnS
|
||||
.Select(x => (IHideAndSeekRole)Activator.CreateInstance(x))
|
||||
.Where(x => x != null)
|
||||
.Join(AllHnSRoles, x => x.GetType().Name.ToLower(), x => x.ToString().ToLower(), (Interface, Enum) => (Enum, Interface))
|
||||
.Where(x => !sns ? (x.Enum is CustomRoles.Seeker or CustomRoles.Hider || x.Enum.GetMode() != 0) : (x.Enum == CustomRoles.Disguiser || (x.Interface.Team != Team.Impostor && x.Enum.GetMode() != 0)))
|
||||
.Where(x => !sns ? x.Enum is CustomRoles.Seeker or CustomRoles.Hider || x.Enum.GetMode() != 0 : x.Enum == CustomRoles.Disguiser || x.Interface.Team != Team.Impostor && x.Enum.GetMode() != 0)
|
||||
.Where(x => (!x.Enum.OnlySpawnsWithPets() || Options.UsePets.GetBool()) && (x.Enum != CustomRoles.Agent || SeekerNum >= 2) && x.Interface.Count > 0 && (x.Interface.Team == Team.Neutral || x.Interface.Chance > IRandom.Instance.Next(100)))
|
||||
.OrderBy(x => x.Enum is CustomRoles.Seeker or CustomRoles.Hider ? 100 : IRandom.Instance.Next(100))
|
||||
.GroupBy(x => x.Interface.Team)
|
||||
@@ -418,7 +418,7 @@ internal static class CustomHnS
|
||||
|
||||
public static string GetSuffixText(PlayerControl seer, PlayerControl target, bool hud = false)
|
||||
{
|
||||
if (!Main.IntroDestroyed || seer.PlayerId != target.PlayerId || (seer.IsModdedClient() && !hud) || TimeLeft < 0) return string.Empty;
|
||||
if (!Main.IntroDestroyed || seer.PlayerId != target.PlayerId || seer.IsModdedClient() && !hud || TimeLeft < 0) return string.Empty;
|
||||
|
||||
Suffix.Clear();
|
||||
|
||||
@@ -480,8 +480,8 @@ internal static class CustomHnS
|
||||
{
|
||||
return Danger.TryGetValue(seer.PlayerId, out int danger)
|
||||
? danger <= 5
|
||||
? $"\n<color={GetColorFromDanger()}>{new('\u25a0', 5 - danger)}{new('\u25a1', danger)}</color>"
|
||||
: $"\n<color=#ffffff>{new('\u25a1', 5)}</color>"
|
||||
? $"\n<color={GetColorFromDanger()}>{new string('\u25a0', 5 - danger)}{new string('\u25a1', danger)}</color>"
|
||||
: $"\n<color=#ffffff>{new string('\u25a1', 5)}</color>"
|
||||
: string.Empty;
|
||||
|
||||
string GetColorFromDanger() // 0: Highest, 4: Lowest
|
||||
|
||||
@@ -11,7 +11,7 @@ namespace EHR.Gamemodes;
|
||||
|
||||
public static class Deathrace
|
||||
{
|
||||
private static readonly PowerUp[] AllPowerUp = Enum.GetValues<PowerUp>();
|
||||
private static readonly PowerUp[] AllPowerUp = EnumHelper.GetValues<PowerUp>();
|
||||
public static readonly Dictionary<string, HashSet<MapNames>> PlayedMaps = [];
|
||||
public static List<SystemTypes> Track = [];
|
||||
public static Dictionary<byte, PlayerData> Data = [];
|
||||
@@ -294,7 +294,7 @@ public static class Deathrace
|
||||
|
||||
public static string GetSuffix(PlayerControl seer, PlayerControl target, bool hud)
|
||||
{
|
||||
if (!GameGoing || seer.PlayerId != target.PlayerId || (seer.IsHost() && !hud) || !Data.TryGetValue(seer.PlayerId, out var data)) return string.Empty;
|
||||
if (!GameGoing || seer.PlayerId != target.PlayerId || seer.IsHost() && !hud || !Data.TryGetValue(seer.PlayerId, out var data)) return string.Empty;
|
||||
|
||||
Suffix.Clear().Append("<#ffffff>");
|
||||
|
||||
@@ -418,7 +418,7 @@ public static class Deathrace
|
||||
|
||||
public static bool CanUseVent(PlayerControl pc, int ventId)
|
||||
{
|
||||
if (!AmongUsClient.Instance.AmHost || (pc.inVent && pc.GetClosestVent()?.Id == ventId)) return true;
|
||||
if (!AmongUsClient.Instance.AmHost || pc.inVent && pc.GetClosestVent()?.Id == ventId) return true;
|
||||
return Data.TryGetValue(pc.PlayerId, out var data) && UsableVentIDs.TryGetValue(Main.CurrentMap, out var dict) && dict.ContainsKey(data.GetNextRoom()) && dict.TryGetValue(data.GetCurrentRoom(), out var vents) && vents.Contains(ventId);
|
||||
}
|
||||
|
||||
@@ -562,7 +562,7 @@ public static class Deathrace
|
||||
|
||||
SystemTypes currentRoom = data.GetCurrentRoom();
|
||||
|
||||
if ((!room && !coordinateCheck) || (room && room.RoomId == currentRoom))
|
||||
if (!room && !coordinateCheck || room && room.RoomId == currentRoom)
|
||||
{
|
||||
CheckAndNotify(data);
|
||||
continue;
|
||||
|
||||
@@ -332,7 +332,7 @@ internal static class DoomTag
|
||||
|
||||
public static string GetSuffix(PlayerControl seer, PlayerControl target, bool hud = false)
|
||||
{
|
||||
if (seer.PlayerId != target.PlayerId || GameStates.IsMeeting || (seer.IsModdedClient() && !hud)) return string.Empty;
|
||||
if (seer.PlayerId != target.PlayerId || GameStates.IsMeeting || seer.IsModdedClient() && !hud) return string.Empty;
|
||||
|
||||
byte targetId = GetTarget(seer.PlayerId);
|
||||
if (targetId == byte.MaxValue) return string.Empty;
|
||||
|
||||
@@ -96,7 +96,7 @@ internal static class HotPotato
|
||||
|
||||
public static string GetSuffixText(byte id, bool hud)
|
||||
{
|
||||
if (!Main.PlayerStates.TryGetValue(id, out PlayerState state) || (id.IsPlayerModdedClient() && !hud) || (state.IsDead && !hud)) return string.Empty;
|
||||
if (!Main.PlayerStates.TryGetValue(id, out PlayerState state) || id.IsPlayerModdedClient() && !hud || state.IsDead && !hud) return string.Empty;
|
||||
string holding = HotPotatoState.HolderID == id ? $"{Translator.GetString("HotPotato_HoldingNotify")}\n" : string.Empty;
|
||||
string arrows = TargetArrow.GetAllArrows(id);
|
||||
arrows = arrows.Length > 0 ? $"\n{arrows}" : string.Empty;
|
||||
|
||||
@@ -29,7 +29,7 @@ public static class KingOfTheZones
|
||||
private static OptionItem SpawnProtectionTime;
|
||||
|
||||
private static readonly string[] PreferNumTeamsOptions = ["KOTZ.PNTO.Less", "KOTZ.PNTO.More"];
|
||||
private static readonly KOTZTeam[] AllKOTZTeam = Enum.GetValues<KOTZTeam>();
|
||||
private static readonly KOTZTeam[] AllKOTZTeam = EnumHelper.GetValues<KOTZTeam>();
|
||||
private static readonly StringBuilder Suffix = new();
|
||||
|
||||
public static (UnityEngine.Color Color, string Team) WinnerData = (Color.white, "No one wins");
|
||||
@@ -586,7 +586,7 @@ public static class KingOfTheZones
|
||||
|
||||
int highestPoints = Points.Values.Max();
|
||||
bool tie = Points.Values.Count(x => x == highestPoints) > 1;
|
||||
bool end = (GameEndsByTimeLimit.GetBool() && TimeLeft <= 0) || (GameEndsByPoints.GetBool() && highestPoints >= PointsToWin.GetInt());
|
||||
bool end = GameEndsByTimeLimit.GetBool() && TimeLeft <= 0 || GameEndsByPoints.GetBool() && highestPoints >= PointsToWin.GetInt();
|
||||
|
||||
if (tie && end)
|
||||
{
|
||||
|
||||
+1
-1
@@ -100,7 +100,7 @@ public static class Mingle
|
||||
|
||||
public static int GetSurvivalTime(byte id)
|
||||
{
|
||||
if (!Main.PlayerStates.TryGetValue(id, out PlayerState state) || ChatCommands.Spectators.Contains(id) || (id == 0 && Main.GM.Value) || state.deathReason == PlayerState.DeathReason.Disconnected) return -1;
|
||||
if (!Main.PlayerStates.TryGetValue(id, out PlayerState state) || ChatCommands.Spectators.Contains(id) || id == 0 && Main.GM.Value || state.deathReason == PlayerState.DeathReason.Disconnected) return -1;
|
||||
|
||||
if (!state.IsDead) return 0;
|
||||
|
||||
|
||||
@@ -178,7 +178,7 @@ public static class NaturalDisasters
|
||||
{
|
||||
cb = string.Empty;
|
||||
}
|
||||
else if (allRooms.Count / 2 <= collapsedRooms.Count)
|
||||
else if (allRooms.Length / 2 <= collapsedRooms.Count)
|
||||
{
|
||||
SystemTypes[] remainingRooms = allRooms.Select(x => x.RoomId).Where(x => x is not (SystemTypes.Hallway or SystemTypes.Outside or SystemTypes.Decontamination2 or SystemTypes.Decontamination3)).Except(collapsedRooms.ConvertAll(x => x.RoomId)).ToArray();
|
||||
cb = string.Format(Translator.GetString("AvailableBuildings"), remainingRooms.Length > 0
|
||||
@@ -259,7 +259,7 @@ public static class NaturalDisasters
|
||||
|
||||
public static void Postfix( /*PlayerControl __instance*/)
|
||||
{
|
||||
if (!AmongUsClient.Instance.AmHost || !GameStates.IsInTask || ExileController.Instance || AntiBlackout.SkipTasks || (Options.CurrentGameMode != CustomGameMode.NaturalDisasters && !Options.IntegrateNaturalDisasters.GetBool()) || !Main.IntroDestroyed || Main.HasJustStarted /* || __instance.PlayerId >= 254 || !__instance.IsHost()*/) return;
|
||||
if (!AmongUsClient.Instance.AmHost || !GameStates.IsInTask || ExileController.Instance || AntiBlackout.SkipTasks || Options.CurrentGameMode != CustomGameMode.NaturalDisasters && !Options.IntegrateNaturalDisasters.GetBool() || !Main.IntroDestroyed || Main.HasJustStarted /* || __instance.PlayerId >= 254 || !__instance.IsHost()*/) return;
|
||||
|
||||
long now = Utils.TimeStamp;
|
||||
if (IntroCutsceneDestroyPatch.IntroDestroyTS + WaitTime > now) return;
|
||||
@@ -646,7 +646,7 @@ public static class NaturalDisasters
|
||||
NetObject.RpcChangeSprite(newSprite);
|
||||
}
|
||||
|
||||
float range = Range - ((Phases - Math.Min(4, Phase)) * 0.4f);
|
||||
float range = Range - (Phases - Math.Min(4, Phase)) * 0.4f;
|
||||
KillNearbyPlayers(PlayerState.DeathReason.Lava, range);
|
||||
return false;
|
||||
}
|
||||
@@ -716,7 +716,7 @@ public static class NaturalDisasters
|
||||
continue;
|
||||
case <= dragRange:
|
||||
Vector2 direction = (Position - pos).normalized;
|
||||
Vector2 newPosition = pos + (direction * 0.15f);
|
||||
Vector2 newPosition = pos + direction * 0.15f;
|
||||
pc.TP(newPosition, true);
|
||||
continue;
|
||||
}
|
||||
@@ -738,7 +738,7 @@ public static class NaturalDisasters
|
||||
Vector2 addVector = new Vector2(Mathf.Cos(angle), Mathf.Sin(angle));
|
||||
Vector2 newPos = Position + addVector * speed;
|
||||
|
||||
if ((!GoesThroughWalls.GetBool() && PhysicsHelpers.AnythingBetween(NetObject.playerControl.Collider, Position, newPos + addVector * 2, Constants.ShipOnlyMask, false)) ||
|
||||
if (!GoesThroughWalls.GetBool() && PhysicsHelpers.AnythingBetween(NetObject.playerControl.Collider, Position, newPos + addVector * 2, Constants.ShipOnlyMask, false) ||
|
||||
newPos.x < MapBounds.X.Left || newPos.x > MapBounds.X.Right || newPos.y < MapBounds.Y.Bottom || newPos.y > MapBounds.Y.Top)
|
||||
{
|
||||
Angle = RandomAngle();
|
||||
@@ -880,7 +880,7 @@ public static class NaturalDisasters
|
||||
{
|
||||
bool inRange = FastVector2.DistanceWithinRange(pc.Pos(), Position, Range * 1.25f);
|
||||
|
||||
if ((inRange && AffectedPlayers.Add(pc.PlayerId)) || (!inRange && AffectedPlayers.Remove(pc.PlayerId)))
|
||||
if (inRange && AffectedPlayers.Add(pc.PlayerId) || !inRange && AffectedPlayers.Remove(pc.PlayerId))
|
||||
pc.MarkDirtySettings();
|
||||
}
|
||||
|
||||
@@ -1004,7 +1004,7 @@ public static class NaturalDisasters
|
||||
best = MovingDirection.BottomToTop;
|
||||
}
|
||||
|
||||
return max == 0 ? Enum.GetValues<MovingDirection>().RandomElement() : best;
|
||||
return max == 0 ? EnumHelper.GetValues<MovingDirection>().RandomElement() : best;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -115,7 +115,7 @@ public static class Quiz
|
||||
.SetColor(color)
|
||||
.SetGameMode(gameMode);
|
||||
|
||||
foreach (Difficulty difficulty in Enum.GetValues<Difficulty>()[1..])
|
||||
foreach (Difficulty difficulty in EnumHelper.GetValues<Difficulty>()[1..])
|
||||
{
|
||||
var rounds = new IntegerOptionItem(id++, $"Quiz.Settings.Rounds.{difficulty}", new(1, 50, 1), 3, TabGroup.GameSettings)
|
||||
.SetHidden(difficulty == Difficulty.Hard)
|
||||
|
||||
@@ -677,7 +677,7 @@ public static class RoomRush
|
||||
|
||||
public static int GetSurvivalTime(byte id)
|
||||
{
|
||||
if (!Main.PlayerStates.TryGetValue(id, out PlayerState state) || ChatCommands.Spectators.Contains(id) || (id == 0 && Main.GM.Value) || state.deathReason == PlayerState.DeathReason.Disconnected) return -1;
|
||||
if (!Main.PlayerStates.TryGetValue(id, out PlayerState state) || ChatCommands.Spectators.Contains(id) || id == 0 && Main.GM.Value || state.deathReason == PlayerState.DeathReason.Disconnected) return -1;
|
||||
|
||||
if (!state.IsDead) return 0;
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using EHR.Roles;
|
||||
using Hazel;
|
||||
@@ -41,7 +40,7 @@ public static class Snowdown
|
||||
private static OptionItem SnowballSizeOption;
|
||||
private static Dictionary<PowerUp, OptionItem> PowerUpPriceOptions = [];
|
||||
|
||||
private static readonly PowerUp[] AllPowerUp = Enum.GetValues<PowerUp>();
|
||||
private static readonly PowerUp[] AllPowerUp = EnumHelper.GetValues<PowerUp>();
|
||||
private static readonly StringBuilder SelfSuffix = new();
|
||||
private static readonly StringBuilder Suffix = new();
|
||||
private static readonly StringBuilder Statistics = new();
|
||||
|
||||
@@ -30,7 +30,7 @@ public class Counter(int totalGreenTime, int totalRedTime, char symbol, bool isR
|
||||
return "--";
|
||||
|
||||
int timer = Timer;
|
||||
bool hidden = IsYellow || (timer == TotalGreenTime && !IsRed && !IsYellow) || (timer == TotalRedTime && IsRed);
|
||||
bool hidden = IsYellow || timer == TotalGreenTime && !IsRed && !IsYellow || timer == TotalRedTime && IsRed;
|
||||
string result = hidden ? Utils.ColorString(Color.clear, "--") : Utils.ColorString(IsRed ? Color.red : Color.green, timer < 10 ? $" {timer}" : timer.ToString());
|
||||
|
||||
if (timer is <= 19 and >= 10 && !hidden) result = $" {result}";
|
||||
@@ -317,7 +317,7 @@ internal static class StopAndGo
|
||||
.SetValueFormat(OptionFormat.Seconds)
|
||||
.SetHeader(true);
|
||||
|
||||
Events[] events = Enum.GetValues<Events>();
|
||||
Events[] events = EnumHelper.GetValues<Events>();
|
||||
|
||||
EventChances = events.ToDictionary(x => x, x => new IntegerOptionItem(68_213_019 + (int)x, $"StopAndGo_EventChance_{x}", new(0, 100, 5), EventDefaults(x).Chance, TabGroup.GameSettings)
|
||||
.SetGameMode(CustomGameMode.StopAndGo)
|
||||
|
||||
@@ -38,7 +38,7 @@ public static class TheMindGame
|
||||
private static bool PreventGameEnd;
|
||||
private static int Round;
|
||||
|
||||
private static readonly Item[] AllItem = Enum.GetValues<Item>();
|
||||
private static readonly Item[] AllItem = EnumHelper.GetValues<Item>();
|
||||
|
||||
// Settings
|
||||
private static bool PlayersCanSeeOthersPoints = true;
|
||||
|
||||
Reference in new issue
Block a user