Merge branch 'master' into Playerbot

This commit is contained in:
Yunfan Li
2023-12-12 20:52:42 +08:00
1088 changed files with 35633 additions and 19812 deletions

View File

@@ -25,8 +25,7 @@ bool Acore::PlayerCommand::HandleLearnSpellCommand(ChatHandler* handler, Player*
{
if (!SpellMgr::IsSpellValid(spell))
{
handler->PSendSysMessage(LANG_COMMAND_SPELL_BROKEN, spell->Id);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_COMMAND_SPELL_BROKEN, spell->Id);
return false;
}
@@ -34,14 +33,13 @@ bool Acore::PlayerCommand::HandleLearnSpellCommand(ChatHandler* handler, Player*
{
if (targetPlayer == handler->GetPlayer())
{
handler->SendSysMessage(LANG_YOU_KNOWN_SPELL);
handler->SendErrorMessage(LANG_YOU_KNOWN_SPELL);
}
else
{
handler->PSendSysMessage(LANG_TARGET_KNOWN_SPELL, handler->GetNameLink(targetPlayer).c_str());
handler->SendErrorMessage(LANG_TARGET_KNOWN_SPELL, handler->GetNameLink(targetPlayer).c_str());
}
handler->SetSentErrorMessage(true);
return false;
}

View File

@@ -26,9 +26,9 @@ EndScriptData */
#include "AccountMgr.h"
#include "Base32.h"
#include "Chat.h"
#include "CommandScript.h"
#include "CryptoGenerics.h"
#include "IPLocation.h"
#include "Language.h"
#include "Player.h"
#include "Realm.h"
#include "ScriptMgr.h"
@@ -101,8 +101,7 @@ public:
{
if (!*args)
{
handler->SendSysMessage(LANG_CMD_SYNTAX);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_CMD_SYNTAX);
return false;
}
@@ -111,8 +110,7 @@ public:
auto const& masterKey = sSecretMgr->GetSecret(SECRET_TOTP_MASTER_KEY);
if (!masterKey.IsAvailable())
{
handler->SendSysMessage(LANG_2FA_COMMANDS_NOT_SETUP);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_2FA_COMMANDS_NOT_SETUP);
return false;
}
@@ -126,15 +124,13 @@ public:
if (!result)
{
LOG_ERROR("misc", "Account {} not found in login database when processing .account 2fa setup command.", accountId);
handler->SendSysMessage(LANG_UNKNOWN_ERROR);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_UNKNOWN_ERROR);
return false;
}
if (!result->Fetch()->IsNull())
{
handler->SendSysMessage(LANG_2FA_ALREADY_SETUP);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_2FA_ALREADY_SETUP);
return false;
}
}
@@ -167,8 +163,7 @@ public:
}
// new suggestion, or no token specified, output TOTP parameters
handler->PSendSysMessage(LANG_2FA_SECRET_SUGGESTION, Acore::Encoding::Base32::Encode(pair.first->second).c_str());
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_2FA_SECRET_SUGGESTION, Acore::Encoding::Base32::Encode(pair.first->second).c_str());
return false;
}
@@ -176,8 +171,7 @@ public:
{
if (!*args)
{
handler->SendSysMessage(LANG_CMD_SYNTAX);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_CMD_SYNTAX);
return false;
}
@@ -186,8 +180,7 @@ public:
auto const& masterKey = sSecretMgr->GetSecret(SECRET_TOTP_MASTER_KEY);
if (!masterKey.IsAvailable())
{
handler->SendSysMessage(LANG_2FA_COMMANDS_NOT_SETUP);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_2FA_COMMANDS_NOT_SETUP);
return false;
}
@@ -201,16 +194,14 @@ public:
if (!result)
{
LOG_ERROR("misc", "Account {} not found in login database when processing .account 2fa setup command.", accountId);
handler->SendSysMessage(LANG_UNKNOWN_ERROR);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_UNKNOWN_ERROR);
return false;
}
Field* field = result->Fetch();
if (field->IsNull())
{ // 2FA not enabled
handler->SendSysMessage(LANG_2FA_NOT_SETUP);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_2FA_NOT_SETUP);
return false;
}
@@ -225,8 +216,7 @@ public:
if (!success)
{
LOG_ERROR("misc", "Account {} has invalid ciphertext in TOTP token.", accountId);
handler->SendSysMessage(LANG_UNKNOWN_ERROR);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_UNKNOWN_ERROR);
return false;
}
}
@@ -244,8 +234,7 @@ public:
handler->SendSysMessage(LANG_2FA_INVALID_TOKEN);
}
handler->SendSysMessage(LANG_2FA_REMOVE_NEED_TOKEN);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_2FA_REMOVE_NEED_TOKEN);
return false;
}
@@ -253,8 +242,7 @@ public:
{
if (!*args)
{
handler->SendSysMessage(LANG_CMD_SYNTAX);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_CMD_SYNTAX);
return false;
}
@@ -265,8 +253,7 @@ public:
auto expansion = Acore::StringTo<uint8>(exp); //get int anyway (0 if error)
if (!expansion || *expansion > sWorld->getIntConfig(CONFIG_EXPANSION))
{
handler->SendSysMessage(LANG_IMPROPER_VALUE);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_IMPROPER_VALUE);
return false;
}
@@ -306,24 +293,19 @@ public:
}
break;
case AOR_NAME_TOO_LONG:
handler->SendSysMessage(LANG_ACCOUNT_TOO_LONG);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_ACCOUNT_TOO_LONG);
return false;
case AOR_PASS_TOO_LONG:
handler->SendSysMessage(LANG_ACCOUNT_PASS_TOO_LONG);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_ACCOUNT_PASS_TOO_LONG);
return false;
case AOR_NAME_ALREADY_EXIST:
handler->SendSysMessage(LANG_ACCOUNT_ALREADY_EXIST);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_ACCOUNT_ALREADY_EXIST);
return false;
case AOR_DB_INTERNAL_ERROR:
handler->PSendSysMessage(LANG_ACCOUNT_NOT_CREATED_SQL_ERROR, accountName);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_ACCOUNT_NOT_CREATED_SQL_ERROR, accountName);
return false;
default:
handler->PSendSysMessage(LANG_ACCOUNT_NOT_CREATED, accountName);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_ACCOUNT_NOT_CREATED, accountName);
return false;
}
@@ -345,16 +327,14 @@ public:
std::string accountName = account;
if (!Utf8ToUpperOnlyLatin(accountName))
{
handler->PSendSysMessage(LANG_ACCOUNT_NOT_EXIST, accountName.c_str());
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_ACCOUNT_NOT_EXIST, accountName.c_str());
return false;
}
uint32 accountId = AccountMgr::GetId(accountName);
if (!accountId)
{
handler->PSendSysMessage(LANG_ACCOUNT_NOT_EXIST, accountName.c_str());
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_ACCOUNT_NOT_EXIST, accountName.c_str());
return false;
}
@@ -371,16 +351,13 @@ public:
handler->PSendSysMessage(LANG_ACCOUNT_DELETED, accountName.c_str());
break;
case AOR_NAME_NOT_EXIST:
handler->PSendSysMessage(LANG_ACCOUNT_NOT_EXIST, accountName.c_str());
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_ACCOUNT_NOT_EXIST, accountName.c_str());
return false;
case AOR_DB_INTERNAL_ERROR:
handler->PSendSysMessage(LANG_ACCOUNT_NOT_DELETED_SQL_ERROR, accountName.c_str());
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_ACCOUNT_NOT_DELETED_SQL_ERROR, accountName.c_str());
return false;
default:
handler->PSendSysMessage(LANG_ACCOUNT_NOT_DELETED, accountName.c_str());
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_ACCOUNT_NOT_DELETED, accountName.c_str());
return false;
}
@@ -439,8 +416,7 @@ public:
{
if (!*args)
{
handler->SendSysMessage(LANG_CMD_SYNTAX);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_CMD_SYNTAX);
return false;
}
@@ -452,16 +428,14 @@ public:
std::string accountName = _accountName;
if (!Utf8ToUpperOnlyLatin(accountName))
{
handler->PSendSysMessage(LANG_ACCOUNT_NOT_EXIST, accountName.c_str());
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_ACCOUNT_NOT_EXIST, accountName.c_str());
return false;
}
uint32 accountId = AccountMgr::GetId(accountName);
if (!accountId)
{
handler->PSendSysMessage(LANG_ACCOUNT_NOT_EXIST, accountName.c_str());
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_ACCOUNT_NOT_EXIST, accountName.c_str());
return false;
}
@@ -478,8 +452,7 @@ public:
{
if (!*args)
{
handler->SendSysMessage(LANG_USE_BOL);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_USE_BOL);
return false;
}
@@ -499,8 +472,7 @@ public:
}
else
{
handler->PSendSysMessage("No IP2Location information - account not locked");
handler->SetSentErrorMessage(true);
handler->SendErrorMessage("No IP2Location information - account not locked");
return false;
}
}
@@ -515,8 +487,7 @@ public:
return true;
}
handler->SendSysMessage(LANG_USE_BOL);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_USE_BOL);
return false;
}
@@ -524,8 +495,7 @@ public:
{
if (!*args)
{
handler->SendSysMessage(LANG_USE_BOL);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_USE_BOL);
return false;
}
@@ -552,8 +522,7 @@ public:
return true;
}
handler->SendSysMessage(LANG_USE_BOL);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_USE_BOL);
return false;
}
@@ -561,8 +530,7 @@ public:
{
if (!*args)
{
handler->SendSysMessage(LANG_CMD_SYNTAX);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_CMD_SYNTAX);
return false;
}
@@ -572,24 +540,21 @@ public:
if (!oldPassword || !newPassword || !passwordConfirmation)
{
handler->SendSysMessage(LANG_CMD_SYNTAX);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_CMD_SYNTAX);
return false;
}
if (!AccountMgr::CheckPassword(handler->GetSession()->GetAccountId(), std::string(oldPassword)))
{
handler->SendSysMessage(LANG_COMMAND_WRONGOLDPASSWORD);
handler->SendErrorMessage(LANG_COMMAND_WRONGOLDPASSWORD);
sScriptMgr->OnFailedPasswordChange(handler->GetSession()->GetAccountId());
handler->SetSentErrorMessage(true);
return false;
}
if (strcmp(newPassword, passwordConfirmation) != 0)
{
handler->SendSysMessage(LANG_NEW_PASSWORDS_NOT_MATCH);
handler->SendErrorMessage(LANG_NEW_PASSWORDS_NOT_MATCH);
sScriptMgr->OnFailedPasswordChange(handler->GetSession()->GetAccountId());
handler->SetSentErrorMessage(true);
return false;
}
@@ -601,13 +566,11 @@ public:
sScriptMgr->OnPasswordChange(handler->GetSession()->GetAccountId());
break;
case AOR_PASS_TOO_LONG:
handler->SendSysMessage(LANG_PASSWORD_TOO_LONG);
handler->SendErrorMessage(LANG_PASSWORD_TOO_LONG);
sScriptMgr->OnFailedPasswordChange(handler->GetSession()->GetAccountId());
handler->SetSentErrorMessage(true);
return false;
default:
handler->SendSysMessage(LANG_COMMAND_NOTCHANGEPASSWORD);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_COMMAND_NOTCHANGEPASSWORD);
return false;
}
@@ -618,8 +581,7 @@ public:
{
if (!*args)
{
handler->SendSysMessage(LANG_CMD_SYNTAX);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_CMD_SYNTAX);
return false;
}
@@ -628,8 +590,7 @@ public:
if (!_account || !_secret)
{
handler->SendSysMessage(LANG_CMD_SYNTAX);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_CMD_SYNTAX);
return false;
}
@@ -638,16 +599,14 @@ public:
if (!Utf8ToUpperOnlyLatin(accountName))
{
handler->PSendSysMessage(LANG_ACCOUNT_NOT_EXIST, accountName.c_str());
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_ACCOUNT_NOT_EXIST, accountName.c_str());
return false;
}
uint32 targetAccountId = AccountMgr::GetId(accountName);
if (!targetAccountId)
{
handler->PSendSysMessage(LANG_ACCOUNT_NOT_EXIST, accountName.c_str());
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_ACCOUNT_NOT_EXIST, accountName.c_str());
return false;
}
@@ -667,23 +626,20 @@ public:
auto const& masterKey = sSecretMgr->GetSecret(SECRET_TOTP_MASTER_KEY);
if (!masterKey.IsAvailable())
{
handler->SendSysMessage(LANG_2FA_COMMANDS_NOT_SETUP);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_2FA_COMMANDS_NOT_SETUP);
return false;
}
Optional<std::vector<uint8>> decoded = Acore::Encoding::Base32::Decode(secret);
if (!decoded)
{
handler->SendSysMessage(LANG_2FA_SECRET_INVALID);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_2FA_SECRET_INVALID);
return false;
}
if (128 < (decoded->size() + Acore::Crypto::AES::IV_SIZE_BYTES + Acore::Crypto::AES::TAG_SIZE_BYTES))
{
handler->SendSysMessage(LANG_2FA_SECRET_TOO_LONG);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_2FA_SECRET_TOO_LONG);
return false;
}
@@ -735,16 +691,14 @@ public:
accountName = account;
if (!Utf8ToUpperOnlyLatin(accountName))
{
handler->PSendSysMessage(LANG_ACCOUNT_NOT_EXIST, accountName.c_str());
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_ACCOUNT_NOT_EXIST, accountName.c_str());
return false;
}
accountId = AccountMgr::GetId(accountName);
if (!accountId)
{
handler->PSendSysMessage(LANG_ACCOUNT_NOT_EXIST, accountName.c_str());
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_ACCOUNT_NOT_EXIST, accountName.c_str());
return false;
}
}
@@ -801,8 +755,7 @@ public:
targetAccountName = arg1;
if (!Utf8ToUpperOnlyLatin(targetAccountName))
{
handler->PSendSysMessage(LANG_ACCOUNT_NOT_EXIST, targetAccountName.c_str());
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_ACCOUNT_NOT_EXIST, targetAccountName.c_str());
return false;
}
}
@@ -811,8 +764,7 @@ public:
gm = (isAccountNameGiven) ? Acore::StringTo<int32>(arg2).value_or(0) : Acore::StringTo<int32>(arg1).value_or(0);
if (gm > SEC_CONSOLE)
{
handler->SendSysMessage(LANG_BAD_VALUE);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_BAD_VALUE);
return false;
}
@@ -830,8 +782,7 @@ public:
targetSecurity = AccountMgr::GetSecurity(targetAccountId, gmRealmID);
if (targetSecurity >= playerSecurity || gm >= playerSecurity)
{
handler->SendSysMessage(LANG_YOURS_SECURITY_IS_LOW);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_YOURS_SECURITY_IS_LOW);
return false;
}
@@ -847,8 +798,7 @@ public:
if (result)
{
handler->SendSysMessage(LANG_YOURS_SECURITY_IS_LOW);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_YOURS_SECURITY_IS_LOW);
return false;
}
}
@@ -856,8 +806,7 @@ public:
// Check if provided realm.Id.Realm has a negative value other than -1
if (gmRealmID < -1)
{
handler->SendSysMessage(LANG_INVALID_REALMID);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_INVALID_REALMID);
return false;
}
@@ -910,16 +859,14 @@ public:
std::string accountName = account;
if (!Utf8ToUpperOnlyLatin(accountName))
{
handler->PSendSysMessage(LANG_ACCOUNT_NOT_EXIST, accountName.c_str());
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_ACCOUNT_NOT_EXIST, accountName.c_str());
return false;
}
uint32 targetAccountId = AccountMgr::GetId(accountName);
if (!targetAccountId)
{
handler->PSendSysMessage(LANG_ACCOUNT_NOT_EXIST, accountName.c_str());
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_ACCOUNT_NOT_EXIST, accountName.c_str());
return false;
}
@@ -930,8 +877,7 @@ public:
if (strcmp(password, passwordConfirmation))
{
handler->SendSysMessage(LANG_NEW_PASSWORDS_NOT_MATCH);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_NEW_PASSWORDS_NOT_MATCH);
return false;
}
@@ -943,16 +889,13 @@ public:
handler->SendSysMessage(LANG_COMMAND_PASSWORD);
break;
case AOR_NAME_NOT_EXIST:
handler->PSendSysMessage(LANG_ACCOUNT_NOT_EXIST, accountName.c_str());
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_ACCOUNT_NOT_EXIST, accountName.c_str());
return false;
case AOR_PASS_TOO_LONG:
handler->SendSysMessage(LANG_PASSWORD_TOO_LONG);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_PASSWORD_TOO_LONG);
return false;
default:
handler->SendSysMessage(LANG_COMMAND_NOTCHANGEPASSWORD);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_COMMAND_NOTCHANGEPASSWORD);
return false;
}
return true;

View File

@@ -24,9 +24,8 @@ EndScriptData */
#include "AchievementMgr.h"
#include "Chat.h"
#include "Language.h"
#include "CommandScript.h"
#include "Player.h"
#include "ScriptMgr.h"
using namespace Acore::ChatCommands;
@@ -54,8 +53,7 @@ public:
Player* target = handler->getSelectedPlayer();
if (!target)
{
handler->SendSysMessage(LANG_NO_CHAR_SELECTED);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_NO_CHAR_SELECTED);
return false;
}
target->CompletedAchievement(achievementEntry);
@@ -72,8 +70,7 @@ public:
if (!player)
{
handler->SendSysMessage(LANG_PLAYER_NOT_FOUND);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_PLAYER_NOT_FOUND);
return false;
}

View File

@@ -24,9 +24,8 @@ EndScriptData */
#include "ArenaTeamMgr.h"
#include "Chat.h"
#include "Language.h"
#include "CommandScript.h"
#include "Player.h"
#include "ScriptMgr.h"
using namespace Acore::ChatCommands;
@@ -59,8 +58,7 @@ public:
{
if (sArenaTeamMgr->GetArenaTeamByName(name))
{
handler->PSendSysMessage(LANG_ARENA_ERROR_NAME_EXISTS, name.c_str());
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_ARENA_ERROR_NAME_EXISTS, name.c_str());
return false;
}
@@ -72,8 +70,7 @@ public:
if (Player::GetArenaTeamIdFromDB(captain->GetGUID(), type) != 0)
{
handler->PSendSysMessage(LANG_ARENA_ERROR_SIZE, captain->GetName().c_str());
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_ARENA_ERROR_SIZE, captain->GetName().c_str());
return false;
}
@@ -82,8 +79,7 @@ public:
if (!arena->Create(captain->GetGUID(), type, name, 4293102085, 101, 4293253939, 4, 4284049911))
{
delete arena;
handler->SendSysMessage(LANG_BAD_VALUE);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_BAD_VALUE);
return false;
}
@@ -99,15 +95,13 @@ public:
if (!arena)
{
handler->PSendSysMessage(LANG_ARENA_ERROR_NOT_FOUND, teamId);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_ARENA_ERROR_NOT_FOUND, teamId);
return false;
}
if (arena->IsFighting())
{
handler->SendSysMessage(LANG_ARENA_ERROR_COMBAT);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_ARENA_ERROR_COMBAT);
return false;
}
@@ -125,29 +119,25 @@ public:
ArenaTeam* arena = sArenaTeamMgr->GetArenaTeamByName(oldName);
if (!arena)
{
handler->PSendSysMessage(LANG_ARENA_ERROR_NAME_NOT_FOUND, oldName.c_str());
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_ARENA_ERROR_NAME_NOT_FOUND, oldName.c_str());
return false;
}
if (sArenaTeamMgr->GetArenaTeamByName(newName))
{
handler->PSendSysMessage(LANG_ARENA_ERROR_NAME_EXISTS, oldName.c_str());
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_ARENA_ERROR_NAME_EXISTS, oldName.c_str());
return false;
}
if (arena->IsFighting())
{
handler->SendSysMessage(LANG_ARENA_ERROR_COMBAT);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_ARENA_ERROR_COMBAT);
return false;
}
if (!arena->SetName(newName))
{
handler->SendSysMessage(LANG_BAD_VALUE);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_BAD_VALUE);
return false;
}
@@ -161,15 +151,13 @@ public:
ArenaTeam* arena = sArenaTeamMgr->GetArenaTeamById(teamId);
if (!arena)
{
handler->PSendSysMessage(LANG_ARENA_ERROR_NOT_FOUND, teamId);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_ARENA_ERROR_NOT_FOUND, teamId);
return false;
}
if (arena->IsFighting())
{
handler->SendSysMessage(LANG_ARENA_ERROR_COMBAT);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_ARENA_ERROR_COMBAT);
return false;
}
@@ -181,15 +169,13 @@ public:
if (!arena->IsMember(target->GetGUID()))
{
handler->PSendSysMessage(LANG_ARENA_ERROR_NOT_MEMBER, target->GetName().c_str(), arena->GetName().c_str());
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_ARENA_ERROR_NOT_MEMBER, target->GetName().c_str(), arena->GetName().c_str());
return false;
}
if (arena->GetCaptain() == target->GetGUID())
{
handler->PSendSysMessage(LANG_ARENA_ERROR_CAPTAIN, target->GetName().c_str(), arena->GetName().c_str());
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_ARENA_ERROR_CAPTAIN, target->GetName().c_str(), arena->GetName().c_str());
return false;
}
@@ -207,8 +193,7 @@ public:
ArenaTeam* arena = sArenaTeamMgr->GetArenaTeamById(teamId);
if (!arena)
{
handler->PSendSysMessage(LANG_ARENA_ERROR_NOT_FOUND, teamId);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_ARENA_ERROR_NOT_FOUND, teamId);
return false;
}

View File

