Planeshift
Classes | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes

CharCreationManager Class Reference

Server manager for character creation. More...

#include <creationmanager.h>

List of all members.

Classes

struct  CreationChoice
class  LifeEventChoiceServer
struct  RaceCP

Public Member Functions

 CharCreationManager (GEMSupervisor *gemsupervisor, CacheManager *cachemanager, EntityManager *entitymanager)
bool Initialize ()
 Caches the data from the database needed for character creation.
bool Validate (psCharUploadMessage &mesg, csString &errorMsg)
virtual ~CharCreationManager ()

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.
static bool IsUnique (const char *playerName, bool dbUniqueness=false)
 Check to see a name is unique in the characters table.

Protected Member Functions

void AssignScript (psCharacter *chardata)
 Assign a script to a character.
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.
void HandleCharCreateCP (MsgEntry *me, Client *client)
 Handles the creation of a character from the char creation screen.
void HandleCharDelete (MsgEntry *me, Client *client)
 Handles the deletion of a character from the char pick screen.
void HandleChildhood (MsgEntry *me, Client *client)
void HandleLifeEvents (MsgEntry *me, Client *client)
void HandleName (MsgEntry *me, Client *client)
 Handles a check on a name.
void HandleParents (MsgEntry *me, Client *client)
 Handle and incomming message from a client about parents.
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.
bool LoadCPValues ()
 Cache in the data about the race CP starting values.
bool LoadCreationChoices ()
 Caches in creation choices from the database.
bool LoadLifeEvents ()
bool PlayerHasFinishedTutorial (AccountID acctID, uint32 tutorialsecid)

Protected Attributes

int raceCPValuesLength

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

Definition at line 87 of file creationmanager.h.


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