Planeshift
CharCreationManager Class Reference

Server manager for character creation. More...

#include <creationmanager.h>

Public Member Functions

 CharCreationManager (GEMSupervisor *gemsupervisor, CacheManager *cachemanager, EntityManager *entitymanager)
 
bool Initialize ()
 Caches the data from the database needed for character creation. More...
 
bool Validate (psCharUploadMessage &mesg, csString &errorMsg)
 
virtual ~CharCreationManager ()
 
- Public Member Functions inherited from MessageManager< CharCreationManager >
void HandleMessage (MsgEntry *msg, Client *client)
 Transfers the message to the manager specific function. More...
 
void Subscribe (FunctionPointer fpt, msgtype type, uint32_t flags=0x01)
 Subscribes this manager to a specific message type with a custom callback. More...
 
bool Unsubscribe (msgtype type)
 Unsubscribes this manager from a specific message type. More...
 
bool Unsubscribe (FunctionPointer handler, msgtype type)
 Unsubscribes a specific handler from a specific message type. More...
 
bool UnsubscribeAll ()
 Unsubscribes this manager from all message types. More...
 
virtual ~MessageManager ()
 Unsubscribes all messages then destroys this object. More...
 
- Public Member Functions inherited from MessageManagerBase
csArray< csString > DecodeCommandArea (Client *client, csString target)
 Decodes an area: expression. More...
 
gemObjectFindObjectByString (const csString &str, gemActor *me) const
 Find the object we are referring to in str. More...
 
ClientFindPlayerClient (const char *name)
 Finds Client* of character with given name. More...
 
virtual bool Verify (MsgEntry *pMsg, unsigned int flags, Client *&client)
 

Static Public Member Functions

static bool FilterName (const char *name)
 
static bool IsLastNameAvailable (const char *lastname, AccountID requestingAcct=0)
 Check whether a given last name is available. More...
 
static bool IsUnique (const char *playerName, bool dbUniqueness=false)
 Check to see a name is unique in the characters table. More...
 

Protected Member Functions

void AssignScript (psCharacter *chardata)
 Assign a script to a character. More...
 
int CalculateCPChoices (csArray< uint32_t > &choices, int fatherMod, int motherMod)
 
int CalculateCPLife (csArray< uint32_t > &events)
 
int ConvertAreaToInt (const char *area)
 Takes a string name of a choice and converts it to it's enum value. More...
 
void HandleCharCreateCP (MsgEntry *me, Client *client)
 Handles the creation of a character from the char creation screen. More...
 
void HandleCharDelete (MsgEntry *me, Client *client)
 Handles the deletion of a character from the char pick screen. More...
 
void HandleChildhood (MsgEntry *me, Client *client)
 
void HandleLifeEvents (MsgEntry *me, Client *client)
 
void HandleName (MsgEntry *me, Client *client)
 Handles a check on a name. More...
 
void HandleParents (MsgEntry *me, Client *client)
 Handle and incomming message from a client about parents. More...
 
void HandleTraits (MsgEntry *me, Client *client)
 
void HandleUploadMessage (MsgEntry *me, Client *client)
 
int IsReserved (const char *playerName, AccountID acctID)
 Check to see if a name is on the reserve list for database migration. More...
 
bool LoadCPValues ()
 Cache in the data about the race CP starting values. More...
 
bool LoadCreationChoices ()
 Caches in creation choices from the database. More...
 
bool LoadLifeEvents ()
 
bool PlayerHasFinishedTutorial (AccountID acctID, uint32 tutorialsecid)
 

Protected Attributes

int raceCPValuesLength
 

Additional Inherited Members

- Public Types inherited from MessageManager< CharCreationManager >
typedef void(CharCreationManager::* FunctionPointer) (MsgEntry *, Client *)
 

Detailed Description

Server manager for character creation.

This guy loads all the data that may be needed to be sent to the client for the character creation. It loads data from these tables: race_info character_creation

Definition at line 47 of file creationmanager.h.

Constructor & Destructor Documentation

