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

Commit

Permalink
Refactor ChestESP to StorageESP (#4514)
Browse files Browse the repository at this point in the history
* StorageESP

* Update and rename ChestESP.h to StorageESP.h

* Update and rename ChestESP.cpp to StorageESP.cpp

* Update ModuleManager.cpp

* Finish StorageESP

* fix build error

* Update Horion.vcxproj
  • Loading branch information
Intoprelised authored Oct 4, 2021
1 parent 10a1a11 commit 5b037ad
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 16 deletions.
4 changes: 2 additions & 2 deletions Horion.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@
<ClCompile Include="Horion\Module\Modules\Blink.cpp" />
<ClCompile Include="Horion\Module\Modules\BowAimbot.cpp" />
<ClCompile Include="Horion\Module\Modules\ChestAura.cpp" />
<ClCompile Include="Horion\Module\Modules\ChestESP.cpp" />
<ClCompile Include="Horion\Module\Modules\StorageESP.cpp" />
<ClCompile Include="Horion\Module\Modules\ChestStealer.cpp" />
<ClCompile Include="Horion\Module\Modules\ClickGuiMod.cpp" />
<ClCompile Include="Horion\Module\Modules\Compass.cpp" />
Expand Down Expand Up @@ -653,4 +653,4 @@
<Error Condition="!Exists('packages\Microsoft.XAudio2.Redist.1.2.0\build\native\Microsoft.XAudio2.Redist.targets')" Text="$([System.String]::Format('$(ErrorText)', 'packages\Microsoft.XAudio2.Redist.1.2.0\build\native\Microsoft.XAudio2.Redist.targets'))" />
<Error Condition="!Exists('packages\directxtk_desktop_2017.2020.2.24.4\build\native\directxtk_desktop_2017.targets')" Text="$([System.String]::Format('$(ErrorText)', 'packages\directxtk_desktop_2017.2020.2.24.4\build\native\directxtk_desktop_2017.targets'))" />
</Target>
</Project>
</Project>
2 changes: 1 addition & 1 deletion Horion/Module/ModuleManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ void ModuleManager::initModules() {
this->moduleList.push_back(std::shared_ptr<IModule>(new Jetpack()));
this->moduleList.push_back(std::shared_ptr<IModule>(new Aimbot()));
this->moduleList.push_back(std::shared_ptr<IModule>(new TriggerBot()));
this->moduleList.push_back(std::shared_ptr<IModule>(new ChestESP()));
this->moduleList.push_back(std::shared_ptr<IModule>(new StorageESP()));
this->moduleList.push_back(std::shared_ptr<IModule>(new Velocity()));
this->moduleList.push_back(std::shared_ptr<IModule>(new RainbowSky()));
this->moduleList.push_back(std::shared_ptr<IModule>(new AirJump()));
Expand Down
2 changes: 1 addition & 1 deletion Horion/Module/ModuleManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
#include "Modules/BowAimbot.h"
#include "Modules/AntiVoid.h"
#include "Modules/ChestAura.h"
#include "Modules/ChestESP.h"
#include "Modules/StorageESP.h"
#include "Modules/ChestStealer.h"
#include "Modules/ClickGuiMod.h"
#include "Modules/Teleport.h"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
#include "ChestESP.h"
#include "StorageESP.h"
#include "../../DrawUtils.h"

ChestESP::ChestESP() : IModule(0, Category::VISUAL, "ESP for chests") {
StorageESP::StorageESP() : IModule(0, Category::VISUAL, "ESP for storage blocks") {
}

ChestESP::~ChestESP() {
StorageESP::~StorageESP() {
}

const char* ChestESP::getModuleName() {
return ("ChestESP");
const char* StorageESP::getModuleName() {
return ("StorageESP");
}

void ChestESP::onPreRender(C_MinecraftUIRenderContext* renderCtx) {
void StorageESP::onPreRender(C_MinecraftUIRenderContext* renderCtx) {
if (!g_Data.isInGame() || !GameData::canUseMoveKeys() || g_Data.getLocalPlayer() == nullptr)
return;

Expand All @@ -35,12 +35,15 @@ void ChestESP::onPreRender(C_MinecraftUIRenderContext* renderCtx) {
if (storageID == 54) DrawUtils::setColor(1.f, 1.f, 1.f, math); // Normal Chest
if (storageID == 146) DrawUtils::setColor(.92f, .14f, .14f, math); // Trapped Chest
if (storageID == 130) DrawUtils::setColor(0.435294f, 0.215686f, 0.631372f, math); // Ender Chest
if (storageID == 458) DrawUtils::setColor(0.62, 0.31, 0.04, math); // Barrel
if (storageID == 205) DrawUtils::setColor(.49f, .17f, .95f, math); // Undyed Shulker Box
if (storageID == 218) DrawUtils::setColor(.08f, .91f, .99f, math); // Shulker Box

DrawUtils::drawBox(chest.lower, chest.upper, (float)fmax(0.2f, 1 / (float)fmax(1, g_Data.getLocalPlayer()->eyePos0.dist(chest.lower))), true); // Fancy math to give an illusion of good esp
}
}

void ChestESP::onTick(C_GameMode* gm) {
void StorageESP::onTick(C_GameMode* gm) {
// Swap list
auto listLock = g_Data.lockChestList();
auto& chestList = g_Data.getChestList();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@

#include "Module.h"

class ChestESP : public IModule {
class StorageESP : public IModule {
private:
int tickTimeout = 0;
std::vector<AABB> bufferedChestList;
std::mutex listLock;

public:
ChestESP();
~ChestESP();
StorageESP();
~StorageESP();

// Inherited via IModule
virtual const char* getModuleName() override;
Expand Down
4 changes: 2 additions & 2 deletions Memory/Hooks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -868,8 +868,8 @@ float Hooks::Dimension_getSunIntensity(__int64 a1, float a2, vec3_t* a3, float a
void Hooks::ChestBlockActor_tick(C_ChestBlockActor* _this, void* a) {
static auto oTick = g_Hooks.ChestBlockActor_tickHook->GetFastcall<void, C_ChestBlockActor*, void*>();
oTick(_this, a);
static auto* chestEspMod = moduleMgr->getModule<ChestESP>();
if (_this != nullptr && chestEspMod->isEnabled())
static auto* storageEspMod = moduleMgr->getModule<StorageESP>();
if (_this != nullptr && storageEspMod->isEnabled())
GameData::addChestToList(_this);
}

Expand Down

0 comments on commit 5b037ad

Please sign in to comment.