CustomArmorsController - xEdziu/RPG-Handy-Helper GitHub Wiki

CpRedCustomArmorsController

This page contains documentation for the CpRedCustomArmorsController class, which handles custom Armors management for Cyberpunk Red.

Basic Information

Base Path: /api/v1/authorized
Package: dev.goral.rpghandyhelper.rpgSystems.cpRed.custom.customArmors

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/customArmors/all Returns basic info about all available custom armors
GET /rpgSystems/cpRed/customArmors/{armorId} Returns detailed information about a specific custom armor by ID
GET /rpgSystems/cpRed/customArmors/game/{gameId} Returns basic info about all available custom armors by game ID
GET /admin/rpgSystems/cpRed/customArmors/all Returns a full list of all custom armors types with administrative data
POST /rpgSystems/cpRed/customArmors/add Adds a new custom armor type to the system
PUT /rpgSystems/cpRed/customArmors/update/{armorId} Update custom armor data

Field Descriptions

Request Body Fields (CustomArmorsDto)

  • gameId (Long): ID of the game this custom armor belongs to. Required.
  • name (String): Name of the custom armor. Required.
  • type (String): Type of the custom armor. Possible values: LEATHER, KEVLAR, LIGHT_ARMORJACK, BODYWEIGHT_SUIT, MEDIUM_ARMORJACK, HEAVY_ARMORJACK, FLAK, METALGEAR, BULLETPROOF_SHIELD.
  • armorPoints (Integer): Number of custom armor points. Required.
  • penalty (Integer): Penalty to the character's actions when wearing this custom armor. Required.
  • price (Integer): Price for custom armor in eurodollars. Required.
  • availability (String): Availability status. Required. Possible values: CHEAP, EVERYDAY, COSTLY, PREMIUM, EXPENSIVE, VERY_EXPENSIVE, LUXURY, SUPER_LUXURY.
  • -description (String): Description of the custom armor. Required.

Response Fields

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

Endpoint Details

Get All Custom Armors

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

Response

{
  "customArmors": [
    {
      "gameId": 1,
      "name": "Stalowa zbroja",
      "type": "BODYWEIGHT_SUIT",
      "armorPoints": 4,
      "penalty": 0,
      "price": 1500,
      "availability": "COSTLY",
      "description": "Customowa zbroja wykonana na specjalne zamówienie."
    },
    {
      "gameId": 1,
      "name": "Pole siłowe",
      "type": "BULLETPROOF_SHIELD",
      "armorPoints": 20,
      "penalty": 0,
      "price": 15000,
      "availability": "VERY_EXPENSIVE",
      "description": "Customowe pole siłowe, które zapewnia doskonałą ochronę przed atakami."
    }
  ],
  "message": "Customowe pancerze zostały pobrane.",
  "error": 200,
  "timestamp": "..."
}

Possible Errors

  • 401 Unauthorized: User is not logged in.

Get Custom Armor by ID

Method: GET
Path: /rpgSystems/cpRed/customArmors/{ArmorId}

Response

{
  "customArmor": {
    "gameId": 1,
    "name": "Stalowa zbroja",
    "type": "BODYWEIGHT_SUIT",
    "armorPoints": 4,
    "penalty": 0,
    "price": 1500,
    "availability": "COSTLY",
    "description": "Customowa zbroja wykonana na specjalne zamówienie."
  },
  "message": "Customowa zbroja została pobrana.",
  "error": 200,
  "timestamp": "..."
}

Possible Errors

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

Get Custom Armors by Game ID

Method: GET
Path: /rpgSystems/cpRed/customArmors/game/{gameId}

Response

{
  "customArmor": [
    {
      "gameId": 1,
      "name": "Stalowa zbroja",
      "type": "BODYWEIGHT_SUIT",
      "armorPoints": 4,
      "penalty": 0,
      "price": 1500,
      "availability": "COSTLY",
      "description": "Customowa zbroja wykonana na specjalne zamówienie."
    },
    {
      "gameId": 1,
      "name": "Pole siłowe",
      "type": "BULLETPROOF_SHIELD",
      "armorPoints": 20,
      "penalty": 0,
      "price": 15000,
      "availability": "VERY_EXPENSIVE",
      "description": "Customowe pole siłowe, które zapewnia doskonałą ochronę przed atakami."
    }
  ],
  "message": "Customowe zbroje do gry zostały pobrane.",
  "error": 200,
  "timestamp": "..."
}

Possible Errors

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

Get All Custom Armors with Admin Data

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

Response

{
  "customArmors": [],
  "message": "Customowe pancerze zostały pobrane dla administratora.",
  "error": 200,
  "timestamp": "..."
}

Possible Errors

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

Add New Custom Armor

Method: POST
Path: /admin/rpgSystems/cpRed/customArmors/add

Request

{
  "gameId": 1,
  "name": "Pancerz własny",
  "type": "LEATHER",
  "armorPoints": 2,
  "penalty": 0,
  "price": 100,
  "availability": "CHEAP",
  "description": "Pancerz skórzany"
}

Response

{
  "message": "Customowy pancerz został dodany.",
  "error": 200,
  "timestamp": "..."
}

Possible Errors

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

Update Custom Armors

Method: PUT
Path: /admin/rpgSystems/cpRed/customArmors/update/{ArmorsId}

Request

{
  "gameId": 1,
  "name": "Pancerz własny 2.0",
  "type": "LEATHER",
  "armorPoints": 3,
  "penalty": 1,
  "price": 150,
  "availability": "CHEAP",
  "description": "Lepszy pancerz skórzany"
}

Response

{
  "message": "Customowy pancerz został zmodyfikowany.",
  "error": 200,
  "timestamp": "..."
}

Possible Errors

  • 400 Bad Request: Invalid custom armor ID or data.
  • 401 Unauthorized: User not logged in.
  • 404 Not Found:Custom armor 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** ⚠️