Planeshift
|
Class for parsing a target of a admin command. More...
#include <adminmanager.h>
Public Member Functions | |
AdminCmdTargetParser (int targetTypes) | |
default constructor. More... | |
virtual AccountID | GetAccountID (size_t gmClientNum) |
Returns the AccountID when the target is a player. More... | |
virtual csString | GetHelpMessagePartForTarget () |
Returns a helpmessage string for the allowed types of the target. More... | |
bool | IsAllowedTargetType (ADMINCMD_TARGET_TYPES targetType) |
Test whether the given target type is allowed or not. More... | |
bool | IsOnline () |
Returns true when the 'target' is online. More... | |
bool | IsTargetType (ADMINCMD_TARGET_TYPES targetType) |
Test whether the given target type is of the supplied type or not. More... | |
bool | IsTargetTypeUnknown () |
Test for unparsable targettype. More... | |
virtual bool | ParseTarget (AdminManager *msgManager, MsgEntry *me, psAdminCmdMessage &msg, Client *client, csString target) |
Tries to parse the supplied string as a destination. More... | |
virtual | ~AdminCmdTargetParser () |
the default destructor. More... | |
Public Attributes | |
bool | area |
is set to true if a character was found by name and multiple name instances were found. More... | |
bool | duplicateActor |
csString | target |
player that is target for the command More... | |
gemActor * | targetActor |
set to the targets actor when possible More... | |
Client * | targetClient |
set to the targets client when possible More... | |
PID | targetID |
stores PID when target is a player/npc/???? specified by PID More... | |
gemObject * | targetObject |
set to the object of the target when possible More... | |
Protected Member Functions | |
bool | GetPlayerAccountIDByName (size_t gmClientNum, const csString &word, bool reporterror) |
Tries to resolve a player name to pid and accountid. More... | |
bool | GetPlayerAccountIDByPID (size_t gmClientNum, const csString &word) |
Tries to resolve player by pid:PID to accountid. More... | |
bool | GetPlayerAccountIDByPIDFromName (size_t gmClientNum, const csString &word, bool reporterror) |
Tries to resolve a player name to pid and accountid. More... | |
bool | GetPlayerClient (AdminManager *msgManager, size_t gmClientNum, const csString &playerName, bool allowduplicate) |
Tries to find a client by name and checks for duplicates. More... | |
virtual void | Reset () |
resets the internal variables to their default values. More... | |
Protected Attributes | |
int | allowedTargetTypes |
allowed destination types More... | |
AccountID | targetAccountID |
internal cache value for accountID More... | |
int | targetTypes |
type of the parsed target More... | |
Class for parsing a target of a admin command.
The class handles the parsing related to the possible targets for the commands. Supported targets are: target (declares explicitly the clients target as a target), pid:PID, area:Area, me, playername, npcname, objectname, accountname, string. The types that the object actually recognizes as correct targets are set in the allowedTypes variables. Recognition is executed in the already given order.
Definition at line 361 of file adminmanager.h.
|
inline |
default constructor.
targetTypes | the allowed target types |
Definition at line 378 of file adminmanager.h.
|
inlinevirtual |
the default destructor.
Definition at line 387 of file adminmanager.h.
|
virtual |
Returns the AccountID when the target is a player.
gmClientNum | id of gm client |
|
virtual |
Returns a helpmessage string for the allowed types of the target.
Automatically generates a help message for the allowed types of the target.
|
protected |
Tries to resolve a player name to pid and accountid.
Queries the database, no checks are done that the player is offline does not set targettypes, etc. (or any other internal variable) targetAccountID is the only exception, it is set when a valid one was found.
gmClientNum | id of gm client |
word | to check for a playername |
reporterror | whether to send errormsg on not found player, or not |
|
protected |
Tries to resolve player by pid:PID to accountid.
Queries the database for the user
gmClientNum | id of gm client |
word | to check for a playername |
|
protected |
Tries to resolve a player name to pid and accountid.
Queries the database, no checks are done that the player is offline
gmClientNum | id of gm client |
word | to check for a playername |
reporterror | whether to send errormsg on not found player, or not |
|
protected |
Tries to find a client by name and checks for duplicates.
msgManager | adminmanager that utilizes this function |
gmClientNum | id of gm client |
playerName | name of the player whose client is searched for |
allowduplicate | is true when playerName can resolve to more than one client |
|
inline |
Test whether the given target type is allowed or not.
targetType | to test |
Definition at line 406 of file adminmanager.h.
|
inline |
Returns true when the 'target' is online.
Definition at line 447 of file adminmanager.h.
|
inline |
Test whether the given target type is of the supplied type or not.
targetType | to test for |
Definition at line 415 of file adminmanager.h.
|
inline |
Test for unparsable targettype.
When no target is detected. This happens when the supplied word is empty or the word does not contain any of the possible (allowed) targettypes.
Definition at line 397 of file adminmanager.h.
|
virtual |
Tries to parse the supplied string as a destination.
msgManager | message manager that handles this command |
me | The incoming message from the GM |
msg | psAdminCmdMessage containing the message |
client | client of the network communication |
target | string to parse as a destination |
|
protectedvirtual |
resets the internal variables to their default values.
Is needed for the case that something is targeted that is not valid
|
protected |
allowed destination types
Definition at line 453 of file adminmanager.h.
bool AdminCmdTargetParser::area |
is set to true if a character was found by name and multiple name instances were found.
Indicates that this is an area target so requires special handling.
Definition at line 370 of file adminmanager.h.
bool AdminCmdTargetParser::duplicateActor |
Definition at line 371 of file adminmanager.h.
csString AdminCmdTargetParser::target |
player that is target for the command
Definition at line 372 of file adminmanager.h.
|
protected |
internal cache value for accountID
Definition at line 455 of file adminmanager.h.
gemActor* AdminCmdTargetParser::targetActor |
set to the targets actor when possible
Definition at line 365 of file adminmanager.h.
Client* AdminCmdTargetParser::targetClient |
set to the targets client when possible
Definition at line 366 of file adminmanager.h.
PID AdminCmdTargetParser::targetID |
stores PID when target is a player/npc/???? specified by PID
Definition at line 373 of file adminmanager.h.
gemObject* AdminCmdTargetParser::targetObject |
set to the object of the target when possible
Definition at line 364 of file adminmanager.h.
|
protected |
type of the parsed target
Definition at line 454 of file adminmanager.h.