CharCreationManager::CharCreationManager ( GEMSupervisor gemsupervisor,
CacheManager cachemanager,
EntityManager entitymanager 
)
virtual CharCreationManager::~CharCreationManager ( )
virtual

Member Function Documentation

void CharCreationManager::AssignScript ( psCharacter chardata)
protected

Assign a script to a character.

Takes whatever script is stored in the migration table and adds it to the character to be run on character login.

Parameters
chardataThe character data class to append the script to.
int CharCreationManager::CalculateCPChoices ( csArray< uint32_t > &  choices,
int  fatherMod,
int  motherMod 
)
protected
int CharCreationManager::CalculateCPLife ( csArray< uint32_t > &  events)
protected
int CharCreationManager::ConvertAreaToInt ( const char *  area)
protected

Takes a string name of a choice and converts it to it's enum value.

This is useful to have string names in the database ( ie human readable ) but then use them as ints in the application ( ie easier to use ).

Parameters
areaThe name of the area to convert.
Returns
The int value of that area. Will be one of the defined enums of areas.
static bool CharCreationManager::FilterName ( const char *  name)
static
void CharCreationManager::HandleCharCreateCP ( MsgEntry me,
Client client 
)
protected

Handles the creation of a character from the char creation screen.

void CharCreationManager::HandleCharDelete ( MsgEntry me,
Client client 
)
protected

Handles the deletion of a character from the char pick screen.

void CharCreationManager::HandleChildhood ( MsgEntry me,
Client client 
)
protected
void CharCreationManager::HandleLifeEvents ( MsgEntry me,
Client client 
)
protected
void CharCreationManager::HandleName ( MsgEntry me,
Client client 
)
protected

Handles a check on a name.

This will check the name against the migration and the current characters table. It will send back a message to the client to notify them of the name status. If rejected it will include a message why.

void CharCreationManager::HandleParents ( MsgEntry me,
Client client 
)
protected

Handle and incomming message from a client about parents.

This handles a request from the client to send it all the data about choice areas in the parents screen.

void CharCreationManager::HandleTraits ( MsgEntry me,
Client client 
)
protected
void CharCreationManager::HandleUploadMessage ( MsgEntry me,
Client client 
)
protected
bool CharCreationManager::Initialize ( )

Caches the data from the database needed for character creation.

static bool CharCreationManager::IsLastNameAvailable ( const char *  lastname,
AccountID  requestingAcct = 0 
)
static

Check whether a given last name is available.

Last names are available if (a) unused, or (b) used by another character on the same account.

Parameters
lastnameThe lastname to check for availability.
requestingAcctThe account requesting the last name (optional).
Returns
true if allowed.
int CharCreationManager::IsReserved ( const char *  playerName,
AccountID  acctID 
)
protected

Check to see if a name is on the reserve list for database migration.

Parameters
playerNameThe name to check to see if is on a the reserve list.
acctIDThe acct that is trying to create this character.
Returns
  • NAME_RESERVED_FOR_YOU - if you can take this name.
  • NAME_RESERVED - you are not allowed this name.
  • NAME_AVAILABLE - name is free for use.
static bool CharCreationManager::IsUnique ( const char *  playerName,
bool  dbUniqueness = false 
)
static

Check to see a name is unique in the characters table.

Parameters
playerNameThe name to check to see if it is unique.
dbUniquenessIf false checks if it's still missing from the db, if true checks if there is only one entry in the db
Returns
true if the name is unique.
bool CharCreationManager::LoadCPValues ( )
protected

Cache in the data about the race CP starting values.

bool CharCreationManager::LoadCreationChoices ( )
protected

Caches in creation choices from the database.

bool CharCreationManager::LoadLifeEvents ( )
protected
bool CharCreationManager::PlayerHasFinishedTutorial ( AccountID  acctID,
uint32  tutorialsecid 
)
protected
bool CharCreationManager::Validate ( psCharUploadMessage mesg,
csString &  errorMsg 
)

Member Data Documentation

int CharCreationManager::raceCPValuesLength
protected

Definition at line 87 of file creationmanager.h.


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