Merge pull request #3 from nullifiedcat/master

Merge cats changes into my fork
This commit is contained in:
julianacan9999 2017-05-02 12:34:01 -05:00 committed by GitHub
commit 446b3a1d62
21 changed files with 324 additions and 58 deletions

View File

@ -26,7 +26,7 @@
</natures>
<filteredResources>
<filter>
<id>1493478184465</id>
<id>1493731871261</id>
<name></name>
<type>22</type>
<matcher>
@ -35,7 +35,7 @@
</matcher>
</filter>
<filter>
<id>1493478184467</id>
<id>1493731871262</id>
<name></name>
<type>22</type>
<matcher>
@ -44,7 +44,7 @@
</matcher>
</filter>
<filter>
<id>1493478184469</id>
<id>1493731871303</id>
<name></name>
<type>5</type>
<matcher>
@ -52,6 +52,15 @@
<arguments>1.0-location-matches-false-false-res/bin</arguments>
</matcher>
</filter>
<filter>
<id>1493731871305</id>
<name></name>
<type>5</type>
<matcher>
<id>org.eclipse.ui.ide.multiFilter</id>
<arguments>1.0-location-matches-false-false-*</arguments>
</matcher>
</filter>
<filter>
<id>1493660654417</id>
<name>res</name>

View File

@ -20,6 +20,8 @@ void ThirdpersonCallback(IConVar* var, const char* pOldValue, float flOldValue)
}
}
bool need_name_change = true;
CatVar force_name(CV_STRING, "name", "", "Force name");
CatVar cathook(CV_SWITCH, "enabled", "1", "CatHook enabled", "Disabling this completely disables cathook (can be re-enabled)");
CatVar ignore_taunting(CV_SWITCH, "ignore_taunting", "1", "Ignore taunting", "Aimbot/Triggerbot won't attack taunting enemies");
CatVar send_packets(CV_SWITCH, "sendpackets", "1", "Send packets", "Internal use");

View File

