Macro APITriggers
Loot Container Found
Runs when a container appears during a run.
- Category
- Loot
- Runs when
- A container can be opened.
- Summary
- Runs when a container appears during a run.
- Version
- 1
Events
- system-loot-container-found
Lua Example
local opened = loot.openContainer(ctx.lootContainer.timelineEventId)
for _, item in ipairs(opened.items) do
loot.keepItem(item)
end
print("Container", ctx.lootContainer.containerTypeKey)ctx Fields
| Trigger | Path | Type | Label | Description |
|---|---|---|---|---|
| Loot Container Found | ctx.lootContainer.containerTypeKey | string | Container type | The kind of container that was found. |
| Loot Container Found | ctx.lootContainer.timelineEventId | id | Source event | The game event where the container appeared. |
| Loot Container Found | ctx.lootContainer.locationKey | string | Region | The area where the container was found. |
| Loot Container Found | loot.openContainer(...).items[].itemDefinitionKey | string | Loot item definition | The generated item's definition key. |
| Loot Container Found | loot.openContainer(...).items[].categoryKey | string | Loot item category | The generated item's category key. |
| Loot Container Found | loot.openContainer(...).items[].categoryFilterGroup | string | Loot item filter group | The generated item's broad filter group. |
| Loot Container Found | loot.openContainer(...).items[].rarity | string | Loot item rarity | The generated item's rarity. |
| Loot Container Found | loot.openContainer(...).items[].quantity | number | Loot item quantity | The generated stack quantity. |
| Loot Container Found | loot.openContainer(...).items[].itemLevel | number | Loot item level | The generated item's required level. |
| Loot Container Found | loot.openContainer(...).items[].dropLevel | number | Loot drop level | The level used to generate the item. |
| Loot Container Found | loot.openContainer(...).items[].vendorValueCopper | number | Loot vendor value | The stack's vendor value in copper. |
| Loot Container Found | loot.openContainer(...).items[].tags[] | array | Loot item tags | Affix group and tag labels on the generated item. |
| Loot Container Found | loot.openContainer(...).items[].isEquippable | boolean | Loot item equippable | Whether the generated item can be equipped. |
| Loot Container Found | loot.openContainer(...).items[].upgrade.slot | string | Loot upgrade slot | The equipped slot the generated item was compared against; two-slot item types use the weaker occupied slot, or an empty slot first. |
| Loot Container Found | loot.openContainer(...).items[].upgrade.isUpgradeForEquippedSlot | boolean | Loot upgrade | True when the generated item's raw stat total is greater than the compared equipped slot, or the slot is empty. |
| Loot Container Found | loot.openContainer(...).items[].upgrade.statDeltas.maxLife | number | Loot upgrade stat delta | A stat delta versus the compared equipped slot; other stat keys are available beside maxLife. |
| Loot Container Found | loot.openContainer(...).items[].affixes[].key | string | Loot affix key | A rolled affix key on the generated item. |
| Loot Container Found | loot.openContainer(...).items[].affixes[].type | string | Loot affix type | Whether the rolled affix is a prefix or suffix. |
| Loot Container Found | loot.openContainer(...).items[].affixes[].name | string | Loot affix name | The rolled affix display name. |
| Loot Container Found | loot.openContainer(...).items[].affixes[].equipLevelRequired | number | Loot affix level | The level required by the rolled affix. |
| Loot Container Found | loot.openContainer(...).items[].affixes[].modifiers[].stat | string | Loot affix modifier stat | The stat changed by a rolled affix modifier. |
| Loot Container Found | loot.openContainer(...).items[].affixes[].modifiers[].op | string | Loot affix modifier op | The operation used by a rolled affix modifier. |
| Loot Container Found | loot.openContainer(...).items[].affixes[].modifiers[].value | number | Loot affix modifier value | The numeric value of a rolled affix modifier. |
| Loot Container Found | loot.openContainer(...).items[].implicitModifiers[].stat | string | Loot implicit modifier stat | The stat changed by a base implicit modifier. |
| Loot Container Found | loot.openContainer(...).items[].implicitModifiers[].op | string | Loot implicit modifier op | The operation used by a base implicit modifier. |
| Loot Container Found | loot.openContainer(...).items[].implicitModifiers[].value | number | Loot implicit modifier value | The numeric value of a base implicit modifier. |
| Loot Container Found | loot.openContainer(...).items[].isUnique | boolean | Loot is unique | True when the generated item is an Uncommon Rare. |
| Loot Container Found | loot.openContainer(...).items[].uniqueImplicitModifiers[].stat | string | Loot unique implicit stat | The stat changed by a unique implicit modifier. |
| Loot Container Found | loot.openContainer(...).items[].uniqueImplicitModifiers[].op | string | Loot unique implicit op | The operation used by a unique implicit modifier. |
| Loot Container Found | loot.openContainer(...).items[].uniqueImplicitModifiers[].value | number | Loot unique implicit value | The numeric value of a unique implicit modifier. |
| Loot Container Found | loot.openContainer(...).items[].timelineEventId | id | Loot item event | The timeline event id to pass back to loot item actions. |
| Loot Container Found | ctx.player.level | number | Player level | The player level used for this macro run. |
| Loot Container Found | ctx.player.currencyCopper | number | Currency | The player currency carried in copper. |
| Loot Container Found | ctx.player.bag.usedSlots | number | Bag used | The number of backpack slots currently occupied. |
| Loot Container Found | ctx.player.bag.maxSlots | number | Bag capacity | The current backpack capacity including equipped bag bonuses. |
| Loot Container Found | ctx.player.bag.freeSlots | number | Bag free | The number of free backpack slots remaining. |
| Loot Container Found | ctx.player.derivedStats.maxLife | number | Derived stat | A derived stat value; other stat keys are available beside maxLife. |
| Loot Container Found | ctx.player.equipment.mainHand.itemDefinitionKey | string | Equipped item | An equipped item definition key. Replace mainHand with another equipment slot as needed. |
| Loot Container Found | ctx.player.equipment.mainHand.rarity | string | Equipped item rarity | The rarity of an equipped item. |
| Loot Container Found | ctx.player.equipment.mainHand.itemLevel | number | Equipped item level | The required level of an equipped item. |
| Loot Container Found | ctx.player.equipment.mainHand.dropLevel | number | Equipped drop level | The drop level used to generate an equipped item. |
| Loot Container Found | ctx.player.equipment.mainHand.stats.maxLife | number | Equipped item stat | A stat contribution from an equipped item; other stat keys are available beside maxLife. |
| Loot Container Found | ctx.player.equipment.mainHand.affixes[].key | string | Equipped affix | A rolled affix key on an equipped item. |
Blocks
| Block | Category | Summary |
|---|---|---|
| Open container | Container | Opens the container found by the event. |
| Check each item | Loot | Loops over each item generated by Open container. |
| If item is rare | Rules | Checks whether the current item rarity is rare. |
| If item is weapon | Rules | Checks whether the current item category is weapon. |
| Keep item | Loot | Moves the current item into your inventory. |
| Leave item | Loot | Skips the current item without picking it up. |
| Sell item | Loot | Converts the current item into its vendor value. |
| Equip item | Loot | Moves the current item into a legal equipment slot when possible, otherwise keeps it. |
| Continue | Flow | Returns continue to the Storyteller. |
| Pause | Flow | Returns pause to the Storyteller. |