# Rocket League community adapter
# Uses the SOS (Rocket League Overlay System) plugin
# https://gitlab.com/bakkesplugins/sos/sos-plugin
#
# SOS sends game state via WebSocket, but you can use a bridge
# to forward events as HTTP POST to:
#   http://<WLED_IP>:8080/api/v1/game-integrations/<ID>/event

name: rocket_league
game: Rocket League
protocol: webhook

mappings:
  - source_path: player.boost
    event: energy
    min: 0
    max: 100
    trigger: on_change

  - source_path: player.speed
    event: speed
    min: 0
    max: 2300
    trigger: on_value

  - source_path: match.goals_scored
    event: kill
    trigger: on_increase
    min: 0
    max: 20

  - source_path: match.goals_conceded
    event: death
    trigger: on_increase
    min: 0
    max: 20

  - source_path: match.time_remaining
    event: objective_progress
    min: 0
    max: 300
    trigger: on_value

  - source_path: game.started
    event: match_start
    trigger: on_change
    min: 0
    max: 1

  - source_path: game.ended
    event: match_end
    trigger: on_change
    min: 0
    max: 1

  - source_path: team.score_blue
    event: team_a
    min: 0
    max: 10
    trigger: on_change

  - source_path: team.score_orange
    event: team_b
    min: 0
    max: 10
    trigger: on_change

setup_instructions: |
  ## Rocket League Integration Setup

  This adapter works with the SOS (Rocket League Overlay System) plugin.

  **Setup:**
  1. Install BakkesMod: https://bakkesmod.com
  2. Install the SOS plugin from the BakkesMod plugin manager
  3. Use a WebSocket-to-HTTP bridge to forward SOS events

  **Bridge tool:**
  A small script that connects to SOS WebSocket (ws://localhost:49122)
  and forwards events as HTTP POST to the WLED event endpoint.

  **Expected JSON format:**
  ```json
  {
    "player": {
      "boost": 75,
      "speed": 1500
    },
    "match": {
      "goals_scored": 2,
      "goals_conceded": 1,
      "time_remaining": 180
    },
    "team": {
      "score_blue": 2,
      "score_orange": 1
    }
  }
  ```
