Skip to content

Commit 80a7e09

Browse files
committed
Useful additions for mods
2 parents 9fc903d + cccb9c7 commit 80a7e09

File tree

5 files changed

+31
-5
lines changed

5 files changed

+31
-5
lines changed

appdata/il2cpp-functions.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,6 @@ DO_APP_FUNC(MessageWriter*, InnerNetClient_StartRpcImmediately, (InnerNetClient*
175175
DO_APP_FUNC(void, InnerNetClient_FinishRpcImmediately, (InnerNetClient* __this, MessageWriter* msg, MethodInfo* method), "Assembly-CSharp, System.Void InnerNet.InnerNetClient::FinishRpcImmediately(Hazel.MessageWriter)");
176176

177177
DO_APP_FUNC(void, MessageExtensions_WriteNetObject, (MessageWriter* self, InnerNetObject* obj, MethodInfo* method), "Assembly-CSharp, System.Void InnerNet.MessageExtensions::WriteNetObject(Hazel.MessageWriter, InnerNet.InnerNetObject)");
178-
DO_APP_FUNC(PlayerControl*, MessageExtensions_ReadNetObject_1, (MessageReader* self, MethodInfo* method), "Assembly-CSharp, PlayerControl InnerNet.MessageExtensions::ReadNetObject(Hazel.MessageReader)");
179178

180179
//DO_APP_FUNC(bool, Constants_1_ShouldFlipSkeld, (MethodInfo* method), "Assembly-CSharp, System.Boolean Constants::ShouldFlipSkeld()");
181180
//this causes issues with dleks

gui/tabs/settings_tab.cpp

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,7 @@ namespace SettingsTab {
257257
if (showMessage) {
258258
float currentTime = static_cast<float>(ImGui::GetTime());
259259
if (currentTime - timer < 4.0f) {
260+
ImGui::SameLine();
260261
if (State.UnlockCosmetics)
261262
ImGui::TextColored(ImVec4(0.0f, 1.0f, 0.0f, 1.0f), "Unlocked All Cosmetics!");
262263
else
@@ -267,7 +268,6 @@ namespace SettingsTab {
267268
}
268269
}
269270

270-
271271
if (Achievements::IsSupported())
272272
{
273273
ImGui::SameLine();
@@ -278,6 +278,24 @@ namespace SettingsTab {
278278
if (ToggleButton("Safe Mode", &State.SafeMode)) {
279279
State.Save();
280280
}
281+
282+
static float timer1 = 0.0f;
283+
static bool showMessage1 = false;
284+
285+
if (showMessage1) {
286+
float currentTime = static_cast<float>(ImGui::GetTime());
287+
if (currentTime - timer1 < 4.0f) {
288+
ImGui::SameLine();
289+
if (State.UnlockCosmetics)
290+
ImGui::TextColored(ImVec4(0.0f, 1.0f, 0.0f, 1.0f), "Unlocked All Cosmetics!");
291+
else
292+
ImGui::TextColored(ImVec4(1.0f, 0.0f, 0.0f, 1.0f), "Disabled Unlock Cosmetics!");
293+
}
294+
else {
295+
showMessage1 = false;
296+
}
297+
}
298+
281299
static int modToShow = 0;
282300

283301
if (ToggleButton("Allow other mod users to see you're using", &State.ModDetection)) {

hooks/InnerNetClient.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -763,6 +763,7 @@ void dInnerNetClient_Update(InnerNetClient* __this, MethodInfo* method)
763763
if ((IsInLobby() || IsInGame()) && (State.OverloadEveryone || State.overloadedPlayers.size() != 0 ||
764764
State.LagEveryone || State.laggedPlayers.size() != 0) && overloadDelay <= 0 && (IsHost() || !State.SafeMode || !State.PatchProtect)) {
765765
bool lag = State.LagEveryone || State.laggedPlayers.size() != 0;
766+
uint8_t count = 0;
766767
for (auto p : GetAllPlayerControl()) {
767768
if (State.Destruct_IgnoreWhitelist && std::find(State.WhitelistFriendCodes.begin(), State.WhitelistFriendCodes.end(),
768769
convert_from_string(GetPlayerData(p)->fields.FriendCode)) != State.WhitelistFriendCodes.end()) continue;
@@ -772,13 +773,15 @@ void dInnerNetClient_Update(InnerNetClient* __this, MethodInfo* method)
772773
p->fields.PlayerId) == State.laggedPlayers.end()) continue;
773774
if (p != *Game::pLocalPlayer) {
774775
for (int i = 0; i < (lag ? 169 : 25); ++i) {
775-
auto writer = InnerNetClient_StartRpcImmediately((InnerNetClient*)(*Game::pAmongUsClient), (*Game::pLocalPlayer)->fields._.NetId, 0xb4 -
776-
0x87, SendOption__Enum::None, p->fields._.OwnerId, NULL);
776+
auto writer = InnerNetClient_StartRpcImmediately((InnerNetClient*)(*Game::pAmongUsClient), (*Game::pLocalPlayer)->fields._.NetId,
777+
(uint8_t)RpcCalls__Enum::ProtectPlayer, SendOption__Enum::None, p->fields._.OwnerId, NULL);
778+
MessageWriter_WriteString(writer, convert_to_string("This string is written so that other mods can detect overloading easily."), NULL);
777779
InnerNetClient_FinishRpcImmediately((InnerNetClient*)(*Game::pAmongUsClient), writer, NULL);
778780
}
781+
count++;
779782
}
780783
}
781-
overloadDelay = int((lag ? 0.2 : 0.1) * GetFps());
784+
overloadDelay = int((lag ? 0.3 : 0.1) * GetFps());
782785
}
783786
else overloadDelay--;
784787

hooks/PlayerControl.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1003,6 +1003,10 @@ void dPlayerControl_StartMeeting(PlayerControl* __this, NetworkedPlayerInfo* tar
10031003

10041004
void dPlayerControl_HandleRpc(PlayerControl* __this, uint8_t callId, MessageReader* reader, MethodInfo* method) {
10051005
if (State.ShowHookLogs) LOG_DEBUG("Hook dPlayerControl_HandleRpc executed");
1006+
if (callId == 45 && MessageReader_ReadString(reader, NULL) != NULL) {
1007+
SMAC_OnCheatDetected(__this, "Overloading");
1008+
return;
1009+
}
10061010
try {
10071011
HandleRpc(__this, callId, reader);
10081012
SMAC_HandleRpc(__this, callId, reader);
@@ -1162,6 +1166,7 @@ void dPlayerControl_Shapeshift(PlayerControl* __this, PlayerControl* target, boo
11621166
}
11631167

11641168
void dPlayerControl_ProtectPlayer(PlayerControl* __this, PlayerControl* target, int32_t colorId, MethodInfo* method) {
1169+
if (target == NULL) return;
11651170
if (State.ShowHookLogs) LOG_DEBUG("Hook dPlayerControl_ProtectPlayer executed");
11661171
try {
11671172
if (SYNCHRONIZED(Replay::replayEventMutex); target != nullptr) {

user/utility.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1577,6 +1577,7 @@ void UpdatePoints(NetworkedPlayerInfo* playerData, float points) {
15771577
}
15781578

15791579
void SMAC_OnCheatDetected(PlayerControl* pCtrl, std::string reason) {
1580+
if (reason == "Overloading" && !(IsHost() && State.SMAC_HostPunishment >= 2)) return; // Don't spam logs for overloading, that causes overload as well
15801581
if (pCtrl == *Game::pLocalPlayer || (!IsInLobby() && !IsInMultiplayerGame())) return; // Avoid detecting yourself and practice mode dummies
15811582
if (reason == "Bad Sabotage" && !IsHost()) return; // Without host, we cannot detect who sent UpdateSystem rpc properly
15821583

0 commit comments

Comments
 (0)