@ -25,6 +25,8 @@ extern CatVar force_thirdperson;
extern CatVar console_logging;
extern CatVar fast_outline;
extern CatVar roll_speedhack;
extern CatVar force_name;
extern bool need_name_change;
class GlobalSettings {
public:

View File

@ -46,7 +46,7 @@ void CTextLabel::SetText(std::string text) {
if (ms.first > 0) {
std::string txt = WordWrap(text, ms.first - 2 * padding.first);
auto size2 = draw::GetStringLength(fonts::MENU, txt);
SetSize(-1, size2.second + padding.second * 2);
SetSize(size2.first + padding.first * 2, size2.second + padding.second * 2);
Props()->SetString("text", txt.c_str());
}
}

View File

@ -20,7 +20,7 @@ Item::Item(std::string name) : CBaseWidget(name, nullptr) {
void Item::Draw(int x, int y) {
const auto& size = GetSize();
//draw::DrawRect(x, y, size.first, size.second, colors::red);
draw::DrawRect(x, y, size.first, size.second, colors::Create(0, 0, 0, 65));
draw::DrawRect(x, y, size.first, size.second, colors::Create(0, 0, 0, 77));
if (IsHovered()) {
draw::DrawRect(x, y, size.first, size.second, colors::Transparent(GUIColor(), 0.32f));
}

View File

@ -289,6 +289,25 @@ static const std::string list_tf2 = R"(
"Trigger Bot Menu"
"trigger_enabled"
"autobackstab"
"Auto Vaccinator" [
"Auto Vaccinator"
"auto_vacc"
"auto_vacc_reset_timer"
"auto_vacc_default_resist"
"auto_vacc_bullets"
"auto_vacc_blast"
"auto_vacc_fire"
"auto_vacc_sniper_pop"
"auto_vacc_blast_pop_health"
"auto_vacc_blast_pop_crit"
"auto_vacc_rocket_range"
"auto_vacc_fire_pop_pyro"
"auto_vacc_afterburn"
"auto_vacc_pyro_range"
"auto_vacc_bullet_pop_ubers"
"auto_vacc_blast_pop_ubers"
"auto_vacc_fire_pop_ubers"
]
"Auto Sticky" [
"Auto Sticky Menu"
"sticky_enabled"
@ -505,10 +524,11 @@ static const std::string list_tf2 = R"(
"Chat" [
"Chat Options Menu"
"chat_newlines"
"clean_chat"
"killsay"
"spam"
"spam_newlines"
"clean_chat"
"spam_random"
]
"Follow Bot" [

View File

@ -18,7 +18,7 @@ PlayerList::PlayerList() : CBaseContainer() {
void PlayerList::Draw(int x, int y) {
if (g_Settings.bInvalid) return;
const auto& size = GetSize();
draw::DrawRect(x, y, size.first, size.second, colors::Create(0, 0, 0, 65));
draw::DrawRect(x, y, size.first, size.second, colors::Create(0, 0, 0, 77));
draw::OutlineRect(x, y, size.first, size.second, GUIColor());
for (int i = 0; i < Props()->GetInt("vischildren"); i++) {
draw::DrawLine(x, y + i * 17, size_table_width(), 0, GUIColor());

View File

@ -13,7 +13,7 @@ namespace menu { namespace ncc {
Tooltip::Tooltip() : CTextLabel("ncc_tooltip") {
SetZIndex(999);
SetPadding(2, 1);
SetPadding(3, 2);
SetMaxSize(220, -1);
SetAutoSize(false);
SetSize(220, -1);
@ -25,7 +25,7 @@ void Tooltip::Draw(int x, int y) {
int originy = y;
if (originx + size.first > draw::width) originx -= size.first;
if (originx + size.second > draw::height) originy -= size.second;
static int bgcolor = colors::Create(0, 0, 0, 65); //colors::Create(70, 86, 47, 28);
static int bgcolor = colors::Create(0, 0, 0, 77); //colors::Create(70, 86, 47, 28);
static int fgcolor = colors::Create(200, 200, 190, 255);
draw::DrawRect(x, y, size.first, size.second, bgcolor);
draw::OutlineRect(x, y, size.first, size.second, GUIColor());

View File

@ -26,7 +26,17 @@ static CatVar share_uber(CV_SWITCH, "autoheal_share_uber", "1", "Share ubercharg
int vaccinator_change_stage = 0;
int vaccinator_change_ticks = 0;
int vaccinator_ideal_resist = 0;
int vaccinator_change_timer = 0;
static CatVar auto_vacc_bullets(CV_SWITCH, "auto_vacc_bullets", "1", "Check bullet danger");
static CatEnum vacc_sniper_enum({"NEVER", "ZOOM & VISIBLE", "ANY ZOOMED"});
static CatVar vacc_sniper(vacc_sniper_enum, "auto_vacc_sniper_pop", "1", "Pop if Sniper", "Defines Auto-Vacc behaviour with snipers");
int ChargeCount() {
return (CE_FLOAT(LOCAL_W, netvar.m_flChargeLevel) / 0.25f);
}
// TODO Angle Checking
int BulletDangerValue(CachedEntity* patient) {
// Find zoomed in snipers in other team
bool any_zoomed_snipers = false;
@ -38,39 +48,85 @@ int BulletDangerValue(CachedEntity* patient) {
if (!HasCondition(ent, TFCond_Zoomed)) continue;
any_zoomed_snipers = true;
// TODO VisCheck from patient.
if (!IsEntityVisible(ent, head)) continue;
return 2;
if ((int)vacc_sniper == 1)
if (!IsEntityVisible(ent, head)) continue;
return vacc_sniper ? 2 : 1;
}
return any_zoomed_snipers;
}
static CatVar auto_vacc_fire_checking(CV_SWITCH, "auto_vacc_fire", "1", "Check fire danger");
static CatEnum pyro_enum({"NEVER", "PRIMARY OUT", "ALWAYS"});
static CatVar auto_vacc_pop_if_pyro(pyro_enum, "auto_vacc_fire_pop_pyro", "1", "Pop if pyro is near", "Defines Auto-Vacc behaviour with pyros");
static CatVar auto_vacc_check_on_fire(CV_SWITCH, "auto_vacc_afterburn", "1", "Anti-Afterburn");
static CatVar auto_vacc_pyro_range(CV_INT, "auto_vacc_pyro_range", "450", "Pyro Danger Range");
int FireDangerValue(CachedEntity* patient) {
// Find nearby pyros
for (int i = 1; i < 32 && i < HIGHEST_ENTITY; i++) {
CachedEntity* ent = ENTITY(i);
if (!ent->m_bEnemy) continue;
if (g_pPlayerResource->GetClass(ent) != tf_pyro) continue;
if (CE_BYTE(ent, netvar.iLifeState)) continue;
if (patient->m_vecOrigin.DistToSqr(ent->m_vecOrigin) > 300.0f * 300.0f) continue;
IClientEntity* pyro_weapon = g_IEntityList->GetClientEntity(CE_INT(ent, netvar.hActiveWeapon) & 0xFFF);
return (pyro_weapon && pyro_weapon->GetClientClass()->m_ClassID == g_pClassID->CTFFlameThrower) ? 2 : 0;
if (!auto_vacc_fire_checking) return 0;
if (auto_vacc_pop_if_pyro) {
for (int i = 1; i < 32 && i < HIGHEST_ENTITY; i++) {
CachedEntity* ent = ENTITY(i);
if (!ent->m_bEnemy) continue;
if (g_pPlayerResource->GetClass(ent) != tf_pyro) continue;
if (CE_BYTE(ent, netvar.iLifeState)) continue;
if (patient->m_vecOrigin.DistTo(ent->m_vecOrigin) > (int)auto_vacc_pyro_range) continue;
if ((int)auto_vacc_pop_if_pyro == 2) return 2;
IClientEntity* pyro_weapon = g_IEntityList->GetClientEntity(CE_INT(ent, netvar.hActiveWeapon) & 0xFFF);
return (pyro_weapon && pyro_weapon->GetClientClass()->m_ClassID == g_pClassID->CTFFlameThrower) ? 2 : 0;
}
}
if (HasCondition(patient, TFCond_OnFire)) {
return 1;
return (bool)auto_vacc_check_on_fire;
}
return 0;
}
struct proj_data_s {
int eid;
Vector last_pos;
};
std::vector<proj_data_s> proj_data_array;
static CatVar auto_vacc_blast_health(CV_INT, "auto_vacc_blast_pop_health", "80", "Pop Blast if rocket & HP <");
static CatVar auto_vacc_blast_crit_pop(CV_SWITCH, "auto_vacc_blast_pop_crit", "1", "Pop Blast if crit rocket near");
static CatVar auto_vacc_blast_checking(CV_SWITCH, "auto_vacc_blast", "1", "Check blast danger");
static CatVar auto_vacc_proj_danger_range(CV_INT, "auto_vacc_rocket_range", "650", "Rocket Danger Range", "This range should be high enough to give more time to change resistances.");
int BlastDangerValue(CachedEntity* patient) {
if (!auto_vacc_blast_checking) return 0;
// Check rockets for being closer
bool hasCritRockets = false;
bool hasRockets = false;
for (auto it = proj_data_array.begin(); it != proj_data_array.end();) {
const auto& d = *it;
CachedEntity* ent = ENTITY(d.eid);
if (CE_GOOD(ent)) {
// Rocket is getting closer
if (patient->m_vecOrigin.DistToSqr(d.last_pos) > patient->m_vecOrigin.DistToSqr(ent->m_vecOrigin)) {
if (ent->m_bCritProjectile) hasCritRockets = true;
hasRockets = true;
}
it++;
} else {
proj_data_array.erase(it);
}
}
if (hasRockets) {
if (patient->m_iHealth < (int)auto_vacc_blast_health || (auto_vacc_blast_crit_pop && hasCritRockets)) {
return 2;
}
return 1;
}
// Find crit rockets/pipes nearby
for (int i = 32; i < HIGHEST_ENTITY; i++) {
CachedEntity* ent = ENTITY(i);
if (CE_BAD(ent)) continue;
if (!ent->m_bEnemy) continue;
if (ent->m_Type != ENTITY_PROJECTILE) continue;
if (patient->m_vecOrigin.DistToSqr(ent->m_vecOrigin) > 420.0f * 420.0f) continue;
// TODO Velocity checking
return ((ent->m_bCritProjectile || (patient->m_iHealth < 80)) ? 2 : 1);
if (patient->m_vecOrigin.DistTo(ent->m_vecOrigin) > (int)auto_vacc_proj_danger_range) continue;
proj_data_array.push_back(proj_data_s{i, ent->m_vecOrigin});
}
return 0;
}
@ -80,21 +136,36 @@ int CurrentResistance() {
return CE_INT(LOCAL_W, netvar.m_nChargeResistType);
}
static CatVar change_timer(CV_INT, "auto_vacc_reset_timer", "200", "Reset Timer", "If no dangers were detected for # ticks, resistance will be reset to default, 0 to disable");
static CatVar auto_vacc_bullet_pop_ubers(CV_INT, "auto_vacc_bullet_pop_ubers", "0", "Pop Bullet if Ubers >=", "Only pop an uber if you have >= # Ubercharges in your Vaccinator", 0, 4);
static CatVar auto_vacc_fire_pop_ubers(CV_INT, "auto_vacc_fire_pop_ubers", "0", "Pop Fire if Ubers >=", "Only pop an uber if you have >= # Ubercharges in your Vaccinator", 0, 4);
static CatVar auto_vacc_blast_pop_ubers(CV_INT, "auto_vacc_blast_pop_ubers", "0", "Pop Blast if Ubers >=", "Only pop an uber if you have >= # Ubercharges in your Vaccinator", 0, 4);
int OptimalResistance(CachedEntity* patient, bool* shouldPop) {
int bd = BlastDangerValue(patient),
fd = FireDangerValue(patient),
hd = BulletDangerValue(patient);
if (shouldPop) {
if (bd > 1 || fd > 1 || hd > 1) *shouldPop = true;
int charges = ChargeCount();
if (bd > 1 && charges >= (int)auto_vacc_blast_pop_ubers) *shouldPop = true;
if (fd > 1 && charges >= (int)auto_vacc_fire_pop_ubers) *shouldPop = true;
if (hd > 1 && charges >= (int)auto_vacc_bullet_pop_ubers) *shouldPop = true;
}
if (!hd && !fd && !bd) return -1;
vaccinator_change_timer = (int)change_timer;
if (hd >= fd && hd >= bd) return 0;
if (bd >= fd && bd >= hd) return 1;
if (fd >= hd && fd >= bd) return 2;
return -1;
}
static CatEnum resistances_enum({"BULLET", "BLAST", "FIRE"});
static CatVar default_resistance(resistances_enum, "auto_vacc_default_resist", "0", "Default Resistance", "Select default resistance type");
void SetResistance(int resistance) {
resistance = _clamp(0, 2, resistance);
vaccinator_change_timer = (int)change_timer;
vaccinator_ideal_resist = resistance;
int cur = CurrentResistance();
if (resistance == cur) return;
@ -103,6 +174,12 @@ void SetResistance(int resistance) {
}
void DoResistSwitching() {
if (vaccinator_change_timer > 0) {
if (vaccinator_change_timer == 1) {
SetResistance((int)default_resistance);
}
vaccinator_change_timer--;
}
if (!vaccinator_change_stage) return;
if (CurrentResistance() == vaccinator_ideal_resist) {
vaccinator_change_ticks = 0;

View File

@ -10,16 +10,13 @@
#include "../sdk.h"
#include <pwd.h>
void KillSayEventListener::FireGameEvent(IGameEvent* event) {
if (!hacks::shared::killsay::enabled) return;
std::string message = hacks::shared::killsay::ComposeKillSay(event);
if (message.size()) {
chat_stack::stack.push(message);
}
}
namespace hacks { namespace shared { namespace killsay {
static CatEnum killsay_enum({"NONE", "CUSTOM", "DEFAULT", "NCC - OFFENSIVE", "NCC - MLG"});
static CatVar killsay_mode(killsay_enum, "killsay", "0", "Killsay", "Defines source of killsay lines. CUSTOM killsay file must be set in cat_killsay_file and loaded with cat_killsay_reload (Use console!)");
static CatVar filename(CV_STRING, "killsay_file", "killsays.txt", "Killsay file (~/.cathook/)", "Killsay file name. Should be located in ~/.cathook folder.");
static CatCommand reload("killsay_reload", "Reload killsays", Reload);
const std::string tf_classes_killsay[] = {
"class",
"scout",
@ -41,13 +38,24 @@ const std::string tf_teams_killsay[] = {
TextFile file {};
std::string ComposeKillSay(IGameEvent* event) {
if (file.LineCount() == 0) return "";
const std::vector<std::string>* source = nullptr;
switch ((int)killsay_mode) {
case 1:
source = &file.lines; break;
case 2:
source = &builtin_default; break;
case 3:
source = &builtin_nonecore_offensive; break;
case 4 :
source = &builtin_nonecore_mlg; break;
}
if (!source || source->size() == 0) return "";
if (!event) return "";
int vid = event->GetInt("userid");
int kid = event->GetInt("attacker");
if (kid == vid) return "";
if (g_IEngine->GetPlayerForUserID(kid) != g_IEngine->GetLocalPlayer()) return "";
std::string msg = file.Line(rand() % file.LineCount());
std::string msg = source->at(rand() % source->size());
player_info_s info;
g_IEngine->GetPlayerInfo(g_IEngine->GetPlayerForUserID(vid), &info);
ReplaceString(msg, "%name%", std::string(info.name));
@ -64,10 +72,6 @@ std::string ComposeKillSay(IGameEvent* event) {
return msg;
}
CatVar enabled(CV_SWITCH, "killsay", "0", "KillSay", "Enable KillSay");
CatVar filename(CV_STRING, "killsay_file", "killsays.txt", "Killsay file (~/.cathook/)", "Killsay file name. Should be located in ~/.cathook folder.");
CatCommand reload("killsay_reload", "Reload killsays", Reload);
KillSayEventListener& getListener() {
static KillSayEventListener listener;
return listener;
@ -85,4 +89,47 @@ void Shutdown() {
g_IEventManager2->RemoveListener(&getListener());
}
// Thanks HellJustFroze for linking me http://daviseford.com/shittalk/
const std::vector<std::string> builtin_default = {
"Don't worry guys, I'm a garbage collector. I'm used to carrying trash.",
"%name% is the human equivalent of a participation award.",
"I would insult %name%, but nature did a better job.",
"%name%, perhaps your strategy should include trying.",
"Some people get paid to suck, you do it for free, %name%.",
"%name%, I'd tell you to commit suicide, but then you'd have a kill.",
"You must really like that respawn timer, %name%.",
"If your main is %class%, you should give up.",
"Hey %name%, i see you can't play %class%. Try quitting the game."
"%team% is filled with spergs",
"%name%@gmail.com to vacreview@valvesoftware.com\nFOUND CHEATER",
"\n☐ Not rekt\n ☑ Rekt\n ☑ Really Rekt\n ☑ Tyrannosaurus Rekt"
};
const std::vector<std::string> builtin_nonecore_offensive = {
"%name%, you are noob.", "%name%, do you even lift?", "%name%, you're a faggot.", "%name%, stop cheating.",
"%name%: Mom, call the police - I've got headshoted again!", "Right into your face, %name%.",
"Into your face, pal.", "Keep crying, baby.", "Faggot. Noob.", "You are dead, not big surprise.",
"Sit down nerd.", "Fuck you with a rake.", "Eat a man spear, you Jamaican manure salesman.",
"Wallow in a river of cocks, you pathetic bitch.", "I will go to heaven and you will be in prison.",
"Piss off, you poor, ignorant, mullet-wearing porch monkey.",
"Your Mom says your turn-ons consist of butthole licking and scat porn.",
"Shut up, you'll never be the man your mother is.",
"It looks like your face caught on fire and someone tried to put it out with a fork.",
"You're so ugly Hello Kitty said goodbye to you.",
"Don't you love nature, despite what it did to you?"
};
const std::vector<std::string> builtin_nonecore_mlg = {
"GET REKT U SCRUB", "GET REKT M8", "U GOT NOSCOPED M8", "U GOT QUICKSCOPED M8", "2 FAST 4 U, SCRUB", "U GOT REKT, M8"
};
}}}
void KillSayEventListener::FireGameEvent(IGameEvent* event) {
if (!hacks::shared::killsay::killsay_mode) return;
std::string message = hacks::shared::killsay::ComposeKillSay(event);
if (message.size()) {
chat_stack::stack.push(message);
}
}

View File

@ -8,10 +8,7 @@
#ifndef HACKS_KILLSAY_H_
#define HACKS_KILLSAY_H_
#include "IHack.h"
#include "../fixsdk.h"
#include <igameevents.h>
#include "../common.h"
class CatCommand;
@ -22,15 +19,15 @@ class KillSayEventListener : public IGameEventListener2 {
namespace hacks { namespace shared { namespace killsay {
extern CatVar enabled;
extern CatVar filename;
extern CatCommand reload;
void Init();
void Shutdown();
void Reload();
std::string ComposeKillSay(IGameEvent* event);
extern const std::vector<std::string> builtin_default;
extern const std::vector<std::string> builtin_nonecore_offensive;
extern const std::vector<std::string> builtin_nonecore_mlg;
}}}
#endif /* HACKS_KILLSAY_H_ */

View File

@ -325,7 +325,7 @@ CatVar crit_suppress(CV_SWITCH, "crit_suppress", "0", "Disable random crits", "C
CatVar anti_afk(CV_SWITCH, "anti_afk", "0", "Anti-AFK", "Sends random commands to prevent being kicked from server");
CatVar tauntslide(CV_SWITCH, "tauntslide", "0", "TF2C tauntslide", "Allows moving and shooting while taunting");
CatCommand name("name", "Change name", [](const CCommand& args) {
CatCommand name("name_set", "Immediate name change", [](const CCommand& args) {
if (args.ArgC() < 2) {
logging::Info("Set a name, silly");
return;

View File

@ -11,10 +11,10 @@
#include <pwd.h>
namespace hacks { namespace shared { namespace spam {
CatVar enabled(CV_SWITCH, "spam", "0", "Chat spam", "Enable Spam");
static CatEnum spam_enum({"DISABLED", "DEFAULT", "LENNYFACES", "BLANKS", "FROM FILE"});
CatVar spam_source(spam_enum, "spam", "0", "Chat Spam", "Defines source of spam lines. CUSTOM spam file must be set in cat_spam_file and loaded with cat_spam_reload (Use console!)");
CatVar random_order(CV_SWITCH, "spam_random", "0", "Random Order");
CatVar filename(CV_STRING, "spam_file", "spam.txt", "Spam file (~/.cathook/...)", "Spam file name. Each line should be no longer than 100 characters, file must be located in ~/.cathook folder");
CatVar newlines(CV_SWITCH, "spam_newlines", "1", "Spam newlines", "If enabled, several newlines will be added before each message");
CatCommand reload("spam_reload", "Reload spam file", Reload);
int current_index { 0 };
@ -22,13 +22,27 @@ float last_spam { 0.0f };
TextFile file {};
void CreateMove() {
if (!enabled) return;
if (!spam_source) return;
if (last_spam > g_GlobalVars->curtime) last_spam = 0.0f;
if (!file.LineCount()) return;
const std::vector<std::string>* source = nullptr;
switch ((int)spam_source) {
case 1:
source = &builtin_default; break;
case 2:
source = &builtin_lennyfaces; break;
case 3:
source = &builtin_blanks; break;
case 4:
source = &file.lines; break;
default:
return;
}
if (!source || !source->size()) return;
if (g_GlobalVars->curtime - last_spam > 0.8f) {
if (chat_stack::stack.empty()) {
if (current_index >= file.LineCount()) current_index = 0;
std::string spamString = (newlines ? format("\n\n\n\n\n\n\n\n\n\n\n\n", file.Line(current_index)) : file.Line(current_index));
if (current_index >= source->size()) current_index = 0;
if (random_order) current_index = rand() % source->size();
std::string spamString = source->at(current_index);
ReplaceString(spamString, "\\n", "\n");
chat_stack::stack.push(spamString);
current_index++;
@ -44,4 +58,18 @@ void Reload() {
file.Load(std::string(filename.GetString()));
}
const std::vector<std::string> builtin_default = {
"cathook - more fun than a ball of yarn!",
"GNU/Linux is the best OS!",
"get cathook: discord.gg/7bu3AFw",
"cathook - free tf2 cheat!"
};
const std::vector<std::string> builtin_lennyfaces = {
"( ͡° ͜ʖ ͡°)", "( ͡°( ͡° ͜ʖ( ͡° ͜ʖ ͡°)ʖ ͡°) ͡°)", "ʕ•ᴥ•ʔ",
"(▀̿Ĺ̯▀̿ ̿)", "( ͡°╭͜ʖ╮͡° )", "(ง'̀-'́)ง", "(◕‿◕✿)",
"༼ つ ͡° ͜ʖ ͡° ༽つ" };
const std::vector<std::string> builtin_blanks = {
". \n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n "
};
}}}

View File

@ -16,9 +16,12 @@ class CatCommand;
namespace hacks { namespace shared { namespace spam {
extern const std::vector<std::string> builtin_default;
extern const std::vector<std::string> builtin_lennyfaces;
extern const std::vector<std::string> builtin_blanks;
extern CatVar enabled;
extern CatVar filename;
extern CatVar newlines;
extern CatCommand reload;
void CreateMove();

View File

@ -94,7 +94,7 @@ bool CreateMove_hook(void* thisptr, float inputSample, CUserCmd* cmd) {
hooks::hkNetChannel = new hooks::VMTHook();
hooks::hkNetChannel->Init(ch, 0);
hooks::hkNetChannel->HookMethod((void*)CanPacket_hook, hooks::offCanPacket);
//hooks::hkNetChannel->HookMethod((void*)SendNetMsg_hook, hooks::offSendNetMsg);
hooks::hkNetChannel->HookMethod((void*)SendNetMsg_hook, hooks::offSendNetMsg);
hooks::hkNetChannel->HookMethod((void*)Shutdown_hook, hooks::offShutdown);
hooks::hkNetChannel->Apply();
}

View File

@ -13,6 +13,7 @@
#include "../segvcatch/segvcatch.h"
#include "../copypasted/CSignature.h"
#include "../profiler.h"
#include "../netmessage.h"
CatVar clean_screenshots(CV_SWITCH, "clean_screenshots", "1", "Clean screenshots", "Don't draw visuals while taking a screenshot");
CatVar disable_visuals(CV_SWITCH, "no_visuals", "0", "Disable ALL drawing", "Completely hides cathook");
@ -57,6 +58,18 @@ void PaintTraverse_hook(void* p, unsigned int vp, bool fr, bool ar) {
g_ISurface->SetCursorAlwaysVisible(vis);
}
if (force_name.convar->m_StringLength > 2 && need_name_change) {
INetChannel* ch = (INetChannel*)g_IEngine->GetNetChannelInfo();
if (ch) {
logging::Info("Sending new name");
NET_SetConVar setname("name", force_name.GetString());
setname.SetNetChannel(ch);
setname.SetReliable(false);
ch->SendNetMsg(setname, false);
need_name_change = false;
}
}
if (call_default) SAFE_CALL(((PaintTraverse_t*)hooks::hkPanel->GetMethod(hooks::offPaintTraverse))(p, vp, fr, ar));
// To avoid threading problems.
@ -111,6 +124,16 @@ void PaintTraverse_hook(void* p, unsigned int vp, bool fr, bool ar) {
#endif
AddSideString("Press 'INSERT' key to open/close cheat menu.", GUIColor());
AddSideString("Use mouse to navigate in menu.", GUIColor());
if (!g_IEngine->IsInGame() || g_pGUI->Visible()) {
const char* name = (force_name.convar->m_StringLength > 2 ? force_name.GetString() : "*Not Set*");
AddSideString(""); // foolish
std::string name_stripped(name); // RIP fps
ReplaceString(name_stripped, "\n", "\\n");
std::string reason_stripped(disconnect_reason.GetString());
ReplaceString(reason_stripped, "\n", "\\n");
AddSideString(format("Custom Name: ", name_stripped), GUIColor());
AddSideString(format("Custom Disconnect Reason: ", (reason_stripped.length() > 3 ? reason_stripped : "*Not Set*")), GUIColor());
}
}
if (CE_GOOD(g_pLocalPlayer->entity) && !g_Settings.bInvalid) {

View File

@ -107,9 +107,29 @@ static CatCommand minus_use_action_slot_item_server("-cat_use_action_slot_item_s
g_IEngine->ServerCmdKeyValues(kv);
});
// Not used anymore..
static CatVar newlines_msg(CV_INT, "chat_newlines", "0", "Prefix newlines", "Add # newlines before each your message");
//static CatVar queue_messages(CV_SWITCH, "chat_queue", "0", "Queue messages", "Use this if you want to use spam/killsay and still be able to chat normally (without having your msgs eaten by valve cooldown)");
bool SendNetMsg_hook(void* thisptr, INetMessage& msg, bool bForceReliable = false, bool bVoice = false) {
SEGV_BEGIN;
// net_StringCmd
if (msg.GetType() == 4 && (newlines_msg)) {
std::string str(msg.ToString());
auto say_idx = str.find("net_StringCmd: \"say \"");
auto say_team_idx = str.find("net_StringCmd: \"say_team \"");
if (!say_idx || !say_team_idx) {
int offset = say_idx ? 26 : 21;
if (newlines_msg) {
std::string newlines = std::string((int)newlines_msg, '\n');
str.insert(offset, newlines);
}
str = str.substr(16, str.length() - 17);
//if (queue_messages && !chat_stack::CanSend()) {
NET_StringCmd stringcmd(str.c_str());
return ((SendNetMsg_t*)hooks::hkNetChannel->GetMethod(hooks::offSendNetMsg))(thisptr, stringcmd, bForceReliable, bVoice);
//}
}
}
if (log_sent && msg.GetType() != 3 && msg.GetType() != 9) {
logging::Info("=> %s [%i] %s", msg.GetName(), msg.GetType(), msg.ToString());
unsigned char buf[4096];
@ -269,16 +289,48 @@ void LevelInit_hook(void* thisptr, const char* newmap) {
//if (TF) LEVEL_INIT(SpyAlert);
chat_stack::Reset();
hacks::shared::spam::Reset();
need_name_change = true;
if (force_name.convar->m_StringLength > 2) {
//static ConVar* name_cv = g_ICvar->FindVar("name");
INetChannel* ch = (INetChannel*)g_IEngine->GetNetChannelInfo();
if (ch) {
logging::Info("Sending new name");
NET_SetConVar setname("name", force_name.GetString());
setname.SetNetChannel(ch);
setname.SetReliable(false);
ch->SendNetMsg(setname, false);
//name_cv->m_pszString = strfmt("%s", force_name.GetString());
}
static ConVar* name_cv = g_ICvar->FindVar("name");
name_cv->SetValue(force_name.GetString());
name_cv->m_pszString = (char*)strfmt("%s", force_name.GetString());
}
}
bool CanInspect_hook(IClientEntity*) { return true; }
void LevelShutdown_hook(void* thisptr) {
need_name_change = true;
playerlist::Save();
((LevelShutdown_t*) hooks::hkClientMode->GetMethod(hooks::offLevelShutdown))(thisptr);
g_Settings.bInvalid = true;
hacks::shared::aimbot::Reset();
chat_stack::Reset();
hacks::shared::spam::Reset();
if (force_name.convar->m_StringLength > 2) {
//static ConVar* name_cv = g_ICvar->FindVar("name");
INetChannel* ch = (INetChannel*)g_IEngine->GetNetChannelInfo();
if (ch) {
logging::Info("Sending new name");
NET_SetConVar setname("name", force_name.GetString());
setname.SetNetChannel(ch);
setname.SetReliable(false);
ch->SendNetMsg(setname, false);
//name_cv->m_pszString = strfmt("%s", force_name.GetString());
}
static ConVar* name_cv = g_ICvar->FindVar("name");
name_cv->SetValue(force_name.GetString());
name_cv->m_pszString = (char*)strfmt("%s", force_name.GetString());
}
}

View File

@ -12,6 +12,9 @@ class INetMessage;
class CViewSetup;
class bf_read;
class SDL_Window;
class CatVar;
extern CatVar disconnect_reason;
bool CanPacket_hook(void*);
int IN_KeyEvent_hook(void*, int, int, const char*);

View File

@ -37,6 +37,7 @@ void NetVars::Init() {
this->_condition_bits = gNetvars.get_offset("DT_TFPlayer", "m_Shared", "m_ConditionList", "_condition_bits");
this->m_flStealthNoAttackExpire = gNetvars.get_offset("DT_TFPlayer", "m_Shared", "tfsharedlocaldata", "m_flStealthNoAttackExpire");
this->m_nChargeResistType = gNetvars.get_offset("DT_WeaponMedigun", "m_nChargeResistType");
this->m_flChargeLevel = gNetvars.get_offset("DT_WeaponMedigun", "NonLocalTFWeaponMedigunData", "m_flChargeLevel");
}
if (TF2 || TF2C) {
this->res_iMaxHealth = gNetvars.get_offset("DT_TFPlayerResource", "m_iMaxHealth");

View File

@ -125,6 +125,7 @@ public:
offset_t m_Collision;
offset_t res_iTeam;
offset_t m_nChargeResistType;
offset_t m_flChargeLevel;
};
extern NetVars netvar;

View File

@ -15,6 +15,7 @@ SpoofedConVar::SpoofedConVar(ConVar* var) : original(var) {
int flags = var->m_nFlags;
const char* name = var->m_pszName;
char* s_name = strfmt("q_%s", name);
if (g_ICvar->FindVar(s_name)) return;
var->m_pszName = s_name;
var->m_nFlags = 0;
ConVar* svar = new ConVar(name, var->m_pszDefaultValue, flags, var->m_pszHelpString, var->m_bHasMin, var->m_fMinVal, var->m_bHasMax, var->m_fMaxVal, var->m_fnChangeCallback);