Don't send unnecessary RPCs

This commit is contained in:
Gurge44 committed 2023-12-02 16:06:02 +01:00
1 parent bfa7d2f760
commit bd22791ddc
109 files changed
+207 -199

No files matched your search

+12 -14
View File
@@ -16,7 +16,7 @@ internal static class FFAManager
public static Dictionary<byte, long> FFALowerVisionList = [];
private static Dictionary<byte, float> originalSpeed = [];
public static Dictionary<byte, int> KBScore = [];
public static Dictionary<byte, int> KillCount = [];
public static int RoundTime;
//Options
@@ -90,12 +90,12 @@ internal static class FFAManager
FFAShieldedList = [];
originalSpeed = [];
KBScore = [];
KillCount = [];
RoundTime = FFA_GameTime.GetInt() + 8;
foreach (PlayerControl pc in Main.AllAlivePlayerControls)
{
KBScore.TryAdd(pc.PlayerId, 0);
KillCount.TryAdd(pc.PlayerId, 0);
}
_ = new LateTask(Utils.SetChatVisible, 7f, "Set Chat Visible for Everyone");
@@ -104,13 +104,13 @@ internal static class FFAManager
{
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.SyncFFAPlayer, SendOption.Reliable, -1);
writer.Write(playerId);
writer.Write(KBScore[playerId]);
writer.Write(KillCount[playerId]);
AmongUsClient.Instance.FinishRpcImmediately(writer);
}
public static void ReceiveRPCSyncFFAPlayer(MessageReader reader)
{
byte PlayerId = reader.ReadByte();
KBScore[PlayerId] = reader.ReadInt32();
KillCount[PlayerId] = reader.ReadInt32();
}
public static void SendRPCSyncNameNotify(PlayerControl pc)
{
@@ -141,7 +141,7 @@ internal static class FFAManager
public static string GetDisplayScore(byte playerId)
{
int rank = GetRankOfScore(playerId);
string score = KBScore.TryGetValue(playerId, out var s) ? $"{s}" : "Invalid";
string score = KillCount.TryGetValue(playerId, out var s) ? $"{s}" : "Invalid";
string text = string.Format(GetString("KBDisplayScore"), rank.ToString(), score);
Color color = Utils.GetRoleColor(CustomRoles.Killer);
return Utils.ColorString(color, text);
@@ -150,9 +150,9 @@ internal static class FFAManager
{
try
{
int ms = KBScore[playerId];
int rank = 1 + KBScore.Values.Where(x => x > ms).Count();
rank += KBScore.Where(x => x.Value == ms).ToList().IndexOf(new(playerId, ms));
int ms = KillCount[playerId];
int rank = 1 + KillCount.Values.Where(x => x > ms).Count();
rank += KillCount.Where(x => x.Value == ms).ToList().IndexOf(new(playerId, ms));
return rank;
}
catch
@@ -235,7 +235,7 @@ internal static class FFAManager
}
killer.Notify(GetString("FFA-Event-GetIncreasedSpeed"), FFA_ModifiedSpeedDuration.GetFloat());
Main.AllPlayerKillCooldown[killer.PlayerId] = FFA_KCD.GetFloat();
sync = true;
mark = true;
break;
case 2:
Main.AllPlayerKillCooldown[killer.PlayerId] = System.Math.Clamp(FFA_KCD.GetFloat() - 3f, 1f, 60f);
@@ -244,7 +244,6 @@ internal static class FFAManager
break;
default:
Main.AllPlayerKillCooldown[killer.PlayerId] = FFA_KCD.GetFloat();
sync = true;
break;
}
}
@@ -268,7 +267,7 @@ internal static class FFAManager
}
killer.Notify(GetString("FFA-Event-GetDecreasedSpeed"), FFA_ModifiedSpeedDuration.GetFloat());
Main.AllPlayerKillCooldown[killer.PlayerId] = FFA_KCD.GetFloat();
sync = true;
mark = true;
break;
case 1:
Main.AllPlayerKillCooldown[killer.PlayerId] = System.Math.Clamp(FFA_KCD.GetFloat() + 3f, 1f, 60f);
@@ -283,7 +282,6 @@ internal static class FFAManager
break;
default:
Main.AllPlayerKillCooldown[killer.PlayerId] = FFA_KCD.GetFloat();
sync = true;
break;
}
}
@@ -313,7 +311,7 @@ internal static class FFAManager
if (PlayerControl.LocalPlayer.Is(CustomRoles.GM))
PlayerControl.LocalPlayer.KillFlash();
KBScore[killer.PlayerId]++;
KillCount[killer.PlayerId]++;
}
public static string GetPlayerArrow(PlayerControl seer, PlayerControl target = null)
+8 -6
View File
@@ -304,22 +304,22 @@ static class ExtendedPlayerControl
}
else if (PlayerControl.LocalPlayer == target)
{
//targetがホストだった場合
// If target is host
PlayerControl.LocalPlayer.Data.Role.SetCooldown();
}
else
{
//targetがホスト以外だった場合
// If target is not host
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(target.NetId, (byte)RpcCalls.ProtectPlayer, SendOption.None, target.GetClientId());
writer.WriteNetObject(target);
writer.Write(0);
AmongUsClient.Instance.FinishRpcImmediately(writer);
}
/*
プレイヤーがバリアを張ったとき、そのプレイヤーの役職に関わらずアビリティーのクールダウンがリセットされます。
ログの追加により無にバリアを張ることができなくなったため、代わりに自身に0秒バリアを張るように変更しました。
この変更により、役職としての守護天使が無効化されます。
ホストのクールダウンは直接リセットします。
When a player guards someone, ability cooldowns are reset regardless of that player's role.
Due to the addition of logs, it is no longer possible to guard no one, so it has been changed to the player guarding themselves for 0 seconds instead.
This change disables Guardian Angel as a position.
Reset host cooldown directly.
*/
}
public static void RpcDesyncRepairSystem(this PlayerControl target, SystemTypes systemType, int amount)
@@ -366,6 +366,8 @@ static class ExtendedPlayerControl
return GameOptionsData.FromBytes(optByte);
}*/
public static bool IsNonHostModClient(this PlayerControl pc) => pc.IsModClient() && pc.PlayerId != 0;
public static string GetDisplayRoleName(this PlayerControl player, bool pure = false)
{
return Utils.GetDisplayRoleName(player.PlayerId, pure);
+1 -1
View File
@@ -498,7 +498,7 @@ public class TaskState
Main.AllPlayerSpeed[player.PlayerId] = Options.ExpressSpeed.GetFloat();
Main.ExpressSpeedUp.Remove(player.PlayerId);
Main.ExpressSpeedUp.TryAdd(player.PlayerId, Utils.GetTimeStamp());
player.SyncSettings();
player.MarkDirtySettings();
break;
case CustomRoles.Alchemist:
Alchemist.OnTaskComplete(player);
+3 -2
View File
@@ -195,6 +195,7 @@ public static class Utils
return false;
}
}
public static bool DoRPC => AmongUsClient.Instance.AmHost && Main.AllPlayerControls.Any(x => x.IsModClient() && x.PlayerId != 0);
public static void SetVision(this IGameOptions opt, bool HasImpVision)
{
if (HasImpVision)
@@ -302,7 +303,7 @@ public static class Utils
var Duration = Options.KillFlashDuration.GetFloat();
if (ReactorCheck) Duration += 0.2f; // Extend blackout during reactor
//実行
// Execution
Main.PlayerStates[player.PlayerId].IsBlackOut = true; // Blackout
if (player.AmOwner)
{
@@ -314,7 +315,7 @@ public static class Utils
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.KillFlash, SendOption.Reliable, player.GetClientId());
AmongUsClient.Instance.FinishRpcImmediately(writer);
}
else if (!ReactorCheck) player.ReactorFlash(0f); // reactor flash
else if (!ReactorCheck) player.ReactorFlash(0f); // Reactor flash
player.MarkDirtySettings();
_ = new LateTask(() =>
{
+1 -1
View File
@@ -32,7 +32,7 @@ class LogicOptionsSerializePatch
{
public static bool Prefix(LogicOptions __instance, ref bool __result, MessageWriter writer, bool initialState)
{
// 初回以外はブロックし、CustomSyncSettingsでのみ同期する
// Block all but the first time and synchronize only with CustomSyncSettings
if (!initialState)
{
__result = false;
+2 -2
View File
@@ -17,7 +17,7 @@ public class FallFromLadder
if (!Options.LadderDeath.GetBool()) return;
var sourcePos = source.transform.position;
var targetPos = source.Destination.transform.position;
//降りているのかを検知
if (sourcePos.y > targetPos.y)
{
int chance = IRandom.Instance.Next(1, 101);
@@ -33,7 +33,7 @@ public class FallFromLadder
if (TargetLadderData.ContainsKey(player.PlayerId) && Vector2.Distance(TargetLadderData[player.PlayerId], player.transform.position) < 0.5f)
{
if (player.Data.IsDead) return;
//LateTaskを入れるため、先に死亡判定を入れておく
// In order to insert LateTask, first enter the death judgment.
player.Data.IsDead = true;
_ = new LateTask(() =>
{
+2 -2
View File
@@ -2264,7 +2264,7 @@ class FixedUpdatePatch
{
player.RpcResetAbilityCooldown();
Main.isCursed = false;//変身クールを1秒に変更
player.SyncSettings();
player.MarkDirtySettings();
Main.WarlockTimer.Remove(player.PlayerId);
}
else Main.WarlockTimer[player.PlayerId] = Main.WarlockTimer[player.PlayerId] + Time.fixedDeltaTime;//時間をカウント
@@ -2440,7 +2440,7 @@ class FixedUpdatePatch
{
Main.ExpressSpeedUp.Remove(player.PlayerId);
Main.AllPlayerSpeed[player.PlayerId] = Main.ExpressSpeedNormal;
player.SyncSettings();
player.MarkDirtySettings();
}
break;
+4
View File
@@ -235,6 +235,7 @@ internal class ChangeRoleSettings
Gaulois.Init();
Analyzer.Init();
Escort.Init();
Marshall.Init();
Consort.Init();
Drainer.Init();
Pursuer.Init();
@@ -684,6 +685,9 @@ internal class SelectRolesPatch
case CustomRoles.Escort:
Escort.Add(pc.PlayerId);
break;
case CustomRoles.Marshall:
Marshall.Add(pc.PlayerId);
break;
case CustomRoles.Consort:
Consort.Add(pc.PlayerId);
break;
+1
View File
@@ -41,6 +41,7 @@ public static class Admirer
public static void SendRPC()
{
if (!IsEnable || !Utils.DoRPC) return;
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.SetAdmireLimit, SendOption.Reliable, -1);
writer.Write(AdmireLimit);
AmongUsClient.Instance.FinishRpcImmediately(writer);
+2 -1
View File
@@ -72,6 +72,7 @@ namespace TOHE.Roles.Crewmate
public static void SendRPCData(bool isProtected, byte potionId, string playerName, bool visionPotionActive, bool fixNextSabo)
{
if (!IsEnable || !Utils.DoRPC) return;
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.SetAlchemistPotion, SendOption.Reliable, -1);
writer.Write(isProtected);
writer.Write(potionId);
@@ -207,7 +208,7 @@ namespace TOHE.Roles.Crewmate
public static bool IsInvis(byte id) => InvisTime.ContainsKey(id);
private static void SendRPC(PlayerControl pc)
{
if (pc.AmOwner) return;
if (!IsEnable || !Utils.DoRPC || pc.AmOwner) return;
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.SetAlchemistTimer, SendOption.Reliable, pc.GetClientId());
writer.Write((InvisTime.TryGetValue(pc.PlayerId, out var x) ? x : -1).ToString());
AmongUsClient.Instance.FinishRpcImmediately(writer);
+1 -1
View File
@@ -90,7 +90,7 @@ namespace TOHE.Roles.Crewmate
private static void SendRPCSyncTarget()
{
if (!IsEnable) return;
if (!IsEnable || !Utils.DoRPC) return;
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.SyncAnalyzerTarget, SendOption.Reliable, -1);
writer.Write(CurrentTarget.ID);
writer.Write(CurrentTarget.TIME);
+1 -1
View File
@@ -48,7 +48,7 @@ namespace TOHE.Roles.Crewmate
}
private static void SendRPC(byte benefactorID, int taskIndex = -1, bool IsShield = false, bool clearAll = false, bool shieldExpire = false, byte shieldedId = byte.MaxValue)
{
if (!IsEnable) return;
if (!IsEnable || !Utils.DoRPC) return;
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.SyncBenefactorMarkedTask, SendOption.Reliable, -1);
writer.Write(benefactorID);
writer.Write(taskIndex);
+2
View File
@@ -52,6 +52,7 @@
private static void SendRPC(byte playerId, bool add, Vector3 loc = new())
{
if (!IsEnable || !Utils.DoRPC) return;
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.SetBloodhoundArrow, SendOption.Reliable, -1);
writer.Write(playerId);
writer.Write(add);
@@ -76,6 +77,7 @@
public static void SendRPCPlus(byte playerId)
{
if (!IsEnable || !Utils.DoRPC) return;
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.BloodhoundIncreaseAbilityUseByOne, SendOption.Reliable, -1);
writer.Write(playerId);
writer.Write(UseLimit[playerId]);
+1
View File
@@ -43,6 +43,7 @@ namespace TOHE.Roles.Crewmate
public static bool IsEnable => playerIdList.Count > 0;
public static void SendRPC(byte playerId)
{
if (!IsEnable || !Utils.DoRPC) return;
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.SetCameraManLimit, SendOption.Reliable, -1);
writer.Write(playerId);
writer.Write(UseLimit[playerId]);
+2 -2
View File
@@ -77,7 +77,7 @@
public static void OnTasksFinished(PlayerControl pc)
{
active = false;
pc.SyncSettings();
pc.MarkDirtySettings();
}
public static void OnFixedUpdate(PlayerControl player)
{
@@ -91,7 +91,7 @@
{
ElapsedTime -= Time.fixedDeltaTime;
if (UpdateTime == 1.0f) player.SyncSettings();
if (UpdateTime == 1.0f) player.MarkDirtySettings();
}
}
}
+2 -1
View File
@@ -52,7 +52,7 @@ public static class Chameleon
public static bool IsEnable => playerIdList.Count > 0;
private static void SendRPC(PlayerControl pc)
{
if (pc.AmOwner) return;
if (!IsEnable || !Utils.DoRPC || pc.AmOwner) return;
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.SetChameleonTimer, SendOption.Reliable, pc.GetClientId());
writer.Write((InvisTime.TryGetValue(pc.PlayerId, out var x) ? x : -1).ToString());
writer.Write((lastTime.TryGetValue(pc.PlayerId, out var y) ? y : -1).ToString());
@@ -69,6 +69,7 @@ public static class Chameleon
}
public static void SendRPCPlus(byte playerId)
{
if (!IsEnable || !Utils.DoRPC) return;
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.SetChameleonLimit, SendOption.Reliable, -1);
writer.Write(playerId);
writer.Write(UseLimit[playerId]);
+1
View File
@@ -57,6 +57,7 @@ public static class Cleanser
}
public static void SendRPC(byte playerId)
{
if (!IsEnable || !Utils.DoRPC) return;
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.SetCleanserCleanLimit, SendOption.Reliable, -1);
writer.Write(playerId);
writer.Write(CleanserUses[playerId]);
+1
View File
@@ -50,6 +50,7 @@ public static class CopyCat
private static void SendRPC(byte playerId)
{
if (!IsEnable || !Utils.DoRPC) return;
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.SetCopyCatMiscopyLimit, SendOption.Reliable, -1);
writer.Write(playerId);
writer.Write(MiscopyLimit[playerId]);
+9 -9
View File
@@ -49,15 +49,15 @@ public static class Crusader
Main.ResetCamPlayerList.Remove(playerId);
}
public static bool IsEnable => playerIdList.Count > 0;
public static void ReceiveRPC(MessageReader reader)
{
byte PlayerId = reader.ReadByte();
int Limit = reader.ReadInt32();
if (CrusaderLimit.ContainsKey(PlayerId))
CrusaderLimit[PlayerId] = Limit;
else
CrusaderLimit.Add(PlayerId, SkillLimitOpt.GetInt());
}
//public static void ReceiveRPC(MessageReader reader)
//{
// byte PlayerId = reader.ReadByte();
// int Limit = reader.ReadInt32();
// if (CrusaderLimit.ContainsKey(PlayerId))
// CrusaderLimit[PlayerId] = Limit;
// else
// CrusaderLimit.Add(PlayerId, SkillLimitOpt.GetInt());
//}
public static bool CanUseKillButton(byte playerId)
=> !Main.PlayerStates[playerId].IsDead
&& (CrusaderLimit.TryGetValue(playerId, out var x) ? x : 1) >= 1;
+1
View File
@@ -49,6 +49,7 @@ public static class Deputy
public static void SendRPC()
{
if (!IsEnable || !Utils.DoRPC) return;
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.SetDeputyHandcuffLimit, SendOption.Reliable, -1);
writer.Write(HandcuffLimit);
AmongUsClient.Instance.FinishRpcImmediately(writer);
+1
View File
@@ -45,6 +45,7 @@ public static class Divinator
public static bool IsEnable => playerIdList.Count > 0;
public static void SendRPC(byte playerId)
{
if (!IsEnable || !Utils.DoRPC) return;
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.SetDivinatorLimit, SendOption.Reliable, -1);
writer.Write(playerId);
writer.Write(CheckLimit[playerId]);
+1 -1
View File
@@ -45,7 +45,7 @@ namespace TOHE.Roles.Crewmate
public static bool IsEnable => playerIdList.Count > 0;
public static void SendRPC()
{
if (!IsEnable) return;
if (!IsEnable || !Utils.DoRPC) return;
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.SetDonutLimit, SendOption.Reliable, -1);
writer.Write(DeliverLimit);
AmongUsClient.Instance.FinishRpcImmediately(writer);
+1
View File
@@ -44,6 +44,7 @@ namespace TOHE.Roles.Crewmate
public static bool IsEnable => playerIdList.Count > 0;
public static void SendRPC(byte playerId)
{
if (!IsEnable || !Utils.DoRPC) return;
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.SetDoormasterLimit, SendOption.Reliable, -1);
writer.Write(playerId);
writer.Write(UseLimit[playerId]);
+1 -1
View File
@@ -55,7 +55,7 @@ namespace TOHE.Roles.Crewmate
public static void SendRPC()
{
if (!IsEnable) return;
if (!IsEnable || !Utils.DoRPC) return;
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.SetDrainerLimit, SendOption.Reliable, -1);
writer.Write(DrainLimit);
AmongUsClient.Instance.FinishRpcImmediately(writer);
+5 -5
View File
@@ -60,7 +60,7 @@ namespace TOHE.Roles.Crewmate
public static void SendRPCSyncAbilityUse(byte playerId)
{
if (!IsEnable) return;
if (!IsEnable || !Utils.DoRPC) return;
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.SetDruidLimit, SendOption.Reliable, -1);
writer.Write(playerId);
writer.Write(UseLimit[playerId]);
@@ -74,7 +74,7 @@ namespace TOHE.Roles.Crewmate
}
public static void SendRPCAddTriggerDelay(byte playerId, long timestamp)
{
if (!IsEnable) return;
if (!IsEnable || !Utils.DoRPC) return;
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.DruidAddTriggerDelay, SendOption.Reliable, -1);
writer.Write(playerId);
writer.Write(timestamp);
@@ -91,7 +91,7 @@ namespace TOHE.Roles.Crewmate
}
public static void SendRPCAddTrigger(byte playerId, Vector2 position, string roomName)
{
if (!IsEnable) return;
if (!IsEnable || !Utils.DoRPC) return;
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.DruidAddTriggerDelay, SendOption.Reliable, -1);
writer.Write(playerId);
writer.Write(position.x);
@@ -114,7 +114,7 @@ namespace TOHE.Roles.Crewmate
}
public static void SendRPCRemoveTrigger(byte playerId, Vector2 position)
{
if (!IsEnable) return;
if (!IsEnable || !Utils.DoRPC) return;
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.DruidAddTriggerDelay, SendOption.Reliable, -1);
writer.Write(playerId);
writer.Write(position.x);
@@ -133,7 +133,7 @@ namespace TOHE.Roles.Crewmate
}
public static void SendRPCSyncLastUpdate()
{
if (!IsEnable) return;
if (!IsEnable || !Utils.DoRPC) return;
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.DruidAddTriggerDelay, SendOption.Reliable, -1);
writer.Write(lastUpdate);
AmongUsClient.Instance.FinishRpcImmediately(writer);
+2 -2
View File
@@ -331,9 +331,9 @@ namespace TOHE.Roles.Crewmate
if (showStageClue) return GetStage3Clue(length);
if (rd.Next(0, 100) < EnigmaClueStage2Probability.GetInt()) return GetStage2Clue(length);
return GetStage1Clue(length);
default:
return null;
}
return null;
}
private string GetStage1Clue(int length)
+1 -1
View File
@@ -47,7 +47,7 @@ namespace TOHE.Roles.Crewmate
public static bool IsEnable => playerIdList.Count > 0;
public static void SendRPC()
{
if (!IsEnable) return;
if (!IsEnable || !Utils.DoRPC) return;
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.SetEscortLimit, SendOption.Reliable, -1);
writer.Write(BlockLimit);
AmongUsClient.Instance.FinishRpcImmediately(writer);
+1 -1
View File
@@ -48,7 +48,7 @@ namespace TOHE.Roles.Crewmate
public static void SendRPC(byte playerId)
{
if (!IsEnable) return;
if (!IsEnable || !Utils.DoRPC) return;
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.SetGauloisLimit, SendOption.Reliable, -1);
writer.Write(playerId);
writer.Write(UseLimit[playerId]);
+1
View File
@@ -53,6 +53,7 @@ public static class Jailor
public static void SendRPC(byte jailerId, byte targetId = byte.MaxValue, bool setTarget = true)
{
if (!IsEnable || !Utils.DoRPC) return;
MessageWriter writer;
if (!setTarget)
{
+1
View File
@@ -227,6 +227,7 @@ public static class Judge
private static void SendRPC(byte playerId)
{
if (!IsEnable || !Utils.DoRPC) return;
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.Judge, SendOption.Reliable, -1);
writer.Write(playerId);
AmongUsClient.Instance.FinishRpcImmediately(writer);
-37
View File
@@ -72,43 +72,6 @@ public static class Marshall
NameNotifyManager.Notify(marshall, Translator.GetString("MarshallDoneTasks"));
IsComplete[marshallId] = true;
}
/// <summary>
/// タスクが進んだスニッチに警告マーク
/// </summary>
/// <param name="seer">キラーの場合有効</param>
/// <param name="target">スニッチの場合有効</param>
/// <returns></returns>
public static string GetWarningMark(PlayerControl seer, PlayerControl target)
=> IsMarshallTarget(seer) && GetExpose(target) ? Utils.ColorString(RoleColor, "★") : string.Empty;
/// <summary>
/// キラーからスニッチに対する矢印
/// </summary>
/// <param name="seer">キラーの場合有効</param>
/// <param name="target">キラーの場合有効</param>
/// <returns></returns>
public static string GetWarningArrow(PlayerControl seer, PlayerControl target = null)
{
if (GameStates.IsMeeting || !IsMarshallTarget(seer)) return string.Empty;
if (target != null && seer.PlayerId != target.PlayerId) return string.Empty;
if (!playerIdList.Any(s => !Main.PlayerStates[s].IsDead && IsExposed[s])) return string.Empty;
var warning = "★";
return Utils.ColorString(RoleColor, warning);
}
/// <summary>
/// スニッチからキラーへの矢印
/// </summary>
/// <param name="seer">スニッチの場合有効</param>
/// <param name="target">スニッチの場合有効</param>
/// <returns></returns>
public static void OnCompleteTask(PlayerControl player)
{
if (!IsThisRole(player.PlayerId) /*|| player.Is(CustomRoles.Madmate)*/) return;
CheckTask(player);
}
}
+2
View File
@@ -85,6 +85,7 @@ public static class Medic
public static bool IsEnable => playerIdList.Count > 0;
private static void SendRPC(byte playerId)
{
if (!IsEnable || !Utils.DoRPC) return;
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.SetMedicalerProtectLimit, SendOption.Reliable, -1);
writer.Write(playerId);
writer.Write(ProtectLimit[playerId]);
@@ -101,6 +102,7 @@ public static class Medic
}
private static void SendRPCForProtectList()
{
if (!IsEnable || !Utils.DoRPC) return;
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.SetMedicalerProtectList, SendOption.Reliable, -1);
writer.Write(ProtectList.Count);
foreach (byte x in ProtectList.ToArray())
+1
View File
@@ -41,6 +41,7 @@ public static class Mediumshiper
public static bool IsEnable => playerIdList.Count > 0;
public static void SendRPC(byte playerId)
{
if (!IsEnable || !Utils.DoRPC) return;
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.SetMediumshiperLimit, SendOption.Reliable, -1);
writer.Write(playerId);
writer.Write(ContactLimit[playerId]);
+6 -29
View File
@@ -112,35 +112,12 @@ namespace TOHE.Roles.Crewmate
addonsSold = [];
bribedKiller = [];
if (OptionCanSellHelpful.GetBool())
{
addons.AddRange(helpfulAddons);
}
if (OptionCanSellBalanced.GetBool())
{
addons.AddRange(balancedAddons);
}
if (OptionCanSellHarmful.GetBool())
{
addons.AddRange(harmfulAddons);
}
if (OptionCanSellNeutral.GetBool())
{
addons.AddRange(neutralAddons);
}
if (OptionCanSellExperimental.GetBool())
{
addons.AddRange(experimentalAddons);
}
if (OptionSellOnlyEnabledAddons.GetBool())
{
addons = addons.Where(role => role.GetMode() != 0).ToList();
}
if (OptionCanSellHelpful.GetBool()) addons.AddRange(helpfulAddons);
if (OptionCanSellBalanced.GetBool()) addons.AddRange(balancedAddons);
if (OptionCanSellHarmful.GetBool()) addons.AddRange(harmfulAddons);
if (OptionCanSellNeutral.GetBool()) addons.AddRange(neutralAddons);
if (OptionCanSellExperimental.GetBool()) addons.AddRange(experimentalAddons);
if (OptionSellOnlyEnabledAddons.GetBool()) addons = addons.Where(role => role.GetMode() != 0).ToList();
}
public static void Add(byte playerId)
+1
View File
@@ -44,6 +44,7 @@ public static class Monarch
public static void SendRPC()
{
if (!IsEnable || !Utils.DoRPC) return;
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.SetMonarchKnightLimit, SendOption.Reliable, -1);
writer.Write(KnightLimit);
AmongUsClient.Instance.FinishRpcImmediately(writer);
+1
View File
@@ -33,6 +33,7 @@ public static class Mortician
public static bool IsEnable => playerIdList.Count > 0;
private static void SendRPC(byte playerId, bool add, Vector3 loc = new())
{
if (!IsEnable || !Utils.DoRPC) return;
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.SetMorticianArrow, SendOption.Reliable, -1);
writer.Write(playerId);
writer.Write(add);
+1
View File
@@ -39,6 +39,7 @@ internal static class NiceEraser
public static bool IsEnable => playerIdList.Count > 0;
public static void SendRPC(byte playerId)
{
if (!IsEnable || !Utils.DoRPC) return;
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.SetEraseLimit, SendOption.Reliable, -1);
writer.Write(playerId);
writer.Write(EraseLimit[playerId]);
+1
View File
@@ -63,6 +63,7 @@
public static bool IsEnable => playerIdList.Count > 0;
public static void SendRPC(byte playerId, float secondsLeft)
{
if (!IsEnable || !Utils.DoRPC) return;
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.SetNiceHackerLimit, SendOption.Reliable, -1);
writer.Write(playerId);
writer.Write(secondsLeft);
+1
View File
@@ -238,6 +238,7 @@ public static class NiceSwapper
}
private static void SendRPC(byte playerId)
{
if (!IsEnable || !Utils.DoRPC) return;
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.SetNiceSwapperVotes, SendOption.Reliable, -1);
writer.Write(playerId);
AmongUsClient.Instance.FinishRpcImmediately(writer);
+1
View File
@@ -48,6 +48,7 @@ public static class Oracle
public static bool IsEnable => playerIdList.Count > 0;
public static void SendRPC(byte playerId)
{
if (!IsEnable || !Utils.DoRPC) return;
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.SetOracleLimit, SendOption.Reliable, -1);
writer.Write(playerId);
writer.Write(CheckLimit[playerId]);
+1
View File
@@ -42,6 +42,7 @@ public static class Psychic
public static bool IsEnable => playerIdList.Any();
private static void SendRPC()
{
if (!IsEnable || !Utils.DoRPC) return;
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.SyncPsychicRedList, SendOption.Reliable, -1);
writer.Write(RedPlayer.Count);
foreach (byte pc in RedPlayer.ToArray())
+2
View File
@@ -42,6 +42,7 @@ namespace TOHE.Roles.Crewmate
public static bool IsEnable => playerIdList.Count > 0;
public static void SendRPC(byte playerId)
{
if (!IsEnable || !Utils.DoRPC) return;
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.SetRicochetLimit, SendOption.Reliable, -1);
writer.Write(playerId);
writer.Write(UseLimit[playerId]);
@@ -49,6 +50,7 @@ namespace TOHE.Roles.Crewmate
}
public static void SendRPCSyncTarget(byte targetId)
{
if (!IsEnable || !Utils.DoRPC) return;
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.SetRicochetTarget, SendOption.Reliable, -1);
writer.Write(targetId);
AmongUsClient.Instance.FinishRpcImmediately(writer);
+2 -1
View File
@@ -51,9 +51,10 @@ public static class SabotageMaster
{
playerIdList.Add(playerId);
}
public static bool IsEnable() => playerIdList.Count > 0;
public static bool IsEnable => playerIdList.Count > 0;
public static void SendRPC(float count)
{
if (!IsEnable || !Utils.DoRPC) return;
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.SetSabotageMasterLimit, SendOption.Reliable, -1);
writer.Write(count);
AmongUsClient.Instance.FinishRpcImmediately(writer);
+1
View File
@@ -101,6 +101,7 @@ public static class Sheriff
public static bool IsEnable => playerIdList.Count > 0;
public static void SendRPC(byte playerId)
{
if (!IsEnable || !Utils.DoRPC) return;
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.SetSheriffShotLimit, SendOption.Reliable, -1);
writer.Write(playerId);
writer.Write(ShotLimit[playerId]);
+3
View File
@@ -47,6 +47,7 @@ namespace TOHE.Roles.Crewmate
public static bool IsEnable => playerIdList.Count > 0;
public static void SendRPC(byte susId)
{
if (!IsEnable || !Utils.DoRPC) return;
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.SpyRedNameSync, SendOption.Reliable, -1);
writer.Write(susId);
writer.Write(SpyRedNameList[susId].ToString());
@@ -54,6 +55,7 @@ namespace TOHE.Roles.Crewmate
}
public static void SendAbilityRPC(byte spyId)
{
if (!IsEnable || !Utils.DoRPC) return;
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.SpyAbilitySync, SendOption.Reliable, -1);
writer.Write(spyId);
writer.Write(UseLimit[spyId]);
@@ -62,6 +64,7 @@ namespace TOHE.Roles.Crewmate
}
public static void SendRPC(byte susId, bool changeColor)
{
if (!IsEnable || !Utils.DoRPC) return;
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.SpyRedNameRemove, SendOption.Reliable, -1);
//writer.Write(spyId);
writer.Write(susId);
+4 -1
View File
@@ -1,4 +1,5 @@
using Hazel;
using Epic.OnlineServices;
using Hazel;
using System.Collections.Generic;
using UnityEngine;
@@ -36,8 +37,10 @@ public static class SwordsMan
if (!Main.ResetCamPlayerList.Contains(playerId))
Main.ResetCamPlayerList.Add(playerId);
}
public static bool IsEnable => playerIdList.Count > 0;
public static void SendRPC(byte playerId)
{
if (!IsEnable || !Utils.DoRPC) return;
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.SwordsManKill, SendOption.Reliable, -1);
writer.Write(playerId);
AmongUsClient.Instance.FinishRpcImmediately(writer);
+2
View File
@@ -45,6 +45,7 @@ namespace TOHE.Roles.Crewmate
public static bool IsEnable => playerIdList.Count > 0;
public static void SendRPC(byte playerId)
{
if (!IsEnable || !Utils.DoRPC) return;
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.SetTetherLimit, SendOption.Reliable, -1);
writer.Write(playerId);
writer.Write(UseLimit[playerId]);
@@ -52,6 +53,7 @@ namespace TOHE.Roles.Crewmate
}
public static void SendRPCSyncTarget(byte targetId)
{
if (!IsEnable || !Utils.DoRPC) return;
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.SetTetherTarget, SendOption.Reliable, -1);
writer.Write(targetId);
AmongUsClient.Instance.FinishRpcImmediately(writer);
+1 -2
View File
@@ -42,6 +42,7 @@ public static class Tracefinder
public static bool IsEnable => playerIdList.Count > 0;
private static void SendRPC(byte playerId, bool add, Vector3 loc = new())
{
if (!IsEnable || !Utils.DoRPC) return;
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.SetTracefinderArrow, SendOption.Reliable, -1);
writer.Write(playerId);
writer.Write(add);
@@ -74,9 +75,7 @@ public static class Tracefinder
LocateArrow.RemoveAllTarget(apc);
SendRPC(apc, false);
}
}
public static void OnPlayerDead(PlayerControl target)
{
var pos = target.Pos();
+1
View File
@@ -56,6 +56,7 @@ namespace TOHE.Roles.Crewmate
}
public static void SendRPC(byte trackerId = byte.MaxValue, byte targetId = byte.MaxValue)
{
if (!IsEnable || !Utils.DoRPC) return;
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.SetTrackerTarget, SendOption.Reliable, -1);
writer.Write(trackerId);
writer.Write(targetId);
+9 -6
View File
@@ -40,6 +40,7 @@ internal static class Assassin
public static bool IsEnable => playerIdList.Count > 0;
private static void SendRPC(byte playerId)
{
if (!IsEnable || !Utils.DoRPC) return;
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.SetMarkedPlayer, SendOption.Reliable, -1);
writer.Write(playerId);
writer.Write(MarkedPlayer.ContainsKey(playerId) ? MarkedPlayer[playerId] : byte.MaxValue);
@@ -97,17 +98,19 @@ internal static class Assassin
if (MarkedPlayer.ContainsKey(pc.PlayerId))
{
var target = Utils.GetPlayerById(MarkedPlayer[pc.PlayerId]);
MarkedPlayer.Remove(pc.PlayerId);
SendRPC(pc.PlayerId);
_ = new LateTask(() =>
{
if (!(target == null || !target.IsAlive() || Pelican.IsEaten(target.PlayerId) || target.inVent || !GameStates.IsInTask))
{
pc.TP(target.Pos());
pc.ResetKillCooldown();
pc.SyncSettings();
pc.SetKillCooldown(DefaultKillCooldown);
pc.RpcCheckAndMurder(target);
if (pc.RpcCheckAndMurder(target))
{
MarkedPlayer.Remove(pc.PlayerId);
SendRPC(pc.PlayerId);
pc.ResetKillCooldown();
pc.SyncSettings();
pc.SetKillCooldown(DefaultKillCooldown);
}
}
}, UsePets.GetBool() ? 0.1f : 0.2f, "Assassin Assassinate");
return;
+1
View File
@@ -41,6 +41,7 @@ public static class BallLightning
public static bool IsEnable => playerIdList.Count > 0;
private static void SendRPC(byte playerId)
{
if (!IsEnable || !Utils.DoRPC) return;
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.SetGhostPlayer, SendOption.Reliable, -1);
writer.Write(playerId);
writer.Write(IsGhost(playerId));
+1
View File
@@ -63,6 +63,7 @@ public static class BountyHunter
public static bool IsEnable;
private static void SendRPC(byte bountyId, byte targetId)
{
if (!IsEnable || !Utils.DoRPC) return;
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.SetBountyTarget, SendOption.Reliable, -1);
writer.Write(bountyId);
writer.Write(targetId);
+1 -1
View File
@@ -47,7 +47,7 @@ namespace TOHE.Roles.Impostor
private static void SendRPC(byte playerId, bool isPlus)
{
if (!IsEnable) return;
if (!IsEnable || !Utils.DoRPC) return;
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.SyncCantankerousLimit, SendOption.Reliable, -1);
writer.Write(playerId);
writer.Write(isPlus);
+2
View File
@@ -33,6 +33,7 @@ namespace TOHE.Roles.Impostor
}
public static void SendRPC()
{
if (!IsEnable || !Utils.DoRPC) return;
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.SetAdmireLimit, SendOption.Reliable, -1);
writer.Write(isRampaging);
writer.Write(chargePercent);
@@ -59,6 +60,7 @@ namespace TOHE.Roles.Impostor
}
public static void SetKillCooldown(byte id) => Main.AllPlayerKillCooldown[id] = isRampaging ? 0.01f : KCD.GetFloat();
public static bool IsEnable => playerIdList.Count > 0;
public static bool IsRPCNecessary => Utils.DoRPC;
public static void OnCheckMurder(PlayerControl killer, PlayerControl target)
{
if (killer == null) return;
+1 -1
View File
@@ -42,7 +42,7 @@ namespace TOHE.Roles.Impostor
public static bool IsEnable => playerIdList.Count > 0;
public static void SendRPC()
{
if (!IsEnable) return;
if (!IsEnable || !Utils.DoRPC) return;
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.SetConsortLimit, SendOption.Reliable, -1);
writer.Write(BlockLimit);
AmongUsClient.Instance.FinishRpcImmediately(writer);
+1
View File
@@ -227,6 +227,7 @@ public static class Councillor
private static void SendRPC(byte playerId)
{
if (!IsEnable || !Utils.DoRPC) return;
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.MeetingKill, SendOption.Reliable, -1);
writer.Write(playerId);
AmongUsClient.Instance.FinishRpcImmediately(writer);
+1 -1
View File
@@ -43,7 +43,7 @@ namespace TOHE.Roles.Impostor
private static void SendRPC(byte duellistId, byte targetId, bool remove)
{
if (!IsEnable) return;
if (!IsEnable || !Utils.DoRPC) return;
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.SyncDuellistTarget, SendOption.Reliable, -1);
writer.Write(duellistId);
writer.Write(targetId);
+1
View File
@@ -56,6 +56,7 @@ internal static class Eraser
public static bool IsEnable => playerIdList.Count > 0;
private static void SendRPC(byte playerId)
{
if (!IsEnable || !Utils.DoRPC) return;
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.SetEraseLimit, SendOption.Reliable, -1);
writer.Write(playerId);
writer.Write(EraseLimit[playerId]);
+1
View File
@@ -47,6 +47,7 @@ namespace TOHE.Roles.Impostor
private static void SendRPC(byte playerId, byte targetId)
{
if (!IsEnable || !Utils.DoRPC) return;
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.SetEvilDiviner, SendOption.Reliable, -1);
writer.Write(playerId);
writer.Write(DivinationCount[playerId]);
+1
View File
@@ -170,6 +170,7 @@ public static class EvilTracker
}
if (!AmongUsClient.Instance.AmHost) return;
if (!IsEnable || !Utils.DoRPC) return;
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.SetEvilTrackerTarget, SendOption.Reliable, -1);
writer.Write(trackerId);
writer.Write(targetId);
+2
View File
@@ -1,3 +1,4 @@
using Epic.OnlineServices;
using Hazel;
using System.Collections.Generic;
using TOHE.Roles.Crewmate;
@@ -61,6 +62,7 @@ public static class FireWorks
public static void SendRPC(byte playerId)
{
if (!IsEnable || !Utils.DoRPC) return;
Logger.Info($"Player{playerId}:SendRPC", "FireWorks");
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.SendFireWorksState, SendOption.Reliable, -1);
writer.Write(playerId);
+3 -3
View File
@@ -167,7 +167,7 @@ namespace TOHE.Roles.Impostor
killer.Notify(string.Format(GetString("GamblerGet.Speedup"), SpeedDur.GetInt(), Speed.GetFloat()));
isSpeedChange.TryAdd(killer.PlayerId, (Main.AllPlayerSpeed[killer.PlayerId], GetTimeStamp()));
Main.AllPlayerSpeed[killer.PlayerId] = Speed.GetFloat();
killer.SyncSettings();
killer.MarkDirtySettings();
break;
default:
Logger.Error("Invalid Effect ID (positive)", "Gambler.OnCheckMurder");
@@ -191,12 +191,12 @@ namespace TOHE.Roles.Impostor
killer.Notify(string.Format(GetString("GamblerGet.Freeze"), FreezeDur.GetInt()));
isSpeedChange.TryAdd(killer.PlayerId, (Main.AllPlayerSpeed[killer.PlayerId], GetTimeStamp()));
Main.AllPlayerSpeed[killer.PlayerId] = Main.MinSpeed;
killer.SyncSettings();
killer.MarkDirtySettings();
break;
case 3: // Low vision
killer.Notify(string.Format(GetString("GamblerGet.LowVision"), LowVisionDur.GetInt(), LowVision.GetFloat()));
isVisionChange.TryAdd(killer.PlayerId, GetTimeStamp());
killer.SyncSettings();
killer.MarkDirtySettings();
break;
case 4: // High KCD
killer.Notify(string.Format(GetString("GamblerGet.HighKCD"), HighKCD.GetFloat()));
+1
View File
@@ -53,6 +53,7 @@ public static class Gangster
public static bool IsEnable => playerIdList.Count > 0;
private static void SendRPC(byte playerId)
{
if (!IsEnable || !Utils.DoRPC) return;
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.SetGangsterRecruitLimit, SendOption.Reliable, -1);
writer.Write(playerId);
writer.Write(RecruitLimit[playerId]);
+1
View File
@@ -40,6 +40,7 @@ public static class Greedier
private static void SendRPC(byte playerId)
{
if (!IsEnable || !Utils.DoRPC) return;
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.SetGreedierOE, SendOption.Reliable, -1);
writer.Write(playerId);
writer.Write(IsOdd[playerId]);
+1
View File
@@ -45,6 +45,7 @@ public static class Hacker
public static bool IsEnable => playerIdList.Count > 0;
private static void SendRPC(byte playerId)
{
if (!IsEnable || !Utils.DoRPC) return;
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.SetHackerHackLimit, SendOption.Reliable, -1);
writer.Write(playerId);
writer.Write(HackLimit[playerId]);
+1
View File
@@ -43,6 +43,7 @@ namespace TOHE.Roles.Impostor
public static void SendRPC(byte targetId)
{
if (!IsEnable || !Utils.DoRPC) return;
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.SetHitmanTarget, SendOption.Reliable, -1);
writer.Write(targetId);
AmongUsClient.Instance.FinishRpcImmediately(writer);
+2 -2
View File
@@ -67,7 +67,7 @@ namespace TOHE.Roles.Impostor
private static void SendRPC(byte playerId, bool isInSilenceMode)
{
if (!IsEnable) return;
if (!IsEnable || !Utils.DoRPC) return;
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.SetLibrarianMode, SendOption.Reliable, -1);
writer.Write(playerId);
writer.Write(isInSilenceMode);
@@ -85,7 +85,7 @@ namespace TOHE.Roles.Impostor
private static void SendRPCSyncList()
{
if (!IsEnable) return;
if (!IsEnable || !Utils.DoRPC) 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())
+2 -2
View File
@@ -92,7 +92,7 @@ namespace TOHE.Roles.Impostor
}
public static void SendRPC()
{
if (!IsEnable) return;
if (!IsEnable || !Utils.DoRPC) return;
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.SyncMafiosoData, SendOption.Reliable, -1);
writer.Write(Tier);
writer.Write(XP);
@@ -110,7 +110,7 @@ namespace TOHE.Roles.Impostor
}
public static void SendRPCSyncPistolCD()
{
if (!IsEnable) return;
if (!IsEnable || !Utils.DoRPC) return;
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.SyncMafiosoPistolCD, SendOption.Reliable, -1);
writer.Write(Pistol1CD);
writer.Write(Pistol2CD);
+12 -19
View File
@@ -9,7 +9,7 @@ namespace TOHE.Roles.Impostor
public static class Mastermind
{
private static readonly int Id = 640600;
public static List<byte> playerIdList = [];
public static byte mastermindId = byte.MaxValue;
public static Dictionary<byte, long> ManipulatedPlayers = [];
public static Dictionary<byte, long> ManipulateDelays = [];
@@ -21,6 +21,8 @@ namespace TOHE.Roles.Impostor
public static float ManipulateCD;
private static PlayerControl Mastermind_ => GetPlayerById(mastermindId);
public static void SetupCustomOption()
{
SetupRoleOptions(Id, TabGroup.ImpostorRoles, CustomRoles.Mastermind);
@@ -35,7 +37,7 @@ namespace TOHE.Roles.Impostor
public static void Init()
{
playerIdList = [];
mastermindId = byte.MaxValue;
ManipulatedPlayers = [];
ManipulateDelays = [];
TempKCDs = [];
@@ -43,11 +45,11 @@ namespace TOHE.Roles.Impostor
public static void Add(byte playerId)
{
playerIdList.Add(playerId);
mastermindId = playerId;
ManipulateCD = KillCooldown.GetFloat() + TimeLimit.GetFloat() + Delay.GetFloat();
}
public static bool IsEnable => playerIdList.Count > 0;
public static bool IsEnable => mastermindId != byte.MaxValue;
public static bool OnCheckMurder(PlayerControl killer, PlayerControl target)
{
@@ -92,8 +94,7 @@ namespace TOHE.Roles.Impostor
pc.SetKillCooldown(time: 1f);
}
PlayerControl mastermind = GetPlayerById(playerIdList[0]);
NotifyRoles(SpecifySeer: mastermind, SpecifyTarget: mastermind);
NotifyRoles(SpecifySeer: Mastermind_, SpecifyTarget: Mastermind_);
}
}
@@ -111,10 +112,8 @@ namespace TOHE.Roles.Impostor
{
ManipulatedPlayers.Remove(x.Key);
TempKCDs.Remove(x.Key);
player.SetRealKiller(GetPlayerById(playerIdList[0]));
Main.PlayerStates[x.Key].deathReason = PlayerState.DeathReason.Suicide;
player.Kill(player);
RPC.PlaySoundRPC(playerIdList[0], Sounds.KillSound);
player.Suicide(PlayerState.DeathReason.Suicide, Mastermind_);
RPC.PlaySoundRPC(mastermindId, Sounds.KillSound);
}
var time = TimeLimit.GetInt() - (GetTimeStamp() - x.Value);
@@ -129,12 +128,7 @@ namespace TOHE.Roles.Impostor
foreach (var x in ManipulatedPlayers)
{
var pc = GetPlayerById(x.Key);
if (pc.IsAlive())
{
pc.SetRealKiller(GetPlayerById(playerIdList[0]));
Main.PlayerStates[pc.PlayerId].deathReason = PlayerState.DeathReason.Suicide;
pc.Kill(pc);
}
if (pc.IsAlive()) pc.Suicide(PlayerState.DeathReason.Suicide, Mastermind_);
}
ManipulateDelays.Clear();
ManipulatedPlayers.Clear();
@@ -187,9 +181,8 @@ namespace TOHE.Roles.Impostor
private static void NotifyMastermindTargetSurvived()
{
if (!IsEnable) return;
var mastermind = GetPlayerById(playerIdList[0]);
mastermind.Notify(GetString("ManipulatedKilled"));
if (mastermind.killTimer > KillCooldown.GetFloat()) mastermind.SetKillCooldown(time: KillCooldown.GetFloat());
Mastermind_.Notify(GetString("ManipulatedKilled"));
if (Mastermind_.killTimer > KillCooldown.GetFloat()) Mastermind_.SetKillCooldown(time: KillCooldown.GetFloat());
}
}
}
+1 -1
View File
@@ -51,7 +51,7 @@ namespace TOHE.Roles.Impostor
public static void ApplyGameOptions(IGameOptions opt) => AURoleOptions.ShapeshifterCooldown = AbductVictim != null ? AbductTimer : AbductTimerLimit;
private static void SendRPC()
{
if (!IsEnable) return;
if (!IsEnable || !Utils.DoRPC) return;
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.PenguinSync, SendOption.Reliable, -1);
writer.Write(AbductVictim?.PlayerId ?? 255);
AmongUsClient.Instance.FinishRpcImmediately(writer);
+1
View File
@@ -39,6 +39,7 @@ internal static class QuickShooter
public static bool IsEnable => playerIdList.Count > 0;
private static void SendRPC(byte playerId)
{
if (!IsEnable || !Utils.DoRPC) return;
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.SetQuickShooterShotLimit, SendOption.Reliable, -1);
writer.Write(playerId);
writer.Write(ShotLimit[playerId]);
+1
View File
@@ -81,6 +81,7 @@ public static class Sniper
public static bool IsThisRole(byte playerId) => PlayerIdList.Contains(playerId);
public static void SendRPC(byte playerId)
{
if (!IsEnable || !Utils.DoRPC) return;
Logger.Info($"Player{playerId}:SendRPC", "Sniper");
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.SniperSync, SendOption.Reliable, -1);
writer.Write(playerId);
+1 -1
View File
@@ -57,7 +57,7 @@ public static class Swooper
public static bool IsEnable => playerIdList.Count > 0;
private static void SendRPC(PlayerControl pc)
{
if (pc.AmOwner) return;
if (!IsEnable || !Utils.DoRPC || pc.AmOwner) return;
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.SetSwooperTimer, SendOption.Reliable, pc.GetClientId());
writer.Write((InvisTime.TryGetValue(pc.PlayerId, out var x) ? x : -1).ToString());
writer.Write((lastTime.TryGetValue(pc.PlayerId, out var y) ? y : -1).ToString());
+9 -6
View File
@@ -40,6 +40,7 @@ internal static class Undertaker
public static bool IsEnable => playerIdList.Count > 0;
private static void SendRPC(byte playerId)
{
if (!IsEnable || !Utils.DoRPC) return;
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.SetMarkedPlayerV2, SendOption.Reliable, -1);
writer.Write(playerId);
writer.Write(MarkedPlayer.ContainsKey(playerId) ? MarkedPlayer[playerId] : byte.MaxValue);
@@ -98,17 +99,19 @@ internal static class Undertaker
if (MarkedPlayer.ContainsKey(pc.PlayerId))
{
var target = Utils.GetPlayerById(MarkedPlayer[pc.PlayerId]);
MarkedPlayer.Remove(pc.PlayerId);
SendRPC(pc.PlayerId);
_ = new LateTask(() =>
{
if (!(target == null || !target.IsAlive() || Pelican.IsEaten(target.PlayerId) || target.inVent || !GameStates.IsInTask))
{
target.TP(new UnityEngine.Vector2(pc.transform.position.x, pc.transform.position.y + 0.3636f));
pc.ResetKillCooldown();
pc.SyncSettings();
pc.SetKillCooldown();
pc.RpcCheckAndMurder(target);
if (pc.RpcCheckAndMurder(target))
{
MarkedPlayer.Remove(pc.PlayerId);
SendRPC(pc.PlayerId);
pc.ResetKillCooldown();
pc.SyncSettings();
pc.SetKillCooldown();
}
}
}, UsePets.GetBool() ? 0.1f : 0.2f, "Undertaker Assassinate");
}
+1
View File
@@ -47,6 +47,7 @@ public static class Wildling
public static bool IsEnable => playerIdList.Count > 0;
private static void SendRPC(byte playerId)
{
if (!IsEnable || !Utils.DoRPC) return;
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.SetBKTimer, SendOption.Reliable, -1);
writer.Write(playerId);
writer.Write(TimeStamp[playerId].ToString());
+1
View File
@@ -56,6 +56,7 @@ public static class Witch
public static bool IsEnable => playerIdList.Count > 0;
private static void SendRPC(bool doSpell, byte witchId, byte target = 255)
{
if (!IsEnable || !Utils.DoRPC) return;
if (doSpell)
{
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.DoSpell, SendOption.Reliable, -1);
+1 -1
View File
@@ -47,7 +47,7 @@ namespace TOHE.Roles.Impostor
public static void SendRPC(bool isClear, byte playerId = byte.MaxValue)
{
if (!IsEnable) return;
if (!IsEnable || !Utils.DoRPC) return;
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.SyncYinYanger, SendOption.Reliable, -1);
writer.Write(isClear);
if (!isClear) writer.Write(playerId);
+1 -22
View File
@@ -379,28 +379,7 @@ public static class Amnesiac
public static bool CanBeRememberedBloodKnight(this PlayerControl pc) => pc != null && pc.Is(CustomRoles.BloodKnight);
public static bool KnowRole(PlayerControl player, PlayerControl target)
{
if (player.Is(CustomRoles.Infectious) && target.Is(CustomRoles.Infectious)) return true;
if (player.Is(CustomRoles.Glitch) && target.Is(CustomRoles.Glitch)) return true;
if (player.Is(CustomRoles.Wraith) && target.Is(CustomRoles.Wraith)) return true;
if (player.Is(CustomRoles.Medusa) && target.Is(CustomRoles.Medusa)) return true;
if (player.Is(CustomRoles.Pelican) && target.Is(CustomRoles.Pelican)) return true;
if (player.Is(CustomRoles.Refugee) && target.Is(CustomRoles.Refugee)) return true;
if (player.Is(CustomRoles.Parasite) && target.Is(CustomRoles.Parasite)) return true;
if (player.Is(CustomRoles.NSerialKiller) && target.Is(CustomRoles.NSerialKiller)) return true;
if (player.Is(CustomRoles.PlagueDoctor) && target.Is(CustomRoles.PlagueDoctor)) return true;
if (player.Is(CustomRoles.Magician) && target.Is(CustomRoles.Magician)) return true;
if (player.Is(CustomRoles.WeaponMaster) && target.Is(CustomRoles.WeaponMaster)) return true;
if (player.Is(CustomRoles.Reckless) && target.Is(CustomRoles.Reckless)) return true;
if (player.Is(CustomRoles.Eclipse) && target.Is(CustomRoles.Eclipse)) return true;
if (player.Is(CustomRoles.Pyromaniac) && target.Is(CustomRoles.Pyromaniac)) return true;
if (player.Is(CustomRoles.Imitator) && target.Is(CustomRoles.Imitator)) return true;
if (player.Is(CustomRoles.Werewolf) && target.Is(CustomRoles.Werewolf)) return true;
if (player.Is(CustomRoles.Pickpocket) && target.Is(CustomRoles.Pickpocket)) return true;
if (player.Is(CustomRoles.Traitor) && target.Is(CustomRoles.Traitor)) return true;
if (player.Is(CustomRoles.Virus) && target.Is(CustomRoles.Virus)) return true;
if (player.Is(CustomRoles.Spiritcaller) && target.Is(CustomRoles.Spiritcaller)) return true;
if (player.Is(CustomRoles.Succubus) && target.Is(CustomRoles.Succubus)) return true;
if (player.Is(CustomRoles.Poisoner) && target.Is(CustomRoles.Poisoner)) return true;
if (player.IsNeutralKiller() && target.IsNeutralKiller() && player.GetCustomRole() == target.GetCustomRole()) return true;
if (player.Is(CustomRoles.Refugee) && target.Is(CustomRoleTypes.Impostor)) return true;
if (player.Is(CustomRoleTypes.Impostor) && target.Is(CustomRoles.Refugee)) return true;
return false;
+2 -1
View File
@@ -64,7 +64,8 @@ public static class Bandit
public static void ApplyGameOptions(IGameOptions opt) => opt.SetVision(HasImpostorVision.GetBool());
private static void SendRPC(byte playerId/*, bool isTargetList = false*/)
{
{
if (!IsEnable || !Utils.DoRPC) return;
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.SetBanditStealLimit, SendOption.Reliable, -1);
writer.Write(playerId);
writer.Write(TotalSteals[playerId]);
+1
View File
@@ -46,6 +46,7 @@ public static class BloodKnight
public static bool IsEnable => playerIdList.Count > 0;
private static void SendRPC(byte playerId)
{
if (!IsEnable || !Utils.DoRPC) return;
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.SetBKTimer, SendOption.Reliable, -1);
writer.Write(playerId);
writer.Write(TimeStamp[playerId].ToString());
+1
View File
@@ -32,6 +32,7 @@ public static class Collector
public static bool IsEnable => playerIdList.Count > 0;
private static void SendRPC(byte playerId)
{
if (!IsEnable || !Utils.DoRPC) return;
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.SetCollectorVotes, SendOption.Reliable, -1);
writer.Write(playerId);
writer.Write(CollectVote[playerId]);
+1
View File
@@ -51,6 +51,7 @@ public static class CursedSoul
private static void SendRPC()
{
if (!IsEnable || !Utils.DoRPC) return;
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.SetCursedSoulCurseLimit, SendOption.Reliable, -1);
writer.Write(CurseLimit);
AmongUsClient.Instance.FinishRpcImmediately(writer);
+1 -1
View File
@@ -64,7 +64,7 @@ public static class DarkHide
}
public static void DRpcSetKillCount(this PlayerControl player)
{
if (!AmongUsClient.Instance.AmHost) return;
if (!IsEnable || !Utils.DoRPC || !AmongUsClient.Instance.AmHost) return;
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.SetDarkHiderKillCount, SendOption.Reliable, -1);
writer.Write(player.PlayerId);
writer.Write(IsWinKill[player.PlayerId]);
+2 -2
View File
@@ -75,8 +75,8 @@ public static class Doomsayer
public static bool IsEnable => playerIdList.Count > 0;
public static void SendRPC(PlayerControl player)
{
MessageWriter writer;
writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.SetDoomsayerProgress, SendOption.Reliable, -1);
if (!IsEnable || !Utils.DoRPC) return;
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.SetDoomsayerProgress, SendOption.Reliable, -1);
writer.Write(player.PlayerId);
AmongUsClient.Instance.FinishRpcImmediately(writer);
}
+1 -1
View File
@@ -50,7 +50,7 @@ public static class Doppelganger
private static void SendRPC(byte playerId, bool isTargetList = false)
{
if (!IsEnable) return;
if (!IsEnable || !Utils.DoRPC) return;
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.SetDoppelgangerStealLimit, SendOption.Reliable, -1);
writer.Write(playerId);
writer.Write(TotalSteals[playerId]);
+2 -1
View File
@@ -52,6 +52,7 @@ public static class Eclipse
public static bool IsEnable => playerIdList.Count > 0;
public static void SendRPC(float vision)
{
if (!IsEnable || !Utils.DoRPC) return;
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.SetEclipseVision, SendOption.Reliable, -1);
writer.Write(vision);
AmongUsClient.Instance.FinishRpcImmediately(writer);
@@ -80,7 +81,7 @@ public static class Eclipse
if (Vision != currentVision)
{
SendRPC(Vision);
pc.SyncSettings();
pc.MarkDirtySettings();
}
}
}
+1
View File
@@ -98,6 +98,7 @@ public static class Executioner
public static bool IsEnable() => playerIdList.Count > 0;
public static void SendRPC(byte executionerId, byte targetId = 0x73, string Progress = "")
{
if (!IsEnable() || !Utils.DoRPC) return;
MessageWriter writer;
switch (Progress)
{
+1
View File
@@ -69,6 +69,7 @@ public static class Gamer
}
private static void SendRPC(byte playerId)
{
if (!IsEnable || !Utils.DoRPC) return;
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.SetGamerHealth, SendOption.Reliable, -1);
writer.Write(playerId);
if (GamerHealth.ContainsKey(playerId))
+6
View File
@@ -93,6 +93,7 @@ public static class Glitch
public static bool IsEnable => playerIdList.Count > 0;
public static void SendRPCSyncTimers(int mimicCDTimer, int mimicDurTimer, int hackCDTimer, int KCDTimer)
{
if (!IsEnable || !Utils.DoRPC) return;
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.SyncGlitchTimers, SendOption.Reliable, -1);
writer.Write(mimicCDTimer);
writer.Write(mimicDurTimer);
@@ -102,6 +103,7 @@ public static class Glitch
}
public static void SendRPCSyncMimic(int mimicCDTimer, int mimicDurTimer, long lastMimic)
{
if (!IsEnable || !Utils.DoRPC) return;
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.SyncGlitchMimic, SendOption.Reliable, -1);
writer.Write(mimicCDTimer);
writer.Write(mimicDurTimer);
@@ -110,6 +112,7 @@ public static class Glitch
}
public static void SendRPCSyncLongs(long lastKill, long lastHack, long lastMimic)
{
if (!IsEnable || !Utils.DoRPC) return;
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.SyncGlitchLongs, SendOption.Reliable, -1);
writer.Write(lastKill);
writer.Write(lastHack);
@@ -118,6 +121,7 @@ public static class Glitch
}
public static void SendRPCSyncKill(long lastKill, int KCDtimer)
{
if (!IsEnable || !Utils.DoRPC) return;
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.SyncGlitchKill, SendOption.Reliable, -1);
writer.Write(lastKill);
writer.Write(KCDtimer);
@@ -125,6 +129,7 @@ public static class Glitch
}
public static void SendRPCSyncHack(long lastHack, int hackCDTimer)
{
if (!IsEnable || !Utils.DoRPC) return;
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.SyncGlitchHack, SendOption.Reliable, -1);
writer.Write(lastHack);
writer.Write(hackCDTimer);
@@ -132,6 +137,7 @@ public static class Glitch
}
public static void SendRPCSyncSS(bool isShifted)
{
if (!IsEnable || !Utils.DoRPC) return;
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.SyncGlitchSS, SendOption.Reliable, -1);
writer.Write(isShifted);
AmongUsClient.Instance.FinishRpcImmediately(writer);
+1
View File
@@ -65,6 +65,7 @@ public static class HexMaster
public static bool IsEnable => playerIdList.Count > 0;
private static void SendRPC(bool doHex, byte hexId, byte target = 255)
{
if (!IsEnable || !Utils.DoRPC) return;
if (doHex)
{
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.DoHex, SendOption.Reliable, -1);
+1
View File
@@ -49,6 +49,7 @@ public static class Imitator
private static void SendRPC(byte playerId)
{
if (!IsEnable || !Utils.DoRPC) return;
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.SetImitatorOE, SendOption.Reliable, -1);
writer.Write(playerId);
writer.Write(IsOdd[playerId]);
+1
View File
@@ -56,6 +56,7 @@ public static class Infectious
public static bool IsEnable => playerIdList.Count > 0;
//private static void SendRPC()
//{
// if (!IsEnable || !Utils.DoRPC) return;
// MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.SetInfectiousBiteLimit, SendOption.Reliable, -1);
// writer.Write(BiteLimit);
// AmongUsClient.Instance.FinishRpcImmediately(writer);
+1
View File
@@ -90,6 +90,7 @@ public static class Jackal
private static void SendRPC(byte playerId)
{
if (!IsEnable || !Utils.DoRPC) return;
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.SetJackalRecruitLimit, SendOption.Reliable, -1);
writer.Write(playerId);
writer.Write(RecruitLimit[playerId]);
+1
View File
@@ -101,6 +101,7 @@ public static class Lawyer
public static bool IsEnable() => playerIdList.Count > 0;
public static void SendRPC(byte lawyerId, byte targetId = 0x73, string Progress = "")
{
if (!IsEnable || !Utils.DoRPC) return;
MessageWriter writer;
switch (Progress)
{
+1
View File
@@ -42,6 +42,7 @@ public static class Pelican
}
private static void SendRPC(byte playerId)
{
if (!IsEnable || !Utils.DoRPC) return;
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.SetPelicanEtenNum, SendOption.Reliable, -1);
writer.Write(playerId);
if (playerId != byte.MaxValue)
+1
View File
@@ -59,6 +59,7 @@ public static class PlagueBearer
public static bool IsPlagued(byte pc, byte target) => PlaguedList.TryGetValue(pc, out var x) && x.Contains(target);
public static void SendRPC(PlayerControl player, PlayerControl target)
{
if (!IsEnable || !Utils.DoRPC) return;
MessageWriter writer;
writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.setPlaguedPlayer, SendOption.Reliable, -1);//RPCによる同期
writer.Write(player.PlayerId);
+1 -1
View File
@@ -103,7 +103,7 @@ namespace TOHE.Roles.Neutral
}
public static void SendRPC(byte targetId, float rate)
{
if (!IsEnable) return;
if (!IsEnable || !Utils.DoRPC) return;
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.SyncPlagueDoctor, SendOption.Reliable, -1);
writer.Write(targetId);
writer.Write(rate);
+1
View File
@@ -42,6 +42,7 @@ public static class Pursuer
public static bool IsEnable => playerIdList.Count > 0;
private static void SendRPC(byte playerId)
{
if (!IsEnable || !Utils.DoRPC) return;
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.SetPursuerSellLimit, SendOption.Reliable, -1);
writer.Write(playerId);
writer.Write(SeelLimit[playerId]);
+1
View File
@@ -53,6 +53,7 @@ namespace TOHE.Roles.Neutral
private static void SendRPC(byte playerId, byte targetId)
{
if (!IsEnable || !Utils.DoRPC) return;
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.SetRitualist, SendOption.Reliable, -1);
writer.Write(playerId);
writer.Write(RitualCount[playerId]);
+2
View File
@@ -69,6 +69,7 @@ public static class Romantic
public static bool IsEnable => playerIdList.Count > 0;
private static void SendRPC(byte playerId)
{
if (!IsEnable || !Utils.DoRPC) return;
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.SyncRomanticTarget, SendOption.Reliable, -1);
writer.Write(playerId);
//writer.Write(BetTimes.TryGetValue(playerId, out var times) ? times : MaxBetTimes);
@@ -280,6 +281,7 @@ public static class VengefulRomantic
}
public static void SendRPC(byte playerId)
{
if (!IsEnable || !Utils.DoRPC) return;
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.SyncVengefulRomanticTarget, SendOption.Reliable, -1);
writer.Write(playerId);
//writer.Write(BetTimes.TryGetValue(playerId, out var times) ? times : MaxBetTimes);
Loaded 100 of 109 files, more files were not shown because too many files have changed in this diff. Show more