@@ -16,9 +16,9 @@
*/
#include "Chat.h"
#include "CommandScript.h"
#include "ObjectMgr.h"
#include "Player.h"
#include "ScriptMgr.h"
constexpr std::array<std::string_view, MAX_ITEM_QUALITY> itemQualityToString =
{

View File

@@ -26,12 +26,12 @@ EndScriptData */
#include "BanMgr.h"
#include "CharacterCache.h"
#include "Chat.h"
#include "CommandScript.h"
#include "GameTime.h"
#include "Language.h"
#include "ObjectAccessor.h"
#include "ObjectMgr.h"
#include "Player.h"
#include "ScriptMgr.h"
/// Ban function modes
enum BanMode
@@ -121,8 +121,7 @@ public:
if (!normalizePlayerName(name))
{
handler->SendSysMessage(LANG_PLAYER_NOT_FOUND);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_PLAYER_NOT_FOUND);
return false;
}
@@ -142,8 +141,7 @@ public:
break;
case BAN_NOTFOUND:
{
handler->PSendSysMessage(LANG_BAN_NOTFOUND, "character", name.c_str());
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_BAN_NOTFOUND, "character", name.c_str());
return false;
}
default:
@@ -187,16 +185,14 @@ public:
case BAN_ACCOUNT:
if (!Utf8ToUpperOnlyLatin(nameOrIP))
{
handler->PSendSysMessage(LANG_ACCOUNT_NOT_EXIST, nameOrIP.c_str());
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_ACCOUNT_NOT_EXIST, nameOrIP.c_str());
return false;
}
break;
case BAN_CHARACTER:
if (!normalizePlayerName(nameOrIP))
{
handler->SendSysMessage(LANG_PLAYER_NOT_FOUND);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_PLAYER_NOT_FOUND);
return false;
}
break;
@@ -242,16 +238,15 @@ public:
switch (mode)
{
default:
handler->PSendSysMessage(LANG_BAN_NOTFOUND, "account", nameOrIP.c_str());
handler->SendErrorMessage(LANG_BAN_NOTFOUND, "account", nameOrIP.c_str());
break;
case BAN_CHARACTER:
handler->PSendSysMessage(LANG_BAN_NOTFOUND, "character", nameOrIP.c_str());
handler->SendErrorMessage(LANG_BAN_NOTFOUND, "character", nameOrIP.c_str());
break;
case BAN_IP:
handler->PSendSysMessage(LANG_BAN_NOTFOUND, "ip", nameOrIP.c_str());
handler->SendErrorMessage(LANG_BAN_NOTFOUND, "ip", nameOrIP.c_str());
break;
}
handler->SetSentErrorMessage(true);
return false;
case BAN_LONGER_EXISTS:
handler->PSendSysMessage("Unsuccessful! A longer ban is already present on this account!");
@@ -275,8 +270,7 @@ public:
std::string accountName = nameStr;
if (!Utf8ToUpperOnlyLatin(accountName))
{
handler->PSendSysMessage(LANG_ACCOUNT_NOT_EXIST, accountName.c_str());
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_ACCOUNT_NOT_EXIST, accountName.c_str());
return false;
}
@@ -681,15 +675,13 @@ public:
if (!normalizePlayerName(CharacterName))
{
handler->SendSysMessage(LANG_PLAYER_NOT_FOUND);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_PLAYER_NOT_FOUND);
return false;
}
if (!sBan->RemoveBanCharacter(CharacterName))
{
handler->SendSysMessage(LANG_PLAYER_NOT_FOUND);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_PLAYER_NOT_FOUND);
return false;
}
@@ -722,16 +714,14 @@ public:
case BAN_ACCOUNT:
if (!Utf8ToUpperOnlyLatin(nameOrIP))
{
handler->PSendSysMessage(LANG_ACCOUNT_NOT_EXIST, nameOrIP.c_str());
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_ACCOUNT_NOT_EXIST, nameOrIP.c_str());
return false;
}
break;
case BAN_CHARACTER:
if (!normalizePlayerName(nameOrIP))
{
handler->SendSysMessage(LANG_PLAYER_NOT_FOUND);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_PLAYER_NOT_FOUND);
return false;
}
break;

View File

@@ -24,7 +24,7 @@ EndScriptData */
#include "BattlefieldMgr.h"
#include "Chat.h"
#include "ScriptMgr.h"
#include "CommandScript.h"
using namespace Acore::ChatCommands;
@@ -126,8 +126,7 @@ public:
if (Acore::StringTo<int32>(timeStr).value_or(0) < 0)
{
handler->SendSysMessage(LANG_BAD_VALUE);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_BAD_VALUE);
return false;
}
@@ -139,8 +138,7 @@ public:
if (time <= 0)
{
handler->SendSysMessage(LANG_BAD_VALUE);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_BAD_VALUE);
return false;
}

View File

@@ -16,10 +16,10 @@
*/
#include "Chat.h"
#include "CommandScript.h"
#include "Group.h"
#include "Language.h"
#include "Player.h"
#include "ScriptMgr.h"
using namespace Acore::ChatCommands;
@@ -53,8 +53,7 @@ public:
if (!player)
{
handler->SendSysMessage(LANG_PLAYER_NOT_FOUND);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_PLAYER_NOT_FOUND);
return false;
}
@@ -62,8 +61,7 @@ public:
if (!cache)
{
handler->PSendSysMessage(LANG_COMMAND_CACHE_NOT_FOUND, player->GetName());
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_COMMAND_CACHE_NOT_FOUND, player->GetName());
return false;
}
@@ -84,8 +82,7 @@ public:
if (!player)
{
handler->SendSysMessage(LANG_PLAYER_NOT_FOUND);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_PLAYER_NOT_FOUND);
return false;
}
@@ -104,8 +101,7 @@ public:
if (!player)
{
handler->SendSysMessage(LANG_PLAYER_NOT_FOUND);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_PLAYER_NOT_FOUND);
return false;
}

View File

@@ -23,10 +23,10 @@ Category: commandscripts
EndScriptData */
#include "Chat.h"
#include "CommandScript.h"
#include "Creature.h"
#include "Language.h"
#include "Player.h"
#include "ScriptMgr.h"
#include "SpellInfo.h"
#include "SpellMgr.h"
@@ -70,15 +70,13 @@ public:
{
if (!spell)
{
handler->PSendSysMessage(LANG_COMMAND_NOSPELLFOUND);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_COMMAND_NOSPELLFOUND);
return false;
}
if (!SpellMgr::IsSpellValid(spell))
{
handler->PSendSysMessage(LANG_COMMAND_SPELL_BROKEN, spell->Id);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_COMMAND_SPELL_BROKEN, spell->Id);
return false;
}
return true;
@@ -101,8 +99,7 @@ public:
Unit* target = handler->getSelectedUnit();
if (!target)
{
handler->SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_SELECT_CHAR_OR_CREATURE);
return false;
}
@@ -127,8 +124,7 @@ public:
Creature* caster = handler->getSelectedCreature();
if (!caster)
{
handler->SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_SELECT_CHAR_OR_CREATURE);
return false;
}
@@ -174,8 +170,7 @@ public:
Unit* target = handler->getSelectedUnit();
if (!target)
{
handler->SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_SELECT_CHAR_OR_CREATURE);
return false;
}
@@ -200,15 +195,13 @@ public:
Creature* caster = handler->getSelectedCreature();
if (!caster)
{
handler->SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_SELECT_CHAR_OR_CREATURE);
return false;
}
if (!caster->GetVictim())
{
handler->SendSysMessage(LANG_SELECTED_TARGET_NOT_HAVE_VICTIM);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_SELECTED_TARGET_NOT_HAVE_VICTIM);
return false;
}
@@ -233,8 +226,7 @@ public:
Unit* caster = handler->getSelectedUnit();
if (!caster)
{
handler->SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_SELECT_CHAR_OR_CREATURE);
return false;
}

View File

@@ -24,6 +24,7 @@ EndScriptData */
#include "AccountMgr.h"
#include "Chat.h"
#include "CommandScript.h"
#include "DBCStores.h"
#include "DatabaseEnv.h"
#include "Log.h"
@@ -32,7 +33,6 @@ EndScriptData */
#include "Player.h"
#include "PlayerDump.h"
#include "ReputationMgr.h"
#include "ScriptMgr.h"
#include "Timer.h"
#include "World.h"
#include "WorldSession.h"
@@ -283,8 +283,7 @@ public:
if (!player || !player->IsConnected())
{
handler->SendSysMessage(LANG_PLAYER_NOT_FOUND);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_PLAYER_NOT_FOUND);
return false;
}
@@ -344,29 +343,25 @@ public:
std::string newName{ *newNameV };
if (!normalizePlayerName(newName))
{
handler->SendSysMessage(LANG_BAD_VALUE);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_BAD_VALUE);
return false;
}
if (ObjectMgr::CheckPlayerName(newName, true) != CHAR_NAME_SUCCESS)
{
handler->SendSysMessage(LANG_BAD_VALUE);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_BAD_VALUE);
return false;
}
if (sObjectMgr->IsReservedName(newName))
{
handler->SendSysMessage(LANG_RESERVED_NAME);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_RESERVED_NAME);
return false;
}
if (sObjectMgr->IsProfanityName(newName))
{
handler->SendSysMessage(LANG_PROFANITY_NAME);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_PROFANITY_NAME);
return false;
}
@@ -375,8 +370,7 @@ public:
PreparedQueryResult result = CharacterDatabase.Query(stmt);
if (result)
{
handler->PSendSysMessage(LANG_RENAME_PLAYER_ALREADY_EXISTS, newName.c_str());
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_RENAME_PLAYER_ALREADY_EXISTS, newName.c_str());
return false;
}
@@ -539,8 +533,7 @@ public:
player = PlayerIdentifier::FromTargetOrSelf(handler);
if (!player || !player->IsConnected())
{
handler->SendSysMessage(LANG_PLAYER_NOT_FOUND);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_PLAYER_NOT_FOUND);
return false;
}
@@ -605,8 +598,7 @@ public:
// if no characters have been found, output a warning
if (foundList.empty())
{
handler->SendSysMessage(LANG_CHARACTER_DELETED_LIST_EMPTY);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_CHARACTER_DELETED_LIST_EMPTY);
return false;
}
@@ -634,8 +626,7 @@ public:
if (foundList.empty())
{
handler->SendSysMessage(LANG_CHARACTER_DELETED_LIST_EMPTY);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_CHARACTER_DELETED_LIST_EMPTY);
return false;
}
@@ -669,8 +660,7 @@ public:
return true;
}
handler->SendSysMessage(LANG_CHARACTER_DELETED_ERR_RENAME);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_CHARACTER_DELETED_ERR_RENAME);
return false;
}
@@ -692,8 +682,7 @@ public:
if (foundList.empty())
{
handler->SendSysMessage(LANG_CHARACTER_DELETED_LIST_EMPTY);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_CHARACTER_DELETED_LIST_EMPTY);
return false;
}
@@ -794,15 +783,13 @@ public:
// normalize the name if specified and check if it exists
if (!normalizePlayerName(name))
{
handler->PSendSysMessage(LANG_INVALID_CHARACTER_NAME);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_INVALID_CHARACTER_NAME);
return false;
}
if (ObjectMgr::CheckPlayerName(name, true) != CHAR_NAME_SUCCESS)
{
handler->PSendSysMessage(LANG_INVALID_CHARACTER_NAME);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_INVALID_CHARACTER_NAME);
return false;
}
}
@@ -811,8 +798,7 @@ public:
{
if (sCharacterCache->GetCharacterAccountIdByGuid(ObjectGuid(HighGuid::Player, *characterGUID)))
{
handler->PSendSysMessage(LANG_CHARACTER_GUID_IN_USE, *characterGUID);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_CHARACTER_GUID_IN_USE, *characterGUID);
return false;
}
}
@@ -832,20 +818,16 @@ public:
handler->PSendSysMessage(LANG_COMMAND_IMPORT_SUCCESS);
break;
case DUMP_FILE_OPEN_ERROR:
handler->PSendSysMessage(LANG_FILE_OPEN_FAIL, fileName.c_str());
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_FILE_OPEN_FAIL, fileName.c_str());
return false;
case DUMP_FILE_BROKEN:
handler->PSendSysMessage(LANG_DUMP_BROKEN, fileName.c_str());
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_DUMP_BROKEN, fileName.c_str());
return false;
case DUMP_TOO_MANY_CHARS:
handler->PSendSysMessage(LANG_ACCOUNT_CHARACTER_LIST_FULL, account.GetName().c_str(), account.GetID());
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_ACCOUNT_CHARACTER_LIST_FULL, account.GetName().c_str(), account.GetID());
return false;
default:
handler->PSendSysMessage(LANG_COMMAND_IMPORT_FAILED);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_COMMAND_IMPORT_FAILED);
return false;
}
@@ -864,13 +846,11 @@ public:
case DUMP_SUCCESS:
break;
case DUMP_CHARACTER_DELETED:
handler->PSendSysMessage(LANG_COMMAND_EXPORT_DELETED_CHAR);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_COMMAND_EXPORT_DELETED_CHAR);
return false;
case DUMP_FILE_OPEN_ERROR: // this error code should not happen
default:
handler->PSendSysMessage(LANG_COMMAND_EXPORT_FAILED);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_COMMAND_EXPORT_FAILED);
return false;
}
@@ -879,14 +859,12 @@ public:
case DUMP_SUCCESS:
break;
case DUMP_TOO_MANY_CHARS:
handler->PSendSysMessage(LANG_ACCOUNT_CHARACTER_LIST_FULL, account.GetName().c_str(), account.GetID());
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_ACCOUNT_CHARACTER_LIST_FULL, account.GetName().c_str(), account.GetID());
return false;
case DUMP_FILE_OPEN_ERROR: // this error code should not happen
case DUMP_FILE_BROKEN: // this error code should not happen
default:
handler->PSendSysMessage(LANG_COMMAND_IMPORT_FAILED);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_COMMAND_IMPORT_FAILED);
return false;
}
@@ -905,16 +883,13 @@ public:
handler->PSendSysMessage(LANG_COMMAND_EXPORT_SUCCESS);
break;
case DUMP_FILE_OPEN_ERROR:
handler->PSendSysMessage(LANG_FILE_OPEN_FAIL, fileName.c_str());
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_FILE_OPEN_FAIL, fileName.c_str());
return false;
case DUMP_CHARACTER_DELETED:
handler->PSendSysMessage(LANG_COMMAND_EXPORT_DELETED_CHAR);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_COMMAND_EXPORT_DELETED_CHAR);
return false;
default:
handler->PSendSysMessage(LANG_COMMAND_EXPORT_FAILED);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_COMMAND_EXPORT_FAILED);
return false;
}
@@ -1079,8 +1054,7 @@ public:
if (!player)
{
handler->SendSysMessage(LANG_PLAYER_NOT_FOUND);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_PLAYER_NOT_FOUND);
return false;
}
@@ -1088,8 +1062,7 @@ public:
{
if (AccountMgr::GetCharactersCount(accountId) >= 10)
{
handler->PSendSysMessage(LANG_ACCOUNT_CHARACTER_LIST_FULL, accountName, accountId);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_ACCOUNT_CHARACTER_LIST_FULL, accountName, accountId);
return true;
}
@@ -1111,8 +1084,7 @@ public:
}
else
{
handler->PSendSysMessage(LANG_ACCOUNT_NOT_EXIST, accountName);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_ACCOUNT_NOT_EXIST, accountName);
return true;
}

View File

@@ -16,9 +16,9 @@
*/
#include "Chat.h"
#include "CommandScript.h"
#include "Language.h"
#include "Player.h"
#include "ScriptMgr.h"
#include "WorldSession.h"
using namespace Acore::ChatCommands;
@@ -205,8 +205,7 @@ public:
Player* chr = handler->getSelectedPlayer();
if (!chr)
{
handler->SendSysMessage(LANG_NO_CHAR_SELECTED);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_NO_CHAR_SELECTED);
return false;
}

View File

@@ -27,12 +27,14 @@
#include "CellImpl.h"
#include "Channel.h"
#include "Chat.h"
#include "CommandScript.h"
#include "GossipDef.h"
#include "GridNotifiersImpl.h"
#include "LFGMgr.h"
#include "Language.h"
#include "Log.h"
#include "MapMgr.h"
#include "M2Stores.h"
#include "MapMgr.h"
#include "ObjectMgr.h"
#include "PoolMgr.h"
#include "ScriptMgr.h"
@@ -120,8 +122,7 @@ public:
CinematicSequencesEntry const* cineSeq = sCinematicSequencesStore.LookupEntry(cinematicId);
if (!cineSeq)
{
handler->PSendSysMessage(LANG_CINEMATIC_NOT_EXIST, cinematicId);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_CINEMATIC_NOT_EXIST, cinematicId);
return false;
}
@@ -147,8 +148,7 @@ public:
{
if (!sMovieStore.LookupEntry(movieId))
{
handler->PSendSysMessage(LANG_MOVIE_NOT_EXIST, movieId);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_MOVIE_NOT_EXIST, movieId);
return false;
}
@@ -161,8 +161,7 @@ public:
{
if (!sSoundEntriesStore.LookupEntry(soundId))
{
handler->PSendSysMessage(LANG_SOUND_NOT_EXIST, soundId);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_SOUND_NOT_EXIST, soundId);
return false;
}
@@ -171,8 +170,7 @@ public:
Unit* unit = handler->getSelectedUnit();
if (!unit)
{
handler->SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_SELECT_CHAR_OR_CREATURE);
return false;
}
@@ -190,8 +188,7 @@ public:
{
if (!sSoundEntriesStore.LookupEntry(musicId))
{
handler->PSendSysMessage(LANG_SOUND_NOT_EXIST, musicId);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_SOUND_NOT_EXIST, musicId);
return false;
}
@@ -207,8 +204,7 @@ public:
{
if (!visualId)
{
handler->SendSysMessage(LANG_BAD_VALUE);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_BAD_VALUE);
return false;
}
@@ -286,8 +282,7 @@ public:
std::ifstream ifs("opcode.txt");
if (!ifs.is_open())
{
handler->SendSysMessage(LANG_DEBUG_OPCODE_FILE_MISSING);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_DEBUG_OPCODE_FILE_MISSING);
return false;
}
@@ -398,8 +393,7 @@ public:
GameObject* obj = handler->GetNearbyGameObject();
if (!obj)
{
handler->PSendSysMessage(LANG_COMMAND_OBJNOTFOUND, 0);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_COMMAND_OBJNOTFOUND, 0);
ifs.close();
return false;
}
@@ -410,8 +404,7 @@ public:
GameObject* obj = handler->GetNearbyGameObject();
if (!obj)
{
handler->PSendSysMessage(LANG_COMMAND_OBJNOTFOUND, 0);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_COMMAND_OBJNOTFOUND, 0);
ifs.close();
return false;
}
@@ -1036,8 +1029,7 @@ public:
Unit* unit = handler->getSelectedUnit();
if (!unit)
{
handler->SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_SELECT_CHAR_OR_CREATURE);
return false;
}
@@ -1058,8 +1050,7 @@ public:
WorldObject* target = handler->getSelectedObject();
if (!target)
{
handler->SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_SELECT_CHAR_OR_CREATURE);
return false;
}
@@ -1088,8 +1079,7 @@ public:
Unit* target = handler->getSelectedUnit();
if (!target)
{
handler->SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_SELECT_CHAR_OR_CREATURE);
return false;
}
@@ -1138,8 +1128,7 @@ public:
Unit* unit = handler->getSelectedUnit();
if (!unit)
{
handler->SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_SELECT_CHAR_OR_CREATURE);
return false;
}
@@ -1174,8 +1163,7 @@ public:
WorldObject* target = handler->getSelectedObject();
if (!target)
{
handler->SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_SELECT_CHAR_OR_CREATURE);
return false;
}
@@ -1257,11 +1245,21 @@ public:
return true;
}
static bool HandleWPGPSCommand(ChatHandler* handler)
static bool HandleWPGPSCommand(ChatHandler* handler, Optional<std::string> type)
{
Player* player = handler->GetSession()->GetPlayer();
LOG_INFO("sql.dev", "(@PATH, XX, {0:.3f}, {0:.3f}, {0:.5f}, 0,0, 0,100, 0),", player->GetPositionX(), player->GetPositionY(), player->GetPositionZ());
if (!type)
{
// waypoint_data - id, point, X, Y, Z, O, delay, move_type, action, action_chance, wpguid
LOG_INFO("sql.dev", "(@PATH, XX, {:.3f}, {:.3f}, {:.5f}, {:.5f}, 0, 0, 0, 100, 0),", player->GetPositionX(), player->GetPositionY(), player->GetPositionZ(), player->GetOrientation());
}
if (type == "sai")
{
// waypoint (SAI) - entry, pointid, X, Y, Z, O, delay
LOG_INFO("sql.dev", "(@PATH, XX, {:.3f}, {:.3f}, {:.5f}, {:.5f}, 0),", player->GetPositionX(), player->GetPositionY(), player->GetPositionZ(), player->GetOrientation());
}
handler->PSendSysMessage("Waypoint SQL written to SQL Developer log");
return true;

View File

@@ -23,9 +23,9 @@
*/
#include "Chat.h"
#include "CommandScript.h"
#include "Language.h"
#include "Player.h"
#include "ScriptMgr.h"
#include "SpellAuras.h"
using namespace Acore::ChatCommands;
@@ -104,8 +104,7 @@ public:
{
if (!normalizePlayerName(*playerName))
{
handler->SendSysMessage(LANG_PLAYER_NOT_FOUND);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_PLAYER_NOT_FOUND);
return false;
}
@@ -118,8 +117,7 @@ public:
{
if (time)
{
handler->SendSysMessage(LANG_PLAYER_NOT_FOUND);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_PLAYER_NOT_FOUND);
return false;
}
@@ -153,8 +151,7 @@ public:
if (duration == 0)
{
handler->SendSysMessage(LANG_BAD_VALUE);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_BAD_VALUE);
return false;
}
@@ -172,8 +169,7 @@ public:
aura = target->AddAura(deserterSpell, target);
if (!aura)
{
handler->SendSysMessage(LANG_BAD_VALUE);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_BAD_VALUE);
return false;
}
aura->SetDuration(duration * IN_MILLISECONDS);
@@ -250,8 +246,7 @@ public:
if (!player)
{
handler->SendSysMessage(LANG_NO_CHAR_SELECTED);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_NO_CHAR_SELECTED);
return false;
}
@@ -279,15 +274,13 @@ public:
if (duration == 0)
{
handler->PSendSysMessage("Player %s does not have %s Deserter.", handler->playerLink(player->GetName()), isInstance ? "Instance" : "Battleground");
handler->SetSentErrorMessage(true);
handler->SendErrorMessage("Player %s does not have %s Deserter.", handler->playerLink(player->GetName()), isInstance ? "Instance" : "Battleground");
return true;
}
if (duration < 0)
{
handler->PSendSysMessage("Permanent %s Deserter has been removed from player %s (GUID %u).", isInstance ? "Instance" : "Battleground", handler->playerLink(player->GetName()), player->GetGUID().GetCounter());
handler->SetSentErrorMessage(true);
handler->SendErrorMessage("Permanent %s Deserter has been removed from player %s (GUID %u).", isInstance ? "Instance" : "Battleground", handler->playerLink(player->GetName()), player->GetGUID().GetCounter());
return true;
}
@@ -338,8 +331,7 @@ public:
// Optimization. Do not execute any further functions or Queries if remainTime is 0.
if (remainTime == 0)
{
handler->SendSysMessage(LANG_BAD_VALUE);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_BAD_VALUE);
return false;
}

View File

