Merge pull request #369 from RyujinZX/master
Custom Weather & Lightning target & Fix Exception miniMap
This commit is contained in:
commit
ff60431a85
@ -24,6 +24,7 @@
|
||||
<ClInclude Include="src\user\cheat\visuals\TextureChanger.h" />
|
||||
<ClInclude Include="src\user\cheat\visuals\FreeCamera.h" />
|
||||
<ClInclude Include="src\user\cheat\world\AutoSeelie.h" />
|
||||
<ClInclude Include="src\user\cheat\world\CustomWeather.h" />
|
||||
<ClInclude Include="src\user\cheat\world\FakeTime.h" />
|
||||
<ClInclude Include="src\user\cheat\debugger.h">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release_WS|x64'">false</ExcludedFromBuild>
|
||||
@ -115,6 +116,7 @@
|
||||
<ClCompile Include="src\user\cheat\visuals\TextureChanger.cpp" />
|
||||
<ClCompile Include="src\user\cheat\visuals\FreeCamera.cpp" />
|
||||
<ClCompile Include="src\user\cheat\world\AutoSeelie.cpp" />
|
||||
<ClCompile Include="src\user\cheat\world\CustomWeather.cpp" />
|
||||
<ClCompile Include="src\user\cheat\world\FakeTime.cpp" />
|
||||
<ClCompile Include="src\user\cheat\debugger.cpp">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</ExcludedFromBuild>
|
||||
|
@ -249,6 +249,9 @@
|
||||
<ClInclude Include="src\user\cheat\world\FreezeEnemies.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\user\cheat\world\CustomWeather.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Font Include="res\Ruda-Bold.ttf" />
|
||||
@ -456,6 +459,9 @@
|
||||
<ClCompile Include="src\user\cheat\world\FreezeEnemies.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\user\cheat\world\CustomWeather.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="res\res.rc">
|
||||
|
@ -42,6 +42,7 @@
|
||||
|
||||
#include <cheat/world/AutoFish.h>
|
||||
#include <cheat/world/AutoCook.h>
|
||||
#include <cheat/world/CustomWeather.h>
|
||||
|
||||
#include <cheat/visuals/NoFog.h>
|
||||
#include <cheat/visuals/FPSUnlock.h>
|
||||
@ -109,6 +110,8 @@ namespace cheat
|
||||
FEAT_INST(AutoFish),
|
||||
FEAT_INST(AutoCook),
|
||||
|
||||
FEAT_INST(CustomWeather),
|
||||
|
||||
FEAT_INST(NoFog),
|
||||
FEAT_INST(FPSUnlock),
|
||||
FEAT_INST(CameraZoom),
|
||||
|
@ -529,5 +529,7 @@ namespace cheat::game::filters
|
||||
SimpleFilter OrganicTargets = { Monsters, Animals }; // Solael: Please don't mess around with this filter.
|
||||
//m0nkrel: We can choose the entities we need ourselves so as not to magnetize cats, dogs, etc.
|
||||
//AdvancedFilter Animals = { {EntityType__Enum_1::EnvAnimal, EntityType__Enum_1::Monster }, {"Crane", "Tit", "Boar", "Squirrel", "Fox", "Pigeon", "Wigeon", "Falcon" ,"Marten" } };
|
||||
|
||||
SimpleFilter Lightning = { EntityType__Enum_1::Lightning };
|
||||
}
|
||||
}
|
||||
|
@ -337,5 +337,6 @@ namespace cheat::game::filters
|
||||
extern SimpleFilter MonsterEquips;
|
||||
extern BlacklistFilter Living;
|
||||
extern SimpleFilter OrganicTargets;
|
||||
extern SimpleFilter Lightning;
|
||||
}
|
||||
}
|
@ -1358,6 +1358,12 @@ namespace cheat::feature
|
||||
if (_monoMiniMap == nullptr)
|
||||
return false;
|
||||
|
||||
// Fix Exception in Console, when loading ptr null | RyujinZX#7832
|
||||
if (_monoMiniMap->fields._._._._.m_CachedPtr == 0) {
|
||||
_monoMiniMap = nullptr;
|
||||
return false;
|
||||
}
|
||||
|
||||
SAFE_BEGIN();
|
||||
return app::Behaviour_get_isActiveAndEnabled(reinterpret_cast<app::Behaviour*>(_monoMiniMap), nullptr);
|
||||
SAFE_ERROR();
|
||||
|
114
cheat-library/src/user/cheat/world/CustomWeather.cpp
Normal file
114
cheat-library/src/user/cheat/world/CustomWeather.cpp
Normal file
@ -0,0 +1,114 @@
|
||||
#include "pch-il2cpp.h"
|
||||
#include "CustomWeather.h"
|
||||
#include <helpers.h>
|
||||
#include <cheat/events.h>
|
||||
#include <cheat/game/EntityManager.h>
|
||||
#include <cheat/game/util.h>
|
||||
#include <cheat/game/filters.h>
|
||||
|
||||
namespace cheat::feature
|
||||
{
|
||||
const char* WeatherType[]{ "ClearSky", "Cloudy", "Foggy", "Storm", "RainHeavy", "FountainRain", "SnowLight", "EastCoast" };
|
||||
std::string CustomWeather::GetWeather() {
|
||||
switch (current_weather)
|
||||
{
|
||||
case 0:
|
||||
return "Data/Environment/Weather/BigWorld/Weather_ClearSky";
|
||||
|
||||
case 1:
|
||||
return "Data/Environment/Weather/BigWorld/Weather_Cloudy";
|
||||
|
||||
case 2:
|
||||
return "Data/Environment/Weather/BigWorld/Weather_Foggy";
|
||||
|
||||
case 3:
|
||||
return "Data/Environment/Weather/BigWorld/Weather_Storm";
|
||||
|
||||
case 4:
|
||||
return "Data/Environment/Weather/BigWorld/Weather_Dq_Tabeisha_Rain_Heavy";
|
||||
|
||||
case 5:
|
||||
return "Data/Environment/Weather/BigWorld/Weather_LY_Fountain_Rain";
|
||||
|
||||
case 6:
|
||||
return "Data/Environment/Weather/BigWorld/Weather_Snowmountain_Snow_Light";
|
||||
|
||||
case 7:
|
||||
return "Data/Environment/Weather/BigWorld/Weather_Snowmountain_EastCoast";
|
||||
|
||||
default:
|
||||
return "Data/Environment/Weather/BigWorld/Weather_ClearSky";
|
||||
}
|
||||
}
|
||||
|
||||
CustomWeather::CustomWeather() : Feature(),
|
||||
NF(f_Enabled, "Custom Weather", "World", false),
|
||||
NF(f_Lightning, "Lightning", "World", false),
|
||||
toBeUpdate(), nextUpdate(0)
|
||||
{
|
||||
events::GameUpdateEvent += MY_METHOD_HANDLER(CustomWeather::OnGameUpdate);
|
||||
}
|
||||
|
||||
const FeatureGUIInfo& CustomWeather::GetGUIInfo() const
|
||||
{
|
||||
static const FeatureGUIInfo info{ "CustomWeather", "Visuals", true };
|
||||
return info;
|
||||
}
|
||||
|
||||
void CustomWeather::DrawMain()
|
||||
{
|
||||
ConfigWidget(f_Enabled, "Custom Weather.");
|
||||
if (f_Enabled) {
|
||||
ImGui::Combo(("Weather Type"), ¤t_weather, WeatherType, ARRAYSIZE(WeatherType));
|
||||
}
|
||||
ConfigWidget(f_Lightning, "Lightning target enemy, works with RainHeavy weather.");
|
||||
}
|
||||
|
||||
bool CustomWeather::NeedStatusDraw() const
|
||||
{
|
||||
return f_Enabled;
|
||||
}
|
||||
|
||||
void CustomWeather::DrawStatus()
|
||||
{
|
||||
ImGui::Text("Custom Weather");
|
||||
if (f_Lightning)
|
||||
ImGui::Text("Lightning");
|
||||
}
|
||||
|
||||
CustomWeather& CustomWeather::GetInstance()
|
||||
{
|
||||
static CustomWeather instance;
|
||||
return instance;
|
||||
}
|
||||
|
||||
void CustomWeather::OnGameUpdate()
|
||||
{
|
||||
if (!f_Enabled)
|
||||
return;
|
||||
|
||||
auto currentTime = util::GetCurrentTimeMillisec();
|
||||
if (currentTime < nextUpdate)
|
||||
return;
|
||||
|
||||
auto Enviro = app::EnviroSky_get_Instance(nullptr);
|
||||
if (Enviro != nullptr) {
|
||||
app::EnviroSky_ChangeWeather(Enviro, string_to_il2cppi(GetWeather()), 1, 1, nullptr);
|
||||
|
||||
if (f_Lightning && current_weather == 4) {
|
||||
auto& manager = game::EntityManager::instance();
|
||||
|
||||
for (auto& Monsters : manager.entities(game::filters::combined::Monsters)) {
|
||||
if (manager.avatar()->distance(Monsters) >= 30)
|
||||
continue;
|
||||
|
||||
for (auto& entity : manager.entities(game::filters::combined::Lightning)) {
|
||||
entity->setRelativePosition(Monsters->relativePosition());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
nextUpdate = currentTime + (int)f_DelayUpdate;
|
||||
}
|
||||
}
|
28
cheat-library/src/user/cheat/world/CustomWeather.h
Normal file
28
cheat-library/src/user/cheat/world/CustomWeather.h
Normal file
@ -0,0 +1,28 @@
|
||||
#pragma once
|
||||
#include <cheat-base/cheat/Feature.h>
|
||||
#include <cheat-base/config/config.h>
|
||||
#include <cheat-base/thread-safe.h>
|
||||
|
||||
namespace cheat::feature
|
||||
{
|
||||
class CustomWeather : public Feature
|
||||
{
|
||||
public:
|
||||
config::Field<config::Toggle<Hotkey>> f_Enabled;
|
||||
config::Field<config::Toggle<Hotkey>> f_Lightning;
|
||||
|
||||
static CustomWeather& GetInstance();
|
||||
const FeatureGUIInfo& GetGUIInfo() const override;
|
||||
void DrawMain() override;
|
||||
bool NeedStatusDraw() const override;
|
||||
void DrawStatus() override;
|
||||
private:
|
||||
int current_weather;
|
||||
std::string GetWeather();
|
||||
SafeQueue<uint32_t> toBeUpdate;
|
||||
SafeValue<int64_t> nextUpdate;
|
||||
int f_DelayUpdate = 1;
|
||||
void OnGameUpdate();
|
||||
CustomWeather();
|
||||
};
|
||||
}
|
Loading…
Reference in New Issue
Block a user