Skip to content
This repository has been archived by the owner on Oct 10, 2024. It is now read-only.

Commit

Permalink
Replay System Release (#297)
Browse files Browse the repository at this point in the history
* added some basic walk event outputting on debug console for filter testing

* fixed event filter

* IMPORTANT: relies on Replay::event_filter to be in same order as the EVENT_TYPES enum declared in _events.h

* - Fixed Walk_Event logging
- Added mutex lock to walk event loggin
- Renamed some Event Enums
- Added some basic walk event visualization

* - Added Getters for all event properties
- Removed unnecessary vent_action enum entry
- Modified imgui Image function to support offset to current cursor
- Added more events to replay visualization with dummy circles

* - Modified some events for more target information
- Added more events to replay
- Added more icons

* - Added Report Icon to Report/Meeting event to replay
- Added new utility function for optional target position

* - Added Task Event/Icon to Replay

* - Changed some data handling for filter to allow padding so we can remove unwanted events from filtering

* Replaced simple dot with proper player icon which recolers to player color

* - Added Icons for all radar visualization
- Added Dead Cross for Ghosts

* - Added dead body icon for radar

* - Added "PlayerControl_CmdReportDeadBody" hook to catch report/meeting calls by local player for event logging

* - some changes to maptype enum
- reversed drawing order so lines won't draw over icons

* added profiling to debug builds

* switched to flatEvents for replay

* kept all the other event vectors for now. walk events still use old events for its filtering in PlayerControl.cpp.
* decreases frametime by 77%

* changed events vectors to use std::unique_ptr

* should fix any memory leak

* replaced all 3 events with 1 flat array

* first pass

* still need to clear collections at round end / disconnect
* still need to add polyline optimizations
* still want to add rendertexture

* align the map properly

* polyline simplification

* fixed glitchy / ugly lines

* also increased distance threshold. 50.f is pretty good, 100.f is noticeably inaccurate when making sharp turns.
* there is an annoying crash. still figuring it out.

* separated WalkEvents from main events collection

* no longer suffer from FPS issues
* can play entire match with hardly any FPS drop
* State.rawEvents can be dumped to file for non-live visualization (all events, including WalkEvents, are preserved there)
* still have a random crash though

* fixed crash in ConsoleGui

* no idea what causes it, but it's at least handled gracefully now

* first pass time filter

* non-functional right now, very buggy

* fixed filters, fixed simplifiedPoints, added replay settings

* - Moved replay options to the replay tab
- Removed num events debug from replay tab since it's in the debug tab

* - Replay window should now dynamically scale with map
- Added new Play and Pause Image Buttons for Replay window

* - changed console timestamps to show min and sec in one go

* - Console now uses liveReplayEvents instead of rawEvents
- Replay Reset won't reset rawEvents anymore
- Round End will delete rawEvents now

* Upgraded project to v143 (vs2022) and std:c++20 standard

* - Upgraded from c++20 to c++latest
- Updated time formatting to std::format

* Set MatchStart at beginning of match

* Added SliderChrono with proper formatting and playing/live handling (TODO: add walkpath/player icon filter for currentTimeStamp; Also might want to add milliseconds instead of seconds when playing to make it smoother)

* for event filters check for milliseconds difference

* changed event time filter to time_point comparison

* added maxTimeFilter to replay player icons

* also added it to walkpath but it's broken right now

* fixed maxTimeFilter for replay walkpaths

* pass time_point by ref, removed useless block

* fixed maxTimeFilter

* replay now always uses State.MatchCurrent as maxTimeFilter

* fixed 'show only last X seconds' setting

* new screenshot with replay window

* - replay will now be properly live when game starts
- updated readme

* replaced credits with special thanks for people who indirectly contributed to the repository

* updated build workflow to use vs2022

* fixed path to windows

* spelling mistake

* more changes

* more changes2

* Upgraded all remaining configurations to v143 and c++latest

* reversed some unnecessary enforment on platform toolset in github workflow

* - Added ability to switch between old radar dots and new icons (Draw Player Icons Option in Radar Tab)
- Moved Dot and Icon drawing for Radar into gui-helpers (TODO: do same for replay)
- Changed RadarPlayerColorStatus check from StringName to newer RoleTeamTypes
- PlayerIcons will also account eventfilter (walking)
- FlipSkeld will also be set now when first of april and not only selected by host
-  FlipSkeld will be set on round start
- Added new utility function for flip skeld (getMapXOffsetSkeld)
- Fixed Meeting Event duplication if playing freeplay/local

* Fixed polyline rendering on flipped skeld

* Now it's fixed. promise!

Co-authored-by: kotae4 <[email protected]>
  • Loading branch information
v0idp and kotae4 authored Feb 19, 2022
1 parent ed56978 commit 6759c5d
Show file tree
Hide file tree
Showing 57 changed files with 1,578 additions and 274 deletions.
18 changes: 9 additions & 9 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,27 @@ name: Build Project

on:
push:
tags:
tags:
- v[0-9].[0-9]+.[0-9]+*
# pr's will trigger this action. i think the idea here is to verify that a build is passing before merging.
pull_request:
branches:
branches:
- main

jobs:
Build_Release:
runs-on: windows-latest
runs-on: windows-2022
steps:
- name: Checkout
uses: actions/[email protected]

- name: Build Release
shell: bash
run: '"/c/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/MSBuild/Current/Bin/MSBuild.exe" -property:Configuration=Release'
run: '"C:/Program Files/Microsoft Visual Studio/2022/Enterprise/Msbuild/Current/Bin/MSBuild.exe" -property:Configuration=Release'

- name: Build Release_Version
shell: bash
run: '"/c/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/MSBuild/Current/Bin/MSBuild.exe" -property:Configuration=Release_Version'
run: '"C:/Program Files/Microsoft Visual Studio/2022/Enterprise/Msbuild/Current/Bin/MSBuild.exe" -property:Configuration=Release_Version'

- name: Package Release Builds
if: ${{ github.event_name == 'push' }}
Expand All @@ -40,18 +40,18 @@ jobs:
path: Release.zip

Build_Debug:
runs-on: windows-latest
runs-on: windows-2022
steps:
- name: Checkout
uses: actions/[email protected]

- name: Build Debug
shell: bash
run: '"/c/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/MSBuild/Current/Bin/MSBuild.exe" -property:Configuration=Debug'
run: '"C:/Program Files/Microsoft Visual Studio/2022/Enterprise/Msbuild/Current/Bin/MSBuild.exe" -property:Configuration=Debug'

- name: Build Debug_Version
shell: bash
run: '"/c/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/MSBuild/Current/Bin/MSBuild.exe" -property:Configuration=Debug_Version'
run: '"C:/Program Files/Microsoft Visual Studio/2022/Enterprise/Msbuild/Current/Bin/MSBuild.exe" -property:Configuration=Debug_Version'

- name: Package Debug Builds
if: ${{ github.event_name == 'push' }}
Expand All @@ -70,7 +70,7 @@ jobs:

AutoRelease:
if: ${{ github.event_name == 'push' }}
runs-on: windows-latest
runs-on: windows-2022
needs: [Build_Release, Build_Debug]
steps:
- name: Parse tag semver
Expand Down
28 changes: 20 additions & 8 deletions AmongUsMenu.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@
<ClCompile Include="hooks\PolusShipStatus.cpp" />
<ClCompile Include="hooks\RoleManager.cpp" />
<ClCompile Include="hooks\UnityDebug.cpp" />
<ClCompile Include="profiler.cpp" />
<ClCompile Include="rpc\CustomRpcHandler.cpp" />
<ClCompile Include="rpc\RpcPlayerAppearance.cpp" />
<ClCompile Include="rpc\RpcSetRole.cpp" />
Expand Down Expand Up @@ -347,6 +348,7 @@
<ClInclude Include="includes\directx11.h" />
<ClInclude Include="includes\detours\detours.h" />
<ClInclude Include="framework\pch-il2cpp.h" />
<ClInclude Include="profiler.h" />
<ClInclude Include="user\achievements.hpp" />
<ClInclude Include="user\keybinds.h" />
<ClInclude Include="resources\resource_data.h" />
Expand Down Expand Up @@ -382,9 +384,19 @@
</ItemGroup>
<ItemGroup>
<Image Include="resources\airship.png" />
<Image Include="resources\cross.png" />
<Image Include="resources\dead_body.png" />
<Image Include="resources\kill.png" />
<Image Include="resources\mira_hq.png" />
<Image Include="resources\pause.png" />
<Image Include="resources\play.png" />
<Image Include="resources\player.png" />
<Image Include="resources\polus.png" />
<Image Include="resources\report.png" />
<Image Include="resources\the_skald.png" />
<Image Include="resources\tick.png" />
<Image Include="resources\vent_in.png" />
<Image Include="resources\vent_out.png" />
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="resources\resource_data.rc" />
Expand All @@ -406,14 +418,14 @@
<UseDebugLibraries>true</UseDebugLibraries>
<!--<PlatformToolset>v142</PlatformToolset>-->
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v142</PlatformToolset>
<PlatformToolset>v143</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug_Version|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v142</PlatformToolset>
<PlatformToolset>v143</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<UseOfMfc>Static</UseOfMfc>
</PropertyGroup>
Expand All @@ -423,15 +435,15 @@
<!--<PlatformToolset>v142</PlatformToolset>-->
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v142</PlatformToolset>
<PlatformToolset>v143</PlatformToolset>
<UseOfMfc>Static</UseOfMfc>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release_Version|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v142</PlatformToolset>
<PlatformToolset>v143</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
Expand Down Expand Up @@ -475,7 +487,7 @@
<PrecompiledHeaderFile>pch-il2cpp.h</PrecompiledHeaderFile>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<AdditionalIncludeDirectories>$(ProjectDir)appdata;$(ProjectDir)events;$(ProjectDir)framework;$(ProjectDir)gui;$(ProjectDir)hooks;$(ProjectDir)includes;$(ProjectDir)resources;$(ProjectDir)rpc;$(ProjectDir)user;$(ProjectDir)</AdditionalIncludeDirectories>
<LanguageStandard>stdcpp17</LanguageStandard>
<LanguageStandard>stdcpplatest</LanguageStandard>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<FunctionLevelLinking>true</FunctionLevelLinking>
<WholeProgramOptimization>false</WholeProgramOptimization>
Expand Down Expand Up @@ -518,7 +530,7 @@ git rev-parse --abbrev-ref HEAD &gt;&gt; gitparams.h</Command>
<PrecompiledHeaderFile>pch-il2cpp.h</PrecompiledHeaderFile>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<AdditionalIncludeDirectories>$(ProjectDir)appdata;$(ProjectDir)events;$(ProjectDir)framework;$(ProjectDir)gui;$(ProjectDir)hooks;$(ProjectDir)includes;$(ProjectDir)resources;$(ProjectDir)rpc;$(ProjectDir)user;$(ProjectDir)</AdditionalIncludeDirectories>
<LanguageStandard>stdcpp17</LanguageStandard>
<LanguageStandard>stdcpplatest</LanguageStandard>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<FunctionLevelLinking>true</FunctionLevelLinking>
<WholeProgramOptimization>false</WholeProgramOptimization>
Expand Down Expand Up @@ -563,7 +575,7 @@ git rev-parse --abbrev-ref HEAD &gt;&gt; gitparams.h</Command>
<PrecompiledHeaderFile>pch-il2cpp.h</PrecompiledHeaderFile>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<AdditionalIncludeDirectories>$(ProjectDir)appdata;$(ProjectDir)events;$(ProjectDir)framework;$(ProjectDir)gui;$(ProjectDir)hooks;$(ProjectDir)includes;$(ProjectDir)resources;$(ProjectDir)rpc;$(ProjectDir)user;$(ProjectDir)</AdditionalIncludeDirectories>
<LanguageStandard>stdcpp17</LanguageStandard>
<LanguageStandard>stdcpplatest</LanguageStandard>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<DebugInformationFormat>None</DebugInformationFormat>
<WholeProgramOptimization>true</WholeProgramOptimization>
Expand Down Expand Up @@ -611,7 +623,7 @@ git rev-parse --abbrev-ref HEAD &gt;&gt; gitparams.h</Command>
<PrecompiledHeaderFile>pch-il2cpp.h</PrecompiledHeaderFile>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<AdditionalIncludeDirectories>$(ProjectDir)appdata;$(ProjectDir)events;$(ProjectDir)framework;$(ProjectDir)gui;$(ProjectDir)hooks;$(ProjectDir)includes;$(ProjectDir)resources;$(ProjectDir)rpc;$(ProjectDir)user;$(ProjectDir)</AdditionalIncludeDirectories>
<LanguageStandard>stdcpp17</LanguageStandard>
<LanguageStandard>stdcpplatest</LanguageStandard>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<DebugInformationFormat>None</DebugInformationFormat>
<WholeProgramOptimization>true</WholeProgramOptimization>
Expand Down
36 changes: 36 additions & 0 deletions AmongUsMenu.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,9 @@
<ClCompile Include="gui\tabs\replay_tab.cpp">
<Filter>gui\tabs</Filter>
</ClCompile>
<ClCompile Include="profiler.cpp">
<Filter>user</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="appdata\il2cpp-api-functions.h">
Expand Down Expand Up @@ -460,6 +463,9 @@
<ClInclude Include="gui\tabs\replay_tab.h">
<Filter>gui\tabs</Filter>
</ClInclude>
<ClInclude Include="profiler.h">
<Filter>user</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<Image Include="resources\mira_hq.png">
Expand All @@ -474,6 +480,36 @@
<Image Include="resources\airship.png">
<Filter>resources</Filter>
</Image>
<Image Include="resources\vent_in.png">
<Filter>resources</Filter>
</Image>
<Image Include="resources\vent_out.png">
<Filter>resources</Filter>
</Image>
<Image Include="resources\kill.png">
<Filter>resources</Filter>
</Image>
<Image Include="resources\report.png">
<Filter>resources</Filter>
</Image>
<Image Include="resources\tick.png">
<Filter>resources</Filter>
</Image>
<Image Include="resources\player.png">
<Filter>resources</Filter>
</Image>
<Image Include="resources\cross.png">
<Filter>resources</Filter>
</Image>
<Image Include="resources\dead_body.png">
<Filter>resources</Filter>
</Image>
<Image Include="resources\play.png">
<Filter>resources</Filter>
</Image>
<Image Include="resources\pause.png">
<Filter>resources</Filter>
</Image>
</ItemGroup>
<ItemGroup>
<None Include="framework\version.def">
Expand Down
11 changes: 4 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,10 @@ Will automatically be loaded by the Game itself if the dll is in the game direct
<img src="screenshot.png">
</p>

## Credits
* [void*](https://github.com/v0idp) (Maintainer & Creator)
* [std-nullptr](https://github.com/std-nullptr) (Maintainer & IL2CPP Madman)
* [OsOmE1](https://github.com/OsOmE1) (Maintainer)
* [RealMVC](https://github.com/RealMVC) (Contributor)
* [Kyreus](https://github.com/KyreusR) (Contributor)
* [manianac](https://github.com/manianac) (Contributor)
## Special Thanks
* [KulaGGin](https://github.com/KulaGGin) (Helped with some ImGui code for replay system)
* [tomsa000](https://github.com/tomsa000) (Helped with fixing memory leaks and smart pointers)
* Everyone else who contributed to the code and I couldn't list here. Thank you!

## Contributing

Expand Down
1 change: 1 addition & 0 deletions appdata/il2cpp-functions.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ DO_APP_FUNC(Camera*, Camera_get_main, (MethodInfo* method), "UnityEngine.CoreMod
DO_APP_FUNC(void, Camera_set_orthographicSize, (Camera* __this, float value, MethodInfo* method), "UnityEngine.CoreModule, System.Void UnityEngine.Camera::set_orthographicSize(System.Single)");
DO_APP_FUNC(float, Camera_get_orthographicSize, (Camera* __this, MethodInfo* method), "UnityEngine.CoreModule, System.Single UnityEngine.Camera::get_orthographicSize()");
DO_APP_FUNC(Color, SpriteRenderer_get_color, (SpriteRenderer* __this, MethodInfo* method), "UnityEngine.CoreModule, UnityEngine.Color UnityEngine.SpriteRenderer::get_color()");
DO_APP_FUNC(float, Time_get_fixedDeltaTime, (MethodInfo* method), "UnityEngine.CoreModule, System.Single UnityEngine.Time::get_fixedDeltaTime()");

DO_APP_FUNC(int32_t, Screen_get_width, (MethodInfo* method), "UnityEngine.CoreModule, System.Int32 UnityEngine.Screen::get_width()");
DO_APP_FUNC(int32_t, Screen_get_height, (MethodInfo* method), "UnityEngine.CoreModule, System.Int32 UnityEngine.Screen::get_height()");
Expand Down
5 changes: 1 addition & 4 deletions events/CastVoteEvent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,7 @@ void CastVoteEvent::Output() {
if (target.has_value()) ImGui::TextColored(AmongUsColorToImVec4(GetPlayerColor(target->colorId)), target->playerName.c_str());
else ImGui::Text("Skipped");
ImGui::SameLine();
auto sec = std::chrono::duration_cast<std::chrono::seconds>(std::chrono::system_clock::now().time_since_epoch()).count() - std::chrono::duration_cast<std::chrono::seconds>(this->timestamp.time_since_epoch()).count();
auto min = std::chrono::duration_cast<std::chrono::minutes>(std::chrono::system_clock::now().time_since_epoch()).count() - std::chrono::duration_cast<std::chrono::minutes>(this->timestamp.time_since_epoch()).count();
if (sec < 60) ImGui::Text(" [%ds ago]", sec);
else ImGui::Text(" [%dm ago]", min);
ImGui::Text("[%s ago]", std::format("{:%OM:%OS}", (std::chrono::system_clock::now() - this->timestamp)).c_str());
}

void CastVoteEvent::ColoredEventOutput() {
Expand Down
7 changes: 2 additions & 5 deletions events/CheatDetectedEvent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#include "_events.h"
#include "utility.h"

CheatDetectedEvent::CheatDetectedEvent(EVENT_PLAYER source, CHEAT_ACTION action) : EventInterface(source, EVENT_CHEAT) {
CheatDetectedEvent::CheatDetectedEvent(EVENT_PLAYER source, CHEAT_ACTIONS action) : EventInterface(source, EVENT_CHEAT) {
this->action = action;
}

Expand All @@ -13,10 +13,7 @@ void CheatDetectedEvent::Output() {
ImGui::SameLine();
ImGui::Text("Cheat detected: %s", CHEAT_ACTION_NAMES[this->action]);
ImGui::SameLine();
auto sec = std::chrono::duration_cast<std::chrono::seconds>(std::chrono::system_clock::now().time_since_epoch()).count() - std::chrono::duration_cast<std::chrono::seconds>(this->timestamp.time_since_epoch()).count();
auto min = std::chrono::duration_cast<std::chrono::minutes>(std::chrono::system_clock::now().time_since_epoch()).count() - std::chrono::duration_cast<std::chrono::minutes>(this->timestamp.time_since_epoch()).count();
if (sec < 60) ImGui::Text(" [%ds ago]", sec);
else ImGui::Text(" [%dm ago]", min);
ImGui::Text("[%s ago]", std::format("{:%OM:%OS}", (std::chrono::system_clock::now() - this->timestamp)).c_str());
}

void CheatDetectedEvent::ColoredEventOutput() {
Expand Down
5 changes: 1 addition & 4 deletions events/DisconnectEvent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,7 @@ void DisconnectEvent::Output() {
ImGui::SameLine();
ImGui::Text("has left the game");
ImGui::SameLine();
auto sec = std::chrono::duration_cast<std::chrono::seconds>(std::chrono::system_clock::now().time_since_epoch()).count() - std::chrono::duration_cast<std::chrono::seconds>(this->timestamp.time_since_epoch()).count();
auto min = std::chrono::duration_cast<std::chrono::minutes>(std::chrono::system_clock::now().time_since_epoch()).count() - std::chrono::duration_cast<std::chrono::minutes>(this->timestamp.time_since_epoch()).count();
if (sec < 60) ImGui::Text(" [%ds ago]", sec);
else ImGui::Text(" [%dm ago]", min);
ImGui::Text("[%s ago]", std::format("{:%OM:%OS}", (std::chrono::system_clock::now() - this->timestamp)).c_str());
}

void DisconnectEvent::ColoredEventOutput() {
Expand Down
8 changes: 3 additions & 5 deletions events/KillEvent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
#include "_events.h"
#include "utility.h"

KillEvent::KillEvent(EVENT_PLAYER source, EVENT_PLAYER target, Vector2 position) : EventInterface(source, EVENT_KILL) {
KillEvent::KillEvent(EVENT_PLAYER source, EVENT_PLAYER target, Vector2 position, Vector2 targetPosition) : EventInterface(source, EVENT_KILL) {
this->target = target;
this->targetPosition = targetPosition;
this->position = position;
this->systemType = GetSystemTypes(position);
}
Expand All @@ -17,10 +18,7 @@ void KillEvent::Output() {
ImGui::SameLine();
ImGui::Text("(%s)", TranslateSystemTypes(systemType));
ImGui::SameLine();
auto sec = std::chrono::duration_cast<std::chrono::seconds>(std::chrono::system_clock::now().time_since_epoch()).count() - std::chrono::duration_cast<std::chrono::seconds>(this->timestamp.time_since_epoch()).count();
auto min = std::chrono::duration_cast<std::chrono::minutes>(std::chrono::system_clock::now().time_since_epoch()).count() - std::chrono::duration_cast<std::chrono::minutes>(this->timestamp.time_since_epoch()).count();
if (sec < 60) ImGui::Text(" [%ds ago]", sec);
else ImGui::Text(" [%dm ago]", min);
ImGui::Text("[%s ago]", std::format("{:%OM:%OS}", (std::chrono::system_clock::now() - this->timestamp)).c_str());
}

void KillEvent::ColoredEventOutput() {
Expand Down
5 changes: 1 addition & 4 deletions events/ProtectPlayerEvent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,7 @@ void ProtectPlayerEvent::Output() {
ImGui::SameLine();
ImGui::TextColored(AmongUsColorToImVec4(GetPlayerColor(target.colorId)), target.playerName.c_str());
ImGui::SameLine();
auto sec = std::chrono::duration_cast<std::chrono::seconds>(std::chrono::system_clock::now().time_since_epoch()).count() - std::chrono::duration_cast<std::chrono::seconds>(this->timestamp.time_since_epoch()).count();
auto min = std::chrono::duration_cast<std::chrono::minutes>(std::chrono::system_clock::now().time_since_epoch()).count() - std::chrono::duration_cast<std::chrono::minutes>(this->timestamp.time_since_epoch()).count();
if (sec < 60) ImGui::Text(" [%ds ago]", sec);
else ImGui::Text(" [%dm ago]", min);
ImGui::Text("[%s ago]", std::format("{:%OM:%OS}", (std::chrono::system_clock::now() - this->timestamp)).c_str());
}

void ProtectPlayerEvent::ColoredEventOutput() {
Expand Down
8 changes: 3 additions & 5 deletions events/ReportDeadBodyEvent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@
#include "_events.h"
#include "utility.h"

ReportDeadBodyEvent::ReportDeadBodyEvent(EVENT_PLAYER source, std::optional<EVENT_PLAYER> target, Vector2 position)
ReportDeadBodyEvent::ReportDeadBodyEvent(EVENT_PLAYER source, std::optional<EVENT_PLAYER> target, Vector2 position, std::optional<Vector2> targetPosition)
: EventInterface(source, (target.has_value() ? EVENT_REPORT : EVENT_MEETING)) {
this->target = target;
this->position = position;
this->targetPosition = targetPosition;
this->systemType = GetSystemTypes(position);
}

Expand All @@ -20,10 +21,7 @@ void ReportDeadBodyEvent::Output() {
}
ImGui::Text("(%s)", TranslateSystemTypes(systemType));
ImGui::SameLine();
auto sec = std::chrono::duration_cast<std::chrono::seconds>(std::chrono::system_clock::now().time_since_epoch()).count() - std::chrono::duration_cast<std::chrono::seconds>(this->timestamp.time_since_epoch()).count();
auto min = std::chrono::duration_cast<std::chrono::minutes>(std::chrono::system_clock::now().time_since_epoch()).count() - std::chrono::duration_cast<std::chrono::minutes>(this->timestamp.time_since_epoch()).count();
if (sec < 60) ImGui::Text(" [%ds ago]", sec);
else ImGui::Text(" [%dm ago]", min);
ImGui::Text("[%s ago]", std::format("{:%OM:%OS}", (std::chrono::system_clock::now() - this->timestamp)).c_str());
}

void ReportDeadBodyEvent::ColoredEventOutput() {
Expand Down
5 changes: 1 addition & 4 deletions events/ShapeShiftEvent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,7 @@ void ShapeShiftEvent::Output() {
ImGui::SameLine();
ImGui::TextColored(AmongUsColorToImVec4(GetPlayerColor(target.colorId)), target.playerName.c_str());
ImGui::SameLine();
auto sec = std::chrono::duration_cast<std::chrono::seconds>(std::chrono::system_clock::now().time_since_epoch()).count() - std::chrono::duration_cast<std::chrono::seconds>(this->timestamp.time_since_epoch()).count();
auto min = std::chrono::duration_cast<std::chrono::minutes>(std::chrono::system_clock::now().time_since_epoch()).count() - std::chrono::duration_cast<std::chrono::minutes>(this->timestamp.time_since_epoch()).count();
if (sec < 60) ImGui::Text(" [%ds ago]", sec);
else ImGui::Text(" [%dm ago]", min);
ImGui::Text("[%s ago]", std::format("{:%OM:%OS}", (std::chrono::system_clock::now() - this->timestamp)).c_str());
}

void ShapeShiftEvent::ColoredEventOutput() {
Expand Down
Loading

0 comments on commit 6759c5d

Please sign in to comment.