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

psServer Class Reference

The main server class. More...

#include <psserver.h>

List of all members.

Public Member Functions

bool AddBuddy (PID self, PID buddy)
 Adds a buddy to this players list of buddies.
bool CheckAccess (Client *client, const char *command, bool returnError=true)
 Check if a client is authorized to execute a command.
ActionManagerGetActionManager ()
 Returns the Advice manager.
AdminManagerGetAdminManager ()
 Returns the Administration Manager.
AdviceManagerGetAdviceManager ()
 Returns the Advice manager.
iResultSet * GetAllResponses (csString &trigger)
iResultSet * GetAllTriggersInArea (csString data)
 Gets all the triggers from a particular knowledge area.
AuthenticationServerGetAuthServer ()
 Returns a pointer to the AuthenticationServer.
BankManagerGetBankManager ()
 Returns the Bank Manager.
CacheManagerGetCacheManager ()
 Returns the Chace Manager.
ServerCharManagerGetCharManager ()
 Returns the character manager.
ChatManagerGetChatManager ()
 Returns the Chat manager.
CombatManagerGetCombatManager ()
 Returns the Combat Manager.
iConfigManager * GetConfig ()
 Returns the configuration manager.
ClientConnectionSetGetConnections ()
 Gets a list of all connected clients.
psDatabaseGetDatabase ()
 Returns the database manager.
EconomyManagerGetEconomyManager ()
 Returns the economy manager.
EventManagerGetEventManager ()
 Returns the event manager.
ExchangeManagerGetExchangeManager ()
 Returns the Exchange Manager.
GMEventManagerGetGMEventManager ()
 Returns the GM Event Manager.
GuildManagerGetGuildManager ()
 Returns the guild manager.
HireManagerGetHireManager ()
 Returns the Hire Manager.
IntroductionManagerGetIntroductionManager ()
 Returns the Introduction Manager.
LogCSVGetLogCSV ()
psMarriageManagerGetMarriageManager ()
 Returns the Marriage Manager.
MathScriptEngineGetMathScriptEngine ()
 Returns the Math Scripting Engine.
MiniGameManagerGetMiniGameManager ()
 Returns the minigame manager.
const char * GetMOTD ()
 Gets the MOTD string.
NetManagerGetNetManager ()
 Returns the server's network thread.
NPCManagerGetNPCManager ()
 Returns the NPC Superclient manager.
iObjectRegistry * GetObjectReg ()
 Returns the object registry.
ProgressionManagerGetProgressionManager ()
 Returns the Progression Manager.
QuestManagerGetQuestManager ()
 Return the quest manager.
float GetRandom ()
 Returns a random number.
uint32 GetRandom (uint32 limit)
 Returns a random number with a limit.
float GetRandomRange (const float pos, const float range)
 Returns a random position within a range.
bool GetServerOption (const char *option_name, csString &value)
 Check for options in table 'server_options'.
ServerSongManagerGetSongManager ()
 Returns the Song Manager.
SpawnManagerGetSpawnManager ()
 Returns the spawn manager.
SpellManagerGetSpellManager ()
 Returns the spell manager.
iResultSet * GetSuperclientNPCs (int superclientID)
 Return a list of NPCs (with their info) managed by a particular superclient.
TutorialManagerGetTutorialManager ()
 Returns the Tutorial Manager.
PID GetUnusedPID ()
 Return a unused PID for temporary usage.
UserManagerGetUserManager ()
 Returns the User Manager.
WeatherManagerGetWeatherManager ()
 Returns the Weather manager.
WorkManagerGetWorkManager ()
 Returns the work manager.
bool HasBeenReady ()
 Checks to see if a world has loaded in the past.
bool Initialize (iObjectRegistry *objreg)
 Initialize the server.
bool IsFull (size_t numclients, Client *client)
 Checks if the server is full.
bool IsMapLoaded ()
 Checks to see if a world is loaded.
bool IsReady ()
 Checks to see if a world is loaded ready to go.
void LoadLogSettings ()
 Used to load the log settings.
bool LoadMap (const char *mapname)
 Loads a map and changes the MapLoaded.
void MainLoop ()
 Runs a script file to set up server and goes to the consoles main loop.
void MutePlayer (uint32_t clientnum, const char *reason)
 Mutes a player from the world.
 psServer ()
 Default constructor.
void QuitServer (int time, Client *client)
 Quits the server and sends informative messages.
bool RemoveBuddy (PID self, PID buddy)
 Removes a buddy from this character's list of buddies.
void RemovePlayer (uint32_t clientnum, const char *reason)
 Removes a player from the world.
void SaveLogSettings ()
 Used to save the log settings.
void SendSystemBaseInfo (int clientnum, const char *fmt,...)
 Similar to SendSystemInfo(), but the message is shown also on the "Main" tab.
void SendSystemError (int clientnum, const char *fmt,...)
 Convenience command to send a client an error psSystemMessage.
void SendSystemInfo (int clientnum, const char *fmt,...)
 Convenience command to send a client a psSystemMessage.
void SendSystemOK (int clientnum, const char *fmt,...)
 Convenience command to send a client a psSystemMessage with the MSG_OK type.
void SendSystemResult (int clientnum, const char *fmt,...)
 Convenience command to send a client a psSystemMessage with the MSG_RESULT type.
void SetMOTD (const char *str)
 Sets the MOTD string.
bool SetServerOption (const char *option_name, const csString &value)
 Set an option in table 'server_options'.
void UnmutePlayer (uint32_t clientnum, const char *reason)
 Unmutes player.
void UpdateDialog (const char *area, const char *trigger, const char *response, int num)
 Change the dialog responses for that trigger in the area.
void UpdateDialog (const char *area, const char *trigger, const char *prohim, const char *proher, const char *it, const char *them)
 Changes the pronoun set for that trigger in that area.
 ~psServer ()
 Destructor.

Public Attributes

CacheManagercachemanager
CharCreationManagercharCreationManager
CombatManagercombatmanager
EntityManagerentitymanager
ExchangeManagerexchangemanager
csRef< GroupManagergroupmanager
csRef< GuildManagerguildmanager
psMarriageManagermarriageManager
NPCManagernpcmanager
csRef< QuestionManagerquestionmanager
QuestManagerquestmanager
csRandomGen * rng
UserManagerusermanager
csRef< iVFS > vfs

Static Public Attributes

static psCharacterLoader CharacterLoader

Protected Attributes

csRef< ActionManageractionmanager
AdminManageradminmanager
csRef< AdviceManageradvicemanager
csRef< AuthenticationServerauthserver
BankManagerbankmanager
ServerCharManagercharmanager
csRef< ChatManagerchatmanager
csRef< iConfigManager > configmanager
psDatabasedatabase
EconomyManagereconomymanager
csRef< EventManagereventmanager
GMEventManagergmeventManager
HireManagerhiremanager
IntroductionManagerintromanager
LogCSVlogcsv
bool MapLoaded
MathScriptEnginemathscriptengine
MiniGameManagerminigamemanager
csString motd
NetManagernetmanager
iObjectRegistry * objreg
ProgressionManagerprogression
psQuitEvent * server_quit_event
 Used to keep track of the shut down event.
ServerConsoleserverconsole
ServerSongManagersongManager
SpawnManagerspawnmanager
SpellManagerspellmanager
TutorialManagertutorialmanager
uint32_t unused_pid
 Unused PID.
WeatherManagerweathermanager
WorkManagerworkmanager

Detailed Description

The main server class.

The main server class holding references to important server objects.

Definition at line 102 of file psserver.h.


Constructor & Destructor Documentation

psServer::psServer ( )

Default constructor.

Just sets all the pointers to NULL.

psServer::~psServer ( )

Destructor.

Cleans up all allocated memory and removes all the players from the world.


Member Function Documentation

bool psServer::AddBuddy ( PID  self,
PID  buddy 
)

Adds a buddy to this players list of buddies.

Takes the player ID of us and the player ID of the buddy. When you have a buddy, you will be able to see when they come online and leave.

Parameters:
self,:Is the player ID for the current player we are adding buddy to.
buddy,:Is the player ID for the buddy you wish to add.
Returns:
Returns either success or failure.
bool psServer::CheckAccess ( Client client,
const char *  command,
bool  returnError = true 
)

