Democratic multiplayer text adventure
$ git clone ...
$ cd server
$ go run src/run/go
Open http://localhost:8080/client in your browser
All requests need to use Basic Authentication
Returns current location view (together with items, npcs, exits and actions)
{
"name": "Lake",
"desc": "You are looking at the beautiful lake full of fish.",
"log": [
{"type":"emote","data":"You caught a fish"}
],
"exits": {
"back": "a pub",
"east": "a lake",
"northeast": "a lake"
},
"actions": {
"fishing": "go fishing"
},
"items": [
{
"id": "fishing_pole",
"name": "Fishing pole",
"desc": "A simple fishing pole"
}
]
}
Invalid {direction} is ignored
Return is the same as /look
Invalid {action} is ignored
Return is the same as /look
If invalid {item} is specified or {item} is not on ground, null is returned
Otherwise return is the same as /look
If invalid {item} is specified or {item} is not in player's inventory, null is returned
Otherwise return is the same as /look
If invalid {item} is specified null is returned
Otherwise return is the same as /look
Return is always the same as /look
Return is always the same as /look
Returns array of items in player's inventory
[
{
"id": "fishing_pole",
"name": "Fishing pole",
"desc": "A simple fishing pole"
},
{
"id": "fish",
"name": "Fish",
"desc": "A small fish"
}
]
Returns description of object or null if {item} is not available on ground or in inventory
{
"name": "Fishing pole",
"desc": "A simple fishing pole"
}
Attributes and other properties will be added over time
Returns key value representation of player's stats
{
"damage": {"min":5,"max":6},
"defense": {"min":10,"max":12}
}
Returns key value representation of player's stats (see GET /api/stats
) or null if {item} is not available in inventory
Returns list of players in room, if player is not joined to a room []
(empty array) is returned
[
"Belzebub",
"Arthur",
"Kain"
]
Everything in POST body is used as is and sent to all players as message
If player is not connected to any room false is returned, otherwise true
Joins the specified {room}
If player is already in some room, player will leave that room automatically (this is ignored if {room} is same as player's current room)
If {room} does not exist it will be created
Return is the same as /look
or null if maximum amount of rooms is reached or no {room} is specified
Leave the current room
Return is the same as /rooms
Everything in POST body is used as string and set as Name
Returns false if empty string ("") is sent, otherwise true
Values for Username & Password are used from Basic Authentication headers
If Username is taken or Username is not valid, false is returned, otherwise true
Returns list of rooms available (only visible rooms are listed)
[
"room1",
"groupe_le_france"
]
Returns list of all active players
[
"Belzebub",
"Arthur",
"Kain"
]
Everything in POST body is used as is and sent to {player} as message
If {player} is not connected false is returned, otherwise true