Skip to content

ItemReward ​

Inherits: Reward < Resource

Grants items to the player's inventory. With no room for all of them nothing is given: the reward is blocked (see Reward.get_block_reason), and whoever grants it keeps it until there is room (Player.grant_reward, quests)

Properties ​

intitem_id0
intquantity1
boolauto_equipfalse
LootLevel.Choicelevel_fromLootLevel.Choice.RECEIVER
intfixed_item_level1
intitem_level_offset0

Methods ​

Stringget_block_reason( player: Player )
Dictionaryapply_to_player( player: Player )
Dictionaryto_pending_data()
boolunapply_from_player( player: Player, tracking_data: Dictionary )
boolsupports_unapply()
Stringget_summary()
voidset_item_reward( new_item_id: int, new_quantity: int = 1, enable_auto_equip: bool = false )
Array[Dictionary]validate()

Property descriptions ​

int item_id = 0 ​

The item to grant

int quantity = 1 ​

How many of the item to grant

bool auto_equip = false ​

Equip the item when it is given

Item Level

LootLevel.Choice level_from = LootLevel.Choice.RECEIVER ​

For an item that is generated (it rolls its quality, stats or effects, or scales with its item level): where the item level comes from

int fixed_item_level = 1 ​

FIXED: the item level

int item_level_offset = 0 ​

Added to the item level (a reward a few levels above the player: +3)

Method descriptions ​

String get_block_reason( player: Player ) ​

Not enough room in the bag for all the items of the reward

Dictionary apply_to_player( player: Player ) ​

Gives the reward to the player. Gives back how it went and what it needs to take the reward back.

Dictionary to_pending_data() ​

What a reward that waits for room needs to be saved and made again

bool unapply_from_player( player: Player, tracking_data: Dictionary ) ​

Takes the reward back from the player (only for a reward that supports it).

bool supports_unapply() ​

Can the reward be taken back?

String get_summary() ​

A short text about the reward and its settings.

void set_item_reward( new_item_id: int, new_quantity: int = 1, enable_auto_equip: bool = false ) ​

Sets the item, the quantity and whether it is equipped at once.

Array[Dictionary] validate() ​

Checks the settings of the reward. Gives the problems found (empty when it is fine).