Function bodies 468 total
BeginPlay method · cpp · L19-L31 (13 LOC).agents/skills/unreal-engine-cpp-pro/examples/ExampleActor.cpp
void AExampleActor::BeginPlay()
{
Super::BeginPlay();
// Cache references here, not in Tick
CachedPC = UGameplayStatics::GetPlayerController(this, 0);
if (bIsActive)
{
UE_LOG(LogExampleActor, Log, TEXT("ExampleActor %s started!"), *GetName());
}
}EndPlay method · cpp · L32-L37 (6 LOC).agents/skills/unreal-engine-cpp-pro/examples/ExampleActor.cpp
void AExampleActor::EndPlay(const EEndPlayReason::Type EndPlayReason)
{
// Clean up any strict delegates or handles here
Super::EndPlay(EndPlayReason);
}Tick method · cpp · L38-L43 (6 LOC).agents/skills/unreal-engine-cpp-pro/examples/ExampleActor.cpp
void AExampleActor::Tick(float DeltaTime)
{
Super::Tick(DeltaTime);
// Ticking is disabled by default in constructor, so this won't run unless enabled explicitly.
}StartupModule method · cpp · L6-L9 (4 LOC)Source/VaultCoreEditor/Private/VaultCoreEditor.cpp
void FVaultCoreEditorModule::StartupModule()
{
}ShutdownModule method · cpp · L10-L13 (4 LOC)Source/VaultCoreEditor/Private/VaultCoreEditor.cpp
void FVaultCoreEditorModule::ShutdownModule()
{
}FVaultCoreEditorModule class · c · L7-L13 (7 LOC)Source/VaultCoreEditor/Public/VaultCoreEditor.h
class FVaultCoreEditorModule : public IModuleInterface
{
public:
virtual void StartupModule() override;
virtual void ShutdownModule() override;
};CanRead_Implementation method · cpp · L5-L10 (6 LOC)Source/VaultCore/Private/AccessRights/DefaultOwnerAccessPolicy.cpp
bool UDefaultOwnerAccessPolicy::CanRead_Implementation(
AActor* Actor, UInventoryManagerComponent* Inventory, const FInventoryEntry& Entry) const
{
return IsOwner(Actor, Inventory);
}Want fix-PRs on findings? Install Repobility's GitHub App · github.com/apps/repobility-bot
CanDeposit_Implementation method · cpp · L11-L16 (6 LOC)Source/VaultCore/Private/AccessRights/DefaultOwnerAccessPolicy.cpp
bool UDefaultOwnerAccessPolicy::CanDeposit_Implementation(
AActor* Actor, UInventoryManagerComponent* Inventory, const UItemDefinition* ItemDef) const
{
return IsOwner(Actor, Inventory);
}CanWithdraw_Implementation method · cpp · L17-L22 (6 LOC)Source/VaultCore/Private/AccessRights/DefaultOwnerAccessPolicy.cpp
bool UDefaultOwnerAccessPolicy::CanWithdraw_Implementation(
AActor* Actor, UInventoryManagerComponent* Inventory, const FInventoryEntry& Entry) const
{
return IsOwner(Actor, Inventory);
}CanModify_Implementation method · cpp · L23-L28 (6 LOC)Source/VaultCore/Private/AccessRights/DefaultOwnerAccessPolicy.cpp
bool UDefaultOwnerAccessPolicy::CanModify_Implementation(
AActor* Actor, UInventoryManagerComponent* Inventory, const FInventoryEntry& Entry) const
{
return IsOwner(Actor, Inventory);
}IsOwner method · cpp · L29-L37 (9 LOC)Source/VaultCore/Private/AccessRights/DefaultOwnerAccessPolicy.cpp
bool UDefaultOwnerAccessPolicy::IsOwner(const AActor* Actor, const UInventoryManagerComponent* Inventory) const
{
if (!IsValid(Actor) || !IsValid(Inventory))
{
return false;
}
return Inventory->GetOwner() == Actor;
}ResolveActorID method · cpp · L4-L12 (9 LOC)Source/VaultCore/Private/AccessRights/PartyLootAccessPolicy.cpp
FString UPartyLootAccessPolicy::ResolveActorID(const AActor* Actor) const
{
if (!IsValid(Actor))
{
return FString();
}
return Actor->GetName();
}CanRead_Implementation method · cpp · L13-L19 (7 LOC)Source/VaultCore/Private/AccessRights/PartyLootAccessPolicy.cpp
bool UPartyLootAccessPolicy::CanRead_Implementation(
AActor* Actor, UInventoryManagerComponent* Inventory, const FInventoryEntry& Entry) const
{
const FString ActorID = ResolveActorID(Actor);
return PartyMemberIDs.Contains(ActorID);
}CanDeposit_Implementation method · cpp · L20-L27 (8 LOC)Source/VaultCore/Private/AccessRights/PartyLootAccessPolicy.cpp
bool UPartyLootAccessPolicy::CanDeposit_Implementation(
AActor* Actor, UInventoryManagerComponent* Inventory, const UItemDefinition* ItemDef) const
{
// Any party member can deposit loot into the shared pool
const FString ActorID = ResolveActorID(Actor);
return PartyMemberIDs.Contains(ActorID);
}CanWithdraw_Implementation method · cpp · L28-L35 (8 LOC)Source/VaultCore/Private/AccessRights/PartyLootAccessPolicy.cpp
bool UPartyLootAccessPolicy::CanWithdraw_Implementation(
AActor* Actor, UInventoryManagerComponent* Inventory, const FInventoryEntry& Entry) const
{
// Only the party leader can withdraw from the shared loot pool
const FString ActorID = ResolveActorID(Actor);
return ActorID == LeaderID;
}Source: Repobility analyzer · https://repobility.com
CanModify_Implementation method · cpp · L36-L43 (8 LOC)Source/VaultCore/Private/AccessRights/PartyLootAccessPolicy.cpp
bool UPartyLootAccessPolicy::CanModify_Implementation(
AActor* Actor, UInventoryManagerComponent* Inventory, const FInventoryEntry& Entry) const
{
// Only the party leader can modify items in the shared pool
const FString ActorID = ResolveActorID(Actor);
return ActorID == LeaderID;
}CanRead_Implementation method · cpp · L8-L13 (6 LOC)Source/VaultCore/Private/AccessRights/RankBasedAccessPolicy.cpp
bool URankBasedAccessPolicy::CanRead_Implementation(
AActor* Actor, UInventoryManagerComponent* Inventory, const FInventoryEntry& Entry) const
{
return ResolveAccessLevel(Actor) >= EVaultAccessLevel::Read;
}CanDeposit_Implementation method · cpp · L14-L19 (6 LOC)Source/VaultCore/Private/AccessRights/RankBasedAccessPolicy.cpp
bool URankBasedAccessPolicy::CanDeposit_Implementation(
AActor* Actor, UInventoryManagerComponent* Inventory, const UItemDefinition* ItemDef) const
{
return ResolveAccessLevel(Actor) >= EVaultAccessLevel::Deposit;
}CanWithdraw_Implementation method · cpp · L20-L27 (8 LOC)Source/VaultCore/Private/AccessRights/RankBasedAccessPolicy.cpp
bool URankBasedAccessPolicy::CanWithdraw_Implementation(
AActor* Actor, UInventoryManagerComponent* Inventory, const FInventoryEntry& Entry) const
{
const EVaultAccessLevel ActorLevel = ResolveAccessLevel(Actor);
const EVaultAccessLevel RequiredLevel = GetRequiredLevelForItem(Entry);
return ActorLevel >= RequiredLevel && ActorLevel >= EVaultAccessLevel::Withdraw;
}CanModify_Implementation method · cpp · L28-L33 (6 LOC)Source/VaultCore/Private/AccessRights/RankBasedAccessPolicy.cpp
bool URankBasedAccessPolicy::CanModify_Implementation(
AActor* Actor, UInventoryManagerComponent* Inventory, const FInventoryEntry& Entry) const
{
return ResolveAccessLevel(Actor) >= EVaultAccessLevel::Full;
}ResolveAccessLevel_Implementation method · cpp · L34-L60 (27 LOC)Source/VaultCore/Private/AccessRights/RankBasedAccessPolicy.cpp
EVaultAccessLevel URankBasedAccessPolicy::ResolveAccessLevel_Implementation(AActor* Actor) const
{
if (!IsValid(Actor))
{
return EVaultAccessLevel::None;
}
// Query actor's gameplay tags via IGameplayTagAssetInterface
FGameplayTagContainer ActorTags;
if (const IGameplayTagAssetInterface* TagInterface = Cast<IGameplayTagAssetInterface>(Actor))
{
TagInterface->GetOwnedGameplayTags(ActorTags);
}
EVaultAccessLevel HighestLevel = EVaultAccessLevel::None;
for (const auto& Pair : RankPermissions)
{
if (ActorTags.HasTag(Pair.Key) && Pair.Value > HighestLevel)
{
HighestLevel = Pair.Value;
}
}
return HighestLevel;
}GetRequiredLevelForItem method · cpp · L61-L81 (21 LOC)Source/VaultCore/Private/AccessRights/RankBasedAccessPolicy.cpp
EVaultAccessLevel URankBasedAccessPolicy::GetRequiredLevelForItem(const FInventoryEntry& Entry) const
{
EVaultAccessLevel RequiredLevel = EVaultAccessLevel::Withdraw; // Default minimum for withdrawal
if (IsValid(Entry.ItemDef.Get()))
{
for (const auto& Override : ItemTagOverrides)
{
if (Entry.ItemDef->ItemTags.HasTag(Override.Key))
{
if (Override.Value > RequiredLevel)
{
RequiredLevel = Override.Value;
}
}
}
}
return RequiredLevel;
}CanRead_Implementation method · cpp · L4-L10 (7 LOC)Source/VaultCore/Private/AccessRights/VendorAccessPolicy.cpp
bool UVendorAccessPolicy::CanRead_Implementation(
AActor* Actor, UInventoryManagerComponent* Inventory, const FInventoryEntry& Entry) const
{
// Anyone can browse vendor stock
return true;
}Repobility · code-quality intelligence · https://repobility.com
CanDeposit_Implementation method · cpp · L11-L17 (7 LOC)Source/VaultCore/Private/AccessRights/VendorAccessPolicy.cpp
bool UVendorAccessPolicy::CanDeposit_Implementation(
AActor* Actor, UInventoryManagerComponent* Inventory, const UItemDefinition* ItemDef) const
{
// Anyone can sell items to the vendor (deposit)
return true;
}CanWithdraw_Implementation method · cpp · L18-L24 (7 LOC)Source/VaultCore/Private/AccessRights/VendorAccessPolicy.cpp
bool UVendorAccessPolicy::CanWithdraw_Implementation(
AActor* Actor, UInventoryManagerComponent* Inventory, const FInventoryEntry& Entry) const
{
// Direct withdraw denied — purchases go through a separate validated RPC
return false;
}CanModify_Implementation method · cpp · L25-L31 (7 LOC)Source/VaultCore/Private/AccessRights/VendorAccessPolicy.cpp
bool UVendorAccessPolicy::CanModify_Implementation(
AActor* Actor, UInventoryManagerComponent* Inventory, const FInventoryEntry& Entry) const
{
// Vendor stock is immutable via direct modification
return false;
}ShouldCreateSubsystem method · cpp · L19-L24 (6 LOC)Source/VaultCore/Private/AsyncEconomy/AuctionSubsystem.cpp
bool UAuctionSubsystem::ShouldCreateSubsystem(UObject* Outer) const
{
const UWorld* World = Cast<UWorld>(Outer);
return World && World->GetNetMode() != NM_Client;
}Initialize method · cpp · L25-L38 (14 LOC)Source/VaultCore/Private/AsyncEconomy/AuctionSubsystem.cpp
void UAuctionSubsystem::Initialize(FSubsystemCollectionBase& Collection)
{
Super::Initialize(Collection);
if (GetWorld())
{
GetWorld()->GetTimerManager().SetTimer(
ExpirationTimerHandle, this, &UAuctionSubsystem::CheckListingExpirations, 60.0f, true);
}
AsyncLoadListings();
UE_LOG(LogVault, Display, TEXT("AuctionSubsystem initialized."));
}CreateListing method · cpp · L39-L138 (100 LOC)Source/VaultCore/Private/AsyncEconomy/AuctionSubsystem.cpp
FGameplayTag UAuctionSubsystem::CreateListing(
APlayerController* Seller, FGuid ItemInstanceID,
FGameplayTag CurrencyTag, int32 Price, float DurationHours)
{
if (!IsValid(Seller) || !ItemInstanceID.IsValid() || Price <= 0)
{
return VaultTags::Validation_Error_OutOfBounds;
}
// Rate limiting — reject listing spam before any item validation (fail fast)
UInventoryValidationSubsystem* RateCheck = GetWorld()->GetSubsystem<UInventoryValidationSubsystem>();
if (RateCheck)
{
FGameplayTag RateLimitResult = RateCheck->CheckRateLimit(Seller);
if (FGameplayTag(RateLimitResult) != FGameplayTag(VaultTags::Validation_Success)
&& RateLimitResult.IsValid())
{
return VaultTags::Validation_Error_RateLimited;
}
}
UInventoryManagerComponent* SellerComp = Seller->GetPawn()
? Seller->GetPawn()->FindComponentByClass<UInventoryManagerComponent>()
: nullptr;
if (!SellerComp) return VaultTags::Validation_Error_NotOwner;
// Validate item
const FInventoryEntry* Entry = SellerCCancelListing method · cpp · L139-L174 (36 LOC)Source/VaultCore/Private/AsyncEconomy/AuctionSubsystem.cpp
FGameplayTag UAuctionSubsystem::CancelListing(APlayerController* Seller, FGuid ListingID)
{
FListingEntry* Listing = Listings.Find(ListingID);
if (!Listing || Listing->ListingStatus != VaultTags::Listing_Active)
{
return VaultTags::Validation_Error_ItemNotFound;
}
// Verify the canceller is the original seller
const FString CallerID = IsValid(Seller) ? Seller->GetName() : TEXT("");
if (CallerID != Listing->SellerOwnerID)
{
return VaultTags::Validation_Error_NotOwner;
}
// Return item from escrow to seller
FEscrowRecord* Record = EscrowLedger.Find(ListingID);
if (!Record)
{
UE_LOG(LogVault, Error, TEXT("CancelListing: Escrow record not found for listing %s — data inconsistency."),
*ListingID.ToString());
return VaultTags::Validation_Error_ItemNotFound;
}
ReturnEscrowToSeller(*Record, VaultTags::Reason_AuctionCancel);
Listing->ListingStatus = VaultTags::Listing_Cancelled;
EscrowLedger.Remove(ListingID);
UE_LOG(LogVault, Log, TEXT("Listing cancelled: %s,PurchaseListing method · cpp · L175-L283 (109 LOC)Source/VaultCore/Private/AsyncEconomy/AuctionSubsystem.cpp
FGameplayTag UAuctionSubsystem::PurchaseListing(APlayerController* Buyer, FGuid ListingID)
{
FListingEntry* Listing = Listings.Find(ListingID);
if (!Listing || Listing->ListingStatus != VaultTags::Listing_Active)
{
return VaultTags::Validation_Error_ItemNotFound;
}
// Prevent self-purchase
const FString BuyerID = IsValid(Buyer) ? Buyer->GetName() : TEXT("");
if (BuyerID == Listing->SellerOwnerID)
{
return VaultTags::Validation_Error_AccessDenied;
}
UInventoryManagerComponent* BuyerComp = Buyer->GetPawn()
? Buyer->GetPawn()->FindComponentByClass<UInventoryManagerComponent>()
: nullptr;
if (!BuyerComp) return VaultTags::Validation_Error_NotOwner;
// Verify escrow record exists (item is safely held by System_AuctionHouse)
FEscrowRecord* Record = EscrowLedger.Find(ListingID);
if (!Record || !IsValid(Record->ItemDef.Get()))
{
UE_LOG(LogVault, Error, TEXT("PurchaseListing: Escrow record missing for listing %s."),
*ListingID.ToString());
return VaultTags::ValRepobility · severity-and-effort ranking · https://repobility.com
QueryListings method · cpp · L284-L307 (24 LOC)Source/VaultCore/Private/AsyncEconomy/AuctionSubsystem.cpp
TArray<FListingEntry> UAuctionSubsystem::QueryListings(FGameplayTagContainer FilterTags, int32 MaxResults,
int32 MinPrice, int32 MaxPrice) const
{
TArray<FListingEntry> Results;
for (const auto& Pair : Listings)
{
if (Pair.Value.ListingStatus != VaultTags::Listing_Active) continue;
// Tag filter
if (!FilterTags.IsEmpty() && IsValid(Pair.Value.ItemDef))
{
if (!Pair.Value.ItemDef->ItemTags.HasAny(FilterTags)) continue;
}
// Price range filter
if (MinPrice > 0 && Pair.Value.AskingPrice < MinPrice) continue;
if (MaxPrice > 0 && Pair.Value.AskingPrice > MaxPrice) continue;
Results.Add(Pair.Value);
if (Results.Num() >= MaxResults) break;
}
return Results;
}CheckListingExpirations method · cpp · L308-L340 (33 LOC)Source/VaultCore/Private/AsyncEconomy/AuctionSubsystem.cpp
void UAuctionSubsystem::CheckListingExpirations()
{
const FDateTime Now = FDateTime::UtcNow();
TArray<FGuid> ExpiredListingIDs;
for (auto& Pair : Listings)
{
if (Pair.Value.ListingStatus == VaultTags::Listing_Active && Now > Pair.Value.ExpiresAtUTC)
{
Pair.Value.ListingStatus = VaultTags::Listing_Expired;
ExpiredListingIDs.Add(Pair.Key);
UE_LOG(LogVault, Log, TEXT("Listing expired: %s"), *Pair.Key.ToString());
}
}
// Return escrowed items from expired listings to their sellers
for (const FGuid& ListingID : ExpiredListingIDs)
{
FEscrowRecord* Record = EscrowLedger.Find(ListingID);
if (Record)
{
ReturnEscrowToSeller(*Record, VaultTags::Reason_AuctionExpire);
EscrowLedger.Remove(ListingID);
}
}
if (ExpiredListingIDs.Num() > 0)
{
AsyncSaveListings();
}
}FindSellerComponent method · cpp · L341-L362 (22 LOC)Source/VaultCore/Private/AsyncEconomy/AuctionSubsystem.cpp
UInventoryManagerComponent* UAuctionSubsystem::FindSellerComponent(const FString& SellerOwnerID) const
{
// Search all player controllers for a pawn whose inventory component matches the seller's ID.
// This is a server-side lookup — only the server has authority over all player states.
const UWorld* World = GetWorld();
if (!World) return nullptr;
for (FConstPlayerControllerIterator It = World->GetPlayerControllerIterator(); It; ++It)
{
APlayerController* PC = It->Get();
if (!IsValid(PC) || !IsValid(PC->GetPawn())) continue;
// Match by name (TODO: use proper OwnerID from identity provider when available)
if (PC->GetName() == SellerOwnerID)
{
return PC->GetPawn()->FindComponentByClass<UInventoryManagerComponent>();
}
}
return nullptr;
}ReturnEscrowToSeller method · cpp · L363-L427 (65 LOC)Source/VaultCore/Private/AsyncEconomy/AuctionSubsystem.cpp
void UAuctionSubsystem::ReturnEscrowToSeller(const FEscrowRecord& Record, FGameplayTag ReasonTag)
{
if (!IsValid(Record.ItemDef.Get()))
{
UE_LOG(LogVault, Error, TEXT("ReturnEscrowToSeller: Invalid ItemDef in escrow record for listing %s."),
*Record.ListingID.ToString());
return;
}
// Try to find the seller online and return directly to their inventory
UInventoryManagerComponent* SellerComp = FindSellerComponent(Record.SellerOwnerID);
if (SellerComp)
{
SellerComp->Authority_AddItem(Record.ItemDef, Record.Quantity, Record.OriginalTags);
UE_LOG(LogVault, Log, TEXT("Escrow returned to online seller %s: %s x%d (Reason: %s)"),
*Record.SellerOwnerID, *Record.ItemDef->GetName(), Record.Quantity,
*ReasonTag.ToString());
}
else
{
// Seller is offline — route to mail for async delivery
UMailSubsystem* MailSub = GetWorld() ? GetWorld()->GetSubsystem<UMailSubsystem>() : nullptr;
if (MailSub)
{
FMailAttachment Attachment;
Attachment.ItemDef = Record.ItemDAsyncSaveListings method · cpp · L430-L501 (72 LOC)Source/VaultCore/Private/AsyncEconomy/AuctionSubsystem.cpp
void UAuctionSubsystem::AsyncSaveListings()
{
UWorld* World_Local = GetWorld();
UGameInstance* GI = World_Local ? World_Local->GetGameInstance() : nullptr;
UVaultStorageManager* SM = GI ? GI->GetSubsystem<UVaultStorageManager>() : nullptr;
if (SM == nullptr) return;
TScriptInterface<IInventoryStorageProvider> Provider = SM->GetActiveProvider();
if (!Provider.GetObject()) return;
// Serialize listings to JSON
TSharedRef<FJsonObject> Root = MakeShared<FJsonObject>();
TArray<TSharedPtr<FJsonValue>> ListingsArray;
for (const auto& Pair : Listings)
{
const FListingEntry& Entry = Pair.Value;
TSharedRef<FJsonObject> Obj = MakeShared<FJsonObject>();
Obj->SetStringField(TEXT("ListingID"), Entry.ListingID.ToString());
Obj->SetStringField(TEXT("SellerOwnerID"), Entry.SellerOwnerID);
Obj->SetStringField(TEXT("ItemInstanceID"), Entry.ItemInstanceID.ToString());
Obj->SetStringField(TEXT("ItemDef"), IsValid(Entry.ItemDef.Get()) ? Entry.ItemDef->GetPathName() : TEXT(""));
AsyncLoadListings method · cpp · L502-L522 (21 LOC)Source/VaultCore/Private/AsyncEconomy/AuctionSubsystem.cpp
void UAuctionSubsystem::AsyncLoadListings()
{
UWorld* World_Local = GetWorld();
UGameInstance* GI = World_Local ? World_Local->GetGameInstance() : nullptr;
UVaultStorageManager* SM = GI ? GI->GetSubsystem<UVaultStorageManager>() : nullptr;
if (SM == nullptr) return;
TScriptInterface<IInventoryStorageProvider> Provider = SM->GetActiveProvider();
if (!Provider.GetObject()) return;
FOnStorageLoadComplete OnComplete;
Provider->AsyncLoad(TEXT("System_AuctionHouse"), OnComplete);
// Note: Deserialization of listing data from JSON would be done in the callback.
// For now, the load dispatches and the subsystem starts fresh each session.
// Full deserialization requires matching ItemDef paths to loaded assets, which
// depends on Asset Manager state. This is wired for the infrastructure but
// the actual deserialization is deferred to when the Asset Manager is ready.
UE_LOG(LogVault, Log, TEXT("AuctionSubsystem: AsyncLoadListings dispatched for System_AuctionHouse"));
}BulkCancelListings method · cpp · L525-L537 (13 LOC)Source/VaultCore/Private/AsyncEconomy/AuctionSubsystem.cpp
TArray<FGameplayTag> UAuctionSubsystem::BulkCancelListings(APlayerController* Seller, const TArray<FGuid>& ListingIDs)
{
TArray<FGameplayTag> Results;
Results.Reserve(ListingIDs.Num());
for (const FGuid& ListingID : ListingIDs)
{
Results.Add(CancelListing(Seller, ListingID));
}
return Results;
}GetMyListings method · cpp · L538-L550 (13 LOC)Source/VaultCore/Private/AsyncEconomy/AuctionSubsystem.cpp
TArray<FListingEntry> UAuctionSubsystem::GetMyListings(const FString& SellerOwnerID) const
{
TArray<FListingEntry> Results;
for (const auto& Pair : Listings)
{
if (Pair.Value.SellerOwnerID == SellerOwnerID)
{
Results.Add(Pair.Value);
}
}
return Results;
}Want fix-PRs on findings? Install Repobility's GitHub App · github.com/apps/repobility-bot
CreatePlayerShop method · cpp · L553-L578 (26 LOC)Source/VaultCore/Private/AsyncEconomy/AuctionSubsystem.cpp
FGameplayTag UAuctionSubsystem::CreatePlayerShop(const FString& OwnerID, const FString& ShopName)
{
if (OwnerID.IsEmpty())
{
return FGameplayTag(VaultTags::Validation_Error_InvalidInput);
}
if (PlayerShops.Contains(OwnerID))
{
return FGameplayTag(VaultTags::Validation_Error_AlreadyExists);
}
FPlayerShop Shop;
Shop.ShopID = FGuid::NewGuid();
Shop.OwnerID = OwnerID;
Shop.ShopName = ShopName;
Shop.CreatedAtUTC = FDateTime::UtcNow();
PlayerShops.Add(OwnerID, Shop);
UE_LOG(LogVault, Display, TEXT("AuctionSubsystem: Player shop '%s' created for OwnerID=%s"),
*ShopName, *OwnerID);
return FGameplayTag(VaultTags::Validation_Success);
}GetPlayerShop method · cpp · L579-L584 (6 LOC)Source/VaultCore/Private/AsyncEconomy/AuctionSubsystem.cpp
FPlayerShop UAuctionSubsystem::GetPlayerShop(const FString& OwnerID) const
{
const FPlayerShop* Shop = PlayerShops.Find(OwnerID);
return Shop ? *Shop : FPlayerShop();
}ShouldCreateSubsystem method · cpp · L10-L16 (7 LOC)Source/VaultCore/Private/Audit/AnomalyDetectionSubsystem.cpp
bool UAnomalyDetectionSubsystem::ShouldCreateSubsystem(UObject* Outer) const
{
const UWorld* World = Cast<UWorld>(Outer);
if (!World) { return false; }
return World->GetNetMode() != NM_Client;
}Initialize method · cpp · L17-L35 (19 LOC)Source/VaultCore/Private/Audit/AnomalyDetectionSubsystem.cpp
void UAnomalyDetectionSubsystem::Initialize(FSubsystemCollectionBase& Collection)
{
Super::Initialize(Collection);
const UVaultSettings* Settings = UVaultSettings::Get();
if (Settings && Settings->bEnableAnomalyDetection)
{
if (UWorld* World = GetWorld())
{
World->GetTimerManager().SetTimer(
SweepTimerHandle,
this,
&UAnomalyDetectionSubsystem::PeriodicSweep,
Settings->AnomalySweepIntervalSeconds,
true);
}
}
}Deinitialize method · cpp · L36-L44 (9 LOC)Source/VaultCore/Private/Audit/AnomalyDetectionSubsystem.cpp
void UAnomalyDetectionSubsystem::Deinitialize()
{
if (UWorld* World = GetWorld())
{
World->GetTimerManager().ClearTimer(SweepTimerHandle);
}
Super::Deinitialize();
}PeriodicSweep method · cpp · L45-L53 (9 LOC)Source/VaultCore/Private/Audit/AnomalyDetectionSubsystem.cpp
void UAnomalyDetectionSubsystem::PeriodicSweep()
{
TArray<FAnomalyReport> Reports = RunAnomalySweep();
for (const FAnomalyReport& Report : Reports)
{
OnAnomalyDetected.Broadcast(Report);
}
}RunAnomalySweep method · cpp · L54-L80 (27 LOC)Source/VaultCore/Private/Audit/AnomalyDetectionSubsystem.cpp
TArray<FAnomalyReport> UAnomalyDetectionSubsystem::RunAnomalySweep()
{
TArray<FAnomalyReport> AllReports;
// Get audit events from the audit subsystem
UAuditLogSubsystem* AuditSub = nullptr;
if (UWorld* World = GetWorld())
{
AuditSub = World->GetSubsystem<UAuditLogSubsystem>();
}
if (!AuditSub)
{
return AllReports;
}
// Query all recent events
TArray<FAuditEvent> AllEvents = AuditSub->QueryAuditEvents(
TEXT(""), FGameplayTag(), TEXT(""), 10000);
// Run detectors
AllReports.Append(DetectCreationRateSpike(AllEvents));
AllReports.Append(DetectWealthVelocity(AllEvents));
return AllReports;
}QuarantineItem method · cpp · L81-L103 (23 LOC)Source/VaultCore/Private/Audit/AnomalyDetectionSubsystem.cpp
bool UAnomalyDetectionSubsystem::QuarantineItem(
UInventoryManagerComponent* Inventory, const FGuid& InstanceID)
{
if (!IsValid(Inventory))
{
return false;
}
// Find the item and add quarantine tag
for (FInventoryEntry& Entry : Inventory->GetMutableEntries())
{
if (Entry.InstanceID == InstanceID)
{
Entry.DynamicStateTags.AddTag(VaultTags::State_Quarantined);
UE_LOG(LogVaultAnomaly, Warning,
TEXT("Quarantined item InstanceID=%s"), *InstanceID.ToString());
return true;
}
}
return false;
}Source: Repobility analyzer · https://repobility.com
QuarantineAccount method · cpp · L104-L109 (6 LOC)Source/VaultCore/Private/Audit/AnomalyDetectionSubsystem.cpp
void UAnomalyDetectionSubsystem::QuarantineAccount(const FString& OwnerID)
{
QuarantinedAccounts.Add(OwnerID);
UE_LOG(LogVaultAnomaly, Warning, TEXT("Quarantined account OwnerID=%s"), *OwnerID);
}IsAccountQuarantined method · cpp · L110-L114 (5 LOC)Source/VaultCore/Private/Audit/AnomalyDetectionSubsystem.cpp
bool UAnomalyDetectionSubsystem::IsAccountQuarantined(const FString& OwnerID) const
{
return QuarantinedAccounts.Contains(OwnerID);
}DetectCreationRateSpike method · cpp · L115-L171 (57 LOC)Source/VaultCore/Private/Audit/AnomalyDetectionSubsystem.cpp
TArray<FAnomalyReport> UAnomalyDetectionSubsystem::DetectCreationRateSpike(
const TArray<FAuditEvent>& Events) const
{
TArray<FAnomalyReport> Reports;
const UVaultSettings* Settings = UVaultSettings::Get();
const float Threshold = Settings ? Settings->CreationRateSpikeThreshold : 10.0f;
// Count creation events per item type in recent window vs historical
// Simple approach: count events with positive QtyDelta in last 60s vs total
const FString NowStr = FDateTime::UtcNow().ToIso8601();
const FString RecentCutoff = (FDateTime::UtcNow() - FTimespan::FromSeconds(60.0)).ToIso8601();
TMap<FString, int32> RecentCounts;
TMap<FString, int32> TotalCounts;
for (const FAuditEvent& Event : Events)
{
if (Event.QtyDelta <= 0 || Event.DefID.IsEmpty()) { continue; }
int32& Total = TotalCounts.FindOrAdd(Event.DefID);
Total += Event.QtyDelta;
if (Event.TimestampUTC >= RecentCutoff)
{
int32& Recent = RecentCounts.FindOrAdd(Event.DefID);
Recent += Event.QtyDelta;
}
}
page 1 / 10next ›