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

Commit

Permalink
smaller rolename & optional abbrv setting
Browse files Browse the repository at this point in the history
  • Loading branch information
kotae4 committed Nov 22, 2021
1 parent e22fe71 commit 9c1b355
Show file tree
Hide file tree
Showing 9 changed files with 65 additions and 12 deletions.
38 changes: 38 additions & 0 deletions appdata/il2cpp-types.h
Original file line number Diff line number Diff line change
Expand Up @@ -9853,6 +9853,44 @@ namespace app
};
#pragma endregion

#pragma region HatManager_c

struct HatManager_c
{
struct HatManager_c__Class* klass;
void* monitor;
};

struct HatManager_c__VTable
{
VirtualInvokeData Equals;
VirtualInvokeData Finalize;
VirtualInvokeData GetHashCode;
VirtualInvokeData ToString;
};

struct HatManager_c__StaticFields
{
struct HatManager_c* __9;
void* __9__9_0;
void* __9__11_0;
void* __9__12_0;
void* __9__15_0;
void* __9__17_0;
};

struct HatManager_c__Class
{
Il2CppClass_0 _0;
Il2CppRuntimeInterfaceOffsetPair* interfaceOffsets;
struct HatManager_c__StaticFields* static_fields;
const Il2CppRGCTXData* rgctx_data;
Il2CppClass_1 _1;
struct HatManager_c__VTable vtable;
};

#pragma endregion

#pragma region ScriptableObject
struct ScriptableObject__Fields
{
Expand Down
6 changes: 6 additions & 0 deletions gui/tabs/self_tab.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,12 @@ namespace SelfTab {
if (ImGui::Checkbox("Reveal Roles", &State.RevealRoles)) {
State.Save();
}
ImGui::SameLine();
if (ImGui::Checkbox("Abbrv. Role", &State.AbbreviatedRoleNames))
{
State.Save();
}

if (ImGui::Checkbox("See Ghosts", &State.ShowGhosts)) {
State.Save();
}
Expand Down
5 changes: 5 additions & 0 deletions hooks/MeetingHud.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ void dMeetingHud_Update(MeetingHud* __this, MethodInfo* method) {
Color32 faceColor = app::Color32_op_Implicit(Palette__TypeInfo->static_fields->Black, NULL);
if (State.RevealRoles || PlayerIsImpostor(localData)) {

std::string playerName = convert_from_string(GetPlayerOutfit(playerData)->fields._playerName);
playerName += "\n<size=50%>(" + GetRoleName(playerData->fields.Role) + ")";
String* playerNameStr = convert_to_string(playerName);
app::TMP_Text_set_text((app::TMP_Text*)playerNameTMP, playerNameStr, NULL);

Color32 c = app::Color32_op_Implicit(GetRoleColor(playerData->fields.Role), NULL);

app::TextMeshPro_SetFaceColor(playerNameTMP, c, NULL);
Expand Down
3 changes: 2 additions & 1 deletion hooks/PlayerControl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ void dPlayerControl_FixedUpdate(PlayerControl* __this, MethodInfo* method) {
Color32 c = app::Color32_op_Implicit(GetRoleColor(playerData->fields.Role), NULL);

std::string playerName = convert_from_string(GetPlayerOutfit(playerData)->fields._playerName);
playerName += "\n(" + GetRoleName(playerData->fields.Role) + ")";
std::string roleName = GetRoleName(playerData->fields.Role, State.AbbreviatedRoleNames);
playerName += "\n<size=50%>(" + roleName + ")";
String* playerNameStr = convert_to_string(playerName);
app::TMP_Text_set_text((app::TMP_Text*)nameTextTMP, playerNameStr, NULL);

Expand Down
2 changes: 1 addition & 1 deletion user/gitparams.h
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
#define GIT_CUR_COMMIT cb1b462045b8585d8e3c4dbe6cfaf778d3bb208f
#define GIT_CUR_COMMIT e22fe71ce90ee66eaa1db5214991f244b3962409
#define GIT_BRANCH 2021.11.9.5e
2 changes: 2 additions & 0 deletions user/state.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ void Settings::Load() {
j.at("Wallhack").get_to(this->Wallhack);
j.at("UnlockVents").get_to(this->UnlockVents);
j.at("RevealRoles").get_to(this->RevealRoles);
j.at("AbbreviatedRoleNames").get_to(this->AbbreviatedRoleNames);
j.at("ChatAlwaysActive").get_to(this->ChatAlwaysActive);
j.at("ReadGhostMessages").get_to(this->ReadGhostMessages);
j.at("AutoOpenDoors").get_to(this->AutoOpenDoors);
Expand Down Expand Up @@ -97,6 +98,7 @@ void Settings::Save() {
{"Wallhack", this->Wallhack},
{"UnlockVents", this->UnlockVents},
{"RevealRoles", this->RevealRoles},
{"AbbreviatedRoleNames", this->AbbreviatedRoleNames},
{"ChatAlwaysActive", this->ChatAlwaysActive},
{"ReadGhostMessages", this->ReadGhostMessages},
{"AutoOpenDoors", this->AutoOpenDoors},
Expand Down
1 change: 1 addition & 0 deletions user/state.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ class Settings {
bool ShowGhosts = false;

bool RevealRoles = false;
bool AbbreviatedRoleNames = false;
int PrevKillDistance = 0;
int KillDistance = 0;
int PrevTaskBarUpdates = 0;
Expand Down
18 changes: 9 additions & 9 deletions user/utility.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -642,25 +642,25 @@ Color GetRoleColor(RoleBehaviour* roleBehaviour) {
return c;
}

std::string GetRoleName(RoleBehaviour* roleBehaviour)
std::string GetRoleName(RoleBehaviour* roleBehaviour, bool abbreviated /* = false */)
{
if (roleBehaviour == nullptr) return "Unknown";
if (roleBehaviour == nullptr) return (abbreviated ? "Unk" : "Unknown");

switch (roleBehaviour->fields.Role)
{
case RoleTypes__Enum::Engineer:
return "Engineer";
return (abbreviated ? "Eng" : "Engineer");
case RoleTypes__Enum::GuardianAngel:
return "GuardianAngel";
return (abbreviated ? "GA" : "GuardianAngel");
case RoleTypes__Enum::Impostor:
return "Impostor";
return (abbreviated ? "I" : "Impostor");
case RoleTypes__Enum::Scientist:
return "Scientist";
return (abbreviated ? "Sci" : "Scientist");
case RoleTypes__Enum::Shapeshifter:
return "Shapeshifter";
return (abbreviated ? "Sh" : "Shapeshifter");
case RoleTypes__Enum::Crewmate:
return "Crewmate";
return (abbreviated ? "C" : "Crewmate");
default:
return "Unknown";
return (abbreviated ? "Unk" : "Unknown");
}
}
2 changes: 1 addition & 1 deletion user/utility.h
Original file line number Diff line number Diff line change
Expand Up @@ -124,4 +124,4 @@ void ResetOriginalAppearance();
bool PlayerIsImpostor(GameData_PlayerInfo* player);
GameData_PlayerOutfit* GetPlayerOutfit(GameData_PlayerInfo* player);
Color GetRoleColor(RoleBehaviour* roleBehaviour);
std::string GetRoleName(RoleBehaviour* roleBehaviour);
std::string GetRoleName(RoleBehaviour* roleBehaviour, bool abbreviated = false);

0 comments on commit 9c1b355

Please sign in to comment.