crithac
This commit is contained in:
parent
8ee2c1c23a
commit
445cd14973
@ -347,11 +347,12 @@ Misc::Misc() {
|
||||
//v_bDumpEventInfo = CreateConVar(CON_PREFIX "debug_event_info", "0", "Show event info");
|
||||
CreateConCommand(CON_PREFIX "set", CC_SetValue, "Set ConVar value (if third argument is 1 the ^'s will be converted into newlines)");
|
||||
if (TF2C) v_bTauntSlide = new CatVar(CV_SWITCH, "tauntslide", "0", "Taunt Slide", NULL, "Works only in TF2 Classic!");
|
||||
if (TF) v_bCritHack = new CatVar(CV_SWITCH, "crits", "0", "Crit Hack", NULL, "Works only in TF2 Classic!");
|
||||
if (TF) v_bCritHack = new CatVar(CV_SWITCH, "crits", "0", "Crit Hack", NULL, "BindToggle that to a key, while enabled, you can only shoot criticals. Be careful not to exhaust the crit bucket!");
|
||||
//v_bDebugCrits = new CatVar(CV_SWITCH, "debug_crits", "0", "Debug Crits", NULL, "???");
|
||||
v_bCleanChat = new CatVar(CV_SWITCH, "clean_chat", "1", "Remove newlines from messages", NULL, "Removes newlines from messages, at least it should do that. Might be broken.");
|
||||
if (TF2) c_Schema = CreateConCommand(CON_PREFIX "schema", CC_Misc_Schema, "Load item schema");
|
||||
if (TF) v_bDebugCrits = new CatVar(CV_SWITCH, "debug_crits", "0", "???", NULL, "???");
|
||||
if (TF) v_bSuppressCrits = new CatVar(CV_SWITCH, "suppress_crits", "1", "Suppress non-forced crits", NULL, "Helps to save the crit bucket");
|
||||
//if (TF2) v_bHookInspect = new CatVar(CV_SWITCH, "hook_inspect", "0", "Hook CanInspect", NULL, "Once enabled, can't be turned off. cathook can't be unloaded after enabling it");
|
||||
//interfaces::eventManager->AddListener(&listener, "player_death", false);
|
||||
}
|
||||
@ -409,109 +410,113 @@ void Misc::ProcessUserCmd(CUserCmd* cmd) {
|
||||
RemoveCondition(LOCAL_E, TFCond_Taunting);
|
||||
|
||||
static ConVar* criticals = interfaces::cvar->FindVar("tf_weapon_criticals");
|
||||
if (CE_GOOD(LOCAL_W) && TF && v_bCritHack->GetBool() && criticals->GetBool()) {
|
||||
bool crit = false;
|
||||
if (CE_GOOD(LOCAL_W) && TF && criticals->GetBool()) {
|
||||
IClientEntity* weapon = RAW_ENT(LOCAL_W);
|
||||
if (TF2C) {
|
||||
if (vfunc<bool(*)(IClientEntity*)>(weapon, 1824 / 4, 0)(weapon)) {
|
||||
static uintptr_t CalcIsAttackCritical_s = gSignatures.GetClientSignature("55 89 E5 56 53 83 EC 10 8B 5D 08 89 1C 24 E8 ? ? ? ? 85 C0 89 C6 74 59 8B 00 89 34 24 FF 90 E0 02 00 00 84 C0 74 4A A1 ? ? ? ? 8B 40 04 3B 83 A8 09 00 00 74 3A");
|
||||
typedef void(*CalcIsAttackCritical_t)(IClientEntity*);
|
||||
CalcIsAttackCritical_t CIACFn = (CalcIsAttackCritical_t)(CalcIsAttackCritical_s);
|
||||
if (cmd->buttons & IN_ATTACK) {
|
||||
*(float*)((uintptr_t)weapon + 2468ul) = 0.0f;
|
||||
int tries = 0;
|
||||
static int lcmdn = 0;
|
||||
bool crit = *(bool*)((uintptr_t)RAW_ENT(LOCAL_W) + 2454ul);
|
||||
static int& seed = *(int*)(sharedobj::client->lmap->l_addr + 0x00D53F68ul);
|
||||
bool cmds = false;
|
||||
seed = MD5_PseudoRandom(cmd->command_number) & 0x7fffffff;
|
||||
*(float*)((uintptr_t)weapon + 2468ul) = 0.0f;
|
||||
int tries = 0;
|
||||
static int lcmdn = 0;
|
||||
crit = *(bool*)((uintptr_t)RAW_ENT(LOCAL_W) + 2454ul);
|
||||
static int& seed = *(int*)(sharedobj::client->lmap->l_addr + 0x00D53F68ul);
|
||||
bool cmds = false;
|
||||
seed = MD5_PseudoRandom(cmd->command_number) & 0x7fffffff;
|
||||
RandomSeed(seed);
|
||||
CIACFn(RAW_ENT(LOCAL_W));
|
||||
crit = *(bool*)((uintptr_t)RAW_ENT(LOCAL_W) + 2454ul);
|
||||
/*while (!crit && (tries < 200)) {
|
||||
*(int*)(weapon + 2472) = 0;
|
||||
seed = MD5_PseudoRandom(++lcmdn) & 0x7fffffff;
|
||||
tries++;
|
||||
RandomSeed(seed);
|
||||
CIACFn(RAW_ENT(LOCAL_W));
|
||||
crit = *(bool*)((uintptr_t)RAW_ENT(LOCAL_W) + 2454ul);
|
||||
/*while (!crit && (tries < 200)) {
|
||||
*(int*)(weapon + 2472) = 0;
|
||||
seed = MD5_PseudoRandom(++lcmdn) & 0x7fffffff;
|
||||
tries++;
|
||||
RandomSeed(seed);
|
||||
CIACFn(RAW_ENT(LOCAL_W));
|
||||
crit = *(bool*)((uintptr_t)RAW_ENT(LOCAL_W) + 2454ul);
|
||||
cmds = true;
|
||||
}*/
|
||||
if (!crit) cmd->buttons &= ~IN_ATTACK;
|
||||
else {
|
||||
/*logging::Info("Got crit at CMD # %i", lcmdn);
|
||||
if (cmds) {
|
||||
cmd->command_number = lcmdn;
|
||||
cmd->random_seed = MD5_PseudoRandom(lcmdn) & 0x7fffffff;
|
||||
}*/
|
||||
}
|
||||
//logging::Info("Seed: %i", seed);
|
||||
/*while (!crit && tries < 50) {
|
||||
tries++;
|
||||
//crit = (vfunc<bool(*)(IClientEntity*)>(RAW_ENT(LOCAL_W), 1764 / 4, 0))(RAW_ENT(LOCAL_W));
|
||||
}*/
|
||||
}
|
||||
cmds = true;
|
||||
}*/
|
||||
//logging::Info("Seed: %i", seed);
|
||||
/*while (!crit && tries < 50) {
|
||||
tries++;
|
||||
//crit = (vfunc<bool(*)(IClientEntity*)>(RAW_ENT(LOCAL_W), 1764 / 4, 0))(RAW_ENT(LOCAL_W));
|
||||
}*/
|
||||
}
|
||||
} else if (TF2) {
|
||||
if (vfunc<bool(*)(IClientEntity*)>(weapon, 1944 / 4, 0)(weapon)) {
|
||||
static uintptr_t CalcIsAttackCritical_s = gSignatures.GetClientSignature("55 89 E5 83 EC 28 89 5D F4 8B 5D 08 89 75 F8 89 7D FC 89 1C 24 E8 ? ? ? ? 85 C0 89 C6 74 60 8B 00 89 34 24 FF 90 E0 02 00 00 84 C0 74 51 A1 ? ? ? ? 8B 40 04");
|
||||
typedef void(*CalcIsAttackCritical_t)(IClientEntity*);
|
||||
CalcIsAttackCritical_t CIACFn = (CalcIsAttackCritical_t)(CalcIsAttackCritical_s);
|
||||
if (cmd->buttons & IN_ATTACK) {
|
||||
//*(float*)((uintptr_t)weapon + 2468ul) = 0.0f;
|
||||
//bool crit = *(bool*)((uintptr_t)RAW_ENT(LOCAL_W) + 2830ul);
|
||||
*(float*)(weapon + 2612ul) = 1000.0f;
|
||||
if (cmd->command_number) {
|
||||
int tries = 0;
|
||||
static int cmdn = 0;
|
||||
crit = false;
|
||||
bool chc = false;
|
||||
if (false) {
|
||||
while (!crit && (tries < 4000)) {
|
||||
cmdn++;
|
||||
tries++;
|
||||
int md5seed = MD5_PseudoRandom(cmdn) & 0x7fffffff;
|
||||
int rseed = md5seed;//*(int*)(weapon + 52ul);
|
||||
int& a = *(int*)((uintptr_t)(sharedobj::client->lmap->l_addr) + 0x1F6D4A8);
|
||||
a = md5seed;
|
||||
int c = LOCAL_W->m_IDX << 8;
|
||||
int b = LOCAL_E->m_IDX;
|
||||
rseed = rseed ^ (b | c);
|
||||
*(float*)(weapon + 2856ul) = 0.0f;
|
||||
RandomSeed(rseed);
|
||||
crit = vfunc<bool(*)(IClientEntity*)>(weapon, 1836 / 4, 0)(weapon);
|
||||
}
|
||||
} else {
|
||||
int md5seed = MD5_PseudoRandom(cmd->command_number) & 0x7fffffff;
|
||||
int rseed = md5seed;
|
||||
int& a = *(int*)((uintptr_t)(sharedobj::client->lmap->l_addr) + 0x01F8B228);
|
||||
a = md5seed;
|
||||
int c = LOCAL_W->m_IDX << 8;
|
||||
int b = LOCAL_E->m_IDX;
|
||||
rseed = rseed ^ (b | c);
|
||||
*(float*)(weapon + 2856ul) = 0.0f;
|
||||
RandomSeed(rseed);
|
||||
crit = vfunc<bool(*)(IClientEntity*)>(weapon, 1836 / 4, 0)(weapon);
|
||||
}
|
||||
//if (!crit) cmd->buttons &= ~IN_ATTACK;
|
||||
//else {
|
||||
/*logging::Info("found crit at cmd # %i # %i # %i", cmdn, cmd->command_number, tries);
|
||||
if (chc) {
|
||||
cmd->random_seed = MD5_PseudoRandom(cmdn) & 0x7fffffff;
|
||||
cmd->command_number = cmdn;
|
||||
}*/
|
||||
//}
|
||||
/*float bucket = *(float*)(weapon + 2612ul);
|
||||
int md5seed = MD5_PseudoRandom(cmd->command_number) & 0x7fffffff;
|
||||
int rseed = md5seed;
|
||||
int a = *(int*)((uintptr_t)(sharedobj::client->lmap->l_addr) + 0x1F6D4A8);
|
||||
int b = vfunc<int(*)(IClientEntity*)>(RAW_ENT(LOCAL_E), 316 / 4, 0)(RAW_ENT(LOCAL_E));
|
||||
int c = vfunc<int(*)(IClientEntity*)>(weapon, 316 / 4, 0)(weapon) << 8;
|
||||
rseed = a ^ (b | c);
|
||||
int& a = *(int*)((uintptr_t)(sharedobj::client->lmap->l_addr) + 0x1F6D4A8);
|
||||
a = md5seed;
|
||||
int c = LOCAL_W->m_IDX << 8;
|
||||
int b = LOCAL_E->m_IDX;
|
||||
rseed = rseed ^ (b | c);
|
||||
*(float*)(weapon + 2856ul) = 0.0f;
|
||||
RandomSeed(rseed);
|
||||
//static int tries = 0;
|
||||
//if (tries > 20) tries = 0;
|
||||
//for (int i = 0; i < tries; i++) RandomInt(0, 10);
|
||||
|
||||
CIACFn(weapon);
|
||||
//logging::Info("%i", *(unsigned char*)(weapon + 2830));
|
||||
//tries++;
|
||||
unsigned char crit = *(unsigned char*)(weapon + 2830);
|
||||
if (crit == 0) cmd->buttons &= ~IN_ATTACK;
|
||||
else {
|
||||
//logging::Info("Try: %i");
|
||||
}
|
||||
bool cancrit = vfunc<bool(*)(IClientEntity*)>(weapon, 1836 / 4, 0)(weapon);
|
||||
if (!cancrit) {
|
||||
cmd->buttons &= ~IN_ATTACK;
|
||||
}*/
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (v_bSuppressCrits->GetBool() && !v_bCritHack->GetBool()) {
|
||||
if (crit) {
|
||||
cmd->buttons &= ~IN_ATTACK;
|
||||
//logging::Info("suppressing crit");
|
||||
}
|
||||
} else if (v_bCritHack->GetBool()) {
|
||||
if (!crit) cmd->buttons &= ~IN_ATTACK;
|
||||
}
|
||||
|
||||
/*f (TF && v_bDebugCrits->GetBool() && CE_GOOD(LOCAL_W)) {
|
||||
//static uintptr_t helper = gSignatures.GetClientSignature("55 89 E5 81 EC 88 00 00 00 89 5D F4 8B 5D 08 89 75 F8 89 7D FC 31 FF 89 1C 24 E8 ? ? ? ? 85 C0 89 C6 74 0F 8B 00 89 34 24 FF 90 E0 02 00 00 84 C0 75 14 89 F8 8B 5D F4 8B 75 F8 8B 7D FC 89 EC 5D C3");
|
||||
/*if (interfaces::gvars->curtime - lastcheck >= 1.0f) {
|
||||
RandomSeed(cmd->random_seed);
|
||||
ciac_s = vfunc<int(*)(IClientEntity*)>(RAW_ENT(LOCAL_W), 458, 0)(RAW_ENT(LOCAL_W));
|
||||
if (ciac_s) cmd->buttons |= IN_ATTACK;
|
||||
lastcheck = interfaces::gvars->curtime;
|
||||
}
|
||||
if (TF2) {
|
||||
static uintptr_t critsig = gSignatures.GetClientSignature("55 89 E5 83 EC 28 89 5D F4 8B 5D 08 89 75 F8 89 7D FC 89 1C 24 E8 ? ? ? ? 85 C0 89 C6 74 60 8B 00 89 34 24 FF 90 E0 02 00 00 84 C0 74 51 A1 ? ? ? ? 8B 40 04");
|
||||
typedef void(*C_TFWeaponBase__CalcIsAttackCritical_t)(IClientEntity*);
|
||||
static C_TFWeaponBase__CalcIsAttackCritical_t ciac = (C_TFWeaponBase__CalcIsAttackCritical_t)critsig;
|
||||
if (interfaces::gvars->curtime - lastcheck >= 1.0f) {
|
||||
//RandomSeed(cmd->random_seed);
|
||||
ciac(RAW_ENT(LOCAL_W));
|
||||
//logging::Info("0x%08x", *(unsigned char*)(RAW_ENT(LOCAL_W) + 0x0B0E));
|
||||
//ciac_s = *(int*)((uintptr_t)RAW_ENT(LOCAL_W) + 0x0B0Eu) - 256;
|
||||
//RandomSeed(cmd->random_seed);
|
||||
ciac_s = vfunc<bool(*)(IClientEntity*)>(RAW_ENT(LOCAL_W), 1836 / 4, 0)(RAW_ENT(LOCAL_W));
|
||||
lastcheck = interfaces::gvars->curtime;
|
||||
if (ciac_s != 0) {
|
||||
//logging::Info("Attack!!!");
|
||||
cmd->buttons = cmd->buttons | IN_ATTACK;
|
||||
AddCenterString(colors::red, "Crit!");
|
||||
}
|
||||
}
|
||||
}
|
||||
}*/
|
||||
g_Settings.bSendPackets->SetValue(true);
|
||||
if (v_iFakeLag->GetInt()) {
|
||||
static int fakelag = 0;
|
||||
@ -586,6 +591,23 @@ void Misc::ProcessUserCmd(CUserCmd* cmd) {
|
||||
}
|
||||
|
||||
void Misc::Draw() {
|
||||
if (v_bDebugCrits->GetBool() && CE_GOOD(LOCAL_W)) {
|
||||
if (v_bCritHack->GetBool()) {
|
||||
AddCenterString(colors::red, "FORCED CRITS: ON");
|
||||
}
|
||||
if (TF2) {
|
||||
if (!vfunc<bool(*)(IClientEntity*)>(RAW_ENT(LOCAL_W), 465, 0)(RAW_ENT(LOCAL_W)))
|
||||
AddCenterString(colors::white, "Random crits are disabled");
|
||||
else {
|
||||
if (!vfunc<bool(*)(IClientEntity*)>(RAW_ENT(LOCAL_W), 465 + 21, 0)(RAW_ENT(LOCAL_W)))
|
||||
AddCenterString(colors::white, "Weapon can't randomly crit");
|
||||
else
|
||||
AddCenterString(colors::white, "Weapon can randomly crit");
|
||||
}
|
||||
AddCenterString(colors::white, "Bucket: %.2f", *(float*)((uintptr_t)RAW_ENT(LOCAL_W) + 2612u));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!v_bDebugInfo->GetBool())return;
|
||||
/*if (!interfaces::input->IsButtonDown(ButtonCode_t::KEY_F)) {
|
||||
|
@ -33,6 +33,7 @@ public:
|
||||
CatVar* v_iFakeLag;
|
||||
CatVar* v_bCritHack;
|
||||
CatVar* v_bTauntSlide;
|
||||
CatVar* v_bSuppressCrits;
|
||||
//ConVar* v_bDumpEventInfo;
|
||||
ConCommand* c_SaveSettings;
|
||||
ConCommand* c_Unrestricted;
|
||||
|
Reference in New Issue
Block a user