@@ -24,12 +24,12 @@ EndScriptData */
#include "AchievementMgr.h"
#include "Chat.h"
#include "CommandScript.h"
#include "DisableMgr.h"
#include "Language.h"
#include "ObjectMgr.h"
#include "OutdoorPvP.h"
#include "Player.h"
#include "ScriptMgr.h"
#include "SpellMgr.h"
using namespace Acore::ChatCommands;
@@ -81,8 +81,7 @@ public:
{
if (!sSpellMgr->GetSpellInfo(entry))
{
handler->PSendSysMessage(LANG_COMMAND_NOSPELLFOUND);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_COMMAND_NOSPELLFOUND);
return false;
}
disableTypeStr = "spell";
@@ -92,8 +91,7 @@ public:
{
if (!sObjectMgr->GetQuestTemplate(entry))
{
handler->PSendSysMessage(LANG_COMMAND_QUEST_NOTFOUND, entry);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_COMMAND_QUEST_NOTFOUND, entry);
return false;
}
disableTypeStr = "quest";
@@ -103,8 +101,7 @@ public:
{
if (!sMapStore.LookupEntry(entry))
{
handler->PSendSysMessage(LANG_COMMAND_NOMAPFOUND);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_COMMAND_NOMAPFOUND);
return false;
}
disableTypeStr = "map";
@@ -114,8 +111,7 @@ public:
{
if (!sBattlemasterListStore.LookupEntry(entry))
{
handler->PSendSysMessage(LANG_COMMAND_NO_BATTLEGROUND_FOUND);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_COMMAND_NO_BATTLEGROUND_FOUND);
return false;
}
disableTypeStr = "battleground";
@@ -125,8 +121,7 @@ public:
{
if (entry > MAX_OUTDOORPVP_TYPES)
{
handler->PSendSysMessage(LANG_COMMAND_NO_OUTDOOR_PVP_FORUND);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_COMMAND_NO_OUTDOOR_PVP_FORUND);
return false;
}
disableTypeStr = "outdoorpvp";
@@ -136,8 +131,7 @@ public:
{
if (!sMapStore.LookupEntry(entry))
{
handler->PSendSysMessage(LANG_COMMAND_NOMAPFOUND);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_COMMAND_NOMAPFOUND);
return false;
}
disableTypeStr = "vmap";
@@ -154,8 +148,7 @@ public:
PreparedQueryResult result = WorldDatabase.Query(stmt);
if (result)
{
handler->PSendSysMessage("This %s (Id: %u) is already disabled.", disableTypeStr.c_str(), entry);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage("This %s (Id: %u) is already disabled.", disableTypeStr.c_str(), entry);
return false;
}
@@ -242,8 +235,7 @@ public:
PreparedQueryResult result = WorldDatabase.Query(stmt);
if (!result)
{
handler->PSendSysMessage("This %s (Id: %u) is not disabled.", disableTypeStr.c_str(), entry);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage("This %s (Id: %u) is not disabled.", disableTypeStr.c_str(), entry);
return false;
}

View File

@@ -23,11 +23,11 @@
EndScriptData */
#include "Chat.h"
#include "CommandScript.h"
#include "GameEventMgr.h"
#include "GameTime.h"
#include "Language.h"
#include "Player.h"
#include "ScriptMgr.h"
#include "Timer.h"
using namespace Acore::ChatCommands;
@@ -96,16 +96,14 @@ public:
if (std::size_t(eventId) >= events.size())
{
handler->SendSysMessage(LANG_EVENT_NOT_EXIST);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_EVENT_NOT_EXIST);
return false;
}
GameEventData const& eventData = events[eventId];
if (!eventData.isValid())
{
handler->SendSysMessage(LANG_EVENT_NOT_EXIST);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_EVENT_NOT_EXIST);
return false;
}
@@ -136,24 +134,21 @@ public:
if (*eventId < 1 || *eventId >= events.size())
{
handler->SendSysMessage(LANG_EVENT_NOT_EXIST);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_EVENT_NOT_EXIST);
return false;
}
GameEventData const& eventData = events[eventId];
if (!eventData.isValid())
{
handler->SendSysMessage(LANG_EVENT_NOT_EXIST);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_EVENT_NOT_EXIST);
return false;
}
GameEventMgr::ActiveEvents const& activeEvents = sGameEventMgr->GetActiveEventList();
if (activeEvents.find(eventId) != activeEvents.end())
{
handler->PSendSysMessage(LANG_EVENT_ALREADY_ACTIVE, uint16(eventId), eventData.description.c_str());
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_EVENT_ALREADY_ACTIVE, uint16(eventId), eventData.description.c_str());
return false;
}
@@ -168,16 +163,14 @@ public:
if (*eventId < 1 || *eventId >= events.size())
{
handler->SendSysMessage(LANG_EVENT_NOT_EXIST);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_EVENT_NOT_EXIST);
return false;
}
GameEventData const& eventData = events[eventId];
if (!eventData.isValid())
{
handler->SendSysMessage(LANG_EVENT_NOT_EXIST);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_EVENT_NOT_EXIST);
return false;
}
@@ -185,8 +178,7 @@ public:
if (activeEvents.find(eventId) == activeEvents.end())
{
handler->PSendSysMessage(LANG_EVENT_NOT_ACTIVE, uint16(eventId), eventData.description.c_str());
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_EVENT_NOT_ACTIVE, uint16(eventId), eventData.description.c_str());
return false;
}

View File

@@ -16,10 +16,10 @@
*/
#include "Chat.h"
#include "CommandScript.h"
#include "Language.h"
#include "Log.h"
#include "Player.h"
#include "ScriptMgr.h"
#include "WorldSession.h"
using namespace Acore::ChatCommands;

View File

@@ -24,13 +24,13 @@ EndScriptData */
#include "AccountMgr.h"
#include "Chat.h"
#include "CommandScript.h"
#include "DatabaseEnv.h"
#include "Language.h"
#include "ObjectAccessor.h"
#include "Opcodes.h"
#include "Player.h"
#include "Realm.h"
#include "ScriptMgr.h"
#include "World.h"
#include "WorldSession.h"
@@ -88,8 +88,7 @@ public:
}
}
handler->SendSysMessage(LANG_USE_BOL);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_USE_BOL);
return false;
}

View File

@@ -23,14 +23,17 @@ Category: commandscripts
EndScriptData */
#include "Chat.h"
#include "CommandScript.h"
#include "GameGraveyard.h"
#include "Language.h"
#include "MapMgr.h"
#include "ObjectMgr.h"
#include "Player.h"
#include "ScriptMgr.h"
#include "TicketMgr.h"
#include "boost/algorithm/string.hpp"
#include <regex>
using namespace Acore::ChatCommands;
class go_commandscript : public CommandScript
@@ -44,6 +47,7 @@ public:
{
{ "creature", HandleGoCreatureSpawnIdCommand, SEC_MODERATOR, Console::No },
{ "creature id", HandleGoCreatureCIdCommand, SEC_MODERATOR, Console::No },
{ "creature name", HandleGoCreatureNameCommand, SEC_MODERATOR, Console::No },
{ "gameobject", HandleGoGameObjectSpawnIdCommand, SEC_MODERATOR, Console::No },
{ "gameobject id", HandleGoGameObjectGOIdCommand, SEC_MODERATOR, Console::No },
{ "graveyard", HandleGoGraveyardCommand, SEC_MODERATOR, Console::No },
@@ -71,8 +75,7 @@ public:
mapId = player->GetMapId();
if (!MapMgr::IsValidMapCoord(mapId, pos) || sObjectMgr->IsTransportMap(mapId))
{
handler->PSendSysMessage(LANG_INVALID_TARGET_COORD, pos.GetPositionX(), pos.GetPositionY(), mapId);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_INVALID_TARGET_COORD, pos.GetPositionX(), pos.GetPositionY(), mapId);
return false;
}
@@ -96,8 +99,7 @@ public:
if (!spawnpoint)
{
handler->SendSysMessage(LANG_COMMAND_GOCREATNOTFOUND);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_COMMAND_GOCREATNOTFOUND);
return false;
}
@@ -109,8 +111,30 @@ public:
CreatureData const* spawnpoint = sObjectMgr->GetCreatureData(spawnId);
if (!spawnpoint)
{
handler->SendSysMessage(LANG_COMMAND_GOCREATNOTFOUND);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_COMMAND_GOCREATNOTFOUND);
return false;
}
return DoTeleport(handler, { spawnpoint->posX, spawnpoint->posY, spawnpoint->posZ }, spawnpoint->mapid);
}
static bool HandleGoCreatureNameCommand(ChatHandler* handler, Tail name)
{
if (!name.data())
return false;
QueryResult result = WorldDatabase.Query("SELECT entry FROM creature_template WHERE name = \"{}\" LIMIT 1" , name.data());
if (!result)
{
handler->SendErrorMessage(LANG_COMMAND_GOCREATNOTFOUND);
return false;
}
uint32 entry = result->Fetch()[0].Get<uint32>();
CreatureData const* spawnpoint = GetCreatureData(handler, entry);
if (!spawnpoint)
{
handler->SendErrorMessage(LANG_COMMAND_GOCREATNOTFOUND);
return false;
}
@@ -122,8 +146,7 @@ public:
GameObjectData const* spawnpoint = sObjectMgr->GetGameObjectData(spawnId);
if (!spawnpoint)
{
handler->SendSysMessage(LANG_COMMAND_GOOBJNOTFOUND);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_COMMAND_GOOBJNOTFOUND);
return false;
}
@@ -136,8 +159,7 @@ public:
if (!spawnpoint)
{
handler->SendSysMessage(LANG_COMMAND_GOOBJNOTFOUND);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_COMMAND_GOOBJNOTFOUND);
return false;
}
@@ -149,15 +171,13 @@ public:
GraveyardStruct const* gy = sGraveyard->GetGraveyard(gyId);
if (!gy)
{
handler->PSendSysMessage(LANG_COMMAND_GRAVEYARDNOEXIST, gyId);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_COMMAND_GRAVEYARDNOEXIST, gyId);
return false;
}
if (!MapMgr::IsValidMapCoord(gy->Map, gy->x, gy->y, gy->z))
{
handler->PSendSysMessage(LANG_INVALID_TARGET_COORD, gy->x, gy->y, gy->Map);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_INVALID_TARGET_COORD, gy->x, gy->y, gy->Map);
return false;
}
@@ -188,8 +208,7 @@ public:
if (!MapMgr::IsValidMapCoord(mapId, x, y))
{
handler->PSendSysMessage(LANG_INVALID_TARGET_COORD, x, y, mapId);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_INVALID_TARGET_COORD, x, y, mapId);
return false;
}
@@ -215,8 +234,7 @@ public:
TaxiNodesEntry const* node = sTaxiNodesStore.LookupEntry(nodeId);
if (!node)
{
handler->PSendSysMessage(LANG_COMMAND_GOTAXINODENOTFOUND, uint32(nodeId));
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_COMMAND_GOTAXINODENOTFOUND, uint32(nodeId));
return false;
}
return DoTeleport(handler, { node->x, node->y, node->z }, node->map_id);
@@ -227,8 +245,7 @@ public:
AreaTrigger const* at = sObjectMgr->GetAreaTrigger(areaTriggerId);
if (!at)
{
handler->PSendSysMessage(LANG_COMMAND_GOAREATRNOTFOUND, uint32(areaTriggerId));
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_COMMAND_GOAREATRNOTFOUND, uint32(areaTriggerId));
return false;
}
return DoTeleport(handler, { at->x, at->y, at->z }, at->map);
@@ -245,8 +262,7 @@ public:
if (x < 0 || x > 100 || y < 0 || y > 100 || !areaEntry)
{
handler->PSendSysMessage(LANG_INVALID_ZONE_COORD, x, y, areaId);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_INVALID_ZONE_COORD, x, y, areaId);
return false;
}
@@ -258,8 +274,7 @@ public:
if (map->Instanceable())
{
handler->PSendSysMessage(LANG_INVALID_ZONE_MAP, areaEntry->ID, areaEntry->area_name[handler->GetSessionDbcLocale()], map->GetId(), map->GetMapName());
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_INVALID_ZONE_MAP, areaEntry->ID, areaEntry->area_name[handler->GetSessionDbcLocale()], map->GetId(), map->GetMapName());
return false;
}
@@ -267,8 +282,7 @@ public:
if (!MapMgr::IsValidMapCoord(zoneEntry->mapid, x, y))
{
handler->PSendSysMessage(LANG_INVALID_TARGET_COORD, x, y, zoneEntry->mapid);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_INVALID_TARGET_COORD, x, y, zoneEntry->mapid);
return false;
}
@@ -288,34 +302,75 @@ public:
return true;
}
//teleport at coordinates, including Z and orientation
static bool HandleGoXYZCommand(ChatHandler* handler, float x, float y, Optional<float> z, Optional<uint32> id, Optional<float> o)
/**
* @brief Teleports the GM to the specified world coordinates, optionally specifying map ID and orientation.
*
* @param handler The ChatHandler that is handling the command.
* @param args The coordinates to teleport to in format "x y z [mapId [orientation]]".
* @return true The command was successful.
* @return false The command was unsuccessful (show error or syntax)
*/
static bool HandleGoXYZCommand(ChatHandler* handler, Tail args)
{
std::wstring wInputCoords;
if (!Utf8toWStr(args, wInputCoords))
{
return false;
}
// extract float and integer values from the input
std::vector<float> locationValues;
std::wregex floatRegex(L"(-?\\d+(?:\\.\\d+)?)");
std::wsregex_iterator floatRegexIterator(wInputCoords.begin(), wInputCoords.end(), floatRegex);
std::wsregex_iterator end;
while (floatRegexIterator != end)
{
std::wsmatch match = *floatRegexIterator;
std::wstring matchStr = match.str();
// try to convert the match to a float
try
{
locationValues.push_back(std::stof(matchStr));
}
// if the match is not a float, do not add it to the vector
catch (std::invalid_argument const&){}
++floatRegexIterator;
}
// X and Y are required
if (locationValues.size() < 2)
{
return false;
}
Player* player = handler->GetSession()->GetPlayer();
uint32 mapId = id.value_or(player->GetMapId());
if (z)
uint32 mapId = locationValues.size() >= 4 ? uint32(locationValues[3]) : player->GetMapId();
float x = locationValues[0];
float y = locationValues[1];
if (!sMapStore.LookupEntry(mapId))
{
if (!MapMgr::IsValidMapCoord(mapId, x, y, *z))
{
handler->PSendSysMessage(LANG_INVALID_TARGET_COORD, x, y, mapId);
handler->SetSentErrorMessage(true);
return false;
}
}
else
{
if (!MapMgr::IsValidMapCoord(mapId, x, y))
{
handler->PSendSysMessage(LANG_INVALID_TARGET_COORD, x, y, mapId);
handler->SetSentErrorMessage(true);
return false;
}
Map const* map = sMapMgr->CreateBaseMap(mapId);
z = std::max(map->GetHeight(x, y, MAX_HEIGHT), map->GetWaterLevel(x, y));
handler->SendErrorMessage(LANG_INVALID_TARGET_COORD, x, y, mapId);
return false;
}
return DoTeleport(handler, { x, y, *z, o.value_or(0.0f) }, mapId);
Map const* map = sMapMgr->CreateBaseMap(mapId);
float z = locationValues.size() >= 3 ? locationValues[2] : std::max(map->GetHeight(x, y, MAX_HEIGHT), map->GetWaterLevel(x, y));
// map ID (locationValues[3]) already handled above
float o = locationValues.size() >= 5 ? locationValues[4] : player->GetOrientation();
if (!MapMgr::IsValidMapCoord(mapId, x, y, z, o))
{
handler->SendErrorMessage(LANG_INVALID_TARGET_COORD, x, y, mapId);
return false;
}
return DoTeleport(handler, { x, y, z, o }, mapId);
}
static bool HandleGoTicketCommand(ChatHandler* handler, uint32 ticketId)
@@ -358,8 +413,7 @@ public:
CreatureData const* spawnpoint = GetCreatureData(handler, itr->first);
if (!spawnpoint)
{
handler->SendSysMessage(LANG_COMMAND_GOCREATNOTFOUND);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_COMMAND_GOCREATNOTFOUND);
return false;
}
@@ -377,8 +431,7 @@ public:
GameObjectData const* spawnpoint = GetGameObjectData(handler, itr->first);
if (!spawnpoint)
{
handler->SendSysMessage(LANG_COMMAND_GOOBJNOTFOUND);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_COMMAND_GOOBJNOTFOUND);
return false;
}
@@ -397,8 +450,7 @@ public:
CreatureData const* spawnpoint = GetCreatureData(handler, itr->first);
if (!spawnpoint)
{
handler->SendSysMessage(LANG_COMMAND_GOCREATNOTFOUND);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_COMMAND_GOCREATNOTFOUND);
return false;
}
@@ -416,8 +468,7 @@ public:
GameObjectData const* spawnpoint = GetGameObjectData(handler, itr->first);
if (!spawnpoint)
{
handler->SendSysMessage(LANG_COMMAND_GOOBJNOTFOUND);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_COMMAND_GOOBJNOTFOUND);
return false;
}
@@ -427,8 +478,7 @@ public:
}
else
{
handler->SendSysMessage(LANG_CMD_GOQUEST_INVALID_SYNTAX);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_CMD_GOQUEST_INVALID_SYNTAX);
return false;
}

View File

@@ -23,6 +23,7 @@ Category: commandscripts
EndScriptData */
#include "Chat.h"
#include "CommandScript.h"
#include "GameEventMgr.h"
#include "GameObject.h"
#include "GameTime.h"
@@ -32,7 +33,6 @@ EndScriptData */
#include "Opcodes.h"
#include "Player.h"
#include "PoolMgr.h"
#include "ScriptMgr.h"
#include "Transport.h"
using namespace Acore::ChatCommands;
@@ -73,8 +73,7 @@ public:
GameObject* object = handler->GetObjectFromPlayerMapByDbGuid(guidLow);
if (!object)
{
handler->PSendSysMessage(LANG_COMMAND_OBJNOTFOUND, uint32(guidLow));
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_COMMAND_OBJNOTFOUND, uint32(guidLow));
return false;
}
@@ -98,8 +97,7 @@ public:
GameObjectTemplate const* objectInfo = sObjectMgr->GetGameObjectTemplate(objectId);
if (!objectInfo)
{
handler->PSendSysMessage(LANG_GAMEOBJECT_NOT_EXIST, uint32(objectId));
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_GAMEOBJECT_NOT_EXIST, uint32(objectId));
return false;
}
@@ -107,8 +105,7 @@ public:
{
// report to DB errors log as in loading case
LOG_ERROR("sql.sql", "Gameobject (Entry {} GoType: {}) have invalid displayId ({}), not spawned.", *objectId, objectInfo->type, objectInfo->displayId);
handler->PSendSysMessage(LANG_GAMEOBJECT_HAVE_INVALID_DATA, uint32(objectId));
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_GAMEOBJECT_HAVE_INVALID_DATA, uint32(objectId));
return false;
}
@@ -162,8 +159,7 @@ public:
if (!sObjectMgr->GetGameObjectTemplate(objectId))
{
handler->PSendSysMessage(LANG_GAMEOBJECT_NOT_EXIST, uint32(objectId));
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_GAMEOBJECT_NOT_EXIST, uint32(objectId));
return false;
}
@@ -299,8 +295,7 @@ public:
GameObject* object = handler->GetObjectFromPlayerMapByDbGuid(spawnId);
if (!object)
{
handler->PSendSysMessage(LANG_COMMAND_OBJNOTFOUND, uint32(spawnId));
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_COMMAND_OBJNOTFOUND, uint32(spawnId));
return false;
}
@@ -310,8 +305,7 @@ public:
Unit* owner = ObjectAccessor::GetUnit(*handler->GetSession()->GetPlayer(), ownerGuid);
if (!owner || !ownerGuid.IsPlayer())
{
handler->PSendSysMessage(LANG_COMMAND_DELOBJREFERCREATURE, ownerGuid.GetCounter(), object->GetSpawnId());
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_COMMAND_DELOBJREFERCREATURE, ownerGuid.GetCounter(), object->GetSpawnId());
return false;
}
@@ -336,8 +330,7 @@ public:
GameObject* object = handler->GetObjectFromPlayerMapByDbGuid(guidLow);
if (!object)
{
handler->PSendSysMessage(LANG_COMMAND_OBJNOTFOUND, uint32(guidLow));
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_COMMAND_OBJNOTFOUND, uint32(guidLow));
return false;
}
@@ -375,8 +368,7 @@ public:
GameObject* object = handler->GetObjectFromPlayerMapByDbGuid(guidLow);
if (!object)
{
handler->PSendSysMessage(LANG_COMMAND_OBJNOTFOUND, uint32(guidLow));
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_COMMAND_OBJNOTFOUND, uint32(guidLow));
return false;
}
@@ -386,8 +378,7 @@ public:
pos = { (*xyz)[0], (*xyz)[1], (*xyz)[2] };
if (!MapMgr::IsValidMapCoord(object->GetMapId(), pos))
{
handler->PSendSysMessage(LANG_INVALID_TARGET_COORD, pos.GetPositionX(), pos.GetPositionY(), object->GetMapId());
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_INVALID_TARGET_COORD, pos.GetPositionX(), pos.GetPositionY(), object->GetMapId());
return false;
}
}
@@ -432,15 +423,13 @@ public:
GameObject* object = handler->GetObjectFromPlayerMapByDbGuid(guidLow);
if (!object)
{
handler->PSendSysMessage(LANG_COMMAND_OBJNOTFOUND, uint32(guidLow));
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_COMMAND_OBJNOTFOUND, uint32(guidLow));
return false;
}
if (!phaseMask)
{
handler->SendSysMessage(LANG_BAD_VALUE);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_BAD_VALUE);
return false;
}
@@ -512,8 +501,7 @@ public:
GameObjectData const* spawnData = sObjectMgr->GetGameObjectData(spawnId);
if (!spawnData)
{
handler->PSendSysMessage(LANG_COMMAND_OBJNOTFOUND, spawnId);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_COMMAND_OBJNOTFOUND, spawnId);
return false;
}
entry = spawnData->id;
@@ -527,8 +515,7 @@ public:
GameObjectTemplate const* gameObjectInfo = sObjectMgr->GetGameObjectTemplate(entry);
if (!gameObjectInfo)
{
handler->PSendSysMessage(LANG_GAMEOBJECT_NOT_EXIST, entry);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_GAMEOBJECT_NOT_EXIST, entry);
return false;
}
@@ -541,6 +528,8 @@ public:
lootId = gameObjectInfo->fishinghole.lootId;
handler->PSendSysMessage(LANG_GOINFO_ENTRY, entry);
if (gameObject)
handler->PSendSysMessage("GUID: %u", gameObject->GetGUID().GetCounter());
handler->PSendSysMessage(LANG_GOINFO_TYPE, type);
handler->PSendSysMessage(LANG_GOINFO_LOOTID, lootId);
handler->PSendSysMessage(LANG_GOINFO_DISPLAYID, displayId);
@@ -567,8 +556,7 @@ public:
GameObject* object = handler->GetObjectFromPlayerMapByDbGuid(guidLow);
if (!object)
{
handler->PSendSysMessage(LANG_COMMAND_OBJNOTFOUND, uint32(guidLow));
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_COMMAND_OBJNOTFOUND, uint32(guidLow));
return false;
}

