GS2 Blog

Game Server Services(https://gs2.io/) の最新情報をお届けします

GS2-Inventory のシンプルインベントリに入手・消費時のスクリプトを設定できるようになりました

はじめに

GS2-Inventory はプレイヤーの所持品を管理するマイクロサービスです。
なかでも、シンプルインベントリはアイテム所持数の上限やインベントリの容量といった機能は持たない代わりに複数のアイテムをまとめて増減できる特徴があります。

機能の詳細は以下の記事を参照ください。

gs2.hatenablog.com

スクリプトは、GS2 内のマイクロサービスで何かイベントが生じた時に追加の処理をする仕組みです。
GS2-Script に Lua で定義したスクリプト、もしくは Amazon Event Bridge を使用して AWS 上で処理を実行できます。

追加された機能の詳細

これまでスタンダードインベントリの増減時のスクリプトは定義可能でしたが、シンプルインベントリに関しては未対応でした。
今回シンプルインベントリもスクリプトの実行に対応しました。

入手時に実行されるスクリプト

namespace = args.namespace
inventoryName = args.inventoryName
simpleItems = args.simpleItems
userId = args.userId
acquireCounts = args.acquireCounts

result = {
  permit=permit,
  overrideAcquireCounts=overrideAcquireCounts
}

消費時に実行されるスクリプト

namespace = args.namespace
inventoryName = args.inventoryName
simpleItems = args.simpleItems
userId = args.userId
consumeCounts = args.consumeCounts

result = {
  permit=permit,
  overrideConsumeCounts=overrideConsumeCounts
}
(C) Game Server Services, Inc.