CustomWeaponModsController - xEdziu/RPG-Handy-Helper GitHub Wiki

CpRedCustomWeaponModsController

This page contains documentation for the CpRedCustomWeaponModsController class, which handles custom WeaponMods management for Cyberpunk Red.

Basic Information

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

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

Field Descriptions

Request Body Fields (CustomWeaponModDto)

  • gameId (Long): ID of the game this custom weapon mod belongs to. Required.
  • 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.
  • customWeaponMod (Object): A single custom weapon mod object (if applicable).
  • customWeaponModList (Array): List of custom weapon mods (if applicable).

Endpoint Details

Get All Custom Weapon Mods

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

Response

{
  "customWeaponMods": [
    {
      "gameId": 1,
      "name": "Customowy celownik",
      "price": 1000,
      "size": 2,
      "availability": "COSTLY",
      "description": "Customowy celownik do broni palnej."
    },
    {
      "gameId": 1,
      "name": "Customowy tłumik",
      "price": 2000,
      "size": 3,
      "availability": "LUXURY",
      "description": "Customowy tłumik do broni palnej, który zapewnia doskonałą redukcję hałasu."
    }
  ],
  "message": "Customowe modyfikacje broni zostały pobrane.",
  "error": 200,
  "timestamp": "..."
}

Possible Errors

  • 401 Unauthorized: User is not logged in.

Get Custom Weapon Mod by ID

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

Response

{
  "customWeaponMod": {
    "gameId": 1,
    "name": "Customowy celownik",
    "price": 1000,
    "size": 2,
    "availability": "COSTLY",
    "description": "Customowy celownik do broni palnej."
  },
  "message": "Customowa modyfikacja broni została pobrana.",
  "error": 200,
  "timestamp": "..."
}

Possible Errors

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

Get Custom Weapon Mods by Game ID

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

Response

{
  "customMods": [
    {
      "gameId": 1,
      "name": "Customowy celownik",
      "price": 1000,
      "size": 2,
      "availability": "COSTLY",
      "description": "Customowy celownik do broni palnej."
    },
    {
      "gameId": 1,
      "name": "Customowy tłumik",
      "price": 2000,
      "size": 3,
      "availability": "LUXURY",
      "description": "Customowy tłumik do broni palnej, który zapewnia doskonałą redukcję hałasu."
    }
  ],
  "message": "Customowe modyfikacje do broni, 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 Weapon Mods with Admin Data

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

Response

{
  "customWeaponMods": [
    {
      "id": 1,
      "gameId": {
        "id": 1,
        "name": "Night City Adventures",
        "description": "A thrilling adventure in the heart of Night City.",
        "owner": {
          "id": 1,
          "username": "zuber",
          "firstName": "Mateusz",
          "surname": "Zubrzycki",
          "email": "[email protected]",
          "token": null,
          "password": "$2a$10$Xg1TSDI6Erl.RcfpAPPuLOrnnskoLJ7wWPrC5QJU1e2h.cNd05JRO",
          "role": "ROLE_ADMIN",
          "locked": false,
          "enabled": true,
          "createdAt": "2025-06-25T08:25:00.517+00:00",
          "userPhotoPath": "/img/profilePics/defaultProfilePic.png",
          "accountNonLocked": true,
          "oauthProvider": null,
          "credentialsNonExpired": true,
          "accountNonExpired": true,
          "oauthId": null,
          "authorities": [
            {
              "authority": "ROLE_ADMIN"
            }
          ]
        },
        "rpgSystem": {
          "id": 1,
          "name": "Cyberpunk 2077",
          "description": "A futuristic role-playing game set in the dystopian Night City."
        },
        "status": "ACTIVE"
      },
      "name": "Customowy celownik",
      "price": 1000,
      "size": 2,
      "availability": "COSTLY",
      "description": "Customowy celownik do broni palnej."
    },
    {
      "id": 2,
      "gameId": {
        "id": 1,
        "name": "Night City Adventures",
        "description": "A thrilling adventure in the heart of Night City.",
        "owner": 1,
        "rpgSystem": {
          "id": 1,
          "name": "Cyberpunk 2077",
          "description": "A futuristic role-playing game set in the dystopian Night City."
        },
        "status": "ACTIVE"
      },
      "name": "Customowy tłumik",
      "price": 2000,
      "size": 3,
      "availability": "LUXURY",
      "description": "Customowy tłumik do broni palnej, który zapewnia doskonałą redukcję hałasu."
    }
  ],
  "message": "Customowe modyfikacje broni 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 WeaponMod

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

Request

{
  "gameId": 1,
  "name": "my mod",
  "price": 100,
  "size": 10,
  "availability": "CHEAP",
  "description": "good custom mod"
}

Response

{
  "message": "Customowa modyfikacja broni została dodana.",
  "error": 200,
  "timestamp": "..."
}

Possible Errors

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

Update Custom WeaponMods

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

Request

{
  "gameId": 1,
  "name": "my new mod",
  "price": 150,
  "size": 5,
  "availability": "LUXURY",
  "description": "better custom mod"
}

Response

{
  "message": "Customowa modyfikacja broni została zaktualizowana.",
  "error": 200,
  "timestamp": "..."
}

Possible Errors

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