'points', 'label' => ('award' === $type) ? __('Points to Award', 'gameengine') : __('Points to Deduct', 'gameengine'), 'type' => 'number', 'width' => '50%', 'default' => 10, 'scope' => array('point_type'), ), array( 'key' => 'log_label', 'label' => __('Log Description', 'gameengine'), 'type' => 'text', 'width' => '50%', 'default' => ('award' === $type) ? __('Activity Reward', 'gameengine') : __('Activity Penalty', 'gameengine'), 'scope' => array('point_type', 'achievement', 'level'), ), array( 'key' => 'limit', 'label' => __('Repeatable Limit', 'gameengine'), 'type' => 'select', 'width' => '50%', 'options' => array( array('label' => __('Unlimited', 'gameengine'), 'value' => 'unlimited'), array('label' => __('1 Time Only', 'gameengine'), 'value' => '1_time'), array('label' => __('Once Per Day', 'gameengine'), 'value' => '1_per_day'), array('label' => __('Once Per Week', 'gameengine'), 'value' => '1_per_week'), array('label' => __('Once Per Month', 'gameengine'), 'value' => '1_per_month'), ), 'default' => 'unlimited', 'scope' => array('point_type', 'achievement', 'level'), ), ); // A streak pays a bonus on top of an award, so it has nothing to say // about a deduction. if ('award' !== $type) { return $fields; } return array_merge($fields, array( array( 'key' => 'streak_interval', 'label' => __('Streak Interval', 'gameengine'), 'type' => 'select', 'width' => '50%', 'options' => array( array('label' => __('Off', 'gameengine'), 'value' => 'off'), array('label' => __('Daily', 'gameengine'), 'value' => 'daily'), array('label' => __('Weekly', 'gameengine'), 'value' => 'weekly'), ), 'default' => 'off', 'description' => __('Count how many intervals in a row this trigger fires.', 'gameengine'), 'scope' => array('point_type'), ), array( 'key' => 'streak_milestone', 'label' => __('Streak Milestone', 'gameengine'), 'type' => 'number', 'width' => '50%', 'default' => 7, 'placeholder' => '7', 'description' => __('Pay the bonus every time the run reaches a multiple of this.', 'gameengine'), 'scope' => array('point_type'), ), array( 'key' => 'streak_bonus_points', 'label' => __('Streak Bonus Points', 'gameengine'), 'type' => 'number', 'width' => '50%', 'default' => 0, 'placeholder' => '0', 'description' => __('Logged separately from the points this trigger already awards.', 'gameengine'), 'scope' => array('point_type'), ), )); } /** * Backward compatibility helper. */ protected static function get_standard_schema($type = 'award'): array { return self::merge_schema(array(), $type); } /** * Returns a flat list of all triggers from this integration for the Available Hooks UI. * Each entry: [ hook_key, label, integration, hook, parameters ] */ public static function get_hooks_list(): array { $integration = static::get_name(); $triggers = static::get_triggers(); $list = array(); foreach ($triggers as $key => $trigger) { $list[] = array( 'hook_key' => $key, 'label' => $trigger['label'] ?? $key, 'integration' => $integration, 'hook' => $trigger['hook'] ?? $key, 'description' => $trigger['description'] ?? '', ); } return $list; } }