Merge remote-tracking branch 'nullworks/newui'
This commit is contained in:
commit
79fc4a44ef
@ -6,7 +6,7 @@
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "reclasses.hpp"
|
||||
namespace re
|
||||
{
|
||||
|
||||
@ -26,4 +26,14 @@ public:
|
||||
int BRequestJoinPlayer(CSteamID steamid);
|
||||
static bool BInQueue(CTFPartyClient *this_);
|
||||
};
|
||||
class ITFMatchGroupDescription
|
||||
{
|
||||
public:
|
||||
char pad0[4];
|
||||
int m_iID;
|
||||
char pad1[63];
|
||||
bool m_bForceCompetitiveSettings;
|
||||
};
|
||||
|
||||
ITFMatchGroupDescription* GetMatchGroupDescription(int& idx);
|
||||
} // namespace re
|
||||
|
@ -10,6 +10,7 @@
|
||||
#include "common.hpp"
|
||||
|
||||
#include "C_BaseEntity.hpp"
|
||||
#include "ITFGroupMatchCriteria.hpp"
|
||||
#include "CTFPlayerShared.hpp"
|
||||
#include "C_BasePlayer.hpp"
|
||||
#include "C_BaseCombatWeapon.hpp"
|
||||
|
11
src/hack.cpp
11
src/hack.cpp
@ -403,6 +403,17 @@ free(logname);*/
|
||||
logging::Info("Initializer stack done");
|
||||
|
||||
hack::initialized = true;
|
||||
for (int i = 0; i < 12; i++)
|
||||
{
|
||||
re::ITFMatchGroupDescription* desc = re::GetMatchGroupDescription(i);
|
||||
if (!desc || desc->m_iID > 9) //ID's over 9 are invalid
|
||||
continue;
|
||||
if (desc->m_bForceCompetitiveSettings)
|
||||
{
|
||||
desc->m_bForceCompetitiveSettings = false;
|
||||
logging::Info("Bypassed force competitive cvars!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void hack::Think()
|
||||
|
@ -48,9 +48,7 @@ void checkAFK()
|
||||
if (CE_BAD(entity))
|
||||
continue;
|
||||
if (!CE_VECTOR(entity, netvar.vVelocity).IsZero(60.0f))
|
||||
{
|
||||
afkTicks[i].update();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -58,6 +56,8 @@ bool HasLowAmmo()
|
||||
{
|
||||
int *weapon_list =
|
||||
(int *) ((unsigned) (RAW_ENT(LOCAL_E)) + netvar.hMyWeapons);
|
||||
if (g_pLocalPlayer->holding_sniper_rifle && CE_INT(LOCAL_E, netvar.m_iAmmo + 4) <= 5)
|
||||
return true;
|
||||
for (int i = 0; weapon_list[i]; i++)
|
||||
{
|
||||
int handle = weapon_list[i];
|
||||
@ -66,9 +66,9 @@ bool HasLowAmmo()
|
||||
{
|
||||
IClientEntity *weapon = g_IEntityList->GetClientEntity(eid);
|
||||
if (weapon and
|
||||
re::C_BaseCombatWeapon::IsBaseCombatWeapon(weapon) and
|
||||
re::C_TFWeaponBase::UsesPrimaryAmmo(weapon) and
|
||||
not re::C_TFWeaponBase::HasPrimaryAmmo(weapon))
|
||||
re::C_BaseCombatWeapon::IsBaseCombatWeapon(weapon) &&
|
||||
re::C_TFWeaponBase::UsesPrimaryAmmo(weapon) &&
|
||||
!re::C_TFWeaponBase::HasPrimaryAmmo(weapon))
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -185,10 +185,14 @@ void Init()
|
||||
sniper_spots.size(), preferred_sniper_spots.size(),
|
||||
nest_spots.size());
|
||||
}
|
||||
// I doubtwe'd use more than 128 Sniper spots
|
||||
std::array<int, 128> priority_spots;
|
||||
void initonce()
|
||||
{
|
||||
for (int i = 0; i < afkTicks.size(); i++)
|
||||
afkTicks[i].update();
|
||||
for (auto &e :priority_spots)
|
||||
e = 0;
|
||||
cdr.update();
|
||||
cd2.update();
|
||||
cd3.update();
|
||||
@ -289,6 +293,43 @@ int GetClosestBuilding()
|
||||
}
|
||||
return BestBuilding;
|
||||
}
|
||||
|
||||
void NavToSniperSpot(int priority)
|
||||
{
|
||||
Vector random_spot;
|
||||
if (!sniper_spots.size() && !preferred_sniper_spots.size())
|
||||
return;
|
||||
auto snip_spot = preferred_sniper_spots.size()
|
||||
? preferred_sniper_spots
|
||||
: sniper_spots;
|
||||
int best_spot = -1;
|
||||
float maxscr = FLT_MAX;
|
||||
int lowest_priority = 9999;
|
||||
for (int i = 0; i < snip_spot.size();i++)
|
||||
{
|
||||
if ((priority_spots[i] < lowest_priority))
|
||||
lowest_priority = priority_spots[i];
|
||||
}
|
||||
for (int i = 0; i < snip_spot.size();i++)
|
||||
{
|
||||
if ((priority_spots[i] > lowest_priority))
|
||||
continue;
|
||||
float scr = snip_spot[i].DistTo(g_pLocalPlayer->v_Eye);
|
||||
if (scr < maxscr)
|
||||
{
|
||||
maxscr = scr;
|
||||
best_spot = i;
|
||||
}
|
||||
}
|
||||
|
||||
if (best_spot == -1)
|
||||
return;
|
||||
random_spot = snip_spot.at(best_spot);
|
||||
if (random_spot.z)
|
||||
nav::NavTo(random_spot, false, true, priority);
|
||||
priority_spots[best_spot]++;
|
||||
return;
|
||||
}
|
||||
int follow_target = 0;
|
||||
void CreateMove()
|
||||
{
|
||||
@ -325,38 +366,18 @@ void CreateMove()
|
||||
if (!spy_mode && !heavy_mode && !engi_mode)
|
||||
{
|
||||
cd3.update();
|
||||
Vector random_spot;
|
||||
if (cd2.test_and_set(5000))
|
||||
Init();
|
||||
if (!sniper_spots.size() && !preferred_sniper_spots.size())
|
||||
return;
|
||||
auto snip_spot = preferred_sniper_spots.size()
|
||||
? preferred_sniper_spots
|
||||
: sniper_spots;
|
||||
int rng = rand() % snip_spot.size();
|
||||
random_spot = snip_spot.at(rng);
|
||||
if (random_spot.z)
|
||||
nav::NavTo(random_spot, true, true);
|
||||
return;
|
||||
NavToSniperSpot(5);
|
||||
}
|
||||
else if (!engi_mode)
|
||||
{
|
||||
CachedEntity *tar = NearestEnemy();
|
||||
if (CE_BAD(tar) && last_tar == -1 && nav::ReadyForCommands)
|
||||
{
|
||||
Vector random_spot;
|
||||
if (cd2.test_and_set(5000))
|
||||
Init();
|
||||
if (!sniper_spots.size() && !preferred_sniper_spots.size())
|
||||
return;
|
||||
auto snip_spot = preferred_sniper_spots.size()
|
||||
? preferred_sniper_spots
|
||||
: sniper_spots;
|
||||
int rng = rand() % snip_spot.size();
|
||||
random_spot = snip_spot.at(rng);
|
||||
if (random_spot.z)
|
||||
nav::NavTo(random_spot, false);
|
||||
return;
|
||||
NavToSniperSpot(5);
|
||||
}
|
||||
if (CE_GOOD(tar))
|
||||
{
|
||||
@ -412,7 +433,7 @@ void CreateMove()
|
||||
}
|
||||
}
|
||||
// If Near The best spot and ready for commands
|
||||
if (best_spot.DistTo(LOCAL_E->m_vecOrigin()) < 300.0f &&
|
||||
if (best_spot.DistTo(LOCAL_E->m_vecOrigin()) < 200.0f &&
|
||||
(nav::ReadyForCommands || nav::priority == 1))
|
||||
{
|
||||
// Get the closest Building
|
||||
@ -467,7 +488,7 @@ void CreateMove()
|
||||
fClampAngle(angles);
|
||||
current_user_cmd->viewangles = angles;
|
||||
current_user_cmd->buttons |= IN_ATTACK;
|
||||
g_pLocalPlayer->bUseSilentAngles = false;
|
||||
g_pLocalPlayer->bUseSilentAngles = true;
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -485,19 +506,9 @@ void CreateMove()
|
||||
// Ammo is dormant, go and find it!
|
||||
else if (sniper_spots.size() && nav::ReadyForCommands)
|
||||
{
|
||||
Vector random_spot;
|
||||
if (cd2.test_and_set(5000))
|
||||
Init();
|
||||
if (!sniper_spots.size() &&
|
||||
!preferred_sniper_spots.size())
|
||||
return;
|
||||
auto snip_spot = preferred_sniper_spots.size()
|
||||
? preferred_sniper_spots
|
||||
: sniper_spots;
|
||||
int rng = rand() % snip_spot.size();
|
||||
random_spot = snip_spot.at(rng);
|
||||
if (random_spot.z)
|
||||
nav::NavTo(random_spot, false, false, 1);
|
||||
NavToSniperSpot(1);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -119,3 +119,14 @@ int re::CTFPartyClient::BRequestJoinPlayer(CSteamID steamid)
|
||||
BRequestJoinPlayer_t(addr);
|
||||
return BRequestJoinPlayer_fn(this, steamid, false);
|
||||
}
|
||||
re::ITFMatchGroupDescription *
|
||||
re::GetMatchGroupDescription(int &idx)
|
||||
{
|
||||
typedef re::ITFMatchGroupDescription *(
|
||||
*GetMatchGroupDescription_t)(int&);
|
||||
static uintptr_t addr = gSignatures.GetClientSignature("55 89 E5 8B 45 08 8B 00 83 F8 FF");
|
||||
static GetMatchGroupDescription_t GetMatchGroupDescription_fn =
|
||||
GetMatchGroupDescription_t(addr);
|
||||
|
||||
return GetMatchGroupDescription_fn(idx);
|
||||
}
|
||||
|
Reference in New Issue
Block a user