Fix some Backtrack ping related issues

This commit is contained in:
LightCat 2019-03-30 21:39:58 +01:00
parent 2d0f38bf9e
commit fe1771cdc6
5 changed files with 64 additions and 17 deletions

View File

@ -109,7 +109,7 @@ void CreateInterfaces()
if (!su)
{
logging::Info("Connecting to Steam User");
g_ISteamClient->ConnectToGlobalUser(sp);
su = g_ISteamClient->ConnectToGlobalUser(sp);
}
logging::Info("Inited Steam User");
g_IVModelRender = BruteforceInterface<IVModelRender>("VEngineModel", sharedobj::engine(), 16);

View File

@ -56,7 +56,7 @@ void AddLatencyToNetchan(INetChannel *ch)
if (!isBacktrackEnabled)
return;
float Latency = *latency;
Latency -= ch->GetAvgLatency(FLOW_OUTGOING) * 1000.0f;
Latency -= (ch->GetAvgLatency(FLOW_OUTGOING) + ch->GetAvgLatency(FLOW_INCOMING)) * 1000.0f;
if (Latency < 0.0f)
Latency = 0.0f;
for (auto &seq : sequences)
@ -326,7 +326,7 @@ float getLatency()
auto ch = (INetChannel *) g_IEngine->GetNetChannelInfo();
if (!ch)
return 0;
float Latency = *latency - ch->GetLatency(FLOW_OUTGOING) * 1000.0f;
float Latency = *latency - (ch->GetAvgLatency(FLOW_OUTGOING) + ch->GetAvgLatency(FLOW_INCOMING)) * 1000.0f;
if (Latency < 0.0f)
Latency = 0.0f;
return Latency;
@ -430,4 +430,8 @@ static InitRoutine EC([]() {
EC::Register(EC::Draw, Draw, "DRAW_Backtrack", EC::average);
#endif
});
CatCommand debug_richpresence("debug_presence", "Debug stuff", []() {
g_ISteamFriends->SetRichPresence("steam_display", "#TF_RichPresence_State_PlayingGeneric");
g_ISteamFriends->SetRichPresence("currentmap", "Cathooking");
});
} // namespace hacks::shared::backtrack

View File

@ -5,8 +5,8 @@
* Author: nullifiedcat
*/
#include <settings/Bool.hpp>
#include "common.hpp"
#include <settings/Bool.hpp>
static settings::Bool enable{ "noisemaker-spam.enable", "false" };
@ -26,5 +26,45 @@ static void CreateMove()
}
}
}
static InitRoutine EC([]() { EC::Register(EC::CreateMove, CreateMove, "Noisemaker", EC::average); });
FnCommandCallbackVoid_t plus_use_action_slot_item_original;
FnCommandCallbackVoid_t minus_use_action_slot_item_original;
void plus_use_action_slot_item_hook()
{
KeyValues *kv = new KeyValues("+use_action_slot_item_server");
g_IEngine->ServerCmdKeyValues(kv);
}
void minus_use_action_slot_item_hook()
{
KeyValues *kv = new KeyValues("-use_action_slot_item_server");
g_IEngine->ServerCmdKeyValues(kv);
}
static void init()
{
auto plus = g_ICvar->FindCommand("+use_action_slot_item");
auto minus = g_ICvar->FindCommand("-use_action_slot_item");
if (!plus || !minus)
return ConColorMsg({ 255, 0, 0, 255 }, "Could not find +use_action_slot_item! INFINITE NOISE MAKER WILL NOT WORK!!!\n");
plus_use_action_slot_item_original = plus->m_fnCommandCallbackV1;
minus_use_action_slot_item_original = minus->m_fnCommandCallbackV1;
plus->m_fnCommandCallbackV1 = plus_use_action_slot_item_hook;
minus->m_fnCommandCallbackV1 = minus_use_action_slot_item_hook;
}
static void shutdown()
{
auto plus = g_ICvar->FindCommand("+use_action_slot_item");
auto minus = g_ICvar->FindCommand("-use_action_slot_item");
if (!plus || !minus)
return ConColorMsg({ 255, 0, 0, 255 }, "Could not find +use_action_slot_item! INFINITE NOISE MAKER WILL NOT WORK!!!\n");
plus->m_fnCommandCallbackV1 = plus_use_action_slot_item_original;
minus->m_fnCommandCallbackV1 = minus_use_action_slot_item_original;
}
static InitRoutine EC([]() {
init();
EC::Register(EC::CreateMove, CreateMove, "Noisemaker", EC::average);
EC::Register(EC::Shutdown, shutdown, "Noisemaker", EC::average);
});
} // namespace hacks::tf2::noisemaker

View File

@ -11,6 +11,7 @@
#include <sys/stat.h>
#include <hacks/SkinChanger.hpp>
#include <settings/Bool.hpp>
#include <boost/functional/hash.hpp>
static settings::Bool enable{ "skinchanger.enable", "false" };
static settings::Bool debug{ "skinchanger.debug", "false" };
@ -95,6 +96,20 @@ void CAttributeList::SetAttribute(int index, float value)
*/
}
static std::array<int, 46> australium_table{ 4, 7, 13, 14, 15, 16, 18, 19, 20, 21, 29, 36, 38, 45, 61, 132, 141, 194, 197, 200, 201, 202, 203, 205, 206, 207, 208, 211, 228, 424, 654, 658, 659, 662, 663, 664, 665, 669, 1000, 1004, 1006, 1007, 1078, 1082, 1085, 1149 };
static std::array<std::pair<int, int>, 12> redirects{ std::pair{ 264, 1071 }, std::pair{ 18, 205 }, std::pair{ 13, 200 }, std::pair{ 21, 208 }, std::pair{ 19, 206 }, std::pair{ 20, 207 }, std::pair{ 15, 202 }, std::pair{ 7, 197 }, std::pair{ 29, 211 }, std::pair{ 14, 201 }, std::pair{ 16, 203 }, std::pair{ 4, 194 } };
static CatCommand australize("australize", "Make everything australium", []() {
enable = true;
for (auto i : redirects)
GetModifier(i.first).defidx_redirect = i.second;
for (auto i : australium_table)
{
GetModifier(i).Set(2027, 1);
GetModifier(i).Set(2022, 1);
GetModifier(i).Set(542, 1);
}
InvalidateCookie();
});
static CatCommand set_attr("skinchanger_set", "Set Attribute", [](const CCommand &args) {
unsigned attrid = strtoul(args.Arg(1), nullptr, 10);
float attrv = strtof(args.Arg(2), nullptr);

View File

@ -59,15 +59,3 @@ CatCommand spectate("spectate", "Spectate", [](const CCommand &args) {
});
#endif
static CatCommand plus_use_action_slot_item_server("+cat_use_action_slot_item_server", "use_action_slot_item_server", []() {
KeyValues *kv = new KeyValues("+use_action_slot_item_server");
g_pLocalPlayer->using_action_slot_item = true;
g_IEngine->ServerCmdKeyValues(kv);
});
static CatCommand minus_use_action_slot_item_server("-cat_use_action_slot_item_server", "use_action_slot_item_server", []() {
KeyValues *kv = new KeyValues("-use_action_slot_item_server");
g_pLocalPlayer->using_action_slot_item = false;
g_IEngine->ServerCmdKeyValues(kv);
});