summaryrefslogtreecommitdiff
path: root/jws/epibazaar/item-producer/src/main/resources
diff options
context:
space:
mode:
authorMartial Simon <msimon_fr@hotmail.com>2025-09-15 01:07:58 +0200
committerMartial Simon <msimon_fr@hotmail.com>2025-09-15 01:07:58 +0200
commit967be9e750221ab2ab783f95df79bb26d290a45e (patch)
tree6802900a5e975f9f68b169f0f503f040056d6952 /jws/epibazaar/item-producer/src/main/resources
add: added projectsHEADmain
Diffstat (limited to 'jws/epibazaar/item-producer/src/main/resources')
-rw-r--r--jws/epibazaar/item-producer/src/main/resources/application.properties13
-rw-r--r--jws/epibazaar/item-producer/src/main/resources/db/migration/V1__Init.sql25
-rw-r--r--jws/epibazaar/item-producer/src/main/resources/maps/custom.epimap16
-rw-r--r--jws/epibazaar/item-producer/src/main/resources/maps/huge.epimap30
-rw-r--r--jws/epibazaar/item-producer/src/main/resources/maps/pretty.epimap16
-rw-r--r--jws/epibazaar/item-producer/src/main/resources/openapi.yaml287
6 files changed, 387 insertions, 0 deletions
diff --git a/jws/epibazaar/item-producer/src/main/resources/application.properties b/jws/epibazaar/item-producer/src/main/resources/application.properties
new file mode 100644
index 0000000..498479f
--- /dev/null
+++ b/jws/epibazaar/item-producer/src/main/resources/application.properties
@@ -0,0 +1,13 @@
+%dev.quarkus.http.port=8081
+quarkus.datasource.db-kind=postgresql
+quarkus.datasource.username=postgres
+quarkus.datasource.jdbc.url=jdbc:postgresql://localhost:5432/item_producer?currentSchema=public
+quarkus.transaction-manager.default-transaction-timeout=3000s
+quarkus.hibernate-orm.log.queries-slower-than-ms=200
+quarkus.http.cors=true
+quarkus.http.cors.origins=*
+quarkus.hibernate-orm.database.generation=drop-and-create
+
+quarkus.kafka.devservices.image-name=reg.undercloud.cri.epita.fr/docker/redpandadata/redpanda:v24.1.2
+quarkus.devservices.enabled=true
+%test.quarkus.devservices.enabled=false
diff --git a/jws/epibazaar/item-producer/src/main/resources/db/migration/V1__Init.sql b/jws/epibazaar/item-producer/src/main/resources/db/migration/V1__Init.sql
new file mode 100644
index 0000000..0eede01
--- /dev/null
+++ b/jws/epibazaar/item-producer/src/main/resources/db/migration/V1__Init.sql
@@ -0,0 +1,25 @@
+CREATE TABLE IF NOT EXISTS "game"
+(
+ id SERIAL PRIMARY KEY NOT NULL,
+ map TEXT NOT NULL
+);
+
+CREATE TABLE IF NOT EXISTS "item"
+(
+ id SERIAL PRIMARY KEY NOT NULL,
+
+ type VARCHAR(64) NOT NULL,
+ quantity FLOAT NOT NULL
+);
+
+CREATE TABLE IF NOT EXISTS "player"
+(
+ id SERIAL PRIMARY KEY NOT NULL,
+ pos_x INTEGER NOT NULL,
+ pos_y INTEGER NOT NULL,
+ last_move TIMESTAMP,
+ last_collect TIMESTAMP,
+ move_speed_multiplier FLOAT NOT NULL,
+ stamina_multiplier FLOAT NOT NULL,
+ collect_rate_multiplier FLOAT NOT NULL
+);
diff --git a/jws/epibazaar/item-producer/src/main/resources/maps/custom.epimap b/jws/epibazaar/item-producer/src/main/resources/maps/custom.epimap
new file mode 100644
index 0000000..5b510f3
--- /dev/null
+++ b/jws/epibazaar/item-producer/src/main/resources/maps/custom.epimap
@@ -0,0 +1,16 @@
+2G4R3W5G2R
+5G3W4R2G2W
+6R3G2W5G
+3W5G6R2W
+4G3R4W5G
+2W5R3G4W2G
+6G4R3W3G
+4R6G3W3R
+5G2W5R4G
+3W5R4G3W1G
+2G6W3R5G
+4W5G3R4W
+3G4R5W4G
+5R3G6W2R
+2W5G4R5W
+9G7G \ No newline at end of file
diff --git a/jws/epibazaar/item-producer/src/main/resources/maps/huge.epimap b/jws/epibazaar/item-producer/src/main/resources/maps/huge.epimap
new file mode 100644
index 0000000..d8384bd
--- /dev/null
+++ b/jws/epibazaar/item-producer/src/main/resources/maps/huge.epimap
@@ -0,0 +1,30 @@
+9G9G9G3G
+8G3W3R2G2R2G2W1R4G1R2G
+7G2W1G3R1W1G1R1W2G1R1G1R1G1R1G2W2R1G
+1G1W4G1R1G1W1R5G2R4G1R1W1R2G1W3G
+1G1W1R2G2R1G1W2R3G2W2G2O3G2R3G1W1G
+1G1W1G2W7G4O3G2O3R3G2W1G
+1G1R4G1R3G1R3G2O3G2O2R3G2W2G
+4G3R3G3R8O3R2G1W3G
+4G3R1G5R4O2G1W2R1G2R5G
+4G9R1G3O9G4G
+5G4R2W2O1R5O2G3W1R5G
+3G4R2G8O1G7W1G2W2G
+3G1R1G2R1G1W9O1W2G1R2W6G
+1G1R1G2R2G1R1W1G6O4W9O1G
+1G4R1G2R1W1G3O1G2O5W1G7O1G
+1G1W2R1W1G1R1G2W3O2R1O4W1G1R7O1G
+5G3W3G2O1G1W1G3W1G1W1G7O1G
+1G2R2G2W4R2O3G3W1R1G1W1G1R5O1G
+1G1W1R1G2R4W1R1G1R1G3R2W5G5O1G
+1G2R2G1R2W1R2G6R1W1G9O1O1G
+2G2W9R2R3W2G9O1G
+6G3W2G4R3W2G2O1W6O1G
+1G3R2G3W2G3R1G3W2R2O1R6O1G
+1G3R1G1W3R2W1R2G2W1G3R2O1R1O1G1O1G1W1O1G
+3G2W1G2R1G2R2G2W3G1R1W2G2R1G1W1G1R1O1G
+3G1W1R3G2R4G1R2G1W1G1R2W2R1G1W3R1G
+1G4W1G3R2W3G2R3W1R2W3R1G2R2G
+2G3W1G2R6G2R2G2R1G1W1G2W1G1R1G1W1G
+2G3W1G1W1G4W9G1G2R1W1G2R2G
+9G9G9G3G \ No newline at end of file
diff --git a/jws/epibazaar/item-producer/src/main/resources/maps/pretty.epimap b/jws/epibazaar/item-producer/src/main/resources/maps/pretty.epimap
new file mode 100644
index 0000000..3699c22
--- /dev/null
+++ b/jws/epibazaar/item-producer/src/main/resources/maps/pretty.epimap
@@ -0,0 +1,16 @@
+9G7G
+2G6O3G4R1G
+2G5O4G3R2G
+2G4O4G3W2G1G
+2G3O4G5W1G1G
+2G3O3G5W3G
+2G3G4W4G3R
+2G3R3G4W3O1G
+1G2R3G4W4O2G
+1G3G3W6O3G
+1G2W4G5O4G
+1G2W3G4R3G3G
+1G3R4G4R1G3G
+1G5R4G4R2G
+1G5R3G6G1G
+9G7G
diff --git a/jws/epibazaar/item-producer/src/main/resources/openapi.yaml b/jws/epibazaar/item-producer/src/main/resources/openapi.yaml
new file mode 100644
index 0000000..16e0465
--- /dev/null
+++ b/jws/epibazaar/item-producer/src/main/resources/openapi.yaml
@@ -0,0 +1,287 @@
+---
+openapi: 3.1.0
+tags:
+- name: Game Management
+- name: Player Actions
+- name: Upgrades
+paths:
+ /:
+ get:
+ summary: Retrieve all inventory resources
+ description: Fetch all resources currently available in the inventory.
+ x-quarkus-openapi-method-ref: m98752433_-1109396335
+ tags:
+ - Game Management
+ responses:
+ "200":
+ description: Resources successfully retrieved.
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ItemsResponse"
+ "400":
+ description: The game is not running.
+ servers:
+ - url: http://localhost:8081/
+ /collect:
+ post:
+ summary: Collect resources
+ description: Collect the resource available on the player's current tile.
+ x-quarkus-openapi-method-ref: m98752433_799402137
+ tags:
+ - Player Actions
+ responses:
+ "200":
+ description: Resource successfully collected and sent to inventory.
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/StartResponse"
+ "400":
+ description: Invalid tile or the game is not running.
+ "429":
+ description: Player has recently collected and must wait before collecting
+ again.
+ servers:
+ - url: http://localhost:8081/
+ /move:
+ post:
+ summary: Move player
+ description: "Move the player in the specified direction (left, right, up, or\
+ \ down)."
+ x-quarkus-openapi-method-ref: m98752433_-1586243046
+ tags:
+ - Player Actions
+ requestBody:
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/MoveRequest"
+ required: true
+ responses:
+ "200":
+ description: Player successfully moved.
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/MoveResponse"
+ "400":
+ description: Invalid direction or the game is not running.
+ "429":
+ description: Player has recently moved and must wait before moving again.
+ servers:
+ - url: http://localhost:8081/
+ /player:
+ get:
+ summary: Retrieve player information
+ description: Fetch information about the current player.
+ x-quarkus-openapi-method-ref: m98752433_-1988770431
+ tags:
+ - Game Management
+ responses:
+ "200":
+ description: Player information successfully retrieved.
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/PlayerResponse"
+ "400":
+ description: The game is not running.
+ servers:
+ - url: http://localhost:8081/
+ /start:
+ post:
+ summary: Start the game
+ description: Initialize and start the item-producer game. Synchronizes the database
+ with the `Inventory` service.
+ x-quarkus-openapi-method-ref: m98752433_677674067
+ tags:
+ - Game Management
+ requestBody:
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/StartRequest"
+ required: true
+ responses:
+ "200":
+ description: The game started successfully.
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/StartResponse"
+ "400":
+ description: Invalid `path` provided.
+ servers:
+ - url: http://localhost:8081/
+ /upgrade/collect:
+ patch:
+ summary: Upgrade collection rate
+ description: Increase the amount of resources collected per action.
+ x-quarkus-openapi-method-ref: m98752433_274012880
+ tags:
+ - Upgrades
+ responses:
+ "204":
+ description: Collection rate upgrade successfully applied.
+ "400":
+ description: Insufficient funds or the game is not running.
+ "404":
+ description: The money was not found.
+ servers:
+ - url: http://localhost:8081/
+ /upgrade/move:
+ patch:
+ summary: Upgrade move speed
+ description: Decrease the tick rate required for the player to move.
+ x-quarkus-openapi-method-ref: m98752433_1889564488
+ tags:
+ - Upgrades
+ responses:
+ "204":
+ description: Move speed upgrade successfully applied.
+ "400":
+ description: Insufficient funds or the game is not running.
+ "404":
+ description: The money was not found.
+ servers:
+ - url: http://localhost:8081/
+ /upgrade/stamina:
+ patch:
+ summary: Upgrade stamina
+ description: Decrease the tick rate required to collect resources.
+ x-quarkus-openapi-method-ref: m98752433_-1142370765
+ tags:
+ - Upgrades
+ responses:
+ "204":
+ description: Stamina upgrade successfully applied.
+ "400":
+ description: Insufficient funds or the game is not running.
+ "404":
+ description: The money was not found.
+ servers:
+ - url: http://localhost:8081/
+ /upgrades:
+ get:
+ summary: Retrieve upgrade costs
+ description: Fetch the costs of all available upgrades.
+ x-quarkus-openapi-method-ref: m98752433_-99503618
+ tags:
+ - Game Management
+ responses:
+ "200":
+ description: Upgrade costs successfully retrieved.
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/UpgradeCostResponse"
+ "400":
+ description: The game is not running.
+ servers:
+ - url: http://localhost:8081/
+components:
+ schemas:
+ Direction:
+ type: string
+ enum:
+ - UP
+ - DOWN
+ - RIGHT
+ - LEFT
+ ItemResponse:
+ type: object
+ properties:
+ id:
+ type: integer
+ format: int32
+ quantity:
+ type: number
+ format: float
+ type:
+ $ref: "#/components/schemas/ResourceType"
+ ItemsResponse:
+ type: object
+ properties:
+ itemsResponse:
+ type: array
+ items:
+ $ref: "#/components/schemas/ItemResponse"
+ LocalDateTime:
+ type: string
+ format: date-time
+ examples:
+ - 2022-03-10T12:15:50
+ MoveRequest:
+ type: object
+ properties:
+ direction:
+ $ref: "#/components/schemas/Direction"
+ MoveResponse:
+ type: object
+ properties:
+ posX:
+ type: integer
+ format: int32
+ posY:
+ type: integer
+ format: int32
+ PlayerResponse:
+ type: object
+ properties:
+ posX:
+ type: integer
+ format: int32
+ posY:
+ type: integer
+ format: int32
+ lastMove:
+ $ref: "#/components/schemas/LocalDateTime"
+ lastCollect:
+ $ref: "#/components/schemas/LocalDateTime"
+ moveSpeedMultiplier:
+ type: number
+ format: float
+ staminaMultiplier:
+ type: number
+ format: float
+ collectRateMultiplier:
+ type: number
+ format: float
+ ResourceType:
+ type: string
+ enum:
+ - MONEY
+ - GROUND
+ - WATER
+ - ROCK
+ - WOOD
+ StartRequest:
+ type: object
+ properties:
+ mapPath:
+ type: string
+ StartResponse:
+ type: object
+ properties:
+ map:
+ type: array
+ items:
+ type: array
+ items:
+ $ref: "#/components/schemas/ResourceType"
+ UpgradeCostResponse:
+ type: object
+ properties:
+ upgradeCollectCost:
+ type: number
+ format: float
+ upgradeMoveCost:
+ type: number
+ format: float
+ upgradeStaminaCost:
+ type: number
+ format: float
+info:
+ title: item-producer API
+ version: 1.0.0