blob: 16e04656a3d9195584c8c3b1588154c5339c7f05 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
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
|