View File

@@ -16,11 +16,11 @@
*/
#include "Chat.h"
#include "CommandScript.h"
#include "DatabaseEnv.h"
#include "GroupMgr.h"
#include "Language.h"
#include "Player.h"
#include "ScriptMgr.h"
using namespace Acore::ChatCommands;

View File

@@ -23,9 +23,9 @@ Category: commandscripts
EndScriptData */
#include "Chat.h"
#include "CommandScript.h"
#include "Guild.h"
#include "GuildMgr.h"
#include "ScriptMgr.h"
using namespace Acore::ChatCommands;
@@ -53,7 +53,7 @@ public:
return commandTable;
}
static bool HandleGuildCreateCommand(ChatHandler* handler, Optional<PlayerIdentifier> target, std::string_view guildName)
static bool HandleGuildCreateCommand(ChatHandler* handler, Optional<PlayerIdentifier> target, QuotedString guildName)
{
if (!target)
{
@@ -62,8 +62,12 @@ public:
if (!target || !target->IsConnected())
{
handler->SendSysMessage(LANG_PLAYER_NOT_FOUND);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_PLAYER_NOT_FOUND);
return false;
}
if (guildName.empty())
{
return false;
}
@@ -71,22 +75,19 @@ public:
if (playerTarget->GetGuildId())
{
handler->SendSysMessage(LANG_PLAYER_IN_GUILD);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_PLAYER_IN_GUILD);
return false;
}
if (sGuildMgr->GetGuildByName(guildName))
{
handler->SendSysMessage(LANG_GUILD_RENAME_ALREADY_EXISTS);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_GUILD_RENAME_ALREADY_EXISTS);
return false;
}
if (sObjectMgr->IsReservedName(guildName) || sObjectMgr->IsProfanityName(guildName) || !sObjectMgr->IsValidCharterName(guildName))
{
handler->SendSysMessage(LANG_BAD_VALUE);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_BAD_VALUE);
return false;
}
@@ -94,8 +95,7 @@ public:
if (!guild->Create(playerTarget, guildName))
{
delete guild;
handler->SendSysMessage(LANG_GUILD_NOT_CREATED);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_GUILD_NOT_CREATED);
return false;
}
@@ -104,7 +104,7 @@ public:
return true;
}
static bool HandleGuildDeleteCommand(ChatHandler*, std::string_view guildName)
static bool HandleGuildDeleteCommand(ChatHandler*, QuotedString guildName)
{
if (guildName.empty())
{
@@ -121,7 +121,7 @@ public:
return true;
}
static bool HandleGuildInviteCommand(ChatHandler* handler, Optional<PlayerIdentifier> target, std::string_view guildName)
static bool HandleGuildInviteCommand(ChatHandler* handler, Optional<PlayerIdentifier> target, QuotedString guildName)
{
if (!target)
{
@@ -133,6 +133,11 @@ public:
return false;
}
if (guildName.empty())
{
return false;
}
Guild* targetGuild = sGuildMgr->GetGuildByName(guildName);
if (!targetGuild)
return false;
@@ -186,14 +191,9 @@ public:
return targetGuild->ChangeMemberRank(player->GetGUID(), rank);
}
static bool HandleGuildRenameCommand(ChatHandler* handler, std::string_view oldGuildStr, std::string_view newGuildStr)
static bool HandleGuildRenameCommand(ChatHandler* handler, QuotedString oldGuildStr, QuotedString newGuildStr)
{
if (!oldGuildStr.empty())
{
return false;
}
if (newGuildStr.empty())
if (oldGuildStr.empty() || newGuildStr.empty())
{
return false;
}
@@ -201,22 +201,19 @@ public:
Guild* guild = sGuildMgr->GetGuildByName(oldGuildStr);
if (!guild)
{
handler->PSendSysMessage(LANG_COMMAND_COULDNOTFIND, oldGuildStr);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_COMMAND_COULDNOTFIND, oldGuildStr);
return false;
}
if (sGuildMgr->GetGuildByName(newGuildStr))
{
handler->PSendSysMessage(LANG_GUILD_RENAME_ALREADY_EXISTS, newGuildStr);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_GUILD_RENAME_ALREADY_EXISTS, newGuildStr);
return false;
}
if (!guild->SetName(newGuildStr))
{
handler->SendSysMessage(LANG_BAD_VALUE);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_BAD_VALUE);
return false;
}
@@ -224,7 +221,7 @@ public:
return true;
}
static bool HandleGuildInfoCommand(ChatHandler* handler, Optional<Variant<ObjectGuid::LowType, std::string_view>> const& guildIdentifier)
static bool HandleGuildInfoCommand(ChatHandler* handler, Optional<Variant<ObjectGuid::LowType, QuotedString>> const& guildIdentifier)
{
Guild* guild = nullptr;
@@ -233,7 +230,7 @@ public:
if (ObjectGuid::LowType const* guid = std::get_if<ObjectGuid::LowType>(&*guildIdentifier))
guild = sGuildMgr->GetGuildById(*guid);
else
guild = sGuildMgr->GetGuildByName(guildIdentifier->get<std::string_view>());
guild = sGuildMgr->GetGuildByName(guildIdentifier->get<QuotedString>());
}
else if (Optional<PlayerIdentifier> target = PlayerIdentifier::FromTargetOrSelf(handler); target && target->IsConnected())
guild = target->GetConnectedPlayer()->GetGuild();

View File

@@ -23,9 +23,9 @@ Category: commandscripts
EndScriptData */
#include "Chat.h"
#include "CommandScript.h"
#include "Language.h"
#include "Player.h"
#include "ScriptMgr.h"
#include "WorldSession.h"
using namespace Acore::ChatCommands;
@@ -61,8 +61,7 @@ public:
Player* target = handler->getSelectedPlayer();
if (!target)
{
handler->SendSysMessage(LANG_PLAYER_NOT_FOUND);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_PLAYER_NOT_FOUND);
return false;
}
@@ -79,8 +78,7 @@ public:
Unit* target = handler->getSelectedUnit();
if (!target)
{
handler->SendSysMessage(LANG_PLAYER_NOT_FOUND);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_PLAYER_NOT_FOUND);
return false;
}
@@ -98,8 +96,7 @@ public:
Player* target = handler->getSelectedPlayer();
if (!target)
{
handler->SendSysMessage(LANG_PLAYER_NOT_FOUND);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_PLAYER_NOT_FOUND);
return false;
}

View File

@@ -23,6 +23,7 @@
EndScriptData */
#include "Chat.h"
#include "CommandScript.h"
#include "GameTime.h"
#include "Group.h"
#include "InstanceSaveMgr.h"
@@ -31,7 +32,6 @@
#include "MapMgr.h"
#include "ObjectAccessor.h"
#include "Player.h"
#include "ScriptMgr.h"
using namespace Acore::ChatCommands;
@@ -139,9 +139,7 @@ public:
arena = 0;
spectators = 0;
sMapMgr->GetNumPlayersInInstances(dungeon, battleground, arena, spectators);
handler->PSendSysMessage("players in instances: dungeons (%d), battlegrounds (%d), arenas (%d + %d spect)", dungeon, battleground, arena, spectators);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage("players in instances: dungeons (%d), battlegrounds (%d), arenas (%d + %d spect)", dungeon, battleground, arena, spectators);
return false;
}
@@ -151,15 +149,13 @@ public:
Map* map = player->GetMap();
if (!map->IsDungeon())
{
handler->PSendSysMessage("Map is not a dungeon.");
handler->SetSentErrorMessage(true);
handler->SendErrorMessage("Map is not a dungeon.");
return false;
}
if (!map->ToInstanceMap()->GetInstanceScript())
{
handler->PSendSysMessage("Map has no instance data.");
handler->SetSentErrorMessage(true);
handler->SendErrorMessage("Map has no instance data.");
return false;
}
@@ -173,8 +169,7 @@ public:
// Character name must be provided when using this from console.
if (!player && !handler->GetSession())
{
handler->PSendSysMessage(LANG_CMD_SYNTAX);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_CMD_SYNTAX);
return false;
}
@@ -183,31 +178,27 @@ public:
if (!player->IsConnected())
{
handler->PSendSysMessage(LANG_PLAYER_NOT_FOUND);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_PLAYER_NOT_FOUND);
return false;
}
InstanceMap* map = player->GetConnectedPlayer()->GetMap()->ToInstanceMap();
if (!map)
{
handler->PSendSysMessage(LANG_NOT_DUNGEON);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_NOT_DUNGEON);
return false;
}
if (!map->GetInstanceScript())
{
handler->PSendSysMessage(LANG_NO_INSTANCE_DATA);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_NO_INSTANCE_DATA);
return false;
}
// Reject improper values.
if (encounterId > map->GetInstanceScript()->GetEncounterCount())
{
handler->PSendSysMessage(LANG_BAD_VALUE);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_BAD_VALUE);
return false;
}
@@ -222,8 +213,7 @@ public:
// Character name must be provided when using this from console.
if (!player && !handler->GetSession())
{
handler->PSendSysMessage(LANG_CMD_SYNTAX);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_CMD_SYNTAX);
return false;
}
@@ -232,30 +222,26 @@ public:
if (!player->IsConnected())
{
handler->PSendSysMessage(LANG_PLAYER_NOT_FOUND);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_PLAYER_NOT_FOUND);
return false;
}
InstanceMap* map = player->GetConnectedPlayer()->GetMap()->ToInstanceMap();
if (!map)
{
handler->PSendSysMessage(LANG_NOT_DUNGEON);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_NOT_DUNGEON);
return false;
}
if (!map->GetInstanceScript())
{
handler->PSendSysMessage(LANG_NO_INSTANCE_DATA);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_NO_INSTANCE_DATA);
return false;
}
if (encounterId > map->GetInstanceScript()->GetEncounterCount())
{
handler->PSendSysMessage(LANG_BAD_VALUE);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_BAD_VALUE);
return false;
}

View File

@@ -16,9 +16,9 @@
*/
#include "Chat.h"
#include "CommandScript.h"
#include "Language.h"
#include "Player.h"
#include "ScriptMgr.h"
#include "WorldSession.h"
constexpr std::array<const char*, MAX_ITEM_SUBCLASS_CONTAINER> bagSpecsToString =
@@ -91,16 +91,14 @@ public:
if (!player)
{
handler->SendSysMessage(LANG_PLAYER_NOT_FOUND);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_PLAYER_NOT_FOUND);
return false;
}
Player* target = player->GetConnectedPlayer();
if (!target)
{
handler->SendSysMessage(LANG_PLAYER_NOT_FOUND);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_PLAYER_NOT_FOUND);
return false;
}

View File

@@ -23,12 +23,12 @@ Category: commandscripts
EndScriptData */
#include "Chat.h"
#include "CommandScript.h"
#include "DBCStores.h"
#include "DatabaseEnv.h"
#include "Language.h"
#include "ObjectMgr.h"
#include "Player.h"
#include "ScriptMgr.h"
using namespace Acore::ChatCommands;
@@ -66,8 +66,7 @@ public:
if (!HasItemDeletionConfig())
{
handler->SendSysMessage(LANG_COMMAND_DISABLED);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_COMMAND_DISABLED);
return false;
}
@@ -78,8 +77,7 @@ public:
if (!fields || !(*fields)[1].Get<uint32>() || (*fields)[3].Get<uint32>() != player.GetGUID().GetCounter())
{
handler->SendSysMessage(LANG_ITEM_RESTORE_MISSING);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_ITEM_RESTORE_MISSING);
return false;
}
@@ -124,8 +122,7 @@ public:
{
if (!HasItemDeletionConfig())
{
handler->SendSysMessage(LANG_COMMAND_DISABLED);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_COMMAND_DISABLED);
return false;
}
@@ -135,8 +132,7 @@ public:
if (!disposedItems)
{
handler->SendSysMessage(LANG_ITEM_RESTORE_LIST_EMPTY);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_ITEM_RESTORE_LIST_EMPTY);
return false;
}
@@ -189,8 +185,7 @@ public:
ItemExtendedCostEntry const* iece = sItemExtendedCostStore.LookupEntry(extendedCost);
if (!iece)
{
handler->PSendSysMessage(LANG_CMD_ITEM_REFUND_BAD_EXTENDED_COST);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_CMD_ITEM_REFUND_BAD_EXTENDED_COST);
return false;
}
@@ -198,8 +193,7 @@ public:
if (!item)
{
handler->PSendSysMessage(LANG_COMMAND_ITEMIDINVALID, itemId);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_COMMAND_ITEMIDINVALID, itemId);
return false;
}
@@ -207,8 +201,7 @@ public:
{
if (!target->HasItemCount(itemId, 1, true))
{
handler->PSendSysMessage(LANG_CMD_ITEM_REFUND_NOT_FOUND, itemId);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_CMD_ITEM_REFUND_NOT_FOUND, itemId);
return false;
}
@@ -217,9 +210,8 @@ public:
uint32 honor = target->GetHonorPoints() + iece->reqhonorpoints;
if (honor > sWorld->getIntConfig(CONFIG_MAX_HONOR_POINTS))
{
handler->PSendSysMessage(LANG_CMD_ITEM_REFUND_MAX_HONOR, item->Name1, item->ItemId, sWorld->getIntConfig(CONFIG_MAX_HONOR_POINTS), target->GetHonorPoints(), iece->reqhonorpoints);
handler->SendErrorMessage(LANG_CMD_ITEM_REFUND_MAX_HONOR, item->Name1, item->ItemId, sWorld->getIntConfig(CONFIG_MAX_HONOR_POINTS), target->GetHonorPoints(), iece->reqhonorpoints);
ChatHandler(target->GetSession()).PSendSysMessage(LANG_CMD_ITEM_REFUND_HONOR_FAILED, item->Name1);
handler->SetSentErrorMessage(true);
return false;
}
@@ -233,9 +225,8 @@ public:
uint32 arenapoints = target->GetArenaPoints() + iece->reqarenapoints;
if (arenapoints > sWorld->getIntConfig(CONFIG_MAX_ARENA_POINTS))
{
handler->PSendSysMessage(LANG_CMD_ITEM_REFUND_MAX_AP, item->Name1, item->ItemId, sWorld->getIntConfig(CONFIG_MAX_ARENA_POINTS), target->GetArenaPoints(), iece->reqarenapoints);
handler->SendErrorMessage(LANG_CMD_ITEM_REFUND_MAX_AP, item->Name1, item->ItemId, sWorld->getIntConfig(CONFIG_MAX_ARENA_POINTS), target->GetArenaPoints(), iece->reqarenapoints);
ChatHandler(target->GetSession()).PSendSysMessage(LANG_CMD_ITEM_REFUND_AP_FAILED, item->Name1);
handler->SetSentErrorMessage(true);
return false;
}
@@ -284,8 +275,7 @@ public:
Field* fields = queryResult->Fetch();
if ((fields[0].Get<uint32>() + iece->reqhonorpoints) > sWorld->getIntConfig(CONFIG_MAX_HONOR_POINTS))
{
handler->PSendSysMessage(LANG_CMD_ITEM_REFUND_MAX_HONOR, item->Name1, item->ItemId, sWorld->getIntConfig(CONFIG_MAX_HONOR_POINTS), fields[0].Get<uint32>(), iece->reqhonorpoints);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_CMD_ITEM_REFUND_MAX_HONOR, item->Name1, item->ItemId, sWorld->getIntConfig(CONFIG_MAX_HONOR_POINTS), fields[0].Get<uint32>(), iece->reqhonorpoints);
return false;
}
}
@@ -309,8 +299,7 @@ public:
Field* fields = queryResult->Fetch();
if ((fields[0].Get<uint32>() + iece->reqhonorpoints) > sWorld->getIntConfig(CONFIG_MAX_ARENA_POINTS))
{
handler->PSendSysMessage(LANG_CMD_ITEM_REFUND_MAX_AP, item->Name1, item->ItemId, sWorld->getIntConfig(CONFIG_MAX_ARENA_POINTS), fields[0].Get<uint32>(), iece->reqarenapoints);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_CMD_ITEM_REFUND_MAX_AP, item->Name1, item->ItemId, sWorld->getIntConfig(CONFIG_MAX_ARENA_POINTS), fields[0].Get<uint32>(), iece->reqarenapoints);
return false;
}
}
@@ -369,8 +358,7 @@ public:
}
else
{
handler->PSendSysMessage(LANG_CMD_ITEM_REFUND_NOT_FOUND, itemId);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_CMD_ITEM_REFUND_NOT_FOUND, itemId);
return false;
}
}

View File

@@ -22,12 +22,12 @@ Comment: All learn related commands
Category: commandscripts
EndScriptData */
#include "CommandScript.h"
#include "Language.h"
#include "ObjectMgr.h"
#include "Pet.h"
#include "Player.h"
#include "PlayerCommand.h"
#include "ScriptMgr.h"
#include "SpellInfo.h"
#include "SpellMgr.h"
@@ -78,8 +78,7 @@ public:
if (!targetPlayer)
{
handler->SendSysMessage(LANG_PLAYER_NOT_FOUND);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_PLAYER_NOT_FOUND);
return false;
}
@@ -212,31 +211,27 @@ public:
Pet* pet = player->GetPet();
if (!pet)
{
handler->SendSysMessage(LANG_NO_PET_FOUND);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_NO_PET_FOUND);
return false;
}
CreatureTemplate const* creatureInfo = pet->GetCreatureTemplate();
if (!creatureInfo)
{
handler->SendSysMessage(LANG_WRONG_PET_TYPE);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_WRONG_PET_TYPE);
return false;
}
CreatureFamilyEntry const* petFamily = sCreatureFamilyStore.LookupEntry(creatureInfo->family);
if (!petFamily)
{
handler->SendSysMessage(LANG_WRONG_PET_TYPE);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_WRONG_PET_TYPE);
return false;
}
if (petFamily->petTalentType < 0) // not hunter pet
{
handler->SendSysMessage(LANG_WRONG_PET_TYPE);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_WRONG_PET_TYPE);
return false;
}
@@ -285,9 +280,12 @@ public:
static bool HandleLearnAllLangCommand(ChatHandler* handler)
{
// skipping UNIVERSAL language (0)
for (uint8 i = 1; i < LANGUAGES_COUNT; ++i)
handler->GetSession()->GetPlayer()->learnSpell(lang_description[i].spell_id);
for (LanguageDesc const& langDesc : lang_description)
if (uint32 langSpellId = langDesc.spell_id)
{
handler->GetPlayer()->learnSpell(langSpellId);
handler->GetPlayer()->SetSkill(langDesc.skill_id, 0, 300, 300);
}
handler->SendSysMessage(LANG_COMMAND_LEARN_ALL_LANG);
return true;
@@ -427,8 +425,7 @@ public:
Player* target = handler->getSelectedPlayer();
if (!target)
{
handler->SendSysMessage(LANG_NO_CHAR_SELECTED);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_NO_CHAR_SELECTED);
return false;
}

View File

@@ -16,12 +16,12 @@
*/
#include "Chat.h"
#include "CommandScript.h"
#include "DatabaseEnv.h"
#include "Group.h"
#include "LFGMgr.h"
#include "Language.h"
#include "Player.h"
#include "ScriptMgr.h"
void GetPlayerInfo(ChatHandler* handler, Player* player)
{

View File

@@ -23,6 +23,7 @@ Category: commandscripts
EndScriptData */
#include "Chat.h"
#include "CommandScript.h"
#include "Creature.h"
#include "DBCStores.h"
#include "DatabaseEnv.h"
@@ -33,7 +34,6 @@ EndScriptData */
#include "ObjectMgr.h"
#include "Player.h"
#include "Random.h"
#include "ScriptMgr.h"
#include "SpellAuraEffects.h"
using namespace Acore::ChatCommands;
@@ -71,8 +71,7 @@ public:
CreatureTemplate const* cInfo = sObjectMgr->GetCreatureTemplate(creatureId);
if (!cInfo)
{
handler->PSendSysMessage(LANG_COMMAND_INVALIDCREATUREID, uint32(creatureId));
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_COMMAND_INVALIDCREATUREID, uint32(creatureId));
return false;
}
@@ -343,8 +342,7 @@ public:
if (inventoryCount + mailCount + auctionCount + guildCount == 0)
{
handler->SendSysMessage(LANG_COMMAND_NOITEMFOUND);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_COMMAND_NOITEMFOUND);
return false;
}
@@ -358,8 +356,7 @@ public:
GameObjectTemplate const* gInfo = sObjectMgr->GetGameObjectTemplate(gameObjectId);
if (!gInfo)
{
handler->PSendSysMessage(LANG_COMMAND_LISTOBJINVALIDID, uint32(gameObjectId));
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_COMMAND_LISTOBJINVALIDID, uint32(gameObjectId));
return false;
}
@@ -459,8 +456,7 @@ public:
Unit* unit = handler->getSelectedUnit();
if (!unit)
{
handler->SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_SELECT_CHAR_OR_CREATURE);
return false;
}

View File

@@ -25,12 +25,12 @@ EndScriptData */
#include "AccountMgr.h"
#include "CharacterCache.h"
#include "Chat.h"
#include "CommandScript.h"
#include "GameEventMgr.h"
#include "ObjectAccessor.h"
#include "ObjectMgr.h"
#include "Player.h"
#include "ReputationMgr.h"
#include "ScriptMgr.h"
#include "SpellInfo.h"
#include "SpellMgr.h"
@@ -1172,8 +1172,7 @@ public:
if (!SpellMgr::IsSpellValid(spell))
{
handler->PSendSysMessage(LANG_COMMAND_SPELL_BROKEN, spell->Id);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_COMMAND_SPELL_BROKEN, spell->Id);
return false;
}
@@ -1650,8 +1649,7 @@ public:
{
if (!result)
{
handler->PSendSysMessage(LANG_NO_PLAYERS_FOUND);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_NO_PLAYERS_FOUND);
return false;
}
@@ -1710,8 +1708,7 @@ public:
if (!counter) // empty accounts only
{
handler->PSendSysMessage(LANG_NO_PLAYERS_FOUND);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_NO_PLAYERS_FOUND);
return false;
}

View File

