aboutsummaryrefslogtreecommitdiff
path: root/src/server/scripts/Commands
diff options
context:
space:
mode:
authorSubv <s.v.h21@hotmail.com>2012-08-07 13:44:22 -0500
committerSubv <s.v.h21@hotmail.com>2012-08-07 13:44:22 -0500
commitd82266bc0ef31df82dc67c1023d6208df6ac247b (patch)
treea0c5970a82e568ca54a25809555b7abad52e1bc1 /src/server/scripts/Commands
parent224cf663e2af8b355b4bdca4069080636321b0ba (diff)
parentf8cd39b2ed1056f409c2690ac8bb661fbcb68e18 (diff)
Merge branch 'master' of github.com:TrinityCore/TrinityCore into 4.3.4
Conflicts: src/server/authserver/Server/AuthSocket.cpp src/server/game/Achievements/AchievementMgr.cpp src/server/game/Chat/Chat.h src/server/game/Chat/Commands/Level1.cpp src/server/game/Chat/Commands/Level2.cpp src/server/game/Chat/Commands/Level3.cpp src/server/game/DataStores/DBCStores.cpp src/server/game/DataStores/DBCStructure.h src/server/game/Entities/Object/Object.cpp src/server/game/Entities/Object/Updates/UpdateData.cpp src/server/game/Entities/Player/Player.cpp src/server/game/Globals/ObjectMgr.cpp src/server/game/Guilds/Guild.cpp src/server/game/Guilds/GuildMgr.cpp src/server/game/Handlers/AuctionHouseHandler.cpp src/server/game/Handlers/CharacterHandler.cpp src/server/game/Handlers/ChatHandler.cpp src/server/game/Handlers/GroupHandler.cpp src/server/game/Handlers/ItemHandler.cpp src/server/game/Handlers/MailHandler.cpp src/server/game/Handlers/MiscHandler.cpp src/server/game/Handlers/MovementHandler.cpp src/server/game/Handlers/PetHandler.cpp src/server/game/Handlers/QuestHandler.cpp src/server/game/Handlers/VehicleHandler.cpp src/server/game/Server/WorldSession.cpp src/server/game/Server/WorldSocket.cpp src/server/game/Spells/Auras/SpellAuraEffects.cpp src/server/game/Spells/SpellEffects.cpp src/server/game/Spells/SpellMgr.cpp src/server/game/World/World.cpp src/server/scripts/Commands/cs_debug.cpp src/server/scripts/Commands/cs_modify.cpp src/server/scripts/Commands/cs_reload.cpp src/server/scripts/Kalimdor/azuremyst_isle.cpp src/server/shared/Logging/Log.cpp src/server/shared/Logging/Log.h src/server/worldserver/worldserver.conf.dist
Diffstat (limited to 'src/server/scripts/Commands')
-rw-r--r--src/server/scripts/Commands/CMakeLists.txt2
-rw-r--r--src/server/scripts/Commands/cs_account.cpp22
-rw-r--r--src/server/scripts/Commands/cs_character.cpp251
-rw-r--r--src/server/scripts/Commands/cs_debug.cpp4
-rw-r--r--src/server/scripts/Commands/cs_disable.cpp371
-rw-r--r--src/server/scripts/Commands/cs_gobject.cpp2
-rw-r--r--src/server/scripts/Commands/cs_learn.cpp72
-rw-r--r--src/server/scripts/Commands/cs_message.cpp215
-rw-r--r--src/server/scripts/Commands/cs_misc.cpp2729
-rw-r--r--src/server/scripts/Commands/cs_modify.cpp22
-rw-r--r--src/server/scripts/Commands/cs_npc.cpp8
-rw-r--r--src/server/scripts/Commands/cs_reload.cpp188
-rw-r--r--src/server/scripts/Commands/cs_reset.cpp2
-rw-r--r--src/server/scripts/Commands/cs_server.cpp37
14 files changed, 3742 insertions, 183 deletions
diff --git a/src/server/scripts/Commands/CMakeLists.txt b/src/server/scripts/Commands/CMakeLists.txt
index bb7d27d7dce..bd439c2c473 100644
--- a/src/server/scripts/Commands/CMakeLists.txt
+++ b/src/server/scripts/Commands/CMakeLists.txt
@@ -16,6 +16,7 @@ set(scripts_STAT_SRCS
Commands/cs_cast.cpp
Commands/cs_character.cpp
Commands/cs_debug.cpp
+ Commands/cs_disable.cpp
Commands/cs_event.cpp
Commands/cs_gm.cpp
Commands/cs_go.cpp
@@ -26,6 +27,7 @@ set(scripts_STAT_SRCS
Commands/cs_learn.cpp
Commands/cs_list.cpp
Commands/cs_lookup.cpp
+ Commands/cs_message.cpp
Commands/cs_misc.cpp
Commands/cs_modify.cpp
Commands/cs_npc.cpp
diff --git a/src/server/scripts/Commands/cs_account.cpp b/src/server/scripts/Commands/cs_account.cpp
index b52102479b5..1024a3acf15 100644
--- a/src/server/scripts/Commands/cs_account.cpp
+++ b/src/server/scripts/Commands/cs_account.cpp
@@ -38,7 +38,7 @@ public:
{ "addon", SEC_ADMINISTRATOR, true, &HandleAccountSetAddonCommand, "", NULL },
{ "gmlevel", SEC_CONSOLE, true, &HandleAccountSetGmLevelCommand, "", NULL },
{ "password", SEC_CONSOLE, true, &HandleAccountSetPasswordCommand, "", NULL },
- { NULL, 0, false, NULL, "", NULL }
+ { NULL, SEC_PLAYER, false, NULL, "", NULL }
};
static ChatCommand accountCommandTable[] =
{
@@ -50,12 +50,12 @@ public:
{ "set", SEC_ADMINISTRATOR, true, NULL, "", accountSetCommandTable },
{ "password", SEC_PLAYER, false, &HandleAccountPasswordCommand, "", NULL },
{ "", SEC_PLAYER, false, &HandleAccountCommand, "", NULL },
- { NULL, 0, false, NULL, "", NULL }
+ { NULL, SEC_PLAYER, false, NULL, "", NULL }
};
static ChatCommand commandTable[] =
{
{ "account", SEC_PLAYER, true, NULL, "", accountCommandTable },
- { NULL, 0, false, NULL, "", NULL }
+ { NULL, SEC_PLAYER, false, NULL, "", NULL }
};
return commandTable;
}
@@ -110,7 +110,11 @@ public:
case AOR_OK:
handler->PSendSysMessage(LANG_ACCOUNT_CREATED, accountName);
if (handler->GetSession())
- sLog->outChar("Account: %d (IP: %s) Character:[%s] (GUID: %u) Change Password.", handler->GetSession()->GetAccountId(),handler->GetSession()->GetRemoteAddress().c_str(), handler->GetSession()->GetPlayer()->GetName(), handler->GetSession()->GetPlayer()->GetGUIDLow());
+ {
+ sLog->outInfo(LOG_FILTER_CHARACTER, "Account: %d (IP: %s) Character:[%s] (GUID: %u) Change Password."
+ , handler->GetSession()->GetAccountId(),handler->GetSession()->GetRemoteAddress().c_str()
+ , handler->GetSession()->GetPlayer()->GetName(), handler->GetSession()->GetPlayer()->GetGUIDLow());
+ }
break;
case AOR_NAME_TOO_LONG:
handler->SendSysMessage(LANG_ACCOUNT_TOO_LONG);
@@ -232,8 +236,8 @@ public:
}
else
handler->PSendSysMessage(LANG_ACCOUNT_LIST_ERROR, name.c_str());
-
- } while (result->NextRow());
+ }
+ while (result->NextRow());
handler->SendSysMessage(LANG_ACCOUNT_LIST_BAR);
return true;
@@ -377,7 +381,6 @@ public:
handler->SetSentErrorMessage(true);
return false;
}
-
}
// Let set addon state only for lesser (strong) security level
@@ -535,8 +538,8 @@ public:
///- Get the command line arguments
char* account = strtok((char*)args, " ");
- char* password = strtok(NULL, " ");
- char* passwordConfirmation = strtok(NULL, " ");
+ char* password = strtok(NULL, " ");
+ char* passwordConfirmation = strtok(NULL, " ");
if (!account || !password || !passwordConfirmation)
return false;
@@ -589,7 +592,6 @@ public:
handler->SetSentErrorMessage(true);
return false;
}
-
return true;
}
};
diff --git a/src/server/scripts/Commands/cs_character.cpp b/src/server/scripts/Commands/cs_character.cpp
index e6d397ead2b..87948391500 100644
--- a/src/server/scripts/Commands/cs_character.cpp
+++ b/src/server/scripts/Commands/cs_character.cpp
@@ -26,6 +26,7 @@ EndScriptData */
#include "Chat.h"
#include "AccountMgr.h"
#include "ObjectMgr.h"
+#include "PlayerDump.h"
class character_commandscript : public CommandScript
{
@@ -34,6 +35,12 @@ public:
ChatCommand* GetCommands() const
{
+ static ChatCommand pdumpCommandTable[] =
+ {
+ { "load", SEC_ADMINISTRATOR, true, &HandlePDumpLoadCommand, "", NULL },
+ { "write", SEC_ADMINISTRATOR, true, &HandlePDumpWriteCommand, "", NULL },
+ { NULL, 0, false, NULL, "", NULL }
+ };
static ChatCommand characterDeletedCommandTable[] =
{
{ "delete", SEC_CONSOLE, true, &HandleCharacterDeletedDeleteCommand, "", NULL },
@@ -48,7 +55,7 @@ public:
{ "customize", SEC_GAMEMASTER, true, &HandleCharacterCustomizeCommand, "", NULL },
{ "changefaction", SEC_GAMEMASTER, true, &HandleCharacterChangeFactionCommand, "", NULL },
{ "changerace", SEC_GAMEMASTER, true, &HandleCharacterChangeRaceCommand, "", NULL },
- { "deleted", SEC_GAMEMASTER, true, NULL, "", characterDeletedCommandTable},
+ { "deleted", SEC_GAMEMASTER, true, NULL, "", characterDeletedCommandTable },
{ "erase", SEC_CONSOLE, true, &HandleCharacterEraseCommand, "", NULL },
{ "level", SEC_ADMINISTRATOR, true, &HandleCharacterLevelCommand, "", NULL },
{ "rename", SEC_GAMEMASTER, true, &HandleCharacterRenameCommand, "", NULL },
@@ -59,7 +66,9 @@ public:
static ChatCommand commandTable[] =
{
- { "character", SEC_GAMEMASTER, true, NULL, "", characterCommandTable},
+ { "character", SEC_GAMEMASTER, true, NULL, "", characterCommandTable },
+ { "levelup", SEC_ADMINISTRATOR, false, &HandleLevelUpCommand, "", NULL },
+ { "pdump", SEC_ADMINISTRATOR, true, NULL, "", pdumpCommandTable },
{ NULL, 0, false, NULL, "", NULL }
};
return commandTable;
@@ -218,6 +227,34 @@ public:
sWorld->AddCharacterNameData(delInfo.lowGuid, delInfo.name, (*result)[2].GetUInt8(), (*result)[0].GetUInt8(), (*result)[1].GetUInt8());
}
+ static void HandleCharacterLevel(Player* player, uint64 playerGuid, uint32 oldLevel, uint32 newLevel, ChatHandler* handler)
+ {
+ if (player)
+ {
+ player->GiveLevel(newLevel);
+ player->InitTalentForLevel();
+ player->SetUInt32Value(PLAYER_XP, 0);
+
+ if (handler->needReportToTarget(player))
+ {
+ if (oldLevel == newLevel)
+ ChatHandler(player).PSendSysMessage(LANG_YOURS_LEVEL_PROGRESS_RESET, handler->GetNameLink().c_str());
+ else if (oldLevel < newLevel)
+ ChatHandler(player).PSendSysMessage(LANG_YOURS_LEVEL_UP, handler->GetNameLink().c_str(), newLevel);
+ else // if (oldlevel > newlevel)
+ ChatHandler(player).PSendSysMessage(LANG_YOURS_LEVEL_DOWN, handler->GetNameLink().c_str(), newLevel);
+ }
+ }
+ else
+ {
+ // Update level and reset XP, everything else will be updated at login
+ PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_LEVEL);
+ stmt->setUInt8(0, uint8(newLevel));
+ stmt->setUInt32(1, GUID_LOPART(playerGuid));
+ CharacterDatabase.Execute(stmt);
+ }
+ }
+
static bool HandleCharacterTitlesCommand(ChatHandler* handler, char const* args)
{
if (!*args)
@@ -326,7 +363,7 @@ public:
if (newlevel > STRONG_MAX_LEVEL) // hardcoded maximum level
newlevel = STRONG_MAX_LEVEL;
- handler->HandleCharacterLevel(target, targetGuid, oldlevel, newlevel);
+ HandleCharacterLevel(target, targetGuid, oldlevel, newlevel, handler);
if (!handler->GetSession() || handler->GetSession()->GetPlayer() != target) // including player == NULL
{
std::string nameLink = handler->playerLink(targetName);
@@ -671,6 +708,214 @@ public:
return true;
}
+
+ static bool HandleLevelUpCommand(ChatHandler* handler, char const* args)
+ {
+ char* nameStr;
+ char* levelStr;
+ handler->extractOptFirstArg((char*)args, &nameStr, &levelStr);
+
+ // exception opt second arg: .character level $name
+ if (levelStr && isalpha(levelStr[0]))
+ {
+ nameStr = levelStr;
+ levelStr = NULL; // current level will used
+ }
+
+ Player* target;
+ uint64 targetGuid;
+ std::string targetName;
+ if (!handler->extractPlayerTarget(nameStr, &target, &targetGuid, &targetName))
+ return false;
+
+ int32 oldlevel = target ? target->getLevel() : Player::GetLevelFromDB(targetGuid);
+ int32 addlevel = levelStr ? atoi(levelStr) : 1;
+ int32 newlevel = oldlevel + addlevel;
+
+ if (newlevel < 1)
+ newlevel = 1;
+
+ if (newlevel > STRONG_MAX_LEVEL) // hardcoded maximum level
+ newlevel = STRONG_MAX_LEVEL;
+
+ HandleCharacterLevel(target, targetGuid, oldlevel, newlevel, handler);
+
+ if (!handler->GetSession() || handler->GetSession()->GetPlayer() != target) // including chr == NULL
+ {
+ std::string nameLink = handler->playerLink(targetName);
+ handler->PSendSysMessage(LANG_YOU_CHANGE_LVL, nameLink.c_str(), newlevel);
+ }
+
+ return true;
+ }
+
+ static bool HandlePDumpLoadCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ char* fileStr = strtok((char*)args, " ");
+ if (!fileStr)
+ return false;
+
+ char* accountStr = strtok(NULL, " ");
+ if (!accountStr)
+ return false;
+
+ std::string accountName = accountStr;
+ if (!AccountMgr::normalizeString(accountName))
+ {
+ handler->PSendSysMessage(LANG_ACCOUNT_NOT_EXIST, accountName.c_str());
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ uint32 accountId = AccountMgr::GetId(accountName);
+ if (!accountId)
+ {
+ accountId = atoi(accountStr); // use original string
+ if (!accountId)
+ {
+ handler->PSendSysMessage(LANG_ACCOUNT_NOT_EXIST, accountName.c_str());
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+ }
+
+ if (!AccountMgr::GetName(accountId, accountName))
+ {
+ handler->PSendSysMessage(LANG_ACCOUNT_NOT_EXIST, accountName.c_str());
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ char* guidStr = NULL;
+ char* nameStr = strtok(NULL, " ");
+
+ std::string name;
+ if (nameStr)
+ {
+ name = nameStr;
+ // normalize the name if specified and check if it exists
+ if (!normalizePlayerName(name))
+ {
+ handler->PSendSysMessage(LANG_INVALID_CHARACTER_NAME);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ if (ObjectMgr::CheckPlayerName(name, true) != CHAR_NAME_SUCCESS)
+ {
+ handler->PSendSysMessage(LANG_INVALID_CHARACTER_NAME);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ guidStr = strtok(NULL, " ");
+ }
+
+ uint32 guid = 0;
+
+ if (guidStr)
+ {
+ guid = uint32(atoi(guidStr));
+ if (!guid)
+ {
+ handler->PSendSysMessage(LANG_INVALID_CHARACTER_GUID);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ if (sObjectMgr->GetPlayerAccountIdByGUID(guid))
+ {
+ handler->PSendSysMessage(LANG_CHARACTER_GUID_IN_USE, guid);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+ }
+
+ switch (PlayerDumpReader().LoadDump(fileStr, accountId, name, guid))
+ {
+ case DUMP_SUCCESS:
+ handler->PSendSysMessage(LANG_COMMAND_IMPORT_SUCCESS);
+ break;
+ case DUMP_FILE_OPEN_ERROR:
+ handler->PSendSysMessage(LANG_FILE_OPEN_FAIL, fileStr);
+ handler->SetSentErrorMessage(true);
+ return false;
+ case DUMP_FILE_BROKEN:
+ handler->PSendSysMessage(LANG_DUMP_BROKEN, fileStr);
+ handler->SetSentErrorMessage(true);
+ return false;
+ case DUMP_TOO_MANY_CHARS:
+ handler->PSendSysMessage(LANG_ACCOUNT_CHARACTER_LIST_FULL, accountName.c_str(), accountId);
+ handler->SetSentErrorMessage(true);
+ return false;
+ default:
+ handler->PSendSysMessage(LANG_COMMAND_IMPORT_FAILED);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ return true;
+ }
+
+ static bool HandlePDumpWriteCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ char* fileStr = strtok((char*)args, " ");
+ char* playerStr = strtok(NULL, " ");
+
+ if (!fileStr || !playerStr)
+ return false;
+
+ uint64 guid;
+ // character name can't start from number
+ if (isNumeric(playerStr))
+ guid = MAKE_NEW_GUID(atoi(playerStr), 0, HIGHGUID_PLAYER);
+ else
+ {
+ std::string name = handler->extractPlayerNameFromLink(playerStr);
+ if (name.empty())
+ {
+ handler->SendSysMessage(LANG_PLAYER_NOT_FOUND);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ guid = sObjectMgr->GetPlayerGUIDByName(name);
+ }
+
+ if (!sObjectMgr->GetPlayerAccountIdByGUID(guid))
+ {
+ handler->PSendSysMessage(LANG_PLAYER_NOT_FOUND);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ switch (PlayerDumpWriter().WriteDump(fileStr, uint32(guid)))
+ {
+ case DUMP_SUCCESS:
+ handler->PSendSysMessage(LANG_COMMAND_EXPORT_SUCCESS);
+ break;
+ case DUMP_FILE_OPEN_ERROR:
+ handler->PSendSysMessage(LANG_FILE_OPEN_FAIL, fileStr);
+ handler->SetSentErrorMessage(true);
+ return false;
+ case DUMP_CHARACTER_DELETED:
+ handler->PSendSysMessage(LANG_COMMAND_EXPORT_DELETED_CHAR);
+ handler->SetSentErrorMessage(true);
+ return false;
+ default:
+ handler->PSendSysMessage(LANG_COMMAND_EXPORT_FAILED);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ return true;
+ }
};
void AddSC_character_commandscript()
diff --git a/src/server/scripts/Commands/cs_debug.cpp b/src/server/scripts/Commands/cs_debug.cpp
index c6bbe883a0e..c7b766cacd0 100644
--- a/src/server/scripts/Commands/cs_debug.cpp
+++ b/src/server/scripts/Commands/cs_debug.cpp
@@ -410,7 +410,7 @@ public:
}
else
{
- sLog->outError("Sending opcode that has unknown type '%s'", type.c_str());
+ sLog->outError(LOG_FILTER_GENERAL, "Sending opcode that has unknown type '%s'", type.c_str());
break;
}
}
@@ -1325,7 +1325,7 @@ public:
{
Player* player = handler->GetSession()->GetPlayer();
- sLog->outSQLDev("(@PATH, XX, %.3f, %.3f, %.5f, 0, 0, 0, 100, 0),", player->GetPositionX(), player->GetPositionY(), player->GetPositionZ());
+ sLog->outInfo(LOG_FILTER_SQL_DEV, "(@PATH, XX, %.3f, %.3f, %.5f, 0, 0, 0, 100, 0),", player->GetPositionX(), player->GetPositionY(), player->GetPositionZ());
handler->PSendSysMessage("Waypoint SQL written to SQL Developer log");
return true;
diff --git a/src/server/scripts/Commands/cs_disable.cpp b/src/server/scripts/Commands/cs_disable.cpp
new file mode 100644
index 00000000000..a2a80edd43b
--- /dev/null
+++ b/src/server/scripts/Commands/cs_disable.cpp
@@ -0,0 +1,371 @@
+/*
+ * Copyright (C) 2008-2012 TrinityCore <http://www.trinitycore.org/>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/* ScriptData
+Name: disable_commandscript
+%Complete: 100
+Comment: All disable related commands
+Category: commandscripts
+EndScriptData */
+
+#include "ScriptMgr.h"
+#include "ObjectMgr.h"
+#include "Chat.h"
+#include "DisableMgr.h"
+#include "OutdoorPvP.h"
+
+class disable_commandscript : public CommandScript
+{
+public:
+ disable_commandscript() : CommandScript("disable_commandscript") { }
+
+ ChatCommand* GetCommands() const
+ {
+ static ChatCommand removeDisableCommandTable[] =
+ {
+ { "spell", SEC_ADMINISTRATOR, true, &HandleRemoveDisableSpellCommand, "", NULL },
+ { "quest", SEC_ADMINISTRATOR, true, &HandleRemoveDisableQuestCommand, "", NULL },
+ { "map", SEC_ADMINISTRATOR, true, &HandleRemoveDisableMapCommand, "", NULL },
+ { "battleground", SEC_ADMINISTRATOR, true, &HandleRemoveDisableBattlegroundCommand, "", NULL },
+ { "achievement_criteria", SEC_ADMINISTRATOR, true, &HandleRemoveDisableAchievementCriteriaCommand, "", NULL },
+ { "outdoorpvp", SEC_ADMINISTRATOR, true, &HandleRemoveDisableOutdoorPvPCommand, "", NULL },
+ { "vmap", SEC_ADMINISTRATOR, true, &HandleRemoveDisableVmapCommand, "", NULL },
+ { NULL, 0, false, NULL, "", NULL }
+ };
+ static ChatCommand addDisableCommandTable[] =
+ {
+ { "spell", SEC_ADMINISTRATOR, true, &HandleAddDisableSpellCommand, "", NULL },
+ { "quest", SEC_ADMINISTRATOR, true, &HandleAddDisableQuestCommand, "", NULL },
+ { "map", SEC_ADMINISTRATOR, true, &HandleAddDisableMapCommand, "", NULL },
+ { "battleground", SEC_ADMINISTRATOR, true, &HandleAddDisableBattlegroundCommand, "", NULL },
+ { "achievement_criteria", SEC_ADMINISTRATOR, true, &HandleAddDisableAchievementCriteriaCommand, "", NULL },
+ { "outdoorpvp", SEC_ADMINISTRATOR, true, &HandleAddDisableOutdoorPvPCommand, "", NULL },
+ { "vmap", SEC_ADMINISTRATOR, true, &HandleAddDisableVmapCommand, "", NULL },
+ { NULL, 0, false, NULL, "", NULL }
+ };
+ static ChatCommand disableCommandTable[] =
+ {
+ { "add", SEC_ADMINISTRATOR, true, NULL, "", addDisableCommandTable },
+ { "remove", SEC_ADMINISTRATOR, true, NULL, "", removeDisableCommandTable },
+ { NULL, 0, false, NULL, "", NULL }
+ };
+ static ChatCommand commandTable[] =
+ {
+ { "disable", SEC_ADMINISTRATOR, false, NULL, "", disableCommandTable },
+ { NULL, 0, false, NULL, "", NULL }
+ };
+ return commandTable;
+ }
+
+ static bool HandleAddDisables(ChatHandler* handler, char const* args, uint8 disableType)
+ {
+ char* entryStr = strtok((char*)args, " ");
+ if (!entryStr || !atoi(entryStr))
+ return false;
+
+ char* flagsStr = strtok(NULL, " ");
+ uint8 flags = flagsStr ? uint8(atoi(flagsStr)) : 0;
+
+ char* commentStr = strtok(NULL, "");
+ if (!commentStr)
+ return false;
+
+ std::string disableComment = commentStr;
+ uint32 entry = uint32(atoi(entryStr));
+
+ std::string disableTypeStr = "";
+
+ switch (disableType)
+ {
+ case DISABLE_TYPE_SPELL:
+ {
+ if (!sSpellMgr->GetSpellInfo(entry))
+ {
+ handler->PSendSysMessage(LANG_COMMAND_NOSPELLFOUND);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+ disableTypeStr = "spell";
+ break;
+ }
+ case DISABLE_TYPE_QUEST:
+ {
+ if (!sObjectMgr->GetQuestTemplate(entry))
+ {
+ handler->PSendSysMessage(LANG_COMMAND_QUEST_NOTFOUND, entry);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+ disableTypeStr = "quest";
+ break;
+ }
+ case DISABLE_TYPE_MAP:
+ {
+ if (!sMapStore.LookupEntry(entry))
+ {
+ handler->PSendSysMessage(LANG_COMMAND_NOMAPFOUND);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+ disableTypeStr = "map";
+ break;
+ }
+ case DISABLE_TYPE_BATTLEGROUND:
+ {
+ if (!sBattlemasterListStore.LookupEntry(entry))
+ {
+ handler->PSendSysMessage(LANG_COMMAND_NO_BATTLEGROUND_FOUND);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+ disableTypeStr = "battleground";
+ break;
+ }
+ case DISABLE_TYPE_ACHIEVEMENT_CRITERIA:
+ {
+ if (!sAchievementCriteriaStore.LookupEntry(entry))
+ {
+ handler->PSendSysMessage(LANG_COMMAND_NO_ACHIEVEMENT_CRITERIA_FOUND);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+ disableTypeStr = "achievement criteria";
+ break;
+ }
+ case DISABLE_TYPE_OUTDOORPVP:
+ {
+ if (entry > MAX_OUTDOORPVP_TYPES)
+ {
+ handler->PSendSysMessage(LANG_COMMAND_NO_OUTDOOR_PVP_FORUND);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+ disableTypeStr = "outdoorpvp";
+ break;
+ }
+ case DISABLE_TYPE_VMAP:
+ {
+ if (!sMapStore.LookupEntry(entry))
+ {
+ handler->PSendSysMessage(LANG_COMMAND_NOMAPFOUND);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+ disableTypeStr = "vmap";
+ break;
+ }
+ default:
+ break;
+ }
+
+ PreparedStatement* stmt = NULL;
+ stmt = WorldDatabase.GetPreparedStatement(WORLD_SEL_DISABLES);
+ stmt->setUInt32(0, entry);
+ stmt->setUInt8(1, disableType);
+ PreparedQueryResult result = WorldDatabase.Query(stmt);
+ if (result)
+ {
+ handler->PSendSysMessage("This %s (Id: %u) is already disabled.", disableTypeStr.c_str(), entry);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ stmt = WorldDatabase.GetPreparedStatement(WORLD_INS_DISABLES);
+ stmt->setUInt32(0, entry);
+ stmt->setUInt8(1, disableType);
+ stmt->setUInt16(2, flags);
+ stmt->setString(3, disableComment);
+ WorldDatabase.Execute(stmt);
+
+ handler->PSendSysMessage("Add Disabled %s (Id: %u) for reason %s", disableTypeStr.c_str(), entry, disableComment.c_str());
+ return true;
+ }
+
+ static bool HandleAddDisableSpellCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ return HandleAddDisables(handler, args, DISABLE_TYPE_SPELL);
+ }
+
+ static bool HandleAddDisableQuestCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ return HandleAddDisables(handler, args, DISABLE_TYPE_QUEST);
+ }
+
+ static bool HandleAddDisableMapCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ return HandleAddDisables(handler, args, DISABLE_TYPE_MAP);
+ }
+
+ static bool HandleAddDisableBattlegroundCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ return HandleAddDisables(handler, args, DISABLE_TYPE_BATTLEGROUND);
+ }
+
+ static bool HandleAddDisableAchievementCriteriaCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ return HandleAddDisables(handler, args, DISABLE_TYPE_ACHIEVEMENT_CRITERIA);
+ }
+
+ static bool HandleAddDisableOutdoorPvPCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ HandleAddDisables(handler, args, DISABLE_TYPE_OUTDOORPVP);
+ return true;
+ }
+
+ static bool HandleAddDisableVmapCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ return HandleAddDisables(handler, args, DISABLE_TYPE_VMAP);
+ }
+
+ static bool HandleRemoveDisables(ChatHandler* handler, char const* args, uint8 disableType)
+ {
+ char* entryStr = strtok((char*)args, " ");
+ if (!entryStr || !atoi(entryStr))
+ return false;
+
+ uint32 entry = uint32(atoi(entryStr));
+
+ std::string disableTypeStr = "";
+
+ switch (disableType)
+ {
+ case DISABLE_TYPE_SPELL:
+ disableTypeStr = "spell";
+ break;
+ case DISABLE_TYPE_QUEST:
+ disableTypeStr = "quest";
+ break;
+ case DISABLE_TYPE_MAP:
+ disableTypeStr = "map";
+ break;
+ case DISABLE_TYPE_BATTLEGROUND:
+ disableTypeStr = "battleground";
+ break;
+ case DISABLE_TYPE_ACHIEVEMENT_CRITERIA:
+ disableTypeStr = "achievement criteria";
+ break;
+ case DISABLE_TYPE_OUTDOORPVP:
+ disableTypeStr = "outdoorpvp";
+ break;
+ case DISABLE_TYPE_VMAP:
+ disableTypeStr = "vmap";
+ break;
+ }
+
+ PreparedStatement* stmt = NULL;
+ stmt = WorldDatabase.GetPreparedStatement(WORLD_SEL_DISABLES);
+ stmt->setUInt32(0, entry);
+ stmt->setUInt8(1, disableType);
+ PreparedQueryResult result = WorldDatabase.Query(stmt);
+ if (!result)
+ {
+ handler->PSendSysMessage("This %s (Id: %u) is not disabled.", disableTypeStr.c_str(), entry);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ stmt = WorldDatabase.GetPreparedStatement(WORLD_DEL_DISABLES);
+ stmt->setUInt32(0, entry);
+ stmt->setUInt8(1, disableType);
+ WorldDatabase.Execute(stmt);
+
+ handler->PSendSysMessage("Remove Disabled %s (Id: %u)", disableTypeStr.c_str(), entry);
+ return true;
+ }
+
+ static bool HandleRemoveDisableSpellCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ return HandleRemoveDisables(handler, args, DISABLE_TYPE_SPELL);
+ }
+
+ static bool HandleRemoveDisableQuestCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ return HandleRemoveDisables(handler, args, DISABLE_TYPE_QUEST);
+ }
+
+ static bool HandleRemoveDisableMapCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ return HandleAddDisables(handler, args, DISABLE_TYPE_MAP);
+ }
+
+ static bool HandleRemoveDisableBattlegroundCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ return HandleRemoveDisables(handler, args, DISABLE_TYPE_BATTLEGROUND);
+ }
+
+ static bool HandleRemoveDisableAchievementCriteriaCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ return HandleRemoveDisables(handler, args, DISABLE_TYPE_ACHIEVEMENT_CRITERIA);
+ }
+
+ static bool HandleRemoveDisableOutdoorPvPCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ return HandleRemoveDisables(handler, args, DISABLE_TYPE_OUTDOORPVP);
+ }
+
+ static bool HandleRemoveDisableVmapCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ return HandleRemoveDisables(handler, args, DISABLE_TYPE_VMAP);
+ }
+};
+
+void AddSC_disable_commandscript()
+{
+ new disable_commandscript();
+}
diff --git a/src/server/scripts/Commands/cs_gobject.cpp b/src/server/scripts/Commands/cs_gobject.cpp
index 232aad9f21c..167c56c20a2 100644
--- a/src/server/scripts/Commands/cs_gobject.cpp
+++ b/src/server/scripts/Commands/cs_gobject.cpp
@@ -133,7 +133,7 @@ public:
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.", objectId, objectInfo->type, objectInfo->displayId);
+ sLog->outError(LOG_FILTER_SQL, "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;
diff --git a/src/server/scripts/Commands/cs_learn.cpp b/src/server/scripts/Commands/cs_learn.cpp
index ae573577d7e..cfdfc66f991 100644
--- a/src/server/scripts/Commands/cs_learn.cpp
+++ b/src/server/scripts/Commands/cs_learn.cpp
@@ -22,10 +22,10 @@ Comment: All learn related commands
Category: commandscripts
EndScriptData */
+#include "Chat.h"
#include "ScriptMgr.h"
#include "ObjectMgr.h"
#include "SpellMgr.h"
-#include "Chat.h"
#include "SpellInfo.h"
class learn_commandscript : public CommandScript
@@ -37,35 +37,36 @@ public:
{
static ChatCommand learnAllMyCommandTable[] =
{
- { "class", SEC_ADMINISTRATOR, false, &HandleLearnAllMyClassCommand, "", NULL },
- { "pettalents", SEC_ADMINISTRATOR, false, &HandleLearnAllMyPetTalentsCommand, "", NULL },
- { "spells", SEC_ADMINISTRATOR, false, &HandleLearnAllMySpellsCommand, "", NULL },
- { "talents", SEC_ADMINISTRATOR, false, &HandleLearnAllMyTalentsCommand, "", NULL },
- { NULL, 0, false, NULL, "", NULL }
+ { "class", SEC_ADMINISTRATOR, false, &HandleLearnAllMyClassCommand, "", NULL },
+ { "pettalents", SEC_ADMINISTRATOR, false, &HandleLearnAllMyPetTalentsCommand, "", NULL },
+ { "spells", SEC_ADMINISTRATOR, false, &HandleLearnAllMySpellsCommand, "", NULL },
+ { "talents", SEC_ADMINISTRATOR, false, &HandleLearnAllMyTalentsCommand, "", NULL },
+ { NULL, 0, false, NULL, "", NULL }
};
static ChatCommand learnAllCommandTable[] =
{
- { "my", SEC_ADMINISTRATOR, false, NULL, "", learnAllMyCommandTable },
- { "gm", SEC_GAMEMASTER, false, &HandleLearnAllGMCommand, "", NULL },
- { "crafts", SEC_GAMEMASTER, false, &HandleLearnAllCraftsCommand, "", NULL },
- { "default", SEC_MODERATOR, false, &HandleLearnAllDefaultCommand, "", NULL },
- { "lang", SEC_MODERATOR, false, &HandleLearnAllLangCommand, "", NULL },
- { "recipes", SEC_GAMEMASTER, false, &HandleLearnAllRecipesCommand, "", NULL },
- { NULL, 0, false, NULL, "", NULL }
+ { "my", SEC_ADMINISTRATOR, false, NULL, "", learnAllMyCommandTable },
+ { "gm", SEC_GAMEMASTER, false, &HandleLearnAllGMCommand, "", NULL },
+ { "crafts", SEC_GAMEMASTER, false, &HandleLearnAllCraftsCommand, "", NULL },
+ { "default", SEC_MODERATOR, false, &HandleLearnAllDefaultCommand, "", NULL },
+ { "lang", SEC_MODERATOR, false, &HandleLearnAllLangCommand, "", NULL },
+ { "recipes", SEC_GAMEMASTER, false, &HandleLearnAllRecipesCommand, "", NULL },
+ { NULL, 0, false, NULL, "", NULL }
};
static ChatCommand learnCommandTable[] =
{
- { "all", SEC_ADMINISTRATOR, false, NULL, "", learnAllCommandTable },
- { "", SEC_ADMINISTRATOR, false, &HandleLearnCommand, "", NULL },
- { NULL, 0, false, NULL, "", NULL }
+ { "all", SEC_ADMINISTRATOR, false, NULL, "", learnAllCommandTable },
+ { "", SEC_ADMINISTRATOR, false, &HandleLearnCommand, "", NULL },
+ { NULL, 0, false, NULL, "", NULL }
};
static ChatCommand commandTable[] =
{
- { "learn", SEC_MODERATOR, false, NULL, "", learnCommandTable },
- { NULL, 0, false, NULL, "", NULL }
+ { "learn", SEC_MODERATOR, false, NULL, "", learnCommandTable },
+ { "unlearn", SEC_ADMINISTRATOR, false, &HandleUnLearnCommand, "", NULL },
+ { NULL, 0, false, NULL, "", NULL }
};
return commandTable;
}
@@ -466,6 +467,41 @@ public:
player->learnSpell(skillLine->spellId, false);
}
}
+
+ static bool HandleUnLearnCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ // number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r
+ uint32 spellId = handler->extractSpellIdFromLink((char*)args);
+ if (!spellId)
+ return false;
+
+ char const* allStr = strtok(NULL, " ");
+ bool allRanks = allStr ? (strncmp(allStr, "all", strlen(allStr)) == 0) : false;
+
+ Player* target = handler->getSelectedPlayer();
+ if (!target)
+ {
+ handler->SendSysMessage(LANG_NO_CHAR_SELECTED);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ if (allRanks)
+ spellId = sSpellMgr->GetFirstSpellInChain (spellId);
+
+ if (target->HasSpell(spellId))
+ target->removeSpell(spellId, false, !allRanks);
+ else
+ handler->SendSysMessage(LANG_FORGET_SPELL);
+
+ if (GetTalentSpellCost(spellId))
+ target->SendTalentsInfoData(false);
+
+ return true;
+ }
};
void AddSC_learn_commandscript()
diff --git a/src/server/scripts/Commands/cs_message.cpp b/src/server/scripts/Commands/cs_message.cpp
new file mode 100644
index 00000000000..d61abf34e2f
--- /dev/null
+++ b/src/server/scripts/Commands/cs_message.cpp
@@ -0,0 +1,215 @@
+/*
+ * Copyright (C) 2008-2012 TrinityCore <http://www.trinitycore.org/>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/* ScriptData
+Name: message_commandscript
+%Complete: 100
+Comment: All message related commands
+Category: commandscripts
+EndScriptData */
+
+#include "ScriptMgr.h"
+#include "Chat.h"
+#include "ChannelMgr.h"
+
+class message_commandscript : public CommandScript
+{
+public:
+ message_commandscript() : CommandScript("message_commandscript") { }
+
+ ChatCommand* GetCommands() const
+ {
+ static ChatCommand channelSetCommandTable[] =
+ {
+ { "ownership", SEC_ADMINISTRATOR, false, &HandleChannelSetOwnership, "", NULL },
+ { NULL, 0, false, NULL, "", NULL }
+ };
+ static ChatCommand channelCommandTable[] =
+ {
+ { "set", SEC_ADMINISTRATOR, true, NULL, "", channelSetCommandTable },
+ { NULL, 0, false, NULL, "", NULL }
+ };
+ static ChatCommand commandTable[] =
+ {
+ { "channel", SEC_ADMINISTRATOR, true, NULL, "", channelCommandTable },
+ { "nameannounce", SEC_MODERATOR, true, &HandleNameAnnounceCommand, "", NULL },
+ { "gmnameannounce", SEC_MODERATOR, true, &HandleGMNameAnnounceCommand, "", NULL },
+ { "announce", SEC_MODERATOR, true, &HandleAnnounceCommand, "", NULL },
+ { "gmannounce", SEC_MODERATOR, true, &HandleGMAnnounceCommand, "", NULL },
+ { "notify", SEC_MODERATOR, true, &HandleNotifyCommand, "", NULL },
+ { "gmnotify", SEC_MODERATOR, true, &HandleGMNotifyCommand, "", NULL },
+ { "whispers", SEC_MODERATOR, false, &HandleWhispersCommand, "", NULL },
+ { NULL, 0, false, NULL, "", NULL }
+ };
+ return commandTable;
+ }
+
+ static bool HandleChannelSetOwnership(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ return false;
+ char const* channelStr = strtok((char*)args, " ");
+ char const* argStr = strtok(NULL, "");
+
+ if (!channelStr || !argStr)
+ return false;
+
+ Player* player = handler->GetSession()->GetPlayer();
+ Channel* channcel = NULL;
+
+ if (ChannelMgr* cMgr = channelMgr(player->GetTeam()))
+ channcel = cMgr->GetChannel(channelStr, player);
+
+ if (strcmp(argStr, "on") == 0)
+ {
+ if (channcel)
+ channcel->SetOwnership(true);
+ PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_CHANNEL_OWNERSHIP);
+ stmt->setUInt8 (0, 1);
+ stmt->setString(1, channelStr);
+ CharacterDatabase.Execute(stmt);
+ handler->PSendSysMessage(LANG_CHANNEL_ENABLE_OWNERSHIP, channelStr);
+ }
+ else if (strcmp(argStr, "off") == 0)
+ {
+ if (channcel)
+ channcel->SetOwnership(false);
+ PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_CHANNEL_OWNERSHIP);
+ stmt->setUInt8 (0, 0);
+ stmt->setString(1, channelStr);
+ CharacterDatabase.Execute(stmt);
+ handler->PSendSysMessage(LANG_CHANNEL_DISABLE_OWNERSHIP, channelStr);
+ }
+ else
+ return false;
+
+ return true;
+ }
+
+ static bool HandleNameAnnounceCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ std::string name("Console");
+ if (WorldSession* session = handler->GetSession())
+ name = session->GetPlayer()->GetName();
+
+ sWorld->SendWorldText(LANG_ANNOUNCE_COLOR, name.c_str(), args);
+ return true;
+ }
+
+ static bool HandleGMNameAnnounceCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ std::string name("Console");
+ if (WorldSession* session = handler->GetSession())
+ name = session->GetPlayer()->GetName();
+
+ sWorld->SendGMText(LANG_GM_ANNOUNCE_COLOR, name.c_str(), args);
+ return true;
+ }
+ // global announce
+ static bool HandleAnnounceCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ char buff[2048];
+ sprintf(buff, handler->GetTrinityString(LANG_SYSTEMMESSAGE), args);
+ sWorld->SendServerMessage(SERVER_MSG_STRING, buff);
+ return true;
+ }
+ // announce to logged in GMs
+ static bool HandleGMAnnounceCommand(ChatHandler* /*handler*/, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ sWorld->SendGMText(LANG_GM_BROADCAST, args);
+ return true;
+ }
+ // notification player at the screen
+ static bool HandleNotifyCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ std::string str = handler->GetTrinityString(LANG_GLOBAL_NOTIFY);
+ str += args;
+
+ WorldPacket data(SMSG_NOTIFICATION, (str.size()+1));
+ data << str;
+ sWorld->SendGlobalMessage(&data);
+
+ return true;
+ }
+ // notification GM at the screen
+ static bool HandleGMNotifyCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ std::string str = handler->GetTrinityString(LANG_GM_NOTIFY);
+ str += args;
+
+ WorldPacket data(SMSG_NOTIFICATION, (str.size()+1));
+ data << str;
+ sWorld->SendGlobalGMMessage(&data);
+
+ return true;
+ }
+ // Enable\Dissable accept whispers (for GM)
+ static bool HandleWhispersCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ {
+ handler->PSendSysMessage(LANG_COMMAND_WHISPERACCEPTING, handler->GetSession()->GetPlayer()->isAcceptWhispers() ? handler->GetTrinityString(LANG_ON) : handler->GetTrinityString(LANG_OFF));
+ return true;
+ }
+
+ std::string argStr = (char*)args;
+ // whisper on
+ if (argStr == "on")
+ {
+ handler->GetSession()->GetPlayer()->SetAcceptWhispers(true);
+ handler->SendSysMessage(LANG_COMMAND_WHISPERON);
+ return true;
+ }
+
+ // whisper off
+ if (argStr == "off")
+ {
+ // Remove all players from the Gamemaster's whisper whitelist
+ handler->GetSession()->GetPlayer()->ClearWhisperWhiteList();
+ handler->GetSession()->GetPlayer()->SetAcceptWhispers(false);
+ handler->SendSysMessage(LANG_COMMAND_WHISPEROFF);
+ return true;
+ }
+
+ handler->SendSysMessage(LANG_USE_BOL);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+};
+
+void AddSC_message_commandscript()
+{
+ new message_commandscript();
+}
diff --git a/src/server/scripts/Commands/cs_misc.cpp b/src/server/scripts/Commands/cs_misc.cpp
index 4aa61bbc297..d8026ccd10a 100644
--- a/src/server/scripts/Commands/cs_misc.cpp
+++ b/src/server/scripts/Commands/cs_misc.cpp
@@ -15,11 +15,20 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
#include "Chat.h"
-#include "ObjectAccessor.h"
#include "ScriptMgr.h"
+#include "AccountMgr.h"
+#include "ArenaTeamMgr.h"
#include "CellImpl.h"
+#include "GridNotifiers.h"
+#include "Group.h"
+#include "InstanceSaveMgr.h"
+#include "MovementGenerator.h"
+#include "ObjectAccessor.h"
+#include "SpellAuras.h"
+#include "TargetedMovementGenerator.h"
+#include "WeatherMgr.h"
+#include "ace/INET_Addr.h"
class misc_commandscript : public CommandScript
{
@@ -28,11 +37,86 @@ public:
ChatCommand* GetCommands() const
{
+ static ChatCommand groupCommandTable[] =
+ {
+ { "leader", SEC_ADMINISTRATOR, false, &HandleGroupLeaderCommand, "", NULL },
+ { "disband", SEC_ADMINISTRATOR, false, &HandleGroupDisbandCommand, "", NULL },
+ { "remove", SEC_ADMINISTRATOR, false, &HandleGroupRemoveCommand, "", NULL },
+ { NULL, 0, false, NULL, "", NULL }
+ };
+ static ChatCommand petCommandTable[] =
+ {
+ { "create", SEC_GAMEMASTER, false, &HandleCreatePetCommand, "", NULL },
+ { "learn", SEC_GAMEMASTER, false, &HandlePetLearnCommand, "", NULL },
+ { "unlearn", SEC_GAMEMASTER, false, &HandlePetUnlearnCommand, "", NULL },
+ { NULL, 0, false, NULL, "", NULL }
+ };
+ static ChatCommand sendCommandTable[] =
+ {
+ { "items", SEC_ADMINISTRATOR, true, &HandleSendItemsCommand, "", NULL },
+ { "mail", SEC_MODERATOR, true, &HandleSendMailCommand, "", NULL },
+ { "message", SEC_ADMINISTRATOR, true, &HandleSendMessageCommand, "", NULL },
+ { "money", SEC_ADMINISTRATOR, true, &HandleSendMoneyCommand, "", NULL },
+ { NULL, 0, false, NULL, "", NULL }
+ };
static ChatCommand commandTable[] =
{
- { "dev", SEC_ADMINISTRATOR, false, &HandleDevCommand, "", NULL },
- { "gps", SEC_ADMINISTRATOR, false, &HandleGPSCommand, "", NULL },
- { NULL, 0, false, NULL, "", NULL }
+ { "dev", SEC_ADMINISTRATOR, false, &HandleDevCommand, "", NULL },
+ { "gps", SEC_ADMINISTRATOR, false, &HandleGPSCommand, "", NULL },
+ { "aura", SEC_ADMINISTRATOR, false, &HandleAuraCommand, "", NULL },
+ { "unaura", SEC_ADMINISTRATOR, false, &HandleUnAuraCommand, "", NULL },
+ { "appear", SEC_MODERATOR, false, &HandleAppearCommand, "", NULL },
+ { "summon", SEC_MODERATOR, false, &HandleSummonCommand, "", NULL },
+ { "groupsummon", SEC_MODERATOR, false, &HandleGroupSummonCommand, "", NULL },
+ { "commands", SEC_PLAYER, true, &HandleCommandsCommand, "", NULL },
+ { "die", SEC_ADMINISTRATOR, false, &HandleDieCommand, "", NULL },
+ { "revive", SEC_ADMINISTRATOR, true, &HandleReviveCommand, "", NULL },
+ { "dismount", SEC_PLAYER, false, &HandleDismountCommand, "", NULL },
+ { "guid", SEC_GAMEMASTER, false, &HandleGUIDCommand, "", NULL },
+ { "help", SEC_PLAYER, true, &HandleHelpCommand, "", NULL },
+ { "itemmove", SEC_GAMEMASTER, false, &HandleItemMoveCommand, "", NULL },
+ { "cooldown", SEC_ADMINISTRATOR, false, &HandleCooldownCommand, "", NULL },
+ { "distance", SEC_ADMINISTRATOR, false, &HandleGetDistanceCommand, "", NULL },
+ { "recall", SEC_MODERATOR, false, &HandleRecallCommand, "", NULL },
+ { "save", SEC_PLAYER, false, &HandleSaveCommand, "", NULL },
+ { "saveall", SEC_MODERATOR, true, &HandleSaveAllCommand, "", NULL },
+ { "kick", SEC_GAMEMASTER, true, &HandleKickPlayerCommand, "", NULL },
+ { "start", SEC_PLAYER, false, &HandleStartCommand, "", NULL },
+ { "taxicheat", SEC_MODERATOR, false, &HandleTaxiCheatCommand, "", NULL },
+ { "linkgrave", SEC_ADMINISTRATOR, false, &HandleLinkGraveCommand, "", NULL },
+ { "neargrave", SEC_ADMINISTRATOR, false, &HandleNearGraveCommand, "", NULL },
+ { "explorecheat", SEC_ADMINISTRATOR, false, &HandleExploreCheatCommand, "", NULL },
+ { "showarea", SEC_ADMINISTRATOR, false, &HandleShowAreaCommand, "", NULL },
+ { "hidearea", SEC_ADMINISTRATOR, false, &HandleHideAreaCommand, "", NULL },
+ { "additem", SEC_ADMINISTRATOR, false, &HandleAddItemCommand, "", NULL },
+ { "additemset", SEC_ADMINISTRATOR, false, &HandleAddItemSetCommand, "", NULL },
+ { "bank", SEC_ADMINISTRATOR, false, &HandleBankCommand, "", NULL },
+ { "wchange", SEC_ADMINISTRATOR, false, &HandleChangeWeather, "", NULL },
+ { "maxskill", SEC_ADMINISTRATOR, false, &HandleMaxSkillCommand, "", NULL },
+ { "setskill", SEC_ADMINISTRATOR, false, &HandleSetSkillCommand, "", NULL },
+ { "pinfo", SEC_GAMEMASTER, true, &HandlePInfoCommand, "", NULL },
+ { "respawn", SEC_ADMINISTRATOR, false, &HandleRespawnCommand, "", NULL },
+ { "send", SEC_MODERATOR, true, NULL, "", sendCommandTable },
+ { "pet", SEC_GAMEMASTER, false, NULL, "", petCommandTable },
+ { "mute", SEC_MODERATOR, true, &HandleMuteCommand, "", NULL },
+ { "unmute", SEC_MODERATOR, true, &HandleUnmuteCommand, "", NULL },
+ { "movegens", SEC_ADMINISTRATOR, false, &HandleMovegensCommand, "", NULL },
+ { "cometome", SEC_ADMINISTRATOR, false, &HandleComeToMeCommand, "", NULL },
+ { "damage", SEC_ADMINISTRATOR, false, &HandleDamageCommand, "", NULL },
+ { "combatstop", SEC_GAMEMASTER, true, &HandleCombatStopCommand, "", NULL },
+ { "flusharenapoints", SEC_ADMINISTRATOR, false, &HandleFlushArenaPointsCommand, "", NULL },
+ { "repairitems", SEC_GAMEMASTER, true, &HandleRepairitemsCommand, "", NULL },
+ { "waterwalk", SEC_GAMEMASTER, false, &HandleWaterwalkCommand, "", NULL },
+ { "freeze", SEC_MODERATOR, false, &HandleFreezeCommand, "", NULL },
+ { "unfreeze", SEC_MODERATOR, false, &HandleUnFreezeCommand, "", NULL },
+ { "listfreeze", SEC_MODERATOR, false, &HandleListFreezeCommand, "", NULL },
+ { "group", SEC_ADMINISTRATOR, false, NULL, "", groupCommandTable },
+ { "possess", SEC_ADMINISTRATOR, false, HandlePossessCommand, "", NULL },
+ { "unpossess", SEC_ADMINISTRATOR, false, HandleUnPossessCommand, "", NULL },
+ { "bindsight", SEC_ADMINISTRATOR, false, HandleBindSightCommand, "", NULL },
+ { "unbindsight", SEC_ADMINISTRATOR, false, HandleUnbindSightCommand, "", NULL },
+ { "playall", SEC_GAMEMASTER, false, HandlePlayAllCommand, "", NULL },
+ { NULL, 0, false, NULL, "", NULL }
};
return commandTable;
}
@@ -152,6 +236,2641 @@ public:
return true;
}
+
+ static bool HandleAuraCommand(ChatHandler* handler, char const* args)
+ {
+ Unit* target = handler->getSelectedUnit();
+ if (!target)
+ {
+ handler->SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ // number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r or Htalent form
+ uint32 spellId = handler->extractSpellIdFromLink((char*)args);
+
+ if (SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId))
+ Aura::TryRefreshStackOrCreate(spellInfo, MAX_EFFECT_MASK, target, target);
+
+ return true;
+ }
+
+ static bool HandleUnAuraCommand(ChatHandler* handler, char const* args)
+ {
+ Unit* target = handler->getSelectedUnit();
+ if (!target)
+ {
+ handler->SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ std::string argstr = args;
+ if (argstr == "all")
+ {
+ target->RemoveAllAuras();
+ return true;
+ }
+
+ // number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r or Htalent form
+ uint32 spellId = handler->extractSpellIdFromLink((char*)args);
+ if (!spellId)
+ return false;
+
+ target->RemoveAurasDueToSpell(spellId);
+
+ return true;
+ }
+ // Teleport to Player
+ static bool HandleAppearCommand(ChatHandler* handler, char const* args)
+ {
+ Player* target;
+ uint64 targetGuid;
+ std::string targetName;
+ if (!handler->extractPlayerTarget((char*)args, &target, &targetGuid, &targetName))
+ return false;
+
+ Player* _player = handler->GetSession()->GetPlayer();
+ if (target == _player || targetGuid == _player->GetGUID())
+ {
+ handler->SendSysMessage(LANG_CANT_TELEPORT_SELF);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ if (target)
+ {
+ // check online security
+ if (handler->HasLowerSecurity(target, 0))
+ return false;
+
+ std::string chrNameLink = handler->playerLink(targetName);
+
+ Map* map = target->GetMap();
+ if (map->IsBattlegroundOrArena())
+ {
+ // only allow if gm mode is on
+ if (!_player->isGameMaster())
+ {
+ handler->PSendSysMessage(LANG_CANNOT_GO_TO_BG_GM, chrNameLink.c_str());
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+ // if both players are in different bgs
+ else if (_player->GetBattlegroundId() && _player->GetBattlegroundId() != target->GetBattlegroundId())
+ _player->LeaveBattleground(false); // Note: should be changed so _player gets no Deserter debuff
+
+ // all's well, set bg id
+ // when porting out from the bg, it will be reset to 0
+ _player->SetBattlegroundId(target->GetBattlegroundId(), target->GetBattlegroundTypeId());
+ // remember current position as entry point for return at bg end teleportation
+ if (!_player->GetMap()->IsBattlegroundOrArena())
+ _player->SetBattlegroundEntryPoint();
+ }
+ else if (map->IsDungeon())
+ {
+ // we have to go to instance, and can go to player only if:
+ // 1) we are in his group (either as leader or as member)
+ // 2) we are not bound to any group and have GM mode on
+ if (_player->GetGroup())
+ {
+ // we are in group, we can go only if we are in the player group
+ if (_player->GetGroup() != target->GetGroup())
+ {
+ handler->PSendSysMessage(LANG_CANNOT_GO_TO_INST_PARTY, chrNameLink.c_str());
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+ }
+ else
+ {
+ // we are not in group, let's verify our GM mode
+ if (!_player->isGameMaster())
+ {
+ handler->PSendSysMessage(LANG_CANNOT_GO_TO_INST_GM, chrNameLink.c_str());
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+ }
+
+ // if the player or the player's group is bound to another instance
+ // the player will not be bound to another one
+ InstancePlayerBind* bind = _player->GetBoundInstance(target->GetMapId(), target->GetDifficulty(map->IsRaid()));
+ if (!bind)
+ {
+ Group* group = _player->GetGroup();
+ // if no bind exists, create a solo bind
+ InstanceGroupBind* gBind = group ? group->GetBoundInstance(target) : NULL; // if no bind exists, create a solo bind
+ if (!gBind)
+ if (InstanceSave* save = sInstanceSaveMgr->GetInstanceSave(target->GetInstanceId()))
+ _player->BindToInstance(save, !save->CanReset());
+ }
+
+ if (map->IsRaid())
+ _player->SetRaidDifficulty(target->GetRaidDifficulty());
+ else
+ _player->SetDungeonDifficulty(target->GetDungeonDifficulty());
+ }
+
+ handler->PSendSysMessage(LANG_APPEARING_AT, chrNameLink.c_str());
+
+ // stop flight if need
+ if (_player->isInFlight())
+ {
+ _player->GetMotionMaster()->MovementExpired();
+ _player->CleanupAfterTaxiFlight();
+ }
+ // save only in non-flight case
+ else
+ _player->SaveRecallPosition();
+
+ // to point to see at target with same orientation
+ float x, y, z;
+ target->GetContactPoint(_player, x, y, z);
+
+ _player->TeleportTo(target->GetMapId(), x, y, z, _player->GetAngle(target), TELE_TO_GM_MODE);
+ _player->SetPhaseMask(target->GetPhaseMask(), true);
+ }
+ else
+ {
+ // check offline security
+ if (handler->HasLowerSecurity(NULL, targetGuid))
+ return false;
+
+ std::string nameLink = handler->playerLink(targetName);
+
+ handler->PSendSysMessage(LANG_APPEARING_AT, nameLink.c_str());
+
+ // to point where player stay (if loaded)
+ float x, y, z, o;
+ uint32 map;
+ bool in_flight;
+ if (!Player::LoadPositionFromDB(map, x, y, z, o, in_flight, targetGuid))
+ return false;
+
+ // stop flight if need
+ if (_player->isInFlight())
+ {
+ _player->GetMotionMaster()->MovementExpired();
+ _player->CleanupAfterTaxiFlight();
+ }
+ // save only in non-flight case
+ else
+ _player->SaveRecallPosition();
+
+ _player->TeleportTo(map, x, y, z, _player->GetOrientation());
+ }
+
+ return true;
+ }
+ // Summon Player
+ static bool HandleSummonCommand(ChatHandler* handler, char const* args)
+ {
+ Player* target;
+ uint64 targetGuid;
+ std::string targetName;
+ if (!handler->extractPlayerTarget((char*)args, &target, &targetGuid, &targetName))
+ return false;
+
+ Player* _player = handler->GetSession()->GetPlayer();
+ if (target == _player || targetGuid == _player->GetGUID())
+ {
+ handler->PSendSysMessage(LANG_CANT_TELEPORT_SELF);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ if (target)
+ {
+ std::string nameLink = handler->playerLink(targetName);
+ // check online security
+ if (handler->HasLowerSecurity(target, 0))
+ return false;
+
+ if (target->IsBeingTeleported())
+ {
+ handler->PSendSysMessage(LANG_IS_TELEPORTED, nameLink.c_str());
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ Map* map = handler->GetSession()->GetPlayer()->GetMap();
+
+ if (map->IsBattlegroundOrArena())
+ {
+ // only allow if gm mode is on
+ if (!_player->isGameMaster())
+ {
+ handler->PSendSysMessage(LANG_CANNOT_GO_TO_BG_GM, nameLink.c_str());
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+ // if both players are in different bgs
+ else if (target->GetBattlegroundId() && handler->GetSession()->GetPlayer()->GetBattlegroundId() != target->GetBattlegroundId())
+ target->LeaveBattleground(false); // Note: should be changed so target gets no Deserter debuff
+
+ // all's well, set bg id
+ // when porting out from the bg, it will be reset to 0
+ target->SetBattlegroundId(handler->GetSession()->GetPlayer()->GetBattlegroundId(), handler->GetSession()->GetPlayer()->GetBattlegroundTypeId());
+ // remember current position as entry point for return at bg end teleportation
+ if (!target->GetMap()->IsBattlegroundOrArena())
+ target->SetBattlegroundEntryPoint();
+ }
+ else if (map->IsDungeon())
+ {
+ Map* map = target->GetMap();
+
+ if (map->Instanceable() && map->GetInstanceId() != map->GetInstanceId())
+ target->UnbindInstance(map->GetInstanceId(), target->GetDungeonDifficulty(), true);
+
+ // we are in instance, and can summon only player in our group with us as lead
+ if (!handler->GetSession()->GetPlayer()->GetGroup() || !target->GetGroup() ||
+ (target->GetGroup()->GetLeaderGUID() != handler->GetSession()->GetPlayer()->GetGUID()) ||
+ (handler->GetSession()->GetPlayer()->GetGroup()->GetLeaderGUID() != handler->GetSession()->GetPlayer()->GetGUID()))
+ // the last check is a bit excessive, but let it be, just in case
+ {
+ handler->PSendSysMessage(LANG_CANNOT_SUMMON_TO_INST, nameLink.c_str());
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+ }
+
+ handler->PSendSysMessage(LANG_SUMMONING, nameLink.c_str(), "");
+ if (handler->needReportToTarget(target))
+ ChatHandler(target).PSendSysMessage(LANG_SUMMONED_BY, handler->playerLink(_player->GetName()).c_str());
+
+ // stop flight if need
+ if (target->isInFlight())
+ {
+ target->GetMotionMaster()->MovementExpired();
+ target->CleanupAfterTaxiFlight();
+ }
+ // save only in non-flight case
+ else
+ target->SaveRecallPosition();
+
+ // before GM
+ float x, y, z;
+ handler->GetSession()->GetPlayer()->GetClosePoint(x, y, z, target->GetObjectSize());
+ target->TeleportTo(handler->GetSession()->GetPlayer()->GetMapId(), x, y, z, target->GetOrientation());
+ target->SetPhaseMask(handler->GetSession()->GetPlayer()->GetPhaseMask(), true);
+ }
+ else
+ {
+ // check offline security
+ if (handler->HasLowerSecurity(NULL, targetGuid))
+ return false;
+
+ std::string nameLink = handler->playerLink(targetName);
+
+ handler->PSendSysMessage(LANG_SUMMONING, nameLink.c_str(), handler->GetTrinityString(LANG_OFFLINE));
+
+ // in point where GM stay
+ Player::SavePositionInDB(handler->GetSession()->GetPlayer()->GetMapId(),
+ handler->GetSession()->GetPlayer()->GetPositionX(),
+ handler->GetSession()->GetPlayer()->GetPositionY(),
+ handler->GetSession()->GetPlayer()->GetPositionZ(),
+ handler->GetSession()->GetPlayer()->GetOrientation(),
+ handler->GetSession()->GetPlayer()->GetZoneId(),
+ targetGuid);
+ }
+
+ return true;
+ }
+ // Summon group of player
+ static bool HandleGroupSummonCommand(ChatHandler* handler, char const* args)
+ {
+ Player* target;
+ if (!handler->extractPlayerTarget((char*)args, &target))
+ return false;
+
+ // check online security
+ if (handler->HasLowerSecurity(target, 0))
+ return false;
+
+ Group* group = target->GetGroup();
+
+ std::string nameLink = handler->GetNameLink(target);
+
+ if (!group)
+ {
+ handler->PSendSysMessage(LANG_NOT_IN_GROUP, nameLink.c_str());
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ Map* gmMap = handler->GetSession()->GetPlayer()->GetMap();
+ bool toInstance = gmMap->Instanceable();
+
+ // we are in instance, and can summon only player in our group with us as lead
+ if (toInstance && (
+ !handler->GetSession()->GetPlayer()->GetGroup() || (group->GetLeaderGUID() != handler->GetSession()->GetPlayer()->GetGUID()) ||
+ (handler->GetSession()->GetPlayer()->GetGroup()->GetLeaderGUID() != handler->GetSession()->GetPlayer()->GetGUID())))
+ // the last check is a bit excessive, but let it be, just in case
+ {
+ handler->SendSysMessage(LANG_CANNOT_SUMMON_TO_INST);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ for (GroupReference* itr = group->GetFirstMember(); itr != NULL; itr = itr->next())
+ {
+ Player* player = itr->getSource();
+
+ if (!player || player == handler->GetSession()->GetPlayer() || !player->GetSession())
+ continue;
+
+ // check online security
+ if (handler->HasLowerSecurity(player, 0))
+ return false;
+
+ std::string plNameLink = handler->GetNameLink(player);
+
+ if (player->IsBeingTeleported() == true)
+ {
+ handler->PSendSysMessage(LANG_IS_TELEPORTED, plNameLink.c_str());
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ if (toInstance)
+ {
+ Map* playerMap = player->GetMap();
+
+ if (playerMap->Instanceable() && playerMap->GetInstanceId() != gmMap->GetInstanceId())
+ {
+ // cannot summon from instance to instance
+ handler->PSendSysMessage(LANG_CANNOT_SUMMON_TO_INST, plNameLink.c_str());
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+ }
+
+ handler->PSendSysMessage(LANG_SUMMONING, plNameLink.c_str(), "");
+ if (handler->needReportToTarget(player))
+ ChatHandler(player).PSendSysMessage(LANG_SUMMONED_BY, handler->GetNameLink().c_str());
+
+ // stop flight if need
+ if (player->isInFlight())
+ {
+ player->GetMotionMaster()->MovementExpired();
+ player->CleanupAfterTaxiFlight();
+ }
+ // save only in non-flight case
+ else
+ player->SaveRecallPosition();
+
+ // before GM
+ float x, y, z;
+ handler->GetSession()->GetPlayer()->GetClosePoint(x, y, z, player->GetObjectSize());
+ player->TeleportTo(handler->GetSession()->GetPlayer()->GetMapId(), x, y, z, player->GetOrientation());
+ }
+
+ return true;
+ }
+
+ static bool HandleCommandsCommand(ChatHandler* handler, char const* /*args*/)
+ {
+ handler->ShowHelpForCommand(handler->getCommandTable(), "");
+ return true;
+ }
+
+ static bool HandleDieCommand(ChatHandler* handler, char const* /*args*/)
+ {
+ Unit* target = handler->getSelectedUnit();
+
+ if (!target || !handler->GetSession()->GetPlayer()->GetSelection())
+ {
+ handler->SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ if (target->GetTypeId() == TYPEID_PLAYER)
+ {
+ if (handler->HasLowerSecurity((Player*)target, 0, false))
+ return false;
+ }
+
+ if (target->isAlive())
+ {
+ if (sWorld->getBoolConfig(CONFIG_DIE_COMMAND_MODE))
+ handler->GetSession()->GetPlayer()->Kill(target);
+ else
+ handler->GetSession()->GetPlayer()->DealDamage(target, target->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
+ }
+
+ return true;
+ }
+
+ static bool HandleReviveCommand(ChatHandler* handler, char const* args)
+ {
+ Player* target;
+ uint64 targetGuid;
+ if (!handler->extractPlayerTarget((char*)args, &target, &targetGuid))
+ return false;
+
+ if (target)
+ {
+ target->ResurrectPlayer(!AccountMgr::IsPlayerAccount(target->GetSession()->GetSecurity()) ? 1.0f : 0.5f);
+ target->SpawnCorpseBones();
+ target->SaveToDB();
+ }
+ else
+ // will resurrected at login without corpse
+ sObjectAccessor->ConvertCorpseForPlayer(targetGuid);
+
+ return true;
+ }
+
+ static bool HandleDismountCommand(ChatHandler* handler, char const* /*args*/)
+ {
+ Player* player = handler->GetSession()->GetPlayer();
+
+ // If player is not mounted, so go out :)
+ if (!player->IsMounted())
+ {
+ handler->SendSysMessage(LANG_CHAR_NON_MOUNTED);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ if (player->isInFlight())
+ {
+ handler->SendSysMessage(LANG_YOU_IN_FLIGHT);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ player->Dismount();
+ player->RemoveAurasByType(SPELL_AURA_MOUNTED);
+ return true;
+ }
+
+ static bool HandleGUIDCommand(ChatHandler* handler, char const* /*args*/)
+ {
+ uint64 guid = handler->GetSession()->GetPlayer()->GetSelection();
+
+ if (guid == 0)
+ {
+ handler->SendSysMessage(LANG_NO_SELECTION);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ handler->PSendSysMessage(LANG_OBJECT_GUID, GUID_LOPART(guid), GUID_HIPART(guid));
+ return true;
+ }
+
+ static bool HandleHelpCommand(ChatHandler* handler, char const* args)
+ {
+ char const* cmd = strtok((char*)args, " ");
+ if (!cmd)
+ {
+ handler->ShowHelpForCommand(handler->getCommandTable(), "help");
+ handler->ShowHelpForCommand(handler->getCommandTable(), "");
+ }
+ else
+ {
+ if (!handler->ShowHelpForCommand(handler->getCommandTable(), cmd))
+ handler->SendSysMessage(LANG_NO_HELP_CMD);
+ }
+
+ return true;
+ }
+ // move item to other slot
+ static bool HandleItemMoveCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ char const* param1 = strtok((char*)args, " ");
+ if (!param1)
+ return false;
+
+ char const* param2 = strtok(NULL, " ");
+ if (!param2)
+ return false;
+
+ uint8 srcSlot = uint8(atoi(param1));
+ uint8 dstSlot = uint8(atoi(param2));
+
+ if (srcSlot == dstSlot)
+ return true;
+
+ if (!handler->GetSession()->GetPlayer()->IsValidPos(INVENTORY_SLOT_BAG_0, srcSlot, true))
+ return false;
+
+ if (!handler->GetSession()->GetPlayer()->IsValidPos(INVENTORY_SLOT_BAG_0, dstSlot, false))
+ return false;
+
+ uint16 src = ((INVENTORY_SLOT_BAG_0 << 8) | srcSlot);
+ uint16 dst = ((INVENTORY_SLOT_BAG_0 << 8) | dstSlot);
+
+ handler->GetSession()->GetPlayer()->SwapItem(src, dst);
+
+ return true;
+ }
+
+ static bool HandleCooldownCommand(ChatHandler* handler, char const* args)
+ {
+ Player* target = handler->getSelectedPlayer();
+ if (!target)
+ {
+ handler->SendSysMessage(LANG_PLAYER_NOT_FOUND);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ std::string nameLink = handler->GetNameLink(target);
+
+ if (!*args)
+ {
+ target->RemoveAllSpellCooldown();
+ handler->PSendSysMessage(LANG_REMOVEALL_COOLDOWN, nameLink.c_str());
+ }
+ else
+ {
+ // number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r or Htalent form
+ uint32 spellIid = handler->extractSpellIdFromLink((char*)args);
+ if (!spellIid)
+ return false;
+
+ if (!sSpellMgr->GetSpellInfo(spellIid))
+ {
+ handler->PSendSysMessage(LANG_UNKNOWN_SPELL, target == handler->GetSession()->GetPlayer() ? handler->GetTrinityString(LANG_YOU) : nameLink.c_str());
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ target->RemoveSpellCooldown(spellIid, true);
+ handler->PSendSysMessage(LANG_REMOVE_COOLDOWN, spellIid, target == handler->GetSession()->GetPlayer() ? handler->GetTrinityString(LANG_YOU) : nameLink.c_str());
+ }
+ return true;
+ }
+
+ static bool HandleGetDistanceCommand(ChatHandler* handler, char const* args)
+ {
+ WorldObject* obj = NULL;
+
+ if (*args)
+ {
+ uint64 guid = handler->extractGuidFromLink((char*)args);
+ if (guid)
+ obj = (WorldObject*)ObjectAccessor::GetObjectByTypeMask(*handler->GetSession()->GetPlayer(), guid, TYPEMASK_UNIT|TYPEMASK_GAMEOBJECT);
+
+ if (!obj)
+ {
+ handler->SendSysMessage(LANG_PLAYER_NOT_FOUND);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+ }
+ else
+ {
+ obj = handler->getSelectedUnit();
+
+ if (!obj)
+ {
+ handler->SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+ }
+
+ handler->PSendSysMessage(LANG_DISTANCE, handler->GetSession()->GetPlayer()->GetDistance(obj), handler->GetSession()->GetPlayer()->GetDistance2d(obj), handler->GetSession()->GetPlayer()->GetExactDist(obj), handler->GetSession()->GetPlayer()->GetExactDist2d(obj));
+ return true;
+ }
+ // Teleport player to last position
+ static bool HandleRecallCommand(ChatHandler* handler, char const* args)
+ {
+ Player* target;
+ if (!handler->extractPlayerTarget((char*)args, &target))
+ return false;
+
+ // check online security
+ if (handler->HasLowerSecurity(target, 0))
+ return false;
+
+ if (target->IsBeingTeleported())
+ {
+ handler->PSendSysMessage(LANG_IS_TELEPORTED, handler->GetNameLink(target).c_str());
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ // stop flight if need
+ if (target->isInFlight())
+ {
+ target->GetMotionMaster()->MovementExpired();
+ target->CleanupAfterTaxiFlight();
+ }
+
+ target->TeleportTo(target->m_recallMap, target->m_recallX, target->m_recallY, target->m_recallZ, target->m_recallO);
+ return true;
+ }
+
+ static bool HandleSaveCommand(ChatHandler* handler, char const* /*args*/)
+ {
+ Player* player = handler->GetSession()->GetPlayer();
+
+ // save GM account without delay and output message
+ if (!AccountMgr::IsPlayerAccount(handler->GetSession()->GetSecurity()))
+ {
+ if (Player* target = handler->getSelectedPlayer())
+ target->SaveToDB();
+ else
+ player->SaveToDB();
+ handler->SendSysMessage(LANG_PLAYER_SAVED);
+ return true;
+ }
+
+ // save if the player has last been saved over 20 seconds ago
+ uint32 saveInterval = sWorld->getIntConfig(CONFIG_INTERVAL_SAVE);
+ if (saveInterval == 0 || (saveInterval > 20 * IN_MILLISECONDS && player->GetSaveTimer() <= saveInterval - 20 * IN_MILLISECONDS))
+ player->SaveToDB();
+
+ return true;
+ }
+
+ // Save all players in the world
+ static bool HandleSaveAllCommand(ChatHandler* handler, char const* /*args*/)
+ {
+ sObjectAccessor->SaveAllPlayers();
+ handler->SendSysMessage(LANG_PLAYERS_SAVED);
+ return true;
+ }
+
+ // kick player
+ static bool HandleKickPlayerCommand(ChatHandler* handler, char const* args)
+ {
+ Player* target = NULL;
+ std::string playerName;
+ if (!handler->extractPlayerTarget((char*)args, &target, NULL, &playerName))
+ return false;
+
+ if (handler->GetSession() && target == handler->GetSession()->GetPlayer())
+ {
+ handler->SendSysMessage(LANG_COMMAND_KICKSELF);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ // check online security
+ if (handler->HasLowerSecurity(target, 0))
+ return false;
+
+ if (sWorld->getBoolConfig(CONFIG_SHOW_KICK_IN_WORLD))
+ sWorld->SendWorldText(LANG_COMMAND_KICKMESSAGE, playerName.c_str());
+ else
+ handler->PSendSysMessage(LANG_COMMAND_KICKMESSAGE, playerName.c_str());
+
+ target->GetSession()->KickPlayer();
+
+ return true;
+ }
+
+ static bool HandleStartCommand(ChatHandler* handler, char const* /*args*/)
+ {
+ Player* player = handler->GetSession()->GetPlayer();
+
+ if (player->isInFlight())
+ {
+ handler->SendSysMessage(LANG_YOU_IN_FLIGHT);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ if (player->isInCombat())
+ {
+ handler->SendSysMessage(LANG_YOU_IN_COMBAT);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ if (player->isDead() || player->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_GHOST))
+ {
+ // if player is dead and stuck, send ghost to graveyard
+ player->RepopAtGraveyard();
+ return true;
+ }
+
+ // cast spell Stuck
+ player->CastSpell(player, 7355, false);
+ return true;
+ }
+ // Enable on\off all taxi paths
+ static bool HandleTaxiCheatCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ {
+ handler->SendSysMessage(LANG_USE_BOL);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ std::string argStr = (char*)args;
+
+ Player* chr = handler->getSelectedPlayer();
+
+ if (!chr)
+ chr = handler->GetSession()->GetPlayer();
+ else if (handler->HasLowerSecurity(chr, 0)) // check online security
+ return false;
+
+ if (argStr == "on")
+ {
+ chr->SetTaxiCheater(true);
+ handler->PSendSysMessage(LANG_YOU_GIVE_TAXIS, handler->GetNameLink(chr).c_str());
+ if (handler->needReportToTarget(chr))
+ ChatHandler(chr).PSendSysMessage(LANG_YOURS_TAXIS_ADDED, handler->GetNameLink().c_str());
+ return true;
+ }
+
+ if (argStr == "off")
+ {
+ chr->SetTaxiCheater(false);
+ handler->PSendSysMessage(LANG_YOU_REMOVE_TAXIS, handler->GetNameLink(chr).c_str());
+ if (handler->needReportToTarget(chr))
+ ChatHandler(chr).PSendSysMessage(LANG_YOURS_TAXIS_REMOVED, handler->GetNameLink().c_str());
+
+ return true;
+ }
+
+ handler->SendSysMessage(LANG_USE_BOL);
+ handler->SetSentErrorMessage(true);
+
+ return false;
+ }
+
+ static bool HandleLinkGraveCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ char* px = strtok((char*)args, " ");
+ if (!px)
+ return false;
+
+ uint32 graveyardId = uint32(atoi(px));
+
+ uint32 team;
+
+ char* px2 = strtok(NULL, " ");
+
+ if (!px2)
+ team = 0;
+ else if (strncmp(px2, "horde", 6) == 0)
+ team = HORDE;
+ else if (strncmp(px2, "alliance", 9) == 0)
+ team = ALLIANCE;
+ else
+ return false;
+
+ WorldSafeLocsEntry const* graveyard = sWorldSafeLocsStore.LookupEntry(graveyardId);
+
+ if (!graveyard)
+ {
+ handler->PSendSysMessage(LANG_COMMAND_GRAVEYARDNOEXIST, graveyardId);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ Player* player = handler->GetSession()->GetPlayer();
+
+ uint32 zoneId = player->GetZoneId();
+
+ AreaTableEntry const* areaEntry = GetAreaEntryByAreaID(zoneId);
+ if (!areaEntry || areaEntry->zone !=0)
+ {
+ handler->PSendSysMessage(LANG_COMMAND_GRAVEYARDWRONGZONE, graveyardId, zoneId);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ if (sObjectMgr->AddGraveYardLink(graveyardId, zoneId, team))
+ handler->PSendSysMessage(LANG_COMMAND_GRAVEYARDLINKED, graveyardId, zoneId);
+ else
+ handler->PSendSysMessage(LANG_COMMAND_GRAVEYARDALRLINKED, graveyardId, zoneId);
+
+ return true;
+ }
+
+ static bool HandleNearGraveCommand(ChatHandler* handler, char const* args)
+ {
+ uint32 team;
+
+ size_t argStr = strlen(args);
+
+ if (!*args)
+ team = 0;
+ else if (strncmp((char*)args, "horde", argStr) == 0)
+ team = HORDE;
+ else if (strncmp((char*)args, "alliance", argStr) == 0)
+ team = ALLIANCE;
+ else
+ return false;
+
+ Player* player = handler->GetSession()->GetPlayer();
+ uint32 zone_id = player->GetZoneId();
+
+ WorldSafeLocsEntry const* graveyard = sObjectMgr->GetClosestGraveYard(
+ player->GetPositionX(), player->GetPositionY(), player->GetPositionZ(), player->GetMapId(), team);
+
+ if (graveyard)
+ {
+ uint32 graveyardId = graveyard->ID;
+
+ GraveYardData const* data = sObjectMgr->FindGraveYardData(graveyardId, zone_id);
+ if (!data)
+ {
+ handler->PSendSysMessage(LANG_COMMAND_GRAVEYARDERROR, graveyardId);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ team = data->team;
+
+ std::string team_name = handler->GetTrinityString(LANG_COMMAND_GRAVEYARD_NOTEAM);
+
+ if (team == 0)
+ team_name = handler->GetTrinityString(LANG_COMMAND_GRAVEYARD_ANY);
+ else if (team == HORDE)
+ team_name = handler->GetTrinityString(LANG_COMMAND_GRAVEYARD_HORDE);
+ else if (team == ALLIANCE)
+ team_name = handler->GetTrinityString(LANG_COMMAND_GRAVEYARD_ALLIANCE);
+
+ handler->PSendSysMessage(LANG_COMMAND_GRAVEYARDNEAREST, graveyardId, team_name.c_str(), zone_id);
+ }
+ else
+ {
+ std::string team_name;
+
+ if (team == 0)
+ team_name = handler->GetTrinityString(LANG_COMMAND_GRAVEYARD_ANY);
+ else if (team == HORDE)
+ team_name = handler->GetTrinityString(LANG_COMMAND_GRAVEYARD_HORDE);
+ else if (team == ALLIANCE)
+ team_name = handler->GetTrinityString(LANG_COMMAND_GRAVEYARD_ALLIANCE);
+
+ if (team == ~uint32(0))
+ handler->PSendSysMessage(LANG_COMMAND_ZONENOGRAVEYARDS, zone_id);
+ else
+ handler->PSendSysMessage(LANG_COMMAND_ZONENOGRAFACTION, zone_id, team_name.c_str());
+ }
+
+ return true;
+ }
+
+ static bool HandleExploreCheatCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ int32 flag = int32(atoi((char*)args));
+
+ Player* playerTarget = handler->getSelectedPlayer();
+ if (!playerTarget)
+ {
+ handler->SendSysMessage(LANG_NO_CHAR_SELECTED);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ if (flag != 0)
+ {
+ handler->PSendSysMessage(LANG_YOU_SET_EXPLORE_ALL, handler->GetNameLink(playerTarget).c_str());
+ if (handler->needReportToTarget(playerTarget))
+ ChatHandler(playerTarget).PSendSysMessage(LANG_YOURS_EXPLORE_SET_ALL, handler->GetNameLink().c_str());
+ }
+ else
+ {
+ handler->PSendSysMessage(LANG_YOU_SET_EXPLORE_NOTHING, handler->GetNameLink(playerTarget).c_str());
+ if (handler->needReportToTarget(playerTarget))
+ ChatHandler(playerTarget).PSendSysMessage(LANG_YOURS_EXPLORE_SET_NOTHING, handler->GetNameLink().c_str());
+ }
+
+ for (uint8 i = 0; i < PLAYER_EXPLORED_ZONES_SIZE; ++i)
+ {
+ if (flag != 0)
+ handler->GetSession()->GetPlayer()->SetFlag(PLAYER_EXPLORED_ZONES_1+i, 0xFFFFFFFF);
+ else
+ handler->GetSession()->GetPlayer()->SetFlag(PLAYER_EXPLORED_ZONES_1+i, 0);
+ }
+
+ return true;
+ }
+
+ static bool HandleShowAreaCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ Player* playerTarget = handler->getSelectedPlayer();
+ if (!playerTarget)
+ {
+ handler->SendSysMessage(LANG_NO_CHAR_SELECTED);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ int32 area = GetAreaFlagByAreaID(atoi((char*)args));
+ int32 offset = area / 32;
+ uint32 val = uint32((1 << (area % 32)));
+
+ if (area<0 || offset >= PLAYER_EXPLORED_ZONES_SIZE)
+ {
+ handler->SendSysMessage(LANG_BAD_VALUE);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ uint32 currFields = playerTarget->GetUInt32Value(PLAYER_EXPLORED_ZONES_1 + offset);
+ playerTarget->SetUInt32Value(PLAYER_EXPLORED_ZONES_1 + offset, uint32((currFields | val)));
+
+ handler->SendSysMessage(LANG_EXPLORE_AREA);
+ return true;
+ }
+
+ static bool HandleHideAreaCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ Player* playerTarget = handler->getSelectedPlayer();
+ if (!playerTarget)
+ {
+ handler->SendSysMessage(LANG_NO_CHAR_SELECTED);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ int32 area = GetAreaFlagByAreaID(atoi((char*)args));
+ int32 offset = area / 32;
+ uint32 val = uint32((1 << (area % 32)));
+
+ if (area < 0 || offset >= PLAYER_EXPLORED_ZONES_SIZE)
+ {
+ handler->SendSysMessage(LANG_BAD_VALUE);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ uint32 currFields = playerTarget->GetUInt32Value(PLAYER_EXPLORED_ZONES_1 + offset);
+ playerTarget->SetUInt32Value(PLAYER_EXPLORED_ZONES_1 + offset, uint32((currFields ^ val)));
+
+ handler->SendSysMessage(LANG_UNEXPLORE_AREA);
+ return true;
+ }
+
+ static bool HandleAddItemCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ uint32 itemId = 0;
+
+ if (args[0] == '[') // [name] manual form
+ {
+ char const* itemNameStr = strtok((char*)args, "]");
+
+ if (itemNameStr && itemNameStr[0])
+ {
+ std::string itemName = itemNameStr+1;
+ WorldDatabase.EscapeString(itemName);
+
+ PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_SEL_ITEM_TEMPLATE_BY_NAME);
+ stmt->setString(0, itemName);
+ PreparedQueryResult result = WorldDatabase.Query(stmt);
+
+ if (!result)
+ {
+ handler->PSendSysMessage(LANG_COMMAND_COULDNOTFIND, itemNameStr+1);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+ itemId = result->Fetch()->GetUInt32();
+ }
+ else
+ return false;
+ }
+ else // item_id or [name] Shift-click form |color|Hitem:item_id:0:0:0|h[name]|h|r
+ {
+ char const* id = handler->extractKeyFromLink((char*)args, "Hitem");
+ if (!id)
+ return false;
+ itemId = uint32(atol(id));
+ }
+
+ char const* ccount = strtok(NULL, " ");
+
+ int32 count = 1;
+
+ if (ccount)
+ count = strtol(ccount, NULL, 10);
+
+ if (count == 0)
+ count = 1;
+
+ Player* player = handler->GetSession()->GetPlayer();
+ Player* playerTarget = handler->getSelectedPlayer();
+ if (!playerTarget)
+ playerTarget = player;
+
+ sLog->outDebug(LOG_FILTER_GENERAL, handler->GetTrinityString(LANG_ADDITEM), itemId, count);
+
+ ItemTemplate const* itemTemplate = sObjectMgr->GetItemTemplate(itemId);
+ if (!itemTemplate)
+ {
+ handler->PSendSysMessage(LANG_COMMAND_ITEMIDINVALID, itemId);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ // Subtract
+ if (count < 0)
+ {
+ playerTarget->DestroyItemCount(itemId, -count, true, false);
+ handler->PSendSysMessage(LANG_REMOVEITEM, itemId, -count, handler->GetNameLink(playerTarget).c_str());
+ return true;
+ }
+
+ // Adding items
+ uint32 noSpaceForCount = 0;
+
+ // check space and find places
+ ItemPosCountVec dest;
+ InventoryResult msg = playerTarget->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, itemId, count, &noSpaceForCount);
+ if (msg != EQUIP_ERR_OK) // convert to possible store amount
+ count -= noSpaceForCount;
+
+ if (count == 0 || dest.empty()) // can't add any
+ {
+ handler->PSendSysMessage(LANG_ITEM_CANNOT_CREATE, itemId, noSpaceForCount);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ Item* item = playerTarget->StoreNewItem(dest, itemId, true, Item::GenerateItemRandomPropertyId(itemId));
+
+ // remove binding (let GM give it to another player later)
+ if (player == playerTarget)
+ for (ItemPosCountVec::const_iterator itr = dest.begin(); itr != dest.end(); ++itr)
+ if (Item* item1 = player->GetItemByPos(itr->pos))
+ item1->SetBinding(false);
+
+ if (count > 0 && item)
+ {
+ player->SendNewItem(item, count, false, true);
+ if (player != playerTarget)
+ playerTarget->SendNewItem(item, count, true, false);
+ }
+
+ if (noSpaceForCount > 0)
+ handler->PSendSysMessage(LANG_ITEM_CANNOT_CREATE, itemId, noSpaceForCount);
+
+ return true;
+ }
+
+ static bool HandleAddItemSetCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ char const* id = handler->extractKeyFromLink((char*)args, "Hitemset"); // number or [name] Shift-click form |color|Hitemset:itemset_id|h[name]|h|r
+ if (!id)
+ return false;
+
+ uint32 itemSetId = atol(id);
+
+ // prevent generation all items with itemset field value '0'
+ if (itemSetId == 0)
+ {
+ handler->PSendSysMessage(LANG_NO_ITEMS_FROM_ITEMSET_FOUND, itemSetId);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ Player* player = handler->GetSession()->GetPlayer();
+ Player* playerTarget = handler->getSelectedPlayer();
+ if (!playerTarget)
+ playerTarget = player;
+
+ sLog->outDebug(LOG_FILTER_GENERAL, handler->GetTrinityString(LANG_ADDITEMSET), itemSetId);
+
+ bool found = false;
+ ItemTemplateContainer const* its = sObjectMgr->GetItemTemplateStore();
+ for (ItemTemplateContainer::const_iterator itr = its->begin(); itr != its->end(); ++itr)
+ {
+ if (itr->second.ItemSet == itemSetId)
+ {
+ found = true;
+ ItemPosCountVec dest;
+ InventoryResult msg = playerTarget->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, itr->second.ItemId, 1);
+ if (msg == EQUIP_ERR_OK)
+ {
+ Item* item = playerTarget->StoreNewItem(dest, itr->second.ItemId, true);
+
+ // remove binding (let GM give it to another player later)
+ if (player == playerTarget)
+ item->SetBinding(false);
+
+ player->SendNewItem(item, 1, false, true);
+ if (player != playerTarget)
+ playerTarget->SendNewItem(item, 1, true, false);
+ }
+ else
+ {
+ player->SendEquipError(msg, NULL, NULL, itr->second.ItemId);
+ handler->PSendSysMessage(LANG_ITEM_CANNOT_CREATE, itr->second.ItemId, 1);
+ }
+ }
+ }
+
+ if (!found)
+ {
+ handler->PSendSysMessage(LANG_NO_ITEMS_FROM_ITEMSET_FOUND, itemSetId);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ return true;
+ }
+
+ static bool HandleBankCommand(ChatHandler* handler, char const* /*args*/)
+ {
+ handler->GetSession()->SendShowBank(handler->GetSession()->GetPlayer()->GetGUID());
+ return true;
+ }
+
+ static bool HandleChangeWeather(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ // Weather is OFF
+ if (!sWorld->getBoolConfig(CONFIG_WEATHER))
+ {
+ handler->SendSysMessage(LANG_WEATHER_DISABLED);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ // *Change the weather of a cell
+ char const* px = strtok((char*)args, " ");
+ char const* py = strtok(NULL, " ");
+
+ if (!px || !py)
+ return false;
+
+ uint32 type = uint32(atoi(px)); //0 to 3, 0: fine, 1: rain, 2: snow, 3: sand
+ float grade = float(atof(py)); //0 to 1, sending -1 is instand good weather
+
+ Player* player = handler->GetSession()->GetPlayer();
+ uint32 zoneid = player->GetZoneId();
+
+ Weather* weather = WeatherMgr::FindWeather(zoneid);
+
+ if (!weather)
+ weather = WeatherMgr::AddWeather(zoneid);
+ if (!weather)
+ {
+ handler->SendSysMessage(LANG_NO_WEATHER);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ weather->SetWeather(WeatherType(type), grade);
+
+ return true;
+ }
+
+
+ static bool HandleMaxSkillCommand(ChatHandler* handler, char const* /*args*/)
+ {
+ Player* SelectedPlayer = handler->getSelectedPlayer();
+ if (!SelectedPlayer)
+ {
+ handler->SendSysMessage(LANG_NO_CHAR_SELECTED);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ // each skills that have max skill value dependent from level seted to current level max skill value
+ SelectedPlayer->UpdateSkillsToMaxSkillsForLevel();
+ return true;
+ }
+
+ static bool HandleSetSkillCommand(ChatHandler* handler, char const* args)
+ {
+ // number or [name] Shift-click form |color|Hskill:skill_id|h[name]|h|r
+ char const* skillStr = handler->extractKeyFromLink((char*)args, "Hskill");
+ if (!skillStr)
+ return false;
+
+ char const* levelStr = strtok(NULL, " ");
+ if (!levelStr)
+ return false;
+
+ char const* maxPureSkill = strtok(NULL, " ");
+
+ int32 skill = atoi(skillStr);
+ if (skill <= 0)
+ {
+ handler->PSendSysMessage(LANG_INVALID_SKILL_ID, skill);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ int32 level = uint32(atol(levelStr));
+
+ Player* target = handler->getSelectedPlayer();
+ if (!target)
+ {
+ handler->SendSysMessage(LANG_NO_CHAR_SELECTED);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ SkillLineEntry const* skillLine = sSkillLineStore.LookupEntry(skill);
+ if (!skillLine)
+ {
+ handler->PSendSysMessage(LANG_INVALID_SKILL_ID, skill);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ std::string tNameLink = handler->GetNameLink(target);
+
+ if (!target->GetSkillValue(skill))
+ {
+ handler->PSendSysMessage(LANG_SET_SKILL_ERROR, tNameLink.c_str(), skill, skillLine->name[handler->GetSessionDbcLocale()]);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ uint16 max = maxPureSkill ? atol (maxPureSkill) : target->GetPureMaxSkillValue(skill);
+
+ if (level <= 0 || level > max || max <= 0)
+ return false;
+
+ target->SetSkill(skill, target->GetSkillStep(skill), level, max);
+ handler->PSendSysMessage(LANG_SET_SKILL, skill, skillLine->name[handler->GetSessionDbcLocale()], tNameLink.c_str(), level, max);
+
+ return true;
+ }
+ // show info of player
+ static bool HandlePInfoCommand(ChatHandler* handler, char const* args)
+ {
+ Player* target;
+ uint64 targetGuid;
+ std::string targetName;
+
+ uint32 parseGUID = MAKE_NEW_GUID(atol((char*)args), 0, HIGHGUID_PLAYER);
+
+ if (sObjectMgr->GetPlayerNameByGUID(parseGUID, targetName))
+ {
+ target = sObjectMgr->GetPlayerByLowGUID(parseGUID);
+ targetGuid = parseGUID;
+ }
+ else if (!handler->extractPlayerTarget((char*)args, &target, &targetGuid, &targetName))
+ return false;
+
+ uint32 accId = 0;
+ uint32 money = 0;
+ uint32 totalPlayerTime = 0;
+ uint8 level = 0;
+ uint32 latency = 0;
+ uint8 race;
+ uint8 Class;
+ int64 muteTime = 0;
+ int64 banTime = -1;
+ uint32 mapId;
+ uint32 areaId;
+ uint32 phase = 0;
+
+ // get additional information from Player object
+ if (target)
+ {
+ // check online security
+ if (handler->HasLowerSecurity(target, 0))
+ return false;
+
+ accId = target->GetSession()->GetAccountId();
+ money = target->GetMoney();
+ totalPlayerTime = target->GetTotalPlayedTime();
+ level = target->getLevel();
+ latency = target->GetSession()->GetLatency();
+ race = target->getRace();
+ Class = target->getClass();
+ muteTime = target->GetSession()->m_muteTime;
+ mapId = target->GetMapId();
+ areaId = target->GetAreaId();
+ phase = target->GetPhaseMask();
+ }
+ // get additional information from DB
+ else
+ {
+ // check offline security
+ if (handler->HasLowerSecurity(NULL, targetGuid))
+ return false;
+
+ PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_PINFO);
+ stmt->setUInt32(0, GUID_LOPART(targetGuid));
+ PreparedQueryResult result = CharacterDatabase.Query(stmt);
+
+ if (!result)
+ return false;
+
+ Field* fields = result->Fetch();
+ totalPlayerTime = fields[0].GetUInt32();
+ level = fields[1].GetUInt8();
+ money = fields[2].GetUInt32();
+ accId = fields[3].GetUInt32();
+ race = fields[4].GetUInt8();
+ Class = fields[5].GetUInt8();
+ mapId = fields[6].GetUInt16();
+ areaId = fields[7].GetUInt16();
+ }
+
+ std::string userName = handler->GetTrinityString(LANG_ERROR);
+ std::string eMail = handler->GetTrinityString(LANG_ERROR);
+ std::string lastIp = handler->GetTrinityString(LANG_ERROR);
+ uint32 security = 0;
+ std::string lastLogin = handler->GetTrinityString(LANG_ERROR);
+
+ PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_PINFO);
+ stmt->setInt32(0, int32(realmID));
+ stmt->setUInt32(1, accId);
+ PreparedQueryResult result = LoginDatabase.Query(stmt);
+
+ if (result)
+ {
+ Field* fields = result->Fetch();
+ userName = fields[0].GetString();
+ security = fields[1].GetUInt8();
+ eMail = fields[2].GetString();
+ muteTime = fields[5].GetUInt64();
+
+ if (eMail.empty())
+ eMail = "-";
+
+ if (!handler->GetSession() || handler->GetSession()->GetSecurity() >= AccountTypes(security))
+ {
+ lastIp = fields[3].GetString();
+ lastLogin = fields[4].GetString();
+
+ uint32 ip = inet_addr(lastIp.c_str());
+#if TRINITY_ENDIAN == BIGENDIAN
+ EndianConvertReverse(ip);
+#endif
+
+ PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_SEL_IP2NATION_COUNTRY);
+
+ stmt->setUInt32(0, ip);
+
+ PreparedQueryResult result2 = WorldDatabase.Query(stmt);
+
+ if (result2)
+ {
+ Field* fields2 = result2->Fetch();
+ lastIp.append(" (");
+ lastIp.append(fields2[0].GetString());
+ lastIp.append(")");
+ }
+ }
+ else
+ {
+ lastIp = "-";
+ lastLogin = "-";
+ }
+ }
+
+ std::string nameLink = handler->playerLink(targetName);
+
+ handler->PSendSysMessage(LANG_PINFO_ACCOUNT, (target ? "" : handler->GetTrinityString(LANG_OFFLINE)), nameLink.c_str(), GUID_LOPART(targetGuid), userName.c_str(), accId, eMail.c_str(), security, lastIp.c_str(), lastLogin.c_str(), latency);
+
+ std::string bannedby = "unknown";
+ std::string banreason = "";
+
+ stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_PINFO_BANS);
+ stmt->setUInt32(0, accId);
+ PreparedQueryResult result2 = LoginDatabase.Query(stmt);
+ if (!result2)
+ {
+ stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_PINFO_BANS);
+ stmt->setUInt32(0, GUID_LOPART(targetGuid));
+ result2 = CharacterDatabase.Query(stmt);
+ }
+
+ if (result2)
+ {
+ Field* fields = result2->Fetch();
+ banTime = int64(fields[1].GetBool() ? 0 : fields[0].GetUInt32());
+ bannedby = fields[2].GetString();
+ banreason = fields[3].GetString();
+ }
+
+ if (muteTime > 0)
+ handler->PSendSysMessage(LANG_PINFO_MUTE, secsToTimeString(muteTime - time(NULL), true).c_str());
+
+ if (banTime >= 0)
+ handler->PSendSysMessage(LANG_PINFO_BAN, banTime > 0 ? secsToTimeString(banTime - time(NULL), true).c_str() : "permanently", bannedby.c_str(), banreason.c_str());
+
+ std::string raceStr, ClassStr;
+ switch (race)
+ {
+ case RACE_HUMAN:
+ raceStr = "Human";
+ break;
+ case RACE_ORC:
+ raceStr = "Orc";
+ break;
+ case RACE_DWARF:
+ raceStr = "Dwarf";
+ break;
+ case RACE_NIGHTELF:
+ raceStr = "Night Elf";
+ break;
+ case RACE_UNDEAD_PLAYER:
+ raceStr = "Undead";
+ break;
+ case RACE_TAUREN:
+ raceStr = "Tauren";
+ break;
+ case RACE_GNOME:
+ raceStr = "Gnome";
+ break;
+ case RACE_TROLL:
+ raceStr = "Troll";
+ break;
+ case RACE_BLOODELF:
+ raceStr = "Blood Elf";
+ break;
+ case RACE_DRAENEI:
+ raceStr = "Draenei";
+ break;
+ }
+
+ switch (Class)
+ {
+ case CLASS_WARRIOR:
+ ClassStr = "Warrior";
+ break;
+ case CLASS_PALADIN:
+ ClassStr = "Paladin";
+ break;
+ case CLASS_HUNTER:
+ ClassStr = "Hunter";
+ break;
+ case CLASS_ROGUE:
+ ClassStr = "Rogue";
+ break;
+ case CLASS_PRIEST:
+ ClassStr = "Priest";
+ break;
+ case CLASS_DEATH_KNIGHT:
+ ClassStr = "Death Knight";
+ break;
+ case CLASS_SHAMAN:
+ ClassStr = "Shaman";
+ break;
+ case CLASS_MAGE:
+ ClassStr = "Mage";
+ break;
+ case CLASS_WARLOCK:
+ ClassStr = "Warlock";
+ break;
+ case CLASS_DRUID:
+ ClassStr = "Druid";
+ break;
+ }
+
+ std::string timeStr = secsToTimeString(totalPlayerTime, true, true);
+ uint32 gold = money /GOLD;
+ uint32 silv = (money % GOLD) / SILVER;
+ uint32 copp = (money % GOLD) % SILVER;
+ handler->PSendSysMessage(LANG_PINFO_LEVEL, raceStr.c_str(), ClassStr.c_str(), timeStr.c_str(), level, gold, silv, copp);
+
+ // Add map, zone, subzone and phase to output
+ int locale = handler->GetSessionDbcLocale();
+ std::string areaName = "<unknown>";
+ std::string zoneName = "";
+
+ MapEntry const* map = sMapStore.LookupEntry(mapId);
+
+ AreaTableEntry const* area = GetAreaEntryByAreaID(areaId);
+ if (area)
+ {
+ areaName = area->area_name[locale];
+
+ AreaTableEntry const* zone = GetAreaEntryByAreaID(area->zone);
+ if (zone)
+ zoneName = zone->area_name[locale];
+ }
+
+ if (target)
+ {
+ if (!zoneName.empty())
+ handler->PSendSysMessage(LANG_PINFO_MAP_ONLINE, map->name[locale], zoneName.c_str(), areaName.c_str(), phase);
+ else
+ handler->PSendSysMessage(LANG_PINFO_MAP_ONLINE, map->name[locale], areaName.c_str(), "<unknown>", phase);
+ }
+ else
+ handler->PSendSysMessage(LANG_PINFO_MAP_OFFLINE, map->name[locale], areaName.c_str());
+
+ return true;
+ }
+
+ static bool HandleRespawnCommand(ChatHandler* handler, char const* /*args*/)
+ {
+ Player* player = handler->GetSession()->GetPlayer();
+
+ // accept only explicitly selected target (not implicitly self targeting case)
+ Unit* target = handler->getSelectedUnit();
+ if (player->GetSelection() && target)
+ {
+ if (target->GetTypeId() != TYPEID_UNIT || target->isPet())
+ {
+ handler->SendSysMessage(LANG_SELECT_CREATURE);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ if (target->isDead())
+ target->ToCreature()->Respawn();
+ return true;
+ }
+
+ CellCoord p(Trinity::ComputeCellCoord(player->GetPositionX(), player->GetPositionY()));
+ Cell cell(p);
+ cell.SetNoCreate();
+
+ Trinity::RespawnDo u_do;
+ Trinity::WorldObjectWorker<Trinity::RespawnDo> worker(player, u_do);
+
+ TypeContainerVisitor<Trinity::WorldObjectWorker<Trinity::RespawnDo>, GridTypeMapContainer > obj_worker(worker);
+ cell.Visit(p, obj_worker, *player->GetMap(), *player, player->GetGridActivationRange());
+
+ return true;
+ }
+ // mute player for some times
+ static bool HandleMuteCommand(ChatHandler* handler, char const* args)
+ {
+ char* nameStr;
+ char* delayStr;
+ handler->extractOptFirstArg((char*)args, &nameStr, &delayStr);
+ if (!delayStr)
+ return false;
+
+ char const* muteReason = strtok(NULL, "\r");
+ std::string muteReasonStr = "No reason";
+ if (muteReason != NULL)
+ muteReasonStr = muteReason;
+
+ Player* target;
+ uint64 targetGuid;
+ std::string targetName;
+ if (!handler->extractPlayerTarget(nameStr, &target, &targetGuid, &targetName))
+ return false;
+
+ uint32 accountId = target ? target->GetSession()->GetAccountId() : sObjectMgr->GetPlayerAccountIdByGUID(targetGuid);
+
+ // find only player from same account if any
+ if (!target)
+ if (WorldSession* session = sWorld->FindSession(accountId))
+ target = session->GetPlayer();
+
+ uint32 notSpeakTime = uint32(atoi(delayStr));
+
+ // must have strong lesser security level
+ if (handler->HasLowerSecurity (target, targetGuid, true))
+ return false;
+
+ PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_UPD_MUTE_TIME);
+
+ if (target)
+ {
+ // Target is online, mute will be in effect right away.
+ int64 muteTime = time(NULL) + notSpeakTime * MINUTE;
+ target->GetSession()->m_muteTime = muteTime;
+ stmt->setInt64(0, muteTime);
+ ChatHandler(target).PSendSysMessage(LANG_YOUR_CHAT_DISABLED, notSpeakTime, muteReasonStr.c_str());
+ }
+ else
+ {
+ // Target is offline, mute will be in effect starting from the next login.
+ int32 muteTime = -int32(notSpeakTime * MINUTE);
+ stmt->setInt64(0, muteTime);
+ }
+
+ stmt->setUInt32(1, accountId);
+ LoginDatabase.Execute(stmt);
+ std::string nameLink = handler->playerLink(targetName);
+
+ handler->PSendSysMessage(target ? LANG_YOU_DISABLE_CHAT : LANG_COMMAND_DISABLE_CHAT_DELAYED, nameLink.c_str(), notSpeakTime, muteReasonStr.c_str());
+
+ return true;
+ }
+
+ // unmute player
+ static bool HandleUnmuteCommand(ChatHandler* handler, char const* args)
+ {
+ Player* target;
+ uint64 targetGuid;
+ std::string targetName;
+ if (!handler->extractPlayerTarget((char*)args, &target, &targetGuid, &targetName))
+ return false;
+
+ uint32 accountId = target ? target->GetSession()->GetAccountId() : sObjectMgr->GetPlayerAccountIdByGUID(targetGuid);
+
+ // find only player from same account if any
+ if (!target)
+ if (WorldSession* session = sWorld->FindSession(accountId))
+ target = session->GetPlayer();
+
+ // must have strong lesser security level
+ if (handler->HasLowerSecurity (target, targetGuid, true))
+ return false;
+
+ if (target)
+ {
+ if (target->CanSpeak())
+ {
+ handler->SendSysMessage(LANG_CHAT_ALREADY_ENABLED);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ target->GetSession()->m_muteTime = 0;
+ }
+
+ PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_UPD_MUTE_TIME);
+ stmt->setInt64(0, 0);
+ stmt->setUInt32(1, accountId);
+ LoginDatabase.Execute(stmt);
+
+ if (target)
+ ChatHandler(target).PSendSysMessage(LANG_YOUR_CHAT_ENABLED);
+
+ std::string nameLink = handler->playerLink(targetName);
+
+ handler->PSendSysMessage(LANG_YOU_ENABLE_CHAT, nameLink.c_str());
+
+ return true;
+ }
+
+
+ static bool HandleMovegensCommand(ChatHandler* handler, char const* /*args*/)
+ {
+ Unit* unit = handler->getSelectedUnit();
+ if (!unit)
+ {
+ handler->SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ handler->PSendSysMessage(LANG_MOVEGENS_LIST, (unit->GetTypeId() == TYPEID_PLAYER ? "Player" : "Creature"), unit->GetGUIDLow());
+
+ MotionMaster* motionMaster = unit->GetMotionMaster();
+ float x, y, z;
+ motionMaster->GetDestination(x, y, z);
+
+ for (uint8 i = 0; i < MAX_MOTION_SLOT; ++i)
+ {
+ MovementGenerator* movementGenerator = motionMaster->GetMotionSlot(i);
+ if (!movementGenerator)
+ {
+ handler->SendSysMessage("Empty");
+ continue;
+ }
+
+ switch (movementGenerator->GetMovementGeneratorType())
+ {
+ case IDLE_MOTION_TYPE:
+ handler->SendSysMessage(LANG_MOVEGENS_IDLE);
+ break;
+ case RANDOM_MOTION_TYPE:
+ handler->SendSysMessage(LANG_MOVEGENS_RANDOM);
+ break;
+ case WAYPOINT_MOTION_TYPE:
+ handler->SendSysMessage(LANG_MOVEGENS_WAYPOINT);
+ break;
+ case ANIMAL_RANDOM_MOTION_TYPE:
+ handler->SendSysMessage(LANG_MOVEGENS_ANIMAL_RANDOM);
+ break;
+ case CONFUSED_MOTION_TYPE:
+ handler->SendSysMessage(LANG_MOVEGENS_CONFUSED);
+ break;
+ case CHASE_MOTION_TYPE:
+ {
+ Unit* target = NULL;
+ if (unit->GetTypeId() == TYPEID_PLAYER)
+ target = static_cast<ChaseMovementGenerator<Player> const*>(movementGenerator)->GetTarget();
+ else
+ target = static_cast<ChaseMovementGenerator<Creature> const*>(movementGenerator)->GetTarget();
+
+ if (!target)
+ handler->SendSysMessage(LANG_MOVEGENS_CHASE_NULL);
+ else if (target->GetTypeId() == TYPEID_PLAYER)
+ handler->PSendSysMessage(LANG_MOVEGENS_CHASE_PLAYER, target->GetName(), target->GetGUIDLow());
+ else
+ handler->PSendSysMessage(LANG_MOVEGENS_CHASE_CREATURE, target->GetName(), target->GetGUIDLow());
+ break;
+ }
+ case FOLLOW_MOTION_TYPE:
+ {
+ Unit* target = NULL;
+ if (unit->GetTypeId() == TYPEID_PLAYER)
+ target = static_cast<FollowMovementGenerator<Player> const*>(movementGenerator)->GetTarget();
+ else
+ target = static_cast<FollowMovementGenerator<Creature> const*>(movementGenerator)->GetTarget();
+
+ if (!target)
+ handler->SendSysMessage(LANG_MOVEGENS_FOLLOW_NULL);
+ else if (target->GetTypeId() == TYPEID_PLAYER)
+ handler->PSendSysMessage(LANG_MOVEGENS_FOLLOW_PLAYER, target->GetName(), target->GetGUIDLow());
+ else
+ handler->PSendSysMessage(LANG_MOVEGENS_FOLLOW_CREATURE, target->GetName(), target->GetGUIDLow());
+ break;
+ }
+ case HOME_MOTION_TYPE:
+ {
+ if (unit->GetTypeId() == TYPEID_UNIT)
+ handler->PSendSysMessage(LANG_MOVEGENS_HOME_CREATURE, x, y, z);
+ else
+ handler->SendSysMessage(LANG_MOVEGENS_HOME_PLAYER);
+ break;
+ }
+ case FLIGHT_MOTION_TYPE:
+ handler->SendSysMessage(LANG_MOVEGENS_FLIGHT);
+ break;
+ case POINT_MOTION_TYPE:
+ {
+ handler->PSendSysMessage(LANG_MOVEGENS_POINT, x, y, z);
+ break;
+ }
+ case FLEEING_MOTION_TYPE:
+ handler->SendSysMessage(LANG_MOVEGENS_FEAR);
+ break;
+ case DISTRACT_MOTION_TYPE:
+ handler->SendSysMessage(LANG_MOVEGENS_DISTRACT);
+ break;
+ case EFFECT_MOTION_TYPE:
+ handler->SendSysMessage(LANG_MOVEGENS_EFFECT);
+ break;
+ default:
+ handler->PSendSysMessage(LANG_MOVEGENS_UNKNOWN, movementGenerator->GetMovementGeneratorType());
+ break;
+ }
+ }
+ return true;
+ }
+ /*
+ ComeToMe command REQUIRED for 3rd party scripting library to have access to PointMovementGenerator
+ Without this function 3rd party scripting library will get linking errors (unresolved external)
+ when attempting to use the PointMovementGenerator
+ */
+ static bool HandleComeToMeCommand(ChatHandler* handler, char const* args)
+ {
+ char const* newFlagStr = strtok((char*)args, " ");
+ if (!newFlagStr)
+ return false;
+
+ Creature* caster = handler->getSelectedCreature();
+ if (!caster)
+ {
+ handler->SendSysMessage(LANG_SELECT_CREATURE);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ Player* player = handler->GetSession()->GetPlayer();
+
+ caster->GetMotionMaster()->MovePoint(0, player->GetPositionX(), player->GetPositionY(), player->GetPositionZ());
+
+ return true;
+ }
+
+ static bool HandleDamageCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ Unit* target = handler->getSelectedUnit();
+ if (!target || !handler->GetSession()->GetPlayer()->GetSelection())
+ {
+ handler->SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ if (target->GetTypeId() == TYPEID_PLAYER)
+ {
+ if (handler->HasLowerSecurity((Player*)target, 0, false))
+ return false;
+ }
+
+ if (!target->isAlive())
+ return true;
+
+ char* damageStr = strtok((char*)args, " ");
+ if (!damageStr)
+ return false;
+
+ int32 damage_int = atoi((char*)damageStr);
+ if (damage_int <= 0)
+ return true;
+
+ uint32 damage = damage_int;
+
+ char* schoolStr = strtok((char*)NULL, " ");
+
+ // flat melee damage without resistence/etc reduction
+ if (!schoolStr)
+ {
+ handler->GetSession()->GetPlayer()->DealDamage(target, damage, NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
+ if (target != handler->GetSession()->GetPlayer())
+ handler->GetSession()->GetPlayer()->SendAttackStateUpdate (HITINFO_AFFECTS_VICTIM, target, 1, SPELL_SCHOOL_MASK_NORMAL, damage, 0, 0, VICTIMSTATE_HIT, 0);
+ return true;
+ }
+
+ uint32 school = schoolStr ? atoi((char*)schoolStr) : SPELL_SCHOOL_NORMAL;
+ if (school >= MAX_SPELL_SCHOOL)
+ return false;
+
+ SpellSchoolMask schoolmask = SpellSchoolMask(1 << school);
+
+ if (Unit::IsDamageReducedByArmor(schoolmask))
+ damage = handler->GetSession()->GetPlayer()->CalcArmorReducedDamage(target, damage, NULL, BASE_ATTACK);
+
+ char* spellStr = strtok((char*)NULL, " ");
+
+ // melee damage by specific school
+ if (!spellStr)
+ {
+ uint32 absorb = 0;
+ uint32 resist = 0;
+
+ handler->GetSession()->GetPlayer()->CalcAbsorbResist(target, schoolmask, SPELL_DIRECT_DAMAGE, damage, &absorb, &resist);
+
+ if (damage <= absorb + resist)
+ return true;
+
+ damage -= absorb + resist;
+
+ handler->GetSession()->GetPlayer()->DealDamageMods(target, damage, &absorb);
+ handler->GetSession()->GetPlayer()->DealDamage(target, damage, NULL, DIRECT_DAMAGE, schoolmask, NULL, false);
+ handler->GetSession()->GetPlayer()->SendAttackStateUpdate (HITINFO_AFFECTS_VICTIM, target, 1, schoolmask, damage, absorb, resist, VICTIMSTATE_HIT, 0);
+ return true;
+ }
+
+ // non-melee damage
+
+ // number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r or Htalent form
+ uint32 spellid = handler->extractSpellIdFromLink((char*)args);
+ if (!spellid || !sSpellMgr->GetSpellInfo(spellid))
+ return false;
+
+ handler->GetSession()->GetPlayer()->SpellNonMeleeDamageLog(target, spellid, damage);
+ return true;
+ }
+
+ static bool HandleCombatStopCommand(ChatHandler* handler, char const* args)
+ {
+ Player* target = NULL;
+
+ if (args && strlen(args) > 0)
+ {
+ target = sObjectAccessor->FindPlayerByName(args);
+ if (!target)
+ {
+ handler->SendSysMessage(LANG_PLAYER_NOT_FOUND);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+ }
+
+ if (!target)
+ {
+ if (!handler->extractPlayerTarget((char*)args, &target))
+ return false;
+ }
+
+ // check online security
+ if (handler->HasLowerSecurity(target, 0))
+ return false;
+
+ target->CombatStop();
+ target->getHostileRefManager().deleteReferences();
+ return true;
+ }
+
+ static bool HandleFlushArenaPointsCommand(ChatHandler* /*handler*/, char const* /*args*/)
+ {
+ sArenaTeamMgr->DistributeArenaPoints();
+ return true;
+ }
+
+ static bool HandleRepairitemsCommand(ChatHandler* handler, char const* args)
+ {
+ Player* target;
+ if (!handler->extractPlayerTarget((char*)args, &target))
+ return false;
+
+ // check online security
+ if (handler->HasLowerSecurity(target, 0))
+ return false;
+
+ // Repair items
+ target->DurabilityRepairAll(false, 0, false);
+
+ handler->PSendSysMessage(LANG_YOU_REPAIR_ITEMS, handler->GetNameLink(target).c_str());
+ if (handler->needReportToTarget(target))
+ ChatHandler(target).PSendSysMessage(LANG_YOUR_ITEMS_REPAIRED, handler->GetNameLink().c_str());
+
+ return true;
+ }
+
+ static bool HandleWaterwalkCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ Player* player = handler->getSelectedPlayer();
+ if (!player)
+ {
+ handler->PSendSysMessage(LANG_NO_CHAR_SELECTED);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ // check online security
+ if (handler->HasLowerSecurity(player, 0))
+ return false;
+
+ if (strncmp(args, "on", 3) == 0)
+ player->SendMovementSetWaterWalking(true);
+ else if (strncmp(args, "off", 4) == 0)
+ player->SendMovementSetWaterWalking(false);
+ else
+ {
+ handler->SendSysMessage(LANG_USE_BOL);
+ return false;
+ }
+
+ handler->PSendSysMessage(LANG_YOU_SET_WATERWALK, args, handler->GetNameLink(player).c_str());
+ if (handler->needReportToTarget(player))
+ ChatHandler(player).PSendSysMessage(LANG_YOUR_WATERWALK_SET, args, handler->GetNameLink().c_str());
+ return true;
+ }
+
+ // Send mail by command
+ static bool HandleSendMailCommand(ChatHandler* handler, char const* args)
+ {
+ // format: name "subject text" "mail text"
+ Player* target;
+ uint64 targetGuid;
+ std::string targetName;
+ if (!handler->extractPlayerTarget((char*)args, &target, &targetGuid, &targetName))
+ return false;
+
+ char* tail1 = strtok(NULL, "");
+ if (!tail1)
+ return false;
+
+ char const* msgSubject = handler->extractQuotedArg(tail1);
+ if (!msgSubject)
+ return false;
+
+ char* tail2 = strtok(NULL, "");
+ if (!tail2)
+ return false;
+
+ char const* msgText = handler->extractQuotedArg(tail2);
+ if (!msgText)
+ return false;
+
+ // msgSubject, msgText isn't NUL after prev. check
+ std::string subject = msgSubject;
+ std::string text = msgText;
+
+ // from console show not existed sender
+ MailSender sender(MAIL_NORMAL, handler->GetSession() ? handler->GetSession()->GetPlayer()->GetGUIDLow() : 0, MAIL_STATIONERY_GM);
+
+ //- TODO: Fix poor design
+ SQLTransaction trans = CharacterDatabase.BeginTransaction();
+ MailDraft(subject, text)
+ .SendMailTo(trans, MailReceiver(target, GUID_LOPART(targetGuid)), sender);
+
+ CharacterDatabase.CommitTransaction(trans);
+
+ std::string nameLink = handler->playerLink(targetName);
+ handler->PSendSysMessage(LANG_MAIL_SENT, nameLink.c_str());
+ return true;
+ }
+ // Send items by mail
+ static bool HandleSendItemsCommand(ChatHandler* handler, char const* args)
+ {
+ // format: name "subject text" "mail text" item1[:count1] item2[:count2] ... item12[:count12]
+ Player* receiver;
+ uint64 receiverGuid;
+ std::string receiverName;
+ if (!handler->extractPlayerTarget((char*)args, &receiver, &receiverGuid, &receiverName))
+ return false;
+
+ char* tail1 = strtok(NULL, "");
+ if (!tail1)
+ return false;
+
+ char const* msgSubject = handler->extractQuotedArg(tail1);
+ if (!msgSubject)
+ return false;
+
+ char* tail2 = strtok(NULL, "");
+ if (!tail2)
+ return false;
+
+ char const* msgText = handler->extractQuotedArg(tail2);
+ if (!msgText)
+ return false;
+
+ // msgSubject, msgText isn't NUL after prev. check
+ std::string subject = msgSubject;
+ std::string text = msgText;
+
+ // extract items
+ typedef std::pair<uint32, uint32> ItemPair;
+ typedef std::list< ItemPair > ItemPairs;
+ ItemPairs items;
+
+ // get all tail string
+ char* tail = strtok(NULL, "");
+
+ // get from tail next item str
+ while (char* itemStr = strtok(tail, " "))
+ {
+ // and get new tail
+ tail = strtok(NULL, "");
+
+ // parse item str
+ char const* itemIdStr = strtok(itemStr, ":");
+ char const* itemCountStr = strtok(NULL, " ");
+
+ uint32 itemId = atoi(itemIdStr);
+ if (!itemId)
+ return false;
+
+ ItemTemplate const* item_proto = sObjectMgr->GetItemTemplate(itemId);
+ if (!item_proto)
+ {
+ handler->PSendSysMessage(LANG_COMMAND_ITEMIDINVALID, itemId);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ uint32 itemCount = itemCountStr ? atoi(itemCountStr) : 1;
+ if (itemCount < 1 || (item_proto->MaxCount > 0 && itemCount > uint32(item_proto->MaxCount)))
+ {
+ handler->PSendSysMessage(LANG_COMMAND_INVALID_ITEM_COUNT, itemCount, itemId);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ while (itemCount > item_proto->GetMaxStackSize())
+ {
+ items.push_back(ItemPair(itemId, item_proto->GetMaxStackSize()));
+ itemCount -= item_proto->GetMaxStackSize();
+ }
+
+ items.push_back(ItemPair(itemId, itemCount));
+
+ if (items.size() > MAX_MAIL_ITEMS)
+ {
+ handler->PSendSysMessage(LANG_COMMAND_MAIL_ITEMS_LIMIT, MAX_MAIL_ITEMS);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+ }
+
+ // from console show not existed sender
+ MailSender sender(MAIL_NORMAL, handler->GetSession() ? handler->GetSession()->GetPlayer()->GetGUIDLow() : 0, MAIL_STATIONERY_GM);
+
+ // fill mail
+ MailDraft draft(subject, text);
+
+ SQLTransaction trans = CharacterDatabase.BeginTransaction();
+
+ for (ItemPairs::const_iterator itr = items.begin(); itr != items.end(); ++itr)
+ {
+ if (Item* item = Item::CreateItem(itr->first, itr->second, handler->GetSession() ? handler->GetSession()->GetPlayer() : 0))
+ {
+ item->SaveToDB(trans); // save for prevent lost at next mail load, if send fail then item will deleted
+ draft.AddItem(item);
+ }
+ }
+
+ draft.SendMailTo(trans, MailReceiver(receiver, GUID_LOPART(receiverGuid)), sender);
+ CharacterDatabase.CommitTransaction(trans);
+
+ std::string nameLink = handler->playerLink(receiverName);
+ handler->PSendSysMessage(LANG_MAIL_SENT, nameLink.c_str());
+ return true;
+ }
+ /// Send money by mail
+ static bool HandleSendMoneyCommand(ChatHandler* handler, char const* args)
+ {
+ /// format: name "subject text" "mail text" money
+
+ Player* receiver;
+ uint64 receiverGuid;
+ std::string receiverName;
+ if (!handler->extractPlayerTarget((char*)args, &receiver, &receiverGuid, &receiverName))
+ return false;
+
+ char* tail1 = strtok(NULL, "");
+ if (!tail1)
+ return false;
+
+ char* msgSubject = handler->extractQuotedArg(tail1);
+ if (!msgSubject)
+ return false;
+
+ char* tail2 = strtok(NULL, "");
+ if (!tail2)
+ return false;
+
+ char* msgText = handler->extractQuotedArg(tail2);
+ if (!msgText)
+ return false;
+
+ char* moneyStr = strtok(NULL, "");
+ int32 money = moneyStr ? atoi(moneyStr) : 0;
+ if (money <= 0)
+ return false;
+
+ // msgSubject, msgText isn't NUL after prev. check
+ std::string subject = msgSubject;
+ std::string text = msgText;
+
+ // from console show not existed sender
+ MailSender sender(MAIL_NORMAL, handler->GetSession() ? handler->GetSession()->GetPlayer()->GetGUIDLow() : 0, MAIL_STATIONERY_GM);
+
+ SQLTransaction trans = CharacterDatabase.BeginTransaction();
+
+ MailDraft(subject, text)
+ .AddMoney(money)
+ .SendMailTo(trans, MailReceiver(receiver, GUID_LOPART(receiverGuid)), sender);
+
+ CharacterDatabase.CommitTransaction(trans);
+
+ std::string nameLink = handler->playerLink(receiverName);
+ handler->PSendSysMessage(LANG_MAIL_SENT, nameLink.c_str());
+ return true;
+ }
+ /// Send a message to a player in game
+ static bool HandleSendMessageCommand(ChatHandler* handler, char const* args)
+ {
+ /// - Find the player
+ Player* player;
+ if (!handler->extractPlayerTarget((char*)args, &player))
+ return false;
+
+ char* msgStr = strtok(NULL, "");
+ if (!msgStr)
+ return false;
+
+ ///- Check that he is not logging out.
+ if (player->GetSession()->isLogingOut())
+ {
+ handler->SendSysMessage(LANG_PLAYER_NOT_FOUND);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ /// - Send the message
+ // Use SendAreaTriggerMessage for fastest delivery.
+ player->GetSession()->SendAreaTriggerMessage("%s", msgStr);
+ player->GetSession()->SendAreaTriggerMessage("|cffff0000[Message from administrator]:|r");
+
+ // Confirmation message
+ std::string nameLink = handler->GetNameLink(player);
+ handler->PSendSysMessage(LANG_SENDMESSAGE, nameLink.c_str(), msgStr);
+
+ return true;
+ }
+
+ static bool HandleCreatePetCommand(ChatHandler* handler, char const* /*args*/)
+ {
+ Player* player = handler->GetSession()->GetPlayer();
+ Creature* creatureTarget = handler->getSelectedCreature();
+
+ if (!creatureTarget || creatureTarget->isPet() || creatureTarget->GetTypeId() == TYPEID_PLAYER)
+ {
+ handler->PSendSysMessage(LANG_SELECT_CREATURE);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ CreatureTemplate const* creatrueTemplate = sObjectMgr->GetCreatureTemplate(creatureTarget->GetEntry());
+ // Creatures with family 0 crashes the server
+ if (!creatrueTemplate->family)
+ {
+ handler->PSendSysMessage("This creature cannot be tamed. (family id: 0).");
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ if (player->GetPetGUID())
+ {
+ handler->PSendSysMessage("You already have a pet");
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ // Everything looks OK, create new pet
+ Pet* pet = new Pet(player, HUNTER_PET);
+ if (!pet->CreateBaseAtCreature(creatureTarget))
+ {
+ delete pet;
+ handler->PSendSysMessage("Error 1");
+ return false;
+ }
+
+ creatureTarget->setDeathState(JUST_DIED);
+ creatureTarget->RemoveCorpse();
+ creatureTarget->SetHealth(0); // just for nice GM-mode view
+
+ pet->SetUInt64Value(UNIT_FIELD_CREATEDBY, player->GetGUID());
+ pet->SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE, player->getFaction());
+
+ if (!pet->InitStatsForLevel(creatureTarget->getLevel()))
+ {
+ sLog->outError(LOG_FILTER_GENERAL, "InitStatsForLevel() in EffectTameCreature failed! Pet deleted.");
+ handler->PSendSysMessage("Error 2");
+ delete pet;
+ return false;
+ }
+
+ // prepare visual effect for levelup
+ pet->SetUInt32Value(UNIT_FIELD_LEVEL, creatureTarget->getLevel()-1);
+
+ pet->GetCharmInfo()->SetPetNumber(sObjectMgr->GeneratePetNumber(), true);
+ // this enables pet details window (Shift+P)
+ pet->InitPetCreateSpells();
+ pet->SetFullHealth();
+
+ pet->GetMap()->AddToMap(pet->ToCreature());
+
+ // visual effect for levelup
+ pet->SetUInt32Value(UNIT_FIELD_LEVEL, creatureTarget->getLevel());
+
+ player->SetMinion(pet, true);
+ pet->SavePetToDB(PET_SAVE_AS_CURRENT);
+ player->PetSpellInitialize();
+
+ return true;
+ }
+
+ static bool HandlePetLearnCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ Player* player = handler->GetSession()->GetPlayer();
+ Pet* pet = player->GetPet();
+
+ if (!pet)
+ {
+ handler->PSendSysMessage("You have no pet");
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ uint32 spellId = handler->extractSpellIdFromLink((char*)args);
+
+ if (!spellId || !sSpellMgr->GetSpellInfo(spellId))
+ return false;
+
+ // Check if pet already has it
+ if (pet->HasSpell(spellId))
+ {
+ handler->PSendSysMessage("Pet already has spell: %u", spellId);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ // Check if spell is valid
+ SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId);
+ if (!spellInfo || !SpellMgr::IsSpellValid(spellInfo))
+ {
+ handler->PSendSysMessage(LANG_COMMAND_SPELL_BROKEN, spellId);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ pet->learnSpell(spellId);
+
+ handler->PSendSysMessage("Pet has learned spell %u", spellId);
+ return true;
+ }
+
+ static bool HandlePetUnlearnCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ Player* player = handler->GetSession()->GetPlayer();
+ Pet* pet = player->GetPet();
+ if (!pet)
+ {
+ handler->PSendSysMessage("You have no pet");
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ uint32 spellId = handler->extractSpellIdFromLink((char*)args);
+
+ if (pet->HasSpell(spellId))
+ pet->removeSpell(spellId, false);
+ else
+ handler->PSendSysMessage("Pet doesn't have that spell");
+
+ return true;
+ }
+
+ static bool HandleFreezeCommand(ChatHandler* handler, char const* args)
+ {
+ std::string name;
+ Player* player;
+ char const* TargetName = strtok((char*)args, " "); // get entered name
+ if (!TargetName) // if no name entered use target
+ {
+ player = handler->getSelectedPlayer();
+ if (player) //prevent crash with creature as target
+ {
+ name = player->GetName();
+ normalizePlayerName(name);
+ }
+ }
+ else // if name entered
+ {
+ name = TargetName;
+ normalizePlayerName(name);
+ player = sObjectAccessor->FindPlayerByName(name.c_str());
+ }
+
+ if (!player)
+ {
+ handler->SendSysMessage(LANG_COMMAND_FREEZE_WRONG);
+ return true;
+ }
+
+ if (player == handler->GetSession()->GetPlayer())
+ {
+ handler->SendSysMessage(LANG_COMMAND_FREEZE_ERROR);
+ return true;
+ }
+
+ // effect
+ if (player && (player != handler->GetSession()->GetPlayer()))
+ {
+ handler->PSendSysMessage(LANG_COMMAND_FREEZE, name.c_str());
+
+ // stop combat + make player unattackable + duel stop + stop some spells
+ player->setFaction(35);
+ player->CombatStop();
+ if (player->IsNonMeleeSpellCasted(true))
+ player->InterruptNonMeleeSpells(true);
+ player->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
+
+ // if player class = hunter || warlock remove pet if alive
+ if ((player->getClass() == CLASS_HUNTER) || (player->getClass() == CLASS_WARLOCK))
+ {
+ if (Pet* pet = player->GetPet())
+ {
+ pet->SavePetToDB(PET_SAVE_AS_CURRENT);
+ // not let dismiss dead pet
+ if (pet && pet->isAlive())
+ player->RemovePet(pet, PET_SAVE_NOT_IN_SLOT);
+ }
+ }
+
+ if (SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(9454))
+ Aura::TryRefreshStackOrCreate(spellInfo, MAX_EFFECT_MASK, player, player);
+
+ // save player
+ player->SaveToDB();
+ }
+
+ return true;
+ }
+
+ static bool HandleUnFreezeCommand(ChatHandler* handler, char const*args)
+ {
+ std::string name;
+ Player* player;
+ char* targetName = strtok((char*)args, " "); // Get entered name
+
+ if (targetName)
+ {
+ name = targetName;
+ normalizePlayerName(name);
+ player = sObjectAccessor->FindPlayerByName(name.c_str());
+ }
+ else // If no name was entered - use target
+ {
+ player = handler->getSelectedPlayer();
+ if (player)
+ name = player->GetName();
+ }
+
+ if (player)
+ {
+ handler->PSendSysMessage(LANG_COMMAND_UNFREEZE, name.c_str());
+
+ // Reset player faction + allow combat + allow duels
+ player->setFactionForRace(player->getRace());
+ player->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
+
+ // Remove Freeze spell (allowing movement and spells)
+ player->RemoveAurasDueToSpell(9454);
+
+ // Save player
+ player->SaveToDB();
+ }
+ else
+ {
+ if (targetName)
+ {
+ // Check for offline players
+ PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_GUID_BY_NAME);
+ stmt->setString(0, name);
+ PreparedQueryResult result = CharacterDatabase.Query(stmt);
+
+ if (!result)
+ {
+ handler->SendSysMessage(LANG_COMMAND_FREEZE_WRONG);
+ return true;
+ }
+
+ // If player found: delete his freeze aura
+ Field* fields = result->Fetch();
+ uint32 lowGuid = fields[0].GetUInt32();
+
+ stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_AURA_FROZEN);
+ stmt->setUInt32(0, lowGuid);
+ CharacterDatabase.Execute(stmt);
+
+ handler->PSendSysMessage(LANG_COMMAND_UNFREEZE, name.c_str());
+ return true;
+ }
+ else
+ {
+ handler->SendSysMessage(LANG_COMMAND_FREEZE_WRONG);
+ return true;
+ }
+ }
+
+ return true;
+ }
+
+ static bool HandleListFreezeCommand(ChatHandler* handler, char const* /*args*/)
+ {
+ // Get names from DB
+ PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER_AURA_FROZEN);
+ PreparedQueryResult result = CharacterDatabase.Query(stmt);
+ if (!result)
+ {
+ handler->SendSysMessage(LANG_COMMAND_NO_FROZEN_PLAYERS);
+ return true;
+ }
+
+ // Header of the names
+ handler->PSendSysMessage(LANG_COMMAND_LIST_FREEZE);
+
+ // Output of the results
+ do
+ {
+ Field* fields = result->Fetch();
+ std::string player = fields[0].GetString();
+ handler->PSendSysMessage(LANG_COMMAND_FROZEN_PLAYERS, player.c_str());
+ }
+ while (result->NextRow());
+
+ return true;
+ }
+
+ static bool HandleGroupLeaderCommand(ChatHandler* handler, char const* args)
+ {
+ Player* player = NULL;
+ Group* group = NULL;
+ uint64 guid = 0;
+ char* nameStr = strtok((char*)args, " ");
+
+ if (handler->GetPlayerGroupAndGUIDByName(nameStr, player, group, guid))
+ if (group && group->GetLeaderGUID() != guid)
+ {
+ group->ChangeLeader(guid);
+ group->SendUpdate();
+ }
+
+ return true;
+ }
+
+ static bool HandleGroupDisbandCommand(ChatHandler* handler, char const* args)
+ {
+ Player* player = NULL;
+ Group* group = NULL;
+ uint64 guid = 0;
+ char* nameStr = strtok((char*)args, " ");
+
+ if (handler->GetPlayerGroupAndGUIDByName(nameStr, player, group, guid))
+ if (group)
+ group->Disband();
+
+ return true;
+ }
+
+ static bool HandleGroupRemoveCommand(ChatHandler* handler, char const* args)
+ {
+ Player* player = NULL;
+ Group* group = NULL;
+ uint64 guid = 0;
+ char* nameStr = strtok((char*)args, " ");
+
+ if (handler->GetPlayerGroupAndGUIDByName(nameStr, player, group, guid, true))
+ if (group)
+ group->RemoveMember(guid);
+
+ return true;
+ }
+
+ static bool HandlePlayAllCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ uint32 soundId = atoi((char*)args);
+
+ if (!sSoundEntriesStore.LookupEntry(soundId))
+ {
+ handler->PSendSysMessage(LANG_SOUND_NOT_EXIST, soundId);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ WorldPacket data(SMSG_PLAY_SOUND, 4);
+ data << uint32(soundId) << handler->GetSession()->GetPlayer()->GetGUID();
+ sWorld->SendGlobalMessage(&data);
+
+ handler->PSendSysMessage(LANG_COMMAND_PLAYED_TO_ALL, soundId);
+ return true;
+ }
+
+ static bool HandlePossessCommand(ChatHandler* handler, char const* /*args*/)
+ {
+ Unit* unit = handler->getSelectedUnit();
+ if (!unit)
+ return false;
+
+ handler->GetSession()->GetPlayer()->CastSpell(unit, 530, true);
+ return true;
+ }
+
+ static bool HandleUnPossessCommand(ChatHandler* handler, char const* /*args*/)
+ {
+ Unit* unit = handler->getSelectedUnit();
+ if (!unit)
+ unit = handler->GetSession()->GetPlayer();
+
+ unit->RemoveCharmAuras();
+
+ return true;
+ }
+
+ static bool HandleBindSightCommand(ChatHandler* handler, char const* /*args*/)
+ {
+ Unit* unit = handler->getSelectedUnit();
+ if (!unit)
+ return false;
+
+ handler->GetSession()->GetPlayer()->CastSpell(unit, 6277, true);
+ return true;
+ }
+
+ static bool HandleUnbindSightCommand(ChatHandler* handler, char const* /*args*/)
+ {
+ Player* player = handler->GetSession()->GetPlayer();
+
+ if (player->isPossessing())
+ return false;
+
+ player->StopCastingBindSight();
+ return true;
+ }
};
void AddSC_misc_commandscript()
diff --git a/src/server/scripts/Commands/cs_modify.cpp b/src/server/scripts/Commands/cs_modify.cpp
index d7b5484ed64..dee8a52debd 100644
--- a/src/server/scripts/Commands/cs_modify.cpp
+++ b/src/server/scripts/Commands/cs_modify.cpp
@@ -199,7 +199,7 @@ public:
target->SetMaxPower(POWER_ENERGY, energym);
target->SetPower(POWER_ENERGY, energy);
- sLog->outDetail(handler->GetTrinityString(LANG_CURRENT_ENERGY), target->GetMaxPower(POWER_ENERGY));
+ sLog->outDebug(LOG_FILTER_GENERAL, handler->GetTrinityString(LANG_CURRENT_ENERGY), target->GetMaxPower(POWER_ENERGY));
return true;
}
@@ -1011,7 +1011,7 @@ public:
{
int64 newmoney = int32(moneyuser) + addmoney;
- sLog->outDetail(handler->GetTrinityString(LANG_CURRENT_MONEY), moneyuser, addmoney, newmoney);
+ sLog->outDebug(LOG_FILTER_GENERAL, handler->GetTrinityString(LANG_CURRENT_MONEY), moneyuser, addmoney, newmoney);
if (newmoney <= 0)
{
handler->PSendSysMessage(LANG_YOU_TAKE_ALL_MONEY, handler->GetNameLink(target).c_str());
@@ -1043,8 +1043,7 @@ public:
target->ModifyMoney(int64(addmoney));
}
- sLog->outDetail(handler->GetTrinityString(LANG_NEW_MONEY), moneyuser, uint32(addmoney), target->GetMoney());
-
+ sLog->outDebug(LOG_FILTER_GENERAL, handler->GetTrinityString(LANG_NEW_MONEY), moneyuser, uint32(addmoney), target->GetMoney());
return true;
}
@@ -1131,20 +1130,15 @@ public:
static bool HandleModifyDrunkCommand(ChatHandler* handler, const char* args)
{
- if (!*args) return false;
+ if (!*args)
+ return false;
- uint32 drunklevel = (uint32)atoi(args);
+ uint8 drunklevel = (uint8)atoi(args);
if (drunklevel > 100)
drunklevel = 100;
- uint16 drunkMod = drunklevel * 0xFFFF / 100;
-
- Player* target = handler->getSelectedPlayer();
- if (!target)
- target = handler->GetSession()->GetPlayer();
-
- if (target)
- target->SetDrunkValue(drunkMod);
+ if (Player* target = handler->getSelectedPlayer())
+ target->SetDrunkValue(drunklevel);
return true;
}
diff --git a/src/server/scripts/Commands/cs_npc.cpp b/src/server/scripts/Commands/cs_npc.cpp
index 832f7958fc8..77fc2918e0b 100644
--- a/src/server/scripts/Commands/cs_npc.cpp
+++ b/src/server/scripts/Commands/cs_npc.cpp
@@ -804,7 +804,7 @@ public:
if (dontdel_str)
{
- //sLog->outError("DEBUG: All 3 params are set");
+ //sLog->outError(LOG_FILTER_GENERAL, "DEBUG: All 3 params are set");
// All 3 params are set
// GUID
@@ -812,7 +812,7 @@ public:
// doNotDEL
if (stricmp(dontdel_str, "NODEL") == 0)
{
- //sLog->outError("DEBUG: doNotDelete = true;");
+ //sLog->outError(LOG_FILTER_GENERAL, "DEBUG: doNotDelete = true;");
doNotDelete = true;
}
}
@@ -821,10 +821,10 @@ public:
// Only 2 params - but maybe NODEL is set
if (type_str)
{
- sLog->outError("DEBUG: Only 2 params ");
+ sLog->outError(LOG_FILTER_GENERAL, "DEBUG: Only 2 params ");
if (stricmp(type_str, "NODEL") == 0)
{
- //sLog->outError("DEBUG: type_str, NODEL ");
+ //sLog->outError(LOG_FILTER_GENERAL, "DEBUG: type_str, NODEL ");
doNotDelete = true;
type_str = NULL;
}
diff --git a/src/server/scripts/Commands/cs_reload.cpp b/src/server/scripts/Commands/cs_reload.cpp
index db9a7bf7f53..93b450bab0f 100644
--- a/src/server/scripts/Commands/cs_reload.cpp
+++ b/src/server/scripts/Commands/cs_reload.cpp
@@ -220,7 +220,7 @@ public:
static bool HandleReloadAllLootCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading Loot Tables...");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Loot Tables...");
LoadLootTables();
handler->SendGlobalGMSysMessage("DB tables `*_loot_template` reloaded.");
sConditionMgr->LoadConditions(true);
@@ -243,7 +243,7 @@ public:
HandleReloadQuestPOICommand(handler, "a");
HandleReloadQuestTemplateCommand(handler, "a");
- sLog->outString("Re-Loading Quests Relations...");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Quests Relations...");
sObjectMgr->LoadQuestRelations();
handler->SendGlobalGMSysMessage("DB tables `*_questrelation` and `*_involvedrelation` reloaded.");
return true;
@@ -258,7 +258,7 @@ public:
return false;
}
- sLog->outString("Re-Loading Scripts...");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Scripts...");
HandleReloadGameObjectScriptsCommand(handler, "a");
HandleReloadEventScriptsCommand(handler, "a");
HandleReloadQuestEndScriptsCommand(handler, "a");
@@ -331,7 +331,7 @@ public:
static bool HandleReloadConfigCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading config settings...");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading config settings...");
sWorld->LoadConfigSettings(true);
sMapMgr->InitializeVisibilityDistanceInfo();
handler->SendGlobalGMSysMessage("World config settings reloaded.");
@@ -340,7 +340,7 @@ public:
static bool HandleReloadAccessRequirementCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading Access Requirement definitions...");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Access Requirement definitions...");
sObjectMgr->LoadAccessRequirements();
handler->SendGlobalGMSysMessage("DB table `access_requirement` reloaded.");
return true;
@@ -348,7 +348,7 @@ public:
static bool HandleReloadAchievementCriteriaDataCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading Additional Achievement Criteria Data...");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Additional Achievement Criteria Data...");
sAchievementMgr->LoadAchievementCriteriaData();
handler->SendGlobalGMSysMessage("DB table `achievement_criteria_data` reloaded.");
return true;
@@ -356,7 +356,7 @@ public:
static bool HandleReloadAchievementRewardCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading Achievement Reward Data...");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Achievement Reward Data...");
sAchievementMgr->LoadRewards();
handler->SendGlobalGMSysMessage("DB table `achievement_reward` reloaded.");
return true;
@@ -364,7 +364,7 @@ public:
static bool HandleReloadAreaTriggerTavernCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading Tavern Area Triggers...");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Tavern Area Triggers...");
sObjectMgr->LoadTavernAreaTriggers();
handler->SendGlobalGMSysMessage("DB table `areatrigger_tavern` reloaded.");
return true;
@@ -372,7 +372,7 @@ public:
static bool HandleReloadAreaTriggerTeleportCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading AreaTrigger teleport definitions...");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading AreaTrigger teleport definitions...");
sObjectMgr->LoadAreaTriggerTeleports();
handler->SendGlobalGMSysMessage("DB table `areatrigger_teleport` reloaded.");
return true;
@@ -380,7 +380,7 @@ public:
static bool HandleReloadAutobroadcastCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading Autobroadcasts...");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Autobroadcasts...");
sWorld->LoadAutobroadcasts();
handler->SendGlobalGMSysMessage("DB table `autobroadcast` reloaded.");
return true;
@@ -395,7 +395,7 @@ public:
static bool HandleReloadOnKillReputationCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading creature award reputation definitions...");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading creature award reputation definitions...");
sObjectMgr->LoadReputationOnKill();
handler->SendGlobalGMSysMessage("DB table `creature_onkill_reputation` reloaded.");
return true;
@@ -429,7 +429,7 @@ public:
continue;
}
- sLog->outString("Reloading creature template entry %u", entry);
+ sLog->outInfo(LOG_FILTER_GENERAL, "Reloading creature template entry %u", entry);
Field* fields = result->Fetch();
@@ -525,7 +525,7 @@ public:
static bool HandleReloadCreatureQuestRelationsCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Loading Quests Relations... (`creature_questrelation`)");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Loading Quests Relations... (`creature_questrelation`)");
sObjectMgr->LoadCreatureQuestRelations();
handler->SendGlobalGMSysMessage("DB table `creature_questrelation` (creature quest givers) reloaded.");
return true;
@@ -533,7 +533,7 @@ public:
static bool HandleReloadLinkedRespawnCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Loading Linked Respawns... (`creature_linked_respawn`)");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Loading Linked Respawns... (`creature_linked_respawn`)");
sObjectMgr->LoadLinkedRespawn();
handler->SendGlobalGMSysMessage("DB table `creature_linked_respawn` (creature linked respawns) reloaded.");
return true;
@@ -541,7 +541,7 @@ public:
static bool HandleReloadCreatureQuestInvRelationsCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Loading Quests Relations... (`creature_involvedrelation`)");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Loading Quests Relations... (`creature_involvedrelation`)");
sObjectMgr->LoadCreatureInvolvedRelations();
handler->SendGlobalGMSysMessage("DB table `creature_involvedrelation` (creature quest takers) reloaded.");
return true;
@@ -549,7 +549,7 @@ public:
static bool HandleReloadGossipMenuCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading `gossip_menu` Table!");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading `gossip_menu` Table!");
sObjectMgr->LoadGossipMenu();
handler->SendGlobalGMSysMessage("DB table `gossip_menu` reloaded.");
sConditionMgr->LoadConditions(true);
@@ -558,7 +558,7 @@ public:
static bool HandleReloadGossipMenuOptionCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading `gossip_menu_option` Table!");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading `gossip_menu_option` Table!");
sObjectMgr->LoadGossipMenuItems();
handler->SendGlobalGMSysMessage("DB table `gossip_menu_option` reloaded.");
sConditionMgr->LoadConditions(true);
@@ -567,7 +567,7 @@ public:
static bool HandleReloadGOQuestRelationsCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Loading Quests Relations... (`gameobject_questrelation`)");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Loading Quests Relations... (`gameobject_questrelation`)");
sObjectMgr->LoadGameobjectQuestRelations();
handler->SendGlobalGMSysMessage("DB table `gameobject_questrelation` (gameobject quest givers) reloaded.");
return true;
@@ -575,7 +575,7 @@ public:
static bool HandleReloadGOQuestInvRelationsCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Loading Quests Relations... (`gameobject_involvedrelation`)");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Loading Quests Relations... (`gameobject_involvedrelation`)");
sObjectMgr->LoadGameobjectInvolvedRelations();
handler->SendGlobalGMSysMessage("DB table `gameobject_involvedrelation` (gameobject quest takers) reloaded.");
return true;
@@ -583,7 +583,7 @@ public:
static bool HandleReloadQuestAreaTriggersCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading Quest Area Triggers...");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Quest Area Triggers...");
sObjectMgr->LoadQuestAreaTriggers();
handler->SendGlobalGMSysMessage("DB table `areatrigger_involvedrelation` (quest area triggers) reloaded.");
return true;
@@ -591,12 +591,12 @@ public:
static bool HandleReloadQuestTemplateCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading Quest Templates...");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Quest Templates...");
sObjectMgr->LoadQuests();
handler->SendGlobalGMSysMessage("DB table `quest_template` (quest definitions) reloaded.");
/// dependent also from `gameobject` but this table not reloaded anyway
- sLog->outString("Re-Loading GameObjects for quests...");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading GameObjects for quests...");
sObjectMgr->LoadGameObjectForQuests();
handler->SendGlobalGMSysMessage("Data GameObjects for quests reloaded.");
return true;
@@ -604,7 +604,7 @@ public:
static bool HandleReloadLootTemplatesCreatureCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading Loot Tables... (`creature_loot_template`)");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Loot Tables... (`creature_loot_template`)");
LoadLootTemplates_Creature();
LootTemplates_Creature.CheckLootRefs();
handler->SendGlobalGMSysMessage("DB table `creature_loot_template` reloaded.");
@@ -614,7 +614,7 @@ public:
static bool HandleReloadLootTemplatesDisenchantCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading Loot Tables... (`disenchant_loot_template`)");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Loot Tables... (`disenchant_loot_template`)");
LoadLootTemplates_Disenchant();
LootTemplates_Disenchant.CheckLootRefs();
handler->SendGlobalGMSysMessage("DB table `disenchant_loot_template` reloaded.");
@@ -624,7 +624,7 @@ public:
static bool HandleReloadLootTemplatesFishingCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading Loot Tables... (`fishing_loot_template`)");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Loot Tables... (`fishing_loot_template`)");
LoadLootTemplates_Fishing();
LootTemplates_Fishing.CheckLootRefs();
handler->SendGlobalGMSysMessage("DB table `fishing_loot_template` reloaded.");
@@ -634,7 +634,7 @@ public:
static bool HandleReloadLootTemplatesGameobjectCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading Loot Tables... (`gameobject_loot_template`)");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Loot Tables... (`gameobject_loot_template`)");
LoadLootTemplates_Gameobject();
LootTemplates_Gameobject.CheckLootRefs();
handler->SendGlobalGMSysMessage("DB table `gameobject_loot_template` reloaded.");
@@ -644,7 +644,7 @@ public:
static bool HandleReloadLootTemplatesItemCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading Loot Tables... (`item_loot_template`)");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Loot Tables... (`item_loot_template`)");
LoadLootTemplates_Item();
LootTemplates_Item.CheckLootRefs();
handler->SendGlobalGMSysMessage("DB table `item_loot_template` reloaded.");
@@ -654,7 +654,7 @@ public:
static bool HandleReloadLootTemplatesMillingCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading Loot Tables... (`milling_loot_template`)");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Loot Tables... (`milling_loot_template`)");
LoadLootTemplates_Milling();
LootTemplates_Milling.CheckLootRefs();
handler->SendGlobalGMSysMessage("DB table `milling_loot_template` reloaded.");
@@ -664,7 +664,7 @@ public:
static bool HandleReloadLootTemplatesPickpocketingCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading Loot Tables... (`pickpocketing_loot_template`)");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Loot Tables... (`pickpocketing_loot_template`)");
LoadLootTemplates_Pickpocketing();
LootTemplates_Pickpocketing.CheckLootRefs();
handler->SendGlobalGMSysMessage("DB table `pickpocketing_loot_template` reloaded.");
@@ -674,7 +674,7 @@ public:
static bool HandleReloadLootTemplatesProspectingCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading Loot Tables... (`prospecting_loot_template`)");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Loot Tables... (`prospecting_loot_template`)");
LoadLootTemplates_Prospecting();
LootTemplates_Prospecting.CheckLootRefs();
handler->SendGlobalGMSysMessage("DB table `prospecting_loot_template` reloaded.");
@@ -684,7 +684,7 @@ public:
static bool HandleReloadLootTemplatesMailCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading Loot Tables... (`mail_loot_template`)");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Loot Tables... (`mail_loot_template`)");
LoadLootTemplates_Mail();
LootTemplates_Mail.CheckLootRefs();
handler->SendGlobalGMSysMessage("DB table `mail_loot_template` reloaded.");
@@ -694,7 +694,7 @@ public:
static bool HandleReloadLootTemplatesReferenceCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading Loot Tables... (`reference_loot_template`)");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Loot Tables... (`reference_loot_template`)");
LoadLootTemplates_Reference();
handler->SendGlobalGMSysMessage("DB table `reference_loot_template` reloaded.");
sConditionMgr->LoadConditions(true);
@@ -703,7 +703,7 @@ public:
static bool HandleReloadLootTemplatesSkinningCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading Loot Tables... (`skinning_loot_template`)");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Loot Tables... (`skinning_loot_template`)");
LoadLootTemplates_Skinning();
LootTemplates_Skinning.CheckLootRefs();
handler->SendGlobalGMSysMessage("DB table `skinning_loot_template` reloaded.");
@@ -713,7 +713,7 @@ public:
static bool HandleReloadLootTemplatesSpellCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading Loot Tables... (`spell_loot_template`)");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Loot Tables... (`spell_loot_template`)");
LoadLootTemplates_Spell();
LootTemplates_Spell.CheckLootRefs();
handler->SendGlobalGMSysMessage("DB table `spell_loot_template` reloaded.");
@@ -723,7 +723,7 @@ public:
static bool HandleReloadTrinityStringCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading trinity_string Table!");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading trinity_string Table!");
sObjectMgr->LoadTrinityStrings();
handler->SendGlobalGMSysMessage("DB table `trinity_string` reloaded.");
return true;
@@ -738,7 +738,7 @@ public:
return false;
}
- sLog->outString("Re-Loading warden_action Table!");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading warden_action Table!");
sWardenCheckMgr->LoadWardenOverrides();
handler->SendGlobalGMSysMessage("DB table `warden_action` reloaded.");
return true;
@@ -746,7 +746,7 @@ public:
static bool HandleReloadNpcTrainerCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading `npc_trainer` Table!");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading `npc_trainer` Table!");
sObjectMgr->LoadTrainerSpell();
handler->SendGlobalGMSysMessage("DB table `npc_trainer` reloaded.");
return true;
@@ -754,7 +754,7 @@ public:
static bool HandleReloadNpcVendorCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading `npc_vendor` Table!");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading `npc_vendor` Table!");
sObjectMgr->LoadVendors();
handler->SendGlobalGMSysMessage("DB table `npc_vendor` reloaded.");
return true;
@@ -762,7 +762,7 @@ public:
static bool HandleReloadPointsOfInterestCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading `points_of_interest` Table!");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading `points_of_interest` Table!");
sObjectMgr->LoadPointsOfInterest();
handler->SendGlobalGMSysMessage("DB table `points_of_interest` reloaded.");
return true;
@@ -770,7 +770,7 @@ public:
static bool HandleReloadQuestPOICommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString( "Re-Loading Quest POI ..." );
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Quest POI ..." );
sObjectMgr->LoadQuestPOI();
handler->SendGlobalGMSysMessage("DB Table `quest_poi` and `quest_poi_points` reloaded.");
return true;
@@ -778,7 +778,7 @@ public:
static bool HandleReloadSpellClickSpellsCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading `npc_spellclick_spells` Table!");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading `npc_spellclick_spells` Table!");
sObjectMgr->LoadNPCSpellClickSpells();
handler->SendGlobalGMSysMessage("DB table `npc_spellclick_spells` reloaded.");
return true;
@@ -786,7 +786,7 @@ public:
static bool HandleReloadReservedNameCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Loading ReservedNames... (`reserved_name`)");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Loading ReservedNames... (`reserved_name`)");
sObjectMgr->LoadReservedPlayersNames();
handler->SendGlobalGMSysMessage("DB table `reserved_name` (player reserved names) reloaded.");
return true;
@@ -794,7 +794,7 @@ public:
static bool HandleReloadReputationRewardRateCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString( "Re-Loading `reputation_reward_rate` Table!" );
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading `reputation_reward_rate` Table!" );
sObjectMgr->LoadReputationRewardRate();
handler->SendGlobalSysMessage("DB table `reputation_reward_rate` reloaded.");
return true;
@@ -802,7 +802,7 @@ public:
static bool HandleReloadReputationSpilloverTemplateCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString( "Re-Loading `reputation_spillover_template` Table!" );
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading `reputation_spillover_template` Table!" );
sObjectMgr->LoadReputationSpilloverTemplate();
handler->SendGlobalSysMessage("DB table `reputation_spillover_template` reloaded.");
return true;
@@ -810,7 +810,7 @@ public:
static bool HandleReloadSkillDiscoveryTemplateCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading Skill Discovery Table...");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Skill Discovery Table...");
LoadSkillDiscoveryTable();
handler->SendGlobalGMSysMessage("DB table `skill_discovery_template` (recipes discovered at crafting) reloaded.");
return true;
@@ -818,7 +818,7 @@ public:
static bool HandleReloadSkillExtraItemTemplateCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading Skill Extra Item Table...");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Skill Extra Item Table...");
LoadSkillExtraItemTable();
handler->SendGlobalGMSysMessage("DB table `skill_extra_item_template` (extra item creation when crafting) reloaded.");
return true;
@@ -826,7 +826,7 @@ public:
static bool HandleReloadSkillFishingBaseLevelCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading Skill Fishing base level requirements...");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Skill Fishing base level requirements...");
sObjectMgr->LoadFishingBaseSkillLevel();
handler->SendGlobalGMSysMessage("DB table `skill_fishing_base_level` (fishing base level for zone/subzone) reloaded.");
return true;
@@ -834,7 +834,7 @@ public:
static bool HandleReloadSpellAreaCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading SpellArea Data...");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading SpellArea Data...");
sSpellMgr->LoadSpellAreas();
handler->SendGlobalGMSysMessage("DB table `spell_area` (spell dependences from area/quest/auras state) reloaded.");
return true;
@@ -842,7 +842,7 @@ public:
static bool HandleReloadSpellRequiredCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading Spell Required Data... ");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Spell Required Data... ");
sSpellMgr->LoadSpellRequired();
handler->SendGlobalGMSysMessage("DB table `spell_required` reloaded.");
return true;
@@ -850,7 +850,7 @@ public:
static bool HandleReloadSpellGroupsCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading Spell Groups...");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Spell Groups...");
sSpellMgr->LoadSpellGroups();
handler->SendGlobalGMSysMessage("DB table `spell_group` (spell groups) reloaded.");
return true;
@@ -858,7 +858,7 @@ public:
static bool HandleReloadSpellLearnSpellCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading Spell Learn Spells...");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Spell Learn Spells...");
sSpellMgr->LoadSpellLearnSpells();
handler->SendGlobalGMSysMessage("DB table `spell_learn_spell` reloaded.");
return true;
@@ -866,7 +866,7 @@ public:
static bool HandleReloadSpellLinkedSpellCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading Spell Linked Spells...");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Spell Linked Spells...");
sSpellMgr->LoadSpellLinked();
handler->SendGlobalGMSysMessage("DB table `spell_linked_spell` reloaded.");
return true;
@@ -874,7 +874,7 @@ public:
static bool HandleReloadSpellProcEventCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading Spell Proc Event conditions...");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Spell Proc Event conditions...");
sSpellMgr->LoadSpellProcEvents();
handler->SendGlobalGMSysMessage("DB table `spell_proc_event` (spell proc trigger requirements) reloaded.");
return true;
@@ -882,7 +882,7 @@ public:
static bool HandleReloadSpellProcsCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading Spell Proc conditions and data...");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Spell Proc conditions and data...");
sSpellMgr->LoadSpellProcs();
handler->SendGlobalGMSysMessage("DB table `spell_proc` (spell proc conditions and data) reloaded.");
return true;
@@ -890,7 +890,7 @@ public:
static bool HandleReloadSpellBonusesCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading Spell Bonus Data...");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Spell Bonus Data...");
sSpellMgr->LoadSpellBonusess();
handler->SendGlobalGMSysMessage("DB table `spell_bonus_data` (spell damage/healing coefficients) reloaded.");
return true;
@@ -898,7 +898,7 @@ public:
static bool HandleReloadSpellTargetPositionCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading Spell target coordinates...");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Spell target coordinates...");
sSpellMgr->LoadSpellTargetPositions();
handler->SendGlobalGMSysMessage("DB table `spell_target_position` (destination coordinates for spell targets) reloaded.");
return true;
@@ -906,7 +906,7 @@ public:
static bool HandleReloadSpellThreatsCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading Aggro Spells Definitions...");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Aggro Spells Definitions...");
sSpellMgr->LoadSpellThreats();
handler->SendGlobalGMSysMessage("DB table `spell_threat` (spell aggro definitions) reloaded.");
return true;
@@ -914,7 +914,7 @@ public:
static bool HandleReloadSpellGroupStackRulesCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading Spell Group Stack Rules...");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Spell Group Stack Rules...");
sSpellMgr->LoadSpellGroupStackRules();
handler->SendGlobalGMSysMessage("DB table `spell_group_stack_rules` (spell stacking definitions) reloaded.");
return true;
@@ -922,7 +922,7 @@ public:
static bool HandleReloadSpellPetAurasCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading Spell pet auras...");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Spell pet auras...");
sSpellMgr->LoadSpellPetAuras();
handler->SendGlobalGMSysMessage("DB table `spell_pet_auras` reloaded.");
return true;
@@ -930,7 +930,7 @@ public:
static bool HandleReloadPageTextsCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading Page Texts...");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Page Texts...");
sObjectMgr->LoadPageTexts();
handler->SendGlobalGMSysMessage("DB table `page_texts` reloaded.");
return true;
@@ -938,7 +938,7 @@ public:
static bool HandleReloadItemEnchantementsCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading Item Random Enchantments Table...");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Item Random Enchantments Table...");
LoadRandomEnchantmentsTable();
handler->SendGlobalGMSysMessage("DB table `item_enchantment_template` reloaded.");
return true;
@@ -954,7 +954,7 @@ public:
}
if (*args != 'a')
- sLog->outString("Re-Loading Scripts from `gameobject_scripts`...");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Scripts from `gameobject_scripts`...");
sObjectMgr->LoadGameObjectScripts();
@@ -974,7 +974,7 @@ public:
}
if (*args != 'a')
- sLog->outString("Re-Loading Scripts from `event_scripts`...");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Scripts from `event_scripts`...");
sObjectMgr->LoadEventScripts();
@@ -994,7 +994,7 @@ public:
}
if (*args != 'a')
- sLog->outString("Re-Loading Scripts from `waypoint_scripts`...");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Scripts from `waypoint_scripts`...");
sObjectMgr->LoadWaypointScripts();
@@ -1007,7 +1007,7 @@ public:
static bool HandleReloadWpCommand(ChatHandler* handler, const char* args)
{
if (*args != 'a')
- sLog->outString("Re-Loading Waypoints data from 'waypoints_data'");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Waypoints data from 'waypoints_data'");
sWaypointMgr->Load();
@@ -1020,7 +1020,7 @@ public:
static bool HandleReloadEventAITextsCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading Texts from `creature_ai_texts`...");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Texts from `creature_ai_texts`...");
sEventAIMgr->LoadCreatureEventAI_Texts();
handler->SendGlobalGMSysMessage("DB table `creature_ai_texts` reloaded.");
return true;
@@ -1028,7 +1028,7 @@ public:
static bool HandleReloadEventAISummonsCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading Summons from `creature_ai_summons`...");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Summons from `creature_ai_summons`...");
sEventAIMgr->LoadCreatureEventAI_Summons();
handler->SendGlobalGMSysMessage("DB table `creature_ai_summons` reloaded.");
return true;
@@ -1036,7 +1036,7 @@ public:
static bool HandleReloadEventAIScriptsCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading Scripts from `creature_ai_scripts`...");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Scripts from `creature_ai_scripts`...");
sEventAIMgr->LoadCreatureEventAI_Scripts();
handler->SendGlobalGMSysMessage("DB table `creature_ai_scripts` reloaded.");
return true;
@@ -1052,7 +1052,7 @@ public:
}
if (*args != 'a')
- sLog->outString("Re-Loading Scripts from `quest_end_scripts`...");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Scripts from `quest_end_scripts`...");
sObjectMgr->LoadQuestEndScripts();
@@ -1072,7 +1072,7 @@ public:
}
if (*args != 'a')
- sLog->outString("Re-Loading Scripts from `quest_start_scripts`...");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Scripts from `quest_start_scripts`...");
sObjectMgr->LoadQuestStartScripts();
@@ -1092,7 +1092,7 @@ public:
}
if (*args != 'a')
- sLog->outString("Re-Loading Scripts from `spell_scripts`...");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Scripts from `spell_scripts`...");
sObjectMgr->LoadSpellScripts();
@@ -1104,7 +1104,7 @@ public:
static bool HandleReloadDbScriptStringCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading Script strings from `db_script_string`...");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Script strings from `db_script_string`...");
sObjectMgr->LoadDbScriptStrings();
handler->SendGlobalGMSysMessage("DB table `db_script_string` reloaded.");
return true;
@@ -1112,7 +1112,7 @@ public:
static bool HandleReloadGameGraveyardZoneCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading Graveyard-zone links...");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Graveyard-zone links...");
sObjectMgr->LoadGraveyardZones();
@@ -1123,7 +1123,7 @@ public:
static bool HandleReloadGameTeleCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading Game Tele coordinates...");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Game Tele coordinates...");
sObjectMgr->LoadGameTele();
@@ -1134,9 +1134,9 @@ public:
static bool HandleReloadDisablesCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading disables table...");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading disables table...");
DisableMgr::LoadDisables();
- sLog->outString("Checking quest disables...");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Checking quest disables...");
DisableMgr::CheckQuestDisables();
handler->SendGlobalGMSysMessage("DB table `disables` reloaded.");
return true;
@@ -1144,7 +1144,7 @@ public:
static bool HandleReloadLocalesAchievementRewardCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading Locales Achievement Reward Data...");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Locales Achievement Reward Data...");
sAchievementMgr->LoadRewardLocales();
handler->SendGlobalGMSysMessage("DB table `locales_achievement_reward` reloaded.");
return true;
@@ -1152,7 +1152,7 @@ public:
static bool HandleReloadLfgRewardsCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading lfg dungeon rewards...");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading lfg dungeon rewards...");
sLFGMgr->LoadRewards();
handler->SendGlobalGMSysMessage("DB table `lfg_dungeon_rewards` reloaded.");
return true;
@@ -1160,7 +1160,7 @@ public:
static bool HandleReloadLocalesCreatureCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading Locales Creature ...");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Locales Creature ...");
sObjectMgr->LoadCreatureLocales();
handler->SendGlobalGMSysMessage("DB table `locales_creature` reloaded.");
return true;
@@ -1168,7 +1168,7 @@ public:
static bool HandleReloadLocalesCreatureTextCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading Locales Creature Texts...");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Locales Creature Texts...");
sCreatureTextMgr->LoadCreatureTextLocales();
handler->SendGlobalGMSysMessage("DB table `locales_creature_text` reloaded.");
return true;
@@ -1176,7 +1176,7 @@ public:
static bool HandleReloadLocalesGameobjectCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading Locales Gameobject ... ");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Locales Gameobject ... ");
sObjectMgr->LoadGameObjectLocales();
handler->SendGlobalGMSysMessage("DB table `locales_gameobject` reloaded.");
return true;
@@ -1184,7 +1184,7 @@ public:
static bool HandleReloadLocalesGossipMenuOptionCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString( "Re-Loading Locales Gossip Menu Option ... ");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Locales Gossip Menu Option ... ");
sObjectMgr->LoadGossipMenuItemsLocales();
handler->SendGlobalGMSysMessage("DB table `locales_gossip_menu_option` reloaded.");
return true;
@@ -1192,7 +1192,7 @@ public:
static bool HandleReloadLocalesItemCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading Locales Item ... ");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Locales Item ... ");
sObjectMgr->LoadItemLocales();
handler->SendGlobalGMSysMessage("DB table `locales_item` reloaded.");
return true;
@@ -1200,7 +1200,7 @@ public:
static bool HandleReloadLocalesNpcTextCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading Locales NPC Text ... ");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Locales NPC Text ... ");
sObjectMgr->LoadNpcTextLocales();
handler->SendGlobalGMSysMessage("DB table `locales_npc_text` reloaded.");
return true;
@@ -1208,7 +1208,7 @@ public:
static bool HandleReloadLocalesPageTextCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading Locales Page Text ... ");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Locales Page Text ... ");
sObjectMgr->LoadPageTextLocales();
handler->SendGlobalGMSysMessage("DB table `locales_page_text` reloaded.");
return true;
@@ -1216,7 +1216,7 @@ public:
static bool HandleReloadLocalesPointsOfInterestCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading Locales Points Of Interest ... ");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Locales Points Of Interest ... ");
sObjectMgr->LoadPointOfInterestLocales();
handler->SendGlobalGMSysMessage("DB table `locales_points_of_interest` reloaded.");
return true;
@@ -1224,7 +1224,7 @@ public:
static bool HandleReloadLocalesQuestCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading Locales Quest ... ");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Locales Quest ... ");
sObjectMgr->LoadQuestLocales();
handler->SendGlobalGMSysMessage("DB table `locales_quest` reloaded.");
return true;
@@ -1232,7 +1232,7 @@ public:
static bool HandleReloadMailLevelRewardCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading Player level dependent mail rewards...");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Player level dependent mail rewards...");
sObjectMgr->LoadMailLevelRewards();
handler->SendGlobalGMSysMessage("DB table `mail_level_reward` reloaded.");
return true;
@@ -1241,7 +1241,7 @@ public:
static bool HandleReloadAuctionsCommand(ChatHandler* handler, const char* /*args*/)
{
///- Reload dynamic data tables from the database
- sLog->outString("Re-Loading Auctions...");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Auctions...");
sAuctionMgr->LoadAuctionItems();
sAuctionMgr->LoadAuctions();
handler->SendGlobalGMSysMessage("Auctions reloaded.");
@@ -1250,7 +1250,7 @@ public:
static bool HandleReloadConditions(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading Conditions...");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Conditions...");
sConditionMgr->LoadConditions(true);
handler->SendGlobalGMSysMessage("Conditions reloaded.");
return true;
@@ -1258,7 +1258,7 @@ public:
static bool HandleReloadCreatureText(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading Creature Texts...");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Creature Texts...");
sCreatureTextMgr->LoadCreatureTexts();
handler->SendGlobalGMSysMessage("Creature Texts reloaded.");
return true;
@@ -1266,7 +1266,7 @@ public:
static bool HandleReloadSmartScripts(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading Smart Scripts...");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Smart Scripts...");
sSmartScriptMgr->LoadSmartAIFromDB();
handler->SendGlobalGMSysMessage("Smart Scripts reloaded.");
return true;
@@ -1274,7 +1274,7 @@ public:
static bool HandleReloadVehicleAccessoryCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Reloading vehicle_accessory table...");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Reloading vehicle_accessory table...");
sObjectMgr->LoadVehicleAccessories();
handler->SendGlobalGMSysMessage("Vehicle accessories reloaded.");
return true;
@@ -1282,7 +1282,7 @@ public:
static bool HandleReloadVehicleTemplateAccessoryCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Reloading vehicle_template_accessory table...");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Reloading vehicle_template_accessory table...");
sObjectMgr->LoadVehicleTemplateAccessories();
handler->SendGlobalGMSysMessage("Vehicle template accessories reloaded.");
return true;
diff --git a/src/server/scripts/Commands/cs_reset.cpp b/src/server/scripts/Commands/cs_reset.cpp
index 82c692ce39e..b0bf3e03f58 100644
--- a/src/server/scripts/Commands/cs_reset.cpp
+++ b/src/server/scripts/Commands/cs_reset.cpp
@@ -85,7 +85,7 @@ public:
ChrClassesEntry const* classEntry = sChrClassesStore.LookupEntry(player->getClass());
if (!classEntry)
{
- sLog->outError("Class %u not found in DBC (Wrong DBC files?)", player->getClass());
+ sLog->outError(LOG_FILTER_GENERAL, "Class %u not found in DBC (Wrong DBC files?)", player->getClass());
return false;
}
diff --git a/src/server/scripts/Commands/cs_server.cpp b/src/server/scripts/Commands/cs_server.cpp
index 8f10af5fe2a..db1995ebb6e 100644
--- a/src/server/scripts/Commands/cs_server.cpp
+++ b/src/server/scripts/Commands/cs_server.cpp
@@ -67,7 +67,6 @@ public:
{
{ "difftime", SEC_CONSOLE, true, &HandleServerSetDiffTimeCommand, "", NULL },
{ "loglevel", SEC_CONSOLE, true, &HandleServerSetLogLevelCommand, "", NULL },
- { "logfilelevel", SEC_CONSOLE, true, &HandleServerSetLogFileLevelCommand, "", NULL },
{ "motd", SEC_ADMINISTRATOR, true, &HandleServerSetMotdCommand, "", NULL },
{ "closed", SEC_ADMINISTRATOR, true, &HandleServerSetClosedCommand, "", NULL },
{ NULL, 0, false, NULL, "", NULL }
@@ -85,7 +84,6 @@ public:
{ "restart", SEC_ADMINISTRATOR, true, NULL, "", serverRestartCommandTable },
{ "shutdown", SEC_ADMINISTRATOR, true, NULL, "", serverShutdownCommandTable },
{ "set", SEC_ADMINISTRATOR, true, NULL, "", serverSetCommandTable },
- { "togglequerylog", SEC_CONSOLE, true, &HandleServerToggleQueryLogging, "", NULL },
{ NULL, 0, false, NULL, "", NULL }
};
@@ -379,30 +377,19 @@ public:
}
// Set the level of logging
- static bool HandleServerSetLogFileLevelCommand(ChatHandler* /*handler*/, char const* args)
- {
- if (!*args)
- return false;
-
- char* newLevel = strtok((char*)args, " ");
- if (!newLevel)
- return false;
-
- sLog->SetLogFileLevel(newLevel);
- return true;
- }
-
- // Set the level of logging
static bool HandleServerSetLogLevelCommand(ChatHandler* /*handler*/, char const* args)
{
if (!*args)
return false;
- char* newLevel = strtok((char*)args, " ");
- if (!newLevel)
+ char* type = strtok((char*)args, " ");
+ char* name = strtok(NULL, " ");
+ char* level = strtok(NULL, " ");
+
+ if (!type || !name || !level || *name == '\0' || *level == '\0' || (*type != 'a' && *type != 'l'))
return false;
- sLog->SetLogLevel(newLevel);
+ sLog->SetLogLevel(name, level, *type == 'l');
return true;
}
@@ -425,18 +412,6 @@ public:
return true;
}
-
- // toggle sql driver query logging
- static bool HandleServerToggleQueryLogging(ChatHandler* handler, char const* /*args*/)
- {
- sLog->SetSQLDriverQueryLogging(!sLog->GetSQLDriverQueryLogging());
-
- if (sLog->GetSQLDriverQueryLogging())
- handler->PSendSysMessage(LANG_SQLDRIVER_QUERY_LOGGING_ENABLED);
- else
- handler->PSendSysMessage(LANG_SQLDRIVER_QUERY_LOGGING_DISABLED);
- return true;
- }
};
void AddSC_server_commandscript()