GS2-Experience Script Trigger Reference
Reference of event triggers that call extended scripts
Trigger
rankCapScript
obtaining rank caps
Synchronous Execution Script
The script is executed synchronously before the obtaining rank caps process.
Request
| Type | Description | |
|---|---|---|
| namespace | Namespace | Namespace |
| experienceModel | ExperienceModel | Experience Model |
| userId | string | User ID |
| propertyId | string | Property ID A developer-defined identifier that uniquely identifies this status within the user’s scope. It is recommended to use a value that appends an experience model suffix to the GS2-Inventory Item Set GRN or GS2-Dictionary Entry GRN that possesses the experience. |
Result
| Type | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|
| rankCap | long | ✓ | 0 ~ 2147483645 | rank cap |
Implementation Example
-- Request
local namespace = args.namespace
local experienceModel = args.experienceModel
local userId = args.userId
local propertyId = args.propertyId
-- Business logic:
local rankCap = 0
-- Result
result = {
rankCap=rankCap
}changeExperience
experience value changes
Synchronous Execution Script
The script is executed synchronously before the experience value changes process.
Request
| Type | Description | |
|---|---|---|
| namespace | Namespace | Namespace |
| experienceModel | ExperienceModel | Experience Model |
| status | Status | Status before change |
| afterStatus | Status | Status after change |
Result
| Type | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|
| permit | bool | ✓ | Whether to allow experience value changes | ||
| overrideExperienceValue | long | ✓ | 0 ~ 2147483645 | Overriding experience value |
Implementation Example
-- Request
local namespace = args.namespace
local experienceModel = args.experienceModel
local status = args.status
local afterStatus = args.afterStatus
-- Business logic:
local permit = true
local overrideExperienceValue = 0
-- Result
result = {
permit=permit,
overrideExperienceValue=overrideExperienceValue
}Asynchronous Execution Script
The script is executed asynchronously after the experience value changes process.
Request
| Type | Description | |
|---|---|---|
| namespace | Namespace | Namespace |
| experienceModel | ExperienceModel | Experience Model |
| oldStatus | Status | Status before change |
| status | Status | Status |
Implementation Example
-- Request
local namespace = args.namespace
local experienceModel = args.experienceModel
local oldStatus = args.oldStatus
local status = args.status
-- Asynchronous scripts typically do not affect the API response.
-- Use for logging, analytics, external notifications, etc.
result = {
}changeRank
rank changes
Synchronous Execution Script
The script is executed synchronously before the rank changes process.
Request
| Type | Description | |
|---|---|---|
| namespace | Namespace | Namespace |
| experienceModel | ExperienceModel | Experience Model |
| status | Status | Status before change |
| afterStatus | Status | Status after change |
Result
| Type | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|
| permit | bool | ✓ | Whether to allow rank changes |
Implementation Example
-- Request
local namespace = args.namespace
local experienceModel = args.experienceModel
local status = args.status
local afterStatus = args.afterStatus
-- Business logic:
local permit = true
-- Result
result = {
permit=permit
}Asynchronous Execution Script
The script is executed asynchronously after the rank changes process.
Request
| Type | Description | |
|---|---|---|
| namespace | Namespace | Namespace |
| experienceModel | ExperienceModel | Experience Model |
| oldStatus | Status | Status before change |
| status | Status | Status |
Implementation Example
-- Request
local namespace = args.namespace
local experienceModel = args.experienceModel
local oldStatus = args.oldStatus
local status = args.status
-- Asynchronous scripts typically do not affect the API response.
-- Use for logging, analytics, external notifications, etc.
result = {
}changeRankCap
Rank cap changes
Synchronous Execution Script
The script is executed synchronously before the rank cap changes process.
Request
| Type | Description | |
|---|---|---|
| namespace | Namespace | Namespace |
| experienceModel | ExperienceModel | Experience Model |
| status | Status | Status before change |
| afterStatus | Status | Status after change |
Result
| Type | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|
| permit | bool | ✓ | Whether to allow rank cap change | ||
| overrideRankCapValue | long | ✓ | 0 ~ 2147483645 | New rank cap |
Implementation Example
-- Request
local namespace = args.namespace
local experienceModel = args.experienceModel
local status = args.status
local afterStatus = args.afterStatus
-- Business logic:
local permit = true
local overrideRankCapValue = 0
-- Result
result = {
permit=permit,
overrideRankCapValue=overrideRankCapValue
}Asynchronous Execution Script
The script is executed asynchronously after the rank cap changes process.
Request
| Type | Description | |
|---|---|---|
| namespace | Namespace | Namespace |
| experienceModel | ExperienceModel | Experience Model |
| status | Status | Status |
Implementation Example
-- Request
local namespace = args.namespace
local experienceModel = args.experienceModel
local status = args.status
-- Asynchronous scripts typically do not affect the API response.
-- Use for logging, analytics, external notifications, etc.
result = {
}overflowExperience
Experience overflow
Synchronous Execution Script
The script is executed synchronously before the experience overflow process.
Request
| Type | Description | |
|---|---|---|
| namespace | Namespace | Namespace |
| experienceModel | ExperienceModel | Experience Model |
| status | Status | Status |
| overflowExperienceValue | long | Experience overflow value |
Result
| Type | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|
| permit | bool | ✓ | Whether to allow experience overflow |
Implementation Example
-- Request
local namespace = args.namespace
local experienceModel = args.experienceModel
local status = args.status
local overflowExperienceValue = args.overflowExperienceValue
-- Business logic:
local permit = true
-- Result
result = {
permit=permit
}