Check if a client is authorized to execute a command.

Parameters:
clientthe client we are checking
commandthe command we are checking for
returnErrortells whether the command outputs an error
Returns:
return true if the client is authorized to execute the command
ActionManager* psServer::GetActionManager ( ) [inline]

Returns the Advice manager.

Returns:
Returns a reference to the current advice manager.

Definition at line 286 of file psserver.h.

AdminManager* psServer::GetAdminManager ( ) [inline]

Returns the Administration Manager.

Returns:
Returns a reference to the current administration manager.

Definition at line 376 of file psserver.h.

AdviceManager* psServer::GetAdviceManager ( ) [inline]

Returns the Advice manager.

Returns:
Returns a reference to the current advice manager.

Definition at line 276 of file psserver.h.

iResultSet* psServer::GetAllResponses ( csString &  trigger)
iResultSet* psServer::GetAllTriggersInArea ( csString  data)

Gets all the triggers from a particular knowledge area.

Parameters:
dataIs a string containing the name of the data area we want the triggers for.
Returns:
Returns an iResultSet containing a list of all the triggers for a particular knowledge area. Result set contains the following members:
  • trigger
AuthenticationServer* psServer::GetAuthServer ( ) [inline]

Returns a pointer to the AuthenticationServer.

Definition at line 567 of file psserver.h.

BankManager* psServer::GetBankManager ( ) [inline]

Returns the Bank Manager.

Returns:
returns a reference to the Bank manager for the server.

Definition at line 499 of file psserver.h.

CacheManager* psServer::GetCacheManager ( ) [inline]

Returns the Chace Manager.

Returns:
returns a reference to the chache manager for the server.

Definition at line 529 of file psserver.h.

ServerCharManager* psServer::GetCharManager ( ) [inline]

Returns the character manager.

Returns:
Returns a reference to the current character manager for the server.

Definition at line 387 of file psserver.h.

ChatManager* psServer::GetChatManager ( ) [inline]

Returns the Chat manager.

Returns:
Returns a reference to the current chat manager server.

Definition at line 266 of file psserver.h.

CombatManager* psServer::GetCombatManager ( ) [inline]

Returns the Combat Manager.

Returns:
Returns a reference to the current combat manager.

Definition at line 423 of file psserver.h.

iConfigManager* psServer::GetConfig ( ) [inline]

Returns the configuration manager.

Returns:
Returns a reference to the current configuration manager object.

Definition at line 316 of file psserver.h.

ClientConnectionSet* psServer::GetConnections ( )

Gets a list of all connected clients.

Returns:
Returns a pointer to the list of all the clients.
psDatabase* psServer::GetDatabase ( ) [inline]

Returns the database manager.

Returns:
Returns a reference to the current database manager.

Definition at line 306 of file psserver.h.

EconomyManager* psServer::GetEconomyManager ( ) [inline]

Returns the economy manager.

Returns:
Returns a reference to the current economy manager for the server.

Definition at line 467 of file psserver.h.

EventManager* psServer::GetEventManager ( ) [inline]

Returns the event manager.

Returns:
Returns a reference to the current event manager.

Definition at line 346 of file psserver.h.

ExchangeManager* psServer::GetExchangeManager ( ) [inline]

Returns the Exchange Manager.

Definition at line 413 of file psserver.h.

GMEventManager* psServer::GetGMEventManager ( ) [inline]

Returns the GM Event Manager.

Returns:
returns a reference to the GM event manager for the server.

Definition at line 489 of file psserver.h.

GuildManager* psServer::GetGuildManager ( ) [inline]

Returns the guild manager.

Returns:
Returns a reference to the current guild manager for the server.

Definition at line 456 of file psserver.h.

HireManager* psServer::GetHireManager ( ) [inline]

Returns the Hire Manager.

Returns:
returns a reference to the Hire manager for the server.

Definition at line 509 of file psserver.h.

IntroductionManager* psServer::GetIntroductionManager ( ) [inline]

Returns the Introduction Manager.

