GS2-Enhance Script Trigger Reference
Reference of event triggers that call extended scripts
Trigger
enhance
enhancement execution
Synchronous Execution Script
The script is executed synchronously before the enhancement execution process.
Request
| Type | Description | |
|---|---|---|
| namespace | Namespace | Namespace |
| rateModel | RateModel | Enhanced Rate Model |
| targetItemSetId | string | GRN for the enhanced Item Set |
| bonusRate | float | Experience bonus multiplier (1.0 = no bonus) |
| experienceValue | long | Amount of experience gained |
Result
| Type | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|
| permit | bool | ✓ | Whether to allow enhancement execution | ||
| overrideExperienceValue | long | 0 ~ 2147483645 | Amount of gained experience to override |
Implementation Example
-- Request
local namespace = args.namespace
local rateModel = args.rateModel
local targetItemSetId = args.targetItemSetId
local bonusRate = args.bonusRate
local experienceValue = args.experienceValue
-- Business logic:
local permit = true
local overrideExperienceValue = 0
-- Result
result = {
permit=permit,
overrideExperienceValue=overrideExperienceValue
}Asynchronous Execution Script
The script is executed asynchronously after the enhancement execution process.
Request
| Type | Description | |
|---|---|---|
| namespace | Namespace | Namespace |
| rateModel | RateModel | Enhanced Rate Model |
| targetItemSetId | string | GRN for the enhanced Item Set |
| bonusRate | float | Experience bonus multiplier (1.0 = no bonus) |
| experienceValue | long | Amount of experience gained |
Implementation Example
-- Request
local namespace = args.namespace
local rateModel = args.rateModel
local targetItemSetId = args.targetItemSetId
local bonusRate = args.bonusRate
local experienceValue = args.experienceValue
-- Asynchronous scripts typically do not affect the API response.
-- Use for logging, analytics, external notifications, etc.
result = {
}