mirror of
https://github.com/Impostor/Impostor.git
synced 2026-10-19 15:51:42 +00:00
Add Phantom Rpcs support
This commit is contained in:
1 parent
ed9f6e3134
commit
83bf1c4368
5 files changed
+109
-1
No files matched your search
@@ -0,0 +1,15 @@
|
||||
namespace Impostor.Api.Net.Messages.Rpcs
|
||||
{
|
||||
public static class Rpc62CheckVanish
|
||||
{
|
||||
public static void Serialize(IMessageWriter writer, float maxDuration)
|
||||
{
|
||||
writer.Write(maxDuration);
|
||||
}
|
||||
|
||||
public static void Deserialize(IMessageReader reader, out float maxDuration)
|
||||
{
|
||||
maxDuration = reader.ReadSingle();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
namespace Impostor.Api.Net.Messages.Rpcs
|
||||
{
|
||||
public static class Rpc63StartVanish
|
||||
{
|
||||
public static void Serialize(IMessageWriter writer)
|
||||
{
|
||||
}
|
||||
|
||||
public static void Deserialize(IMessageReader reader)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
namespace Impostor.Api.Net.Messages.Rpcs
|
||||
{
|
||||
public static class Rpc64CheckAppear
|
||||
{
|
||||
public static void Serialize(IMessageWriter writer, bool shouldAnimate)
|
||||
{
|
||||
writer.Write(shouldAnimate);
|
||||
}
|
||||
|
||||
public static void Deserialize(IMessageReader reader, out bool shouldAnimate)
|
||||
{
|
||||
shouldAnimate = reader.ReadBoolean();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
namespace Impostor.Api.Net.Messages.Rpcs
|
||||
{
|
||||
public static class Rpc65StartAppear
|
||||
{
|
||||
public static void Serialize(IMessageWriter writer, bool shouldAnimate)
|
||||
{
|
||||
writer.Write(shouldAnimate);
|
||||
}
|
||||
|
||||
public static void Deserialize(IMessageReader reader, out bool shouldAnimate)
|
||||
{
|
||||
shouldAnimate = reader.ReadBoolean();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -511,7 +511,7 @@ namespace Impostor.Server.Net.Inner.Objects
|
||||
return false;
|
||||
}
|
||||
|
||||
Rpc55CheckShapeshift.Deserialize(reader, Game, out var playerControl, out var shouldAnimate);
|
||||
Rpc55CheckShapeshift.Deserialize(reader, Game, out var playerControl, out _);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -526,6 +526,56 @@ namespace Impostor.Server.Net.Inner.Objects
|
||||
break;
|
||||
}
|
||||
|
||||
case RpcCalls.CheckVanish:
|
||||
{
|
||||
if (!await ValidateOwnership(call, sender) ||
|
||||
!await ValidateRole(call, sender, PlayerInfo, RoleTypes.Phantom) ||
|
||||
!await ValidateCmd(call, sender, target))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
Rpc62CheckVanish.Deserialize(reader, out var maxDuration);
|
||||
break;
|
||||
}
|
||||
|
||||
case RpcCalls.StartVanish:
|
||||
{
|
||||
if (!await ValidateHost(call, sender) ||
|
||||
!await ValidateBroadcast(call, sender, target))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
Rpc63StartVanish.Deserialize(reader);
|
||||
break;
|
||||
}
|
||||
|
||||
case RpcCalls.CheckAppear:
|
||||
{
|
||||
if (!await ValidateOwnership(call, sender) ||
|
||||
!await ValidateRole(call, sender, PlayerInfo, RoleTypes.Phantom) ||
|
||||
!await ValidateCmd(call, sender, target))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
Rpc64CheckAppear.Deserialize(reader, out bool shouldAnimate);
|
||||
break;
|
||||
}
|
||||
|
||||
case RpcCalls.StartAppear:
|
||||
{
|
||||
if (!await ValidateHost(call, sender) ||
|
||||
!await ValidateBroadcast(call, sender, target))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
Rpc65StartAppear.Deserialize(reader, out _);
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
return await base.HandleRpcAsync(sender, target, call, reader);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user