helper functions added

- Added helper functions to facilitate Vector3 and Transform operations.
- Defined operator overloads for Vector3 (not tested).
- Added fly and spawnPrefab functions to the Misc namespace (not tested).
- Added fly speed to settings.
This commit is contained in:
Jadis0x
2024-05-19 02:43:52 +03:00
parent 0c809fc44b
commit d32b92d1e3
9 changed files with 156 additions and 7 deletions

View File

@@ -1,4 +1,4 @@
#include "pch-il2cpp.h"
#include "pch-il2cpp.h"
#include "Misc.h"
#include "Wrapper.h"
@@ -138,9 +138,80 @@ void Misc::InstantWin()
}
}
// This function has not been tested
// This function has not been tested
// This function has not been tested
void Misc::Fly(float speed) {
auto localPlayer = Player::GetLocalPlayer();
if (localPlayer == nullptr) return;
auto nb = Player::GetNolan();
app::Transform* _transform = Unity::Transform::Get(localPlayer);
if (_transform) {
app::Vector3 pos = Unity::Transform::Position(_transform);
if (GetAsyncKeyState('W') & 0x8000) {
pos = pos + (app::Transform_get_forward(_transform, nullptr) * speed * Time_DeltaTime());
}
if (GetAsyncKeyState('S') & 0x8000) {
pos = pos - (app::Transform_get_forward(_transform, nullptr) * speed * Time_DeltaTime());
}
if (GetAsyncKeyState('D') & 0x8000) {
pos = pos + (app::Transform_get_right(_transform, nullptr) * speed * Time_DeltaTime());
}
if (GetAsyncKeyState('A') & 0x8000) {
pos = pos - (app::Transform_get_right(_transform, nullptr) * speed * Time_DeltaTime());
}
if (GetAsyncKeyState(VK_SPACE) & 0x8000) {
pos = pos + (app::Transform_get_up(_transform, nullptr) * speed * Time_DeltaTime());
}
if (GetAsyncKeyState(VK_LCONTROL) & 0x8000) {
pos = pos - (app::Transform_get_up(_transform, nullptr) * speed * Time_DeltaTime());
}
auto component = Unity::GameObject::GetComponentByName(localPlayer, "UltimateCharacterLocomotion");
if (component) {
app::UltimateCharacterLocomotion* locomotion = reinterpret_cast<app::UltimateCharacterLocomotion*>(component);
if (locomotion) {
if (app::UltimateCharacterLocomotion_SetPosition_1 == nullptr) return;
app::UltimateCharacterLocomotion_SetPosition_1(locomotion, pos, false, nullptr);
}
}
}
}
void Misc::CustomizedLobby()
{
}
// This function has not been tested
// This function has not been tested
// This function has not been tested
void Misc::SpawnPrefab(app::PrefabId id) {
if (il2cppi_is_initialized(app::BoltPrefabs__TypeInfo)) {
app::PrefabId pGate = (*app::BoltPrefabs__TypeInfo)->static_fields->ManorGate;
app::Quaternion rotation = app::Quaternion_get_identity(NULL);
auto localPlayer = Player::GetLocalPlayer();
if (localPlayer) {
app::Transform* _transform = Unity::Transform::Get(localPlayer);
if (_transform == nullptr) return;
app::Vector3 pos = Unity::Transform::Position(_transform);
// CRASH????????????????
app::BoltNetwork_Instantiate_6(pGate, pos, rotation, NULL);
}
}
}
void Misc::RankSpoofer(int value) {
@@ -182,9 +253,6 @@ void Misc::FullBright()
}
}
void Misc::Fly() {
}
void Misc::Revive(bool self)
{

View File

@@ -9,9 +9,10 @@ namespace Misc {
void CarryItem(const char* itemName);
void CarryAnimal(const char* animalName);
void InstantWin();
void Fly(float speed);
void CustomizedLobby();
void SpawnPrefab(app::PrefabId id);
void FullBright();
void Fly();
void Revive(bool self);
void GetKeys();
void Jumpscare();