Skip to content

[Feature Request] API to retrieve all ships from user dock and save to local file #369

@yltx

Description

@yltx

Feature Request

Summary

Add a new API endpoint that retrieves all ships currently in the user's dock (ship hold/船舱) via OCR or game data parsing, and saves the result to a local JSON file.

Motivation

The GUI frontend (AutoWSGR-GUI) now supports fleet presets — users can define named fleet compositions (e.g. 传统AIII双装母: [飞龙, AIII, 鞍山, 长春, 大凤, 不挠]) in their plan YAML files. To provide a good user experience, the frontend needs to know which ships the user actually owns, so it can:

  1. Validate fleet presets — highlight presets where one or more ships are missing from the user's dock
  2. Guide fleet selection — only show presets that the user can actually form
  3. Auto-complete ship names — provide suggestions when editing fleet compositions

Proposed API

GET /api/game/dock

Response:

{
  success: true,
  data: {
    ships: [
      { name: 飞龙, ship_type: cv, level: 110 },
      { name: AIII, ship_type: bbv, level: 105 },
      ...
    ],
    total: 500,
    saved_to: dock_ships.json
  }
}

Behavior

  1. Navigate to the dock/ship hold screen in-game (or use existing game data if available without navigation)
  2. Enumerate all ships the user owns (name, type, level at minimum)
  3. Save the full list to a local JSON file (e.g. dock_ships.json in the autowsgr data directory)
  4. Return the list in the API response

Notes

  • This can be implemented using OCR on the dock screen, or by parsing game network data if the protocol supports it
  • The saved file can be cached and reused by the frontend without re-calling the API each time
  • Ship names should match the standard naming used in fleet fields (e.g. change_ships)
  • Level and type information helps the frontend provide richer UI (e.g. sorting by level, filtering by type)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions