Skip to content

Commit

Permalink
Header additions/fixes and tiny fix on api utils buff (ServersHub#31)
Browse files Browse the repository at this point in the history
* Updated to not require manual calling get singleton

* Updated some things, and fixed api utils buff property

* Added another constructor for specifying notification id in special cases
  • Loading branch information
Pelayori authored Jan 11, 2024
1 parent 573ae6e commit dbdcd39
Show file tree
Hide file tree
Showing 8 changed files with 39 additions and 17 deletions.
1 change: 1 addition & 0 deletions AsaApi/Core/Public/API/ARK/Actor.h
Original file line number Diff line number Diff line change
Expand Up @@ -6899,6 +6899,7 @@ struct APrimalDinoCharacter : APrimalCharacter
UE::Math::TVector<double>& SpawnedLocationField() { return *GetNativePointerField<UE::Math::TVector<double>*>(this, "APrimalDinoCharacter.SpawnedLocation"); }
long double& LastWantsToEnableNavRelevancyField() { return *GetNativePointerField<long double*>(this, "APrimalDinoCharacter.LastWantsToEnableNavRelevancy"); }
float& DinoArmorDurabilityScalingMultiplierField() { return *GetNativePointerField<float*>(this, "APrimalDinoCharacter.DinoArmorDurabilityScalingMultiplier"); }
unsigned __int8& TamedAITargetingRangeField() { return *GetNativePointerField<unsigned __int8*>(this, "APrimalDinoCharacter.TamedAITargetingRange"); }

// Bitfields

Expand Down
1 change: 1 addition & 0 deletions AsaApi/Core/Public/API/ARK/GameMode.h
Original file line number Diff line number Diff line change
Expand Up @@ -1148,6 +1148,7 @@ struct UPrimalGameData : UObject
static void AppendGlobalBoneModifiers(USkeletalMeshComponent* ForMesh, bool IsFemale, TArray<FBoneModifier, TSizedDefaultAllocator<32> >* BoneModifiers) { NativeCall<void, USkeletalMeshComponent*, bool, TArray<FBoneModifier, TSizedDefaultAllocator<32> >*>(nullptr, "UPrimalGameData.AppendGlobalBoneModifiers(USkeletalMeshComponent*,bool,TArray<FBoneModifier,TSizedDefaultAllocator<32>>*)", ForMesh, IsFemale, BoneModifiers); }
static char GetIsItemBlacklisted() { return NativeCall<char>(nullptr, "UPrimalGameData.GetIsItemBlacklisted()"); }
const UPrimalGlobalUIData* GetUIDataFast() { return NativeCall<const UPrimalGlobalUIData*>(this, "UPrimalGameData.GetUIDataFast()"); }
static TSubclassOf<UObject>* GetRedirectedClass(TSubclassOf<UObject>* result, FString* key, UObject* WorldContextObject) { return NativeCall<TSubclassOf<UObject>*, TSubclassOf<UObject>*, FString*, UObject*>(nullptr, "UPrimalGameData.GetRedirectedClass(FString&,UObject*)", result, key, WorldContextObject); }
};

