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

+ Proper Mana/HP abuse! #143

Merged
merged 2 commits into from
Jun 12, 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
2 changes: 2 additions & 0 deletions Dota2Cheat/CheatSDK/Config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,8 @@ void Config::ConfigManager::SetupVars() {
CFG_VAR(IllusionColoring::Color, Vector(1, 0, 0));

CFG_VAR(ManaAbuse::Enabled, false);
CFG_VAR(ManaAbuse::Mode, 0);
CFG_VAR(ManaAbuse::SafetyRadius, 1000);

CFG_VAR(AutoAccept::Enabled, true);
CFG_VAR(AutoAccept::Delay, 1);
Expand Down
3 changes: 3 additions & 0 deletions Dota2Cheat/CheatSDK/Config.h
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,9 @@ namespace Config {
}
namespace ManaAbuse {
inline bool Enabled;
// For enum definition see Modules/Hacks/ManaHPAbuse
inline int Mode;
inline int SafetyRadius;
}
namespace ParticleMapHack {
inline bool Enabled;
Expand Down
6 changes: 5 additions & 1 deletion Dota2Cheat/Dota2Cheat.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,7 @@
<ClCompile Include="Modules\Hacks\IllusionColoring.cpp" />
<ClCompile Include="Modules\Hacks\LastHitMarker.cpp" />
<ClCompile Include="Modules\Hacks\LinearProjectileWarner.cpp" />
<ClCompile Include="Modules\Hacks\ManaHPAbuse.cpp" />
<ClCompile Include="Modules\Hacks\ParticleAbilityWarner.cpp" />
<ClCompile Include="Modules\Hacks\PerfectBlink.cpp" />
<ClCompile Include="Modules\Hacks\SkinChanger.cpp" />
Expand Down Expand Up @@ -559,6 +560,10 @@
<SubType>
</SubType>
</ClInclude>
<ClInclude Include="Modules\Hacks\ManaHPAbuse.h">
<SubType>
</SubType>
</ClInclude>
<ClInclude Include="Modules\UI\BarAugmenter.h">
<SubType>
</SubType>
Expand Down Expand Up @@ -726,7 +731,6 @@
<ClInclude Include="CheatSDK\Lua\LuaInitialization.h" />
<ClInclude Include="Hooks\NetChannel.h" />
<ClInclude Include="Hooks\ModifierEvents.h" />
<ClInclude Include="Modules\Hacks\ManaHpAbuse.h" />
<ClInclude Include="SDK\Globals\Interfaces.h" />
<ClInclude Include="SDK\Interfaces\Network\bf_read.h" />
<ClInclude Include="SDK\Interfaces\Network\bf_write.h" />
Expand Down
3 changes: 2 additions & 1 deletion Dota2Cheat/Dota2Cheat.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@
<ClCompile Include="Modules\UI\Indicators\HookIndicator.cpp" />
<ClCompile Include="UI\Pages\MainMenu.cpp" />
<ClCompile Include="Hooks\GameCoordinator.cpp" />
<ClCompile Include="Modules\Hacks\ManaHPAbuse.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="Modules\Hacks\AutoLastHit.h" />
Expand Down Expand Up @@ -218,7 +219,6 @@
<ClInclude Include="CheatSDK\Lua\LuaInitialization.h" />
<ClInclude Include="Hooks\NetChannel.h" />
<ClInclude Include="Hooks\ModifierEvents.h" />
<ClInclude Include="Modules\Hacks\ManaHpAbuse.h" />
<ClInclude Include="SDK\Globals\Interfaces.h" />
<ClInclude Include="SDK\Interfaces\Network\bf_read.h" />
<ClInclude Include="SDK\Interfaces\Network\bf_write.h" />
Expand Down Expand Up @@ -345,5 +345,6 @@
<ClInclude Include="CheatSDK\GameEventListeners\dota_player_update_assigned_hero.h" />
<ClInclude Include="CheatSDK\GameEventListeners\dota_game_state_change.h" />
<ClInclude Include="CheatSDK\GameEventListeners\LuaListener.h" />
<ClInclude Include="Modules\Hacks\ManaHPAbuse.h" />
</ItemGroup>
</Project>
119 changes: 1 addition & 118 deletions Dota2Cheat/Hooks/PrepareUnitOrders.cpp
Original file line number Diff line number Diff line change
@@ -1,24 +1,5 @@
#include "PrepareUnitOrders.h"

void ChangeItemStatTo(CDOTAItem* item, ItemStat stat, CDOTAPlayerController* player, CBaseEntity* issuer) {
if (!item || item->GetItemStat() == stat)
return;
int diff = (int)stat - (int)item->GetItemStat();
int cycles = diff > 0 ? diff : diff + 3;

for (int i = 0; i < cycles; i++)
Hooks::oPrepareUnitOrders(
player,
DOTA_UNIT_ORDER_CAST_NO_TARGET,
0,
&Vector::Zero,
item->GetIndex(),
DOTA_ORDER_ISSUER_PASSED_UNIT_ONLY,
issuer,
true,
false);
}

void Hooks::hkPrepareUnitOrders(CDOTAPlayerController* player, dotaunitorder_t orderType, UINT32 targetIndex, Vector* position, UINT32 abilityIndex, PlayerOrderIssuer_t orderIssuer, CBaseEntity* issuer, bool queue, bool showEffects) {
//std::cout << "[ORDER] " << player << '\n';
bool giveOrder = true; // whether or not the function will continue
Expand Down Expand Up @@ -46,106 +27,8 @@ void Hooks::hkPrepareUnitOrders(CDOTAPlayerController* player, dotaunitorder_t o
Modules::PerfectBlink.AdjustIfBlink(position, abilityIndex, issuer);
break;
}
case DOTA_UNIT_ORDER_DROP_ITEM:
{
break;
}
case DOTA_UNIT_ORDER_CAST_NO_TARGET: {
if (!Config::ManaAbuse::Enabled)
break;

//Automatic mana & HP abuse with items like Arcane Boots or Faerie Fire
static std::vector<const char*> filters = {
"item_arcane_boots",
"item_enchanted_mango",
"item_guardian_greaves",
"item_magic_stick",
"item_magic_wand",
"item_holy_locket",
"item_soul_ring",
"item_cheese",
"item_arcane_ring",
"item_faerie_fire",
"item_greater_faerie_fire"
};
static std::vector<const char*> bonusTypes = {
"bonus_int",
"bonus_intellect",
"bonus_strength",
"bonus_str",
"bonus_all_stats",
"bonus_mana",
"bonus_health"
};

if (!TestStringFilters(
Interfaces::EntitySystem
->GetEntity<CDOTABaseAbility>(abilityIndex)
->GetIdentity()
->GetName(),
filters))
break;

CDOTABaseNPC* npc = (CDOTABaseNPC*)issuer;
bool callPickup = false;

std::map<CDOTAItem*, ItemStat> origItemStats{
};
if (HeroData[ctx.localHero].Items["power_treads"]) {
origItemStats[HeroData[ctx.localHero].Items["power_treads"]] = HeroData[ctx.localHero].Items["power_treads"]->GetItemStat();
ChangeItemStatTo(HeroData[ctx.localHero].Items["power_treads"], ItemStat::AGILITY, player, issuer);
callPickup = true;
}
if (HeroData[ctx.localHero].Items["vambrace"]) {
origItemStats[HeroData[ctx.localHero].Items["vambrace"]] = HeroData[ctx.localHero].Items["vambrace"]->GetItemStat();
ChangeItemStatTo(HeroData[ctx.localHero].Items["vambrace"], ItemStat::AGILITY, player, issuer);
callPickup = true;
}

auto items = npc->GetItems();

//Dropping items
for (auto& item : items) {
if (!item) continue;
auto itemSlot = npc->GetInventory()->GetItemSlot(item->GetHandle());
if (
item->GetIndex() == abilityIndex // must not be the item we're using
||
(
itemSlot > 5 && // must not be in the backpack
itemSlot != 15 // but can be in the neutral slot
)
)
continue;

double anyBonus = 0;
for (auto& bonus : bonusTypes) {
anyBonus = item->GetLevelSpecialValueFor(bonus, -1);
if (anyBonus > 0)
break;
}
auto fVec = npc->GetForwardVector(5);
if (anyBonus > 0) {
//std::cout << abilityIndex << bonusInt << '\n';
queue = true;
oPrepareUnitOrders(player, DOTA_UNIT_ORDER_DROP_ITEM, 0, &fVec, item->GetIndex(), DOTA_ORDER_ISSUER_PASSED_UNIT_ONLY, issuer, true, false);
callPickup = true;
}
}
if (callPickup) {
// Multhithreading magic — who knows when the hero finishes dropping the items?
manaAbusePickup = std::async(std::launch::async, [&, origItemStats, player, issuer]() mutable {
Sleep(300);
for (auto& [item, stat] : origItemStats)
ChangeItemStatTo(item, stat, player, issuer);

for (auto& item : ctx.physicalItems) { // wtf is with this indentation???
if (IsWithinRadius(item->GetPos(), ctx.localHero->GetPos(), 50))
oPrepareUnitOrders(player, DOTA_UNIT_ORDER_PICKUP_ITEM, item->GetIndex(), &Vector::Zero, 0, DOTA_ORDER_ISSUER_PASSED_UNIT_ONLY, issuer, true, false);
}
ctx.physicalItems.clear();
});
}
Modules::ManaHPAbuse.PerformAbuse((CDOTABaseNPC*)issuer, Interfaces::EntitySystem->GetEntity<CDOTAItem>(abilityIndex));
break;
}
}
Expand Down
4 changes: 1 addition & 3 deletions Dota2Cheat/Hooks/PrepareUnitOrders.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,12 @@
#include "../Modules/Hacks/BadCastPrevention.h"
#include "../Modules/Hacks/PerfectBlink.h"
#include "../Modules/Hacks/CastRedirection.h"
#include "../Modules/Hacks/ManaHPAbuse.h"

// All unit orders go through this function
// This allows to adjust them to given parameters

namespace Hooks {
inline Signatures::PrepareUnitOrdersFn oPrepareUnitOrders = nullptr;

inline std::future<void> manaAbusePickup;

void hkPrepareUnitOrders(CDOTAPlayerController* player, dotaunitorder_t orderType, UINT32 targetIndex, Vector* position, UINT32 abilityIndex, PlayerOrderIssuer_t orderIssuer, CBaseEntity* issuer, bool queue, bool showEffects);
}
Loading