Files
Project-Reboot-3.0/Project Reboot 3.0/FortPlayerControllerAthena.h
Milxnor 6daab8d5a2 a bit
fix restarting, add cheat teleport and help, build free and infinite ammo, fix restarting on c1,  fix some gui issues.
2023-04-17 21:05:08 -04:00

108 lines
3.9 KiB
C++

#pragma once
#include "FortPlayerController.h"
#include "FortPlayerStateAthena.h"
#include "FortPlayerPawn.h"
#include "SoftObjectPtr.h"
#include "FortKismetLibrary.h"
#include "AthenaMarkerComponent.h"
#include "FortVolume.h"
static void ApplyCID(AFortPlayerPawn* Pawn, UObject* CID, bool bUseServerChoosePart = false)
{
if (!CID)
return;
if (!Pawn && bUseServerChoosePart)
return;
static auto HeroDefinitionOffset = CID->GetOffset("HeroDefinition");
auto HeroDefinition = CID->Get(HeroDefinitionOffset);
using UFortHeroSpecialization = UObject;
static auto SpecializationsOffset = HeroDefinition->GetOffset("Specializations");
auto& Specializations = HeroDefinition->Get<TArray<TSoftObjectPtr<UFortHeroSpecialization>>>(SpecializationsOffset);
auto PlayerState = Pawn->GetPlayerState();
for (int i = 0; i < Specializations.Num(); i++)
{
auto& SpecializationSoft = Specializations.at(i);
static auto FortHeroSpecializationClass = FindObject<UClass>("/Script/FortniteGame.FortHeroSpecialization");
auto Specialization = SpecializationSoft.Get(FortHeroSpecializationClass, true);
if (Specialization)
{
static auto Specialization_CharacterPartsOffset = Specialization->GetOffset("CharacterParts");
auto& CharacterParts = Specialization->Get<TArray<TSoftObjectPtr<UObject>>>(Specialization_CharacterPartsOffset);
static auto CustomCharacterPartClass = FindObject<UClass>("/Script/FortniteGame.CustomCharacterPart");
/* if (bUseServerChoosePart)
{
for (int z = 0; z < CharacterParts.Num(); z++)
{
Pawn->ServerChoosePart((EFortCustomPartType)z, CharacterParts.at(z).Get(CustomCharacterPartClass, true));
}
continue; // hm?
} */
bool aa;
TArray<UObject*> CharacterPartsaa;
for (int z = 0; z < CharacterParts.Num(); z++)
{
auto& CharacterPartSoft = CharacterParts.at(z);
auto CharacterPart = CharacterPartSoft.Get(CustomCharacterPartClass, true);
CharacterPartsaa.Add(CharacterPart);
continue;
}
UFortKismetLibrary::ApplyCharacterCosmetics(GetWorld(), CharacterPartsaa, PlayerState, &aa);
CharacterPartsaa.Free();
}
}
static auto HeroTypeOffset = PlayerState->GetOffset("HeroType");
// PlayerState->Get(HeroTypeOffset) = HeroDefinition;
}
class AFortPlayerControllerAthena : public AFortPlayerController
{
public:
static inline void (*GetPlayerViewPointOriginal)(AFortPlayerControllerAthena* PlayerController, FVector& Location, FRotator& Rotation);
static inline void (*ServerReadyToStartMatchOriginal)(AFortPlayerControllerAthena* PlayerController);
static inline void (*ServerRequestSeatChangeOriginal)(AFortPlayerControllerAthena* PlayerController, int TargetSeatIndex);
AFortPlayerStateAthena* GetPlayerStateAthena()
{
return (AFortPlayerStateAthena*)GetPlayerState();
}
UAthenaMarkerComponent* GetMarkerComponent()
{
static auto MarkerComponentOffset = GetOffset("MarkerComponent");
return Get<UAthenaMarkerComponent*>(MarkerComponentOffset);
}
static void ServerRequestSeatChangeHook(AFortPlayerControllerAthena* PlayerController, int TargetSeatIndex); // actually in zone
static void ServerRestartPlayerHook(AFortPlayerControllerAthena* Controller);
static void ServerGiveCreativeItemHook(AFortPlayerControllerAthena* Controller, FFortItemEntry CreativeItem);
static void ServerTeleportToPlaygroundLobbyIslandHook(AFortPlayerControllerAthena* Controller);
static void ServerAcknowledgePossessionHook(APlayerController* Controller, APawn* Pawn);
static void ServerPlaySquadQuickChatMessageHook(AFortPlayerControllerAthena* PlayerController, __int64 ChatEntry, __int64 SenderID);
static void GetPlayerViewPointHook(AFortPlayerControllerAthena* PlayerController, FVector& Location, FRotator& Rotation);
static void ServerReadyToStartMatchHook(AFortPlayerControllerAthena* PlayerController);
static UClass* StaticClass()
{
static auto Class = FindObject<UClass>("/Script/FortniteGame.FortPlayerControllerAthena");
return Class;
}
};