Trigger Reference of GS2-Exchange Script

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 stamp sheet variables

Result

TypeRequireDefaultLimitationDescription
permitboolAllow exchange
ratefloat1.0~ 1000Acquisition quantity rate

Implementation Example

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

result = {
  permit=permit,
  rate=rate
}

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 stamp sheet 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
currentExchangeCountintCurrent number of exchange counts
quantityintExchange Quantity

Result

TypeRequireDefaultLimitationDescription
costlong~ 9223372036854775805Cost

Implementation Example

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

result = {
  cost=cost
}