Returns:
returns a reference to the introduction manager for the server.

Definition at line 539 of file psserver.h.

LogCSV* psServer::GetLogCSV ( ) [inline]

Definition at line 634 of file psserver.h.

psMarriageManager* psServer::GetMarriageManager ( ) [inline]

Returns the Marriage Manager.

Definition at line 405 of file psserver.h.

MathScriptEngine* psServer::GetMathScriptEngine ( ) [inline]

Returns the Math Scripting Engine.

Returns:
Returns a ptr to the math script engine.

Definition at line 366 of file psserver.h.

MiniGameManager* psServer::GetMiniGameManager ( ) [inline]

Returns the minigame manager.

Returns:
returns a reference to the current minigame manager for the server.

Definition at line 478 of file psserver.h.

const char* psServer::GetMOTD ( ) [inline]

Gets the MOTD string.

Definition at line 238 of file psserver.h.

NetManager* psServer::GetNetManager ( ) [inline]

Returns the server's network thread.

Returns:
Returns the NetManager object for the current networking thread.

Definition at line 256 of file psserver.h.

NPCManager* psServer::GetNPCManager ( ) [inline]

Returns the NPC Superclient manager.

Returns:
Returns a reference to the current npc manager.

Definition at line 296 of file psserver.h.

iObjectRegistry* psServer::GetObjectReg ( ) [inline]

Returns the object registry.

Returns:
Returns a reference to the current object registry.

Definition at line 326 of file psserver.h.

ProgressionManager* psServer::GetProgressionManager ( ) [inline]

Returns the Progression Manager.

Returns:
Returns a reference to the current administration manager.

Definition at line 397 of file psserver.h.

QuestManager* psServer::GetQuestManager ( ) [inline]

Return the quest manager.

Definition at line 785 of file psserver.h.

float psServer::GetRandom ( ) [inline]

Returns a random number.

Returns:
Returns a random number between 0.0(inclusive) and 1.0(non-inclusive).

Definition at line 584 of file psserver.h.

uint32 psServer::GetRandom ( uint32  limit) [inline]

Returns a random number with a limit.

Returns:
Returns a random number between 0 and limit.

Definition at line 604 of file psserver.h.

float psServer::GetRandomRange ( const float  pos,
const float  range 
) [inline]

Returns a random position within a range.

Returns:
Returns the provided position changed randomly of the supplied range.

Definition at line 594 of file psserver.h.

bool psServer::GetServerOption ( const char *  option_name,
csString &  value 
)

Check for options in table 'server_options'.

Parameters:
option_namethe desired option
valueValue of the found option will be placed in this string.
Returns:
Return false is option not found or if an error happened. True otherwise.
ServerSongManager* psServer::GetSongManager ( ) [inline]

Returns the Song Manager.

Returns:
a reference to the song manager of the server.

Definition at line 549 of file psserver.h.

SpawnManager* psServer::GetSpawnManager ( ) [inline]

Returns the spawn manager.

Returns:
Returns a reference to the current spawn manager.

Definition at line 336 of file psserver.h.

SpellManager* psServer::GetSpellManager ( ) [inline]

Returns the spell manager.

Returns:
Returns a reference to the current spell manager for the server.

Definition at line 434 of file psserver.h.

iResultSet* psServer::GetSuperclientNPCs ( int  superclientID)

Return a list of NPCs (with their info) managed by a particular superclient.

Parameters:
superclientIDis the playerID of the superclient
Returns:
Returns a iResultSet which contains the set of all npcs managed by the superclient.
  • id
  • name
  • master (npc master id)
  • x,y,z coords of positions
  • rotational angle (y-axis)
TutorialManager* psServer::GetTutorialManager ( ) [inline]

Returns the Tutorial Manager.

Returns:
A reference to the tutorial manager of the server.

Definition at line 559 of file psserver.h.

PID psServer::GetUnusedPID ( ) [inline]

Return a unused PID for temporary usage.

Definition at line 778 of file psserver.h.

UserManager* psServer::GetUserManager ( ) [inline]

Returns the User Manager.

Returns:
returns a reference to the User manager for the server.

Definition at line 519 of file psserver.h.