@@ -24,12 +24,12 @@ EndScriptData */
#include "Channel.h"
#include "Chat.h"
#include "CommandScript.h"
#include "DatabaseEnv.h"
#include "Language.h"
#include "ObjectAccessor.h"
#include "ObjectMgr.h"
#include "Player.h"
#include "ScriptMgr.h"
#include "World.h"
#include "WorldSession.h"
@@ -175,14 +175,12 @@ public:
}
else
{
handler->PSendSysMessage(LANG_PLAYER_NOT_FOUND, playerNameArg->c_str());
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_PLAYER_NOT_FOUND, playerNameArg->c_str());
return false;
}
}
}
handler->SendSysMessage(LANG_USE_BOL);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_USE_BOL);
return false;
}
};

View File

@@ -21,6 +21,7 @@
#include "CellImpl.h"
#include "CharacterCache.h"
#include "Chat.h"
#include "CommandScript.h"
#include "GameGraveyard.h"
#include "GameTime.h"
#include "GridNotifiers.h"
@@ -29,6 +30,7 @@
#include "IPLocation.h"
#include "InstanceSaveMgr.h"
#include "LFG.h"
#include "LFGMgr.h"
#include "Language.h"
#include "MapMgr.h"
#include "MiscPackets.h"
@@ -113,7 +115,7 @@ public:
{ "neargrave", HandleNearGraveCommand, SEC_GAMEMASTER, Console::No },
{ "showarea", HandleShowAreaCommand, SEC_GAMEMASTER, Console::No },
{ "hidearea", HandleHideAreaCommand, SEC_ADMINISTRATOR, Console::No },
{ "additem", HandleAddItemCommand, SEC_GAMEMASTER, Console::No },
{ "additem", HandleAddItemCommand, SEC_GAMEMASTER, Console::Yes },
{ "additem set", HandleAddItemSetCommand, SEC_GAMEMASTER, Console::No },
{ "wchange", HandleChangeWeather, SEC_ADMINISTRATOR, Console::No },
{ "maxskill", HandleMaxSkillCommand, SEC_GAMEMASTER, Console::No },
@@ -169,8 +171,7 @@ public:
{
if (arenaTokens.size() > 1)
{
handler->PSendSysMessage("Invalid [arena] specified.");
handler->SetSentErrorMessage(true);
handler->SendErrorMessage("Invalid [arena] specified.");
return false;
}
@@ -202,8 +203,7 @@ public:
}
else
{
handler->PSendSysMessage("Invalid [arena] specified.");
handler->SetSentErrorMessage(true);
handler->SendErrorMessage("Invalid [arena] specified.");
return false;
}
}
@@ -236,15 +236,13 @@ public:
if (!count)
{
handler->PSendSysMessage("Invalid bracket. Can be 1v1, 2v2, 3v3, 5v5");
handler->SetSentErrorMessage(true);
handler->SendErrorMessage("Invalid bracket. Can be 1v1, 2v2, 3v3, 5v5");
return false;
}
if (tokens.size() != uint16(count + 2))
{
handler->PSendSysMessage("Invalid number of nicknames for this bracket.");
handler->SetSentErrorMessage(true);
handler->SendErrorMessage("Invalid number of nicknames for this bracket.");
return false;
}
@@ -409,16 +407,14 @@ public:
Battleground* bgt = sBattlegroundMgr->GetBattlegroundTemplate(BATTLEGROUND_AA);
if (!bgt)
{
handler->PSendSysMessage("Couldn't create arena map!");
handler->SetSentErrorMessage(true);
handler->SendErrorMessage("Couldn't create arena map!");
return false;
}
Battleground* bg = sBattlegroundMgr->CreateNewBattleground(randomizedArenaBgTypeId, GetBattlegroundBracketById(bgt->GetMapId(), bgt->GetBracketId()), ArenaType(hcnt >= 2 ? hcnt : 2), false);
if (!bg)
{
handler->PSendSysMessage("Couldn't create arena map!");
handler->SetSentErrorMessage(true);
handler->SendErrorMessage("Couldn't create arena map!");
return false;
}
@@ -492,8 +488,7 @@ public:
return true;
}
handler->SendSysMessage(LANG_USE_BOL);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_USE_BOL);
return false;
}
@@ -538,8 +533,7 @@ public:
return true;
}
handler->SendSysMessage(LANG_USE_BOL);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_USE_BOL);
return false;
}
@@ -638,23 +632,20 @@ public:
{
if (!spell)
{
handler->PSendSysMessage(LANG_COMMAND_NOSPELLFOUND);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_COMMAND_NOSPELLFOUND);
return false;
}
if (!SpellMgr::IsSpellValid(spell))
{
handler->PSendSysMessage(LANG_COMMAND_SPELL_BROKEN, spell->Id);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_COMMAND_SPELL_BROKEN, spell->Id);
return false;
}
Unit* target = handler->getSelectedUnit();
if (!target)
{
handler->SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_SELECT_CHAR_OR_CREATURE);
return false;
}
@@ -668,8 +659,7 @@ public:
Unit* target = handler->getSelectedUnit();
if (!target)
{
handler->SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_SELECT_CHAR_OR_CREATURE);
return false;
}
@@ -681,8 +671,7 @@ public:
if (!spells.holds_alternative<SpellInfo const*>())
{
handler->PSendSysMessage(LANG_COMMAND_NOSPELLFOUND);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_COMMAND_NOSPELLFOUND);
return false;
}
@@ -690,8 +679,7 @@ public:
if (!SpellMgr::IsSpellValid(spell))
{
handler->PSendSysMessage(LANG_COMMAND_SPELL_BROKEN, spell->Id);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_COMMAND_SPELL_BROKEN, spell->Id);
return false;
}
@@ -715,8 +703,7 @@ public:
Player* _player = handler->GetSession()->GetPlayer();
if (target->GetGUID() == _player->GetGUID())
{
handler->SendSysMessage(LANG_CANT_TELEPORT_SELF);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_CANT_TELEPORT_SELF);
return false;
}
@@ -738,8 +725,7 @@ public:
// only allow if gm mode is on
if (!_player->IsGameMaster())
{
handler->PSendSysMessage(LANG_CANNOT_GO_TO_BG_GM, nameLink.c_str());
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_CANNOT_GO_TO_BG_GM, nameLink.c_str());
return false;
}
@@ -760,8 +746,7 @@ public:
// we are in group, we can go only if we are in the player group
if (_player->GetGroup() != targetPlayer->GetGroup())
{
handler->PSendSysMessage(LANG_CANNOT_GO_TO_INST_PARTY, nameLink.c_str());
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_CANNOT_GO_TO_INST_PARTY, nameLink.c_str());
return false;
}
}
@@ -770,8 +755,7 @@ public:
// we are not in group, let's verify our GM mode
if (!_player->IsGameMaster())
{
handler->PSendSysMessage(LANG_CANNOT_GO_TO_INST_GM, nameLink.c_str());
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_CANNOT_GO_TO_INST_GM, nameLink.c_str());
return false;
}
}
@@ -868,8 +852,7 @@ public:
Player* _player = handler->GetSession()->GetPlayer();
if (target->GetGUID() == _player->GetGUID())
{
handler->PSendSysMessage(LANG_CANT_TELEPORT_SELF);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_CANT_TELEPORT_SELF);
return false;
}
@@ -887,8 +870,7 @@ public:
if (targetPlayer->IsBeingTeleported())
{
handler->PSendSysMessage(LANG_IS_TELEPORTED, nameLink.c_str());
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_IS_TELEPORTED, nameLink.c_str());
return false;
}
@@ -896,8 +878,7 @@ public:
if (map->IsBattlegroundOrArena())
{
handler->PSendSysMessage("Can't summon to a battleground!");
handler->SetSentErrorMessage(true);
handler->SendErrorMessage("Can't summon to a battleground!");
return false;
}
else if (map->IsDungeon())
@@ -908,8 +889,7 @@ public:
// pussywizard: prevent unbinding normal player's perm bind by just summoning him >_>
if (!targetPlayer->GetSession()->GetSecurity())
{
handler->PSendSysMessage("Only GMs can be summoned to an instance!");
handler->SetSentErrorMessage(true);
handler->SendErrorMessage("Only GMs can be summoned to an instance!");
return false;
}
}
@@ -927,8 +907,7 @@ public:
(handler->GetSession()->GetPlayer()->GetGroup()->GetLeaderGUID() != handler->GetSession()->GetPlayer()->GetGUID()))
// the last check is a bit excessive, but let it be, just in case
{
handler->PSendSysMessage(LANG_CANNOT_SUMMON_TO_INST, nameLink.c_str());
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_CANNOT_SUMMON_TO_INST, nameLink.c_str());
return false;
}
}
@@ -1006,8 +985,7 @@ public:
if (!group)
{
handler->PSendSysMessage(LANG_NOT_IN_GROUP, nameLink.c_str());
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_NOT_IN_GROUP, nameLink.c_str());
return false;
}
@@ -1020,8 +998,7 @@ public:
(handler->GetSession()->GetPlayer()->GetGroup()->GetLeaderGUID() != handler->GetSession()->GetPlayer()->GetGUID())))
// the last check is a bit excessive, but let it be, just in case
{
handler->SendSysMessage(LANG_CANNOT_SUMMON_TO_INST);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_CANNOT_SUMMON_TO_INST);
return false;
}
@@ -1044,8 +1021,7 @@ public:
if (player->IsBeingTeleported())
{
handler->PSendSysMessage(LANG_IS_TELEPORTED, plNameLink.c_str());
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_IS_TELEPORTED, plNameLink.c_str());
return false;
}
@@ -1056,8 +1032,7 @@ public:
if (playerMap->Instanceable() && playerMap->GetInstanceId() != gmMap->GetInstanceId())
{
// cannot summon from instance to instance
handler->PSendSysMessage(LANG_CANNOT_SUMMON_TO_INST, plNameLink.c_str());
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_CANNOT_SUMMON_TO_INST, plNameLink.c_str());
return false;
}
}
@@ -1101,8 +1076,7 @@ public:
if (!target || !handler->GetSession()->GetPlayer()->GetTarget())
{
handler->SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_SELECT_CHAR_OR_CREATURE);
return false;
}
@@ -1169,15 +1143,13 @@ public:
// If player is not mounted, so go out :)
if (!player->IsMounted())
{
handler->SendSysMessage(LANG_CHAR_NON_MOUNTED);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_CHAR_NON_MOUNTED);
return false;
}
if (player->IsInFlight())
{
handler->SendSysMessage(LANG_YOU_IN_FLIGHT);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_YOU_IN_FLIGHT);
return false;
}
@@ -1194,8 +1166,7 @@ public:
if (!guid)
{
handler->SendSysMessage(LANG_NO_SELECTION);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_NO_SELECTION);
return false;
}
@@ -1220,8 +1191,7 @@ public:
Player* target = handler->getSelectedPlayer();
if (!target)
{
handler->SendSysMessage(LANG_PLAYER_NOT_FOUND);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_PLAYER_NOT_FOUND);
return false;
}
@@ -1236,8 +1206,7 @@ public:
{
if (!SpellMgr::IsSpellValid(*spell))
{
handler->PSendSysMessage(LANG_COMMAND_SPELL_BROKEN, spell.value()->Id);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_COMMAND_SPELL_BROKEN, spell.value()->Id);
return false;
}
@@ -1297,8 +1266,7 @@ public:
if (targetPlayer->IsBeingTeleported())
{
handler->PSendSysMessage(LANG_IS_TELEPORTED, handler->playerLink(target->GetName()).c_str());
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_IS_TELEPORTED, handler->playerLink(target->GetName()).c_str());
return false;
}
@@ -1368,8 +1336,7 @@ public:
if (handler->GetSession() && target->GetGUID() == handler->GetSession()->GetPlayer()->GetGUID())
{
handler->SendSysMessage(LANG_COMMAND_KICKSELF);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_COMMAND_KICKSELF);
return false;
}
@@ -1487,8 +1454,7 @@ public:
if (!graveyard)
{
handler->PSendSysMessage(LANG_COMMAND_GRAVEYARDNOEXIST, graveyardId);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_COMMAND_GRAVEYARDNOEXIST, graveyardId);
return false;
}
@@ -1498,8 +1464,7 @@ public:
AreaTableEntry const* areaEntry = sAreaTableStore.LookupEntry(zoneId);
if (!areaEntry || areaEntry->zone != 0)
{
handler->PSendSysMessage(LANG_COMMAND_GRAVEYARDWRONGZONE, graveyardId, zoneId);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_COMMAND_GRAVEYARDWRONGZONE, graveyardId, zoneId);
return false;
}
@@ -1548,8 +1513,7 @@ public:
GraveyardData const* data = sGraveyard->FindGraveyardData(graveyardId, zone_id);
if (!data)
{
handler->PSendSysMessage(LANG_COMMAND_GRAVEYARDERROR, graveyardId);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_COMMAND_GRAVEYARDERROR, graveyardId);
return false;
}
@@ -1598,24 +1562,21 @@ public:
Player* playerTarget = handler->getSelectedPlayer();
if (!playerTarget)
{
handler->SendSysMessage(LANG_NO_CHAR_SELECTED);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_NO_CHAR_SELECTED);
return false;
}
AreaTableEntry const* area = sAreaTableStore.LookupEntry(areaID);
if (!area)
{
handler->SendSysMessage(LANG_BAD_VALUE);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_BAD_VALUE);
return false;
}
int32 offset = area->exploreFlag / 32;
if (offset >= PLAYER_EXPLORED_ZONES_SIZE)
{
handler->SendSysMessage(LANG_BAD_VALUE);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_BAD_VALUE);
return false;
}
@@ -1632,24 +1593,21 @@ public:
Player* playerTarget = handler->getSelectedPlayer();
if (!playerTarget)
{
handler->SendSysMessage(LANG_NO_CHAR_SELECTED);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_NO_CHAR_SELECTED);
return false;
}
AreaTableEntry const* area = sAreaTableStore.LookupEntry(areaID);
if (!area)
{
handler->SendSysMessage(LANG_BAD_VALUE);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_BAD_VALUE);
return false;
}
int32 offset = area->exploreFlag / 32;
if (offset >= PLAYER_EXPLORED_ZONES_SIZE)
{
handler->SendSysMessage(LANG_BAD_VALUE);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_BAD_VALUE);
return false;
}
@@ -1661,12 +1619,11 @@ public:
return true;
}
static bool HandleAddItemCommand(ChatHandler* handler, ItemTemplate const* itemTemplate, Optional<int32> _count)
static bool HandleAddItemCommand(ChatHandler* handler, Optional<PlayerIdentifier> player, ItemTemplate const* itemTemplate, Optional<int32> _count)
{
if (!sObjectMgr->GetItemTemplate(itemTemplate->ItemId))
{
handler->PSendSysMessage(LANG_COMMAND_ITEMIDINVALID, itemTemplate->ItemId);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_COMMAND_ITEMIDINVALID, itemTemplate->ItemId);
return false;
}
@@ -1674,22 +1631,21 @@ public:
int32 count = 1;
if (_count)
{
count = *_count;
}
if (!count)
{
count = 1;
}
Player* player = handler->GetSession()->GetPlayer();
Player* playerTarget = handler->getSelectedPlayer();
if (!player)
player = PlayerIdentifier::FromTargetOrSelf(handler);
if (!player)
return false;
Player* playerTarget = player->GetConnectedPlayer();
if (!playerTarget)
{
playerTarget = player;
}
return false;
// Subtract
if (count < 0)
@@ -1700,16 +1656,14 @@ public:
if (!playerTarget->HasItemCount(itemId, 0))
{
// output that player don't have any items to destroy
handler->PSendSysMessage(LANG_REMOVEITEM_FAILURE, handler->GetNameLink(playerTarget).c_str(), itemId);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_REMOVEITEM_FAILURE, handler->GetNameLink(playerTarget).c_str(), itemId);
return false;
}
if (!playerTarget->HasItemCount(itemId, -count))
{
// output that player don't have as many items that you want to destroy
handler->PSendSysMessage(LANG_REMOVEITEM_ERROR, handler->GetNameLink(playerTarget).c_str(), itemId);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_REMOVEITEM_ERROR, handler->GetNameLink(playerTarget).c_str(), itemId);
return false;
}
}
@@ -1728,45 +1682,41 @@ public:
InventoryResult msg = playerTarget->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, itemId, count, &noSpaceForCount);
if (msg != EQUIP_ERR_OK) // convert to possible store amount
{
count -= noSpaceForCount;
}
if (!count || dest.empty()) // can't add any
{
handler->PSendSysMessage(LANG_ITEM_CANNOT_CREATE, itemId, noSpaceForCount);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_ITEM_CANNOT_CREATE, itemId, noSpaceForCount);
return false;
}
Item* item = playerTarget->StoreNewItem(dest, itemId, true);
Player* p = handler->GetSession()->GetPlayer();
// remove binding (let GM give it to another player later)
if (player == playerTarget)
if (p && p == playerTarget)
{
for (auto const& itemPos : dest)
{
if (Item* item1 = player->GetItemByPos(itemPos.pos))
if (Item* item1 = p->GetItemByPos(itemPos.pos))
{
item1->SetBinding(false);
}
}
}
if (count && item)
if (p && count && item)
{
player->SendNewItem(item, count, false, true);
p->SendNewItem(item, count, false, true);
if (player != playerTarget)
if (p != playerTarget)
{
playerTarget->SendNewItem(item, count, true, false);
}
}
if (noSpaceForCount)
{
handler->PSendSysMessage(LANG_ITEM_CANNOT_CREATE, itemId, noSpaceForCount);
}
return true;
}
@@ -1776,8 +1726,7 @@ public:
// prevent generation all items with itemset field value '0'
if (!*itemSetId)
{
handler->PSendSysMessage(LANG_NO_ITEMS_FROM_ITEMSET_FOUND, uint32(itemSetId));
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_NO_ITEMS_FROM_ITEMSET_FOUND, uint32(itemSetId));
return false;
}
@@ -1826,8 +1775,7 @@ public:
if (!found)
{
handler->PSendSysMessage(LANG_NO_ITEMS_FROM_ITEMSET_FOUND, uint32(itemSetId));
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_NO_ITEMS_FROM_ITEMSET_FOUND, uint32(itemSetId));
return false;
}
@@ -1839,8 +1787,7 @@ public:
// Weather is OFF
if (!sWorld->getBoolConfig(CONFIG_WEATHER))
{
handler->SendSysMessage(LANG_WEATHER_DISABLED);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_WEATHER_DISABLED);
return false;
}
@@ -1856,8 +1803,7 @@ public:
if (!weather)
{
handler->SendSysMessage(LANG_NO_WEATHER);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_NO_WEATHER);
return false;
}
@@ -1871,8 +1817,7 @@ public:
Player* SelectedPlayer = handler->getSelectedPlayer();
if (!SelectedPlayer)
{
handler->SendSysMessage(LANG_NO_CHAR_SELECTED);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_NO_CHAR_SELECTED);
return false;
}
@@ -1887,24 +1832,21 @@ public:
if (skillID <= 0)
{
handler->PSendSysMessage(LANG_INVALID_SKILL_ID, skillID);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_INVALID_SKILL_ID, skillID);
return false;
}
Player* target = handler->getSelectedPlayer();
if (!target)
{
handler->SendSysMessage(LANG_NO_CHAR_SELECTED);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_NO_CHAR_SELECTED);
return false;
}
SkillLineEntry const* skillLine = sSkillLineStore.LookupEntry(skillID);
if (!skillLine)
{
handler->PSendSysMessage(LANG_INVALID_SKILL_ID, uint32(skillID));
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_INVALID_SKILL_ID, uint32(skillID));
return false;
}
@@ -2384,20 +2326,18 @@ public:
{
if (target->GetTypeId() != TYPEID_UNIT || target->IsPet())
{
handler->SendSysMessage(LANG_SELECT_CREATURE);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_SELECT_CREATURE);
return false;
}
if (target->isDead())
{
target->ToCreature()->Respawn();
target->ToCreature()->Respawn(true);
}
return true;
}
handler->SendSysMessage(LANG_SELECT_CREATURE);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_SELECT_CREATURE);
return false;
}
@@ -2428,8 +2368,7 @@ public:
if (Acore::StringTo<int32>(notSpeakTime).value_or(0) < 0)
{
handler->SendSysMessage(LANG_BAD_VALUE);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_BAD_VALUE);
return false;
}
@@ -2445,8 +2384,7 @@ public:
if (!player)
{
handler->SendSysMessage(LANG_PLAYER_NOT_FOUND);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_PLAYER_NOT_FOUND);
return false;
}
@@ -2475,8 +2413,7 @@ public:
if (muteDuration <= 0)
{
handler->SendSysMessage(LANG_BAD_VALUE);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_BAD_VALUE);
return false;
}
@@ -2578,8 +2515,7 @@ public:
{
if (playerTarget->CanSpeak())
{
handler->SendSysMessage(LANG_CHAT_ALREADY_ENABLED);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_CHAT_ALREADY_ENABLED);
return false;
}
@@ -2608,8 +2544,7 @@ public:
{
if (!Utf8ToUpperOnlyLatin(accountName))
{
handler->PSendSysMessage(LANG_ACCOUNT_NOT_EXIST, accountName.c_str());
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_ACCOUNT_NOT_EXIST, accountName.c_str());
return false;
}
@@ -2651,8 +2586,7 @@ public:
Unit* unit = handler->getSelectedUnit();
if (!unit)
{
handler->SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_SELECT_CHAR_OR_CREATURE);
return false;
}
@@ -2786,8 +2720,7 @@ public:
Creature* caster = handler->getSelectedCreature();
if (!caster)
{
handler->SendSysMessage(LANG_SELECT_CREATURE);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_SELECT_CREATURE);
return false;
}
@@ -2803,8 +2736,7 @@ public:
Unit* target = handler->getSelectedUnit();
if (!target || !handler->GetSession()->GetPlayer()->GetTarget())
{
handler->SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_SELECT_CHAR_OR_CREATURE);
return false;
}
@@ -2850,8 +2782,7 @@ public:
if (!target || !target->IsConnected())
{
handler->SendSysMessage(LANG_PLAYER_NOT_FOUND);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_PLAYER_NOT_FOUND);
return false;
}
@@ -2885,8 +2816,7 @@ public:
if (!target && !creatureTarget)
{
handler->SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_SELECT_CHAR_OR_CREATURE);
return false;
}
@@ -2914,8 +2844,7 @@ public:
return true;
}
handler->SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_SELECT_CHAR_OR_CREATURE);
return false;
}
@@ -2930,8 +2859,7 @@ public:
if (!target && !creatureTarget)
{
handler->SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_SELECT_CHAR_OR_CREATURE);
return false;
}
@@ -2966,8 +2894,7 @@ public:
{
if (!sSoundEntriesStore.LookupEntry(soundId))
{
handler->PSendSysMessage(LANG_SOUND_NOT_EXIST, soundId);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_SOUND_NOT_EXIST, soundId);
return false;
}

View File

@@ -25,6 +25,7 @@
#include "CellImpl.h"
#include "Chat.h"
#include "CommandScript.h"
#include "GridNotifiers.h"
#include "GridNotifiersImpl.h"
#include "MMapFactory.h"
@@ -33,7 +34,6 @@
#include "PathGenerator.h"
#include "Player.h"
#include "PointMovementGenerator.h"
#include "ScriptMgr.h"
#include "TargetedMovementGenerator.h"
using namespace Acore::ChatCommands;

View File

@@ -24,12 +24,12 @@ EndScriptData */
#include "AccountMgr.h"
#include "Chat.h"
#include "CommandScript.h"
#include "ObjectMgr.h"
#include "Opcodes.h"
#include "Pet.h"
#include "Player.h"
#include "ReputationMgr.h"
#include "ScriptMgr.h"
#include "StringConvert.h"
using namespace Acore::ChatCommands;
@@ -108,15 +108,13 @@ public:
{
if (modifyValue < 1)
{
handler->SendSysMessage(LANG_BAD_VALUE);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_BAD_VALUE);
return false;
}
if (!target)
{
handler->SendSysMessage(LANG_NO_CHAR_SELECTED);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_NO_CHAR_SELECTED);
return false;
}
@@ -257,8 +255,7 @@ public:
Creature* target = handler->getSelectedCreature();
if (!target)
{
handler->SendSysMessage(LANG_SELECT_CREATURE);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_SELECT_CREATURE);
return false;
}
@@ -297,8 +294,7 @@ public:
if (!sFactionTemplateStore.LookupEntry(factionid))
{
handler->PSendSysMessage(LANG_WRONG_FACTION, factionid);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_WRONG_FACTION, factionid);
return false;
}
@@ -318,8 +314,7 @@ public:
Player* target = handler->getSelectedPlayer();
if (!target)
{
handler->SendSysMessage(LANG_NO_CHAR_SELECTED);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_NO_CHAR_SELECTED);
return false;
}
@@ -356,8 +351,7 @@ public:
Unit* target = handler->getSelectedUnit();
if (!target)
{
handler->SendSysMessage(LANG_NO_CHAR_SELECTED);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_NO_CHAR_SELECTED);
return false;
}
@@ -387,8 +381,7 @@ public:
}
}
handler->SendSysMessage(LANG_NO_CHAR_SELECTED);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_NO_CHAR_SELECTED);
return false;
}
@@ -396,15 +389,13 @@ public:
{
if (speed > maximumBound || speed < minimumBound)
{
handler->SendSysMessage(LANG_BAD_VALUE);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_BAD_VALUE);
return false;
}
if (!target)
{
handler->SendSysMessage(LANG_NO_CHAR_SELECTED);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_NO_CHAR_SELECTED);
return false;
}
@@ -418,8 +409,7 @@ public:
if (player->IsInFlight() && checkInFlight)
{
handler->PSendSysMessage(LANG_CHAR_IN_FLIGHT, handler->GetNameLink(player).c_str());
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_CHAR_IN_FLIGHT, handler->GetNameLink(player).c_str());
return false;
}
}
@@ -505,16 +495,14 @@ public:
{
if (scale > 10.0f || scale < 0.1f)
{
handler->SendSysMessage(LANG_BAD_VALUE);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_BAD_VALUE);
return false;
}
Unit* target = handler->getSelectedUnit();
if (!target)
{
handler->SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_SELECT_CHAR_OR_CREATURE);
return false;
}
@@ -539,16 +527,14 @@ public:
{
if (!sCreatureDisplayInfoStore.LookupEntry(creatureDisplayID))
{
handler->SendSysMessage(LANG_NO_MOUNT);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_NO_MOUNT);
return false;
}
Player* target = handler->getSelectedPlayerOrSelf();
if (!target)
{
handler->SendSysMessage(LANG_NO_CHAR_SELECTED);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_NO_CHAR_SELECTED);
return false;
}
@@ -584,8 +570,7 @@ public:
Player* target = handler->getSelectedPlayer();
if (!target)
{
handler->SendSysMessage(LANG_NO_CHAR_SELECTED);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_NO_CHAR_SELECTED);
return false;
}
@@ -676,8 +661,7 @@ public:
Unit* target = handler->getSelectedUnit();
if (!target)
{
handler->SendSysMessage(LANG_NO_CHAR_SELECTED);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_NO_CHAR_SELECTED);
return false;
}
@@ -689,15 +673,13 @@ public:
if (field < OBJECT_END || field >= target->GetValuesCount())
{
handler->SendSysMessage(LANG_BAD_VALUE);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_BAD_VALUE);
return false;
}
if (bit < 1 || bit > 32)
{
handler->SendSysMessage(LANG_BAD_VALUE);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_BAD_VALUE);
return false;
}
@@ -720,8 +702,7 @@ public:
Player* target = handler->getSelectedPlayer();
if (!target)
{
handler->SendSysMessage(LANG_PLAYER_NOT_FOUND);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_PLAYER_NOT_FOUND);
return false;
}
@@ -758,8 +739,7 @@ public:
Player* target = handler->getSelectedPlayer();
if (!target)
{
handler->SendSysMessage(LANG_PLAYER_NOT_FOUND);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_PLAYER_NOT_FOUND);
return false;
}
@@ -804,8 +784,7 @@ public:
{
if (*delta < 0 || (*delta > ReputationMgr::PointsInRank[r] - 1))
{
handler->PSendSysMessage(LANG_COMMAND_FACTION_DELTA, ReputationMgr::PointsInRank[r] - 1);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_COMMAND_FACTION_DELTA, ReputationMgr::PointsInRank[r] - 1);
return false;
}
@@ -820,8 +799,7 @@ public:
if (r >= MAX_REPUTATION_RANK)
{
handler->PSendSysMessage(LANG_COMMAND_FACTION_INVPARAM, rankStr.c_str());
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_COMMAND_FACTION_INVPARAM, rankStr.c_str());
return false;
}
}
@@ -839,15 +817,13 @@ public:
if (!factionEntry)
{
handler->PSendSysMessage(LANG_COMMAND_FACTION_UNKNOWN, factionId);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_COMMAND_FACTION_UNKNOWN, factionId);
return false;
}
if (factionEntry->reputationListID < 0)
{
handler->PSendSysMessage(LANG_COMMAND_FACTION_NOREP_ERROR, factionEntry->name[handler->GetSessionDbcLocale()], factionId);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_COMMAND_FACTION_NOREP_ERROR, factionEntry->name[handler->GetSessionDbcLocale()], factionId);
return false;
}
@@ -922,8 +898,7 @@ public:
Player* target = handler->getSelectedPlayer();
if (!target)
{
handler->SendSysMessage(LANG_PLAYER_NOT_FOUND);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_PLAYER_NOT_FOUND);
return false;
}
@@ -944,8 +919,7 @@ public:
Player* target = handler->getSelectedPlayer();
if (!target)
{
handler->PSendSysMessage(LANG_PLAYER_NOT_FOUND);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_PLAYER_NOT_FOUND);
return false;
}
@@ -973,8 +947,7 @@ public:
}
else
{
handler->SendSysMessage(LANG_MUST_MALE_OR_FEMALE);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_MUST_MALE_OR_FEMALE);
return false;
}

View File

@@ -16,6 +16,7 @@
*/
#include "Chat.h"
#include "CommandScript.h"
#include "CreatureAI.h"
#include "CreatureGroups.h"
#include "GameTime.h"
@@ -23,7 +24,6 @@
#include "ObjectMgr.h"
#include "Pet.h"
#include "Player.h"
#include "ScriptMgr.h"
#include "TargetedMovementGenerator.h" // for HandleNpcUnFollowCommand
#include "Transport.h"
#include <string>
@@ -265,16 +265,14 @@ public:
{
if (!item)
{
handler->SendSysMessage(LANG_COMMAND_NEEDITEMSEND);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_COMMAND_NEEDITEMSEND);
return false;
}
Creature* vendor = handler->getSelectedCreature();
if (!vendor)
{
handler->SendSysMessage(LANG_SELECT_CREATURE);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_SELECT_CREATURE);
return false;
}
@@ -303,8 +301,7 @@ public:
CreatureData const* data = sObjectMgr->GetCreatureData(lowGuid);
if (!data)
{
handler->PSendSysMessage(LANG_COMMAND_CREATGUIDNOTFOUND, uint32(lowGuid));
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_COMMAND_CREATGUIDNOTFOUND, uint32(lowGuid));
return false;
}
@@ -342,8 +339,7 @@ public:
Unit* unit = handler->getSelectedUnit();
if (!unit || unit->GetTypeId() != TYPEID_UNIT)
{
handler->SendSysMessage(LANG_SELECT_CREATURE);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_SELECT_CREATURE);
return false;
}
Creature* creature = unit->ToCreature();
@@ -359,16 +355,14 @@ public:
{
if (lvl < 1 || lvl > sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL) + 3)
{
handler->SendSysMessage(LANG_BAD_VALUE);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_BAD_VALUE);
return false;
}
Creature* creature = handler->getSelectedCreature();
if (!creature || creature->IsPet())
{
handler->SendSysMessage(LANG_SELECT_CREATURE);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_SELECT_CREATURE);
return false;
}
@@ -386,8 +380,7 @@ public:
if (!unit || unit->IsPet() || unit->IsTotem())
{
handler->SendSysMessage(LANG_SELECT_CREATURE);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_SELECT_CREATURE);
return false;
}
@@ -407,23 +400,20 @@ public:
Creature* vendor = handler->getSelectedCreature();
if (!vendor || !vendor->IsVendor())
{
handler->SendSysMessage(LANG_COMMAND_VENDORSELECTION);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_COMMAND_VENDORSELECTION);
return false;
}
if (!item)
{
handler->SendSysMessage(LANG_COMMAND_NEEDITEMSEND);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_COMMAND_NEEDITEMSEND);
return false;
}
uint32 itemId = item->ItemId;
if (!sObjectMgr->RemoveVendorItem(addMulti.value_or(false) ? handler->GetSession()->GetCurrentVendor() : vendor->GetEntry(), itemId))
{
handler->PSendSysMessage(LANG_ITEM_NOT_IN_LIST, itemId);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_ITEM_NOT_IN_LIST, itemId);
return false;
}
@@ -436,8 +426,7 @@ public:
{
if (!sFactionTemplateStore.LookupEntry(factionId))
{
handler->PSendSysMessage(LANG_WRONG_FACTION, factionId);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_WRONG_FACTION, factionId);
return false;
}
@@ -445,8 +434,7 @@ public:
if (!creature)
{
handler->SendSysMessage(LANG_SELECT_CREATURE);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_SELECT_CREATURE);
return false;
}
@@ -513,8 +501,7 @@ public:
if (!creature)
{
handler->SendSysMessage(LANG_SELECT_CREATURE);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_SELECT_CREATURE);
return false;
}
@@ -539,8 +526,7 @@ public:
if (!creature)
{
handler->SendSysMessage(LANG_SELECT_CREATURE);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_SELECT_CREATURE);
return false;
}
@@ -558,8 +544,7 @@ public:
if (!creature)
{
handler->PSendSysMessage(LANG_SELECT_CREATURE);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_SELECT_CREATURE);
return false;
}
@@ -576,8 +561,7 @@ public:
if (!target)
{
handler->SendSysMessage(LANG_SELECT_CREATURE);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_SELECT_CREATURE);
return false;
}
@@ -652,8 +636,7 @@ public:
if (!target)
{
handler->SendSysMessage(LANG_SELECT_CREATURE);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_SELECT_CREATURE);
return false;
}
@@ -737,15 +720,13 @@ public:
CreatureData const* data = sObjectMgr->GetCreatureData(lowguid);
if (!data)
{
handler->PSendSysMessage(LANG_COMMAND_CREATGUIDNOTFOUND, lowguid);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_COMMAND_CREATGUIDNOTFOUND, lowguid);
return false;
}
if (handler->GetSession()->GetPlayer()->GetMapId() != data->mapid)
{
handler->PSendSysMessage(LANG_COMMAND_CREATUREATSAMEMAP, lowguid);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_COMMAND_CREATUREATSAMEMAP, lowguid);
return false;
}
@@ -769,7 +750,7 @@ public:
if (creature->IsAlive()) // dead creature will reset movement generator at respawn
{
creature->setDeathState(JUST_DIED);
creature->setDeathState(DeathState::JustDied);
creature->Respawn();
}
}
@@ -793,8 +774,7 @@ public:
Creature* target = handler->getSelectedCreature();
if (!target)
{
handler->SendSysMessage(LANG_SELECT_CREATURE);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_SELECT_CREATURE);
return false;
}
@@ -810,15 +790,13 @@ public:
if (!creature || creature->IsPet())
{
handler->SendSysMessage(LANG_SELECT_CREATURE);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_SELECT_CREATURE);
return false;
}
if (!sCreatureDisplayInfoStore.LookupEntry(displayId))
{
handler->PSendSysMessage(LANG_COMMAND_FACTION_INVPARAM, Acore::ToString(displayId).c_str());
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_COMMAND_FACTION_INVPARAM, Acore::ToString(displayId).c_str());
return false;
}
@@ -876,8 +854,7 @@ public:
CreatureData const* data = sObjectMgr->GetCreatureData(lowguid);
if (!data)
{
handler->PSendSysMessage(LANG_COMMAND_CREATGUIDNOTFOUND, lowguid);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_COMMAND_CREATGUIDNOTFOUND, lowguid);
return false;
}
}
@@ -921,7 +898,7 @@ public:
if (creature->IsAlive()) // dead creature will reset movement generator at respawn
{
creature->setDeathState(JUST_DIED);
creature->setDeathState(DeathState::JustDied);
creature->Respawn();
}
@@ -946,16 +923,14 @@ public:
{
if (phasemask == 0)
{
handler->SendSysMessage(LANG_BAD_VALUE);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_BAD_VALUE);
return false;
}
Creature* creature = handler->getSelectedCreature();
if (!creature)
{
handler->SendSysMessage(LANG_SELECT_CREATURE);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_SELECT_CREATURE);
return false;
}
@@ -995,7 +970,7 @@ public:
if (creature->IsAlive()) // dead creature will reset movement generator at respawn
{
creature->setDeathState(JUST_DIED);
creature->setDeathState(DeathState::JustDied);
creature->Respawn();
}
@@ -1021,8 +996,7 @@ public:
if (Acore::StringTo<int32>(spawnTimeStr).value_or(0) < 0)
{
handler->SendSysMessage(LANG_BAD_VALUE);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_BAD_VALUE);
return false;
}
@@ -1038,8 +1012,7 @@ public:
if (spawnTime <= 0)
{
handler->SendSysMessage(LANG_BAD_VALUE);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_BAD_VALUE);
return false;
}
@@ -1062,8 +1035,7 @@ public:
Creature* creature = handler->getSelectedCreature();
if (!creature)
{
handler->SendSysMessage(LANG_SELECT_CREATURE);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_SELECT_CREATURE);
return false;
}
@@ -1090,8 +1062,7 @@ public:
if (!creature)
{
handler->SendSysMessage(LANG_SELECT_CREATURE);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_SELECT_CREATURE);
return false;
}
@@ -1108,16 +1079,14 @@ public:
if (!creature)
{
handler->PSendSysMessage(LANG_SELECT_CREATURE);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_SELECT_CREATURE);
return false;
}
if (/*creature->GetMotionMaster()->empty() ||*/
creature->GetMotionMaster()->GetCurrentMovementGeneratorType() != FOLLOW_MOTION_TYPE)
{
handler->PSendSysMessage(LANG_CREATURE_NOT_FOLLOW_YOU, creature->GetName().c_str());
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_CREATURE_NOT_FOLLOW_YOU, creature->GetName().c_str());
return false;
}
@@ -1125,8 +1094,7 @@ public:
if (mgen->GetTarget() != player)
{
handler->PSendSysMessage(LANG_CREATURE_NOT_FOLLOW_YOU, creature->GetName().c_str());
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_CREATURE_NOT_FOLLOW_YOU, creature->GetName().c_str());
return false;
}
@@ -1146,8 +1114,7 @@ public:
Creature* creature = handler->getSelectedCreature();
if (!creature)
{
handler->SendSysMessage(LANG_SELECT_CREATURE);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_SELECT_CREATURE);
return false;
}
@@ -1168,8 +1135,7 @@ public:
Creature* creature = handler->getSelectedCreature();
if (!creature)
{
handler->SendSysMessage(LANG_SELECT_CREATURE);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_SELECT_CREATURE);
return false;
}
@@ -1209,8 +1175,7 @@ public:
if (player->IsExistPet())
{
handler->SendSysMessage(LANG_YOU_ALREADY_HAVE_PET);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_YOU_ALREADY_HAVE_PET);
return false;
}
@@ -1225,8 +1190,7 @@ public:
if (!player->CreatePet(creatureTarget))
{
handler->PSendSysMessage(LANG_CREATURE_NON_TAMEABLE, cInfo->Entry);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_CREATURE_NON_TAMEABLE, cInfo->Entry);
return false;
}
@@ -1239,8 +1203,7 @@ public:
if (!creature || !creature->GetSpawnId())
{
handler->SendSysMessage(LANG_SELECT_CREATURE);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_SELECT_CREATURE);
return false;
}
@@ -1284,22 +1247,19 @@ public:
if (!creature)
{
handler->SendSysMessage(LANG_SELECT_CREATURE);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_SELECT_CREATURE);
return false;
}
if (!creature->GetSpawnId())
{
handler->PSendSysMessage("Selected creature %u isn't in creature table", creature->GetGUID().GetCounter());
handler->SetSentErrorMessage(true);
handler->SendErrorMessage("Selected creature %u isn't in creature table", creature->GetGUID().GetCounter());
return false;
}
if (!sObjectMgr->SetCreatureLinkedRespawn(creature->GetSpawnId(), linkguid))
{
handler->PSendSysMessage("Selected creature can't link with guid '%u'", linkguid);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage("Selected creature can't link with guid '%u'", linkguid);
return false;
}

View File

@@ -16,12 +16,12 @@
*/
#include "Chat.h"
#include "CommandScript.h"
#include "Language.h"
#include "Log.h"
#include "ObjectMgr.h"
#include "Pet.h"
#include "Player.h"
#include "ScriptMgr.h"
#include "SpellInfo.h"
#include "SpellMgr.h"
@@ -56,8 +56,7 @@ public:
if (!creatureTarget || creatureTarget->IsPet() || creatureTarget->GetTypeId() == TYPEID_PLAYER)
{
handler->PSendSysMessage(LANG_SELECT_CREATURE);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_SELECT_CREATURE);
return false;
}
@@ -65,22 +64,19 @@ public:
// Creatures with family 0 crashes the server
if (!creatrueTemplate->family)
{
handler->PSendSysMessage(LANG_CREATURE_NON_TAMEABLE, creatrueTemplate->Entry);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_CREATURE_NON_TAMEABLE, creatrueTemplate->Entry);
return false;
}
if (player->IsExistPet())
{
handler->SendSysMessage(LANG_YOU_ALREADY_HAVE_PET);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_YOU_ALREADY_HAVE_PET);
return false;
}
if (!player->CreatePet(creatureTarget))
{
handler->PSendSysMessage(LANG_CREATURE_NON_TAMEABLE, creatrueTemplate->Entry);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_CREATURE_NON_TAMEABLE, creatrueTemplate->Entry);
return false;
}
@@ -91,23 +87,20 @@ public:
{
if (!spell)
{
handler->PSendSysMessage(LANG_COMMAND_NOSPELLFOUND);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_COMMAND_NOSPELLFOUND);
return false;
}
if (!SpellMgr::IsSpellValid(spell))
{
handler->PSendSysMessage(LANG_COMMAND_SPELL_BROKEN, spell->Id);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_COMMAND_SPELL_BROKEN, spell->Id);
return false;
}
Pet* pet = handler->GetSession()->GetPlayer()->GetPet();
if (!pet)
{
handler->PSendSysMessage("You have no pet");
handler->SetSentErrorMessage(true);
handler->SendErrorMessage("You have no pet");
return false;
}
@@ -115,16 +108,14 @@ public:
uint32 spellDifficultyId = sSpellMgr->GetSpellDifficultyId(spell->Id);
if (bounds.first != bounds.second || spellDifficultyId)
{
handler->PSendSysMessage("Spell %u cannot be learnt using a command!", spell->Id);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage("Spell %u cannot be learnt using a command!", spell->Id);
return false;
}
// Check if pet already has it
if (pet->HasSpell(spell->Id))
{
handler->PSendSysMessage("Pet already has spell: %u", spell->Id);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage("Pet already has spell: %u", spell->Id);
return false;
}
@@ -138,23 +129,20 @@ public:
{
if (!spell)
{
handler->PSendSysMessage(LANG_COMMAND_NOSPELLFOUND);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_COMMAND_NOSPELLFOUND);
return false;
}
if (!SpellMgr::IsSpellValid(spell))
{
handler->PSendSysMessage(LANG_COMMAND_SPELL_BROKEN, spell->Id);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_COMMAND_SPELL_BROKEN, spell->Id);
return false;
}
Pet* pet = handler->GetSession()->GetPlayer()->GetPet();
if (!pet)
{
handler->PSendSysMessage("You have no pet");
handler->SetSentErrorMessage(true);
handler->SendErrorMessage("You have no pet");
return false;
}

View File

@@ -15,8 +15,8 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "CommandScript.h"
#include "PlayerCommand.h"
#include "ScriptMgr.h"
using namespace Acore::ChatCommands;

View File

@@ -16,9 +16,9 @@
*/
#include "Chat.h"
#include "CommandScript.h"
#include "Player.h"
#include "PlayerSettings.h"
#include "ScriptMgr.h"
using namespace Acore::ChatCommands;

View File

