Documentation index for AI agents

GS2-Enchant Transaction Actions

Specification of verify/consume/acquire transaction actions

Combining actions, and concurrency

The background common to every service is collected in Combining Transaction Actions. Read that first; the rest of this section is what GS2-Enchant adds to it.

The transaction actions of GS2-Enchant address two kinds of status, both identified by the combination of namespace, user, parameter model, and property. Each is rewritten as a whole on every update.

  • Balance parameter status
  • Rarity parameter status
OperationRepeated in one transactionAcross a nested transactionBoundary that separates targets
Redrawing a balance parameter
ReDrawBalanceParameterStatusByUserId
Rejected when the transaction is issued, even if the requests are identicalFailsnamespace, user, parameter model, property (balance)
Setting a balance parameter
SetBalanceParameterStatusByUserId
Combined if equal; rejected when the transaction is issued if the values differFailsnamespace, user, parameter model, property (balance)
Redrawing a rarity parameter
ReDrawRarityParameterStatusByUserId
Rejected when the transaction is issued, even if the requests are identicalFailsnamespace, user, parameter model, property (rarity)
Adding to a rarity parameter
AddRarityParameterStatusByUserId
Combined, and the counts are added upFailsnamespace, user, parameter model, property (rarity)
Setting a rarity parameter
SetRarityParameterStatusByUserId
Combined if equal; rejected when the transaction is issued if the values differFailsnamespace, user, parameter model, property (rarity)
Verifying
VerifyRarityParameterStatusByUserId
First winsNo collision, because it only readsstatus, verify type, parameter name, count

Only an addition to a rarity parameter carries a value that can be added up. A redraw and a set replace the whole status, so they cannot sit alongside another row on the same status.

A redraw redraws the whole status, so you cannot specify two or more redraws against the same status. Two redraws that are identical down to the parameters they fix are still rejected when the transaction is issued. Treat “redraw twice” as something that cannot be expressed.

A balance parameter status and a rarity parameter status are separate targets even for the same property, so updating both in one transaction is fine.

Verify actions look at the status as of the start of the transaction. You cannot verify a parameter that is reached by the same transaction.

Take care with nested transactions

Even two additions to the same rarity parameter, which would have been combined if written side by side, make the transaction fail when one of them arrives from the inside. Take the contents of any rewards or draws into account as well, and design so that only one place in a transaction updates one status.

Redraws are rejected when the transaction is issued if they are written side by side, and when the transaction runs if one of them arrives from the inside. Only the point at which the error is raised differs, so keep a redraw of one status to a single place in a transaction.

If you want to avoid these restrictions

Every action of GS2-Enchant that updates a status is an acquire action, so turning acquireActionUseJobQueue on clears all of the collisions above.

Duplicates that are rejected when the transaction is issued are the exception: redraws written side by side, and sets written side by side with different values. Both are rejected before the acquireActionUseJobQueue check, so turning it on does not help. If you want to redraw the same status twice, split the transaction itself.

Concurrency and retries

A status is rewritten as a whole with a revision check, so when several requests update the same status at the same time, the one confirmed later returns a conflict (409). Nothing is wrong with the request, so retrying will succeed.

This gets more likely the more places enchant the same property at once, so serialise updates to one status where you can.


Verify Action

Gs2Enchant:VerifyRarityParameterStatusByUserId

Verify rarity parameter by User ID

Verifies that a rarity parameter status of the specified user meets the specified condition. Three verification types are supported:

  • ‘have’: Verifies that the specified parameter value exists in the status
  • ‘havent’: Verifies that the specified parameter value does not exist in the status
  • ‘count’: Verifies that the number of parameters matches the specified count This can be used as a precondition check before executing other actions.

Quantity specification supported: YES

