diff --git a/Fortnite Internal/Configs/Config.h b/Fortnite Internal/Configs/Config.h index 5112ef3..30c33a2 100644 --- a/Fortnite Internal/Configs/Config.h +++ b/Fortnite Internal/Configs/Config.h @@ -95,6 +95,16 @@ namespace Config { inline bool Name = true; inline bool Distance = true; inline bool CurrentWeapon = true; + + // Chams + inline bool Chams = false; + + inline bool SelfChams = false; + + inline bool Wireframe = true; + inline bool Glow = true; + + inline float GlowAmount = 1.f; } namespace Weapons { diff --git a/Fortnite Internal/Fortnite Internal.vcxproj b/Fortnite Internal/Fortnite Internal.vcxproj index 111a48d..c121be7 100644 --- a/Fortnite Internal/Fortnite Internal.vcxproj +++ b/Fortnite Internal/Fortnite Internal.vcxproj @@ -272,8 +272,8 @@ + - diff --git a/Fortnite Internal/Fortnite Internal.vcxproj.filters b/Fortnite Internal/Fortnite Internal.vcxproj.filters index a8a3a05..9f962a1 100644 --- a/Fortnite Internal/Fortnite Internal.vcxproj.filters +++ b/Fortnite Internal/Fortnite Internal.vcxproj.filters @@ -23,10 +23,10 @@ Drawing\RaaxGUI - + Game\Actors\Loops - + Game\Actors\Loops diff --git a/Fortnite Internal/Game/Actors/Loops/FortPawn.cpp b/Fortnite Internal/Game/Actors/Loops/FortPawn.cpp new file mode 100644 index 0000000..9faff74 --- /dev/null +++ b/Fortnite Internal/Game/Actors/Loops/FortPawn.cpp @@ -0,0 +1,280 @@ +#include "../Actors.h" + +#include "../../SDK/Classes/Engine_classes.h" + +#include "../../Game.h" + +#include "../../../Drawing/Drawing.h" +#include "../../../Configs/Config.h" + +#include "../../Features/FortPawnHelper/Bone.h" +#include "../../Features/FortPawnHelper/FortPawnHelper.h" +#include "../../Features/Aimbot/Aimbot.h" +#include "../../Features/Exploits/Vehicle.h" +#include "../../Features/Exploits/Weapon.h" +#include "../../Features/Exploits/Player.h" + +#include "../../../Utilities/Math.h" +#include "../../../Utilities/Logger.h" +#include "../../Input/Input.h" + +void Actors::FortPawn::Tick() { + bool SeenTarget = false; + + // move somewhere better later this is gay here + if (SDK::GetLocalPawn() == nullptr) LocalPawnCache.TeamIndex = INT_FAST8_MAX; + + std::vector CachedPlayersLocal = Actors::FortPawn::CachedPlayers; + + for (auto it = CachedPlayersLocal.begin(); it != CachedPlayersLocal.end(); ++it) { + Actors::Caches::FortPawnCache& CurrentPlayer = *it; + + SDK::AFortPawn* FortPawn = CurrentPlayer.FortPawn; if (SDK::IsValidPointer(FortPawn) == false) continue; + SDK::AFortPlayerState* FortPlayerState = SDK::Cast(FortPawn->PlayerState()); //if (SDK::IsValidPointer(FortPlayerState) == false) continue; + CurrentPlayer.Mesh = FortPawn->Mesh(); if (SDK::IsValidPointer(CurrentPlayer.Mesh) == false) continue; + + // IMPROVE LATER + if (Config::Visuals::Players::Chams) { + SDK::GetChamsMaterial()->SetbDisableDepthTest(true, &Config::Visuals::Players::Chams); + SDK::GetChamsMaterial()->SetBlendMode(SDK::EBlendMode::BLEND_AlphaComposite, &Config::Visuals::Players::Chams); + SDK::GetChamsMaterial()->SetWireFrame(Config::Visuals::Players::Wireframe, &Config::Visuals::Players::Chams); + + SDK::FLinearColor ChamsColor = SDK::FLinearColor(1.f, 0.f, 0.75f, 1.f); + SDK::GetChamsMaterialDynamic()->SetVectorParameterValue(SDK::FName(L"S Color1"), ChamsColor); + SDK::GetChamsMaterialDynamic()->SetVectorParameterValue(SDK::FName(L"S Color2"), ChamsColor); + + // i dont think this is working for some reason + SDK::GetChamsMaterialDynamic()->SetScalarParameterValue(SDK::FName(L"Dissolve Pattern Emissive Brightness"), Config::Visuals::Players::Glow ? Config::Visuals::Players::GlowAmount : 0.f); + + if ((FortPawn == SDK::GetLocalPawn() && Config::Visuals::Players::SelfChams) || (FortPawn != SDK::GetLocalPawn())) { + std::vector CharacterParts = SDK::Cast(FortPawn)->GetCharacterPartSkeletalMeshComponents(); + + for (auto Mesh : CharacterParts) { + if (SDK::IsValidPointer(Mesh) == false) continue; + + SDK::TArray Materials = Mesh->GetMaterials(); + + for (int i = 0; i < Materials.Num(); i++) { + if (SDK::IsValidPointer(Materials[i])) { + Mesh->SetMaterial(i, SDK::GetChamsMaterialDynamic()); + } + } + } + } + } + + // LocalPawn caching and exploit ticks + if (FortPawn == SDK::GetLocalPawn()) { + LocalPawnCache.Position = CurrentPlayer.Mesh->GetBonePosition(Features::FortPawnHelper::Bone::Head); + LocalPawnCache.TeamIndex = CurrentPlayer.TeamIndex; + + Features::Exploits::Vehicle::Tick(SDK::Cast(FortPawn)); + Features::Exploits::Weapon::Tick(FortPawn->CurrentWeapon()); + Features::Exploits::Player::Tick(SDK::Cast(FortPawn), SDK::Cast(SDK::GetLocalController())); + + continue; + } + + // Player state validation + if (CurrentPlayer.TeamIndex == LocalPawnCache.TeamIndex) continue; + if (CurrentPlayer.FortPawn->IsDying()) continue; + if (SDK::Cast(SDK::GetLocalPawn()->PlayerState())->SpectatingTarget() == SDK::Cast(FortPlayerState)) continue; + + // Bone positions and visibility caching + // If this returns false, the player isn't on the screen and only 5 of the bones were WorldToScreened + CurrentPlayer.IsBoneRegister2DPopulated = Features::FortPawnHelper::PopulateBones(CurrentPlayer); + Features::FortPawnHelper::PopulateVisibilities(CurrentPlayer); + + // Update IsPlayerVisibleOnScreen based on if any of the bones 2D positions are on the screen + CurrentPlayer.IsPlayerVisibleOnScreen = false; + for (int i = 0; i < CurrentPlayer.BonePositions2D.size(); i++) { + if (CurrentPlayer.BonePositions2D[i] == SDK::FVector2D()) continue; + + if (Math::IsOnScreen(CurrentPlayer.BonePositions2D[i])) { + CurrentPlayer.IsPlayerVisibleOnScreen = true; + } + } + + CurrentPlayer.DistanceFromLocalPawn = LocalPawnCache.Position.Distance(CurrentPlayer.BonePositions3D[Features::FortPawnHelper::Bone::Root]) / 100.f; + + // Hardcoded max distance, should move to bone population for optimisation + if (CurrentPlayer.DistanceFromLocalPawn > 500.f) continue; + + // Update any bone visibility + CurrentPlayer.IsAnyBoneVisible = false; + for (int i = 0; i < CurrentPlayer.BoneVisibilityStates.size(); i++) { + if (CurrentPlayer.BoneVisibilityStates[i]) { + CurrentPlayer.IsAnyBoneVisible = true; + break; + } + } + + // Visuals + if (CurrentPlayer.IsPlayerVisibleOnScreen) { + SDK::FVector2D TopLeft, BottomRight; + Features::FortPawnHelper::PopulateBoundCorners(CurrentPlayer, TopLeft, BottomRight); + + float FontSize = Math::CalculateInterpolatedValue(150.f, CurrentPlayer.DistanceFromLocalPawn, 12.f, 20.f); + float PrimaryThicknessMultiplier = Math::CalculateInterpolatedValue(75.f, CurrentPlayer.DistanceFromLocalPawn, 1.f, 3.f); + float SecondaryThicknessMultiplier = Math::CalculateInterpolatedValue(75.f, CurrentPlayer.DistanceFromLocalPawn, 1.f, 2.f); + + float PrimaryThickness = 1.f * PrimaryThicknessMultiplier; + float SecondaryThickness = 1.f * SecondaryThicknessMultiplier; + + SDK::FLinearColor PrimaryColor = SDK::FLinearColor(1.f, 1.f, 1.f, 1.f); + if (CurrentPlayer.IsAnyBoneVisible) { + PrimaryColor = SDK::FLinearColor(1.f, 0.f, 0.f, 1.f); + } + + SDK::FLinearColor SecondaryColor = SDK::FLinearColor(1.0f, 0.f, 0.f, 1.0f); + if (CurrentPlayer.IsAnyBoneVisible) { + SecondaryColor = SDK::FLinearColor(0.0f, 1.f, 1.f, 1.0f); + } + + if (CurrentPlayer.IsPlayerVisibleOnScreen){ + if (Config::Visuals::Players::Enabled) { + if (Config::Visuals::Players::Skeleton) { + for (const auto& Pair : Features::FortPawnHelper::Bone::SkeletonBonePairs) { + int BoneIDs[2] = { (int)Pair.first, (int)Pair.second }; + SDK::FVector2D ScreenPos[2]; + + bool BoneVisibleToPlayer = false; + + if (Math::IsOnScreen(ScreenPos[0]) == false && Math::IsOnScreen(ScreenPos[1]) == false) { + continue; + } + + for (int i = 0; i <= 1; ++i) { + int BoneID = BoneIDs[i]; + + if (BoneID <= Features::FortPawnHelper::Bone::None || BoneID >= Features::FortPawnHelper::Bone::BONEID_MAX) { + break; + } + + ScreenPos[i] = CurrentPlayer.BonePositions2D[BoneID]; + + if (CurrentPlayer.BoneVisibilityStates[BoneID]) { + BoneVisibleToPlayer = true; + } + } + + Drawing::Line( + SDK::FVector2D(ScreenPos[0].X, ScreenPos[0].Y), + SDK::FVector2D(ScreenPos[1].X, ScreenPos[1].Y), + SecondaryThicknessMultiplier, + Config::Visuals::Players::IndividualBoneVisibilities ? BoneVisibleToPlayer ? SDK::FLinearColor(0.0f, 1.f, 1.f, 1.0f) : SDK::FLinearColor(1.0f, 0.f, 0.f, 1.0f) : SecondaryColor, + false + ); + } + } + + if (Config::Visuals::Players::Box) { + switch (Config::Visuals::Players::BoxType) { + case ConfigTypes::BoxType::Full3D: + // ADD THIS LATER + break; + case ConfigTypes::BoxType::Cornered3D: + // ADD THIS LATER + break; + case ConfigTypes::BoxType::Full2D: + Drawing::Rect(TopLeft, SDK::FVector2D(BottomRight - TopLeft), PrimaryThickness, PrimaryColor, true); + break; + case ConfigTypes::BoxType::Cornered2D: + Drawing::CorneredRect(TopLeft, SDK::FVector2D(BottomRight - TopLeft), PrimaryThickness, PrimaryColor, true); + break; + } + } + + if (Config::Visuals::Players::Name) { + // Text position at the top of the box + SDK::FVector2D PlayerNameTextPos = SDK::FVector2D(TopLeft.X + (BottomRight.X - TopLeft.X) / 2, TopLeft.Y - FontSize - 2); + + Drawing::Text(CurrentPlayer.PlayerName.ToString().c_str(), PlayerNameTextPos, FontSize, PrimaryColor, true, false, true); + } + + if (Config::Visuals::Players::Distance) { + // Text position at the bottom of the box + SDK::FVector2D PlayerDistanceTextPos = SDK::FVector2D(TopLeft.X + (BottomRight.X - TopLeft.X) / 2, BottomRight.Y + 2); + + // Cast to int to remove decimal places + std::string DistanceString = skCrypt("[ ").decrypt() + std::to_string((int)CurrentPlayer.DistanceFromLocalPawn) + skCrypt(" m ]").decrypt(); + Drawing::Text(DistanceString.c_str(), PlayerDistanceTextPos, FontSize, PrimaryColor, true, false, true); + } + + if (Config::Visuals::Players::CurrentWeapon) { + //SDK::AFortWeapon* CurrentWeapon = FortPawn->CurrentWeapon(); + //if (CurrentWeapon) { + // std::string WeaponName = CurrentWeapon->WeaponData()->DisplayName().ToString(); + + // SDK::FVector2D WeaponTextPos = SDK::FVector2D(TopLeft.X + (BottomRight.X - TopLeft.X) / 2, BottomRight.Y); + // WeaponTextPos.Y += Config::Visuals::Players::Distance ? FontSize + 1 : 0; + + // Drawing::Text(WeaponName.c_str(), WeaponTextPos, FontSize, CurrentWeapon->WeaponData()->GetRarityColor(), true, false, true); + //} + } + } + } + } + else if (Config::Visuals::Players::Enabled) { + if (Config::Visuals::Players::OffScreenIndicators::Enabled) { + SDK::FVector2D TipPoint, BasePoint1, BasePoint2; + + // Calculate offscreen indicator triangle points + { + // TO-DO: Cache this so we don't have to get the head pos twice per tick + const SDK::FVector HeadPosition = CurrentPlayer.BonePositions3D[Features::FortPawnHelper::Bone::Head]; + SDK::FVector HeadPosition2D = SDK::Project3D(HeadPosition); + + // Calculate the indicator's position + float Radius = Config::Visuals::Players::OffScreenIndicators::CopyAimbotFOV ? Actors::CurrentFOVSizePixels : Config::Visuals::Players::OffScreenIndicators::FOV * Game::PixelsPerDegree; + SDK::FVector2D DirectionToPlayer = SDK::FVector2D(HeadPosition2D.X - Game::ScreenCenterX, HeadPosition2D.Y - Game::ScreenCenterY); + float Magnitude = std::sqrt(DirectionToPlayer.X * DirectionToPlayer.X + DirectionToPlayer.Y * DirectionToPlayer.Y); + DirectionToPlayer = DirectionToPlayer / Magnitude; + + float Angle = std::atan2(DirectionToPlayer.Y, DirectionToPlayer.X); + SDK::FVector2D IndicatorPosition = { + Game::ScreenCenterX + std::cos(Angle) * Radius, + Game::ScreenCenterY + std::sin(Angle) * Radius + }; + + // Calculate the points for the indicator triangle + TipPoint = IndicatorPosition + DirectionToPlayer * Config::Visuals::Players::OffScreenIndicators::Height; + BasePoint1 = IndicatorPosition + SDK::FVector2D(-DirectionToPlayer.Y, DirectionToPlayer.X) * Config::Visuals::Players::OffScreenIndicators::Width; + BasePoint2 = IndicatorPosition - SDK::FVector2D(-DirectionToPlayer.Y, DirectionToPlayer.X) * Config::Visuals::Players::OffScreenIndicators::Width; + + } + + SDK::FLinearColor IndicatorColor = CurrentPlayer.IsAnyBoneVisible ? SDK::FLinearColor(0.2f, 1.f, 0.2f, 1.f) : SDK::FLinearColor(1.f, 0.2f, 0.2f, 1.f); + Drawing::Triangle(BasePoint1, BasePoint2, TipPoint, 1.f, IndicatorColor, true, true); + } + } + + // Aimbot + if (Config::Aimbot::Enabled && SDK::GetLocalPawn()) { + if ((CurrentPlayer.IsAnyBoneVisible || Config::Aimbot::VisibleCheck == false) && ((MainTarget.LocalInfo.IsTargeting == false || Config::Aimbot::StickyAim == false) || MainTarget.GlobalInfo.TargetActor == nullptr)) { + Features::Aimbot::Target PotentialNewTarget{}; + + Features::Aimbot::PlayerTarget::UpdateTargetInfo(PotentialNewTarget, CurrentPlayer, MainCamera, AimbotCamera); + MainTarget.SetTarget(PotentialNewTarget); + } + + if (MainTarget.GlobalInfo.TargetActor == FortPawn) { + if (CurrentPlayer.IsAnyBoneVisible == false && Config::Aimbot::VisibleCheck == true) { + MainTarget.ResetTarget(); + } + else { + SeenTarget = true; + + Features::Aimbot::PlayerTarget::UpdateTargetInfo(MainTarget, CurrentPlayer, MainCamera, AimbotCamera, FPSScale); + + Features::Aimbot::AimbotTarget(MainTarget); + } + } + } + } + + if (MainTarget.GlobalInfo.Type == Features::Aimbot::Target::TargetType::ClosePlayer + || MainTarget.GlobalInfo.Type == Features::Aimbot::Target::TargetType::FarPlayer) { + MainTarget.TargetTick(SeenTarget); + } +} \ No newline at end of file diff --git a/Fortnite Internal/Game/Actors/Loops/FortPickup.cpp b/Fortnite Internal/Game/Actors/Loops/FortPickup.cpp index 61b8130..1048f62 100644 --- a/Fortnite Internal/Game/Actors/Loops/FortPickup.cpp +++ b/Fortnite Internal/Game/Actors/Loops/FortPickup.cpp @@ -1,323 +1,114 @@ #include "../Actors.h" #include "../../SDK/Classes/Engine_classes.h" - -#include "../../Game.h" +#include "../../SDK/Classes/FortniteGame_classes.h" #include "../../../Drawing/Drawing.h" + #include "../../../Configs/Config.h" -#include "../../Features/FortPawnHelper/Bone.h" -#include "../../Features/FortPawnHelper/FortPawnHelper.h" -#include "../../Features/Aimbot/Aimbot.h" -#include "../../Features/Exploits/Vehicle.h" -#include "../../Features/Exploits/Weapon.h" -#include "../../Features/Exploits/Player.h" - -#include "../../../Utilities/Math.h" -#include "../../../Utilities/Logger.h" #include "../../Input/Input.h" -//int num = 0; +#include "../../../Utilities/Math.h" -void Actors::FortPawn::Tick() { - bool SeenTarget = false; +#include - // move somewhere better later this is gay here - if (SDK::GetLocalPawn() == nullptr) LocalPawnCache.TeamIndex = INT_FAST8_MAX; +void Actors::FortPickup::Tick() { + for (int i = 0; i < CachedWeapons.Num(); i++) { + if (Config::Visuals::Weapons::Enabled) { + if (!CachedWeapons.IsValidIndex(i)) continue; - std::vector CachedPlayersLocal = Actors::FortPawn::CachedPlayers; + SDK::AActor* Actor = CachedWeapons[i]; if (SDK::IsValidPointer(Actor) == false) continue; - for (auto it = CachedPlayersLocal.begin(); it != CachedPlayersLocal.end(); ++it) { - Actors::Caches::FortPawnCache& CurrentPlayer = *it; + SDK::FVector RootPosition = Actor->RootComponent()->RelativeLocation(); + if (RootPosition.Distance(Actors::LocalPawnCache.Position) / 100 > Config::Visuals::Weapons::MaxDistance) { + continue; + } - SDK::AFortPawn* FortPawn = CurrentPlayer.FortPawn; if (SDK::IsValidPointer(FortPawn) == false) continue; - SDK::AFortPlayerState* FortPlayerState = SDK::Cast(FortPawn->PlayerState()); //if (SDK::IsValidPointer(FortPlayerState) == false) continue; - CurrentPlayer.Mesh = FortPawn->Mesh(); if (SDK::IsValidPointer(CurrentPlayer.Mesh) == false) continue; + SDK::FVector2D Project = SDK::Project(RootPosition); + if (Math::IsOnScreen(Project) == false) continue; -#if 0 - int loop = 0; - bool found = false; + SDK::AFortPickup* FortPickup = SDK::Cast(Actor); if (SDK::IsValidPointer(FortPickup) == false) continue; + SDK::FFortItemEntry* FortItemEntry = FortPickup->PrimaryPickupItemEntry(); if (SDK::IsValidPointer(FortItemEntry) == false) continue; + SDK::UFortItemDefinition* FortItemDefinition = FortItemEntry->ItemDefinition(); if (SDK::IsValidPointer(FortItemDefinition) == false) continue; - for (int i = 0; i < SDK::UObject::ObjectArray.Num(); i++) { - SDK::UObject* Object = SDK::UObject::ObjectArray.GetByIndex(i); - if (Object == nullptr) continue; + SDK::FText WeaponName = FortItemDefinition->DisplayName(); - if (Object->IsDefaultObject() == false && Object->IsA(SDK::UMaterialInterface::StaticClass())) { - found = true; + if (WeaponName.Data && WeaponName.Data->Name && WeaponName.Data->Length > 0) { + SDK::EFortItemTier Rarity = FortItemDefinition->Tier(); - loop++; + SDK::FLinearColor WeaponColor = FortItemDefinition->GetRarityColor(); - if (loop < num) { - num++; - continue; - } + Drawing::Text(WeaponName.ToString().c_str(), Project, 16.f, WeaponColor, true, true, true); + } + } + } - DEBUG_LOG(LOG_INFO, std::string(skCrypt("Material: ")) + Object->GetFullName()); + if (Config::Exploits::Pickup::AutoPickup || Input::WasKeyJustPressed((Input::KeyName)Config::Exploits::Pickup::PickupAllKey)) { + std::chrono::steady_clock::time_point CurrentTime = std::chrono::steady_clock::now(); + if (Config::Exploits::Pickup::AutoPickup) { + double ElapsedTime = std::chrono::duration_cast>(CurrentTime - LastAutoPickupTime).count(); - num++; - - SDK::UMaterialInstanceDynamic* MaterialInstanceDynamic = SDK::UKismetMaterialLibrary::StaticClass()->SDK::UKismetMaterialLibrary::CreateDynamicMaterialInstance(SDK::GetWorld(), reinterpret_cast(Object), SDK::FName()); - DEBUG_LOG(LOG_INFO, std::string(skCrypt("Material Made! - ")) + std::to_string((uintptr_t)MaterialInstanceDynamic)); - if (MaterialInstanceDynamic) { - //DEBUG_LOG(LOG_INFO, std::string(skCrypt("Material: ")) + Object->GetFullName()); - //test->SetScalarParameterValue(skCrypt("GlowAmount").decrypt(), 1.f); - - SDK::TArray Materials = CurrentPlayer.Mesh->GetMaterials(); - - for (int i2 = 0; i2 < Materials.Num(); i2++) { - DEBUG_LOG(LOG_INFO, "Num Mats: " + std::to_string(Materials.Num())); - - CurrentPlayer.Mesh->SetMaterial(i2, MaterialInstanceDynamic); - } - - break; - } + if (ElapsedTime < (Config::Exploits::Pickup::AutoPickupDelaySecs)) { + return; } } + LastAutoPickupTime = CurrentTime; - if (found == false) { - num = 0; - } -#endif + struct OrderedWeaponsType { + SDK::AActor* Actor; + float DistanceFromLocal; + }; - // LocalPawn caching and exploit ticks - if (FortPawn == SDK::GetLocalPawn()) { - LocalPawnCache.Position = CurrentPlayer.Mesh->GetBonePosition(Features::FortPawnHelper::Bone::Head); - LocalPawnCache.TeamIndex = CurrentPlayer.TeamIndex; + std::vector OrderedWeapons; + for (int i = 0; i < CachedWeapons.Num(); i++) { + if (!CachedWeapons.IsValidIndex(i)) continue; - Features::Exploits::Vehicle::Tick(SDK::Cast(FortPawn)); - Features::Exploits::Weapon::Tick(FortPawn->CurrentWeapon()); - Features::Exploits::Player::Tick(SDK::Cast(FortPawn), SDK::Cast(SDK::GetLocalController())); + SDK::AActor* Actor = CachedWeapons[i]; if (SDK::IsValidPointer(Actor) == false) continue; - { - //DEBUG_LOG(LOG_INFO, std::string(skCrypt("----------------------------------------------"))); - - //SDK::TArray* InstanceComponents = FortPlayerState->InstanceComponents(); - //SDK::TArray* BlueprintCreatedComponents = FortPlayerState->BlueprintCreatedComponents(); - - //for (int i = 0; i < InstanceComponents->Num(); i++) { - // SDK::UActorComponent* Component = InstanceComponents->GetByIndex(i); - // if (Component == nullptr) continue; - - // DEBUG_LOG(LOG_INFO, std::string(skCrypt("InstanceComponent: ")) + Component->GetFullName()); - //} - - //for (int i = 0; i < BlueprintCreatedComponents->Num(); i++) { - // SDK::UActorComponent* Component = BlueprintCreatedComponents->GetByIndex(i); - // if (Component == nullptr) continue; - - // DEBUG_LOG(LOG_INFO, std::string(skCrypt("BlueprintCreatedComponent: ")) + Component->GetFullName()); - //} - - //DEBUG_LOG(LOG_INFO, std::string(skCrypt("----------------------------------------------"))); + SDK::FVector RootPosition = Actor->RootComponent()->RelativeLocation(); + float DistanceFromLocal = RootPosition.Distance(Actors::LocalPawnCache.Position); + if (DistanceFromLocal / 100 >= Config::Exploits::Pickup::MaxDistance) { + continue; } - continue; + OrderedWeaponsType OrderedWeapon; + OrderedWeapon.Actor = Actor; + OrderedWeapon.DistanceFromLocal = DistanceFromLocal / 100; + + OrderedWeapons.push_back(OrderedWeapon); + } + + if (Config::Exploits::Pickup::PrioritizeFarthestWeapons) { + // Order so that the farthest weapons are first + std::sort(OrderedWeapons.begin(), OrderedWeapons.end(), [](const OrderedWeaponsType& a, const OrderedWeaponsType& b) { + return a.DistanceFromLocal > b.DistanceFromLocal; + }); + } + else { + // Order so that the closest weapons are first + std::sort(OrderedWeapons.begin(), OrderedWeapons.end(), [](const OrderedWeaponsType& a, const OrderedWeaponsType& b) { + return a.DistanceFromLocal < b.DistanceFromLocal; + }); } - // Player state validation - if (CurrentPlayer.TeamIndex == LocalPawnCache.TeamIndex) continue; - if (CurrentPlayer.FortPawn->IsDying()) continue; - if (SDK::Cast(SDK::GetLocalPawn()->PlayerState())->SpectatingTarget() == SDK::Cast(FortPlayerState)) continue; - // Bone positions and visibility caching - // If this returns false, the player isn't on the screen and only 5 of the bones were WorldToScreened - CurrentPlayer.IsBoneRegister2DPopulated = Features::FortPawnHelper::PopulateBones(CurrentPlayer); - Features::FortPawnHelper::PopulateVisibilities(CurrentPlayer); - // Update IsPlayerVisibleOnScreen based on if any of the bones 2D positions are on the screen - CurrentPlayer.IsPlayerVisibleOnScreen = false; - for (int i = 0; i < CurrentPlayer.BonePositions2D.size(); i++) { - if (CurrentPlayer.BonePositions2D[i] == SDK::FVector2D()) continue; + int ItemsPickedUp = 0; - if (Math::IsOnScreen(CurrentPlayer.BonePositions2D[i])) { - CurrentPlayer.IsPlayerVisibleOnScreen = true; - } - } + for (auto OrderedWeapon : OrderedWeapons) { + SDK::AActor* Actor = OrderedWeapon.Actor; if (SDK::IsValidPointer(Actor) == false) continue; + SDK::AFortPickup* FortPickup = reinterpret_cast(Actor); if (SDK::IsValidPointer(FortPickup) == false) continue; - CurrentPlayer.DistanceFromLocalPawn = LocalPawnCache.Position.Distance(CurrentPlayer.BonePositions3D[Features::FortPawnHelper::Bone::Root]) / 100.f; + SDK::Cast(SDK::GetLocalPawn())->ServerHandlePickup(FortPickup, 0.1f, SDK::FVector(), false); - // Hardcoded max distance, should move to bone population for optimisation - if (CurrentPlayer.DistanceFromLocalPawn > 500.f) continue; + ItemsPickedUp++; - // Update any bone visibility - CurrentPlayer.IsAnyBoneVisible = false; - for (int i = 0; i < CurrentPlayer.BoneVisibilityStates.size(); i++) { - if (CurrentPlayer.BoneVisibilityStates[i]) { - CurrentPlayer.IsAnyBoneVisible = true; + if (ItemsPickedUp >= Config::Exploits::Pickup::MaxItems) { break; } } - - // Visuals - if (CurrentPlayer.IsPlayerVisibleOnScreen) { - SDK::FVector2D TopLeft, BottomRight; - Features::FortPawnHelper::PopulateBoundCorners(CurrentPlayer, TopLeft, BottomRight); - - float FontSize = Math::CalculateInterpolatedValue(150.f, CurrentPlayer.DistanceFromLocalPawn, 12.f, 20.f); - float PrimaryThicknessMultiplier = Math::CalculateInterpolatedValue(75.f, CurrentPlayer.DistanceFromLocalPawn, 1.f, 3.f); - float SecondaryThicknessMultiplier = Math::CalculateInterpolatedValue(75.f, CurrentPlayer.DistanceFromLocalPawn, 1.f, 2.f); - - float PrimaryThickness = 1.f * PrimaryThicknessMultiplier; - float SecondaryThickness = 1.f * SecondaryThicknessMultiplier; - - SDK::FLinearColor PrimaryColor = SDK::FLinearColor(1.f, 1.f, 1.f, 1.f); - if (CurrentPlayer.IsAnyBoneVisible) { - PrimaryColor = SDK::FLinearColor(1.f, 0.f, 0.f, 1.f); - } - - SDK::FLinearColor SecondaryColor = SDK::FLinearColor(1.0f, 0.f, 0.f, 1.0f); - if (CurrentPlayer.IsAnyBoneVisible) { - SecondaryColor = SDK::FLinearColor(0.0f, 1.f, 1.f, 1.0f); - } - - if (CurrentPlayer.IsPlayerVisibleOnScreen){ - if (Config::Visuals::Players::Enabled) { - if (Config::Visuals::Players::Skeleton) { - for (const auto& Pair : Features::FortPawnHelper::Bone::SkeletonBonePairs) { - int BoneIDs[2] = { (int)Pair.first, (int)Pair.second }; - SDK::FVector2D ScreenPos[2]; - - bool BoneVisibleToPlayer = false; - - if (Math::IsOnScreen(ScreenPos[0]) == false && Math::IsOnScreen(ScreenPos[1]) == false) { - continue; - } - - for (int i = 0; i <= 1; ++i) { - int BoneID = BoneIDs[i]; - - if (BoneID <= Features::FortPawnHelper::Bone::None || BoneID >= Features::FortPawnHelper::Bone::BONEID_MAX) { - break; - } - - ScreenPos[i] = CurrentPlayer.BonePositions2D[BoneID]; - - if (CurrentPlayer.BoneVisibilityStates[BoneID]) { - BoneVisibleToPlayer = true; - } - } - - Drawing::Line( - SDK::FVector2D(ScreenPos[0].X, ScreenPos[0].Y), - SDK::FVector2D(ScreenPos[1].X, ScreenPos[1].Y), - SecondaryThicknessMultiplier, - Config::Visuals::Players::IndividualBoneVisibilities ? BoneVisibleToPlayer ? SDK::FLinearColor(0.0f, 1.f, 1.f, 1.0f) : SDK::FLinearColor(1.0f, 0.f, 0.f, 1.0f) : SecondaryColor, - false - ); - } - } - - if (Config::Visuals::Players::Box) { - switch (Config::Visuals::Players::BoxType) { - case ConfigTypes::BoxType::Full3D: - // ADD THIS LATER - break; - case ConfigTypes::BoxType::Cornered3D: - // ADD THIS LATER - break; - case ConfigTypes::BoxType::Full2D: - Drawing::Rect(TopLeft, SDK::FVector2D(BottomRight - TopLeft), PrimaryThickness, PrimaryColor, true); - break; - case ConfigTypes::BoxType::Cornered2D: - Drawing::CorneredRect(TopLeft, SDK::FVector2D(BottomRight - TopLeft), PrimaryThickness, PrimaryColor, true); - break; - } - } - - if (Config::Visuals::Players::Name) { - // Text position at the top of the box - SDK::FVector2D PlayerNameTextPos = SDK::FVector2D(TopLeft.X + (BottomRight.X - TopLeft.X) / 2, TopLeft.Y - FontSize - 2); - - Drawing::Text(CurrentPlayer.PlayerName.ToString().c_str(), PlayerNameTextPos, FontSize, PrimaryColor, true, false, true); - } - - if (Config::Visuals::Players::Distance) { - // Text position at the bottom of the box - SDK::FVector2D PlayerDistanceTextPos = SDK::FVector2D(TopLeft.X + (BottomRight.X - TopLeft.X) / 2, BottomRight.Y + 2); - - // Cast to int to remove decimal places - std::string DistanceString = skCrypt("[ ").decrypt() + std::to_string((int)CurrentPlayer.DistanceFromLocalPawn) + skCrypt(" m ]").decrypt(); - Drawing::Text(DistanceString.c_str(), PlayerDistanceTextPos, FontSize, PrimaryColor, true, false, true); - } - - if (Config::Visuals::Players::CurrentWeapon) { - //SDK::AFortWeapon* CurrentWeapon = FortPawn->CurrentWeapon(); - //if (CurrentWeapon) { - // std::string WeaponName = CurrentWeapon->WeaponData()->DisplayName().ToString(); - - // SDK::FVector2D WeaponTextPos = SDK::FVector2D(TopLeft.X + (BottomRight.X - TopLeft.X) / 2, BottomRight.Y); - // WeaponTextPos.Y += Config::Visuals::Players::Distance ? FontSize + 1 : 0; - - // Drawing::Text(WeaponName.c_str(), WeaponTextPos, FontSize, CurrentWeapon->WeaponData()->GetRarityColor(), true, false, true); - //} - } - } - } - } - else if (Config::Visuals::Players::Enabled) { - if (Config::Visuals::Players::OffScreenIndicators::Enabled) { - SDK::FVector2D TipPoint, BasePoint1, BasePoint2; - - // Calculate offscreen indicator triangle points - { - // TO-DO: Cache this so we don't have to get the head pos twice per tick - const SDK::FVector HeadPosition = CurrentPlayer.BonePositions3D[Features::FortPawnHelper::Bone::Head]; - SDK::FVector HeadPosition2D = SDK::Project3D(HeadPosition); - - // Calculate the indicator's position - float Radius = Config::Visuals::Players::OffScreenIndicators::CopyAimbotFOV ? Actors::CurrentFOVSizePixels : Config::Visuals::Players::OffScreenIndicators::FOV * Game::PixelsPerDegree; - SDK::FVector2D DirectionToPlayer = SDK::FVector2D(HeadPosition2D.X - Game::ScreenCenterX, HeadPosition2D.Y - Game::ScreenCenterY); - float Magnitude = std::sqrt(DirectionToPlayer.X * DirectionToPlayer.X + DirectionToPlayer.Y * DirectionToPlayer.Y); - DirectionToPlayer = DirectionToPlayer / Magnitude; - - float Angle = std::atan2(DirectionToPlayer.Y, DirectionToPlayer.X); - SDK::FVector2D IndicatorPosition = { - Game::ScreenCenterX + std::cos(Angle) * Radius, - Game::ScreenCenterY + std::sin(Angle) * Radius - }; - - // Calculate the points for the indicator triangle - TipPoint = IndicatorPosition + DirectionToPlayer * Config::Visuals::Players::OffScreenIndicators::Height; - BasePoint1 = IndicatorPosition + SDK::FVector2D(-DirectionToPlayer.Y, DirectionToPlayer.X) * Config::Visuals::Players::OffScreenIndicators::Width; - BasePoint2 = IndicatorPosition - SDK::FVector2D(-DirectionToPlayer.Y, DirectionToPlayer.X) * Config::Visuals::Players::OffScreenIndicators::Width; - - } - - SDK::FLinearColor IndicatorColor = CurrentPlayer.IsAnyBoneVisible ? SDK::FLinearColor(0.2f, 1.f, 0.2f, 1.f) : SDK::FLinearColor(1.f, 0.2f, 0.2f, 1.f); - Drawing::Triangle(BasePoint1, BasePoint2, TipPoint, 1.f, IndicatorColor, true, true); - } - } - - // Aimbot - if (Config::Aimbot::Enabled && SDK::GetLocalPawn()) { - if ((CurrentPlayer.IsAnyBoneVisible || Config::Aimbot::VisibleCheck == false) && ((MainTarget.LocalInfo.IsTargeting == false || Config::Aimbot::StickyAim == false) || MainTarget.GlobalInfo.TargetActor == nullptr)) { - Features::Aimbot::Target PotentialNewTarget{}; - - Features::Aimbot::PlayerTarget::UpdateTargetInfo(PotentialNewTarget, CurrentPlayer, MainCamera, AimbotCamera); - MainTarget.SetTarget(PotentialNewTarget); - } - - if (MainTarget.GlobalInfo.TargetActor == FortPawn) { - if (CurrentPlayer.IsAnyBoneVisible == false && Config::Aimbot::VisibleCheck == true) { - MainTarget.ResetTarget(); - } - else { - SeenTarget = true; - - Features::Aimbot::PlayerTarget::UpdateTargetInfo(MainTarget, CurrentPlayer, MainCamera, AimbotCamera, FPSScale); - - Features::Aimbot::AimbotTarget(MainTarget); - } - } - } - } - - if (MainTarget.GlobalInfo.Type == Features::Aimbot::Target::TargetType::ClosePlayer - || MainTarget.GlobalInfo.Type == Features::Aimbot::Target::TargetType::FarPlayer) { - MainTarget.TargetTick(SeenTarget); } } \ No newline at end of file diff --git a/Fortnite Internal/Game/Actors/Loops/FortWeapon.cpp b/Fortnite Internal/Game/Actors/Loops/FortWeapon.cpp deleted file mode 100644 index 1048f62..0000000 --- a/Fortnite Internal/Game/Actors/Loops/FortWeapon.cpp +++ /dev/null @@ -1,114 +0,0 @@ -#include "../Actors.h" - -#include "../../SDK/Classes/Engine_classes.h" -#include "../../SDK/Classes/FortniteGame_classes.h" - -#include "../../../Drawing/Drawing.h" - -#include "../../../Configs/Config.h" - -#include "../../Input/Input.h" - -#include "../../../Utilities/Math.h" - -#include - -void Actors::FortPickup::Tick() { - for (int i = 0; i < CachedWeapons.Num(); i++) { - if (Config::Visuals::Weapons::Enabled) { - if (!CachedWeapons.IsValidIndex(i)) continue; - - SDK::AActor* Actor = CachedWeapons[i]; if (SDK::IsValidPointer(Actor) == false) continue; - - SDK::FVector RootPosition = Actor->RootComponent()->RelativeLocation(); - if (RootPosition.Distance(Actors::LocalPawnCache.Position) / 100 > Config::Visuals::Weapons::MaxDistance) { - continue; - } - - SDK::FVector2D Project = SDK::Project(RootPosition); - if (Math::IsOnScreen(Project) == false) continue; - - SDK::AFortPickup* FortPickup = SDK::Cast(Actor); if (SDK::IsValidPointer(FortPickup) == false) continue; - - SDK::FFortItemEntry* FortItemEntry = FortPickup->PrimaryPickupItemEntry(); if (SDK::IsValidPointer(FortItemEntry) == false) continue; - SDK::UFortItemDefinition* FortItemDefinition = FortItemEntry->ItemDefinition(); if (SDK::IsValidPointer(FortItemDefinition) == false) continue; - - SDK::FText WeaponName = FortItemDefinition->DisplayName(); - - if (WeaponName.Data && WeaponName.Data->Name && WeaponName.Data->Length > 0) { - SDK::EFortItemTier Rarity = FortItemDefinition->Tier(); - - SDK::FLinearColor WeaponColor = FortItemDefinition->GetRarityColor(); - - Drawing::Text(WeaponName.ToString().c_str(), Project, 16.f, WeaponColor, true, true, true); - } - } - } - - if (Config::Exploits::Pickup::AutoPickup || Input::WasKeyJustPressed((Input::KeyName)Config::Exploits::Pickup::PickupAllKey)) { - std::chrono::steady_clock::time_point CurrentTime = std::chrono::steady_clock::now(); - if (Config::Exploits::Pickup::AutoPickup) { - double ElapsedTime = std::chrono::duration_cast>(CurrentTime - LastAutoPickupTime).count(); - - if (ElapsedTime < (Config::Exploits::Pickup::AutoPickupDelaySecs)) { - return; - } - } - - LastAutoPickupTime = CurrentTime; - - struct OrderedWeaponsType { - SDK::AActor* Actor; - float DistanceFromLocal; - }; - - std::vector OrderedWeapons; - for (int i = 0; i < CachedWeapons.Num(); i++) { - if (!CachedWeapons.IsValidIndex(i)) continue; - - SDK::AActor* Actor = CachedWeapons[i]; if (SDK::IsValidPointer(Actor) == false) continue; - - SDK::FVector RootPosition = Actor->RootComponent()->RelativeLocation(); - float DistanceFromLocal = RootPosition.Distance(Actors::LocalPawnCache.Position); - if (DistanceFromLocal / 100 >= Config::Exploits::Pickup::MaxDistance) { - continue; - } - - OrderedWeaponsType OrderedWeapon; - OrderedWeapon.Actor = Actor; - OrderedWeapon.DistanceFromLocal = DistanceFromLocal / 100; - - OrderedWeapons.push_back(OrderedWeapon); - } - - if (Config::Exploits::Pickup::PrioritizeFarthestWeapons) { - // Order so that the farthest weapons are first - std::sort(OrderedWeapons.begin(), OrderedWeapons.end(), [](const OrderedWeaponsType& a, const OrderedWeaponsType& b) { - return a.DistanceFromLocal > b.DistanceFromLocal; - }); - } - else { - // Order so that the closest weapons are first - std::sort(OrderedWeapons.begin(), OrderedWeapons.end(), [](const OrderedWeaponsType& a, const OrderedWeaponsType& b) { - return a.DistanceFromLocal < b.DistanceFromLocal; - }); - } - - - - int ItemsPickedUp = 0; - - for (auto OrderedWeapon : OrderedWeapons) { - SDK::AActor* Actor = OrderedWeapon.Actor; if (SDK::IsValidPointer(Actor) == false) continue; - SDK::AFortPickup* FortPickup = reinterpret_cast(Actor); if (SDK::IsValidPointer(FortPickup) == false) continue; - - SDK::Cast(SDK::GetLocalPawn())->ServerHandlePickup(FortPickup, 0.1f, SDK::FVector(), false); - - ItemsPickedUp++; - - if (ItemsPickedUp >= Config::Exploits::Pickup::MaxItems) { - break; - } - } - } -} \ No newline at end of file diff --git a/Fortnite Internal/Game/Features/Exploits/Vehicle.cpp b/Fortnite Internal/Game/Features/Exploits/Vehicle.cpp index 176de5d..a4afe0a 100644 --- a/Fortnite Internal/Game/Features/Exploits/Vehicle.cpp +++ b/Fortnite Internal/Game/Features/Exploits/Vehicle.cpp @@ -17,14 +17,14 @@ void Features::Exploits::Vehicle::Tick(SDK::AFortPlayerPawnAthena* FortPawn) { if (Config::Exploits::Vehicle::InfiniteBoost) { if (Vehicle->IsA(SDK::AFortAthenaAntelopeVehicle::StaticClass())) { - SDK::AFortAthenaAntelopeVehicle* Antelope = SDK::Cast(Vehicle); + SDK::AFortAthenaAntelopeVehicle* Antelope = SDK::Cast(Vehicle); Antelope->FortAntelopeVehicleConfigs()->SetBoostAccumulationRate(FLT_MAX, &Config::Exploits::Vehicle::InfiniteBoost); Antelope->FortAntelopeVehicleConfigs()->SetBoostExpenseRate(0.f, &Config::Exploits::Vehicle::InfiniteBoost); } if (Vehicle->IsA(SDK::AFortAthenaJackalVehicle::StaticClass())) { - SDK::AFortAthenaJackalVehicle* Jackal = SDK::Cast(Vehicle); + SDK::AFortAthenaJackalVehicle* Jackal = SDK::Cast(Vehicle); for (int i = 0; i < Jackal->BoostTimers().Num(); i++) { Jackal->BoostTimers()[i].SetCharge(1.0f); @@ -32,7 +32,7 @@ void Features::Exploits::Vehicle::Tick(SDK::AFortPlayerPawnAthena* FortPawn) { } if (Vehicle->IsA(SDK::AFortAthenaDoghouseVehicle::StaticClass())) { - SDK::AFortAthenaDoghouseVehicle* Doghouse = SDK::Cast(Vehicle); + SDK::AFortAthenaDoghouseVehicle* Doghouse = SDK::Cast(Vehicle); Doghouse->BoostAction()->SetCharge(1.0f); } diff --git a/Fortnite Internal/Game/Game.cpp b/Fortnite Internal/Game/Game.cpp index 985a6a7..dd5e91a 100644 --- a/Fortnite Internal/Game/Game.cpp +++ b/Fortnite Internal/Game/Game.cpp @@ -247,6 +247,16 @@ void Game::MenuCallback() { ImGui::Checkbox(skCrypt("Player ESP"), &Config::Visuals::Players::Enabled); if (Config::Visuals::Players::Enabled) { + ImGui::Checkbox(skCrypt("Chams"), &Config::Visuals::Players::Chams); + if (Config::Visuals::Players::Chams) { + ImGui::Checkbox(skCrypt("Self Chams"), &Config::Visuals::Players::SelfChams); + ImGui::Checkbox(skCrypt("Wireframe"), &Config::Visuals::Players::Wireframe); + ImGui::Checkbox(skCrypt("Glow"), &Config::Visuals::Players::Glow); + if (Config::Visuals::Players::Glow) { + ImGui::SliderFloat(skCrypt("Glow Amount"), &Config::Visuals::Players::GlowAmount, 0.f, 10000.f); + } + } + ImGui::Checkbox(skCrypt("Box"), &Config::Visuals::Players::Box); if (Config::Visuals::Players::Box) { diff --git a/Fortnite Internal/Game/SDK/Classes/Engine_Functions.cpp b/Fortnite Internal/Game/SDK/Classes/Engine_Functions.cpp index 4692ddc..a7bc742 100644 --- a/Fortnite Internal/Game/SDK/Classes/Engine_Functions.cpp +++ b/Fortnite Internal/Game/SDK/Classes/Engine_Functions.cpp @@ -184,6 +184,15 @@ SDK::UPawnMovementComponent* SDK::APawn::GetMovementComponent() { return params_GetMovementComponent.return_value; } +SDK::UClass* SDK::USkeletalMeshComponentBudgeted::StaticClass() { + static class UClass* Clss = nullptr; + + if (!Clss) + Clss = UObject::FindClassFast(std::string(skCrypt("SkeletalMeshComponentBudgeted"))); + + return Clss; +} + SDK::FString SDK::APlayerState::GetPlayerName() { if (SDK::IsValidPointer(this) == false) return FString{}; @@ -423,21 +432,43 @@ SDK::UClass* SDK::UKismetSystemLibrary::StaticClass() { } SDK::UMaterialInstanceDynamic* SDK::UKismetMaterialLibrary::CreateDynamicMaterialInstance(class UObject* WorldContextObject, class UMaterialInterface* Parent, class FName OptionalName) { - struct { - class UObject* WorldContextObject; - class UMaterialInterface* Parent; - class FName OptionalName; - - class UMaterialInstanceDynamic* return_value; - } params_CreateDynamicMaterialInstance{}; + if (SDK::GetGameVersion() >= 12.00) { + struct { + class UObject* WorldContextObject; + class UMaterialInterface* Parent; + /*enum class EMIDCreationFlags*/ uint8 CreationFlags; + uint8 Pad_186A[0x7]; + class FName OptionalName; - params_CreateDynamicMaterialInstance.WorldContextObject = WorldContextObject; - params_CreateDynamicMaterialInstance.Parent = Parent; - params_CreateDynamicMaterialInstance.OptionalName = OptionalName; + class UMaterialInstanceDynamic* return_value; + } params_CreateDynamicMaterialInstance{}; - StaticClass()->ProcessEvent(SDK::Cached::Functions::KismetMaterialLibrary::CreateDynamicMaterialInstance, ¶ms_CreateDynamicMaterialInstance); + params_CreateDynamicMaterialInstance.WorldContextObject = WorldContextObject; + params_CreateDynamicMaterialInstance.Parent = Parent; + params_CreateDynamicMaterialInstance.CreationFlags = /*EMIDCreationFlags::None*/ 0; + params_CreateDynamicMaterialInstance.OptionalName = OptionalName; - return params_CreateDynamicMaterialInstance.return_value; + StaticClass()->ProcessEvent(SDK::Cached::Functions::KismetMaterialLibrary::CreateDynamicMaterialInstance, ¶ms_CreateDynamicMaterialInstance); + + return params_CreateDynamicMaterialInstance.return_value; + } + else { + struct { + class UObject* WorldContextObject; + class UMaterialInterface* Parent; + class FName OptionalName; + + class UMaterialInstanceDynamic* return_value; + } params_CreateDynamicMaterialInstance{}; + + params_CreateDynamicMaterialInstance.WorldContextObject = WorldContextObject; + params_CreateDynamicMaterialInstance.Parent = Parent; + params_CreateDynamicMaterialInstance.OptionalName = OptionalName; + + StaticClass()->ProcessEvent(SDK::Cached::Functions::KismetMaterialLibrary::CreateDynamicMaterialInstance, ¶ms_CreateDynamicMaterialInstance); + + return params_CreateDynamicMaterialInstance.return_value; + } } SDK::UClass* SDK::UKismetMaterialLibrary::StaticClass() { static class UClass* Clss = nullptr; @@ -681,6 +712,34 @@ SDK::UClass* SDK::UMaterialInterface::StaticClass() { return Clss; } +void SDK::UMaterialInstanceDynamic::SetVectorParameterValue(FName ParameterName, FLinearColor Value) { + if (SDK::IsValidPointer(this) == false) return; + + struct { + FName ParameterName; + FLinearColor Value; + } params_SetVectorParameterValue{}; + + params_SetVectorParameterValue.ParameterName = ParameterName; + params_SetVectorParameterValue.Value = Value; + + this->ProcessEvent(SDK::Cached::Functions::MaterialInstanceDynamic::SetVectorParameterValue, ¶ms_SetVectorParameterValue); +} + +void SDK::UMaterialInstanceDynamic::SetScalarParameterValue(FName ParameterName, float Value) { + if (SDK::IsValidPointer(this) == false) return; + + struct { + FName ParameterName; + float Value; + } params_SetScalarParameterValue{}; + + params_SetScalarParameterValue.ParameterName = ParameterName; + params_SetScalarParameterValue.Value = Value; + + this->ProcessEvent(SDK::Cached::Functions::MaterialInstanceDynamic::SetScalarParameterValue, ¶ms_SetScalarParameterValue); +} + // Wrapper Functions @@ -689,6 +748,24 @@ SDK::FVector SDK::USkeletalMeshComponent::GetBonePosition(uint8_t BoneID) { return GetSocketLocation(Features::FortPawnHelper::Bone::GetBoneName(BoneID)); } +SDK::UMaterial* SDK::GetChamsMaterial() { + static UMaterial* ChamsMaterial = nullptr; + + if (!ChamsMaterial) + ChamsMaterial = UObject::FindObject(std::string(skCrypt("Material CharacterShield_DimMak.CharacterShield_DimMak"))); + + return ChamsMaterial; +} + +SDK::UMaterialInstanceDynamic* SDK::GetChamsMaterialDynamic() { + static UMaterialInstanceDynamic* ChamsMaterialInstance = nullptr; + + if (!ChamsMaterialInstance) + ChamsMaterialInstance = UKismetMaterialLibrary::CreateDynamicMaterialInstance(GetLocalCanvas(), GetChamsMaterial(), FName()); + + return ChamsMaterialInstance; +} + SDK::FVector2D SDK::Project(FVector WorldLocation) { SDK::FVector ScreenLocation = SDK::GetLocalCanvas()->K2_Project(WorldLocation); diff --git a/Fortnite Internal/Game/SDK/Classes/Engine_classes.h b/Fortnite Internal/Game/SDK/Classes/Engine_classes.h index 6030fff..eeaef27 100644 --- a/Fortnite Internal/Game/SDK/Classes/Engine_classes.h +++ b/Fortnite Internal/Game/SDK/Classes/Engine_classes.h @@ -4,6 +4,8 @@ #include "CoreUObject_Classes.h" +#include "../../Features/Features.h" + typedef __int8 int8; typedef __int16 int16; typedef __int32 int32; @@ -17,19 +19,73 @@ typedef unsigned __int64 uint64; namespace SDK { // Classes - class UMaterial : public UObject { - public: - - }; class UMaterialInterface : public UObject { public: // STATIC FUNCTIONS static UClass* StaticClass(); }; + class UMaterial : public UMaterialInterface { + public: + // VALUES + + void SetbDisableDepthTest(bool NewValue, bool* AutoRevertFeature = nullptr) { + if (SDK::IsValidPointer(this) == false || (SDK::Cached::Offsets::Material::bDisableDepthTest == -0x1 && SDK::Cached::Masks::Material::bDisableDepthTest == -0x1)) return; + + if (SDK::Cached::Masks::Material::bDisableDepthTest != -0x1) { + if (AutoRevertFeature) { + Features::CreateAutoRevertBitFeature(((uint8_t*)(uintptr_t)this + SDK::Cached::Offsets::Material::bDisableDepthTest), SDK::Cached::Masks::Material::bDisableDepthTest, AutoRevertFeature); + } + + uint8* BitField = (uint8*)((uintptr_t)this + SDK::Cached::Offsets::Material::bDisableDepthTest); + *BitField = NewValue ? *BitField | SDK::Cached::Masks::Material::bDisableDepthTest : *BitField & ~SDK::Cached::Masks::Material::bDisableDepthTest; + } + else { + if (AutoRevertFeature) { + Features::CreateAutoRevertFeature((bool*)((uintptr_t)this + SDK::Cached::Offsets::Material::bDisableDepthTest), AutoRevertFeature); + } + + *(bool*)((uintptr_t)this + SDK::Cached::Offsets::Material::bDisableDepthTest) = NewValue; + } + } + + void SetBlendMode(EBlendMode NewValue, bool* AutoRevertFeature = nullptr) { + if (SDK::IsValidPointer(this) == false || SDK::Cached::Offsets::Material::BlendMode == -0x1) return; + + if (AutoRevertFeature) { + Features::CreateAutoRevertFeature((bool*)((uintptr_t)this + SDK::Cached::Offsets::Material::BlendMode), AutoRevertFeature); + } + + *(EBlendMode*)((uintptr_t)this + SDK::Cached::Offsets::Material::BlendMode) = NewValue; + } + + void SetWireFrame(bool NewValue, bool* AutoRevertFeature = nullptr) { + if (SDK::IsValidPointer(this) == false || (SDK::Cached::Offsets::Material::Wireframe == -0x1 && SDK::Cached::Masks::Material::Wireframe == -0x1)) return; + + if (SDK::Cached::Masks::Material::Wireframe != -0x1) { + if (AutoRevertFeature) { + Features::CreateAutoRevertBitFeature(((uint8_t*)(uintptr_t)this + SDK::Cached::Offsets::Material::Wireframe), SDK::Cached::Masks::Material::Wireframe, AutoRevertFeature); + } + + uint8* BitField = (uint8*)((uintptr_t)this + SDK::Cached::Offsets::Material::Wireframe); + *BitField = NewValue ? *BitField | SDK::Cached::Masks::Material::Wireframe : *BitField & ~SDK::Cached::Masks::Material::Wireframe; + } + else { + if (AutoRevertFeature) { + Features::CreateAutoRevertFeature((bool*)((uintptr_t)this + SDK::Cached::Offsets::Material::Wireframe), AutoRevertFeature); + } + + *(bool*)((uintptr_t)this + SDK::Cached::Offsets::Material::Wireframe) = NewValue; + } + } + }; class UMaterialInstanceDynamic : public UMaterialInterface { public: + // FUNCTIONS + void SetVectorParameterValue(FName ParameterName, FLinearColor Value); + + void SetScalarParameterValue(FName ParameterName, float Value); }; class UActorComponent : public UObject { public: @@ -121,6 +177,13 @@ namespace SDK { FVector GetBonePosition(uint8_t BoneID); }; + class USkeletalMeshComponentBudgeted : public USkeletalMeshComponent + { + public: + // STATIC FUNCTIONS + + static UClass* StaticClass(); + }; class APlayerState : public AActor { public: // FUNCTIONS @@ -391,6 +454,18 @@ namespace SDK { // Wrapper Functions + /* + * @brief Gets the UMaterial used for chams + * + * @return The UMaterial used for chams + */ + UMaterial* GetChamsMaterial(); + /* + * @brief Gets the UMaterialInstanceDynamic used for chams + * + * @return The UMaterialInstanceDynamic used for chams + */ + UMaterialInstanceDynamic* GetChamsMaterialDynamic(); /* * @brief Wrapper for K2_Project * diff --git a/Fortnite Internal/Game/SDK/Classes/Engine_structs.h b/Fortnite Internal/Game/SDK/Classes/Engine_structs.h index a77b5f4..99be66b 100644 --- a/Fortnite Internal/Game/SDK/Classes/Engine_structs.h +++ b/Fortnite Internal/Game/SDK/Classes/Engine_structs.h @@ -158,6 +158,24 @@ namespace SDK { eSSP_RIGHT_EYE_SIDE, }; + enum class EBlendMode : uint8 + { + BLEND_Opaque = 0, + BLEND_Masked = 1, + BLEND_Translucent = 2, + BLEND_Additive = 3, + BLEND_Modulate = 4, + BLEND_AlphaComposite = 5, + BLEND_MAX = 6, + }; + + //enum class EMIDCreationFlags : uint8 + //{ + // None = 0, + // Transient = 1, + // EMIDCreationFlags_MAX = 2, + //}; + struct FKey { public: diff --git a/Fortnite Internal/Game/SDK/Classes/FortniteGame_Classes.h b/Fortnite Internal/Game/SDK/Classes/FortniteGame_Classes.h index 5c3d1ca..2b720bf 100644 --- a/Fortnite Internal/Game/SDK/Classes/FortniteGame_Classes.h +++ b/Fortnite Internal/Game/SDK/Classes/FortniteGame_Classes.h @@ -256,7 +256,7 @@ namespace SDK { bool IsDying() { if (SDK::IsValidPointer(this) == false || (SDK::Cached::Offsets::FortPawn::bIsDying == -0x1 && SDK::Cached::Masks::FortPawn::bIsDying == -0x1)) return false; - if (SDK::Cached::Masks::FortPawn::bIsDying) { + if (SDK::Cached::Masks::FortPawn::bIsDying != -0x1) { uint8 BitField = *(uint8*)((uintptr_t)this + SDK::Cached::Offsets::FortPawn::bIsDying); return BitField & SDK::Cached::Masks::FortPawn::bIsDying; } @@ -296,6 +296,8 @@ namespace SDK { // CUSTOM FUNCTIONS AFortAthenaVehicle* GetVehicle(); + + std::vector GetCharacterPartSkeletalMeshComponents(); }; class AFortPlayerPawnAthena : public AFortPlayerPawn { public: @@ -370,7 +372,7 @@ namespace SDK { bool bHit() { if (SDK::IsValidPointer(this) == false || (SDK::Cached::Offsets::BuildingWeakSpot::bHit == -0x1 && SDK::Cached::Masks::BuildingWeakSpot::bHit == -0x1)) return false; - if (SDK::Cached::Masks::BuildingWeakSpot::bHit) { + if (SDK::Cached::Masks::BuildingWeakSpot::bHit != -0x1) { uint8 BitField = *(uint8*)((uintptr_t)this + SDK::Cached::Offsets::BuildingWeakSpot::bHit); return BitField & SDK::Cached::Masks::BuildingWeakSpot::bHit; } @@ -382,7 +384,7 @@ namespace SDK { bool bFadeOut() { if (SDK::IsValidPointer(this) == false || (SDK::Cached::Offsets::BuildingWeakSpot::bFadeOut == -0x1 && SDK::Cached::Masks::BuildingWeakSpot::bFadeOut == -0x1)) return false; - if (SDK::Cached::Masks::BuildingWeakSpot::bFadeOut) { + if (SDK::Cached::Masks::BuildingWeakSpot::bFadeOut != -0x1) { uint8 BitField = *(uint8*)((uintptr_t)this + SDK::Cached::Offsets::BuildingWeakSpot::bFadeOut); return BitField & SDK::Cached::Masks::BuildingWeakSpot::bFadeOut; } @@ -394,7 +396,7 @@ namespace SDK { bool bActive() { if (SDK::IsValidPointer(this) == false || (SDK::Cached::Offsets::BuildingWeakSpot::bActive == -0x1 && SDK::Cached::Masks::BuildingWeakSpot::bActive == -0x1)) return false; - if (SDK::Cached::Masks::BuildingWeakSpot::bActive) { + if (SDK::Cached::Masks::BuildingWeakSpot::bActive != -0x1) { uint8 BitField = *(uint8*)((uintptr_t)this + SDK::Cached::Offsets::BuildingWeakSpot::bActive); return BitField & SDK::Cached::Masks::BuildingWeakSpot::bActive; } diff --git a/Fortnite Internal/Game/SDK/Classes/FortniteGame_Functions.cpp b/Fortnite Internal/Game/SDK/Classes/FortniteGame_Functions.cpp index 924e0a6..afed9f6 100644 --- a/Fortnite Internal/Game/SDK/Classes/FortniteGame_Functions.cpp +++ b/Fortnite Internal/Game/SDK/Classes/FortniteGame_Functions.cpp @@ -1,4 +1,5 @@ #include "FortniteGame_Classes.h" +#include "../../../Utilities/Logger.h" SDK::UClass* SDK::AFortAthenaVehicle::StaticClass() { static class UClass* Clss = nullptr; @@ -209,6 +210,22 @@ SDK::AFortAthenaVehicle* SDK::AFortPlayerPawn::GetVehicle() { return VehicleStateLocal()->Vehicle(); } +std::vector SDK::AFortPlayerPawn::GetCharacterPartSkeletalMeshComponents() { + std::vector Components; + + if (SDK::IsValidPointer(this) == false || SDK::Cached::Offsets::FortPlayerPawn::CharacterPartSkeletalMeshComponents == -0x1) return Components; + + // There should never be more than 8 character parts + for (int i = 0; i < 8; i++) { + USkeletalMeshComponentBudgeted* Mesh = *(USkeletalMeshComponentBudgeted**)((uintptr_t)this + SDK::Cached::Offsets::FortPlayerPawn::CharacterPartSkeletalMeshComponents + (i * 8)); + if (SDK::IsValidPointer(Mesh) == false || Mesh->IsA(USkeletalMeshComponentBudgeted::StaticClass()) == false) continue; + + Components.push_back(Mesh); + } + + return Components; +} + SDK::UClass* SDK::AFortPlayerPawnAthena::StaticClass() { static class UClass* Clss = nullptr; diff --git a/Fortnite Internal/Game/SDK/SDK.cpp b/Fortnite Internal/Game/SDK/SDK.cpp index 1c6bcf5..5e49c0e 100644 --- a/Fortnite Internal/Game/SDK/SDK.cpp +++ b/Fortnite Internal/Game/SDK/SDK.cpp @@ -114,6 +114,8 @@ void SDK::Init() { FunctionSearch { std::string(skCrypt("FortPlayerPawn")), std::string(skCrypt("ServerHandlePickup")), &SDK::Cached::Functions::FortPlayerPawn::ServerHandlePickup }, FunctionSearch { std::string(skCrypt("MeshComponent")), std::string(skCrypt("GetMaterials")), &SDK::Cached::Functions::MeshComponent::GetMaterials }, FunctionSearch { std::string(skCrypt("PrimitiveComponent")), std::string(skCrypt("SetMaterial")), &SDK::Cached::Functions::PrimitiveComponent::SetMaterial }, + FunctionSearch { std::string(skCrypt("MaterialInstanceDynamic")),std::string(skCrypt("SetVectorParameterValue")), &SDK::Cached::Functions::MaterialInstanceDynamic::SetVectorParameterValue}, + FunctionSearch { std::string(skCrypt("MaterialInstanceDynamic")),std::string(skCrypt("SetScalarParameterValue")), &SDK::Cached::Functions::MaterialInstanceDynamic::SetScalarParameterValue}, }; std::vector Offsets{ @@ -131,6 +133,10 @@ void SDK::Init() { OffsetSearch { std::string(skCrypt("Character")), std::string(skCrypt("Mesh")), &SDK::Cached::Offsets::Character::Mesh, nullptr }, OffsetSearch { std::string(skCrypt("Font")), std::string(skCrypt("LegacyFontSize")), &SDK::Cached::Offsets::Font::LegacyFontSize, nullptr }, + OffsetSearch { std::string(skCrypt("Material")), std::string(skCrypt("bDisableDepthTest")), &SDK::Cached::Offsets::Material::bDisableDepthTest, &SDK::Cached::Masks::Material::bDisableDepthTest }, + OffsetSearch { std::string(skCrypt("Material")), std::string(skCrypt("BlendMode")), &SDK::Cached::Offsets::Material::BlendMode, nullptr }, + OffsetSearch { std::string(skCrypt("Material")), std::string(skCrypt("Wireframe")), &SDK::Cached::Offsets::Material::Wireframe, &SDK::Cached::Masks::Material::Wireframe }, + OffsetSearch { std::string(skCrypt("HitResult")), std::string(skCrypt("TraceStart")), &SDK::Cached::Offsets::HitResult::TraceStart, nullptr }, OffsetSearch { std::string(skCrypt("HitResult")), std::string(skCrypt("Distance")), &SDK::Cached::Offsets::HitResult::Distance, nullptr }, @@ -150,6 +156,7 @@ void SDK::Init() { OffsetSearch { std::string(skCrypt("FortPawn")), std::string(skCrypt("CurrentWeapon")), &SDK::Cached::Offsets::FortPawn::CurrentWeapon, nullptr }, OffsetSearch { std::string(skCrypt("FortPawn")), std::string(skCrypt("bIsDying")), &SDK::Cached::Offsets::FortPawn::bIsDying, &SDK::Cached::Masks::FortPawn::bIsDying }, OffsetSearch { std::string(skCrypt("FortPlayerPawn")), std::string(skCrypt("VehicleStateLocal")), &SDK::Cached::Offsets::FortPlayerPawn::VehicleStateLocal, nullptr }, + OffsetSearch { std::string(skCrypt("FortPlayerPawn")), std::string(skCrypt("CharacterPartSkeletalMeshComponents")),&SDK::Cached::Offsets::FortPlayerPawn::CharacterPartSkeletalMeshComponents,nullptr }, OffsetSearch { std::string(skCrypt("FortPlayerPawnAthena")), std::string(skCrypt("bADSWhileNotOnGround")), &SDK::Cached::Offsets::FortPlayerPawnAthena::bADSWhileNotOnGround,nullptr }, OffsetSearch { std::string(skCrypt("FortWeapon")), std::string(skCrypt("WeaponData")), &SDK::Cached::Offsets::FortWeapon::WeaponData, nullptr }, OffsetSearch { std::string(skCrypt("FortWeapon")), std::string(skCrypt("LastFireTime")), &SDK::Cached::Offsets::FortWeapon::LastFireTime, nullptr }, diff --git a/Fortnite Internal/Game/SDK/SDK.h b/Fortnite Internal/Game/SDK/SDK.h index cadf49d..368e764 100644 --- a/Fortnite Internal/Game/SDK/SDK.h +++ b/Fortnite Internal/Game/SDK/SDK.h @@ -31,6 +31,12 @@ namespace SDK { inline uintptr_t PlayerState = -0x1; } + namespace Material{ + inline uintptr_t bDisableDepthTest = -0x1; + inline uintptr_t BlendMode = -0x1; + inline uintptr_t Wireframe = -0x1; + } + namespace FortPawn { inline uintptr_t bIsDying = -0x1; inline uintptr_t CurrentWeapon = -0x1; @@ -39,6 +45,7 @@ namespace SDK { namespace FortPlayerPawn { inline uintptr_t VehicleStateLocal = -0x1; inline uintptr_t ZiplineState = -0x1; + inline uintptr_t CharacterPartSkeletalMeshComponents = -0x1; } namespace FortPlayerPawnAthena { @@ -249,6 +256,11 @@ namespace SDK { inline void* CreateDynamicMaterialInstance = nullptr; } + namespace MaterialInstanceDynamic { + inline void* SetVectorParameterValue = nullptr; + inline void* SetScalarParameterValue = nullptr; + } + namespace KismetMathLibrary { inline void* FindLookAtRotation = nullptr; inline void* GetForwardVector = nullptr; @@ -319,6 +331,11 @@ namespace SDK { inline uintptr_t bFadeOut = -0x1; inline uintptr_t bActive = -0x1; } + + namespace Material { + inline uintptr_t bDisableDepthTest = -0x1; + inline uintptr_t Wireframe = -0x1; + } } }