Rehti MMORPG  1.0.0
Rehti MMORPG is a free and open source MMORPG game.
SkillSet Class Reference

Contains all the skills that a character has. More...

#include <SkillSet.hpp>

Collaboration diagram for SkillSet:
Collaboration graph

Public Member Functions

 SkillSet ()
 
const std::map< int, SkillInfo > & getSkills ()
 Returns map with skill id keys and SkillInfo values. More...
 
std::optional< int > getSkillXp (int id)
 Returns the current xp of the skill with the given id. Returns nullopt if the skill doesn't exist. More...
 
std::optional< int > getSkillLevel (int id)
 Returns the level of the skill calculated based on the current xp in the skill. Returns nullopt if the skill doesn't exist. More...
 
bool addSkillXp (int id, unsigned int amount)
 Adds the given amount of xp to the skill with the given id. Returns false if the addition failed, for example skill doesn't exist. More...
 

Private Attributes

std::map< int, SkillInfoskillsM
 Key = skill id, Value = SkillInfo. More...
 

Detailed Description

Contains all the skills that a character has.

Constructor & Destructor Documentation

◆ SkillSet()

SkillSet::SkillSet ( )
Here is the call graph for this function:

Member Function Documentation

◆ addSkillXp()

bool SkillSet::addSkillXp ( int  id,
unsigned int  amount 
)

Adds the given amount of xp to the skill with the given id. Returns false if the addition failed, for example skill doesn't exist.

Parameters
id
amount
Returns
bool
Here is the caller graph for this function:

◆ getSkillLevel()

std::optional< int > SkillSet::getSkillLevel ( int  id)

Returns the level of the skill calculated based on the current xp in the skill. Returns nullopt if the skill doesn't exist.

Parameters
id
Returns
std::optional<int>
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getSkills()

const std::map< int, SkillInfo > & SkillSet::getSkills ( )

Returns map with skill id keys and SkillInfo values.

Returns
const std::map<int, SkillInfo>&
Here is the caller graph for this function:

◆ getSkillXp()

std::optional< int > SkillSet::getSkillXp ( int  id)

Returns the current xp of the skill with the given id. Returns nullopt if the skill doesn't exist.

Parameters
id
Returns
std::optional<int>
Here is the caller graph for this function:

Member Data Documentation

◆ skillsM

std::map<int, SkillInfo> SkillSet::skillsM
private

Key = skill id, Value = SkillInfo.


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