TypeConditionRequiredDefaultValue LimitsDescription
namespaceNamestring
~ 128 charsNamespace name
Unique Namespace name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.).
parameterNamestring
~ 128 charsRarity Parameter Model name
The name of the Rarity Parameter Model that defines the drawing conditions for this status. References the model that specifies the maximum parameter count, count lottery weights, and value lottery pool.
userIdstring
~ 128 charsUser ID
Specify #{userId} to substitute the currently logged-in user’s ID.
propertyIdstring
~ 1024 charsProperty ID of the resource that owns the parameter
Identifies the specific game resource (e.g., a weapon or equipment item) to which these rarity parameters are attached. Typically references a GS2-Inventory item or similar resource via its property ID.
verifyTypestring (enum)
enum {
  “havent”,
  “have”,
  “count”
}
Type of verification
DefinitionDescription
haventThe specified parameter must not be held
haveThe specified parameter must be held
countThe number of parameters held must be the specified number
parameterValueNamestring{verifyType} in [“havent”, “have”]
✓*
~ 64 charsName
The identifier for this lottery entry. Must be unique within the rarity parameter model’s value pool. When drawn, this name is stored in the resulting Rarity Parameter Value.
* Required if verifyType is “havent”,“have”
parameterCountint{verifyType} == “count”
✓*
0 ~ 10Number of parameters to verify
* Required if verifyType is “count”
multiplyValueSpecifyingQuantityboolfalseWhether to multiply the value used for verification when specifying the quantity
timeOffsetTokenstring~ 1024 charsTime offset token
{
    "action": "Gs2Enchant:VerifyRarityParameterStatusByUserId",
    "request": {
        "namespaceName": "[string]Namespace name",
        "parameterName": "[string]Rarity Parameter Model name",
        "userId": "[string]User ID",
        "propertyId": "[string]Property ID of the resource that owns the parameter",
        "verifyType": "[string]Type of verification",
        "parameterValueName": "[string]Name",
        "parameterCount": "[int]Number of parameters to verify",
        "multiplyValueSpecifyingQuantity": "[bool]Whether to multiply the value used for verification when specifying the quantity",
        "timeOffsetToken": "[string]Time offset token"
    }
}
action: Gs2Enchant:VerifyRarityParameterStatusByUserId
request:
  namespaceName: "[string]Namespace name"
  parameterName: "[string]Rarity Parameter Model name"
  userId: "[string]User ID"
  propertyId: "[string]Property ID of the resource that owns the parameter"
  verifyType: "[string]Type of verification"
  parameterValueName: "[string]Name"
  parameterCount: "[int]Number of parameters to verify"
  multiplyValueSpecifyingQuantity: "[bool]Whether to multiply the value used for verification when specifying the quantity"
  timeOffsetToken: "[string]Time offset token"
transaction.service("enchant").verify.verify_rarity_parameter_status_by_user_id({
    namespaceName="[string]Namespace name",
    parameterName="[string]Rarity Parameter Model name",
    userId="[string]User ID",
    propertyId="[string]Property ID of the resource that owns the parameter",
    verifyType="[string]Type of verification",
    parameterValueName="[string]Name",
    parameterCount="[int]Number of parameters to verify",
    multiplyValueSpecifyingQuantity="[bool]Whether to multiply the value used for verification when specifying the quantity",
    timeOffsetToken="[string]Time offset token",
})

Acquire Action

Gs2Enchant:ReDrawBalanceParameterStatusByUserId

Re-draw balance parameter by User ID

Re-draws the balance parameter values for a specific property, redistributing the total value among the parameters. Specific parameters can be fixed (locked) to prevent them from being re-drawn by specifying their names in fixedParameterNames (up to 10). The total value constraint is maintained: the sum of all parameter values (including fixed ones) always equals the model’s total value. Both the updated and previous parameter states are returned.

Quantity specification supported: NO

Reversible action: NO

