Economy
#
Read more about the Economy system in Hiro here.
Donation claim
#
Claim one or more rewards which are partially or full donated by other players.
1
2
3
4
5
6
7
8
9
10
11
12
13
| FHiroEconomyDonationClaimRequest Request;
Request.Items = {TEXT("donation_1"), TEXT("donation_2")};
FHiroOnEconomyDonationClaim OnEconomyDonationClaim;
OnEconomyDonationClaim.AddDynamic(this, &AMyActor::OnEconomyDonationClaim);
FOnError OnError;
HiroClient->EconomyDonationCLaim(Session, Request, OnEconomyDonationClaim, OnError);
void AMyActor::OnEconomyDonationClaim(const FHiroEconomyDonationClaimRewards& EconomyDonationClaimRewards)
{
UE_LOG(LogTemp, Log, TEXT("%s"), *EconomyDonationClaimRewards.ToJson());
}
|
Donate to a user
#
Donate some resource (currencies, items, etc.) to a user by donation ID.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
| FHiroEconomyDonationGiveRequest Request;
Request.UserId = TEXT("user_1");
Request.DonationId = TEXT("donation_1");
FHiroOnEconomyDonationGive OnEconomyDonationGive;
OnEconomyDonationGive.AddDynamic(this, &AMyActor::OnEconomyDonationGive);
FOnError OnError;
HiroClient->EconomyDonationGive(Session, Request, OnEconomyDonationGive, OnError);
void AMyActor::OnEconomyDonationGive(const FHiroEconomyUpdateAck& EconomyUpdateAck)
{
UE_LOG(LogTemp, Log, TEXT("%s"), *EconomyUpdateAck.ToJson());
}
|
Get donation progress
#
Get progress on one or more donations for a set of players by their IDs.
1
2
3
4
5
6
7
8
9
10
11
12
13
| FHiroEconomyDonationGetRequest Request;
Request.Ids = {TEXT("donation_1"), TEXT("donation_2")};
FHiroOnEconomyDonationGet OnEconomyDonationGet;
OnEconomyDonationGet.AddDynamic(this, &AMyActor::OnEconomyDonationGet);
FOnError OnError;
HiroClient->EconomyDonationGet(Session, Request, OnEconomyDonationGet, OnError);
void AMyActor::OnEconomyDonationGet(const FHiroEconomyDonationsByUserList& EconomyDonationsByUserList)
{
UE_LOG(LogTemp, Log, TEXT("%s"), *EconomyDonationsByUserList.ToJson());
}
|
Request a donation
#
Request a donation which other players can contribute into.
1
2
3
4
5
6
7
8
9
10
11
12
13
| FHiroEconomyDonationRequest Request;
Request.DonationId = TEXT("donation_1");
FHiroOnEconomyDonationRequest OnEconomyDonationRequest;
OnEconomyDonationRequest.AddDynamic(this, &AMyActor::OnEconomyDonationRequest);
FOnError OnError;
HiroClient->EconomyDonationRequest(Session, Request, OnEconomyDonationRequest, OnError);
void AMyActor::OnEconomyDonationRequest(const FHiroEconomyDonationAck& EconomyDonationAck)
{
UE_LOG(LogTemp, Log, TEXT("%s"), *EconomyDonationAck.ToJson());
}
|
Get store items
#
Get all store items defined in the Virtual Store.
1
2
3
4
5
6
7
8
9
10
11
12
13
| FHiroEconomyListRequest Request;
Request.StoreType = EHiroEconomyStoreType::ECONOMY_STORE_TYPE_APPLE_APPSTORE;
FHiroOnEconomyStoreGet OnEconomyStoreGet;
OnEconomyStoreGet.AddDynamic(this, &AMyActor::OnEconomyStoreGet);
FOnError OnError;
HiroClient->EconomyStoreGet(Session, Request, OnEconomyStoreGet, OnError);
void AMyActor::OnEconomyStoreGet(const FHiroEconomyList& EconomyList)
{
UE_LOG(LogTemp, Log, TEXT("%s"), *EconomyList.ToJson());
}
|
Grant currencies or reward modifiers
#
Grant one or more currencies or reward modifiers to the player.
1
2
3
4
5
6
7
8
9
10
11
12
13
| FHiroEconomyGrantRequest Request;
Request.Currencies.Add(TEXT("coins"), 100);
FHiroOnEconomyGrant OnEconomyGrant;
OnEconomyGrant.AddDynamic(this, &AMyActor::OnEconomyGrant);
FOnError OnError;
HiroClient->EconomyGrant(Session, Request, OnEconomyGrant, OnError);
void AMyActor::OnEconomyGrant(const FHiroEconomyUpdateAck& EconomyUpdateAck)
{
UE_LOG(LogTemp, Log, TEXT("%s"), *EconomyUpdateAck.ToJson());
}
|
Send a purchase intent
#
Send a marker of intent to purchase by the player.
1
2
3
4
5
6
7
8
9
10
| FHiroEconomyPurchaseIntentRequest Request;
Request.ItemId = TEXT("item_1");
Request.StoreType = EHiroEconomyStoreType::ECONOMY_STORE_TYPE_APPLE_APPSTORE;
Request.Sku = TEXT("sku_1");
FHiroOnEconomyPurchaseIntent OnEconomyPurchaseIntent;
OnEconomyPurchaseIntent.AddDynamic(this, &AMyActor::OnEconomyPurchaseIntent);
FOnError OnError;
HiroClient->EconomyPurchaseIntent(Session, Request, OnEconomyPurchaseIntent, OnError);
|
Purchase a store item
#
Purchase a store item by the player.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
| FHiroEconomyPurchaseRequest Request;
Request.ItemId = TEXT("item_1");
Request.StoreType = EHiroEconomyStoreType::ECONOMY_STORE_TYPE_APPLE_APPSTORE;
Request.Receipt = TEXT("<receipt>");
FHiroOnEconomyPurchaseItem OnEconomyPurchaseItem;
OnEconomyPurchaseItem.AddDynamic(this, &AMyActor::OnEconomyPurchaseItem);
FOnError OnError;
HiroClient->EconomyPurchaseItem(Session, Request, OnEconomyPurchaseItem, OnError);
void AMyActor::OnEconomyPurchaseItem(const FHiroEconomyPurchaseAck& EconomyPurchaseAck)
{
UE_LOG(LogTemp, Log, TEXT("%s"), *EconomyPurchaseAck.ToJson());
}
|
Get ad placement status
#
Get the current status on an Ad placement which may have been rewarded.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
| FHiroEconomyPlacementStatusRequest Request;
Request.RewardId = TEXT("reward_1");
Request.PlacementId = TEXT("placement_1");
Request.Count = 0;
FHiroOnEconomyPlacementStatus OnEconomyPlacementStatus;
OnEconomyPlacementStatus.AddDynamic(this, &AMyActor::OnEconomyPlacementStatus);
FOnError OnError;
HiroClient->EconomyPlacementStatus(Session, Request, OnEconomyPlacementStatus, OnError);
void AMyActor::OnEconomyPlacementStatus(const FHiroEconomyPlacementStatus& EconomyPlacementStatus)
{
UE_LOG(LogTemp, Log, TEXT("%s"), *EconomyPlacementStatus.ToJson());
}
|
Start a new ad placement
#
Start a new Ad placement by placement ID.
1
2
3
4
5
6
7
8
9
10
11
12
13
| FHiroEconomyPlacementStartRequest Request;
Request.PlacementId = TEXT("placement_1");
FHiroOnEconomyPlacementStart OnEconomyPlacementStart;
OnEconomyPlacementStart.AddDynamic(this, &AMyActor::OnEconomyPlacementStart);
FOnError OnError;
HiroClient->EconomyPlacementStart(Session, Request, OnEconomyPlacementStart, OnError);
void AMyActor::OnEconomyPlacementStart(const FHiroEconomyPlacementStatus& EconomyPlacementStatus)
{
UE_LOG(LogTemp, Log, TEXT("%s"), *EconomyPlacementStatus.ToJson());
}
|
Placement success
#
Webhook RPC to handle Rewarded Video Ad placement success callbacks.
1
2
3
4
5
| FHiroOnEconomyPlacementSuccess OnEconomyPlacementSuccess;
OnEconomyPlacementSuccess.AddDynamic(this, &AMyActor::OnEconomyPlacementSuccess);
FOnError OnError;
HiroClient->EconomyPlacementSuccess(Session, OnEconomyPlacementSuccess, OnError);
|
Placement fail
#
Webhook RPC to handle Rewarded Video Ad placement failure callbacks.
1
2
3
4
5
| FHiroOnEconomyPlacementFail OnEconomyPlacementFail;
OnEconomyPlacementFail.AddDynamic(this, &AMyActor::OnEconomyPlacementFail);
FOnError OnError;
HiroClient->EconomyPlacementFail(Session, OnEconomyPlacementFail, OnError);
|