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
TypeDescription
namespaceNamespaceNamespace
rateModelRateModelEnhanced Rate Model
targetItemSetIdstringGRN for the enhanced Item Set
bonusRatefloatExperience bonus multiplier (1.0 = no bonus)
experienceValuelongAmount of experience gained
Result
TypeRequiredDefaultValue LimitsDescription
permitbool
Whether to allow enhancement execution
overrideExperienceValuelong0 ~ 2147483645Amount 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
TypeDescription
namespaceNamespaceNamespace
rateModelRateModelEnhanced Rate Model
targetItemSetIdstringGRN for the enhanced Item Set
bonusRatefloatExperience bonus multiplier (1.0 = no bonus)
experienceValuelongAmount 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 = {
}