Add GameSpeed and Destroy Special Objects/Chests

author closed pr#555 after I fixed it.

Co-Authored-By: Echo <102425595+EchoesFromBeyond@users.noreply.github.com>
This commit is contained in:
Joaquin 2022-08-31 21:16:45 -06:00
parent 58a3113eb6
commit 06d9360f58
9 changed files with 153 additions and 12 deletions

View File

@ -101,6 +101,7 @@
<ClInclude Include="src\user\cheat\world\DialogSkip.h" /> <ClInclude Include="src\user\cheat\world\DialogSkip.h" />
<ClInclude Include="src\user\cheat\world\DumbEnemies.h" /> <ClInclude Include="src\user\cheat\world\DumbEnemies.h" />
<ClInclude Include="src\user\cheat\world\FreezeEnemies.h" /> <ClInclude Include="src\user\cheat\world\FreezeEnemies.h" />
<ClInclude Include="src\user\cheat\world\GameSpeed.h" />
<ClInclude Include="src\user\cheat\world\KillAura.h" /> <ClInclude Include="src\user\cheat\world\KillAura.h" />
<ClInclude Include="src\user\cheat\world\MobVacuum.h" /> <ClInclude Include="src\user\cheat\world\MobVacuum.h" />
<ClInclude Include="src\user\cheat\world\OpenTeamImmediately.h" /> <ClInclude Include="src\user\cheat\world\OpenTeamImmediately.h" />
@ -195,6 +196,7 @@
<ClCompile Include="src\user\cheat\world\DialogSkip.cpp" /> <ClCompile Include="src\user\cheat\world\DialogSkip.cpp" />
<ClCompile Include="src\user\cheat\world\DumbEnemies.cpp" /> <ClCompile Include="src\user\cheat\world\DumbEnemies.cpp" />
<ClCompile Include="src\user\cheat\world\FreezeEnemies.cpp" /> <ClCompile Include="src\user\cheat\world\FreezeEnemies.cpp" />
<ClCompile Include="src\user\cheat\world\GameSpeed.cpp" />
<ClCompile Include="src\user\cheat\world\KillAura.cpp" /> <ClCompile Include="src\user\cheat\world\KillAura.cpp" />
<ClCompile Include="src\user\cheat\world\MobVacuum.cpp" /> <ClCompile Include="src\user\cheat\world\MobVacuum.cpp" />
<ClCompile Include="src\user\cheat\world\OpenTeamImmediately.cpp" /> <ClCompile Include="src\user\cheat\world\OpenTeamImmediately.cpp" />

View File

@ -267,6 +267,9 @@
<ClInclude Include="src\user\cheat\misc\About.h"> <ClInclude Include="src\user\cheat\misc\About.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="src\user\cheat\world\GameSpeed.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Font Include="res\Ruda-Bold.ttf" /> <Font Include="res\Ruda-Bold.ttf" />
@ -492,6 +495,9 @@
<ClCompile Include="src\user\cheat\misc\About.cpp"> <ClCompile Include="src\user\cheat\misc\About.cpp">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="src\user\cheat\world\GameSpeed.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ResourceCompile Include="res\res.rc"> <ResourceCompile Include="res\res.rc">

View File

@ -32,6 +32,7 @@
#include <cheat/world/FakeTime.h> #include <cheat/world/FakeTime.h>
#include <cheat/world/AutoSeelie.h> #include <cheat/world/AutoSeelie.h>
#include <cheat/world/VacuumLoot.h> #include <cheat/world/VacuumLoot.h>
#include <cheat/world/GameSpeed.h>
#include <cheat/teleport/ChestTeleport.h> #include <cheat/teleport/ChestTeleport.h>
#include <cheat/teleport/MapTeleport.h> #include <cheat/teleport/MapTeleport.h>
@ -107,6 +108,7 @@ namespace cheat
FEAT_INST(AutoChallenge), FEAT_INST(AutoChallenge),
FEAT_INST(MobVacuum), FEAT_INST(MobVacuum),
FEAT_INST(FakeTime), FEAT_INST(FakeTime),
FEAT_INST(GameSpeed),
FEAT_INST(ChestTeleport), FEAT_INST(ChestTeleport),
FEAT_INST(OculiTeleport), FEAT_INST(OculiTeleport),

View File