WeatherManager* psServer::GetWeatherManager ( ) [inline]

Returns the Weather manager.

Returns:
Returns a reference to the current weather manager.

Definition at line 356 of file psserver.h.

WorkManager* psServer::GetWorkManager ( ) [inline]

Returns the work manager.

Returns:
Returns a reference to the current work manager for the server.

Definition at line 445 of file psserver.h.

bool psServer::HasBeenReady ( )

Checks to see if a world has loaded in the past.

Returns:
Returns a true if a world has been loaded or is still loaded.
See also:
EntityManager::HasBeenReady()
bool psServer::Initialize ( iObjectRegistry *  objreg)

Initialize the server.

Initializes the following modules:

Starts a thread for:

Parameters:
objreg,:Is a reference to the object registry.
Returns:
Returns success or failure.
bool psServer::IsFull ( size_t  numclients,
Client client 
)

Checks if the server is full.

Parameters:
numclientsCurrent number of connected clients
clientWill say no if client is GM
bool psServer::IsMapLoaded ( ) [inline]

Checks to see if a world is loaded.

Returns:
Returns a true if a world has been loaded.

Definition at line 169 of file psserver.h.

bool psServer::IsReady ( )

Checks to see if a world is loaded ready to go.

Returns:
Returns a true if a world has been loaded and is ready to go.
See also:
EntityManager::IsReady()
void psServer::LoadLogSettings ( )

Used to load the log settings.

bool psServer::LoadMap ( const char *  mapname)

Loads a map and changes the MapLoaded.

Parameters:
mapnameThe name of the map to load.
Returns:
Returns a true if the world loaded.
void psServer::MainLoop ( )

Runs a script file to set up server and goes to the consoles main loop.

Load and starts an optional script file whose name was given on the command line using the "run script_filename" option. This script sets up the server by executing console commands. After that the function jumps into the server console's main loop, accepting commands from the user.

See also:
ServerConsole::MainLoop()
void psServer::MutePlayer ( uint32_t  clientnum,
const char *  reason 
)

Mutes a player from the world.

It will prevent them from being heard, until they log back in

Parameters:
clientnumIs the number of the client whose player we wish to remove from the world.
reasonIs a string representing the reason we are removing the player from the world.
void psServer::QuitServer ( int  time,
Client client 
)

Quits the server and sends informative messages.

Parameters:
time-1 to stop the quit, 0 to quit the server immediately, > 0 to delay the server quit
clientthe client we are checking. If null messages are sent only to server console
bool psServer::RemoveBuddy ( PID  self,
PID  buddy 
)

Removes a buddy from this character's list of buddies.

Takes the unique player ID of us and the player ID of the buddy. Returns false if buddy diddnt exist.

Parameters:
self,:Is the player ID for the current player we are removing the buddy from.
buddy,:Is the player ID for the buddy you wish to remove.
Returns:
Returns either success or failure.
void psServer::RemovePlayer ( uint32_t  clientnum,
const char *  reason 
)

Removes a player from the world.

It will save the players state information and remove them from the world.

Parameters:
clientnumIs the number of the client whose player we wish to remove from the world.
reasonIs a string representing the reason we are removing the player from the world.
void psServer::SaveLogSettings ( )

Used to save the log settings.

void psServer::SendSystemBaseInfo ( int  clientnum,
const char *  fmt,
  ... 
)

Similar to SendSystemInfo(), but the message is shown also on the "Main" tab.

void psServer::SendSystemError ( int  clientnum,
const char *  fmt,
  ... 
)

Convenience command to send a client an error psSystemMessage.

void psServer::SendSystemInfo ( int  clientnum,
const char *  fmt,
  ... 
)

Convenience command to send a client a psSystemMessage.

void psServer::SendSystemOK ( int  clientnum,
const char *  fmt,
  ... 
)

Convenience command to send a client a psSystemMessage with the MSG_OK type.

void psServer::SendSystemResult ( int  clientnum,
const char *  fmt,
  ... 
)

Convenience command to send a client a psSystemMessage with the MSG_RESULT type.

void psServer::SetMOTD ( const char *  str) [inline]

Sets the MOTD string.

