GS2-Showcase

Product sales function

This function is used to sell products in the game.

The difference from GS2-Exchange is that there is a Showcase. DisplayItem can be displayed on the Showcase, and the price required to purchase DisplayItem and the reward for purchasing the item can be set.

There are two types of display shelves: the “Standard Showcase”, which displays a fixed number of DisplayItems, and the “Random Showcase”, which randomly selects DisplayItem items at regular intervals.

Standard Showcase

In the standard Showcase, all the DisplayItems you specify are displayed. There are two types of DisplayItem: “SalesItem” and “SalesItemGroup”.

SalesItem

A SalesItem is a display item that contains the price required to purchase the item as well as the reward for making the purchase.

SalesItemGroup

SalesItemGroup is a system that changes the SalesItem to be sold according to the number of purchases.

A SalesItemGroup can have multiple SalesItems belonging to it, except for the last item on the list, for which a GS2-Limit counter increase must be set as the compensation. When a SalesItemGroup is displayed on a Showcase, the internal SalesItem is determined if it is available for purchase, and the first item determined to be available is displayed.

By using this function, it is possible to sell products at half price for the first purchase only, or to realize products that increase in price with each purchase, or to add an extra item for the 10th purchase. This feature can be used to realize products such as

Random Showcase

In the Random Showcase, a specified number of DisplayItem items specified in the master data are randomly drawn and displayed. The result of the drawing is retained for a certain period of time, and the same list is responded to until the reset timing is reached.

The reset timing can be set in hourly intervals of up to 7 days.

For each DisplayItem, the “number of times available for purchase” and “lottery weight” can be set. The number of purchases is the number of times the item can be purchased before the next reset timing, and the lottery weight is the probability of the item being drawn.

Suppose that three products are registered and the following settings are used.

NameDrawing Weight
Product A1
Product B1
Product C2

In this case, the probability that a product is drawn is

NameExhaustion probability
Product A25%
Product B25%
Product C50%

and so on.

If the random draw shelf is set to display a maximum of two products out of three, the drawing for the first DisplayItem will be based on the above probabilities, but the drawing for the second DisplayItem will be based on the list from which the already drawn DisplayItem was removed. The second DisplayItem will be drawn from the list from which the already drawn DisplayItem was removed.

For example, if “Item C” is selected in the first drawing, the drawing for the second DisplayItem will be based on the following probabilities.

NameDrawing WeightExclusion Probability
Product A150%
Product B150%

Notes on “Maximum number of items to be selected”

The name of the field specifying the number of products to be selected is 《Maximum Number of Products to be Selected》, In principle, the number of selected items will never be less than the number specified here.

Exceptionally, if the number of DisplayItem settings is less than the number specified in “Maximum number of selected products,” fewer products than the value specified here will be selected.

Forced Redraw

A “Random Shelf Redraw” is available as a transactional reward action that can be set in the AcquireActions of various microservices. GS2-Showcase and GS2-Exchange can be used for monetization by “selling redraws”.

Example of implementation

Standard Showcase

Get the Showcase

    var item = await gs2.Showcase.Namespace(
        namespaceName: "namespace-0001"
    ).Me(
        gameSession: GameSession
    ).Showcase(
        showcaseName: "showcase-0001"
    ).ModelAsync();
    const auto Domain = Gs2->Showcase->Namespace(
        "namespace-0001" // namespaceName
    )->Me(
        AccessToken
    )->Showcase(
        "showcase-0001" // showcaseName
    );
    const auto item = Domain.Model();

item

    var result = await gs2.Showcase.Namespace(
        namespaceName: "namespace-0001"
    ).Me(
        gameSession: GameSession
    ).Showcase(
        showcaseName: "showcase-0001"
    ).BuyAsync(
        displayItemId: "display-item-0001",
        quantity: 1,
    );
    const auto Domain = Gs2->Showcase->Namespace(
        "namespace-0001" // namespaceName
    )->Me(
        AccessToken
    )->Showcase(
        "showcase-0001" // showcaseName
    );
    const auto Future = Domain->Buy(
        "display-item-0001", // displayItemId
        nullptr, // quantity
        nullptr // config
    );
    Future->StartSynchronousTask();
    if (!TestFalse(WHAT, Future->GetTask().IsError())) return false;

Random Showcase

Get Showcase.

    var items = await gs2.Showcase.Namespace(
        namespaceName: "namespace-0001"
    ).Me(
        gameSession: GameSession
    ).RandomShowcase(
        showcaseName: "showcase-0001"
    ).RandomDisplayItemsAsync(
    ).ToListAsync();
    const auto It = Gs2->Showcase->Namespace(
        "namespace-0001" // namespaceName
    )->Me(
        AccessToken
    )->RandomShowcase(
        "showcase-0001" // showcaseName
    )->RandomDisplayItems(
    );
    for (auto Item : *It)
    {

    }

Buy Item

    var result = await gs2.Showcase.Namespace(
        namespaceName: "namespace-0001"
    ).Me(
        gameSession: GameSession
    ).RandomShowcase(
        showcaseName: "showcase-0001"
    ).RandomDisplayItem(
        displayItemName: "display-item-0001"
    ).RandomShowcaseBuyAsync(
        quantity: 1,
        config: null
    );
    const auto Future = Gs2->Showcase->Namespace(
        "namespace-0001" // namespaceName
    )->Me(
        AccessToken
    )->RandomShowcase(
        "showcase-0001" // showcaseName
    )->RandomDisplayItem(
        "display-item-0001" // displayItemName
    )->RandomShowcaseBuy(
        1, // quantity
        nullptr // config
    );
    Future->StartSynchronousTask();
    if (Future->GetTask().IsError())
    {
        return false;
    }

Advanced Reference