@@ -23,11 +23,11 @@ Category: commandscripts
EndScriptData */
#include "Chat.h"
#include "CommandScript.h"
#include "GameTime.h"
#include "ObjectMgr.h"
#include "Player.h"
#include "ReputationMgr.h"
#include "ScriptMgr.h"
using namespace Acore::ChatCommands;
@@ -61,8 +61,7 @@ public:
if (!playerTarget)
{
handler->SendSysMessage(LANG_PLAYER_NOT_FOUND);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_PLAYER_NOT_FOUND);
return false;
}
@@ -74,8 +73,7 @@ public:
if (result != itc->end())
{
handler->PSendSysMessage(LANG_COMMAND_QUEST_STARTFROMITEM, entry, result->second.ItemId);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_COMMAND_QUEST_STARTFROMITEM, entry, result->second.ItemId);
return false;
}
@@ -83,8 +81,7 @@ public:
{
if (player->IsActiveQuest(entry))
{
handler->PSendSysMessage(LANG_COMMAND_QUEST_ACTIVE, quest->GetTitle().c_str(), entry);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_COMMAND_QUEST_ACTIVE, quest->GetTitle().c_str(), entry);
return false;
}
@@ -101,8 +98,7 @@ public:
if (result)
{
handler->PSendSysMessage(LANG_COMMAND_QUEST_ACTIVE, quest->GetTitle().c_str(), entry);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_COMMAND_QUEST_ACTIVE, quest->GetTitle().c_str(), entry);
return false;
}
@@ -144,8 +140,7 @@ public:
if (!playerTarget)
{
handler->SendSysMessage(LANG_PLAYER_NOT_FOUND);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_PLAYER_NOT_FOUND);
return false;
}
@@ -153,8 +148,7 @@ public:
if (!quest)
{
handler->PSendSysMessage(LANG_COMMAND_QUEST_NOTFOUND, entry);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_COMMAND_QUEST_NOTFOUND, entry);
return false;
}
@@ -236,8 +230,7 @@ public:
if (!playerTarget)
{
handler->SendSysMessage(LANG_PLAYER_NOT_FOUND);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_PLAYER_NOT_FOUND);
return false;
}
@@ -248,8 +241,7 @@ public:
// If player doesn't have the quest
if (player->GetQuestStatus(entry) == QUEST_STATUS_NONE)
{
handler->PSendSysMessage(LANG_COMMAND_QUEST_NOTFOUND, entry);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_COMMAND_QUEST_NOTFOUND, entry);
return false;
}
@@ -352,8 +344,7 @@ public:
if (!result)
{
handler->PSendSysMessage(LANG_COMMAND_QUEST_NOT_FOUND_IN_LOG, quest->GetTitle(), entry);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_COMMAND_QUEST_NOT_FOUND_IN_LOG, quest->GetTitle(), entry);
return false;
}
@@ -505,8 +496,7 @@ public:
if (!playerTarget)
{
handler->SendSysMessage(LANG_PLAYER_NOT_FOUND);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_PLAYER_NOT_FOUND);
return false;
}
@@ -517,8 +507,7 @@ public:
// If player doesn't have the quest
if (player->GetQuestStatus(entry) != QUEST_STATUS_COMPLETE)
{
handler->PSendSysMessage(LANG_COMMAND_QUEST_NOTFOUND, entry);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_COMMAND_QUEST_NOTFOUND, entry);
return false;
}
@@ -540,8 +529,7 @@ public:
if (!result)
{
handler->SendSysMessage(LANG_COMMAND_QUEST_NOT_COMPLETE);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_COMMAND_QUEST_NOT_COMPLETE);
return false;
}

View File

@@ -27,6 +27,7 @@ EndScriptData */
#include "AutobroadcastMgr.h"
#include "BattlegroundMgr.h"
#include "Chat.h"
#include "CommandScript.h"
#include "CreatureTextMgr.h"
#include "DisableMgr.h"
#include "GameGraveyard.h"
@@ -280,8 +281,7 @@ public:
{
if (sScriptMgr->IsScriptScheduled())
{
handler->PSendSysMessage("DB scripts used currently, please attempt reload later.");
handler->SetSentErrorMessage(true);
handler->SendErrorMessage("DB scripts used currently, please attempt reload later.");
return false;
}
@@ -476,7 +476,7 @@ public:
Field* fields = result->Fetch();
sObjectMgr->LoadCreatureTemplate(fields);
sObjectMgr->LoadCreatureTemplate(fields, true);
sObjectMgr->CheckCreatureTemplate(cInfo);
}
@@ -728,8 +728,7 @@ public:
{
if (!sWorld->getBoolConfig(CONFIG_WARDEN_ENABLED))
{
handler->SendSysMessage("Warden system disabled by config - reloading warden_action skipped.");
handler->SetSentErrorMessage(true);
handler->SendErrorMessage("Warden system disabled by config - reloading warden_action skipped.");
return false;
}
@@ -961,8 +960,7 @@ public:
{
if (sScriptMgr->IsScriptScheduled())
{
handler->SendSysMessage("DB scripts used currently, please attempt reload later.");
handler->SetSentErrorMessage(true);
handler->SendErrorMessage("DB scripts used currently, please attempt reload later.");
return false;
}
@@ -979,8 +977,7 @@ public:
{
if (sScriptMgr->IsScriptScheduled())
{
handler->SendSysMessage("DB scripts used currently, please attempt reload later.");
handler->SetSentErrorMessage(true);
handler->SendErrorMessage("DB scripts used currently, please attempt reload later.");
return false;
}
@@ -1006,8 +1003,7 @@ public:
{
if (sScriptMgr->IsScriptScheduled())
{
handler->SendSysMessage("DB scripts used currently, please attempt reload later.");
handler->SetSentErrorMessage(true);
handler->SendErrorMessage("DB scripts used currently, please attempt reload later.");
return false;
}

View File

@@ -24,6 +24,7 @@ EndScriptData */
#include "AchievementMgr.h"
#include "Chat.h"
#include "CommandScript.h"
#include "Language.h"
#include "ObjectAccessor.h"
#include "Pet.h"
@@ -229,8 +230,7 @@ public:
}
else
{
handler->SendSysMessage(LANG_NO_CHAR_SELECTED);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_NO_CHAR_SELECTED);
return false;
}
@@ -282,8 +282,7 @@ public:
}
else
{
handler->PSendSysMessage(LANG_RESETALL_UNKNOWN_CASE, caseName);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_RESETALL_UNKNOWN_CASE, caseName);
return false;
}

View File

@@ -16,6 +16,7 @@
*/
#include "Chat.h"
#include "CommandScript.h"
#include "DatabaseEnv.h"
#include "Item.h"
#include "Language.h"
@@ -23,7 +24,6 @@
#include "ObjectMgr.h"
#include "Pet.h"
#include "Player.h"
#include "ScriptMgr.h"
#include "Tokenize.h"
using namespace Acore::ChatCommands;
@@ -89,15 +89,13 @@ public:
ItemTemplate const* itemTemplate = sObjectMgr->GetItemTemplate(itemID);
if (!itemTemplate)
{
handler->PSendSysMessage(LANG_COMMAND_ITEMIDINVALID, itemID);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_COMMAND_ITEMIDINVALID, itemID);
return false;
}
if (!itemCount || (itemTemplate->MaxCount > 0 && itemCount > uint32(itemTemplate->MaxCount)))
{
handler->PSendSysMessage(LANG_COMMAND_INVALID_ITEM_COUNT, itemCount, itemID);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_COMMAND_INVALID_ITEM_COUNT, itemCount, itemID);
return false;
}
@@ -111,8 +109,7 @@ public:
if (itemList.size() > MAX_MAIL_ITEMS)
{
handler->PSendSysMessage(LANG_COMMAND_MAIL_ITEMS_LIMIT, MAX_MAIL_ITEMS);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_COMMAND_MAIL_ITEMS_LIMIT, MAX_MAIL_ITEMS);
return false;
}
}

View File

@@ -23,16 +23,16 @@
EndScriptData */
#include "Chat.h"
#include "CommandScript.h"
#include "Config.h"
#include "GameTime.h"
#include "GitRevision.h"
#include "Language.h"
#include "ModuleMgr.h"
#include "MotdMgr.h"
#include "MySQLThreading.h"
#include "Player.h"
#include "Realm.h"
#include "ScriptMgr.h"
#include "MotdMgr.h"
#include "StringConvert.h"
#include "UpdateTime.h"
#include "VMapFactory.h"
@@ -318,8 +318,7 @@ public:
if (Acore::StringTo<int32>(time).value_or(0) < 0)
{
handler->SendSysMessage(LANG_BAD_VALUE);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_BAD_VALUE);
return false;
}
@@ -344,8 +343,7 @@ public:
if (delay <= 0)
{
handler->SendSysMessage(LANG_BAD_VALUE);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_BAD_VALUE);
return false;
}
@@ -373,8 +371,7 @@ public:
if (Acore::StringTo<int32>(time).value_or(0) < 0)
{
handler->SendSysMessage(LANG_BAD_VALUE);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_BAD_VALUE);
return false;
}
@@ -399,8 +396,7 @@ public:
if (delay <= 0)
{
handler->SendSysMessage(LANG_BAD_VALUE);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_BAD_VALUE);
return false;
}
@@ -428,8 +424,7 @@ public:
if (Acore::StringTo<int32>(time).value_or(0) < 0)
{
handler->SendSysMessage(LANG_BAD_VALUE);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_BAD_VALUE);
return false;
}
@@ -454,8 +449,7 @@ public:
if (delay <= 0)
{
handler->SendSysMessage(LANG_BAD_VALUE);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_BAD_VALUE);
return false;
}
@@ -483,8 +477,7 @@ public:
if (Acore::StringTo<int32>(time).value_or(0) < 0)
{
handler->SendSysMessage(LANG_BAD_VALUE);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_BAD_VALUE);
return false;
}
@@ -509,8 +502,7 @@ public:
if (delay <= 0)
{
handler->SendSysMessage(LANG_BAD_VALUE);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_BAD_VALUE);
return false;
}
@@ -588,8 +580,7 @@ public:
return true;
}
handler->SendSysMessage(LANG_USE_BOL);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_USE_BOL);
return false;
}

View File

@@ -19,8 +19,8 @@
#include "ArenaSpectator.h"
#include "BattlegroundMgr.h"
#include "Chat.h"
#include "CommandScript.h"
#include "Player.h"
#include "ScriptMgr.h"
#include "World.h"
using namespace Acore::ChatCommands;

View File

@@ -23,6 +23,7 @@ Category: commandscripts
EndScriptData */
#include "Chat.h"
#include "CommandScript.h"
#include "DBCStores.h"
#include "DatabaseEnv.h"
#include "Group.h"
@@ -30,7 +31,6 @@ EndScriptData */
#include "MapMgr.h"
#include "ObjectMgr.h"
#include "Player.h"
#include "ScriptMgr.h"
using namespace Acore::ChatCommands;
@@ -75,8 +75,7 @@ public:
if (sObjectMgr->GetGameTele(name))
{
handler->SendSysMessage(LANG_COMMAND_TP_ALREADYEXIST);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_COMMAND_TP_ALREADYEXIST);
return false;
}
@@ -94,8 +93,7 @@ public:
}
else
{
handler->SendSysMessage(LANG_COMMAND_TP_ADDEDERR);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_COMMAND_TP_ADDEDERR);
return false;
}
@@ -106,8 +104,7 @@ public:
{
if (!tele)
{
handler->SendSysMessage(LANG_COMMAND_TELE_NOTFOUND);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_COMMAND_TELE_NOTFOUND);
return false;
}
std::string name = tele->name;
@@ -120,8 +117,7 @@ public:
{
if (!MapMgr::IsValidMapCoord(mapId, pos) || sObjectMgr->IsTransportMap(mapId))
{
handler->PSendSysMessage(LANG_INVALID_TARGET_COORD, pos.GetPositionX(), pos.GetPositionY(), mapId);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_INVALID_TARGET_COORD, pos.GetPositionX(), pos.GetPositionY(), mapId);
return false;
}
@@ -135,8 +131,7 @@ public:
if (target->IsBeingTeleported())
{
handler->PSendSysMessage(LANG_IS_TELEPORTED, chrNameLink.c_str());
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_IS_TELEPORTED, chrNameLink.c_str());
return false;
}
@@ -212,16 +207,14 @@ public:
{
if (!tele)
{
handler->SendSysMessage(LANG_COMMAND_TELE_NOTFOUND);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_COMMAND_TELE_NOTFOUND);
return false;
}
Player* target = handler->getSelectedPlayer();
if (!target)
{
handler->SendSysMessage(LANG_NO_CHAR_SELECTED);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_NO_CHAR_SELECTED);
return false;
}
@@ -232,8 +225,7 @@ public:
MapEntry const* map = sMapStore.LookupEntry(tele->mapId);
if (!map || map->IsBattlegroundOrArena())
{
handler->SendSysMessage(LANG_CANNOT_TELE_TO_BG);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_CANNOT_TELE_TO_BG);
return false;
}
@@ -242,8 +234,7 @@ public:
Group* grp = target->GetGroup();
if (!grp)
{
handler->PSendSysMessage(LANG_NOT_IN_GROUP, nameLink.c_str());
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_NOT_IN_GROUP, nameLink.c_str());
return false;
}
@@ -289,24 +280,21 @@ public:
{
if (!tele)
{
handler->SendSysMessage(LANG_COMMAND_TELE_NOTFOUND);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_COMMAND_TELE_NOTFOUND);
return false;
}
Player* player = handler->GetSession()->GetPlayer();
if (player->IsInCombat())
{
handler->SendSysMessage(LANG_YOU_IN_COMBAT);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_YOU_IN_COMBAT);
return false;
}
MapEntry const* map = sMapStore.LookupEntry(tele->mapId);
if (!map || (map->IsBattlegroundOrArena() && (player->GetMapId() != tele->mapId || !player->IsGameMaster())))
{
handler->SendSysMessage(LANG_CANNOT_TELE_TO_BG);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_CANNOT_TELE_TO_BG);
return false;
}
@@ -342,8 +330,7 @@ public:
if (!spawnpoint)
{
handler->SendSysMessage(LANG_COMMAND_GOCREATNOTFOUND);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_COMMAND_GOCREATNOTFOUND);
return false;
}
@@ -357,8 +344,7 @@ public:
CreatureData const* spawnpoint = sObjectMgr->GetCreatureData(spawnId);
if (!spawnpoint)
{
handler->SendSysMessage(LANG_COMMAND_GOCREATNOTFOUND);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_COMMAND_GOCREATNOTFOUND);
return false;
}
@@ -376,8 +362,7 @@ public:
QueryResult result = WorldDatabase.Query("SELECT c.position_x, c.position_y, c.position_z, c.orientation, c.map, ct.name FROM creature c INNER JOIN creature_template ct ON c.id1 = ct.entry WHERE ct.name LIKE '{}'", normalizedName);
if (!result)
{
handler->SendSysMessage(LANG_COMMAND_GOCREATNOTFOUND);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_COMMAND_GOCREATNOTFOUND);
return false;
}

View File

@@ -24,11 +24,11 @@ EndScriptData */
#include "AccountMgr.h"
#include "Chat.h"
#include "CommandScript.h"
#include "ObjectMgr.h"
#include "Opcodes.h"
#include "Player.h"
#include "Realm.h"
#include "ScriptMgr.h"
#include "TicketMgr.h"
using namespace Acore::ChatCommands;
@@ -158,10 +158,9 @@ public:
return true;
}
static bool HandleGMTicketCommentCommand(ChatHandler* handler, uint32 ticketId)
static bool HandleGMTicketCommentCommand(ChatHandler* handler, uint32 ticketId, Tail comment)
{
char* comment = strtok(nullptr, "\n");
if (!comment)
if (comment.empty())
return false;
GmTicket* ticket = sTicketMgr->GetTicket(ticketId);
@@ -180,14 +179,14 @@ public:
}
CharacterDatabaseTransaction trans = CharacterDatabaseTransaction(nullptr);
ticket->SetComment(comment);
ticket->SetComment(comment.data());
ticket->SaveToDB(trans);
sTicketMgr->UpdateLastChange();
std::string const assignedName = ticket->GetAssignedToName();
std::string msg = ticket->FormatMessageString(*handler, assignedName.empty() ? nullptr : assignedName.c_str(), nullptr, nullptr, nullptr);
msg += handler->PGetParseString(LANG_COMMAND_TICKETLISTADDCOMMENT, player ? player->GetName().c_str() : "Console", comment);
msg += handler->PGetParseString(LANG_COMMAND_TICKETLISTADDCOMMENT, player ? player->GetName().c_str() : "Console", comment.data());
handler->SendGlobalGMSysMessage(msg.c_str());
return true;

View File

@@ -23,10 +23,10 @@ Category: commandscripts
EndScriptData */
#include "Chat.h"
#include "CommandScript.h"
#include "DBCStores.h"
#include "Language.h"
#include "Player.h"
#include "ScriptMgr.h"
using namespace Acore::ChatCommands;
@@ -60,8 +60,7 @@ public:
Player* target = handler->getSelectedPlayer();
if (!target)
{
handler->SendSysMessage(LANG_NO_CHAR_SELECTED);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_NO_CHAR_SELECTED);
return false;
}
@@ -72,8 +71,7 @@ public:
CharTitlesEntry const* titleInfo = sCharTitlesStore.LookupEntry(titleId);
if (!titleInfo)
{
handler->PSendSysMessage(LANG_INVALID_TITLE_ID, uint32(titleId));
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_INVALID_TITLE_ID, uint32(titleId));
return false;
}
@@ -93,8 +91,7 @@ public:
Player* target = handler->getSelectedPlayer();
if (!target)
{
handler->SendSysMessage(LANG_NO_CHAR_SELECTED);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_NO_CHAR_SELECTED);
return false;
}
@@ -105,8 +102,7 @@ public:
CharTitlesEntry const* titleInfo = sCharTitlesStore.LookupEntry(titleId);
if (!titleInfo)
{
handler->PSendSysMessage(LANG_INVALID_TITLE_ID, uint32(titleId));
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_INVALID_TITLE_ID, uint32(titleId));
return false;
}
@@ -124,8 +120,7 @@ public:
Player* target = handler->getSelectedPlayer();
if (!target)
{
handler->SendSysMessage(LANG_NO_CHAR_SELECTED);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_NO_CHAR_SELECTED);
return false;
}
@@ -136,8 +131,7 @@ public:
CharTitlesEntry const* titleInfo = sCharTitlesStore.LookupEntry(titleId);
if (!titleInfo)
{
handler->PSendSysMessage(LANG_INVALID_TITLE_ID, uint32(titleId));
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_INVALID_TITLE_ID, uint32(titleId));
return false;
}
@@ -163,8 +157,7 @@ public:
Player* target = handler->getSelectedPlayer();
if (!target)
{
handler->SendSysMessage(LANG_NO_CHAR_SELECTED);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_NO_CHAR_SELECTED);
return false;
}

View File

@@ -23,10 +23,10 @@ Category: commandscripts
EndScriptData */
#include "Chat.h"
#include "CommandScript.h"
#include "Language.h"
#include "ObjectMgr.h"
#include "Player.h"
#include "ScriptMgr.h"
#include "WaypointMgr.h"
#if AC_COMPILER == AC_COMPILER_GNU
@@ -163,15 +163,13 @@ public:
if (!target)
{
handler->SendSysMessage(LANG_SELECT_CREATURE);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_SELECT_CREATURE);
return false;
}
if (target->GetEntry() == 1)
{
handler->PSendSysMessage("%s%s|r", "|cffff33ff", "You want to load path to a waypoint? Aren't you?");
handler->SetSentErrorMessage(true);
handler->SendErrorMessage("%s%s|r", "|cffff33ff", "You want to load path to a waypoint? Aren't you?");
return false;
}
@@ -772,8 +770,7 @@ public:
if (!target)
{
handler->SendSysMessage(LANG_SELECT_CREATURE);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_SELECT_CREATURE);
return false;
}
@@ -800,8 +797,7 @@ public:
// Check if the user did specify a visual waypoint
if (!target || target->GetEntry() != VISUAL_WAYPOINT)
{
handler->PSendSysMessage(LANG_WAYPOINT_VP_SELECT);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_WAYPOINT_VP_SELECT);
return false;
}
@@ -848,8 +844,7 @@ public:
if (!result)
{
handler->SendSysMessage("|cffff33ffPath no found.|r");
handler->SetSentErrorMessage(true);
handler->SendErrorMessage("|cffff33ffPath no found.|r");
return false;
}
@@ -958,8 +953,7 @@ public:
PreparedQueryResult result = WorldDatabase.Query(stmt);
if (!result)
{
handler->PSendSysMessage(LANG_WAYPOINT_NOTFOUND, pathid);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_WAYPOINT_NOTFOUND, pathid);
return false;
}
@@ -1008,8 +1002,7 @@ public:
PreparedQueryResult result = WorldDatabase.Query(stmt);
if (!result)
{
handler->PSendSysMessage(LANG_WAYPOINT_NOTFOUNDLAST, pathid);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_WAYPOINT_NOTFOUNDLAST, pathid);
return false;
}
@@ -1056,8 +1049,7 @@ public:
PreparedQueryResult result = WorldDatabase.Query(stmt);
if (!result)
{
handler->SendSysMessage(LANG_WAYPOINT_VP_NOTFOUND);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_WAYPOINT_VP_NOTFOUND);
return false;
}

View File

@@ -16,7 +16,7 @@
*/
#include "BattlegroundAV.h"
#include "ScriptMgr.h"
#include "CreatureScript.h"
#include "ScriptedCreature.h"
enum Spells

View File