Definition at line 246 of file psserver.h.

bool psServer::SetServerOption ( const char *  option_name,
const csString &  value 
)

Set an option in table 'server_options'.

Parameters:
option_namethe desired option
valueValue of the found option will be replaced with this string.
Returns:
Return false is option not found or if an error happened. True otherwise.
void psServer::UnmutePlayer ( uint32_t  clientnum,
const char *  reason 
)

Unmutes player.

void psServer::UpdateDialog ( const char *  area,
const char *  trigger,
const char *  prohim,
const char *  proher,
const char *  it,
const char *  them 
)

Changes the pronoun set for that trigger in that area.

Note:
Brendon have to find info on these args. What are the pronoun fields for?
Parameters:
areaIs the name of the area associated with the trigger.
triggerIs the trigger we want to modify a response for.
prohim
proher
it
them
void psServer::UpdateDialog ( const char *  area,
const char *  trigger,
const char *  response,
int  num 
)

Change the dialog responses for that trigger in the area.

Given the area, trigger and response number; change the reponse to be the new value. There are seperate tables for the triggers and the responses. If something has been said then it is checked against the triggers. If it matches a trigger then the response ID is retrieved for that trigger. That response ID is looked up and for each ID there are a number of responses (5 to be exact) One of these responses is chosen and that response is used from the trigger.

Parameters:
area,:Is the name of the area associated with the trigger.
trigger,:Is the trigger we want to modify a response for.
response,:Is the new response for the trigger.
num,:Is the response number to change. This can be a value from 1 - 5.

Member Data Documentation

Definition at line 831 of file psserver.h.

Definition at line 812 of file psserver.h.

Definition at line 830 of file psserver.h.

Definition at line 832 of file psserver.h.

Definition at line 837 of file psserver.h.

Definition at line 805 of file psserver.h.

Definition at line 791 of file psserver.h.

Definition at line 798 of file psserver.h.

Definition at line 814 of file psserver.h.

csRef<ChatManager> psServer::chatmanager [protected]

Definition at line 829 of file psserver.h.

Definition at line 795 of file psserver.h.

csRef<iConfigManager> psServer::configmanager [protected]

Definition at line 828 of file psserver.h.

Definition at line 813 of file psserver.h.

Definition at line 821 of file psserver.h.

Definition at line 804 of file psserver.h.

Definition at line 816 of file psserver.h.

Definition at line 803 of file psserver.h.

Definition at line 836 of file psserver.h.

Definition at line 801 of file psserver.h.

Definition at line 799 of file psserver.h.

Definition at line 838 of file psserver.h.

Definition at line 824 of file psserver.h.

LogCSV* psServer::logcsv [protected]

Definition at line 833 of file psserver.h.

bool psServer::MapLoaded [protected]

Definition at line 834 of file psserver.h.

Definition at line 794 of file psserver.h.

Definition at line 826 of file psserver.h.

Definition at line 823 of file psserver.h.

csString psServer::motd [protected]

Definition at line 835 of file psserver.h.

Definition at line 811 of file psserver.h.

Definition at line 793 of file psserver.h.

iObjectRegistry* psServer::objreg [protected]

Definition at line 827 of file psserver.h.

Definition at line 819 of file psserver.h.

Definition at line 800 of file psserver.h.

Definition at line 797 of file psserver.h.

csRandomGen* psServer::rng

Definition at line 796 of file psserver.h.

psQuitEvent* psServer::server_quit_event [protected]

Used to keep track of the shut down event.

Definition at line 840 of file psserver.h.

Definition at line 810 of file psserver.h.

Definition at line 825 of file psserver.h.

Definition at line 815 of file psserver.h.

Definition at line 818 of file psserver.h.

Definition at line 822 of file psserver.h.

uint32_t psServer::unused_pid [protected]

Unused PID.

These are for temporary use. Init with a really big number and decrements.

Definition at line 846 of file psserver.h.

Definition at line 802 of file psserver.h.

csRef<iVFS> psServer::vfs

Definition at line 806 of file psserver.h.

Definition at line 817 of file psserver.h.

Definition at line 820 of file psserver.h.


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