Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -158,3 +158,25 @@ FString ULootLockerPlayerRequestHandler::DeletePlayer(const FLootLockerPlayerDat
return LLAPI<FLootLockerResponse>::CallAPI(LootLockerEmptyRequest, ULootLockerGameEndpoints::DeletePlayer, {}, EmptyQueryParams, PlayerData, OnCompletedRequest);
}

FString ULootLockerPlayerRequestHandler::ListPlayerInventory(const FLootLockerPlayerData& PlayerData, const FLootLockerListSimplifiedInventoryRequest& Request, int32 PerPage, int32 Page, const FLootLockerSimpleInventoryResponseDelegate& OnCompletedRequest)
{
TMultiMap<FString, FString> QueryParams;
QueryParams.Add("per_page", FString::FromInt(PerPage > 0 ? PerPage : 100));
QueryParams.Add("page", FString::FromInt(Page > 0 ? Page : 1));

return LLAPI<FLootLockerSimpleInventoryResponse>::CallAPI(Request, ULootLockerGameEndpoints::ListPlayerSimpleInventoryEndPoint, {}, QueryParams, PlayerData, OnCompletedRequest);
}

FString ULootLockerPlayerRequestHandler::ListCharacterInventory(const FLootLockerPlayerData& PlayerData, const FLootLockerListSimplifiedInventoryRequest& Request, int32 CharacterId, int32 PerPage, int32 Page, const FLootLockerSimpleInventoryResponseDelegate& OnCompletedRequest)
{
TMultiMap<FString, FString> QueryParams;
if (CharacterId > 0)
{
QueryParams.Add("character_id", FString::FromInt(CharacterId));
}
QueryParams.Add("per_page", FString::FromInt(PerPage > 0 ? PerPage : 100));
QueryParams.Add("page", FString::FromInt(Page > 0 ? Page : 1));

return LLAPI<FLootLockerSimpleInventoryResponse>::CallAPI(Request, ULootLockerGameEndpoints::ListPlayerSimpleInventoryEndPoint, {}, QueryParams, PlayerData, OnCompletedRequest);
}

Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ FLootLockerEndPoints ULootLockerGameEndpoints::ListOtherPlayersFilesEndpoint = I
FLootLockerEndPoints ULootLockerGameEndpoints::GetInfoFromSession = InitEndpoint("player/hazy-hammock/v1/info", ELootLockerHTTPMethod::GET);
FLootLockerEndPoints ULootLockerGameEndpoints::ListPlayerInfo = InitEndpoint("player/hazy-hammock/v1/info", ELootLockerHTTPMethod::POST);
FLootLockerEndPoints ULootLockerGameEndpoints::GetPlayerInventoryEndPoint = InitEndpoint("v1/player/inventory/list", ELootLockerHTTPMethod::GET);
FLootLockerEndPoints ULootLockerGameEndpoints::ListPlayerSimpleInventoryEndPoint = InitEndpoint("player/inventories/v1", ELootLockerHTTPMethod::POST);
FLootLockerEndPoints ULootLockerGameEndpoints::GetCurrencyBalance = InitEndpoint("v1/player/balance", ELootLockerHTTPMethod::GET);
FLootLockerEndPoints ULootLockerGameEndpoints::CheckPlayerAssetActivationEndpoint = InitEndpoint("v1/player/notification/assets", ELootLockerHTTPMethod::GET);
FLootLockerEndPoints ULootLockerGameEndpoints::InitiateDLCMigration = InitEndpoint("v1/player/dlcs", ELootLockerHTTPMethod::POST);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -476,6 +476,22 @@ FString ULootLockerManager::GetFullInventory(const FString ForPlayerWithUlid, in
}), StartIndex, ForPlayerWithUlid);
}

FString ULootLockerManager::ListPlayerInventory(const FString& ForPlayerWithUlid, const FLootLockerListSimplifiedInventoryRequest& Request, int PerPage, const int& Page, const FLootLockerSimpleInventoryResponseBP& OnCompletedRequest)
{
return ULootLockerSDKManager::ListPlayerInventory(Request, PerPage, Page, FLootLockerSimpleInventoryResponseDelegate::CreateLambda([OnCompletedRequest](FLootLockerSimpleInventoryResponse Response)
{
OnCompletedRequest.ExecuteIfBound(Response);
}), ForPlayerWithUlid);
}

FString ULootLockerManager::ListCharacterInventory(const FString& ForPlayerWithUlid, int CharacterId, const FLootLockerListSimplifiedInventoryRequest& Request, int PerPage, const int& Page, const FLootLockerSimpleInventoryResponseBP& OnCompletedRequest)
{
return ULootLockerSDKManager::ListCharacterInventory(CharacterId, Request, PerPage, Page, FLootLockerSimpleInventoryResponseDelegate::CreateLambda([OnCompletedRequest](FLootLockerSimpleInventoryResponse Response)
{
OnCompletedRequest.ExecuteIfBound(Response);
}), ForPlayerWithUlid);
}

FString ULootLockerManager::CheckPlayerAssetActivationNotification(const FString& ForPlayerWithUlid, const FPAssetNotificationResponseBP& OnCheckPlayerAssetDeactivationNotificationRequestCompleted)
{
return ULootLockerSDKManager::CheckPlayerAssetActivationNotification(FLootLockerAssetNotificationResponse::CreateLambda([OnCheckPlayerAssetDeactivationNotificationRequestCompleted](FLootLockerPlayerAssetNotificationResponse Response)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,26 @@ FString ULootLockerSDKManager::GetFullInventory(const FInventoryResponse& OnComp
return ULootLockerPlayerRequestHandler::GetFullInventory(GetSavedStateOrDefaultOrEmptyForPlayer(ForPlayerWithUlid), OnCompletedRequest, StartIndex);
}

FString ULootLockerSDKManager::ListPlayerInventoryWithDefaultParameters(const FLootLockerSimpleInventoryResponseDelegate& OnCompletedRequest, const FString& ForPlayerWithUlid /* = "" */)
{
return ListPlayerInventory(FLootLockerListSimplifiedInventoryRequest(), 0, 0, OnCompletedRequest, ForPlayerWithUlid);
}

FString ULootLockerSDKManager::ListPlayerInventory(const FLootLockerListSimplifiedInventoryRequest& Request, int PerPage, int Page, const FLootLockerSimpleInventoryResponseDelegate& OnCompletedRequest, const FString& ForPlayerWithUlid /* = "" */)
{
return ULootLockerPlayerRequestHandler::ListPlayerInventory(GetSavedStateOrDefaultOrEmptyForPlayer(ForPlayerWithUlid), Request, PerPage, Page, OnCompletedRequest);
}

FString ULootLockerSDKManager::ListCharacterInventoryWithDefaultParameters(int CharacterId, const FLootLockerSimpleInventoryResponseDelegate& OnCompletedRequest, const FString& ForPlayerWithUlid /* = "" */)
{
return ListCharacterInventory(CharacterId, FLootLockerListSimplifiedInventoryRequest(), 0, 0, OnCompletedRequest, ForPlayerWithUlid);
}

FString ULootLockerSDKManager::ListCharacterInventory(int CharacterId, const FLootLockerListSimplifiedInventoryRequest& Request, int PerPage, int Page, const FLootLockerSimpleInventoryResponseDelegate& OnCompletedRequest, const FString& ForPlayerWithUlid /* = "" */)
{
return ULootLockerPlayerRequestHandler::ListCharacterInventory(GetSavedStateOrDefaultOrEmptyForPlayer(ForPlayerWithUlid), Request, CharacterId, PerPage, Page, OnCompletedRequest);
}

FString ULootLockerSDKManager::CheckPlayerAssetActivationNotification(const FLootLockerAssetNotificationResponse& OnCompletedRequest, const FString& ForPlayerWithUlid /* = "" */)
{
return ULootLockerPlayerRequestHandler::CheckPlayerAssetNotification(GetSavedStateOrDefaultOrEmptyForPlayer(ForPlayerWithUlid), OnCompletedRequest);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,73 @@ struct FLootLockerMultiplePlayerNamesAndPlatformsRequest {
TArray<FString> player_public_uids;
};

/**
* A simplified inventory item for optimized inventory listing
*/
USTRUCT(BlueprintType)
struct FLootLockerSimpleInventoryItem
{
GENERATED_BODY()
/**
* The ID of the asset
*/
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "LootLocker")
int32 Asset_id = 0;
/**
* The instance ID of this specific asset instance
*/
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "LootLocker")
int32 Instance_id = 0;
/**
* How this asset was acquired (e.g., purchase, loot_box, etc.)
*/
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "LootLocker")
FString Acquisition_source = "";
/**
* When this asset was acquired
*/
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "LootLocker")
FString Acquisition_date = "";
};

/**
* Request filters for simplified inventory listing
*/
USTRUCT(BlueprintType)
struct FLootLockerListSimplifiedInventoryRequest
{
GENERATED_BODY()
/**
* A list of asset ids to filter the inventory items by
*/
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "LootLocker")
TArray<int32> Asset_ids;
/**
* A list of context ids to filter the inventory items by
*/
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "LootLocker")
TArray<int32> Context_ids;
};

/**
* Response for simplified inventory listing
*/
USTRUCT(BlueprintType)
struct FLootLockerSimpleInventoryResponse : public FLootLockerResponse
{
GENERATED_BODY()
/**
* List of simplified inventory items according to the requested filters
*/
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "LootLocker")
TArray<FLootLockerSimpleInventoryItem> Items;
/**
* Pagination information for the inventory items returned
*/
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "LootLocker")
FLootLockerIndexBasedPagination Pagination;
};

