--- /dev/null
+using Impostor.Api.Innersloth.Net.Objects.Systems;
+
+namespace Impostor.Api
+{
+ public static class SystemTypesExtensions
+ {
+ public static string GetFriendlyName(this SystemTypes type)
+ {
+ return SystemTypeHelpers.Names[(int)type];
+ }
+ }
+}
\ No newline at end of file
{
if (!sender.IsHost)
{
- throw new ImpostorCheatException($"Client sent {nameof(RpcCalls.SetInfected)} but was not a host.");
+ throw new ImpostorCheatException($"Client sent {nameof(RpcCalls.Exiled)} but was not a host.");
}
if (target != null)
{
- throw new ImpostorCheatException($"Client sent {nameof(RpcCalls.SetInfected)} to a specific player instead of broadcast.");
+ throw new ImpostorCheatException($"Client sent {nameof(RpcCalls.Exiled)} to a specific player instead of broadcast.");
}
- Console.WriteLine(PlayerInfo.PlayerName + " was voted out.");
-
+ // TODO: Not hit?
Die(DeathReason.Exile);
break;
}
}
var player = reader.ReadNetObject<InnerPlayerControl>(_game);
+ if (!player.PlayerInfo.IsDead)
+ {
+ player.Die(DeathReason.Kill);
+ }
+
break;
}
{
case RpcCalls.CloseDoorsOfType:
{
+ if (target == null || !target.IsHost)
+ {
+ throw new ImpostorCheatException($"Client sent {nameof(RpcCalls.CloseDoorsOfType)} to wrong destinition, must be host.");
+ }
+
if (!sender.Character.PlayerInfo.IsImpostor)
{
- Console.WriteLine($"OOPS Fake Impostor: {sender.Character.PlayerInfo.PlayerName} did doors");
+ // throw new ImpostorCheatException($"Client sent {nameof(RpcCalls.CloseDoorsOfType)} as crewmate.");
}
+ var systemType = (SystemTypes)reader.ReadByte();
+
break;
}
case RpcCalls.RepairSystem:
{
+ if (target == null || !target.IsHost)
+ {
+ throw new ImpostorCheatException($"Client sent {nameof(RpcCalls.RepairSystem)} to wrong destinition, must be host.");
+ }
+
+ if (!sender.Character.PlayerInfo.IsImpostor)
+ {
+ // throw new ImpostorCheatException($"Client sent {nameof(RpcCalls.RepairSystem)} as crewmate.");
+ }
+
var systemType = (SystemTypes)reader.ReadByte();
var player = reader.ReadNetObject<InnerPlayerControl>(_game);
var amount = reader.ReadByte();
- if (systemType == SystemTypes.Sabotage && !player.PlayerInfo.IsImpostor)
- {
- Console.WriteLine($"OOPS Fake Impostor: {player.PlayerInfo.PlayerName} did {(SystemTypes) amount}");
- }
+ // TODO: Modify data (?)
break;
}
public override bool Serialize(IMessageWriter writer, bool initialState)
{
- throw new System.NotImplementedException();
+ throw new NotImplementedException();
}
public override void Deserialize(IClientPlayer sender, IMessageReader reader, bool initialState)