API Reference of GS2-Enhance SDK for Game Engine

Specifications of models and API references for GS2-SDK for Game Engine

Model

EzRateModel

Enhancement Rate Model

The enhancement rate is data that defines the materials used for enhancement and the target of enhancement.

Both material data and enhancement target data must be managed in GS2-Inventory. The experience value obtained from the enhancement is recorded in GS2-Inventory metadata in JSON format. Here, it is necessary to describe at which level of the metadata the experience value is stored.

A correction value can be applied to the amount of experience value that can be obtained with a certain probability of great success during enhancement. The probability of that draw is also defined in this entity.

TypeRequireDefaultLimitationDescription
namestring~ 128 charsEnhanced Rate Name
metadatastring~ 2048 charsmetadata
targetInventoryModelIdstring~ 1024 charsInventory available for enhancement targets
acquireExperienceSuffixstring~ 1024 charsSuffix to be assigned to the property ID that stores the experience value obtained from GS2-Experience
materialInventoryModelIdstring~ 1024 charsGRN of item sets (quantity of items held per expiration date) that will be used as materials for enhancement.
acquireExperienceHierarchyList<string>~ 10 itemsHierarchical structure of JSON data defining acquisition experience values to be stored in ItemModel metadata
experienceModelIdstring~ 1024 charsExperience Model GRN

EzProgress

Enhance Progress

It is created at the beginning of the enhance and deleted at the end.

When you exit the application in the middle of an enhance, this data will remain. It is possible to resume the game from the ongoing enhance information maintained by the entity.

TypeRequireDefaultLimitationDescription
namestringUUID~ 36 charsConduct ID
rateNamestring~ 128 charsRate Model Name
propertyIdstring~ 1024 charsProperty ID to be enhanced
experienceValuelong~ 9223372036854775805Experience value
ratefloat~ 100.0Experience value scale factor

EzConfig

Configration

Set values to be applied to transaction variables

TypeRequireDefaultLimitationDescription
keystring~ 64 charsName
valuestring~ 51200 charsValue

EzMaterial

Balance Parameter Value Model

TypeRequireDefaultLimitationDescription
materialItemSetIdstring~ 1024 charsGRN of item sets (quantity of items held per expiration date) that will be used as materials for enhancement
countint1~ 2147483645Number of consumption

EzVerifyActionResult

Verify action execution result

TypeRequireDefaultLimitationDescription
actionenum {
}
~ 128 charsTypes of actions to be performed in the verify task
verifyRequeststring~ 1048576 charsJSON of request
statusCodeint~ 999Status code
verifyResultstring~ 1048576 charsResult payload

Enumeration type definition to specify as action

Enumerator String DefinitionDescription

EzConsumeActionResult

Consume action execution result

TypeRequireDefaultLimitationDescription
actionenum {
}
~ 128 charsTypes of actions to be performed in the consume action
consumeRequeststring~ 1048576 charsJSON of request
statusCodeint~ 999Status code
consumeResultstring~ 1048576 charsResult payload

Enumeration type definition to specify as action

Enumerator String DefinitionDescription

EzAcquireActionResult

Acquire action execution result

TypeRequireDefaultLimitationDescription
actionenum {
}
~ 128 charsTypes of actions to be performed in the acquire action
acquireRequeststring~ 1048576 charsJSON of request
statusCodeint~ 999Status code
acquireResultstring~ 1048576 charsResult payload

Enumeration type definition to specify as action

Enumerator String DefinitionDescription

EzTransactionResult

Transaction execution results

Transaction execution results executed using server-side transaction auto-execution functionality

TypeRequireDefaultLimitationDescription
transactionIdstring36 ~ 36 charsTransaction ID
verifyResultsList<EzVerifyActionResult>~ 10 itemsList of verify action execution results
consumeResultsList<EzConsumeActionResult>~ 10 itemsList of consume action execution results
acquireResultsList<EzAcquireActionResult>~ 100 itemsList of acquire action execution results

Methods

getRateModel

Obtain enhanced rate model information

Request

TypeRequireDefaultLimitationDescription
namespaceNamestring~ 128 charsNamespace name
rateNamestring~ 128 charsEnhanced Rate Name

Result

