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 } |
![]() | |
typedef void(UserManager::* | FunctionPointer) (MsgEntry *, Client *) |
Public Member Functions | |
void | AcceptDuel (PendingDuelInvite *invite) |
This is called by the Pending Invite if the duel is accepted. More... | |
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. More... | |
void | Attack (Stance stance, Client *client) |
void | BuddyList (Client *client, int clientnum, bool filter) |
Send a buddy list to a player. More... | |
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. More... | |
bool | CheckForEmote (csString command, bool execute, gemActor *actor) |
Check to see if command is an emote. More... | |
bool | CheckTargetLootable (gemActor *actor, Client *client) |
Checks whether target is lootable. More... | |
void | Emote (csString general, csString specific, csString animation, gemActor *actor) |
Process an emote command. More... | |
void | HandleLoot (psUserCmdMessage &msg, Client *client) |
Handles a /loot command from a player to loot something. More... | |
virtual bool | Initialize (GEMSupervisor *gemsupervisor) |
bool | LoadEmotes (const char *xmlfile, iVFS *vfs) |
Load emotes from xml. More... | |
void | Loot (Client *client) |
Attempt to loot the target using the loot window. More... | |
void | LootItems (gemActor *actor, Client *client, csString categories="all", uint8_t lootAction=0) |
Attempt to loot all or certain items from target. More... | |
void | LootMoney (gemActor *actor, Client *client) |
Attempt to loot money from the target. More... | |
void | Mount (gemActor *rider, gemActor *mount) |
Handles the /mount command. More... | |
void | NotifyAllianceBuddies (Client *client, bool loggedon) |
Send a notification to all clients on a person alliance if they log on/off. More... | |
void | NotifyBuddies (Client *client, bool loggedon) |
Send a notification to all clients on a person buddy list if they log on/off. More... | |
void | NotifyGuildBuddies (Client *client, bool loggedon) |
Send a notification to all clients on a person guild if they log on/off. More... | |
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. More... | |
void | Ready () |
void | SendCharacterDescription (Client *client, gemActor *actor, bool full, bool simple, const csString &requestor) |
Sends detail information about 'charData' to 'client'. More... | |
void | SendPlayerMoney (Client *client) |
UserManager (ClientConnectionSet *pCCS, CacheManager *cachemanager, BankManager *bankmanager, EntityManager *entitymanager) | |
void | UserStatRegeneration () |
virtual | ~UserManager () |
![]() | |
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... | |
![]() | |
csArray< csString > | DecodeCommandArea (Client *client, csString target) |
Decodes an area: expression. More... | |
gemObject * | FindObjectByString (const csString &str, gemActor *me) const |
Find the object we are referring to in str. More... | |
Client * | FindPlayerClient (const char *name) |
Finds Client* of character with given name. More... | |
virtual bool | Verify (MsgEntry *pMsg, unsigned int flags, Client *&client) |
Protected Types | |
enum | { ALL_PLAYERS =0, PLAYER_BUDDIES =1 } |
typedef void(UserManager::* | userCmdPointer) (psUserCmdMessage &msg, Client *client) |
pointer to member function typedef, improves readability More... | |
Protected Member Functions | |
void | Assist (psUserCmdMessage &msg, Client *client) |
Handles an /Assist command comming from the client. More... | |
void | Buddy (psUserCmdMessage &msg, Client *client) |
Adds/removes a person to a player's buddy list. More... | |
void | ChallengeToDuel (psUserCmdMessage &msg, Client *client) |
Command to challenge someone to a duel. More... | |
void | GiveMOTD (psUserCmdMessage &msg, Client *client) |
Sends the MOTD to the client. More... | |
void | GiveTip (psUserCmdMessage &msg, Client *client) |
Give a tip from the database to the client. More... | |
void | Guard (Client *client, gemObject *object, csString action) |
Handles a player command to guard/unguard an item. More... | |
void | HandleAdminCommand (psUserCmdMessage &msg, Client *client) |
Handles the /admin command. More... | |
void | HandleAttack (psUserCmdMessage &msg, Client *client) |
Command to start attacking something. More... | |
void | HandleBanking (psUserCmdMessage &msg, Client *client) |
Handles a player command to start banking with the targeted entity. More... | |
void | HandleCharDescUpdate (MsgEntry *me, Client *client) |
Handle a message to update a character's description. More... | |
void | HandleCharDetailsRequest (MsgEntry *me, Client *client) |
Handle a request to send a character description. More... | |
void | HandleClientReady (MsgEntry *me, Client *client) |
void | HandleDie (psUserCmdMessage &msg, Client *client) |
Handles a player command to die. More... | |
void | HandleEntranceMessage (MsgEntry *me, Client *client) |
void | HandleGMEvents (Client *client) |
Sends a client a list of their current assigned event. More... | |
void | HandleGuard (psUserCmdMessage &msg, Client *client) |
Handle the /guard command, send it to Guard() More... | |
void | HandleMarriage (psUserCmdMessage &msg, Client *client) |
Command to marry/divorce someone. More... | |
void | HandleMOTDRequest (MsgEntry *me, Client *client) |
Sends to client the MOTD and tip, and his guild's MOTD if needed. More... | |
void | HandleMount (psUserCmdMessage &msg, Client *client) |
Handles a player command to mount. More... | |
void | HandlePickup (psUserCmdMessage &msg, Client *client) |
Handle the /pickup command, send it to Pickup() More... | |
void | HandleQuests (Client *client) |
Sends a client a list of their current assigned quests. More... | |
void | HandleQuestsCommand (psUserCmdMessage &msg, Client *client) |
Sends a client a list of their current assigned quests and events. More... | |
void | HandleQueueAttack (psUserCmdMessage &msg, Client *client) |
command to add an attack to the attackQueue More... | |
void | HandleRename (psUserCmdMessage &msg, Client *client) |
void | HandleRotate (psUserCmdMessage &msg, Client *client) |
Handle the /rotate command, send it to Rotate() More... | |
void | HandleSit (psUserCmdMessage &msg, Client *client) |
Handles a player command to sit down. More... | |
void | HandleStand (psUserCmdMessage &msg, Client *client) |
Handles a player command to stand up. More... | |
void | HandleStopAttack (psUserCmdMessage &msg, Client *client) |
Command to stop attacking your target. More... | |
void | HandleTakeAll (psUserCmdMessage &me, Client *client) |
Handle taking all items from a container. More... | |
void | HandleTakeStackAll (psUserCmdMessage &me, Client *client) |
Handle taking all items from a container ignoring some qualities when stacking. More... | |
void | HandleTargetEvent (MsgEntry *me, Client *client) |
void | HandleTraining (psUserCmdMessage &msg, Client *client) |
Handles a player command to start training with targeted entity. More... | |
void | HandleUnmount (psUserCmdMessage &msg, Client *client) |
Handles a player command to unmount. More... | |
void | HandleUnstick (psUserCmdMessage &msg, Client *client) |
Moves a player back to his last valid position. More... | |
void | HandleUse (Client *client, bool on) |
Handles a player request to 'use' the targeted item. More... | |
void | HandleUserCommand (MsgEntry *me, Client *client) |
Take a user command from a client, and send it to be handled by a function. More... | |
void | HandleYield (psUserCmdMessage &msg, Client *client) |
Handle the yield command. More... | |
void | LogStuck (Client *client) |
Helper function to log a stuck character's details. More... | |
void | Pickup (Client *client, csString target) |
Handles a player command to pickup an item. More... | |
void | Rename (Client *client, csString *target, psItem *item) |
void | ReportPosition (psUserCmdMessage &msg, Client *client) |
Sends the player their current position and sector. More... | |
void | RollDice (psUserCmdMessage &msg, Client *client) |
Calculates a dice roll from a player based on number of die and sides. More... | |
void | Rotate (Client *client, gemObject *target, csString action) |
Handles a player command to rotate an item. More... | |
void | ShowNpcMenu (psUserCmdMessage &msg, Client *client) |
Handles a player command to show the popup dialog menu of the currently targeted NPC, if any. More... | |
void | StartTrading (psUserCmdMessage &msg, Client *client) |
Handle the /starttrading command. More... | |
void | StopAllCombat (Client *client) |
Helper function to make the character stop attacking. More... | |
void | StopTrading (psUserCmdMessage &msg, Client *client) |
Handle the /stoptrading command. More... | |
void | StrToLowerCase (csString &str) |
Converts a string to lowercase. More... | |
void | SwitchAttackTarget (Client *targeter, Client *targeted) |
void | Who (psUserCmdMessage &msg, Client *client) |
Send a list of the players that are online to a client. More... | |
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. More... | |
void | YieldDuel (Client *client) |
Command to surrender to someone in a duel. More... | |
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. More... | |
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.
|
protected |
pointer to member function typedef, improves readability
Definition at line 649 of file usermanager.h.
anonymous enum |
Enumerator | |
---|---|
LOGGED_OFF | |
LOGGED_ON |
Definition at line 104 of file usermanager.h.
|
protected |
Enumerator | |
---|---|
ALL_PLAYERS | |
PLAYER_BUDDIES |
Definition at line 281 of file usermanager.h.
UserManager::UserManager | ( | ClientConnectionSet * | pCCS, |
CacheManager * | cachemanager, | ||
BankManager * | bankmanager, | ||
EntityManager * | entitymanager | ||
) |
|
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.
|
protected |
Handles an /Assist command comming from the client.
msg | The incoming command message |
client | A pointer to the client struct. |
|
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.
|
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. |
|
protected |
Sends the MOTD to the client.
msg | The incoming user command message |
client | the client who sit |
|
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" |
|
protected |
Handles the /admin command.
msg | The incoming user command message. |
client | The client who issues the admin command. |
|
protected |
Command to start attacking something.
Starts the combat manager working.
msg | The incoming user command message. |
client | The client that request the command. |
|
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.
|
protected |
Handles a player command to die.
msg | The incoming user command message |
client | The client who die |
|
protected |
Sends a client a list of their current assigned event.
client | The requesting 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 |
|
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 |
|
protected |
Handles a player command to mount.
msg | the user command message |
client | The client that issued the command. |
|
protected |
Handle the /pickup command, send it to Pickup()
|
protected |
Sends a client a list of their current assigned quests.
client | The requesting client. |
|
protected |
Sends a client a list of their current assigned quests and events.
msg | The incoming user command message. |
client | The requesting client. |
|
protected |
command to add an attack to the attackQueue
msg | The incoming user command message. |
client | The client that request the command. |
|
protected |
|
protected |
Handle the /rotate command, send it to Rotate()
|
protected |
Handles a player command to sit down.
msg | The incoming user command message |
client | The client who sit |
|
protected |
Handles a player command to stand up.
msg | The incoming user command message. |
client | The client who stand. |
|
protected |
Command to stop attacking your target.
msg | The incoming user command message. |
client | The client that request the command. |
|
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. |
|
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. |
|
protected |
Handles a player command to start training with targeted entity.
msg | The user command message |
client | The client that issued the command. |
|
protected |
Handles a player command to unmount.
msg | the user command message |
client | The client that issued the command. |
|
protected |
Moves a player back to his last valid position.
msg | The incoming user command message. |
client | The client that request the command. |
|
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.
|
protected |
Handle the yield command.
msg | The incoming user command message. |
client | The client that request the command.. |
|
inlinevirtual |
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. |
|
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. |
|
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 | ( | ) |
|
protected |
Sends the player their current position and sector.
msg | The incoming user command message. |
client | The client that request the command. |
|
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 | ) |
|
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. |
|
protected |
Handle the /starttrading command.
|
protected |
Helper function to make the character stop attacking.
client | The client that needs to stop attacking. |
|
protected |
Handle the /stoptrading command.
|
protected |
Converts a string to lowercase.
str | The string. |
void UserManager::UserStatRegeneration | ( | ) |
|
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 |
|
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 |
|
protected |
Command to surrender to someone in a duel.
client | The client that request the command.. |
|
protected |
Definition at line 655 of file usermanager.h.
|
protected |
Definition at line 653 of file usermanager.h.
|
protected |
Definition at line 646 of file usermanager.h.
|
protected |
Definition at line 644 of file usermanager.h.
|
protected |
Definition at line 656 of file usermanager.h.
|
protected |
Definition at line 654 of file usermanager.h.
|
protected |
Hash of the user commands, the key is the command name.
Definition at line 651 of file usermanager.h.