Optimize NotifyRoles, Continue Analyzer, Fix bugs

This commit is contained in:
Gurge44 committed 2023-11-25 21:08:51 +01:00
1 parent 0ccf84c03c
commit 49a5a7033e
52 files changed
+241 -325

No files matched your search

+1 -1
View File
@@ -358,7 +358,7 @@ internal static class FFAManager
{
NameNotify.Remove(pc.PlayerId);
SendRPCSyncNameNotify(pc);
Utils.NotifyRoles(SpecifySeer: pc);
Utils.NotifyRoles(SpecifySeer: pc, SpecifyTarget: pc);
}
var rd = IRandom.Instance;
+4 -4
View File
@@ -239,8 +239,8 @@ internal static class SoloKombatManager
target.RpcGuardAndKill(colorId: 5);
SendRPCSyncKBPlayer(target.PlayerId);
Utils.NotifyRoles(SpecifySeer: killer);
Utils.NotifyRoles(SpecifySeer: target);
Utils.NotifyRoles(SpecifySeer: killer, SpecifyTarget: killer);
Utils.NotifyRoles(SpecifySeer: target, SpecifyTarget: target);
}
public static void OnPlayerBack(PlayerControl pc)
{
@@ -324,7 +324,7 @@ internal static class SoloKombatManager
NameNotify.Add(pc.PlayerId, (text, Utils.GetTimeStamp() + time));
SendRPCSyncNameNotify(pc);
SendRPCSyncKBPlayer(pc.PlayerId);
Utils.NotifyRoles(SpecifySeer: pc);
Utils.NotifyRoles(SpecifySeer: pc, SpecifyTarget: pc);
}
private static Dictionary<byte, int> BackCountdown = [];
@@ -391,7 +391,7 @@ internal static class SoloKombatManager
notifyRoles = true;
}
// 必要时刷新玩家名字
if (notifyRoles) Utils.NotifyRoles(SpecifySeer: pc);
if (notifyRoles) Utils.NotifyRoles(SpecifySeer: pc, SpecifyTarget: pc);
}
}
}
+1 -1
View File
@@ -141,7 +141,7 @@ static class LocateArrow
}
if (update)
{
Utils.NotifyRoles(SpecifySeer: seer, ForceLoop: false);
Utils.NotifyRoles(SpecifySeer: seer, ForceLoop: false, SpecifyTarget: seer);
}
}
}
+2 -2
View File
@@ -19,7 +19,7 @@ public static class NameNotifyManager
Notice.Remove(pc.PlayerId);
Notice.Add(pc.PlayerId, new(text, Utils.GetTimeStamp() + (long)time));
SendRPC(pc.PlayerId);
Utils.NotifyRoles(SpecifySeer: pc);
Utils.NotifyRoles(SpecifySeer: pc, SpecifyTarget: pc);
Logger.Info($"New name notify for {pc.GetNameWithRole().RemoveHtmlTags()}: {text} ({time}s)", "Name Notify");
}
public static void OnFixedUpdate(PlayerControl player)
@@ -32,7 +32,7 @@ public static class NameNotifyManager
if (Notice.ContainsKey(player.PlayerId) && Notice[player.PlayerId].Item2 < Utils.GetTimeStamp())
{
Notice.Remove(player.PlayerId);
Utils.NotifyRoles(SpecifySeer: player);
Utils.NotifyRoles(SpecifySeer: player, SpecifyTarget: player);
}
}
public static bool GetNameNotify(PlayerControl player, out string name)
+1 -1
View File
@@ -143,7 +143,7 @@ static class TargetArrow
}
if (update)
{
Utils.NotifyRoles(SpecifySeer: seer, ForceLoop: false);
Utils.NotifyRoles(SpecifySeer: seer, ForceLoop: false, SpecifyTarget: seer);
}
}
}
+1 -1
View File
@@ -58,6 +58,6 @@ class ElectricalDoorsInitializePatch
else
closedoors += $", {num}";
}
Logger.Info($"ClosedDoors:{closedoors}", "ElectricalDoors Initialize");
Logger.Info($"Closed Doors: {closedoors}", "ElectricalDoors Initialize");
}
}
+52 -162
View File
@@ -1240,7 +1240,7 @@ class MurderPlayerPatch
{
__instance.MarkDirtySettings();
target.MarkDirtySettings();
NotifyRoles(SpecifySeer: killer);
NotifyRoles(SpecifySeer: killer, SpecifyTarget: killer);
NotifyRoles(SpecifySeer: target);
}
else
@@ -2111,206 +2111,90 @@ class FixedUpdatePatch
switch (player.GetCustomRole())
{
case CustomRoles.Doormaster:
if (Main.DoormasterCD.TryGetValue(player.PlayerId, out var dm) && dm + Doormaster.VentCooldown.GetInt() < GetTimeStamp())
{
Main.DoormasterCD.Remove(player.PlayerId);
NotifyRoles(SpecifySeer: player);
}
if (Main.DoormasterCD.ContainsKey(player.PlayerId)) NotifyRoles(SpecifySeer: player);
NotifyPetCD(Main.DoormasterCD, Doormaster.VentCooldown.GetInt());
break;
case CustomRoles.Sapper:
if (Main.SapperCD.TryGetValue(player.PlayerId, out var spp) && spp + Sapper.ShapeshiftCooldown.GetInt() < GetTimeStamp())
{
Main.SapperCD.Remove(player.PlayerId);
NotifyRoles(SpecifySeer: player);
}
if (Main.SapperCD.ContainsKey(player.PlayerId)) NotifyRoles(SpecifySeer: player);
NotifyPetCD(Main.SapperCD, Sapper.ShapeshiftCooldown.GetInt());
break;
case CustomRoles.Druid:
if (Main.DruidCD.TryGetValue(player.PlayerId, out var dc) && dc + Druid.VentCooldown.GetInt() < GetTimeStamp())
{
Main.DruidCD.Remove(player.PlayerId);
NotifyRoles(SpecifySeer: player);
}
if (Main.DruidCD.ContainsKey(player.PlayerId)) NotifyRoles(SpecifySeer: player);
NotifyPetCD(Main.DruidCD, Druid.VentCooldown.GetInt());
break;
case CustomRoles.Tether:
if (Main.TetherCD.TryGetValue(player.PlayerId, out var th) && th + Tether.VentCooldown.GetInt() < GetTimeStamp())
{
Main.TetherCD.Remove(player.PlayerId);
NotifyRoles(SpecifySeer: player);
}
if (Main.TetherCD.ContainsKey(player.PlayerId)) NotifyRoles(SpecifySeer: player);
NotifyPetCD(Main.TetherCD, Tether.VentCooldown.GetInt());
break;
case CustomRoles.CameraMan:
if (Main.CameraManCD.TryGetValue(player.PlayerId, out var cm) && cm + CameraMan.VentCooldown.GetInt() < GetTimeStamp())
{
Main.CameraManCD.Remove(player.PlayerId);
NotifyRoles(SpecifySeer: player);
}
if (Main.CameraManCD.ContainsKey(player.PlayerId)) NotifyRoles(SpecifySeer: player);
NotifyPetCD(Main.CameraManCD, CameraMan.VentCooldown.GetInt());
break;
case CustomRoles.Mayor:
if (Main.MayorCD.TryGetValue(player.PlayerId, out var my) && my + Options.DefaultKillCooldown < GetTimeStamp())
{
Main.MayorCD.Remove(player.PlayerId);
NotifyRoles(SpecifySeer: player);
}
if (Main.MayorCD.ContainsKey(player.PlayerId)) NotifyRoles(SpecifySeer: player);
NotifyPetCD(Main.MayorCD, (int)Math.Round(Options.DefaultKillCooldown));
break;
case CustomRoles.Paranoia:
if (Main.ParanoiaCD.TryGetValue(player.PlayerId, out var pn) && pn + Options.ParanoiaVentCooldown.GetInt() < GetTimeStamp())
{
Main.ParanoiaCD.Remove(player.PlayerId);
NotifyRoles(SpecifySeer: player);
}
if (Main.ParanoiaCD.ContainsKey(player.PlayerId)) NotifyRoles(SpecifySeer: player);
NotifyPetCD(Main.ParanoiaCD, Options.ParanoiaVentCooldown.GetInt());
break;
case CustomRoles.NiceHacker:
if (Main.HackerCD.TryGetValue(player.PlayerId, out var nh) && nh + NiceHacker.AbilityCD.GetInt() < GetTimeStamp())
{
Main.HackerCD.Remove(player.PlayerId);
NotifyRoles(SpecifySeer: player);
}
if (Main.HackerCD.ContainsKey(player.PlayerId)) NotifyRoles(SpecifySeer: player);
NotifyPetCD(Main.HackerCD, NiceHacker.AbilityCD.GetInt());
break;
case CustomRoles.Grenadier:
if (Main.GrenadierCD.TryGetValue(player.PlayerId, out var gd) && gd + Options.GrenadierSkillCooldown.GetInt() + Options.GrenadierSkillDuration.GetInt() < GetTimeStamp())
{
Main.GrenadierCD.Remove(player.PlayerId);
NotifyRoles(SpecifySeer: player);
}
if (Main.GrenadierCD.ContainsKey(player.PlayerId)) NotifyRoles(SpecifySeer: player);
NotifyPetCD(Main.GrenadierCD, Options.GrenadierSkillCooldown.GetInt() + Options.GrenadierSkillDuration.GetInt());
break;
case CustomRoles.Lighter:
if (Main.LighterCD.TryGetValue(player.PlayerId, out var lt) && lt + Options.LighterSkillCooldown.GetInt() + Options.LighterSkillDuration.GetInt() < GetTimeStamp())
{
Main.LighterCD.Remove(player.PlayerId);
NotifyRoles(SpecifySeer: player);
}
if (Main.LighterCD.ContainsKey(player.PlayerId)) NotifyRoles(SpecifySeer: player);
NotifyPetCD(Main.LighterCD, Options.LighterSkillCooldown.GetInt() + Options.LighterSkillDuration.GetInt());
break;
case CustomRoles.SecurityGuard:
if (Main.SecurityGuardCD.TryGetValue(player.PlayerId, out var sg) && sg + Options.SecurityGuardSkillCooldown.GetInt() + Options.SecurityGuardSkillDuration.GetInt() < GetTimeStamp())
{
Main.SecurityGuardCD.Remove(player.PlayerId);
NotifyRoles(SpecifySeer: player);
}
if (Main.SecurityGuardCD.ContainsKey(player.PlayerId)) NotifyRoles(SpecifySeer: player);
NotifyPetCD(Main.SecurityGuardCD, Options.SecurityGuardSkillCooldown.GetInt() + Options.SecurityGuardSkillDuration.GetInt());
break;
case CustomRoles.DovesOfNeace:
if (Main.DovesOfNeaceCD.TryGetValue(player.PlayerId, out var don) && don + Options.DovesOfNeaceCooldown.GetInt() < GetTimeStamp())
{
Main.DovesOfNeaceCD.Remove(player.PlayerId);
NotifyRoles(SpecifySeer: player);
}
if (Main.DovesOfNeaceCD.ContainsKey(player.PlayerId)) NotifyRoles(SpecifySeer: player);
NotifyPetCD(Main.DovesOfNeaceCD, Options.DovesOfNeaceCooldown.GetInt());
break;
case CustomRoles.Alchemist:
if (Main.AlchemistCD.TryGetValue(player.PlayerId, out var ac) && ac + Alchemist.VentCooldown.GetInt() < GetTimeStamp())
{
Main.AlchemistCD.Remove(player.PlayerId);
NotifyRoles(SpecifySeer: player);
}
if (Main.AlchemistCD.ContainsKey(player.PlayerId)) NotifyRoles(SpecifySeer: player);
NotifyPetCD(Main.AlchemistCD, Alchemist.VentCooldown.GetInt());
break;
case CustomRoles.TimeMaster:
if (Main.TimeMasterCD.TryGetValue(player.PlayerId, out var tm) && tm + Options.TimeMasterSkillCooldown.GetInt() + Options.TimeMasterSkillDuration.GetInt() < GetTimeStamp())
{
Main.TimeMasterCD.Remove(player.PlayerId);
NotifyRoles(SpecifySeer: player);
}
if (Main.TimeMasterCD.ContainsKey(player.PlayerId)) NotifyRoles(SpecifySeer: player);
NotifyPetCD(Main.TimeMasterCD, Options.TimeMasterSkillCooldown.GetInt() + Options.TimeMasterSkillDuration.GetInt());
break;
case CustomRoles.Veteran:
if (Main.VeteranCD.TryGetValue(player.PlayerId, out var vr) && vr + Options.VeteranSkillCooldown.GetInt() + Options.VeteranSkillDuration.GetInt() < GetTimeStamp())
{
Main.VeteranCD.Remove(player.PlayerId);
NotifyRoles(SpecifySeer: player);
}
if (Main.VeteranCD.ContainsKey(player.PlayerId)) NotifyRoles(SpecifySeer: player);
NotifyPetCD(Main.VeteranCD, Options.VeteranSkillCooldown.GetInt() + Options.VeteranSkillDuration.GetInt());
break;
case CustomRoles.Sniper:
if (Main.SniperCD.TryGetValue(player.PlayerId, out var sp) && sp + Options.DefaultShapeshiftCooldown.GetInt() < GetTimeStamp())
{
Main.SniperCD.Remove(player.PlayerId);
NotifyRoles(SpecifySeer: player);
}
if (Main.SniperCD.ContainsKey(player.PlayerId)) NotifyRoles(SpecifySeer: player);
NotifyPetCD(Main.SniperCD, Options.DefaultShapeshiftCooldown.GetInt());
break;
case CustomRoles.Assassin:
if (Main.AssassinCD.TryGetValue(player.PlayerId, out var ass) && ass + Assassin.AssassinateCooldown.GetInt() < GetTimeStamp())
{
Main.AssassinCD.Remove(player.PlayerId);
NotifyRoles(SpecifySeer: player);
}
if (Main.AssassinCD.ContainsKey(player.PlayerId)) NotifyRoles(SpecifySeer: player);
NotifyPetCD(Main.AssassinCD, Assassin.AssassinateCooldown.GetInt());
break;
case CustomRoles.Undertaker:
if (Main.UndertakerCD.TryGetValue(player.PlayerId, out var ut) && ut + Undertaker.AssassinateCooldown.GetInt() < GetTimeStamp())
{
Main.UndertakerCD.Remove(player.PlayerId);
NotifyRoles(SpecifySeer: player);
}
if (Main.UndertakerCD.ContainsKey(player.PlayerId)) NotifyRoles(SpecifySeer: player);
NotifyPetCD(Main.UndertakerCD, Undertaker.AssassinateCooldown.GetInt());
break;
case CustomRoles.Bomber:
if (Main.BomberCD.TryGetValue(player.PlayerId, out var bb) && bb + Options.BombCooldown.GetInt() < GetTimeStamp())
{
Main.BomberCD.Remove(player.PlayerId);
NotifyRoles(SpecifySeer: player);
}
if (Main.BomberCD.ContainsKey(player.PlayerId)) NotifyRoles(SpecifySeer: player);
NotifyPetCD(Main.BomberCD, Options.BombCooldown.GetInt());
break;
case CustomRoles.Nuker:
if (Main.NukerCD.TryGetValue(player.PlayerId, out var nk) && nk + Options.NukeCooldown.GetInt() < GetTimeStamp())
{
Main.NukerCD.Remove(player.PlayerId);
NotifyRoles(SpecifySeer: player);
}
if (Main.NukerCD.ContainsKey(player.PlayerId)) NotifyRoles(SpecifySeer: player);
NotifyPetCD(Main.NukerCD, Options.NukeCooldown.GetInt());
break;
case CustomRoles.Escapee:
if (Main.EscapeeCD.TryGetValue(player.PlayerId, out var ec) && ec + Options.EscapeeSSCD.GetInt() < GetTimeStamp())
{
Main.EscapeeCD.Remove(player.PlayerId);
NotifyRoles(SpecifySeer: player);
}
if (Main.EscapeeCD.ContainsKey(player.PlayerId)) NotifyRoles(SpecifySeer: player);
NotifyPetCD(Main.EscapeeCD, Options.EscapeeSSCD.GetInt());
break;
case CustomRoles.Miner:
if (Main.MinerCD.TryGetValue(player.PlayerId, out var mn) && mn + Options.MinerSSCD.GetInt() < GetTimeStamp())
{
Main.MinerCD.Remove(player.PlayerId);
NotifyRoles(SpecifySeer: player);
}
if (Main.MinerCD.ContainsKey(player.PlayerId)) NotifyRoles(SpecifySeer: player);
NotifyPetCD(Main.MinerCD, Options.MinerSSCD.GetInt());
break;
case CustomRoles.Disperser:
if (Main.DisperserCD.TryGetValue(player.PlayerId, out var dp) && dp + Disperser.DisperserShapeshiftCooldown.GetInt() < GetTimeStamp())
{
Main.DisperserCD.Remove(player.PlayerId);
NotifyRoles(SpecifySeer: player);
}
if (Main.DisperserCD.ContainsKey(player.PlayerId)) NotifyRoles(SpecifySeer: player);
NotifyPetCD(Main.DisperserCD, Disperser.DisperserShapeshiftCooldown.GetInt());
break;
case CustomRoles.Twister:
if (Main.TwisterCD.TryGetValue(player.PlayerId, out var ts) && ts + Twister.ShapeshiftCooldown.GetInt() < GetTimeStamp())
{
Main.TwisterCD.Remove(player.PlayerId);
NotifyRoles(SpecifySeer: player);
}
if (Main.TwisterCD.ContainsKey(player.PlayerId)) NotifyRoles(SpecifySeer: player);
NotifyPetCD(Main.TwisterCD, Twister.ShapeshiftCooldown.GetInt());
break;
case CustomRoles.QuickShooter:
if (Main.QuickShooterCD.TryGetValue(player.PlayerId, out var qs) && qs + QuickShooter.ShapeshiftCooldown.GetInt() < GetTimeStamp())
{
Main.QuickShooterCD.Remove(player.PlayerId);
NotifyRoles(SpecifySeer: player);
}
if (Main.QuickShooterCD.ContainsKey(player.PlayerId)) NotifyRoles(SpecifySeer: player);
NotifyPetCD(Main.QuickShooterCD, QuickShooter.ShapeshiftCooldown.GetInt());
break;
}
void NotifyPetCD(Dictionary<byte, long> data, int CD)
{
if (data.TryGetValue(player.PlayerId, out var timer) && timer + CD < GetTimeStamp())
{
data.Remove(player.PlayerId);
NotifyRoles(SpecifySeer: player, SpecifyTarget: player);
}
if (data.ContainsKey(player.PlayerId)) NotifyRoles(SpecifySeer: player, SpecifyTarget: player);
}
}
if (!lowLoad) Duellist.OnFixedUpdate();
@@ -2464,7 +2348,7 @@ class FixedUpdatePatch
else//否则删除
{
Main.RevolutionistTimer.Remove(player.PlayerId);
NotifyRoles(SpecifySeer: __instance);
NotifyRoles(SpecifySeer: __instance, SpecifyTarget: rv_target);
RPC.ResetCurrentDrawTarget(player.PlayerId);
Logger.Info($"Canceled: {__instance.GetNameWithRole().RemoveHtmlTags()}", "Revolutionist");
@@ -2489,7 +2373,7 @@ class FixedUpdatePatch
foreach (var pc in y.Where(x => x != null && x.IsAlive()))
{
pc.Suicide(PlayerState.DeathReason.Sacrifice);
NotifyRoles(SpecifySeer: pc);
NotifyRoles(SpecifySeer: pc, SpecifyTarget: pc);
}
player.Suicide(PlayerState.DeathReason.Sacrifice);
}
@@ -2690,8 +2574,8 @@ class FixedUpdatePatch
Main.PuppeteerList.Remove(player.PlayerId);
Main.PuppeteerDelayList.Remove(player.PlayerId);
Main.PuppeteerDelay.Remove(player.PlayerId);
NotifyRoles(SpecifySeer: player);
NotifyRoles(SpecifySeer: target);
NotifyRoles(SpecifySeer: player, SpecifyTarget: player);
NotifyRoles(SpecifySeer: target, SpecifyTarget: target);
}
}
}
@@ -3150,7 +3034,9 @@ class ExitVentPatch
{
public static void Postfix(Vent __instance, [HarmonyArgument(0)] PlayerControl pc)
{
Drainer.OnOtherPlayerExitVent(pc, __instance.Id);
Logger.Info($" {pc.GetNameWithRole()}, Vent ID: {__instance.Id} ({__instance.name})", "ExitVent");
Drainer.OnAnyoneExitVent(pc, __instance.Id);
}
}
[HarmonyPatch(typeof(Vent), nameof(Vent.EnterVent))]
@@ -3158,7 +3044,9 @@ class EnterVentPatch
{
public static void Postfix(Vent __instance, [HarmonyArgument(0)] PlayerControl pc)
{
Drainer.OnOtherPlayerEnterVent(pc, __instance.Id);
Logger.Info($" {pc.GetNameWithRole()}, Vent ID: {__instance.Id} ({__instance.name})", "EnterVent");
Drainer.OnAnyoneEnterVent(pc, __instance);
if (Witch.IsEnable) Witch.OnEnterVent(pc);
if (HexMaster.IsEnable) HexMaster.OnEnterVent(pc);
@@ -3193,7 +3081,7 @@ class EnterVentPatch
{
Main.MarioVentCount.TryAdd(pc.PlayerId, 0);
Main.MarioVentCount[pc.PlayerId]++;
NotifyRoles(SpecifySeer: pc);
NotifyRoles(SpecifySeer: pc, SpecifyTarget: pc);
if (pc.AmOwner)
{
// if (Main.MarioVentCount[pc.PlayerId] % 5 == 0) CustomSoundsManager.Play("MarioCoin");
@@ -3422,10 +3310,12 @@ class CoEnterVentPatch
{
if (!AmongUsClient.Instance.AmHost) return true;
Logger.Info($" {__instance.myPlayer.GetNameWithRole()}, Vent ID: {id}", "CoEnterVent");
if (Options.CurrentGameMode == CustomGameMode.FFA && FFAManager.FFA_DisableVentingWhenTwoPlayersAlive.GetBool() && Main.AllAlivePlayerControls.Length <= 2)
{
var pc = __instance.myPlayer;
if (pc.killTimer <= 0)
var pc = __instance?.myPlayer;
if (pc?.killTimer <= 0)
{
_ = new LateTask(() =>
{
@@ -3611,7 +3501,7 @@ class GameDataCompleteTaskPatch
{
Logger.Info($"TaskComplete: {pc.GetNameWithRole().RemoveHtmlTags()}", "CompleteTask");
Main.PlayerStates[pc.PlayerId].UpdateTask(pc);
NotifyRoles(SpecifySeer: pc);
NotifyRoles(SpecifySeer: pc, SpecifyTarget: pc);
}
}
[HarmonyPatch(typeof(PlayerControl), nameof(PlayerControl.CompleteTask))]
@@ -3633,7 +3523,7 @@ class PlayerControlCompleteTaskPatch
taskState.CompletedTasksCount++;
GameData.Instance.RpcSetTasks(player.PlayerId, Array.Empty<byte>()); //タスクを再配布
player.SyncSettings();
NotifyRoles(SpecifySeer: player);
NotifyRoles(SpecifySeer: player, SpecifyTarget: player);
return false;
}
+1 -1
View File
@@ -2832,7 +2832,7 @@
"## Drainer"
"Drainer","","Drainer","","",""
"DrainerInfo","","Drain Vents by Entering Them","","",""
"DrainerInfoLong","","(Crewmates):\nAs the Drainer, entering and exiting a vent will kill all players inside that vent.","","",""
"DrainerInfoLong","","(Crewmates):\nAs the Drainer, entering a vent will kill all players inside that vent and all connecting vents.","","",""
"## Camera Man"
"CameraMan","","Camera Man","","",""
Can't render this file because it is too large.
+1 -1
View File
@@ -72,7 +72,7 @@ public static class Workhorse
Add(pc.PlayerId);
GameData.Instance.RpcSetTasks(pc.PlayerId, System.Array.Empty<byte>()); //タスクを再配布
pc.SyncSettings();
Utils.NotifyRoles(SpecifySeer: pc);
Utils.NotifyRoles(SpecifySeer: pc, SpecifyTarget: pc);
}
return true;
+1 -1
View File
@@ -67,7 +67,7 @@ namespace TOHE.Roles.AddOns.Impostor
}
if (pc.IsModClient() && pc.PlayerId != 0) SendRPC();
NotifyRoles(SpecifySeer: pc);
NotifyRoles(SpecifySeer: pc, SpecifyTarget: pc);
}
public static void SendRPC()
+1 -1
View File
@@ -37,7 +37,7 @@ public static class LastImpostor
Add(pc.PlayerId);
SetKillCooldown();
pc.SyncSettings();
Utils.NotifyRoles(SpecifySeer: pc);
Utils.NotifyRoles(SpecifySeer: pc, SpecifyTarget: pc);
break;
}
}
+1 -1
View File
@@ -56,7 +56,7 @@ namespace TOHE.Roles.Crewmate
{
UseLimit[killer.PlayerId] -= 1;
ShieldedPlayers.TryAdd(target.PlayerId, GetTimeStamp());
NotifyRoles(SpecifySeer: killer);
NotifyRoles(SpecifySeer: killer, SpecifyTarget: target);
return false;
}
else
+34 -18
View File
@@ -1,12 +1,9 @@
using System;
using Hazel;
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 static TOHE.Utils;
namespace TOHE.Roles.Crewmate
{
@@ -46,22 +43,23 @@ namespace TOHE.Roles.Crewmate
.SetParent(CustomRoleSpawnChances[CustomRoles.Analyzer]);
}
public static bool CanUseKillButton =>
public static bool CanUseKillButton => CurrentTarget.Item1 == byte.MaxValue;
public static bool IsEnable => playerId != byte.MaxValue;
private static string GetRoleBasis(CustomRoles role)
{
var DYRole = role.GetDYRole();
var VNRole = role.GetVNRole();
if (DYRole == AmongUs.GameOptions.RoleTypes.Impostor) return ColorString(GetRoleColor(CustomRoles.Impostor), GetString("Impostor"));
else return VNRole switch
{
CustomRoles.Impostor => ColorString(GetRoleColor(CustomRoles.Impostor), GetString("Impostor")),
CustomRoles.Shapeshifter => ColorString(GetRoleColor(CustomRoles.Speedrunner), GetString("Shapeshifter")),
CustomRoles.Crewmate => ColorString(GetRoleColor(CustomRoles.Crewmate), GetString("Crewmate")),
CustomRoles.Engineer => ColorString(GetRoleColor(CustomRoles.Autocrat), GetString("Engineer")),
CustomRoles.Scientist => ColorString(GetRoleColor(CustomRoles.Doctor), GetString("Scientist")),
_ => string.Empty
};
return role.GetDYRole() == AmongUs.GameOptions.RoleTypes.Impostor
? ColorString(GetRoleColor(CustomRoles.Impostor), GetString("Impostor"))
: role.GetVNRole() switch
{
CustomRoles.Impostor => ColorString(GetRoleColor(CustomRoles.Impostor), GetString("Impostor")),
CustomRoles.Shapeshifter => ColorString(GetRoleColor(CustomRoles.Speedrunner), GetString("Shapeshifter")),
CustomRoles.Crewmate => ColorString(GetRoleColor(CustomRoles.Crewmate), GetString("Crewmate")),
CustomRoles.Engineer => ColorString(GetRoleColor(CustomRoles.Autocrat), GetString("Engineer")),
CustomRoles.Scientist => ColorString(GetRoleColor(CustomRoles.Doctor), GetString("Scientist")),
_ => string.Empty
};
}
private static int GetKillCount(byte id) => Main.PlayerStates.Count(x => x.Value.GetRealKiller() == id);
@@ -126,5 +124,23 @@ namespace TOHE.Roles.Crewmate
VentCount.Add(key, value);
}
}
public static void OnCheckMurder(PlayerControl killer, PlayerControl target)
{
if (killer == null || target == null) return;
if (UseLimit <= 0) return;
if (CurrentTarget.Item1 != byte.MaxValue) return;
UseLimit--;
CurrentTarget = (target.PlayerId, GetTimeStamp());
killer.SetKillCooldown(time: Duration.GetFloat());
NotifyRoles(SpecifySeer: killer, SpecifyTarget: target);
}
public static void OnFixedUpdate(PlayerControl pc)
{
if (pc == null) return;
if ()
}
}
}
+26 -21
View File
@@ -39,65 +39,69 @@ namespace TOHE.Roles.Crewmate
playersInVents = [];
DrainLimit = 0;
}
public static void Add(byte playerId)
{
playerIdList.Add(playerId);
DrainLimit = UseLimit.GetInt();
}
public static void ApplyGameOptions(IGameOptions opt)
{
AURoleOptions.EngineerCooldown = VentCD.GetFloat();
}
public static bool IsEnable => playerIdList.Any();
public static void SendRPC()
{
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.SetDrainerLimit, SendOption.Reliable, -1);
writer.Write(DrainLimit);
AmongUsClient.Instance.FinishRpcImmediately(writer);
}
public static void ReceiveRPC(MessageReader reader)
{
DrainLimit = reader.ReadInt32();
}
public static void OnEnterVent(PlayerControl pc, int ventId)
public static void OnAnyoneExitVent(PlayerControl pc, int ventId)
{
if (pc != null) playersInVents.Remove(pc.PlayerId);
}
public static void OnDrainerEnterVent(PlayerControl pc, Vent vent)
{
if (pc == null) return;
if (!pc.Is(CustomRoles.Drainer)) return;
if (DrainLimit <= 0) return;
DrainLimit--;
KillPlayersInVent(pc, ventId);
foreach (var ventToDrain in vent.NearbyVents.ToArray())
{
KillPlayersInVent(pc, ventToDrain.Id);
}
}
public static void OnOtherPlayerEnterVent(PlayerControl pc, int ventId)
{
OnEnterVent(pc, ventId);
if (pc == null) return;
if (pc.Is(CustomRoles.Drainer)) return;
playersInVents.TryAdd(pc.PlayerId, ventId);
}
public static void OnExitVent(PlayerControl pc, int ventId)
public static void OnAnyoneEnterVent(PlayerControl pc, Vent vent)
{
if (pc == null) return;
if (!pc.Is(CustomRoles.Drainer)) return;
if (pc.Is(CustomRoles.Drainer))
{
OnDrainerEnterVent(pc, vent);
return;
}
KillPlayersInVent(pc, ventId);
playersInVents.Add(pc.PlayerId, vent.Id);
}
public static void OnOtherPlayerExitVent(PlayerControl pc, int ventId)
{
OnExitVent(pc, ventId);
if (pc == null) return;
if (pc.Is(CustomRoles.Drainer)) return;
playersInVents.Remove(pc.PlayerId);
}
public static string GetProgressText() => $"<color=#777777>-</color> <color=#ffffff>{DrainLimit}</color>";
private static void KillPlayersInVent(PlayerControl pc, int ventId)
{
if (!playersInVents.ContainsValue(ventId)) return;
foreach (var venterId in playersInVents.Where(x => x.Value == ventId))
foreach (var venterId in playersInVents.Where(x => x.Value == ventId).ToArray())
{
var venter = Utils.GetPlayerById(venterId.Key);
if (venter == null) continue;
@@ -112,6 +116,7 @@ namespace TOHE.Roles.Crewmate
}
}
}
public static void OnReportDeadBody()
{
playersInVents.Clear();
+1 -1
View File
@@ -139,7 +139,7 @@ namespace TOHE.Roles.Crewmate
Main.FarseerTimer.Remove(player.PlayerId);//塗が完了したのでDictionaryから削除
Main.isRevealed[(player.PlayerId, ar_target.PlayerId)] = true;//塗り完了
player.RpcSetRevealtPlayer(ar_target, true);
NotifyRoles(SpecifySeer: player);//名前変更
NotifyRoles(SpecifySeer: player, SpecifyTarget: ar_target);//名前変更
RPC.ResetCurrentRevealTarget(player.PlayerId);
}
else
+3 -3
View File
@@ -152,8 +152,8 @@ public static class Medic
break;
}
Utils.NotifyRoles(SpecifySeer: killer);
Utils.NotifyRoles(SpecifySeer: target);
Utils.NotifyRoles(SpecifySeer: killer, SpecifyTarget: target);
Utils.NotifyRoles(SpecifySeer: target, SpecifyTarget: killer);
Logger.Info($"{killer.GetNameWithRole().RemoveHtmlTags()} : {ProtectLimit[killer.PlayerId]} shields left", "Medic");
}
@@ -167,7 +167,7 @@ public static class Medic
//killer.RpcGuardAndKill(target);
killer.SetKillCooldown(ResetCooldown.GetFloat());
Utils.NotifyRoles(SpecifySeer: target);
Utils.NotifyRoles(SpecifySeer: target, SpecifyTarget: killer);
switch (KnowShieldBroken.GetInt())
{
+2 -2
View File
@@ -213,8 +213,8 @@ namespace TOHE.Roles.Crewmate
target.Notify(Utils.ColorString(Utils.GetRoleColor(CustomRoles.Merchant), GetString("MerchantAddonSell")));
player.Notify(Utils.ColorString(Utils.GetRoleColor(CustomRoles.Merchant), GetString("MerchantAddonDelivered")));
Utils.NotifyRoles(SpecifySeer: player);
Utils.NotifyRoles(SpecifySeer: target);
Utils.NotifyRoles(SpecifySeer: player, SpecifyTarget: target);
Utils.NotifyRoles(SpecifySeer: target, SpecifyTarget: player);
addonsSold[player.PlayerId] += 1;
}
+2 -2
View File
@@ -65,8 +65,8 @@ public static class Monarch
killer.Notify(Utils.ColorString(Utils.GetRoleColor(CustomRoles.Monarch), GetString("MonarchKnightedPlayer")));
target.Notify(Utils.ColorString(Utils.GetRoleColor(CustomRoles.Monarch), GetString("KnightedByMonarch")));
Utils.NotifyRoles(SpecifySeer: killer);
Utils.NotifyRoles(SpecifySeer: target);
Utils.NotifyRoles(SpecifySeer: killer, SpecifyTarget: target);
Utils.NotifyRoles(SpecifySeer: target, SpecifyTarget: killer);
killer.ResetKillCooldown();
killer.SetKillCooldown();
+4 -3
View File
@@ -120,10 +120,11 @@ internal class Monitor
if (isChange)
{
foreach (byte pc in playerIdList.ToArray())
foreach (byte id in playerIdList.ToArray())
{
Utils.NotifyRoles(SpecifySeer: Utils.GetPlayerById(pc));
FixedUpdatePatch.Postfix(Utils.GetPlayerById(pc));
PlayerControl pc = Utils.GetPlayerById(id);
Utils.NotifyRoles(SpecifySeer: pc, SpecifyTarget: pc);
FixedUpdatePatch.Postfix(pc);
}
}
}
+1 -1
View File
@@ -83,7 +83,7 @@ internal static class NiceEraser
Utils.SendMessage(string.Format(GetString("EraserEraseNotice"), target.GetRealName()), player.PlayerId, Utils.ColorString(Utils.GetRoleColor(CustomRoles.NiceEraser), GetString("EraserEraseMsgTitle")));
Utils.NotifyRoles(SpecifySeer: player);
Utils.NotifyRoles(SpecifySeer: player, SpecifyTarget: target);
}
public static void OnReportDeadBody()
{
+1 -1
View File
@@ -100,7 +100,7 @@ namespace TOHE.Roles.Crewmate
SendAbilityRPC(target.PlayerId);
SpyRedNameList.TryAdd(killer.PlayerId, GetTimeStamp());
SendRPC(killer.PlayerId);
NotifyRoles(SpecifySeer: target);
NotifyRoles(SpecifySeer: target, SpecifyTarget: killer);
}
}
public static void OnFixedUpdate(PlayerControl pc)
+1 -1
View File
@@ -55,6 +55,6 @@ public static class SwordsMan
killed.Add(killer.PlayerId);
Logger.Info($"{killer.GetNameWithRole().RemoveHtmlTags()} : " + (IsKilled(killer.PlayerId) ? "已使用击杀机会" : "未使用击杀机会"), "SwordsMan");
SetKillCooldown(killer.PlayerId);
Utils.NotifyRoles(SpecifySeer: killer);
Utils.NotifyRoles(SpecifySeer: killer, SpecifyTarget: killer);
}
}
+6 -6
View File
@@ -102,14 +102,14 @@ public static class Tracefinder
{
if (GameStates.IsInTask)
{
foreach (byte pc in playerIdList.ToArray())
foreach (byte id in playerIdList.ToArray())
{
var player = Utils.GetPlayerById(pc);
if (player == null || !player.IsAlive())
PlayerControl pc = Utils.GetPlayerById(id);
if (pc == null || !pc.IsAlive())
continue;
LocateArrow.Add(pc, target.transform.position);
SendRPC(pc, true, target.transform.position);
Utils.NotifyRoles(SpecifySeer: Utils.GetPlayerById(pc));
LocateArrow.Add(id, target.transform.position);
SendRPC(id, true, target.transform.position);
Utils.NotifyRoles(SpecifySeer: pc, SpecifyTarget: pc);
}
}
}, delay, "Tracefinder arrow delay");
+4 -3
View File
@@ -118,10 +118,11 @@ internal class AntiAdminer
if (isChange)
{
foreach (byte pc in playerIdList.ToArray())
foreach (byte id in playerIdList.ToArray())
{
Utils.NotifyRoles(SpecifySeer: Utils.GetPlayerById(pc));
FixedUpdatePatch.Postfix(Utils.GetPlayerById(pc));
PlayerControl pc = Utils.GetPlayerById(id);
Utils.NotifyRoles(SpecifySeer: pc, SpecifyTarget: pc);
FixedUpdatePatch.Postfix(pc);
}
}
}
+2 -2
View File
@@ -89,8 +89,8 @@ public static class BallLightning
SendRPC(target.PlayerId);
RealKiller.TryAdd(target.PlayerId, killer);
if (!killer.inVent) killer.SetKillCooldown();
Utils.NotifyRoles(SpecifySeer: killer);
Utils.NotifyRoles(SpecifySeer: target);
Utils.NotifyRoles(SpecifySeer: killer, SpecifyTarget: target);
Utils.NotifyRoles(SpecifySeer: target, SpecifyTarget: killer);
Logger.Info($"{target.GetNameWithRole().RemoveHtmlTags()} 转化为量子幽灵", "BallLightning");
}
}, ConvertTime.GetFloat(), "BallLightning Convert Player To Ghost");
+9 -10
View File
@@ -21,8 +21,7 @@ public static class BountyHunter
private static float FailureKillCooldown;
private static bool ShowTargetArrow;
private static int Timer;
private static Dictionary<byte, int> Timer;
public static Dictionary<byte, byte> Targets = [];
public static Dictionary<byte, float> ChangeTimer = [];
@@ -55,7 +54,7 @@ public static class BountyHunter
FailureKillCooldown = OptionFailureKillCooldown.GetFloat();
ShowTargetArrow = OptionShowTargetArrow.GetBool();
Timer = (int)TargetChangeTime;
Timer[playerId] = (int)TargetChangeTime;
if (AmongUsClient.Instance.AmHost)
ResetTarget(Utils.GetPlayerById(playerId));
@@ -117,15 +116,15 @@ public static class BountyHunter
var targetId = GetTarget(player);
if (ChangeTimer[player.PlayerId] >= TargetChangeTime)//時間経過でターゲットをリセットする処理
{
ResetTarget(player);//ターゲットの選びなおし
Utils.NotifyRoles(SpecifySeer: player);
var newTargetId = ResetTarget(player);//ターゲットの選びなおし
Utils.NotifyRoles(SpecifySeer: player, SpecifyTarget: Utils.GetPlayerById(newTargetId));
}
if (ChangeTimer[player.PlayerId] >= 0)
{
ChangeTimer[player.PlayerId] += Time.fixedDeltaTime;
int tempTimer = Timer;
Timer = (int)(TargetChangeTime - ChangeTimer[player.PlayerId]);
if (tempTimer != Timer && Timer <= 15 && !player.IsModClient()) Utils.NotifyRoles(SpecifySeer: player);
int tempTimer = Timer[player.PlayerId];
Timer[player.PlayerId] = (int)(TargetChangeTime - ChangeTimer[player.PlayerId]);
if (tempTimer != Timer[player.PlayerId] && Timer[player.PlayerId] <= 15 && !player.IsModClient()) Utils.NotifyRoles(SpecifySeer: player, SpecifyTarget: player);
}
@@ -160,7 +159,7 @@ public static class BountyHunter
var playerId = player.PlayerId;
ChangeTimer[playerId] = 0f;
Timer = (int)TargetChangeTime;
Timer[playerId] = (int)TargetChangeTime;
Logger.Info($"{player.GetNameWithRole().RemoveHtmlTags()}:ターゲットリセット", "BountyHunter");
//player.RpcResetAbilityCooldown(); ;//タイマー(変身クールダウン)のリセットと
@@ -195,7 +194,7 @@ public static class BountyHunter
if (!Main.PlayerStates[id].IsDead)
{
ChangeTimer[id] = 0f;
Timer = (int)TargetChangeTime;
Timer[id] = (int)TargetChangeTime;
if (Utils.GetPlayerById(id).GetCustomRole() == CustomRoles.BountyHunter)
{
Main.AllPlayerKillCooldown[id] = Options.DefaultKillCooldown;
+2 -2
View File
@@ -76,8 +76,8 @@ namespace TOHE.Roles.Impostor
PlayerSkinsCosumed[pc.PlayerId].Add(target.PlayerId);
pc.Notify(Utils.ColorString(Utils.GetRoleColor(CustomRoles.Devourer), GetString("DevourerEatenSkin")));
target.Notify(Utils.ColorString(Utils.GetRoleColor(CustomRoles.Devourer), GetString("EatenByDevourer")));
Utils.NotifyRoles(SpecifySeer: pc);
Utils.NotifyRoles(SpecifySeer: target);
Utils.NotifyRoles(SpecifySeer: pc, SpecifyTarget: target);
Utils.NotifyRoles(SpecifySeer: target, SpecifyTarget: pc);
OriginalPlayerSkins.Add(target.PlayerId, Camouflage.PlayerSkins[target.PlayerId]);
Camouflage.PlayerSkins[target.PlayerId] = ConsumedOutfit;
+1 -1
View File
@@ -129,7 +129,7 @@ internal static class Eraser
Utils.SendMessage(string.Format(GetString("EraserEraseNotice"), target.GetRealName()), player.PlayerId, Utils.ColorString(Utils.GetRoleColor(CustomRoles.Eraser), GetString("EraserEraseMsgTitle")));
Utils.NotifyRoles(SpecifySeer: player);
Utils.NotifyRoles(SpecifySeer: player, SpecifyTarget: target);
}
public static void OnReportDeadBody()
{
+1 -1
View File
@@ -102,7 +102,7 @@ namespace TOHE.Roles.Impostor
DivinationCount[killer.PlayerId] -= 1;
DivinationTarget[killer.PlayerId].Add(target.PlayerId);
Logger.Info($"{killer.GetNameWithRole().RemoveHtmlTags()}:占った 占い先→{target.GetNameWithRole().RemoveHtmlTags()} || 残り{DivinationCount[killer.PlayerId]}回", "EvilDiviner");
Utils.NotifyRoles(SpecifySeer: killer);
Utils.NotifyRoles(SpecifySeer: killer, SpecifyTarget: target);
SendRPC(killer.PlayerId, target.PlayerId);
//キルクールの適正化
+2 -2
View File
@@ -118,8 +118,8 @@ public static class EvilTracker
SetTarget(shapeshifter.PlayerId, target.PlayerId);
Logger.Info($"{shapeshifter.GetNameWithRole().RemoveHtmlTags()}のターゲットを{target.GetNameWithRole().RemoveHtmlTags()}に設定", "EvilTrackerTarget");
shapeshifter.MarkDirtySettings();
Utils.NotifyRoles(SpecifySeer: shapeshifter);
Utils.NotifyRoles(SpecifySeer: target);
Utils.NotifyRoles(SpecifySeer: shapeshifter, SpecifyTarget: target);
Utils.NotifyRoles(SpecifySeer: target, SpecifyTarget: shapeshifter);
}
public static void AfterMeetingTasks()
{
+1 -1
View File
@@ -162,7 +162,7 @@ public static class FireWorks
Logger.Info("爆破準備OK", "FireWorks");
state[pc.PlayerId] = FireWorksState.ReadyFire;
SendRPC(pc.PlayerId);
Utils.NotifyRoles(SpecifySeer: pc);
Utils.NotifyRoles(SpecifySeer: pc, SpecifyTarget: pc);
}
switch (state[pc.PlayerId])
{
+12 -12
View File
@@ -87,8 +87,8 @@ public static class Gangster
killer.Notify(Utils.ColorString(Utils.GetRoleColor(CustomRoles.Gangster), GetString("GangsterSuccessfullyRecruited")));
target.Notify(Utils.ColorString(Utils.GetRoleColor(CustomRoles.Gangster), GetString("BeRecruitedByGangster")));
Utils.NotifyRoles(SpecifySeer: killer);
Utils.NotifyRoles(SpecifySeer: target);
Utils.NotifyRoles(SpecifySeer: killer, SpecifyTarget: target);
Utils.NotifyRoles(SpecifySeer: target, SpecifyTarget: killer);
killer.ResetKillCooldown();
killer.SetKillCooldown();
@@ -110,8 +110,8 @@ public static class Gangster
killer.Notify(Utils.ColorString(Utils.GetRoleColor(CustomRoles.Recruit), GetString("GangsterSuccessfullyRecruited")));
target.Notify(Utils.ColorString(Utils.GetRoleColor(CustomRoles.Recruit), GetString("BeRecruitedByGangster")));
Utils.NotifyRoles(SpecifySeer: killer);
Utils.NotifyRoles(SpecifySeer: target);
Utils.NotifyRoles(SpecifySeer: killer, SpecifyTarget: target);
Utils.NotifyRoles(SpecifySeer: target, SpecifyTarget: killer);
killer.ResetKillCooldown();
killer.SetKillCooldown();
@@ -133,8 +133,8 @@ public static class Gangster
killer.Notify(Utils.ColorString(Utils.GetRoleColor(CustomRoles.Admired), GetString("GangsterSuccessfullyRecruited")));
target.Notify(Utils.ColorString(Utils.GetRoleColor(CustomRoles.Admired), GetString("BeRecruitedByGangster")));
Utils.NotifyRoles(SpecifySeer: killer);
Utils.NotifyRoles(SpecifySeer: target);
Utils.NotifyRoles(SpecifySeer: killer, SpecifyTarget: target);
Utils.NotifyRoles(SpecifySeer: target, SpecifyTarget: killer);
killer.ResetKillCooldown();
killer.SetKillCooldown();
@@ -156,8 +156,8 @@ public static class Gangster
killer.Notify(Utils.ColorString(Utils.GetRoleColor(CustomRoles.Charmed), GetString("GangsterSuccessfullyRecruited")));
target.Notify(Utils.ColorString(Utils.GetRoleColor(CustomRoles.Charmed), GetString("BeRecruitedByGangster")));
Utils.NotifyRoles(SpecifySeer: killer);
Utils.NotifyRoles(SpecifySeer: target);
Utils.NotifyRoles(SpecifySeer: killer, SpecifyTarget: target);
Utils.NotifyRoles(SpecifySeer: target, SpecifyTarget: killer);
killer.ResetKillCooldown();
killer.SetKillCooldown();
@@ -179,8 +179,8 @@ public static class Gangster
killer.Notify(Utils.ColorString(Utils.GetRoleColor(CustomRoles.Infected), GetString("GangsterSuccessfullyRecruited")));
target.Notify(Utils.ColorString(Utils.GetRoleColor(CustomRoles.Infected), GetString("BeRecruitedByGangster")));
Utils.NotifyRoles(SpecifySeer: killer);
Utils.NotifyRoles(SpecifySeer: target);
Utils.NotifyRoles(SpecifySeer: killer, SpecifyTarget: target);
Utils.NotifyRoles(SpecifySeer: target, SpecifyTarget: killer);
killer.ResetKillCooldown();
killer.SetKillCooldown();
@@ -202,8 +202,8 @@ public static class Gangster
killer.Notify(Utils.ColorString(Utils.GetRoleColor(CustomRoles.Contagious), GetString("GangsterSuccessfullyRecruited")));
target.Notify(Utils.ColorString(Utils.GetRoleColor(CustomRoles.Contagious), GetString("BeRecruitedByGangster")));
Utils.NotifyRoles(SpecifySeer: killer);
Utils.NotifyRoles(SpecifySeer: target);
Utils.NotifyRoles(SpecifySeer: killer, SpecifyTarget: target);
Utils.NotifyRoles(SpecifySeer: target, SpecifyTarget: killer);
killer.ResetKillCooldown();
killer.SetKillCooldown();
+1 -1
View File
@@ -87,7 +87,7 @@ namespace TOHE.Roles.Impostor
targetId = target.PlayerId;
SendRPC(targetId);
NotifyRoles(SpecifySeer: hitman);
NotifyRoles(SpecifySeer: hitman, SpecifyTarget: hitman);
//_ = new LateTask(() => { hitman.CmdCheckRevertShapeshift(false); }, 1.5f, "Hitman RpcRevertShapeshift");
}
+3 -3
View File
@@ -150,7 +150,7 @@ namespace TOHE.Roles.Impostor
if (before1CD != Pistol1CD || before2CD != Pistol2CD)
{
NotifyRoles(SpecifySeer: pc);
NotifyRoles(SpecifySeer: pc, SpecifyTarget: pc);
SendRPCSyncPistolCD();
Logger.Info($"Pistol 1 CD: {Pistol1CD}; Pistol 2 CD: {Pistol2CD}", "debug");
}
@@ -170,12 +170,12 @@ namespace TOHE.Roles.Impostor
if (Pistol1CD <= 0 && Pistol2CD > 0)
{
Pistol1CD = KCD;
NotifyRoles(SpecifySeer: killer);
NotifyRoles(SpecifySeer: killer, SpecifyTarget: killer);
}
if (Pistol2CD <= 0 && Pistol1CD > 0)
{
Pistol2CD = KCD;
NotifyRoles(SpecifySeer: killer);
NotifyRoles(SpecifySeer: killer, SpecifyTarget: killer);
}
if (Tier >= 5)
+3 -2
View File
@@ -60,7 +60,7 @@ namespace TOHE.Roles.Impostor
if (target.HasKillButton() || target.GetPlayerTaskState().hasTasks)
{
ManipulateDelays.TryAdd(target.PlayerId, GetTimeStamp());
NotifyRoles(SpecifySeer: GetPlayerById(playerIdList[0]));
NotifyRoles(SpecifySeer: killer, SpecifyTarget: target);
}
});
}
@@ -90,7 +90,8 @@ namespace TOHE.Roles.Impostor
pc.SetKillCooldown(time: 1f);
}
NotifyRoles(SpecifySeer: GetPlayerById(playerIdList[0]));
PlayerControl mastermind = GetPlayerById(playerIdList[0]);
NotifyRoles(SpecifySeer: mastermind, SpecifyTarget: mastermind);
}
}
+1 -1
View File
@@ -191,7 +191,7 @@ namespace TOHE.Roles.Impostor
default:
break;
}
if (GameStates.IsInTask) Utils.NotifyRoles(SpecifySeer: target);
if (GameStates.IsInTask) Utils.NotifyRoles(SpecifySeer: target, SpecifyTarget: target);
}, Delay.GetInt(), "Nullifier Remove Ability Use");
});
}
+11 -12
View File
@@ -13,7 +13,7 @@ public static class SerialKiller
public static OptionItem TimeLimit;
public static OptionItem WaitFor1Kill;
private static int Timer;
private static Dictionary<byte, int> Timer;
public static Dictionary<byte, float> SuicideTimer = [];
@@ -34,7 +34,7 @@ public static class SerialKiller
public static void Add(byte serial)
{
playerIdList.Add(serial);
Timer = TimeLimit.GetInt();
Timer[serial] = TimeLimit.GetInt();
}
public static bool IsEnable() => playerIdList.Any();
public static void ApplyKillCooldown(byte id) => Main.AllPlayerKillCooldown[id] = KillCooldown.GetFloat();
@@ -52,14 +52,13 @@ public static class SerialKiller
{
if (!killer.Is(CustomRoles.SerialKiller)) return;
SuicideTimer.Remove(killer.PlayerId);
Timer = TimeLimit.GetInt();
if (CanMurder)
killer.MarkDirtySettings();
Timer[killer.PlayerId] = TimeLimit.GetInt();
if (CanMurder) killer.MarkDirtySettings();
}
public static void OnReportDeadBody()
{
SuicideTimer.Clear();
Timer = TimeLimit.GetInt();
foreach (var kvp in Timer) Timer[kvp.Key] = TimeLimit.GetInt();
}
public static void FixedUpdate(PlayerControl player)
{
@@ -67,7 +66,7 @@ public static class SerialKiller
if (!HasKilled(player))
{
SuicideTimer.Remove(player.PlayerId);
Timer = TimeLimit.GetInt();
Timer[player.PlayerId] = TimeLimit.GetInt();
return;
}
if (!SuicideTimer.ContainsKey(player.PlayerId)) //タイマーがない
@@ -81,14 +80,14 @@ public static class SerialKiller
Main.PlayerStates[player.PlayerId].deathReason = PlayerState.DeathReason.Suicide;//死因:自殺
player.Kill(player);//自殺させる
SuicideTimer.Remove(player.PlayerId);
Timer = TimeLimit.GetInt();
Timer[player.PlayerId] = TimeLimit.GetInt();
}
else
{
SuicideTimer[player.PlayerId] += Time.fixedDeltaTime;
int tempTimer = Timer;
Timer = TimeLimit.GetInt() - (int)SuicideTimer[player.PlayerId];
if (Timer != tempTimer && Timer <= 20 && !player.IsModClient()) Utils.NotifyRoles(SpecifySeer: player);
int tempTimer = Timer[player.PlayerId];
Timer[player.PlayerId] = TimeLimit.GetInt() - (int)SuicideTimer[player.PlayerId];
if (Timer[player.PlayerId] != tempTimer && Timer[player.PlayerId] <= 20 && !player.IsModClient()) Utils.NotifyRoles(SpecifySeer: player);
}
//時間をカウント
}
@@ -108,7 +107,7 @@ public static class SerialKiller
if (HasKilled(pc))
{
SuicideTimer[id] = 0f;
Timer = TimeLimit.GetInt();
Timer[id] = TimeLimit.GetInt();
}
}
+1 -1
View File
@@ -282,7 +282,7 @@ public static class Sniper
else
{
AimTime[sniperId] += Time.fixedDeltaTime;
Utils.NotifyRoles(SpecifySeer: sniper);
Utils.NotifyRoles(SpecifySeer: sniper, SpecifyTarget: sniper);
}
}
public static void OnReportDeadBody()
+1 -1
View File
@@ -146,7 +146,7 @@ namespace TOHE.Roles.Impostor
}
darkenTimer = darkenDuration;
RpcDarken(null);
Utils.NotifyRoles(SpecifySeer: Utils.GetPlayerById(playerIdList[0]));
Utils.NotifyRoles(SpecifySeer: Utils.GetPlayerById(playerIdList[0]), SpecifyTarget: Utils.GetPlayerById(playerIdList[0]));
}
public static string GetSuffix(PlayerControl seer, PlayerControl seen = null, bool isForMeeting = false, bool isHUD = false)
+1 -1
View File
@@ -112,7 +112,7 @@ public static class Witch
{
SpellMode[playerId] = !SpellMode[playerId];
SendRPC(false, playerId);
Utils.NotifyRoles(SpecifySeer: Utils.GetPlayerById(playerId));
Utils.NotifyRoles(SpecifySeer: Utils.GetPlayerById(playerId), SpecifyTarget: Utils.GetPlayerById(playerId));
}
}
public static bool HaveSpelledPlayer()
+11 -8
View File
@@ -147,8 +147,9 @@ public static class Amnesiac
killer.Notify(Utils.ColorString(Utils.GetRoleColor(CustomRoles.Amnesiac), GetString("RememberedPursuer")));
target.Notify(Utils.ColorString(Utils.GetRoleColor(CustomRoles.Amnesiac), GetString("AmnesiacRemembered")));
Utils.NotifyRoles(SpecifySeer: killer);
Utils.NotifyRoles(SpecifySeer: target);
Utils.NotifyRoles(SpecifySeer: killer, SpecifyTarget: target, ForceLoop: true);
Utils.NotifyRoles(SpecifySeer: target, SpecifyTarget: killer, ForceLoop: true);
Pursuer.Add(killer.PlayerId);
@@ -170,8 +171,9 @@ public static class Amnesiac
killer.Notify(Utils.ColorString(Utils.GetRoleColor(CustomRoles.Amnesiac), GetString("RememberedFollower")));
target.Notify(Utils.ColorString(Utils.GetRoleColor(CustomRoles.Amnesiac), GetString("AmnesiacRemembered")));
Utils.NotifyRoles(SpecifySeer: killer);
Utils.NotifyRoles(SpecifySeer: target);
Utils.NotifyRoles(SpecifySeer: killer, SpecifyTarget: target, ForceLoop: true);
Utils.NotifyRoles(SpecifySeer: target, SpecifyTarget: killer, ForceLoop: true);
Totocalcio.Add(killer.PlayerId);
@@ -193,9 +195,9 @@ public static class Amnesiac
killer.Notify(Utils.ColorString(Utils.GetRoleColor(CustomRoles.Amnesiac), GetString("RememberedMaverick")));
target.Notify(Utils.ColorString(Utils.GetRoleColor(CustomRoles.Amnesiac), GetString("AmnesiacRemembered")));
Utils.NotifyRoles(SpecifySeer: killer);
Utils.NotifyRoles(SpecifySeer: target);
Utils.NotifyRoles(SpecifySeer: killer, SpecifyTarget: target, ForceLoop: true);
Utils.NotifyRoles(SpecifySeer: target, SpecifyTarget: killer, ForceLoop: true);
killer.ResetKillCooldown();
killer.SetKillCooldown();
@@ -242,8 +244,9 @@ public static class Amnesiac
killer.Notify(Utils.ColorString(Utils.GetRoleColor(CustomRoles.Amnesiac), GetString("RememberedCrewmate")));
target.Notify(Utils.ColorString(Utils.GetRoleColor(CustomRoles.Amnesiac), GetString("AmnesiacRemembered")));
Utils.NotifyRoles(SpecifySeer: killer);
Utils.NotifyRoles(SpecifySeer: target);
Utils.NotifyRoles(SpecifySeer: killer, SpecifyTarget: target, ForceLoop: true);
Utils.NotifyRoles(SpecifySeer: target, SpecifyTarget: killer, ForceLoop: true);
Sheriff.Add(killer.PlayerId);
+3 -2
View File
@@ -72,8 +72,9 @@ public static class CursedSoul
killer.Notify(Utils.ColorString(Utils.GetRoleColor(CustomRoles.CursedSoul), GetString("CursedSoulSoullessPlayer")));
target.Notify(Utils.ColorString(Utils.GetRoleColor(CustomRoles.CursedSoul), GetString("SoullessByCursedSoul")));
Utils.NotifyRoles(SpecifySeer: killer);
Utils.NotifyRoles(SpecifySeer: target);
Utils.NotifyRoles(SpecifySeer: killer, SpecifyTarget: target, ForceLoop: true);
Utils.NotifyRoles(SpecifySeer: target, SpecifyTarget: killer, ForceLoop: true);
killer.ResetKillCooldown();
killer.SetKillCooldown();
+2 -2
View File
@@ -134,8 +134,8 @@ public static class Executioner
Utils.GetPlayerById(Executioner).RpcSetCustomRole(CRoleChangeRoles[ChangeRolesAfterTargetKilled.GetValue()]);
Target.Remove(Executioner);
SendRPC(Executioner);
Utils.NotifyRoles(SpecifySeer: Utils.GetPlayerById(Executioner));
Utils.NotifyRoles(SpecifySeer: target);
Utils.NotifyRoles(SpecifySeer: Utils.GetPlayerById(Executioner), SpecifyTarget: target);
Utils.NotifyRoles(SpecifySeer: target, SpecifyTarget: Utils.GetPlayerById(Executioner));
}
public static void ChangeRole(PlayerControl executioner)
{
+4 -4
View File
@@ -95,14 +95,14 @@ public static class Gamer
{
PlayerHealth.Remove(target.PlayerId);
killer.Kill(target);
Utils.NotifyRoles(SpecifySeer: killer);
Utils.NotifyRoles(SpecifySeer: killer, SpecifyTarget: target);
return false;
}
PlayerHealth[target.PlayerId] -= Damage.GetInt();
SendRPC(target.PlayerId);
RPC.PlaySoundRPC(killer.PlayerId, Sounds.KillSound);
Utils.NotifyRoles(SpecifySeer: killer);
Utils.NotifyRoles(SpecifySeer: killer, SpecifyTarget: target);
Logger.Info($"{killer.GetNameWithRole().RemoveHtmlTags()} 对玩家 {target.GetNameWithRole().RemoveHtmlTags()} 造成了 {Damage.GetInt()} 点伤害", "Gamer");
return true;
@@ -114,7 +114,7 @@ public static class Gamer
if (GamerHealth[target.PlayerId] - SelfDamage.GetInt() < 1)
{
GamerHealth.Remove(target.PlayerId);
Utils.NotifyRoles(SpecifySeer: target);
Utils.NotifyRoles(SpecifySeer: target, SpecifyTarget: killer);
return true;
}
@@ -124,7 +124,7 @@ public static class Gamer
SendRPC(target.PlayerId);
RPC.PlaySoundRPC(target.PlayerId, Sounds.KillSound);
//killer.RpcGuardAndKill(target);
Utils.NotifyRoles(SpecifySeer: target);
Utils.NotifyRoles(SpecifySeer: target, SpecifyTarget: killer);
Logger.Info($"{killer.GetNameWithRole().RemoveHtmlTags()} 对玩家 {target.GetNameWithRole().RemoveHtmlTags()} 造成了 {SelfDamage.GetInt()} 点伤害", "Gamer");
return false;
+2 -2
View File
@@ -220,7 +220,7 @@ public static class Glitch
{
if (HackCDTimer <= 0)
{
Utils.NotifyRoles(SpecifySeer: killer);
Utils.NotifyRoles(SpecifySeer: killer, SpecifyTarget: target);
HackCDTimer = HackCooldown.GetInt();
hackedIdList.TryAdd(target.PlayerId, Utils.GetTimeStamp());
LastHack = Utils.GetTimeStamp();
@@ -256,7 +256,7 @@ public static class Glitch
if (player == null) return;
if (!player.Is(CustomRoles.Glitch)) return;
if (change) { Utils.NotifyRoles(SpecifySeer: player); }
if (change) { Utils.NotifyRoles(SpecifySeer: player, SpecifyTarget: player); }
if (!player.IsAlive())
{
+1 -1
View File
@@ -121,7 +121,7 @@ public static class HexMaster
{
HexMode[playerId] = !HexMode[playerId];
SendRPC(false, playerId);
Utils.NotifyRoles(SpecifySeer: Utils.GetPlayerById(playerId));
Utils.NotifyRoles(SpecifySeer: Utils.GetPlayerById(playerId), SpecifyTarget: Utils.GetPlayerById(playerId));
}
}
public static bool HaveHexedPlayer()
+2 -2
View File
@@ -133,8 +133,8 @@ public static class Lawyer
Utils.GetPlayerById(Lawyer).RpcSetCustomRole(CRoleChangeRoles[ChangeRolesAfterTargetKilled.GetValue()]);
Target.Remove(Lawyer);
SendRPC(Lawyer);
Utils.NotifyRoles(SpecifySeer: Utils.GetPlayerById(Lawyer));
Utils.NotifyRoles(SpecifySeer: target);
Utils.NotifyRoles(SpecifySeer: Utils.GetPlayerById(Lawyer), SpecifyTarget: target);
Utils.NotifyRoles(SpecifySeer: target, SpecifyTarget: Utils.GetPlayerById(Lawyer));
}
public static bool KnowRole(PlayerControl player, PlayerControl target)
{
+7 -7
View File
@@ -122,8 +122,8 @@ public static class Pelican
ReportDeadBodyPatch.CanReport[target.PlayerId] = false;
target.MarkDirtySettings();
Utils.NotifyRoles(SpecifySeer: pc);
Utils.NotifyRoles(SpecifySeer: target);
Utils.NotifyRoles(SpecifySeer: pc, SpecifyTarget: target);
Utils.NotifyRoles(SpecifySeer: target, SpecifyTarget: pc);
Logger.Info($"{pc.GetRealName()} 吞掉了 {target.GetRealName()}", "Pelican");
}
@@ -157,15 +157,15 @@ public static class Pelican
foreach (byte tar in eatenList[pc].ToArray())
{
var target = Utils.GetPlayerById(tar);
var palyer = Utils.GetPlayerById(pc);
if (palyer == null || target == null)
var player = Utils.GetPlayerById(pc);
if (player == null || target == null)
continue;
target.TP(palyer.GetTruePosition());
target.TP(player.GetTruePosition());
Main.AllPlayerSpeed[tar] = Main.AllPlayerSpeed[tar] - 0.5f + originalSpeed[tar];
ReportDeadBodyPatch.CanReport[tar] = true;
target.MarkDirtySettings();
RPC.PlaySoundRPC(tar, Sounds.TaskComplete);
Utils.NotifyRoles(SpecifySeer: target);
Utils.NotifyRoles(SpecifySeer: target, SpecifyTarget: player);
Logger.Info($"{Utils.GetPlayerById(pc).GetRealName()} 吐出了 {target.GetRealName()}", "Pelican");
}
eatenList.Remove(pc);
@@ -199,7 +199,7 @@ public static class Pelican
if (dis < 1f)
continue;
target.TP(pos);
Utils.NotifyRoles(SpecifySeer: target);
Utils.NotifyRoles(SpecifySeer: target, SpecifyTarget: Utils.GetPlayerById(pc.Key));
}
}
}
+1 -1
View File
@@ -104,7 +104,7 @@ public static class PlagueBearer
return false;
}
PlaguedList[killer.PlayerId].Add(target.PlayerId);
Utils.NotifyRoles(SpecifySeer: killer);
Utils.NotifyRoles(SpecifySeer: killer, SpecifyTarget: target);
killer.ResetKillCooldown();
killer.SetKillCooldown();
Logger.Msg($"kill cooldown {PlagueBearerCD[killer.PlayerId]}", "PlagueBearer");
+1 -1
View File
@@ -81,7 +81,7 @@ public static class Pursuer
notActiveList.Add(pc.PlayerId);
pc.SetKillCooldown();
pc.RPCPlayCustomSound("Bet");
Utils.NotifyRoles(SpecifySeer: pc);
Utils.NotifyRoles(SpecifySeer: pc, SpecifyTarget: target);
}
public static bool OnClientMurder(PlayerControl pc)
{
+1 -1
View File
@@ -105,7 +105,7 @@ namespace TOHE.Roles.Neutral
RitualCount[killer.PlayerId]--;
RitualTarget[killer.PlayerId].Add(target.PlayerId);
Logger.Info($"{killer.GetNameWithRole().RemoveHtmlTags()}:占った 占い先→{target.GetNameWithRole().RemoveHtmlTags()} || 残り{RitualCount[killer.PlayerId]}回", "Ritualist");
Utils.NotifyRoles(SpecifySeer: killer);
Utils.NotifyRoles(SpecifySeer: killer, SpecifyTarget: target);
SendRPC(killer.PlayerId, target.PlayerId);
//キルクールの適正化
+2 -2
View File
@@ -220,7 +220,7 @@ public static class Romantic
}, 0.2f, "Convert to Vengeful romanticId");
}
Utils.NotifyRoles(SpecifySeer: romantic);
Utils.NotifyRoles(SpecifySeer: romantic, SpecifyTarget: partner);
Utils.NotifyRoles(SpecifySeer: partner);
romantic.ResetKillCooldown();
@@ -262,7 +262,7 @@ public static class VengefulRomantic
if (VengefulTarget.TryGetValue(killer.PlayerId, out var PartnerKiller) && target.PlayerId == PartnerKiller)
{
hasKilledKiller = true;
Utils.NotifyRoles(SpecifySeer: killer);
Utils.NotifyRoles(SpecifySeer: killer, SpecifyTarget: target);
return true;
}
else