struct UPrimalGlobals : UObject
Expand Down
23 changes: 11 additions & 12 deletions AsaApi/Core/Public/API/ARK/Inventory.h
Original file line number Diff line number Diff line change
Expand Up @@ -726,8 +726,7 @@ struct UPrimalInventoryComponent : UActorComponent
TArray<UPrimalItem*, TSizedDefaultAllocator<32> >& AllDyeColorItemsField() { return *GetNativePointerField<TArray<UPrimalItem*, TSizedDefaultAllocator<32> >*>(this, "UPrimalInventoryComponent.AllDyeColorItems"); }
TArray<FItemCraftQueueEntry, TSizedDefaultAllocator<32> >& ItemCraftQueueEntriesField() { return *GetNativePointerField<TArray<FItemCraftQueueEntry, TSizedDefaultAllocator<32> >*>(this, "UPrimalInventoryComponent.ItemCraftQueueEntries"); }
int& OverrideInventoryDefaultTabField() { return *GetNativePointerField<int*>(this, "UPrimalInventoryComponent.OverrideInventoryDefaultTab"); }
//TArray<TEnumAsByte<enum EPrimalEquipmentType::Type>, TSizedDefaultAllocator<32> >& EquippableItemTypesField() { return *GetNativePointerField<TArray<TEnumAsByte<enum EPrimalEquipmentType::Type>, TSizedDefaultAllocator<32> >*>(this, "UPrimalInventoryComponent.EquippableItemTypes"); }
__int8& _padding_183Field() { return *GetNativePointerField<__int8*>(this, "UPrimalInventoryComponent._padding_183"); }
TArray<TEnumAsByte<enum EPrimalEquipmentType::Type>, TSizedDefaultAllocator<32> >& EquippableItemTypesField() { return *GetNativePointerField<TArray<TEnumAsByte<enum EPrimalEquipmentType::Type>, TSizedDefaultAllocator<32> >*>(this, "UPrimalInventoryComponent.EquippableItemTypes"); }
float& CraftingItemSpeedField() { return *GetNativePointerField<float*>(this, "UPrimalInventoryComponent.CraftingItemSpeed"); }
TArray<FItemMultiplier, TSizedDefaultAllocator<32> >& ItemSpoilingTimeMultipliersField() { return *GetNativePointerField<TArray<FItemMultiplier, TSizedDefaultAllocator<32> >*>(this, "UPrimalInventoryComponent.ItemSpoilingTimeMultipliers"); }
UGenericDataListEntry* ExtraItemDisplayField() { return *GetNativePointerField<UGenericDataListEntry**>(this, "UPrimalInventoryComponent.ExtraItemDisplay"); }
Expand All @@ -742,18 +741,18 @@ struct UPrimalInventoryComponent : UActorComponent
//TArray<TSubclassOf<UPrimalItem>, TSizedDefaultAllocator<32> >& RemoteAddItemOnlyAllowItemClassesField() { return *GetNativePointerField<//TArray<TSubclassOf<UPrimalItem>, TSizedDefaultAllocator<32> >*>(this, "UPrimalInventoryComponent.RemoteAddItemOnlyAllowItemClasses"); }
//TArray<TSubclassOf<UPrimalItem>, TSizedDefaultAllocator<32> >& RemoteAddItemPreventItemClassesField() { return *GetNativePointerField<//TArray<TSubclassOf<UPrimalItem>, TSizedDefaultAllocator<32> >*>(this, "UPrimalInventoryComponent.RemoteAddItemPreventItemClasses"); }
TArray<FEventItem, TSizedDefaultAllocator<32> >& EventItemsField() { return *GetNativePointerField<TArray<FEventItem, TSizedDefaultAllocator<32> >*>(this, "UPrimalInventoryComponent.EventItems"); }
//TArray<TSubclassOf<UPrimalItem>, TSizedDefaultAllocator<32> >& DefaultInventoryItemsField() { return *GetNativePointerField<//TArray<TSubclassOf<UPrimalItem>, TSizedDefaultAllocator<32> >*>(this, "UPrimalInventoryComponent.DefaultInventoryItems"); }
//TArray<TSubclassOf<UPrimalItem>, TSizedDefaultAllocator<32> >& DefaultInventoryItems2Field() { return *GetNativePointerField<//TArray<TSubclassOf<UPrimalItem>, TSizedDefaultAllocator<32> >*>(this, "UPrimalInventoryComponent.DefaultInventoryItems2"); }
//TArray<TSubclassOf<UPrimalItem>, TSizedDefaultAllocator<32> >& DefaultInventoryItems3Field() { return *GetNativePointerField<//TArray<TSubclassOf<UPrimalItem>, TSizedDefaultAllocator<32> >*>(this, "UPrimalInventoryComponent.DefaultInventoryItems3"); }
//TArray<TSubclassOf<UPrimalItem>, TSizedDefaultAllocator<32> >& DefaultInventoryItems4Field() { return *GetNativePointerField<//TArray<TSubclassOf<UPrimalItem>, TSizedDefaultAllocator<32> >*>(this, "UPrimalInventoryComponent.DefaultInventoryItems4"); }
TArray<TSubclassOf<UPrimalItem>, TSizedDefaultAllocator<32> >& DefaultInventoryItemsField() { return *GetNativePointerField<TArray<TSubclassOf<UPrimalItem>, TSizedDefaultAllocator<32> >*>(this, "UPrimalInventoryComponent.DefaultInventoryItems"); }
TArray<TSubclassOf<UPrimalItem>, TSizedDefaultAllocator<32> >& DefaultInventoryItems2Field() { return *GetNativePointerField<TArray<TSubclassOf<UPrimalItem>, TSizedDefaultAllocator<32> >*>(this, "UPrimalInventoryComponent.DefaultInventoryItems2"); }
TArray<TSubclassOf<UPrimalItem>, TSizedDefaultAllocator<32> >& DefaultInventoryItems3Field() { return *GetNativePointerField<TArray<TSubclassOf<UPrimalItem>, TSizedDefaultAllocator<32> >*>(this, "UPrimalInventoryComponent.DefaultInventoryItems3"); }
TArray<TSubclassOf<UPrimalItem>, TSizedDefaultAllocator<32> >& DefaultInventoryItems4Field() { return *GetNativePointerField<TArray<TSubclassOf<UPrimalItem>, TSizedDefaultAllocator<32> >*>(this, "UPrimalInventoryComponent.DefaultInventoryItems4"); }
//TArray<//TSoftObjectPtr<UObject>, TSizedDefaultAllocator<32> >& DefaultInventoryItemsClasses_DEPRECATEDField() { return *GetNativePointerField<//TArray<//TSoftObjectPtr<UObject>, TSizedDefaultAllocator<32> >*>(this, "UPrimalInventoryComponent.DefaultInventoryItemsClasses_DEPRECATED"); }
//TArray<//TSoftClassPtr<UObject>, TSizedDefaultAllocator<32> >& DefaultInventoryItemsClassesNewField() { return *GetNativePointerField<//TArray<//TSoftClassPtr<UObject>, TSizedDefaultAllocator<32> >*>(this, "UPrimalInventoryComponent.DefaultInventoryItemsClassesNew"); }
TArray<FString, TSizedDefaultAllocator<32> >& DefaultInventoryItemsRandomCustomStringsField() { return *GetNativePointerField<TArray<FString, TSizedDefaultAllocator<32> >*>(this, "UPrimalInventoryComponent.DefaultInventoryItemsRandomCustomStrings"); }
TArray<float, TSizedDefaultAllocator<32> >& DefaultInventoryItemsRandomCustomStringsWeightsField() { return *GetNativePointerField<TArray<float, TSizedDefaultAllocator<32> >*>(this, "UPrimalInventoryComponent.DefaultInventoryItemsRandomCustomStringsWeights"); }
//TArray<TSubclassOf<UPrimalItem>, TSizedDefaultAllocator<32> >& CheatInventoryItemsField() { return *GetNativePointerField<//TArray<TSubclassOf<UPrimalItem>, TSizedDefaultAllocator<32> >*>(this, "UPrimalInventoryComponent.CheatInventoryItems"); }
//TArray<TSubclassOf<UPrimalItem>, TSizedDefaultAllocator<32> >& DefaultEquippedItemsField() { return *GetNativePointerField<//TArray<TSubclassOf<UPrimalItem>, TSizedDefaultAllocator<32> >*>(this, "UPrimalInventoryComponent.DefaultEquippedItems"); }
//TArray<TSubclassOf<UPrimalItem>, TSizedDefaultAllocator<32> >& DefaultEquippedItemSkinsField() { return *GetNativePointerField<//TArray<TSubclassOf<UPrimalItem>, TSizedDefaultAllocator<32> >*>(this, "UPrimalInventoryComponent.DefaultEquippedItemSkins"); }
//TArray<TSubclassOf<UPrimalItem>, TSizedDefaultAllocator<32> >& DefaultSlotItemsField() { return *GetNativePointerField<//TArray<TSubclassOf<UPrimalItem>, TSizedDefaultAllocator<32> >*>(this, "UPrimalInventoryComponent.DefaultSlotItems"); }
//TArray<FString, TSizedDefaultAllocator<32> >& DefaultInventoryItemsRandomCustomStringsField() { return *GetNativePointerField<TArray<FString, TSizedDefaultAllocator<32> >*>(this, "UPrimalInventoryComponent.DefaultInventoryItemsRandomCustomStrings"); }
//TArray<float, TSizedDefaultAllocator<32> >& DefaultInventoryItemsRandomCustomStringsWeightsField() { return *GetNativePointerField<TArray<float, TSizedDefaultAllocator<32> >*>(this, "UPrimalInventoryComponent.DefaultInventoryItemsRandomCustomStringsWeights"); }
TArray<TSubclassOf<UPrimalItem>, TSizedDefaultAllocator<32> >& CheatInventoryItemsField() { return *GetNativePointerField<TArray<TSubclassOf<UPrimalItem>, TSizedDefaultAllocator<32> >*>(this, "UPrimalInventoryComponent.CheatInventoryItems"); }
TArray<TSubclassOf<UPrimalItem>, TSizedDefaultAllocator<32> >& DefaultEquippedItemsField() { return *GetNativePointerField<TArray<TSubclassOf<UPrimalItem>, TSizedDefaultAllocator<32> >*>(this, "UPrimalInventoryComponent.DefaultEquippedItems"); }
TArray<TSubclassOf<UPrimalItem>, TSizedDefaultAllocator<32> >& DefaultEquippedItemSkinsField() { return *GetNativePointerField<TArray<TSubclassOf<UPrimalItem>, TSizedDefaultAllocator<32> >*>(this, "UPrimalInventoryComponent.DefaultEquippedItemSkins"); }
TArray<TSubclassOf<UPrimalItem>, TSizedDefaultAllocator<32> >& DefaultSlotItemsField() { return *GetNativePointerField<TArray<TSubclassOf<UPrimalItem>, TSizedDefaultAllocator<32> >*>(this, "UPrimalInventoryComponent.DefaultSlotItems"); }
TArray<FItemSpawnActorClassOverride, TSizedDefaultAllocator<32> >& ItemSpawnActorClassOverridesField() { return *GetNativePointerField<TArray<FItemSpawnActorClassOverride, TSizedDefaultAllocator<32> >*>(this, "UPrimalInventoryComponent.ItemSpawnActorClassOverrides"); }
//TArray<TSubclassOf<UPrimalItem>, TSizedDefaultAllocator<32> >& OnlyAllowCraftingItemClassesField() { return *GetNativePointerField<//TArray<TSubclassOf<UPrimalItem>, TSizedDefaultAllocator<32> >*>(this, "UPrimalInventoryComponent.OnlyAllowCraftingItemClasses"); }
TArray<unsigned char, TSizedDefaultAllocator<32> >& DefaultEngramsField() { return *GetNativePointerField<TArray<unsigned char, TSizedDefaultAllocator<32> >*>(this, "UPrimalInventoryComponent.DefaultEngrams"); }
Expand Down
18 changes: 17 additions & 1 deletion AsaApi/Core/Public/API/ARK/ModParamStructs.h
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,22 @@ struct AsaApiUtilsNotification
, bAddToChat(bAddToChat)
{
}

