Auctions
#
Read more about the Auctions system in Hiro here.
Creating a New Auction
#
To create a new auction, use the AuctionsCreate
function.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
| FHiroAuctionCreateRequest Request;
Request.TemplateId = TEXT("template_auction_001");
Request.ConditionId = TEXT("condition_001");
Request.InstanceIds.Add(TEXT("item_instance_001", 1));
FHiroOnAuctionsCreate OnAuctionsCreate;
OnAuctionsCreate.AddDynamic(this, &AMyActor::OnAuctionsCreate);
FOnError OnError;
HiroClient->AuctionsCreate(Session, Request, OnAuctionsCreate, OnError);
void AMyActor::OnAuctionsCreate(const FHiroAuctionCreateRequest& AuctionCreateRequest)
{
UE_LOG(LogTemp, Log, TEXT("%s"), *AuctionCreateRequest.ToJson());
}
|
Placing a Bid on an Auction
#
You can place a bid on an auction using the BidAsync
function.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
| FHiroAuctionBidRequest Request;
Request.Id = TEXT("auction_instance_123");
Request.Version = TEXT("1.0");
Request.Bid.Currencies.Add(TEXT("gold", 1000));
FHiroOnAuctionsBid OnAuctionsBid;
OnAuctionsBid.AddDynamic(this, &AMyActor::OnAuctionsBid);
FOnError OnError;
HiroClient->AuctionsBid(Session, Request, OnAuctionsBid, OnError);
void AMyActor::OnAuctionsBid(const FHiroAuctionBidRequest& AuctionsBidRequest)
{
UE_LOG(LogTemp, Log, TEXT("%s"), *AuctionsBidRequest.ToJson());
}
|
Canceling an Auction
#
If an auction needs to be canceled before it ends, the CancelAsync
method can be used.
1
2
3
4
5
6
7
8
9
10
11
12
13
| FHiroAuctionsCancelRequest Request;
Request.Id = TEXT("auction_instance_123");
FHiroOnAuctionsCancel OnAuctionsCancel;
OnAuctionsCancel.AddDynamic(this, &AMyActor::OnAuctionsCancel);
FOnError OnError;
HiroClient->AuctionsCancel(Session, Request, OnAuctionsCancel, OnError);
void AMyActor::OnAuctionsCancel(const AuctionsCancelRequest& AuctionsCancelRequest)
{
UE_LOG(LogTemp, Log, TEXT("%s"), *AuctionCreateRequest.ToJson());
}
|
Claiming a Winning Bid
#
Once an auction has ended, the winning bidder can claim their item using ClaimBidAsync
.
1
2
3
4
5
6
7
8
9
10
11
12
13
| FHiroAuctionClaimBidRequest Request;
Request.Id = TEXT("auction_instance_123");
FHiroOnAuctionsClaimBid OnAuctionsClaimBid;
OnAuctionsClaimBid.AddDynamic(this, &AMyActor::OnAuctionsClaimBid);
FOnError OnError;
HiroClient->AuctionsClaimBid(Session, Request, OnAuctionsClaimBid, OnError);
void AMyActor::OnAuctionsClaimBid(const FHiroAuctionClaimBidRequest& AuctionsClaimBidRequest)
{
UE_LOG(LogTemp, Log, TEXT("%s"), *AuctionsClaimBidRequest.ToJson());
}
|
Listing Available Auctions
#
You can list the currently available auctions using the ListAsync
function.
1
2
3
4
5
6
7
8
9
10
11
12
| FHiroAuctionListRequest Request;
FHiroOnAuctionsList OnAuctionsList;
OnAuctionsList.AddDynamic(this, &AMyActor::OnAuctionsList);
FOnError OnError;
HiroClient->AuctionsList(Session, Request, OnAuctionsList, OnError);
void AMyActor::OnAuctionsList(const FHiroAuctionListRequest& AuctionsListRequest)
{
UE_LOG(LogTemp, Log, TEXT("%s"), *AuctionsListRequest.ToJson());
}
|