aboutsummaryrefslogtreecommitdiff
path: root/src/server/worldserver/CommandLine
diff options
context:
space:
mode:
authorParadox <iamparadox@netscape.net>2010-11-09 10:15:35 -0500
committerParadox <iamparadox@netscape.net>2010-11-09 10:15:35 -0500
commitde1798e4acb61d4c864da1888baef7d0a0871fee (patch)
tree659bf2e343129f6624b80dae3ac1ecb0c016bff2 /src/server/worldserver/CommandLine
parent2da116a4174595b1041501302c34380997c182ed (diff)
Core/Scripts Part 1 of moving all commands to commandscripts
closes issue 4669 (first 5 patches rolled into 1) Patch by Paradox --HG-- branch : trunk
Diffstat (limited to 'src/server/worldserver/CommandLine')
-rwxr-xr-xsrc/server/worldserver/CommandLine/CliRunnable.cpp146
1 files changed, 0 insertions, 146 deletions
diff --git a/src/server/worldserver/CommandLine/CliRunnable.cpp b/src/server/worldserver/CommandLine/CliRunnable.cpp
index c6bc310de57..e3a7fef571a 100755
--- a/src/server/worldserver/CommandLine/CliRunnable.cpp
+++ b/src/server/worldserver/CommandLine/CliRunnable.cpp
@@ -117,63 +117,6 @@ void commandFinished(void*, bool /*success*/)
printf("TC> ");
fflush(stdout);
}
-/// Delete a user account and all associated characters in this realm
-/// \todo This function has to be enhanced to respect the login/realm split (delete char, delete account chars in realm, delete account chars in realm then delete account
-bool ChatHandler::HandleAccountDeleteCommand(const char* args)
-{
- if (!*args)
- return false;
-
- ///- Get the account name from the command line
- char *account_name_str=strtok ((char*)args," ");
- if (!account_name_str)
- return false;
-
- std::string account_name = account_name_str;
- if (!AccountMgr::normalizeString(account_name))
- {
- PSendSysMessage(LANG_ACCOUNT_NOT_EXIST,account_name.c_str());
- SetSentErrorMessage(true);
- return false;
- }
-
- uint32 account_id = sAccountMgr.GetId(account_name);
- if (!account_id)
- {
- PSendSysMessage(LANG_ACCOUNT_NOT_EXIST,account_name.c_str());
- SetSentErrorMessage(true);
- return false;
- }
-
- /// Commands not recommended call from chat, but support anyway
- /// can delete only for account with less security
- /// This is also reject self apply in fact
- if (HasLowerSecurityAccount (NULL,account_id,true))
- return false;
-
- AccountOpResult result = sAccountMgr.DeleteAccount(account_id);
- switch(result)
- {
- case AOR_OK:
- PSendSysMessage(LANG_ACCOUNT_DELETED,account_name.c_str());
- break;
- case AOR_NAME_NOT_EXIST:
- PSendSysMessage(LANG_ACCOUNT_NOT_EXIST,account_name.c_str());
- SetSentErrorMessage(true);
- return false;
- case AOR_DB_INTERNAL_ERROR:
- PSendSysMessage(LANG_ACCOUNT_NOT_DELETED_SQL_ERROR,account_name.c_str());
- SetSentErrorMessage(true);
- return false;
- default:
- PSendSysMessage(LANG_ACCOUNT_NOT_DELETED,account_name.c_str());
- SetSentErrorMessage(true);
- return false;
- }
-
- return true;
-}
-
/**
* Collects all GUIDs (and related info) from deleted characters which are still in the database.
*
@@ -540,95 +483,6 @@ bool ChatHandler::HandleServerExitCommand(const char* /*args*/)
return true;
}
-/// Display info on users currently in the realm
-bool ChatHandler::HandleAccountOnlineListCommand(const char* /*args*/)
-{
- ///- Get the list of accounts ID logged to the realm
- QueryResult resultDB = CharacterDatabase.Query("SELECT name,account,map,zone FROM characters WHERE online > 0");
- if (!resultDB)
- {
- SendSysMessage(LANG_ACCOUNT_LIST_EMPTY);
- return true;
- }
-
- ///- Display the list of account/characters online
- SendSysMessage(LANG_ACCOUNT_LIST_BAR_HEADER);
- SendSysMessage(LANG_ACCOUNT_LIST_HEADER);
- SendSysMessage(LANG_ACCOUNT_LIST_BAR);
-
- ///- Circle through accounts
- do
- {
- Field *fieldsDB = resultDB->Fetch();
- std::string name = fieldsDB[0].GetString();
- uint32 account = fieldsDB[1].GetUInt32();
-
- ///- Get the username, last IP and GM level of each account
- // No SQL injection. account is uint32.
- QueryResult resultLogin =
- LoginDatabase.PQuery("SELECT a.username, a.last_ip, aa.gmlevel, a.expansion "
- "FROM account a "
- "LEFT JOIN account_access aa "
- "ON (a.id = aa.id) "
- "WHERE a.id = '%u'", account);
- if (resultLogin)
- {
- Field *fieldsLogin = resultLogin->Fetch();
- PSendSysMessage(LANG_ACCOUNT_LIST_LINE,
- fieldsLogin[0].GetCString(),name.c_str(),fieldsLogin[1].GetCString(),fieldsDB[2].GetInt32(),fieldsDB[3].GetInt32(),fieldsLogin[3].GetUInt32(),fieldsLogin[2].GetUInt32());
- }
- else
- PSendSysMessage(LANG_ACCOUNT_LIST_ERROR,name.c_str());
-
- }while (resultDB->NextRow());
-
- SendSysMessage(LANG_ACCOUNT_LIST_BAR);
- return true;
-}
-
-/// Create an account
-bool ChatHandler::HandleAccountCreateCommand(const char* args)
-{
- if (!*args)
- return false;
-
- ///- %Parse the command line arguments
- char *szAcc = strtok((char*)args, " ");
- char *szPassword = strtok(NULL, " ");
- if (!szAcc || !szPassword)
- return false;
-
- // normalized in sAccountMgr.CreateAccount
- std::string account_name = szAcc;
- std::string password = szPassword;
-
- AccountOpResult result = sAccountMgr.CreateAccount(account_name, password);
- switch(result)
- {
- case AOR_OK:
- PSendSysMessage(LANG_ACCOUNT_CREATED,account_name.c_str());
- break;
- case AOR_NAME_TOO_LONG:
- SendSysMessage(LANG_ACCOUNT_TOO_LONG);
- SetSentErrorMessage(true);
- return false;
- case AOR_NAME_ALREDY_EXIST:
- SendSysMessage(LANG_ACCOUNT_ALREADY_EXIST);
- SetSentErrorMessage(true);
- return false;
- case AOR_DB_INTERNAL_ERROR:
- PSendSysMessage(LANG_ACCOUNT_NOT_CREATED_SQL_ERROR,account_name.c_str());
- SetSentErrorMessage(true);
- return false;
- default:
- PSendSysMessage(LANG_ACCOUNT_NOT_CREATED,account_name.c_str());
- SetSentErrorMessage(true);
- return false;
- }
-
- return true;
-}
-
/// Set the level of logging
bool ChatHandler::HandleServerSetLogFileLevelCommand(const char *args)
{