WeaponsController - xEdziu/RPG-Handy-Helper GitHub Wiki
This page contains documentation for the CpRedWeaponsController
, which manages weapons in the Cyberpunk Red RPG system.
Base Path: /api/v1/authorized
Package: dev.goral.rpghandyhelper.rpgSystems.cpRed.manual.weapons
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/cpRed/weapons/all |
Returns basic info about all available weapons |
GET | /rpgSystems/cpRed/weapons/{weaponId} |
Returns detailed information about a specific weapon by ID |
GET | /admin/rpgSystems/cpRed/weapons/all |
Returns a full list of all weapons types with administrative data |
POST | /admin/rpgSystems/cpRed/weapons/add |
Adds a new weapon type to the system |
PUT | /admin/rpgSystems/cpRed/weapons/update/{weaponId} |
Update weapon data |
-requiredSkillId (Integer): ID of the connected stat for the weapon. Required.
-type (String): Category of the weapon. Required. Possible values: MEDIUM_PISTOL
,
HEAVY_PISTOL
,
VERY_HEAVY_PISTOL
,
SUBMACHINE_GUN
,
HEAVY_SUBMACHINE_GUN
,
SHOTGUN
,
ASSAULT_RIFLE
,
SNIPER_RIFLE
,
BOW
,
CROSSBOW
,
GRENADE_LAUNCHER
,
ROCKET_LAUNCHER
,
LIGHT_MELEE_WEAPON
,
MEDIUM_MELEE_WEAPON
,
HEAVY_MELEE_WEAPON
,
VERY_HEAVY_MELEE_WEAPON
,
THROWING_WEAPON
,
EXPLOSIVE
,
GRENADE
.
-dammage (Integer): Damage value of the weapon. Required.
- magazineCapacity (Integer): Maximum number of rounds the weapon can hold in its magazine. Required.
- standardAmmunitionId (Long): ID of the standard ammunition type for the weapon. Required.
- numberOfAttacks (Short): Number of attacks the weapon can perform in a single action. Required.
- handType (Short): Type of hand used to wield the weapon. Required.
- isHidden (Boolean): Indicates if the weapon is hidden or not. Required.
-
quality (String): Quality of the weapon. Required. Possible values:
POOR
,STANDARD
,EXCELLENT
. - price (Integer): Price of the weapon in Eurodollars. Required.
-
availability (String): Availability status. Required. Possible values:
CHEAP
,EVERYDAY
,COSTLY
,PREMIUM
,EXPENSIVE
,VERY_EXPENSIVE
,LUXURY
,SUPER_LUXURY
. - isModifiable (Boolean): Indicates if the weapon can be modified. Required.
- modSlots (Short): Number of modification slots available for the weapon. Required.
- description (String): Description of the weapon. Required.
- message (String): Describes the result of the operation.
- error (Integer): HTTP status code.
- timestamp (String): Time the response was generated.
- weapon (Object): A single weapon object (if applicable).
- weaponList (Array): List of weapons (if applicable).
Method: GET
Path: /rpgSystems/cpRed/weapons/all
{
"message": "Bronie zostały pobrane.",
"error": 200,
"weapons": [
{
"requiredSkillId": 1,
"type": "Pistolet",
"damage": 2,
"magazineCapacity": 12,
"standardAmmunitionId": 1,
"numberOfAttacks": 1,
"handType": 1,
"isHidden": true,
"quality": "STANDARD",
"price": 100,
"availability": "EVERYDAY",
"isModifiable": true,
"modSlots": 3,
"description": "Standardowy pistolet używany w wielu sytuacjach."
},
{
"requiredSkillId": 1,
"type": "Karabin",
"damage": 4,
"magazineCapacity": 30,
"standardAmmunitionId": 2,
"numberOfAttacks": 2,
"handType": 2,
"isHidden": false,
"quality": "POOR",
"price": 500,
"availability": "EVERYDAY",
"isModifiable": true,
"modSlots": 3,
"description": "Karabin używany przez Kapitana Bombe."
}
],
"timestamp": "..."
}
-
401 Unauthorized
: User is not logged in.
Method: GET
Path: /rpgSystems/cpRed/skils/{weaponId}
{
"weapon": {
"requiredSkillId": 1,
"type": "Pistolet",
"damage": 2,
"magazineCapacity": 12,
"standardAmmunitionId": 1,
"numberOfAttacks": 1,
"handType": 1,
"isHidden": true,
"quality": "STANDARD",
"price": 100,
"availability": "EVERYDAY",
"isModifiable": true,
"modSlots": 3,
"description": "Standardowy pistolet używany w wielu sytuacjach."
},
"message": "Broń została pobrana.",
"error": 200,
"timestamp": "..."
}
-
400 Bad Request
: Invalid weapon ID. -
401 Unauthorized
: User is not logged in. -
404 Not Found
: Weapon with the specified ID does not exist.
Method: GET
Path: admin/rpgSystems/cpRed/weapons/all
{
"message": "Bronie zostały pobrane dla administratora.",
"error": 200,
"weapons": [
{
"id": 1,
"requiredSkillId": {
"id": 1,
"category": "FIGHTING",
"name": "Bijatyka",
"connectedStat": {
"id": 1,
"name": "Zwinność",
"tag": "ZW",
"changeable": false,
"description": "Zwinność określa zdolność postaci do wykonywania zwinnych ruchów, unikania ataków i wykonywania skomplikowanych manewrów."
},
"description": "Bijatyka to umiejętność walki wręcz"
},
"name": "Pistolet",
"damage": 2,
"magazineCapacity": 12,
"standardAmmunitionId": {
"id": 1,
"name": "Amunicja karabinowa",
"description": "Amunicja do broni palnej, która jest używana przez Kapitana Bombe.",
"pricePerBullet": 50,
"availability": "SUPER_LUXURY"
},
"numberOfAttacks": 1,
"handType": 1,
"isHidden": true,
"quality": "STANDARD",
"price": 100,
"availability": "EVERYDAY",
"isModifiable": true,
"modSlots": 3,
"description": "Standardowy pistolet używany w wielu sytuacjach."
},
{
"id": 2,
"requiredSkillId": {
"id": 1,
"category": "FIGHTING",
"name": "Bijatyka",
"connectedStat": {
"id": 1,
"name": "Zwinność",
"tag": "ZW",
"changeable": false,
"description": "Zwinność określa zdolność postaci do wykonywania zwinnych ruchów, unikania ataków i wykonywania skomplikowanych manewrów."
},
"description": "Bijatyka to umiejętność walki wręcz"
},
"name": "Karabin",
"damage": 4,
"magazineCapacity": 30,
"standardAmmunitionId": {
"id": 2,
"name": "Breneka",
"description": "Amunicja do strzelby",
"pricePerBullet": 10,
"availability": "CHEAP"
},
"numberOfAttacks": 2,
"handType": 2,
"isHidden": false,
"quality": "POOR",
"price": 500,
"availability": "EVERYDAY",
"isModifiable": true,
"modSlots": 3,
"description": "Karabin używany przez Kapitana Bombe."
}
],
"timestamp": "..."
}
-
401 Unauthorized
: User is not logged in. -
403 Forbidden
: User is not an admin.
Method: POST
Path: /admin/rpgSystems/cpRed/weapon/add
{
"requiredSkillId": 1,
"name": "Średni pistolet 2",
"damage": 3,
"magazineCapacity": 8,
"standardAmmunitionId": 1,
"numberOfAttacks": 2,
"handType": 1,
"isHidden": true,
"quality": "STANDARD",
"price": 300,
"availability": "EVERYDAY",
"isModifiable": true,
"modSlots": 3,
"description": "Mała lekka broń palna, która nie wymaga dużej siły do użycia. Idealna do walki w bliskim zasięgu."
}
{
"message": "Broń została dodana.",
"error": 200,
"timestamp": "..."
}
-
400 Bad Request
: User not authenticated. -
401 Unauthorized
: User not logged in. -
403 Forbidden
: User is not an admin. -
404 Not Found
: Invalid weapon data.
Method: PUT
Path: /admin/rpgSystems/cpRed/cyberwares/weapon/{weaponId}
{
"requiredSkillId": 2,
"name": "Średni pistolet zmodyfikowany",
"damage": 4,
"magazineCapacity": 16,
"standardAmmunitionId": 2,
"numberOfAttacks": 1,
"handType": 2,
"isHidden": false,
"quality": "EXCELLENT",
"price": 4000,
"availability": "LUXURY",
"isModifiable": false,
"modSlots": 3,
"description": "Inny opis"
}
{
"message": "Broń została zmodyfikowana.",
"error": 200,
"timestamp": "..."
}
-
400 Bad Request
: Invalid weapon ID or data. -
401 Unauthorized
: User not logged in. -
403 Forbidden
: User is not an admin. -
404 Not Found
: Weapon 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.