TypeConditionRequiredDefaultValue LimitsDescription
namespaceNamestring
~ 128 charsNamespace name
Unique Namespace name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.).
userIdstring
~ 128 charsUser ID
Specify #{userId} to substitute the currently logged-in user’s ID.
parameterNamestring
~ 128 charsBalance Parameter Model name
The name of the Balance Parameter Model that defines the drawing conditions for this status. References the model that specifies the total value, allocation strategy, and available parameter slots.
propertyIdstring
~ 1024 charsProperty ID of the resource that owns the parameter
Identifies the specific game resource (e.g., a weapon or equipment item) to which these balance parameters are attached. Typically references a GS2-Inventory item or similar resource via its property ID.
fixedParameterNamesList<string>[]0 ~ 10 itemsList of Parameter index not to re-draw
timeOffsetTokenstring~ 1024 charsTime offset token
{
    "action": "Gs2Enchant:ReDrawBalanceParameterStatusByUserId",
    "request": {
        "namespaceName": "[string]Namespace name",
        "userId": "[string]User ID",
        "parameterName": "[string]Balance Parameter Model name",
        "propertyId": "[string]Property ID of the resource that owns the parameter",
        "fixedParameterNames": [
            "[string]Parameter name not to re-draw"
        ],
        "timeOffsetToken": "[string]Time offset token"
    }
}
action: Gs2Enchant:ReDrawBalanceParameterStatusByUserId
request:
  namespaceName: "[string]Namespace name"
  userId: "[string]User ID"
  parameterName: "[string]Balance Parameter Model name"
  propertyId: "[string]Property ID of the resource that owns the parameter"
  fixedParameterNames: 
    - "[string]Parameter name not to re-draw"
  timeOffsetToken: "[string]Time offset token"
transaction.service("enchant").acquire.re_draw_balance_parameter_status_by_user_id({
    namespaceName="[string]Namespace name",
    userId="[string]User ID",
    parameterName="[string]Balance Parameter Model name",
    propertyId="[string]Property ID of the resource that owns the parameter",
    fixedParameterNames={
        "[string]Parameter name not to re-draw"
    },
    timeOffsetToken="[string]Time offset token",
})

Gs2Enchant:SetBalanceParameterStatusByUserId

Set any value to Balance Parameter Status by User ID

Directly sets parameter values for a specific property of the specified user, bypassing the normal draw/re-draw mechanism. This is an administrative operation that allows arbitrary parameter values to be assigned. Both the updated and previous parameter states are returned.

Quantity specification supported: NO

Reversible action: NO

TypeConditionRequiredDefaultValue LimitsDescription
namespaceNamestring
~ 128 charsNamespace name
Unique Namespace name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.).
userIdstring
~ 128 charsUser ID
Specify #{userId} to substitute the currently logged-in user’s ID.
parameterNamestring
~ 128 charsBalance Parameter Model name
The name of the Balance Parameter Model that defines the drawing conditions for this status. References the model that specifies the total value, allocation strategy, and available parameter slots.
propertyIdstring
~ 1024 charsProperty ID of the resource that owns the parameter
Identifies the specific game resource (e.g., a weapon or equipment item) to which these balance parameters are attached. Typically references a GS2-Inventory item or similar resource via its property ID.
parameterValuesList<BalanceParameterValue>
1 ~ 10 itemsList of balance parameter values
The concrete values assigned to each parameter slot after the drawing process. Each entry corresponds to a parameter slot defined in the model and contains the actual numeric value allocated. The sum of all values equals the total value specified in the model.
timeOffsetTokenstring~ 1024 charsTime offset token
{
    "action": "Gs2Enchant:SetBalanceParameterStatusByUserId",
    "request": {
        "namespaceName": "[string]Namespace name",
        "userId": "[string]User ID",
        "parameterName": "[string]Balance Parameter Model name",
        "propertyId": "[string]Property ID of the resource that owns the parameter",
        "parameterValues": [
            {
                "name": "[string]Name",
                "value": "[long]Value"
            }
        ],
        "timeOffsetToken": "[string]Time offset token"
    }
}
action: Gs2Enchant:SetBalanceParameterStatusByUserId
request:
  namespaceName: "[string]Namespace name"
  userId: "[string]User ID"
  parameterName: "[string]Balance Parameter Model name"
  propertyId: "[string]Property ID of the resource that owns the parameter"
  parameterValues: 
    - name: "[string]Name"
      value: "[long]Value"
  timeOffsetToken: "[string]Time offset token"
transaction.service("enchant").acquire.set_balance_parameter_status_by_user_id({
    namespaceName="[string]Namespace name",
    userId="[string]User ID",
    parameterName="[string]Balance Parameter Model name",
    propertyId="[string]Property ID of the resource that owns the parameter",
    parameterValues={
        {
            name="[string]Name",
            value="[long]Value"
        }
    },
    timeOffsetToken="[string]Time offset token",
})

