mirror of
https://github.com/Gurge44/EndlessHostRoles.git
synced 2026-10-20 01:46:25 +00:00
Fixes & Improvements & Reverts
This commit is contained in:
1 parent
ae85b1f0be
commit
d4dbc9273a
10 files changed
+55
-11
No files matched your search
@@ -257,6 +257,7 @@ public enum CustomRoles
|
||||
Mycologist,
|
||||
Necromancer,
|
||||
Opportunist,
|
||||
Patroller,
|
||||
Pelican,
|
||||
Pestilence,
|
||||
Phantom,
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:s="clr-namespace:System;assembly=mscorlib"
|
||||
xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
|
||||
<s:String x:Key="/Default/CodeInspection/Highlighting/AnalysisEnabled/@EntryValue">VISIBLE_FILES</s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=AU/@EntryIndexedValue">AU</s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=CD/@EntryIndexedValue">CD</s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=CK/@EntryIndexedValue">CK</s:String>
|
||||
|
||||
@@ -48,7 +48,7 @@ public abstract class GameOptionsSender
|
||||
protected virtual void SendOptionsArray(Il2CppStructArray<byte> optionArray)
|
||||
{
|
||||
byte i = 0;
|
||||
foreach (var logicComponent in GameManager.Instance.LogicComponents.GetFastEnumerator())
|
||||
foreach (var logicComponent in GameManager.Instance.LogicComponents)
|
||||
{
|
||||
if (logicComponent.TryCast<LogicOptions>(out _))
|
||||
{
|
||||
|
||||
@@ -16,7 +16,7 @@ public class NormalGameOptionsSender : GameOptionsSender
|
||||
{
|
||||
if (GameManager.Instance != null && GameManager.Instance.LogicComponents != null && (_logicOptions == null || !GameManager.Instance.LogicComponents.Contains(_logicOptions)))
|
||||
{
|
||||
foreach (var glc in GameManager.Instance.LogicComponents.GetFastEnumerator())
|
||||
foreach (var glc in GameManager.Instance.LogicComponents)
|
||||
if (glc.TryCast<LogicOptions>(out var lo))
|
||||
_logicOptions = lo;
|
||||
}
|
||||
|
||||
@@ -88,7 +88,7 @@ public class PlayerGameOptionsSender(PlayerControl player) : GameOptionsSender
|
||||
var opt = BuildGameOptions();
|
||||
if (GameManager.Instance?.LogicComponents != null)
|
||||
{
|
||||
foreach (var com in GameManager.Instance.LogicComponents.GetFastEnumerator())
|
||||
foreach (var com in GameManager.Instance.LogicComponents)
|
||||
{
|
||||
if (com.TryCast<LogicOptions>(out var lo))
|
||||
lo.SetGameOptions(opt);
|
||||
@@ -105,7 +105,7 @@ public class PlayerGameOptionsSender(PlayerControl player) : GameOptionsSender
|
||||
try
|
||||
{
|
||||
byte i = 0;
|
||||
foreach (var logicComponent in GameManager.Instance.LogicComponents.GetFastEnumerator())
|
||||
foreach (var logicComponent in GameManager.Instance.LogicComponents)
|
||||
{
|
||||
if (logicComponent.TryCast<LogicOptions>(out _))
|
||||
{
|
||||
|
||||
@@ -66,6 +66,18 @@ namespace EHR.Modules
|
||||
_ = new LateTask(() => { IsChangeInProgress = false; }, 5f, log: false);
|
||||
}
|
||||
|
||||
public static void ChangeBasisToImpostor(this PlayerControl pc)
|
||||
{
|
||||
pc.Data.IsDead = true;
|
||||
GameData.Instance.SetDirty();
|
||||
pc.RpcSetRole(RoleTypes.ImpostorGhost);
|
||||
pc.SyncSettings();
|
||||
pc.Data.IsDead = false;
|
||||
GameData.Instance.SetDirty();
|
||||
pc.MarkDirtySettings();
|
||||
pc.KillFlash();
|
||||
}
|
||||
|
||||
[HarmonyPatch(typeof(InnerNetClient), nameof(InnerNetClient.Spawn))]
|
||||
public static class Client_SpawnDisable
|
||||
{
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System.Linq;
|
||||
using AmongUs.Data;
|
||||
using AmongUs.GameOptions;
|
||||
using EHR.Modules;
|
||||
using EHR.Roles.AddOns.Crewmate;
|
||||
using EHR.Roles.AddOns.Impostor;
|
||||
using EHR.Roles.Crewmate;
|
||||
@@ -145,6 +146,8 @@ class ExileControllerWrapUpPatch
|
||||
pc.RpcSetCustomRole(CustomRoles.Refugee);
|
||||
pc.SetKillCooldown();
|
||||
Logger.Warn($"{pc.GetRealName()} is now a Refugee since all Impostors are dead", "Add Refugee");
|
||||
|
||||
pc.ChangeBasisToImpostor();
|
||||
}
|
||||
else Logger.Msg("No Player to change to Refugee.", "Add Refugee");
|
||||
}
|
||||
|
||||
@@ -3137,7 +3137,8 @@
|
||||
"GamblerGet.HighKCD": "<color=#ffffff><color=#ffa500>Effect:</color> Higher Kill Cooldown (<color=#ffa500>{0}s</color>)</color>",
|
||||
"Patroller": "Patroller",
|
||||
"PatrollerInfo": "Have Different Boosts in Each Room",
|
||||
"PatrollerInfoLong": "(Neutrals):\\nAs the Patroller, you have different boosts in each room.\\nAt the start of the game, it gets randomly rolled which boosts you get in which room.\\nKill everyone to win!\\n\\nYou can see your boosts by petting your pet if the setting to use them is on.",
|
||||
"PatrollerInfoLong": "(Neutrals):\\nAs the Patroller, you have different boosts in each room.\\nAt the start of the game, it gets randomly rolled which boosts you get in which room.\\nAdditionally, you can vent freely from any room once per round.\\nKill everyone to win!\\n\\nYou can see your boosts by petting your pet if the setting to use them is on.",
|
||||
"PatrollerNotifyNoBoost": "You are now in <color=#00ffa5>{0}</color>\\nIn this room, you have <#ff0000>no boosts</color>",
|
||||
"PatrollerNotify": "You are now in <color=#00ffa5>{0}</color>\\nIn this room, {1}",
|
||||
"PatrollerBoost.Speed": "you have <color=#00ffa5>higher speed</color>",
|
||||
"PatrollerBoost.Vision": "you have <color=#00ffa5>higher vision</color>",
|
||||
|
||||
@@ -13,7 +13,10 @@ namespace EHR.Neutral
|
||||
private static OptionItem KillCooldown;
|
||||
private static OptionItem DecreasedKillCooldown;
|
||||
private static OptionItem IncreasedSpeed;
|
||||
|
||||
private int Count;
|
||||
private PlainShipRoom LastRoom;
|
||||
private byte PatrollerId;
|
||||
|
||||
private Dictionary<Boost, PlainShipRoom> RoomBoosts = [];
|
||||
|
||||
@@ -41,6 +44,7 @@ namespace EHR.Neutral
|
||||
public override void Add(byte playerId)
|
||||
{
|
||||
On = true;
|
||||
PatrollerId = playerId;
|
||||
|
||||
LastRoom = null;
|
||||
RoomBoosts = ShipStatus.Instance.AllRooms
|
||||
@@ -48,13 +52,15 @@ namespace EHR.Neutral
|
||||
.Zip(Enum.GetValues<Boost>())
|
||||
.ToDictionary(x => x.Second, x => x.First);
|
||||
|
||||
playerId.SetAbilityUseLimit(1);
|
||||
|
||||
if (!AmongUsClient.Instance.AmHost) return;
|
||||
if (!Main.ResetCamPlayerList.Contains(playerId))
|
||||
Main.ResetCamPlayerList.Add(playerId);
|
||||
}
|
||||
|
||||
public override void SetKillCooldown(byte id) => Main.AllPlayerKillCooldown[id] = Utils.GetPlayerById(id).GetPlainShipRoom() == RoomBoosts[Boost.Cooldown] ? DecreasedKillCooldown.GetFloat() : KillCooldown.GetFloat();
|
||||
public override bool CanUseImpostorVentButton(PlayerControl pc) => pc.GetPlainShipRoom() == RoomBoosts[Boost.Vent];
|
||||
public override bool CanUseImpostorVentButton(PlayerControl pc) => pc.inVent || pc.GetAbilityUseLimit() > 0 || pc.GetPlainShipRoom() == RoomBoosts[Boost.Vent];
|
||||
public override bool CanUseSabotage(PlayerControl pc) => pc.GetPlainShipRoom() == RoomBoosts[Boost.Sabotage];
|
||||
|
||||
public override void ApplyGameOptions(IGameOptions opt, byte id)
|
||||
@@ -69,13 +75,33 @@ namespace EHR.Neutral
|
||||
public override void OnFixedUpdate(PlayerControl pc)
|
||||
{
|
||||
if (!pc.IsAlive() || !GameStates.IsInTask) return;
|
||||
Count++;
|
||||
if (Count < 20) return;
|
||||
Count = 0;
|
||||
|
||||
var room = pc.GetPlainShipRoom();
|
||||
if (room == LastRoom) return;
|
||||
if (LastRoom != null && room == LastRoom) return;
|
||||
LastRoom = room;
|
||||
|
||||
pc.Notify(string.Format(Translator.GetString("PatrollerNotify"), Translator.GetString(room.RoomId.ToString()), Translator.GetString($"PatrollerBoost.{RoomBoosts.GetKeyByValue(room)}")));
|
||||
pc.SyncSettings();
|
||||
var roomName = Translator.GetString(room.RoomId.ToString());
|
||||
pc.Notify(RoomBoosts.Any(x => x.Value == room)
|
||||
? string.Format(Translator.GetString("PatrollerNotify"), roomName, Translator.GetString($"PatrollerBoost.{RoomBoosts.First(x => x.Value == room).Key}"))
|
||||
: string.Format(Translator.GetString("PatrollerNotifyNoBoost"), roomName), 300f);
|
||||
pc.MarkDirtySettings();
|
||||
|
||||
if (pc.PlayerId == PlayerControl.LocalPlayer.PlayerId)
|
||||
HudManager.Instance.SetHudActive(pc, pc.Data.Role, true);
|
||||
}
|
||||
|
||||
public override void OnEnterVent(PlayerControl pc, Vent vent)
|
||||
{
|
||||
if (pc.GetPlainShipRoom() == RoomBoosts[Boost.Vent]) return;
|
||||
pc.RpcRemoveAbilityUse();
|
||||
}
|
||||
|
||||
public override void AfterMeetingTasks()
|
||||
{
|
||||
PatrollerId.SetAbilityUseLimit(1);
|
||||
}
|
||||
|
||||
public override void OnPet(PlayerControl pc)
|
||||
|
||||
@@ -173,7 +173,7 @@ public class Main : BasePlugin
|
||||
{
|
||||
List<PlayerControl> result = [];
|
||||
// ReSharper disable once LoopCanBeConvertedToQuery
|
||||
foreach (var pc in PlayerControl.AllPlayerControls.GetFastEnumerator())
|
||||
foreach (var pc in PlayerControl.AllPlayerControls)
|
||||
{
|
||||
if (pc == null) continue;
|
||||
result.Add(pc);
|
||||
@@ -189,7 +189,7 @@ public class Main : BasePlugin
|
||||
{
|
||||
List<PlayerControl> result = [];
|
||||
// ReSharper disable once LoopCanBeConvertedToQuery
|
||||
foreach (var pc in PlayerControl.AllPlayerControls.GetFastEnumerator())
|
||||
foreach (var pc in PlayerControl.AllPlayerControls)
|
||||
{
|
||||
if (pc == null || !pc.IsAlive() || pc.Data.Disconnected || Pelican.IsEaten(pc.PlayerId)) continue;
|
||||
result.Add(pc);
|
||||
|
||||
Reference in new issue
Block a user