WeaponModsController - xEdziu/RPG-Handy-Helper GitHub Wiki

CpRedWeaponModsController

This page contains documentation for the CpRedweaponModsController class, which handles weapon mods management for Cyberpunk Red.

Basic Information

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

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

Field Descriptions

Request Body Fields (weaponModsDto)

  • name (String): Name of the weapon mod. Required.
  • price (Integer): Price of the weapon mod. Required.
  • size (Integer): Size of the weapon mod in slots. Required.
  • availability (String): Availability status. Required. Possible values: CHEAP, EVERYDAY, COSTLY, PREMIUM, EXPENSIVE, VERY_EXPENSIVE, LUXURY, SUPER_LUXURY.
  • description (String): Description of the weapon mods. Required.

Response Fields

  • message (String): Describes the result of the operation.
  • error (Integer): HTTP status code.
  • timestamp (String): Time the response was generated.
  • weaponMod (Object): A single weaponm mod object (if applicable).
  • weaponModList (Array): List of weapon mods (if applicable).

Endpoint Details

Get All Weapon Mods

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

Response

{
  "weaponMods": [
    {
      "name": "Tłumik",
      "price": 200,
      "size": 2,
      "availability": "CHEAP",
      "description": "Tłumik do broni palnej."
    },
    {
      "name": "Kolimator",
      "price": 400,
      "size": 1,
      "availability": "PREMIUM",
      "description": "Kolimator do broni palnej, który poprawia celność strzałów."
    }
  ],
  "message": "Pobrano modyfikacje broni",
  "error": 200,
  "timestamp": "..."
}

Possible Errors

  • 401 Unauthorized: User is not logged in.

Get Weapon Mod by ID

Method: GET
Path: /rpgSystems/cpRed/weaponMods/{weaponModId}

Response

{
  "weaponMod": {
    "name": "Tłumik",
    "price": 200,
    "size": 2,
    "availability": "CHEAP",
    "description": "Tłumik do broni palnej."
  },
  "message": "Pobrano modyfikację broni",
  "error": 200,
  "timestamp": "..."
}

Possible Errors

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

Get All Weapon Mods with Admin Data

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

Response

{
  "weaponMods": [
    {
      "id": 1,
      "name": "Tłumik",
      "price": 200,
      "size": 2,
      "availability": "CHEAP",
      "description": "Tłumik do broni palnej."
    },
    {
      "id": 2,
      "name": "Kolimator",
      "price": 400,
      "size": 1,
      "availability": "PREMIUM",
      "description": "Kolimator do broni palnej, który poprawia celność strzałów."
    }
  ],
  "message": "Pobrano modyfikacje broni",
  "error": 200,
  "timestamp": "..."
}

Possible Errors

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

Add New Weapon Mod

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

Request

{
  "name": "mod",
  "price": 100,
  "size": 20,
  "availability": "CHEAP",
  "description": "A cheap mod"
}

Response

{
  "message": "Dodano modyfikację broni",
  "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 Weapon mod data.

Update Weapon Mod

Method: PUT
Path: /admin/rpgSystems/cpRed/weaponMods/update/{weaponModId}

Request

{
  "name": "mod 2.0",
  "price": 300,
  "size": 10,
  "availability": "LUXURY",
  "description": "Awesome mod"
}

Response

{
  "message": "Zaktualizowano modyfikację broni",
  "error": 200,
  "timestamp": "..."
}

Possible Errors

  • 400 Bad Request: Invalid weaponMods ID or data.
  • 401 Unauthorized: User not logged in.
  • 403 Forbidden: User is not an admin.
  • 404 Not Found: Weapon mod 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** ⚠️