TypeDescription
itemEzRateModelEnhanced Rate Model

Implementation Example

    var domain = gs2.Enhance.Namespace(
        namespaceName: "namespace-0001"
    ).RateModel(
        rateName: "character-level"
    );
    var item = await domain.ModelAsync();
    var domain = gs2.Enhance.Namespace(
        namespaceName: "namespace-0001"
    ).RateModel(
        rateName: "character-level"
    );
    var future = domain.ModelFuture();
    yield return future;
    var item = future.Result;
    const auto Domain = Gs2->Enhance->Namespace(
        "namespace-0001" // namespaceName
    )->RateModel(
        "character-level" // rateName
    );
    const auto Future = Domain->Model();
    Future->StartSynchronousTask();
    if (Future->GetTask().IsError())
    {
        return false;
    }
Value change event handling
    var domain = gs2.Enhance.Namespace(
        namespaceName: "namespace-0001"
    ).RateModel(
        rateName: "character-level"
    );
    
    // Start event handling
    var callbackId = domain.Subscribe(
        value => {
            // Called when the value changes
            // The "value" is passed the value after the change.
        }
    );

    // Stop event handling
    domain.Unsubscribe(callbackId);
    var domain = gs2.Enhance.Namespace(
        namespaceName: "namespace-0001"
    ).RateModel(
        rateName: "character-level"
    );
    var future = domain.ModelFuture();
    yield return future;
    var item = future.Result;
    const auto Domain = Gs2->Enhance->Namespace(
        "namespace-0001" // namespaceName
    )->RateModel(
        "character-level" // rateName
    );
    
    // Start event handling
    const auto CallbackId = Domain->Subscribe(
        [](TSharedPtr<Gs2::Enhance::Model::FRateModel> value) {
            // Called when the value changes
            // The "value" is passed the value after the change.
        }
    );

    // Stop event handling
    Domain->Unsubscribe(CallbackId);

listRateModels

Get list of enhanced rate model information

Request

TypeRequireDefaultLimitationDescription
namespaceNamestring~ 128 charsNamespace name

Result

TypeDescription
itemsList<EzRateModel>List of Enhanced Rate Model

Implementation Example

    var domain = gs2.Enhance.Namespace(
        namespaceName: "namespace-0001"
    );
    var items = await domain.RateModelsAsync(
    ).ToListAsync();
    var domain = gs2.Enhance.Namespace(
        namespaceName: "namespace-0001"
    );
    var it = domain.RateModels(
    );
    List<EzRateModel> items = new List<EzRateModel>();
    while (it.HasNext())
    {
        yield return it.Next();
        if (it.Error != null)
        {
            onError.Invoke(it.Error, null);
            break;
        }
        if (it.Current != null)
        {
            items.Add(it.Current);
        }
        else
        {
            break;
        }
    }
    const auto Domain = Gs2->Enhance->Namespace(
        "namespace-0001" // namespaceName
    );
    const auto It = Domain->RateModels(
    );
    TArray<Gs2::UE5::Enhance::Model::FEzRateModelPtr> Result;
    for (auto Item : *It)
    {
        if (Item.IsError())
        {
            return false;
        }
        Result.Add(Item.Current());
    }
Value change event handling
    var domain = gs2.Enhance.Namespace(
        namespaceName: "namespace-0001"
    );
    
    // Start event handling
    var callbackId = domain.SubscribeRateModels(
        () => {
            // Called when an element of the list changes.
        }
    );

    // Stop event handling
    domain.UnsubscribeRateModels(callbackId);
    var domain = gs2.Enhance.Namespace(
        namespaceName: "namespace-0001"
    );
    var it = domain.RateModels(
    );
    List<EzRateModel> items = new List<EzRateModel>();
    while (it.HasNext())
    {
        yield return it.Next();
        if (it.Error != null)
        {
            onError.Invoke(it.Error, null);
            break;
        }
        if (it.Current != null)
        {
            items.Add(it.Current);
        }
        else
        {
            break;
        }
    }
    const auto Domain = Gs2->Enhance->Namespace(
        "namespace-0001" // namespaceName
    );
    
    // Start event handling
    const auto CallbackId = Domain->SubscribeRateModels(
        []() {
            // Called when an element of the list changes.
        }
    );

    // Stop event handling
    Domain->UnsubscribeRateModels(CallbackId);

