nanoMMO 0.97.8
Building an MMO: The Engineering Series
Loading...
Searching...
No Matches
nanommo::Characters Class Reference

#include <characters.h>

Public Member Functions

 Characters (Database &database)
absl::StatusOr< std::vector< protocol::CharacterListing > > List (uint32_t account)
absl::StatusOr< uint32_t > Create (uint32_t account, const std::string &world, const std::string &name, const std::optional< protocol::Looks > &looks=std::nullopt)
absl::Status Delete (uint32_t account, uint32_t id)
absl::StatusOr< std::string > WorldOf (uint32_t account, uint32_t id)
 Characters (const rig::Rig &rig, Shader shader, const figures::Figures &figures)
 Characters (const std::string &folder, const std::vector< std::string > &files, float height, Shader shader)
 ~Characters ()
 Characters (const Characters &)=delete
Characters & operator= (const Characters &)=delete
std::size_t size () const
void Hold (uint32_t id, const items::Look &look, Shader shader)
void Wear (uint32_t id, const items::Look &look)
void Learn (uint32_t skill, const skills::Look &look)
 Keeps the skill's move, for the players who use it.
void Draw (const Figure &figure, Color color, const Outline *outline) const
void DrawGhost (const Figure &figure, Color color) const
std::optional< std::pair< Vector3, Vector3 > > Blade (const Figure &figure) const
std::optional< Gait > GaitOf (const Figure &figure) const
 Where the figure is in its walk or run: none, if it's doing neither.

Static Public Attributes

static constexpr uint32_t kMostLook = 255
 The most each of a character's looks can be, as its column keeps it.

Detailed Description

An account's characters, which the login server lists, makes and deletes. Each is in one world, by its id, with a name nobody else in that world has. What a world saves of them, it saves by that id (Players).

Definition at line 19 of file characters.h.

Constructor & Destructor Documentation

◆ Characters() [1/4]

nanommo::Characters::Characters ( Database & database)
inlineexplicit

Definition at line 24 of file characters.h.

◆ Characters() [2/4]

nanommo::Characters::Characters ( const rig::Rig & rig,
Shader shader,
const figures::Figures & figures )

People: one for each of the rig's builds, with its motions, in the figures' body, and each player in their own skin and hair.

Definition at line 118 of file characters.cc.

◆ Characters() [3/4]

nanommo::Characters::Characters ( const std::string & folder,
const std::vector< std::string > & files,
float height,
Shader shader )

Monsters: each model in the folder's files, with the clips in it, as tall as the height.

Definition at line 146 of file characters.cc.

◆ ~Characters()

nanommo::Characters::~Characters ( )

Definition at line 250 of file characters.cc.

◆ Characters() [4/4]

nanommo::Characters::Characters ( const Characters & )
delete

Member Function Documentation

◆ Blade()

std::optional< std::pair< Vector3, Vector3 > > nanommo::Characters::Blade ( const Figure & figure) const

Where the figure's blade is, in the world, from the hilt to the tip, as it's posed: none, if it holds nothing.

Definition at line 424 of file characters.cc.

◆ Create()

absl::StatusOr< uint32_t > nanommo::Characters::Create ( uint32_t account,
const std::string & world,
const std::string & name,
const std::optional< protocol::Looks > & looks = std::nullopt )

A new character, which gets the starting kit as it first enters its world, and looks as the player chose, or, without looks, as its id picks. An InvalidArgument error says what's wrong with the name or the looks, an AlreadyExists error that it's taken in the world, and a ResourceExhausted one that the account has kCharactersPerWorld there already.

Definition at line 113 of file characters.cc.

◆ Delete()

absl::Status nanommo::Characters::Delete ( uint32_t account,
uint32_t id )

Deletes the account's character, with its skills and its bag, or says NotFound when the account has no character with that id.

Definition at line 174 of file characters.cc.

◆ Draw()

void nanommo::Characters::Draw ( const Figure & figure,
Color color,
const Outline * outline ) const

Draws the figure, posed, with what it wears and its weapon, and with an outline, when it's given one: a model in the colour, and a player's figure in their skin, with their hair, and what's dyed in the colour.

Definition at line 441 of file characters.cc.

◆ DrawGhost()

void nanommo::Characters::DrawGhost ( const Figure & figure,
Color color ) const

The figure as it was, see-through and lit in the colour, without an outline: one of the copies a fast move leaves behind it. Drawn after what's solid, as it doesn't hide what's behind it.

Definition at line 495 of file characters.cc.

◆ GaitOf()

std::optional< Gait > nanommo::Characters::GaitOf ( const Figure & figure) const

Where the figure is in its walk or run: none, if it's doing neither.

Definition at line 361 of file characters.cc.

◆ Hold()

void nanommo::Characters::Hold ( uint32_t id,
const items::Look & look,
Shader shader )

Loads the item's model, to draw in the hand of each figure that holds the item.

Definition at line 280 of file characters.cc.

◆ Learn()

void nanommo::Characters::Learn ( uint32_t skill,
const skills::Look & look )

Keeps the skill's move, for the players who use it.

Definition at line 343 of file characters.cc.

◆ List()

absl::StatusOr< std::vector< protocol::CharacterListing > > nanommo::Characters::List ( uint32_t account)

All the account's characters, in all the worlds, the oldest first, with what they wear, from what MySQL has: what a world has saved in Redis and not yet flushed shows a few seconds later.

Definition at line 19 of file characters.cc.

◆ operator=()

Characters & nanommo::Characters::operator= ( const Characters & )
delete

◆ size()

std::size_t nanommo::Characters::size ( ) const
inline

Definition at line 48 of file characters.h.

◆ Wear()

void nanommo::Characters::Wear ( uint32_t id,
const items::Look & look )

Makes the item's parts, for each character to draw on the players who wear it.

Definition at line 324 of file characters.cc.

◆ WorldOf()

absl::StatusOr< std::string > nanommo::Characters::WorldOf ( uint32_t account,
uint32_t id )

The world the account's character is in, or NotFound when the account has no character with that id.

Definition at line 200 of file characters.cc.

Member Data Documentation

◆ kMostLook

uint32_t nanommo::Characters::kMostLook = 255
staticconstexpr

The most each of a character's looks can be, as its column keeps it.

Definition at line 22 of file characters.h.


The documentation for this class was generated from the following files: