Trigger Reference of GS2-Exchange Script
exchange
Event trigger to call GS2-Script before Exchange.
Request
| Type | Description |  | 
|---|
| namespace | Namespace | Namespace | 
| rateModel | RateModel | Exchange rate model | 
| userId | string | User ID performing the exchange | 
| count | int | Exchanging volume | 
| config | Config[] | Set values to be applied to stamp sheet variables | 
Result
| Type | Require | Default | Limitation | Description |  | 
|---|
| permit | bool | ✓ |  |  | Allow exchange | 
| rate | float |  | 1.0 | ~ 1000 | Acquisition 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
| Type | Description |  | 
|---|
| namespace | Namespace | Namespace | 
| rateModel | RateModel | Exchange rate model | 
| userId | string | User ID performing the exchange | 
| count | int | Exchanging volume | 
| config | Config[] | Set values to be applied to stamp sheet variables | 
Result
| Type | Require | Default | Limitation | Description |  | 
|---|
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
| Type | Description |  | 
|---|
| namespace | Namespace | Namespace | 
| incrementalRateModel | IncrementalRateModel | Cost increase type exchange rate model | 
| currentExchangeCount | int | Current number of exchange counts | 
| quantity | int | Exchange Quantity | 
Result
| Type | Require | Default | Limitation | Description |  | 
|---|
| cost | long | ✓ |  | ~ 9223372036854775805 | Cost | 
Implementation Example
namespace = args.namespace
incrementalRateModel = args.incrementalRateModel
currentExchangeCount = args.currentExchangeCount
quantity = args.quantity
result = {
  cost=cost
}