mirror of
https://github.com/Milxnor/Project-Reboot-3.0.git
synced 2026-01-13 02:42:22 +01:00
Edit Bug fix + cheat ckd thingf
This commit is contained in:
@@ -50,9 +50,11 @@ public:
|
|||||||
|
|
||||||
void SetEditingPlayer(APlayerState* NewEditingPlayer) // actually AFortPlayerStateZone
|
void SetEditingPlayer(APlayerState* NewEditingPlayer) // actually AFortPlayerStateZone
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
if (// AActor::HasAuthority() &&
|
if (// AActor::HasAuthority() &&
|
||||||
(!GetEditingPlayer() || !NewEditingPlayer)
|
(!GetEditingPlayer() || !NewEditingPlayer)
|
||||||
)
|
)
|
||||||
|
*/
|
||||||
{
|
{
|
||||||
SetNetDormancy((ENetDormancy)(2 - (NewEditingPlayer != 0)));
|
SetNetDormancy((ENetDormancy)(2 - (NewEditingPlayer != 0)));
|
||||||
ForceNetUpdate();
|
ForceNetUpdate();
|
||||||
|
|||||||
@@ -1681,6 +1681,8 @@ void AFortPlayerController::ClientOnPawnDiedHook(AFortPlayerController* PlayerCo
|
|||||||
|
|
||||||
void AFortPlayerController::ServerBeginEditingBuildingActorHook(AFortPlayerController* PlayerController, ABuildingSMActor* BuildingActorToEdit)
|
void AFortPlayerController::ServerBeginEditingBuildingActorHook(AFortPlayerController* PlayerController, ABuildingSMActor* BuildingActorToEdit)
|
||||||
{
|
{
|
||||||
|
// LOG_INFO(LogDev, "ServerBeginEditingBuildingActorHook!");
|
||||||
|
|
||||||
if (!BuildingActorToEdit || !BuildingActorToEdit->IsPlayerPlaced()) // We need more checks.
|
if (!BuildingActorToEdit || !BuildingActorToEdit->IsPlayerPlaced()) // We need more checks.
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -1709,18 +1711,23 @@ void AFortPlayerController::ServerBeginEditingBuildingActorHook(AFortPlayerContr
|
|||||||
Pawn->EquipWeaponDefinition(EditToolDef, EditToolInstance->GetItemEntry()->GetItemGuid());
|
Pawn->EquipWeaponDefinition(EditToolDef, EditToolInstance->GetItemEntry()->GetItemGuid());
|
||||||
|
|
||||||
auto EditTool = Cast<AFortWeap_EditingTool>(Pawn->GetCurrentWeapon());
|
auto EditTool = Cast<AFortWeap_EditingTool>(Pawn->GetCurrentWeapon());
|
||||||
|
// LOG_INFO(LogDev, "[Begin {}] EditTool: {}!", BuildingActorToEdit->GetFullName(), __int64(EditTool));
|
||||||
|
|
||||||
if (!EditTool)
|
if (!EditTool)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
EditTool->GetEditActor() = BuildingActorToEdit;
|
EditTool->GetEditActor() = BuildingActorToEdit;
|
||||||
// EditTool->OnRep_EditActor();
|
EditTool->OnRep_EditActor();
|
||||||
|
|
||||||
BuildingActorToEdit->SetEditingPlayer(PlayerState);
|
BuildingActorToEdit->SetEditingPlayer(PlayerState);
|
||||||
|
|
||||||
|
// LOG_INFO(LogDev, "[Begin] Updating Editing player to: {}!", __int64(PlayerState));
|
||||||
}
|
}
|
||||||
|
|
||||||
void AFortPlayerController::ServerEditBuildingActorHook(UObject* Context, FFrame& Stack, void* Ret)
|
void AFortPlayerController::ServerEditBuildingActorHook(UObject* Context, FFrame& Stack, void* Ret)
|
||||||
{
|
{
|
||||||
|
// LOG_INFO(LogDev, "ServerEditBuildingActorHook!");
|
||||||
|
|
||||||
auto PlayerController = (AFortPlayerController*)Context;
|
auto PlayerController = (AFortPlayerController*)Context;
|
||||||
|
|
||||||
auto PlayerState = (AFortPlayerState*)PlayerController->GetPlayerState();
|
auto PlayerState = (AFortPlayerState*)PlayerController->GetPlayerState();
|
||||||
@@ -1762,11 +1769,41 @@ void AFortPlayerController::ServerEditBuildingActorHook(UObject* Context, FFrame
|
|||||||
|
|
||||||
// we should do more things here
|
// we should do more things here
|
||||||
|
|
||||||
|
// we need to set editactor and stuff because on newer builds ServerEndEditingBuildingActor doesnt get callered
|
||||||
|
BuildingActorToEdit->SetEditingPlayer(nullptr);
|
||||||
|
auto Pawn = PlayerController->GetMyFortPawn();
|
||||||
|
|
||||||
|
if (!Pawn)
|
||||||
|
return ServerEditBuildingActorOriginal(Context, Stack, Ret);
|
||||||
|
|
||||||
|
static auto EditToolDef = FindObject<UFortWeaponItemDefinition>(L"/Game/Items/Weapons/BuildingTools/EditTool.EditTool");
|
||||||
|
|
||||||
|
auto WorldInventory = PlayerController->GetWorldInventory();
|
||||||
|
|
||||||
|
if (!WorldInventory)
|
||||||
|
return ServerEditBuildingActorOriginal(Context, Stack, Ret);
|
||||||
|
|
||||||
|
auto EditToolInstance = WorldInventory->FindItemInstance(EditToolDef);
|
||||||
|
|
||||||
|
if (!EditToolInstance)
|
||||||
|
return ServerEditBuildingActorOriginal(Context, Stack, Ret);
|
||||||
|
|
||||||
|
Pawn->EquipWeaponDefinition(EditToolDef, EditToolInstance->GetItemEntry()->GetItemGuid());
|
||||||
|
|
||||||
|
auto EditTool = Cast<AFortWeap_EditingTool>(Pawn->GetCurrentWeapon());
|
||||||
|
// LOG_INFO(LogDev, "EditTool: {}", __int64(EditTool));
|
||||||
|
|
||||||
|
if (EditTool)
|
||||||
|
{
|
||||||
|
EditTool->GetEditActor() = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
return ServerEditBuildingActorOriginal(Context, Stack, Ret);
|
return ServerEditBuildingActorOriginal(Context, Stack, Ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AFortPlayerController::ServerEndEditingBuildingActorHook(AFortPlayerController* PlayerController, ABuildingSMActor* BuildingActorToStopEditing)
|
void AFortPlayerController::ServerEndEditingBuildingActorHook(AFortPlayerController* PlayerController, ABuildingSMActor* BuildingActorToStopEditing)
|
||||||
{
|
{
|
||||||
|
// LOG_INFO(LogDev, "[{}] ServerEndEditingBuildingActorHook EditiNgplAyer: {}!", BuildingActorToStopEditing ? BuildingActorToStopEditing->GetFullName() : "NULL", BuildingActorToStopEditing ? __int64(BuildingActorToStopEditing->GetEditingPlayer()) : -1);
|
||||||
auto Pawn = PlayerController->GetMyFortPawn();
|
auto Pawn = PlayerController->GetMyFortPawn();
|
||||||
|
|
||||||
if (!BuildingActorToStopEditing || !Pawn
|
if (!BuildingActorToStopEditing || !Pawn
|
||||||
@@ -1788,7 +1825,8 @@ void AFortPlayerController::ServerEndEditingBuildingActorHook(AFortPlayerControl
|
|||||||
if (!EditToolInstance)
|
if (!EditToolInstance)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Pawn->EquipWeaponDefinition(EditToolDef, EditToolInstance->GetItemEntry()->GetItemGuid());
|
// LOG_INFO(LogDev, "EditTool BEFORE: {}", __int64(Cast<AFortWeap_EditingTool>(Pawn->GetCurrentWeapon())));
|
||||||
|
Pawn->EquipWeaponDefinition(EditToolDef, EditToolInstance->GetItemEntry()->GetItemGuid());
|
||||||
|
|
||||||
auto EditTool = Cast<AFortWeap_EditingTool>(Pawn->GetCurrentWeapon());
|
auto EditTool = Cast<AFortWeap_EditingTool>(Pawn->GetCurrentWeapon());
|
||||||
|
|
||||||
|
|||||||
@@ -4,8 +4,9 @@
|
|||||||
|
|
||||||
void ServerCheatHook(AFortPlayerControllerAthena* PlayerController, FString Msg)
|
void ServerCheatHook(AFortPlayerControllerAthena* PlayerController, FString Msg)
|
||||||
{
|
{
|
||||||
if (!Msg.Data.Data || Msg.Data.Num() <= 0)
|
bool isMsgEmpty = !Msg.Data.Data || Msg.Data.Num() <= 0;
|
||||||
return;
|
// if (isMsgEmpty)
|
||||||
|
// return;
|
||||||
|
|
||||||
auto PlayerState = Cast<AFortPlayerStateAthena>(PlayerController->GetPlayerState());
|
auto PlayerState = Cast<AFortPlayerStateAthena>(PlayerController->GetPlayerState());
|
||||||
|
|
||||||
@@ -15,7 +16,9 @@ void ServerCheatHook(AFortPlayerControllerAthena* PlayerController, FString Msg)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
std::vector<std::string> Arguments;
|
std::vector<std::string> Arguments;
|
||||||
auto OldMsg = Msg.ToString();
|
std::string OldMsg = "";
|
||||||
|
if (!isMsgEmpty)
|
||||||
|
OldMsg = Msg.ToString();
|
||||||
|
|
||||||
auto ReceivingController = PlayerController; // for now
|
auto ReceivingController = PlayerController; // for now
|
||||||
auto ReceivingPlayerState = PlayerState; // for now
|
auto ReceivingPlayerState = PlayerState; // for now
|
||||||
@@ -73,6 +76,7 @@ void ServerCheatHook(AFortPlayerControllerAthena* PlayerController, FString Msg)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!isMsgEmpty)
|
||||||
{
|
{
|
||||||
auto Message = Msg.ToString();
|
auto Message = Msg.ToString();
|
||||||
|
|
||||||
@@ -118,7 +122,7 @@ void ServerCheatHook(AFortPlayerControllerAthena* PlayerController, FString Msg)
|
|||||||
|
|
||||||
// return;
|
// return;
|
||||||
|
|
||||||
bool bSendHelpMessage = false;
|
bool bSendHelpMessage = isMsgEmpty;
|
||||||
|
|
||||||
auto GameState = Cast<AFortGameStateAthena>(GetWorld()->GetGameState());
|
auto GameState = Cast<AFortGameStateAthena>(GetWorld()->GetGameState());
|
||||||
auto GameMode = Cast<AFortGameModeAthena>(GetWorld()->GetGameMode());
|
auto GameMode = Cast<AFortGameModeAthena>(GetWorld()->GetGameMode());
|
||||||
|
|||||||
@@ -337,6 +337,8 @@ static inline void StaticUI()
|
|||||||
if (ImGui::Checkbox("Log ProcessEvent", &Globals::bLogProcessEvent))
|
if (ImGui::Checkbox("Log ProcessEvent", &Globals::bLogProcessEvent))
|
||||||
{
|
{
|
||||||
// todo toggle hook
|
// todo toggle hook
|
||||||
|
// this is lowkey highkey a race.. so i hope this below will fix ? idk im confused
|
||||||
|
UObject::ProcessEventOriginal = decltype(UObject::ProcessEventOriginal)(Addresses::ProcessEvent);
|
||||||
Hooking::MinHook::Hook((PVOID)Addresses::ProcessEvent, ProcessEventHook, (PVOID*)&UObject::ProcessEventOriginal);
|
Hooking::MinHook::Hook((PVOID)Addresses::ProcessEvent, ProcessEventHook, (PVOID*)&UObject::ProcessEventOriginal);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user