use role data

This commit is contained in:
D1GQ committed 2024-08-17 03:40:15 -05:00
1 parent 4c581c7abb
commit 46389d30c4
5 files changed
+7 -8

No files matched your search

+1 -1
View File
@@ -163,7 +163,7 @@ static class ExtendedPlayerControl
// Check if player role name
public static string GetRoleName(this PlayerControl player)
{
if (!player.IsAlive() && !player.IsGhostRole() && Main.GetRoleName.TryGetValue((int)player.BetterData().DeadDisplayRole, out var roleName))
if (!player.IsAlive() && !player.IsGhostRole() && Main.GetRoleName.TryGetValue((int)player.BetterData().RoleInfo.DeadDisplayRole, out var roleName))
{
return roleName;
}
+2 -3
View File
@@ -12,18 +12,17 @@ public class ExtendedPlayerInfo
public bool BannedByAntiCheat { get; set; } = false;
// Track Game Info
public bool HasNoisemakerNotify { get; set; } = false;
public float TimeSinceLastTask { get; set; } = 5f;
public uint LastTaskId { get; set; } = 0;
public int TimesCalledMeeting { get; set; } = 0;
public RoleTypes DeadDisplayRole { get; set; }
public ExtendedRoleInfo? RoleInfo { get; set; }
}
public class ExtendedRoleInfo
{
public int Kills { get; set; } = 0;
public bool HasNoisemakerNotify { get; set; } = false;
public RoleTypes DeadDisplayRole { get; set; }
}
public static class PlayerControlExtensions
+1 -1
View File
@@ -71,7 +71,7 @@ class PlayerControlPatch
if (!GameStates.IsInGamePlay)
{
__instance.BetterData().TimesCalledMeeting = 0;
__instance.BetterData().HasNoisemakerNotify = false;
__instance.BetterData().RoleInfo.HasNoisemakerNotify = false;
__instance.BetterData().TimeSinceLastTask = 5f;
__instance.BetterData().LastTaskId = 999;
__instance.BetterData().RoleInfo.Kills = 0;
+1 -1
View File
@@ -254,7 +254,7 @@ public class RoleManagerPatch
public static bool AssignRoleOnDeath_Prefix(/*RoleManager __instance*/ [HarmonyArgument(0)] PlayerControl player)
{
if (player.Data.RoleType != RoleTypes.CrewmateGhost && player.Data.RoleType != RoleTypes.ImpostorGhost)
player.BetterData().DeadDisplayRole = player.Data.RoleType;
player.BetterData().RoleInfo.DeadDisplayRole = player.Data.RoleType;
if (!Main.BetterRoleAlgorithma.Value) return true;
+2 -2
View File
@@ -11,12 +11,12 @@ class RolePatch
[HarmonyPrefix]
public static bool NotifyOfDeath_Prefix(NoisemakerRole __instance)
{
if (__instance.Player.BetterData().HasNoisemakerNotify)
if (__instance.Player.BetterData().RoleInfo.HasNoisemakerNotify)
{
return false;
}
__instance.Player.BetterData().HasNoisemakerNotify = true;
__instance.Player.BetterData().RoleInfo.HasNoisemakerNotify = true;
return true;
}