deleteProgress

Delete reinforcement progress information.

Use this option if you want to explicitly remove progress information rather than using the force option at the start of the reinforcement.

Request

TypeRequireDefaultLimitationDescription
namespaceNamestring~ 128 charsNamespace name
accessTokenstring~ 128 charsAccess token

Result

TypeDescription
itemEzProgressRunning enhancement

Implementation Example

    var domain = gs2.Enhance.Namespace(
        namespaceName: "namespace-0001"
    ).Me(
        gameSession: GameSession
    ).Progress(
    );
    var result = await domain.DeleteProgressAsync(
    );
    var domain = gs2.Enhance.Namespace(
        namespaceName: "namespace-0001"
    ).Me(
        gameSession: GameSession
    ).Progress(
    );
    var future = domain.DeleteProgressFuture(
    );
    yield return future;
    if (future.Error != null)
    {
        onError.Invoke(future.Error, null);
        yield break;
    }
    const auto Domain = Gs2->Enhance->Namespace(
        "namespace-0001" // namespaceName
    )->Me(
        GameSession
    )->Progress(
    );
    const auto Future = Domain->DeleteProgress(
    );
    Future->StartSynchronousTask();
    if (Future->GetTask().IsError())
    {
        return false;
    }
    const auto Result = Future->GetTask().Result();

end

Reported completion of enhancements

Request

TypeRequireDefaultLimitationDescription
namespaceNamestring~ 128 charsNamespace name
accessTokenstring~ 128 charsAccess token
configList<EzConfig>[]~ 32 itemsSet values to be applied to transaction variables

Result

TypeDescription
itemEzProgressRunning enhancement
transactionIdstringIssed transaction ID
stampSheetstringStamp sheet used to execute the reward granting process
stampSheetEncryptionKeyIdstringCryptographic key GRN used for stamp sheet signature calculations
autoRunStampSheetboolIs transaction auto-execution enabled?
atomicCommitboolTransaction to commit atomically
transactionstringIssued transaction
transactionResultEzTransactionResultTransaction execution result
acquireExperiencelongAmount of experience gained
bonusRatefloatExperience bonus multiplier (1.0 = no bonus)

Implementation Example

    var domain = gs2.Enhance.Namespace(
        namespaceName: "namespace-0001"
    ).Me(
        gameSession: GameSession
    ).Progress(
    );
    var result = await domain.EndAsync(
        config: null
    );
    // In New Experience, stamp sheets are automatically executed at the SDK level.
    // If an error occurs, a TransactionException is thrown.
    // you can retry with TransactionException::Retry().
    var domain = gs2.Enhance.Namespace(
        namespaceName: "namespace-0001"
    ).Me(
        gameSession: GameSession
    ).Progress(
    );
    var future = domain.EndFuture(
        config: null
    );
    yield return future;
    if (future.Error != null)
    {
        onError.Invoke(future.Error, null);
        yield break;
    }
    // In New Experience, stamp sheets are automatically executed at the SDK level.
    // If an error occurs, a TransactionException is thrown.
    // you can retry with TransactionException::Retry().
    const auto Domain = Gs2->Enhance->Namespace(
        "namespace-0001" // namespaceName
    )->Me(
        GameSession
    )->Progress(
    );
    const auto Future = Domain->End(
        // config
    );
    Future->StartSynchronousTask();
    if (Future->GetTask().IsError())
    {
        return false;
    }

getProgress

Obtain information on the progress of the enhancement.

Request

TypeRequireDefaultLimitationDescription
namespaceNamestring~ 128 charsNamespace name
accessTokenstring~ 128 charsAccess token

Result

TypeDescription
itemEzProgressRunning enhancement

Implementation Example

    var domain = gs2.Enhance.Namespace(
        namespaceName: "namespace-0001"
    ).Me(
        gameSession: GameSession
    ).Progress(
    );
    var item = await domain.ModelAsync();
    var domain = gs2.Enhance.Namespace(
        namespaceName: "namespace-0001"
    ).Me(
        gameSession: GameSession
    ).Progress(
    );
    var future = domain.ModelFuture();
    yield return future;
    var item = future.Result;
    const auto Domain = Gs2->Enhance->Namespace(
        "namespace-0001" // namespaceName
    )->Me(
        GameSession
    )->Progress(
    );
    const auto Future = Domain->Model();
    Future->StartSynchronousTask();
    if (Future->GetTask().IsError())
    {
        return false;
    }
