Skip to content
This repository has been archived by the owner on Jan 26, 2024. It is now read-only.

a lot of stuff #115

Merged
merged 8 commits into from
May 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion Dota2Cheat/CheatSDK/Config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,11 @@ void Config::ConfigManager::SetupVars() {
CFG_VAR(BOOL, AbilityESP::Enabled, true);
CFG_VAR(FLOAT, AbilityESP::UIScale, 1.0f);
CFG_VAR(BOOL, AbilityESP::ShowAllies, true);
CFG_VAR(BOOL, AbilityESP::ShowManabars, true);
CFG_VAR(BOOL, AbilityESP::ShowCooldownDecimals, false);

CFG_VAR(BOOL, Bars::ManaBar, true);
CFG_VAR(BOOL, Bars::HPNumbers, true);

CFG_VAR(BOOL, Indicators::Speed, true);
CFG_VAR(BOOL, Indicators::Kill, true);
CFG_VAR(FLOAT, Indicators::KillScale, 1.0f);
Expand All @@ -125,6 +127,10 @@ void Config::ConfigManager::SetupVars() {
CFG_VAR(BOOL, ModifierRevealer::TrueSight, true);

CFG_VAR(BOOL, TPTracker::Enabled, true);
CFG_VAR(INT, TPTracker::FadeDuration, 5);

CFG_VAR(BOOL, ParticleMapHack::Enabled, true);
CFG_VAR(INT, ParticleMapHack::FadeDuration, 5);

CFG_VAR(BOOL, IllusionColoring::Enabled, true);
CFG_VAR(VECTOR3D, IllusionColoring::Color, Vector(1, 0, 0));
Expand Down
12 changes: 11 additions & 1 deletion Dota2Cheat/CheatSDK/Config.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,14 @@ namespace Config {
inline bool Enabled;
inline bool ShowAllies;
inline float UIScale;
inline bool ShowManabars;
inline bool ShowCooldownDecimals;
}

namespace Bars {
inline bool ManaBar;
inline bool HPNumbers;
}

namespace AutoAccept {
inline bool Enabled;
inline int Delay;
Expand All @@ -85,8 +89,10 @@ namespace Config {
inline bool Kill;
inline float KillScale;
}

namespace TPTracker {
inline bool Enabled;
inline int FadeDuration;
}

inline bool BadCastPrevention;
Expand Down Expand Up @@ -127,6 +133,10 @@ namespace Config {
namespace ManaAbuse {
inline bool Enabled;
}
namespace ParticleMapHack {
inline bool Enabled;
inline int FadeDuration;
}

inline bool LastHitMarker;

Expand Down
22 changes: 22 additions & 0 deletions Dota2Cheat/CheatSDK/HeroData.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#pragma once
#include "../SDK/pch.h"
#include <imgui/imgui.h>

// Centralized storage for data about heroes

struct _HeroData {
std::map<std::string, CDOTAModifier*> Modifiers;
std::map<std::string, CDOTAItem*> Items;
ImVec2 HealthbarW2S; // healthbar's screen pos
Vector AbsOrigin;
};

inline std::map<CDOTABaseNPC*, _HeroData> HeroData;

inline void ClearHeroData() {
for (auto& [_, data] : HeroData) {
data.Modifiers.clear();
data.Items.clear();
}
HeroData.clear();
}
4 changes: 1 addition & 3 deletions Dota2Cheat/CheatSDK/Hooking.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,10 @@
#include "../Hooks/OnAcceptMatch.h"
#include "../Hooks/RunFrame.h"
#include "../Hooks/NetChannel.h"
#include "../Hooks/EntitySystemEvents.h"
#include "../Hooks/EntityEvents.h"
#include "../Hooks/ParticleRendering.h"
#include "../Hooks/ModifierEvents.h"
#include "../Hooks/SteamGC.h"
#include "../Hooks/UIState.h"
#include "../Hooks/MinimapRenderer.h"
#include "../Hooks/GameEvents.h"

#include "../Hooks/Misc.h"
Expand Down
2 changes: 1 addition & 1 deletion Dota2Cheat/CheatSDK/Lua/LuaInitialization.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ void Lua::SetGlobals(sol::state& lua) {
lua["ParticleManager"] = GameSystems::ParticleManager;
lua["GameRules"] = GameSystems::GameRules;

ctx.lua["localHero"] = ctx.assignedHero;
ctx.lua["localHero"] = ctx.localHero;
ctx.lua["localPlayer"] = ctx.localPlayer;
}

Expand Down
37 changes: 20 additions & 17 deletions Dota2Cheat/CheatSDK/MatchStateHandling.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,15 @@ void CacheAllEntities() {
}
void OnUpdatedAssignedHero()
{
ctx.lua["localHero"] = ctx.assignedHero;
ctx.lua["localHero"] = ctx.localHero;
Lua::CallModuleFunc("OnUpdatedAssignedHero");

for (auto& modifier : ctx.assignedHero->GetModifierManager()->GetModifierList())
Hooks::CacheIfItemModifier(modifier); // for registering important items on reinjection
for (auto& modifier : ctx.localHero->GetModifierManager()->GetModifierList()) {
Hooks::CacheIfItemModifier(modifier); // for registering items on reinjection
Hooks::CacheModifier(modifier);
}

Modules::ShakerAttackAnimFix.SubscribeEntity(ctx.assignedHero);
Modules::ShakerAttackAnimFix.SubscribeEntity(ctx.localHero);
}

void UpdateAssignedHero() {
Expand All @@ -60,7 +62,7 @@ void UpdateAssignedHero() {
auto assignedHero = Interfaces::EntitySystem->GetEntity<CDOTABaseNPC_Hero>(H2IDX(ctx.localPlayer->GetAssignedHeroHandle()));

ctx.assignedHeroHandle = heroHandle;
ctx.assignedHero = assignedHero;
ctx.localHero = assignedHero;

LogF(LP_INFO, "Changed hero: \n\tHandle: {:X}\n\tEntity: {}", heroHandle, (void*)assignedHero);
if (assignedHero)
Expand Down Expand Up @@ -96,7 +98,7 @@ void EnteredPreGame() {
break;
}

ctx.gameStage = Context::GameStage::PRE_GAME;
ctx.gameStage = GameStage::PRE_GAME;

if (!oFireEventClientSide) {
auto vmt = VMT(GameSystems::GameEventManager);
Expand All @@ -118,16 +120,16 @@ void EnteredInGame() {

UpdateAssignedHero();

if (!ctx.assignedHero)
if (!ctx.localHero)
return;

//Config::AutoPingTarget = ctx.assignedHero;
//Config::AutoPingTarget = ctx.localHero;
//FillPlayerList();

Log(LP_INFO, "GAME STAGE: INGAME");
LogF(LP_DATA, "Local Player: {}\n\tSTEAM ID: {}", (void*)ctx.localPlayer, ctx.localPlayer->GetSteamID());
if (ctx.assignedHero->GetUnitName())
LogF(LP_DATA, "Assigned Hero: {} {}", (void*)ctx.assignedHero, ctx.assignedHero->GetUnitName());
if (ctx.localHero->GetUnitName())
LogF(LP_DATA, "Assigned Hero: {} {}", (void*)ctx.localHero, ctx.localHero->GetUnitName());

Interfaces::CVar->SetConvars();

Expand All @@ -148,11 +150,11 @@ void EnteredInGame() {

Lua::CallModuleFunc("OnJoinedMatch");

ctx.gameStage = Context::GameStage::IN_GAME;
ctx.gameStage = GameStage::IN_GAME;
}

void LeftMatch() {
ctx.gameStage = Context::GameStage::NONE;
ctx.gameStage = GameStage::NONE;

Lua::CallModuleFunc("OnLeftMatch");

Expand All @@ -173,9 +175,10 @@ void LeftMatch() {
GameSystems::MinimapRenderer = nullptr;
GameSystems::DotaHud = nullptr;
GameSystems::GameEventManager = nullptr;
ClearHeroData();

ctx.localPlayer = nullptr;
ctx.assignedHero = nullptr;
ctx.localHero = nullptr;
ctx.assignedHeroHandle = 0xFFFFFFFF;

Lua::SetGlobals(ctx.lua);
Expand All @@ -187,13 +190,13 @@ void LeftMatch() {
void CheckMatchState() {
if (Interfaces::Engine->IsInGame()) {
//Modules::AutoPick.TryAutoBan();
if (ctx.gameStage == Context::GameStage::NONE)
if (ctx.gameStage == GameStage::NONE)
EnteredPreGame();
else if (ctx.gameStage == Context::GameStage::PRE_GAME)
else if (ctx.gameStage == GameStage::PRE_GAME)
EnteredInGame();
else if (ctx.gameStage == Context::GameStage::IN_GAME)
else if (ctx.gameStage == GameStage::IN_GAME)
UpdateAssignedHero();
}
else if (ctx.gameStage != Context::GameStage::NONE)
else if (ctx.gameStage != GameStage::NONE)
LeftMatch();
}
7 changes: 5 additions & 2 deletions Dota2Cheat/CheatSDK/Utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,11 @@ inline ImVec2 WorldToScreen(const Vector& pos) {
}

inline bool IsPointOnScreen(const ImVec2& pos) {
const auto screenSize = glfwGetVideoMode(glfwGetPrimaryMonitor());
ImRect screen{ 0,0 ,(float)screenSize->width, (float)screenSize->height };
if (!GameSystems::DotaHud)
return false;

const auto screenSize = GameSystems::DotaHud->GetScreenSize();
ImRect screen{ 0, 0, screenSize.x, screenSize.y };
return screen.Contains(pos);
}

Expand Down
1 change: 1 addition & 0 deletions Dota2Cheat/CheatSDK/include.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@
#include "Config.h"
#include "Utils.h"
#include "DrawData.h"
#include "HeroData.h"
#include "Lua/LuaModules.h"
2 changes: 1 addition & 1 deletion Dota2Cheat/DebugFunctions.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ inline void LogModifiers(CDOTABaseNPC* npc) {
}
inline void LogInvAndAbilities(CDOTABaseNPC* npc = nullptr) {
if (npc == nullptr)
npc = ctx.assignedHero;
npc = ctx.localHero;

std::cout << std::dec;
std::cout << "abilities: " << '\n';
Expand Down
19 changes: 14 additions & 5 deletions Dota2Cheat/Dota2Cheat.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@
<ClCompile Include="CheatSDK\Config.cpp" />
<ClCompile Include="CheatSDK\Hooking.cpp" />
<ClCompile Include="CheatSDK\Utils.cpp" />
<ClCompile Include="Hooks\EntitySystemEvents.cpp" />
<ClCompile Include="Hooks\EntityEvents.cpp" />
<ClCompile Include="Hooks\ModifierEvents.cpp" />
<ClCompile Include="Hooks\NetChannel.cpp" />
<ClCompile Include="Hooks\OnAcceptMatch.cpp" />
Expand Down Expand Up @@ -222,9 +222,11 @@
<ClCompile Include="Modules\Hacks\SkinChanger.cpp" />
<ClCompile Include="Modules\Hacks\TargetedSpellHighlighter.cpp" />
<ClCompile Include="Modules\UI\AbilityESP.cpp" />
<ClCompile Include="Modules\UI\BarAugmenter.cpp" />
<ClCompile Include="Modules\UI\BlinkRevealer.cpp" />
<ClCompile Include="Modules\UI\Indicators\KillIndicator.cpp" />
<ClCompile Include="Modules\UI\Indicators\SpeedIndicator.cpp" />
<ClCompile Include="Modules\UI\ParticleMaphack.cpp" />
<ClCompile Include="Modules\UI\TPTracker.cpp" />
<ClCompile Include="Modules\Hacks\TrueSightESP.cpp" />
<ClCompile Include="Modules\UI\UIOverhaul.cpp" />
Expand Down Expand Up @@ -471,17 +473,24 @@
</ItemGroup>
<ItemGroup>
<ClInclude Include="CheatSDK\DrawData.h" />
<ClInclude Include="Modules\UI\BarAugmenter.h">
<SubType>
</SubType>
</ClInclude>
<ClInclude Include="Modules\UI\BlinkRevealer.h">
<SubType>
</SubType>
</ClInclude>
<ClInclude Include="Modules\UI\MultiThreadModule.h" />
<ClInclude Include="Modules\UI\ParticleMaphack.h">
<SubType>
</SubType>
</ClInclude>
<ClInclude Include="SDK\Base\Address.h" />
<ClInclude Include="SDK\Bytes\Fonts.h" />
<ClInclude Include="CheatSDK\include.h" />
<ClInclude Include="CheatSDK\Utils.h" />
<ClInclude Include="Hooks\GameEvents.h" />
<ClInclude Include="Hooks\MinimapRenderer.h" />
<ClInclude Include="Hooks\UIState.h" />
<ClInclude Include="Modules\Hacks\AutoLastHit.h" />
<ClInclude Include="Modules\Hacks\TrueSightESP.h" />
<ClInclude Include="Modules\UI\Indicators\KillIndicator.h">
Expand Down Expand Up @@ -543,6 +552,7 @@
<ClInclude Include="SDK\GameSystems\C_DOTA_PlayerResource.h" />
<ClInclude Include="SDK\GameSystems\C_DOTA_ProjectileManager.h" />
<ClInclude Include="SDK\Globals\GameSystems.h" />
<ClInclude Include="CheatSDK\HeroData.h" />
<ClInclude Include="SDK\Interfaces\CBaseFileSystem.h" />
<ClInclude Include="SDK\GameSystems\CDOTAParticleManager.h" />
<ClInclude Include="SDK\Interfaces\CGameEntitySystem.h" />
Expand Down Expand Up @@ -615,7 +625,7 @@
<ClInclude Include="UI\Pages\AutoPickSelectionGrid.h" />
<ClInclude Include="Utils\Drawing.h" />
<ClInclude Include="SDK\Globals\Context.h" />
<ClInclude Include="Hooks\EntitySystemEvents.h" />
<ClInclude Include="Hooks\EntityEvents.h" />
<ClInclude Include="CheatSDK\EventListeners.h" />
<ClInclude Include="CheatSDK\Hooking.h" />
<ClInclude Include="Modules\Hacks\LinearProjectileWarner.h" />
Expand Down Expand Up @@ -661,7 +671,6 @@
<ClInclude Include="SDK\VTableIndexes.h" />
<ClInclude Include="SDK\Interfaces\CVarSystem.h" />
<ClInclude Include="SDK\Base\CUtlVector.h" />
<ClInclude Include="dllmain.h" />
<ClInclude Include="SDK\Enums.h" />
<ClInclude Include="SDK\Interfaces\IEngineClient.h" />
<ClInclude Include="CheatSDK\MatchStateHandling.h" />
Expand Down
13 changes: 8 additions & 5 deletions Dota2Cheat/Dota2Cheat.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<ItemGroup>
<ClCompile Include="CheatSDK\Config.cpp" />
<ClCompile Include="CheatSDK\Hooking.cpp" />
<ClCompile Include="Hooks\EntitySystemEvents.cpp" />
<ClCompile Include="Hooks\EntityEvents.cpp" />
<ClCompile Include="Hooks\ModifierEvents.cpp" />
<ClCompile Include="Hooks\NetChannel.cpp" />
<ClCompile Include="Hooks\OnAcceptMatch.cpp" />
Expand Down Expand Up @@ -141,10 +141,10 @@
<ClCompile Include="CheatSDK\Utils.cpp" />
<ClCompile Include="include\cityhash\city.cc" />
<ClCompile Include="Modules\UI\BlinkRevealer.cpp" />
<ClCompile Include="Modules\UI\ParticleMaphack.cpp" />
<ClCompile Include="Modules\UI\BarAugmenter.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="Hooks\MinimapRenderer.h" />
<ClInclude Include="Hooks\UIState.h" />
<ClInclude Include="Modules\Hacks\AutoLastHit.h" />
<ClInclude Include="Modules\UI\UIOverhaul.h" />
<ClInclude Include="SDK\GameSystems\CDOTA_PanoramaMinimapRenderer.h" />
Expand Down Expand Up @@ -216,7 +216,7 @@
<ClInclude Include="UI\Pages\AutoPickSelectionGrid.h" />
<ClInclude Include="Utils\Drawing.h" />
<ClInclude Include="SDK\Globals\Context.h" />
<ClInclude Include="Hooks\EntitySystemEvents.h" />
<ClInclude Include="Hooks\EntityEvents.h" />
<ClInclude Include="CheatSDK\EventListeners.h" />
<ClInclude Include="CheatSDK\Hooking.h" />
<ClInclude Include="Modules\Hacks\LinearProjectileWarner.h" />
Expand Down Expand Up @@ -262,7 +262,6 @@
<ClInclude Include="SDK\VTableIndexes.h" />
<ClInclude Include="SDK\Interfaces\CVarSystem.h" />
<ClInclude Include="SDK\Base\CUtlVector.h" />
<ClInclude Include="dllmain.h" />
<ClInclude Include="SDK\Enums.h" />
<ClInclude Include="SDK\Interfaces\IEngineClient.h" />
<ClInclude Include="CheatSDK\MatchStateHandling.h" />
Expand Down Expand Up @@ -337,5 +336,9 @@
<ClInclude Include="CheatSDK\DrawData.h" />
<ClInclude Include="Modules\UI\BlinkRevealer.h" />
<ClInclude Include="SDK\Base\Address.h" />
<ClInclude Include="Modules\UI\ParticleMaphack.h" />
<ClInclude Include="Modules\UI\MultiThreadModule.h" />
<ClInclude Include="CheatSDK\HeroData.h" />
<ClInclude Include="Modules\UI\BarAugmenter.h" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "EntitySystemEvents.h"
#include "EntityEvents.h"

// Here we filter entities and put them into their respective collections
CBaseEntity* Hooks::hkOnAddEntity(CEntitySystem* thisptr, CBaseEntity* ent, ENT_HANDLE handle) {
Expand All @@ -14,9 +14,9 @@ CBaseEntity* Hooks::hkOnRemoveEntity(CEntitySystem* thisptr, CBaseEntity* ent, E
ctx.entities.erase(ent);
ctx.runes.erase((CDOTAItemRune*)ent);

for (auto it = ctx.ImportantItems.begin(); it != ctx.ImportantItems.end(); ++it)
for (auto it = HeroData[ctx.localHero].Items.begin(); it != HeroData[ctx.localHero].Items.end(); ++it)
if (it->second == ent) {
it = ctx.ImportantItems.erase(it);
it = HeroData[ctx.localHero].Items.erase(it);
break;
}

Expand Down
Loading