DECLARE_DELEGATE_OneParam(FLootLockerGetCurrentPlayerInfoResponseDelegate, FLootLockerGetCurrentPlayerInfoResponse);

DECLARE_DELEGATE_OneParam(FLootLockerListPlayerInfoResponseDelegate, FLootLockerListPlayerInfoResponse);
Expand All @@ -367,6 +434,8 @@ DECLARE_DELEGATE_OneParam(FPMultiplePlayerNames, FLootLockerMultiplePlayersNames

DECLARE_DELEGATE_OneParam(FPMultiplePlayersPlatformIdsNames, FLootLockerMultiplePlayersPlatformIdsResponse);

DECLARE_DELEGATE_OneParam(FLootLockerSimpleInventoryResponseDelegate, FLootLockerSimpleInventoryResponse);

UCLASS()
class LOOTLOCKERSDK_API ULootLockerPlayerRequestHandler : public UObject
{
Expand All @@ -391,4 +460,8 @@ class LOOTLOCKERSDK_API ULootLockerPlayerRequestHandler : public UObject
static FString LookupMultiplePlayersDataUsingIDs(const FLootLockerPlayerData& PlayerData, FLootLockerLookupMultiplePlayersDataRequest Request, const FPMultiplePlayerNames& OnCompletedRequest);
static FString LookupMultiplePlayerNames1stPlatformIDs(const FLootLockerPlayerData& PlayerData, const FLootLockerMultiplePlayerNamesAndPlatformsRequest& Request, const FPMultiplePlayersPlatformIdsNames& OnCompletedRequest);
static FString DeletePlayer(const FLootLockerPlayerData& PlayerData, const FLootLockerDefaultDelegate OnCompletedRequest);

// Simple inventory listing methods
static FString ListPlayerInventory(const FLootLockerPlayerData& PlayerData, const FLootLockerListSimplifiedInventoryRequest& Request, int32 PerPage, int32 Page, const FLootLockerSimpleInventoryResponseDelegate& OnCompletedRequest);
static FString ListCharacterInventory(const FLootLockerPlayerData& PlayerData, const FLootLockerListSimplifiedInventoryRequest& Request, int32 CharacterId, int32 PerPage, int32 Page, const FLootLockerSimpleInventoryResponseDelegate& OnCompletedRequest);
};
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ class LOOTLOCKERSDK_API ULootLockerGameEndpoints : public UObject
static FLootLockerEndPoints GetInfoFromSession;
static FLootLockerEndPoints ListPlayerInfo;
static FLootLockerEndPoints GetPlayerInventoryEndPoint;
static FLootLockerEndPoints ListPlayerSimpleInventoryEndPoint;
static FLootLockerEndPoints GetCurrencyBalance;
static FLootLockerEndPoints CheckPlayerAssetActivationEndpoint;
static FLootLockerEndPoints CheckPlayerAssetDeactivationEndpoint;
Expand Down
29 changes: 29 additions & 0 deletions LootLockerSDK/Source/LootLockerSDK/Public/LootLockerManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,8 @@ DECLARE_DYNAMIC_DELEGATE_OneParam(FLootLockerGetCurrentPlayerInfoResponseBP, FLo
DECLARE_DYNAMIC_DELEGATE_OneParam(FLootLockerListPlayerInfoResponseBP, FLootLockerListPlayerInfoResponse, Value);
/** Blueprint response delegate for player inventory responses */
DECLARE_DYNAMIC_DELEGATE_OneParam(FPInventoryResponseBP, FLootLockerInventoryResponse, Value);
/** Blueprint response delegate for simple player inventory responses */
DECLARE_DYNAMIC_DELEGATE_OneParam(FLootLockerSimpleInventoryResponseBP, FLootLockerSimpleInventoryResponse, Value);
/** Blueprint response delegate for player asset notification responses */
DECLARE_DYNAMIC_DELEGATE_OneParam(FPAssetNotificationResponseBP, FLootLockerPlayerAssetNotificationResponse, Value);
/** Blueprint response delegate for player balance responses */
Expand Down Expand Up @@ -1226,6 +1228,33 @@ class LOOTLOCKERSDK_API ULootLockerManager : public UObject
UFUNCTION(BlueprintCallable, Category = "LootLocker Methods | Players", meta = (AdvancedDisplay = "ForPlayerWithUlid", ForPlayerWithUlid=""))
static UPARAM(DisplayName = "RequestId") FString GetFullInventory(const FString ForPlayerWithUlid, int32 StartIndex, const FPInventoryResponseBP& OnGetInventoryRequestCompleted);

/**
Get a simplified list of the player's inventory.

@param ForPlayerWithUlid Optional: Execute for the specified player ULID (default player if empty)
@param Request Request object containing any filters to apply to the inventory listing
@param PerPage Number of items to return per page
@param Page Page number to retrieve
@param OnCompletedRequest Delegate for handling the server response
@return A unique id for this request, use this to match callbacks to requests when you have multiple simultaneous requests outbound
*/
UFUNCTION(BlueprintCallable, Category = "LootLocker Methods | Players", meta = (AdvancedDisplay = "ForPlayerWithUlid,Request,PerPage,Page", ForPlayerWithUlid="", PerPage="100", Page="1", AutoCreateRefTerm = "Request"))
static UPARAM(DisplayName = "RequestId") FString ListPlayerInventory(const FString& ForPlayerWithUlid, const FLootLockerListSimplifiedInventoryRequest& Request, int PerPage, const int& Page, const FLootLockerSimpleInventoryResponseBP& OnCompletedRequest);

/**
Get a simplified list of the character's inventory.

@param ForPlayerWithUlid Optional: Execute for the specified player ULID (default player if empty)
@param CharacterId Identifier of the character whose inventory is being requested
@param Request Request object containing any filters to apply to the inventory listing
@param PerPage Number of items to return per page
@param Page Page number to retrieve
@param OnCompletedRequest Delegate for handling the server response
@return A unique id for this request, use this to match callbacks to requests when you have multiple simultaneous requests outbound
*/
UFUNCTION(BlueprintCallable, Category = "LootLocker Methods | Players", meta = (AdvancedDisplay = "ForPlayerWithUlid,Request,PerPage,Page", ForPlayerWithUlid="", PerPage="100", Page="1", AutoCreateRefTerm = "Request"))
static UPARAM(DisplayName = "RequestId") FString ListCharacterInventory(const FString& ForPlayerWithUlid, int CharacterId, const FLootLockerListSimplifiedInventoryRequest& Request, int PerPage, const int& Page, const FLootLockerSimpleInventoryResponseBP& OnCompletedRequest);

/**
Get recently granted player assets since the last activation notification check.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -876,6 +876,50 @@ class LOOTLOCKERSDK_API ULootLockerSDKManager : public UObject
*/
static FString CheckPlayerAssetActivationNotification(const FLootLockerAssetNotificationResponse & OnCompletedRequest, const FString& ForPlayerWithUlid = "");

/**
Get a simplified list of the player's inventory with default parameters.

@param OnCompletedRequest Delegate for handling the server response
@param ForPlayerWithUlid Optional: Execute for the specified player ULID (default player if empty)
@return A unique id for this request, use this to match callbacks to requests when you have multiple simultaneous requests outbound
*/
static FString ListPlayerInventoryWithDefaultParameters(const FLootLockerSimpleInventoryResponseDelegate& OnCompletedRequest, const FString& ForPlayerWithUlid = "");

/**
Get a simplified list of the player's inventory.

@param Request Request object containing any filters to apply to the inventory listing
@param PerPage Number of items to return per page
@param Page Page number to retrieve
@param OnCompletedRequest Delegate for handling the server response
@param ForPlayerWithUlid Optional: Execute for the specified player ULID (default player if empty)
@return A unique id for this request, use this to match callbacks to requests when you have multiple simultaneous requests outbound
*/
static FString ListPlayerInventory(const FLootLockerListSimplifiedInventoryRequest& Request, int PerPage, int Page, const FLootLockerSimpleInventoryResponseDelegate& OnCompletedRequest, const FString& ForPlayerWithUlid = "");

/**
Get a simplified list of the character's inventory with default parameters.

@param CharacterId ID of the character to retrieve inventory for
@param OnCompletedRequest Delegate for handling the server response
@param ForPlayerWithUlid Optional: Execute for the specified player ULID (default player if empty)
@return A unique id for this request, use this to match callbacks to requests when you have multiple simultaneous requests outbound
*/
static FString ListCharacterInventoryWithDefaultParameters(int CharacterId, const FLootLockerSimpleInventoryResponseDelegate& OnCompletedRequest, const FString& ForPlayerWithUlid = "");

/**
Get a simplified list of a character's inventory.

@param CharacterId ID of the character to retrieve inventory for
@param Request Request object containing any filters to apply to the inventory listing
@param PerPage Number of items to return per page
@param Page Page number to retrieve
@param OnCompletedRequest Delegate for handling the server response
@param ForPlayerWithUlid Optional: Execute for the specified player ULID (default player if empty)
@return A unique id for this request, use this to match callbacks to requests when you have multiple simultaneous requests outbound
*/
static FString ListCharacterInventory(int CharacterId, const FLootLockerListSimplifiedInventoryRequest& Request, int PerPage, int Page, const FLootLockerSimpleInventoryResponseDelegate& OnCompletedRequest, const FString& ForPlayerWithUlid = "");

/**
Get the player's current credit / currency balance.

Expand Down