Value change event handling
    var domain = gs2.Enhance.Namespace(
        namespaceName: "namespace-0001"
    ).Me(
        gameSession: GameSession
    ).Progress(
    );
    
    // Start event handling
    var callbackId = domain.Subscribe(
        value => {
            // Called when the value changes
            // The "value" is passed the value after the change.
        }
    );

    // Stop event handling
    domain.Unsubscribe(callbackId);
    var domain = gs2.Enhance.Namespace(
        namespaceName: "namespace-0001"
    ).Me(
        gameSession: GameSession
    ).Progress(
    );
    var future = domain.ModelFuture();
    yield return future;
    var item = future.Result;
    const auto Domain = Gs2->Enhance->Namespace(
        "namespace-0001" // namespaceName
    )->Me(
        GameSession
    )->Progress(
    );
    
    // Start event handling
    const auto CallbackId = Domain->Subscribe(
        [](TSharedPtr<Gs2::Enhance::Model::FProgress> value) {
            // Called when the value changes
            // The "value" is passed the value after the change.
        }
    );

    // Stop event handling
    Domain->Unsubscribe(CallbackId);

start

Start enhancements

Request

TypeRequireDefaultLimitationDescription
namespaceNamestring~ 128 charsNamespace name
rateNamestring~ 128 charsRate Model Name
targetItemSetIdstring~ 1024 charsGRN for the item set to be enhanced (number of items held per validity period)
materialsList<EzMaterial>~ 10 itemsList of materials
accessTokenstring~ 128 charsAccess token
forceboolfalseIf there is an enhancement that has already been started, it can be discarded and started, or
configList<EzConfig>[]~ 32 itemsSet values to be applied to transaction variables

Result

TypeDescription
transactionIdstringIssed transaction ID
stampSheetstringStamp sheet used to execute the reinforcement initiation process
stampSheetEncryptionKeyIdstringCryptographic key GRN used for stamp sheet signature calculations
autoRunStampSheetboolIs transaction auto-execution enabled?
atomicCommitboolTransaction to commit atomically
transactionstringIssued transaction
transactionResultEzTransactionResultTransaction execution result

Implementation Example

    var domain = gs2.Enhance.Namespace(
        namespaceName: "namespace-0001"
    ).Me(
        gameSession: GameSession
    ).Progress(
    );
    var result = await domain.StartAsync(
        rateName: "character-level",
        targetItemSetId: "item-set-0001",
        materials: new List<Gs2.Unity.Gs2Enhance.Model.EzMaterial> {
            new Gs2.Unity.Gs2Enhance.Model.EzMaterial() {
                MaterialItemSetId = "material-0001",
                Count = 1,
            },
        },
        force: null,
        config: null
    );
    // In New Experience, stamp sheets are automatically executed at the SDK level.
    // If an error occurs, a TransactionException is thrown.
    // you can retry with TransactionException::Retry().
    var domain = gs2.Enhance.Namespace(
        namespaceName: "namespace-0001"
    ).Me(
        gameSession: GameSession
    ).Progress(
    );
    var future = domain.StartFuture(
        rateName: "character-level",
        targetItemSetId: "item-set-0001",
        materials: new List<Gs2.Unity.Gs2Enhance.Model.EzMaterial> {
            new Gs2.Unity.Gs2Enhance.Model.EzMaterial() {
                MaterialItemSetId = "material-0001",
                Count = 1,
            },
        },
        force: null,
        config: null
    );
    yield return future;
    if (future.Error != null)
    {
        onError.Invoke(future.Error, null);
        yield break;
    }
    // In New Experience, stamp sheets are automatically executed at the SDK level.
    // If an error occurs, a TransactionException is thrown.
    // you can retry with TransactionException::Retry().
    const auto Domain = Gs2->Enhance->Namespace(
        "namespace-0001" // namespaceName
    )->Me(
        GameSession
    )->Progress(
    );
    const auto Future = Domain->Start(
        "character-level", // rateName
        "item-set-0001", // targetItemSetId
        []
        {
            auto v = MakeShared<TArray<TSharedPtr<Gs2::UE5::Enhance::Model::FEzMaterial>>>();
            v->Add(
                MakeShared<Gs2::UE5::Enhance::Model::FEzMaterial>()
                ->WithMaterialItemSetId(TOptional<FString>("material-0001"))
                ->WithCount(TOptional<int32>(1))
            );
            return v;
        }() // materials
        // force
        // config
    );
    Future->StartSynchronousTask();
    if (Future->GetTask().IsError())
    {
        return false;
    }

