CriticalInjuriesController - xEdziu/RPG-Handy-Helper GitHub Wiki

CpRedCriticalInjuriesController

This page contains documentation for the CpRedCriticalInjuriesController class, which handles operations related to critical injuries in the Cyberpunk Red.

Basic Information

Base Path: /api/v1/authorized
Package: dev.goral.rpghandyhelper.rpgSystems.cpRed.manual.criticalInjuries

Authentication

All requests to this controller require an XSRF token to be included in the headers.
Example:

headers: {
  "X-XSRF-TOKEN": "<csrfToken>"
}

Endpoint Summary

HTTP Method Path Description
GET /rpgSystems/cpRed/criticalInjuries/all Returns basic info about all available critical injuries
GET /rpgSystems/cpRed/criticalInjuries/{injuryId} Returns detailed information about a specific critical injury by ID
GET /admin/rpgSystems/cpRed/criticalInjuries/all Returns a full list of all critical injuries with administrative data
POST /admin/rpgSystems/cpRed/criticalInjuries/add Adds a new critical injury type to the system
PUT /admin/rpgSystems/cpRed/criticalInjuries/update/{injuryId} Update critical injury data

Field Descriptions

Request Body Fields (CriticalInjuriesDto)

  • rollValue (Integer): The roll value for the critical injury. Required.
  • injuryPlace (String): The place of the injury on the body. Required. Possible values: HEAD,BODY.
  • name (String): Name of the critical injury. Required.
  • effect (String): Description of the critical injury effect. Required.
  • patching (String): Description of the patching process for the injury. Required.
  • treating (String): Description of the treatment process for the injury. Required.

Response Fields

  • message (String): Describes the result of the operation.
  • error (Integer): HTTP status code.
  • timestamp (String): Time the response was generated.
  • criticalInjury (Object): A single critical injury object (if applicable).
  • criticalInjuryList (Array): List of critical injuries (if applicable).

Endpoint Details

Get All Critical Injuries

Method: GET
Path: /rpgSystems/cpRed/criticalInjuries/all

Response

{
  "criticalInjuries": [
    {
      "rollValue": 3,
      "injuryPlace": "HEAD",
      "name": "Critical Hit",
      "effects": "Critical damage",
      "patching": "None",
      "treating": "None"
    }
  ],
  "message": "Pobrano wszystkie rodzaje ran krytycznych.",
  "error": 200,
  "timestamp": "..."
}

Possible Errors

  • 401 Unauthorized: User is not logged in.

Get Critical Injury by ID

Method: GET
Path: /rpgSystems/cpRed/criticalInjuries/{injuryId}

Response

{
  "criticalInjury": {
    "rollValue": 3,
    "injuryPlace": "HEAD",
    "name": "Critical Hit",
    "effects": "Critical damage",
    "patching": "None",
    "treating": "None"
  },
  "message": "Pobrano rany krytyczne o id 1",
  "error": 200,
  "timestamp": "..."
}

Possible Errors

  • 400 Bad Request: Invalid critical injury ID.
  • 401 Unauthorized: User is not logged in.
  • 404 Not Found: Critical injury with the specified ID does not exist.

Get All Critical Injuries with Admin Data

Method: GET
Path: admin/rpgSystems/cpRed/criticalInjuries/all

Response

{
  "criticalInjuries": [
    {
      "id": 1,
      "rollValue": 3,
      "injuryPlace": "HEAD",
      "name": "Critical Hit",
      "effects": "Critical damage",
      "patching": "None",
      "treating": "None"
    }
  ],
  "message": "Pobrano wszystkie rany krytyczne.",
  "error": 200,
  "timestamp": "..."
}

Possible Errors

  • 401 Unauthorized: User is not logged in.
  • 403 Forbidden: User is not an admin.

Add New Critical Injury

Method: POST
Path: /admin/rpgSystems/cpRed/criticalInjuries/all

Request

{
  "rollValue": 3,
  "injuryPlace": "HEAD",
  "name": "Critical Hit",
  "effects": "Critical damage",
  "patching": "None",
  "treating": "None"
}

Response

{
  "message": "Rany krytyczne zostały dodane.",
  "error": 200,
  "timestamp": "..."
}

Possible Errors

  • 400 Bad Request: User not authenticated.
  • 401 Unauthorized: User not logged in.
  • 403 Forbidden: User is not an admin.
  • 404 Not Found: Invalid critical injury data.

Update Critical Injury

Method: PUT
Path: /admin/rpgSystems/cpRed/criticalInjuries/update/{injuryId}

Request

{
  "rollValue": 2,
  "injuryPlace": "HEAD",
  "name": "Critical Hit 2.0",
  "effects": "Critical damage",
  "patching": "yes",
  "treating": "None"
}

Response

{
  "message": "Rany krytyczne zostały zaktualizowane.",
  "error": 200,
  "timestamp": "..."
}

Possible Errors

  • 400 Bad Request: Invalid armor ID or data.
  • 401 Unauthorized: User not logged in.
  • 403 Forbidden: User is not an admin.
  • 404 Not Found: Critical Injury with the specified ID does not exist.

Common Troubleshooting Tips

  • Missing XSRF Token: Ensure the X-XSRF-TOKEN header is included in every request.
  • Invalid Fields: Double-check the request body for missing or invalid fields.
  • Permission Issues: Verify that the user has the necessary permissions for the requested operation.
⚠️ **GitHub.com Fallback** ⚠️