@@ -15,7 +15,7 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "ScriptMgr.h"
#include "CreatureScript.h"
#include "ScriptedCreature.h"
enum Spells
@@ -23,14 +23,16 @@ enum Spells
SPELL_ARCANE_EXPLOSION = 46608,
SPELL_CONE_OF_COLD = 38384,
SPELL_FIREBALL = 46988,
SPELL_FROSTBOLT = 46987
SPELL_FROSTBOLT = 46987,
SPELL_SUMMON_WATER_ELEMENTAL = 45067,
SPELL_ICEBLOCK = 46604
};
enum Yells
{
YELL_AGGRO = 0,
YELL_EVADE = 1,
YELL_SALVATION = 2,
SAY_AGGRO = 0,
SAY_EVADE = 1,
SAY_SALVATION = 2,
};
enum Creatures
@@ -38,181 +40,110 @@ enum Creatures
NPC_WATER_ELEMENTAL = 25040
};
enum WaterElementalSpells
struct boss_balinda : public ScriptedAI
{
SPELL_WATERBOLT = 46983
};
class npc_water_elemental : public CreatureScript
{
public:
npc_water_elemental() : CreatureScript("npc_water_elemental") { }
struct npc_water_elementalAI : public ScriptedAI
boss_balinda(Creature* creature) : ScriptedAI(creature), summons(me), _hasCastIceBlock(false)
{
npc_water_elementalAI(Creature* creature) : ScriptedAI(creature) { }
uint32 waterBoltTimer;
ObjectGuid balindaGUID;
uint32 resetTimer;
void Reset() override
scheduler.SetValidator([this]
{
waterBoltTimer = 3 * IN_MILLISECONDS;
resetTimer = 5 * IN_MILLISECONDS;
balindaGUID.Clear();
}
void UpdateAI(uint32 diff) override
{
if (!UpdateVictim())
return;
if (waterBoltTimer < diff)
{
DoCastVictim(SPELL_WATERBOLT);
waterBoltTimer = 5 * IN_MILLISECONDS;
}
else waterBoltTimer -= diff;
// check if creature is not outside of building
if (resetTimer < diff)
{
if (Creature* pBalinda = ObjectAccessor::GetCreature(*me, balindaGUID))
if (me->GetDistance2d(pBalinda->GetHomePosition().GetPositionX(), pBalinda->GetHomePosition().GetPositionY()) > 50)
EnterEvadeMode();
resetTimer = 5 * IN_MILLISECONDS;
}
else resetTimer -= diff;
DoMeleeAttackIfReady();
}
};
CreatureAI* GetAI(Creature* creature) const override
{
return new npc_water_elementalAI(creature);
return !me->HasUnitState(UNIT_STATE_CASTING);
});
}
};
class boss_balinda : public CreatureScript
{
public:
boss_balinda() : CreatureScript("boss_balinda") { }
struct boss_balindaAI : public ScriptedAI
void Reset() override
{
boss_balindaAI(Creature* creature) : ScriptedAI(creature), summons(me) { }
summons.DespawnAll();
}
uint32 arcaneExplosionTimer;
uint32 coneOfColdTimer;
uint32 fireBoltTimer;
uint32 frostboltTimer;
uint32 resetTimer;
uint32 waterElementalTimer;
void JustEngagedWith(Unit* /*who*/) override
{
_hasCastIceBlock = false;
SummonList summons;
Talk(SAY_AGGRO);
void Reset() override
ScheduleTimedEvent(3s, [&]
{
arcaneExplosionTimer = urand(5 * IN_MILLISECONDS, 15 * IN_MILLISECONDS);
coneOfColdTimer = 8 * IN_MILLISECONDS;
fireBoltTimer = 1 * IN_MILLISECONDS;
frostboltTimer = 4 * IN_MILLISECONDS;
resetTimer = 5 * IN_MILLISECONDS;
waterElementalTimer = 0;
summons.DespawnAll();
}
void JustEngagedWith(Unit* /*who*/) override
{
Talk(YELL_AGGRO);
}
void JustRespawned() override
{
Reset();
}
void JustSummoned(Creature* summoned) override
{
CAST_AI(npc_water_elemental::npc_water_elementalAI, summoned->AI())->balindaGUID = me->GetGUID();
summoned->AI()->AttackStart(SelectTarget(SelectTargetMethod::Random, 0, 50, true));
summoned->SetFaction(me->GetFaction());
summons.Summon(summoned);
}
void JustDied(Unit* /*killer*/) override
{
summons.DespawnAll();
}
void UpdateAI(uint32 diff) override
{
if (!UpdateVictim())
return;
if (waterElementalTimer < diff)
if (summons.empty())
{
if (summons.empty())
me->SummonCreature(NPC_WATER_ELEMENTAL, 0, 0, 0, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 45 * IN_MILLISECONDS);
waterElementalTimer = 50 * IN_MILLISECONDS;
DoCast(SPELL_SUMMON_WATER_ELEMENTAL);
}
else waterElementalTimer -= diff;
}, 50s, 50s);
if (arcaneExplosionTimer < diff)
ScheduleTimedEvent(5s, 15s, [&]
{
DoCastAOE(SPELL_ARCANE_EXPLOSION);
}, 5s, 15s);
ScheduleTimedEvent(8s, [&]
{
DoCastVictim(SPELL_CONE_OF_COLD);
}, 10s, 20s);
ScheduleTimedEvent(1s, [&]
{
DoCastVictim(SPELL_FIREBALL);
}, 5s, 9s);
ScheduleTimedEvent(4s, [&]
{
DoCastVictim(SPELL_FROSTBOLT);
}, 4s, 12s);
ScheduleTimedEvent(5s, [&]
{
if (me->GetDistance2d(me->GetHomePosition().GetPositionX(), me->GetHomePosition().GetPositionY()) > 50)
{
DoCastVictim(SPELL_ARCANE_EXPLOSION);
arcaneExplosionTimer = urand(5 * IN_MILLISECONDS, 15 * IN_MILLISECONDS);
EnterEvadeMode();
Talk(SAY_EVADE);
}
else arcaneExplosionTimer -= diff;
if (coneOfColdTimer < diff)
if (Creature* elemental = summons.GetCreatureWithEntry(NPC_WATER_ELEMENTAL))
{
DoCastVictim(SPELL_CONE_OF_COLD);
coneOfColdTimer = urand(10 * IN_MILLISECONDS, 20 * IN_MILLISECONDS);
}
else coneOfColdTimer -= diff;
if (fireBoltTimer < diff)
{
DoCastVictim(SPELL_FIREBALL);
fireBoltTimer = urand(5 * IN_MILLISECONDS, 9 * IN_MILLISECONDS);
}
else fireBoltTimer -= diff;
if (frostboltTimer < diff)
{
DoCastVictim(SPELL_FROSTBOLT);
frostboltTimer = urand(4 * IN_MILLISECONDS, 12 * IN_MILLISECONDS);
}
else frostboltTimer -= diff;
// check if creature is not outside of building
if (resetTimer < diff)
{
if (me->GetDistance2d(me->GetHomePosition().GetPositionX(), me->GetHomePosition().GetPositionY()) > 50)
if (elemental->GetDistance2d(me->GetHomePosition().GetPositionX(), me->GetHomePosition().GetPositionY()) > 50)
{
EnterEvadeMode();
Talk(YELL_EVADE);
elemental->AI()->EnterEvadeMode();
}
resetTimer = 5 * IN_MILLISECONDS;
}
else resetTimer -= diff;
DoMeleeAttackIfReady();
}
};
CreatureAI* GetAI(Creature* creature) const override
{
return new boss_balindaAI(creature);
}, 5s, 5s);
}
void JustSummoned(Creature* summoned) override
{
summoned->AI()->AttackStart(SelectTarget(SelectTargetMethod::Random, 0, 50, true));
summoned->SetFaction(me->GetFaction());
summons.Summon(summoned);
}
void DamageTaken(Unit* /*attacker*/, uint32& damage, DamageEffectType /*type*/, SpellSchoolMask /*school*/) override
{
if (me->HealthBelowPctDamaged(40, damage) && !_hasCastIceBlock)
{
DoCast(SPELL_ICEBLOCK);
_hasCastIceBlock = true;
}
}
void JustDied(Unit* /*killer*/) override
{
summons.DespawnAll();
}
void UpdateAI(uint32 diff) override
{
if (!UpdateVictim())
return;
scheduler.Update(diff,
std::bind(&ScriptedAI::DoMeleeAttackIfReady, this));
}
private:
SummonList summons;
bool _hasCastIceBlock;
};
void AddSC_boss_balinda()
{
new boss_balinda;
new npc_water_elemental;
RegisterCreatureAI(boss_balinda);
}

View File

@@ -16,7 +16,7 @@
*/
#include "BattlegroundAV.h"
#include "ScriptMgr.h"
#include "CreatureScript.h"
#include "ScriptedCreature.h"
enum Spells

View File

@@ -15,7 +15,7 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "ScriptMgr.h"
#include "CreatureScript.h"
#include "ScriptedCreature.h"
enum Spells

View File

@@ -16,7 +16,7 @@
*/
#include "BattlegroundAV.h"
#include "ScriptMgr.h"
#include "CreatureScript.h"
#include "ScriptedCreature.h"
enum Yells

View File

@@ -16,13 +16,14 @@
*/
#include "blackrock_depths.h"
#include "AreaTriggerScript.h"
#include "CreatureScript.h"
#include "GameObjectScript.h"
#include "GameTime.h"
#include "Player.h"
#include "ScriptMgr.h"
#include "ScriptedCreature.h"
#include "ScriptedEscortAI.h"
#include "ScriptedGossip.h"
#include "WorldSession.h"
enum IronhandData
{

View File

@@ -15,7 +15,7 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "ScriptMgr.h"
#include "CreatureScript.h"
#include "ScriptedCreature.h"
#include "blackrock_depths.h"
#include <vector>

View File

@@ -15,7 +15,7 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "ScriptMgr.h"
#include "CreatureScript.h"
#include "ScriptedCreature.h"
#include "blackrock_depths.h"

View File

@@ -15,7 +15,7 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "ScriptMgr.h"
#include "CreatureScript.h"
#include "ScriptedCreature.h"
#include "blackrock_depths.h"

View File

@@ -15,7 +15,7 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "ScriptMgr.h"
#include "CreatureScript.h"
#include "ScriptedCreature.h"
#include "blackrock_depths.h"

View File

@@ -15,7 +15,7 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "ScriptMgr.h"
#include "CreatureScript.h"
#include "ScriptedCreature.h"
#include "blackrock_depths.h"

View File

@@ -15,7 +15,7 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "ScriptMgr.h"
#include "CreatureScript.h"
#include "ScriptedCreature.h"
#include "blackrock_depths.h"

View File

@@ -15,7 +15,7 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "ScriptMgr.h"
#include "CreatureScript.h"
#include "ScriptedCreature.h"
#include "blackrock_depths.h"

View File

@@ -15,7 +15,7 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "ScriptMgr.h"
#include "CreatureScript.h"
#include "ScriptedCreature.h"
#include "blackrock_depths.h"

View File

@@ -15,7 +15,7 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "ScriptMgr.h"
#include "CreatureScript.h"
#include "ScriptedCreature.h"
#include "blackrock_depths.h"

View File

@@ -15,7 +15,7 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "ScriptMgr.h"
#include "CreatureScript.h"
#include "ScriptedCreature.h"
#include "blackrock_depths.h"

View File

@@ -15,7 +15,7 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "ScriptMgr.h"
#include "CreatureScript.h"
#include "ScriptedCreature.h"
#include "blackrock_depths.h"

View File

@@ -15,7 +15,7 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "ScriptMgr.h"
#include "CreatureScript.h"
#include "ScriptedCreature.h"
#include "blackrock_depths.h"

View File

@@ -15,8 +15,8 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "CreatureScript.h"
#include "Player.h"
#include "ScriptMgr.h"
#include "ScriptedCreature.h"
#include "ScriptedGossip.h"
#include "blackrock_depths.h"

View File

@@ -16,9 +16,9 @@
*/
#include "GameTime.h"
#include "InstanceMapScript.h"
#include "InstanceScript.h"
#include "Player.h"
#include "ScriptMgr.h"
#include "blackrock_depths.h"
constexpr auto MAX_ENCOUNTER = 6;

View File

@@ -15,7 +15,7 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "ScriptMgr.h"
#include "CreatureScript.h"
#include "ScriptedCreature.h"
#include "blackrock_spire.h"

View File

@@ -15,10 +15,11 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "ScriptMgr.h"
#include "CreatureScript.h"
#include "ScriptedCreature.h"
#include "blackrock_spire.h"
#include "SpellScript.h"
#include "SpellScriptLoader.h"
#include "blackrock_spire.h"
enum Spells
{
@@ -244,3 +245,4 @@ void AddSC_boss_gyth()
new boss_gyth();
RegisterSpellScript(spell_gyth_chromatic_protection);
}

View File

@@ -15,7 +15,7 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "ScriptMgr.h"
#include "CreatureScript.h"
#include "ScriptedCreature.h"
#include "blackrock_spire.h"

View File

@@ -15,7 +15,7 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "ScriptMgr.h"
#include "CreatureScript.h"
#include "ScriptedCreature.h"
#include "blackrock_spire.h"

View File

@@ -15,7 +15,7 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "ScriptMgr.h"
#include "CreatureScript.h"
#include "ScriptedCreature.h"
#include "blackrock_spire.h"

View File

@@ -15,7 +15,7 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "ScriptMgr.h"
#include "CreatureScript.h"
#include "ScriptedCreature.h"
#include "TaskScheduler.h"
#include "blackrock_spire.h"

View File

@@ -15,7 +15,7 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "ScriptMgr.h"
#include "CreatureScript.h"
#include "ScriptedCreature.h"
#include "blackrock_spire.h"

View File

@@ -15,9 +15,9 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "CreatureScript.h"
#include "ObjectMgr.h"
#include "Player.h"
#include "ScriptMgr.h"
#include "ScriptedCreature.h"
#include "Spell.h"
#include "blackrock_spire.h"

View File

@@ -15,7 +15,7 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "ScriptMgr.h"
#include "CreatureScript.h"
#include "ScriptedCreature.h"
#include "SpellInfo.h"
#include "blackrock_spire.h"

View File

@@ -15,8 +15,8 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "CreatureScript.h"
#include "Player.h"
#include "ScriptMgr.h"
#include "ScriptedCreature.h"
#include "blackrock_spire.h"

View File

@@ -15,7 +15,7 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "ScriptMgr.h"
#include "CreatureScript.h"
#include "ScriptedCreature.h"
#include "blackrock_spire.h"

View File

@@ -15,8 +15,9 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "AreaTriggerScript.h"
#include "CreatureScript.h"
#include "Player.h"
#include "ScriptMgr.h"
#include "ScriptedCreature.h"
#include "blackrock_spire.h"

View File

@@ -15,7 +15,7 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "ScriptMgr.h"
#include "CreatureScript.h"
#include "ScriptedCreature.h"
#include "blackrock_spire.h"

View File

@@ -15,7 +15,7 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "ScriptMgr.h"
#include "CreatureScript.h"
#include "ScriptedCreature.h"
#include "blackrock_spire.h"

View File

@@ -15,17 +15,21 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "AreaTriggerScript.h"
#include "Cell.h"
#include "CellImpl.h"
#include "CreatureScript.h"
#include "GameObjectScript.h"
#include "GridNotifiers.h"
#include "GridNotifiersImpl.h"
#include "InstanceMapScript.h"
#include "InstanceScript.h"
#include "ObjectDefines.h"
#include "ObjectMgr.h"
#include "ScriptMgr.h"
#include "ScriptedCreature.h"
#include "SpellScript.h"
#include "SpellScriptLoader.h"
#include "blackrock_spire.h"
#include "GridNotifiersImpl.h"
uint32 const DragonspireMobs[3] = { NPC_BLACKHAND_DREADWEAVER, NPC_BLACKHAND_SUMMONER, NPC_BLACKHAND_VETERAN };
@@ -176,7 +180,7 @@ public:
creature->AI()->Talk(SAY_FINKLE_GANG);
break;
case NPC_CHROMATIC_ELITE_GUARD:
AddMinion(creature, true);
AddMinion(creature);
break;
}
}

View File

@@ -15,13 +15,16 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "CreatureScript.h"
#include "GameObject.h"
#include "GameObjectAI.h"
#include "GameObjectScript.h"
#include "InstanceMapScript.h"
#include "InstanceScript.h"
#include "ScriptMgr.h"
#include "ScriptedCreature.h"
#include "blackwing_lair.h"
#include "SpellScript.h"
#include "SpellScriptLoader.h"
#include "blackwing_lair.h"
enum Say
{
@@ -273,3 +276,4 @@ void AddSC_boss_broodlord()
new go_suppression_device();
RegisterSpellScript(spell_suppression_aura);
}

View File

@@ -15,14 +15,17 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "CreatureScript.h"
#include "GameObject.h"
#include "GameObjectAI.h"
#include "GameObjectScript.h"
#include "InstanceMapScript.h"
#include "InstanceScript.h"
#include "Map.h"
#include "Player.h"
#include "ScriptMgr.h"
#include "ScriptedCreature.h"
#include "SpellScript.h"
#include "SpellScriptLoader.h"
#include "blackwing_lair.h"
enum Emotes
@@ -363,3 +366,4 @@ void AddSC_boss_chromaggus()
RegisterSpellScript(spell_gen_elemental_shield);
RegisterSpellScript(spell_gen_brood_power);
}

View File

@@ -15,7 +15,7 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "ScriptMgr.h"
#include "CreatureScript.h"
#include "ScriptedCreature.h"
#include "blackwing_lair.h"

View File

@@ -15,7 +15,7 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "ScriptMgr.h"
#include "CreatureScript.h"
#include "ScriptedCreature.h"
#include "blackwing_lair.h"

View File

@@ -15,7 +15,7 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "ScriptMgr.h"
#include "CreatureScript.h"
#include "ScriptedCreature.h"
#include "blackwing_lair.h"

View File

@@ -15,17 +15,19 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "CreatureScript.h"
#include "GameObject.h"
#include "InstanceMapScript.h"
#include "InstanceScript.h"
#include "MotionMaster.h"
#include "Player.h"
#include "ScriptMgr.h"
#include "ScriptedCreature.h"
#include "ScriptedGossip.h"
#include "SpellScript.h"
#include "SpellScriptLoader.h"
#include "TaskScheduler.h"
#include "TemporarySummon.h"
#include "blackwing_lair.h"
#include "TaskScheduler.h"
enum Events
{
@@ -327,7 +329,6 @@ public:
if (Creature* nefarian = me->SummonCreature(NPC_NEFARIAN, NefarianSpawn))
{
nefarian->setActive(true);
nefarian->SetFarVisible(true);
nefarian->SetCanFly(true);
nefarian->SetDisableGravity(true);
nefarian->GetMotionMaster()->MovePath(NEFARIAN_PATH, false);
@@ -1306,3 +1307,4 @@ void AddSC_boss_nefarian()
RegisterSpellScript(spell_shadowblink);
RegisterSpellScript(spell_spawn_drakonid);
}

View File

@@ -15,10 +15,12 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "CreatureScript.h"
#include "GameObjectScript.h"
#include "Player.h"
#include "ScriptMgr.h"
#include "ScriptedCreature.h"
#include "SpellScript.h"
#include "SpellScriptLoader.h"
#include "blackwing_lair.h"
enum Say
@@ -347,3 +349,4 @@ void AddSC_boss_razorgore()
new go_orb_of_domination();
new spell_egg_event();
}

View File

@@ -15,13 +15,14 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "CreatureScript.h"
#include "ObjectAccessor.h"
#include "Player.h"
#include "ScriptMgr.h"
#include "ScriptedCreature.h"
#include "ScriptedGossip.h"
#include "SpellAuraEffects.h"
#include "SpellScript.h"
#include "SpellScriptLoader.h"
#include "blackwing_lair.h"
constexpr float aNefariusSpawnLoc[4] = { -7466.16f, -1040.80f, 412.053f, 2.14675f };
@@ -327,3 +328,4 @@ void AddSC_boss_vaelastrasz()
new boss_vaelastrasz();
RegisterSpellScript(spell_vael_burning_adrenaline);
}

View File

@@ -15,18 +15,19 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "AreaTriggerScript.h"
#include "EventMap.h"
#include "GameObject.h"
#include "InstanceMapScript.h"
#include "InstanceScript.h"
#include "Map.h"
#include "MotionMaster.h"
#include "Player.h"
#include "ScriptMgr.h"
#include "SpellAuraEffects.h"
#include "SpellScript.h"
#include "SpellScriptLoader.h"
#include "TemporarySummon.h"
#include "blackwing_lair.h"
#include <array>
DoorData const doorData[] =
@@ -425,7 +426,6 @@ public:
{
nefarius->SetPhaseMask(1, true);
nefarius->setActive(true);
nefarius->SetFarVisible(true);
nefarius->Respawn();
nefarius->GetMotionMaster()->MoveTargetedHome();
}
@@ -542,3 +542,4 @@ void AddSC_instance_blackwing_lair()
new spell_bwl_shadowflame();
new at_orb_of_command();
}

View File

@@ -15,10 +15,11 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "ScriptMgr.h"
#include "CreatureScript.h"
#include "ScriptedCreature.h"
#include "SpellAuraEffects.h"
#include "SpellScript.h"
#include "SpellScriptLoader.h"
#include "molten_core.h"
enum Emotes
@@ -250,3 +251,4 @@ void AddSC_boss_baron_geddon()
new spell_geddon_inferno();
new spell_geddon_armageddon();
}

View File

@@ -16,12 +16,13 @@
*/
#include "Containers.h"
#include "CreatureScript.h"
#include "ObjectAccessor.h"
#include "ScriptMgr.h"
#include "ScriptedCreature.h"
#include "SpellAuras.h"
#include "SpellInfo.h"
#include "SpellScript.h"
#include "SpellScriptLoader.h"
#include "molten_core.h"
enum Texts
@@ -253,3 +254,4 @@ void AddSC_boss_garr()
new spell_garr_separation_nexiety();
new spell_garr_frenzy();
}

View File

@@ -15,7 +15,7 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "ScriptMgr.h"
#include "CreatureScript.h"
#include "ScriptedCreature.h"
#include "molten_core.h"

View File

@@ -15,8 +15,8 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "CreatureScript.h"
#include "ObjectAccessor.h"
#include "ScriptMgr.h"
#include "ScriptedCreature.h"
#include "molten_core.h"

View File

@@ -15,7 +15,7 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "ScriptMgr.h"
#include "CreatureScript.h"
#include "ScriptedCreature.h"
#include "molten_core.h"

View File

@@ -15,9 +15,10 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "ScriptMgr.h"
#include "CreatureScript.h"
#include "ScriptedCreature.h"
#include "SpellScript.h"
#include "SpellScriptLoader.h"
#include "molten_core.h"
enum Texts
@@ -177,3 +178,4 @@ void AddSC_boss_magmadar()
// Spells
new spell_magmadar_lava_bomb();
}

View File

@@ -15,12 +15,13 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "CreatureScript.h"
#include "ObjectAccessor.h"
#include "Player.h"
#include "ScriptMgr.h"
#include "ScriptedCreature.h"
#include "ScriptedGossip.h"
#include "SpellScript.h"
#include "SpellScriptLoader.h"
#include "molten_core.h"
enum Texts
@@ -694,3 +695,4 @@ void AddSC_boss_majordomo()
new spell_majordomo_separation_nexiety();
new spell_summon_ragnaros();
}

View File

@@ -15,9 +15,10 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "ScriptMgr.h"
#include "CreatureScript.h"
#include "ScriptedCreature.h"
#include "SpellScript.h"
#include "SpellScriptLoader.h"
#include "molten_core.h"
enum Texts
@@ -563,3 +564,4 @@ void AddSC_boss_ragnaros()
RegisterSpellScript(spell_ragnaros_lava_burst_randomizer);
RegisterSpellScript(spell_ragnaros_summon_sons_of_flame);
}

View File

@@ -15,10 +15,11 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "CreatureScript.h"
#include "Player.h"
#include "ScriptMgr.h"
#include "ScriptedCreature.h"
#include "SpellScript.h"
#include "SpellScriptLoader.h"
#include "molten_core.h"
enum Spells
@@ -197,3 +198,4 @@ void AddSC_boss_shazzrah()
// Spells
new spell_shazzrah_gate_dummy();
}

Some files were not shown because too many files have changed in this diff Show More