diff --git a/hooks/MeetingHud.cpp b/hooks/MeetingHud.cpp index d9048af1..ed187870 100644 --- a/hooks/MeetingHud.cpp +++ b/hooks/MeetingHud.cpp @@ -2,6 +2,7 @@ #include "_hooks.h" #include "state.hpp" #include "game.h" +#include "logger.h" void dMeetingHud_Awake(MeetingHud* __this, MethodInfo* method) { State.voteMonitor.reset(); @@ -24,6 +25,7 @@ void dMeetingHud_Update(MeetingHud* __this, MethodInfo* method) { auto localData = GetPlayerData(*Game::pLocalPlayer); auto playerNameTMP = playerVoteArea->fields.NameText; + if (playerData && localData) { Color32 faceColor = app::Color32_op_Implicit(Palette__TypeInfo->static_fields->Black, NULL); if (State.RevealImpostors || localData->fields.IsImpostor) { @@ -40,13 +42,25 @@ void dMeetingHud_Update(MeetingHud* __this, MethodInfo* method) { app::TextMeshPro_SetFaceColor(playerNameTMP, c, NULL); app::TextMeshPro_SetOutlineColor(playerNameTMP, faceColor, NULL); } + } + //This is to not show the "Force skip all" that a host does at the end of a meeting + bool isDiscussionState = (__this->fields.discussionTimer < (*Game::pGameOptionsData)->fields.DiscussionTime); + bool isVotingState = !isDiscussionState && + ((__this->fields.discussionTimer - (*Game::pGameOptionsData)->fields.DiscussionTime) < (*Game::pGameOptionsData)->fields.VotingTime); //Voting phase + if (playerVoteArea && playerData) + { // We are goign to check to see if they voted, then we are going to check to see who they voted for, finally we are going to check to see if we already recorded a vote for them // votedFor will either contain the id of the person they voted for, -1 if they skipped, or -2 if they didn't vote. We don't want to record people who didn't vote - if (playerVoteArea->fields.didVote && playerVoteArea->fields.votedFor != -2 && !State.voteMonitor[playerData->fields.PlayerId]) { + if (isVotingState && playerVoteArea->fields.didVote && playerVoteArea->fields.votedFor != -2 && !State.voteMonitor[playerData->fields.PlayerId]) { State.events[playerVoteArea->fields._TargetPlayerId_k__BackingField][EVENT_VOTE].push_back(new CastVoteEvent(*GetEventPlayer(playerData), GetEventPlayer(GetPlayerDataById(playerVoteArea->fields.votedFor)))); State.consoleEvents.push_back(new CastVoteEvent(*GetEventPlayer(playerData), GetEventPlayer(GetPlayerDataById(playerVoteArea->fields.votedFor)))); State.voteMonitor[playerData->fields.PlayerId] = true; + STREAM_DEBUG("Id " << +playerData->fields.PlayerId << " voted for " << +playerVoteArea->fields.votedFor); + } + else if (!playerVoteArea->fields.didVote && State.voteMonitor[playerData->fields.PlayerId]) + { + State.voteMonitor[playerData->fields.PlayerId] = false; //Likely disconnected player } } }