CustomAmmunitionController - xEdziu/RPG-Handy-Helper GitHub Wiki
This page contains documentation for the CpRedCustomAmmunitionController
class, which handles custom ammunition management for Cyberpunk Red.
Base Path: /api/v1/authorized
Package: dev.goral.rpghandyhelper.rpgSystems.cpRed.custom.customAmmunition
All requests to this controller require an XSRF token to be included in the headers.
Example:
headers: {
"X-XSRF-TOKEN": "<csrfToken>"
}
HTTP Method | Path | Description |
---|---|---|
GET | /rpgSystems/cpRed/customAmmunition/all |
Returns basic info about all available custom ammunition |
GET | /rpgSystems/cpRed/customAmmunition/{ammunitionId} |
Returns detailed information about a specific custom ammunition by ID |
GET | /rpgSystems/cpRed/customAmmunition/game/{gameId} |
Returns basic info about all available custom ammunition by game ID |
GET | /admin/rpgSystems/cpRed/customAmmunition/all |
Returns a full list of all custom ammunition types with administrative data |
POST | /rpgSystems/cpRed/customAmmunition/add |
Adds a new custom ammunition type to the system |
PUT | /rpgSystems/cpRed/customAmmunition/update/{ammunitionId} |
Update custom ammunition data |
- gameId (Long): ID of the game this ammunition belongs to. Required.
- name (String): Name of the ammunition. Required.
- description (String): Description of the ammunition. Required.
- pricePerBullet (Integer): Price per bullet. Required.
-
availability (String): Availability status. Required. Possible values:
CHEAP
,EVERYDAY
,COSTLY
,PREMIUM
,EXPENSIVE
,VERY_EXPENSIVE
,LUXURY
,SUPER_LUXURY
.
- message (String): Describes the result of the operation.
- error (Integer): HTTP status code.
- timestamp (String): Time the response was generated.
- customAmmunition (Object): A single custom ammunition object (if applicable).
- customAmmunitionList (Array): List of custom ammunition (if applicable).
Method: GET
Path: /rpgSystems/cpRed/customAmmunition/all
{
"customAmmunition": [
{
"gameId": 1,
"name": "Customowa amunicja",
"description": "Customowa amunicja do broni palnej.",
"pricePerBullet": 20,
"availability": "COSTLY"
}
],
"message": "Customowa amunicja została pobrana.",
"error": 200,
"timestamp": "..."
}
-
401 Unauthorized
: User is not logged in.
Method: GET
Path: /rpgSystems/cpRed/customAmmunition/{ammunitionId}
{
"customAmmunition": {
"gameId": 1,
"name": "Customowa amunicja",
"description": "Customowa amunicja do broni palnej.",
"pricePerBullet": 20,
"availability": "COSTLY"
},
"message": "Customowa amunicja została pobrana.",
"error": 200,
"timestamp": "..."
}
-
400 Bad Request
: Invalid custom ammunition ID. -
401 Unauthorized
: User is not logged in. -
404 Not Found
:Custom Ammunition with the specified ID does not exist.
Method: GET
Path: /rpgSystems/cpRed/customAmmunition/game/{gameId}
{
"customAmmunition": [
{
"gameId": 1,
"name": "Customowa amunicja",
"description": "Customowa amunicja do broni palnej.",
"pricePerBullet": 20,
"availability": "COSTLY"
},
{
"gameId": 1,
"name": "Customowa amunicja ale lepsza",
"description": "Może i lata jak zwykła amunicja ale za to jest głośniejsza. Zapytasz więc czemu lepsza? Bo jest droższa.",
"pricePerBullet": 20,
"availability": "COSTLY"
}
],
"message": "Customowa amunicja dla gry została pobrana.",
"error": 200,
"timestamp": "..."
}
-
400 Bad Request
: Invalid game ID. -
401 Unauthorized
: User is not logged in. -
404 Not Found
: Game with the specified ID does not exist.
Method: GET
Path: admin/rpgSystems/cpRed/customAmmunition/all
{
"customAmmunition": [],
"message": "Customowa amunicja została pobrana dla administratora.",
"error": 200,
"timestamp": "..."
}
-
401 Unauthorized
: User is not logged in. -
403 Forbidden
: User is not an admin.
Method: POST
Path: /admin/rpgSystems/cpRed/customAmmunition/add
{
"gameId": 1,
"name": "Amunicja EMP 2",
"description": "Amunicja EMP, która wyłącza elektronikę w pojazdach i broniach.",
"pricePerBullet": 20,
"availability": "SUPER_LUXURY"
}
{
"message": "Customowa amunicja została dodana.",
"error": 200,
"timestamp": "..."
}
-
400 Bad Request
: User not authenticated. -
401 Unauthorized
: User not logged in. -
404 Not Found
: Invalid custom ammunition data.
Method: PUT
Path: /admin/rpgSystems/cpRed/customAmmunition/update/{ammunitionId}
{
"gameId": 1,
"name": "Amunicja EMP zmodyfikowany 3",
"description": "Amunicja EMP, która wyłącza elektronikę w pojazdach i broniach.",
"pricePerBullet": 2000,
"availability": "COSTLY"
}
{
"message": "Customowa amunicja została zmodyfikowana.",
"error": 200,
"timestamp": "..."
}
-
400 Bad Request
: Invalid custom ammunition ID or data. -
401 Unauthorized
: User not logged in. -
404 Not Found
:Custom ammunition with the specified ID does not exist.
-
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.