enhance

Perform enhancements

Request

TypeRequireDefaultLimitationDescription
namespaceNamestring~ 128 charsNamespace name
rateNamestring~ 128 charsEnhanced Rate Name
accessTokenstring~ 128 charsAccess token
targetItemSetIdstring~ 1024 charsGRN for the item set to be enhanced (number of items held per validity period)
materialsList<EzMaterial>1 ~ 10 itemsList of Material
configList<EzConfig>[]~ 32 itemsSet values to be applied to transaction variables

Result

TypeDescription
itemEzRateModelEnhanced Rate Model
transactionIdstringIssed transaction ID
stampSheetstringStamp sheet used to perform the enhancement process
stampSheetEncryptionKeyIdstringCryptographic key GRN used for stamp sheet signature calculations
autoRunStampSheetboolIs transaction auto-execution enabled?
atomicCommitboolTransaction to commit atomically
transactionstringIssued transaction
transactionResultEzTransactionResultTransaction execution result
acquireExperiencelongAmount of experience gained
bonusRatefloatExperience bonus multiplier (1.0 = no bonus)

Implementation Example

    var domain = gs2.Enhance.Namespace(
        namespaceName: "namespace-0001"
    ).Me(
        gameSession: GameSession
    ).Enhance(
    );
    var result = await domain.EnhanceAsync(
        rateName: "rate-0001",
        targetItemSetId: "item-set-0001",
        materials: new List<Gs2.Unity.Gs2Enhance.Model.EzMaterial> {
            new Gs2.Unity.Gs2Enhance.Model.EzMaterial() {
                MaterialItemSetId = "material-0001",
                Count = 1,
            },
        },
        config: null
    );
    // In New Experience, stamp sheets are automatically executed at the SDK level.
    // If an error occurs, a TransactionException is thrown.
    // you can retry with TransactionException::Retry().
    var domain = gs2.Enhance.Namespace(
        namespaceName: "namespace-0001"
    ).Me(
        gameSession: GameSession
    ).Enhance(
    );
    var future = domain.EnhanceFuture(
        rateName: "rate-0001",
        targetItemSetId: "item-set-0001",
        materials: new List<Gs2.Unity.Gs2Enhance.Model.EzMaterial> {
            new Gs2.Unity.Gs2Enhance.Model.EzMaterial() {
                MaterialItemSetId = "material-0001",
                Count = 1,
            },
        },
        config: null
    );
    yield return future;
    if (future.Error != null)
    {
        onError.Invoke(future.Error, null);
        yield break;
    }
    // In New Experience, stamp sheets are automatically executed at the SDK level.
    // If an error occurs, a TransactionException is thrown.
    // you can retry with TransactionException::Retry().
    const auto Domain = Gs2->Enhance->Namespace(
        "namespace-0001" // namespaceName
    )->Me(
        GameSession
    )->Enhance(
    );
    const auto Future = Domain->Enhance(
        "rate-0001", // rateName
        "item-set-0001", // targetItemSetId
        []
        {
            auto v = MakeShared<TArray<TSharedPtr<Gs2::UE5::Enhance::Model::FEzMaterial>>>();
            v->Add(
                MakeShared<Gs2::UE5::Enhance::Model::FEzMaterial>()
                ->WithMaterialItemSetId(TOptional<FString>("material-0001"))
                ->WithCount(TOptional<int32>(1))
            );
            return v;
        }() // materials
        // config
    );
    Future->StartSynchronousTask();
    if (Future->GetTask().IsError())
    {
        return false;
    }