Planeshift
|
Used to manage incoming user commands from a client. More...
#include <usermanager.h>
Classes | |
struct | EMOTE |
Struct to hold our emote data. More... | |
Public Types | |
enum | { LOGGED_OFF = 0, LOGGED_ON = 1 } |
Public Member Functions | |
void | AcceptDuel (PendingDuelInvite *invite) |
This is called by the Pending Invite if the duel is accepted. | |
bool | Animation (csString animation, gemActor *actor) |
This function will start an animation on the actor, it will not repeat, so if you need an animation loop, just call it repeatedly from a script. | |
void | Attack (Stance stance, Client *client) |
void | BuddyList (Client *client, int clientnum, bool filter) |
Send a buddy list to a player. | |
void | CalculateComparativeDifference (psCharacter *myCharData, psCharacter *theirCharData, int &theirPhysicalLevel, int &theirMagicalLevel, int &physicalDiff, int &magicalDiff, int &overallLevelComparison) |
Calcualte a comarative difference between two characters for physical, magical, and overall level. | |
bool | CheckForEmote (csString command, bool execute, gemActor *actor) |
Check to see if command is an emote. | |
bool | CheckTargetLootable (gemActor *actor, Client *client) |
Checks whether target is lootable. | |
void | Emote (csString general, csString specific, csString animation, gemActor *actor) |
Process an emote command. | |
void | HandleLoot (psUserCmdMessage &msg, Client *client) |
Handles a /loot command from a player to loot something. | |
virtual bool | Initialize (GEMSupervisor *gemsupervisor) |
bool | LoadEmotes (const char *xmlfile, iVFS *vfs) |
Load emotes from xml. | |
void | Loot (Client *client) |
Attempt to loot the target using the loot window. | |
void | LootItems (gemActor *actor, Client *client, csString categories="all", uint8_t lootAction=0) |
Attempt to loot all or certain items from target. | |
void | LootMoney (gemActor *actor, Client *client) |
Attempt to loot money from the target. | |
void | Mount (gemActor *rider, gemActor *mount) |
Handles the /mount command. | |
void | NotifyAllianceBuddies (Client *client, bool loggedon) |
Send a notification to all clients on a person alliance if they log on/off. | |
void | NotifyBuddies (Client *client, bool loggedon) |
Send a notification to all clients on a person buddy list if they log on/off. | |
void | NotifyGuildBuddies (Client *client, bool loggedon) |
Send a notification to all clients on a person guild if they log on/off. | |
void | NotifyPlayerBuddies (Client *client, bool loggedon) |
Send a notification to all player (non GM/Dev) clients on a person buddy list that they have logged on/off. | |
void | Ready () |
void | SendCharacterDescription (Client *client, gemActor *actor, bool full, bool simple, const csString &requestor) |
Sends detail information about 'charData' to 'client'. | |
void | SendPlayerMoney (Client *client) |
UserManager (ClientConnectionSet *pCCS, CacheManager *cachemanager, BankManager *bankmanager, EntityManager *entitymanager) | |
void | UserStatRegeneration () |
virtual | ~UserManager () |
Protected Types | |
enum | { ALL_PLAYERS = 0, PLAYER_BUDDIES = 1 } |
typedef void(UserManager::* | userCmdPointer )(psUserCmdMessage &msg, Client *client) |
pointer to member function typedef, improves readability | |
Protected Member Functions | |
void | Assist (psUserCmdMessage &msg, Client *client) |
Handles an /Assist command comming from the client. | |
void | Buddy (psUserCmdMessage &msg, Client *client) |
Adds/removes a person to a player's buddy list. | |
void | ChallengeToDuel (psUserCmdMessage &msg, Client *client) |
Command to challenge someone to a duel. | |
void | GiveMOTD (psUserCmdMessage &msg, Client *client) |
Sends the MOTD to the client. | |
void | GiveTip (psUserCmdMessage &msg, Client *client) |
Give a tip from the database to the client. | |
void | Guard (Client *client, gemObject *object, csString action) |
Handles a player command to guard/unguard an item. | |
void | HandleAdminCommand (psUserCmdMessage &msg, Client *client) |
Handles the /admin command. | |
void | HandleAttack (psUserCmdMessage &msg, Client *client) |
Command to start attacking something. | |
void | HandleBanking (psUserCmdMessage &msg, Client *client) |
Handles a player command to start banking with the targeted entity. | |
void | HandleCharDescUpdate (MsgEntry *me, Client *client) |
Handle a message to update a character's description. | |
void | HandleCharDetailsRequest (MsgEntry *me, Client *client) |
Handle a request to send a character description. | |
void | HandleClientReady (MsgEntry *me, Client *client) |
void | HandleDie (psUserCmdMessage &msg, Client *client) |
Handles a player command to die. | |
void | HandleEntranceMessage (MsgEntry *me, Client *client) |
void | HandleGMEvents (Client *client) |
Sends a client a list of their current assigned event. | |
void | HandleGuard (psUserCmdMessage &msg, Client *client) |
Handle the /guard command, send it to Guard() | |
void | HandleMarriage (psUserCmdMessage &msg, Client *client) |
Command to marry/divorce someone. | |
void | HandleMOTDRequest (MsgEntry *me, Client *client) |
Sends to client the MOTD and tip, and his guild's MOTD if needed. | |
void | HandleMount (psUserCmdMessage &msg, Client *client) |
Handles a player command to mount. | |
void | HandlePickup (psUserCmdMessage &msg, Client *client) |
Handle the /pickup command, send it to Pickup() | |
void | HandleQuests (Client *client) |
Sends a client a list of their current assigned quests. | |
void | HandleQuestsCommand (psUserCmdMessage &msg, Client *client) |
Sends a client a list of their current assigned quests and events. | |
void | HandleQueueAttack (psUserCmdMessage &msg, Client *client) |
command to add an attack to the attackQueue | |
void | HandleRename (psUserCmdMessage &msg, Client *client) |
void | HandleRotate (psUserCmdMessage &msg, Client *client) |
Handle the /rotate command, send it to Rotate() | |
void | HandleSit (psUserCmdMessage &msg, Client *client) |
Handles a player command to sit down. | |
void | HandleStand (psUserCmdMessage &msg, Client *client) |
Handles a player command to stand up. | |
void | HandleStopAttack (psUserCmdMessage &msg, Client *client) |
Command to stop attacking your target. | |
void | HandleTakeAll (psUserCmdMessage &me, Client *client) |
Handle taking all items from a container. | |
void | HandleTakeStackAll (psUserCmdMessage &me, Client *client) |
Handle taking all items from a container ignoring some qualities when stacking. | |
void | HandleTargetEvent (MsgEntry *me, Client *client) |
void | HandleTraining (psUserCmdMessage &msg, Client *client) |
Handles a player command to start training with targeted entity. | |
void | HandleUnmount (psUserCmdMessage &msg, Client *client) |
Handles a player command to unmount. | |
void | HandleUnstick (psUserCmdMessage &msg, Client *client) |
Moves a player back to his last valid position. | |
void | HandleUse (Client *client, bool on) |
Handles a player request to 'use' the targeted item. | |
void | HandleUserCommand (MsgEntry *me, Client *client) |
Take a user command from a client, and send it to be handled by a function. | |
void | HandleYield (psUserCmdMessage &msg, Client *client) |
Handle the yield command. | |
void | LogStuck (Client *client) |
Helper function to log a stuck character's details. | |
void | Pickup (Client *client, csString target) |
Handles a player command to pickup an item. | |
void | Rename (Client *client, csString *target, psItem *item) |
void | ReportPosition (psUserCmdMessage &msg, Client *client) |
Sends the player their current position and sector. | |
void | RollDice (psUserCmdMessage &msg, Client *client) |
Calculates a dice roll from a player based on number of die and sides. | |
void | Rotate (Client *client, gemObject *target, csString action) |
Handles a player command to rotate an item. | |
void | ShowNpcMenu (psUserCmdMessage &msg, Client *client) |
Handles a player command to show the popup dialog menu of the currently targeted NPC, if any. | |
void | StartTrading (psUserCmdMessage &msg, Client *client) |
Handle the /starttrading command. | |
void | StopAllCombat (Client *client) |
Helper function to make the character stop attacking. | |
void | StopTrading (psUserCmdMessage &msg, Client *client) |
Handle the /stoptrading command. | |
void | StrToLowerCase (csString &str) |
Converts a string to lowercase. | |
void | SwitchAttackTarget (Client *targeter, Client *targeted) |
void | Who (psUserCmdMessage &msg, Client *client) |
Send a list of the players that are online to a client. | |
bool | WhoProcessClient (Client *curr, int guildId, csString *message, csString filter, bool check, unsigned *count) |
Formats output of a player and adds it to a message. | |
void | YieldDuel (Client *client) |
Command to surrender to someone in a duel. | |
Protected Attributes | |
BankManager * | bankManager |
CacheManager * | cacheManager |
ClientConnectionSet * | clients |
csHash< EMOTE *, csString > | emoteHash |
EntityManager * | entityManager |
GEMSupervisor * | gem |
csHash< userCmdPointer, csString > | userCommandHash |
Hash of the user commands, the key is the command name. |
Used to manage incoming user commands from a client.
Most commands are in the format of /command param1 param2 ... paramN
Definition at line 53 of file usermanager.h.
typedef void(UserManager::* UserManager::userCmdPointer)(psUserCmdMessage &msg, Client *client) [protected] |
pointer to member function typedef, improves readability
Definition at line 649 of file usermanager.h.
anonymous enum |
Definition at line 104 of file usermanager.h.
anonymous enum [protected] |
Definition at line 281 of file usermanager.h.
UserManager::UserManager | ( | ClientConnectionSet * | pCCS, |
CacheManager * | cachemanager, | ||
BankManager * | bankmanager, | ||
EntityManager * | entitymanager | ||
) |
virtual UserManager::~UserManager | ( | ) | [virtual] |
void UserManager::AcceptDuel | ( | PendingDuelInvite * | invite | ) |
This is called by the Pending Invite if the duel is accepted.
invite | This is the invitemanager structure used to invoke the invitation. |
bool UserManager::Animation | ( | csString | animation, |
gemActor * | actor | ||
) |
This function will start an animation on the actor, it will not repeat, so if you need an animation loop, just call it repeatedly from a script.
void UserManager::Assist | ( | psUserCmdMessage & | msg, |
Client * | client | ||
) | [protected] |
Handles an /Assist command comming from the client.
msg | The incoming command message |
client | A pointer to the client struct. |
void UserManager::Buddy | ( | psUserCmdMessage & | msg, |
Client * | client | ||
) | [protected] |
Adds/removes a person to a player's buddy list.
This does a database hit to add/remove to the buddy table.
msg | The incoming user command message. |
client | The client that request the /buddy. |
Send a buddy list to a player.
Sends a list of all the players that are currently on a player's buddy list.
client | The client that request the command.. |
clientnum | The client id number of the requesting client. |
filter | True if show only buddies online. Else show all buddies. |
void UserManager::CalculateComparativeDifference | ( | psCharacter * | myCharData, |
psCharacter * | theirCharData, | ||
int & | theirPhysicalLevel, | ||
int & | theirMagicalLevel, | ||
int & | physicalDiff, | ||
int & | magicalDiff, | ||
int & | overallLevelComparison | ||
) |
Calcualte a comarative difference between two characters for physical, magical, and overall level.
void UserManager::ChallengeToDuel | ( | psUserCmdMessage & | msg, |
Client * | client | ||
) | [protected] |
Command to challenge someone to a duel.
msg | The incoming user command message. |
client | The client that request the command.. |
bool UserManager::CheckForEmote | ( | csString | command, |
bool | execute, | ||
gemActor * | actor | ||
) |
Check to see if command is an emote.
command | The command in question. |
execute | Execute the emote or not. |
actor | The actor. |
Checks whether target is lootable.
actor | The actor which is looting |
client | The client where the loot command came from. |
void UserManager::Emote | ( | csString | general, |
csString | specific, | ||
csString | animation, | ||
gemActor * | actor | ||
) |
Process an emote command.
general | The phrase to broadcast if no target is selected. |
specific | The phrase to broadcast if a target is selected. |
animation | The animation for the emote. If there isn't one pass "noanim". |
actor | The actor. |
void UserManager::GiveMOTD | ( | psUserCmdMessage & | msg, |
Client * | client | ||
) | [protected] |
Sends the MOTD to the client.
msg | The incoming user command message |
client | the client who sit |
void UserManager::GiveTip | ( | psUserCmdMessage & | msg, |
Client * | client | ||
) | [protected] |
Give a tip from the database to the client.
msg | The incoming user command message |
client | The client who sit |
Handles a player command to guard/unguard an item.
If the action parameter is empty, the guarding status of the item will be toggled.
client | The client that issued the command. |
object | pointer to the item to be guarded/unguarded. |
action | value can be "on" or "off" |
void UserManager::HandleAdminCommand | ( | psUserCmdMessage & | msg, |
Client * | client | ||
) | [protected] |
Handles the /admin command.
msg | The incoming user command message. |
client | The client who issues the admin command. |
void UserManager::HandleAttack | ( | psUserCmdMessage & | msg, |
Client * | client | ||
) | [protected] |
Command to start attacking something.
Starts the combat manager working.
msg | The incoming user command message. |
client | The client that request the command. |
void UserManager::HandleBanking | ( | psUserCmdMessage & | msg, |
Client * | client | ||
) | [protected] |
Handles a player command to start banking with the targeted entity.
msg | The incoming user command message |
client | The client that issued the command. |
Handle a message to update a character's description.
Handle a request to send a character description.
void UserManager::HandleDie | ( | psUserCmdMessage & | msg, |
Client * | client | ||
) | [protected] |
Handles a player command to die.
msg | The incoming user command message |
client | The client who die |
void UserManager::HandleGMEvents | ( | Client * | client | ) | [protected] |
Sends a client a list of their current assigned event.
client | The requesting client. |
void UserManager::HandleGuard | ( | psUserCmdMessage & | msg, |
Client * | client | ||
) | [protected] |
Handle the /guard command, send it to Guard()
void UserManager::HandleLoot | ( | psUserCmdMessage & | msg, |
Client * | client | ||
) |
Handles a /loot command from a player to loot something.
msg | The incoming user command message |
client | The client that request the /who |
void UserManager::HandleMarriage | ( | psUserCmdMessage & | msg, |
Client * | client | ||
) | [protected] |
Command to marry/divorce someone.
msg | The incoming user command message. |
client | The client that request the command.. |
Sends to client the MOTD and tip, and his guild's MOTD if needed.
me | The incoming message |
client | the client to send the message to |
void UserManager::HandleMount | ( | psUserCmdMessage & | msg, |
Client * | client | ||
) | [protected] |
Handles a player command to mount.
msg | the user command message |
client | The client that issued the command. |
void UserManager::HandlePickup | ( | psUserCmdMessage & | msg, |
Client * | client | ||
) | [protected] |
Handle the /pickup command, send it to Pickup()
void UserManager::HandleQuests | ( | Client * | client | ) | [protected] |
Sends a client a list of their current assigned quests.
client | The requesting client. |
void UserManager::HandleQuestsCommand | ( | psUserCmdMessage & | msg, |
Client * | client | ||
) | [protected] |
Sends a client a list of their current assigned quests and events.
msg | The incoming user command message. |
client | The requesting client. |
void UserManager::HandleQueueAttack | ( | psUserCmdMessage & | msg, |
Client * | client | ||
) | [protected] |
command to add an attack to the attackQueue
msg | The incoming user command message. |
client | The client that request the command. |
void UserManager::HandleRename | ( | psUserCmdMessage & | msg, |
Client * | client | ||
) | [protected] |
void UserManager::HandleRotate | ( | psUserCmdMessage & | msg, |
Client * | client | ||
) | [protected] |
Handle the /rotate command, send it to Rotate()
void UserManager::HandleSit | ( | psUserCmdMessage & | msg, |
Client * | client | ||
) | [protected] |
Handles a player command to sit down.
msg | The incoming user command message |
client | The client who sit |
void UserManager::HandleStand | ( | psUserCmdMessage & | msg, |
Client * | client | ||
) | [protected] |
Handles a player command to stand up.
msg | The incoming user command message. |
client | The client who stand. |
void UserManager::HandleStopAttack | ( | psUserCmdMessage & | msg, |
Client * | client | ||
) | [protected] |
Command to stop attacking your target.
msg | The incoming user command message. |
client | The client that request the command. |
void UserManager::HandleTakeAll | ( | psUserCmdMessage & | me, |
Client * | client | ||
) | [protected] |
Handle taking all items from a container.
me | The message from the client which will be analyzed. |
client | The client which sent the message. |
void UserManager::HandleTakeStackAll | ( | psUserCmdMessage & | me, |
Client * | client | ||
) | [protected] |
Handle taking all items from a container ignoring some qualities when stacking.
me | The message from the client which will be analyzed. |
client | The client which sent the message. |
void UserManager::HandleTraining | ( | psUserCmdMessage & | msg, |
Client * | client | ||
) | [protected] |
Handles a player command to start training with targeted entity.
msg | The user command message |
client | The client that issued the command. |
void UserManager::HandleUnmount | ( | psUserCmdMessage & | msg, |
Client * | client | ||
) | [protected] |
Handles a player command to unmount.
msg | the user command message |
client | The client that issued the command. |
void UserManager::HandleUnstick | ( | psUserCmdMessage & | msg, |
Client * | client | ||
) | [protected] |
Moves a player back to his last valid position.
msg | The incoming user command message. |
client | The client that request the command. |
void UserManager::HandleUse | ( | Client * | client, |
bool | on | ||
) | [protected] |
Handles a player request to 'use' the targeted item.
client | The client that issued the command. |
on | Toggle for start/stop using. |
Take a user command from a client, and send it to be handled by a function.
void UserManager::HandleYield | ( | psUserCmdMessage & | msg, |
Client * | client | ||
) | [protected] |
Handle the yield command.
msg | The incoming user command message. |
client | The client that request the command.. |
virtual bool UserManager::Initialize | ( | GEMSupervisor * | gemsupervisor | ) | [inline, virtual] |
Definition at line 60 of file usermanager.h.
bool UserManager::LoadEmotes | ( | const char * | xmlfile, |
iVFS * | vfs | ||
) |
Load emotes from xml.
xmlfile | A point to a string containing the xml file. |
vfs | A pointer to an iVFS object. |
void UserManager::LogStuck | ( | Client * | client | ) | [protected] |
Helper function to log a stuck character's details.
client | The client that requested to be unstuck. |
void UserManager::Loot | ( | Client * | client | ) |
Attempt to loot the target using the loot window.
Sends the lootable items to the client and calls LootMoney(CLient *client)
client | The client where the loot command came from. |
void UserManager::LootItems | ( | gemActor * | actor, |
Client * | client, | ||
csString | categories = "all" , |
||
uint8_t | lootAction = 0 |
||
) |
Attempt to loot all or certain items from target.
Tries to loot the items which fit the specified categories (if any). Also handles group looting and rolling, if a group is present
actor | The actor which is looting |
client | The client where the loot command came from. |
categories | Only items of given categories are looted (e.g. "weapons, gems") |
lootAction | Either 0 for LOOT_SELF or 1 for LOOT_ROLL (only works when in a group) |
Attempt to loot money from the target.
Takes money from the target and splits it across the group (if any)
actor | The actor which is looting |
client | The client where the loot command came from. |
Handles the /mount command.
rider | The actor which is going to mount |
mount | The actor which is going to be mounted. |
void UserManager::NotifyAllianceBuddies | ( | Client * | client, |
bool | loggedon | ||
) |
Send a notification to all clients on a person alliance if they log on/off.
client | The client that has logged in/out. |
loggedon | True if the player has logged on. False if logged off. |
void UserManager::NotifyBuddies | ( | Client * | client, |
bool | loggedon | ||
) |
Send a notification to all clients on a person buddy list if they log on/off.
This does a database hit.
client | The client that has logged in/out. |
loggedon | True if the player has logged on. False if logged off. |
void UserManager::NotifyGuildBuddies | ( | Client * | client, |
bool | loggedon | ||
) |
Send a notification to all clients on a person guild if they log on/off.
client | The client that has logged in/out. |
loggedon | True if the player has logged on. False if logged off. |
void UserManager::NotifyPlayerBuddies | ( | Client * | client, |
bool | loggedon | ||
) |
Send a notification to all player (non GM/Dev) clients on a person buddy list that they have logged on/off.
This does a database hit.
client | The client that has logged in/out. |
loggedon | True if the player has logged on. False if logged off. |
void UserManager::Pickup | ( | Client * | client, |
csString | target | ||
) | [protected] |
Handles a player command to pickup an item.
client | The client that issued the command. |
target | description of the item to be picked up. |
void UserManager::Ready | ( | ) |
void UserManager::ReportPosition | ( | psUserCmdMessage & | msg, |
Client * | client | ||
) | [protected] |
Sends the player their current position and sector.
msg | The incoming user command message. |
client | The client that request the command. |
void UserManager::RollDice | ( | psUserCmdMessage & | msg, |
Client * | client | ||
) | [protected] |
Calculates a dice roll from a player based on number of die and sides.
msg | The incoming user command message. |
client | The client that request the command. |
Handles a player command to rotate an item.
client | The client that issued the command. |
target | pointer to the item to be rotated. |
action | rotation data |
void UserManager::SendCharacterDescription | ( | Client * | client, |
gemActor * | actor, | ||
bool | full, | ||
bool | simple, | ||
const csString & | requestor | ||
) |
Sends detail information about 'charData' to 'client'.
If 'full' is true, it contains info about HP and basic stats like Strength.
void UserManager::SendPlayerMoney | ( | Client * | client | ) |
void UserManager::ShowNpcMenu | ( | psUserCmdMessage & | msg, |
Client * | client | ||
) | [protected] |
Handles a player command to show the popup dialog menu of the currently targeted NPC, if any.
msg | The incoming user command message |
client | The client that issued the command. |
void UserManager::StartTrading | ( | psUserCmdMessage & | msg, |
Client * | client | ||
) | [protected] |
Handle the /starttrading command.
void UserManager::StopAllCombat | ( | Client * | client | ) | [protected] |
Helper function to make the character stop attacking.
client | The client that needs to stop attacking. |
void UserManager::StopTrading | ( | psUserCmdMessage & | msg, |
Client * | client | ||
) | [protected] |
Handle the /stoptrading command.
void UserManager::StrToLowerCase | ( | csString & | str | ) | [protected] |
Converts a string to lowercase.
str | The string. |
void UserManager::UserStatRegeneration | ( | ) |
void UserManager::Who | ( | psUserCmdMessage & | msg, |
Client * | client | ||
) | [protected] |
Send a list of the players that are online to a client.
Sends the name/guild/rank of all players in the world.
msg | The incoming user command message |
client | The client that request the /who |
bool UserManager::WhoProcessClient | ( | Client * | curr, |
int | guildId, | ||
csString * | message, | ||
csString | filter, | ||
bool | check, | ||
unsigned * | count | ||
) | [protected] |
Formats output of a player and adds it to a message.
curr | The client that is to be formated |
guildId | The guildId of the caller |
message | The target csString object |
filter | What clients |
check | If a check against filter should be done |
count | COunter to be increased in case of a successfull match |
void UserManager::YieldDuel | ( | Client * | client | ) | [protected] |
Command to surrender to someone in a duel.
client | The client that request the command.. |
BankManager* UserManager::bankManager [protected] |
Definition at line 655 of file usermanager.h.
CacheManager* UserManager::cacheManager [protected] |
Definition at line 653 of file usermanager.h.
ClientConnectionSet* UserManager::clients [protected] |
Definition at line 646 of file usermanager.h.
csHash<EMOTE*, csString> UserManager::emoteHash [protected] |
Definition at line 644 of file usermanager.h.
EntityManager* UserManager::entityManager [protected] |
Definition at line 656 of file usermanager.h.
GEMSupervisor* UserManager::gem [protected] |
Definition at line 654 of file usermanager.h.
csHash<userCmdPointer, csString> UserManager::userCommandHash [protected] |
Hash of the user commands, the key is the command name.
Definition at line 651 of file usermanager.h.