Skip to content

Reward ​

Inherits: Resource

Inherited by: AbilityRankReward, AbilityReward, CraftingRecipeReward, CraftingSkillPointReward, CurrencyReward, EquipmentSlotUnlockReward, ExperienceReward, FactionReputationReward, FactionStandingReward, InventorySizeReward, ItemReward, ProfessionReward, ProficiencyReward, SkillPointReward, SkillTierReward, SkillTreeReward, SpecializationReward

Base class for all reward types

Methods ​

Stringget_block_reason( _player: Player )
Dictionaryto_pending_data()
Dictionaryapply_to_player( player: Player )
boolunapply_from_player( player: Player, tracking_data: Dictionary )
boolsupports_unapply()
boolshould_apply_on_load()
Stringget_summary()
Array[Dictionary]validate()

Method descriptions ​

String get_block_reason( _player: Player ) ​

Why this reward cannot be given right now ("" = it can). A reward that needs room (items) overrides it: whoever grants it keeps it until it can be given (Player.grant_reward), or does not complete what it belongs to (a quest)

Dictionary to_pending_data() ​

What a reward that waits for room needs to be saved ({} = this kind of reward never waits). Player.pending_rewards

Dictionary apply_to_player( player: Player ) ​

Apply this reward to a player - override in child classes Returns a Dictionary with:

  • "success": bool - whether the application succeeded
  • Additional tracking data needed for unapply (e.g., instance IDs, amounts)

Example: {"success": true, "ability_instance_id": 12345, "ability_definition_id": 42}

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

Unapply this reward from a player using tracking data from apply tracking_data: The dictionary returned from apply_to_player() Returns true if the unapply was successful NOTE: Only called if supports_unapply() returns true

bool supports_unapply() ​

Returns true if this reward type can be removed/undone Override to return true for reversible rewards Default is false for safety - rewards must explicitly opt-in to removal

bool should_apply_on_load() ​

Returns true if this reward should be re-applied when loading from save Override in child classes based on whether the reward is:

  • PERSISTENT: Saved elsewhere (currency, XP, skill points) - return false
  • TRANSIENT: Must be re-granted on load (abilities) - return true

Default is false (persistent) for safety

String get_summary() ​

Get a user-facing summary of what this reward grants Override in child classes to provide meaningful descriptions Example: "Ability: Fireball (Active)" or "Skill Points: +5 Combat"

Array[Dictionary] validate() ​

Validate reward configuration - override in child classes