Skip to content

bobesa/olduar

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Olduar

Democratic multiplayer text adventure

Quick start

    $ git clone ...
    $ cd server
    $ go run src/run/go

Open http://localhost:8080/client in your browser

REST Api

All requests need to use Basic Authentication

GET /api/look

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"
        }
    ]
}

POST /api/go/{direction}

Invalid {direction} is ignored

Return is the same as /look

POST /api/do/{action}

Invalid {action} is ignored

Return is the same as /look

POST /api/pickup/{item}

If invalid {item} is specified or {item} is not on ground, null is returned

Otherwise return is the same as /look

POST /api/drop/{item}

If invalid {item} is specified or {item} is not in player's inventory, null is returned

Otherwise return is the same as /look

POST /api/use/{item}

If invalid {item} is specified null is returned

Otherwise return is the same as /look

POST /api/defend

Return is always the same as /look

POST /api/attack/{target}

Return is always the same as /look

GET /api/inventory

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"
	}
]

GET /api/inspect/{item}

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

GET /api/stats

Returns key value representation of player's stats

{
    "damage": {"min":5,"max":6},
    "defense": {"min":10,"max":12}
}

GET /api/equip/{item}

Returns key value representation of player's stats (see GET /api/stats) or null if {item} is not available in inventory

GET /api/party

Returns list of players in room, if player is not joined to a room [](empty array) is returned

[
    "Belzebub",
    "Arthur",
    "Kain"
]

POST /api/say

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

POST /api/join/{room}

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

POST /api/leave

Leave the current room

Return is the same as /rooms

POST /api/rename

Everything in POST body is used as string and set as Name

Returns false if empty string ("") is sent, otherwise true

POST /api/register

Values for Username & Password are used from Basic Authentication headers

If Username is taken or Username is not valid, false is returned, otherwise true

GET /api/rooms

Returns list of rooms available (only visible rooms are listed)

[
    "room1",
    "groupe_le_france"
]

GET /api/players

Returns list of all active players

[
    "Belzebub",
    "Arthur",
    "Kain"
]

POST /api/tell/{player}

Everything in POST body is used as is and sent to {player} as message

If {player} is not connected false is returned, otherwise true

About

Democratic multiplayer text adventure

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •