Trigger Reference of GS2-Exchange Script

Reference of event triggers that call extended scripts

exchange

Event trigger to call GS2-Script before Exchange.

Request

TypeDescription
namespaceNamespaceNamespace
rateModelRateModelExchange rate model
userIdstringUser ID performing the exchange
countintExchanging volume
configConfig[]Set values to be applied to transaction variables

Result

TypeRequireDefaultLimitationDescription
permitboolAllow exchange
rateModestring“float”~ 128 charsRate mode
ratefloat1.0~ 1000Acquisition quantity rate
logRateLogRateLogarithmic acquisition correction

Implementation Example

namespace = args.namespace
rateModel = args.rateModel
userId = args.userId
count = args.count
config = args.config

result = {
  permit=permit,
  rateMode=rateMode,
  rate=rate,
  logRate=logRate
}

exchangeDone

GS2-Script called after Exchange.

Request

TypeDescription
namespaceNamespaceNamespace
rateModelRateModelExchange rate model
userIdstringUser ID performing the exchange
countintExchanging volume
configConfig[]Set values to be applied to transaction variables

Result

TypeRequireDefaultLimitationDescription

Implementation Example

namespace = args.namespace
rateModel = args.rateModel
userId = args.userId
count = args.count
config = args.config

result = {
}

incrementalExchange

Event trigger to call GS2-Script before Exchange.

Request

TypeDescription
namespaceNamespaceNamespace
rateModelIncrementalRateModelExchange rate model
userIdstringUser ID performing the exchange
countintExchanging volume
configConfig[]Set values to be applied to transaction variables

Result

TypeRequireDefaultLimitationDescription
permitboolAllow exchange

Implementation Example

namespace = args.namespace
rateModel = args.rateModel
userId = args.userId
count = args.count
config = args.config

result = {
  permit=permit
}

incrementalExchangeDone

GS2-Script called after Exchange.

Request

TypeDescription
namespaceNamespaceNamespace
rateModelIncrementalRateModelExchange rate model
userIdstringUser ID performing the exchange
countintExchanging volume
configConfig[]Set values to be applied to transaction variables

Result

TypeRequireDefaultLimitationDescription

Implementation Example

namespace = args.namespace
rateModel = args.rateModel
userId = args.userId
count = args.count
config = args.config

result = {
}

calculateCost

Event trigger to call GS2-Script when Costing Scripts for Cost Increase Type Exchange Rate.

Request

TypeDescription
namespaceNamespaceNamespace
incrementalRateModelIncrementalRateModelCost increase type exchange rate model
userIdstringUser Id
currentExchangeCountintCurrent number of exchange counts
quantityintExchange Quantity

Result

TypeRequireDefaultLimitationDescription
costModestring“num”~ 128 charsCost calculation method
costlong~ 9223372036854775805Cost
logCostLogCostCost calculation result using logarithm

Implementation Example

namespace = args.namespace
incrementalRateModel = args.incrementalRateModel
userId = args.userId
currentExchangeCount = args.currentExchangeCount
quantity = args.quantity

result = {
  costMode=costMode,
  cost=cost,
  logCost=logCost
}

acquireAwait

Event trigger to call GS2-Script before Await.

Request

TypeDescription
namespaceNamespaceNamespace
rateModelRateModelReceive rate model
awaitModelAwaitAwait

Result

TypeRequireDefaultLimitationDescription
permitboolAllow receive

Implementation Example

namespace = args.namespace
rateModel = args.rateModel
awaitModel = args.awaitModel

result = {
  permit=permit
}

acquireAwaitDone

GS2-Script called after Await.

Request

TypeDescription
namespaceNamespaceNamespace
rateModelRateModelReceive rate model
awaitModelAwaitAwait

Result

TypeRequireDefaultLimitationDescription

Implementation Example

namespace = args.namespace
rateModel = args.rateModel
awaitModel = args.awaitModel

result = {
}