From 3a4d15dd76d70a6087a6f8d08d1f4efc02cc27cb Mon Sep 17 00:00:00 2001 From: jesus Date: Sun, 26 Mar 2023 01:35:00 +0100 Subject: [PATCH] Role changes --- .../Features/Wrappers/Player/CursedPlayer.cs | 41 +++++++++++++++++-- .../Wrappers/Player/Roles/CursedNoneRole.cs | 2 +- .../Wrappers/Player/Roles/CursedRole.cs | 4 +- 3 files changed, 41 insertions(+), 6 deletions(-) diff --git a/CursedMod/Features/Wrappers/Player/CursedPlayer.cs b/CursedMod/Features/Wrappers/Player/CursedPlayer.cs index 85434707..0fbd61ca 100644 --- a/CursedMod/Features/Wrappers/Player/CursedPlayer.cs +++ b/CursedMod/Features/Wrappers/Player/CursedPlayer.cs @@ -16,6 +16,8 @@ using CursedMod.Features.Wrappers.Facility; using CursedMod.Features.Wrappers.Inventory.Items; using CursedMod.Features.Wrappers.Inventory.Pickups; +using CursedMod.Features.Wrappers.Player.Roles; +using CursedMod.Features.Wrappers.Player.Roles.SCPs; using CursedMod.Features.Wrappers.Player.VoiceChat; using CursedMod.Features.Wrappers.Server; using CustomPlayerEffects; @@ -290,11 +292,29 @@ public RoleTypeId Role set => SetRole(value); } - public PlayerRoleBase CurrentRole + public PlayerRoleBase RoleBase { get => RoleManager.CurrentRole; set => RoleManager.CurrentRole = value; } + + public CursedRole CurrentRole => CursedRole.Get(RoleBase); + + public CursedScp049Role CursedScp049Role => CurrentRole as CursedScp049Role; + + public CursedScp079Role CursedScp079Role => CurrentRole as CursedScp079Role; + + public CursedScp096Role CursedScp096Role => CurrentRole as CursedScp096Role; + + public CursedScp106Role CursedScp106Role => CurrentRole as CursedScp106Role; + + public CursedScp173Role CursedScp173Role => CurrentRole as CursedScp173Role; + + public CursedScp939Role CursedScp939Role => CurrentRole as CursedScp939Role; + + public CursedZombieRole CursedZombieRole => CurrentRole as CursedZombieRole; + + public CursedHumanRole CursedHumanRole => CurrentRole as CursedHumanRole; public bool IsInOverWatch { @@ -425,8 +445,23 @@ public ulong Permissions // difference: this also returns true if the whitelist is disabled public bool IsWhitelisted => WhiteList.IsWhitelisted(UserId); - - public CursedVoiceChat VoiceChat => CurrentRole is FpcStandardRoleBase role ? new CursedVoiceChat(role.VoiceModule) : null; + + public CursedVoiceChat VoiceChat + { + get + { + if (CurrentRole is CursedFpcRole fpcRole) + return new CursedVoiceChat(fpcRole.VoiceModule); + + if (CurrentRole is CursedScp079Role scp079Role) + return new CursedVoiceChat(scp079Role.VoiceModule); + + if (CurrentRole is CursedNoneRole noneRole) + return new CursedVoiceChat(noneRole.VoiceModule); + + return null; + } + } public bool IsHost => ReferenceHub == ReferenceHub.HostHub; diff --git a/CursedMod/Features/Wrappers/Player/Roles/CursedNoneRole.cs b/CursedMod/Features/Wrappers/Player/Roles/CursedNoneRole.cs index c1fb758b..df4e036f 100644 --- a/CursedMod/Features/Wrappers/Player/Roles/CursedNoneRole.cs +++ b/CursedMod/Features/Wrappers/Player/Roles/CursedNoneRole.cs @@ -21,7 +21,7 @@ internal CursedNoneRole(NoneRole roleBase) public NoneRole NoneRoleBase { get; } - public VoiceModuleBase VoiceModuleBase + public VoiceModuleBase VoiceModule { get => NoneRoleBase.VoiceModule; set => NoneRoleBase.VoiceModule = value; diff --git a/CursedMod/Features/Wrappers/Player/Roles/CursedRole.cs b/CursedMod/Features/Wrappers/Player/Roles/CursedRole.cs index 36aae41a..40f1ebe3 100644 --- a/CursedMod/Features/Wrappers/Player/Roles/CursedRole.cs +++ b/CursedMod/Features/Wrappers/Player/Roles/CursedRole.cs @@ -23,11 +23,11 @@ internal CursedRole(PlayerRoleBase roleBase) public PlayerRoleBase RoleBase { get; } - public RoleTypeId RoleType => RoleBase.RoleTypeId; + public RoleTypeId RoleTypeId => RoleBase.RoleTypeId; public Team Team => RoleBase.Team; - public Color Color => RoleBase.RoleColor; + public Color RoleColor => RoleBase.RoleColor; public string Name => RoleBase.RoleName;