Gs2Enchant:ReDrawRarityParameterStatusByUserId

Re-draw Rarity Parameter Status by User ID

Re-draws the rarity parameter values for a specific property, randomly assigning new values based on the rarity weights. Specific parameters can be fixed (locked) to prevent them from being re-drawn by specifying their names in fixedParameterNames (up to 10). Fixed parameters retain their current values while unfixed parameters are re-drawn. Both the updated and previous parameter states are returned.

Quantity specification supported: NO

Reversible action: NO

TypeConditionRequiredDefaultValue LimitsDescription
namespaceNamestring
~ 128 charsNamespace name
Unique Namespace name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.).
userIdstring
~ 128 charsUser ID
Specify #{userId} to substitute the currently logged-in user’s ID.
parameterNamestring
~ 128 charsRarity Parameter Model name
The name of the Rarity Parameter Model that defines the drawing conditions for this status. References the model that specifies the maximum parameter count, count lottery weights, and value lottery pool.
propertyIdstring
~ 1024 charsProperty ID of the resource that owns the parameter
Identifies the specific game resource (e.g., a weapon or equipment item) to which these rarity parameters are attached. Typically references a GS2-Inventory item or similar resource via its property ID.
fixedParameterNamesList<string>0 ~ 10 itemsList of Parameter index not to re-draw
timeOffsetTokenstring~ 1024 charsTime offset token
{
    "action": "Gs2Enchant:ReDrawRarityParameterStatusByUserId",
    "request": {
        "namespaceName": "[string]Namespace name",
        "userId": "[string]User ID",
        "parameterName": "[string]Rarity Parameter Model name",
        "propertyId": "[string]Property ID of the resource that owns the parameter",
        "fixedParameterNames": [
            "[string]Parameter name not to re-draw"
        ],
        "timeOffsetToken": "[string]Time offset token"
    }
}
action: Gs2Enchant:ReDrawRarityParameterStatusByUserId
request:
  namespaceName: "[string]Namespace name"
  userId: "[string]User ID"
  parameterName: "[string]Rarity Parameter Model name"
  propertyId: "[string]Property ID of the resource that owns the parameter"
  fixedParameterNames: 
    - "[string]Parameter name not to re-draw"
  timeOffsetToken: "[string]Time offset token"
transaction.service("enchant").acquire.re_draw_rarity_parameter_status_by_user_id({
    namespaceName="[string]Namespace name",
    userId="[string]User ID",
    parameterName="[string]Rarity Parameter Model name",
    propertyId="[string]Property ID of the resource that owns the parameter",
    fixedParameterNames={
        "[string]Parameter name not to re-draw"
    },
    timeOffsetToken="[string]Time offset token",
})

Gs2Enchant:AddRarityParameterStatusByUserId

Add Rarity Parameter Status by User ID

Adds new parameter slots to an existing rarity parameter status by randomly drawing values based on the rarity weights. The count specifies how many parameter slots to add (1 to 10), up to the model’s maximum parameter count. Both the updated and previous parameter states are returned.

Quantity specification supported: YES

Reversible action: NO

TypeConditionRequiredDefaultValue LimitsDescription
namespaceNamestring
~ 128 charsNamespace name
Unique Namespace name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.).
userIdstring
~ 128 charsUser ID
Specify #{userId} to substitute the currently logged-in user’s ID.
parameterNamestring
~ 128 charsRarity Parameter Model name
The name of the Rarity Parameter Model that defines the drawing conditions for this status. References the model that specifies the maximum parameter count, count lottery weights, and value lottery pool.
propertyIdstring
~ 1024 charsProperty ID of the resource that owns the parameter
Identifies the specific game resource (e.g., a weapon or equipment item) to which these rarity parameters are attached. Typically references a GS2-Inventory item or similar resource via its property ID.
countint11 ~ 10Number of parameters to add
timeOffsetTokenstring~ 1024 charsTime offset token
{
    "action": "Gs2Enchant:AddRarityParameterStatusByUserId",
    "request": {
        "namespaceName": "[string]Namespace name",
        "userId": "[string]User ID",
        "parameterName": "[string]Rarity Parameter Model name",
        "propertyId": "[string]Property ID of the resource that owns the parameter",
        "count": "[int]Number of parameters to add",
        "timeOffsetToken": "[string]Time offset token"
    }
}
action: Gs2Enchant:AddRarityParameterStatusByUserId
request:
  namespaceName: "[string]Namespace name"
  userId: "[string]User ID"
  parameterName: "[string]Rarity Parameter Model name"
  propertyId: "[string]Property ID of the resource that owns the parameter"
  count: "[int]Number of parameters to add"
  timeOffsetToken: "[string]Time offset token"
