diff options
author | Machiavelli <machiaveltman@gmail.com> | 2011-10-10 10:38:50 -0700 |
---|---|---|
committer | Machiavelli <machiaveltman@gmail.com> | 2011-10-10 10:38:50 -0700 |
commit | 85957c33686f34923dbbdcb287b6f88709acb811 (patch) | |
tree | d1cfd470d8dc1e58cfa4777a8ce76eeb56524130 | |
parent | 00f5366029808be221129e039df948b14cadb11d (diff) | |
parent | fd76ef3cd046364e2f81903d23dfdced1fc73532 (diff) |
Merge pull request #3436 from Fredi/cleanup
Script/Commands: Codestyle and cleanups
-rw-r--r-- | src/server/scripts/Commands/cs_account.cpp | 289 | ||||
-rw-r--r-- | src/server/scripts/Commands/cs_achievement.cpp | 10 | ||||
-rw-r--r-- | src/server/scripts/Commands/cs_debug.cpp | 439 | ||||
-rw-r--r-- | src/server/scripts/Commands/cs_event.cpp | 68 | ||||
-rw-r--r-- | src/server/scripts/Commands/cs_gm.cpp | 58 | ||||
-rw-r--r-- | src/server/scripts/Commands/cs_go.cpp | 330 | ||||
-rw-r--r-- | src/server/scripts/Commands/cs_gobject.cpp | 425 |
7 files changed, 823 insertions, 796 deletions
diff --git a/src/server/scripts/Commands/cs_account.cpp b/src/server/scripts/Commands/cs_account.cpp index 1b3454e5ae6..80dd2dc366a 100644 --- a/src/server/scripts/Commands/cs_account.cpp +++ b/src/server/scripts/Commands/cs_account.cpp @@ -60,7 +60,7 @@ public: return commandTable; } - static bool HandleAccountAddonCommand(ChatHandler* handler, const char* args) + static bool HandleAccountAddonCommand(ChatHandler* handler, char const* args) { if (!*args) { @@ -69,11 +69,11 @@ public: return false; } - char *szExp = strtok((char*)args, " "); + char* exp = strtok((char*)args, " "); - uint32 account_id = handler->GetSession()->GetAccountId(); + uint32 accountId = handler->GetSession()->GetAccountId(); - int expansion = atoi(szExp); //get int anyway (0 if error) + int expansion = atoi(exp); //get int anyway (0 if error) if (expansion < 0 || uint8(expansion) > sWorld->getIntConfig(CONFIG_EXPANSION)) { handler->SendSysMessage(LANG_IMPROPER_VALUE); @@ -82,78 +82,74 @@ public: } // No SQL injection - LoginDatabase.PExecute("UPDATE account SET expansion = '%d' WHERE id = '%u'", expansion, account_id); + LoginDatabase.PExecute("UPDATE account SET expansion = '%d' WHERE id = '%u'", expansion, accountId); handler->PSendSysMessage(LANG_ACCOUNT_ADDON, expansion); return true; } /// Create an account - static bool HandleAccountCreateCommand(ChatHandler* handler, const char* args) + static bool HandleAccountCreateCommand(ChatHandler* handler, char const* args) { if (!*args) return false; ///- %Parse the command line arguments - char *szAcc = strtok((char*)args, " "); - char *szPassword = strtok(NULL, " "); - if (!szAcc || !szPassword) + char* accountName = strtok((char*)args, " "); + char* password = strtok(NULL, " "); + if (!accountName || !password) return false; - // normalized in AccountMgr::CreateAccount - std::string account_name = szAcc; - std::string password = szPassword; - - AccountOpResult result = AccountMgr::CreateAccount(account_name, password); + AccountOpResult result = AccountMgr::CreateAccount(std::string(accountName), std::string(password)); switch (result) { - case AOR_OK: - handler->PSendSysMessage(LANG_ACCOUNT_CREATED, account_name.c_str()); - break; - case AOR_NAME_TOO_LONG: - handler->SendSysMessage(LANG_ACCOUNT_TOO_LONG); - handler->SetSentErrorMessage(true); - return false; - case AOR_NAME_ALREDY_EXIST: - handler->SendSysMessage(LANG_ACCOUNT_ALREADY_EXIST); - handler->SetSentErrorMessage(true); - return false; - case AOR_DB_INTERNAL_ERROR: - handler->PSendSysMessage(LANG_ACCOUNT_NOT_CREATED_SQL_ERROR, account_name.c_str()); - handler->SetSentErrorMessage(true); - return false; - default: - handler->PSendSysMessage(LANG_ACCOUNT_NOT_CREATED, account_name.c_str()); - handler->SetSentErrorMessage(true); - return false; + case AOR_OK: + handler->PSendSysMessage(LANG_ACCOUNT_CREATED, accountName); + break; + case AOR_NAME_TOO_LONG: + handler->SendSysMessage(LANG_ACCOUNT_TOO_LONG); + handler->SetSentErrorMessage(true); + return false; + case AOR_NAME_ALREDY_EXIST: + handler->SendSysMessage(LANG_ACCOUNT_ALREADY_EXIST); + handler->SetSentErrorMessage(true); + return false; + case AOR_DB_INTERNAL_ERROR: + handler->PSendSysMessage(LANG_ACCOUNT_NOT_CREATED_SQL_ERROR, accountName); + handler->SetSentErrorMessage(true); + return false; + default: + handler->PSendSysMessage(LANG_ACCOUNT_NOT_CREATED, accountName); + handler->SetSentErrorMessage(true); + return false; } return true; } /// 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 - static bool HandleAccountDeleteCommand(ChatHandler* handler, const char* args) + /// \todo This function has to be enhanced to respect the login/realm split (delete char, delete account chars in realm then delete account) + static bool HandleAccountDeleteCommand(ChatHandler* handler, char const* args) { if (!*args) return false; ///- Get the account name from the command line - char *account_name_str=strtok ((char*)args, " "); - if (!account_name_str) + char* account = strtok((char*)args, " "); + if (!account) return false; - std::string account_name = account_name_str; - if (!AccountMgr::normalizeString(account_name)) + std::string accountName = account; + if (!AccountMgr::normalizeString(accountName)) { - handler->PSendSysMessage(LANG_ACCOUNT_NOT_EXIST, account_name.c_str()); + handler->PSendSysMessage(LANG_ACCOUNT_NOT_EXIST, accountName.c_str()); handler->SetSentErrorMessage(true); return false; } - uint32 account_id = AccountMgr::GetId(account_name); - if (!account_id) + uint32 accountId = AccountMgr::GetId(accountName); + if (!accountId) { - handler->PSendSysMessage(LANG_ACCOUNT_NOT_EXIST, account_name.c_str()); + handler->PSendSysMessage(LANG_ACCOUNT_NOT_EXIST, accountName.c_str()); handler->SetSentErrorMessage(true); return false; } @@ -161,34 +157,34 @@ public: /// 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 (handler->HasLowerSecurityAccount (NULL, account_id, true)) + if (handler->HasLowerSecurityAccount(NULL, accountId, true)) return false; - AccountOpResult result = AccountMgr::DeleteAccount(account_id); + AccountOpResult result = AccountMgr::DeleteAccount(accountId); switch (result) { - case AOR_OK: - handler->PSendSysMessage(LANG_ACCOUNT_DELETED, account_name.c_str()); - break; - case AOR_NAME_NOT_EXIST: - handler->PSendSysMessage(LANG_ACCOUNT_NOT_EXIST, account_name.c_str()); - handler->SetSentErrorMessage(true); - return false; - case AOR_DB_INTERNAL_ERROR: - handler->PSendSysMessage(LANG_ACCOUNT_NOT_DELETED_SQL_ERROR, account_name.c_str()); - handler->SetSentErrorMessage(true); - return false; - default: - handler->PSendSysMessage(LANG_ACCOUNT_NOT_DELETED, account_name.c_str()); - handler->SetSentErrorMessage(true); - return false; + case AOR_OK: + handler->PSendSysMessage(LANG_ACCOUNT_DELETED, accountName.c_str()); + break; + case AOR_NAME_NOT_EXIST: + handler->PSendSysMessage(LANG_ACCOUNT_NOT_EXIST, accountName.c_str()); + handler->SetSentErrorMessage(true); + return false; + case AOR_DB_INTERNAL_ERROR: + handler->PSendSysMessage(LANG_ACCOUNT_NOT_DELETED_SQL_ERROR, accountName.c_str()); + handler->SetSentErrorMessage(true); + return false; + default: + handler->PSendSysMessage(LANG_ACCOUNT_NOT_DELETED, accountName.c_str()); + handler->SetSentErrorMessage(true); + return false; } return true; } /// Display info on users currently in the realm - static bool HandleAccountOnlineListCommand(ChatHandler* handler, const char* /*args*/) + static bool HandleAccountOnlineListCommand(ChatHandler* handler, char const* /*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"); @@ -218,6 +214,7 @@ public: "LEFT JOIN account_access aa " "ON (a.id = aa.id) " "WHERE a.id = '%u'", account); + if (resultLogin) { Field* fieldsLogin = resultLogin->Fetch(); @@ -229,13 +226,13 @@ public: else handler->PSendSysMessage(LANG_ACCOUNT_LIST_ERROR, name.c_str()); - }while (resultDB->NextRow()); + } while (resultDB->NextRow()); handler->SendSysMessage(LANG_ACCOUNT_LIST_BAR); return true; } - static bool HandleAccountLockCommand(ChatHandler* handler, const char* args) + static bool HandleAccountLockCommand(ChatHandler* handler, char const* args) { if (!*args) { @@ -244,15 +241,15 @@ public: return false; } - std::string argstr = (char*)args; - if (argstr == "on") + std::string param = (char*)args; + if (param == "on") { LoginDatabase.PExecute("UPDATE account SET locked = '1' WHERE id = '%d'", handler->GetSession()->GetAccountId()); handler->PSendSysMessage(LANG_COMMAND_ACCLOCKLOCKED); return true; } - if (argstr == "off") + if (param == "off") { LoginDatabase.PExecute("UPDATE account SET locked = '0' WHERE id = '%d'", handler->GetSession()->GetAccountId()); handler->PSendSysMessage(LANG_COMMAND_ACCLOCKUNLOCKED); @@ -264,7 +261,7 @@ public: return false; } - static bool HandleAccountPasswordCommand(ChatHandler* handler, const char* args) + static bool HandleAccountPasswordCommand(ChatHandler* handler, char const* args) { if (!*args) { @@ -273,95 +270,95 @@ public: return false; } - char *old_pass = strtok((char*)args, " "); - char *new_pass = strtok(NULL, " "); - char *new_pass_c = strtok(NULL, " "); + char* oldPassword = strtok((char*)args, " "); + char* newPassword = strtok(NULL, " "); + char* passwordConfirmation = strtok(NULL, " "); - if (!old_pass || !new_pass || !new_pass_c) + if (!oldPassword || !newPassword || !passwordConfirmation) { handler->SendSysMessage(LANG_CMD_SYNTAX); handler->SetSentErrorMessage(true); return false; } - if (!AccountMgr::CheckPassword(handler->GetSession()->GetAccountId(), std::string(old_pass))) + if (!AccountMgr::CheckPassword(handler->GetSession()->GetAccountId(), std::string(oldPassword))) { handler->SendSysMessage(LANG_COMMAND_WRONGOLDPASSWORD); handler->SetSentErrorMessage(true); return false; } - if (strcmp(new_pass, new_pass_c) != 0) + if (strcmp(newPassword, passwordConfirmation) != 0) { handler->SendSysMessage(LANG_NEW_PASSWORDS_NOT_MATCH); handler->SetSentErrorMessage(true); return false; } - AccountOpResult result = AccountMgr::ChangePassword(handler->GetSession()->GetAccountId(), std::string(new_pass)); + AccountOpResult result = AccountMgr::ChangePassword(handler->GetSession()->GetAccountId(), std::string(newPassword)); switch (result) { - case AOR_OK: - handler->SendSysMessage(LANG_COMMAND_PASSWORD); - break; - case AOR_PASS_TOO_LONG: - handler->SendSysMessage(LANG_PASSWORD_TOO_LONG); - handler->SetSentErrorMessage(true); - return false; - default: - handler->SendSysMessage(LANG_COMMAND_NOTCHANGEPASSWORD); - handler->SetSentErrorMessage(true); - return false; + case AOR_OK: + handler->SendSysMessage(LANG_COMMAND_PASSWORD); + break; + case AOR_PASS_TOO_LONG: + handler->SendSysMessage(LANG_PASSWORD_TOO_LONG); + handler->SetSentErrorMessage(true); + return false; + default: + handler->SendSysMessage(LANG_COMMAND_NOTCHANGEPASSWORD); + handler->SetSentErrorMessage(true); + return false; } return true; } - static bool HandleAccountCommand(ChatHandler* handler, const char* /*args*/) + static bool HandleAccountCommand(ChatHandler* handler, char const* /*args*/) { - AccountTypes gmlevel = handler->GetSession()->GetSecurity(); - handler->PSendSysMessage(LANG_ACCOUNT_LEVEL, uint32(gmlevel)); + AccountTypes gmLevel = handler->GetSession()->GetSecurity(); + handler->PSendSysMessage(LANG_ACCOUNT_LEVEL, uint32(gmLevel)); return true; } /// Set/Unset the expansion level for an account - static bool HandleAccountSetAddonCommand(ChatHandler* handler, const char *args) + static bool HandleAccountSetAddonCommand(ChatHandler* handler, char const* args) { ///- Get the command line arguments - char *szAcc = strtok((char*)args, " "); - char *szExp = strtok(NULL, " "); + char* account = strtok((char*)args, " "); + char* exp = strtok(NULL, " "); - if (!szAcc) + if (!account) return false; - std::string account_name; - uint32 account_id; + std::string accountName; + uint32 accountId; - if (!szExp) + if (!exp) { Player* player = handler->getSelectedPlayer(); if (!player) return false; - account_id = player->GetSession()->GetAccountId(); - AccountMgr::GetName(account_id, account_name); - szExp = szAcc; + accountId = player->GetSession()->GetAccountId(); + AccountMgr::GetName(accountId, accountName); + exp = account; } else { ///- Convert Account name to Upper Format - account_name = szAcc; - if (!AccountMgr::normalizeString(account_name)) + accountName = account; + if (!AccountMgr::normalizeString(accountName)) { - handler->PSendSysMessage(LANG_ACCOUNT_NOT_EXIST, account_name.c_str()); + handler->PSendSysMessage(LANG_ACCOUNT_NOT_EXIST, accountName.c_str()); handler->SetSentErrorMessage(true); return false; } - account_id = AccountMgr::GetId(account_name); - if (!account_id) + accountId = AccountMgr::GetId(accountName); + if (!accountId) { - handler->PSendSysMessage(LANG_ACCOUNT_NOT_EXIST, account_name.c_str()); + handler->PSendSysMessage(LANG_ACCOUNT_NOT_EXIST, accountName.c_str()); handler->SetSentErrorMessage(true); return false; } @@ -370,21 +367,21 @@ public: // Let set addon state only for lesser (strong) security level // or to self account - if (handler->GetSession() && handler->GetSession()->GetAccountId () != account_id && - handler->HasLowerSecurityAccount (NULL, account_id, true)) + if (handler->GetSession() && handler->GetSession()->GetAccountId () != accountId && + handler->HasLowerSecurityAccount(NULL, accountId, true)) return false; - int expansion = atoi(szExp); //get int anyway (0 if error) + int expansion = atoi(exp); //get int anyway (0 if error) if (expansion < 0 || uint8(expansion) > sWorld->getIntConfig(CONFIG_EXPANSION)) return false; // No SQL injection - LoginDatabase.PExecute("UPDATE account SET expansion = '%d' WHERE id = '%u'", expansion, account_id); - handler->PSendSysMessage(LANG_ACCOUNT_SETADDON, account_name.c_str(), account_id, expansion); + LoginDatabase.PExecute("UPDATE account SET expansion = '%d' WHERE id = '%u'", expansion, accountId); + handler->PSendSysMessage(LANG_ACCOUNT_SETADDON, accountName.c_str(), accountId, expansion); return true; } - static bool HandleAccountSetGmLevelCommand(ChatHandler* handler, const char *args) + static bool HandleAccountSetGmLevelCommand(ChatHandler* handler, char const* args) { if (!*args) return false; @@ -433,16 +430,16 @@ public: // handler->getSession() == NULL only for console targetAccountId = (isAccountNameGiven) ? AccountMgr::GetId(targetAccountName) : handler->getSelectedPlayer()->GetSession()->GetAccountId(); int32 gmRealmID = (isAccountNameGiven) ? atoi(arg3) : atoi(arg2); - uint32 plSecurity; + uint32 playerSecurity; if (handler->GetSession()) - plSecurity = AccountMgr::GetSecurity(handler->GetSession()->GetAccountId(), gmRealmID); + playerSecurity = AccountMgr::GetSecurity(handler->GetSession()->GetAccountId(), gmRealmID); else - plSecurity = SEC_CONSOLE; + playerSecurity = SEC_CONSOLE; // can set security level only for target with less security and to less security that we have // This is also reject self apply in fact targetSecurity = AccountMgr::GetSecurity(targetAccountId, gmRealmID); - if (targetSecurity >= plSecurity || gm >= plSecurity) + if (targetSecurity >= playerSecurity || gm >= playerSecurity) { handler->SendSysMessage(LANG_YOURS_SECURITY_IS_LOW); handler->SetSentErrorMessage(true); @@ -450,7 +447,7 @@ public: } // Check and abort if the target gm has a higher rank on one of the realms and the new realm is -1 - if (gmRealmID == -1 && !AccountMgr::IsConsoleAccount(plSecurity)) + if (gmRealmID == -1 && !AccountMgr::IsConsoleAccount(playerSecurity)) { QueryResult result = LoginDatabase.PQuery("SELECT * FROM account_access WHERE id = '%u' AND gmlevel > '%d'", targetAccountId, gm); if (result) @@ -477,72 +474,74 @@ public: if (gm != 0) LoginDatabase.PExecute("INSERT INTO account_access VALUES ('%u', '%d', '%d')", targetAccountId, gm, realmID); + handler->PSendSysMessage(LANG_YOU_CHANGE_SECURITY, targetAccountName.c_str(), gm); return true; } /// Set password for account - static bool HandleAccountSetPasswordCommand(ChatHandler* handler, const char *args) + static bool HandleAccountSetPasswordCommand(ChatHandler* handler, char const* args) { if (!*args) return false; ///- Get the command line arguments - char *szAccount = strtok ((char*)args, " "); - char *szPassword1 = strtok (NULL, " "); - char *szPassword2 = strtok (NULL, " "); + char* account = strtok((char*)args, " "); + char* password = strtok(NULL, " "); + char* passwordConfirmation = strtok(NULL, " "); - if (!szAccount||!szPassword1 || !szPassword2) + if (!account || !password || !passwordConfirmation) return false; - std::string account_name = szAccount; - if (!AccountMgr::normalizeString(account_name)) + std::string accountName = account; + if (!AccountMgr::normalizeString(accountName)) { - handler->PSendSysMessage(LANG_ACCOUNT_NOT_EXIST, account_name.c_str()); + handler->PSendSysMessage(LANG_ACCOUNT_NOT_EXIST, accountName.c_str()); handler->SetSentErrorMessage(true); return false; } - uint32 targetAccountId = AccountMgr::GetId(account_name); + uint32 targetAccountId = AccountMgr::GetId(accountName); if (!targetAccountId) { - handler->PSendSysMessage(LANG_ACCOUNT_NOT_EXIST, account_name.c_str()); + handler->PSendSysMessage(LANG_ACCOUNT_NOT_EXIST, accountName.c_str()); handler->SetSentErrorMessage(true); return false; } /// can set password only for target with less security /// This is also reject self apply in fact - if (handler->HasLowerSecurityAccount (NULL, targetAccountId, true)) + if (handler->HasLowerSecurityAccount(NULL, targetAccountId, true)) return false; - if (strcmp(szPassword1, szPassword2)) + if (strcmp(password, passwordConfirmation)) { - handler->SendSysMessage (LANG_NEW_PASSWORDS_NOT_MATCH); - handler->SetSentErrorMessage (true); + handler->SendSysMessage(LANG_NEW_PASSWORDS_NOT_MATCH); + handler->SetSentErrorMessage(true); return false; } - AccountOpResult result = AccountMgr::ChangePassword(targetAccountId, szPassword1); + AccountOpResult result = AccountMgr::ChangePassword(targetAccountId, password); switch (result) { - case AOR_OK: - handler->SendSysMessage(LANG_COMMAND_PASSWORD); - break; - case AOR_NAME_NOT_EXIST: - handler->PSendSysMessage(LANG_ACCOUNT_NOT_EXIST, account_name.c_str()); - handler->SetSentErrorMessage(true); - return false; - case AOR_PASS_TOO_LONG: - handler->SendSysMessage(LANG_PASSWORD_TOO_LONG); - handler->SetSentErrorMessage(true); - return false; - default: - handler->SendSysMessage(LANG_COMMAND_NOTCHANGEPASSWORD); - handler->SetSentErrorMessage(true); - return false; + case AOR_OK: + handler->SendSysMessage(LANG_COMMAND_PASSWORD); + break; + case AOR_NAME_NOT_EXIST: + handler->PSendSysMessage(LANG_ACCOUNT_NOT_EXIST, accountName.c_str()); + handler->SetSentErrorMessage(true); + return false; + case AOR_PASS_TOO_LONG: + handler->SendSysMessage(LANG_PASSWORD_TOO_LONG); + handler->SetSentErrorMessage(true); + return false; + default: + handler->SendSysMessage(LANG_COMMAND_NOTCHANGEPASSWORD); + handler->SetSentErrorMessage(true); + return false; } + return true; } }; diff --git a/src/server/scripts/Commands/cs_achievement.cpp b/src/server/scripts/Commands/cs_achievement.cpp index 88e07a07fe7..61ce13f0ecb 100644 --- a/src/server/scripts/Commands/cs_achievement.cpp +++ b/src/server/scripts/Commands/cs_achievement.cpp @@ -45,7 +45,7 @@ public: return commandTable; } - static bool HandleAchievementAddCommand(ChatHandler* handler, const char *args) + static bool HandleAchievementAddCommand(ChatHandler* handler, char const* args) { if (!*args) return false; @@ -53,8 +53,8 @@ public: uint32 achievementId = atoi((char*)args); if (!achievementId) { - if (char* cId = handler->extractKeyFromLink((char*)args, "Hachievement")) - achievementId = atoi(cId); + if (char* id = handler->extractKeyFromLink((char*)args, "Hachievement")) + achievementId = atoi(id); if (!achievementId) return false; } @@ -67,8 +67,8 @@ public: return false; } - if (AchievementEntry const* pAE = GetAchievementStore()->LookupEntry(achievementId)) - target->CompletedAchievement(pAE); + if (AchievementEntry const* achievementEntry = GetAchievementStore()->LookupEntry(achievementId)) + target->CompletedAchievement(achievementEntry); return true; } diff --git a/src/server/scripts/Commands/cs_debug.cpp b/src/server/scripts/Commands/cs_debug.cpp index dca2f1e4f0e..11e46a8c878 100644 --- a/src/server/scripts/Commands/cs_debug.cpp +++ b/src/server/scripts/Commands/cs_debug.cpp @@ -98,7 +98,7 @@ public: return commandTable; } - static bool HandleDebugPlayCinematicCommand(ChatHandler* handler, const char* args) + static bool HandleDebugPlayCinematicCommand(ChatHandler* handler, char const* args) { // USAGE: .debug play cinematic #cinematicid // #cinematicid - ID decimal number from CinemaicSequences.dbc (1st column) @@ -109,20 +109,20 @@ public: return false; } - uint32 dwId = atoi((char*)args); + uint32 id = atoi((char*)args); - if (!sCinematicSequencesStore.LookupEntry(dwId)) + if (!sCinematicSequencesStore.LookupEntry(id)) { - handler->PSendSysMessage(LANG_CINEMATIC_NOT_EXIST, dwId); + handler->PSendSysMessage(LANG_CINEMATIC_NOT_EXIST, id); handler->SetSentErrorMessage(true); return false; } - handler->GetSession()->GetPlayer()->SendCinematicStart(dwId); + handler->GetSession()->GetPlayer()->SendCinematicStart(id); return true; } - static bool HandleDebugPlayMovieCommand(ChatHandler* handler, const char* args) + static bool HandleDebugPlayMovieCommand(ChatHandler* handler, char const* args) { // USAGE: .debug play movie #movieid // #movieid - ID decimal number from Movie.dbc (1st column) @@ -133,21 +133,21 @@ public: return false; } - uint32 dwId = atoi((char*)args); + uint32 id = atoi((char*)args); - if (!sMovieStore.LookupEntry(dwId)) + if (!sMovieStore.LookupEntry(id)) { - handler->PSendSysMessage(LANG_MOVIE_NOT_EXIST, dwId); + handler->PSendSysMessage(LANG_MOVIE_NOT_EXIST, id); handler->SetSentErrorMessage(true); return false; } - handler->GetSession()->GetPlayer()->SendMovieStart(dwId); + handler->GetSession()->GetPlayer()->SendMovieStart(id); return true; } //Play sound - static bool HandleDebugPlaySoundCommand(ChatHandler* handler, const char* args) + static bool HandleDebugPlaySoundCommand(ChatHandler* handler, char const* args) { // USAGE: .debug playsound #soundid // #soundid - ID decimal number from SoundEntries.dbc (1st column) @@ -158,11 +158,11 @@ public: return false; } - uint32 dwSoundId = atoi((char*)args); + uint32 soundId = atoi((char*)args); - if (!sSoundEntriesStore.LookupEntry(dwSoundId)) + if (!sSoundEntriesStore.LookupEntry(soundId)) { - handler->PSendSysMessage(LANG_SOUND_NOT_EXIST, dwSoundId); + handler->PSendSysMessage(LANG_SOUND_NOT_EXIST, soundId); handler->SetSentErrorMessage(true); return false; } @@ -176,48 +176,48 @@ public: } if (handler->GetSession()->GetPlayer()->GetSelection()) - unit->PlayDistanceSound(dwSoundId, handler->GetSession()->GetPlayer()); + unit->PlayDistanceSound(soundId, handler->GetSession()->GetPlayer()); else - unit->PlayDirectSound(dwSoundId, handler->GetSession()->GetPlayer()); + unit->PlayDirectSound(soundId, handler->GetSession()->GetPlayer()); - handler->PSendSysMessage(LANG_YOU_HEAR_SOUND, dwSoundId); + handler->PSendSysMessage(LANG_YOU_HEAR_SOUND, soundId); return true; } - static bool HandleDebugSendSpellFailCommand(ChatHandler* handler, const char* args) + static bool HandleDebugSendSpellFailCommand(ChatHandler* handler, char const* args) { if (!*args) return false; - char* px = strtok((char*)args, " "); - if (!px) + char* result = strtok((char*)args, " "); + if (!result) return false; - uint8 failnum = (uint8)atoi(px); - if (failnum == 0 && *px != '0') + uint8 failNum = (uint8)atoi(result); + if (failNum == 0 && *result != '0') return false; - char* p1 = strtok(NULL, " "); - uint8 failarg1 = p1 ? (uint8)atoi(p1) : 0; + char* fail1 = strtok(NULL, " "); + uint8 failArg1 = fail1 ? (uint8)atoi(fail1) : 0; - char* p2 = strtok(NULL, " "); - uint8 failarg2 = p2 ? (uint8)atoi(p2) : 0; + char* fail2 = strtok(NULL, " "); + uint8 failArg2 = fail2 ? (uint8)atoi(fail2) : 0; WorldPacket data(SMSG_CAST_FAILED, 5); data << uint8(0); data << uint32(133); - data << uint8(failnum); - if (p1 || p2) - data << uint32(failarg1); - if (p2) - data << uint32(failarg2); + data << uint8(failNum); + if (fail1 || fail2) + data << uint32(failArg1); + if (fail2) + data << uint32(failArg2); handler->GetSession()->SendPacket(&data); return true; } - static bool HandleDebugSendEquipErrorCommand(ChatHandler* handler, const char* args) + static bool HandleDebugSendEquipErrorCommand(ChatHandler* handler, char const* args) { if (!*args) return false; @@ -227,7 +227,7 @@ public: return true; } - static bool HandleDebugSendSellErrorCommand(ChatHandler* handler, const char* args) + static bool HandleDebugSendSellErrorCommand(ChatHandler* handler, char const* args) { if (!*args) return false; @@ -237,7 +237,7 @@ public: return true; } - static bool HandleDebugSendBuyErrorCommand(ChatHandler* handler, const char* args) + static bool HandleDebugSendBuyErrorCommand(ChatHandler* handler, char const* args) { if (!*args) return false; @@ -247,7 +247,7 @@ public: return true; } - static bool HandleDebugSendOpcodeCommand(ChatHandler* handler, const char* /*args*/) + static bool HandleDebugSendOpcodeCommand(ChatHandler* handler, char const* /*args*/) { Unit* unit = handler->getSelectedUnit(); Player* player = NULL; @@ -255,7 +255,9 @@ public: player = handler->GetSession()->GetPlayer(); else player = (Player*)unit; - if (!unit) unit = player; + + if (!unit) + unit = player; std::ifstream ifs("opcode.txt"); if (ifs.bad()) @@ -296,9 +298,7 @@ public: } // regular data else - { ifs.putback(commentToken[1]); - } } parsedStream.put(commentToken[0]); } @@ -418,7 +418,7 @@ public: return true; } - static bool HandleDebugUpdateWorldStateCommand(ChatHandler* handler, const char* args) + static bool HandleDebugUpdateWorldStateCommand(ChatHandler* handler, char const* args) { char* w = strtok((char*)args, " "); char* s = strtok(NULL, " "); @@ -432,14 +432,16 @@ public: return true; } - static bool HandleDebugAreaTriggersCommand(ChatHandler* handler, const char* /*args*/) + static bool HandleDebugAreaTriggersCommand(ChatHandler* handler, char const* /*args*/) { Player* player = handler->GetSession()->GetPlayer(); if (!player->isDebugAreaTriggers) { handler->PSendSysMessage(LANG_DEBUG_AREATRIGGER_ON); player->isDebugAreaTriggers = true; - } else { + } + else + { handler->PSendSysMessage(LANG_DEBUG_AREATRIGGER_OFF); player->isDebugAreaTriggers = false; } @@ -447,12 +449,12 @@ public: } //Send notification in channel - static bool HandleDebugSendChannelNotifyCommand(ChatHandler* handler, const char* args) + static bool HandleDebugSendChannelNotifyCommand(ChatHandler* handler, char const* args) { if (!*args) return false; - const char *name = "test"; + char const* name = "test"; uint8 code = atoi(args); WorldPacket data(SMSG_CHANNEL_NOTIFY, (1+10)); @@ -465,12 +467,12 @@ public: } //Send notification in chat - static bool HandleDebugSendChatMsgCommand(ChatHandler* handler, const char* args) + static bool HandleDebugSendChatMsgCommand(ChatHandler* handler, char const* args) { if (!*args) return false; - const char *msg = "testtest"; + char const* msg = "testtest"; uint8 type = atoi(args); WorldPacket data; ChatHandler::FillMessageData(&data, handler->GetSession(), type, 0, "chan", handler->GetSession()->GetPlayer()->GetGUID(), msg, handler->GetSession()->GetPlayer()); @@ -478,54 +480,64 @@ public: return true; } - static bool HandleDebugSendQuestPartyMsgCommand(ChatHandler* handler, const char* args) + static bool HandleDebugSendQuestPartyMsgCommand(ChatHandler* handler, char const* args) { uint32 msg = atol((char*)args); handler->GetSession()->GetPlayer()->SendPushToPartyResponse(handler->GetSession()->GetPlayer(), msg); return true; } - static bool HandleDebugGetLootRecipientCommand(ChatHandler* handler, const char* /*args*/) + static bool HandleDebugGetLootRecipientCommand(ChatHandler* handler, char const* /*args*/) { Creature* target = handler->getSelectedCreature(); if (!target) return false; - handler->PSendSysMessage("Loot recipient for creature %s (GUID %u, DB GUID %u) is %s", target->GetName(), target->GetGUIDLow(), target->GetDBTableGUIDLow(), target->hasLootRecipient()?(target->GetLootRecipient()?target->GetLootRecipient()->GetName():"offline"):"no loot recipient"); + handler->PSendSysMessage("Loot recipient for creature %s (GUID %u, DB GUID %u) is %s", target->GetName(), target->GetGUIDLow(), target->GetDBTableGUIDLow(), target->hasLootRecipient() ? (target->GetLootRecipient() ? target->GetLootRecipient()->GetName() : "offline") : "no loot recipient"); return true; } - static bool HandleDebugSendQuestInvalidMsgCommand(ChatHandler* handler, const char* args) + static bool HandleDebugSendQuestInvalidMsgCommand(ChatHandler* handler, char const* args) { uint32 msg = atol((char*)args); handler->GetSession()->GetPlayer()->SendCanTakeQuestResponse(msg); return true; } - static bool HandleDebugGetItemStateCommand(ChatHandler* handler, const char* args) + static bool HandleDebugGetItemStateCommand(ChatHandler* handler, char const* args) { if (!*args) return false; - std::string state_str = args; + std::string itemState = args; ItemUpdateState state = ITEM_UNCHANGED; - bool list_queue = false, check_all = false; - if (state_str == "unchanged") state = ITEM_UNCHANGED; - else if (state_str == "changed") state = ITEM_CHANGED; - else if (state_str == "new") state = ITEM_NEW; - else if (state_str == "removed") state = ITEM_REMOVED; - else if (state_str == "queue") list_queue = true; - else if (state_str == "check_all") check_all = true; - else return false; + bool listQueue = false; + bool checkAll = false; + + if (itemState == "unchanged") + state = ITEM_UNCHANGED; + else if (itemState == "changed") + state = ITEM_CHANGED; + else if (itemState == "new") + state = ITEM_NEW; + else if (itemState == "removed") + state = ITEM_REMOVED; + else if (itemState == "queue") + listQueue = true; + else if (itemState == "check_all") + checkAll = true; + else + return false; Player* player = handler->getSelectedPlayer(); - if (!player) player = handler->GetSession()->GetPlayer(); + if (!player) + player = handler->GetSession()->GetPlayer(); - if (!list_queue && !check_all) + if (!listQueue && !checkAll) { - state_str = "The player has the following " + state_str + " items: "; - handler->SendSysMessage(state_str.c_str()); + itemState = "The player has the following " + itemState + " items: "; + handler->SendSysMessage(itemState.c_str()); for (uint8 i = PLAYER_SLOT_START; i < PLAYER_SLOT_END; ++i) { if (i >= BUYBACK_SLOT_START && i < BUYBACK_SLOT_END) @@ -546,60 +558,73 @@ public: } } - if (list_queue) + if (listQueue) { - std::vector<Item*> &updateQueue = player->GetItemUpdateQueue(); + std::vector<Item*>& updateQueue = player->GetItemUpdateQueue(); for (size_t i = 0; i < updateQueue.size(); ++i) { Item* item = updateQueue[i]; - if (!item) continue; + if (!item) + continue; Bag* container = item->GetContainer(); - uint8 bag_slot = container ? container->GetSlot() : uint8(INVENTORY_SLOT_BAG_0); + uint8 bagSlot = container ? container->GetSlot() : uint8(INVENTORY_SLOT_BAG_0); std::string st; switch (item->GetState()) { - case ITEM_UNCHANGED: st = "unchanged"; break; - case ITEM_CHANGED: st = "changed"; break; - case ITEM_NEW: st = "new"; break; - case ITEM_REMOVED: st = "removed"; break; + case ITEM_UNCHANGED: + st = "unchanged"; + break; + case ITEM_CHANGED: + st = "changed"; + break; + case ITEM_NEW: + st = "new"; + break; + case ITEM_REMOVED: + st = "removed"; + break; } - handler->PSendSysMessage("bag: %d slot: %d guid: %d - state: %s", bag_slot, item->GetSlot(), item->GetGUIDLow(), st.c_str()); + handler->PSendSysMessage("bag: %d slot: %d guid: %d - state: %s", bagSlot, item->GetSlot(), item->GetGUIDLow(), st.c_str()); } if (updateQueue.empty()) handler->PSendSysMessage("The player's updatequeue is empty"); } - if (check_all) + if (checkAll) { bool error = false; - std::vector<Item*> &updateQueue = player->GetItemUpdateQueue(); + std::vector<Item*>& updateQueue = player->GetItemUpdateQueue(); for (uint8 i = PLAYER_SLOT_START; i < PLAYER_SLOT_END; ++i) { if (i >= BUYBACK_SLOT_START && i < BUYBACK_SLOT_END) continue; Item* item = player->GetItemByPos(INVENTORY_SLOT_BAG_0, i); - if (!item) continue; + if (!item) + continue; if (item->GetSlot() != i) { handler->PSendSysMessage("Item with slot %d and guid %d has an incorrect slot value: %d", i, item->GetGUIDLow(), item->GetSlot()); - error = true; continue; + error = true; + continue; } if (item->GetOwnerGUID() != player->GetGUID()) { handler->PSendSysMessage("The item with slot %d and itemguid %d does have non-matching owner guid (%d) and player guid (%d) !", item->GetSlot(), item->GetGUIDLow(), GUID_LOPART(item->GetOwnerGUID()), player->GetGUIDLow()); - error = true; continue; + error = true; + continue; } if (Bag* container = item->GetContainer()) { handler->PSendSysMessage("The item with slot %d and guid %d has a container (slot: %d, guid: %d) but shouldn't!", item->GetSlot(), item->GetGUIDLow(), container->GetSlot(), container->GetGUIDLow()); - error = true; continue; + error = true; + continue; } if (item->IsInUpdateQueue()) @@ -608,25 +633,29 @@ public: if (qp > updateQueue.size()) { handler->PSendSysMessage("The item with slot %d and guid %d has its queuepos (%d) larger than the update queue size! ", item->GetSlot(), item->GetGUIDLow(), qp); - error = true; continue; + error = true; + continue; } if (updateQueue[qp] == NULL) { handler->PSendSysMessage("The item with slot %d and guid %d has its queuepos (%d) pointing to NULL in the queue!", item->GetSlot(), item->GetGUIDLow(), qp); - error = true; continue; + error = true; + continue; } if (updateQueue[qp] != item) { handler->PSendSysMessage("The item with slot %d and guid %d has a queuepos (%d) that points to another item in the queue (bag: %d, slot: %d, guid: %d)", item->GetSlot(), item->GetGUIDLow(), qp, updateQueue[qp]->GetBagSlot(), updateQueue[qp]->GetSlot(), updateQueue[qp]->GetGUIDLow()); - error = true; continue; + error = true; + continue; } } else if (item->GetState() != ITEM_UNCHANGED) { handler->PSendSysMessage("The item with slot %d and guid %d is not in queue but should be (state: %d)!", item->GetSlot(), item->GetGUIDLow(), item->GetState()); - error = true; continue; + error = true; + continue; } if (Bag* bag = item->ToBag()) @@ -634,31 +663,36 @@ public: for (uint8 j = 0; j < bag->GetBagSize(); ++j) { Item* item2 = bag->GetItemByPos(j); - if (!item2) continue; + if (!item2) + continue; if (item2->GetSlot() != j) { handler->PSendSysMessage("The item in bag %d and slot %d (guid: %d) has an incorrect slot value: %d", bag->GetSlot(), j, item2->GetGUIDLow(), item2->GetSlot()); - error = true; continue; + error = true; + continue; } if (item2->GetOwnerGUID() != player->GetGUID()) { handler->PSendSysMessage("The item in bag %d at slot %d and with itemguid %d, the owner's guid (%d) and the player's guid (%d) don't match!", bag->GetSlot(), item2->GetSlot(), item2->GetGUIDLow(), GUID_LOPART(item2->GetOwnerGUID()), player->GetGUIDLow()); - error = true; continue; + error = true; + continue; } Bag* container = item2->GetContainer(); if (!container) { handler->PSendSysMessage("The item in bag %d at slot %d with guid %d has no container!", bag->GetSlot(), item2->GetSlot(), item2->GetGUIDLow()); - error = true; continue; + error = true; + continue; } if (container != bag) { handler->PSendSysMessage("The item in bag %d at slot %d with guid %d has a different container(slot %d guid %d)!", bag->GetSlot(), item2->GetSlot(), item2->GetGUIDLow(), container->GetSlot(), container->GetGUIDLow()); - error = true; continue; + error = true; + continue; } if (item2->IsInUpdateQueue()) @@ -667,25 +701,29 @@ public: if (qp > updateQueue.size()) { handler->PSendSysMessage("The item in bag %d at slot %d having guid %d has a queuepos (%d) larger than the update queue size! ", bag->GetSlot(), item2->GetSlot(), item2->GetGUIDLow(), qp); - error = true; continue; + error = true; + continue; } if (updateQueue[qp] == NULL) { handler->PSendSysMessage("The item in bag %d at slot %d having guid %d has a queuepos (%d) that points to NULL in the queue!", bag->GetSlot(), item2->GetSlot(), item2->GetGUIDLow(), qp); - error = true; continue; + error = true; + continue; } if (updateQueue[qp] != item2) { handler->PSendSysMessage("The item in bag %d at slot %d having guid %d has a queuepos (%d) that points to another item in the queue (bag: %d, slot: %d, guid: %d)", bag->GetSlot(), item2->GetSlot(), item2->GetGUIDLow(), qp, updateQueue[qp]->GetBagSlot(), updateQueue[qp]->GetSlot(), updateQueue[qp]->GetGUIDLow()); - error = true; continue; + error = true; + continue; } } else if (item2->GetState() != ITEM_UNCHANGED) { handler->PSendSysMessage("The item in bag %d at slot %d having guid %d is not in queue but should be (state: %d)!", bag->GetSlot(), item2->GetSlot(), item2->GetGUIDLow(), item2->GetState()); - error = true; continue; + error = true; + continue; } } } @@ -694,33 +732,40 @@ public: for (size_t i = 0; i < updateQueue.size(); ++i) { Item* item = updateQueue[i]; - if (!item) continue; + if (!item) + continue; if (item->GetOwnerGUID() != player->GetGUID()) { handler->PSendSysMessage("queue(" SIZEFMTD "): For the item with guid %d, the owner's guid (%d) and the player's guid (%d) don't match!", i, item->GetGUIDLow(), GUID_LOPART(item->GetOwnerGUID()), player->GetGUIDLow()); - error = true; continue; + error = true; + continue; } if (item->GetQueuePos() != i) { handler->PSendSysMessage("queue(" SIZEFMTD "): For the item with guid %d, the queuepos doesn't match it's position in the queue!", i, item->GetGUIDLow()); - error = true; continue; + error = true; + continue; } - if (item->GetState() == ITEM_REMOVED) continue; + if (item->GetState() == ITEM_REMOVED) + continue; + Item* test = player->GetItemByPos(item->GetBagSlot(), item->GetSlot()); if (test == NULL) { handler->PSendSysMessage("queue(" SIZEFMTD "): The bag(%d) and slot(%d) values for the item with guid %d are incorrect, the player doesn't have any item at that position!", i, item->GetBagSlot(), item->GetSlot(), item->GetGUIDLow()); - error = true; continue; + error = true; + continue; } if (test != item) { handler->PSendSysMessage("queue(" SIZEFMTD "): The bag(%d) and slot(%d) values for the item with guid %d are incorrect, an item which guid is %d is there instead!", i, item->GetBagSlot(), item->GetSlot(), item->GetGUIDLow(), test->GetGUIDLow()); - error = true; continue; + error = true; + continue; } } if (!error) @@ -730,54 +775,54 @@ public: return true; } - static bool HandleDebugBattlegroundCommand(ChatHandler* /*handler*/, const char* /*args*/) + static bool HandleDebugBattlegroundCommand(ChatHandler* /*handler*/, char const* /*args*/) { sBattlegroundMgr->ToggleTesting(); return true; } - static bool HandleDebugArenaCommand(ChatHandler* /*handler*/, const char* /*args*/) + static bool HandleDebugArenaCommand(ChatHandler* /*handler*/, char const* /*args*/) { sBattlegroundMgr->ToggleArenaTesting(); return true; } - static bool HandleDebugThreatListCommand(ChatHandler* handler, const char* /*args*/) + static bool HandleDebugThreatListCommand(ChatHandler* handler, char const* /*args*/) { Creature* target = handler->getSelectedCreature(); if (!target || target->isTotem() || target->isPet()) return false; - std::list<HostileReference*>& tlist = target->getThreatManager().getThreatList(); + std::list<HostileReference*>& threatList = target->getThreatManager().getThreatList(); std::list<HostileReference*>::iterator itr; - uint32 cnt = 0; + uint32 count = 0; handler->PSendSysMessage("Threat list of %s (guid %u)", target->GetName(), target->GetGUIDLow()); - for (itr = tlist.begin(); itr != tlist.end(); ++itr) + for (itr = threatList.begin(); itr != threatList.end(); ++itr) { Unit* unit = (*itr)->getTarget(); if (!unit) continue; - ++cnt; - handler->PSendSysMessage(" %u. %s (guid %u) - threat %f", cnt, unit->GetName(), unit->GetGUIDLow(), (*itr)->getThreat()); + ++count; + handler->PSendSysMessage(" %u. %s (guid %u) - threat %f", count, unit->GetName(), unit->GetGUIDLow(), (*itr)->getThreat()); } handler->SendSysMessage("End of threat list."); return true; } - static bool HandleDebugHostileRefListCommand(ChatHandler* handler, const char* /*args*/) + static bool HandleDebugHostileRefListCommand(ChatHandler* handler, char const* /*args*/) { Unit* target = handler->getSelectedUnit(); if (!target) target = handler->GetSession()->GetPlayer(); HostileReference* ref = target->getHostileRefManager().getFirst(); - uint32 cnt = 0; + uint32 count = 0; handler->PSendSysMessage("Hostil reference list of %s (guid %u)", target->GetName(), target->GetGUIDLow()); while (ref) { if (Unit* unit = ref->getSource()->getOwner()) { - ++cnt; - handler->PSendSysMessage(" %u. %s (guid %u) - threat %f", cnt, unit->GetName(), unit->GetGUIDLow(), ref->getThreat()); + ++count; + handler->PSendSysMessage(" %u. %s (guid %u) - threat %f", count, unit->GetName(), unit->GetGUIDLow(), ref->getThreat()); } ref = ref->next(); } @@ -785,7 +830,7 @@ public: return true; } - static bool HandleDebugSetVehicleIdCommand(ChatHandler* handler, const char* args) + static bool HandleDebugSetVehicleIdCommand(ChatHandler* handler, char const* args) { Unit* target = handler->getSelectedUnit(); if (!target || target->IsVehicle()) @@ -804,7 +849,7 @@ public: return true; } - static bool HandleDebugEnterVehicleCommand(ChatHandler* handler, const char* args) + static bool HandleDebugEnterVehicleCommand(ChatHandler* handler, char const* args) { Unit* target = handler->getSelectedUnit(); if (!target || !target->IsVehicle()) @@ -839,7 +884,7 @@ public: return true; } - static bool HandleDebugSpawnVehicleCommand(ChatHandler* handler, const char* args) + static bool HandleDebugSpawnVehicleCommand(ChatHandler* handler, char const* args) { if (!*args) return false; @@ -885,7 +930,7 @@ public: return true; } - static bool HandleDebugSendLargePacketCommand(ChatHandler* handler, const char* /*args*/) + static bool HandleDebugSendLargePacketCommand(ChatHandler* handler, char const* /*args*/) { const char* stuffingString = "This is a dummy string to push the packet's size beyond 128000 bytes. "; std::ostringstream ss; @@ -895,7 +940,7 @@ public: return true; } - static bool HandleDebugSendSetPhaseShiftCommand(ChatHandler* handler, const char* args) + static bool HandleDebugSendSetPhaseShiftCommand(ChatHandler* handler, char const* args) { if (!*args) return false; @@ -905,7 +950,7 @@ public: return true; } - static bool HandleDebugGetItemValueCommand(ChatHandler* handler, const char* args) + static bool HandleDebugGetItemValueCommand(ChatHandler* handler, char const* args) { if (!*args) return false; @@ -934,7 +979,7 @@ public: return true; } - static bool HandleDebugSetItemValueCommand(ChatHandler* handler, const char* args) + static bool HandleDebugSetItemValueCommand(ChatHandler* handler, char const* args) { if (!*args) return false; @@ -963,7 +1008,7 @@ public: return true; } - static bool HandleDebugItemExpireCommand(ChatHandler* handler, const char* args) + static bool HandleDebugItemExpireCommand(ChatHandler* handler, char const* args) { if (!*args) return false; @@ -986,17 +1031,17 @@ public: } //show animation - static bool HandleDebugAnimCommand(ChatHandler* handler, const char* args) + static bool HandleDebugAnimCommand(ChatHandler* handler, char const* args) { if (!*args) return false; - uint32 anim_id = atoi((char*)args); - handler->GetSession()->GetPlayer()->HandleEmoteCommand(anim_id); + uint32 animId = atoi((char*)args); + handler->GetSession()->GetPlayer()->HandleEmoteCommand(animId); return true; } - static bool HandleDebugSetAuraStateCommand(ChatHandler* handler, const char* args) + static bool HandleDebugSetAuraStateCommand(ChatHandler* handler, char const* args) { if (!*args) { @@ -1026,16 +1071,16 @@ public: return true; } - static bool HandleDebugSetValueCommand(ChatHandler* handler, const char* args) + static bool HandleDebugSetValueCommand(ChatHandler* handler, char const* args) { if (!*args) return false; - char* px = strtok((char*)args, " "); - char* py = strtok(NULL, " "); - char* pz = strtok(NULL, " "); + char* x = strtok((char*)args, " "); + char* y = strtok(NULL, " "); + char* z = strtok(NULL, " "); - if (!px || !py) + if (!x || !y) return false; WorldObject* target = handler->getSelectedObject(); @@ -1048,41 +1093,42 @@ public: uint64 guid = target->GetGUID(); - uint32 Opcode = (uint32)atoi(px); - if (Opcode >= target->GetValuesCount()) + uint32 opcode = (uint32)atoi(x); + if (opcode >= target->GetValuesCount()) { - handler->PSendSysMessage(LANG_TOO_BIG_INDEX, Opcode, GUID_LOPART(guid), target->GetValuesCount()); + handler->PSendSysMessage(LANG_TOO_BIG_INDEX, opcode, GUID_LOPART(guid), target->GetValuesCount()); return false; } - bool isint32 = true; - if (pz) - isint32 = (bool)atoi(pz); - if (isint32) + bool isInt32 = true; + if (z) + isInt32 = (bool)atoi(z); + + if (isInt32) { - uint32 iValue = (uint32)atoi(py); - target->SetUInt32Value(Opcode, iValue); - handler->PSendSysMessage(LANG_SET_UINT_FIELD, GUID_LOPART(guid), Opcode, iValue); + uint32 value = (uint32)atoi(y); + target->SetUInt32Value(opcode , value); + handler->PSendSysMessage(LANG_SET_UINT_FIELD, GUID_LOPART(guid), opcode, value); } else { - float fValue = (float)atof(py); - target->SetFloatValue(Opcode, fValue); - handler->PSendSysMessage(LANG_SET_FLOAT_FIELD, GUID_LOPART(guid), Opcode, fValue); + float value = (float)atof(y); + target->SetFloatValue(opcode , value); + handler->PSendSysMessage(LANG_SET_FLOAT_FIELD, GUID_LOPART(guid), opcode, value); } return true; } - static bool HandleDebugGetValueCommand(ChatHandler* handler, const char* args) + static bool HandleDebugGetValueCommand(ChatHandler* handler, char const* args) { if (!*args) return false; - char* px = strtok((char*)args, " "); - char* pz = strtok(NULL, " "); + char* x = strtok((char*)args, " "); + char* z = strtok(NULL, " "); - if (!px) + if (!x) return false; Unit* target = handler->getSelectedUnit(); @@ -1095,62 +1141,62 @@ public: uint64 guid = target->GetGUID(); - uint32 Opcode = (uint32)atoi(px); - if (Opcode >= target->GetValuesCount()) + uint32 opcode = (uint32)atoi(x); + if (opcode >= target->GetValuesCount()) { - handler->PSendSysMessage(LANG_TOO_BIG_INDEX, Opcode, GUID_LOPART(guid), target->GetValuesCount()); + handler->PSendSysMessage(LANG_TOO_BIG_INDEX, opcode, GUID_LOPART(guid), target->GetValuesCount()); return false; } - bool isint32 = true; - if (pz) - isint32 = (bool)atoi(pz); + bool isInt32 = true; + if (z) + isInt32 = (bool)atoi(z); - if (isint32) + if (isInt32) { - uint32 iValue = target->GetUInt32Value(Opcode); - handler->PSendSysMessage(LANG_GET_UINT_FIELD, GUID_LOPART(guid), Opcode, iValue); + uint32 value = target->GetUInt32Value(opcode); + handler->PSendSysMessage(LANG_GET_UINT_FIELD, GUID_LOPART(guid), opcode, value); } else { - float fValue = target->GetFloatValue(Opcode); - handler->PSendSysMessage(LANG_GET_FLOAT_FIELD, GUID_LOPART(guid), Opcode, fValue); + float value = target->GetFloatValue(opcode); + handler->PSendSysMessage(LANG_GET_FLOAT_FIELD, GUID_LOPART(guid), opcode, value); } return true; } - static bool HandleDebugMod32ValueCommand(ChatHandler* handler, const char* args) + static bool HandleDebugMod32ValueCommand(ChatHandler* handler, char const* args) { if (!*args) return false; - char* px = strtok((char*)args, " "); - char* py = strtok(NULL, " "); + char* x = strtok((char*)args, " "); + char* y = strtok(NULL, " "); - if (!px || !py) + if (!x || !y) return false; - uint32 Opcode = (uint32)atoi(px); - int Value = atoi(py); + uint32 opcode = (uint32)atoi(x); + int value = atoi(y); - if (Opcode >= handler->GetSession()->GetPlayer()->GetValuesCount()) + if (opcode >= handler->GetSession()->GetPlayer()->GetValuesCount()) { - handler->PSendSysMessage(LANG_TOO_BIG_INDEX, Opcode, handler->GetSession()->GetPlayer()->GetGUIDLow(), handler->GetSession()->GetPlayer()->GetValuesCount()); + handler->PSendSysMessage(LANG_TOO_BIG_INDEX, opcode, handler->GetSession()->GetPlayer()->GetGUIDLow(), handler->GetSession()->GetPlayer()->GetValuesCount()); return false; } - int CurrentValue = (int)handler->GetSession()->GetPlayer()->GetUInt32Value(Opcode); + int currentValue = (int)handler->GetSession()->GetPlayer()->GetUInt32Value(opcode); - CurrentValue += Value; - handler->GetSession()->GetPlayer()->SetUInt32Value(Opcode, (uint32)CurrentValue); + currentValue += value; + handler->GetSession()->GetPlayer()->SetUInt32Value(opcode , (uint32)currentValue); - handler->PSendSysMessage(LANG_CHANGE_32BIT_FIELD, Opcode, CurrentValue); + handler->PSendSysMessage(LANG_CHANGE_32BIT_FIELD, opcode, currentValue); return true; } - static bool HandleDebugUpdateCommand(ChatHandler* handler, const char* args) + static bool HandleDebugUpdateCommand(ChatHandler* handler, char const* args) { if (!*args) return false; @@ -1158,49 +1204,48 @@ public: uint32 updateIndex; uint32 value; - char* pUpdateIndex = strtok((char*)args, " "); + char* index = strtok((char*)args, " "); - Unit* chr = handler->getSelectedUnit(); - if (chr == NULL) + Unit* unit = handler->getSelectedUnit(); + if (!unit) { handler->SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE); handler->SetSentErrorMessage(true); return false; } - if (!pUpdateIndex) - { + if (!index) return true; - } - updateIndex = atoi(pUpdateIndex); + + updateIndex = atoi(index); //check updateIndex - if (chr->GetTypeId() == TYPEID_PLAYER) - { - if (updateIndex >= PLAYER_END) return true; - } - else + if (unit->GetTypeId() == TYPEID_PLAYER) { - if (updateIndex >= UNIT_END) return true; + if (updateIndex >= PLAYER_END) + return true; } + else if (updateIndex >= UNIT_END) + return true; - char* pvalue = strtok(NULL, " "); - if (!pvalue) + char* val = strtok(NULL, " "); + if (!val) { - value=chr->GetUInt32Value(updateIndex); + value = unit->GetUInt32Value(updateIndex); - handler->PSendSysMessage(LANG_UPDATE, chr->GetGUIDLow(), updateIndex, value); + handler->PSendSysMessage(LANG_UPDATE, unit->GetGUIDLow(), updateIndex, value); return true; } - value=atoi(pvalue); + value = atoi(val); - handler->PSendSysMessage(LANG_UPDATE_CHANGE, chr->GetGUIDLow(), updateIndex, value); + handler->PSendSysMessage(LANG_UPDATE_CHANGE, unit->GetGUIDLow(), updateIndex, value); - chr->SetUInt32Value(updateIndex, value); + unit->SetUInt32Value(updateIndex, value); return true; } - static bool HandleDebugSet32BitCommand(ChatHandler* handler, const char* args) + + static bool HandleDebugSet32BitCommand(ChatHandler* handler, char const* args) { if (!*args) return false; @@ -1213,21 +1258,21 @@ public: return false; } - char* px = strtok((char*)args, " "); - char* py = strtok(NULL, " "); + char* x = strtok((char*)args, " "); + char* y = strtok(NULL, " "); - if (!px || !py) + if (!x || !y) return false; - uint32 Opcode = (uint32)atoi(px); - uint32 Value = (uint32)atoi(py); - if (Value > 32) //uint32 = 32 bits + uint32 opcode = (uint32)atoi(x); + uint32 val = (uint32)atoi(y); + if (val > 32) //uint32 = 32 bits return false; - uint32 iValue = Value ? 1 << (Value - 1) : 0; - target->SetUInt32Value(Opcode, iValue); + uint32 value = val ? 1 << (val - 1) : 0; + target->SetUInt32Value(opcode, value); - handler->PSendSysMessage(LANG_SET_32BIT_FIELD, Opcode, iValue); + handler->PSendSysMessage(LANG_SET_32BIT_FIELD, opcode, value); return true; } }; diff --git a/src/server/scripts/Commands/cs_event.cpp b/src/server/scripts/Commands/cs_event.cpp index 20ade38d676..3bd745df4f4 100644 --- a/src/server/scripts/Commands/cs_event.cpp +++ b/src/server/scripts/Commands/cs_event.cpp @@ -49,7 +49,7 @@ public: return commandTable; } - static bool HandleEventActiveListCommand(ChatHandler* handler, const char* /*args*/) + static bool HandleEventActiveListCommand(ChatHandler* handler, char const* /*args*/) { uint32 counter = 0; @@ -60,13 +60,13 @@ public: for (GameEventMgr::ActiveEvents::const_iterator itr = activeEvents.begin(); itr != activeEvents.end(); ++itr) { - uint32 event_id = *itr; - GameEventData const& eventData = events[event_id]; + uint32 eventId = *itr; + GameEventData const& eventData = events[eventId]; if (handler->GetSession()) - handler->PSendSysMessage(LANG_EVENT_ENTRY_LIST_CHAT, event_id, event_id, eventData.description.c_str(), active); + handler->PSendSysMessage(LANG_EVENT_ENTRY_LIST_CHAT, eventId, eventId, eventData.description.c_str(), active); else - handler->PSendSysMessage(LANG_EVENT_ENTRY_LIST_CONSOLE, event_id, eventData.description.c_str(), active); + handler->PSendSysMessage(LANG_EVENT_ENTRY_LIST_CONSOLE, eventId, eventData.description.c_str(), active); ++counter; } @@ -78,28 +78,28 @@ public: return true; } - static bool HandleEventInfoCommand(ChatHandler* handler, const char* args) + static bool HandleEventInfoCommand(ChatHandler* handler, char const* args) { if (!*args) return false; // id or [name] Shift-click form |color|Hgameevent:id|h[name]|h|r - char* cId = handler->extractKeyFromLink((char*)args, "Hgameevent"); - if (!cId) + char* id = handler->extractKeyFromLink((char*)args, "Hgameevent"); + if (!id) return false; - uint32 event_id = atoi(cId); + uint32 eventId = atoi(id); GameEventMgr::GameEventDataMap const& events = sGameEventMgr->GetEventMap(); - if (event_id >=events.size()) + if (eventId >= events.size()) { handler->SendSysMessage(LANG_EVENT_NOT_EXIST); handler->SetSentErrorMessage(true); return false; } - GameEventData const& eventData = events[event_id]; + GameEventData const& eventData = events[eventId]; if (!eventData.isValid()) { handler->SendSysMessage(LANG_EVENT_NOT_EXIST); @@ -108,47 +108,47 @@ public: } GameEventMgr::ActiveEvents const& activeEvents = sGameEventMgr->GetActiveEventList(); - bool active = activeEvents.find(event_id) != activeEvents.end(); + bool active = activeEvents.find(eventId) != activeEvents.end(); char const* activeStr = active ? handler->GetTrinityString(LANG_ACTIVE) : ""; std::string startTimeStr = TimeToTimestampStr(eventData.start); std::string endTimeStr = TimeToTimestampStr(eventData.end); - uint32 delay = sGameEventMgr->NextCheck(event_id); - time_t nextTime = time(NULL)+delay; - std::string nextStr = nextTime >= eventData.start && nextTime < eventData.end ? TimeToTimestampStr(time(NULL)+delay) : "-"; + uint32 delay = sGameEventMgr->NextCheck(eventId); + time_t nextTime = time(NULL) + delay; + std::string nextStr = nextTime >= eventData.start && nextTime < eventData.end ? TimeToTimestampStr(time(NULL) + delay) : "-"; std::string occurenceStr = secsToTimeString(eventData.occurence * MINUTE); std::string lengthStr = secsToTimeString(eventData.length * MINUTE); - handler->PSendSysMessage(LANG_EVENT_INFO, event_id, eventData.description.c_str(), activeStr, + handler->PSendSysMessage(LANG_EVENT_INFO, eventId, eventData.description.c_str(), activeStr, startTimeStr.c_str(), endTimeStr.c_str(), occurenceStr.c_str(), lengthStr.c_str(), nextStr.c_str()); return true; } - static bool HandleEventStartCommand(ChatHandler* handler, const char* args) + static bool HandleEventStartCommand(ChatHandler* handler, char const* args) { if (!*args) return false; // id or [name] Shift-click form |color|Hgameevent:id|h[name]|h|r - char* cId = handler->extractKeyFromLink((char*)args, "Hgameevent"); - if (!cId) + char* id = handler->extractKeyFromLink((char*)args, "Hgameevent"); + if (!id) return false; - int32 event_id = atoi(cId); + int32 eventId = atoi(id); GameEventMgr::GameEventDataMap const& events = sGameEventMgr->GetEventMap(); - if (event_id < 1 || uint32(event_id) >= events.size()) + if (eventId < 1 || uint32(eventId) >= events.size()) { handler->SendSysMessage(LANG_EVENT_NOT_EXIST); handler->SetSentErrorMessage(true); return false; } - GameEventData const& eventData = events[event_id]; + GameEventData const& eventData = events[eventId]; if (!eventData.isValid()) { handler->SendSysMessage(LANG_EVENT_NOT_EXIST); @@ -157,39 +157,39 @@ public: } GameEventMgr::ActiveEvents const& activeEvents = sGameEventMgr->GetActiveEventList(); - if (activeEvents.find(event_id) != activeEvents.end()) + if (activeEvents.find(eventId) != activeEvents.end()) { - handler->PSendSysMessage(LANG_EVENT_ALREADY_ACTIVE, event_id); + handler->PSendSysMessage(LANG_EVENT_ALREADY_ACTIVE, eventId); handler->SetSentErrorMessage(true); return false; } - sGameEventMgr->StartEvent(event_id, true); + sGameEventMgr->StartEvent(eventId, true); return true; } - static bool HandleEventStopCommand(ChatHandler* handler, const char* args) + static bool HandleEventStopCommand(ChatHandler* handler, char const* args) { if (!*args) return false; // id or [name] Shift-click form |color|Hgameevent:id|h[name]|h|r - char* cId = handler->extractKeyFromLink((char*)args, "Hgameevent"); - if (!cId) + char* id = handler->extractKeyFromLink((char*)args, "Hgameevent"); + if (!id) return false; - int32 event_id = atoi(cId); + int32 eventId = atoi(id); GameEventMgr::GameEventDataMap const& events = sGameEventMgr->GetEventMap(); - if (event_id < 1 || uint32(event_id) >= events.size()) + if (eventId < 1 || uint32(eventId) >= events.size()) { handler->SendSysMessage(LANG_EVENT_NOT_EXIST); handler->SetSentErrorMessage(true); return false; } - GameEventData const& eventData = events[event_id]; + GameEventData const& eventData = events[eventId]; if (!eventData.isValid()) { handler->SendSysMessage(LANG_EVENT_NOT_EXIST); @@ -199,14 +199,14 @@ public: GameEventMgr::ActiveEvents const& activeEvents = sGameEventMgr->GetActiveEventList(); - if (activeEvents.find(event_id) == activeEvents.end()) + if (activeEvents.find(eventId) == activeEvents.end()) { - handler->PSendSysMessage(LANG_EVENT_NOT_ACTIVE, event_id); + handler->PSendSysMessage(LANG_EVENT_NOT_ACTIVE, eventId); handler->SetSentErrorMessage(true); return false; } - sGameEventMgr->StopEvent(event_id, true); + sGameEventMgr->StopEvent(eventId, true); return true; } }; diff --git a/src/server/scripts/Commands/cs_gm.cpp b/src/server/scripts/Commands/cs_gm.cpp index 9a7146c641c..2a352e92d01 100644 --- a/src/server/scripts/Commands/cs_gm.cpp +++ b/src/server/scripts/Commands/cs_gm.cpp @@ -53,7 +53,7 @@ public: } // Enables or disables hiding of the staff badge - static bool HandleGMChatCommand(ChatHandler* handler, const char* args) + static bool HandleGMChatCommand(ChatHandler* handler, char const* args) { if (!*args) { @@ -65,16 +65,16 @@ public: return true; } - std::string argstr = (char*)args; + std::string param = (char*)args; - if (argstr == "on") + if (param == "on") { handler->GetSession()->GetPlayer()->SetGMChat(true); handler->GetSession()->SendNotification(LANG_GM_CHAT_ON); return true; } - if (argstr == "off") + if (param == "off") { handler->GetSession()->GetPlayer()->SetGMChat(false); handler->GetSession()->SendNotification(LANG_GM_CHAT_OFF); @@ -86,7 +86,7 @@ public: return false; } - static bool HandleGMFlyCommand(ChatHandler* handler, const char* args) + static bool HandleGMFlyCommand(ChatHandler* handler, char const* args) { if (!*args) return false; @@ -112,17 +112,17 @@ public: return true; } - static bool HandleGMListIngameCommand(ChatHandler* handler, const char* /*args*/) + static bool HandleGMListIngameCommand(ChatHandler* handler, char const* /*args*/) { bool first = true; bool footer = false; ACE_GUARD_RETURN(ACE_Thread_Mutex, guard, *HashMapHolder<Player>::GetLock(), true); - HashMapHolder<Player>::MapType &m = sObjectAccessor->GetPlayers(); + HashMapHolder<Player>::MapType& m = sObjectAccessor->GetPlayers(); for (HashMapHolder<Player>::MapType::const_iterator itr = m.begin(); itr != m.end(); ++itr) { - AccountTypes itr_sec = itr->second->GetSession()->GetSecurity(); - if ((itr->second->isGameMaster() || (!AccountMgr::IsPlayerAccount(itr_sec) && itr_sec <= AccountTypes(sWorld->getIntConfig(CONFIG_GM_LEVEL_IN_GM_LIST)))) && + AccountTypes itrSec = itr->second->GetSession()->GetSecurity(); + if ((itr->second->isGameMaster() || (!AccountMgr::IsPlayerAccount(itrSec) && itrSec <= AccountTypes(sWorld->getIntConfig(CONFIG_GM_LEVEL_IN_GM_LIST)))) && (!handler->GetSession() || itr->second->IsVisibleGloballyFor(handler->GetSession()->GetPlayer()))) { if (first) @@ -132,12 +132,12 @@ public: handler->SendSysMessage(LANG_GMS_ON_SRV); handler->SendSysMessage("========================"); } - const char* name = itr->second->GetName(); - uint8 security = itr_sec; + char const* name = itr->second->GetName(); + uint8 security = itrSec; uint8 max = ((16 - strlen(name)) / 2); uint8 max2 = max; - if (((max)+(max2)+(strlen(name))) == 16) - max2 = ((max)-1); + if ((max + max2 + strlen(name)) == 16) + max2 = max - 1; if (handler->GetSession()) handler->PSendSysMessage("| %s GMLevel %u", name, security); else @@ -152,7 +152,7 @@ public: } /// Display the list of GMs - static bool HandleGMListFullCommand(ChatHandler* handler, const char* /*args*/) + static bool HandleGMListFullCommand(ChatHandler* handler, char const* /*args*/) { ///- Get the accounts with GM Level >0 QueryResult result = LoginDatabase.PQuery("SELECT a.username, aa.gmlevel FROM account a, account_access aa WHERE a.id=aa.id AND aa.gmlevel >= %u", SEC_MODERATOR); @@ -164,19 +164,17 @@ public: do { Field* fields = result->Fetch(); - const char* name = fields[0].GetCString(); + char const* name = fields[0].GetCString(); uint8 security = fields[1].GetUInt8(); - uint8 max = ((16 - strlen(name)) / 2); + uint8 max = (16 - strlen(name)) / 2; uint8 max2 = max; - if (((max)+(max2)+(strlen(name))) == 16) - max2 = ((max)-1); + if ((max + max2 + strlen(name)) == 16) + max2 = max - 1; if (handler->GetSession()) handler->PSendSysMessage("| %s GMLevel %u", name, security); else handler->PSendSysMessage("|%*s%s%*s| %u |", max, " ", name, max2, " ", security); - } - while (result->NextRow()); - + } while (result->NextRow()); handler->SendSysMessage("========================"); } else @@ -185,24 +183,24 @@ public: } //Enable\Disable Invisible mode - static bool HandleGMVisibleCommand(ChatHandler* handler, const char* args) + static bool HandleGMVisibleCommand(ChatHandler* handler, char const* args) { if (!*args) { - handler->PSendSysMessage(LANG_YOU_ARE, handler->GetSession()->GetPlayer()->isGMVisible() ? handler->GetTrinityString(LANG_VISIBLE) : handler->GetTrinityString(LANG_INVISIBLE)); + handler->PSendSysMessage(LANG_YOU_ARE, handler->GetSession()->GetPlayer()->isGMVisible() ? handler->GetTrinityString(LANG_VISIBLE) : handler->GetTrinityString(LANG_INVISIBLE)); return true; } - std::string argstr = (char*)args; + std::string param = (char*)args; - if (argstr == "on") + if (param == "on") { handler->GetSession()->GetPlayer()->SetGMVisible(true); handler->GetSession()->SendNotification(LANG_INVISIBLE_VISIBLE); return true; } - if (argstr == "off") + if (param == "off") { handler->GetSession()->SendNotification(LANG_INVISIBLE_INVISIBLE); handler->GetSession()->GetPlayer()->SetGMVisible(false); @@ -215,7 +213,7 @@ public: } //Enable\Disable GM Mode - static bool HandleGMCommand(ChatHandler* handler, const char* args) + static bool HandleGMCommand(ChatHandler* handler, char const* args) { if (!*args) { @@ -226,9 +224,9 @@ public: return true; } - std::string argstr = (char*)args; + std::string param = (char*)args; - if (argstr == "on") + if (param == "on") { handler->GetSession()->GetPlayer()->SetGameMaster(true); handler->GetSession()->SendNotification(LANG_GM_ON); @@ -240,7 +238,7 @@ public: return true; } - if (argstr == "off") + if (param == "off") { handler->GetSession()->GetPlayer()->SetGameMaster(false); handler->GetSession()->SendNotification(LANG_GM_OFF); diff --git a/src/server/scripts/Commands/cs_go.cpp b/src/server/scripts/Commands/cs_go.cpp index 118ab9eb13a..5ed2d6a3dd8 100644 --- a/src/server/scripts/Commands/cs_go.cpp +++ b/src/server/scripts/Commands/cs_go.cpp @@ -57,6 +57,7 @@ public: }; return commandTable; } + /** \brief Teleport the GM to the specified creature * * .gocreature <GUID> --> TP using creature.guid @@ -68,59 +69,52 @@ public: * you will be teleported to the first one that is found. */ //teleport to creature - static bool HandleGoCreatureCommand(ChatHandler* handler, const char* args) + static bool HandleGoCreatureCommand(ChatHandler* handler, char const* args) { if (!*args) return false; - Player* _player = handler->GetSession()->GetPlayer(); + + Player* player = handler->GetSession()->GetPlayer(); // "id" or number or [name] Shift-click form |color|Hcreature_entry:creature_id|h[name]|h|r - char* pParam1 = handler->extractKeyFromLink((char*)args, "Hcreature"); - if (!pParam1) + char* param1 = handler->extractKeyFromLink((char*)args, "Hcreature"); + if (!param1) return false; std::ostringstream whereClause; // User wants to teleport to the NPC's template entry - if (strcmp(pParam1, "id") == 0) + if (strcmp(param1, "id") == 0) { - //sLog->outError("DEBUG: ID found"); - // Get the "creature_template.entry" // number or [name] Shift-click form |color|Hcreature_entry:creature_id|h[name]|h|r char* tail = strtok(NULL, ""); if (!tail) return false; - char* cId = handler->extractKeyFromLink(tail, "Hcreature_entry"); - if (!cId) + char* id = handler->extractKeyFromLink(tail, "Hcreature_entry"); + if (!id) return false; - int32 tEntry = atoi(cId); - //sLog->outError("DEBUG: ID value: %d", tEntry); - if (!tEntry) + int32 entry = atoi(id); + if (!entry) return false; - whereClause << "WHERE id = '" << tEntry << '\''; + whereClause << "WHERE id = '" << entry << '\''; } else { - //sLog->outError("DEBUG: ID *not found*"); - - int32 guid = atoi(pParam1); + int32 guid = atoi(param1); // Number is invalid - maybe the user specified the mob's name if (!guid) { - std::string name = pParam1; + std::string name = param1; WorldDatabase.EscapeString(name); whereClause << ", creature_template WHERE creature.id = creature_template.entry AND creature_template.name "_LIKE_" '" << name << '\''; } else - { whereClause << "WHERE guid = '" << guid << '\''; - } } - //sLog->outError("DEBUG: %s", whereClause.c_str()); QueryResult result = WorldDatabase.PQuery("SELECT position_x, position_y, position_z, orientation, map, guid, id FROM creature %s", whereClause.str().c_str()); if (!result) @@ -137,12 +131,12 @@ public: float y = fields[1].GetFloat(); float z = fields[2].GetFloat(); float ort = fields[3].GetFloat(); - int mapid = fields[4].GetUInt16(); + int mapId = fields[4].GetUInt16(); uint32 guid = fields[5].GetUInt32(); uint32 id = fields[6].GetUInt32(); // if creature is in same map with caster go at its current location - if (Creature* creature = sObjectAccessor->GetCreature(*_player, MAKE_NEW_GUID(guid, id, HIGHGUID_UNIT))) + if (Creature* creature = sObjectAccessor->GetCreature(*player, MAKE_NEW_GUID(guid, id, HIGHGUID_UNIT))) { x = creature->GetPositionX(); y = creature->GetPositionY(); @@ -150,46 +144,47 @@ public: ort = creature->GetOrientation(); } - if (!MapManager::IsValidMapCoord(mapid, x, y, z, ort)) + if (!MapManager::IsValidMapCoord(mapId, x, y, z, ort)) { - handler->PSendSysMessage(LANG_INVALID_TARGET_COORD, x, y, mapid); + handler->PSendSysMessage(LANG_INVALID_TARGET_COORD, x, y, mapId); handler->SetSentErrorMessage(true); return false; } // stop flight if need - if (_player->isInFlight()) + if (player->isInFlight()) { - _player->GetMotionMaster()->MovementExpired(); - _player->CleanupAfterTaxiFlight(); + player->GetMotionMaster()->MovementExpired(); + player->CleanupAfterTaxiFlight(); } // save only in non-flight case else - _player->SaveRecallPosition(); + player->SaveRecallPosition(); - _player->TeleportTo(mapid, x, y, z, ort); + player->TeleportTo(mapId, x, y, z, ort); return true; } - static bool HandleGoGraveyardCommand(ChatHandler* handler, const char* args) + + static bool HandleGoGraveyardCommand(ChatHandler* handler, char const* args) { - Player* _player = handler->GetSession()->GetPlayer(); + Player* player = handler->GetSession()->GetPlayer(); if (!*args) return false; - char *gyId = strtok((char*)args, " "); + char* gyId = strtok((char*)args, " "); if (!gyId) return false; - int32 i_gyId = atoi(gyId); + int32 graveyardId = atoi(gyId); - if (!i_gyId) + if (!graveyardId) return false; - WorldSafeLocsEntry const* gy = sWorldSafeLocsStore.LookupEntry(i_gyId); + WorldSafeLocsEntry const* gy = sWorldSafeLocsStore.LookupEntry(graveyardId); if (!gy) { - handler->PSendSysMessage(LANG_COMMAND_GRAVEYARDNOEXIST, i_gyId); + handler->PSendSysMessage(LANG_COMMAND_GRAVEYARDNOEXIST, graveyardId); handler->SetSentErrorMessage(true); return false; } @@ -202,93 +197,92 @@ public: } // stop flight if need - if (_player->isInFlight()) + if (player->isInFlight()) { - _player->GetMotionMaster()->MovementExpired(); - _player->CleanupAfterTaxiFlight(); + player->GetMotionMaster()->MovementExpired(); + player->CleanupAfterTaxiFlight(); } // save only in non-flight case else - _player->SaveRecallPosition(); + player->SaveRecallPosition(); - _player->TeleportTo(gy->map_id, gy->x, gy->y, gy->z, _player->GetOrientation()); + player->TeleportTo(gy->map_id, gy->x, gy->y, gy->z, player->GetOrientation()); return true; } + //teleport to grid - static bool HandleGoGridCommand(ChatHandler* handler, const char* args) + static bool HandleGoGridCommand(ChatHandler* handler, char const* args) { - if (!*args) return false; - Player* _player = handler->GetSession()->GetPlayer(); + if (!*args) + return false; + + Player* player = handler->GetSession()->GetPlayer(); - char* px = strtok((char*)args, " "); - char* py = strtok(NULL, " "); - char* pmapid = strtok(NULL, " "); + char* gridX = strtok((char*)args, " "); + char* gridY = strtok(NULL, " "); + char* id = strtok(NULL, " "); - if (!px || !py) + if (!gridX || !gridY) return false; - float grid_x = (float)atof(px); - float grid_y = (float)atof(py); - uint32 mapid; - if (pmapid) - mapid = (uint32)atoi(pmapid); - else mapid = _player->GetMapId(); + uint32 mapId = id ? (uint32)atoi(id) : player->GetMapId(); // center of grid - float x = (grid_x-CENTER_GRID_ID+0.5f)*SIZE_OF_GRIDS; - float y = (grid_y-CENTER_GRID_ID+0.5f)*SIZE_OF_GRIDS; + float x = ((float)atof(gridX) - CENTER_GRID_ID + 0.5f) * SIZE_OF_GRIDS; + float y = ((float)atof(gridY) - CENTER_GRID_ID + 0.5f) * SIZE_OF_GRIDS; - if (!MapManager::IsValidMapCoord(mapid, x, y)) + if (!MapManager::IsValidMapCoord(mapId, x, y)) { - handler->PSendSysMessage(LANG_INVALID_TARGET_COORD, x, y, mapid); + handler->PSendSysMessage(LANG_INVALID_TARGET_COORD, x, y, mapId); handler->SetSentErrorMessage(true); return false; } // stop flight if need - if (_player->isInFlight()) + if (player->isInFlight()) { - _player->GetMotionMaster()->MovementExpired(); - _player->CleanupAfterTaxiFlight(); + player->GetMotionMaster()->MovementExpired(); + player->CleanupAfterTaxiFlight(); } // save only in non-flight case else - _player->SaveRecallPosition(); + player->SaveRecallPosition(); - Map const* map = sMapMgr->CreateBaseMap(mapid); + Map const* map = sMapMgr->CreateBaseMap(mapId); float z = std::max(map->GetHeight(x, y, MAX_HEIGHT), map->GetWaterLevel(x, y)); - _player->TeleportTo(mapid, x, y, z, _player->GetOrientation()); + player->TeleportTo(mapId, x, y, z, player->GetOrientation()); return true; } + //teleport to gameobject - static bool HandleGoObjectCommand(ChatHandler* handler, const char* args) + static bool HandleGoObjectCommand(ChatHandler* handler, char const* args) { if (!*args) return false; - Player* _player = handler->GetSession()->GetPlayer(); + Player* player = handler->GetSession()->GetPlayer(); // number or [name] Shift-click form |color|Hgameobject:go_guid|h[name]|h|r - char* cId = handler->extractKeyFromLink((char*)args, "Hgameobject"); - if (!cId) + char* id = handler->extractKeyFromLink((char*)args, "Hgameobject"); + if (!id) return false; - int32 guid = atoi(cId); + int32 guid = atoi(id); if (!guid) return false; float x, y, z, ort; - int mapid; + int mapId; // by DB guid - if (GameObjectData const* go_data = sObjectMgr->GetGOData(guid)) + if (GameObjectData const* goData = sObjectMgr->GetGOData(guid)) { - x = go_data->posX; - y = go_data->posY; - z = go_data->posZ; - ort = go_data->orientation; - mapid = go_data->mapid; + x = goData->posX; + y = goData->posY; + z = goData->posZ; + ort = goData->orientation; + mapId = goData->mapid; } else { @@ -297,45 +291,46 @@ public: return false; } - if (!MapManager::IsValidMapCoord(mapid, x, y, z, ort)) + if (!MapManager::IsValidMapCoord(mapId, x, y, z, ort)) { - handler->PSendSysMessage(LANG_INVALID_TARGET_COORD, x, y, mapid); + handler->PSendSysMessage(LANG_INVALID_TARGET_COORD, x, y, mapId); handler->SetSentErrorMessage(true); return false; } // stop flight if need - if (_player->isInFlight()) + if (player->isInFlight()) { - _player->GetMotionMaster()->MovementExpired(); - _player->CleanupAfterTaxiFlight(); + player->GetMotionMaster()->MovementExpired(); + player->CleanupAfterTaxiFlight(); } // save only in non-flight case else - _player->SaveRecallPosition(); + player->SaveRecallPosition(); - _player->TeleportTo(mapid, x, y, z, ort); + player->TeleportTo(mapId, x, y, z, ort); return true; } - static bool HandleGoTaxinodeCommand(ChatHandler* handler, const char* args) + + static bool HandleGoTaxinodeCommand(ChatHandler* handler, char const* args) { - Player* _player = handler->GetSession()->GetPlayer(); + Player* player = handler->GetSession()->GetPlayer(); if (!*args) return false; - char* cNodeId = handler->extractKeyFromLink((char*)args, "Htaxinode"); - if (!cNodeId) + char* id = handler->extractKeyFromLink((char*)args, "Htaxinode"); + if (!id) return false; - int32 i_nodeId = atoi(cNodeId); - if (!i_nodeId) + int32 nodeId = atoi(id); + if (!nodeId) return false; - TaxiNodesEntry const* node = sTaxiNodesStore.LookupEntry(i_nodeId); + TaxiNodesEntry const* node = sTaxiNodesStore.LookupEntry(nodeId); if (!node) { - handler->PSendSysMessage(LANG_COMMAND_GOTAXINODENOTFOUND, i_nodeId); + handler->PSendSysMessage(LANG_COMMAND_GOTAXINODENOTFOUND, nodeId); handler->SetSentErrorMessage(true); return false; } @@ -349,38 +344,39 @@ public: } // stop flight if need - if (_player->isInFlight()) + if (player->isInFlight()) { - _player->GetMotionMaster()->MovementExpired(); - _player->CleanupAfterTaxiFlight(); + player->GetMotionMaster()->MovementExpired(); + player->CleanupAfterTaxiFlight(); } // save only in non-flight case else - _player->SaveRecallPosition(); + player->SaveRecallPosition(); - _player->TeleportTo(node->map_id, node->x, node->y, node->z, _player->GetOrientation()); + player->TeleportTo(node->map_id, node->x, node->y, node->z, player->GetOrientation()); return true; } - static bool HandleGoTriggerCommand(ChatHandler* handler, const char* args) + + static bool HandleGoTriggerCommand(ChatHandler* handler, char const* args) { - Player* _player = handler->GetSession()->GetPlayer(); + Player* player = handler->GetSession()->GetPlayer(); if (!*args) return false; - char *atId = strtok((char*)args, " "); - if (!atId) + char* id = strtok((char*)args, " "); + if (!id) return false; - int32 i_atId = atoi(atId); + int32 areaTriggerId = atoi(id); - if (!i_atId) + if (!areaTriggerId) return false; - AreaTriggerEntry const* at = sAreaTriggerStore.LookupEntry(i_atId); + AreaTriggerEntry const* at = sAreaTriggerStore.LookupEntry(areaTriggerId); if (!at) { - handler->PSendSysMessage(LANG_COMMAND_GOAREATRNOTFOUND, i_atId); + handler->PSendSysMessage(LANG_COMMAND_GOAREATRNOTFOUND, areaTriggerId); handler->SetSentErrorMessage(true); return false; } @@ -393,49 +389,50 @@ public: } // stop flight if need - if (_player->isInFlight()) + if (player->isInFlight()) { - _player->GetMotionMaster()->MovementExpired(); - _player->CleanupAfterTaxiFlight(); + player->GetMotionMaster()->MovementExpired(); + player->CleanupAfterTaxiFlight(); } // save only in non-flight case else - _player->SaveRecallPosition(); + player->SaveRecallPosition(); - _player->TeleportTo(at->mapid, at->x, at->y, at->z, _player->GetOrientation()); + player->TeleportTo(at->mapid, at->x, at->y, at->z, player->GetOrientation()); return true; } + //teleport at coordinates - static bool HandleGoZoneXYCommand(ChatHandler* handler, const char* args) + static bool HandleGoZoneXYCommand(ChatHandler* handler, char const* args) { if (!*args) return false; - Player* _player = handler->GetSession()->GetPlayer(); + Player* player = handler->GetSession()->GetPlayer(); - char* px = strtok((char*)args, " "); - char* py = strtok(NULL, " "); + char* zoneX = strtok((char*)args, " "); + char* zoneY = strtok(NULL, " "); char* tail = strtok(NULL, ""); - char* cAreaId = handler->extractKeyFromLink(tail, "Harea"); // string or [name] Shift-click form |color|Harea:area_id|h[name]|h|r + char* id = handler->extractKeyFromLink(tail, "Harea"); // string or [name] Shift-click form |color|Harea:area_id|h[name]|h|r - if (!px || !py) + if (!zoneX || !zoneY) return false; - float x = (float)atof(px); - float y = (float)atof(py); + float x = (float)atof(zoneX); + float y = (float)atof(zoneY); // prevent accept wrong numeric args - if ((x == 0.0f && *px != '0') || (y == 0.0f && *py != '0')) + if ((x == 0.0f && *zoneX != '0') || (y == 0.0f && *zoneY != '0')) return false; - uint32 areaid = cAreaId ? (uint32)atoi(cAreaId) : _player->GetZoneId(); + uint32 areaId = id ? (uint32)atoi(id) : player->GetZoneId(); - AreaTableEntry const* areaEntry = GetAreaEntryByAreaID(areaid); + AreaTableEntry const* areaEntry = GetAreaEntryByAreaID(areaId); if (x < 0 || x > 100 || y < 0 || y > 100 || !areaEntry) { - handler->PSendSysMessage(LANG_INVALID_ZONE_COORD, x, y, areaid); + handler->PSendSysMessage(LANG_INVALID_ZONE_COORD, x, y, areaId); handler->SetSentErrorMessage(true); return false; } @@ -462,99 +459,90 @@ public: } // stop flight if need - if (_player->isInFlight()) + if (player->isInFlight()) { - _player->GetMotionMaster()->MovementExpired(); - _player->CleanupAfterTaxiFlight(); + player->GetMotionMaster()->MovementExpired(); + player->CleanupAfterTaxiFlight(); } // save only in non-flight case else - _player->SaveRecallPosition(); + player->SaveRecallPosition(); float z = std::max(map->GetHeight(x, y, MAX_HEIGHT), map->GetWaterLevel(x, y)); - _player->TeleportTo(zoneEntry->mapid, x, y, z, _player->GetOrientation()); + player->TeleportTo(zoneEntry->mapid, x, y, z, player->GetOrientation()); return true; } + //teleport at coordinates, including Z and orientation - static bool HandleGoXYZCommand(ChatHandler* handler, const char* args) + static bool HandleGoXYZCommand(ChatHandler* handler, char const* args) { if (!*args) return false; - Player* _player = handler->GetSession()->GetPlayer(); + Player* player = handler->GetSession()->GetPlayer(); - char* px = strtok((char*)args, " "); - char* py = strtok(NULL, " "); - char* pz = strtok(NULL, " "); - char* pmapid = strtok(NULL, " "); + char* goX = strtok((char*)args, " "); + char* goY = strtok(NULL, " "); + char* goZ = strtok(NULL, " "); + char* id = strtok(NULL, " "); char* port = strtok(NULL, " "); - if (!px || !py) + if (!goX || !goY) return false; - float x = (float)atof(px); - float y = (float)atof(py); + float x = (float)atof(goX); + float y = (float)atof(goY); float z; - float ort; - uint32 mapid; - - if (pmapid) - mapid = (uint32)atoi(pmapid); - else - mapid = _player->GetMapId(); - - if ( port ) - ort = (float)atof(port); - else - ort = _player->GetOrientation(); - - if ( pz ) + float ort = port ? (float)atof(port) : player->GetOrientation(); + uint32 mapId = id ? (uint32)atoi(id) : player->GetMapId(); + + if (goZ) { - z = (float)atof(pz); - if (!MapManager::IsValidMapCoord(mapid, x, y, z)) + z = (float)atof(goZ); + if (!MapManager::IsValidMapCoord(mapId, x, y, z)) { - handler->PSendSysMessage(LANG_INVALID_TARGET_COORD, x, y, mapid); + handler->PSendSysMessage(LANG_INVALID_TARGET_COORD, x, y, mapId); handler->SetSentErrorMessage(true); return false; } } else { - if (!MapManager::IsValidMapCoord(mapid, x, y)) + if (!MapManager::IsValidMapCoord(mapId, x, y)) { - handler->PSendSysMessage(LANG_INVALID_TARGET_COORD, x, y, mapid); + handler->PSendSysMessage(LANG_INVALID_TARGET_COORD, x, y, mapId); handler->SetSentErrorMessage(true); return false; } - Map const* map = sMapMgr->CreateBaseMap(mapid); + Map const* map = sMapMgr->CreateBaseMap(mapId); z = std::max(map->GetHeight(x, y, MAX_HEIGHT), map->GetWaterLevel(x, y)); } // stop flight if need - if (_player->isInFlight()) + if (player->isInFlight()) { - _player->GetMotionMaster()->MovementExpired(); - _player->CleanupAfterTaxiFlight(); + player->GetMotionMaster()->MovementExpired(); + player->CleanupAfterTaxiFlight(); } // save only in non-flight case else - _player->SaveRecallPosition(); - - _player->TeleportTo(mapid, x, y, z, ort); + player->SaveRecallPosition(); + player->TeleportTo(mapId, x, y, z, ort); return true; } - static bool HandleGoTicketCommand(ChatHandler* handler, const char* args) + + static bool HandleGoTicketCommand(ChatHandler* handler, char const* args) { if (!*args) return false; - char *sTicketId = strtok((char*)args, " "); - if (!sTicketId) + char* id = strtok((char*)args, " "); + if (!id) return false; - uint32 ticketId = atoi(sTicketId); + uint32 ticketId = atoi(id); if (!ticketId) return false; @@ -565,16 +553,16 @@ public: return true; } - Player* _player = handler->GetSession()->GetPlayer(); - if (_player->isInFlight()) + Player* player = handler->GetSession()->GetPlayer(); + if (player->isInFlight()) { - _player->GetMotionMaster()->MovementExpired(); - _player->CleanupAfterTaxiFlight(); + player->GetMotionMaster()->MovementExpired(); + player->CleanupAfterTaxiFlight(); } else - _player->SaveRecallPosition(); + player->SaveRecallPosition(); - ticket->TeleportTo(_player); + ticket->TeleportTo(player); return true; } }; diff --git a/src/server/scripts/Commands/cs_gobject.cpp b/src/server/scripts/Commands/cs_gobject.cpp index f8e636fb961..3ea49345f5f 100644 --- a/src/server/scripts/Commands/cs_gobject.cpp +++ b/src/server/scripts/Commands/cs_gobject.cpp @@ -69,35 +69,35 @@ public: return commandTable; } - static bool HandleGameObjectActivateCommand(ChatHandler* handler, const char* args) + static bool HandleGameObjectActivateCommand(ChatHandler* handler, char const* args) { if (!*args) return false; - char* cId = handler->extractKeyFromLink((char*)args, "Hgameobject"); - if (!cId) + char* id = handler->extractKeyFromLink((char*)args, "Hgameobject"); + if (!id) return false; - uint32 lowguid = atoi(cId); - if (!lowguid) + uint32 guidLow = atoi(id); + if (!guidLow) return false; - GameObject* obj = NULL; + GameObject* object = NULL; // by DB guid - if (GameObjectData const* go_data = sObjectMgr->GetGOData(lowguid)) - obj = handler->GetObjectGlobalyWithGuidOrNearWithDbGuid(lowguid, go_data->id); + if (GameObjectData const* goData = sObjectMgr->GetGOData(guidLow)) + object = handler->GetObjectGlobalyWithGuidOrNearWithDbGuid(guidLow, goData->id); - if (!obj) + if (!object) { - handler->PSendSysMessage(LANG_COMMAND_OBJNOTFOUND, lowguid); + handler->PSendSysMessage(LANG_COMMAND_OBJNOTFOUND, guidLow); handler->SetSentErrorMessage(true); return false; } // Activate - obj->SetLootState(GO_READY); - obj->UseDoorOrButton(10000); + object->SetLootState(GO_READY); + object->UseDoorOrButton(10000); handler->PSendSysMessage("Object activated!"); @@ -105,92 +105,92 @@ public: } //spawn go - static bool HandleGameObjectAddCommand(ChatHandler* handler, const char* args) + static bool HandleGameObjectAddCommand(ChatHandler* handler, char const* args) { if (!*args) return false; // number or [name] Shift-click form |color|Hgameobject_entry:go_id|h[name]|h|r - char* cId = handler->extractKeyFromLink((char*)args, "Hgameobject_entry"); - if (!cId) + char* id = handler->extractKeyFromLink((char*)args, "Hgameobject_entry"); + if (!id) return false; - uint32 id = atol(cId); - if (!id) + uint32 objectId = atol(id); + if (!objectId) return false; char* spawntimeSecs = strtok(NULL, " "); - const GameObjectTemplate* gInfo = sObjectMgr->GetGameObjectTemplate(id); + const GameObjectTemplate* objectInfo = sObjectMgr->GetGameObjectTemplate(objectId); - if (!gInfo) + if (!objectInfo) { - handler->PSendSysMessage(LANG_GAMEOBJECT_NOT_EXIST, id); + handler->PSendSysMessage(LANG_GAMEOBJECT_NOT_EXIST, objectId); handler->SetSentErrorMessage(true); return false; } - if (gInfo->displayId && !sGameObjectDisplayInfoStore.LookupEntry(gInfo->displayId)) + if (objectInfo->displayId && !sGameObjectDisplayInfoStore.LookupEntry(objectInfo->displayId)) { // report to DB errors log as in loading case - sLog->outErrorDb("Gameobject (Entry %u GoType: %u) have invalid displayId (%u), not spawned.", id, gInfo->type, gInfo->displayId); - handler->PSendSysMessage(LANG_GAMEOBJECT_HAVE_INVALID_DATA, id); + sLog->outErrorDb("Gameobject (Entry %u GoType: %u) have invalid displayId (%u), not spawned.", objectId, objectInfo->type, objectInfo->displayId); + handler->PSendSysMessage(LANG_GAMEOBJECT_HAVE_INVALID_DATA, objectId); handler->SetSentErrorMessage(true); return false; } - Player* chr = handler->GetSession()->GetPlayer(); - float x = float(chr->GetPositionX()); - float y = float(chr->GetPositionY()); - float z = float(chr->GetPositionZ()); - float o = float(chr->GetOrientation()); - Map* map = chr->GetMap(); + Player* player = handler->GetSession()->GetPlayer(); + float x = float(player->GetPositionX()); + float y = float(player->GetPositionY()); + float z = float(player->GetPositionZ()); + float o = float(player->GetOrientation()); + Map* map = player->GetMap(); - GameObject* pGameObj = new GameObject; - uint32 db_lowGUID = sObjectMgr->GenerateLowGuid(HIGHGUID_GAMEOBJECT); + GameObject* object = new GameObject; + uint32 guidLow = sObjectMgr->GenerateLowGuid(HIGHGUID_GAMEOBJECT); - if (!pGameObj->Create(db_lowGUID, gInfo->entry, map, chr->GetPhaseMaskForSpawn(), x, y, z, o, 0.0f, 0.0f, 0.0f, 0.0f, 0, GO_STATE_READY)) + if (!object->Create(guidLow, objectInfo->entry, map, player->GetPhaseMaskForSpawn(), x, y, z, o, 0.0f, 0.0f, 0.0f, 0.0f, 0, GO_STATE_READY)) { - delete pGameObj; + delete object; return false; } if (spawntimeSecs) { uint32 value = atoi((char*)spawntimeSecs); - pGameObj->SetRespawnTime(value); - //sLog->outDebug(LOG_FILTER_TSCR, "*** spawntimeSecs: %d", value); + object->SetRespawnTime(value); } // fill the gameobject data and save to the db - pGameObj->SaveToDB(map->GetId(), (1 << map->GetSpawnMode()), chr->GetPhaseMaskForSpawn()); + object->SaveToDB(map->GetId(), (1 << map->GetSpawnMode()), player->GetPhaseMaskForSpawn()); // this will generate a new guid if the object is in an instance - if (!pGameObj->LoadFromDB(db_lowGUID, map)) + if (!object->LoadFromDB(guidLow, map)) { - delete pGameObj; + delete object; return false; } - map->Add(pGameObj); + map->Add(object); // TODO: is it really necessary to add both the real and DB table guid here ? - sObjectMgr->AddGameobjectToGrid(db_lowGUID, sObjectMgr->GetGOData(db_lowGUID)); + sObjectMgr->AddGameobjectToGrid(guidLow, sObjectMgr->GetGOData(guidLow)); - handler->PSendSysMessage(LANG_GAMEOBJECT_ADD, id, gInfo->name.c_str(), db_lowGUID, x, y, z); + handler->PSendSysMessage(LANG_GAMEOBJECT_ADD, objectId, objectInfo->name.c_str(), guidLow, x, y, z); return true; } // add go, temp only - static bool HandleGameObjectAddTempCommand(ChatHandler* handler, const char* args) + static bool HandleGameObjectAddTempCommand(ChatHandler* handler, char const* args) { if (!*args) return false; - char* charID = strtok((char*)args, " "); - if (!charID) + + char* id = strtok((char*)args, " "); + if (!id) return false; - Player* chr = handler->GetSession()->GetPlayer(); + Player* player = handler->GetSession()->GetPlayer(); char* spawntime = strtok(NULL, " "); uint32 spawntm = 300; @@ -198,46 +198,47 @@ public: if (spawntime) spawntm = atoi((char*)spawntime); - float x = chr->GetPositionX(); - float y = chr->GetPositionY(); - float z = chr->GetPositionZ(); - float ang = chr->GetOrientation(); + float x = player->GetPositionX(); + float y = player->GetPositionY(); + float z = player->GetPositionZ(); + float ang = player->GetOrientation(); float rot2 = sin(ang/2); float rot3 = cos(ang/2); - uint32 id = atoi(charID); + uint32 objectId = atoi(id); - chr->SummonGameObject(id, x, y, z, ang, 0, 0, rot2, rot3, spawntm); + player->SummonGameObject(objectId, x, y, z, ang, 0, 0, rot2, rot3, spawntm); return true; } - static bool HandleGameObjectTargetCommand(ChatHandler* handler, const char* args) + static bool HandleGameObjectTargetCommand(ChatHandler* handler, char const* args) { - Player* pl = handler->GetSession()->GetPlayer(); + Player* player = handler->GetSession()->GetPlayer(); QueryResult result; GameEventMgr::ActiveEvents const& activeEventsList = sGameEventMgr->GetActiveEventList(); + if (*args) { // number or [name] Shift-click form |color|Hgameobject_entry:go_id|h[name]|h|r - char* cId = handler->extractKeyFromLink((char*)args, "Hgameobject_entry"); - if (!cId) + char* id = handler->extractKeyFromLink((char*)args, "Hgameobject_entry"); + if (!id) return false; - uint32 id = atol(cId); + uint32 objectId = atol(id); - if (id) + if (objectId) result = WorldDatabase.PQuery("SELECT guid, id, position_x, position_y, position_z, orientation, map, phaseMask, (POW(position_x - '%f', 2) + POW(position_y - '%f', 2) + POW(position_z - '%f', 2)) AS order_ FROM gameobject WHERE map = '%i' AND id = '%u' ORDER BY order_ ASC LIMIT 1", - pl->GetPositionX(), pl->GetPositionY(), pl->GetPositionZ(), pl->GetMapId(), id); + player->GetPositionX(), player->GetPositionY(), player->GetPositionZ(), player->GetMapId(), objectId); else { - std::string name = cId; + std::string name = id; WorldDatabase.EscapeString(name); result = WorldDatabase.PQuery( "SELECT guid, id, position_x, position_y, position_z, orientation, map, phaseMask, (POW(position_x - %f, 2) + POW(position_y - %f, 2) + POW(position_z - %f, 2)) AS order_ " "FROM gameobject, gameobject_template WHERE gameobject_template.entry = gameobject.id AND map = %i AND name "_LIKE_" "_CONCAT3_("'%%'", "'%s'", "'%%'")" ORDER BY order_ ASC LIMIT 1", - pl->GetPositionX(), pl->GetPositionY(), pl->GetPositionZ(), pl->GetMapId(), name.c_str()); + player->GetPositionX(), player->GetPositionY(), player->GetPositionZ(), player->GetMapId(), name.c_str()); } } else @@ -250,8 +251,8 @@ public: { if (initString) { - eventFilter << "OR eventEntry IN (" <<*itr; - initString =false; + eventFilter << "OR eventEntry IN (" << *itr; + initString = false; } else eventFilter << ',' << *itr; @@ -277,25 +278,25 @@ public: bool found = false; float x, y, z, o; - uint32 lowguid, id; - uint16 mapid, phase; - uint32 pool_id; + uint32 guidLow, id; + uint16 mapId, phase; + uint32 poolId; do { Field* fields = result->Fetch(); - lowguid = fields[0].GetUInt32(); + guidLow = fields[0].GetUInt32(); id = fields[1].GetUInt32(); x = fields[2].GetFloat(); y = fields[3].GetFloat(); z = fields[4].GetFloat(); o = fields[5].GetFloat(); - mapid = fields[6].GetUInt16(); + mapId = fields[6].GetUInt16(); phase = fields[7].GetUInt16(); - pool_id = sPoolMgr->IsPartOfAPool<GameObject>(lowguid); - if (!pool_id || sPoolMgr->IsSpawnedObject<GameObject>(lowguid)) + poolId = sPoolMgr->IsPartOfAPool<GameObject>(guidLow); + if (!poolId || sPoolMgr->IsSpawnedObject<GameObject>(guidLow)) found = true; - } while (result->NextRow() && (!found)); + } while (result->NextRow() && !found); if (!found) { @@ -303,21 +304,21 @@ public: return false; } - GameObjectTemplate const* goI = sObjectMgr->GetGameObjectTemplate(id); + GameObjectTemplate const* objectInfo = sObjectMgr->GetGameObjectTemplate(id); - if (!goI) + if (!objectInfo) { handler->PSendSysMessage(LANG_GAMEOBJECT_NOT_EXIST, id); return false; } - GameObject* target = handler->GetSession()->GetPlayer()->GetMap()->GetGameObject(MAKE_NEW_GUID(lowguid, id, HIGHGUID_GAMEOBJECT)); + GameObject* target = handler->GetSession()->GetPlayer()->GetMap()->GetGameObject(MAKE_NEW_GUID(guidLow, id, HIGHGUID_GAMEOBJECT)); - handler->PSendSysMessage(LANG_GAMEOBJECT_DETAIL, lowguid, goI->name.c_str(), lowguid, id, x, y, z, mapid, o, phase); + handler->PSendSysMessage(LANG_GAMEOBJECT_DETAIL, guidLow, objectInfo->name.c_str(), guidLow, id, x, y, z, mapId, o, phase); if (target) { - int32 curRespawnDelay = int32(target->GetRespawnTimeEx()-time(NULL)); + int32 curRespawnDelay = int32(target->GetRespawnTimeEx() - time(NULL)); if (curRespawnDelay < 0) curRespawnDelay = 0; @@ -330,219 +331,217 @@ public: } //delete object by selection or guid - static bool HandleGameObjectDeleteCommand(ChatHandler* handler, const char* args) + static bool HandleGameObjectDeleteCommand(ChatHandler* handler, char const* args) { // number or [name] Shift-click form |color|Hgameobject:go_guid|h[name]|h|r - char* cId = handler->extractKeyFromLink((char*)args, "Hgameobject"); - if (!cId) + char* id = handler->extractKeyFromLink((char*)args, "Hgameobject"); + if (!id) return false; - uint32 lowguid = atoi(cId); - if (!lowguid) + uint32 guidLow = atoi(id); + if (!guidLow) return false; - GameObject* obj = NULL; + GameObject* object = NULL; // by DB guid - if (GameObjectData const* go_data = sObjectMgr->GetGOData(lowguid)) - obj = handler->GetObjectGlobalyWithGuidOrNearWithDbGuid(lowguid, go_data->id); + if (GameObjectData const* gameObjectData = sObjectMgr->GetGOData(guidLow)) + object = handler->GetObjectGlobalyWithGuidOrNearWithDbGuid(guidLow, gameObjectData->id); - if (!obj) + if (!object) { - handler->PSendSysMessage(LANG_COMMAND_OBJNOTFOUND, lowguid); + handler->PSendSysMessage(LANG_COMMAND_OBJNOTFOUND, guidLow); handler->SetSentErrorMessage(true); return false; } - uint64 owner_guid = obj->GetOwnerGUID(); - if (owner_guid) + uint64 ownerGuid = object->GetOwnerGUID(); + if (ownerGuid) { - Unit* owner = ObjectAccessor::GetUnit(*handler->GetSession()->GetPlayer(), owner_guid); - if (!owner || !IS_PLAYER_GUID(owner_guid)) + Unit* owner = ObjectAccessor::GetUnit(*handler->GetSession()->GetPlayer(), ownerGuid); + if (!owner || !IS_PLAYER_GUID(ownerGuid)) { - handler->PSendSysMessage(LANG_COMMAND_DELOBJREFERCREATURE, GUID_LOPART(owner_guid), obj->GetGUIDLow()); + handler->PSendSysMessage(LANG_COMMAND_DELOBJREFERCREATURE, GUID_LOPART(ownerGuid), object->GetGUIDLow()); handler->SetSentErrorMessage(true); return false; } - owner->RemoveGameObject(obj, false); + owner->RemoveGameObject(object, false); } - obj->SetRespawnTime(0); // not save respawn time - obj->Delete(); - obj->DeleteFromDB(); + object->SetRespawnTime(0); // not save respawn time + object->Delete(); + object->DeleteFromDB(); - handler->PSendSysMessage(LANG_COMMAND_DELOBJMESSAGE, obj->GetGUIDLow()); + handler->PSendSysMessage(LANG_COMMAND_DELOBJMESSAGE, object->GetGUIDLow()); return true; } //turn selected object - static bool HandleGameObjectTurnCommand(ChatHandler* handler, const char* args) + static bool HandleGameObjectTurnCommand(ChatHandler* handler, char const* args) { // number or [name] Shift-click form |color|Hgameobject:go_id|h[name]|h|r - char* cId = handler->extractKeyFromLink((char*)args, "Hgameobject"); - if (!cId) + char* id = handler->extractKeyFromLink((char*)args, "Hgameobject"); + if (!id) return false; - uint32 lowguid = atoi(cId); - if (!lowguid) + uint32 guidLow = atoi(id); + if (!guidLow) return false; - GameObject* obj = NULL; + GameObject* object = NULL; // by DB guid - if (GameObjectData const* go_data = sObjectMgr->GetGOData(lowguid)) - obj = handler->GetObjectGlobalyWithGuidOrNearWithDbGuid(lowguid, go_data->id); + if (GameObjectData const* gameObjectData = sObjectMgr->GetGOData(guidLow)) + object = handler->GetObjectGlobalyWithGuidOrNearWithDbGuid(guidLow, gameObjectData->id); - if (!obj) + if (!object) { - handler->PSendSysMessage(LANG_COMMAND_OBJNOTFOUND, lowguid); + handler->PSendSysMessage(LANG_COMMAND_OBJNOTFOUND, guidLow); handler->SetSentErrorMessage(true); return false; } - char* po = strtok(NULL, " "); + char* orientation = strtok(NULL, " "); float o; - if (po) - { - o = (float)atof(po); - } + if (orientation) + o = (float)atof(orientation); else { - Player* chr = handler->GetSession()->GetPlayer(); - o = chr->GetOrientation(); + Player* player = handler->GetSession()->GetPlayer(); + o = player->GetOrientation(); } - obj->Relocate(obj->GetPositionX(), obj->GetPositionY(), obj->GetPositionZ(), o); - obj->UpdateRotationFields(); - obj->DestroyForNearbyPlayers(); - obj->UpdateObjectVisibility(); + object->Relocate(object->GetPositionX(), object->GetPositionY(), object->GetPositionZ(), o); + object->UpdateRotationFields(); + object->DestroyForNearbyPlayers(); + object->UpdateObjectVisibility(); - obj->SaveToDB(); - obj->Refresh(); + object->SaveToDB(); + object->Refresh(); - handler->PSendSysMessage(LANG_COMMAND_TURNOBJMESSAGE, obj->GetGUIDLow(), obj->GetGOInfo()->name.c_str(), obj->GetGUIDLow(), o); + handler->PSendSysMessage(LANG_COMMAND_TURNOBJMESSAGE, object->GetGUIDLow(), object->GetGOInfo()->name.c_str(), object->GetGUIDLow(), o); return true; } //move selected object - static bool HandleGameObjectMoveCommand(ChatHandler* handler, const char* args) + static bool HandleGameObjectMoveCommand(ChatHandler* handler, char const* args) { // number or [name] Shift-click form |color|Hgameobject:go_guid|h[name]|h|r - char* cId = handler->extractKeyFromLink((char*)args, "Hgameobject"); - if (!cId) + char* id = handler->extractKeyFromLink((char*)args, "Hgameobject"); + if (!id) return false; - uint32 lowguid = atoi(cId); - if (!lowguid) + uint32 guidLow = atoi(id); + if (!guidLow) return false; - GameObject* obj = NULL; + GameObject* object = NULL; // by DB guid - if (GameObjectData const* go_data = sObjectMgr->GetGOData(lowguid)) - obj = handler->GetObjectGlobalyWithGuidOrNearWithDbGuid(lowguid, go_data->id); + if (GameObjectData const* gameObjectData = sObjectMgr->GetGOData(guidLow)) + object = handler->GetObjectGlobalyWithGuidOrNearWithDbGuid(guidLow, gameObjectData->id); - if (!obj) + if (!object) { - handler->PSendSysMessage(LANG_COMMAND_OBJNOTFOUND, lowguid); + handler->PSendSysMessage(LANG_COMMAND_OBJNOTFOUND, guidLow); handler->SetSentErrorMessage(true); return false; } - char* px = strtok(NULL, " "); - char* py = strtok(NULL, " "); - char* pz = strtok(NULL, " "); + char* toX = strtok(NULL, " "); + char* toY = strtok(NULL, " "); + char* toZ = strtok(NULL, " "); - if (!px) + if (!toX) { - Player* chr = handler->GetSession()->GetPlayer(); - obj->Relocate(chr->GetPositionX(), chr->GetPositionY(), chr->GetPositionZ(), obj->GetOrientation()); - obj->DestroyForNearbyPlayers(); - obj->UpdateObjectVisibility(); + Player* player = handler->GetSession()->GetPlayer(); + object->Relocate(player->GetPositionX(), player->GetPositionY(), player->GetPositionZ(), object->GetOrientation()); + object->DestroyForNearbyPlayers(); + object->UpdateObjectVisibility(); } else { - if (!py || !pz) + if (!toY || !toZ) return false; - float x = (float)atof(px); - float y = (float)atof(py); - float z = (float)atof(pz); + float x = (float)atof(toX); + float y = (float)atof(toY); + float z = (float)atof(toZ); - if (!MapManager::IsValidMapCoord(obj->GetMapId(), x, y, z)) + if (!MapManager::IsValidMapCoord(object->GetMapId(), x, y, z)) { - handler->PSendSysMessage(LANG_INVALID_TARGET_COORD, x, y, obj->GetMapId()); + handler->PSendSysMessage(LANG_INVALID_TARGET_COORD, x, y, object->GetMapId()); handler->SetSentErrorMessage(true); return false; } - obj->Relocate(x, y, z, obj->GetOrientation()); - obj->DestroyForNearbyPlayers(); - obj->UpdateObjectVisibility(); + object->Relocate(x, y, z, object->GetOrientation()); + object->DestroyForNearbyPlayers(); + object->UpdateObjectVisibility(); } - obj->SaveToDB(); - obj->Refresh(); + object->SaveToDB(); + object->Refresh(); - handler->PSendSysMessage(LANG_COMMAND_MOVEOBJMESSAGE, obj->GetGUIDLow(), obj->GetGOInfo()->name.c_str(), obj->GetGUIDLow()); + handler->PSendSysMessage(LANG_COMMAND_MOVEOBJMESSAGE, object->GetGUIDLow(), object->GetGOInfo()->name.c_str(), object->GetGUIDLow()); return true; } - //set pahsemask for selected object - static bool HandleGameObjectSetPhaseCommand(ChatHandler* handler, const char* args) + //set phasemask for selected object + static bool HandleGameObjectSetPhaseCommand(ChatHandler* handler, char const* args) { // number or [name] Shift-click form |color|Hgameobject:go_id|h[name]|h|r - char* cId = handler->extractKeyFromLink((char*)args, "Hgameobject"); - if (!cId) + char* id = handler->extractKeyFromLink((char*)args, "Hgameobject"); + if (!id) return false; - uint32 lowguid = atoi(cId); - if (!lowguid) + uint32 guidLow = atoi(id); + if (!guidLow) return false; - GameObject* obj = NULL; + GameObject* object = NULL; // by DB guid - if (GameObjectData const* go_data = sObjectMgr->GetGOData(lowguid)) - obj = handler->GetObjectGlobalyWithGuidOrNearWithDbGuid(lowguid, go_data->id); + if (GameObjectData const* gameObjectData = sObjectMgr->GetGOData(guidLow)) + object = handler->GetObjectGlobalyWithGuidOrNearWithDbGuid(guidLow, gameObjectData->id); - if (!obj) + if (!object) { - handler->PSendSysMessage(LANG_COMMAND_OBJNOTFOUND, lowguid); + handler->PSendSysMessage(LANG_COMMAND_OBJNOTFOUND, guidLow); handler->SetSentErrorMessage(true); return false; } - char* phaseStr = strtok (NULL, " "); - uint32 phasemask = phaseStr? atoi(phaseStr) : 0; - if (phasemask == 0) + char* phase = strtok (NULL, " "); + uint32 phaseMask = phase ? atoi(phase) : 0; + if (phaseMask == 0) { handler->SendSysMessage(LANG_BAD_VALUE); handler->SetSentErrorMessage(true); return false; } - obj->SetPhaseMask(phasemask, true); - obj->SaveToDB(); + object->SetPhaseMask(phaseMask, true); + object->SaveToDB(); return true; } - static bool HandleGameObjectNearCommand(ChatHandler* handler, const char* args) + static bool HandleGameObjectNearCommand(ChatHandler* handler, char const* args) { float distance = (!*args) ? 10.0f : (float)(atof(args)); uint32 count = 0; - Player* pl = handler->GetSession()->GetPlayer(); + Player* player = handler->GetSession()->GetPlayer(); QueryResult result = WorldDatabase.PQuery("SELECT guid, id, position_x, position_y, position_z, map, " "(POW(position_x - '%f', 2) + POW(position_y - '%f', 2) + POW(position_z - '%f', 2)) AS order_ " "FROM gameobject WHERE map='%u' AND (POW(position_x - '%f', 2) + POW(position_y - '%f', 2) + POW(position_z - '%f', 2)) <= '%f' ORDER BY order_", - pl->GetPositionX(), pl->GetPositionY(), pl->GetPositionZ(), - pl->GetMapId(), pl->GetPositionX(), pl->GetPositionY(), pl->GetPositionZ(), distance*distance); + player->GetPositionX(), player->GetPositionY(), player->GetPositionZ(), + player->GetMapId(), player->GetPositionX(), player->GetPositionY(), player->GetPositionZ(), distance * distance); if (result) { @@ -554,14 +553,14 @@ public: float x = fields[2].GetFloat(); float y = fields[3].GetFloat(); float z = fields[4].GetFloat(); - uint16 mapid = fields[5].GetUInt16(); + uint16 mapId = fields[5].GetUInt16(); - GameObjectTemplate const* gInfo = sObjectMgr->GetGameObjectTemplate(entry); + GameObjectTemplate const* gameObjectInfo = sObjectMgr->GetGameObjectTemplate(entry); - if (!gInfo) + if (!gameObjectInfo) continue; - handler->PSendSysMessage(LANG_GO_LIST_CHAT, guid, entry, guid, gInfo->name.c_str(), x, y, z, mapid); + handler->PSendSysMessage(LANG_GO_LIST_CHAT, guid, entry, guid, gameObjectInfo->name.c_str(), x, y, z, mapId); ++count; } while (result->NextRow()); @@ -572,99 +571,97 @@ public: } //show info of gameobject - static bool HandleGameObjectInfoCommand(ChatHandler* handler, const char* args) + static bool HandleGameObjectInfoCommand(ChatHandler* handler, char const* args) { uint32 entry = 0; uint32 type = 0; - uint32 displayid = 0; + uint32 displayId = 0; std::string name; uint32 lootId = 0; if (!*args) { - if (WorldObject* obj = handler->getSelectedObject()) - entry = obj->GetEntry(); + if (WorldObject* object = handler->getSelectedObject()) + entry = object->GetEntry(); else entry = atoi((char*)args); } - GameObjectTemplate const* goinfo = sObjectMgr->GetGameObjectTemplate(entry); + GameObjectTemplate const* gameObjectInfo = sObjectMgr->GetGameObjectTemplate(entry); - if (!goinfo) + if (!gameObjectInfo) return false; - type = goinfo->type; - displayid = goinfo->displayId; - name = goinfo->name; + type = gameObjectInfo->type; + displayId = gameObjectInfo->displayId; + name = gameObjectInfo->name; if (type == GAMEOBJECT_TYPE_CHEST) - lootId = goinfo->chest.lootId; + lootId = gameObjectInfo->chest.lootId; else if (type == GAMEOBJECT_TYPE_FISHINGHOLE) - lootId = goinfo->fishinghole.lootId; + lootId = gameObjectInfo->fishinghole.lootId; handler->PSendSysMessage(LANG_GOINFO_ENTRY, entry); handler->PSendSysMessage(LANG_GOINFO_TYPE, type); handler->PSendSysMessage(LANG_GOINFO_LOOTID, lootId); - handler->PSendSysMessage(LANG_GOINFO_DISPLAYID, displayid); + handler->PSendSysMessage(LANG_GOINFO_DISPLAYID, displayId); handler->PSendSysMessage(LANG_GOINFO_NAME, name.c_str()); return true; } - static bool HandleGameObjectSetStateCommand(ChatHandler* handler, const char* args) + static bool HandleGameObjectSetStateCommand(ChatHandler* handler, char const* args) { // number or [name] Shift-click form |color|Hgameobject:go_id|h[name]|h|r - char* cId = handler->extractKeyFromLink((char*)args, "Hgameobject"); - if (!cId) + char* id = handler->extractKeyFromLink((char*)args, "Hgameobject"); + if (!id) return false; - uint32 lowguid = atoi(cId); - if (!lowguid) + uint32 guidLow = atoi(id); + if (!guidLow) return false; - GameObject* gobj = NULL; + GameObject* object = NULL; - if (GameObjectData const* goData = sObjectMgr->GetGOData(lowguid)) - gobj = handler->GetObjectGlobalyWithGuidOrNearWithDbGuid(lowguid, goData->id); + if (GameObjectData const* gameObjectData = sObjectMgr->GetGOData(guidLow)) + object = handler->GetObjectGlobalyWithGuidOrNearWithDbGuid(guidLow, gameObjectData->id); - if (!gobj) + if (!object) { - handler->PSendSysMessage(LANG_COMMAND_OBJNOTFOUND, lowguid); + handler->PSendSysMessage(LANG_COMMAND_OBJNOTFOUND, guidLow); handler->SetSentErrorMessage(true); return false; } - char* ctype = strtok(NULL, " "); - if (!ctype) + char* type = strtok(NULL, " "); + if (!type) return false; - int32 type = atoi(ctype); - if (type < 0) + int32 objectType = atoi(type); + if (objectType < 0) { - if (type == -1) - gobj->SendObjectDeSpawnAnim(gobj->GetGUID()); - else if (type == -2) - { + if (objectType == -1) + object->SendObjectDeSpawnAnim(object->GetGUID()); + else if (objectType == -2) return false; - } return true; } - char* cstate = strtok(NULL, " "); - if (!cstate) + char* state = strtok(NULL, " "); + if (!state) return false; - int32 state = atoi(cstate); + int32 objectState = atoi(state); - if (type < 4) - gobj->SetByteValue(GAMEOBJECT_BYTES_1, type, state); - else if (type == 4) + if (objectType < 4) + object->SetByteValue(GAMEOBJECT_BYTES_1, objectType, objectState); + else if (objectType == 4) { WorldPacket data(SMSG_GAMEOBJECT_CUSTOM_ANIM, 8+4); - data << gobj->GetGUID(); - data << (uint32)(state); - gobj->SendMessageToSet(&data, true); + data << object->GetGUID(); + data << (uint32)(objectState); + object->SendMessageToSet(&data, true); } - handler->PSendSysMessage("Set gobject type %d state %d", type, state); + handler->PSendSysMessage("Set gobject type %d state %d", objectType, objectState); return true; } }; |