mirror of
https://github.com/Gurge44/EndlessHostRoles.git
synced 2026-10-20 01:46:25 +00:00
Add Librarian & Optimize
This commit is contained in:
1 parent
c3b1c47935
commit
11d41233bc
139 files changed
+450
-193
No files matched your search
@@ -378,7 +378,7 @@ internal static class FFAManager
|
||||
|
||||
var filtered = Main.AllAlivePlayerControls.Where(a =>
|
||||
pc.IsAlive() && !pc.inVent && a.PlayerId != pc.PlayerId && !changePositionPlayers.Contains(a.PlayerId)).ToArray();
|
||||
if (!filtered.Any()) break;
|
||||
if (filtered.Length == 0) break;
|
||||
|
||||
PlayerControl target = filtered[rd.Next(0, filtered.Length)];
|
||||
|
||||
|
||||
@@ -123,7 +123,7 @@ internal class CustomRoleSelector
|
||||
}
|
||||
|
||||
// 抽取优先职业(内鬼)
|
||||
while (ImpOnList.Any())
|
||||
while (ImpOnList.Count > 0)
|
||||
{
|
||||
var select = ImpOnList[rd.Next(0, ImpOnList.Count)];
|
||||
ImpOnList.Remove(select);
|
||||
@@ -136,7 +136,7 @@ internal class CustomRoleSelector
|
||||
// 优先职业不足以分配,开始分配启用的职业(内鬼)
|
||||
if (readyRoleNum < playerCount && readyRoleNum < optImpNum)
|
||||
{
|
||||
while (ImpRateList.Any())
|
||||
while (ImpRateList.Count > 0)
|
||||
{
|
||||
var select = ImpRateList[rd.Next(0, ImpRateList.Count)];
|
||||
ImpRateList.Remove(select);
|
||||
@@ -149,7 +149,7 @@ internal class CustomRoleSelector
|
||||
}
|
||||
|
||||
// Select NonNeutralKilling "Always"
|
||||
while (NonNeutralKillingOnList.Any() && optNonNeutralKillingNum > 0)
|
||||
while (NonNeutralKillingOnList.Count > 0 && optNonNeutralKillingNum > 0)
|
||||
{
|
||||
var select = NonNeutralKillingOnList[rd.Next(0, NonNeutralKillingOnList.Count)];
|
||||
NonNeutralKillingOnList.Remove(select);
|
||||
@@ -164,7 +164,7 @@ internal class CustomRoleSelector
|
||||
// Select NonNeutralKilling "Random"
|
||||
if (readyRoleNum < playerCount && readyNonNeutralKillingNum < optNonNeutralKillingNum)
|
||||
{
|
||||
while (NonNeutralKillingRateList.Any() && optNonNeutralKillingNum > 0)
|
||||
while (NonNeutralKillingRateList.Count > 0 && optNonNeutralKillingNum > 0)
|
||||
{
|
||||
var select = NonNeutralKillingRateList[rd.Next(0, NonNeutralKillingRateList.Count)];
|
||||
NonNeutralKillingRateList.Remove(select);
|
||||
@@ -178,7 +178,7 @@ internal class CustomRoleSelector
|
||||
}
|
||||
|
||||
// Select NeutralKilling "Always"
|
||||
while (NeutralKillingOnList.Any() && optNeutralKillingNum > 0)
|
||||
while (NeutralKillingOnList.Count > 0 && optNeutralKillingNum > 0)
|
||||
{
|
||||
var select = NeutralKillingOnList[rd.Next(0, NeutralKillingOnList.Count)];
|
||||
NeutralKillingOnList.Remove(select);
|
||||
@@ -193,7 +193,7 @@ internal class CustomRoleSelector
|
||||
// Select NeutralKilling "Random"
|
||||
if (readyRoleNum < playerCount && readyNeutralKillingNum < optNeutralKillingNum)
|
||||
{
|
||||
while (NeutralKillingRateList.Any() && optNeutralKillingNum > 0)
|
||||
while (NeutralKillingRateList.Count > 0 && optNeutralKillingNum > 0)
|
||||
{
|
||||
var select = NeutralKillingRateList[rd.Next(0, NeutralKillingRateList.Count)];
|
||||
NeutralKillingRateList.Remove(select);
|
||||
@@ -206,35 +206,8 @@ internal class CustomRoleSelector
|
||||
}
|
||||
}
|
||||
|
||||
/*while (CovenOnList.Any() && optCovenNum > 0)
|
||||
{
|
||||
var select = CovenOnList[rd.Next(0, CovenOnList.Count)];
|
||||
CovenOnList.Remove(select);
|
||||
rolesToAssign.Add(select);
|
||||
readyRoleNum++;
|
||||
readyCovenNum += select.GetCount();
|
||||
Logger.Info(select.ToString() + " 加入中立职业待选列表(优先)", "CustomRoleSelector");
|
||||
if (readyRoleNum >= playerCount) goto EndOfAssign;
|
||||
if (readyCovenNum >= optCovenNum) break;
|
||||
}*/
|
||||
|
||||
/*if (readyRoleNum < playerCount && readyCovenNum < optCovenNum)
|
||||
{
|
||||
while (CovenRateList.Any() && optCovenNum > 0)
|
||||
{
|
||||
var select = CovenRateList[rd.Next(0, CovenRateList.Count)];
|
||||
CovenRateList.Remove(select);
|
||||
rolesToAssign.Add(select);
|
||||
readyRoleNum++;
|
||||
readyCovenNum += select.GetCount();
|
||||
Logger.Info(select.ToString() + " 加入中立职业待选列表", "CustomRoleSelector");
|
||||
if (readyRoleNum >= playerCount) goto EndOfAssign;
|
||||
if (readyCovenNum >= optCovenNum) break;
|
||||
}
|
||||
}*/
|
||||
|
||||
// 抽取优先职业
|
||||
while (roleOnList.Any())
|
||||
while (roleOnList.Count > 0)
|
||||
{
|
||||
var select = roleOnList[rd.Next(0, roleOnList.Count)];
|
||||
roleOnList.Remove(select);
|
||||
@@ -246,7 +219,7 @@ internal class CustomRoleSelector
|
||||
// 优先职业不足以分配,开始分配启用的职业
|
||||
if (readyRoleNum < playerCount)
|
||||
{
|
||||
while (roleRateList.Any())
|
||||
while (roleRateList.Count > 0)
|
||||
{
|
||||
var select = roleRateList[rd.Next(0, roleRateList.Count)];
|
||||
roleRateList.Remove(select);
|
||||
@@ -311,7 +284,7 @@ internal class CustomRoleSelector
|
||||
|
||||
var AllPlayer = Main.AllAlivePlayerControls.ToList();
|
||||
|
||||
while (AllPlayer.Any() && rolesToAssign.Any())
|
||||
while (AllPlayer.Count > 0 && rolesToAssign.Count > 0)
|
||||
{
|
||||
PlayerControl delPc = null;
|
||||
for (int i = 0; i < AllPlayer.Count; i++)
|
||||
@@ -344,9 +317,9 @@ internal class CustomRoleSelector
|
||||
}
|
||||
}
|
||||
|
||||
if (AllPlayer.Any())
|
||||
if (AllPlayer.Count > 0)
|
||||
Logger.Error("Role assignment error: There are players who have not been assigned a role", "CustomRoleSelector");
|
||||
if (rolesToAssign.Any())
|
||||
if (rolesToAssign.Count > 0)
|
||||
Logger.Error("Team assignment error: There is an unassigned team", "CustomRoleSelector");
|
||||
|
||||
}
|
||||
|
||||
@@ -50,6 +50,7 @@ internal static class CustomRolesHelper
|
||||
CustomRoles.SpeedBooster => CustomRoles.Crewmate,
|
||||
CustomRoles.Dictator => CustomRoles.Crewmate,
|
||||
CustomRoles.Inhibitor => CustomRoles.Impostor,
|
||||
CustomRoles.Librarian => CustomRoles.Shapeshifter,
|
||||
CustomRoles.Cantankerous => CustomRoles.Impostor,
|
||||
CustomRoles.YinYanger => CustomRoles.Impostor,
|
||||
CustomRoles.Duellist => CustomRoles.Shapeshifter,
|
||||
@@ -732,6 +733,7 @@ internal static class CustomRolesHelper
|
||||
CustomRoles.SerialKiller or
|
||||
CustomRoles.Underdog or
|
||||
CustomRoles.Inhibitor or
|
||||
CustomRoles.Librarian or
|
||||
CustomRoles.Cantankerous or
|
||||
CustomRoles.Duellist or
|
||||
CustomRoles.YinYanger or
|
||||
@@ -1519,7 +1521,7 @@ internal static class CustomRolesHelper
|
||||
_ => role.IsImpostorTeam() ? CountTypes.Impostor : CountTypes.Crew,
|
||||
};
|
||||
|
||||
public static bool HasSubRole(this PlayerControl pc) => Main.PlayerStates[pc.PlayerId].SubRoles.Any();
|
||||
public static bool HasSubRole(this PlayerControl pc) => Main.PlayerStates[pc.PlayerId].SubRoles.Count > 0;
|
||||
}
|
||||
public enum CustomRoleTypes
|
||||
{
|
||||
|
||||
@@ -52,8 +52,8 @@ public class ErrorText : MonoBehaviour
|
||||
public void Update()
|
||||
{
|
||||
AllErrors.ForEach(err => err.IncreaseTimer());
|
||||
var ToRemove = AllErrors.Where(err => err.ErrorLevel <= 1 && 30f < err.Timer);
|
||||
if (ToRemove.Any())
|
||||
var ToRemove = AllErrors.Where(err => err.ErrorLevel <= 1 && 30f < err.Timer).ToArray();
|
||||
if (ToRemove.Length > 0)
|
||||
{
|
||||
AllErrors.RemoveAll(err => ToRemove.Contains(err));
|
||||
UpdateText();
|
||||
|
||||
@@ -373,7 +373,7 @@ static class ExtendedPlayerControl
|
||||
public static string GetSubRoleName(this PlayerControl player, bool forUser = false)
|
||||
{
|
||||
var SubRoles = Main.PlayerStates[player.PlayerId].SubRoles.ToArray();
|
||||
if (!SubRoles.Any()) return string.Empty;
|
||||
if (SubRoles.Length == 0) return string.Empty;
|
||||
var sb = new StringBuilder();
|
||||
foreach (CustomRoles role in SubRoles)
|
||||
{
|
||||
@@ -475,6 +475,7 @@ static class ExtendedPlayerControl
|
||||
CustomRoles.RiftMaker => true,
|
||||
CustomRoles.Hitman => true,
|
||||
CustomRoles.Inhibitor => true,
|
||||
CustomRoles.Librarian => true,
|
||||
CustomRoles.Cantankerous => true,
|
||||
CustomRoles.YinYanger => true,
|
||||
CustomRoles.Duellist => true,
|
||||
@@ -595,6 +596,7 @@ static class ExtendedPlayerControl
|
||||
CustomRoles.Mafioso => pc.IsAlive(),
|
||||
CustomRoles.Consort => pc.IsAlive(),
|
||||
CustomRoles.Duellist => pc.IsAlive(),
|
||||
CustomRoles.Librarian => pc.IsAlive() && Librarian.CanUseKillButton(pc),
|
||||
CustomRoles.YinYanger => pc.IsAlive(),
|
||||
CustomRoles.Cantankerous => pc.IsAlive() && Cantankerous.CanUseKillButton(pc.PlayerId),
|
||||
CustomRoles.Inhibitor => !Utils.IsActive(SystemTypes.Electrical) && !Utils.IsActive(SystemTypes.Laboratory) && !Utils.IsActive(SystemTypes.Comms) && !Utils.IsActive(SystemTypes.LifeSupp) && !Utils.IsActive(SystemTypes.Reactor),
|
||||
|
||||
@@ -15,25 +15,45 @@ namespace TOHE.Modules;
|
||||
public class PlayerGameOptionsSender(PlayerControl player) : GameOptionsSender
|
||||
{
|
||||
public static void SetDirty(PlayerControl player) => SetDirty(player.PlayerId);
|
||||
public static void SetDirty(byte playerId) =>
|
||||
AllSenders.OfType<PlayerGameOptionsSender>()
|
||||
.Where(sender => sender.player.PlayerId == playerId)
|
||||
.ToList().ForEach(sender => sender.SetDirty());
|
||||
public static void SetDirtyToAll() =>
|
||||
AllSenders.OfType<PlayerGameOptionsSender>()
|
||||
.ToList().ForEach(sender => sender.SetDirty());
|
||||
public static void SetDirtyToAllV2() =>
|
||||
AllSenders.OfType<PlayerGameOptionsSender>()
|
||||
.Where(sender => !sender.IsDirty && sender.player.IsAlive() && CustomRolesHelper.NeedUpdateOnLights(sender.player.GetCustomRole()))
|
||||
.ToList().ForEach(sender => sender.SetDirty());
|
||||
public static void SetDirtyToAllV3() =>
|
||||
AllSenders.OfType<PlayerGameOptionsSender>()
|
||||
.Where(sender => !sender.IsDirty && sender.player.IsAlive() && ((Main.GrenadierBlinding.Any() && (sender.player.GetCustomRole().IsImpostor() || (sender.player.GetCustomRole().IsNeutral() && Options.GrenadierCanAffectNeutral.GetBool()))) || (Main.MadGrenadierBlinding.Any() && !sender.player.GetCustomRole().IsImpostorTeam() && !sender.player.Is(CustomRoles.Madmate))))
|
||||
.ToList().ForEach(sender => sender.SetDirty());
|
||||
public static void SetDirtyToAllV4() =>
|
||||
AllSenders.OfType<PlayerGameOptionsSender>()
|
||||
.Where(sender => !sender.IsDirty && sender.player.IsAlive() && sender.player.CanUseKillButton())
|
||||
.ToList().ForEach(sender => sender.SetDirty());
|
||||
public static void SetDirty(byte playerId)
|
||||
{
|
||||
foreach (var sender in AllSenders.OfType<PlayerGameOptionsSender>().Where(sender => sender.player.PlayerId == playerId).ToArray())
|
||||
{
|
||||
sender.SetDirty();
|
||||
}
|
||||
}
|
||||
|
||||
public static void SetDirtyToAll()
|
||||
{
|
||||
foreach (var sender in AllSenders.OfType<PlayerGameOptionsSender>().ToArray())
|
||||
{
|
||||
sender.SetDirty();
|
||||
}
|
||||
}
|
||||
|
||||
public static void SetDirtyToAllV2()
|
||||
{
|
||||
foreach (var sender in AllSenders.OfType<PlayerGameOptionsSender>().Where(sender => !sender.IsDirty && sender.player.IsAlive() && sender.player.GetCustomRole().NeedUpdateOnLights()).ToArray())
|
||||
{
|
||||
sender.SetDirty();
|
||||
}
|
||||
}
|
||||
|
||||
public static void SetDirtyToAllV3()
|
||||
{
|
||||
foreach (var sender in AllSenders.OfType<PlayerGameOptionsSender>().Where(sender => !sender.IsDirty && sender.player.IsAlive() && ((Main.GrenadierBlinding.Any() && (sender.player.GetCustomRole().IsImpostor() || (sender.player.GetCustomRole().IsNeutral() && Options.GrenadierCanAffectNeutral.GetBool()))) || (Main.MadGrenadierBlinding.Any() && !sender.player.GetCustomRole().IsImpostorTeam() && !sender.player.Is(CustomRoles.Madmate)))).ToArray())
|
||||
{
|
||||
sender.SetDirty();
|
||||
}
|
||||
}
|
||||
|
||||
public static void SetDirtyToAllV4()
|
||||
{
|
||||
foreach (var sender in AllSenders.OfType<PlayerGameOptionsSender>().Where(sender => !sender.IsDirty && sender.player.IsAlive() && sender.player.CanUseKillButton()).ToArray())
|
||||
{
|
||||
sender.SetDirty();
|
||||
}
|
||||
}
|
||||
|
||||
public override IGameOptions BasedGameOptions =>
|
||||
Main.RealOptionsData.Restore(new NormalGameOptionsV07(new UnityLogger().Cast<ILogger>()).Cast<IGameOptions>());
|
||||
@@ -62,7 +82,7 @@ public class PlayerGameOptionsSender(PlayerControl player) : GameOptionsSender
|
||||
{
|
||||
try
|
||||
{
|
||||
for (byte i = 0; i < GameManager.Instance.LogicComponents.Count; i++)
|
||||
for (byte i = 0; i < GameManager.Instance?.LogicComponents?.Count; i++)
|
||||
{
|
||||
if (GameManager.Instance.LogicComponents[(Index)i].TryCast<LogicOptions>(out _))
|
||||
{
|
||||
@@ -333,6 +353,9 @@ public class PlayerGameOptionsSender(PlayerControl player) : GameOptionsSender
|
||||
case CustomRoles.Sidekick:
|
||||
Sidekick.ApplyGameOptions(opt);
|
||||
break;
|
||||
case CustomRoles.Librarian:
|
||||
Librarian.ApplyGameOptions();
|
||||
break;
|
||||
case CustomRoles.Vulture:
|
||||
Vulture.ApplyGameOptions(opt);
|
||||
AURoleOptions.EngineerCooldown = 0f;
|
||||
|
||||
@@ -1218,6 +1218,8 @@ public static class Options
|
||||
InhibitorCDAfterMeetings = FloatOptionItem.Create(1511, "AfterMeetingKillCooldown", new(0f, 180f, 2.5f), 22.5f, TabGroup.ImpostorRoles, false)
|
||||
.SetParent(CustomRoleSpawnChances[CustomRoles.Inhibitor])
|
||||
.SetValueFormat(OptionFormat.Seconds);
|
||||
RoleLoadingText = "Impostor roles\nLibrarian";
|
||||
Librarian.SetupCustomOption();
|
||||
RoleLoadingText = "Impostor roles\nCantankerous";
|
||||
Cantankerous.SetupCustomOption();
|
||||
RoleLoadingText = "Impostor roles\nDuellist";
|
||||
|
||||
@@ -58,6 +58,8 @@ enum CustomRPC
|
||||
|
||||
//Roles
|
||||
SetDrawPlayer,
|
||||
SetLibrarianMode,
|
||||
SyncLibrarianList,
|
||||
GaulousAddPlayerToList,
|
||||
SetGauloisLimit,
|
||||
SyncYinYanger,
|
||||
@@ -400,6 +402,12 @@ internal class RPCHandlerPatch
|
||||
case CustomRPC.SetCPTasksDone:
|
||||
RPC.CrewpostorTasksRecieveRPC(reader);
|
||||
break;
|
||||
case CustomRPC.SetLibrarianMode:
|
||||
Librarian.ReceiveRPC(reader);
|
||||
break;
|
||||
case CustomRPC.SyncLibrarianList:
|
||||
Librarian.ReceiveRPCSyncList(reader);
|
||||
break;
|
||||
case CustomRPC.SetDousedPlayer:
|
||||
byte ArsonistId = reader.ReadByte();
|
||||
byte DousedId = reader.ReadByte();
|
||||
@@ -1193,6 +1201,9 @@ internal static class RPC
|
||||
case CustomRoles.Benefactor:
|
||||
Benefactor.Add(targetId);
|
||||
break;
|
||||
case CustomRoles.Librarian:
|
||||
Librarian.Add(targetId);
|
||||
break;
|
||||
case CustomRoles.Escort:
|
||||
Escort.Add(targetId);
|
||||
break;
|
||||
|
||||
@@ -2481,6 +2481,8 @@ public static class Utils
|
||||
TargetSuffix.Append(PlagueDoctor.GetLowerTextOthers(seer, target));
|
||||
TargetSuffix.Append(Stealth.GetSuffix(seer, target));
|
||||
|
||||
if (target.Is(CustomRoles.Librarian)) TargetSuffix.Append(Librarian.GetNameTextForSuffix(target.PlayerId));
|
||||
|
||||
string TargetDeathReason = string.Empty;
|
||||
if (seer.KnowDeathReason(target))
|
||||
TargetDeathReason = $"({ColorString(GetRoleColor(CustomRoles.Doctor), GetVitalText(target.PlayerId))})";
|
||||
|
||||
@@ -476,6 +476,7 @@ class HudManagerPatch
|
||||
CustomRoles.Chronomancer => Chronomancer.GetHudText(),
|
||||
CustomRoles.Mafioso => Mafioso.GetHUDText(),
|
||||
CustomRoles.Druid => Druid.GetHUDText(player),
|
||||
CustomRoles.Librarian => Librarian.GetSelfSuffixAndHUDText(player.PlayerId),
|
||||
CustomRoles.PlagueDoctor => PlagueDoctor.GetLowerTextOthers(player, isForHud: true),
|
||||
CustomRoles.Stealth => Stealth.GetSuffix(player, isHUD: true),
|
||||
CustomRoles.Sapper => GetCD_HUDText(Main.SapperCD, Sapper.ShapeshiftCooldown.GetInt(), player.PlayerId),
|
||||
|
||||
@@ -643,11 +643,11 @@ class CheckMurderPatch
|
||||
|
||||
if (killer.Is(CustomRoles.Swift) && !target.Is(CustomRoles.Pestilence))
|
||||
{
|
||||
target.Kill(target);
|
||||
//killer.RpcGuardAndKill(killer);
|
||||
// target.RpcGuardAndKill(target);
|
||||
target.SetRealKiller(killer);
|
||||
killer.SetKillCooldown();
|
||||
if (killer.RpcCheckAndMurder(target, true))
|
||||
{
|
||||
target.Suicide(PlayerState.DeathReason.Kill, killer);
|
||||
killer.SetKillCooldown();
|
||||
}
|
||||
RPC.PlaySoundRPC(killer.PlayerId, Sounds.KillSound);
|
||||
return false;
|
||||
}
|
||||
@@ -1344,6 +1344,11 @@ class ShapeshiftPatch
|
||||
Blackmailer.ForBlackmailer.Add(target.PlayerId);
|
||||
isSSneeded = false;
|
||||
break;
|
||||
case CustomRoles.Librarian:
|
||||
if (shapeshifting)
|
||||
{
|
||||
isSSneeded = Librarian.OnShapeshift(shapeshifter);
|
||||
}
|
||||
case CustomRoles.Warlock:
|
||||
if (Main.CursedPlayers[shapeshifter.PlayerId] != null)//呪われた人がいるか確認
|
||||
{
|
||||
@@ -1640,6 +1645,8 @@ class ReportDeadBodyPatch
|
||||
if (Bloodhound.UnreportablePlayers.Contains(target.PlayerId)
|
||||
|| Vulture.UnreportablePlayers.Contains(target.PlayerId)) return false;
|
||||
|
||||
if (!Librarian.OnAnyoneReport(__instance)) return false;
|
||||
|
||||
switch (__instance.GetCustomRole())
|
||||
{
|
||||
case CustomRoles.Bloodhound:
|
||||
@@ -1843,6 +1850,7 @@ class ReportDeadBodyPatch
|
||||
if (QuickShooter.IsEnable) QuickShooter.OnReportDeadBody();
|
||||
if (Eraser.IsEnable) Eraser.OnReportDeadBody();
|
||||
if (NiceEraser.IsEnable) NiceEraser.OnReportDeadBody();
|
||||
if (Librarian.IsEnable) Librarian.OnReportDeadBody();
|
||||
if (Hacker.IsEnable) Hacker.OnReportDeadBody();
|
||||
if (Analyzer.IsEnable) Analyzer.OnReportDeadBody();
|
||||
if (Judge.IsEnable) Judge.OnReportDeadBody();
|
||||
@@ -2073,6 +2081,9 @@ class FixedUpdatePatch
|
||||
case CustomRoles.Mafioso when !lowLoad:
|
||||
Mafioso.OnFixedUpdate(player);
|
||||
break;
|
||||
case CustomRoles.Librarian when !lowLoad:
|
||||
Librarian.OnFixedUpdate();
|
||||
break;
|
||||
case CustomRoles.Analyzer:
|
||||
Analyzer.OnFixedUpdate(player);
|
||||
break;
|
||||
@@ -2928,9 +2939,14 @@ class FixedUpdatePatch
|
||||
case CustomRoles.YinYanger when !seer.IsModClient():
|
||||
Suffix.Append(YinYanger.ModeText);
|
||||
break;
|
||||
case CustomRoles.Librarian when !seer.IsModClient():
|
||||
Suffix.Append(Librarian.GetSelfSuffixAndHUDText(seer.PlayerId));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (target.Is(CustomRoles.Librarian) && !seer.Is(CustomRoles.Librarian)) Suffix.Append(Librarian.GetNameTextForSuffix(target.PlayerId));
|
||||
|
||||
if (Spiritualist.IsEnable) Suffix.Append(Spiritualist.GetSpiritualistArrow(seer, target));
|
||||
|
||||
if (Options.CurrentGameMode == CustomGameMode.FFA) Suffix.Append(FFAManager.GetPlayerArrow(seer, target));
|
||||
|
||||
@@ -228,6 +228,7 @@ internal class ChangeRoleSettings
|
||||
Pelican.Init();
|
||||
//Counterfeiter.Init();
|
||||
Tether.Init();
|
||||
Librarian.Init();
|
||||
Benefactor.Init();
|
||||
Aid.Init();
|
||||
DonutDelivery.Init();
|
||||
@@ -674,6 +675,9 @@ internal class SelectRolesPatch
|
||||
case CustomRoles.Benefactor:
|
||||
Benefactor.Add(pc.PlayerId);
|
||||
break;
|
||||
case CustomRoles.Librarian:
|
||||
Librarian.Add(pc.PlayerId);
|
||||
break;
|
||||
case CustomRoles.Aid:
|
||||
Aid.Add(pc.PlayerId);
|
||||
break;
|
||||
|
||||
@@ -3021,6 +3021,20 @@
|
||||
"MagicianBombExlodesIn","","Bomb explodes in {0}s","","",""
|
||||
"MagicianCardUsed","","Card used","","",""
|
||||
|
||||
"## Librarian"
|
||||
"Librarian","","Librarian","","",""
|
||||
"LibrarianInfo","","Silence the Reporters Nearby","","",""
|
||||
"LibrarianInfoLong","","(Impostors):\nAs the Librarian, when you're in silencing mode, if someone reports a body next to you, you'll kill them instead. After you kill someone like this, everyone will see 'SSSH!' in red under your name.","","",""
|
||||
"LibrarianRadius","","Silence Radius","","",""
|
||||
"LibrarianShowSSAnimation","","Shapeshift Transformation Animation is Visible","","",""
|
||||
"LibrarianNameNotifyDuration","","SSSH! Name Text Duration","","",""
|
||||
"LibrarianNameText","","SSSH!","","",""
|
||||
"LibrarianModeText","","<color=#00ffa5>Mode:</color> <b>{0}</b>","","",""
|
||||
"LibrarianSilenceMode","","<color=#ff1919>Silence</color>","","",""
|
||||
"LibrarianNormalMode","","Normal","","",""
|
||||
|
||||
"CanKillWhileShifted","","Can Kill While Shapeshifting","","",""
|
||||
|
||||
"## Postman"
|
||||
"Postman","","Postman","","",""
|
||||
"PostmanInfo","","Deliver Mail to Everyone!","","",""
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -41,7 +41,7 @@ public static class Workhorse
|
||||
{
|
||||
playerIdList.Add(playerId);
|
||||
}
|
||||
public static bool IsEnable => playerIdList.Any();
|
||||
public static bool IsEnable => playerIdList.Count > 0;
|
||||
public static bool IsThisRole(byte playerId) => playerIdList.Contains(playerId);
|
||||
public static (bool, int, int) TaskData => (false, NumLongTasks, NumShortTasks);
|
||||
private static bool IsAssignTarget(PlayerControl pc)
|
||||
|
||||
@@ -49,7 +49,7 @@ namespace TOHE.Roles.Crewmate
|
||||
ImmortalTimer.TryAdd(playerId, 420f);
|
||||
DefaultSpeed = Main.AllPlayerSpeed[playerId];
|
||||
}
|
||||
public static bool IsEnable => playerIdList.Any();
|
||||
public static bool IsEnable => playerIdList.Count > 0;
|
||||
|
||||
public static bool IsImmortal(PlayerControl player) => player.Is(CustomRoles.Addict) && ImmortalTimer[player.PlayerId] <= ImmortalTimeAfterVent.GetFloat();
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ public static class Admirer
|
||||
if (!Main.ResetCamPlayerList.Contains(playerId))
|
||||
Main.ResetCamPlayerList.Add(playerId);
|
||||
}
|
||||
public static bool IsEnable => playerIdList.Any();
|
||||
public static bool IsEnable => playerIdList.Count > 0;
|
||||
|
||||
public static void SendRPC()
|
||||
{
|
||||
|
||||
@@ -45,7 +45,7 @@ namespace TOHE.Roles.Crewmate
|
||||
Main.ResetCamPlayerList.Add(playerId);
|
||||
}
|
||||
public static void SetKillCooldown(byte playerId) => Main.AllPlayerKillCooldown[playerId] = AidCD.GetInt();
|
||||
public static bool IsEnable => playerIdList.Any();
|
||||
public static bool IsEnable => playerIdList.Count > 0;
|
||||
public static bool OnCheckMurder(PlayerControl killer, PlayerControl target)
|
||||
{
|
||||
if (killer == null) return false;
|
||||
|
||||
@@ -68,7 +68,7 @@ namespace TOHE.Roles.Crewmate
|
||||
PlayerName = Utils.GetPlayerById(playerId).GetRealName();
|
||||
_ = new LateTask(() => { SendRPCData(IsProtected, PotionID, PlayerName, VisionPotionActive, FixNextSabo); }, 10f, "Alchemist RPCs");
|
||||
}
|
||||
public static bool IsEnable => playerIdList.Any();
|
||||
public static bool IsEnable => playerIdList.Count > 0;
|
||||
|
||||
public static void SendRPCData(bool isProtected, byte potionId, string playerName, bool visionPotionActive, bool fixNextSabo)
|
||||
{
|
||||
|
||||
@@ -57,6 +57,7 @@ namespace TOHE.Roles.Crewmate
|
||||
writer.Write(shieldExpire);
|
||||
writer.Write(shieldedId);
|
||||
if (!IsShield) writer.Write(TaskMarkPerRound[benefactorID]);
|
||||
AmongUsClient.Instance.FinishRpcImmediately(writer);
|
||||
}
|
||||
public static void ReceiveRPC(MessageReader reader)
|
||||
{
|
||||
|
||||
@@ -48,7 +48,7 @@
|
||||
BloodhoundTargets.Add(playerId, []);
|
||||
|
||||
}
|
||||
public static bool IsEnable => playerIdList.Any();
|
||||
public static bool IsEnable => playerIdList.Count > 0;
|
||||
|
||||
private static void SendRPC(byte playerId, bool add, Vector3 loc = new())
|
||||
{
|
||||
|
||||
@@ -40,7 +40,7 @@ namespace TOHE.Roles.Crewmate
|
||||
playerIdList.Add(playerId);
|
||||
UseLimit.Add(playerId, UseLimitOpt.GetInt());
|
||||
}
|
||||
public static bool IsEnable => playerIdList.Any();
|
||||
public static bool IsEnable => playerIdList.Count > 0;
|
||||
public static void SendRPC(byte playerId)
|
||||
{
|
||||
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.SetCameraManLimit, SendOption.Reliable, -1);
|
||||
|
||||
@@ -68,7 +68,7 @@
|
||||
if (Utils.IsActive(SystemTypes.Electrical))
|
||||
opt.SetFloat(FloatOptionNames.CrewLightMod, Vision * 5);
|
||||
}
|
||||
public static bool IsEnable => playerIdList.Any();
|
||||
public static bool IsEnable => playerIdList.Count > 0;
|
||||
public static bool OnCompleteTask(PlayerControl pc)
|
||||
{
|
||||
ElapsedTime = OptionTaskEndVisionTime.GetInt();
|
||||
|
||||
@@ -49,7 +49,7 @@ public static class Chameleon
|
||||
playerIdList.Add(playerId);
|
||||
UseLimit.Add(playerId, UseLimitOpt.GetInt());
|
||||
}
|
||||
public static bool IsEnable => playerIdList.Any();
|
||||
public static bool IsEnable => playerIdList.Count > 0;
|
||||
private static void SendRPC(PlayerControl pc)
|
||||
{
|
||||
if (pc.AmOwner) return;
|
||||
|
||||
@@ -43,7 +43,7 @@ public static class Cleanser
|
||||
DidVote.Add(playerId, false);
|
||||
}
|
||||
|
||||
public static bool IsEnable => playerIdList.Any();
|
||||
public static bool IsEnable => playerIdList.Count > 0;
|
||||
|
||||
//public static string GetProgressText(byte playerId) => Utils.ColorString(CleanserUsesOpt.GetInt() - CleanserUses[playerId] > 0 ? Utils.GetRoleColor(CustomRoles.Cleanser).ShadeColor(0.25f) : Color.gray, CleanserUses.TryGetValue(playerId, out var x) ? $"({CleanserUsesOpt.GetInt() - x})" : "Invalid");
|
||||
public static string GetProgressText(byte playerId)
|
||||
|
||||
@@ -46,7 +46,7 @@ public static class CopyCat
|
||||
Main.ResetCamPlayerList.Add(playerId);
|
||||
}
|
||||
|
||||
public static bool IsEnable() => playerIdList.Any();
|
||||
public static bool IsEnable() => playerIdList.Count > 0;
|
||||
|
||||
private static void SendRPC(byte playerId)
|
||||
{
|
||||
|
||||
@@ -48,7 +48,7 @@ public static class Crusader
|
||||
if (Main.ResetCamPlayerList.Contains(playerId))
|
||||
Main.ResetCamPlayerList.Remove(playerId);
|
||||
}
|
||||
public static bool IsEnable => playerIdList.Any();
|
||||
public static bool IsEnable => playerIdList.Count > 0;
|
||||
public static void ReceiveRPC(MessageReader reader)
|
||||
{
|
||||
byte PlayerId = reader.ReadByte();
|
||||
|
||||
@@ -45,7 +45,7 @@ public static class Deputy
|
||||
if (!Main.ResetCamPlayerList.Contains(playerId))
|
||||
Main.ResetCamPlayerList.Add(playerId);
|
||||
}
|
||||
public static bool IsEnable => playerIdList.Any();
|
||||
public static bool IsEnable => playerIdList.Count > 0;
|
||||
|
||||
public static void SendRPC()
|
||||
{
|
||||
|
||||
@@ -42,7 +42,7 @@ public static class Divinator
|
||||
playerIdList.Add(playerId);
|
||||
CheckLimit.TryAdd(playerId, CheckLimitOpt.GetInt());
|
||||
}
|
||||
public static bool IsEnable => playerIdList.Any();
|
||||
public static bool IsEnable => playerIdList.Count > 0;
|
||||
public static void SendRPC(byte playerId)
|
||||
{
|
||||
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.SetDivinatorLimit, SendOption.Reliable, -1);
|
||||
|
||||
@@ -42,7 +42,7 @@ namespace TOHE.Roles.Crewmate
|
||||
if (!Main.ResetCamPlayerList.Contains(playerId))
|
||||
Main.ResetCamPlayerList.Add(playerId);
|
||||
}
|
||||
public static bool IsEnable => playerIdList.Any();
|
||||
public static bool IsEnable => playerIdList.Count > 0;
|
||||
public static void SendRPC()
|
||||
{
|
||||
if (!IsEnable) return;
|
||||
|
||||
@@ -41,7 +41,7 @@ namespace TOHE.Roles.Crewmate
|
||||
playerIdList.Add(playerId);
|
||||
UseLimit.Add(playerId, UseLimitOpt.GetInt());
|
||||
}
|
||||
public static bool IsEnable => playerIdList.Any();
|
||||
public static bool IsEnable => playerIdList.Count > 0;
|
||||
public static void SendRPC(byte playerId)
|
||||
{
|
||||
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.SetDoormasterLimit, SendOption.Reliable, -1);
|
||||
|
||||
@@ -51,7 +51,7 @@ namespace TOHE.Roles.Crewmate
|
||||
AURoleOptions.EngineerCooldown = VentCD.GetFloat();
|
||||
}
|
||||
|
||||
public static bool IsEnable => playerIdList.Any();
|
||||
public static bool IsEnable => playerIdList.Count > 0;
|
||||
|
||||
public static void SendRPC()
|
||||
{
|
||||
|
||||
@@ -56,7 +56,7 @@ namespace TOHE.Roles.Crewmate
|
||||
lastUpdate = GetTimeStamp();
|
||||
}
|
||||
|
||||
public static bool IsEnable => playerIdList.Any();
|
||||
public static bool IsEnable => playerIdList.Count > 0;
|
||||
|
||||
public static void SendRPCSyncAbilityUse(byte playerId)
|
||||
{
|
||||
|
||||
@@ -44,7 +44,7 @@ namespace TOHE.Roles.Crewmate
|
||||
if (!Main.ResetCamPlayerList.Contains(playerId))
|
||||
Main.ResetCamPlayerList.Add(playerId);
|
||||
}
|
||||
public static bool IsEnable => playerIdList.Any();
|
||||
public static bool IsEnable => playerIdList.Count > 0;
|
||||
public static void SendRPC()
|
||||
{
|
||||
if (!IsEnable) return;
|
||||
|
||||
@@ -44,7 +44,7 @@ namespace TOHE.Roles.Crewmate
|
||||
UseLimit.Add(playerId, UseLimitOpt.GetInt());
|
||||
}
|
||||
|
||||
public static bool IsEnable => playerIdList.Any();
|
||||
public static bool IsEnable => playerIdList.Count > 0;
|
||||
|
||||
public static void SendRPC(byte playerId)
|
||||
{
|
||||
|
||||
@@ -46,7 +46,7 @@ public static class Jailor
|
||||
if (!Main.ResetCamPlayerList.Contains(playerId))
|
||||
Main.ResetCamPlayerList.Add(playerId);
|
||||
}
|
||||
public static bool IsEnable => playerIdList.Any();
|
||||
public static bool IsEnable => playerIdList.Count > 0;
|
||||
public static void SetKillCooldown(byte id) => Main.AllPlayerKillCooldown[id] = Utils.GetPlayerById(id).IsAlive() ? JailCooldown.GetFloat() : 0f;
|
||||
public static string GetProgressText(byte playerId) => Utils.ColorString(Utils.GetRoleColor(CustomRoles.Jailor).ShadeColor(0.25f), JailorExeLimit.TryGetValue(playerId, out var exeLimit) ? $"({exeLimit})" : "Invalid");
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@ public static class Judge
|
||||
playerIdList.Add(playerId);
|
||||
TrialLimit.Add(playerId, TrialLimitPerMeeting.GetInt());
|
||||
}
|
||||
public static bool IsEnable => playerIdList.Any();
|
||||
public static bool IsEnable => playerIdList.Count > 0;
|
||||
public static void OnReportDeadBody()
|
||||
{
|
||||
byte[] list = [.. TrialLimit.Keys];
|
||||
|
||||
@@ -82,7 +82,7 @@ public static class Medic
|
||||
if (!Main.ResetCamPlayerList.Contains(playerId))
|
||||
Main.ResetCamPlayerList.Add(playerId);
|
||||
}
|
||||
public static bool IsEnable => playerIdList.Any();
|
||||
public static bool IsEnable => playerIdList.Count > 0;
|
||||
private static void SendRPC(byte playerId)
|
||||
{
|
||||
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.SetMedicalerProtectLimit, SendOption.Reliable, -1);
|
||||
|
||||
@@ -38,7 +38,7 @@ public static class Mediumshiper
|
||||
playerIdList.Add(playerId);
|
||||
ContactLimit.Add(playerId, ContactLimitOpt.GetInt());
|
||||
}
|
||||
public static bool IsEnable => playerIdList.Any();
|
||||
public static bool IsEnable => playerIdList.Count > 0;
|
||||
public static void SendRPC(byte playerId)
|
||||
{
|
||||
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.SetMediumshiperLimit, SendOption.Reliable, -1);
|
||||
|
||||
@@ -40,7 +40,7 @@ public static class Monarch
|
||||
if (!Main.ResetCamPlayerList.Contains(playerId))
|
||||
Main.ResetCamPlayerList.Add(playerId);
|
||||
}
|
||||
public static bool IsEnable => playerIdList.Any();
|
||||
public static bool IsEnable => playerIdList.Count > 0;
|
||||
|
||||
public static void SendRPC()
|
||||
{
|
||||
|
||||
@@ -38,7 +38,7 @@ internal class Monitor
|
||||
{
|
||||
playerIdList.Add(playerId);
|
||||
}
|
||||
public static bool IsEnable => playerIdList.Any();
|
||||
public static bool IsEnable => playerIdList.Count > 0;
|
||||
|
||||
private static int Count;
|
||||
public static void FixedUpdate()
|
||||
|
||||
@@ -30,7 +30,7 @@ public static class Mortician
|
||||
{
|
||||
playerIdList.Add(playerId);
|
||||
}
|
||||
public static bool IsEnable => playerIdList.Any();
|
||||
public static bool IsEnable => playerIdList.Count > 0;
|
||||
private static void SendRPC(byte playerId, bool add, Vector3 loc = new())
|
||||
{
|
||||
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.SetMorticianArrow, SendOption.Reliable, -1);
|
||||
|
||||
@@ -36,7 +36,7 @@ internal static class NiceEraser
|
||||
EraseLimit.TryAdd(playerId, EraseLimitOpt.GetInt());
|
||||
Logger.Info($"{Utils.GetPlayerById(playerId)?.GetNameWithRole().RemoveHtmlTags()} : 剩余{EraseLimit[playerId]}次", "NiceEraser");
|
||||
}
|
||||
public static bool IsEnable => playerIdList.Any();
|
||||
public static bool IsEnable => playerIdList.Count > 0;
|
||||
public static void SendRPC(byte playerId)
|
||||
{
|
||||
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.SetEraseLimit, SendOption.Reliable, -1);
|
||||
|
||||
@@ -60,7 +60,7 @@
|
||||
if (!GetPlayerById(playerId).IsModClient()) UseLimit.Add(playerId, UseLimitOpt.GetInt());
|
||||
else UseLimitSeconds.Add(playerId, UseLimitOpt.GetInt() * ModdedClientAbilityUseSecondsMultiplier.GetInt());
|
||||
}
|
||||
public static bool IsEnable => playerIdList.Any();
|
||||
public static bool IsEnable => playerIdList.Count > 0;
|
||||
public static void SendRPC(byte playerId, float secondsLeft)
|
||||
{
|
||||
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.SetNiceHackerLimit, SendOption.Reliable, -1);
|
||||
|
||||
@@ -47,7 +47,7 @@ public static class NiceSwapper
|
||||
playerIdList.Add(playerId);
|
||||
NiceSwappermax.TryAdd(playerId, SwapMax.GetInt());
|
||||
}
|
||||
public static bool IsEnable => playerIdList.Any();
|
||||
public static bool IsEnable => playerIdList.Count > 0;
|
||||
public static string GetNiceSwappermax(byte playerId) => Utils.ColorString((NiceSwappermax.TryGetValue(playerId, out var x) && x >= 1) ? Color.white : Color.red, NiceSwappermax.TryGetValue(playerId, out var changermax) ? $"<color=#777777>-</color> {Math.Round(changermax, 1)}" : "Invalid");
|
||||
public static bool SwapMsg(PlayerControl pc, string msg, bool isUI = false)
|
||||
{
|
||||
|
||||
@@ -45,7 +45,7 @@ public static class Oracle
|
||||
playerIdList.Add(playerId);
|
||||
CheckLimit.TryAdd(playerId, CheckLimitOpt.GetInt());
|
||||
}
|
||||
public static bool IsEnable => playerIdList.Any();
|
||||
public static bool IsEnable => playerIdList.Count > 0;
|
||||
public static void SendRPC(byte playerId)
|
||||
{
|
||||
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.SetOracleLimit, SendOption.Reliable, -1);
|
||||
|
||||
@@ -68,7 +68,7 @@ public static class ParityCop
|
||||
MaxCheckLimit.Add(playerId, ParityCheckLimitMax.GetInt());
|
||||
RoundCheckLimit.Add(playerId, ParityCheckLimitPerMeeting.GetInt());
|
||||
}
|
||||
public static bool IsEnable => playerIdList.Any();
|
||||
public static bool IsEnable => playerIdList.Count > 0;
|
||||
public static void OnReportDeadBody()
|
||||
{
|
||||
RoundCheckLimit.Clear();
|
||||
|
||||
@@ -39,7 +39,7 @@ public static class Psychic
|
||||
{
|
||||
playerIdList.Add(playerId);
|
||||
}
|
||||
public static bool IsEnable => playerIdList.Any();
|
||||
public static bool IsEnable => playerIdList.Count > 0;
|
||||
private static void SendRPC()
|
||||
{
|
||||
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.SyncPsychicRedList, SendOption.Reliable, -1);
|
||||
|
||||
@@ -39,7 +39,7 @@ namespace TOHE.Roles.Crewmate
|
||||
playerIdList.Add(playerId);
|
||||
UseLimit.Add(playerId, UseLimitOpt.GetInt());
|
||||
}
|
||||
public static bool IsEnable => playerIdList.Any();
|
||||
public static bool IsEnable => playerIdList.Count > 0;
|
||||
public static void SendRPC(byte playerId)
|
||||
{
|
||||
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.SetRicochetLimit, SendOption.Reliable, -1);
|
||||
|
||||
@@ -51,7 +51,7 @@ public static class SabotageMaster
|
||||
{
|
||||
playerIdList.Add(playerId);
|
||||
}
|
||||
public static bool IsEnable() => playerIdList.Any();
|
||||
public static bool IsEnable() => playerIdList.Count > 0;
|
||||
public static void SendRPC(float count)
|
||||
{
|
||||
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.SetSabotageMasterLimit, SendOption.Reliable, -1);
|
||||
|
||||
@@ -98,7 +98,7 @@ public static class Sheriff
|
||||
if (!Main.ResetCamPlayerList.Contains(playerId))
|
||||
Main.ResetCamPlayerList.Add(playerId);
|
||||
}
|
||||
public static bool IsEnable => playerIdList.Any();
|
||||
public static bool IsEnable => playerIdList.Count > 0;
|
||||
public static void SendRPC(byte playerId)
|
||||
{
|
||||
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.SetSheriffShotLimit, SendOption.Reliable, -1);
|
||||
|
||||
@@ -42,7 +42,7 @@ namespace TOHE.Roles.Crewmate
|
||||
LastGhostArrowShowTime.Add(playerId, 0);
|
||||
ShowGhostArrowUntil.Add(playerId, 0);
|
||||
}
|
||||
public static bool IsEnable => playerIdList.Any();
|
||||
public static bool IsEnable => playerIdList.Count > 0;
|
||||
|
||||
private static bool ShowArrow(byte playerId)
|
||||
{
|
||||
|
||||
@@ -44,7 +44,7 @@ namespace TOHE.Roles.Crewmate
|
||||
playerIdList.Add(playerId);
|
||||
UseLimit.Add(playerId, UseLimitOpt.GetInt());
|
||||
}
|
||||
public static bool IsEnable => playerIdList.Any();
|
||||
public static bool IsEnable => playerIdList.Count > 0;
|
||||
public static void SendRPC(byte susId)
|
||||
{
|
||||
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.SpyRedNameSync, SendOption.Reliable, -1);
|
||||
|
||||
@@ -42,7 +42,7 @@ namespace TOHE.Roles.Crewmate
|
||||
playerIdList.Add(playerId);
|
||||
UseLimit.Add(playerId, UseLimitOpt.GetInt());
|
||||
}
|
||||
public static bool IsEnable => playerIdList.Any();
|
||||
public static bool IsEnable => playerIdList.Count > 0;
|
||||
public static void SendRPC(byte playerId)
|
||||
{
|
||||
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.SetTetherLimit, SendOption.Reliable, -1);
|
||||
|
||||
@@ -30,7 +30,7 @@ public static class TimeManager
|
||||
{
|
||||
playerIdList.Add(playerId);
|
||||
}
|
||||
public static bool IsEnable => playerIdList.Any();
|
||||
public static bool IsEnable => playerIdList.Count > 0;
|
||||
private static int AdditionalTime(byte id)
|
||||
{
|
||||
var pc = Utils.GetPlayerById(id);
|
||||
|
||||
@@ -39,7 +39,7 @@ public static class Tracefinder
|
||||
{
|
||||
playerIdList.Add(playerId);
|
||||
}
|
||||
public static bool IsEnable => playerIdList.Any();
|
||||
public static bool IsEnable => playerIdList.Count > 0;
|
||||
private static void SendRPC(byte playerId, bool add, Vector3 loc = new())
|
||||
{
|
||||
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.SetTracefinderArrow, SendOption.Reliable, -1);
|
||||
|
||||
@@ -36,7 +36,7 @@ internal class AntiAdminer
|
||||
{
|
||||
playerIdList.Add(playerId);
|
||||
}
|
||||
public static bool IsEnable() => playerIdList.Any();
|
||||
public static bool IsEnable() => playerIdList.Count > 0;
|
||||
|
||||
private static int Count;
|
||||
public static void FixedUpdate()
|
||||
|
||||
@@ -37,7 +37,7 @@ internal static class Assassin
|
||||
{
|
||||
playerIdList.Add(playerId);
|
||||
}
|
||||
public static bool IsEnable => playerIdList.Any();
|
||||
public static bool IsEnable => playerIdList.Count > 0;
|
||||
private static void SendRPC(byte playerId)
|
||||
{
|
||||
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.SetMarkedPlayer, SendOption.Reliable, -1);
|
||||
|
||||
@@ -38,7 +38,7 @@ public static class BallLightning
|
||||
{
|
||||
playerIdList.Add(playerId);
|
||||
}
|
||||
public static bool IsEnable => playerIdList.Any();
|
||||
public static bool IsEnable => playerIdList.Count > 0;
|
||||
private static void SendRPC(byte playerId)
|
||||
{
|
||||
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.SetGhostPlayer, SendOption.Reliable, -1);
|
||||
|
||||
@@ -41,7 +41,7 @@ namespace TOHE.Roles.Impostor
|
||||
Points.Add(playerId, StartingPoints.GetInt());
|
||||
}
|
||||
|
||||
public static bool IsEnable => playerIdList.Any();
|
||||
public static bool IsEnable => playerIdList.Count > 0;
|
||||
|
||||
public static bool CanUseKillButton(byte playerId) => Points.TryGetValue(playerId, out var point) && point > 0;
|
||||
|
||||
|
||||
@@ -58,7 +58,7 @@ namespace TOHE.Roles.Impostor
|
||||
lastUpdate = Utils.GetTimeStamp() + 10;
|
||||
}
|
||||
public static void SetKillCooldown(byte id) => Main.AllPlayerKillCooldown[id] = isRampaging ? 0.01f : KCD.GetFloat();
|
||||
public static bool IsEnable => playerIdList.Any();
|
||||
public static bool IsEnable => playerIdList.Count > 0;
|
||||
public static void OnCheckMurder(PlayerControl killer, PlayerControl target)
|
||||
{
|
||||
if (killer == null) return;
|
||||
|
||||
@@ -39,7 +39,7 @@ namespace TOHE.Roles.Impostor
|
||||
playerIdList.Add(playerId);
|
||||
BlockLimit = UseLimit.GetInt();
|
||||
}
|
||||
public static bool IsEnable => playerIdList.Any();
|
||||
public static bool IsEnable => playerIdList.Count > 0;
|
||||
public static void SendRPC()
|
||||
{
|
||||
if (!IsEnable) return;
|
||||
|
||||
@@ -53,7 +53,7 @@ public static class Councillor
|
||||
MurderLimit.Add(playerId, MurderLimitPerMeeting.GetInt());
|
||||
// MurderLimitGame.Add(playerId, MurderLimitPerGame.GetInt());
|
||||
}
|
||||
public static bool IsEnable => playerIdList.Any();
|
||||
public static bool IsEnable => playerIdList.Count > 0;
|
||||
public static void OnReportDeadBody()
|
||||
{
|
||||
MurderLimit.Clear();
|
||||
|
||||
@@ -69,7 +69,7 @@ namespace TOHE.Roles.Impostor
|
||||
AURoleOptions.ShapeshifterCooldown = ShapeshiftCooldown.GetFloat();
|
||||
AURoleOptions.ShapeshifterDuration = 1f;
|
||||
}
|
||||
public static bool IsEnable => playerIdList.Any();
|
||||
public static bool IsEnable => playerIdList.Count > 0;
|
||||
|
||||
public static void SetKillCooldown(byte id) => Main.AllPlayerKillCooldown[id] = KillCooldown.GetFloat();
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ namespace TOHE.Roles.Impostor
|
||||
playerIdList.Add(playerId);
|
||||
}
|
||||
|
||||
public static bool IsEnable => playerIdList.Any();
|
||||
public static bool IsEnable => playerIdList.Count > 0;
|
||||
|
||||
public static void ApplyGameOptions()
|
||||
{
|
||||
|
||||
@@ -53,7 +53,7 @@ internal static class Eraser
|
||||
EraseLimit.TryAdd(playerId, EraseLimitOpt.GetInt());
|
||||
Logger.Info($"{Utils.GetPlayerById(playerId)?.GetNameWithRole().RemoveHtmlTags()} : 剩余{EraseLimit[playerId]}次", "Eraser");
|
||||
}
|
||||
public static bool IsEnable => playerIdList.Any();
|
||||
public static bool IsEnable => playerIdList.Count > 0;
|
||||
private static void SendRPC(byte playerId)
|
||||
{
|
||||
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.SetEraseLimit, SendOption.Reliable, -1);
|
||||
|
||||
@@ -80,7 +80,7 @@ public static class EvilTracker
|
||||
}
|
||||
}
|
||||
}
|
||||
public static bool IsEnable => playerIdList.Any();
|
||||
public static bool IsEnable => playerIdList.Count > 0;
|
||||
public static void ApplyGameOptions(byte playerId)
|
||||
{
|
||||
AURoleOptions.ShapeshifterCooldown = CanTarget(playerId) ? 1f : 255f;
|
||||
|
||||
@@ -92,7 +92,7 @@ namespace TOHE.Roles.Impostor
|
||||
playerIdList.Add(playerId);
|
||||
}
|
||||
|
||||
public static bool IsEnable => playerIdList.Any();
|
||||
public static bool IsEnable => playerIdList.Count > 0;
|
||||
|
||||
public static bool OnCheckMurder(PlayerControl killer, PlayerControl target)
|
||||
{
|
||||
|
||||
@@ -50,7 +50,7 @@ public static class Gangster
|
||||
playerIdList.Add(playerId);
|
||||
RecruitLimit.TryAdd(playerId, RecruitLimitOpt.GetInt());
|
||||
}
|
||||
public static bool IsEnable => playerIdList.Any();
|
||||
public static bool IsEnable => playerIdList.Count > 0;
|
||||
private static void SendRPC(byte playerId)
|
||||
{
|
||||
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.SetGangsterRecruitLimit, SendOption.Reliable, -1);
|
||||
|
||||
@@ -36,7 +36,7 @@ public static class Greedier
|
||||
playerIdList.Add(playerId);
|
||||
IsOdd.Add(playerId, true);
|
||||
}
|
||||
public static bool IsEnable() => playerIdList.Any();
|
||||
public static bool IsEnable() => playerIdList.Count > 0;
|
||||
|
||||
private static void SendRPC(byte playerId)
|
||||
{
|
||||
|
||||
@@ -42,7 +42,7 @@ public static class Hacker
|
||||
playerIdList.Add(playerId);
|
||||
HackLimit.TryAdd(playerId, HackLimitOpt.GetInt());
|
||||
}
|
||||
public static bool IsEnable => playerIdList.Any();
|
||||
public static bool IsEnable => playerIdList.Count > 0;
|
||||
private static void SendRPC(byte playerId)
|
||||
{
|
||||
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.SetHackerHackLimit, SendOption.Reliable, -1);
|
||||
|
||||
@@ -42,7 +42,7 @@ public static class Hangman
|
||||
playerIdList.Add(playerId);
|
||||
HangLimit.Add(playerId, HangmanLimitOpt.GetInt());
|
||||
}
|
||||
public static bool IsEnable => playerIdList.Any();
|
||||
public static bool IsEnable => playerIdList.Count > 0;
|
||||
public static void ApplyGameOptions()
|
||||
{
|
||||
AURoleOptions.ShapeshifterCooldown = ShapeshiftCooldown.GetFloat();
|
||||
|
||||
@@ -39,7 +39,7 @@ namespace TOHE.Roles.Impostor
|
||||
playerIdList.Add(playerId);
|
||||
}
|
||||
|
||||
public static bool IsEnable => playerIdList.Any();
|
||||
public static bool IsEnable => playerIdList.Count > 0;
|
||||
|
||||
public static void SendRPC(byte targetId)
|
||||
{
|
||||
|
||||
@@ -0,0 +1,205 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using static TOHE.Options;
|
||||
using static TOHE.Utils;
|
||||
using static TOHE.Translator;
|
||||
using Hazel;
|
||||
using TOHE.Roles.Crewmate;
|
||||
using Il2CppMono.Security.Authenticode;
|
||||
|
||||
namespace TOHE.Roles.Impostor
|
||||
{
|
||||
public static class Librarian
|
||||
{
|
||||
private static readonly int Id = 643150;
|
||||
private static List<byte> playerIdList = [];
|
||||
private static Dictionary<byte, (bool SILENCING, long LAST_CHANGE)> isInSilencingMode = [];
|
||||
private static List<byte> sssh = [];
|
||||
|
||||
private static OptionItem Radius;
|
||||
private static OptionItem ShowSSAnimation;
|
||||
private static OptionItem NameDuration;
|
||||
private static OptionItem SSCD;
|
||||
private static OptionItem SSDur;
|
||||
private static OptionItem CanKillWhileShifted;
|
||||
|
||||
public static void SetupCustomOption()
|
||||
{
|
||||
SetupRoleOptions(Id, TabGroup.ImpostorRoles, CustomRoles.Librarian);
|
||||
Radius = FloatOptionItem.Create(Id + 5, "LibrarianRadius", new(0.5f, 5f, 0.5f), 2f, TabGroup.ImpostorRoles, false)
|
||||
.SetParent(CustomRoleSpawnChances[CustomRoles.Librarian])
|
||||
.SetValueFormat(OptionFormat.Multiplier);
|
||||
ShowSSAnimation = BooleanOptionItem.Create(Id + 6, "LibrarianShowSSAnimation", false, TabGroup.ImpostorRoles, false)
|
||||
.SetParent(CustomRoleSpawnChances[CustomRoles.Librarian]);
|
||||
SSCD = FloatOptionItem.Create(Id + 7, "ShapeshiftCooldown", new(2.5f, 60f, 2.5f), 30f, TabGroup.ImpostorRoles, false)
|
||||
.SetParent(ShowSSAnimation)
|
||||
.SetValueFormat(OptionFormat.Seconds);
|
||||
SSDur = FloatOptionItem.Create(Id + 8, "ShapeshiftDuration", new(2.5f, 60f, 2.5f), 10f, TabGroup.ImpostorRoles, false)
|
||||
.SetParent(ShowSSAnimation)
|
||||
.SetValueFormat(OptionFormat.Seconds);
|
||||
CanKillWhileShifted = BooleanOptionItem.Create(Id + 9, "CanKillWhileShifted", false, TabGroup.ImpostorRoles, false)
|
||||
.SetParent(ShowSSAnimation);
|
||||
NameDuration = IntegerOptionItem.Create(Id + 10, "LibrarianNameNotifyDuration", new(1, 30, 1), 10, TabGroup.ImpostorRoles, false)
|
||||
.SetParent(CustomRoleSpawnChances[CustomRoles.Librarian])
|
||||
.SetValueFormat(OptionFormat.Seconds);
|
||||
}
|
||||
|
||||
public static void Init()
|
||||
{
|
||||
playerIdList = [];
|
||||
isInSilencingMode = [];
|
||||
sssh = [];
|
||||
}
|
||||
|
||||
public static void Add(byte playerId)
|
||||
{
|
||||
playerIdList.Add(playerId);
|
||||
isInSilencingMode.Add(playerId, (false, GetTimeStamp()));
|
||||
}
|
||||
|
||||
public static bool IsEnable => playerIdList.Count > 0;
|
||||
|
||||
public static bool CanUseKillButton(PlayerControl pc) => !pc.shapeshifting || CanKillWhileShifted.GetBool();
|
||||
|
||||
public static void ApplyGameOptions()
|
||||
{
|
||||
AURoleOptions.ShapeshifterDuration = SSDur.GetFloat();
|
||||
AURoleOptions.ShapeshifterCooldown = SSCD.GetFloat();
|
||||
}
|
||||
|
||||
private static void SendRPC(byte playerId, bool isInSilenceMode)
|
||||
{
|
||||
if (!IsEnable) return;
|
||||
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.SetLibrarianMode, SendOption.Reliable, -1);
|
||||
writer.Write(playerId);
|
||||
writer.Write(isInSilenceMode);
|
||||
AmongUsClient.Instance.FinishRpcImmediately(writer);
|
||||
}
|
||||
|
||||
public static void ReceiveRPC(MessageReader reader)
|
||||
{
|
||||
if (!IsEnable) return;
|
||||
byte playerId = reader.ReadByte();
|
||||
bool isInSilenceMode = reader.ReadBoolean();
|
||||
|
||||
isInSilencingMode[playerId] = (isInSilenceMode, GetTimeStamp());
|
||||
}
|
||||
|
||||
private static void SendRPCSyncList()
|
||||
{
|
||||
if (!IsEnable) return;
|
||||
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.SyncLibrarianList, SendOption.Reliable, -1);
|
||||
writer.Write(sssh.Count);
|
||||
foreach (var item in sssh.ToArray())
|
||||
{
|
||||
writer.Write(item);
|
||||
}
|
||||
AmongUsClient.Instance.FinishRpcImmediately(writer);
|
||||
}
|
||||
|
||||
public static void ReceiveRPCSyncList(MessageReader reader)
|
||||
{
|
||||
if (!IsEnable) return;
|
||||
sssh.Clear();
|
||||
|
||||
int length = reader.ReadInt32();
|
||||
if (length == 0) return;
|
||||
|
||||
for (int i = 0; i < length; i++)
|
||||
{
|
||||
sssh.Add(reader.ReadByte());
|
||||
}
|
||||
}
|
||||
|
||||
public static bool OnAnyoneReport(PlayerControl reporter)
|
||||
{
|
||||
if (!IsEnable) return true;
|
||||
if (reporter == null) return true;
|
||||
|
||||
bool isSilence = false;
|
||||
PlayerControl librarian = null;
|
||||
float silenceRadius = Radius.GetFloat();
|
||||
|
||||
foreach (var id in playerIdList.ToArray())
|
||||
{
|
||||
if (!isInSilencingMode.TryGetValue(id, out var x) || !x.SILENCING) continue;
|
||||
var pc = GetPlayerById(id);
|
||||
if (UnityEngine.Vector2.Distance(pc.GetTruePosition(), reporter.GetTruePosition()) <= silenceRadius)
|
||||
{
|
||||
isSilence = true;
|
||||
librarian = pc;
|
||||
}
|
||||
}
|
||||
|
||||
if (!isSilence || librarian == null) return true;
|
||||
|
||||
if (librarian.RpcCheckAndMurder(reporter))
|
||||
{
|
||||
sssh.Add(librarian.PlayerId);
|
||||
SendRPCSyncList();
|
||||
_ = new LateTask(() =>
|
||||
{
|
||||
sssh.Remove(librarian.PlayerId);
|
||||
SendRPCSyncList();
|
||||
}, NameDuration.GetInt(), "Librarian sssh text");
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static bool OnShapeshift(PlayerControl pc)
|
||||
{
|
||||
if (!IsEnable) return false;
|
||||
if (pc == null) return false;
|
||||
|
||||
byte id = pc.PlayerId;
|
||||
|
||||
isInSilencingMode[id] = (!isInSilencingMode[id].SILENCING, GetTimeStamp());
|
||||
SendRPC(id, isInSilencingMode[id].SILENCING);
|
||||
|
||||
return ShowSSAnimation.GetBool();
|
||||
}
|
||||
|
||||
public static void OnFixedUpdate()
|
||||
{
|
||||
if (!IsEnable) return;
|
||||
if (ShowSSAnimation.GetBool()) return;
|
||||
|
||||
foreach (var kvp in isInSilencingMode.Where(x => x.Value.SILENCING && x.Value.LAST_CHANGE + SSDur.GetInt() < GetTimeStamp()).ToArray())
|
||||
{
|
||||
var id = kvp.Key;
|
||||
isInSilencingMode[id] = (!isInSilencingMode[id].SILENCING, GetTimeStamp());
|
||||
SendRPC(id, isInSilencingMode[id].SILENCING);
|
||||
}
|
||||
}
|
||||
|
||||
public static void OnReportDeadBody()
|
||||
{
|
||||
if (!IsEnable) return;
|
||||
foreach (var id in isInSilencingMode.Keys.ToArray())
|
||||
{
|
||||
isInSilencingMode[id] = (false, GetTimeStamp());
|
||||
}
|
||||
sssh.Clear();
|
||||
}
|
||||
|
||||
public static string GetNameTextForSuffix(byte playerId)
|
||||
{
|
||||
if (!IsEnable) return string.Empty;
|
||||
return isInSilencingMode.TryGetValue(playerId, out var x) && x.SILENCING && sssh.Contains(playerId) && GameStates.IsInTask
|
||||
? GetString("LibrarianNameText")
|
||||
: string.Empty;
|
||||
}
|
||||
|
||||
public static string GetSelfSuffixAndHUDText(byte playerId)
|
||||
{
|
||||
if (!IsEnable || !GameStates.IsInTask) return string.Empty;
|
||||
if (!isInSilencingMode.TryGetValue(playerId, out var x)) return string.Empty;
|
||||
|
||||
return string.Format(GetString("LibrarianModeText"), x.SILENCING ? GetString("LibrarianSilenceMode") : GetString("LibrarianNormalMode"));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -28,7 +28,7 @@ namespace TOHE.Roles.Impostor
|
||||
{
|
||||
playerIdList.Add(playerId);
|
||||
}
|
||||
public static bool IsEnable() => playerIdList.Any();
|
||||
public static bool IsEnable() => playerIdList.Count > 0;
|
||||
|
||||
public static void SetKillCooldown(byte id) => Main.AllPlayerKillCooldown[id] = DefaultKillCooldown.GetFloat();
|
||||
|
||||
|
||||
@@ -201,7 +201,7 @@ namespace TOHE.Roles.Impostor
|
||||
|
||||
return true;
|
||||
}
|
||||
public static bool IsEnable => playerIdList.Any();
|
||||
public static bool IsEnable => playerIdList.Count > 0;
|
||||
public static void OnReportDeadBody()
|
||||
{
|
||||
if (!IsEnable) return;
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
// {
|
||||
// playerIdList.Add(mare);
|
||||
// }
|
||||
// public static bool IsEnable => playerIdList.Any();
|
||||
// public static bool IsEnable => playerIdList.Count > 0;
|
||||
// public static float GetKillCooldown => Utils.IsActive(SystemTypes.Electrical) ? KillCooldownInLightsOut.GetFloat() : KillCooldownNormally.GetFloat();
|
||||
// public static void SetKillCooldown(byte id)
|
||||
// {
|
||||
|
||||
@@ -47,7 +47,7 @@ namespace TOHE.Roles.Impostor
|
||||
ManipulateCD = KillCooldown.GetFloat() + TimeLimit.GetFloat() + Delay.GetFloat();
|
||||
}
|
||||
|
||||
public static bool IsEnable => playerIdList.Any();
|
||||
public static bool IsEnable => playerIdList.Count > 0;
|
||||
|
||||
public static bool OnCheckMurder(PlayerControl killer, PlayerControl target)
|
||||
{
|
||||
|
||||
@@ -47,7 +47,7 @@ public static class Morphling
|
||||
public static void SetKillCooldown(byte id) => Main.AllPlayerKillCooldown[id] = KillCooldown.GetFloat();
|
||||
|
||||
|
||||
public static bool IsEnable => playerIdList.Any();
|
||||
public static bool IsEnable => playerIdList.Count > 0;
|
||||
|
||||
|
||||
}
|
||||
@@ -40,7 +40,7 @@ namespace TOHE.Roles.Impostor
|
||||
|
||||
public static void SetKillCooldown(byte id) => Main.AllPlayerKillCooldown[id] = KCD.GetFloat();
|
||||
|
||||
public static bool IsEnable => playerIdList.Any();
|
||||
public static bool IsEnable => playerIdList.Count > 0;
|
||||
|
||||
public static bool OnCheckMurder(PlayerControl killer, PlayerControl target)
|
||||
{
|
||||
|
||||
@@ -46,7 +46,7 @@ namespace TOHE.Roles.Impostor
|
||||
AbductTimer = 255f;
|
||||
stopCount = false;
|
||||
}
|
||||
public static bool IsEnable => playerIdList.Any();
|
||||
public static bool IsEnable => playerIdList.Count > 0;
|
||||
public static void SetKillCooldown(byte id) => Main.AllPlayerKillCooldown[id] = Options.DefaultKillCooldown;
|
||||
public static void ApplyGameOptions(IGameOptions opt) => AURoleOptions.ShapeshifterCooldown = AbductVictim != null ? AbductTimer : AbductTimerLimit;
|
||||
private static void SendRPC()
|
||||
|
||||
@@ -36,7 +36,7 @@ internal static class QuickShooter
|
||||
playerIdList.Add(playerId);
|
||||
ShotLimit.TryAdd(playerId, 0);
|
||||
}
|
||||
public static bool IsEnable => playerIdList.Any();
|
||||
public static bool IsEnable => playerIdList.Count > 0;
|
||||
private static void SendRPC(byte playerId)
|
||||
{
|
||||
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.SetQuickShooterShotLimit, SendOption.Reliable, -1);
|
||||
|
||||
@@ -41,7 +41,7 @@ namespace TOHE.Roles.Impostor
|
||||
LastTP = GetTimeStamp();
|
||||
}
|
||||
|
||||
public static bool IsEnable => playerIdList.Any();
|
||||
public static bool IsEnable => playerIdList.Count > 0;
|
||||
|
||||
public static void OnFixedUpdate(PlayerControl player)
|
||||
{
|
||||
|
||||
@@ -40,7 +40,7 @@ public static class Sans
|
||||
playerIdList.Add(playerId);
|
||||
NowCooldown.TryAdd(playerId, DefaultKillCooldown.GetFloat());
|
||||
}
|
||||
public static bool IsEnable() => playerIdList.Any();
|
||||
public static bool IsEnable() => playerIdList.Count > 0;
|
||||
public static void SetKillCooldown(byte id) => Main.AllPlayerKillCooldown[id] = NowCooldown[id];
|
||||
public static void OnCheckMurder(PlayerControl killer)
|
||||
{
|
||||
|
||||
@@ -49,7 +49,7 @@ namespace TOHE.Roles.Impostor
|
||||
AURoleOptions.ShapeshifterDuration = 1f;
|
||||
}
|
||||
|
||||
public static bool IsEnable => playerIdList.Any();
|
||||
public static bool IsEnable => playerIdList.Count > 0;
|
||||
|
||||
public static void OnShapeshift(PlayerControl pc, bool isPet = false)
|
||||
{
|
||||
|
||||
@@ -37,7 +37,7 @@ public static class SerialKiller
|
||||
playerIdList.Add(serial);
|
||||
Timer.Add(serial, TimeLimit.GetInt());
|
||||
}
|
||||
public static bool IsEnable() => playerIdList.Any();
|
||||
public static bool IsEnable() => playerIdList.Count > 0;
|
||||
public static void ApplyKillCooldown(byte id) => Main.AllPlayerKillCooldown[id] = KillCooldown.GetFloat();
|
||||
//public static void ApplyGameOptions(PlayerControl pc)
|
||||
//{
|
||||
|
||||
@@ -41,7 +41,7 @@ namespace TOHE.Roles.Impostor
|
||||
|
||||
playerIdList.Add(playerId);
|
||||
}
|
||||
public static bool IsEnable => playerIdList.Any();
|
||||
public static bool IsEnable => playerIdList.Count > 0;
|
||||
public static void SetKillCooldown(byte id) => Main.AllPlayerKillCooldown[id] = Options.DefaultKillCooldown;
|
||||
public static void OnCheckMurder(PlayerControl killer, PlayerControl target)
|
||||
{
|
||||
|
||||
@@ -54,7 +54,7 @@ public static class Swooper
|
||||
playerIdList.Add(playerId);
|
||||
SwoopLimit.Add(playerId, SwooperLimitOpt.GetInt());
|
||||
}
|
||||
public static bool IsEnable => playerIdList.Any();
|
||||
public static bool IsEnable => playerIdList.Count > 0;
|
||||
private static void SendRPC(PlayerControl pc)
|
||||
{
|
||||
if (pc.AmOwner) return;
|
||||
|
||||
@@ -30,7 +30,7 @@ public static class TimeThief
|
||||
{
|
||||
playerIdList.Add(playerId);
|
||||
}
|
||||
public static bool IsEnable => playerIdList.Any();
|
||||
public static bool IsEnable => playerIdList.Count > 0;
|
||||
public static void SetKillCooldown(byte id) => Main.AllPlayerKillCooldown[id] = KillCooldown.GetFloat();
|
||||
private static int StolenTime(byte id)
|
||||
{
|
||||
|
||||
@@ -37,7 +37,7 @@ internal static class Undertaker
|
||||
{
|
||||
playerIdList.Add(playerId);
|
||||
}
|
||||
public static bool IsEnable => playerIdList.Any();
|
||||
public static bool IsEnable => playerIdList.Count > 0;
|
||||
private static void SendRPC(byte playerId)
|
||||
{
|
||||
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.SetMarkedPlayerV2, SendOption.Reliable, -1);
|
||||
|
||||
@@ -44,7 +44,7 @@ public static class Wildling
|
||||
|
||||
|
||||
}
|
||||
public static bool IsEnable => playerIdList.Any();
|
||||
public static bool IsEnable => playerIdList.Count > 0;
|
||||
private static void SendRPC(byte playerId)
|
||||
{
|
||||
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.SetBKTimer, SendOption.Reliable, -1);
|
||||
|
||||
@@ -53,7 +53,7 @@ public static class Witch
|
||||
pc.AddDoubleTrigger();
|
||||
|
||||
}
|
||||
public static bool IsEnable => playerIdList.Any();
|
||||
public static bool IsEnable => playerIdList.Count > 0;
|
||||
private static void SendRPC(bool doSpell, byte witchId, byte target = 255)
|
||||
{
|
||||
if (doSpell)
|
||||
|
||||
@@ -38,7 +38,7 @@ namespace TOHE.Roles.Impostor
|
||||
playerIdList.Add(playerId);
|
||||
}
|
||||
|
||||
public static bool IsEnable => playerIdList.Any();
|
||||
public static bool IsEnable => playerIdList.Count > 0;
|
||||
|
||||
public static void SetKillCooldown(byte playerId)
|
||||
{
|
||||
|
||||
@@ -49,7 +49,7 @@ public static class Amnesiac
|
||||
if (!Main.ResetCamPlayerList.Contains(playerId))
|
||||
Main.ResetCamPlayerList.Add(playerId);
|
||||
}
|
||||
public static bool IsEnable => playerIdList.Any();
|
||||
public static bool IsEnable => playerIdList.Count > 0;
|
||||
|
||||
private static void SendRPC()
|
||||
{
|
||||
|
||||
@@ -43,7 +43,7 @@ public static class BloodKnight
|
||||
if (!Main.ResetCamPlayerList.Contains(playerId))
|
||||
Main.ResetCamPlayerList.Add(playerId);
|
||||
}
|
||||
public static bool IsEnable => playerIdList.Any();
|
||||
public static bool IsEnable => playerIdList.Count > 0;
|
||||
private static void SendRPC(byte playerId)
|
||||
{
|
||||
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.SetBKTimer, SendOption.Reliable, -1);
|
||||
|
||||
@@ -29,7 +29,7 @@ public static class Collector
|
||||
playerIdList.Add(playerId);
|
||||
CollectVote.TryAdd(playerId, 0);
|
||||
}
|
||||
public static bool IsEnable => playerIdList.Any();
|
||||
public static bool IsEnable => playerIdList.Count > 0;
|
||||
private static void SendRPC(byte playerId)
|
||||
{
|
||||
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.SetCollectorVotes, SendOption.Reliable, -1);
|
||||
|
||||
@@ -47,7 +47,7 @@ public static class CursedSoul
|
||||
if (!Main.ResetCamPlayerList.Contains(playerId))
|
||||
Main.ResetCamPlayerList.Add(playerId);
|
||||
}
|
||||
public static bool IsEnable => playerIdList.Any();
|
||||
public static bool IsEnable => playerIdList.Count > 0;
|
||||
|
||||
private static void SendRPC()
|
||||
{
|
||||
|
||||
@@ -50,7 +50,7 @@ public static class DarkHide
|
||||
if (!Main.ResetCamPlayerList.Contains(playerId))
|
||||
Main.ResetCamPlayerList.Add(playerId);
|
||||
}
|
||||
public static bool IsEnable => playerIdList.Any();
|
||||
public static bool IsEnable => playerIdList.Count > 0;
|
||||
|
||||
public static void ReceiveRPC(MessageReader msg)
|
||||
{
|
||||
|
||||
@@ -72,7 +72,7 @@ public static class Doomsayer
|
||||
playerIdList.Add(playerId);
|
||||
GuessingToWin.TryAdd(playerId, GuessesCount);
|
||||
}
|
||||
public static bool IsEnable => playerIdList.Any();
|
||||
public static bool IsEnable => playerIdList.Count > 0;
|
||||
public static void SendRPC(PlayerControl player)
|
||||
{
|
||||
MessageWriter writer;
|
||||
|
||||
@@ -49,7 +49,7 @@ public static class Eclipse
|
||||
if (!Main.ResetCamPlayerList.Contains(playerId))
|
||||
Main.ResetCamPlayerList.Add(playerId);
|
||||
}
|
||||
public static bool IsEnable => playerIdList.Any();
|
||||
public static bool IsEnable => playerIdList.Count > 0;
|
||||
public static void SendRPC(float vision)
|
||||
{
|
||||
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.SetEclipseVision, SendOption.Reliable, -1);
|
||||
|
||||
@@ -95,7 +95,7 @@ public static class Executioner
|
||||
Logger.Info($"{Utils.GetPlayerById(playerId)?.GetNameWithRole().RemoveHtmlTags()}:{SelectedTarget.GetNameWithRole().RemoveHtmlTags()}", "Executioner");
|
||||
}
|
||||
}
|
||||
public static bool IsEnable() => playerIdList.Any();
|
||||
public static bool IsEnable() => playerIdList.Count > 0;
|
||||
public static void SendRPC(byte executionerId, byte targetId = 0x73, string Progress = "")
|
||||
{
|
||||
MessageWriter writer;
|
||||
|
||||
Loaded 100 of 139 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user