From: AeonLucid Date: Sat, 24 Oct 2020 03:02:24 +0000 (+0200) Subject: Add useful method X-Git-Tag: v1.2.2~96^2~22 X-Git-Url: https://git.deb.at/?a=commitdiff_plain;h=b55d09de71af591367a63fb4fd9f1b87e09e8b93;p=rhonda%2Fimpostor.git Add useful method --- diff --git a/src/Impostor.Api/Innersloth/Net/InnerNetObject.cs b/src/Impostor.Api/Innersloth/Net/InnerNetObject.cs index b800cc6..da1b516 100644 --- a/src/Impostor.Api/Innersloth/Net/InnerNetObject.cs +++ b/src/Impostor.Api/Innersloth/Net/InnerNetObject.cs @@ -5,6 +5,8 @@ namespace Impostor.Api.Innersloth.Net { public abstract class InnerNetObject : GameObject { + private const int HostInheritId = -2; + public uint NetId { get; internal set; } public int OwnerId { get; internal set; } @@ -16,5 +18,11 @@ namespace Impostor.Api.Innersloth.Net public abstract bool Serialize(IMessageWriter writer, bool initialState); public abstract void Deserialize(IClientPlayer sender, IClientPlayer? target, IMessageReader reader, bool initialState); + + public bool IsOwnedBy(IClientPlayer player) + { + return OwnerId == player.Client.Id || + (OwnerId == HostInheritId && player.IsHost); + } } } \ No newline at end of file