mirror of
https://github.com/Milxnor/Project-Reboot-3.0.git
synced 2026-01-13 10:52:22 +01:00
i hope maxs pr works
sidegrading and upgrading on upgradebenches
This commit is contained in:
@@ -429,6 +429,9 @@ void AFortPlayerController::ServerAttemptInteractHook(UObject* Context, FFrame*
|
|||||||
static auto ReceivingActorOffset = FindOffsetStruct(StructName, "ReceivingActor");
|
static auto ReceivingActorOffset = FindOffsetStruct(StructName, "ReceivingActor");
|
||||||
auto ReceivingActor = *(AActor**)(__int64(Params) + ReceivingActorOffset);
|
auto ReceivingActor = *(AActor**)(__int64(Params) + ReceivingActorOffset);
|
||||||
|
|
||||||
|
static auto InteractionBeingAttemptedOffset = FindOffsetStruct(StructName, "InteractionBeingAttempted");
|
||||||
|
auto InteractionBeingAttempted = *(EInteractionBeingAttempted*)(__int64(Params) + InteractionBeingAttemptedOffset);
|
||||||
|
|
||||||
// LOG_INFO(LogInteraction, "ReceivingActor: {}", __int64(ReceivingActor));
|
// LOG_INFO(LogInteraction, "ReceivingActor: {}", __int64(ReceivingActor));
|
||||||
|
|
||||||
if (!ReceivingActor)
|
if (!ReceivingActor)
|
||||||
@@ -548,6 +551,101 @@ void AFortPlayerController::ServerAttemptInteractHook(UObject* Context, FFrame*
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else if (ReceivingActor->IsA(BuildingItemCollectorActorClass))
|
else if (ReceivingActor->IsA(BuildingItemCollectorActorClass))
|
||||||
|
{
|
||||||
|
if (Engine_Version >= 424 && Fortnite_Version < 15 && ReceivingActor->GetFullName().contains("Wumba"))
|
||||||
|
{
|
||||||
|
bool bIsSidegrading = InteractionBeingAttempted == EInteractionBeingAttempted::SecondInteraction ? true : false;
|
||||||
|
|
||||||
|
LOG_INFO(LogDev, "bIsSidegrading: {}", (bool)bIsSidegrading);
|
||||||
|
|
||||||
|
struct FWeaponUpgradeItemRow
|
||||||
|
{
|
||||||
|
void* FTableRowBaseInheritance;
|
||||||
|
UFortWeaponItemDefinition* CurrentWeaponDef; // 0x8(0x8)(Edit, ZeroConstructor, DisableEditOnInstance, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic)
|
||||||
|
UFortWeaponItemDefinition* UpgradedWeaponDef; // 0x10(0x8)(Edit, ZeroConstructor, DisableEditOnInstance, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic)
|
||||||
|
EFortWeaponUpgradeCosts WoodCost; // 0x18(0x1)(Edit, ZeroConstructor, DisableEditOnInstance, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic)
|
||||||
|
EFortWeaponUpgradeCosts MetalCost; // 0x19(0x1)(Edit, ZeroConstructor, DisableEditOnInstance, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic)
|
||||||
|
EFortWeaponUpgradeCosts BrickCost; // 0x1A(0x1)(Edit, ZeroConstructor, DisableEditOnInstance, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic)
|
||||||
|
EFortWeaponUpgradeDirection Direction;
|
||||||
|
};
|
||||||
|
|
||||||
|
static auto WumbaDataTable = FindObject<UDataTable>("/Game/Items/Datatables/AthenaWumbaData.AthenaWumbaData");
|
||||||
|
|
||||||
|
static auto LootPackagesRowMap = WumbaDataTable->GetRowMap();
|
||||||
|
|
||||||
|
auto Pawn = Cast<AFortPawn>(PlayerController->GetPawn());
|
||||||
|
auto CurrentHeldWeapon = Pawn->GetCurrentWeapon();
|
||||||
|
auto CurrentHeldWeaponDef = CurrentHeldWeapon->GetWeaponData();
|
||||||
|
|
||||||
|
auto Direction = bIsSidegrading ? EFortWeaponUpgradeDirection::Horizontal : EFortWeaponUpgradeDirection::Vertical;
|
||||||
|
|
||||||
|
LOG_INFO(LogDev, "Direction: {}", (int)Direction);
|
||||||
|
|
||||||
|
FWeaponUpgradeItemRow* FoundRow = nullptr;
|
||||||
|
|
||||||
|
for (int i = 0; i < LootPackagesRowMap.Pairs.Elements.Data.Num(); i++)
|
||||||
|
{
|
||||||
|
auto& Pair = LootPackagesRowMap.Pairs.Elements.Data.at(i).ElementData.Value;
|
||||||
|
auto First = Pair.First;
|
||||||
|
auto Row = (FWeaponUpgradeItemRow*)Pair.Second;
|
||||||
|
|
||||||
|
if (Row->CurrentWeaponDef == CurrentHeldWeaponDef && Row->Direction == Direction)
|
||||||
|
{
|
||||||
|
FoundRow = Row;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!FoundRow)
|
||||||
|
{
|
||||||
|
LOG_WARN(LogGame, "Failed to find row!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto NewDefinition = FoundRow->UpgradedWeaponDef;
|
||||||
|
|
||||||
|
LOG_INFO(LogDev, "UpgradedWeaponDef: {}", NewDefinition->GetFullName());
|
||||||
|
|
||||||
|
int WoodCost = (int)FoundRow->WoodCost * 50;
|
||||||
|
int StoneCost = (int)FoundRow->BrickCost * 50 - 400;
|
||||||
|
int MetalCost = (int)FoundRow->MetalCost * 50 - 200;
|
||||||
|
|
||||||
|
if (bIsSidegrading)
|
||||||
|
{
|
||||||
|
WoodCost = 20;
|
||||||
|
StoneCost = 20;
|
||||||
|
MetalCost = 20;
|
||||||
|
}
|
||||||
|
|
||||||
|
static auto WoodItemData = FindObject<UFortItemDefinition>("/Game/Items/ResourcePickups/WoodItemData.WoodItemData");
|
||||||
|
static auto StoneItemData = FindObject<UFortItemDefinition>("/Game/Items/ResourcePickups/StoneItemData.StoneItemData");
|
||||||
|
static auto MetalItemData = FindObject<UFortItemDefinition>("/Game/Items/ResourcePickups/MetalItemData.MetalItemData");
|
||||||
|
|
||||||
|
auto WorldInventory = PlayerController->GetWorldInventory();
|
||||||
|
|
||||||
|
auto WoodInstance = WorldInventory->FindItemInstance(WoodItemData);
|
||||||
|
auto WoodCount = WoodInstance->GetItemEntry()->GetCount();
|
||||||
|
|
||||||
|
auto StoneInstance = WorldInventory->FindItemInstance(StoneItemData);
|
||||||
|
auto StoneCount = StoneInstance->GetItemEntry()->GetCount();
|
||||||
|
|
||||||
|
auto MetalInstance = WorldInventory->FindItemInstance(MetalItemData);
|
||||||
|
auto MetalCount = MetalInstance->GetItemEntry()->GetCount();
|
||||||
|
|
||||||
|
bool bShouldUpdate = false;
|
||||||
|
|
||||||
|
WorldInventory->RemoveItem(WoodInstance->GetItemEntry()->GetItemGuid(), &bShouldUpdate, WoodCost);
|
||||||
|
WorldInventory->RemoveItem(StoneInstance->GetItemEntry()->GetItemGuid(), &bShouldUpdate, StoneCost);
|
||||||
|
WorldInventory->RemoveItem(MetalInstance->GetItemEntry()->GetItemGuid(), &bShouldUpdate, MetalCost);
|
||||||
|
|
||||||
|
WorldInventory->RemoveItem(CurrentHeldWeapon->GetItemEntryGuid(), &bShouldUpdate, 1, true);
|
||||||
|
|
||||||
|
WorldInventory->AddItem(NewDefinition, &bShouldUpdate);
|
||||||
|
|
||||||
|
if (bShouldUpdate)
|
||||||
|
WorldInventory->Update();
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
auto WorldInventory = PlayerController->GetWorldInventory();
|
auto WorldInventory = PlayerController->GetWorldInventory();
|
||||||
|
|
||||||
@@ -628,6 +726,7 @@ void AFortPlayerController::ServerAttemptInteractHook(UObject* Context, FFrame*
|
|||||||
ItemCollector->K2_DestroyActor();
|
ItemCollector->K2_DestroyActor();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return ServerAttemptInteractOriginal(Context, Stack, Ret);
|
return ServerAttemptInteractOriginal(Context, Stack, Ret);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,6 +40,55 @@ struct FFortAthenaLoadout
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum class EFortWeaponUpgradeCosts : uint8_t
|
||||||
|
{
|
||||||
|
NotSet = 0,
|
||||||
|
WoodUncommon = 1,
|
||||||
|
WoodRare = 2,
|
||||||
|
WoodVeryRare = 3,
|
||||||
|
WoodSuperRare = 4,
|
||||||
|
MetalUncommon = 5,
|
||||||
|
MetalRare = 6,
|
||||||
|
MetalVeryRare = 7,
|
||||||
|
MetalSuperRare = 8,
|
||||||
|
BrickUncommon = 9,
|
||||||
|
BrickRare = 10,
|
||||||
|
BrickVeryRare = 11,
|
||||||
|
BrickSuperRare = 12,
|
||||||
|
HorizontalWoodCommon = 13,
|
||||||
|
HorizontalWoodUncommon = 14,
|
||||||
|
HorizontalWoodRare = 15,
|
||||||
|
HorizontalWoodVeryRare = 16,
|
||||||
|
HorizontalWoodSuperRare = 17,
|
||||||
|
HorizontalMetalCommon = 18,
|
||||||
|
HorizontalMetalUncommon = 19,
|
||||||
|
HorizontalMetalRare = 20,
|
||||||
|
HorizontalMetalVeryRare = 21,
|
||||||
|
HorizontalMetalSuperRare = 22,
|
||||||
|
HorizontalBrickCommon = 23,
|
||||||
|
HorizontalBrickUncommon = 24,
|
||||||
|
HorizontalBrickRare = 25,
|
||||||
|
HorizontalBrickVeryRare = 26,
|
||||||
|
HorizontalBrickSuperRare = 27,
|
||||||
|
EFortWeaponUpgradeCosts_MAX = 28,
|
||||||
|
};
|
||||||
|
|
||||||
|
enum class EFortWeaponUpgradeDirection : uint8
|
||||||
|
{
|
||||||
|
NotSet = 0,
|
||||||
|
Vertical = 1,
|
||||||
|
Horizontal = 2,
|
||||||
|
EFortWeaponUpgradeDirection_MAX = 3,
|
||||||
|
};
|
||||||
|
|
||||||
|
enum class EInteractionBeingAttempted : uint8
|
||||||
|
{
|
||||||
|
FirstInteraction = 0,
|
||||||
|
SecondInteraction = 1,
|
||||||
|
AllInteraction = 2,
|
||||||
|
EInteractionBeingAttempted_MAX = 3,
|
||||||
|
};
|
||||||
|
|
||||||
class AFortPlayerController : public APlayerController
|
class AFortPlayerController : public APlayerController
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|||||||
Reference in New Issue
Block a user