-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add MemoryUtilisationTest * WIP - Started working on WebGame and RestController * WIP - Continued working on Controller * WIP - Basic API loop in place * WIP - Rename packages and add same-site=strict to props * WIP - Create actions using factory with environment * WIP - Added environment to appProperties and made actions web-compatible * WIP - Refactor Encounter to store records if Environment.WEB * WIP - Add locationName and poiName * WIP - Make every call return WebResponseDto * WIP - Clean up logging and add gold cheat * WIP - Consolidate /start and /play and simplify actions * WIP - Update documentation and clean up * WIP - Make Events web-compatible * WIP - Add quest log endpoint * WIP - Update quest log endpoint and docs * Fix 2 event display related bugs Fix bug where events were not displayed at target and fix bug where event were not displayed at MAIN_SQUARE at all * Clean up Postman/Controller, add WIP resumeGame, update README
- Loading branch information
1 parent
edf7832
commit 91f240a
Showing
108 changed files
with
1,614 additions
and
330 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
# How to use the API | ||
|
||
Endpoints require basic auth. Use `player1` / `password` or `player2` / `password`. | ||
|
||
## Endpoints | ||
|
||
### `GET` `/api/play` | ||
|
||
- Requires basic auth | ||
- Returns a JSON `WebResponse` containing the `List<ActionResponseDto>` and `PlayerDto` | ||
- Example request: | ||
|
||
``` | ||
curl -u player1:password http://localhost:8080/api/play | ||
``` | ||
|
||
### `POST` `/api/play` | ||
|
||
- Requires basic auth | ||
- Returns a JSON `WebResponse` containing the `viewType` to be rendered and the relevant DTO(s) | ||
- Requires JSON body containing the `playerId` and `choice` | ||
- Example request: | ||
|
||
``` | ||
curl -u player1:password -X POST http://localhost:8080/api/play -H "Content-Type: application/json" -d '{"playerId": "PLA~PLAYER1@1277912753", "choice": "1"}' | ||
``` | ||
|
||
- Example body: | ||
|
||
```json | ||
{ | ||
"playerId": "PLA~PLAYER1@1277912753", | ||
"choice": "1" | ||
} | ||
``` | ||
|
||
### `GET` `/api/play/{playerId}/quest-log` | ||
|
||
- Requires basic auth | ||
- Returns a JSON `List<QuestDto>` | ||
- Example request: | ||
|
||
``` | ||
curl -u player1:password http://localhost:8080/api/play/PLA~PLAYER1@1277912753/quest-log | ||
``` | ||
|
||
- Example response: | ||
|
||
```json | ||
[ | ||
{ | ||
"about": "A dialogue", | ||
"eventType": "DIALOGUE", | ||
"eventState": "DECLINED", | ||
"questGiver": { | ||
"name": "Ashur-nasir-pal Hapi", | ||
"location": "Thyrvera", | ||
"poi": "Cathedral" | ||
}, | ||
"questTarget": null | ||
} | ||
] | ||
``` | ||
|
||
### Example `WebResponse` | ||
|
||
```json | ||
{ | ||
"viewType": "DEFAULT", | ||
"actions": [ | ||
{ | ||
"index": 1, | ||
"name": "Go to... (4 point(s) of interest)" | ||
}, | ||
{ | ||
"index": 2, | ||
"name": "Travel to Hylasoria (102 km south-east, unvisited) (Location)" | ||
}, | ||
{ | ||
"index": 3, | ||
"name": "Travel to Valthia (102 km south-west, unvisited) (Location)" | ||
}, | ||
{ | ||
"index": 4, | ||
"name": "Show debug menu" | ||
} | ||
], | ||
"encounterSummary": null, | ||
"interactions": null, | ||
"player": { | ||
"id": "PLA~PLAYER1@1277912753", | ||
"name": "player1", | ||
"locationName": "Thyrvera", | ||
"poiName": "Thyrvera Field", | ||
"x": 12779, | ||
"y": 12753, | ||
"gold": 100, | ||
"minDamage": 1, | ||
"maxDamage": 4, | ||
"health": 100, | ||
"maxHealth": 100, | ||
"experience": 0, | ||
"level": 1, | ||
"previousState": "AT_POI", | ||
"currentState": "AT_POI" | ||
} | ||
} | ||
``` | ||
|
||
## Postman collection | ||
|
||
This folder contains a Postman collection for the API. Import it into Postman to use it with `player1`. |
Oops, something went wrong.