@ -311,7 +311,7 @@ namespace cheat::game::filters
WhitelistFilter PressurePlate = { {EntityType__Enum_1::Field, EntityType__Enum_1::Gadget }, {"Gear_Gravity", "_LitPathPlate" } }; WhitelistFilter PressurePlate = { {EntityType__Enum_1::Field, EntityType__Enum_1::Gadget }, {"Gear_Gravity", "_LitPathPlate" } };
SimpleFilter SealLocations = { EntityType__Enum_1::Gadget, "_RunesKey" }; SimpleFilter SealLocations = { EntityType__Enum_1::Gadget, "_RunesKey" };
SimpleFilter SeelieLamp = { EntityType__Enum_1::Field, {"Gear_SeeliaLamp", "LifeSeelieBase"} }; SimpleFilter SeelieLamp = { EntityType__Enum_1::Field, {"Gear_SeeliaLamp", "LifeSeelieBase"} };
SimpleFilter Seelie = { EntityType__Enum_1::Platform, {"Gear_Seelie", "_LifeSeelie"}}; SimpleFilter Seelie = { EntityType__Enum_1::Platform, {"Gear_Seelie", "_LifeSeelie"} };
SimpleFilter SmallRockPile = { EntityType__Enum_1::Gadget, "_StonePile_01" }; SimpleFilter SmallRockPile = { EntityType__Enum_1::Gadget, "_StonePile_01" };
SimpleFilter StormBarrier = { EntityType__Enum_1::Field, "_WindField_PushField" }; SimpleFilter StormBarrier = { EntityType__Enum_1::Field, "_WindField_PushField" };
SimpleFilter SwordHilt = { EntityType__Enum_1::Field, "_WastedSword_" }; SimpleFilter SwordHilt = { EntityType__Enum_1::Field, "_WastedSword_" };
@ -367,7 +367,11 @@ namespace cheat::game::filters
plant::MistFlowerCorolla, plant::MistFlowerCorolla,
plant::FlamingFlowerStamen plant::FlamingFlowerStamen
}; };
SimpleFilter BreakableObjects = {
puzzle::AncientRime,
puzzle::LargeRockPile,
puzzle::SmallRockPile
};
WhitelistFilter Doodads = { WhitelistFilter Doodads = {
EntityType__Enum_1::Gadget, EntityType__Enum_1::Gadget,
{ {

View File

@ -342,6 +342,7 @@ namespace cheat::game::filters
extern SimpleFilter Chests; extern SimpleFilter Chests;
extern SimpleFilter Ores; extern SimpleFilter Ores;
extern SimpleFilter PlantDestroy; extern SimpleFilter PlantDestroy;
extern SimpleFilter BreakableObjects;
extern WhitelistFilter Doodads; extern WhitelistFilter Doodads;
extern SimpleFilter Animals; extern SimpleFilter Animals;
extern SimpleFilter AnimalDrop; extern SimpleFilter AnimalDrop;

View File

@ -20,6 +20,8 @@ namespace cheat::feature
NF(f_DestroyShields, "Destroy Shields", "AutoDestroy", false), NF(f_DestroyShields, "Destroy Shields", "AutoDestroy", false),
NF(f_DestroyDoodads, "Destroy Doodads", "AutoDestroy", false), NF(f_DestroyDoodads, "Destroy Doodads", "AutoDestroy", false),
NF(f_DestroyPlants, "Destroy Plants", "AutoDestroy", false), NF(f_DestroyPlants, "Destroy Plants", "AutoDestroy", false),
NF(f_DestroySpecialObjects, "Destroy Special Objects", "AutoDestroy", false),
NF(f_DestroySpecialChests, "Destroy Special Chests", "AutoDestroy", false),
NF(f_Range, "Range", "AutoDestroy", 10.0f) NF(f_Range, "Range", "AutoDestroy", 10.0f)
{ {
HookManager::install(app::MoleMole_LCAbilityElement_ReduceModifierDurability, LCAbilityElement_ReduceModifierDurability_Hook); HookManager::install(app::MoleMole_LCAbilityElement_ReduceModifierDurability, LCAbilityElement_ReduceModifierDurability_Hook);
@ -40,12 +42,14 @@ namespace cheat::feature
ImGui::Indent(); ImGui::Indent();
ConfigWidget("Ores", f_DestroyOres, "Ores and variants, e.g. electro crystals, marrows, etc."); ConfigWidget("Ores", f_DestroyOres, "Ores and variants, e.g. electro crystals, marrows, etc.");
ConfigWidget("Shields", f_DestroyShields, "Abyss mage/churl/slime shields."); ConfigWidget("Shields", f_DestroyShields, "Abyss mage/churl/slime shields.");
ImGui::SameLine();
ImGui::TextColored(ImColor(255, 165, 0, 255), "Extremely risky!");
ConfigWidget("Doodads", f_DestroyDoodads, "Barrels, boxes, vases, etc."); ConfigWidget("Doodads", f_DestroyDoodads, "Barrels, boxes, vases, etc.");
ImGui::SameLine();
ImGui::TextColored(ImColor(255, 165, 0, 255), "Extremely risky!");
ConfigWidget("Plants", f_DestroyPlants, "Dandelion Seeds, Sakura Bloom, etc."); ConfigWidget("Plants", f_DestroyPlants, "Dandelion Seeds, Sakura Bloom, etc.");
ConfigWidget("Special Objects", f_DestroySpecialObjects, "Destroy Ancient Rime, Large and Small Rock Piles");
ImGui::SameLine();
ImGui::TextColored(ImColor(255, 165, 0, 255), "Risk Unknown!");
ConfigWidget("Special Chests", f_DestroySpecialChests, "Destroy Chests with Brambles, Frozen, or In Rocks");
ImGui::SameLine();
ImGui::TextColored(ImColor(255, 165, 0, 255), "Risk Unknown!");
ImGui::Unindent(); ImGui::Unindent();
ConfigWidget("Range (m)", f_Range, 0.1f, 1.0f, 15.0f); ConfigWidget("Range (m)", f_Range, 0.1f, 1.0f, 15.0f);
} }
@ -57,13 +61,15 @@ namespace cheat::feature
void AutoDestroy::DrawStatus() void AutoDestroy::DrawStatus()
{ {
ImGui::Text("Destroy [%.01fm%s%s%s%s%s]", ImGui::Text("Destroy [%.01fm%s%s%s%s%s%s%s]",
f_Range.value(), f_Range.value(),
f_DestroyOres || f_DestroyShields || f_DestroyDoodads || f_DestroyPlants ? "|" : "", f_DestroyOres || f_DestroyShields || f_DestroyDoodads || f_DestroyPlants || f_DestroySpecialObjects || f_DestroySpecialChests ? "|" : "",
f_DestroyOres ? "O" : "", f_DestroyOres ? "O" : "",
f_DestroyShields ? "S" : "", f_DestroyShields ? "S" : "",
f_DestroyDoodads ? "D" : "", f_DestroyDoodads ? "D" : "",
f_DestroyPlants ? "P" : ""); f_DestroyPlants ? "P" : "",
f_DestroySpecialObjects ? "SO" : "",
f_DestroySpecialChests ? "SC" : "");
} }
AutoDestroy& AutoDestroy::GetInstance() AutoDestroy& AutoDestroy::GetInstance()
@ -101,7 +107,9 @@ namespace cheat::feature
(autoDestroy.f_DestroyShields && !game::filters::combined::MonsterBosses.IsValid(manager.entity(entity)) && ( (autoDestroy.f_DestroyShields && !game::filters::combined::MonsterBosses.IsValid(manager.entity(entity)) && (
game::filters::combined::MonsterShielded.IsValid(manager.entity(entity)) || // For shields attached to monsters, e.g. abyss mage shields. game::filters::combined::MonsterShielded.IsValid(manager.entity(entity)) || // For shields attached to monsters, e.g. abyss mage shields.
game::filters::combined::MonsterEquips.IsValid(manager.entity(entity)))) || // For shields/weapons equipped by monsters, e.g. rock shield. game::filters::combined::MonsterEquips.IsValid(manager.entity(entity)))) || // For shields/weapons equipped by monsters, e.g. rock shield.
(autoDestroy.f_DestroyPlants && game::filters::combined::PlantDestroy.IsValid(manager.entity(entity))) // For plants e.g dandelion seeds. (autoDestroy.f_DestroyPlants && game::filters::combined::PlantDestroy.IsValid(manager.entity(entity))) || // For plants e.g dandelion seeds.
(autoDestroy.f_DestroySpecialObjects && game::filters::combined::BreakableObjects.IsValid(manager.entity(entity))) || // For Breakable Objects e.g Ancient Rime, Large and Small Rock Piles.
(autoDestroy.f_DestroySpecialChests && game::filters::combined::Chests.IsValid(manager.entity(entity))) // For Special Chests e.g Brambles, Frozen, Encased in Rock.
) )
) )
{ {

View File

@ -13,6 +13,8 @@ namespace cheat::feature
config::Field<config::Toggle<Hotkey>> f_DestroyShields; config::Field<config::Toggle<Hotkey>> f_DestroyShields;
config::Field<config::Toggle<Hotkey>> f_DestroyDoodads; config::Field<config::Toggle<Hotkey>> f_DestroyDoodads;
config::Field<config::Toggle<Hotkey>> f_DestroyPlants; config::Field<config::Toggle<Hotkey>> f_DestroyPlants;
config::Field<config::Toggle<Hotkey>> f_DestroySpecialObjects;
config::Field<config::Toggle<Hotkey>> f_DestroySpecialChests;
config::Field<float> f_Range; config::Field<float> f_Range;
static AutoDestroy& GetInstance(); static AutoDestroy& GetInstance();

View File

@ -0,0 +1,89 @@
#include "pch-il2cpp.h"
#include "GameSpeed.h"
#include <helpers.h>
#include <cheat/events.h>
#include <cheat/game/EntityManager.h>
namespace cheat::feature
{
GameSpeed::GameSpeed() : Feature(),
NF(f_Enabled, "GameSpeed Enabled", "GameSpeed", false),
NF(f_Hotkey, "GameSpeed HotKey", "GameSpeed", Hotkey(VK_CAPITAL)),
NF(f_Speed, "GameSpeed Multiplier", "GameSpeed", 5.0f)
{
events::GameUpdateEvent += MY_METHOD_HANDLER(GameSpeed::OnGameUpdate);
}
const FeatureGUIInfo& GameSpeed::GetGUIInfo() const
{
static const FeatureGUIInfo info{ "GameSpeed", "World", true };
return info;
}
void GameSpeed::DrawMain()
{
ConfigWidget("GameSpeed Enabled", f_Enabled, "Speeds up game with hotkey");
if (f_Enabled)
{
ConfigWidget("GameSpeed Hotkey", f_Hotkey);
ConfigWidget(f_Speed, 1.0f, 0.0f, 20.0f, "Set GameSpeed Multiplier\n" \
"Do NOT use this in the Open World, only use in menus/etc, VERY DANGEROUS!");
}
}
bool GameSpeed::NeedStatusDraw() const
{
return f_Enabled;
}
void GameSpeed::DrawStatus()
{
ImGui::Text("GameSpeed");
}
GameSpeed& GameSpeed::GetInstance()
{
static GameSpeed instance;
return instance;
}
void GameSpeed::OnGameUpdate()
{
static bool isSpeed = false;
float currentSpeed = app::Time_get_timeScale(nullptr);
if (f_Enabled)
{
if (f_Hotkey.value().IsPressed() && !isSpeed)
{
if (currentSpeed == 1.0f)
{
app::Time_set_timeScale(f_Speed, nullptr);
isSpeed = true;
}
}
if (!f_Hotkey.value().IsPressed() && isSpeed)
{
if (currentSpeed != 1.0f)
{
app::Time_set_timeScale(1.0f, nullptr);
isSpeed = false;
}
}
}
else
{
// Aditional check if user is still pressing key and they decide to disable the feature
if (isSpeed)
{
if (currentSpeed != 1.0f)
{
app::Time_set_timeScale(1.0f, nullptr);
isSpeed = false;
}
}
}
}
}

View File

@ -0,0 +1,27 @@
#pragma once
#include <cheat-base/cheat/Feature.h>
#include <cheat-base/config/config.h>
namespace cheat::feature
{
class GameSpeed : public Feature
{
public:
config::Field<config::Toggle<Hotkey>> f_Enabled;
config::Field<Hotkey> f_Hotkey;
config::Field<float> f_Speed;
static GameSpeed& GetInstance();
const FeatureGUIInfo& GetGUIInfo() const override;
void DrawMain() override;
virtual bool NeedStatusDraw() const override;
void DrawStatus() override;
void OnGameUpdate();
private:
GameSpeed();
};
}