AsaApiUtilsNotification(
const FString& Notificationid,
const FString& Text,
const TArray<FString>& RecipientEOS,
const FLinearColor& BackgroundColor,
const FLinearColor& TextColor,
const double& DisplayScale,
const double& DisplayTime,
const Position& TextJustification,
const Position& NotificationScreenPosition,
const bool& bAddToChat
) : AsaApiUtilsNotification(Text, RecipientEOS, BackgroundColor, TextColor, DisplayScale, DisplayTime, TextJustification, NotificationScreenPosition, bAddToChat)
{
NotificationId = Notificationid;
}
};

struct AddNotification_Params
Expand All @@ -146,7 +162,7 @@ struct APrimalBuff_ApiUtils : APrimalBuff
TArray<AsaApiUtilsNotification>& NotificationsField()
{
FProperty* NotificationsProperty = FindProperty("Notifications");
return *NotificationsProperty->Get<TArray<AsaApiUtilsNotification>*>(this);
return NotificationsProperty->Get<TArray<AsaApiUtilsNotification>>(this);
}

// Functions
Expand Down
5 changes: 4 additions & 1 deletion AsaApi/Core/Public/API/ARK/Other.h
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,10 @@ struct UVictoryCore : UVictoryCoreHighest
//static TArray<UPrimalItem*, TSizedDefaultAllocator<32> >* GiveItemToCharacter(TArray<UPrimalItem*, TSizedDefaultAllocator<32> >* result, APrimalCharacter* Character, TSubclassOf<UPrimalItem> ItemType, int NumItems, float Quality, bool bAutoEquip) { return NativeCall<TArray<UPrimalItem*, TSizedDefaultAllocator<32> >*, TArray<UPrimalItem*, TSizedDefaultAllocator<32> >*, APrimalCharacter*, TSubclassOf<UPrimalItem>, int, float, bool>(nullptr, "UVictoryCore.GiveItemToCharacter(TArray<UPrimalItem*,TSizedDefaultAllocator<32>>*,APrimalCharacter*,TSubclassOf<UPrimalItem>,int,float,bool)", result, Character, ItemType, NumItems, Quality, bAutoEquip); }
static void GetObjectsReferencedBy(UObject* ForObject, TArray<UObject*, TSizedDefaultAllocator<32> >* OutReferencedObjects, bool bIgnoreTransient) { NativeCall<void, UObject*, TArray<UObject*, TSizedDefaultAllocator<32> >*, bool>(nullptr, "UVictoryCore.GetObjectsReferencedBy(UObject*,TArray<UObject*,TSizedDefaultAllocator<32>>*,bool)", ForObject, OutReferencedObjects, bIgnoreTransient); }
static bool GetOverlappedHarvestActors(UObject* WorldContextObject, const UE::Math::TVector<double>* AtLoc, float AtRadius, TArray<AActor*, TSizedDefaultAllocator<32> >* OutHarvestActors, TArray<UActorComponent*, TSizedDefaultAllocator<32> >* OutHarvestComponents, TArray<UE::Math::TVector<double>, TSizedDefaultAllocator<32> >* OutHarvestLocations, TArray<int, TSizedDefaultAllocator<32> >* OutHitBodyIndices) { return NativeCall<bool, UObject*, const UE::Math::TVector<double>*, float, TArray<AActor*, TSizedDefaultAllocator<32> >*, TArray<UActorComponent*, TSizedDefaultAllocator<32> >*, TArray<UE::Math::TVector<double>, TSizedDefaultAllocator<32> >*, TArray<int, TSizedDefaultAllocator<32> >*>(nullptr, "UVictoryCore.GetOverlappedHarvestActors(UObject*,UE::Math::TVector<double>*,float,TArray<AActor*,TSizedDefaultAllocator<32>>*,TArray<UActorComponent*,TSizedDefaultAllocator<32>>*,TArray<UE::Math::TVector<double>,TSizedDefaultAllocator<32>>*,TArray<int,TSizedDefaultAllocator<32>>*)", WorldContextObject, AtLoc, AtRadius, OutHarvestActors, OutHarvestComponents, OutHarvestLocations, OutHitBodyIndices); }
static void ServerSearchFoliage() { NativeCall<void>(nullptr, "UVictoryCore.ServerSearchFoliage()"); }
static void ServerSearchFoliage
(UObject* WorldContextObject, UE::Math::TVector<double>* Origin, float Radius, TArray<FOverlappedFoliageElement, TSizedDefaultAllocator<32> >* OutFoliage, bool bVisibleAndActiveOnly, bool bIncludeUsableFoliage, bool bIncludeMeshFoliage, bool bSortByDistance, bool bReverseSort)
{ NativeCall<void, UObject*, UE::Math::TVector<double>*, float, TArray<FOverlappedFoliageElement, TSizedDefaultAllocator<32>>*, bool, bool, bool, bool, bool>(nullptr, "UVictoryCore.ServerSearchFoliage(UObject*,UE::Math::TVector<double>,float,TArray<FOverlappedFoliageElement,TSizedDefaultAllocator<32>>&,bool,bool,bool,bool,bool)",
WorldContextObject, Origin, Radius, OutFoliage, bVisibleAndActiveOnly, bIncludeUsableFoliage, bIncludeMeshFoliage, bSortByDistance, bReverseSort); }
static FName* GetHitBoneNameFromDamageEvent(FName* result, APrimalCharacter* Character, AController* HitInstigator, const FDamageEvent* DamageEvent, bool bIsPointDamage, const FHitResult* PointHitResult, FName MatchCollisionPresetName) { return NativeCall<FName*, FName*, APrimalCharacter*, AController*, const FDamageEvent*, bool, const FHitResult*, FName>(nullptr, "UVictoryCore.GetHitBoneNameFromDamageEvent(FName*,APrimalCharacter*,AController*,FDamageEvent*,bool,FHitResult*,FName)", result, Character, HitInstigator, DamageEvent, bIsPointDamage, PointHitResult, MatchCollisionPresetName); }
static float GetAngleBetweenVectors(const UE::Math::TVector<double>* VectorA, const UE::Math::TVector<double>* VectorB, const UE::Math::TVector<double>* AroundAxis) { return NativeCall<float, const UE::Math::TVector<double>*, const UE::Math::TVector<double>*, const UE::Math::TVector<double>*>(nullptr, "UVictoryCore.GetAngleBetweenVectors(UE::Math::TVector<double>*,UE::Math::TVector<double>*,UE::Math::TVector<double>*)", VectorA, VectorB, AroundAxis); }
static float GetAngleBetweenVectorsPure() { return NativeCall<float>(nullptr, "UVictoryCore.GetAngleBetweenVectorsPure()"); }
Expand Down
1 change: 1 addition & 0 deletions AsaApi/Core/Public/API/ARK/PrimalStructure.h
Original file line number Diff line number Diff line change
Expand Up @@ -2073,6 +2073,7 @@ struct APrimalStructureTurret : APrimalStructureItemContainer
float& AimSpreadField() { return *GetNativePointerField<float*>(this, "APrimalStructureTurret.AimSpread"); }
unsigned __int8& RangeSettingField() { return *GetNativePointerField<unsigned __int8*>(this, "APrimalStructureTurret.RangeSetting"); }
unsigned __int8& WarningSettingField() { return *GetNativePointerField<unsigned __int8*>(this, "APrimalStructureTurret.WarningSetting"); }
unsigned __int8& AISettingField() { return *GetNativePointerField<unsigned __int8*>(this, "APrimalStructureTurret.AISetting"); }
int& MinTargetLevelField() { return *GetNativePointerField<int*>(this, "APrimalStructureTurret.MinTargetLevel"); }
int& MaxTargetLevelField() { return *GetNativePointerField<int*>(this, "APrimalStructureTurret.MaxTargetLevel"); }
TArray<TSubclassOf<APrimalDinoCharacter>, TSizedDefaultAllocator<32> >& DinoTargetListField() { return *GetNativePointerField<TArray<TSubclassOf<APrimalDinoCharacter>, TSizedDefaultAllocator<32> >*>(this, "APrimalStructureTurret.DinoTargetList"); }
Expand Down
1 change: 1 addition & 0 deletions AsaApi/Core/Public/API/Base.h
Original file line number Diff line number Diff line change
Expand Up @@ -815,6 +815,7 @@ struct UWeaponAttackData;
struct UWidget;
struct UWorld;
struct UWorldPartition;
struct FOverlappedFoliageElement;

