> For the complete documentation index, see [llms.txt](/llms.txt)

# GS2-Inventory 스크립트 트리거 레퍼런스

확장 스크립트를 호출하는 이벤트 트리거의 레퍼런스



## 트리거

### acquire



**관련 메서드:**
acquireItemSetByUserId - 사용자 ID를 지정하여 아이템 세트 입수
acquireItemSetWithGradeByUserId - 사용자 ID를 지정하여 GS2-Grade에 그레이드를 설정하면서 아이템 세트를 1개 입수


#### 동기 실행 스크립트

 처리 전에, 스크립트가 동기 실행됩니다.

##### Request

| | 타입 | 설명 |
| --- | --- | --- |
| namespace | [Namespace](../sdk/#namespace) | 네임스페이스 |
| inventory | [Inventory](../sdk/#inventory) | 인벤토리 |
| itemSets | [ItemSet[]](../sdk/#itemset) | 아이템 세트 리스트 |
| acquireItemName | string | 입수한 아이템 모델 이름 |
| userId | string | 사용자ID |
| acquireCount | long | 입수 수량 |
| expiresAt | long | 유효기간<br>UNIX 시간·밀리초 |

##### Result

|  | 타입 | 필수 | 기본값 | 값 제한 | 설명 |
| --- | --- | --- | --- | --- | --- |
| permit | bool | ✓ |  |  | 아이템 입수를 허용할지 여부 |
| overrideAcquireCount | int |  |  | 0 ~ 2147483645 | 실제로 적용할 입수량 |

##### 구현 예제


**Lua**
```lua

-- Request
local namespace = args.namespace
local inventory = args.inventory
local itemSets = args.itemSets
local acquireItemName = args.acquireItemName
local userId = args.userId
local acquireCount = args.acquireCount
local expiresAt = args.expiresAt

-- Business logic:
local permit = true
local overrideAcquireCount = 0

-- Result
result = {
  permit=permit,
  overrideAcquireCount=overrideAcquireCount
}
```


#### 비동기 실행 스크립트

 처리 후에, 스크립트가 비동기 실행됩니다.

##### Request

| | 타입 | 설명 |
| --- | --- | --- |
| namespace | [Namespace](../sdk/#namespace) | 네임스페이스 |
| oldInventory | [Inventory](../sdk/#inventory) | 갱신 전 인벤토리 |
| oldItemSets | [ItemSet[]](../sdk/#itemset) | 갱신 전 아이템 세트 리스트 |
| newInventory | [Inventory](../sdk/#inventory) | 갱신 후 인벤토리 |
| newItemSets | [ItemSet[]](../sdk/#itemset) | 갱신 후 아이템 세트 리스트 |
| acquireItemName | string | 입수한 아이템 모델 이름 |
| userId | string | 사용자ID |
| acquireCount | long | 입수 수량 |
| overflowValue | long | 넘친 양 |
| expiresAt | long | 유효기간<br>UNIX 시간·밀리초 |


##### 구현 예제


**Lua**
```lua

-- Request
local namespace = args.namespace
local oldInventory = args.oldInventory
local oldItemSets = args.oldItemSets
local newInventory = args.newInventory
local newItemSets = args.newItemSets
local acquireItemName = args.acquireItemName
local userId = args.userId
local acquireCount = args.acquireCount
local overflowValue = args.overflowValue
local expiresAt = args.expiresAt

-- 비동기 스크립트는 일반적으로 API 응답에 영향을 주지 않습니다.
-- 로그 출력이나 분석, 외부 알림 등에 사용됩니다.

result = {
}
```


---
  
### overflowDone



**관련 메서드:**
acquireItemSetByUserId - 사용자 ID를 지정하여 아이템 세트 입수
acquireItemSetWithGradeByUserId - 사용자 ID를 지정하여 GS2-Grade에 그레이드를 설정하면서 아이템 세트를 1개 입수


#### 동기 실행 스크립트

 처리 전에, 스크립트가 동기 실행됩니다.

##### Request

| | 타입 | 설명 |
| --- | --- | --- |
| namespace | [Namespace](../sdk/#namespace) | 네임스페이스 |
| inventory | [Inventory](../sdk/#inventory) | 인벤토리 |
| itemModel | [ItemModel](../sdk/#itemmodel) | 아이템 모델 |
| userId | string | 사용자ID |
| overflowValue | long | 넘친 양 |


##### 구현 예제


**Lua**
```lua

-- Request
local namespace = args.namespace
local inventory = args.inventory
local itemModel = args.itemModel
local userId = args.userId
local overflowValue = args.overflowValue

-- Business logic:

-- Result
result = {
}
```


---
  
### consume



**관련 메서드:**
consumeItemSet - 아이템 세트를 소비
consumeItemSetByUserId - 사용자 ID를 지정하여 아이템 세트를 소비


#### 동기 실행 스크립트

 처리 전에, 스크립트가 동기 실행됩니다.

##### Request

| | 타입 | 설명 |
| --- | --- | --- |
| namespace | [Namespace](../sdk/#namespace) | 네임스페이스 |
| inventory | [Inventory](../sdk/#inventory) | 인벤토리 |
| itemSets | [ItemSet[]](../sdk/#itemset) | 아이템 세트 리스트 |
| consumeItemName | string | 소비한 아이템 모델 이름 |
| userId | string | 사용자ID |
| consumeCount | long | 소비 수량 |

##### Result

|  | 타입 | 필수 | 기본값 | 값 제한 | 설명 |
| --- | --- | --- | --- | --- | --- |
| permit | bool | ✓ |  |  | 아이템 소비를 허용할지 여부 |
| overrideConsumeCount | int |  |  | 0 ~ 2147483645 | 실제로 적용할 소비량 |

##### 구현 예제


**Lua**
```lua

-- Request
local namespace = args.namespace
local inventory = args.inventory
local itemSets = args.itemSets
local consumeItemName = args.consumeItemName
local userId = args.userId
local consumeCount = args.consumeCount

-- Business logic:
local permit = true
local overrideConsumeCount = 0

-- Result
result = {
  permit=permit,
  overrideConsumeCount=overrideConsumeCount
}
```


#### 비동기 실행 스크립트

 처리 후에, 스크립트가 비동기 실행됩니다.

##### Request

| | 타입 | 설명 |
| --- | --- | --- |
| namespace | [Namespace](../sdk/#namespace) | 네임스페이스 |
| oldInventory | [Inventory](../sdk/#inventory) | 소비 전 인벤토리 |
| oldItemSets | [ItemSet[]](../sdk/#itemset) | 소비 전 아이템 세트 리스트 |
| newInventory | [Inventory](../sdk/#inventory) | 소비 후 인벤토리 |
| newItemSets | [ItemSet[]](../sdk/#itemset) | 소비 후 아이템 세트 리스트 |
| consumeItemName | string | 소비한 아이템 모델 이름 |
| userId | string | 사용자ID |
| consumeCount | long | 소비 수량 |


##### 구현 예제


**Lua**
```lua

-- Request
local namespace = args.namespace
local oldInventory = args.oldInventory
local oldItemSets = args.oldItemSets
local newInventory = args.newInventory
local newItemSets = args.newItemSets
local consumeItemName = args.consumeItemName
local userId = args.userId
local consumeCount = args.consumeCount

-- 비동기 스크립트는 일반적으로 API 응답에 영향을 주지 않습니다.
-- 로그 출력이나 분석, 외부 알림 등에 사용됩니다.

result = {
}
```


---
  
### simpleItemAcquire



**관련 메서드:**
acquireSimpleItemsByUserId - 사용자 ID를 지정하여 심플 아이템 입수


#### 동기 실행 스크립트

 처리 전에, 스크립트가 동기 실행됩니다.

##### Request

| | 타입 | 설명 |
| --- | --- | --- |
| namespace | [Namespace](../sdk/#namespace) | 네임스페이스 |
| inventoryName | string | 심플 인벤토리 모델명<br>이 인벤토리의 아이템 종류를 정의하는 심플 인벤토리 모델의 이름입니다. 사용자의 심플 인벤토리 인스턴스를 모델 정의에 연결합니다. |
| simpleItems | [SimpleItem[]](../sdk/#simpleitem) | 심플 아이템 리스트 |
| userId | string | 사용자ID |
| acquireCounts | [AcquireCount[]](../sdk/#acquirecount) | 심플 아이템의 입수 수량 리스트 |

##### Result

|  | 타입 | 필수 | 기본값 | 값 제한 | 설명 |
| --- | --- | --- | --- | --- | --- |
| permit | bool | ✓ |  |  | 심플 아이템 입수를 허용할지 여부 |
| overrideAcquireCounts | AcquireCount[] |  |  | 0 ~ 100 items | 심플 아이템의 입수 수량 리스트 |

##### 구현 예제


**Lua**
```lua

-- Request
local namespace = args.namespace
local inventoryName = args.inventoryName
local simpleItems = args.simpleItems
local userId = args.userId
local acquireCounts = args.acquireCounts

-- Business logic:
local permit = true
local overrideAcquireCounts = {}

-- Result
result = {
  permit=permit,
  overrideAcquireCounts=overrideAcquireCounts
}
```


#### 비동기 실행 스크립트

 처리 후에, 스크립트가 비동기 실행됩니다.

##### Request

| | 타입 | 설명 |
| --- | --- | --- |
| namespace | [Namespace](../sdk/#namespace) | 네임스페이스 |
| inventoryName | string | 심플 인벤토리 모델명<br>이 인벤토리의 아이템 종류를 정의하는 심플 인벤토리 모델의 이름입니다. 사용자의 심플 인벤토리 인스턴스를 모델 정의에 연결합니다. |
| oldSimpleItems | [SimpleItem[]](../sdk/#simpleitem) | 갱신 전 심플 아이템 리스트 |
| newSimpleItems | [SimpleItem[]](../sdk/#simpleitem) | 갱신 후 심플 아이템 리스트 |
| userId | string | 사용자ID |
| acquireCounts | [AcquireCount[]](../sdk/#acquirecount) | 심플 아이템 리스트 |


##### 구현 예제


**Lua**
```lua

-- Request
local namespace = args.namespace
local inventoryName = args.inventoryName
local oldSimpleItems = args.oldSimpleItems
local newSimpleItems = args.newSimpleItems
local userId = args.userId
local acquireCounts = args.acquireCounts

-- 비동기 스크립트는 일반적으로 API 응답에 영향을 주지 않습니다.
-- 로그 출력이나 분석, 외부 알림 등에 사용됩니다.

result = {
}
```


---
  
### simpleItemConsume



**관련 메서드:**
consumeSimpleItems - 심플 아이템 소비
consumeSimpleItemsByUserId - 사용자 ID를 지정하여 심플 아이템 소비


#### 동기 실행 스크립트

 처리 전에, 스크립트가 동기 실행됩니다.

##### Request

| | 타입 | 설명 |
| --- | --- | --- |
| namespace | [Namespace](../sdk/#namespace) | 네임스페이스 |
| inventoryName | string | 심플 인벤토리 모델명<br>이 인벤토리의 아이템 종류를 정의하는 심플 인벤토리 모델의 이름입니다. 사용자의 심플 인벤토리 인스턴스를 모델 정의에 연결합니다. |
| simpleItems | [SimpleItem[]](../sdk/#simpleitem) | 심플 아이템 리스트 |
| userId | string | 사용자ID |
| consumeCounts | [ConsumeCount[]](../sdk/#consumecount) | 심플 아이템의 소비 수량 리스트 |

##### Result

|  | 타입 | 필수 | 기본값 | 값 제한 | 설명 |
| --- | --- | --- | --- | --- | --- |
| permit | bool | ✓ |  |  | 심플 아이템 소비를 허용할지 여부 |
| overrideConsumeCounts | ConsumeCount[] |  |  | 0 ~ 100 items | 심플 아이템 리스트 |

##### 구현 예제


**Lua**
```lua

-- Request
local namespace = args.namespace
local inventoryName = args.inventoryName
local simpleItems = args.simpleItems
local userId = args.userId
local consumeCounts = args.consumeCounts

-- Business logic:
local permit = true
local overrideConsumeCounts = {}

-- Result
result = {
  permit=permit,
  overrideConsumeCounts=overrideConsumeCounts
}
```


#### 비동기 실행 스크립트

 처리 후에, 스크립트가 비동기 실행됩니다.

##### Request

| | 타입 | 설명 |
| --- | --- | --- |
| namespace | [Namespace](../sdk/#namespace) | 네임스페이스 |
| inventoryName | string | 심플 인벤토리 모델명<br>이 인벤토리의 아이템 종류를 정의하는 심플 인벤토리 모델의 이름입니다. 사용자의 심플 인벤토리 인스턴스를 모델 정의에 연결합니다. |
| oldSimpleItems | [SimpleItem[]](../sdk/#simpleitem) | 갱신 전 심플 아이템 리스트 |
| newSimpleItems | [SimpleItem[]](../sdk/#simpleitem) | 갱신 후 심플 아이템 리스트 |
| userId | string | 사용자ID |
| consumeCounts | [ConsumeCount[]](../sdk/#consumecount) | 심플 아이템의 소비 수량 리스트 |


##### 구현 예제


**Lua**
```lua

-- Request
local namespace = args.namespace
local inventoryName = args.inventoryName
local oldSimpleItems = args.oldSimpleItems
local newSimpleItems = args.newSimpleItems
local userId = args.userId
local consumeCounts = args.consumeCounts

-- 비동기 스크립트는 일반적으로 API 응답에 영향을 주지 않습니다.
-- 로그 출력이나 분석, 외부 알림 등에 사용됩니다.

result = {
}
```


---
  
### bigItemAcquire



**관련 메서드:**
acquireBigItemByUserId - 사용자 ID를 지정하여 거대 아이템 입수


#### 동기 실행 스크립트

 처리 전에, 스크립트가 동기 실행됩니다.

##### Request

| | 타입 | 설명 |
| --- | --- | --- |
| namespace | [Namespace](../sdk/#namespace) | 네임스페이스 |
| inventoryName | string | 거대 인벤토리 모델명<br>이 인벤토리의 아이템 종류를 정의하는 거대 인벤토리 모델의 이름입니다. 사용자의 거대 인벤토리 인스턴스를 모델 정의에 연결합니다. |
| itemName | string | 거대 아이템 모델 이름<br>이 레코드에 저장된 아이템의 종류를 정의하는 거대 아이템 모델의 이름입니다. 이 거대 아이템 소지품이 어떤 아이템 정의에 대응하는지 식별하는 데 사용됩니다. |
| item | [BigItem](../sdk/#bigitem) | 거대 아이템 |
| userId | string | 사용자ID |
| acquireCount | string | 거대 아이템의 입수 수량<br>최대 1024자리까지의 정수값 문자열 |

##### Result

|  | 타입 | 필수 | 기본값 | 값 제한 | 설명 |
| --- | --- | --- | --- | --- | --- |
| permit | bool | ✓ |  |  | 거대 아이템 입수를 허용할지 여부 |
| rate | float |  | 1.0 | 0 ~ 1000 | 획득량 배율 |

##### 구현 예제


**Lua**
```lua

-- Request
local namespace = args.namespace
local inventoryName = args.inventoryName
local itemName = args.itemName
local item = args.item
local userId = args.userId
local acquireCount = args.acquireCount

-- Business logic:
local permit = true
local rate = 1.0

-- Result
result = {
  permit=permit,
  rate=rate
}
```


#### 비동기 실행 스크립트

 처리 후에, 스크립트가 비동기 실행됩니다.

##### Request

| | 타입 | 설명 |
| --- | --- | --- |
| namespace | [Namespace](../sdk/#namespace) | 네임스페이스 |
| inventoryName | string | 거대 인벤토리 모델명<br>이 인벤토리의 아이템 종류를 정의하는 거대 인벤토리 모델의 이름입니다. 사용자의 거대 인벤토리 인스턴스를 모델 정의에 연결합니다. |
| itemName | string | 거대 아이템 모델 이름<br>이 레코드에 저장된 아이템의 종류를 정의하는 거대 아이템 모델의 이름입니다. 이 거대 아이템 소지품이 어떤 아이템 정의에 대응하는지 식별하는 데 사용됩니다. |
| oldItem | [BigItem](../sdk/#bigitem) | 갱신 전 거대 아이템 |
| newItem | [BigItem](../sdk/#bigitem) | 갱신 후 거대 아이템 |
| userId | string | 사용자ID |
| acquireCount | string | 거대 아이템의 입수 수량<br>최대 1024자리까지의 정수값 문자열 |


##### 구현 예제


**Lua**
```lua

-- Request
local namespace = args.namespace
local inventoryName = args.inventoryName
local itemName = args.itemName
local oldItem = args.oldItem
local newItem = args.newItem
local userId = args.userId
local acquireCount = args.acquireCount

-- 비동기 스크립트는 일반적으로 API 응답에 영향을 주지 않습니다.
-- 로그 출력이나 분석, 외부 알림 등에 사용됩니다.

result = {
}
```


---
  
### bigItemConsume



**관련 메서드:**
consumeBigItem - 거대 아이템 소비
consumeBigItemByUserId - 사용자 ID를 지정하여 거대 아이템 소비


#### 동기 실행 스크립트

 처리 전에, 스크립트가 동기 실행됩니다.

##### Request

| | 타입 | 설명 |
| --- | --- | --- |
| namespace | [Namespace](../sdk/#namespace) | 네임스페이스 |
| inventoryName | string | 거대 인벤토리 모델명<br>이 인벤토리의 아이템 종류를 정의하는 거대 인벤토리 모델의 이름입니다. 사용자의 거대 인벤토리 인스턴스를 모델 정의에 연결합니다. |
| itemName | string | 거대 아이템 모델 이름<br>이 레코드에 저장된 아이템의 종류를 정의하는 거대 아이템 모델의 이름입니다. 이 거대 아이템 소지품이 어떤 아이템 정의에 대응하는지 식별하는 데 사용됩니다. |
| item | [BigItem](../sdk/#bigitem) | 거대 아이템 |
| userId | string | 사용자ID |
| consumeCount | string | 거대 아이템의 소비 수량<br>최대 1024자리까지의 정수값 문자열 |

##### Result

|  | 타입 | 필수 | 기본값 | 값 제한 | 설명 |
| --- | --- | --- | --- | --- | --- |
| permit | bool | ✓ |  |  | 거대 아이템 소비를 허용할지 여부 |
| rate | float |  | 1.0 | 0 ~ 1000 | 소비량 배율 |

##### 구현 예제


**Lua**
```lua

-- Request
local namespace = args.namespace
local inventoryName = args.inventoryName
local itemName = args.itemName
local item = args.item
local userId = args.userId
local consumeCount = args.consumeCount

-- Business logic:
local permit = true
local rate = 1.0

-- Result
result = {
  permit=permit,
  rate=rate
}
```


#### 비동기 실행 스크립트

 처리 후에, 스크립트가 비동기 실행됩니다.

##### Request

| | 타입 | 설명 |
| --- | --- | --- |
| namespace | [Namespace](../sdk/#namespace) | 네임스페이스 |
| inventoryName | string | 거대 인벤토리 모델명<br>이 인벤토리의 아이템 종류를 정의하는 거대 인벤토리 모델의 이름입니다. 사용자의 거대 인벤토리 인스턴스를 모델 정의에 연결합니다. |
| itemName | string | 거대 아이템 모델 이름<br>이 레코드에 저장된 아이템의 종류를 정의하는 거대 아이템 모델의 이름입니다. 이 거대 아이템 소지품이 어떤 아이템 정의에 대응하는지 식별하는 데 사용됩니다. |
| oldItem | [BigItem](../sdk/#bigitem) | 갱신 전 거대 아이템 |
| newItem | [BigItem](../sdk/#bigitem) | 갱신 후 거대 아이템 |
| userId | string | 사용자ID |
| consumeCount | string | 거대 아이템의 소비 수량<br>최대 1024자리까지의 정수값 문자열 |


##### 구현 예제


**Lua**
```lua

-- Request
local namespace = args.namespace
local inventoryName = args.inventoryName
local itemName = args.itemName
local oldItem = args.oldItem
local newItem = args.newItem
local userId = args.userId
local consumeCount = args.consumeCount

-- 비동기 스크립트는 일반적으로 API 응답에 영향을 주지 않습니다.
-- 로그 출력이나 분석, 외부 알림 등에 사용됩니다.

result = {
}
```


---
  