transaction.service("enchant").acquire.add_rarity_parameter_status_by_user_id({
    namespaceName="[string]Namespace name",
    userId="[string]User ID",
    parameterName="[string]Rarity Parameter Model name",
    propertyId="[string]Property ID of the resource that owns the parameter",
    count="[int]Number of parameters to add",
    timeOffsetToken="[string]Time offset token",
})

Gs2Enchant:SetRarityParameterStatusByUserId

Set any value to rarity parameter by User ID

Directly sets parameter values for a specific property of the specified user, bypassing the normal draw/re-draw mechanism. This is an administrative operation that allows arbitrary parameter values to be assigned regardless of rarity weights. Both the updated and previous parameter states are returned.

Quantity specification supported: NO

Reversible action: NO

TypeConditionRequiredDefaultValue LimitsDescription
namespaceNamestring
~ 128 charsNamespace name
Unique Namespace name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.).
userIdstring
~ 128 charsUser ID
Specify #{userId} to substitute the currently logged-in user’s ID.
parameterNamestring
~ 128 charsRarity Parameter Model name
The name of the Rarity Parameter Model that defines the drawing conditions for this status. References the model that specifies the maximum parameter count, count lottery weights, and value lottery pool.
propertyIdstring
~ 1024 charsProperty ID of the resource that owns the parameter
Identifies the specific game resource (e.g., a weapon or equipment item) to which these rarity parameters are attached. Typically references a GS2-Inventory item or similar resource via its property ID.
parameterValuesList<RarityParameterValue>0 ~ 10 itemsList of rarity parameter values
The concrete parameter values selected through weighted lottery for each granted slot. The number of entries is determined by the parameter count draw, and each entry’s value is selected from the value model pool. May contain fewer entries than the maximum parameter count.
timeOffsetTokenstring~ 1024 charsTime offset token
{
    "action": "Gs2Enchant:SetRarityParameterStatusByUserId",
    "request": {
        "namespaceName": "[string]Namespace name",
        "userId": "[string]User ID",
        "parameterName": "[string]Rarity Parameter Model name",
        "propertyId": "[string]Property ID of the resource that owns the parameter",
        "parameterValues": [
            {
                "name": "[string]Name",
                "resourceName": "[string]Resource Name",
                "resourceValue": "[long]Resource Value"
            }
        ],
        "timeOffsetToken": "[string]Time offset token"
    }
}
action: Gs2Enchant:SetRarityParameterStatusByUserId
request:
  namespaceName: "[string]Namespace name"
  userId: "[string]User ID"
  parameterName: "[string]Rarity Parameter Model name"
  propertyId: "[string]Property ID of the resource that owns the parameter"
  parameterValues: 
    - name: "[string]Name"
      resourceName: "[string]Resource Name"
      resourceValue: "[long]Resource Value"
  timeOffsetToken: "[string]Time offset token"
transaction.service("enchant").acquire.set_rarity_parameter_status_by_user_id({
    namespaceName="[string]Namespace name",
    userId="[string]User ID",
    parameterName="[string]Rarity Parameter Model name",
    propertyId="[string]Property ID of the resource that owns the parameter",
    parameterValues={
        {
            name="[string]Name",
            resourceName="[string]Resource Name",
            resourceValue="[long]Resource Value"
        }
    },
    timeOffsetToken="[string]Time offset token",
})