// Address helpers
ARK_API DWORD64 GetAddress(const void* base, const std::string& name);
Expand Down
6 changes: 3 additions & 3 deletions AsaApi/Core/Public/AsaApiModUtils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ namespace AsaApiModUtils
params.Color = Color;
params.Duration = Duration;

if (Singleton != nullptr)
if (GetSingleton() != nullptr)
{
Singleton->ProcessEvent(Singleton->FindFunctionChecked(FName("DrawDebugLine")), &params);
}
Expand All @@ -72,7 +72,7 @@ namespace AsaApiModUtils
{
DrawDebugSphere_Params sentParams = params;

if (Singleton != nullptr)
if (GetSingleton() != nullptr)
{
Singleton->ProcessEvent(Singleton->FindFunctionChecked(FName("DrawSphere")), &sentParams);
return GetWeakReference(sentParams.SphereActor);
Expand All @@ -99,7 +99,7 @@ namespace AsaApiModUtils
AddNotification_Params notification;
notification.Notification = notificationParams;

if (Singleton != nullptr)
if (GetSingleton() != nullptr)
{
Singleton->ProcessEvent(Singleton->FindFunctionChecked(FName("AddNotification")), &notification);
return notification.NotificationId;
Expand Down

0 comments on commit dbdcd39

Please sign in to comment.