Skip to content

Display variable condition values in technical badges #181

Description

@mikkisguy

Problem

Technical badges currently display variable names only (e.g., has_spell, is_main_quest) without showing the actual values or comparison operators.

This makes it harder to understand what the condition actually checks at a glance.

Scope

Parse and display variable conditions with values:

  • Truthiness checks: if has_spell: → shows as truthy
  • Negation: if not has_drink: → shows as falsy
  • String comparisons: if alignment == "good":alignment = "good"
  • Boolean comparisons: if has_drink == True:has_drink = True
  • Numeric comparisons (already handled as stats): if gold > 100:gold > 100

Implementation

  1. Data model update:

    type VariableCondition = {
      value: string | boolean;
      operator: "==" | "!=" | "truthy" | "falsy";
    };
    
    variables?: Record<string, VariableCondition>;
  2. Parser updates (apps/backend/src/services/rpy-parser.service.ts):

    • Detect bare identifiers → truthy
    • Detect not var_namefalsy
    • Detect string comparisons → extract operator and value
    • Detect explicit boolean comparisons → == True, != False, etc.
  3. UI updates:

    • TechnicalPopover: display variable conditions with operator + value
    • LabelPropertiesPanel: same display as popover
    • Symbol mapping: ===, !=

Backward compatibility

Normalize legacy string[] format to new VariableCondition format with default truthy operator.

Priority

Medium - improves visibility but current functionality works.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    Status
    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions