Merge branch 'master' of github.com:TrinityCore/TrinityCore into mmaps
Conflicts: dep/PackageList.txt src/server/game/Movement/MotionMaster.cpp src/server/game/Movement/MovementGenerators/HomeMovementGenerator.cpp src/server/game/Movement/MovementGenerators/PointMovementGenerator.h src/server/game/Movement/Spline/MoveSplineInit.h src/server/game/World/World.h
This commit is contained in:
commit
dc95ce61b4
1376 files changed
+55480
-24539
No files matched your search
@@ -82,6 +82,8 @@ include_directories(
|
||||
${CMAKE_SOURCE_DIR}/src/server/game/AI/ScriptedAI
|
||||
${CMAKE_SOURCE_DIR}/src/server/game/AI/SmartScripts
|
||||
${CMAKE_SOURCE_DIR}/src/server/game/AuctionHouse
|
||||
${CMAKE_SOURCE_DIR}/src/server/game/Battlefield
|
||||
${CMAKE_SOURCE_DIR}/src/server/game/Battlefield/Zones
|
||||
${CMAKE_SOURCE_DIR}/src/server/game/Battlegrounds
|
||||
${CMAKE_SOURCE_DIR}/src/server/game/Battlegrounds/Zones
|
||||
${CMAKE_SOURCE_DIR}/src/server/game/Calendar
|
||||
|
||||
@@ -12,34 +12,37 @@ set(scripts_STAT_SRCS
|
||||
${scripts_STAT_SRCS}
|
||||
Commands/cs_account.cpp
|
||||
Commands/cs_achievement.cpp
|
||||
Commands/cs_ban.cpp
|
||||
Commands/cs_bf.cpp
|
||||
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
|
||||
Commands/cs_gobject.cpp
|
||||
Commands/cs_gps.cpp
|
||||
Commands/cs_guild.cpp
|
||||
Commands/cs_honor.cpp
|
||||
Commands/cs_instance.cpp
|
||||
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
|
||||
Commands/cs_quest.cpp
|
||||
Commands/cs_reload.cpp
|
||||
Commands/cs_reset.cpp
|
||||
Commands/cs_tele.cpp
|
||||
Commands/cs_ticket.cpp
|
||||
Commands/cs_server.cpp
|
||||
Commands/cs_titles.cpp
|
||||
Commands/cs_wp.cpp
|
||||
# Commands/cs_character.cpp
|
||||
# Commands/cs_list.cpp
|
||||
# Commands/cs_lookup.cpp
|
||||
# Commands/cs_pdump.cpp
|
||||
# Commands/cs_guild.cpp
|
||||
# Commands/cs_cast.cpp
|
||||
# Commands/cs_reset.cpp
|
||||
# Commands/cs_instance.cpp
|
||||
# Commands/cs_server.cpp
|
||||
# Commands/cs_channel.cpp
|
||||
# Commands/cs_pet.cpp
|
||||
# Commands/cs_ticket.cpp
|
||||
# Commands/cs_aura.cpp
|
||||
# Commands/cs_unaura.cpp
|
||||
# Commands/cs_nameannounce.cpp
|
||||
@@ -66,10 +69,6 @@ set(scripts_STAT_SRCS
|
||||
# Commands/cs_save.cpp
|
||||
# Commands/cs_saveall.cpp
|
||||
# Commands/cs_kick.cpp
|
||||
# Commands/cs_ban.cpp
|
||||
# Commands/cs_unban.cpp
|
||||
# Commands/cs_baninfo.cpp
|
||||
# Commands/cs_banlist.cpp
|
||||
# Commands/cs_start.cpp
|
||||
# Commands/cs_taxicheat.cpp
|
||||
# Commands/cs_linkgrave.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;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -0,0 +1,718 @@
|
||||
/*
|
||||
* 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: ban_commandscript
|
||||
%Complete: 100
|
||||
Comment: All ban related commands
|
||||
Category: commandscripts
|
||||
EndScriptData */
|
||||
|
||||
#include "ScriptMgr.h"
|
||||
#include "Chat.h"
|
||||
#include "AccountMgr.h"
|
||||
#include "ObjectAccessor.h"
|
||||
#include "ObjectMgr.h"
|
||||
|
||||
class ban_commandscript : public CommandScript
|
||||
{
|
||||
public:
|
||||
ban_commandscript() : CommandScript("ban_commandscript") { }
|
||||
|
||||
ChatCommand* GetCommands() const
|
||||
{
|
||||
static ChatCommand unbanCommandTable[] =
|
||||
{
|
||||
{ "account", SEC_ADMINISTRATOR, true, &HandleUnBanAccountCommand, "", NULL },
|
||||
{ "character", SEC_ADMINISTRATOR, true, &HandleUnBanCharacterCommand, "", NULL },
|
||||
{ "playeraccount", SEC_ADMINISTRATOR, true, &HandleUnBanAccountByCharCommand, "", NULL },
|
||||
{ "ip", SEC_ADMINISTRATOR, true, &HandleUnBanIPCommand, "", NULL },
|
||||
{ NULL, 0, false, NULL, "", NULL }
|
||||
};
|
||||
static ChatCommand banlistCommandTable[] =
|
||||
{
|
||||
{ "account", SEC_ADMINISTRATOR, true, &HandleBanListAccountCommand, "", NULL },
|
||||
{ "character", SEC_ADMINISTRATOR, true, &HandleBanListCharacterCommand, "", NULL },
|
||||
{ "ip", SEC_ADMINISTRATOR, true, &HandleBanListIPCommand, "", NULL },
|
||||
{ NULL, 0, false, NULL, "", NULL }
|
||||
};
|
||||
static ChatCommand baninfoCommandTable[] =
|
||||
{
|
||||
{ "account", SEC_ADMINISTRATOR, true, &HandleBanInfoAccountCommand, "", NULL },
|
||||
{ "character", SEC_ADMINISTRATOR, true, &HandleBanInfoCharacterCommand, "", NULL },
|
||||
{ "ip", SEC_ADMINISTRATOR, true, &HandleBanInfoIPCommand, "", NULL },
|
||||
{ NULL, 0, false, NULL, "", NULL }
|
||||
};
|
||||
static ChatCommand banCommandTable[] =
|
||||
{
|
||||
{ "account", SEC_ADMINISTRATOR, true, &HandleBanAccountCommand, "", NULL },
|
||||
{ "character", SEC_ADMINISTRATOR, true, &HandleBanCharacterCommand, "", NULL },
|
||||
{ "playeraccount", SEC_ADMINISTRATOR, true, &HandleBanAccountByCharCommand, "", NULL },
|
||||
{ "ip", SEC_ADMINISTRATOR, true, &HandleBanIPCommand, "", NULL },
|
||||
{ NULL, 0, false, NULL, "", NULL }
|
||||
};
|
||||
static ChatCommand commandTable[] =
|
||||
{
|
||||
{ "ban", SEC_ADMINISTRATOR, true, NULL, "", banCommandTable },
|
||||
{ "baninfo", SEC_ADMINISTRATOR, true, NULL, "", baninfoCommandTable },
|
||||
{ "banlist", SEC_ADMINISTRATOR, true, NULL, "", banlistCommandTable },
|
||||
{ "unban", SEC_ADMINISTRATOR, true, NULL, "", unbanCommandTable },
|
||||
{ NULL, 0, false, NULL, "", NULL }
|
||||
};
|
||||
return commandTable;
|
||||
}
|
||||
|
||||
static bool HandleBanAccountCommand(ChatHandler* handler, char const* args)
|
||||
{
|
||||
return HandleBanHelper(BAN_ACCOUNT, args, handler);
|
||||
}
|
||||
|
||||
static bool HandleBanCharacterCommand(ChatHandler* handler, char const* args)
|
||||
{
|
||||
if (!*args)
|
||||
return false;
|
||||
|
||||
char* nameStr = strtok((char*)args, " ");
|
||||
if (!nameStr)
|
||||
return false;
|
||||
|
||||
std::string name = nameStr;
|
||||
|
||||
char* durationStr = strtok(NULL, " ");
|
||||
if (!durationStr || !atoi(durationStr))
|
||||
return false;
|
||||
|
||||
char* reasonStr = strtok(NULL, "");
|
||||
if (!reasonStr)
|
||||
return false;
|
||||
|
||||
if (!normalizePlayerName(name))
|
||||
{
|
||||
handler->SendSysMessage(LANG_PLAYER_NOT_FOUND);
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
switch (sWorld->BanCharacter(name, durationStr, reasonStr, handler->GetSession() ? handler->GetSession()->GetPlayerName().c_str() : ""))
|
||||
{
|
||||
case BAN_SUCCESS:
|
||||
{
|
||||
if (atoi(durationStr) > 0)
|
||||
handler->PSendSysMessage(LANG_BAN_YOUBANNED, name.c_str(), secsToTimeString(TimeStringToSecs(durationStr), true).c_str(), reasonStr);
|
||||
else
|
||||
handler->PSendSysMessage(LANG_BAN_YOUPERMBANNED, name.c_str(), reasonStr);
|
||||
break;
|
||||
}
|
||||
case BAN_NOTFOUND:
|
||||
{
|
||||
handler->PSendSysMessage(LANG_BAN_NOTFOUND, "character", name.c_str());
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool HandleBanAccountByCharCommand(ChatHandler* handler, char const* args)
|
||||
{
|
||||
return HandleBanHelper(BAN_CHARACTER, args, handler);
|
||||
}
|
||||
|
||||
static bool HandleBanIPCommand(ChatHandler* handler, char const* args)
|
||||
{
|
||||
return HandleBanHelper(BAN_IP, args, handler);
|
||||
}
|
||||
|
||||
static bool HandleBanHelper(BanMode mode, char const* args, ChatHandler* handler)
|
||||
{
|
||||
if (!*args)
|
||||
return false;
|
||||
|
||||
char* cnameOrIP = strtok((char*)args, " ");
|
||||
if (!cnameOrIP)
|
||||
return false;
|
||||
|
||||
std::string nameOrIP = cnameOrIP;
|
||||
|
||||
char* durationStr = strtok(NULL, " ");
|
||||
if (!durationStr || !atoi(durationStr))
|
||||
return false;
|
||||
|
||||
char* reasonStr = strtok(NULL, "");
|
||||
if (!reasonStr)
|
||||
return false;
|
||||
|
||||
switch (mode)
|
||||
{
|
||||
case BAN_ACCOUNT:
|
||||
if (!AccountMgr::normalizeString(nameOrIP))
|
||||
{
|
||||
handler->PSendSysMessage(LANG_ACCOUNT_NOT_EXIST, nameOrIP.c_str());
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case BAN_CHARACTER:
|
||||
if (!normalizePlayerName(nameOrIP))
|
||||
{
|
||||
handler->SendSysMessage(LANG_PLAYER_NOT_FOUND);
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case BAN_IP:
|
||||
if (!IsIPAddress(nameOrIP.c_str()))
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
|
||||
switch (sWorld->BanAccount(mode, nameOrIP, durationStr, reasonStr, handler->GetSession() ? handler->GetSession()->GetPlayerName().c_str() : ""))
|
||||
{
|
||||
case BAN_SUCCESS:
|
||||
if (atoi(durationStr) > 0)
|
||||
handler->PSendSysMessage(LANG_BAN_YOUBANNED, nameOrIP.c_str(), secsToTimeString(TimeStringToSecs(durationStr), true).c_str(), reasonStr);
|
||||
else
|
||||
handler->PSendSysMessage(LANG_BAN_YOUPERMBANNED, nameOrIP.c_str(), reasonStr);
|
||||
break;
|
||||
case BAN_SYNTAX_ERROR:
|
||||
return false;
|
||||
case BAN_NOTFOUND:
|
||||
switch (mode)
|
||||
{
|
||||
default:
|
||||
handler->PSendSysMessage(LANG_BAN_NOTFOUND, "account", nameOrIP.c_str());
|
||||
break;
|
||||
case BAN_CHARACTER:
|
||||
handler->PSendSysMessage(LANG_BAN_NOTFOUND, "character", nameOrIP.c_str());
|
||||
break;
|
||||
case BAN_IP:
|
||||
handler->PSendSysMessage(LANG_BAN_NOTFOUND, "ip", nameOrIP.c_str());
|
||||
break;
|
||||
}
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool HandleBanInfoAccountCommand(ChatHandler* handler, char const* args)
|
||||
{
|
||||
if (!*args)
|
||||
return false;
|
||||
|
||||
char* nameStr = strtok((char*)args, "");
|
||||
if (!nameStr)
|
||||
return false;
|
||||
|
||||
std::string accountName = nameStr;
|
||||
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)
|
||||
{
|
||||
handler->PSendSysMessage(LANG_ACCOUNT_NOT_EXIST, accountName.c_str());
|
||||
return true;
|
||||
}
|
||||
|
||||
return HandleBanInfoHelper(accountId, accountName.c_str(), handler);
|
||||
}
|
||||
|
||||
static bool HandleBanInfoHelper(uint32 accountId, char const* accountName, ChatHandler* handler)
|
||||
{
|
||||
QueryResult result = LoginDatabase.PQuery("SELECT FROM_UNIXTIME(bandate), unbandate-bandate, active, unbandate, banreason, bannedby FROM account_banned WHERE id = '%u' ORDER BY bandate ASC", accountId);
|
||||
if (!result)
|
||||
{
|
||||
handler->PSendSysMessage(LANG_BANINFO_NOACCOUNTBAN, accountName);
|
||||
return true;
|
||||
}
|
||||
|
||||
handler->PSendSysMessage(LANG_BANINFO_BANHISTORY, accountName);
|
||||
do
|
||||
{
|
||||
Field* fields = result->Fetch();
|
||||
|
||||
time_t unbanDate = time_t(fields[3].GetUInt32());
|
||||
bool active = false;
|
||||
if (fields[2].GetBool() && (fields[1].GetUInt64() == uint64(0) || unbanDate >= time(NULL)))
|
||||
active = true;
|
||||
bool permanent = (fields[1].GetUInt64() == uint64(0));
|
||||
std::string banTime = permanent ? handler->GetTrinityString(LANG_BANINFO_INFINITE) : secsToTimeString(fields[1].GetUInt64(), true);
|
||||
handler->PSendSysMessage(LANG_BANINFO_HISTORYENTRY,
|
||||
fields[0].GetCString(), banTime.c_str(), active ? handler->GetTrinityString(LANG_BANINFO_YES) : handler->GetTrinityString(LANG_BANINFO_NO), fields[4].GetCString(), fields[5].GetCString());
|
||||
}
|
||||
while (result->NextRow());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool HandleBanInfoCharacterCommand(ChatHandler* handler, char const* args)
|
||||
{
|
||||
if (!*args)
|
||||
return false;
|
||||
|
||||
Player* target = sObjectAccessor->FindPlayerByName(args);
|
||||
uint32 targetGuid = 0;
|
||||
std::string name(args);
|
||||
|
||||
if (!target)
|
||||
{
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_GUID_BY_NAME);
|
||||
stmt->setString(0, name);
|
||||
PreparedQueryResult resultCharacter = CharacterDatabase.Query(stmt);
|
||||
|
||||
if (!resultCharacter)
|
||||
{
|
||||
handler->PSendSysMessage(LANG_BANINFO_NOCHARACTER);
|
||||
return false;
|
||||
}
|
||||
|
||||
targetGuid = (*resultCharacter)[0].GetUInt32();
|
||||
}
|
||||
else
|
||||
targetGuid = target->GetGUIDLow();
|
||||
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_BANINFO);
|
||||
stmt->setUInt32(0, targetGuid);
|
||||
PreparedQueryResult result = CharacterDatabase.Query(stmt);
|
||||
if (!result)
|
||||
{
|
||||
handler->PSendSysMessage(LANG_CHAR_NOT_BANNED, name.c_str());
|
||||
return true;
|
||||
}
|
||||
|
||||
handler->PSendSysMessage(LANG_BANINFO_BANHISTORY, name.c_str());
|
||||
do
|
||||
{
|
||||
Field* fields = result->Fetch();
|
||||
time_t unbanDate = time_t(fields[3].GetUInt32());
|
||||
bool active = false;
|
||||
if (fields[2].GetUInt8() && (!fields[1].GetUInt32() || unbanDate >= time(NULL)))
|
||||
active = true;
|
||||
bool permanent = (fields[1].GetUInt32() == uint32(0));
|
||||
std::string banTime = permanent ? handler->GetTrinityString(LANG_BANINFO_INFINITE) : secsToTimeString(fields[1].GetUInt32(), true);
|
||||
handler->PSendSysMessage(LANG_BANINFO_HISTORYENTRY,
|
||||
fields[0].GetCString(), banTime.c_str(), active ? handler->GetTrinityString(LANG_BANINFO_YES) : handler->GetTrinityString(LANG_BANINFO_NO), fields[4].GetCString(), fields[5].GetCString());
|
||||
}
|
||||
while (result->NextRow());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool HandleBanInfoIPCommand(ChatHandler* handler, char const* args)
|
||||
{
|
||||
if (!*args)
|
||||
return false;
|
||||
|
||||
char* ipStr = strtok((char*)args, "");
|
||||
if (!ipStr)
|
||||
return false;
|
||||
|
||||
if (!IsIPAddress(ipStr))
|
||||
return false;
|
||||
|
||||
std::string IP = ipStr;
|
||||
|
||||
LoginDatabase.EscapeString(IP);
|
||||
QueryResult result = LoginDatabase.PQuery("SELECT ip, FROM_UNIXTIME(bandate), FROM_UNIXTIME(unbandate), unbandate-UNIX_TIMESTAMP(), banreason, bannedby, unbandate-bandate FROM ip_banned WHERE ip = '%s'", IP.c_str());
|
||||
if (!result)
|
||||
{
|
||||
handler->PSendSysMessage(LANG_BANINFO_NOIP);
|
||||
return true;
|
||||
}
|
||||
|
||||
Field* fields = result->Fetch();
|
||||
bool permanent = !fields[6].GetUInt64();
|
||||
handler->PSendSysMessage(LANG_BANINFO_IPENTRY,
|
||||
fields[0].GetCString(), fields[1].GetCString(), permanent ? handler->GetTrinityString(LANG_BANINFO_NEVER) : fields[2].GetCString(),
|
||||
permanent ? handler->GetTrinityString(LANG_BANINFO_INFINITE) : secsToTimeString(fields[3].GetUInt64(), true).c_str(), fields[4].GetCString(), fields[5].GetCString());
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool HandleBanListAccountCommand(ChatHandler* handler, char const* args)
|
||||
{
|
||||
PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_DEL_EXPIRED_IP_BANS);
|
||||
LoginDatabase.Execute(stmt);
|
||||
|
||||
char* filterStr = strtok((char*)args, " ");
|
||||
std::string filter = filterStr ? filterStr : "";
|
||||
|
||||
PreparedQueryResult result;
|
||||
|
||||
if (filter.empty())
|
||||
{
|
||||
PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_ACCOUNT_BANNED_ALL);
|
||||
result = LoginDatabase.Query(stmt);
|
||||
}
|
||||
else
|
||||
{
|
||||
PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_ACCOUNT_BANNED_BY_USERNAME);
|
||||
stmt->setString(0, filter);
|
||||
result = LoginDatabase.Query(stmt);
|
||||
}
|
||||
|
||||
if (!result)
|
||||
{
|
||||
handler->PSendSysMessage(LANG_BANLIST_NOACCOUNT);
|
||||
return true;
|
||||
}
|
||||
|
||||
return HandleBanListHelper(result, handler);
|
||||
}
|
||||
|
||||
static bool HandleBanListHelper(PreparedQueryResult result, ChatHandler* handler)
|
||||
{
|
||||
handler->PSendSysMessage(LANG_BANLIST_MATCHINGACCOUNT);
|
||||
|
||||
// Chat short output
|
||||
if (handler->GetSession())
|
||||
{
|
||||
do
|
||||
{
|
||||
Field* fields = result->Fetch();
|
||||
uint32 accountid = fields[0].GetUInt32();
|
||||
|
||||
QueryResult banResult = LoginDatabase.PQuery("SELECT account.username FROM account, account_banned WHERE account_banned.id='%u' AND account_banned.id=account.id", accountid);
|
||||
if (banResult)
|
||||
{
|
||||
Field* fields2 = banResult->Fetch();
|
||||
handler->PSendSysMessage("%s", fields2[0].GetCString());
|
||||
}
|
||||
}
|
||||
while (result->NextRow());
|
||||
}
|
||||
// Console wide output
|
||||
else
|
||||
{
|
||||
handler->SendSysMessage(LANG_BANLIST_ACCOUNTS);
|
||||
handler->SendSysMessage(" ===============================================================================");
|
||||
handler->SendSysMessage(LANG_BANLIST_ACCOUNTS_HEADER);
|
||||
do
|
||||
{
|
||||
handler->SendSysMessage("-------------------------------------------------------------------------------");
|
||||
Field* fields = result->Fetch();
|
||||
uint32 accountId = fields[0].GetUInt32();
|
||||
|
||||
std::string accountName;
|
||||
|
||||
// "account" case, name can be get in same query
|
||||
if (result->GetFieldCount() > 1)
|
||||
accountName = fields[1].GetString();
|
||||
// "character" case, name need extract from another DB
|
||||
else
|
||||
AccountMgr::GetName(accountId, accountName);
|
||||
|
||||
// No SQL injection. id is uint32.
|
||||
QueryResult banInfo = LoginDatabase.PQuery("SELECT bandate, unbandate, bannedby, banreason FROM account_banned WHERE id = %u ORDER BY unbandate", accountId);
|
||||
if (banInfo)
|
||||
{
|
||||
Field* fields2 = banInfo->Fetch();
|
||||
do
|
||||
{
|
||||
time_t timeBan = time_t(fields2[0].GetUInt32());
|
||||
tm* tmBan = localtime(&timeBan);
|
||||
|
||||
if (fields2[0].GetUInt32() == fields2[1].GetUInt32())
|
||||
{
|
||||
handler->PSendSysMessage("|%-15.15s|%02d-%02d-%02d %02d:%02d| permanent |%-15.15s|%-15.15s|",
|
||||
accountName.c_str(), tmBan->tm_year%100, tmBan->tm_mon+1, tmBan->tm_mday, tmBan->tm_hour, tmBan->tm_min,
|
||||
fields2[2].GetCString(), fields2[3].GetCString());
|
||||
}
|
||||
else
|
||||
{
|
||||
time_t timeUnban = time_t(fields2[1].GetUInt32());
|
||||
tm* tmUnban = localtime(&timeUnban);
|
||||
handler->PSendSysMessage("|%-15.15s|%02d-%02d-%02d %02d:%02d|%02d-%02d-%02d %02d:%02d|%-15.15s|%-15.15s|",
|
||||
accountName.c_str(), tmBan->tm_year%100, tmBan->tm_mon+1, tmBan->tm_mday, tmBan->tm_hour, tmBan->tm_min,
|
||||
tmUnban->tm_year%100, tmUnban->tm_mon+1, tmUnban->tm_mday, tmUnban->tm_hour, tmUnban->tm_min,
|
||||
fields2[2].GetCString(), fields2[3].GetCString());
|
||||
}
|
||||
}
|
||||
while (banInfo->NextRow());
|
||||
}
|
||||
}
|
||||
while (result->NextRow());
|
||||
|
||||
handler->SendSysMessage(" ===============================================================================");
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool HandleBanListCharacterCommand(ChatHandler* handler, char const* args)
|
||||
{
|
||||
if (!*args)
|
||||
return false;
|
||||
|
||||
char* filterStr = strtok((char*)args, " ");
|
||||
if (!filterStr)
|
||||
return false;
|
||||
|
||||
std::string filter(filterStr);
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_GUID_BY_NAME_FILTER);
|
||||
stmt->setString(0, filter);
|
||||
PreparedQueryResult result = CharacterDatabase.Query(stmt);
|
||||
if (!result)
|
||||
{
|
||||
handler->PSendSysMessage(LANG_BANLIST_NOCHARACTER);
|
||||
return true;
|
||||
}
|
||||
|
||||
handler->PSendSysMessage(LANG_BANLIST_MATCHINGCHARACTER);
|
||||
|
||||
// Chat short output
|
||||
if (handler->GetSession())
|
||||
{
|
||||
do
|
||||
{
|
||||
Field* fields = result->Fetch();
|
||||
PreparedStatement* stmt2 = CharacterDatabase.GetPreparedStatement(CHAR_SEL_BANNED_NAME);
|
||||
stmt2->setUInt32(0, fields[0].GetUInt32());
|
||||
PreparedQueryResult banResult = CharacterDatabase.Query(stmt2);
|
||||
if (banResult)
|
||||
handler->PSendSysMessage("%s", (*banResult)[0].GetCString());
|
||||
}
|
||||
while (result->NextRow());
|
||||
}
|
||||
// Console wide output
|
||||
else
|
||||
{
|
||||
handler->SendSysMessage(LANG_BANLIST_CHARACTERS);
|
||||
handler->SendSysMessage(" =============================================================================== ");
|
||||
handler->SendSysMessage(LANG_BANLIST_CHARACTERS_HEADER);
|
||||
do
|
||||
{
|
||||
handler->SendSysMessage("-------------------------------------------------------------------------------");
|
||||
|
||||
Field* fields = result->Fetch();
|
||||
|
||||
std::string char_name = fields[1].GetString();
|
||||
|
||||
PreparedStatement* stmt2 = CharacterDatabase.GetPreparedStatement(CHAR_SEL_BANINFO_LIST);
|
||||
stmt2->setUInt32(0, fields[0].GetUInt32());
|
||||
PreparedQueryResult banInfo = CharacterDatabase.Query(stmt2);
|
||||
if (banInfo)
|
||||
{
|
||||
Field* banFields = banInfo->Fetch();
|
||||
do
|
||||
{
|
||||
time_t timeBan = time_t(banFields[0].GetUInt32());
|
||||
tm* tmBan = localtime(&timeBan);
|
||||
|
||||
if (banFields[0].GetUInt32() == banFields[1].GetUInt32())
|
||||
{
|
||||
handler->PSendSysMessage("|%-15.15s|%02d-%02d-%02d %02d:%02d| permanent |%-15.15s|%-15.15s|",
|
||||
char_name.c_str(), tmBan->tm_year%100, tmBan->tm_mon+1, tmBan->tm_mday, tmBan->tm_hour, tmBan->tm_min,
|
||||
banFields[2].GetCString(), banFields[3].GetCString());
|
||||
}
|
||||
else
|
||||
{
|
||||
time_t timeUnban = time_t(banFields[1].GetUInt32());
|
||||
tm* tmUnban = localtime(&timeUnban);
|
||||
handler->PSendSysMessage("|%-15.15s|%02d-%02d-%02d %02d:%02d|%02d-%02d-%02d %02d:%02d|%-15.15s|%-15.15s|",
|
||||
char_name.c_str(), tmBan->tm_year%100, tmBan->tm_mon+1, tmBan->tm_mday, tmBan->tm_hour, tmBan->tm_min,
|
||||
tmUnban->tm_year%100, tmUnban->tm_mon+1, tmUnban->tm_mday, tmUnban->tm_hour, tmUnban->tm_min,
|
||||
banFields[2].GetCString(), banFields[3].GetCString());
|
||||
}
|
||||
}
|
||||
while (banInfo->NextRow());
|
||||
}
|
||||
}
|
||||
while (result->NextRow());
|
||||
handler->SendSysMessage(" =============================================================================== ");
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool HandleBanListIPCommand(ChatHandler* handler, char const* args)
|
||||
{
|
||||
PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_DEL_EXPIRED_IP_BANS);
|
||||
LoginDatabase.Execute(stmt);
|
||||
|
||||
char* filterStr = strtok((char*)args, " ");
|
||||
std::string filter = filterStr ? filterStr : "";
|
||||
LoginDatabase.EscapeString(filter);
|
||||
|
||||
PreparedQueryResult result;
|
||||
|
||||
if (filter.empty())
|
||||
{
|
||||
PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_IP_BANNED_ALL);
|
||||
result = LoginDatabase.Query(stmt);
|
||||
}
|
||||
else
|
||||
{
|
||||
PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_IP_BANNED_BY_IP);
|
||||
stmt->setString(0, filter);
|
||||
result = LoginDatabase.Query(stmt);
|
||||
}
|
||||
|
||||
if (!result)
|
||||
{
|
||||
handler->PSendSysMessage(LANG_BANLIST_NOIP);
|
||||
return true;
|
||||
}
|
||||
|
||||
handler->PSendSysMessage(LANG_BANLIST_MATCHINGIP);
|
||||
// Chat short output
|
||||
if (handler->GetSession())
|
||||
{
|
||||
do
|
||||
{
|
||||
Field* fields = result->Fetch();
|
||||
handler->PSendSysMessage("%s", fields[0].GetCString());
|
||||
}
|
||||
while (result->NextRow());
|
||||
}
|
||||
// Console wide output
|
||||
else
|
||||
{
|
||||
handler->SendSysMessage(LANG_BANLIST_IPS);
|
||||
handler->SendSysMessage(" ===============================================================================");
|
||||
handler->SendSysMessage(LANG_BANLIST_IPS_HEADER);
|
||||
do
|
||||
{
|
||||
handler->SendSysMessage("-------------------------------------------------------------------------------");
|
||||
Field* fields = result->Fetch();
|
||||
time_t timeBan = time_t(fields[1].GetUInt32());
|
||||
tm* tmBan = localtime(&timeBan);
|
||||
if (fields[1].GetUInt32() == fields[2].GetUInt32())
|
||||
{
|
||||
handler->PSendSysMessage("|%-15.15s|%02d-%02d-%02d %02d:%02d| permanent |%-15.15s|%-15.15s|",
|
||||
fields[0].GetCString(), tmBan->tm_year%100, tmBan->tm_mon+1, tmBan->tm_mday, tmBan->tm_hour, tmBan->tm_min,
|
||||
fields[3].GetCString(), fields[4].GetCString());
|
||||
}
|
||||
else
|
||||
{
|
||||
time_t timeUnban = time_t(fields[2].GetUInt32());
|
||||
tm* tmUnban = localtime(&timeUnban);
|
||||
handler->PSendSysMessage("|%-15.15s|%02d-%02d-%02d %02d:%02d|%02d-%02d-%02d %02d:%02d|%-15.15s|%-15.15s|",
|
||||
fields[0].GetCString(), tmBan->tm_year%100, tmBan->tm_mon+1, tmBan->tm_mday, tmBan->tm_hour, tmBan->tm_min,
|
||||
tmUnban->tm_year%100, tmUnban->tm_mon+1, tmUnban->tm_mday, tmUnban->tm_hour, tmUnban->tm_min,
|
||||
fields[3].GetCString(), fields[4].GetCString());
|
||||
}
|
||||
}
|
||||
while (result->NextRow());
|
||||
|
||||
handler->SendSysMessage(" ===============================================================================");
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool HandleUnBanAccountCommand(ChatHandler* handler, char const* args)
|
||||
{
|
||||
return HandleUnBanHelper(BAN_ACCOUNT, args, handler);
|
||||
}
|
||||
|
||||
static bool HandleUnBanCharacterCommand(ChatHandler* handler, char const* args)
|
||||
{
|
||||
if (!*args)
|
||||
return false;
|
||||
|
||||
char* nameStr = strtok((char*)args, " ");
|
||||
if (!nameStr)
|
||||
return false;
|
||||
|
||||
std::string name = nameStr;
|
||||
|
||||
if (!normalizePlayerName(name))
|
||||
{
|
||||
handler->SendSysMessage(LANG_PLAYER_NOT_FOUND);
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!sWorld->RemoveBanCharacter(name))
|
||||
{
|
||||
handler->SendSysMessage(LANG_PLAYER_NOT_FOUND);
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool HandleUnBanAccountByCharCommand(ChatHandler* handler, char const* args)
|
||||
{
|
||||
return HandleUnBanHelper(BAN_CHARACTER, args, handler);
|
||||
}
|
||||
|
||||
static bool HandleUnBanIPCommand(ChatHandler* handler, char const* args)
|
||||
{
|
||||
return HandleUnBanHelper(BAN_IP, args, handler);
|
||||
}
|
||||
|
||||
static bool HandleUnBanHelper(BanMode mode, char const* args, ChatHandler* handler)
|
||||
{
|
||||
if (!*args)
|
||||
return false;
|
||||
|
||||
char* nameOrIPStr = strtok((char*)args, " ");
|
||||
if (!nameOrIPStr)
|
||||
return false;
|
||||
|
||||
std::string nameOrIP = nameOrIPStr;
|
||||
|
||||
switch (mode)
|
||||
{
|
||||
case BAN_ACCOUNT:
|
||||
if (!AccountMgr::normalizeString(nameOrIP))
|
||||
{
|
||||
handler->PSendSysMessage(LANG_ACCOUNT_NOT_EXIST, nameOrIP.c_str());
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case BAN_CHARACTER:
|
||||
if (!normalizePlayerName(nameOrIP))
|
||||
{
|
||||
handler->SendSysMessage(LANG_PLAYER_NOT_FOUND);
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case BAN_IP:
|
||||
if (!IsIPAddress(nameOrIP.c_str()))
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
|
||||
if (sWorld->RemoveBanAccount(mode, nameOrIP))
|
||||
handler->PSendSysMessage(LANG_UNBAN_UNBANNED, nameOrIP.c_str());
|
||||
else
|
||||
handler->PSendSysMessage(LANG_UNBAN_ERROR, nameOrIP.c_str());
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
void AddSC_ban_commandscript()
|
||||
{
|
||||
new ban_commandscript();
|
||||
}
|
||||
@@ -0,0 +1,180 @@
|
||||
/*
|
||||
* Copyright (C) 2008-2011 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: bf_commandscript
|
||||
%Complete: 100
|
||||
Comment: All bf related commands
|
||||
Category: commandscripts
|
||||
EndScriptData */
|
||||
|
||||
#include "ScriptMgr.h"
|
||||
#include "Chat.h"
|
||||
#include "BattlefieldMgr.h"
|
||||
|
||||
class bf_commandscript : public CommandScript
|
||||
{
|
||||
public:
|
||||
bf_commandscript() : CommandScript("bf_commandscript") { }
|
||||
|
||||
ChatCommand* GetCommands() const
|
||||
{
|
||||
static ChatCommand battlefieldcommandTable[] =
|
||||
{
|
||||
{ "start", SEC_ADMINISTRATOR, false, &HandleBattlefieldStart, "", NULL },
|
||||
{ "stop", SEC_ADMINISTRATOR, false, &HandleBattlefieldEnd, "", NULL },
|
||||
{ "switch", SEC_ADMINISTRATOR, false, &HandleBattlefieldSwitch, "", NULL },
|
||||
{ "timer", SEC_ADMINISTRATOR, false, &HandleBattlefieldTimer, "", NULL },
|
||||
{ "enable", SEC_ADMINISTRATOR, false, &HandleBattlefieldEnable, "", NULL },
|
||||
{ NULL, 0, false, NULL, "", NULL }
|
||||
};
|
||||
static ChatCommand commandTable[] =
|
||||
{
|
||||
{ "bf", SEC_ADMINISTRATOR, false, NULL, "", battlefieldcommandTable },
|
||||
{ NULL, 0, false, NULL, "", NULL }
|
||||
};
|
||||
return commandTable;
|
||||
}
|
||||
|
||||
static bool HandleBattlefieldStart(ChatHandler* handler, const char* args)
|
||||
{
|
||||
uint32 battleid = 0;
|
||||
char* battleid_str = strtok((char*)args, " ");
|
||||
if (!battleid_str)
|
||||
return false;
|
||||
|
||||
battleid = atoi(battleid_str);
|
||||
|
||||
Battlefield* bf = sBattlefieldMgr->GetBattlefieldByBattleId(battleid);
|
||||
|
||||
if (!bf)
|
||||
return false;
|
||||
|
||||
bf->StartBattle();
|
||||
|
||||
if (battleid == 1)
|
||||
handler->SendGlobalGMSysMessage("Wintergrasp (Command start used)");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool HandleBattlefieldEnd(ChatHandler* handler, const char* args)
|
||||
{
|
||||
uint32 battleid = 0;
|
||||
char* battleid_str = strtok((char*)args, " ");
|
||||
if (!battleid_str)
|
||||
return false;
|
||||
|
||||
battleid = atoi(battleid_str);
|
||||
|
||||
Battlefield* bf = sBattlefieldMgr->GetBattlefieldByBattleId(battleid);
|
||||
|
||||
if (!bf)
|
||||
return false;
|
||||
|
||||
bf->EndBattle(true);
|
||||
|
||||
if (battleid == 1)
|
||||
handler->SendGlobalGMSysMessage("Wintergrasp (Command stop used)");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool HandleBattlefieldEnable(ChatHandler* handler, const char* args)
|
||||
{
|
||||
uint32 battleid = 0;
|
||||
char* battleid_str = strtok((char*)args, " ");
|
||||
if (!battleid_str)
|
||||
return false;
|
||||
|
||||
battleid = atoi(battleid_str);
|
||||
|
||||
Battlefield* bf = sBattlefieldMgr->GetBattlefieldByBattleId(battleid);
|
||||
|
||||
if (!bf)
|
||||
return false;
|
||||
|
||||
if (bf->IsEnabled())
|
||||
{
|
||||
bf->ToggleBattlefield(false);
|
||||
if (battleid == 1)
|
||||
handler->SendGlobalGMSysMessage("Wintergrasp is disabled");
|
||||
}
|
||||
else
|
||||
{
|
||||
bf->ToggleBattlefield(true);
|
||||
if (battleid == 1)
|
||||
handler->SendGlobalGMSysMessage("Wintergrasp is enabled");
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool HandleBattlefieldSwitch(ChatHandler* handler, const char* args)
|
||||
{
|
||||
uint32 battleid = 0;
|
||||
char* battleid_str = strtok((char*)args, " ");
|
||||
if (!battleid_str)
|
||||
return false;
|
||||
|
||||
battleid = atoi(battleid_str);
|
||||
|
||||
Battlefield* bf = sBattlefieldMgr->GetBattlefieldByBattleId(battleid);
|
||||
|
||||
if (!bf)
|
||||
return false;
|
||||
|
||||
bf->EndBattle(false);
|
||||
if (battleid == 1)
|
||||
handler->SendGlobalGMSysMessage("Wintergrasp (Command switch used)");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool HandleBattlefieldTimer(ChatHandler* handler, const char* args)
|
||||
{
|
||||
uint32 battleid = 0;
|
||||
uint32 time = 0;
|
||||
char* battleid_str = strtok((char*)args, " ");
|
||||
if (!battleid_str)
|
||||
return false;
|
||||
char* time_str = strtok(NULL, " ");
|
||||
if (!time_str)
|
||||
return false;
|
||||
|
||||
battleid = atoi(battleid_str);
|
||||
|
||||
time = atoi(time_str);
|
||||
|
||||
Battlefield* bf = sBattlefieldMgr->GetBattlefieldByBattleId(battleid);
|
||||
|
||||
if (!bf)
|
||||
return false;
|
||||
|
||||
bf->SetTimer(time * IN_MILLISECONDS);
|
||||
bf->SendInitWorldStatesToAll();
|
||||
if (battleid == 1)
|
||||
handler->SendGlobalGMSysMessage("Wintergrasp (Command timer used)");
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
void AddSC_bf_commandscript()
|
||||
{
|
||||
new bf_commandscript();
|
||||
}
|
||||
@@ -0,0 +1,310 @@
|
||||
/*
|
||||
* 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: cast_commandscript
|
||||
%Complete: 100
|
||||
Comment: All cast related commands
|
||||
Category: commandscripts
|
||||
EndScriptData */
|
||||
|
||||
#include "ScriptMgr.h"
|
||||
#include "Chat.h"
|
||||
|
||||
class cast_commandscript : public CommandScript
|
||||
{
|
||||
public:
|
||||
cast_commandscript() : CommandScript("cast_commandscript") { }
|
||||
|
||||
ChatCommand* GetCommands() const
|
||||
{
|
||||
static ChatCommand castCommandTable[] =
|
||||
{
|
||||
{ "back", SEC_ADMINISTRATOR, false, &HandleCastBackCommand, "", NULL },
|
||||
{ "dist", SEC_ADMINISTRATOR, false, &HandleCastDistCommand, "", NULL },
|
||||
{ "self", SEC_ADMINISTRATOR, false, &HandleCastSelfCommand, "", NULL },
|
||||
{ "target", SEC_ADMINISTRATOR, false, &HandleCastTargetCommad, "", NULL },
|
||||
{ "dest", SEC_ADMINISTRATOR, false, &HandleCastDestCommand, "", NULL },
|
||||
{ "", SEC_ADMINISTRATOR, false, &HandleCastCommand, "", NULL },
|
||||
{ NULL, 0, false, NULL, "", NULL }
|
||||
};
|
||||
static ChatCommand commandTable[] =
|
||||
{
|
||||
{ "cast", SEC_ADMINISTRATOR, false, NULL, "", castCommandTable },
|
||||
{ NULL, 0, false, NULL, "", NULL }
|
||||
};
|
||||
return commandTable;
|
||||
}
|
||||
|
||||
static bool HandleCastCommand(ChatHandler* handler, char const* args)
|
||||
{
|
||||
if (!*args)
|
||||
return false;
|
||||
|
||||
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 (!spellId)
|
||||
return false;
|
||||
|
||||
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId);
|
||||
if (!spellInfo)
|
||||
{
|
||||
handler->PSendSysMessage(LANG_COMMAND_NOSPELLFOUND);
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!SpellMgr::IsSpellValid(spellInfo, handler->GetSession()->GetPlayer()))
|
||||
{
|
||||
handler->PSendSysMessage(LANG_COMMAND_SPELL_BROKEN, spellId);
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
char* triggeredStr = strtok(NULL, " ");
|
||||
if (triggeredStr)
|
||||
{
|
||||
int l = strlen(triggeredStr);
|
||||
if (strncmp(triggeredStr, "triggered", l) != 0)
|
||||
return false;
|
||||
}
|
||||
|
||||
bool triggered = (triggeredStr != NULL);
|
||||
|
||||
handler->GetSession()->GetPlayer()->CastSpell(target, spellId, triggered);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool HandleCastBackCommand(ChatHandler* handler, char const* args)
|
||||
{
|
||||
Creature* caster = handler->getSelectedCreature();
|
||||
if (!caster)
|
||||
{
|
||||
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
|
||||
// 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))
|
||||
{
|
||||
handler->PSendSysMessage(LANG_COMMAND_NOSPELLFOUND);
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
char* triggeredStr = strtok(NULL, " ");
|
||||
if (triggeredStr)
|
||||
{
|
||||
int l = strlen(triggeredStr);
|
||||
if (strncmp(triggeredStr, "triggered", l) != 0)
|
||||
return false;
|
||||
}
|
||||
|
||||
bool triggered = (triggeredStr != NULL);
|
||||
|
||||
caster->CastSpell(handler->GetSession()->GetPlayer(), spellId, triggered);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool HandleCastDistCommand(ChatHandler* handler, char const* args)
|
||||
{
|
||||
if (!*args)
|
||||
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 (!spellId)
|
||||
return false;
|
||||
|
||||
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId);
|
||||
if (!spellInfo)
|
||||
{
|
||||
handler->PSendSysMessage(LANG_COMMAND_NOSPELLFOUND);
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!SpellMgr::IsSpellValid(spellInfo, handler->GetSession()->GetPlayer()))
|
||||
{
|
||||
handler->PSendSysMessage(LANG_COMMAND_SPELL_BROKEN, spellId);
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
char* distStr = strtok(NULL, " ");
|
||||
|
||||
float dist = 0;
|
||||
|
||||
if (distStr)
|
||||
sscanf(distStr, "%f", &dist);
|
||||
|
||||
char* triggeredStr = strtok(NULL, " ");
|
||||
if (triggeredStr)
|
||||
{
|
||||
int l = strlen(triggeredStr);
|
||||
if (strncmp(triggeredStr, "triggered", l) != 0)
|
||||
return false;
|
||||
}
|
||||
|
||||
bool triggered = (triggeredStr != NULL);
|
||||
|
||||
float x, y, z;
|
||||
handler->GetSession()->GetPlayer()->GetClosePoint(x, y, z, dist);
|
||||
|
||||
handler->GetSession()->GetPlayer()->CastSpell(x, y, z, spellId, triggered);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool HandleCastSelfCommand(ChatHandler* handler, char const* args)
|
||||
{
|
||||
if (!*args)
|
||||
return false;
|
||||
|
||||
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 (!spellId)
|
||||
return false;
|
||||
|
||||
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId);
|
||||
if (!spellInfo)
|
||||
return false;
|
||||
|
||||
if (!SpellMgr::IsSpellValid(spellInfo, handler->GetSession()->GetPlayer()))
|
||||
{
|
||||
handler->PSendSysMessage(LANG_COMMAND_SPELL_BROKEN, spellId);
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
target->CastSpell(target, spellId, false);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool HandleCastTargetCommad(ChatHandler* handler, char const* args)
|
||||
{
|
||||
Creature* caster = handler->getSelectedCreature();
|
||||
if (!caster)
|
||||
{
|
||||
handler->SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE);
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!caster->getVictim())
|
||||
{
|
||||
handler->SendSysMessage(LANG_SELECTED_TARGET_NOT_HAVE_VICTIM);
|
||||
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 (!spellId || !sSpellMgr->GetSpellInfo(spellId))
|
||||
{
|
||||
handler->PSendSysMessage(LANG_COMMAND_NOSPELLFOUND);
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
char* triggeredStr = strtok(NULL, " ");
|
||||
if (triggeredStr)
|
||||
{
|
||||
int l = strlen(triggeredStr);
|
||||
if (strncmp(triggeredStr, "triggered", l) != 0)
|
||||
return false;
|
||||
}
|
||||
|
||||
bool triggered = (triggeredStr != NULL);
|
||||
|
||||
caster->CastSpell(caster->getVictim(), spellId, triggered);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool HandleCastDestCommand(ChatHandler* handler, char const* args)
|
||||
{
|
||||
Unit* caster = handler->getSelectedUnit();
|
||||
if (!caster)
|
||||
{
|
||||
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 (!spellId || !sSpellMgr->GetSpellInfo(spellId))
|
||||
{
|
||||
handler->PSendSysMessage(LANG_COMMAND_NOSPELLFOUND);
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
char* posX = strtok(NULL, " ");
|
||||
char* posY = strtok(NULL, " ");
|
||||
char* posZ = strtok(NULL, " ");
|
||||
|
||||
if (!posX || !posY || !posZ)
|
||||
return false;
|
||||
|
||||
float x = float(atof(posX));
|
||||
float y = float(atof(posY));
|
||||
float z = float(atof(posZ));
|
||||
|
||||
char* triggeredStr = strtok(NULL, " ");
|
||||
if (triggeredStr)
|
||||
{
|
||||
int l = strlen(triggeredStr);
|
||||
if (strncmp(triggeredStr, "triggered", l) != 0)
|
||||
return false;
|
||||
}
|
||||
|
||||
bool triggered = (triggeredStr != NULL);
|
||||
|
||||
caster->CastSpell(x, y, z, spellId, triggered);
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
void AddSC_cast_commandscript()
|
||||
{
|
||||
new cast_commandscript();
|
||||
}
|
||||
@@ -0,0 +1,924 @@
|
||||
/*
|
||||
* 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: character_commandscript
|
||||
%Complete: 100
|
||||
Comment: All character related commands
|
||||
Category: commandscripts
|
||||
EndScriptData */
|
||||
|
||||
#include "ScriptMgr.h"
|
||||
#include "Chat.h"
|
||||
#include "AccountMgr.h"
|
||||
#include "ObjectMgr.h"
|
||||
#include "PlayerDump.h"
|
||||
|
||||
class character_commandscript : public CommandScript
|
||||
{
|
||||
public:
|
||||
character_commandscript() : CommandScript("character_commandscript") { }
|
||||
|
||||
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 },
|
||||
{ "list", SEC_ADMINISTRATOR, true, &HandleCharacterDeletedListCommand, "", NULL },
|
||||
{ "restore", SEC_ADMINISTRATOR, true, &HandleCharacterDeletedRestoreCommand, "", NULL },
|
||||
{ "old", SEC_CONSOLE, true, &HandleCharacterDeletedOldCommand, "", NULL },
|
||||
{ NULL, 0, false, NULL, "", NULL }
|
||||
};
|
||||
|
||||
static ChatCommand characterCommandTable[] =
|
||||
{
|
||||
{ "customize", SEC_GAMEMASTER, true, &HandleCharacterCustomizeCommand, "", NULL },
|
||||
{ "changefaction", SEC_GAMEMASTER, true, &HandleCharacterChangeFactionCommand, "", NULL },
|
||||
{ "changerace", SEC_GAMEMASTER, true, &HandleCharacterChangeRaceCommand, "", NULL },
|
||||
{ "deleted", SEC_GAMEMASTER, true, NULL, "", characterDeletedCommandTable },
|
||||
{ "erase", SEC_CONSOLE, true, &HandleCharacterEraseCommand, "", NULL },
|
||||
{ "level", SEC_ADMINISTRATOR, true, &HandleCharacterLevelCommand, "", NULL },
|
||||
{ "rename", SEC_GAMEMASTER, true, &HandleCharacterRenameCommand, "", NULL },
|
||||
{ "reputation", SEC_GAMEMASTER, true, &HandleCharacterReputationCommand, "", NULL },
|
||||
{ "titles", SEC_GAMEMASTER, true, &HandleCharacterTitlesCommand, "", NULL },
|
||||
{ NULL, 0, false, NULL, "", NULL }
|
||||
};
|
||||
|
||||
static ChatCommand commandTable[] =
|
||||
{
|
||||
{ "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;
|
||||
}
|
||||
|
||||
// Stores informations about a deleted character
|
||||
struct DeletedInfo
|
||||
{
|
||||
uint32 lowGuid; ///< the low GUID from the character
|
||||
std::string name; ///< the character name
|
||||
uint32 accountId; ///< the account id
|
||||
std::string accountName; ///< the account name
|
||||
time_t deleteDate; ///< the date at which the character has been deleted
|
||||
};
|
||||
|
||||
typedef std::list<DeletedInfo> DeletedInfoList;
|
||||
|
||||
/**
|
||||
* Collects all GUIDs (and related info) from deleted characters which are still in the database.
|
||||
*
|
||||
* @param foundList a reference to an std::list which will be filled with info data
|
||||
* @param searchString the search string which either contains a player GUID or a part fo the character-name
|
||||
* @return returns false if there was a problem while selecting the characters (e.g. player name not normalizeable)
|
||||
*/
|
||||
static bool GetDeletedCharacterInfoList(DeletedInfoList& foundList, std::string searchString)
|
||||
{
|
||||
PreparedQueryResult result;
|
||||
PreparedStatement* stmt;
|
||||
if (!searchString.empty())
|
||||
{
|
||||
// search by GUID
|
||||
if (isNumeric(searchString.c_str()))
|
||||
{
|
||||
stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_DEL_INFO_BY_GUID);
|
||||
stmt->setUInt32(0, uint32(atoi(searchString.c_str())));
|
||||
result = CharacterDatabase.Query(stmt);
|
||||
}
|
||||
// search by name
|
||||
else
|
||||
{
|
||||
if (!normalizePlayerName(searchString))
|
||||
return false;
|
||||
|
||||
stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_DEL_INFO_BY_NAME);
|
||||
stmt->setString(0, searchString);
|
||||
result = CharacterDatabase.Query(stmt);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_DEL_INFO);
|
||||
result = CharacterDatabase.Query(stmt);
|
||||
}
|
||||
|
||||
if (result)
|
||||
{
|
||||
do
|
||||
{
|
||||
Field* fields = result->Fetch();
|
||||
|
||||
DeletedInfo info;
|
||||
|
||||
info.lowGuid = fields[0].GetUInt32();
|
||||
info.name = fields[1].GetString();
|
||||
info.accountId = fields[2].GetUInt32();
|
||||
|
||||
// account name will be empty for not existed account
|
||||
AccountMgr::GetName(info.accountId, info.accountName);
|
||||
info.deleteDate = time_t(fields[3].GetUInt32());
|
||||
foundList.push_back(info);
|
||||
}
|
||||
while (result->NextRow());
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows all deleted characters which matches the given search string, expected non empty list
|
||||
*
|
||||
* @see HandleCharacterDeletedListCommand
|
||||
* @see HandleCharacterDeletedRestoreCommand
|
||||
* @see HandleCharacterDeletedDeleteCommand
|
||||
* @see DeletedInfoList
|
||||
*
|
||||
* @param foundList contains a list with all found deleted characters
|
||||
*/
|
||||
static void HandleCharacterDeletedListHelper(DeletedInfoList const& foundList, ChatHandler* handler)
|
||||
{
|
||||
if (!handler->GetSession())
|
||||
{
|
||||
handler->SendSysMessage(LANG_CHARACTER_DELETED_LIST_BAR);
|
||||
handler->SendSysMessage(LANG_CHARACTER_DELETED_LIST_HEADER);
|
||||
handler->SendSysMessage(LANG_CHARACTER_DELETED_LIST_BAR);
|
||||
}
|
||||
|
||||
for (DeletedInfoList::const_iterator itr = foundList.begin(); itr != foundList.end(); ++itr)
|
||||
{
|
||||
std::string dateStr = TimeToTimestampStr(itr->deleteDate);
|
||||
|
||||
if (!handler->GetSession())
|
||||
handler->PSendSysMessage(LANG_CHARACTER_DELETED_LIST_LINE_CONSOLE,
|
||||
itr->lowGuid, itr->name.c_str(), itr->accountName.empty() ? "<Not existed>" : itr->accountName.c_str(),
|
||||
itr->accountId, dateStr.c_str());
|
||||
else
|
||||
handler->PSendSysMessage(LANG_CHARACTER_DELETED_LIST_LINE_CHAT,
|
||||
itr->lowGuid, itr->name.c_str(), itr->accountName.empty() ? "<Not existed>" : itr->accountName.c_str(),
|
||||
itr->accountId, dateStr.c_str());
|
||||
}
|
||||
|
||||
if (!handler->GetSession())
|
||||
handler->SendSysMessage(LANG_CHARACTER_DELETED_LIST_BAR);
|
||||
}
|
||||
|
||||
/**
|
||||
* Restore a previously deleted character
|
||||
*
|
||||
* @see HandleCharacterDeletedListHelper
|
||||
* @see HandleCharacterDeletedRestoreCommand
|
||||
* @see HandleCharacterDeletedDeleteCommand
|
||||
* @see DeletedInfoList
|
||||
*
|
||||
* @param delInfo the informations about the character which will be restored
|
||||
*/
|
||||
static void HandleCharacterDeletedRestoreHelper(DeletedInfo const& delInfo, ChatHandler* handler)
|
||||
{
|
||||
if (delInfo.accountName.empty()) // account not exist
|
||||
{
|
||||
handler->PSendSysMessage(LANG_CHARACTER_DELETED_SKIP_ACCOUNT, delInfo.name.c_str(), delInfo.lowGuid, delInfo.accountId);
|
||||
return;
|
||||
}
|
||||
|
||||
// check character count
|
||||
uint32 charcount = AccountMgr::GetCharactersCount(delInfo.accountId);
|
||||
if (charcount >= 10)
|
||||
{
|
||||
handler->PSendSysMessage(LANG_CHARACTER_DELETED_SKIP_FULL, delInfo.name.c_str(), delInfo.lowGuid, delInfo.accountId);
|
||||
return;
|
||||
}
|
||||
|
||||
if (sObjectMgr->GetPlayerGUIDByName(delInfo.name))
|
||||
{
|
||||
handler->PSendSysMessage(LANG_CHARACTER_DELETED_SKIP_NAME, delInfo.name.c_str(), delInfo.lowGuid, delInfo.accountId);
|
||||
return;
|
||||
}
|
||||
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UDP_RESTORE_DELETE_INFO);
|
||||
stmt->setString(0, delInfo.name);
|
||||
stmt->setUInt32(1, delInfo.accountId);
|
||||
stmt->setUInt32(2, delInfo.lowGuid);
|
||||
CharacterDatabase.Execute(stmt);
|
||||
|
||||
stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER_NAME_DATA);
|
||||
stmt->setUInt32(0, delInfo.lowGuid);
|
||||
if (PreparedQueryResult result = CharacterDatabase.Query(stmt))
|
||||
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)
|
||||
return false;
|
||||
|
||||
Player* target;
|
||||
if (!handler->extractPlayerTarget((char*)args, &target))
|
||||
return false;
|
||||
|
||||
LocaleConstant loc = handler->GetSessionDbcLocale();
|
||||
char const* targetName = target->GetName();
|
||||
char const* knownStr = handler->GetTrinityString(LANG_KNOWN);
|
||||
|
||||
// Search in CharTitles.dbc
|
||||
for (uint32 id = 0; id < sCharTitlesStore.GetNumRows(); id++)
|
||||
{
|
||||
CharTitlesEntry const* titleInfo = sCharTitlesStore.LookupEntry(id);
|
||||
|
||||
if (titleInfo && target->HasTitle(titleInfo))
|
||||
{
|
||||
std::string name = titleInfo->name[loc];
|
||||
if (name.empty())
|
||||
continue;
|
||||
|
||||
char const* activeStr = target && target->GetUInt32Value(PLAYER_CHOSEN_TITLE) == titleInfo->bit_index
|
||||
? handler->GetTrinityString(LANG_ACTIVE)
|
||||
: "";
|
||||
|
||||
char titleNameStr[80];
|
||||
snprintf(titleNameStr, 80, name.c_str(), targetName);
|
||||
|
||||
// send title in "id (idx:idx) - [namedlink locale]" format
|
||||
if (handler->GetSession())
|
||||
handler->PSendSysMessage(LANG_TITLE_LIST_CHAT, id, titleInfo->bit_index, id, titleNameStr, localeNames[loc], knownStr, activeStr);
|
||||
else
|
||||
handler->PSendSysMessage(LANG_TITLE_LIST_CONSOLE, id, titleInfo->bit_index, name.c_str(), localeNames[loc], knownStr, activeStr);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//rename characters
|
||||
static bool HandleCharacterRenameCommand(ChatHandler* handler, char const* args)
|
||||
{
|
||||
Player* target;
|
||||
uint64 targetGuid;
|
||||
std::string targetName;
|
||||
if (!handler->extractPlayerTarget((char*)args, &target, &targetGuid, &targetName))
|
||||
return false;
|
||||
|
||||
if (target)
|
||||
{
|
||||
// check online security
|
||||
if (handler->HasLowerSecurity(target, 0))
|
||||
return false;
|
||||
|
||||
handler->PSendSysMessage(LANG_RENAME_PLAYER, handler->GetNameLink(target).c_str());
|
||||
target->SetAtLoginFlag(AT_LOGIN_RENAME);
|
||||
}
|
||||
else
|
||||
{
|
||||
// check offline security
|
||||
if (handler->HasLowerSecurity(NULL, targetGuid))
|
||||
return false;
|
||||
|
||||
std::string oldNameLink = handler->playerLink(targetName);
|
||||
handler->PSendSysMessage(LANG_RENAME_PLAYER_GUID, oldNameLink.c_str(), GUID_LOPART(targetGuid));
|
||||
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_ADD_AT_LOGIN_FLAG);
|
||||
stmt->setUInt16(0, uint16(AT_LOGIN_RENAME));
|
||||
stmt->setUInt32(1, GUID_LOPART(targetGuid));
|
||||
CharacterDatabase.Execute(stmt);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool HandleCharacterLevelCommand(ChatHandler* handler, char const* args)
|
||||
{
|
||||
char* nameStr;
|
||||
char* levelStr;
|
||||
handler->extractOptFirstArg((char*)args, &nameStr, &levelStr);
|
||||
if (!levelStr)
|
||||
return false;
|
||||
|
||||
// exception opt second arg: .character level $name
|
||||
if (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 newlevel = levelStr ? atoi(levelStr) : oldlevel;
|
||||
|
||||
if (newlevel < 1)
|
||||
return false; // invalid level
|
||||
|
||||
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 player == NULL
|
||||
{
|
||||
std::string nameLink = handler->playerLink(targetName);
|
||||
handler->PSendSysMessage(LANG_YOU_CHANGE_LVL, nameLink.c_str(), newlevel);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// customize characters
|
||||
static bool HandleCharacterCustomizeCommand(ChatHandler* handler, char const* args)
|
||||
{
|
||||
Player* target;
|
||||
uint64 targetGuid;
|
||||
std::string targetName;
|
||||
if (!handler->extractPlayerTarget((char*)args, &target, &targetGuid, &targetName))
|
||||
return false;
|
||||
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_ADD_AT_LOGIN_FLAG);
|
||||
stmt->setUInt16(0, uint16(AT_LOGIN_CUSTOMIZE));
|
||||
if (target)
|
||||
{
|
||||
handler->PSendSysMessage(LANG_CUSTOMIZE_PLAYER, handler->GetNameLink(target).c_str());
|
||||
target->SetAtLoginFlag(AT_LOGIN_CUSTOMIZE);
|
||||
stmt->setUInt32(1, target->GetGUIDLow());
|
||||
}
|
||||
else
|
||||
{
|
||||
std::string oldNameLink = handler->playerLink(targetName);
|
||||
stmt->setUInt32(1, GUID_LOPART(targetGuid));
|
||||
handler->PSendSysMessage(LANG_CUSTOMIZE_PLAYER_GUID, oldNameLink.c_str(), GUID_LOPART(targetGuid));
|
||||
}
|
||||
CharacterDatabase.Execute(stmt);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool HandleCharacterChangeFactionCommand(ChatHandler* handler, char const* args)
|
||||
{
|
||||
Player* target;
|
||||
uint64 targetGuid;
|
||||
std::string targetName;
|
||||
|
||||
if (!handler->extractPlayerTarget((char*)args, &target, &targetGuid, &targetName))
|
||||
return false;
|
||||
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_ADD_AT_LOGIN_FLAG);
|
||||
stmt->setUInt16(0, uint16(AT_LOGIN_CHANGE_FACTION));
|
||||
if (target)
|
||||
{
|
||||
handler->PSendSysMessage(LANG_CUSTOMIZE_PLAYER, handler->GetNameLink(target).c_str());
|
||||
target->SetAtLoginFlag(AT_LOGIN_CHANGE_FACTION);
|
||||
stmt->setUInt32(1, target->GetGUIDLow());
|
||||
}
|
||||
else
|
||||
{
|
||||
std::string oldNameLink = handler->playerLink(targetName);
|
||||
handler->PSendSysMessage(LANG_CUSTOMIZE_PLAYER_GUID, oldNameLink.c_str(), GUID_LOPART(targetGuid));
|
||||
stmt->setUInt32(1, GUID_LOPART(targetGuid));
|
||||
}
|
||||
CharacterDatabase.Execute(stmt);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool HandleCharacterChangeRaceCommand(ChatHandler* handler, char const* args)
|
||||
{
|
||||
Player* target;
|
||||
uint64 targetGuid;
|
||||
std::string targetName;
|
||||
if (!handler->extractPlayerTarget((char*)args, &target, &targetGuid, &targetName))
|
||||
return false;
|
||||
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_ADD_AT_LOGIN_FLAG);
|
||||
stmt->setUInt16(0, uint16(AT_LOGIN_CHANGE_RACE));
|
||||
if (target)
|
||||
{
|
||||
// TODO : add text into database
|
||||
handler->PSendSysMessage(LANG_CUSTOMIZE_PLAYER, handler->GetNameLink(target).c_str());
|
||||
target->SetAtLoginFlag(AT_LOGIN_CHANGE_RACE);
|
||||
stmt->setUInt32(1, target->GetGUIDLow());
|
||||
}
|
||||
else
|
||||
{
|
||||
std::string oldNameLink = handler->playerLink(targetName);
|
||||
// TODO : add text into database
|
||||
handler->PSendSysMessage(LANG_CUSTOMIZE_PLAYER_GUID, oldNameLink.c_str(), GUID_LOPART(targetGuid));
|
||||
stmt->setUInt32(1, GUID_LOPART(targetGuid));
|
||||
}
|
||||
CharacterDatabase.Execute(stmt);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool HandleCharacterReputationCommand(ChatHandler* handler, char const* args)
|
||||
{
|
||||
Player* target;
|
||||
if (!handler->extractPlayerTarget((char*)args, &target))
|
||||
return false;
|
||||
|
||||
LocaleConstant loc = handler->GetSessionDbcLocale();
|
||||
|
||||
FactionStateList const& targetFSL = target->GetReputationMgr().GetStateList();
|
||||
for (FactionStateList::const_iterator itr = targetFSL.begin(); itr != targetFSL.end(); ++itr)
|
||||
{
|
||||
FactionState const& faction = itr->second;
|
||||
FactionEntry const* factionEntry = sFactionStore.LookupEntry(faction.ID);
|
||||
char const* factionName = factionEntry ? factionEntry->name[loc] : "#Not found#";
|
||||
ReputationRank rank = target->GetReputationMgr().GetRank(factionEntry);
|
||||
std::string rankName = handler->GetTrinityString(ReputationRankStrIndex[rank]);
|
||||
std::ostringstream ss;
|
||||
if (handler->GetSession())
|
||||
ss << faction.ID << " - |cffffffff|Hfaction:" << faction.ID << "|h[" << factionName << ' ' << localeNames[loc] << "]|h|r";
|
||||
else
|
||||
ss << faction.ID << " - " << factionName << ' ' << localeNames[loc];
|
||||
|
||||
ss << ' ' << rankName << " (" << target->GetReputationMgr().GetReputation(factionEntry) << ')';
|
||||
|
||||
if (faction.Flags & FACTION_FLAG_VISIBLE)
|
||||
ss << handler->GetTrinityString(LANG_FACTION_VISIBLE);
|
||||
if (faction.Flags & FACTION_FLAG_AT_WAR)
|
||||
ss << handler->GetTrinityString(LANG_FACTION_ATWAR);
|
||||
if (faction.Flags & FACTION_FLAG_PEACE_FORCED)
|
||||
ss << handler->GetTrinityString(LANG_FACTION_PEACE_FORCED);
|
||||
if (faction.Flags & FACTION_FLAG_HIDDEN)
|
||||
ss << handler->GetTrinityString(LANG_FACTION_HIDDEN);
|
||||
if (faction.Flags & FACTION_FLAG_INVISIBLE_FORCED)
|
||||
ss << handler->GetTrinityString(LANG_FACTION_INVISIBLE_FORCED);
|
||||
if (faction.Flags & FACTION_FLAG_INACTIVE)
|
||||
ss << handler->GetTrinityString(LANG_FACTION_INACTIVE);
|
||||
|
||||
handler->SendSysMessage(ss.str().c_str());
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles the '.character deleted list' command, which shows all deleted characters which matches the given search string
|
||||
*
|
||||
* @see HandleCharacterDeletedListHelper
|
||||
* @see HandleCharacterDeletedRestoreCommand
|
||||
* @see HandleCharacterDeletedDeleteCommand
|
||||
* @see DeletedInfoList
|
||||
*
|
||||
* @param args the search string which either contains a player GUID or a part fo the character-name
|
||||
*/
|
||||
static bool HandleCharacterDeletedListCommand(ChatHandler* handler, char const* args)
|
||||
{
|
||||
DeletedInfoList foundList;
|
||||
if (!GetDeletedCharacterInfoList(foundList, args))
|
||||
return false;
|
||||
|
||||
// if no characters have been found, output a warning
|
||||
if (foundList.empty())
|
||||
{
|
||||
handler->SendSysMessage(LANG_CHARACTER_DELETED_LIST_EMPTY);
|
||||
return false;
|
||||
}
|
||||
|
||||
HandleCharacterDeletedListHelper(foundList, handler);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles the '.character deleted restore' command, which restores all deleted characters which matches the given search string
|
||||
*
|
||||
* The command automatically calls '.character deleted list' command with the search string to show all restored characters.
|
||||
*
|
||||
* @see HandleCharacterDeletedRestoreHelper
|
||||
* @see HandleCharacterDeletedListCommand
|
||||
* @see HandleCharacterDeletedDeleteCommand
|
||||
*
|
||||
* @param args the search string which either contains a player GUID or a part of the character-name
|
||||
*/
|
||||
static bool HandleCharacterDeletedRestoreCommand(ChatHandler* handler, char const* args)
|
||||
{
|
||||
// It is required to submit at least one argument
|
||||
if (!*args)
|
||||
return false;
|
||||
|
||||
std::string searchString;
|
||||
std::string newCharName;
|
||||
uint32 newAccount = 0;
|
||||
|
||||
// GCC by some strange reason fail build code without temporary variable
|
||||
std::istringstream params(args);
|
||||
params >> searchString >> newCharName >> newAccount;
|
||||
|
||||
DeletedInfoList foundList;
|
||||
if (!GetDeletedCharacterInfoList(foundList, searchString))
|
||||
return false;
|
||||
|
||||
if (foundList.empty())
|
||||
{
|
||||
handler->SendSysMessage(LANG_CHARACTER_DELETED_LIST_EMPTY);
|
||||
return false;
|
||||
}
|
||||
|
||||
handler->SendSysMessage(LANG_CHARACTER_DELETED_RESTORE);
|
||||
HandleCharacterDeletedListHelper(foundList, handler);
|
||||
|
||||
if (newCharName.empty())
|
||||
{
|
||||
// Drop not existed account cases
|
||||
for (DeletedInfoList::iterator itr = foundList.begin(); itr != foundList.end(); ++itr)
|
||||
HandleCharacterDeletedRestoreHelper(*itr, handler);
|
||||
}
|
||||
else if (foundList.size() == 1 && normalizePlayerName(newCharName))
|
||||
{
|
||||
DeletedInfo delInfo = foundList.front();
|
||||
|
||||
// update name
|
||||
delInfo.name = newCharName;
|
||||
|
||||
// if new account provided update deleted info
|
||||
if (newAccount && newAccount != delInfo.accountId)
|
||||
{
|
||||
delInfo.accountId = newAccount;
|
||||
AccountMgr::GetName(newAccount, delInfo.accountName);
|
||||
}
|
||||
|
||||
HandleCharacterDeletedRestoreHelper(delInfo, handler);
|
||||
}
|
||||
else
|
||||
handler->SendSysMessage(LANG_CHARACTER_DELETED_ERR_RENAME);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles the '.character deleted delete' command, which completely deletes all deleted characters which matches the given search string
|
||||
*
|
||||
* @see Player::GetDeletedCharacterGUIDs
|
||||
* @see Player::DeleteFromDB
|
||||
* @see HandleCharacterDeletedListCommand
|
||||
* @see HandleCharacterDeletedRestoreCommand
|
||||
*
|
||||
* @param args the search string which either contains a player GUID or a part fo the character-name
|
||||
*/
|
||||
static bool HandleCharacterDeletedDeleteCommand(ChatHandler* handler, char const* args)
|
||||
{
|
||||
// It is required to submit at least one argument
|
||||
if (!*args)
|
||||
return false;
|
||||
|
||||
DeletedInfoList foundList;
|
||||
if (!GetDeletedCharacterInfoList(foundList, args))
|
||||
return false;
|
||||
|
||||
if (foundList.empty())
|
||||
{
|
||||
handler->SendSysMessage(LANG_CHARACTER_DELETED_LIST_EMPTY);
|
||||
return false;
|
||||
}
|
||||
|
||||
handler->SendSysMessage(LANG_CHARACTER_DELETED_DELETE);
|
||||
HandleCharacterDeletedListHelper(foundList, handler);
|
||||
|
||||
// Call the appropriate function to delete them (current account for deleted characters is 0)
|
||||
for (DeletedInfoList::const_iterator itr = foundList.begin(); itr != foundList.end(); ++itr)
|
||||
Player::DeleteFromDB(itr->lowGuid, 0, false, true);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles the '.character deleted old' command, which completely deletes all deleted characters deleted with some days ago
|
||||
*
|
||||
* @see Player::DeleteOldCharacters
|
||||
* @see Player::DeleteFromDB
|
||||
* @see HandleCharacterDeletedDeleteCommand
|
||||
* @see HandleCharacterDeletedListCommand
|
||||
* @see HandleCharacterDeletedRestoreCommand
|
||||
*
|
||||
* @param args the search string which either contains a player GUID or a part fo the character-name
|
||||
*/
|
||||
static bool HandleCharacterDeletedOldCommand(ChatHandler* /*handler*/, char const* args)
|
||||
{
|
||||
int32 keepDays = sWorld->getIntConfig(CONFIG_CHARDELETE_KEEP_DAYS);
|
||||
|
||||
char* daysStr = strtok((char*)args, " ");
|
||||
if (daysStr)
|
||||
{
|
||||
if (!isNumeric(daysStr))
|
||||
return false;
|
||||
|
||||
keepDays = atoi(daysStr);
|
||||
if (keepDays < 0)
|
||||
return false;
|
||||
}
|
||||
// config option value 0 -> disabled and can't be used
|
||||
else if (keepDays <= 0)
|
||||
return false;
|
||||
|
||||
Player::DeleteOldCharacters(uint32(keepDays));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool HandleCharacterEraseCommand(ChatHandler* handler, char const* args)
|
||||
{
|
||||
if (!*args)
|
||||
return false;
|
||||
|
||||
char* characterName_str = strtok((char*)args, " ");
|
||||
if (!characterName_str)
|
||||
return false;
|
||||
|
||||
std::string characterName = characterName_str;
|
||||
if (!normalizePlayerName(characterName))
|
||||
return false;
|
||||
|
||||
uint64 characterGuid;
|
||||
uint32 accountId;
|
||||
|
||||
Player* player = sObjectAccessor->FindPlayerByName(characterName.c_str());
|
||||
if (player)
|
||||
{
|
||||
characterGuid = player->GetGUID();
|
||||
accountId = player->GetSession()->GetAccountId();
|
||||
player->GetSession()->KickPlayer();
|
||||
}
|
||||
else
|
||||
{
|
||||
characterGuid = sObjectMgr->GetPlayerGUIDByName(characterName);
|
||||
if (!characterGuid)
|
||||
{
|
||||
handler->PSendSysMessage(LANG_NO_PLAYER, characterName.c_str());
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
accountId = sObjectMgr->GetPlayerAccountIdByGUID(characterGuid);
|
||||
}
|
||||
|
||||
std::string accountName;
|
||||
AccountMgr::GetName(accountId, accountName);
|
||||
|
||||
Player::DeleteFromDB(characterGuid, accountId, true, true);
|
||||
handler->PSendSysMessage(LANG_CHARACTER_DELETED, characterName.c_str(), GUID_LOPART(characterGuid), accountName.c_str(), accountId);
|
||||
|
||||
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()
|
||||
{
|
||||
new character_commandscript();
|
||||
}
|
||||
@@ -95,6 +95,7 @@ public:
|
||||
static ChatCommand commandTable[] =
|
||||
{
|
||||
{ "debug", SEC_MODERATOR, true, NULL, "", debugCommandTable },
|
||||
{ "wpgps", SEC_ADMINISTRATOR, false, &HandleWPGPSCommand, "", NULL },
|
||||
{ NULL, SEC_PLAYER, false, NULL, "", NULL }
|
||||
};
|
||||
return commandTable;
|
||||
@@ -409,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;
|
||||
}
|
||||
}
|
||||
@@ -1319,6 +1320,16 @@ public:
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool HandleWPGPSCommand(ChatHandler* handler, char const* /*args*/)
|
||||
{
|
||||
Player* player = handler->GetSession()->GetPlayer();
|
||||
|
||||
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;
|
||||
}
|
||||
};
|
||||
|
||||
void AddSC_debug_commandscript()
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
@@ -196,11 +196,16 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
const uint32 VISUAL_AURA = 37800;
|
||||
std::string param = (char*)args;
|
||||
Player* player = handler->GetSession()->GetPlayer();
|
||||
|
||||
if (param == "on")
|
||||
{
|
||||
handler->GetSession()->GetPlayer()->SetGMVisible(true);
|
||||
if (player->HasAura(VISUAL_AURA, 0))
|
||||
player->RemoveAurasDueToSpell(VISUAL_AURA);
|
||||
|
||||
player->SetGMVisible(true);
|
||||
handler->GetSession()->SendNotification(LANG_INVISIBLE_VISIBLE);
|
||||
return true;
|
||||
}
|
||||
@@ -208,7 +213,10 @@ public:
|
||||
if (param == "off")
|
||||
{
|
||||
handler->GetSession()->SendNotification(LANG_INVISIBLE_INVISIBLE);
|
||||
handler->GetSession()->GetPlayer()->SetGMVisible(false);
|
||||
player->SetGMVisible(false);
|
||||
|
||||
player->AddAura(VISUAL_AURA, player);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -1,144 +0,0 @@
|
||||
/*
|
||||
* 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: gps_commandscript
|
||||
%Complete: 100
|
||||
Comment: GPS/WPGPS commands
|
||||
Category: commandscripts
|
||||
EndScriptData */
|
||||
|
||||
#include "ObjectAccessor.h"
|
||||
#include "ScriptMgr.h"
|
||||
#include "Chat.h"
|
||||
#include "CellImpl.h"
|
||||
|
||||
class gps_commandscript : public CommandScript
|
||||
{
|
||||
public:
|
||||
gps_commandscript() : CommandScript("gps_commandscript") { }
|
||||
|
||||
ChatCommand* GetCommands() const
|
||||
{
|
||||
static ChatCommand commandTable[] =
|
||||
{
|
||||
{ "gps", SEC_ADMINISTRATOR, false, &HandleGPSCommand, "", NULL },
|
||||
{ "wpgps", SEC_ADMINISTRATOR, false, &HandleWPGPSCommand, "", NULL },
|
||||
{ NULL, 0, false, NULL, "", NULL }
|
||||
};
|
||||
return commandTable;
|
||||
}
|
||||
|
||||
static bool HandleGPSCommand(ChatHandler* handler, char const* args)
|
||||
{
|
||||
WorldObject* object = NULL;
|
||||
if (*args)
|
||||
{
|
||||
uint64 guid = handler->extractGuidFromLink((char*)args);
|
||||
if (guid)
|
||||
object = (WorldObject*)ObjectAccessor::GetObjectByTypeMask(*handler->GetSession()->GetPlayer(), guid, TYPEMASK_UNIT | TYPEMASK_GAMEOBJECT);
|
||||
|
||||
if (!object)
|
||||
{
|
||||
handler->SendSysMessage(LANG_PLAYER_NOT_FOUND);
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
object = handler->getSelectedUnit();
|
||||
|
||||
if (!object)
|
||||
{
|
||||
handler->SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE);
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
CellCoord cellCoord = Trinity::ComputeCellCoord(object->GetPositionX(), object->GetPositionY());
|
||||
Cell cell(cellCoord);
|
||||
|
||||
uint32 zoneId, areaId;
|
||||
object->GetZoneAndAreaId(zoneId, areaId);
|
||||
|
||||
MapEntry const* mapEntry = sMapStore.LookupEntry(object->GetMapId());
|
||||
AreaTableEntry const* zoneEntry = GetAreaEntryByAreaID(zoneId);
|
||||
AreaTableEntry const* areaEntry = GetAreaEntryByAreaID(areaId);
|
||||
|
||||
float zoneX = object->GetPositionX();
|
||||
float zoneY = object->GetPositionY();
|
||||
|
||||
Map2ZoneCoordinates(zoneX, zoneY, zoneId);
|
||||
|
||||
Map const* map = object->GetMap();
|
||||
float groundZ = map->GetHeight(object->GetPhaseMask(), object->GetPositionX(), object->GetPositionY(), MAX_HEIGHT);
|
||||
float floorZ = map->GetHeight(object->GetPhaseMask(), object->GetPositionX(), object->GetPositionY(), object->GetPositionZ());
|
||||
|
||||
GridCoord gridCoord = Trinity::ComputeGridCoord(object->GetPositionX(), object->GetPositionY());
|
||||
|
||||
// 63? WHY?
|
||||
int gridX = 63 - gridCoord.x_coord;
|
||||
int gridY = 63 - gridCoord.y_coord;
|
||||
|
||||
uint32 haveMap = Map::ExistMap(object->GetMapId(), gridX, gridY) ? 1 : 0;
|
||||
uint32 haveVMap = Map::ExistVMap(object->GetMapId(), gridX, gridY) ? 1 : 0;
|
||||
|
||||
if (haveVMap)
|
||||
{
|
||||
if (map->IsOutdoors(object->GetPositionX(), object->GetPositionY(), object->GetPositionZ()))
|
||||
handler->PSendSysMessage("You are outdoors");
|
||||
else
|
||||
handler->PSendSysMessage("You are indoors");
|
||||
}
|
||||
else
|
||||
handler->PSendSysMessage("no VMAP available for area info");
|
||||
|
||||
handler->PSendSysMessage(LANG_MAP_POSITION,
|
||||
object->GetMapId(), (mapEntry ? mapEntry->name[handler->GetSessionDbcLocale()] : "<unknown>"),
|
||||
zoneId, (zoneEntry ? zoneEntry->area_name[handler->GetSessionDbcLocale()] : "<unknown>"),
|
||||
areaId, (areaEntry ? areaEntry->area_name[handler->GetSessionDbcLocale()] : "<unknown>"),
|
||||
object->GetPhaseMask(),
|
||||
object->GetPositionX(), object->GetPositionY(), object->GetPositionZ(), object->GetOrientation(),
|
||||
cell.GridX(), cell.GridY(), cell.CellX(), cell.CellY(), object->GetInstanceId(),
|
||||
zoneX, zoneY, groundZ, floorZ, haveMap, haveVMap);
|
||||
|
||||
LiquidData liquidStatus;
|
||||
ZLiquidStatus status = map->getLiquidStatus(object->GetPositionX(), object->GetPositionY(), object->GetPositionZ(), MAP_ALL_LIQUIDS, &liquidStatus);
|
||||
|
||||
if (status)
|
||||
handler->PSendSysMessage(LANG_LIQUID_STATUS, liquidStatus.level, liquidStatus.depth_level, liquidStatus.entry, liquidStatus.type_flags, status);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool HandleWPGPSCommand(ChatHandler* handler, char const* /*args*/)
|
||||
{
|
||||
Player* player = handler->GetSession()->GetPlayer();
|
||||
|
||||
sLog->outSQLDev("(@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;
|
||||
}
|
||||
};
|
||||
|
||||
void AddSC_gps_commandscript()
|
||||
{
|
||||
new gps_commandscript();
|
||||
}
|
||||
@@ -0,0 +1,199 @@
|
||||
/*
|
||||
* 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: guild_commandscript
|
||||
%Complete: 100
|
||||
Comment: All guild related commands
|
||||
Category: commandscripts
|
||||
EndScriptData */
|
||||
|
||||
#include "ScriptMgr.h"
|
||||
#include "Chat.h"
|
||||
#include "Guild.h"
|
||||
#include "GuildMgr.h"
|
||||
#include "ObjectAccessor.h"
|
||||
|
||||
class guild_commandscript : public CommandScript
|
||||
{
|
||||
public:
|
||||
guild_commandscript() : CommandScript("guild_commandscript") { }
|
||||
|
||||
ChatCommand* GetCommands() const
|
||||
{
|
||||
static ChatCommand guildCommandTable[] =
|
||||
{
|
||||
{ "create", SEC_GAMEMASTER, true, &HandleGuildCreateCommand, "", NULL },
|
||||
{ "delete", SEC_GAMEMASTER, true, &HandleGuildDeleteCommand, "", NULL },
|
||||
{ "invite", SEC_GAMEMASTER, true, &HandleGuildInviteCommand, "", NULL },
|
||||
{ "uninvite", SEC_GAMEMASTER, true, &HandleGuildUninviteCommand, "", NULL },
|
||||
{ "rank", SEC_GAMEMASTER, true, &HandleGuildRankCommand, "", NULL },
|
||||
{ NULL, 0, false, NULL, "", NULL }
|
||||
};
|
||||
static ChatCommand commandTable[] =
|
||||
{
|
||||
{ "guild", SEC_ADMINISTRATOR, true, NULL, "", guildCommandTable },
|
||||
{ NULL, 0, false, NULL, "", NULL }
|
||||
};
|
||||
return commandTable;
|
||||
}
|
||||
|
||||
/** \brief GM command level 3 - Create a guild.
|
||||
*
|
||||
* This command allows a GM (level 3) to create a guild.
|
||||
*
|
||||
* The "args" parameter contains the name of the guild leader
|
||||
* and then the name of the guild.
|
||||
*
|
||||
*/
|
||||
static bool HandleGuildCreateCommand(ChatHandler* handler, char const* args)
|
||||
{
|
||||
if (!*args)
|
||||
return false;
|
||||
|
||||
// if not guild name only (in "") then player name
|
||||
Player* target;
|
||||
if (!handler->extractPlayerTarget(*args != '"' ? (char*)args : NULL, &target))
|
||||
return false;
|
||||
|
||||
char* tailStr = *args != '"' ? strtok(NULL, "") : (char*)args;
|
||||
if (!tailStr)
|
||||
return false;
|
||||
|
||||
char* guildStr = handler->extractQuotedArg(tailStr);
|
||||
if (!guildStr)
|
||||
return false;
|
||||
|
||||
std::string guildName = guildStr;
|
||||
|
||||
if (target->GetGuildId())
|
||||
{
|
||||
handler->SendSysMessage(LANG_PLAYER_IN_GUILD);
|
||||
return true;
|
||||
}
|
||||
|
||||
Guild* guild = new Guild;
|
||||
if (!guild->Create(target, guildName))
|
||||
{
|
||||
delete guild;
|
||||
handler->SendSysMessage(LANG_GUILD_NOT_CREATED);
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
sGuildMgr->AddGuild(guild);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool HandleGuildDeleteCommand(ChatHandler* handler, char const* args)
|
||||
{
|
||||
if (!*args)
|
||||
return false;
|
||||
|
||||
char* guildStr = handler->extractQuotedArg((char*)args);
|
||||
if (!guildStr)
|
||||
return false;
|
||||
|
||||
std::string guildName = guildStr;
|
||||
|
||||
Guild* targetGuild = sGuildMgr->GetGuildByName(guildName);
|
||||
if (!targetGuild)
|
||||
return false;
|
||||
|
||||
targetGuild->Disband();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool HandleGuildInviteCommand(ChatHandler* handler, char const* args)
|
||||
{
|
||||
if (!*args)
|
||||
return false;
|
||||
|
||||
// if not guild name only (in "") then player name
|
||||
uint64 targetGuid;
|
||||
if (!handler->extractPlayerTarget(*args != '"' ? (char*)args : NULL, NULL, &targetGuid))
|
||||
return false;
|
||||
|
||||
char* tailStr = *args != '"' ? strtok(NULL, "") : (char*)args;
|
||||
if (!tailStr)
|
||||
return false;
|
||||
|
||||
char* guildStr = handler->extractQuotedArg(tailStr);
|
||||
if (!guildStr)
|
||||
return false;
|
||||
|
||||
std::string guildName = guildStr;
|
||||
Guild* targetGuild = sGuildMgr->GetGuildByName(guildName);
|
||||
if (!targetGuild)
|
||||
return false;
|
||||
|
||||
// player's guild membership checked in AddMember before add
|
||||
return targetGuild->AddMember(targetGuid);
|
||||
}
|
||||
|
||||
static bool HandleGuildUninviteCommand(ChatHandler* handler, char const* args)
|
||||
{
|
||||
Player* target;
|
||||
uint64 targetGuid;
|
||||
if (!handler->extractPlayerTarget((char*)args, &target, &targetGuid))
|
||||
return false;
|
||||
|
||||
uint32 guildId = target ? target->GetGuildId() : Player::GetGuildIdFromDB(targetGuid);
|
||||
if (!guildId)
|
||||
return false;
|
||||
|
||||
Guild* targetGuild = sGuildMgr->GetGuildById(guildId);
|
||||
if (!targetGuild)
|
||||
return false;
|
||||
|
||||
targetGuild->DeleteMember(targetGuid, false, true);
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool HandleGuildRankCommand(ChatHandler* handler, char const* args)
|
||||
{
|
||||
char* nameStr;
|
||||
char* rankStr;
|
||||
handler->extractOptFirstArg((char*)args, &nameStr, &rankStr);
|
||||
if (!rankStr)
|
||||
return false;
|
||||
|
||||
Player* target;
|
||||
uint64 targetGuid;
|
||||
std::string target_name;
|
||||
if (!handler->extractPlayerTarget(nameStr, &target, &targetGuid, &target_name))
|
||||
return false;
|
||||
|
||||
uint32 guildId = target ? target->GetGuildId() : Player::GetGuildIdFromDB(targetGuid);
|
||||
if (!guildId)
|
||||
return false;
|
||||
|
||||
Guild* targetGuild = sGuildMgr->GetGuildById(guildId);
|
||||
if (!targetGuild)
|
||||
return false;
|
||||
|
||||
uint8 newRank = uint8(atoi(rankStr));
|
||||
return targetGuild->ChangeMemberRank(targetGuid, newRank);
|
||||
}
|
||||
};
|
||||
|
||||
void AddSC_guild_commandscript()
|
||||
{
|
||||
new guild_commandscript();
|
||||
}
|
||||
@@ -0,0 +1,193 @@
|
||||
/*
|
||||
* 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: instance_commandscript
|
||||
%Complete: 100
|
||||
Comment: All instance related commands
|
||||
Category: commandscripts
|
||||
EndScriptData */
|
||||
|
||||
#include "ScriptMgr.h"
|
||||
#include "Chat.h"
|
||||
#include "Group.h"
|
||||
#include "InstanceSaveMgr.h"
|
||||
#include "InstanceScript.h"
|
||||
#include "MapManager.h"
|
||||
|
||||
class instance_commandscript : public CommandScript
|
||||
{
|
||||
public:
|
||||
instance_commandscript() : CommandScript("instance_commandscript") { }
|
||||
|
||||
ChatCommand* GetCommands() const
|
||||
{
|
||||
static ChatCommand instanceCommandTable[] =
|
||||
{
|
||||
{ "listbinds", SEC_ADMINISTRATOR, false, &HandleInstanceListBindsCommand, "", NULL },
|
||||
{ "unbind", SEC_ADMINISTRATOR, false, &HandleInstanceUnbindCommand, "", NULL },
|
||||
{ "stats", SEC_ADMINISTRATOR, true, &HandleInstanceStatsCommand, "", NULL },
|
||||
{ "savedata", SEC_ADMINISTRATOR, false, &HandleInstanceSaveDataCommand, "", NULL },
|
||||
{ NULL, 0, false, NULL, "", NULL }
|
||||
};
|
||||
|
||||
static ChatCommand commandTable[] =
|
||||
{
|
||||
{ "instance", SEC_ADMINISTRATOR, true, NULL, "", instanceCommandTable },
|
||||
{ NULL, 0, false, NULL, "", NULL }
|
||||
};
|
||||
|
||||
return commandTable;
|
||||
}
|
||||
|
||||
static std::string GetTimeString(uint64 time)
|
||||
{
|
||||
uint64 days = time / DAY, hours = (time % DAY) / HOUR, minute = (time % HOUR) / MINUTE;
|
||||
std::ostringstream ss;
|
||||
if (days)
|
||||
ss << days << "d ";
|
||||
if (hours)
|
||||
ss << hours << "h ";
|
||||
ss << minute << 'm';
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
static bool HandleInstanceListBindsCommand(ChatHandler* handler, char const* /*args*/)
|
||||
{
|
||||
Player* player = handler->getSelectedPlayer();
|
||||
if (!player)
|
||||
player = handler->GetSession()->GetPlayer();
|
||||
|
||||
uint32 counter = 0;
|
||||
for (uint8 i = 0; i < MAX_DIFFICULTY; ++i)
|
||||
{
|
||||
Player::BoundInstancesMap &binds = player->GetBoundInstances(Difficulty(i));
|
||||
for (Player::BoundInstancesMap::const_iterator itr = binds.begin(); itr != binds.end(); ++itr)
|
||||
{
|
||||
InstanceSave* save = itr->second.save;
|
||||
std::string timeleft = GetTimeString(save->GetResetTime() - time(NULL));
|
||||
handler->PSendSysMessage("map: %d inst: %d perm: %s diff: %d canReset: %s TTR: %s", itr->first, save->GetInstanceId(), itr->second.perm ? "yes" : "no", save->GetDifficulty(), save->CanReset() ? "yes" : "no", timeleft.c_str());
|
||||
counter++;
|
||||
}
|
||||
}
|
||||
handler->PSendSysMessage("player binds: %d", counter);
|
||||
|
||||
counter = 0;
|
||||
if (Group* group = player->GetGroup())
|
||||
{
|
||||
for (uint8 i = 0; i < MAX_DIFFICULTY; ++i)
|
||||
{
|
||||
Group::BoundInstancesMap &binds = group->GetBoundInstances(Difficulty(i));
|
||||
for (Group::BoundInstancesMap::const_iterator itr = binds.begin(); itr != binds.end(); ++itr)
|
||||
{
|
||||
InstanceSave* save = itr->second.save;
|
||||
std::string timeleft = GetTimeString(save->GetResetTime() - time(NULL));
|
||||
handler->PSendSysMessage("map: %d inst: %d perm: %s diff: %d canReset: %s TTR: %s", itr->first, save->GetInstanceId(), itr->second.perm ? "yes" : "no", save->GetDifficulty(), save->CanReset() ? "yes" : "no", timeleft.c_str());
|
||||
counter++;
|
||||
}
|
||||
}
|
||||
}
|
||||
handler->PSendSysMessage("group binds: %d", counter);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool HandleInstanceUnbindCommand(ChatHandler* handler, char const* args)
|
||||
{
|
||||
if (!*args)
|
||||
return false;
|
||||
|
||||
Player* player = handler->getSelectedPlayer();
|
||||
if (!player)
|
||||
player = handler->GetSession()->GetPlayer();
|
||||
|
||||
char* map = strtok((char*)args, " ");
|
||||
char* pDiff = strtok(NULL, " ");
|
||||
int8 diff = -1;
|
||||
if (pDiff)
|
||||
diff = atoi(pDiff);
|
||||
uint16 counter = 0;
|
||||
uint16 MapId = 0;
|
||||
|
||||
if (strcmp(map, "all"))
|
||||
{
|
||||
MapId = uint16(atoi(map));
|
||||
if (!MapId)
|
||||
return false;
|
||||
}
|
||||
|
||||
for (uint8 i = 0; i < MAX_DIFFICULTY; ++i)
|
||||
{
|
||||
Player::BoundInstancesMap &binds = player->GetBoundInstances(Difficulty(i));
|
||||
for (Player::BoundInstancesMap::iterator itr = binds.begin(); itr != binds.end();)
|
||||
{
|
||||
InstanceSave* save = itr->second.save;
|
||||
if (itr->first != player->GetMapId() && (!MapId || MapId == itr->first) && (diff == -1 || diff == save->GetDifficulty()))
|
||||
{
|
||||
std::string timeleft = GetTimeString(save->GetResetTime() - time(NULL));
|
||||
handler->PSendSysMessage("unbinding map: %d inst: %d perm: %s diff: %d canReset: %s TTR: %s", itr->first, save->GetInstanceId(), itr->second.perm ? "yes" : "no", save->GetDifficulty(), save->CanReset() ? "yes" : "no", timeleft.c_str());
|
||||
player->UnbindInstance(itr, Difficulty(i));
|
||||
counter++;
|
||||
}
|
||||
else
|
||||
++itr;
|
||||
}
|
||||
}
|
||||
handler->PSendSysMessage("instances unbound: %d", counter);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool HandleInstanceStatsCommand(ChatHandler* handler, char const* /*args*/)
|
||||
{
|
||||
handler->PSendSysMessage("instances loaded: %d", sMapMgr->GetNumInstances());
|
||||
handler->PSendSysMessage("players in instances: %d", sMapMgr->GetNumPlayersInInstances());
|
||||
handler->PSendSysMessage("instance saves: %d", sInstanceSaveMgr->GetNumInstanceSaves());
|
||||
handler->PSendSysMessage("players bound: %d", sInstanceSaveMgr->GetNumBoundPlayersTotal());
|
||||
handler->PSendSysMessage("groups bound: %d", sInstanceSaveMgr->GetNumBoundGroupsTotal());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool HandleInstanceSaveDataCommand(ChatHandler* handler, char const* /*args*/)
|
||||
{
|
||||
Player* player = handler->GetSession()->GetPlayer();
|
||||
Map* map = player->GetMap();
|
||||
if (!map->IsDungeon())
|
||||
{
|
||||
handler->PSendSysMessage("Map is not a dungeon.");
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!((InstanceMap*)map)->GetInstanceScript())
|
||||
{
|
||||
handler->PSendSysMessage("Map has no instance data.");
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
((InstanceMap*)map)->GetInstanceScript()->SaveToDB();
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
void AddSC_instance_commandscript()
|
||||
{
|
||||
new instance_commandscript();
|
||||
}
|
||||
@@ -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()
|
||||
|
||||
@@ -0,0 +1,469 @@
|
||||
/*
|
||||
* 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: list_commandscript
|
||||
%Complete: 100
|
||||
Comment: All list related commands
|
||||
Category: commandscripts
|
||||
EndScriptData */
|
||||
|
||||
#include "ScriptMgr.h"
|
||||
#include "Chat.h"
|
||||
#include "SpellAuraEffects.h"
|
||||
#include "ObjectAccessor.h"
|
||||
#include "ObjectMgr.h"
|
||||
|
||||
class list_commandscript : public CommandScript
|
||||
{
|
||||
public:
|
||||
list_commandscript() : CommandScript("list_commandscript") { }
|
||||
|
||||
ChatCommand* GetCommands() const
|
||||
{
|
||||
static ChatCommand listCommandTable[] =
|
||||
{
|
||||
{ "creature", SEC_ADMINISTRATOR, true, &HandleListCreatureCommand, "", NULL },
|
||||
{ "item", SEC_ADMINISTRATOR, true, &HandleListItemCommand, "", NULL },
|
||||
{ "object", SEC_ADMINISTRATOR, true, &HandleListObjectCommand, "", NULL },
|
||||
{ "auras", SEC_ADMINISTRATOR, false, &HandleListAurasCommand, "", NULL },
|
||||
{ NULL, 0, false, NULL, "", NULL }
|
||||
};
|
||||
static ChatCommand commandTable[] =
|
||||
{
|
||||
{ "list", SEC_ADMINISTRATOR, true, NULL, "", listCommandTable },
|
||||
{ NULL, 0, false, NULL, "", NULL }
|
||||
};
|
||||
return commandTable;
|
||||
}
|
||||
|
||||
static bool HandleListCreatureCommand(ChatHandler* handler, char const* args)
|
||||
{
|
||||
if (!*args)
|
||||
return false;
|
||||
|
||||
// number or [name] Shift-click form |color|Hcreature_entry:creature_id|h[name]|h|r
|
||||
char* id = handler->extractKeyFromLink((char*)args, "Hcreature_entry");
|
||||
if (!id)
|
||||
return false;
|
||||
|
||||
uint32 creatureId = atol(id);
|
||||
if (!creatureId)
|
||||
{
|
||||
handler->PSendSysMessage(LANG_COMMAND_INVALIDCREATUREID, creatureId);
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
CreatureTemplate const* cInfo = sObjectMgr->GetCreatureTemplate(creatureId);
|
||||
if (!cInfo)
|
||||
{
|
||||
handler->PSendSysMessage(LANG_COMMAND_INVALIDCREATUREID, creatureId);
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
char* countStr = strtok(NULL, " ");
|
||||
uint32 count = countStr ? atol(countStr) : 10;
|
||||
|
||||
if (count == 0)
|
||||
return false;
|
||||
|
||||
QueryResult result;
|
||||
|
||||
uint32 creatureCount = 0;
|
||||
result = WorldDatabase.PQuery("SELECT COUNT(guid) FROM creature WHERE id='%u'", creatureId);
|
||||
if (result)
|
||||
creatureCount = (*result)[0].GetUInt64();
|
||||
|
||||
if (handler->GetSession())
|
||||
{
|
||||
Player* player = handler->GetSession()->GetPlayer();
|
||||
result = WorldDatabase.PQuery("SELECT guid, position_x, position_y, position_z, map, (POW(position_x - '%f', 2) + POW(position_y - '%f', 2) + POW(position_z - '%f', 2)) AS order_ FROM creature WHERE id = '%u' ORDER BY order_ ASC LIMIT %u",
|
||||
player->GetPositionX(), player->GetPositionY(), player->GetPositionZ(), creatureId, count);
|
||||
}
|
||||
else
|
||||
result = WorldDatabase.PQuery("SELECT guid, position_x, position_y, position_z, map FROM creature WHERE id = '%u' LIMIT %u",
|
||||
creatureId, count);
|
||||
|
||||
if (result)
|
||||
{
|
||||
do
|
||||
{
|
||||
Field* fields = result->Fetch();
|
||||
uint32 guid = fields[0].GetUInt32();
|
||||
float x = fields[1].GetFloat();
|
||||
float y = fields[2].GetFloat();
|
||||
float z = fields[3].GetFloat();
|
||||
uint16 mapId = fields[4].GetUInt16();
|
||||
|
||||
if (handler->GetSession())
|
||||
handler->PSendSysMessage(LANG_CREATURE_LIST_CHAT, guid, guid, cInfo->Name.c_str(), x, y, z, mapId);
|
||||
else
|
||||
handler->PSendSysMessage(LANG_CREATURE_LIST_CONSOLE, guid, cInfo->Name.c_str(), x, y, z, mapId);
|
||||
}
|
||||
while (result->NextRow());
|
||||
}
|
||||
|
||||
handler->PSendSysMessage(LANG_COMMAND_LISTCREATUREMESSAGE, creatureId, creatureCount);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool HandleListItemCommand(ChatHandler* handler, char const* args)
|
||||
{
|
||||
if (!*args)
|
||||
return false;
|
||||
|
||||
char* id = handler->extractKeyFromLink((char*)args, "Hitem");
|
||||
if (!id)
|
||||
return false;
|
||||
|
||||
uint32 itemId = atol(id);
|
||||
if (!itemId)
|
||||
{
|
||||
handler->PSendSysMessage(LANG_COMMAND_ITEMIDINVALID, itemId);
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
ItemTemplate const* itemTemplate = sObjectMgr->GetItemTemplate(itemId);
|
||||
if (!itemTemplate)
|
||||
{
|
||||
handler->PSendSysMessage(LANG_COMMAND_ITEMIDINVALID, itemId);
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
char* countStr = strtok(NULL, " ");
|
||||
uint32 count = countStr ? atol(countStr) : 10;
|
||||
|
||||
if (count == 0)
|
||||
return false;
|
||||
|
||||
PreparedQueryResult result;
|
||||
|
||||
// inventory case
|
||||
uint32 inventoryCount = 0;
|
||||
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_INVENTORY_COUNT_ITEM);
|
||||
stmt->setUInt32(0, itemId);
|
||||
result = CharacterDatabase.Query(stmt);
|
||||
|
||||
if (result)
|
||||
inventoryCount = (*result)[0].GetUInt64();
|
||||
|
||||
stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_INVENTORY_ITEM_BY_ENTRY);
|
||||
stmt->setUInt32(0, itemId);
|
||||
stmt->setUInt32(1, count);
|
||||
result = CharacterDatabase.Query(stmt);
|
||||
|
||||
if (result)
|
||||
{
|
||||
do
|
||||
{
|
||||
Field* fields = result->Fetch();
|
||||
uint32 itemGuid = fields[0].GetUInt32();
|
||||
uint32 itemBag = fields[1].GetUInt32();
|
||||
uint8 itemSlot = fields[2].GetUInt8();
|
||||
uint32 ownerGuid = fields[3].GetUInt32();
|
||||
uint32 ownerAccountId = fields[4].GetUInt32();
|
||||
std::string ownerName = fields[5].GetString();
|
||||
|
||||
char const* itemPos = 0;
|
||||
if (Player::IsEquipmentPos(itemBag, itemSlot))
|
||||
itemPos = "[equipped]";
|
||||
else if (Player::IsInventoryPos(itemBag, itemSlot))
|
||||
itemPos = "[in inventory]";
|
||||
else if (Player::IsBankPos(itemBag, itemSlot))
|
||||
itemPos = "[in bank]";
|
||||
else
|
||||
itemPos = "";
|
||||
|
||||
handler->PSendSysMessage(LANG_ITEMLIST_SLOT, itemGuid, ownerName.c_str(), ownerGuid, ownerAccountId, itemPos);
|
||||
}
|
||||
while (result->NextRow());
|
||||
|
||||
uint32 resultCount = uint32(result->GetRowCount());
|
||||
|
||||
if (count > resultCount)
|
||||
count -= resultCount;
|
||||
else if (count)
|
||||
count = 0;
|
||||
}
|
||||
|
||||
// mail case
|
||||
uint32 mailCount = 0;
|
||||
|
||||
stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_MAIL_COUNT_ITEM);
|
||||
stmt->setUInt32(0, itemId);
|
||||
result = CharacterDatabase.Query(stmt);
|
||||
|
||||
if (result)
|
||||
mailCount = (*result)[0].GetUInt64();
|
||||
|
||||
if (count > 0)
|
||||
{
|
||||
stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_MAIL_ITEMS_BY_ENTRY);
|
||||
stmt->setUInt32(0, itemId);
|
||||
stmt->setUInt32(1, count);
|
||||
result = CharacterDatabase.Query(stmt);
|
||||
}
|
||||
else
|
||||
result = PreparedQueryResult(NULL);
|
||||
|
||||
if (result)
|
||||
{
|
||||
do
|
||||
{
|
||||
Field* fields = result->Fetch();
|
||||
uint32 itemGuid = fields[0].GetUInt32();
|
||||
uint32 itemSender = fields[1].GetUInt32();
|
||||
uint32 itemReceiver = fields[2].GetUInt32();
|
||||
uint32 itemSenderAccountId = fields[3].GetUInt32();
|
||||
std::string itemSenderName = fields[4].GetString();
|
||||
uint32 itemReceiverAccount = fields[5].GetUInt32();
|
||||
std::string itemReceiverName = fields[6].GetString();
|
||||
|
||||
char const* itemPos = "[in mail]";
|
||||
|
||||
handler->PSendSysMessage(LANG_ITEMLIST_MAIL, itemGuid, itemSenderName.c_str(), itemSender, itemSenderAccountId, itemReceiverName.c_str(), itemReceiver, itemReceiverAccount, itemPos);
|
||||
}
|
||||
while (result->NextRow());
|
||||
|
||||
uint32 resultCount = uint32(result->GetRowCount());
|
||||
|
||||
if (count > resultCount)
|
||||
count -= resultCount;
|
||||
else if (count)
|
||||
count = 0;
|
||||
}
|
||||
|
||||
// auction case
|
||||
uint32 auctionCount = 0;
|
||||
|
||||
stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_AUCTIONHOUSE_COUNT_ITEM);
|
||||
stmt->setUInt32(0, itemId);
|
||||
result = CharacterDatabase.Query(stmt);
|
||||
|
||||
if (result)
|
||||
auctionCount = (*result)[0].GetUInt64();
|
||||
|
||||
if (count > 0)
|
||||
{
|
||||
stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_AUCTIONHOUSE_ITEM_BY_ENTRY);
|
||||
stmt->setUInt32(0, itemId);
|
||||
stmt->setUInt32(1, count);
|
||||
result = CharacterDatabase.Query(stmt);
|
||||
}
|
||||
else
|
||||
result = PreparedQueryResult(NULL);
|
||||
|
||||
if (result)
|
||||
{
|
||||
do
|
||||
{
|
||||
Field* fields = result->Fetch();
|
||||
uint32 itemGuid = fields[0].GetUInt32();
|
||||
uint32 owner = fields[1].GetUInt32();
|
||||
uint32 ownerAccountId = fields[2].GetUInt32();
|
||||
std::string ownerName = fields[3].GetString();
|
||||
|
||||
char const* itemPos = "[in auction]";
|
||||
|
||||
handler->PSendSysMessage(LANG_ITEMLIST_AUCTION, itemGuid, ownerName.c_str(), owner, ownerAccountId, itemPos);
|
||||
}
|
||||
while (result->NextRow());
|
||||
}
|
||||
|
||||
// guild bank case
|
||||
uint32 guildCount = 0;
|
||||
|
||||
stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_GUILD_BANK_COUNT_ITEM);
|
||||
stmt->setUInt32(0, itemId);
|
||||
result = CharacterDatabase.Query(stmt);
|
||||
|
||||
if (result)
|
||||
guildCount = (*result)[0].GetUInt64();
|
||||
|
||||
stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_GUILD_BANK_ITEM_BY_ENTRY);
|
||||
stmt->setUInt32(0, itemId);
|
||||
stmt->setUInt32(1, count);
|
||||
result = CharacterDatabase.Query(stmt);
|
||||
|
||||
if (result)
|
||||
{
|
||||
do
|
||||
{
|
||||
Field* fields = result->Fetch();
|
||||
uint32 itemGuid = fields[0].GetUInt32();
|
||||
uint32 guildGuid = fields[1].GetUInt32();
|
||||
std::string guildName = fields[2].GetString();
|
||||
|
||||
char const* itemPos = "[in guild bank]";
|
||||
|
||||
handler->PSendSysMessage(LANG_ITEMLIST_GUILD, itemGuid, guildName.c_str(), guildGuid, itemPos);
|
||||
}
|
||||
while (result->NextRow());
|
||||
|
||||
uint32 resultCount = uint32(result->GetRowCount());
|
||||
|
||||
if (count > resultCount)
|
||||
count -= resultCount;
|
||||
else if (count)
|
||||
count = 0;
|
||||
}
|
||||
|
||||
if (inventoryCount + mailCount + auctionCount + guildCount == 0)
|
||||
{
|
||||
handler->SendSysMessage(LANG_COMMAND_NOITEMFOUND);
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
handler->PSendSysMessage(LANG_COMMAND_LISTITEMMESSAGE, itemId, inventoryCount + mailCount + auctionCount + guildCount, inventoryCount, mailCount, auctionCount, guildCount);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool HandleListObjectCommand(ChatHandler* handler, char const* args)
|
||||
{
|
||||
if (!*args)
|
||||
return false;
|
||||
|
||||
// number or [name] Shift-click form |color|Hgameobject_entry:go_id|h[name]|h|r
|
||||
char* id = handler->extractKeyFromLink((char*)args, "Hgameobject_entry");
|
||||
if (!id)
|
||||
return false;
|
||||
|
||||
uint32 gameObjectId = atol(id);
|
||||
if (!gameObjectId)
|
||||
{
|
||||
handler->PSendSysMessage(LANG_COMMAND_LISTOBJINVALIDID, gameObjectId);
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
GameObjectTemplate const* gInfo = sObjectMgr->GetGameObjectTemplate(gameObjectId);
|
||||
if (!gInfo)
|
||||
{
|
||||
handler->PSendSysMessage(LANG_COMMAND_LISTOBJINVALIDID, gameObjectId);
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
char* countStr = strtok(NULL, " ");
|
||||
uint32 count = countStr ? atol(countStr) : 10;
|
||||
|
||||
if (count == 0)
|
||||
return false;
|
||||
|
||||
QueryResult result;
|
||||
|
||||
uint32 objectCount = 0;
|
||||
result = WorldDatabase.PQuery("SELECT COUNT(guid) FROM gameobject WHERE id='%u'", gameObjectId);
|
||||
if (result)
|
||||
objectCount = (*result)[0].GetUInt64();
|
||||
|
||||
if (handler->GetSession())
|
||||
{
|
||||
Player* player = handler->GetSession()->GetPlayer();
|
||||
result = WorldDatabase.PQuery("SELECT guid, position_x, position_y, position_z, map, id, (POW(position_x - '%f', 2) + POW(position_y - '%f', 2) + POW(position_z - '%f', 2)) AS order_ FROM gameobject WHERE id = '%u' ORDER BY order_ ASC LIMIT %u",
|
||||
player->GetPositionX(), player->GetPositionY(), player->GetPositionZ(), gameObjectId, count);
|
||||
}
|
||||
else
|
||||
result = WorldDatabase.PQuery("SELECT guid, position_x, position_y, position_z, map, id FROM gameobject WHERE id = '%u' LIMIT %u",
|
||||
gameObjectId, count);
|
||||
|
||||
if (result)
|
||||
{
|
||||
do
|
||||
{
|
||||
Field* fields = result->Fetch();
|
||||
uint32 guid = fields[0].GetUInt32();
|
||||
float x = fields[1].GetFloat();
|
||||
float y = fields[2].GetFloat();
|
||||
float z = fields[3].GetFloat();
|
||||
uint16 mapId = fields[4].GetUInt16();
|
||||
uint32 entry = fields[5].GetUInt32();
|
||||
|
||||
if (handler->GetSession())
|
||||
handler->PSendSysMessage(LANG_GO_LIST_CHAT, guid, entry, guid, gInfo->name.c_str(), x, y, z, mapId);
|
||||
else
|
||||
handler->PSendSysMessage(LANG_GO_LIST_CONSOLE, guid, gInfo->name.c_str(), x, y, z, mapId);
|
||||
}
|
||||
while (result->NextRow());
|
||||
}
|
||||
|
||||
handler->PSendSysMessage(LANG_COMMAND_LISTOBJMESSAGE, gameObjectId, objectCount);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool HandleListAurasCommand(ChatHandler* handler, char const* /*args*/)
|
||||
{
|
||||
Unit* unit = handler->getSelectedUnit();
|
||||
if (!unit)
|
||||
{
|
||||
handler->SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE);
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
char const* talentStr = handler->GetTrinityString(LANG_TALENT);
|
||||
char const* passiveStr = handler->GetTrinityString(LANG_PASSIVE);
|
||||
|
||||
Unit::AuraApplicationMap const& auras = unit->GetAppliedAuras();
|
||||
handler->PSendSysMessage(LANG_COMMAND_TARGET_LISTAURAS, auras.size());
|
||||
for (Unit::AuraApplicationMap::const_iterator itr = auras.begin(); itr != auras.end(); ++itr)
|
||||
{
|
||||
bool talent = GetTalentSpellCost(itr->second->GetBase()->GetId()) > 0;
|
||||
|
||||
AuraApplication const* aurApp = itr->second;
|
||||
Aura const* aura = aurApp->GetBase();
|
||||
char const* name = aura->GetSpellInfo()->SpellName[handler->GetSessionDbcLocale()];
|
||||
|
||||
std::ostringstream ss_name;
|
||||
ss_name << "|cffffffff|Hspell:" << aura->GetId() << "|h[" << name << "]|h|r";
|
||||
|
||||
handler->PSendSysMessage(LANG_COMMAND_TARGET_AURADETAIL, aura->GetId(), (handler->GetSession() ? ss_name.str().c_str() : name),
|
||||
aurApp->GetEffectMask(), aura->GetCharges(), aura->GetStackAmount(), aurApp->GetSlot(),
|
||||
aura->GetDuration(), aura->GetMaxDuration(), (aura->IsPassive() ? passiveStr : ""),
|
||||
(talent ? talentStr : ""), IS_PLAYER_GUID(aura->GetCasterGUID()) ? "player" : "creature",
|
||||
GUID_LOPART(aura->GetCasterGUID()));
|
||||
}
|
||||
|
||||
for (uint16 i = 0; i < TOTAL_AURAS; ++i)
|
||||
{
|
||||
Unit::AuraEffectList const& auraList = unit->GetAuraEffectsByType(AuraType(i));
|
||||
if (auraList.empty())
|
||||
continue;
|
||||
|
||||
handler->PSendSysMessage(LANG_COMMAND_TARGET_LISTAURATYPE, auraList.size(), i);
|
||||
|
||||
for (Unit::AuraEffectList::const_iterator itr = auraList.begin(); itr != auraList.end(); ++itr)
|
||||
handler->PSendSysMessage(LANG_COMMAND_TARGET_AURASIMPLE, (*itr)->GetId(), (*itr)->GetEffIndex(), (*itr)->GetAmount());
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
void AddSC_list_commandscript()
|
||||
{
|
||||
new list_commandscript();
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
@@ -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();
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
@@ -33,6 +33,16 @@ public:
|
||||
|
||||
ChatCommand* GetCommands() const
|
||||
{
|
||||
static ChatCommand modifyspeedCommandTable[] =
|
||||
{
|
||||
{ "fly", SEC_MODERATOR, false, &HandleModifyFlyCommand, "", NULL },
|
||||
{ "all", SEC_MODERATOR, false, &HandleModifyASpeedCommand, "", NULL },
|
||||
{ "walk", SEC_MODERATOR, false, &HandleModifySpeedCommand, "", NULL },
|
||||
{ "backwalk", SEC_MODERATOR, false, &HandleModifyBWalkCommand, "", NULL },
|
||||
{ "swim", SEC_MODERATOR, false, &HandleModifySwimCommand, "", NULL },
|
||||
{ "", SEC_MODERATOR, false, &HandleModifyASpeedCommand, "", NULL },
|
||||
{ NULL, 0, false, NULL, "", NULL }
|
||||
};
|
||||
static ChatCommand modifyCommandTable[] =
|
||||
{
|
||||
{ "hp", SEC_MODERATOR, false, &HandleModifyHPCommand, "", NULL },
|
||||
@@ -41,29 +51,26 @@ public:
|
||||
{ "runicpower", SEC_MODERATOR, false, &HandleModifyRunicPowerCommand, "", NULL },
|
||||
{ "energy", SEC_MODERATOR, false, &HandleModifyEnergyCommand, "", NULL },
|
||||
{ "money", SEC_MODERATOR, false, &HandleModifyMoneyCommand, "", NULL },
|
||||
{ "speed", SEC_MODERATOR, false, &HandleModifySpeedCommand, "", NULL },
|
||||
{ "swim", SEC_MODERATOR, false, &HandleModifySwimCommand, "", NULL },
|
||||
{ "scale", SEC_MODERATOR, false, &HandleModifyScaleCommand, "", NULL },
|
||||
{ "bit", SEC_MODERATOR, false, &HandleModifyBitCommand, "", NULL },
|
||||
{ "bwalk", SEC_MODERATOR, false, &HandleModifyBWalkCommand, "", NULL },
|
||||
{ "fly", SEC_MODERATOR, false, &HandleModifyFlyCommand, "", NULL },
|
||||
{ "aspeed", SEC_MODERATOR, false, &HandleModifyASpeedCommand, "", NULL },
|
||||
{ "faction", SEC_MODERATOR, false, &HandleModifyFactionCommand, "", NULL },
|
||||
{ "spell", SEC_MODERATOR, false, &HandleModifySpellCommand, "", NULL },
|
||||
{ "tp", SEC_MODERATOR, false, &HandleModifyTalentCommand, "", NULL },
|
||||
{ "talentpoints", SEC_MODERATOR, false, &HandleModifyTalentCommand, "", NULL },
|
||||
{ "mount", SEC_MODERATOR, false, &HandleModifyMountCommand, "", NULL },
|
||||
{ "honor", SEC_MODERATOR, false, &HandleModifyHonorCommand, "", NULL },
|
||||
{ "rep", SEC_GAMEMASTER, false, &HandleModifyRepCommand, "", NULL },
|
||||
{ "arena", SEC_MODERATOR, false, &HandleModifyArenaCommand, "", NULL },
|
||||
{ "reputation", SEC_GAMEMASTER, false, &HandleModifyRepCommand, "", NULL },
|
||||
{ "arenapoints", SEC_MODERATOR, false, &HandleModifyArenaCommand, "", NULL },
|
||||
{ "drunk", SEC_MODERATOR, false, &HandleModifyDrunkCommand, "", NULL },
|
||||
{ "standstate", SEC_GAMEMASTER, false, &HandleModifyStandStateCommand, "", NULL },
|
||||
{ "morph", SEC_GAMEMASTER, false, &HandleModifyMorphCommand, "", NULL },
|
||||
{ "phase", SEC_ADMINISTRATOR, false, &HandleModifyPhaseCommand, "", NULL },
|
||||
{ "gender", SEC_GAMEMASTER, false, &HandleModifyGenderCommand, "", NULL },
|
||||
{ "speed", SEC_MODERATOR, false, NULL, "", modifyspeedCommandTable },
|
||||
{ NULL, 0, false, NULL, "", NULL }
|
||||
};
|
||||
static ChatCommand commandTable[] =
|
||||
{
|
||||
{ "morph", SEC_GAMEMASTER, false, &HandleModifyMorphCommand, "", NULL },
|
||||
{ "demorph", SEC_GAMEMASTER, false, &HandleDeMorphCommand, "", NULL },
|
||||
{ "modify", SEC_MODERATOR, false, NULL, "", modifyCommandTable },
|
||||
{ NULL, 0, false, NULL, "", NULL }
|
||||
};
|
||||
@@ -191,7 +198,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;
|
||||
}
|
||||
@@ -711,7 +718,7 @@ public:
|
||||
(ChatHandler(player)).PSendSysMessage(LANG_YOURS_SIZE_CHANGED, handler->GetNameLink().c_str(), Scale);
|
||||
}
|
||||
|
||||
target->SetFloatValue(OBJECT_FIELD_SCALE_X, Scale);
|
||||
target->SetObjectScale(Scale);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -1003,7 +1010,7 @@ public:
|
||||
{
|
||||
int32 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());
|
||||
@@ -1035,7 +1042,7 @@ public:
|
||||
target->ModifyMoney(addmoney);
|
||||
}
|
||||
|
||||
sLog->outDetail(handler->GetTrinityString(LANG_NEW_MONEY), moneyuser, addmoney, target->GetMoney());
|
||||
sLog->outDebug(LOG_FILTER_GENERAL, handler->GetTrinityString(LANG_NEW_MONEY), moneyuser, addmoney, target->GetMoney());
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -1123,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;
|
||||
}
|
||||
@@ -1234,7 +1236,7 @@ public:
|
||||
return false;
|
||||
}
|
||||
|
||||
target->GetReputationMgr().SetReputation(factionEntry, amount);
|
||||
target->GetReputationMgr().SetOneFactionReputation(factionEntry, amount, false);
|
||||
handler->PSendSysMessage(LANG_COMMAND_MODIFY_REP, factionEntry->name[handler->GetSessionDbcLocale()], factionId,
|
||||
handler->GetNameLink(target).c_str(), target->GetReputationMgr().GetReputation(factionEntry));
|
||||
return true;
|
||||
@@ -1374,6 +1376,21 @@ public:
|
||||
if (handler->needReportToTarget(target))
|
||||
(ChatHandler(target)).PSendSysMessage(LANG_YOUR_GENDER_CHANGED, gender_full, handler->GetNameLink().c_str());
|
||||
|
||||
return true;
|
||||
}
|
||||
//demorph player or unit
|
||||
static bool HandleDeMorphCommand(ChatHandler* handler, const char* /*args*/)
|
||||
{
|
||||
Unit* target = handler->getSelectedUnit();
|
||||
if (!target)
|
||||
target = handler->GetSession()->GetPlayer();
|
||||
|
||||
// check online security
|
||||
else if (target->GetTypeId() == TYPEID_PLAYER && handler->HasLowerSecurity(target->ToPlayer(), 0))
|
||||
return false;
|
||||
|
||||
target->DeMorph();
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -28,6 +28,7 @@ EndScriptData */
|
||||
#include "Transport.h"
|
||||
#include "CreatureGroups.h"
|
||||
#include "TargetedMovementGenerator.h" // for HandleNpcUnFollowCommand
|
||||
#include "CreatureAI.h"
|
||||
|
||||
class npc_commandscript : public CommandScript
|
||||
{
|
||||
@@ -73,6 +74,7 @@ public:
|
||||
{ "phase", SEC_GAMEMASTER, false, &HandleNpcSetPhaseCommand, "", NULL },
|
||||
{ "spawndist", SEC_GAMEMASTER, false, &HandleNpcSetSpawnDistCommand, "", NULL },
|
||||
{ "spawntime", SEC_GAMEMASTER, false, &HandleNpcSetSpawnTimeCommand, "", NULL },
|
||||
{ "data", SEC_ADMINISTRATOR, false, &HandleNpcSetDataCommand, "", NULL },
|
||||
//{ TODO: fix or remove these commands
|
||||
{ "name", SEC_GAMEMASTER, false, &HandleNpcSetNameCommand, "", NULL },
|
||||
{ "subname", SEC_GAMEMASTER, false, &HandleNpcSetSubNameCommand, "", NULL },
|
||||
@@ -524,6 +526,39 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
//set data of creature for testing scripting
|
||||
static bool HandleNpcSetDataCommand(ChatHandler* handler, const char* args)
|
||||
{
|
||||
if (!*args)
|
||||
return false;
|
||||
|
||||
char* arg1 = strtok((char*)args, " ");
|
||||
char* arg2 = strtok((char*)NULL, "");
|
||||
|
||||
if (!arg1 || !arg2)
|
||||
return false;
|
||||
|
||||
uint32 data_1 = (uint32)atoi(arg1);
|
||||
uint32 data_2 = (uint32)atoi(arg2);
|
||||
|
||||
if (!data_1 || !data_2)
|
||||
return false;
|
||||
|
||||
Creature* creature = handler->getSelectedCreature();
|
||||
|
||||
if (!creature)
|
||||
{
|
||||
handler->SendSysMessage(LANG_SELECT_CREATURE);
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
creature->AI()->SetData(data_1, data_2);
|
||||
std::string AIorScript = creature->GetAIName() != "" ? "AI type: " + creature->GetAIName() : (creature->GetScriptName() != "" ? "Script Name: " + creature->GetScriptName() : "No AI or Script Name Set");
|
||||
handler->PSendSysMessage(LANG_NPC_SETDATA, creature->GetGUID(), creature->GetEntry(), creature->GetName(), data_1, data_2, AIorScript.c_str());
|
||||
return true;
|
||||
}
|
||||
|
||||
//npc follow handling
|
||||
static bool HandleNpcFollowCommand(ChatHandler* handler, const char* /*args*/)
|
||||
{
|
||||
@@ -769,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
|
||||
@@ -777,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;
|
||||
}
|
||||
}
|
||||
@@ -786,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;
|
||||
}
|
||||
|
||||
@@ -38,6 +38,7 @@ public:
|
||||
{ "add", SEC_ADMINISTRATOR, false, &HandleQuestAdd, "", NULL },
|
||||
{ "complete", SEC_ADMINISTRATOR, false, &HandleQuestComplete, "", NULL },
|
||||
{ "remove", SEC_ADMINISTRATOR, false, &HandleQuestRemove, "", NULL },
|
||||
{ "reward", SEC_ADMINISTRATOR, false, &HandleQuestReward, "", NULL },
|
||||
{ NULL, 0, false, NULL, "", NULL }
|
||||
};
|
||||
static ChatCommand commandTable[] =
|
||||
@@ -77,7 +78,7 @@ public:
|
||||
|
||||
// check item starting quest (it can work incorrectly if added without item in inventory)
|
||||
ItemTemplateContainer const* itc = sObjectMgr->GetItemTemplateStore();
|
||||
ItemTemplateContainer::const_iterator result = find_if (itc->begin(), itc->end(), Finder<uint32, ItemTemplate>(entry, &ItemTemplate::StartQuest));
|
||||
ItemTemplateContainer::const_iterator result = find_if(itc->begin(), itc->end(), Finder<uint32, ItemTemplate>(entry, &ItemTemplate::StartQuest));
|
||||
|
||||
if (result != itc->end())
|
||||
{
|
||||
@@ -244,6 +245,38 @@ public:
|
||||
player->CompleteQuest(entry);
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool HandleQuestReward(ChatHandler* handler, char const* args)
|
||||
{
|
||||
Player* player = handler->getSelectedPlayer();
|
||||
if (!player)
|
||||
{
|
||||
handler->SendSysMessage(LANG_NO_CHAR_SELECTED);
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
// .quest reward #entry
|
||||
// number or [name] Shift-click form |color|Hquest:quest_id:quest_level|h[name]|h|r
|
||||
char* cId = handler->extractKeyFromLink((char*)args, "Hquest");
|
||||
if (!cId)
|
||||
return false;
|
||||
|
||||
uint32 entry = atol(cId);
|
||||
|
||||
Quest const* quest = sObjectMgr->GetQuestTemplate(entry);
|
||||
|
||||
// If player doesn't have the quest
|
||||
if (!quest || player->GetQuestStatus(entry) != QUEST_STATUS_COMPLETE)
|
||||
{
|
||||
handler->PSendSysMessage(LANG_COMMAND_QUEST_NOTFOUND, entry);
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
player->RewardQuest(quest, 0, player);
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
void AddSC_quest_commandscript()
|
||||
|
||||
@@ -222,7 +222,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);
|
||||
@@ -245,7 +245,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;
|
||||
@@ -260,7 +260,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");
|
||||
@@ -333,7 +333,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.");
|
||||
@@ -342,7 +342,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;
|
||||
@@ -350,7 +350,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;
|
||||
@@ -358,7 +358,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;
|
||||
@@ -366,7 +366,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;
|
||||
@@ -374,7 +374,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;
|
||||
@@ -382,7 +382,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;
|
||||
@@ -397,7 +397,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;
|
||||
@@ -431,7 +431,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();
|
||||
|
||||
@@ -527,7 +527,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;
|
||||
@@ -535,7 +535,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;
|
||||
@@ -543,7 +543,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;
|
||||
@@ -551,7 +551,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);
|
||||
@@ -560,7 +560,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);
|
||||
@@ -569,7 +569,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;
|
||||
@@ -577,7 +577,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;
|
||||
@@ -585,7 +585,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;
|
||||
@@ -593,12 +593,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;
|
||||
@@ -606,7 +606,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.");
|
||||
@@ -616,7 +616,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.");
|
||||
@@ -626,7 +626,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.");
|
||||
@@ -636,7 +636,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.");
|
||||
@@ -646,7 +646,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.");
|
||||
@@ -656,7 +656,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.");
|
||||
@@ -666,7 +666,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.");
|
||||
@@ -676,7 +676,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.");
|
||||
@@ -686,7 +686,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.");
|
||||
@@ -696,7 +696,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);
|
||||
@@ -705,7 +705,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.");
|
||||
@@ -715,7 +715,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.");
|
||||
@@ -725,7 +725,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;
|
||||
@@ -740,7 +740,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;
|
||||
@@ -748,7 +748,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;
|
||||
@@ -756,7 +756,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;
|
||||
@@ -764,7 +764,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;
|
||||
@@ -772,7 +772,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;
|
||||
@@ -780,7 +780,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;
|
||||
@@ -788,7 +788,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;
|
||||
@@ -796,7 +796,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;
|
||||
@@ -804,7 +804,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;
|
||||
@@ -812,7 +812,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;
|
||||
@@ -820,7 +820,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;
|
||||
@@ -828,7 +828,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;
|
||||
@@ -836,7 +836,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;
|
||||
@@ -844,7 +844,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;
|
||||
@@ -852,7 +852,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;
|
||||
@@ -860,7 +860,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;
|
||||
@@ -868,7 +868,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;
|
||||
@@ -876,7 +876,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;
|
||||
@@ -884,7 +884,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;
|
||||
@@ -892,7 +892,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;
|
||||
@@ -900,7 +900,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;
|
||||
@@ -908,7 +908,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;
|
||||
@@ -916,7 +916,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;
|
||||
@@ -924,7 +924,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;
|
||||
@@ -932,7 +932,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;
|
||||
@@ -940,7 +940,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;
|
||||
@@ -948,8 +948,8 @@ public:
|
||||
|
||||
static bool HandleReloadItemSetNamesCommand(ChatHandler* handler, const char* /*args*/)
|
||||
{
|
||||
sLog->outString("Re-Loading Item set names...");
|
||||
LoadRandomEnchantmentsTable();
|
||||
sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Item set names...");
|
||||
sObjectMgr->LoadItemSetNames();
|
||||
handler->SendGlobalGMSysMessage("DB table `item_set_names` reloaded.");
|
||||
return true;
|
||||
}
|
||||
@@ -964,7 +964,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();
|
||||
|
||||
@@ -984,7 +984,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();
|
||||
|
||||
@@ -1004,7 +1004,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();
|
||||
|
||||
@@ -1017,7 +1017,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();
|
||||
|
||||
@@ -1030,7 +1030,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;
|
||||
@@ -1038,7 +1038,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;
|
||||
@@ -1046,7 +1046,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;
|
||||
@@ -1062,7 +1062,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();
|
||||
|
||||
@@ -1082,7 +1082,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();
|
||||
|
||||
@@ -1102,7 +1102,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();
|
||||
|
||||
@@ -1114,7 +1114,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;
|
||||
@@ -1122,7 +1122,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();
|
||||
|
||||
@@ -1133,7 +1133,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();
|
||||
|
||||
@@ -1144,9 +1144,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;
|
||||
@@ -1154,7 +1154,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;
|
||||
@@ -1162,7 +1162,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;
|
||||
@@ -1170,7 +1170,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;
|
||||
@@ -1178,7 +1178,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;
|
||||
@@ -1186,7 +1186,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;
|
||||
@@ -1194,7 +1194,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;
|
||||
@@ -1202,7 +1202,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;
|
||||
@@ -1210,7 +1210,7 @@ public:
|
||||
|
||||
static bool HandleReloadLocalesItemSetNameCommand(ChatHandler* handler, const char* /*args*/)
|
||||
{
|
||||
sLog->outString("Re-Loading Locales Item set name... ");
|
||||
sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Locales Item set name... ");
|
||||
sObjectMgr->LoadItemSetNameLocales();
|
||||
handler->SendGlobalGMSysMessage("DB table `locales_item_set_name` reloaded.");
|
||||
return true;
|
||||
@@ -1218,7 +1218,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;
|
||||
@@ -1226,7 +1226,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;
|
||||
@@ -1234,7 +1234,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;
|
||||
@@ -1242,7 +1242,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;
|
||||
@@ -1250,7 +1250,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;
|
||||
@@ -1259,7 +1259,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.");
|
||||
@@ -1268,7 +1268,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;
|
||||
@@ -1276,7 +1276,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;
|
||||
@@ -1284,7 +1284,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;
|
||||
@@ -1292,7 +1292,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;
|
||||
@@ -1300,7 +1300,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;
|
||||
|
||||
@@ -0,0 +1,313 @@
|
||||
/*
|
||||
* 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: reset_commandscript
|
||||
%Complete: 100
|
||||
Comment: All reset related commands
|
||||
Category: commandscripts
|
||||
EndScriptData */
|
||||
|
||||
#include "ScriptMgr.h"
|
||||
#include "Chat.h"
|
||||
#include "ObjectAccessor.h"
|
||||
|
||||
class reset_commandscript : public CommandScript
|
||||
{
|
||||
public:
|
||||
reset_commandscript() : CommandScript("reset_commandscript") { }
|
||||
|
||||
ChatCommand* GetCommands() const
|
||||
{
|
||||
static ChatCommand resetCommandTable[] =
|
||||
{
|
||||
{ "achievements", SEC_ADMINISTRATOR, true, &HandleResetAchievementsCommand, "", NULL },
|
||||
{ "honor", SEC_ADMINISTRATOR, true, &HandleResetHonorCommand, "", NULL },
|
||||
{ "level", SEC_ADMINISTRATOR, true, &HandleResetLevelCommand, "", NULL },
|
||||
{ "spells", SEC_ADMINISTRATOR, true, &HandleResetSpellsCommand, "", NULL },
|
||||
{ "stats", SEC_ADMINISTRATOR, true, &HandleResetStatsCommand, "", NULL },
|
||||
{ "talents", SEC_ADMINISTRATOR, true, &HandleResetTalentsCommand, "", NULL },
|
||||
{ "all", SEC_ADMINISTRATOR, true, &HandleResetAllCommand, "", NULL },
|
||||
{ NULL, 0, false, NULL, "", NULL }
|
||||
};
|
||||
static ChatCommand commandTable[] =
|
||||
{
|
||||
{ "reset", SEC_ADMINISTRATOR, true, NULL, "", resetCommandTable },
|
||||
{ NULL, 0, false, NULL, "", NULL }
|
||||
};
|
||||
return commandTable;
|
||||
}
|
||||
|
||||
static bool HandleResetAchievementsCommand(ChatHandler* handler, char const* args)
|
||||
{
|
||||
Player* target;
|
||||
uint64 targetGuid;
|
||||
if (!handler->extractPlayerTarget((char*)args, &target, &targetGuid))
|
||||
return false;
|
||||
|
||||
if (target)
|
||||
target->GetAchievementMgr().Reset();
|
||||
else
|
||||
AchievementMgr::DeleteFromDB(GUID_LOPART(targetGuid));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool HandleResetHonorCommand(ChatHandler* handler, char const* args)
|
||||
{
|
||||
Player* target;
|
||||
if (!handler->extractPlayerTarget((char*)args, &target))
|
||||
return false;
|
||||
|
||||
target->SetHonorPoints(0);
|
||||
target->SetUInt32Value(PLAYER_FIELD_KILLS, 0);
|
||||
target->SetUInt32Value(PLAYER_FIELD_LIFETIME_HONORABLE_KILLS, 0);
|
||||
target->SetUInt32Value(PLAYER_FIELD_TODAY_CONTRIBUTION, 0);
|
||||
target->SetUInt32Value(PLAYER_FIELD_YESTERDAY_CONTRIBUTION, 0);
|
||||
target->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_EARN_HONORABLE_KILL);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool HandleResetStatsOrLevelHelper(Player* player)
|
||||
{
|
||||
ChrClassesEntry const* classEntry = sChrClassesStore.LookupEntry(player->getClass());
|
||||
if (!classEntry)
|
||||
{
|
||||
sLog->outError(LOG_FILTER_GENERAL, "Class %u not found in DBC (Wrong DBC files?)", player->getClass());
|
||||
return false;
|
||||
}
|
||||
|
||||
uint8 powerType = classEntry->powerType;
|
||||
|
||||
// reset m_form if no aura
|
||||
if (!player->HasAuraType(SPELL_AURA_MOD_SHAPESHIFT))
|
||||
player->SetShapeshiftForm(FORM_NONE);
|
||||
|
||||
player->SetFloatValue(UNIT_FIELD_BOUNDINGRADIUS, DEFAULT_WORLD_OBJECT_SIZE);
|
||||
player->SetFloatValue(UNIT_FIELD_COMBATREACH, DEFAULT_COMBAT_REACH);
|
||||
|
||||
player->setFactionForRace(player->getRace());
|
||||
|
||||
player->SetUInt32Value(UNIT_FIELD_BYTES_0, ((player->getRace()) | (player->getClass() << 8) | (player->getGender() << 16) | (powerType << 24)));
|
||||
|
||||
// reset only if player not in some form;
|
||||
if (player->GetShapeshiftForm() == FORM_NONE)
|
||||
player->InitDisplayIds();
|
||||
|
||||
player->SetByteValue(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_PVP);
|
||||
|
||||
player->SetUInt32Value(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE);
|
||||
|
||||
//-1 is default value
|
||||
player->SetUInt32Value(PLAYER_FIELD_WATCHED_FACTION_INDEX, uint32(-1));
|
||||
|
||||
//player->SetUInt32Value(PLAYER_FIELD_BYTES, 0xEEE00000);
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool HandleResetLevelCommand(ChatHandler* handler, char const* args)
|
||||
{
|
||||
Player* target;
|
||||
if (!handler->extractPlayerTarget((char*)args, &target))
|
||||
return false;
|
||||
|
||||
if (!HandleResetStatsOrLevelHelper(target))
|
||||
return false;
|
||||
|
||||
uint8 oldLevel = target->getLevel();
|
||||
|
||||
// set starting level
|
||||
uint32 startLevel = target->getClass() != CLASS_DEATH_KNIGHT
|
||||
? sWorld->getIntConfig(CONFIG_START_PLAYER_LEVEL)
|
||||
: sWorld->getIntConfig(CONFIG_START_HEROIC_PLAYER_LEVEL);
|
||||
|
||||
target->_ApplyAllLevelScaleItemMods(false);
|
||||
target->SetLevel(startLevel);
|
||||
target->InitRunes();
|
||||
target->InitStatsForLevel(true);
|
||||
target->InitTaxiNodesForLevel();
|
||||
target->InitGlyphsForLevel();
|
||||
target->InitTalentForLevel();
|
||||
target->SetUInt32Value(PLAYER_XP, 0);
|
||||
|
||||
target->_ApplyAllLevelScaleItemMods(true);
|
||||
|
||||
// reset level for pet
|
||||
if (Pet* pet = target->GetPet())
|
||||
pet->SynchronizeLevelWithOwner();
|
||||
|
||||
sScriptMgr->OnPlayerLevelChanged(target, oldLevel);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool HandleResetSpellsCommand(ChatHandler* handler, char const* args)
|
||||
{
|
||||
Player* target;
|
||||
uint64 targetGuid;
|
||||
std::string targetName;
|
||||
if (!handler->extractPlayerTarget((char*)args, &target, &targetGuid, &targetName))
|
||||
return false;
|
||||
|
||||
if (target)
|
||||
{
|
||||
target->resetSpells(/* bool myClassOnly */);
|
||||
|
||||
ChatHandler(target).SendSysMessage(LANG_RESET_SPELLS);
|
||||
if (!handler->GetSession() || handler->GetSession()->GetPlayer() != target)
|
||||
handler->PSendSysMessage(LANG_RESET_SPELLS_ONLINE, handler->GetNameLink(target).c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_ADD_AT_LOGIN_FLAG);
|
||||
stmt->setUInt16(0, uint16(AT_LOGIN_RESET_SPELLS));
|
||||
stmt->setUInt32(1, GUID_LOPART(targetGuid));
|
||||
CharacterDatabase.Execute(stmt);
|
||||
|
||||
handler->PSendSysMessage(LANG_RESET_SPELLS_OFFLINE, targetName.c_str());
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool HandleResetStatsCommand(ChatHandler* handler, char const* args)
|
||||
{
|
||||
Player* target;
|
||||
if (!handler->extractPlayerTarget((char*)args, &target))
|
||||
return false;
|
||||
|
||||
if (!HandleResetStatsOrLevelHelper(target))
|
||||
return false;
|
||||
|
||||
target->InitRunes();
|
||||
target->InitStatsForLevel(true);
|
||||
target->InitTaxiNodesForLevel();
|
||||
target->InitGlyphsForLevel();
|
||||
target->InitTalentForLevel();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool HandleResetTalentsCommand(ChatHandler* handler, char const* args)
|
||||
{
|
||||
Player* target;
|
||||
uint64 targetGuid;
|
||||
std::string targetName;
|
||||
if (!handler->extractPlayerTarget((char*)args, &target, &targetGuid, &targetName))
|
||||
{
|
||||
// Try reset talents as Hunter Pet
|
||||
Creature* creature = handler->getSelectedCreature();
|
||||
if (!*args && creature && creature->isPet())
|
||||
{
|
||||
Unit* owner = creature->GetOwner();
|
||||
if (owner && owner->GetTypeId() == TYPEID_PLAYER && creature->ToPet()->IsPermanentPetFor(owner->ToPlayer()))
|
||||
{
|
||||
creature->ToPet()->resetTalents();
|
||||
owner->ToPlayer()->SendTalentsInfoData(true);
|
||||
|
||||
ChatHandler(owner->ToPlayer()).SendSysMessage(LANG_RESET_PET_TALENTS);
|
||||
if (!handler->GetSession() || handler->GetSession()->GetPlayer() != owner->ToPlayer())
|
||||
handler->PSendSysMessage(LANG_RESET_PET_TALENTS_ONLINE, handler->GetNameLink(owner->ToPlayer()).c_str());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
handler->SendSysMessage(LANG_NO_CHAR_SELECTED);
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (target)
|
||||
{
|
||||
target->resetTalents(true);
|
||||
target->SendTalentsInfoData(false);
|
||||
ChatHandler(target).SendSysMessage(LANG_RESET_TALENTS);
|
||||
if (!handler->GetSession() || handler->GetSession()->GetPlayer() != target)
|
||||
handler->PSendSysMessage(LANG_RESET_TALENTS_ONLINE, handler->GetNameLink(target).c_str());
|
||||
|
||||
Pet* pet = target->GetPet();
|
||||
Pet::resetTalentsForAllPetsOf(target, pet);
|
||||
if (pet)
|
||||
target->SendTalentsInfoData(true);
|
||||
return true;
|
||||
}
|
||||
else if (targetGuid)
|
||||
{
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_ADD_AT_LOGIN_FLAG);
|
||||
stmt->setUInt16(0, uint16(AT_LOGIN_NONE | AT_LOGIN_RESET_PET_TALENTS));
|
||||
stmt->setUInt32(1, GUID_LOPART(targetGuid));
|
||||
CharacterDatabase.Execute(stmt);
|
||||
|
||||
std::string nameLink = handler->playerLink(targetName);
|
||||
handler->PSendSysMessage(LANG_RESET_TALENTS_OFFLINE, nameLink.c_str());
|
||||
return true;
|
||||
}
|
||||
|
||||
handler->SendSysMessage(LANG_NO_CHAR_SELECTED);
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool HandleResetAllCommand(ChatHandler* handler, char const* args)
|
||||
{
|
||||
if (!*args)
|
||||
return false;
|
||||
|
||||
std::string caseName = args;
|
||||
|
||||
AtLoginFlags atLogin;
|
||||
|
||||
// Command specially created as single command to prevent using short case names
|
||||
if (caseName == "spells")
|
||||
{
|
||||
atLogin = AT_LOGIN_RESET_SPELLS;
|
||||
sWorld->SendWorldText(LANG_RESETALL_SPELLS);
|
||||
if (!handler->GetSession())
|
||||
handler->SendSysMessage(LANG_RESETALL_SPELLS);
|
||||
}
|
||||
else if (caseName == "talents")
|
||||
{
|
||||
atLogin = AtLoginFlags(AT_LOGIN_RESET_TALENTS | AT_LOGIN_RESET_PET_TALENTS);
|
||||
sWorld->SendWorldText(LANG_RESETALL_TALENTS);
|
||||
if (!handler->GetSession())
|
||||
handler->SendSysMessage(LANG_RESETALL_TALENTS);
|
||||
}
|
||||
else
|
||||
{
|
||||
handler->PSendSysMessage(LANG_RESETALL_UNKNOWN_CASE, args);
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_ALL_AT_LOGIN_FLAGS);
|
||||
stmt->setUInt16(0, uint16(atLogin));
|
||||
CharacterDatabase.Execute(stmt);
|
||||
|
||||
TRINITY_READ_GUARD(HashMapHolder<Player>::LockType, *HashMapHolder<Player>::GetLock());
|
||||
HashMapHolder<Player>::MapType const& plist = sObjectAccessor->GetPlayers();
|
||||
for (HashMapHolder<Player>::MapType::const_iterator itr = plist.begin(); itr != plist.end(); ++itr)
|
||||
itr->second->SetAtLoginFlag(atLogin);
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
void AddSC_reset_commandscript()
|
||||
{
|
||||
new reset_commandscript();
|
||||
}
|
||||
@@ -0,0 +1,420 @@
|
||||
/*
|
||||
* 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: server_commandscript
|
||||
%Complete: 100
|
||||
Comment: All server related commands
|
||||
Category: commandscripts
|
||||
EndScriptData */
|
||||
|
||||
#include "ScriptMgr.h"
|
||||
#include "Chat.h"
|
||||
#include "SystemConfig.h"
|
||||
#include "Config.h"
|
||||
#include "ObjectAccessor.h"
|
||||
|
||||
class server_commandscript : public CommandScript
|
||||
{
|
||||
public:
|
||||
server_commandscript() : CommandScript("server_commandscript") { }
|
||||
|
||||
ChatCommand* GetCommands() const
|
||||
{
|
||||
static ChatCommand serverIdleRestartCommandTable[] =
|
||||
{
|
||||
{ "cancel", SEC_ADMINISTRATOR, true, &HandleServerShutDownCancelCommand, "", NULL },
|
||||
{ "" , SEC_ADMINISTRATOR, true, &HandleServerIdleRestartCommand, "", NULL },
|
||||
{ NULL, 0, false, NULL, "", NULL }
|
||||
};
|
||||
|
||||
static ChatCommand serverIdleShutdownCommandTable[] =
|
||||
{
|
||||
{ "cancel", SEC_ADMINISTRATOR, true, &HandleServerShutDownCancelCommand, "", NULL },
|
||||
{ "" , SEC_ADMINISTRATOR, true, &HandleServerIdleShutDownCommand, "", NULL },
|
||||
{ NULL, 0, false, NULL, "", NULL }
|
||||
};
|
||||
|
||||
static ChatCommand serverRestartCommandTable[] =
|
||||
{
|
||||
{ "cancel", SEC_ADMINISTRATOR, true, &HandleServerShutDownCancelCommand, "", NULL },
|
||||
{ "" , SEC_ADMINISTRATOR, true, &HandleServerRestartCommand, "", NULL },
|
||||
{ NULL, 0, false, NULL, "", NULL }
|
||||
};
|
||||
|
||||
static ChatCommand serverShutdownCommandTable[] =
|
||||
{
|
||||
{ "cancel", SEC_ADMINISTRATOR, true, &HandleServerShutDownCancelCommand, "", NULL },
|
||||
{ "" , SEC_ADMINISTRATOR, true, &HandleServerShutDownCommand, "", NULL },
|
||||
{ NULL, 0, false, NULL, "", NULL }
|
||||
};
|
||||
|
||||
static ChatCommand serverSetCommandTable[] =
|
||||
{
|
||||
{ "difftime", SEC_CONSOLE, true, &HandleServerSetDiffTimeCommand, "", NULL },
|
||||
{ "loglevel", SEC_CONSOLE, true, &HandleServerSetLogLevelCommand, "", NULL },
|
||||
{ "motd", SEC_ADMINISTRATOR, true, &HandleServerSetMotdCommand, "", NULL },
|
||||
{ "closed", SEC_ADMINISTRATOR, true, &HandleServerSetClosedCommand, "", NULL },
|
||||
{ NULL, 0, false, NULL, "", NULL }
|
||||
};
|
||||
|
||||
static ChatCommand serverCommandTable[] =
|
||||
{
|
||||
{ "corpses", SEC_GAMEMASTER, true, &HandleServerCorpsesCommand, "", NULL },
|
||||
{ "exit", SEC_CONSOLE, true, &HandleServerExitCommand, "", NULL },
|
||||
{ "idlerestart", SEC_ADMINISTRATOR, true, NULL, "", serverIdleRestartCommandTable },
|
||||
{ "idleshutdown", SEC_ADMINISTRATOR, true, NULL, "", serverIdleShutdownCommandTable },
|
||||
{ "info", SEC_PLAYER, true, &HandleServerInfoCommand, "", NULL },
|
||||
{ "motd", SEC_PLAYER, true, &HandleServerMotdCommand, "", NULL },
|
||||
{ "plimit", SEC_ADMINISTRATOR, true, &HandleServerPLimitCommand, "", NULL },
|
||||
{ "restart", SEC_ADMINISTRATOR, true, NULL, "", serverRestartCommandTable },
|
||||
{ "shutdown", SEC_ADMINISTRATOR, true, NULL, "", serverShutdownCommandTable },
|
||||
{ "set", SEC_ADMINISTRATOR, true, NULL, "", serverSetCommandTable },
|
||||
{ NULL, 0, false, NULL, "", NULL }
|
||||
};
|
||||
|
||||
static ChatCommand commandTable[] =
|
||||
{
|
||||
{ "server", SEC_ADMINISTRATOR, true, NULL, "", serverCommandTable },
|
||||
{ NULL, 0, false, NULL, "", NULL }
|
||||
};
|
||||
return commandTable;
|
||||
}
|
||||
|
||||
// Triggering corpses expire check in world
|
||||
static bool HandleServerCorpsesCommand(ChatHandler* /*handler*/, char const* /*args*/)
|
||||
{
|
||||
sObjectAccessor->RemoveOldCorpses();
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool HandleServerInfoCommand(ChatHandler* handler, char const* /*args*/)
|
||||
{
|
||||
uint32 playersNum = sWorld->GetPlayerCount();
|
||||
uint32 maxPlayersNum = sWorld->GetMaxPlayerCount();
|
||||
uint32 activeClientsNum = sWorld->GetActiveSessionCount();
|
||||
uint32 queuedClientsNum = sWorld->GetQueuedSessionCount();
|
||||
uint32 maxActiveClientsNum = sWorld->GetMaxActiveSessionCount();
|
||||
uint32 maxQueuedClientsNum = sWorld->GetMaxQueuedSessionCount();
|
||||
std::string uptime = secsToTimeString(sWorld->GetUptime());
|
||||
uint32 updateTime = sWorld->GetUpdateTime();
|
||||
|
||||
handler->SendSysMessage(_FULLVERSION);
|
||||
handler->PSendSysMessage(LANG_CONNECTED_PLAYERS, playersNum, maxPlayersNum);
|
||||
handler->PSendSysMessage(LANG_CONNECTED_USERS, activeClientsNum, maxActiveClientsNum, queuedClientsNum, maxQueuedClientsNum);
|
||||
handler->PSendSysMessage(LANG_UPTIME, uptime.c_str());
|
||||
handler->PSendSysMessage(LANG_UPDATE_DIFF, updateTime);
|
||||
// Can't use sWorld->ShutdownMsg here in case of console command
|
||||
if (sWorld->IsShuttingDown())
|
||||
handler->PSendSysMessage(LANG_SHUTDOWN_TIMELEFT, secsToTimeString(sWorld->GetShutDownTimeLeft()).c_str());
|
||||
|
||||
return true;
|
||||
}
|
||||
// Display the 'Message of the day' for the realm
|
||||
static bool HandleServerMotdCommand(ChatHandler* handler, char const* /*args*/)
|
||||
{
|
||||
handler->PSendSysMessage(LANG_MOTD_CURRENT, sWorld->GetMotd());
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool HandleServerPLimitCommand(ChatHandler* handler, char const* args)
|
||||
{
|
||||
if (*args)
|
||||
{
|
||||
char* paramStr = strtok((char*)args, " ");
|
||||
if (!paramStr)
|
||||
return false;
|
||||
|
||||
int32 limit = strlen(paramStr);
|
||||
|
||||
if (strncmp(paramStr, "player", limit) == 0)
|
||||
sWorld->SetPlayerSecurityLimit(SEC_PLAYER);
|
||||
else if (strncmp(paramStr, "moderator", limit) == 0)
|
||||
sWorld->SetPlayerSecurityLimit(SEC_MODERATOR);
|
||||
else if (strncmp(paramStr, "gamemaster", limit) == 0)
|
||||
sWorld->SetPlayerSecurityLimit(SEC_GAMEMASTER);
|
||||
else if (strncmp(paramStr, "administrator", limit) == 0)
|
||||
sWorld->SetPlayerSecurityLimit(SEC_ADMINISTRATOR);
|
||||
else if (strncmp(paramStr, "reset", limit) == 0)
|
||||
{
|
||||
sWorld->SetPlayerAmountLimit(ConfigMgr::GetIntDefault("PlayerLimit", 100));
|
||||
sWorld->LoadDBAllowedSecurityLevel();
|
||||
}
|
||||
else
|
||||
{
|
||||
int32 value = atoi(paramStr);
|
||||
if (value < 0)
|
||||
sWorld->SetPlayerSecurityLimit(AccountTypes(-value));
|
||||
else
|
||||
sWorld->SetPlayerAmountLimit(uint32(value));
|
||||
}
|
||||
}
|
||||
|
||||
uint32 playerAmountLimit = sWorld->GetPlayerAmountLimit();
|
||||
AccountTypes allowedAccountType = sWorld->GetPlayerSecurityLimit();
|
||||
char const* secName = "";
|
||||
switch (allowedAccountType)
|
||||
{
|
||||
case SEC_PLAYER:
|
||||
secName = "Player";
|
||||
break;
|
||||
case SEC_MODERATOR:
|
||||
secName = "Moderator";
|
||||
break;
|
||||
case SEC_GAMEMASTER:
|
||||
secName = "Gamemaster";
|
||||
break;
|
||||
case SEC_ADMINISTRATOR:
|
||||
secName = "Administrator";
|
||||
break;
|
||||
default:
|
||||
secName = "<unknown>";
|
||||
break;
|
||||
}
|
||||
handler->PSendSysMessage("Player limits: amount %u, min. security level %s.", playerAmountLimit, secName);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool HandleServerShutDownCancelCommand(ChatHandler* /*handler*/, char const* /*args*/)
|
||||
{
|
||||
sWorld->ShutdownCancel();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool HandleServerShutDownCommand(ChatHandler* /*handler*/, char const* args)
|
||||
{
|
||||
if (!*args)
|
||||
return false;
|
||||
|
||||
char* timeStr = strtok((char*) args, " ");
|
||||
char* exitCodeStr = strtok(NULL, "");
|
||||
|
||||
int32 time = atoi(timeStr);
|
||||
|
||||
// Prevent interpret wrong arg value as 0 secs shutdown time
|
||||
if ((time == 0 && (timeStr[0] != '0' || timeStr[1] != '\0')) || time < 0)
|
||||
return false;
|
||||
|
||||
if (exitCodeStr)
|
||||
{
|
||||
int32 exitCode = atoi(exitCodeStr);
|
||||
|
||||
// Handle atoi() errors
|
||||
if (exitCode == 0 && (exitCodeStr[0] != '0' || exitCodeStr[1] != '\0'))
|
||||
return false;
|
||||
|
||||
// Exit code should be in range of 0-125, 126-255 is used
|
||||
// in many shells for their own return codes and code > 255
|
||||
// is not supported in many others
|
||||
if (exitCode < 0 || exitCode > 125)
|
||||
return false;
|
||||
|
||||
sWorld->ShutdownServ(time, 0, exitCode);
|
||||
}
|
||||
else
|
||||
sWorld->ShutdownServ(time, 0, SHUTDOWN_EXIT_CODE);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool HandleServerRestartCommand(ChatHandler* /*handler*/, char const* args)
|
||||
{
|
||||
if (!*args)
|
||||
return false;
|
||||
|
||||
char* timeStr = strtok((char*) args, " ");
|
||||
char* exitCodeStr = strtok(NULL, "");
|
||||
|
||||
int32 time = atoi(timeStr);
|
||||
|
||||
// Prevent interpret wrong arg value as 0 secs shutdown time
|
||||
if ((time == 0 && (timeStr[0] != '0' || timeStr[1] != '\0')) || time < 0)
|
||||
return false;
|
||||
|
||||
if (exitCodeStr)
|
||||
{
|
||||
int32 exitCode = atoi(exitCodeStr);
|
||||
|
||||
// Handle atoi() errors
|
||||
if (exitCode == 0 && (exitCodeStr[0] != '0' || exitCodeStr[1] != '\0'))
|
||||
return false;
|
||||
|
||||
// Exit code should be in range of 0-125, 126-255 is used
|
||||
// in many shells for their own return codes and code > 255
|
||||
// is not supported in many others
|
||||
if (exitCode < 0 || exitCode > 125)
|
||||
return false;
|
||||
|
||||
sWorld->ShutdownServ(time, SHUTDOWN_MASK_RESTART, exitCode);
|
||||
}
|
||||
else
|
||||
sWorld->ShutdownServ(time, SHUTDOWN_MASK_RESTART, RESTART_EXIT_CODE);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool HandleServerIdleRestartCommand(ChatHandler* /*handler*/, char const* args)
|
||||
{
|
||||
if (!*args)
|
||||
return false;
|
||||
|
||||
char* timeStr = strtok((char*) args, " ");
|
||||
char* exitCodeStr = strtok(NULL, "");
|
||||
|
||||
int32 time = atoi(timeStr);
|
||||
|
||||
// Prevent interpret wrong arg value as 0 secs shutdown time
|
||||
if ((time == 0 && (timeStr[0] != '0' || timeStr[1] != '\0')) || time < 0)
|
||||
return false;
|
||||
|
||||
if (exitCodeStr)
|
||||
{
|
||||
int32 exitCode = atoi(exitCodeStr);
|
||||
|
||||
// Handle atoi() errors
|
||||
if (exitCode == 0 && (exitCodeStr[0] != '0' || exitCodeStr[1] != '\0'))
|
||||
return false;
|
||||
|
||||
// Exit code should be in range of 0-125, 126-255 is used
|
||||
// in many shells for their own return codes and code > 255
|
||||
// is not supported in many others
|
||||
if (exitCode < 0 || exitCode > 125)
|
||||
return false;
|
||||
|
||||
sWorld->ShutdownServ(time, SHUTDOWN_MASK_RESTART | SHUTDOWN_MASK_IDLE, exitCode);
|
||||
}
|
||||
else
|
||||
sWorld->ShutdownServ(time, SHUTDOWN_MASK_RESTART | SHUTDOWN_MASK_IDLE, RESTART_EXIT_CODE);
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool HandleServerIdleShutDownCommand(ChatHandler* /*handler*/, char const* args)
|
||||
{
|
||||
if (!*args)
|
||||
return false;
|
||||
|
||||
char* timeStr = strtok((char*) args, " ");
|
||||
char* exitCodeStr = strtok(NULL, "");
|
||||
|
||||
int32 time = atoi(timeStr);
|
||||
|
||||
// Prevent interpret wrong arg value as 0 secs shutdown time
|
||||
if ((time == 0 && (timeStr[0] != '0' || timeStr[1] != '\0')) || time < 0)
|
||||
return false;
|
||||
|
||||
if (exitCodeStr)
|
||||
{
|
||||
int32 exitCode = atoi(exitCodeStr);
|
||||
|
||||
// Handle atoi() errors
|
||||
if (exitCode == 0 && (exitCodeStr[0] != '0' || exitCodeStr[1] != '\0'))
|
||||
return false;
|
||||
|
||||
// Exit code should be in range of 0-125, 126-255 is used
|
||||
// in many shells for their own return codes and code > 255
|
||||
// is not supported in many others
|
||||
if (exitCode < 0 || exitCode > 125)
|
||||
return false;
|
||||
|
||||
sWorld->ShutdownServ(time, SHUTDOWN_MASK_IDLE, exitCode);
|
||||
}
|
||||
else
|
||||
sWorld->ShutdownServ(time, SHUTDOWN_MASK_IDLE, SHUTDOWN_EXIT_CODE);
|
||||
return true;
|
||||
}
|
||||
|
||||
// Exit the realm
|
||||
static bool HandleServerExitCommand(ChatHandler* handler, char const* /*args*/)
|
||||
{
|
||||
handler->SendSysMessage(LANG_COMMAND_EXIT);
|
||||
World::StopNow(SHUTDOWN_EXIT_CODE);
|
||||
return true;
|
||||
}
|
||||
|
||||
// Define the 'Message of the day' for the realm
|
||||
static bool HandleServerSetMotdCommand(ChatHandler* handler, char const* args)
|
||||
{
|
||||
sWorld->SetMotd(args);
|
||||
handler->PSendSysMessage(LANG_MOTD_NEW, args);
|
||||
return true;
|
||||
}
|
||||
|
||||
// Set whether we accept new clients
|
||||
static bool HandleServerSetClosedCommand(ChatHandler* handler, char const* args)
|
||||
{
|
||||
if (strncmp(args, "on", 3) == 0)
|
||||
{
|
||||
handler->SendSysMessage(LANG_WORLD_CLOSED);
|
||||
sWorld->SetClosed(true);
|
||||
return true;
|
||||
}
|
||||
else if (strncmp(args, "off", 4) == 0)
|
||||
{
|
||||
handler->SendSysMessage(LANG_WORLD_OPENED);
|
||||
sWorld->SetClosed(false);
|
||||
return true;
|
||||
}
|
||||
|
||||
handler->SendSysMessage(LANG_USE_BOL);
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
// Set the level of logging
|
||||
static bool HandleServerSetLogLevelCommand(ChatHandler* /*handler*/, char const* args)
|
||||
{
|
||||
if (!*args)
|
||||
return false;
|
||||
|
||||
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(name, level, *type == 'l');
|
||||
return true;
|
||||
}
|
||||
|
||||
// set diff time record interval
|
||||
static bool HandleServerSetDiffTimeCommand(ChatHandler* /*handler*/, char const* args)
|
||||
{
|
||||
if (!*args)
|
||||
return false;
|
||||
|
||||
char* newTimeStr = strtok((char*)args, " ");
|
||||
if (!newTimeStr)
|
||||
return false;
|
||||
|
||||
int32 newTime = atoi(newTimeStr);
|
||||
if (newTime < 0)
|
||||
return false;
|
||||
|
||||
sWorld->SetRecordDiffInterval(newTime);
|
||||
printf("Record diff every %u ms\n", newTime);
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
void AddSC_server_commandscript()
|
||||
{
|
||||
new server_commandscript();
|
||||
}
|
||||
@@ -97,15 +97,16 @@ public:
|
||||
if (!*args)
|
||||
return false;
|
||||
|
||||
std::string name = args;
|
||||
|
||||
if (!sObjectMgr->DeleteGameTele(name))
|
||||
// id, or string, or [name] Shift-click form |color|Htele:id|h[name]|h|r
|
||||
GameTele const* tele = handler->extractGameTeleFromLink((char*)args);
|
||||
if (!tele)
|
||||
{
|
||||
handler->SendSysMessage(LANG_COMMAND_TELE_NOTFOUND);
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
std::string name = tele->name;
|
||||
sObjectMgr->DeleteGameTele(name);
|
||||
handler->SendSysMessage(LANG_COMMAND_TP_DELETED);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,509 @@
|
||||
/*
|
||||
* 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: ticket_commandscript
|
||||
%Complete: 100
|
||||
Comment: All ticket related commands
|
||||
Category: commandscripts
|
||||
EndScriptData */
|
||||
|
||||
#include "ScriptMgr.h"
|
||||
#include "Chat.h"
|
||||
#include "AccountMgr.h"
|
||||
#include "ObjectMgr.h"
|
||||
#include "TicketMgr.h"
|
||||
|
||||
class ticket_commandscript : public CommandScript
|
||||
{
|
||||
public:
|
||||
ticket_commandscript() : CommandScript("ticket_commandscript") { }
|
||||
|
||||
ChatCommand* GetCommands() const
|
||||
{
|
||||
static ChatCommand ticketResponseCommandTable[] =
|
||||
{
|
||||
{ "append", SEC_MODERATOR, true, &HandleGMTicketResponseAppendCommand, "", NULL },
|
||||
{ "appendln", SEC_MODERATOR, true, &HandleGMTicketResponseAppendLnCommand, "", NULL },
|
||||
{ NULL, 0, false, NULL, "", NULL }
|
||||
};
|
||||
static ChatCommand ticketCommandTable[] =
|
||||
{
|
||||
{ "assign", SEC_GAMEMASTER, true, &HandleGMTicketAssignToCommand, "", NULL },
|
||||
{ "close", SEC_MODERATOR, true, &HandleGMTicketCloseByIdCommand, "", NULL },
|
||||
{ "closedlist", SEC_MODERATOR, true, &HandleGMTicketListClosedCommand, "", NULL },
|
||||
{ "comment", SEC_MODERATOR, true, &HandleGMTicketCommentCommand, "", NULL },
|
||||
{ "complete", SEC_MODERATOR, true, &HandleGMTicketCompleteCommand, "", NULL },
|
||||
{ "delete", SEC_ADMINISTRATOR, true, &HandleGMTicketDeleteByIdCommand, "", NULL },
|
||||
{ "escalate", SEC_MODERATOR, true, &HandleGMTicketEscalateCommand, "", NULL },
|
||||
{ "escalatedlist", SEC_GAMEMASTER, true, &HandleGMTicketListEscalatedCommand, "", NULL },
|
||||
{ "list", SEC_MODERATOR, true, &HandleGMTicketListCommand, "", NULL },
|
||||
{ "onlinelist", SEC_MODERATOR, true, &HandleGMTicketListOnlineCommand, "", NULL },
|
||||
{ "reset", SEC_ADMINISTRATOR, true, &HandleGMTicketResetCommand, "", NULL },
|
||||
{ "response", SEC_MODERATOR, true, NULL, "", ticketResponseCommandTable },
|
||||
{ "togglesystem", SEC_ADMINISTRATOR, true, &HandleToggleGMTicketSystem, "", NULL },
|
||||
{ "unassign", SEC_GAMEMASTER, true, &HandleGMTicketUnAssignCommand, "", NULL },
|
||||
{ "viewid", SEC_MODERATOR, true, &HandleGMTicketGetByIdCommand, "", NULL },
|
||||
{ "viewname", SEC_MODERATOR, true, &HandleGMTicketGetByNameCommand, "", NULL },
|
||||
{ NULL, 0, false, NULL, "", NULL }
|
||||
};
|
||||
static ChatCommand commandTable[] =
|
||||
{
|
||||
{ "ticket", SEC_MODERATOR, false, NULL, "", ticketCommandTable },
|
||||
{ NULL, 0, false, NULL, "", NULL }
|
||||
};
|
||||
return commandTable;
|
||||
}
|
||||
|
||||
static bool HandleGMTicketAssignToCommand(ChatHandler* handler, char const* args)
|
||||
{
|
||||
if (!*args)
|
||||
return false;
|
||||
|
||||
char* ticketIdStr = strtok((char*)args, " ");
|
||||
uint32 ticketId = atoi(ticketIdStr);
|
||||
|
||||
char* targetStr = strtok(NULL, " ");
|
||||
if (!targetStr)
|
||||
return false;
|
||||
|
||||
std::string target(targetStr);
|
||||
if (!normalizePlayerName(target))
|
||||
return false;
|
||||
|
||||
GmTicket* ticket = sTicketMgr->GetTicket(ticketId);
|
||||
if (!ticket || ticket->IsClosed())
|
||||
{
|
||||
handler->SendSysMessage(LANG_COMMAND_TICKETNOTEXIST);
|
||||
return true;
|
||||
}
|
||||
|
||||
// Get target information
|
||||
uint64 targetGuid = sObjectMgr->GetPlayerGUIDByName(target.c_str());
|
||||
uint64 targetAccountId = sObjectMgr->GetPlayerAccountIdByGUID(targetGuid);
|
||||
uint32 targetGmLevel = AccountMgr::GetSecurity(targetAccountId, realmID);
|
||||
|
||||
// Target must exist and have administrative rights
|
||||
if (!targetGuid || AccountMgr::IsPlayerAccount(targetGmLevel))
|
||||
{
|
||||
handler->SendSysMessage(LANG_COMMAND_TICKETASSIGNERROR_A);
|
||||
return true;
|
||||
}
|
||||
|
||||
// If already assigned, leave
|
||||
if (ticket->IsAssignedTo(targetGuid))
|
||||
{
|
||||
handler->PSendSysMessage(LANG_COMMAND_TICKETASSIGNERROR_B, ticket->GetId());
|
||||
return true;
|
||||
}
|
||||
|
||||
// If assigned to different player other than current, leave
|
||||
//! Console can override though
|
||||
Player* player = handler->GetSession() ? handler->GetSession()->GetPlayer() : NULL;
|
||||
if (player && ticket->IsAssignedNotTo(player->GetGUID()))
|
||||
{
|
||||
handler->PSendSysMessage(LANG_COMMAND_TICKETALREADYASSIGNED, ticket->GetId(), target.c_str());
|
||||
return true;
|
||||
}
|
||||
|
||||
// Assign ticket
|
||||
SQLTransaction trans = SQLTransaction(NULL);
|
||||
ticket->SetAssignedTo(targetGuid, AccountMgr::IsAdminAccount(targetGmLevel));
|
||||
ticket->SaveToDB(trans);
|
||||
sTicketMgr->UpdateLastChange();
|
||||
|
||||
std::string msg = ticket->FormatMessageString(*handler, NULL, target.c_str(), NULL, NULL);
|
||||
handler->SendGlobalGMSysMessage(msg.c_str());
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool HandleGMTicketCloseByIdCommand(ChatHandler* handler, char const* args)
|
||||
{
|
||||
if (!*args)
|
||||
return false;
|
||||
|
||||
uint32 ticketId = atoi(args);
|
||||
GmTicket* ticket = sTicketMgr->GetTicket(ticketId);
|
||||
if (!ticket || ticket->IsClosed() || ticket->IsCompleted())
|
||||
{
|
||||
handler->SendSysMessage(LANG_COMMAND_TICKETNOTEXIST);
|
||||
return true;
|
||||
}
|
||||
|
||||
// Ticket should be assigned to the player who tries to close it.
|
||||
// Console can override though
|
||||
Player* player = handler->GetSession() ? handler->GetSession()->GetPlayer() : NULL;
|
||||
if (player && ticket->IsAssignedNotTo(player->GetGUID()))
|
||||
{
|
||||
handler->PSendSysMessage(LANG_COMMAND_TICKETCANNOTCLOSE, ticket->GetId());
|
||||
return true;
|
||||
}
|
||||
|
||||
sTicketMgr->CloseTicket(ticket->GetId(), player ? player->GetGUID() : -1);
|
||||
sTicketMgr->UpdateLastChange();
|
||||
|
||||
std::string msg = ticket->FormatMessageString(*handler, player ? player->GetName() : "Console", NULL, NULL, NULL);
|
||||
handler->SendGlobalGMSysMessage(msg.c_str());
|
||||
|
||||
// Inform player, who submitted this ticket, that it is closed
|
||||
if (Player* submitter = ticket->GetPlayer())
|
||||
{
|
||||
if (submitter->IsInWorld())
|
||||
{
|
||||
WorldPacket data(SMSG_GMTICKET_DELETETICKET, 4);
|
||||
data << uint32(GMTICKET_RESPONSE_TICKET_DELETED);
|
||||
submitter->GetSession()->SendPacket(&data);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool HandleGMTicketCommentCommand(ChatHandler* handler, char const* args)
|
||||
{
|
||||
if (!*args)
|
||||
return false;
|
||||
|
||||
char* ticketIdStr = strtok((char*)args, " ");
|
||||
uint32 ticketId = atoi(ticketIdStr);
|
||||
|
||||
char* comment = strtok(NULL, "\n");
|
||||
if (!comment)
|
||||
return false;
|
||||
|
||||
GmTicket* ticket = sTicketMgr->GetTicket(ticketId);
|
||||
if (!ticket || ticket->IsClosed())
|
||||
{
|
||||
handler->PSendSysMessage(LANG_COMMAND_TICKETNOTEXIST);
|
||||
return true;
|
||||
}
|
||||
|
||||
// Cannot comment ticket assigned to someone else
|
||||
//! Console excluded
|
||||
Player* player = handler->GetSession() ? handler->GetSession()->GetPlayer() : NULL;
|
||||
if (player && ticket->IsAssignedNotTo(player->GetGUID()))
|
||||
{
|
||||
handler->PSendSysMessage(LANG_COMMAND_TICKETALREADYASSIGNED, ticket->GetId());
|
||||
return true;
|
||||
}
|
||||
|
||||
SQLTransaction trans = SQLTransaction(NULL);
|
||||
ticket->SetComment(comment);
|
||||
ticket->SaveToDB(trans);
|
||||
sTicketMgr->UpdateLastChange();
|
||||
|
||||
std::string msg = ticket->FormatMessageString(*handler, NULL, ticket->GetAssignedToName().c_str(), NULL, NULL);
|
||||
msg += handler->PGetParseString(LANG_COMMAND_TICKETLISTADDCOMMENT, player ? player->GetName() : "Console", comment);
|
||||
handler->SendGlobalGMSysMessage(msg.c_str());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool HandleGMTicketListClosedCommand(ChatHandler* handler, char const* /*args*/)
|
||||
{
|
||||
sTicketMgr->ShowClosedList(*handler);
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool HandleGMTicketCompleteCommand(ChatHandler* handler, char const* args)
|
||||
{
|
||||
if (!*args)
|
||||
return false;
|
||||
|
||||
uint32 ticketId = atoi(args);
|
||||
GmTicket* ticket = sTicketMgr->GetTicket(ticketId);
|
||||
if (!ticket || ticket->IsClosed() || ticket->IsCompleted())
|
||||
{
|
||||
handler->SendSysMessage(LANG_COMMAND_TICKETNOTEXIST);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (Player* player = ticket->GetPlayer())
|
||||
if (player->IsInWorld())
|
||||
ticket->SendResponse(player->GetSession());
|
||||
|
||||
sTicketMgr->UpdateLastChange();
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool HandleGMTicketDeleteByIdCommand(ChatHandler* handler, char const* args)
|
||||
{
|
||||
if (!*args)
|
||||
return false;
|
||||
|
||||
uint32 ticketId = atoi(args);
|
||||
GmTicket* ticket = sTicketMgr->GetTicket(ticketId);
|
||||
if (!ticket)
|
||||
{
|
||||
handler->SendSysMessage(LANG_COMMAND_TICKETNOTEXIST);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!ticket->IsClosed())
|
||||
{
|
||||
handler->SendSysMessage(LANG_COMMAND_TICKETCLOSEFIRST);
|
||||
return true;
|
||||
}
|
||||
|
||||
std::string msg = ticket->FormatMessageString(*handler, NULL, NULL, NULL, handler->GetSession() ? handler->GetSession()->GetPlayer()->GetName() : "Console");
|
||||
handler->SendGlobalGMSysMessage(msg.c_str());
|
||||
|
||||
sTicketMgr->RemoveTicket(ticket->GetId());
|
||||
sTicketMgr->UpdateLastChange();
|
||||
|
||||
if (Player* player = ticket->GetPlayer())
|
||||
{
|
||||
if (player->IsInWorld())
|
||||
{
|
||||
// Force abandon ticket
|
||||
WorldPacket data(SMSG_GMTICKET_DELETETICKET, 4);
|
||||
data << uint32(GMTICKET_RESPONSE_TICKET_DELETED);
|
||||
player->GetSession()->SendPacket(&data);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool HandleGMTicketEscalateCommand(ChatHandler* handler, char const* args)
|
||||
{
|
||||
if (!*args)
|
||||
return false;
|
||||
|
||||
uint32 ticketId = atoi(args);
|
||||
GmTicket* ticket = sTicketMgr->GetTicket(ticketId);
|
||||
if (!ticket || ticket->IsClosed() || ticket->IsCompleted() || ticket->GetEscalatedStatus() != TICKET_UNASSIGNED)
|
||||
{
|
||||
handler->SendSysMessage(LANG_COMMAND_TICKETNOTEXIST);
|
||||
return true;
|
||||
}
|
||||
|
||||
ticket->SetEscalatedStatus(TICKET_IN_ESCALATION_QUEUE);
|
||||
|
||||
if (Player* player = ticket->GetPlayer())
|
||||
if (player->IsInWorld())
|
||||
sTicketMgr->SendTicket(player->GetSession(), ticket);
|
||||
|
||||
sTicketMgr->UpdateLastChange();
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool HandleGMTicketListEscalatedCommand(ChatHandler* handler, char const* /*args*/)
|
||||
{
|
||||
sTicketMgr->ShowEscalatedList(*handler);
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool HandleGMTicketListCommand(ChatHandler* handler, char const* /*args*/)
|
||||
{
|
||||
sTicketMgr->ShowList(*handler, false);
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool HandleGMTicketListOnlineCommand(ChatHandler* handler, char const* /*args*/)
|
||||
{
|
||||
sTicketMgr->ShowList(*handler, true);
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool HandleGMTicketResetCommand(ChatHandler* handler, char const* /*args*/)
|
||||
{
|
||||
if (sTicketMgr->GetOpenTicketCount())
|
||||
{
|
||||
handler->SendSysMessage(LANG_COMMAND_TICKETPENDING);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
sTicketMgr->ResetTickets();
|
||||
handler->SendSysMessage(LANG_COMMAND_TICKETRESET);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool HandleToggleGMTicketSystem(ChatHandler* handler, char const* /*args*/)
|
||||
{
|
||||
bool status = !sTicketMgr->GetStatus();
|
||||
sTicketMgr->SetStatus(status);
|
||||
handler->PSendSysMessage(status ? LANG_ALLOW_TICKETS : LANG_DISALLOW_TICKETS);
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool HandleGMTicketUnAssignCommand(ChatHandler* handler, char const* args)
|
||||
{
|
||||
if (!*args)
|
||||
return false;
|
||||
|
||||
uint32 ticketId = atoi(args);
|
||||
GmTicket* ticket = sTicketMgr->GetTicket(ticketId);
|
||||
if (!ticket || ticket->IsClosed())
|
||||
{
|
||||
handler->SendSysMessage(LANG_COMMAND_TICKETNOTEXIST);
|
||||
return true;
|
||||
}
|
||||
// Ticket must be assigned
|
||||
if (!ticket->IsAssigned())
|
||||
{
|
||||
handler->PSendSysMessage(LANG_COMMAND_TICKETNOTASSIGNED, ticket->GetId());
|
||||
return true;
|
||||
}
|
||||
|
||||
// Get security level of player, whom this ticket is assigned to
|
||||
uint32 security = SEC_PLAYER;
|
||||
Player* assignedPlayer = ticket->GetAssignedPlayer();
|
||||
if (assignedPlayer && assignedPlayer->IsInWorld())
|
||||
security = assignedPlayer->GetSession()->GetSecurity();
|
||||
else
|
||||
{
|
||||
uint64 guid = ticket->GetAssignedToGUID();
|
||||
uint32 accountId = sObjectMgr->GetPlayerAccountIdByGUID(guid);
|
||||
security = AccountMgr::GetSecurity(accountId, realmID);
|
||||
}
|
||||
|
||||
// Check security
|
||||
//! If no m_session present it means we're issuing this command from the console
|
||||
uint32 mySecurity = handler->GetSession() ? handler->GetSession()->GetSecurity() : SEC_CONSOLE;
|
||||
if (security > mySecurity)
|
||||
{
|
||||
handler->SendSysMessage(LANG_COMMAND_TICKETUNASSIGNSECURITY);
|
||||
return true;
|
||||
}
|
||||
|
||||
SQLTransaction trans = SQLTransaction(NULL);
|
||||
ticket->SetUnassigned();
|
||||
ticket->SaveToDB(trans);
|
||||
sTicketMgr->UpdateLastChange();
|
||||
|
||||
std::string msg = ticket->FormatMessageString(*handler, NULL, ticket->GetAssignedToName().c_str(),
|
||||
handler->GetSession() ? handler->GetSession()->GetPlayer()->GetName() : "Console", NULL);
|
||||
handler->SendGlobalGMSysMessage(msg.c_str());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool HandleGMTicketGetByIdCommand(ChatHandler* handler, char const* args)
|
||||
{
|
||||
if (!*args)
|
||||
return false;
|
||||
|
||||
uint32 ticketId = atoi(args);
|
||||
GmTicket* ticket = sTicketMgr->GetTicket(ticketId);
|
||||
if (!ticket || ticket->IsClosed() || ticket->IsCompleted())
|
||||
{
|
||||
handler->SendSysMessage(LANG_COMMAND_TICKETNOTEXIST);
|
||||
return true;
|
||||
}
|
||||
|
||||
SQLTransaction trans = SQLTransaction(NULL);
|
||||
ticket->SetViewed();
|
||||
ticket->SaveToDB(trans);
|
||||
|
||||
handler->SendSysMessage(ticket->FormatMessageString(*handler, true).c_str());
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool HandleGMTicketGetByNameCommand(ChatHandler* handler, char const* args)
|
||||
{
|
||||
if (!*args)
|
||||
return false;
|
||||
|
||||
std::string name(args);
|
||||
if (!normalizePlayerName(name))
|
||||
return false;
|
||||
|
||||
// Detect target's GUID
|
||||
uint64 guid = 0;
|
||||
if (Player* player = sObjectAccessor->FindPlayerByName(name.c_str()))
|
||||
guid = player->GetGUID();
|
||||
else
|
||||
guid = sObjectMgr->GetPlayerGUIDByName(name);
|
||||
|
||||
// Target must exist
|
||||
if (!guid)
|
||||
{
|
||||
handler->SendSysMessage(LANG_NO_PLAYERS_FOUND);
|
||||
return true;
|
||||
}
|
||||
|
||||
// Ticket must exist
|
||||
GmTicket* ticket = sTicketMgr->GetTicketByPlayer(guid);
|
||||
if (!ticket)
|
||||
{
|
||||
handler->SendSysMessage(LANG_COMMAND_TICKETNOTEXIST);
|
||||
return true;
|
||||
}
|
||||
|
||||
SQLTransaction trans = SQLTransaction(NULL);
|
||||
ticket->SetViewed();
|
||||
ticket->SaveToDB(trans);
|
||||
|
||||
handler->SendSysMessage(ticket->FormatMessageString(*handler, true).c_str());
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool _HandleGMTicketResponseAppendCommand(char const* args, bool newLine, ChatHandler* handler)
|
||||
{
|
||||
if (!*args)
|
||||
return false;
|
||||
|
||||
char* ticketIdStr = strtok((char*)args, " ");
|
||||
uint32 ticketId = atoi(ticketIdStr);
|
||||
|
||||
char* response = strtok(NULL, "\n");
|
||||
if (!response)
|
||||
return false;
|
||||
|
||||
GmTicket* ticket = sTicketMgr->GetTicket(ticketId);
|
||||
if (!ticket || ticket->IsClosed())
|
||||
{
|
||||
handler->PSendSysMessage(LANG_COMMAND_TICKETNOTEXIST);
|
||||
return true;
|
||||
}
|
||||
|
||||
// Cannot add response to ticket, assigned to someone else
|
||||
//! Console excluded
|
||||
Player* player = handler->GetSession() ? handler->GetSession()->GetPlayer() : NULL;
|
||||
if (player && ticket->IsAssignedNotTo(player->GetGUID()))
|
||||
{
|
||||
handler->PSendSysMessage(LANG_COMMAND_TICKETALREADYASSIGNED, ticket->GetId());
|
||||
return true;
|
||||
}
|
||||
|
||||
SQLTransaction trans = SQLTransaction(NULL);
|
||||
ticket->AppendResponse(response);
|
||||
if (newLine)
|
||||
ticket->AppendResponse("\n");
|
||||
ticket->SaveToDB(trans);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool HandleGMTicketResponseAppendCommand(ChatHandler* handler, char const* args)
|
||||
{
|
||||
return _HandleGMTicketResponseAppendCommand(args, false, handler);
|
||||
}
|
||||
|
||||
static bool HandleGMTicketResponseAppendLnCommand(ChatHandler* handler, char const* args)
|
||||
{
|
||||
return _HandleGMTicketResponseAppendCommand(args, true, handler);
|
||||
}
|
||||
};
|
||||
|
||||
void AddSC_ticket_commandscript()
|
||||
{
|
||||
new ticket_commandscript();
|
||||
}
|
||||
@@ -949,7 +949,7 @@ public:
|
||||
if (target)
|
||||
{
|
||||
wpCreature->SetDisplayId(target->GetDisplayId());
|
||||
wpCreature->SetFloatValue(OBJECT_FIELD_SCALE_X, 0.5f);
|
||||
wpCreature->SetObjectScale(0.5f);
|
||||
wpCreature->SetLevel(point > STRONG_MAX_LEVEL ? STRONG_MAX_LEVEL : point);
|
||||
}
|
||||
}
|
||||
@@ -1003,7 +1003,7 @@ public:
|
||||
if (target)
|
||||
{
|
||||
creature->SetDisplayId(target->GetDisplayId());
|
||||
creature->SetFloatValue(OBJECT_FIELD_SCALE_X, 0.5f);
|
||||
creature->SetObjectScale(0.5f);
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -1052,7 +1052,7 @@ public:
|
||||
if (target)
|
||||
{
|
||||
creature->SetDisplayId(target->GetDisplayId());
|
||||
creature->SetFloatValue(OBJECT_FIELD_SCALE_X, 0.5f);
|
||||
creature->SetObjectScale(0.5f);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -15,7 +15,8 @@
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "ScriptPCH.h"
|
||||
#include "ScriptMgr.h"
|
||||
#include "ScriptedCreature.h"
|
||||
|
||||
enum Spells
|
||||
{
|
||||
|
||||
@@ -15,7 +15,8 @@
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "ScriptPCH.h"
|
||||
#include "ScriptMgr.h"
|
||||
#include "ScriptedCreature.h"
|
||||
|
||||
enum Spells
|
||||
{
|
||||
|
||||
@@ -15,7 +15,8 @@
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "ScriptPCH.h"
|
||||
#include "ScriptMgr.h"
|
||||
#include "ScriptedCreature.h"
|
||||
|
||||
enum Spells
|
||||
{
|
||||
|
||||
@@ -15,7 +15,8 @@
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "ScriptPCH.h"
|
||||
#include "ScriptMgr.h"
|
||||
#include "ScriptedCreature.h"
|
||||
|
||||
enum Spells
|
||||
{
|
||||
|
||||
@@ -15,7 +15,8 @@
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "ScriptPCH.h"
|
||||
#include "ScriptMgr.h"
|
||||
#include "ScriptedCreature.h"
|
||||
|
||||
enum Yells
|
||||
{
|
||||
|
||||
@@ -15,8 +15,10 @@
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "ScriptPCH.h"
|
||||
#include "ScriptMgr.h"
|
||||
#include "ScriptedCreature.h"
|
||||
#include "ScriptedEscortAI.h"
|
||||
#include "ScriptedGossip.h"
|
||||
#include "blackrock_depths.h"
|
||||
|
||||
//go_shadowforge_brazier
|
||||
@@ -207,7 +209,7 @@ public:
|
||||
{
|
||||
instance->UpdateEncounterState(ENCOUNTER_CREDIT_KILL_CREATURE, NPC_GRIMSTONE, me);
|
||||
instance->SetData(TYPE_RING_OF_LAW, DONE);
|
||||
sLog->outDebug(LOG_FILTER_TSCR, "TSCR: npc_grimstone: event reached end and set complete.");
|
||||
sLog->outDebug(LOG_FILTER_TSCR, "npc_grimstone: event reached end and set complete.");
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -16,7 +16,8 @@
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "ScriptPCH.h"
|
||||
#include "ScriptMgr.h"
|
||||
#include "ScriptedCreature.h"
|
||||
|
||||
enum Spells
|
||||
{
|
||||
|
||||
@@ -16,7 +16,8 @@
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "ScriptPCH.h"
|
||||
#include "ScriptMgr.h"
|
||||
#include "ScriptedCreature.h"
|
||||
|
||||
enum Spells
|
||||
{
|
||||
|
||||
+2
-1
@@ -16,7 +16,8 @@
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "ScriptPCH.h"
|
||||
#include "ScriptMgr.h"
|
||||
#include "ScriptedCreature.h"
|
||||
#include "blackrock_depths.h"
|
||||
|
||||
enum Yells
|
||||
|
||||
@@ -16,7 +16,8 @@
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "ScriptPCH.h"
|
||||
#include "ScriptMgr.h"
|
||||
#include "ScriptedCreature.h"
|
||||
|
||||
enum Spells
|
||||
{
|
||||
|
||||
@@ -16,7 +16,8 @@
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "ScriptPCH.h"
|
||||
#include "ScriptMgr.h"
|
||||
#include "ScriptedCreature.h"
|
||||
|
||||
enum Spells
|
||||
{
|
||||
|
||||
@@ -16,7 +16,8 @@
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "ScriptPCH.h"
|
||||
#include "ScriptMgr.h"
|
||||
#include "ScriptedCreature.h"
|
||||
|
||||
enum Spells
|
||||
{
|
||||
|
||||
+2
-1
@@ -16,7 +16,8 @@
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "ScriptPCH.h"
|
||||
#include "ScriptMgr.h"
|
||||
#include "ScriptedCreature.h"
|
||||
|
||||
enum Spells
|
||||
{
|
||||
|
||||
@@ -16,7 +16,8 @@
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "ScriptPCH.h"
|
||||
#include "ScriptMgr.h"
|
||||
#include "ScriptedCreature.h"
|
||||
|
||||
enum Spells
|
||||
{
|
||||
|
||||
@@ -16,7 +16,8 @@
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "ScriptPCH.h"
|
||||
#include "ScriptMgr.h"
|
||||
#include "ScriptedCreature.h"
|
||||
|
||||
enum Spells
|
||||
{
|
||||
|
||||
@@ -16,7 +16,9 @@
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "ScriptPCH.h"
|
||||
#include "ScriptMgr.h"
|
||||
#include "ScriptedCreature.h"
|
||||
#include "ScriptedGossip.h"
|
||||
#include "blackrock_depths.h"
|
||||
|
||||
enum Spells
|
||||
|
||||
@@ -16,7 +16,9 @@
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "ScriptPCH.h"
|
||||
#include "ScriptMgr.h"
|
||||
#include "ScriptedCreature.h"
|
||||
#include "InstanceScript.h"
|
||||
#include "blackrock_depths.h"
|
||||
|
||||
#define TIMER_TOMBOFTHESEVEN 15000
|
||||
@@ -210,7 +212,7 @@ public:
|
||||
|
||||
void SetData64(uint32 type, uint64 data)
|
||||
{
|
||||
sLog->outDebug(LOG_FILTER_TSCR, "TSCR: Instance Blackrock Depths: SetData64 update (Type: %u Data " UI64FMTD ")", type, data);
|
||||
sLog->outDebug(LOG_FILTER_TSCR, "Instance Blackrock Depths: SetData64 update (Type: %u Data " UI64FMTD ")", type, data);
|
||||
|
||||
switch (type)
|
||||
{
|
||||
@@ -226,7 +228,7 @@ public:
|
||||
|
||||
void SetData(uint32 type, uint32 data)
|
||||
{
|
||||
sLog->outDebug(LOG_FILTER_TSCR, "TSCR: Instance Blackrock Depths: SetData update (Type: %u Data %u)", type, data);
|
||||
sLog->outDebug(LOG_FILTER_TSCR, "Instance Blackrock Depths: SetData update (Type: %u Data %u)", type, data);
|
||||
|
||||
switch (type)
|
||||
{
|
||||
|
||||
@@ -33,7 +33,8 @@ enum Data
|
||||
DATA_WARCHIEF_REND_BLACKHAND,
|
||||
DATA_GYTH,
|
||||
DATA_THE_BEAST,
|
||||
DATA_GENERAL_DRAKKISATH
|
||||
DATA_GENERAL_DRAKKISATH,
|
||||
DATA_DRAGONSPIRE_ROOM,
|
||||
};
|
||||
enum Npc
|
||||
{
|
||||
@@ -51,17 +52,51 @@ enum Npc
|
||||
NPC_GYTH = 10339,
|
||||
NPC_THE_BEAST = 10430,
|
||||
NPC_GENERAL_DRAKKISATH = 10363,
|
||||
NPC_BLACKHAND_DREADWEAVER = 9817,
|
||||
NPC_BLACKHAND_SUMMONER = 9818,
|
||||
NPC_BLACKHAND_VETERAN = 9819,
|
||||
};
|
||||
|
||||
enum AdditionalData
|
||||
{
|
||||
SPELL_SUMMON_ROOKERY_WHELP = 15745,
|
||||
MAX_ENCOUNTER = 14,
|
||||
MAX_DRAGONSPIRE_HALL_RUNES = 7,
|
||||
EVENT_PYROGUARD_EMBERSEER = 4884,
|
||||
AREATRIGGER_ENTER_UBRS = 2046,
|
||||
AREATRIGGER_STADIUM = 2026,
|
||||
};
|
||||
|
||||
enum GameObjects
|
||||
{
|
||||
GO_WHELP_SPAWNER = 175622, //trap spawned by go id 175124
|
||||
GO_WHELP_SPAWNER = 175622, // trap spawned by go id 175124
|
||||
|
||||
// Doors
|
||||
GO_EMBERSEER_IN = 175244, // First door to Pyroguard Emberseer
|
||||
GO_DOORS = 175705, // Second door to Pyroguard Emberseer
|
||||
GO_EMBERSEER_OUT = 175153, // Door after Pyroguard Emberseer event
|
||||
GO_GYTH_ENTRY_DOOR = 164726,
|
||||
GO_GYTH_COMBAT_DOOR = 175185,
|
||||
GO_GYTH_EXIT_DOOR = 175186,
|
||||
GO_DRAKKISATH_DOOR_1 = 175946,
|
||||
GO_DRAKKISATH_DOOR_2 = 175947,
|
||||
|
||||
// Runes
|
||||
GO_ROOM_1_RUNE = 175197,
|
||||
GO_ROOM_2_RUNE = 175199,
|
||||
GO_ROOM_3_RUNE = 175195,
|
||||
GO_ROOM_4_RUNE = 175200,
|
||||
GO_ROOM_5_RUNE = 175198,
|
||||
GO_ROOM_6_RUNE = 175196,
|
||||
GO_ROOM_7_RUNE = 175194,
|
||||
|
||||
GO_EMBERSEER_RUNE_1 = 175266,
|
||||
GO_EMBERSEER_RUNE_2 = 175267,
|
||||
GO_EMBERSEER_RUNE_3 = 175268,
|
||||
GO_EMBERSEER_RUNE_4 = 175269,
|
||||
GO_EMBERSEER_RUNE_5 = 175270,
|
||||
GO_EMBERSEER_RUNE_6 = 175271,
|
||||
GO_EMBERSEER_RUNE_7 = 175272,
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -20,11 +20,24 @@
|
||||
#include "ScriptedCreature.h"
|
||||
#include "blackrock_spire.h"
|
||||
|
||||
enum Text
|
||||
{
|
||||
EMOTE_ONE_STACK = 0,
|
||||
EMOTE_TEN_STACK = 1,
|
||||
EMOTE_FREE_OF_BONDS = 2,
|
||||
YELL_FREE_OF_BONDS = 3,
|
||||
};
|
||||
|
||||
enum Spells
|
||||
{
|
||||
SPELL_FIRENOVA = 23462,
|
||||
SPELL_FLAMEBUFFET = 23341,
|
||||
SPELL_PYROBLAST = 17274,
|
||||
SPELL_ENCAGED_EMBERSEER = 15282, // Self on spawn
|
||||
SPELL_FIRE_SHIELD_TRIGGER = 13377, // Self on spawn missing from 335 dbc
|
||||
SPELL_FREEZE_ANIM = 16245, // Self on event start
|
||||
SPELL_EMBERSEER_GROWING = 16048, // Self on event start
|
||||
SPELL_EMBERSEER_FULL_STRENGTH = 16047, // Emberseer Full Strength
|
||||
SPELL_FIRENOVA = 23462, // Combat
|
||||
SPELL_FLAMEBUFFET = 23341, // Combat
|
||||
SPELL_PYROBLAST = 17274, // Combat
|
||||
};
|
||||
|
||||
enum Events
|
||||
@@ -51,6 +64,12 @@ public:
|
||||
|
||||
void Reset()
|
||||
{
|
||||
if (instance->GetBossState(DATA_PYROGAURD_EMBERSEER) == IN_PROGRESS)
|
||||
OpenDoors(false);
|
||||
instance->SetBossState(DATA_PYROGAURD_EMBERSEER,NOT_STARTED);
|
||||
// respawn any dead Blackhand Incarcerators
|
||||
DoCast(me, SPELL_ENCAGED_EMBERSEER);
|
||||
//DoCast(me, SPELL_FIRE_SHIELD_TRIGGER);
|
||||
_Reset();
|
||||
}
|
||||
|
||||
@@ -64,12 +83,26 @@ public:
|
||||
|
||||
void JustDied(Unit* /*killer*/)
|
||||
{
|
||||
instance->SetBossState(DATA_PYROGAURD_EMBERSEER,DONE);
|
||||
OpenDoors(true);
|
||||
_JustDied();
|
||||
}
|
||||
|
||||
void OpenDoors(bool Boss_Killed)
|
||||
{
|
||||
if (GameObject* door1 = me->GetMap()->GetGameObject(instance->GetData64(GO_EMBERSEER_IN)))
|
||||
door1->SetGoState(GO_STATE_ACTIVE);
|
||||
if (GameObject* door2 = me->GetMap()->GetGameObject(instance->GetData64(GO_DOORS)))
|
||||
door2->SetGoState(GO_STATE_ACTIVE);
|
||||
if (Boss_Killed)
|
||||
if (GameObject* door3 = me->GetMap()->GetGameObject(instance->GetData64(GO_EMBERSEER_OUT)))
|
||||
door3->SetGoState(GO_STATE_ACTIVE);
|
||||
}
|
||||
|
||||
void UpdateAI(uint32 const diff)
|
||||
{
|
||||
if (!UpdateVictim())
|
||||
|
||||
return;
|
||||
|
||||
events.Update(diff);
|
||||
|
||||
@@ -49,6 +49,12 @@ public:
|
||||
uint64 Gyth;
|
||||
uint64 TheBeast;
|
||||
uint64 GeneralDrakkisath;
|
||||
uint64 go_emberseerin;
|
||||
uint64 go_doors;
|
||||
uint64 go_emberseerout;
|
||||
uint64 go_roomrunes[MAX_DRAGONSPIRE_HALL_RUNES];
|
||||
uint8 Runemaxprotectors[MAX_DRAGONSPIRE_HALL_RUNES];
|
||||
uint8 Runeprotectorsdead[MAX_DRAGONSPIRE_HALL_RUNES];
|
||||
|
||||
void Initialize()
|
||||
{
|
||||
@@ -67,6 +73,9 @@ public:
|
||||
Gyth = 0;
|
||||
TheBeast = 0;
|
||||
GeneralDrakkisath = 0;
|
||||
go_emberseerin = 0;
|
||||
go_doors = 0;
|
||||
go_emberseerout = 0;
|
||||
}
|
||||
|
||||
bool IsEncounterInProgress() const
|
||||
@@ -125,7 +134,11 @@ public:
|
||||
case NPC_GENERAL_DRAKKISATH:
|
||||
GeneralDrakkisath = creature->GetGUID();
|
||||
break;
|
||||
}
|
||||
case NPC_BLACKHAND_DREADWEAVER:
|
||||
case NPC_BLACKHAND_SUMMONER:
|
||||
case NPC_BLACKHAND_VETERAN:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void OnGameObjectCreate(GameObject* go)
|
||||
@@ -135,6 +148,36 @@ public:
|
||||
case GO_WHELP_SPAWNER:
|
||||
go->CastSpell(NULL, SPELL_SUMMON_ROOKERY_WHELP);
|
||||
break;
|
||||
case GO_EMBERSEER_IN:
|
||||
go_emberseerin = go->GetGUID();
|
||||
break;
|
||||
case GO_DOORS:
|
||||
go_doors = go->GetGUID();
|
||||
break;
|
||||
case GO_EMBERSEER_OUT:
|
||||
go_emberseerout = go->GetGUID();
|
||||
break;
|
||||
case GO_ROOM_1_RUNE:
|
||||
go_roomrunes[0] = go->GetGUID();
|
||||
break;
|
||||
case GO_ROOM_2_RUNE:
|
||||
go_roomrunes[1] = go->GetGUID();
|
||||
break;
|
||||
case GO_ROOM_3_RUNE:
|
||||
go_roomrunes[2] = go->GetGUID();
|
||||
break;
|
||||
case GO_ROOM_4_RUNE:
|
||||
go_roomrunes[3] = go->GetGUID();
|
||||
break;
|
||||
case GO_ROOM_5_RUNE:
|
||||
go_roomrunes[4] = go->GetGUID();
|
||||
break;
|
||||
case GO_ROOM_6_RUNE:
|
||||
go_roomrunes[5] = go->GetGUID();
|
||||
break;
|
||||
case GO_ROOM_7_RUNE:
|
||||
go_roomrunes[6] = go->GetGUID();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -167,6 +210,18 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
void ProcessEvent(WorldObject* /*gameObject*/, uint32 eventId)
|
||||
{
|
||||
switch (eventId)
|
||||
{
|
||||
case EVENT_PYROGUARD_EMBERSEER:
|
||||
SetBossState(DATA_PYROGAURD_EMBERSEER,IN_PROGRESS);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
uint64 GetData64(uint32 type)
|
||||
{
|
||||
switch (type)
|
||||
@@ -199,6 +254,26 @@ public:
|
||||
return TheBeast;
|
||||
case DATA_GENERAL_DRAKKISATH:
|
||||
return GeneralDrakkisath;
|
||||
case GO_EMBERSEER_IN:
|
||||
return go_emberseerin;
|
||||
case GO_DOORS:
|
||||
return go_doors;
|
||||
case GO_EMBERSEER_OUT:
|
||||
return go_emberseerout;
|
||||
case GO_ROOM_1_RUNE:
|
||||
return go_roomrunes[0];
|
||||
case GO_ROOM_2_RUNE:
|
||||
return go_roomrunes[1];
|
||||
case GO_ROOM_3_RUNE:
|
||||
return go_roomrunes[2];
|
||||
case GO_ROOM_4_RUNE:
|
||||
return go_roomrunes[3];
|
||||
case GO_ROOM_5_RUNE:
|
||||
return go_roomrunes[4];
|
||||
case GO_ROOM_6_RUNE:
|
||||
return go_roomrunes[5];
|
||||
case GO_ROOM_7_RUNE:
|
||||
return go_roomrunes[6];
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -23,7 +23,9 @@ SDComment:
|
||||
SDCategory: Blackwing Lair
|
||||
EndScriptData */
|
||||
|
||||
#include "ScriptPCH.h"
|
||||
#include "ScriptMgr.h"
|
||||
#include "ScriptedCreature.h"
|
||||
|
||||
enum Say
|
||||
{
|
||||
SAY_AGGRO = -1469000,
|
||||
|
||||
@@ -23,7 +23,8 @@ SDComment: Chromatic Mutation disabled due to lack of core support
|
||||
SDCategory: Blackwing Lair
|
||||
EndScriptData */
|
||||
|
||||
#include "ScriptPCH.h"
|
||||
#include "ScriptMgr.h"
|
||||
#include "ScriptedCreature.h"
|
||||
|
||||
enum Emotes
|
||||
{
|
||||
|
||||
@@ -23,7 +23,8 @@ SDComment: Shadow of Ebonroc needs core support
|
||||
SDCategory: Blackwing Lair
|
||||
EndScriptData */
|
||||
|
||||
#include "ScriptPCH.h"
|
||||
#include "ScriptMgr.h"
|
||||
#include "ScriptedCreature.h"
|
||||
|
||||
#define SPELL_SHADOWFLAME 22539
|
||||
#define SPELL_WINGBUFFET 18500
|
||||
|
||||
@@ -23,7 +23,8 @@ SDComment:
|
||||
SDCategory: Blackwing Lair
|
||||
EndScriptData */
|
||||
|
||||
#include "ScriptPCH.h"
|
||||
#include "ScriptMgr.h"
|
||||
#include "ScriptedCreature.h"
|
||||
|
||||
#define SPELL_SHADOWFLAME 22539
|
||||
#define SPELL_WINGBUFFET 23339
|
||||
|
||||
@@ -23,7 +23,8 @@ SDComment:
|
||||
SDCategory: Blackwing Lair
|
||||
EndScriptData */
|
||||
|
||||
#include "ScriptPCH.h"
|
||||
#include "ScriptMgr.h"
|
||||
#include "ScriptedCreature.h"
|
||||
|
||||
enum Emotes
|
||||
{
|
||||
|
||||
@@ -23,7 +23,8 @@ SDComment: Some issues with class calls effecting more than one class
|
||||
SDCategory: Blackwing Lair
|
||||
EndScriptData */
|
||||
|
||||
#include "ScriptPCH.h"
|
||||
#include "ScriptMgr.h"
|
||||
#include "ScriptedCreature.h"
|
||||
|
||||
enum Say
|
||||
{
|
||||
|
||||
@@ -23,7 +23,8 @@ SDComment: Needs additional review. Phase 1 NYI (Grethok the Controller)
|
||||
SDCategory: Blackwing Lair
|
||||
EndScriptData */
|
||||
|
||||
#include "ScriptPCH.h"
|
||||
#include "ScriptMgr.h"
|
||||
#include "ScriptedCreature.h"
|
||||
|
||||
//Razorgore Phase 2 Script
|
||||
|
||||
|
||||
@@ -23,7 +23,9 @@ SDComment: Burning Adrenaline not correctly implemented in core
|
||||
SDCategory: Blackwing Lair
|
||||
EndScriptData */
|
||||
|
||||
#include "ScriptPCH.h"
|
||||
#include "ScriptMgr.h"
|
||||
#include "ScriptedCreature.h"
|
||||
#include "ScriptedGossip.h"
|
||||
|
||||
enum Says
|
||||
{
|
||||
|
||||
@@ -23,7 +23,9 @@ SDComment: Missing some text, Vael beginning event, and spawns Nef in wrong plac
|
||||
SDCategory: Blackwing Lair
|
||||
EndScriptData */
|
||||
|
||||
#include "ScriptPCH.h"
|
||||
#include "ScriptMgr.h"
|
||||
#include "ScriptedCreature.h"
|
||||
#include "ScriptedGossip.h"
|
||||
|
||||
enum Says
|
||||
{
|
||||
@@ -362,7 +364,7 @@ public:
|
||||
Nefarian->setFaction(103);
|
||||
NefarianGUID = Nefarian->GetGUID();
|
||||
}
|
||||
else sLog->outError("TSCR: Blackwing Lair: Unable to spawn nefarian properly.");
|
||||
else sLog->outError(LOG_FILTER_TSCR, "Blackwing Lair: Unable to spawn nefarian properly.");
|
||||
}
|
||||
|
||||
AddSpawnTimer = 4000;
|
||||
|
||||
@@ -23,4 +23,5 @@ SDComment:
|
||||
SDCategory: Blackwing Lair
|
||||
EndScriptData */
|
||||
|
||||
#include "ScriptPCH.h"
|
||||
#include "ScriptMgr.h"
|
||||
#include "InstanceScript.h"
|
||||
@@ -21,7 +21,8 @@ SD%Complete:
|
||||
SDComment: Timers and say taken from acid script
|
||||
EndScriptData */
|
||||
|
||||
#include "ScriptPCH.h"
|
||||
#include "ScriptMgr.h"
|
||||
#include "ScriptedCreature.h"
|
||||
#include "deadmines.h"
|
||||
|
||||
enum eSpels
|
||||
|
||||
@@ -23,7 +23,8 @@ SDComment: Placeholder
|
||||
SDCategory: Deadmines
|
||||
EndScriptData */
|
||||
|
||||
#include "ScriptPCH.h"
|
||||
#include "ScriptMgr.h"
|
||||
#include "ScriptedCreature.h"
|
||||
#include "deadmines.h"
|
||||
#include "Spell.h"
|
||||
|
||||
|
||||
@@ -23,7 +23,8 @@ SDComment:
|
||||
SDCategory: Deadmines
|
||||
EndScriptData */
|
||||
|
||||
#include "ScriptPCH.h"
|
||||
#include "ScriptMgr.h"
|
||||
#include "InstanceScript.h"
|
||||
#include "deadmines.h"
|
||||
|
||||
enum Sounds
|
||||
|
||||
@@ -22,7 +22,9 @@ SD%Complete: 90%
|
||||
SDComment: Some visual effects are not implemented.
|
||||
Script Data End */
|
||||
|
||||
#include "ScriptPCH.h"
|
||||
#include "ScriptMgr.h"
|
||||
#include "ScriptedCreature.h"
|
||||
#include "ScriptedGossip.h"
|
||||
#include "gnomeregan.h"
|
||||
#include "ScriptedEscortAI.h"
|
||||
|
||||
|
||||
@@ -15,7 +15,8 @@
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "ScriptPCH.h"
|
||||
#include "ScriptMgr.h"
|
||||
#include "InstanceScript.h"
|
||||
#include "gnomeregan.h"
|
||||
|
||||
#define MAX_ENCOUNTER 1
|
||||
|
||||
@@ -23,7 +23,8 @@ SDComment:
|
||||
SDCategory: Karazhan
|
||||
EndScriptData */
|
||||
|
||||
#include "ScriptPCH.h"
|
||||
#include "ScriptMgr.h"
|
||||
#include "ScriptedCreature.h"
|
||||
|
||||
#define SAY_AGGRO -1532057
|
||||
#define SAY_SUMMON1 -1532058
|
||||
|
||||
@@ -23,7 +23,8 @@ SDComment:
|
||||
SDCategory: Karazhan
|
||||
EndScriptData */
|
||||
|
||||
#include "ScriptPCH.h"
|
||||
#include "ScriptMgr.h"
|
||||
#include "ScriptedCreature.h"
|
||||
|
||||
#define SAY_AGGRO -1532018
|
||||
#define SAY_SLAY1 -1532019
|
||||
|
||||
@@ -23,7 +23,8 @@ SDComment:
|
||||
SDCategory: Karazhan
|
||||
EndScriptData */
|
||||
|
||||
#include "ScriptPCH.h"
|
||||
#include "ScriptMgr.h"
|
||||
#include "ScriptedCreature.h"
|
||||
|
||||
#define SAY_MIDNIGHT_KILL -1532000
|
||||
#define SAY_APPEAR1 -1532001
|
||||
@@ -79,6 +80,12 @@ public:
|
||||
|
||||
void Reset()
|
||||
{
|
||||
ResetTimer = 0;
|
||||
}
|
||||
|
||||
void EnterEvadeMode()
|
||||
{
|
||||
ScriptedAI::EnterEvadeMode();
|
||||
ResetTimer = 2000;
|
||||
}
|
||||
|
||||
@@ -185,7 +192,7 @@ public:
|
||||
pAttumen->GetMotionMaster()->MoveChase(pAttumen->getVictim());
|
||||
pAttumen->SetTarget(pAttumen->getVictim()->GetGUID());
|
||||
}
|
||||
pAttumen->SetFloatValue(OBJECT_FIELD_SCALE_X, 1);
|
||||
pAttumen->SetObjectScale(1);
|
||||
}
|
||||
} else Mount_Timer -= diff;
|
||||
}
|
||||
@@ -244,8 +251,8 @@ void boss_attumen::boss_attumenAI::UpdateAI(const uint32 diff)
|
||||
Midnight = 0;
|
||||
me->SetVisible(false);
|
||||
me->Kill(me);
|
||||
}
|
||||
} else ResetTimer -= diff;
|
||||
} else ResetTimer -= diff;
|
||||
}
|
||||
|
||||
//Return since we have no target
|
||||
if (!UpdateVictim())
|
||||
|
||||
@@ -23,7 +23,8 @@ SDComment:
|
||||
SDCategory: Karazhan
|
||||
EndScriptData */
|
||||
|
||||
#include "ScriptPCH.h"
|
||||
#include "ScriptMgr.h"
|
||||
#include "ScriptedCreature.h"
|
||||
#include "karazhan.h"
|
||||
|
||||
#define SAY_AGGRO -1532011
|
||||
@@ -74,8 +75,8 @@ public:
|
||||
{
|
||||
boss_moroesAI(Creature* creature) : ScriptedAI(creature)
|
||||
{
|
||||
for (uint8 i = 0; i < 4; ++i)
|
||||
AddId[i] = 0;
|
||||
memset(AddId, 0, sizeof(AddId));
|
||||
memset(AddGUID, 0, sizeof(AddGUID));
|
||||
|
||||
instance = creature->GetInstanceScript();
|
||||
}
|
||||
@@ -104,10 +105,8 @@ public:
|
||||
|
||||
Enrage = false;
|
||||
InVanish = false;
|
||||
if (me->GetHealth() > 0)
|
||||
{
|
||||
if (me->GetHealth())
|
||||
SpawnAdds();
|
||||
}
|
||||
|
||||
if (instance)
|
||||
instance->SetData(TYPE_MOROES, NOT_STARTED);
|
||||
@@ -192,10 +191,9 @@ public:
|
||||
bool isAddlistEmpty()
|
||||
{
|
||||
for (uint8 i = 0; i < 4; ++i)
|
||||
{
|
||||
if (AddId[i] == 0)
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -340,17 +338,10 @@ struct boss_moroes_guestAI : public ScriptedAI
|
||||
if (!instance)
|
||||
return;
|
||||
|
||||
uint64 MoroesGUID = instance->GetData64(DATA_MOROES);
|
||||
Creature* Moroes = (Unit::GetCreature((*me), MoroesGUID));
|
||||
if (Moroes)
|
||||
{
|
||||
if (Creature* Moroes = Unit::GetCreature(*me, instance->GetData64(DATA_MOROES)))
|
||||
for (uint8 i = 0; i < 4; ++i)
|
||||
{
|
||||
uint64 GUID = CAST_AI(boss_moroes::boss_moroesAI, Moroes->AI())->AddGUID[i];
|
||||
if (GUID)
|
||||
if (uint64 GUID = CAST_AI(boss_moroes::boss_moroesAI, Moroes->AI())->AddGUID[i])
|
||||
GuestGUID[i] = GUID;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Unit* SelectGuestTarget()
|
||||
|
||||
@@ -23,7 +23,8 @@ SDComment: Not sure about timing and portals placing
|
||||
SDCategory: Karazhan
|
||||
EndScriptData */
|
||||
|
||||
#include "ScriptPCH.h"
|
||||
#include "ScriptMgr.h"
|
||||
#include "ScriptedCreature.h"
|
||||
#include "karazhan.h"
|
||||
|
||||
#define EMOTE_PHASE_PORTAL -1532089
|
||||
|
||||
@@ -23,7 +23,8 @@ SDComment: SDComment: Timers may incorrect
|
||||
SDCategory: Karazhan
|
||||
EndScriptData */
|
||||
|
||||
#include "ScriptPCH.h"
|
||||
#include "ScriptMgr.h"
|
||||
#include "ScriptedCreature.h"
|
||||
#include "karazhan.h"
|
||||
|
||||
//phase 1
|
||||
|
||||
@@ -23,7 +23,8 @@ SDComment:
|
||||
SDCategory: Karazhan
|
||||
EndScriptData */
|
||||
|
||||
#include "ScriptPCH.h"
|
||||
#include "ScriptMgr.h"
|
||||
#include "ScriptedCreature.h"
|
||||
#include "karazhan.h"
|
||||
|
||||
#define SAY_AGGRO -1532091
|
||||
@@ -186,6 +187,7 @@ public:
|
||||
boss_malchezaarAI(Creature* creature) : ScriptedAI(creature)
|
||||
{
|
||||
instance = creature->GetInstanceScript();
|
||||
memset(axes, 0, sizeof(axes));
|
||||
}
|
||||
|
||||
InstanceScript* instance;
|
||||
@@ -217,7 +219,10 @@ public:
|
||||
positions.clear();
|
||||
|
||||
for (uint8 i = 0; i < 5; ++i)
|
||||
{
|
||||
enfeeble_targets[i] = 0;
|
||||
enfeeble_health[i] = 0;
|
||||
}
|
||||
|
||||
for (uint8 i = 0; i < TOTAL_INFERNAL_POINTS; ++i)
|
||||
positions.push_back(&InfernalPoints[i]);
|
||||
|
||||
@@ -23,7 +23,8 @@ SDComment: Flame wreath missing cast animation, mods won't triggere.
|
||||
SDCategory: Karazhan
|
||||
EndScriptData */
|
||||
|
||||
#include "ScriptPCH.h"
|
||||
#include "ScriptMgr.h"
|
||||
#include "ScriptedCreature.h"
|
||||
#include "karazhan.h"
|
||||
#include "GameObject.h"
|
||||
|
||||
|
||||
@@ -23,8 +23,10 @@ SDComment: Complete! Needs adjustments to use spell though.
|
||||
SDCategory: Karazhan
|
||||
EndScriptData */
|
||||
|
||||
#include "ScriptPCH.h"
|
||||
#include "ScriptMgr.h"
|
||||
#include "ScriptedCreature.h"
|
||||
#include "karazhan.h"
|
||||
#include "PassiveAI.h"
|
||||
|
||||
#define SAY_SLAY1 -1532065
|
||||
#define SAY_SLAY2 -1532066
|
||||
|
||||
@@ -23,7 +23,9 @@ SDComment: Oz, Hood, and RAJ event implemented. RAJ event requires more testing.
|
||||
SDCategory: Karazhan
|
||||
EndScriptData */
|
||||
|
||||
#include "ScriptPCH.h"
|
||||
#include "ScriptMgr.h"
|
||||
#include "ScriptedCreature.h"
|
||||
#include "ScriptedGossip.h"
|
||||
#include "karazhan.h"
|
||||
|
||||
/***********************************/
|
||||
@@ -1221,7 +1223,7 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
sLog->outError("TSCR: boss_romuloAI: DamageTaken reach end of code, that should not happen.");
|
||||
sLog->outError(LOG_FILTER_TSCR, "boss_romuloAI: DamageTaken reach end of code, that should not happen.");
|
||||
}
|
||||
|
||||
void EnterCombat(Unit* /*who*/)
|
||||
@@ -1467,7 +1469,7 @@ void boss_julianne::boss_julianneAI::DamageTaken(Unit* /*done_by*/, uint32 &dama
|
||||
|
||||
if (Phase == PHASE_ROMULO)
|
||||
{
|
||||
sLog->outError("TSCR: boss_julianneAI: cannot take damage in PHASE_ROMULO, why was i here?");
|
||||
sLog->outError(LOG_FILTER_TSCR, "boss_julianneAI: cannot take damage in PHASE_ROMULO, why was i here?");
|
||||
damage = 0;
|
||||
return;
|
||||
}
|
||||
@@ -1501,7 +1503,7 @@ void boss_julianne::boss_julianneAI::DamageTaken(Unit* /*done_by*/, uint32 &dama
|
||||
return;
|
||||
}
|
||||
}
|
||||
sLog->outError("TSCR: boss_julianneAI: DamageTaken reach end of code, that should not happen.");
|
||||
sLog->outError(LOG_FILTER_TSCR, "boss_julianneAI: DamageTaken reach end of code, that should not happen.");
|
||||
}
|
||||
|
||||
void AddSC_bosses_opera()
|
||||
|
||||
@@ -23,7 +23,8 @@ SDComment: Instance Script for Karazhan to help in various encounters. TODO: Gam
|
||||
SDCategory: Karazhan
|
||||
EndScriptData */
|
||||
|
||||
#include "ScriptPCH.h"
|
||||
#include "ScriptMgr.h"
|
||||
#include "InstanceScript.h"
|
||||
#include "karazhan.h"
|
||||
|
||||
#define MAX_ENCOUNTER 12
|
||||
|
||||
@@ -29,7 +29,9 @@ npc_berthold
|
||||
npc_image_of_medivh
|
||||
EndContentData */
|
||||
|
||||
#include "ScriptPCH.h"
|
||||
#include "ScriptMgr.h"
|
||||
#include "ScriptedCreature.h"
|
||||
#include "ScriptedGossip.h"
|
||||
#include "karazhan.h"
|
||||
#include "ScriptedEscortAI.h"
|
||||
|
||||
@@ -227,7 +229,7 @@ public:
|
||||
|
||||
void PrepareEncounter()
|
||||
{
|
||||
sLog->outDebug(LOG_FILTER_TSCR, "TSCR: Barnes Opera Event - Introduction complete - preparing encounter %d", m_uiEventId);
|
||||
sLog->outDebug(LOG_FILTER_TSCR, "Barnes Opera Event - Introduction complete - preparing encounter %d", m_uiEventId);
|
||||
uint8 index = 0;
|
||||
uint8 count = 0;
|
||||
|
||||
@@ -342,17 +344,17 @@ public:
|
||||
case GOSSIP_ACTION_INFO_DEF+3:
|
||||
player->CLOSE_GOSSIP_MENU();
|
||||
pBarnesAI->m_uiEventId = EVENT_OZ;
|
||||
sLog->outString("TSCR: player (GUID " UI64FMTD ") manually set Opera event to EVENT_OZ", player->GetGUID());
|
||||
sLog->outInfo(LOG_FILTER_TSCR, "TSCR: player (GUID " UI64FMTD ") manually set Opera event to EVENT_OZ", player->GetGUID());
|
||||
break;
|
||||
case GOSSIP_ACTION_INFO_DEF+4:
|
||||
player->CLOSE_GOSSIP_MENU();
|
||||
pBarnesAI->m_uiEventId = EVENT_HOOD;
|
||||
sLog->outString("TSCR: player (GUID " UI64FMTD ") manually set Opera event to EVENT_HOOD", player->GetGUID());
|
||||
sLog->outInfo(LOG_FILTER_TSCR, "TSCR: player (GUID " UI64FMTD ") manually set Opera event to EVENT_HOOD", player->GetGUID());
|
||||
break;
|
||||
case GOSSIP_ACTION_INFO_DEF+5:
|
||||
player->CLOSE_GOSSIP_MENU();
|
||||
pBarnesAI->m_uiEventId = EVENT_RAJ;
|
||||
sLog->outString("TSCR: player (GUID " UI64FMTD ") manually set Opera event to EVENT_RAJ", player->GetGUID());
|
||||
sLog->outInfo(LOG_FILTER_TSCR, "TSCR: player (GUID " UI64FMTD ") manually set Opera event to EVENT_RAJ", player->GetGUID());
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -62,6 +62,6 @@ enum OperaEvents
|
||||
EVENT_RAJ = 3
|
||||
};
|
||||
|
||||
#define ERROR_INST_DATA(a) sLog->outError("TSCR: Instance Data for Karazhan not set properly. Encounter for Creature Entry %u may not work properly.", a->GetEntry());
|
||||
#define ERROR_INST_DATA(a) sLog->outError(LOG_FILTER_TSCR, "Instance Data for Karazhan not set properly. Encounter for Creature Entry %u may not work properly.", a->GetEntry());
|
||||
#endif
|
||||
|
||||
@@ -23,7 +23,8 @@ SDComment: Normal and Heroic Support. Issues: Arcane Spheres do not initially fo
|
||||
SDCategory: Magisters' Terrace
|
||||
EndScriptData */
|
||||
|
||||
#include "ScriptPCH.h"
|
||||
#include "ScriptMgr.h"
|
||||
#include "ScriptedCreature.h"
|
||||
#include "magisters_terrace.h"
|
||||
#include "WorldPacket.h"
|
||||
|
||||
|
||||
@@ -23,7 +23,8 @@ SDComment: No Heroic support yet. Needs further testing. Several scripts for pet
|
||||
SDCategory: Magister's Terrace
|
||||
EndScriptData */
|
||||
|
||||
#include "ScriptPCH.h"
|
||||
#include "ScriptMgr.h"
|
||||
#include "ScriptedCreature.h"
|
||||
#include "magisters_terrace.h"
|
||||
|
||||
struct Speech
|
||||
|
||||
@@ -23,7 +23,8 @@ SDComment: Heroic and Normal Support. Needs further testing.
|
||||
SDCategory: Magister's Terrace
|
||||
EndScriptData */
|
||||
|
||||
#include "ScriptPCH.h"
|
||||
#include "ScriptMgr.h"
|
||||
#include "ScriptedCreature.h"
|
||||
#include "magisters_terrace.h"
|
||||
|
||||
#define SAY_AGGRO -1585000
|
||||
@@ -75,7 +76,7 @@ public:
|
||||
for (uint8 i = 0; i < size; ++i)
|
||||
{
|
||||
uint64 guid = instance->GetData64(DATA_FEL_CRYSTAL);
|
||||
sLog->outDebug(LOG_FILTER_TSCR, "TSCR: Selin: Adding Fel Crystal " UI64FMTD " to list", guid);
|
||||
sLog->outDebug(LOG_FILTER_TSCR, "Selin: Adding Fel Crystal " UI64FMTD " to list", guid);
|
||||
Crystals.push_back(guid);
|
||||
}
|
||||
}
|
||||
@@ -120,7 +121,7 @@ public:
|
||||
// Small door opened after event are expected to be closed by default
|
||||
// Set Inst data for encounter
|
||||
instance->SetData(DATA_SELIN_EVENT, NOT_STARTED);
|
||||
} else sLog->outError(ERROR_INST_DATA);
|
||||
} else sLog->outError(LOG_FILTER_TSCR, ERROR_INST_DATA);
|
||||
|
||||
DrainLifeTimer = urand(3000, 7000);
|
||||
DrainManaTimer = DrainLifeTimer + 5000;
|
||||
@@ -222,7 +223,7 @@ public:
|
||||
else
|
||||
{
|
||||
// Make an error message in case something weird happened here
|
||||
sLog->outError("TSCR: Selin Fireheart unable to drain crystal as the crystal is either dead or despawned");
|
||||
sLog->outError(LOG_FILTER_TSCR, "Selin Fireheart unable to drain crystal as the crystal is either dead or despawned");
|
||||
DrainingCrystal = false;
|
||||
}
|
||||
}
|
||||
@@ -361,7 +362,7 @@ public:
|
||||
}
|
||||
}
|
||||
}
|
||||
} else sLog->outError(ERROR_INST_DATA);
|
||||
} else sLog->outError(LOG_FILTER_TSCR, ERROR_INST_DATA);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -23,7 +23,8 @@ SDComment: Heroic and Normal support. Needs further testing.
|
||||
SDCategory: Magister's Terrace
|
||||
EndScriptData */
|
||||
|
||||
#include "ScriptPCH.h"
|
||||
#include "ScriptMgr.h"
|
||||
#include "ScriptedCreature.h"
|
||||
#include "magisters_terrace.h"
|
||||
|
||||
enum eEnums
|
||||
|
||||
+13
-12
@@ -23,7 +23,8 @@ SDComment: Designed only for Selin Fireheart
|
||||
SDCategory: Magister's Terrace
|
||||
EndScriptData */
|
||||
|
||||
#include "ScriptPCH.h"
|
||||
#include "ScriptMgr.h"
|
||||
#include "InstanceScript.h"
|
||||
#include "magisters_terrace.h"
|
||||
|
||||
#define MAX_ENCOUNTER 4
|
||||
@@ -218,32 +219,32 @@ public:
|
||||
{
|
||||
switch (identifier)
|
||||
{
|
||||
case DATA_SELIN:
|
||||
case DATA_SELIN:
|
||||
return SelinGUID;
|
||||
case DATA_DELRISSA:
|
||||
case DATA_DELRISSA:
|
||||
return DelrissaGUID;
|
||||
case DATA_VEXALLUS_DOOR:
|
||||
case DATA_VEXALLUS_DOOR:
|
||||
return VexallusDoorGUID;
|
||||
case DATA_SELIN_DOOR:
|
||||
case DATA_SELIN_DOOR:
|
||||
return SelinDoorGUID;
|
||||
case DATA_SELIN_ENCOUNTER_DOOR:
|
||||
case DATA_SELIN_ENCOUNTER_DOOR:
|
||||
return SelinEncounterDoorGUID;
|
||||
case DATA_DELRISSA_DOOR:
|
||||
case DATA_DELRISSA_DOOR:
|
||||
return DelrissaDoorGUID;
|
||||
case DATA_KAEL_DOOR:
|
||||
case DATA_KAEL_DOOR:
|
||||
return KaelDoorGUID;
|
||||
case DATA_KAEL_STATUE_LEFT:
|
||||
case DATA_KAEL_STATUE_LEFT:
|
||||
return KaelStatue[0];
|
||||
case DATA_KAEL_STATUE_RIGHT:
|
||||
case DATA_KAEL_STATUE_RIGHT:
|
||||
return KaelStatue[1];
|
||||
case DATA_ESCAPE_ORB:
|
||||
case DATA_ESCAPE_ORB:
|
||||
return EscapeOrbGUID;
|
||||
|
||||
case DATA_FEL_CRYSTAL:
|
||||
{
|
||||
if (FelCrystals.empty())
|
||||
{
|
||||
sLog->outError("TSCR: Magisters Terrace: No Fel Crystals loaded in Inst Data");
|
||||
sLog->outError(LOG_FILTER_TSCR, "Magisters Terrace: No Fel Crystals loaded in Inst Data");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -27,7 +27,9 @@ EndScriptData */
|
||||
npc_kalecgos
|
||||
EndContentData */
|
||||
|
||||
#include "ScriptPCH.h"
|
||||
#include "ScriptMgr.h"
|
||||
#include "ScriptedCreature.h"
|
||||
#include "ScriptedGossip.h"
|
||||
|
||||
/*######
|
||||
## npc_kalecgos
|
||||
|
||||
@@ -23,7 +23,8 @@ SDComment: some spells doesnt work correctly
|
||||
SDCategory: Molten Core
|
||||
EndScriptData */
|
||||
|
||||
#include "ScriptPCH.h"
|
||||
#include "ScriptMgr.h"
|
||||
#include "ScriptedCreature.h"
|
||||
#include "molten_core.h"
|
||||
|
||||
enum Texts
|
||||
|
||||
@@ -15,10 +15,14 @@
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "ScriptPCH.h"
|
||||
#include "ScriptMgr.h"
|
||||
#include "ScriptedCreature.h"
|
||||
#include "ScriptedGossip.h"
|
||||
#include "Vehicle.h"
|
||||
#include "ObjectMgr.h"
|
||||
#include "ScriptedEscortAI.h"
|
||||
#include "CombatAI.h"
|
||||
#include "PassiveAI.h"
|
||||
|
||||
/*######
|
||||
##Quest 12848
|
||||
@@ -185,7 +189,7 @@ public:
|
||||
anchorGUID = anchor->GetGUID();
|
||||
}
|
||||
else
|
||||
sLog->outError("npc_unworthy_initiateAI: unable to find anchor!");
|
||||
sLog->outError(LOG_FILTER_TSCR, "npc_unworthy_initiateAI: unable to find anchor!");
|
||||
|
||||
float dist = 99.0f;
|
||||
GameObject* prison = NULL;
|
||||
@@ -205,7 +209,7 @@ public:
|
||||
if (prison)
|
||||
prison->ResetDoorOrButton();
|
||||
else
|
||||
sLog->outError("npc_unworthy_initiateAI: unable to find prison!");
|
||||
sLog->outError(LOG_FILTER_TSCR, "npc_unworthy_initiateAI: unable to find prison!");
|
||||
}
|
||||
break;
|
||||
case PHASE_TO_EQUIP:
|
||||
@@ -664,7 +668,7 @@ public:
|
||||
{
|
||||
CAST_PLR(charmer)->GroupEventHappens(12687, me);
|
||||
charmer->RemoveAurasDueToSpell(SPELL_EFFECT_OVERTAKE);
|
||||
CAST_CRE(who)->ForcedDespawn();
|
||||
CAST_CRE(who)->DespawnOrUnsummon();
|
||||
//CAST_CRE(who)->Respawn(true);
|
||||
}
|
||||
|
||||
@@ -767,7 +771,7 @@ public:
|
||||
//Todo: Creatures must not be removed, but, must instead
|
||||
// stand next to Gothik and be commanded into the pit
|
||||
// and dig into the ground.
|
||||
CAST_CRE(who)->ForcedDespawn();
|
||||
CAST_CRE(who)->DespawnOrUnsummon();
|
||||
|
||||
if (CAST_PLR(owner)->GetQuestStatus(12698) == QUEST_STATUS_COMPLETE)
|
||||
owner->RemoveAllMinionsByEntry(GHOULS);
|
||||
@@ -1074,9 +1078,9 @@ public:
|
||||
{
|
||||
car->AI()->SetGUID(miner->GetGUID());
|
||||
CAST_AI(npc_scarlet_miner::npc_scarlet_minerAI, miner->AI())->InitCartQuest(player);
|
||||
} else sLog->outError("TSCR: OnGossipHello vehicle entry is not correct.");
|
||||
} else sLog->outError("TSCR: OnGossipHello player is not on the vehicle.");
|
||||
} else sLog->outError("TSCR: OnGossipHello Scarlet Miner cant be found by script.");
|
||||
} else sLog->outError(LOG_FILTER_TSCR, "OnGossipHello vehicle entry is not correct.");
|
||||
} else sLog->outError(LOG_FILTER_TSCR, "OnGossipHello player is not on the vehicle.");
|
||||
} else sLog->outError(LOG_FILTER_TSCR, "OnGossipHello Scarlet Miner cant be found by script.");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -15,7 +15,8 @@
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "ScriptPCH.h"
|
||||
#include "ScriptMgr.h"
|
||||
#include "ScriptedCreature.h"
|
||||
#include "ScriptedEscortAI.h"
|
||||
|
||||
//How to win friends and influence enemies
|
||||
|
||||
@@ -15,7 +15,9 @@
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "ScriptPCH.h"
|
||||
#include "ScriptMgr.h"
|
||||
#include "ScriptedCreature.h"
|
||||
#include "ScriptedGossip.h"
|
||||
#include "ScriptedEscortAI.h"
|
||||
|
||||
#define LESS_MOB // if you do not have a good server and do not want it to be laggy as hell
|
||||
|
||||
@@ -15,7 +15,9 @@
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "ScriptPCH.h"
|
||||
#include "ScriptMgr.h"
|
||||
#include "ScriptedCreature.h"
|
||||
#include "PassiveAI.h"
|
||||
|
||||
/*####
|
||||
## npc_valkyr_battle_maiden
|
||||
|
||||
@@ -23,7 +23,8 @@ SDComment:
|
||||
SDCategory: Scarlet Monastery
|
||||
EndScriptData */
|
||||
|
||||
#include "ScriptPCH.h"
|
||||
#include "ScriptMgr.h"
|
||||
#include "ScriptedCreature.h"
|
||||
|
||||
enum eEnums
|
||||
{
|
||||
|
||||
@@ -23,7 +23,8 @@ SDComment:
|
||||
SDCategory: Scarlet Monastery
|
||||
EndScriptData */
|
||||
|
||||
#include "ScriptPCH.h"
|
||||
#include "ScriptMgr.h"
|
||||
#include "ScriptedCreature.h"
|
||||
|
||||
enum Spells
|
||||
{
|
||||
|
||||
@@ -23,7 +23,8 @@ SDComment:
|
||||
SDCategory: Scarlet Monastery
|
||||
EndScriptData */
|
||||
|
||||
#include "ScriptPCH.h"
|
||||
#include "ScriptMgr.h"
|
||||
#include "ScriptedCreature.h"
|
||||
|
||||
enum eEnums
|
||||
{
|
||||
|
||||
@@ -23,7 +23,8 @@ SDComment:
|
||||
SDCategory: Scarlet Monastery
|
||||
EndScriptData */
|
||||
|
||||
#include "ScriptPCH.h"
|
||||
#include "ScriptMgr.h"
|
||||
#include "ScriptedCreature.h"
|
||||
#include "SpellMgr.h"
|
||||
#include "scarlet_monastery.h"
|
||||
|
||||
|
||||
@@ -23,7 +23,8 @@ SDComment: Should in addition spawn Myrmidons in the hallway outside
|
||||
SDCategory: Scarlet Monastery
|
||||
EndScriptData */
|
||||
|
||||
#include "ScriptPCH.h"
|
||||
#include "ScriptMgr.h"
|
||||
#include "ScriptedCreature.h"
|
||||
#include "ScriptedEscortAI.h"
|
||||
|
||||
enum Says
|
||||
|
||||
+2
-1
@@ -23,7 +23,8 @@ SDComment: TODO: if this guy not involved in some special event, remove (and let
|
||||
SDCategory: Scarlet Monastery
|
||||
EndScriptData */
|
||||
|
||||
#include "ScriptPCH.h"
|
||||
#include "ScriptMgr.h"
|
||||
#include "ScriptedCreature.h"
|
||||
|
||||
enum eSpells
|
||||
{
|
||||
|
||||
@@ -23,7 +23,8 @@ SDComment:
|
||||
SDCategory: Scarlet Monastery
|
||||
EndScriptData */
|
||||
|
||||
#include "ScriptPCH.h"
|
||||
#include "ScriptMgr.h"
|
||||
#include "ScriptedCreature.h"
|
||||
|
||||
enum eEnums
|
||||
{
|
||||
|
||||
@@ -23,7 +23,8 @@ SDComment:
|
||||
SDCategory: Scarlet Monastery
|
||||
EndScriptData */
|
||||
|
||||
#include "ScriptPCH.h"
|
||||
#include "ScriptMgr.h"
|
||||
#include "ScriptedCreature.h"
|
||||
#include "scarlet_monastery.h"
|
||||
|
||||
enum Says
|
||||
|
||||
@@ -23,7 +23,8 @@ SDComment:
|
||||
SDCategory: Scarlet Monastery
|
||||
EndScriptData */
|
||||
|
||||
#include "ScriptPCH.h"
|
||||
#include "ScriptMgr.h"
|
||||
#include "ScriptedCreature.h"
|
||||
#include "scarlet_monastery.h"
|
||||
|
||||
enum Says
|
||||
|
||||
@@ -23,7 +23,8 @@ SDComment:
|
||||
SDCategory: Scarlet Monastery
|
||||
EndScriptData */
|
||||
|
||||
#include "ScriptPCH.h"
|
||||
#include "ScriptMgr.h"
|
||||
#include "ScriptedCreature.h"
|
||||
|
||||
enum Spells
|
||||
{
|
||||
|
||||
@@ -23,7 +23,8 @@ SDComment:
|
||||
SDCategory: Scarlet Monastery
|
||||
EndScriptData */
|
||||
|
||||
#include "ScriptPCH.h"
|
||||
#include "ScriptMgr.h"
|
||||
#include "ScriptedCreature.h"
|
||||
#include "scarlet_monastery.h"
|
||||
|
||||
enum Entry
|
||||
|
||||
@@ -23,7 +23,8 @@ SDComment: Doors missing in instance script.
|
||||
SDCategory: Scholomance
|
||||
EndScriptData */
|
||||
|
||||
#include "ScriptPCH.h"
|
||||
#include "ScriptMgr.h"
|
||||
#include "ScriptedCreature.h"
|
||||
#include "scholomance.h"
|
||||
|
||||
#define SPELL_ARCANEMISSILES 22272
|
||||
|
||||
@@ -23,7 +23,8 @@ SDComment:
|
||||
SDCategory: Scholomance
|
||||
EndScriptData */
|
||||
|
||||
#include "ScriptPCH.h"
|
||||
#include "ScriptMgr.h"
|
||||
#include "ScriptedCreature.h"
|
||||
|
||||
class boss_death_knight_darkreaver : public CreatureScript
|
||||
{
|
||||
|
||||
Loaded 100 of 1376 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user