CharacterArmorController - xEdziu/RPG-Handy-Helper GitHub Wiki

CpRedCharacterArmorController

This page contains documentation for the CpRedCharacterArmorController class, which handles character armors management for Cyberpunk Red.

Basic Information

Base Path: /api/v1/authorized
Package: dev.goral.rpgSystems.cpRed.characters.characterArmor

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 /games/cpRed/characters/armors/{characterId} Returns detailed information about a specific character armor by characterID
POST /games/cpRed/characters/armors/create Adds a new connection between armor type and character to the system
PUT /games/cpRed/characters/armors/update/{characterArmorId} Update character armor data
DELETE /games/cpRed/characters/armors/delete/{characterArmorId} Delete character armor data
GET /admin/games/cpRed/characters/armors/all Returns a full list of character armor type with administrative data

Field Descriptions

Request Body Fields (CharacterArmorDto)

  • Id (Long): Unique identifier for the character armor. Required.
  • baseArmorId (Long): Unique identifier for the armor type. Required.
  • CharacterId (Long): Unique identifier for the character. Required.
  • status (String): Status of the armor. Required. Possible values: EQUIPPED, STORED.
  • place (String): Location of the armor. Required. Possible values: HEAD, BODY, SHIELD.
  • currentArmorPoints (Integer): Current armor points of the character. Required.
  • description (String): Description of the character armor. Required.

Response Fields

  • message (String): Describes the result of the operation.
  • error (Integer): HTTP status code.
  • timestamp (String): Time the response was generated.
  • characterArmor (Object): A single character armor object (if applicable).
  • characterArmorList (Array): List of character armors (if applicable).

Endpoint Details

Get Armor by Character ID

Method: GET
Path: /games/cpRed/characters/armors/{characterId}

Response

{
  "characterArmors": [],
  "message": "Pancerze postaci pobrane pomyślnie",
  "error": 200,
  "timestamp": "..."
}

Possible Errors

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

Add New Character Armor

Method: POST
Path: /games/cpRed/characters/armors/create

Request

{
  "baseArmorId": 1,
  "characterId": 1,
  "status": "EQUIPPED",
  "place": "BODY"
}

Response

{
  "message": "Pancerz został dodany do postaci",
  "error": 200,
  "timestamp": "..."
}

Possible Errors

  • 400 Bad Request: User not authenticated.
  • 401 Unauthorized: User not logged in.
  • 404 Not Found: Invalid character armor data.

Update Armor

Method: PUT
Path: /games/cpRed/characters/armors/update/{characterArmorId}

Request

{
  "status": "STORED",
  "currentArmorPoints": 2,
  "description": "Pancerz tak twardy jak..."
}

Response

{
  "message": "Pancerz postaci został pomyślnie zmodyfikowany",
  "error": 200,
  "timestamp": "..."
}

Possible Errors

  • 400 Bad Request: Invalid character armor ID or data.
  • 401 Unauthorized: User not logged in.
  • 404 Not Found: Character armor with the specified ID does not exist.

Delete Character Armor

Method: DELETE Path: /games/cpRed/characters/armors/delete/{characterArmorId}

Response

{
  "message": "Pancerz postaci został pomyślnie usunięty",
  "error": 200,
  "timestamp": "..."
}

Possible Errors

  • 400 Bad Request: Invalid character armor ID.
  • 401 Unauthorized: User not logged in.
  • 404 Not Found: Character armor with the specified ID does not exist.

Get All Character Armor with Admin Data

Method: GET
Path: /admin/games/cpRed/characters/armors/all

Response

{
  "characterArmors": [],
  "message": "Wszystkie pancerze postaci pobrane pomyślnie",
  "error": 200,
  "timestamp": "..."
}

Possible Errors

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

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** ⚠️