refactor(Scripts/Commands): Convert commands to new system Part 1 (#8704)
This commit is contained in:
committed by
GitHub
parent
67b3ac442a
commit
fe682805ab
@@ -2510,6 +2510,7 @@ public:
|
|||||||
void ClearWhisperWhiteList() { WhisperList.clear(); }
|
void ClearWhisperWhiteList() { WhisperList.clear(); }
|
||||||
void AddWhisperWhiteList(ObjectGuid guid) { WhisperList.push_back(guid); }
|
void AddWhisperWhiteList(ObjectGuid guid) { WhisperList.push_back(guid); }
|
||||||
bool IsInWhisperWhiteList(ObjectGuid guid);
|
bool IsInWhisperWhiteList(ObjectGuid guid);
|
||||||
|
void RemoveFromWhisperWhiteList(ObjectGuid guid) { WhisperList.remove(guid); }
|
||||||
|
|
||||||
bool SetDisableGravity(bool disable, bool packetOnly /* = false */) override;
|
bool SetDisableGravity(bool disable, bool packetOnly /* = false */) override;
|
||||||
bool SetCanFly(bool apply, bool packetOnly = false) override;
|
bool SetCanFly(bool apply, bool packetOnly = false) override;
|
||||||
|
|||||||
@@ -15,78 +15,90 @@
|
|||||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @file cs_deserter.cpp
|
||||||
|
* @brief .deserter related commands
|
||||||
|
*
|
||||||
|
* This file contains the CommandScripts for all deserter sub-commands
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "ScriptMgr.h"
|
||||||
#include "Chat.h"
|
#include "Chat.h"
|
||||||
#include "Language.h"
|
#include "Language.h"
|
||||||
#include "Player.h"
|
#include "Player.h"
|
||||||
#include "ScriptMgr.h"
|
|
||||||
#include "SpellAuraEffects.h"
|
|
||||||
#include "SpellAuras.h"
|
#include "SpellAuras.h"
|
||||||
|
|
||||||
|
using namespace Acore::ChatCommands;
|
||||||
|
|
||||||
enum Spells
|
enum Spells
|
||||||
{
|
{
|
||||||
LFG_SPELL_DUNGEON_DESERTER = 71041,
|
LFG_SPELL_DUNGEON_DESERTER = 71041,
|
||||||
BG_SPELL_DESERTER = 26013
|
BG_SPELL_DESERTER = 26013
|
||||||
};
|
};
|
||||||
|
|
||||||
#if AC_COMPILER == AC_COMPILER_GNU
|
|
||||||
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
using namespace Acore::ChatCommands;
|
|
||||||
|
|
||||||
class deserter_commandscript : public CommandScript
|
class deserter_commandscript : public CommandScript
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
deserter_commandscript() : CommandScript("deserter_commandscript") { }
|
deserter_commandscript() : CommandScript("deserter_commandscript") { }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Returns the command structure for the system.
|
||||||
|
*/
|
||||||
|
|
||||||
ChatCommandTable GetCommands() const override
|
ChatCommandTable GetCommands() const override
|
||||||
{
|
{
|
||||||
static ChatCommandTable deserterinstanceCommandTable =
|
static ChatCommandTable deserterInstanceCommandTable =
|
||||||
{
|
{
|
||||||
{ "add", SEC_ADMINISTRATOR, false, &HandleDeserterInstanceAdd, "" },
|
{ "add", HandleDeserterInstanceAdd, SEC_ADMINISTRATOR, Console::No },
|
||||||
{ "remove", SEC_ADMINISTRATOR, false, &HandleDeserterInstanceRemove, "" }
|
{ "remove", HandleDeserterInstanceRemove, SEC_ADMINISTRATOR, Console::No }
|
||||||
};
|
};
|
||||||
|
|
||||||
static ChatCommandTable deserterBGCommandTable =
|
static ChatCommandTable deserterBGCommandTable =
|
||||||
{
|
{
|
||||||
{ "add", SEC_ADMINISTRATOR, false, &HandleDeserterBGAdd, "" },
|
{ "add", HandleDeserterBGAdd, SEC_ADMINISTRATOR, Console::No },
|
||||||
{ "remove", SEC_ADMINISTRATOR, false, &HandleDeserterBGRemove, "" }
|
{ "remove", HandleDeserterBGRemove, SEC_ADMINISTRATOR, Console::No }
|
||||||
};
|
};
|
||||||
|
|
||||||
static ChatCommandTable deserterCommandTable =
|
static ChatCommandTable deserterCommandTable =
|
||||||
{
|
{
|
||||||
{ "instance", SEC_ADMINISTRATOR, false, nullptr, "", deserterinstanceCommandTable },
|
{ "instance", deserterInstanceCommandTable },
|
||||||
{ "bg", SEC_ADMINISTRATOR, false, nullptr, "", deserterBGCommandTable }
|
{ "bg", deserterBGCommandTable }
|
||||||
};
|
};
|
||||||
|
|
||||||
static ChatCommandTable commandTable =
|
static ChatCommandTable commandTable =
|
||||||
{
|
{
|
||||||
{ "deserter", SEC_ADMINISTRATOR, false, nullptr, "", deserterCommandTable }
|
{ "deserter", deserterCommandTable }
|
||||||
};
|
};
|
||||||
|
|
||||||
return commandTable;
|
return commandTable;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool HandleDeserterAdd(ChatHandler* handler, char const* args, bool isInstance)
|
/**
|
||||||
|
* @brief Applies the Deserter Debuff to a player
|
||||||
|
*
|
||||||
|
* This function applies a Deserter Debuff of the given type (Instance or BG) to the
|
||||||
|
* selected player, with the provided duration in seconds.
|
||||||
|
*
|
||||||
|
* @param handler The ChatHandler, passed by the system.
|
||||||
|
* @param time The provided duration in seconds.
|
||||||
|
* @param isInstance provided by the relaying functions, so we don't have
|
||||||
|
* to write that much code :)
|
||||||
|
*
|
||||||
|
* @return true if everything was correct, false if an error occured.
|
||||||
|
*
|
||||||
|
* Example Usage:
|
||||||
|
* @code
|
||||||
|
* .deserter instance add 3600 (one hour)
|
||||||
|
* -or-
|
||||||
|
* .deserter bg add 3600 (one hour)
|
||||||
|
* @endcode
|
||||||
|
*/
|
||||||
|
static bool HandleDeserterAdd(ChatHandler* handler, uint32 time, bool isInstance)
|
||||||
{
|
{
|
||||||
if (!*args)
|
Player* player = handler->getSelectedPlayer();
|
||||||
return false;
|
if (!player)
|
||||||
|
|
||||||
Player* targetPlayer = handler->getSelectedPlayer();
|
|
||||||
if (!targetPlayer)
|
|
||||||
{
|
{
|
||||||
handler->SendSysMessage(LANG_NO_CHAR_SELECTED);
|
handler->SendSysMessage(LANG_NO_CHAR_SELECTED);
|
||||||
handler->SetSentErrorMessage(true);
|
handler->SetSentErrorMessage(true);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
char* timeStr = strtok((char*)args, " ");
|
|
||||||
if (!timeStr)
|
|
||||||
{
|
|
||||||
handler->SendSysMessage(LANG_BAD_VALUE);
|
|
||||||
handler->SetSentErrorMessage(true);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
uint32 time = atoi(timeStr);
|
|
||||||
|
|
||||||
if (!time)
|
if (!time)
|
||||||
{
|
{
|
||||||
@@ -95,7 +107,7 @@ public:
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Aura* aura = targetPlayer->AddAura(isInstance ? LFG_SPELL_DUNGEON_DESERTER : BG_SPELL_DESERTER, targetPlayer);
|
Aura* aura = player->AddAura(isInstance ? LFG_SPELL_DUNGEON_DESERTER : BG_SPELL_DESERTER, player);
|
||||||
|
|
||||||
if (!aura)
|
if (!aura)
|
||||||
{
|
{
|
||||||
@@ -108,39 +120,62 @@ public:
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool HandleDeserterRemove(ChatHandler* handler, char const* /*args*/, bool isInstance)
|
/**
|
||||||
|
* @brief Removes the Deserter Debuff from a player
|
||||||
|
*
|
||||||
|
* This function removes a Deserter Debuff of the given type (Instance or BG) from the
|
||||||
|
* selected player.
|
||||||
|
*
|
||||||
|
* @param handler The ChatHandler, passed by the system.
|
||||||
|
* @param isInstance provided by the relaying functions, so we don't have
|
||||||
|
* to write that much code :)
|
||||||
|
*
|
||||||
|
* @return true if everything was correct, false if an error occured.
|
||||||
|
*
|
||||||
|
* Example Usage:
|
||||||
|
* @code
|
||||||
|
* .deserter instance remove
|
||||||
|
* -or-
|
||||||
|
* .deserter bg remove
|
||||||
|
* @endcode
|
||||||
|
*/
|
||||||
|
static bool HandleDeserterRemove(ChatHandler* handler, bool isInstance)
|
||||||
{
|
{
|
||||||
Player* targetPlayer = handler->getSelectedPlayer();
|
Player* player = handler->getSelectedPlayer();
|
||||||
if (!targetPlayer)
|
if (!player)
|
||||||
{
|
{
|
||||||
handler->SendSysMessage(LANG_NO_CHAR_SELECTED);
|
handler->SendSysMessage(LANG_NO_CHAR_SELECTED);
|
||||||
handler->SetSentErrorMessage(true);
|
handler->SetSentErrorMessage(true);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
targetPlayer->RemoveAura(isInstance ? LFG_SPELL_DUNGEON_DESERTER : BG_SPELL_DESERTER);
|
player->RemoveAura(isInstance ? LFG_SPELL_DUNGEON_DESERTER : BG_SPELL_DESERTER);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool HandleDeserterInstanceAdd(ChatHandler* handler, char const* args)
|
/// @sa HandleDeserterAdd()
|
||||||
|
static bool HandleDeserterInstanceAdd(ChatHandler* handler, uint32 time)
|
||||||
{
|
{
|
||||||
return HandleDeserterAdd(handler, args, true);
|
return HandleDeserterAdd(handler, time, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool HandleDeserterBGAdd(ChatHandler* handler, char const* args)
|
/// @sa HandleDeserterAdd()
|
||||||
|
static bool HandleDeserterBGAdd(ChatHandler* handler, uint32 time)
|
||||||
{
|
{
|
||||||
return HandleDeserterAdd(handler, args, false);
|
return HandleDeserterAdd(handler, time, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool HandleDeserterInstanceRemove(ChatHandler* handler, char const* args)
|
/// @sa HandleDeserterRemove()
|
||||||
|
static bool HandleDeserterInstanceRemove(ChatHandler* handler)
|
||||||
{
|
{
|
||||||
return HandleDeserterRemove(handler, args, true);
|
return HandleDeserterRemove(handler, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool HandleDeserterBGRemove(ChatHandler* handler, char const* args)
|
/// @sa HandleDeserterRemove()
|
||||||
|
static bool HandleDeserterBGRemove(ChatHandler* handler)
|
||||||
{
|
{
|
||||||
return HandleDeserterRemove(handler, args, false);
|
return HandleDeserterRemove(handler, false);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -22,19 +22,17 @@ Comment: All gm related commands
|
|||||||
Category: commandscripts
|
Category: commandscripts
|
||||||
EndScriptData */
|
EndScriptData */
|
||||||
|
|
||||||
|
#include "ScriptMgr.h"
|
||||||
#include "AccountMgr.h"
|
#include "AccountMgr.h"
|
||||||
#include "Chat.h"
|
#include "Chat.h"
|
||||||
|
#include "DatabaseEnv.h"
|
||||||
#include "Language.h"
|
#include "Language.h"
|
||||||
#include "ObjectMgr.h"
|
#include "ObjectAccessor.h"
|
||||||
#include "Opcodes.h"
|
#include "Opcodes.h"
|
||||||
#include "Player.h"
|
#include "Player.h"
|
||||||
#include "Realm.h"
|
#include "Realm.h"
|
||||||
#include "ScriptMgr.h"
|
|
||||||
#include "World.h"
|
#include "World.h"
|
||||||
|
#include "WorldSession.h"
|
||||||
#if AC_COMPILER == AC_COMPILER_GNU
|
|
||||||
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
using namespace Acore::ChatCommands;
|
using namespace Acore::ChatCommands;
|
||||||
|
|
||||||
@@ -47,47 +45,47 @@ public:
|
|||||||
{
|
{
|
||||||
static ChatCommandTable gmCommandTable =
|
static ChatCommandTable gmCommandTable =
|
||||||
{
|
{
|
||||||
{ "chat", SEC_GAMEMASTER, false, &HandleGMChatCommand, "" },
|
{ "chat", HandleGMChatCommand, SEC_GAMEMASTER, Console::No },
|
||||||
{ "fly", SEC_GAMEMASTER, false, &HandleGMFlyCommand, "" },
|
{ "fly", HandleGMFlyCommand, SEC_GAMEMASTER, Console::No },
|
||||||
{ "ingame", SEC_PLAYER, true, &HandleGMListIngameCommand, "" },
|
{ "ingame", HandleGMListIngameCommand, SEC_PLAYER, Console::Yes },
|
||||||
{ "list", SEC_GAMEMASTER, true, &HandleGMListFullCommand, "" },
|
{ "list", HandleGMListFullCommand, SEC_GAMEMASTER, Console::Yes },
|
||||||
{ "visible", SEC_GAMEMASTER, false, &HandleGMVisibleCommand, "" },
|
{ "visible", HandleGMVisibleCommand, SEC_GAMEMASTER, Console::No },
|
||||||
{ "", SEC_MODERATOR, false, &HandleGMCommand, "" }
|
{ "on", HandleGMOnCommand, SEC_GAMEMASTER, Console::No },
|
||||||
|
{ "off", HandleGMOffCommand, SEC_GAMEMASTER, Console::No }
|
||||||
};
|
};
|
||||||
static ChatCommandTable commandTable =
|
static ChatCommandTable commandTable =
|
||||||
{
|
{
|
||||||
{ "gm", SEC_MODERATOR, false, nullptr, "", gmCommandTable }
|
{ "gm", gmCommandTable }
|
||||||
};
|
};
|
||||||
return commandTable;
|
return commandTable;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Enables or disables hiding of the staff badge
|
// Enables or disables the staff badge
|
||||||
static bool HandleGMChatCommand(ChatHandler* handler, char const* args)
|
static bool HandleGMChatCommand(ChatHandler* handler, Optional<bool> enableArg)
|
||||||
{
|
{
|
||||||
if (!*args)
|
if (WorldSession* session = handler->GetSession())
|
||||||
{
|
{
|
||||||
WorldSession* session = handler->GetSession();
|
if (!enableArg)
|
||||||
if (!AccountMgr::IsPlayerAccount(session->GetSecurity()) && session->GetPlayer()->isGMChat())
|
{
|
||||||
|
if (!AccountMgr::IsPlayerAccount(session->GetSecurity()) && session->GetPlayer()->isGMChat())
|
||||||
|
session->SendNotification(LANG_GM_CHAT_ON);
|
||||||
|
else
|
||||||
|
session->SendNotification(LANG_GM_CHAT_OFF);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (*enableArg)
|
||||||
|
{
|
||||||
|
session->GetPlayer()->SetGMChat(true);
|
||||||
session->SendNotification(LANG_GM_CHAT_ON);
|
session->SendNotification(LANG_GM_CHAT_ON);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
session->GetPlayer()->SetGMChat(false);
|
||||||
session->SendNotification(LANG_GM_CHAT_OFF);
|
session->SendNotification(LANG_GM_CHAT_OFF);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string param = (char*)args;
|
|
||||||
|
|
||||||
if (param == "on")
|
|
||||||
{
|
|
||||||
handler->GetSession()->GetPlayer()->SetGMChat(true);
|
|
||||||
handler->GetSession()->SendNotification(LANG_GM_CHAT_ON);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (param == "off")
|
|
||||||
{
|
|
||||||
handler->GetSession()->GetPlayer()->SetGMChat(false);
|
|
||||||
handler->GetSession()->SendNotification(LANG_GM_CHAT_OFF);
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
handler->SendSysMessage(LANG_USE_BOL);
|
handler->SendSysMessage(LANG_USE_BOL);
|
||||||
@@ -95,51 +93,37 @@ public:
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool HandleGMFlyCommand(ChatHandler* handler, char const* args)
|
static bool HandleGMFlyCommand(ChatHandler* handler, bool enable)
|
||||||
{
|
{
|
||||||
if (!*args)
|
Player* target = handler->getSelectedPlayer();
|
||||||
return false;
|
if (!target)
|
||||||
|
|
||||||
Player* target = handler->getSelectedPlayer();
|
|
||||||
if (!target || AccountMgr::IsGMAccount(handler->GetSession()->GetSecurity()))
|
|
||||||
target = handler->GetSession()->GetPlayer();
|
target = handler->GetSession()->GetPlayer();
|
||||||
|
|
||||||
WorldPacket data(12);
|
WorldPacket data(12);
|
||||||
if (strncmp(args, "on", 3) == 0)
|
if (enable)
|
||||||
{
|
|
||||||
data.SetOpcode(SMSG_MOVE_SET_CAN_FLY);
|
data.SetOpcode(SMSG_MOVE_SET_CAN_FLY);
|
||||||
sScriptMgr->AnticheatSetCanFlybyServer(target, true);
|
|
||||||
}
|
|
||||||
else if (strncmp(args, "off", 4) == 0)
|
|
||||||
{
|
|
||||||
data.SetOpcode(SMSG_MOVE_UNSET_CAN_FLY);
|
|
||||||
sScriptMgr->AnticheatSetCanFlybyServer(target, false);
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
data.SetOpcode(SMSG_MOVE_UNSET_CAN_FLY);
|
||||||
handler->SendSysMessage(LANG_USE_BOL);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
data << target->GetPackGUID();
|
data << target->GetPackGUID();
|
||||||
data << uint32(0); // unknown
|
data << uint32(0); // unknown
|
||||||
target->SendMessageToSet(&data, true);
|
target->SendMessageToSet(&data, true);
|
||||||
handler->PSendSysMessage(LANG_COMMAND_FLYMODE_STATUS, handler->GetNameLink(target).c_str(), args);
|
handler->PSendSysMessage(LANG_COMMAND_FLYMODE_STATUS, handler->GetNameLink(target).c_str(), enable ? "on" : "off");
|
||||||
handler->SetSentErrorMessage(true);
|
return true;
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool HandleGMListIngameCommand(ChatHandler* handler, char const* /*args*/)
|
static bool HandleGMListIngameCommand(ChatHandler* handler)
|
||||||
{
|
{
|
||||||
bool first = true;
|
bool first = true;
|
||||||
bool footer = false;
|
bool footer = false;
|
||||||
|
|
||||||
std::shared_lock<std::shared_mutex> lock(*HashMapHolder<Player>::GetLock());
|
std::shared_lock<std::shared_mutex> lock(*HashMapHolder<Player>::GetLock());
|
||||||
HashMapHolder<Player>::MapType const& m = ObjectAccessor::GetPlayers();
|
for (auto const& [playerGuid, player] : ObjectAccessor::GetPlayers())
|
||||||
for (HashMapHolder<Player>::MapType::const_iterator itr = m.begin(); itr != m.end(); ++itr)
|
|
||||||
{
|
{
|
||||||
AccountTypes itrSec = itr->second->GetSession()->GetSecurity();
|
AccountTypes playerSec = player->GetSession()->GetSecurity();
|
||||||
if ((itr->second->IsGameMaster() || (!AccountMgr::IsPlayerAccount(itrSec) && itrSec <= AccountTypes(sWorld->getIntConfig(CONFIG_GM_LEVEL_IN_GM_LIST)))) &&
|
if ((player->IsGameMaster() ||
|
||||||
(!handler->GetSession() || itr->second->IsVisibleGloballyFor(handler->GetSession()->GetPlayer())))
|
(!AccountMgr::IsPlayerAccount(playerSec) && playerSec <= AccountTypes(sWorld->getIntConfig(CONFIG_GM_LEVEL_IN_GM_LIST)))) &&
|
||||||
|
(!handler->GetSession() || player->IsVisibleGloballyFor(handler->GetSession()->GetPlayer())))
|
||||||
{
|
{
|
||||||
if (first)
|
if (first)
|
||||||
{
|
{
|
||||||
@@ -148,9 +132,9 @@ public:
|
|||||||
handler->SendSysMessage(LANG_GMS_ON_SRV);
|
handler->SendSysMessage(LANG_GMS_ON_SRV);
|
||||||
handler->SendSysMessage("========================");
|
handler->SendSysMessage("========================");
|
||||||
}
|
}
|
||||||
std::string const& name = itr->second->GetName();
|
std::string const& name = player->GetName();
|
||||||
uint8 size = name.size();
|
uint8 size = uint8(name.size());
|
||||||
uint8 security = itrSec;
|
uint8 security = playerSec;
|
||||||
uint8 max = ((16 - size) / 2);
|
uint8 max = ((16 - size) / 2);
|
||||||
uint8 max2 = max;
|
uint8 max2 = max;
|
||||||
if ((max + max2 + size) == 16)
|
if ((max + max2 + size) == 16)
|
||||||
@@ -169,7 +153,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Display the list of GMs
|
/// Display the list of GMs
|
||||||
static bool HandleGMListFullCommand(ChatHandler* handler, char const* /*args*/)
|
static bool HandleGMListFullCommand(ChatHandler* handler)
|
||||||
{
|
{
|
||||||
///- Get the accounts with GM Level >0
|
///- Get the accounts with GM Level >0
|
||||||
LoginDatabasePreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_GM_ACCOUNTS);
|
LoginDatabasePreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_GM_ACCOUNTS);
|
||||||
@@ -204,77 +188,52 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Enable\Disable Invisible mode
|
//Enable\Disable Invisible mode
|
||||||
static bool HandleGMVisibleCommand(ChatHandler* handler, char const* args)
|
static bool HandleGMVisibleCommand(ChatHandler* handler, Optional<bool> visibleArg)
|
||||||
{
|
{
|
||||||
Player* _player = handler->GetSession()->GetPlayer();
|
Player* _player = handler->GetSession()->GetPlayer();
|
||||||
|
|
||||||
if (!*args)
|
if (!visibleArg)
|
||||||
{
|
{
|
||||||
handler->PSendSysMessage(LANG_YOU_ARE, _player->isGMVisible() ? handler->GetAcoreString(LANG_VISIBLE) : handler->GetAcoreString(LANG_INVISIBLE));
|
handler->PSendSysMessage(LANG_YOU_ARE, _player->isGMVisible() ? handler->GetAcoreString(LANG_VISIBLE) : handler->GetAcoreString(LANG_INVISIBLE));
|
||||||
handler->SetSentErrorMessage(true);
|
return true;
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string param = (char*)args;
|
const uint32 VISUAL_AURA = 37800;
|
||||||
|
|
||||||
if (param == "on")
|
if (*visibleArg)
|
||||||
{
|
{
|
||||||
|
if (_player->HasAura(VISUAL_AURA))
|
||||||
|
_player->RemoveAurasDueToSpell(VISUAL_AURA);
|
||||||
|
|
||||||
_player->SetGMVisible(true);
|
_player->SetGMVisible(true);
|
||||||
//_player->UpdateObjectVisibility();
|
_player->UpdateObjectVisibility();
|
||||||
handler->GetSession()->SendNotification(LANG_INVISIBLE_VISIBLE);
|
handler->GetSession()->SendNotification(LANG_INVISIBLE_VISIBLE);
|
||||||
handler->SetSentErrorMessage(true);
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
if (param == "off")
|
|
||||||
{
|
{
|
||||||
|
_player->AddAura(VISUAL_AURA, _player);
|
||||||
_player->SetGMVisible(false);
|
_player->SetGMVisible(false);
|
||||||
//_player->UpdateObjectVisibility();
|
_player->UpdateObjectVisibility();
|
||||||
handler->GetSession()->SendNotification(LANG_INVISIBLE_INVISIBLE);
|
handler->GetSession()->SendNotification(LANG_INVISIBLE_INVISIBLE);
|
||||||
handler->SetSentErrorMessage(true);
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
handler->SendSysMessage(LANG_USE_BOL);
|
return true;
|
||||||
handler->SetSentErrorMessage(true);
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//Enable\Disable GM Mode
|
static bool HandleGMOnCommand(ChatHandler* handler)
|
||||||
static bool HandleGMCommand(ChatHandler* handler, char const* args)
|
|
||||||
{
|
{
|
||||||
Player* _player = handler->GetSession()->GetPlayer();
|
handler->GetPlayer()->SetGameMaster(true);
|
||||||
|
handler->GetPlayer()->UpdateTriggerVisibility();
|
||||||
|
handler->GetSession()->SendNotification(LANG_GM_ON);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
if (!*args)
|
static bool HandleGMOffCommand(ChatHandler* handler)
|
||||||
{
|
{
|
||||||
handler->GetSession()->SendNotification(_player->IsGameMaster() ? LANG_GM_ON : LANG_GM_OFF);
|
handler->GetPlayer()->SetGameMaster(false);
|
||||||
handler->SetSentErrorMessage(true);
|
handler->GetPlayer()->UpdateTriggerVisibility();
|
||||||
return false;
|
handler->GetSession()->SendNotification(LANG_GM_OFF);
|
||||||
}
|
return true;
|
||||||
|
|
||||||
std::string param = (char*)args;
|
|
||||||
|
|
||||||
if (param == "on")
|
|
||||||
{
|
|
||||||
_player->SetGameMaster(true);
|
|
||||||
handler->GetSession()->SendNotification(LANG_GM_ON);
|
|
||||||
_player->UpdateTriggerVisibility();
|
|
||||||
handler->SetSentErrorMessage(true);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (param == "off")
|
|
||||||
{
|
|
||||||
_player->SetGameMaster(false);
|
|
||||||
handler->GetSession()->SendNotification(LANG_GM_OFF);
|
|
||||||
_player->UpdateTriggerVisibility();
|
|
||||||
handler->SetSentErrorMessage(true);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
handler->SendSysMessage(LANG_USE_BOL);
|
|
||||||
handler->SetSentErrorMessage(true);
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -22,15 +22,11 @@ Comment: All honor related commands
|
|||||||
Category: commandscripts
|
Category: commandscripts
|
||||||
EndScriptData */
|
EndScriptData */
|
||||||
|
|
||||||
|
#include "ScriptMgr.h"
|
||||||
#include "Chat.h"
|
#include "Chat.h"
|
||||||
#include "Language.h"
|
#include "Language.h"
|
||||||
#include "ObjectMgr.h"
|
|
||||||
#include "Player.h"
|
#include "Player.h"
|
||||||
#include "ScriptMgr.h"
|
#include "WorldSession.h"
|
||||||
|
|
||||||
#if AC_COMPILER == AC_COMPILER_GNU
|
|
||||||
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
using namespace Acore::ChatCommands;
|
using namespace Acore::ChatCommands;
|
||||||
|
|
||||||
@@ -43,28 +39,25 @@ public:
|
|||||||
{
|
{
|
||||||
static ChatCommandTable honorAddCommandTable =
|
static ChatCommandTable honorAddCommandTable =
|
||||||
{
|
{
|
||||||
{ "kill", SEC_GAMEMASTER, false, &HandleHonorAddKillCommand, "" },
|
{ "kill", HandleHonorAddKillCommand, SEC_GAMEMASTER, Console::No },
|
||||||
{ "", SEC_GAMEMASTER, false, &HandleHonorAddCommand, "" }
|
{ "", HandleHonorAddCommand, SEC_GAMEMASTER, Console::No }
|
||||||
};
|
};
|
||||||
|
|
||||||
static ChatCommandTable honorCommandTable =
|
static ChatCommandTable honorCommandTable =
|
||||||
{
|
{
|
||||||
{ "add", SEC_GAMEMASTER, false, nullptr, "", honorAddCommandTable },
|
{ "add", honorAddCommandTable },
|
||||||
{ "update", SEC_GAMEMASTER, false, &HandleHonorUpdateCommand, "" }
|
{ "update", HandleHonorUpdateCommand, SEC_GAMEMASTER, Console::No }
|
||||||
};
|
};
|
||||||
|
|
||||||
static ChatCommandTable commandTable =
|
static ChatCommandTable commandTable =
|
||||||
{
|
{
|
||||||
{ "honor", SEC_GAMEMASTER, false, nullptr, "", honorCommandTable }
|
{ "honor", honorCommandTable }
|
||||||
};
|
};
|
||||||
return commandTable;
|
return commandTable;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool HandleHonorAddCommand(ChatHandler* handler, char const* args)
|
static bool HandleHonorAddCommand(ChatHandler* handler, uint32 amount)
|
||||||
{
|
{
|
||||||
if (!*args)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
Player* target = handler->getSelectedPlayer();
|
Player* target = handler->getSelectedPlayer();
|
||||||
if (!target)
|
if (!target)
|
||||||
{
|
{
|
||||||
@@ -74,15 +67,14 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
// check online security
|
// check online security
|
||||||
if (handler->HasLowerSecurity(target))
|
if (handler->HasLowerSecurity(target, ObjectGuid::Empty))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
uint32 amount = (uint32)atoi(args);
|
|
||||||
target->RewardHonor(nullptr, 1, amount);
|
target->RewardHonor(nullptr, 1, amount);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool HandleHonorAddKillCommand(ChatHandler* handler, char const* /*args*/)
|
static bool HandleHonorAddKillCommand(ChatHandler* handler)
|
||||||
{
|
{
|
||||||
Unit* target = handler->getSelectedUnit();
|
Unit* target = handler->getSelectedUnit();
|
||||||
if (!target)
|
if (!target)
|
||||||
@@ -93,14 +85,15 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
// check online security
|
// check online security
|
||||||
if (target->GetTypeId() == TYPEID_PLAYER && handler->HasLowerSecurity(target->ToPlayer()))
|
if (Player* player = target->ToPlayer())
|
||||||
return false;
|
if (handler->HasLowerSecurity(player, ObjectGuid::Empty))
|
||||||
|
return false;
|
||||||
|
|
||||||
handler->GetSession()->GetPlayer()->RewardHonor(target, 1);
|
handler->GetSession()->GetPlayer()->RewardHonor(target, 1);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool HandleHonorUpdateCommand(ChatHandler* handler, char const* /*args*/)
|
static bool HandleHonorUpdateCommand(ChatHandler* handler)
|
||||||
{
|
{
|
||||||
Player* target = handler->getSelectedPlayer();
|
Player* target = handler->getSelectedPlayer();
|
||||||
if (!target)
|
if (!target)
|
||||||
@@ -111,7 +104,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
// check online security
|
// check online security
|
||||||
if (handler->HasLowerSecurity(target))
|
if (handler->HasLowerSecurity(target, ObjectGuid::Empty))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
target->UpdateHonorFields();
|
target->UpdateHonorFields();
|
||||||
|
|||||||
@@ -22,15 +22,18 @@ Comment: All message related commands
|
|||||||
Category: commandscripts
|
Category: commandscripts
|
||||||
EndScriptData */
|
EndScriptData */
|
||||||
|
|
||||||
|
#include "ScriptMgr.h"
|
||||||
|
#include "Channel.h"
|
||||||
#include "ChannelMgr.h"
|
#include "ChannelMgr.h"
|
||||||
#include "Chat.h"
|
#include "Chat.h"
|
||||||
|
#include "DatabaseEnv.h"
|
||||||
|
#include "DBCStores.h"
|
||||||
#include "Language.h"
|
#include "Language.h"
|
||||||
|
#include "ObjectAccessor.h"
|
||||||
|
#include "ObjectMgr.h"
|
||||||
#include "Player.h"
|
#include "Player.h"
|
||||||
#include "ScriptMgr.h"
|
#include "World.h"
|
||||||
|
#include "WorldSession.h"
|
||||||
#if AC_COMPILER == AC_COMPILER_GNU
|
|
||||||
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
using namespace Acore::ChatCommands;
|
using namespace Acore::ChatCommands;
|
||||||
|
|
||||||
@@ -43,70 +46,71 @@ public:
|
|||||||
{
|
{
|
||||||
static ChatCommandTable commandTable =
|
static ChatCommandTable commandTable =
|
||||||
{
|
{
|
||||||
{ "nameannounce", SEC_GAMEMASTER, true, &HandleNameAnnounceCommand, "" },
|
{ "nameannounce", HandleNameAnnounceCommand, SEC_GAMEMASTER, Console::Yes },
|
||||||
{ "gmnameannounce", SEC_GAMEMASTER, true, &HandleGMNameAnnounceCommand, "" },
|
{ "gmnameannounce", HandleGMNameAnnounceCommand, SEC_GAMEMASTER, Console::Yes },
|
||||||
{ "announce", SEC_GAMEMASTER, true, &HandleAnnounceCommand, "" },
|
{ "announce", HandleAnnounceCommand, SEC_GAMEMASTER, Console::Yes },
|
||||||
{ "gmannounce", SEC_GAMEMASTER, true, &HandleGMAnnounceCommand, "" },
|
{ "gmannounce", HandleGMAnnounceCommand, SEC_GAMEMASTER, Console::Yes },
|
||||||
{ "notify", SEC_GAMEMASTER, true, &HandleNotifyCommand, "" },
|
{ "notify", HandleNotifyCommand, SEC_GAMEMASTER, Console::Yes },
|
||||||
{ "gmnotify", SEC_GAMEMASTER, true, &HandleGMNotifyCommand, "" },
|
{ "gmnotify", HandleGMNotifyCommand, SEC_GAMEMASTER, Console::Yes },
|
||||||
{ "whispers", SEC_MODERATOR, false, &HandleWhispersCommand, "" }
|
{ "whispers", HandleWhispersCommand, SEC_MODERATOR, Console::No },
|
||||||
};
|
};
|
||||||
return commandTable;
|
return commandTable;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool HandleNameAnnounceCommand(ChatHandler* handler, char const* args)
|
static bool HandleNameAnnounceCommand(ChatHandler* handler, Tail message)
|
||||||
{
|
{
|
||||||
if (!*args)
|
if (message.empty())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
std::string name("Console");
|
std::string name("Console");
|
||||||
if (WorldSession* session = handler->GetSession())
|
if (WorldSession* session = handler->GetSession())
|
||||||
name = session->GetPlayer()->GetName();
|
name = session->GetPlayer()->GetName();
|
||||||
|
|
||||||
sWorld->SendWorldText(LANG_ANNOUNCE_COLOR, name.c_str(), args);
|
sWorld->SendWorldText(LANG_ANNOUNCE_COLOR, name.c_str(), message.data());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool HandleGMNameAnnounceCommand(ChatHandler* handler, char const* args)
|
static bool HandleGMNameAnnounceCommand(ChatHandler* handler, Tail message)
|
||||||
{
|
{
|
||||||
if (!*args)
|
if (message.empty())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
std::string name("Console");
|
std::string name("Console");
|
||||||
if (WorldSession* session = handler->GetSession())
|
if (WorldSession* session = handler->GetSession())
|
||||||
name = session->GetPlayer()->GetName();
|
name = session->GetPlayer()->GetName();
|
||||||
|
|
||||||
sWorld->SendGMText(LANG_GM_ANNOUNCE_COLOR, name.c_str(), args);
|
sWorld->SendGMText(LANG_GM_ANNOUNCE_COLOR, name.c_str(), message.data());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// global announce
|
// global announce
|
||||||
static bool HandleAnnounceCommand(ChatHandler* handler, char const* args)
|
static bool HandleAnnounceCommand(ChatHandler* handler, Tail message)
|
||||||
{
|
{
|
||||||
if (!*args)
|
if (message.empty())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
char buff[2048];
|
sWorld->SendServerMessage(SERVER_MSG_STRING, Acore::StringFormat(handler->GetAcoreString(LANG_SYSTEMMESSAGE), message.data()).c_str());
|
||||||
sprintf(buff, handler->GetAcoreString(LANG_SYSTEMMESSAGE), args);
|
|
||||||
sWorld->SendServerMessage(SERVER_MSG_STRING, buff);
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// announce to logged in GMs
|
// announce to logged in GMs
|
||||||
static bool HandleGMAnnounceCommand(ChatHandler* /*handler*/, char const* args)
|
static bool HandleGMAnnounceCommand(ChatHandler* /*handler*/, Tail message)
|
||||||
{
|
{
|
||||||
if (!*args)
|
if (message.empty())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
sWorld->SendGMText(LANG_GM_BROADCAST, args);
|
sWorld->SendGMText(LANG_GM_BROADCAST, message.data());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
// notification player at the screen
|
|
||||||
static bool HandleNotifyCommand(ChatHandler* handler, char const* args)
|
// send on-screen notification to players
|
||||||
|
static bool HandleNotifyCommand(ChatHandler* handler, Tail message)
|
||||||
{
|
{
|
||||||
if (!*args)
|
if (message.empty())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
std::string str = handler->GetAcoreString(LANG_GLOBAL_NOTIFY);
|
std::string str = handler->GetAcoreString(LANG_GLOBAL_NOTIFY);
|
||||||
str += args;
|
str += message;
|
||||||
|
|
||||||
WorldPacket data(SMSG_NOTIFICATION, (str.size() + 1));
|
WorldPacket data(SMSG_NOTIFICATION, (str.size() + 1));
|
||||||
data << str;
|
data << str;
|
||||||
@@ -114,14 +118,15 @@ public:
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
// notification GM at the screen
|
|
||||||
static bool HandleGMNotifyCommand(ChatHandler* handler, char const* args)
|
// send on-screen notification to GMs
|
||||||
|
static bool HandleGMNotifyCommand(ChatHandler* handler, Tail message)
|
||||||
{
|
{
|
||||||
if (!*args)
|
if (message.empty())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
std::string str = handler->GetAcoreString(LANG_GM_NOTIFY);
|
std::string str = handler->GetAcoreString(LANG_GM_NOTIFY);
|
||||||
str += args;
|
str += message;
|
||||||
|
|
||||||
WorldPacket data(SMSG_NOTIFICATION, (str.size() + 1));
|
WorldPacket data(SMSG_NOTIFICATION, (str.size() + 1));
|
||||||
data << str;
|
data << str;
|
||||||
@@ -129,34 +134,55 @@ public:
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
// Enable\Dissable accept whispers (for GM)
|
|
||||||
static bool HandleWhispersCommand(ChatHandler* handler, char const* args)
|
// Enable/Disable accepting whispers (for GM)
|
||||||
|
static bool HandleWhispersCommand(ChatHandler* handler, Optional<Variant<bool, EXACT_SEQUENCE("remove")>> operationArg, Optional<std::string> playerNameArg)
|
||||||
{
|
{
|
||||||
if (!*args)
|
if (!operationArg)
|
||||||
{
|
{
|
||||||
handler->PSendSysMessage(LANG_COMMAND_WHISPERACCEPTING, handler->GetSession()->GetPlayer()->isAcceptWhispers() ? handler->GetAcoreString(LANG_ON) : handler->GetAcoreString(LANG_OFF));
|
handler->PSendSysMessage(LANG_COMMAND_WHISPERACCEPTING, handler->GetSession()->GetPlayer()->isAcceptWhispers() ? handler->GetAcoreString(LANG_ON) : handler->GetAcoreString(LANG_OFF));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string argStr = (char*)args;
|
if (operationArg->holds_alternative<bool>())
|
||||||
// whisper on
|
|
||||||
if (argStr == "on")
|
|
||||||
{
|
{
|
||||||
handler->GetSession()->GetPlayer()->SetAcceptWhispers(true);
|
if (operationArg->get<bool>())
|
||||||
handler->SendSysMessage(LANG_COMMAND_WHISPERON);
|
{
|
||||||
return true;
|
handler->GetSession()->GetPlayer()->SetAcceptWhispers(true);
|
||||||
|
handler->SendSysMessage(LANG_COMMAND_WHISPERON);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Remove all players from the Gamemaster's whisper whitelist
|
||||||
|
handler->GetSession()->GetPlayer()->ClearWhisperWhiteList();
|
||||||
|
handler->GetSession()->GetPlayer()->SetAcceptWhispers(false);
|
||||||
|
handler->SendSysMessage(LANG_COMMAND_WHISPEROFF);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// whisper off
|
if (operationArg->holds_alternative<EXACT_SEQUENCE("remove")>())
|
||||||
if (argStr == "off")
|
|
||||||
{
|
{
|
||||||
// Remove all players from the Gamemaster's whisper whitelist
|
if (!playerNameArg)
|
||||||
handler->GetSession()->GetPlayer()->ClearWhisperWhiteList();
|
return false;
|
||||||
handler->GetSession()->GetPlayer()->SetAcceptWhispers(false);
|
|
||||||
handler->SendSysMessage(LANG_COMMAND_WHISPEROFF);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
if (normalizePlayerName(*playerNameArg))
|
||||||
|
{
|
||||||
|
if (Player* player = ObjectAccessor::FindPlayerByName(*playerNameArg))
|
||||||
|
{
|
||||||
|
handler->GetSession()->GetPlayer()->RemoveFromWhisperWhiteList(player->GetGUID());
|
||||||
|
handler->PSendSysMessage(LANG_COMMAND_WHISPEROFFPLAYER, playerNameArg->c_str());
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
handler->PSendSysMessage(LANG_PLAYER_NOT_FOUND, playerNameArg->c_str());
|
||||||
|
handler->SetSentErrorMessage(true);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
handler->SendSysMessage(LANG_USE_BOL);
|
handler->SendSysMessage(LANG_USE_BOL);
|
||||||
handler->SetSentErrorMessage(true);
|
handler->SetSentErrorMessage(true);
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -22,17 +22,13 @@ Comment: All tele related commands
|
|||||||
Category: commandscripts
|
Category: commandscripts
|
||||||
EndScriptData */
|
EndScriptData */
|
||||||
|
|
||||||
|
#include "ScriptMgr.h"
|
||||||
#include "Chat.h"
|
#include "Chat.h"
|
||||||
#include "Group.h"
|
#include "Group.h"
|
||||||
#include "Language.h"
|
#include "Language.h"
|
||||||
#include "MapMgr.h"
|
#include "MapMgr.h"
|
||||||
#include "ObjectMgr.h"
|
#include "ObjectMgr.h"
|
||||||
#include "Player.h"
|
#include "Player.h"
|
||||||
#include "ScriptMgr.h"
|
|
||||||
|
|
||||||
#if AC_COMPILER == AC_COMPILER_GNU
|
|
||||||
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
using namespace Acore::ChatCommands;
|
using namespace Acore::ChatCommands;
|
||||||
|
|
||||||
@@ -45,30 +41,25 @@ public:
|
|||||||
{
|
{
|
||||||
static ChatCommandTable teleCommandTable =
|
static ChatCommandTable teleCommandTable =
|
||||||
{
|
{
|
||||||
{ "add", SEC_ADMINISTRATOR, false, &HandleTeleAddCommand, "" },
|
{ "add", HandleTeleAddCommand, SEC_ADMINISTRATOR, Console::No },
|
||||||
{ "del", SEC_ADMINISTRATOR, true, &HandleTeleDelCommand, "" },
|
{ "del", HandleTeleDelCommand, SEC_ADMINISTRATOR, Console::Yes },
|
||||||
{ "name", SEC_GAMEMASTER, true, &HandleTeleNameCommand, "" },
|
{ "name", HandleTeleNameCommand, SEC_GAMEMASTER, Console::Yes },
|
||||||
{ "group", SEC_GAMEMASTER, false, &HandleTeleGroupCommand, "" },
|
{ "group", HandleTeleGroupCommand, SEC_GAMEMASTER, Console::No },
|
||||||
{ "", SEC_MODERATOR, false, &HandleTeleCommand, "" }
|
{ "", HandleTeleCommand, SEC_GAMEMASTER, Console::No }
|
||||||
};
|
};
|
||||||
static ChatCommandTable commandTable =
|
static ChatCommandTable commandTable =
|
||||||
{
|
{
|
||||||
{ "teleport", SEC_MODERATOR, false, nullptr, "", teleCommandTable }
|
{ "teleport", teleCommandTable }
|
||||||
};
|
};
|
||||||
return commandTable;
|
return commandTable;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool HandleTeleAddCommand(ChatHandler* handler, const char* args)
|
static bool HandleTeleAddCommand(ChatHandler* handler, std::string const& name)
|
||||||
{
|
{
|
||||||
if (!*args)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
Player* player = handler->GetSession()->GetPlayer();
|
Player* player = handler->GetSession()->GetPlayer();
|
||||||
if (!player)
|
if (!player)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
std::string name = args;
|
|
||||||
|
|
||||||
if (sObjectMgr->GetGameTele(name))
|
if (sObjectMgr->GetGameTele(name))
|
||||||
{
|
{
|
||||||
handler->SendSysMessage(LANG_COMMAND_TP_ALREADYEXIST);
|
handler->SendSysMessage(LANG_COMMAND_TP_ALREADYEXIST);
|
||||||
@@ -162,7 +153,7 @@ public:
|
|||||||
|
|
||||||
handler->PSendSysMessage(LANG_TELEPORTING_TO, nameLink.c_str(), handler->GetAcoreString(LANG_OFFLINE), locationName.c_str());
|
handler->PSendSysMessage(LANG_TELEPORTING_TO, nameLink.c_str(), handler->GetAcoreString(LANG_OFFLINE), locationName.c_str());
|
||||||
|
|
||||||
Player::SavePositionInDB({mapId, pos}, sMapMgr->GetZoneId(PHASEMASK_NORMAL, {mapId, pos}), player.GetGUID(), nullptr);
|
Player::SavePositionInDB({ mapId, pos }, sMapMgr->GetZoneId(PHASEMASK_NORMAL, { mapId, pos }), player.GetGUID(), nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -173,7 +164,6 @@ public:
|
|||||||
{
|
{
|
||||||
if (!player)
|
if (!player)
|
||||||
player = PlayerIdentifier::FromTargetOrSelf(handler);
|
player = PlayerIdentifier::FromTargetOrSelf(handler);
|
||||||
|
|
||||||
if (!player)
|
if (!player)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@@ -224,7 +214,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
// check online security
|
// check online security
|
||||||
if (handler->HasLowerSecurity(target))
|
if (handler->HasLowerSecurity(target, ObjectGuid::Empty))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
MapEntry const* map = sMapStore.LookupEntry(tele->mapId);
|
MapEntry const* map = sMapStore.LookupEntry(tele->mapId);
|
||||||
@@ -253,7 +243,7 @@ public:
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
// check online security
|
// check online security
|
||||||
if (handler->HasLowerSecurity(player))
|
if (handler->HasLowerSecurity(player, ObjectGuid::Empty))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
std::string plNameLink = handler->GetNameLink(player);
|
std::string plNameLink = handler->GetNameLink(player);
|
||||||
@@ -266,17 +256,16 @@ public:
|
|||||||
|
|
||||||
handler->PSendSysMessage(LANG_TELEPORTING_TO, plNameLink.c_str(), "", tele->name.c_str());
|
handler->PSendSysMessage(LANG_TELEPORTING_TO, plNameLink.c_str(), "", tele->name.c_str());
|
||||||
if (handler->needReportToTarget(player))
|
if (handler->needReportToTarget(player))
|
||||||
(ChatHandler(player->GetSession())).PSendSysMessage(LANG_TELEPORTED_TO_BY, nameLink.c_str());
|
ChatHandler(player->GetSession()).PSendSysMessage(LANG_TELEPORTED_TO_BY, nameLink.c_str());
|
||||||
|
|
||||||
// stop flight if need
|
// stop flight if need
|
||||||
if (player->IsInFlight())
|
if (target->IsInFlight())
|
||||||
{
|
{
|
||||||
player->GetMotionMaster()->MovementExpired();
|
target->GetMotionMaster()->MovementExpired();
|
||||||
player->CleanupAfterTaxiFlight();
|
target->CleanupAfterTaxiFlight();
|
||||||
}
|
}
|
||||||
// save only in non-flight case
|
else // save only in non-flight case
|
||||||
else
|
target->SaveRecallPosition();
|
||||||
player->SaveRecallPosition();
|
|
||||||
|
|
||||||
player->TeleportTo(tele->mapId, tele->position_x, tele->position_y, tele->position_z, tele->orientation);
|
player->TeleportTo(tele->mapId, tele->position_x, tele->position_y, tele->position_z, tele->orientation);
|
||||||
}
|
}
|
||||||
@@ -293,16 +282,8 @@ public:
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Player* me = handler->GetSession()->GetPlayer();
|
Player* player = handler->GetSession()->GetPlayer();
|
||||||
|
if (player->IsInCombat())
|
||||||
if (!tele)
|
|
||||||
{
|
|
||||||
handler->SendSysMessage(LANG_COMMAND_TELE_NOTFOUND);
|
|
||||||
handler->SetSentErrorMessage(true);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (me->IsInCombat())
|
|
||||||
{
|
{
|
||||||
handler->SendSysMessage(LANG_YOU_IN_COMBAT);
|
handler->SendSysMessage(LANG_YOU_IN_COMBAT);
|
||||||
handler->SetSentErrorMessage(true);
|
handler->SetSentErrorMessage(true);
|
||||||
@@ -310,7 +291,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
MapEntry const* map = sMapStore.LookupEntry(tele->mapId);
|
MapEntry const* map = sMapStore.LookupEntry(tele->mapId);
|
||||||
if (!map || map->IsBattlegroundOrArena())
|
if (!map || (map->IsBattlegroundOrArena() && (player->GetMapId() != tele->mapId || !player->IsGameMaster())))
|
||||||
{
|
{
|
||||||
handler->SendSysMessage(LANG_CANNOT_TELE_TO_BG);
|
handler->SendSysMessage(LANG_CANNOT_TELE_TO_BG);
|
||||||
handler->SetSentErrorMessage(true);
|
handler->SetSentErrorMessage(true);
|
||||||
@@ -318,16 +299,15 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
// stop flight if need
|
// stop flight if need
|
||||||
if (me->IsInFlight())
|
if (player->IsInFlight())
|
||||||
{
|
{
|
||||||
me->GetMotionMaster()->MovementExpired();
|
player->GetMotionMaster()->MovementExpired();
|
||||||
me->CleanupAfterTaxiFlight();
|
player->CleanupAfterTaxiFlight();
|
||||||
}
|
}
|
||||||
// save only in non-flight case
|
else // save only in non-flight case
|
||||||
else
|
player->SaveRecallPosition();
|
||||||
me->SaveRecallPosition();
|
|
||||||
|
|
||||||
me->TeleportTo(tele->mapId, tele->position_x, tele->position_y, tele->position_z, tele->orientation);
|
player->TeleportTo(tele->mapId, tele->position_x, tele->position_y, tele->position_z, tele->orientation);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -22,15 +22,11 @@ Comment: All titles related commands
|
|||||||
Category: commandscripts
|
Category: commandscripts
|
||||||
EndScriptData */
|
EndScriptData */
|
||||||
|
|
||||||
#include "Chat.h"
|
|
||||||
#include "Language.h"
|
|
||||||
#include "ObjectMgr.h"
|
|
||||||
#include "Player.h"
|
|
||||||
#include "ScriptMgr.h"
|
#include "ScriptMgr.h"
|
||||||
|
#include "Chat.h"
|
||||||
#if AC_COMPILER == AC_COMPILER_GNU
|
#include "DBCStores.h"
|
||||||
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
#include "Language.h"
|
||||||
#endif
|
#include "Player.h"
|
||||||
|
|
||||||
using namespace Acore::ChatCommands;
|
using namespace Acore::ChatCommands;
|
||||||
|
|
||||||
@@ -43,37 +39,24 @@ public:
|
|||||||
{
|
{
|
||||||
static ChatCommandTable titlesSetCommandTable =
|
static ChatCommandTable titlesSetCommandTable =
|
||||||
{
|
{
|
||||||
{ "mask", SEC_GAMEMASTER, false, &HandleTitlesSetMaskCommand, "" }
|
{ "mask", HandleTitlesSetMaskCommand, SEC_GAMEMASTER, Console::No },
|
||||||
};
|
};
|
||||||
static ChatCommandTable titlesCommandTable =
|
static ChatCommandTable titlesCommandTable =
|
||||||
{
|
{
|
||||||
{ "add", SEC_GAMEMASTER, false, &HandleTitlesAddCommand, "" },
|
{ "add", HandleTitlesAddCommand, SEC_GAMEMASTER, Console::No },
|
||||||
{ "current", SEC_GAMEMASTER, false, &HandleTitlesCurrentCommand, "" },
|
{ "current", HandleTitlesCurrentCommand, SEC_GAMEMASTER, Console::No },
|
||||||
{ "remove", SEC_GAMEMASTER, false, &HandleTitlesRemoveCommand, "" },
|
{ "remove", HandleTitlesRemoveCommand, SEC_GAMEMASTER, Console::No },
|
||||||
{ "set", SEC_GAMEMASTER, false, nullptr, "", titlesSetCommandTable }
|
{ "set", titlesSetCommandTable },
|
||||||
};
|
};
|
||||||
static ChatCommandTable commandTable =
|
static ChatCommandTable commandTable =
|
||||||
{
|
{
|
||||||
{ "titles", SEC_GAMEMASTER, false, nullptr, "", titlesCommandTable }
|
{ "titles", titlesCommandTable },
|
||||||
};
|
};
|
||||||
return commandTable;
|
return commandTable;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool HandleTitlesCurrentCommand(ChatHandler* handler, const char* args)
|
static bool HandleTitlesCurrentCommand(ChatHandler* handler, Variant<Hyperlink<title>, uint16> titleId)
|
||||||
{
|
{
|
||||||
// number or [name] Shift-click form |color|Htitle:title_id|h[name]|h|r
|
|
||||||
char* id_p = handler->extractKeyFromLink((char*)args, "Htitle");
|
|
||||||
if (!id_p)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
int32 id = atoi(id_p);
|
|
||||||
if (id <= 0)
|
|
||||||
{
|
|
||||||
handler->PSendSysMessage(LANG_INVALID_TITLE_ID, id);
|
|
||||||
handler->SetSentErrorMessage(true);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
Player* target = handler->getSelectedPlayer();
|
Player* target = handler->getSelectedPlayer();
|
||||||
if (!target)
|
if (!target)
|
||||||
{
|
{
|
||||||
@@ -83,88 +66,30 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
// check online security
|
// check online security
|
||||||
if (handler->HasLowerSecurity(target))
|
if (handler->HasLowerSecurity(target, ObjectGuid::Empty))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
CharTitlesEntry const* titleInfo = sCharTitlesStore.LookupEntry(id);
|
CharTitlesEntry const* titleInfo = sCharTitlesStore.LookupEntry(titleId);
|
||||||
if (!titleInfo)
|
if (!titleInfo)
|
||||||
{
|
{
|
||||||
handler->PSendSysMessage(LANG_INVALID_TITLE_ID, id);
|
handler->PSendSysMessage(LANG_INVALID_TITLE_ID, uint32(titleId));
|
||||||
handler->SetSentErrorMessage(true);
|
handler->SetSentErrorMessage(true);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string tNameLink = handler->GetNameLink(target);
|
std::string tNameLink = handler->GetNameLink(target);
|
||||||
|
std::string titleNameStr = Acore::StringFormat(target->getGender() == GENDER_MALE ? titleInfo->nameMale[handler->GetSessionDbcLocale()] : titleInfo->nameFemale[handler->GetSessionDbcLocale()], target->GetName());
|
||||||
target->SetTitle(titleInfo); // to be sure that title now known
|
|
||||||
target->SetUInt32Value(PLAYER_CHOSEN_TITLE, titleInfo->bit_index);
|
|
||||||
|
|
||||||
handler->PSendSysMessage(LANG_TITLE_CURRENT_RES, id, target->getGender() == GENDER_MALE ? titleInfo->nameMale[handler->GetSessionDbcLocale()] : titleInfo->nameFemale[handler->GetSessionDbcLocale()], tNameLink.c_str());
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
static bool HandleTitlesAddCommand(ChatHandler* handler, const char* args)
|
|
||||||
{
|
|
||||||
// number or [name] Shift-click form |color|Htitle:title_id|h[name]|h|r
|
|
||||||
char* id_p = handler->extractKeyFromLink((char*)args, "Htitle");
|
|
||||||
if (!id_p)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
int32 id = atoi(id_p);
|
|
||||||
if (id <= 0)
|
|
||||||
{
|
|
||||||
handler->PSendSysMessage(LANG_INVALID_TITLE_ID, id);
|
|
||||||
handler->SetSentErrorMessage(true);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
Player* target = handler->getSelectedPlayer();
|
|
||||||
if (!target)
|
|
||||||
{
|
|
||||||
handler->SendSysMessage(LANG_NO_CHAR_SELECTED);
|
|
||||||
handler->SetSentErrorMessage(true);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// check online security
|
|
||||||
if (handler->HasLowerSecurity(target))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
CharTitlesEntry const* titleInfo = sCharTitlesStore.LookupEntry(id);
|
|
||||||
if (!titleInfo)
|
|
||||||
{
|
|
||||||
handler->PSendSysMessage(LANG_INVALID_TITLE_ID, id);
|
|
||||||
handler->SetSentErrorMessage(true);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string tNameLink = handler->GetNameLink(target);
|
|
||||||
|
|
||||||
char titleNameStr[80];
|
|
||||||
snprintf(titleNameStr, 80, target->getGender() == GENDER_MALE ? titleInfo->nameMale[handler->GetSessionDbcLocale()] : titleInfo->nameFemale[handler->GetSessionDbcLocale()], target->GetName().c_str());
|
|
||||||
|
|
||||||
target->SetTitle(titleInfo);
|
target->SetTitle(titleInfo);
|
||||||
handler->PSendSysMessage(LANG_TITLE_ADD_RES, id, titleNameStr, tNameLink.c_str());
|
target->SetUInt32Value(PLAYER_CHOSEN_TITLE, titleInfo->bit_index);
|
||||||
|
|
||||||
|
handler->PSendSysMessage(LANG_TITLE_CURRENT_RES, uint32(titleId), titleNameStr, tNameLink);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool HandleTitlesRemoveCommand(ChatHandler* handler, char const* args)
|
static bool HandleTitlesAddCommand(ChatHandler* handler, Variant<Hyperlink<title>, uint16> titleId)
|
||||||
{
|
{
|
||||||
// number or [name] Shift-click form |color|Htitle:title_id|h[name]|h|r
|
|
||||||
char* id_p = handler->extractKeyFromLink((char*)args, "Htitle");
|
|
||||||
if (!id_p)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
int32 id = atoi(id_p);
|
|
||||||
if (id <= 0)
|
|
||||||
{
|
|
||||||
handler->PSendSysMessage(LANG_INVALID_TITLE_ID, id);
|
|
||||||
handler->SetSentErrorMessage(true);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
Player* target = handler->getSelectedPlayer();
|
Player* target = handler->getSelectedPlayer();
|
||||||
if (!target)
|
if (!target)
|
||||||
{
|
{
|
||||||
@@ -174,13 +99,44 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
// check online security
|
// check online security
|
||||||
if (handler->HasLowerSecurity(target))
|
if (handler->HasLowerSecurity(target, ObjectGuid::Empty))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
CharTitlesEntry const* titleInfo = sCharTitlesStore.LookupEntry(id);
|
CharTitlesEntry const* titleInfo = sCharTitlesStore.LookupEntry(titleId);
|
||||||
if (!titleInfo)
|
if (!titleInfo)
|
||||||
{
|
{
|
||||||
handler->PSendSysMessage(LANG_INVALID_TITLE_ID, id);
|
handler->PSendSysMessage(LANG_INVALID_TITLE_ID, uint32(titleId));
|
||||||
|
handler->SetSentErrorMessage(true);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string tNameLink = handler->GetNameLink(target);
|
||||||
|
std::string titleNameStr = Acore::StringFormat(target->getGender() == GENDER_MALE ? titleInfo->nameMale[handler->GetSessionDbcLocale()] : titleInfo->nameFemale[handler->GetSessionDbcLocale()], target->GetName());
|
||||||
|
|
||||||
|
target->SetTitle(titleInfo);
|
||||||
|
handler->PSendSysMessage(LANG_TITLE_ADD_RES, uint32(titleId), titleNameStr, tNameLink);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool HandleTitlesRemoveCommand(ChatHandler* handler, Variant<Hyperlink<title>, uint16> titleId)
|
||||||
|
{
|
||||||
|
Player* target = handler->getSelectedPlayer();
|
||||||
|
if (!target)
|
||||||
|
{
|
||||||
|
handler->SendSysMessage(LANG_NO_CHAR_SELECTED);
|
||||||
|
handler->SetSentErrorMessage(true);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// check online security
|
||||||
|
if (handler->HasLowerSecurity(target, ObjectGuid::Empty))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
CharTitlesEntry const* titleInfo = sCharTitlesStore.LookupEntry(titleId);
|
||||||
|
if (!titleInfo)
|
||||||
|
{
|
||||||
|
handler->PSendSysMessage(LANG_INVALID_TITLE_ID, uint32(titleId));
|
||||||
handler->SetSentErrorMessage(true);
|
handler->SetSentErrorMessage(true);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -188,31 +144,22 @@ public:
|
|||||||
target->SetTitle(titleInfo, true);
|
target->SetTitle(titleInfo, true);
|
||||||
|
|
||||||
std::string tNameLink = handler->GetNameLink(target);
|
std::string tNameLink = handler->GetNameLink(target);
|
||||||
|
std::string titleNameStr = Acore::StringFormat(target->getGender() == GENDER_MALE ? titleInfo->nameMale[handler->GetSessionDbcLocale()] : titleInfo->nameFemale[handler->GetSessionDbcLocale()], target->GetName());
|
||||||
|
|
||||||
char titleNameStr[80];
|
handler->PSendSysMessage(LANG_TITLE_REMOVE_RES, uint32(titleId), titleNameStr, tNameLink);
|
||||||
snprintf(titleNameStr, 80, target->getGender() == GENDER_MALE ? titleInfo->nameMale[handler->GetSessionDbcLocale()] : titleInfo->nameFemale[handler->GetSessionDbcLocale()], target->GetName().c_str());
|
|
||||||
|
|
||||||
handler->PSendSysMessage(LANG_TITLE_REMOVE_RES, id, titleNameStr, tNameLink.c_str());
|
|
||||||
|
|
||||||
if (!target->HasTitle(target->GetInt32Value(PLAYER_CHOSEN_TITLE)))
|
if (!target->HasTitle(target->GetInt32Value(PLAYER_CHOSEN_TITLE)))
|
||||||
{
|
{
|
||||||
target->SetUInt32Value(PLAYER_CHOSEN_TITLE, 0);
|
target->SetUInt32Value(PLAYER_CHOSEN_TITLE, 0);
|
||||||
handler->PSendSysMessage(LANG_CURRENT_TITLE_RESET, tNameLink.c_str());
|
handler->PSendSysMessage(LANG_CURRENT_TITLE_RESET, tNameLink);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Edit Player KnownTitles
|
//Edit Player KnownTitles
|
||||||
static bool HandleTitlesSetMaskCommand(ChatHandler* handler, char const* args)
|
static bool HandleTitlesSetMaskCommand(ChatHandler* handler, uint64 mask)
|
||||||
{
|
{
|
||||||
if (!*args)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
uint64 titles = 0;
|
|
||||||
|
|
||||||
sscanf((char*)args, UI64FMTD, &titles);
|
|
||||||
|
|
||||||
Player* target = handler->getSelectedPlayer();
|
Player* target = handler->getSelectedPlayer();
|
||||||
if (!target)
|
if (!target)
|
||||||
{
|
{
|
||||||
@@ -222,24 +169,24 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
// check online security
|
// check online security
|
||||||
if (handler->HasLowerSecurity(target))
|
if (handler->HasLowerSecurity(target, ObjectGuid::Empty))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
uint64 titles2 = titles;
|
uint64 titles2 = mask;
|
||||||
|
|
||||||
for (uint32 i = 1; i < sCharTitlesStore.GetNumRows(); ++i)
|
for (uint32 i = 1; i < sCharTitlesStore.GetNumRows(); ++i)
|
||||||
if (CharTitlesEntry const* tEntry = sCharTitlesStore.LookupEntry(i))
|
if (CharTitlesEntry const* tEntry = sCharTitlesStore.LookupEntry(i))
|
||||||
titles2 &= ~(uint64(1) << tEntry->bit_index);
|
titles2 &= ~(uint64(1) << tEntry->bit_index);
|
||||||
|
|
||||||
titles &= ~titles2; // remove not existed titles
|
mask &= ~titles2; // remove non-existing titles
|
||||||
|
|
||||||
target->SetUInt64Value(PLAYER__FIELD_KNOWN_TITLES, titles);
|
target->SetUInt64Value(PLAYER__FIELD_KNOWN_TITLES, mask);
|
||||||
handler->SendSysMessage(LANG_DONE);
|
handler->SendSysMessage(LANG_DONE);
|
||||||
|
|
||||||
if (!target->HasTitle(target->GetInt32Value(PLAYER_CHOSEN_TITLE)))
|
if (!target->HasTitle(target->GetInt32Value(PLAYER_CHOSEN_TITLE)))
|
||||||
{
|
{
|
||||||
target->SetUInt32Value(PLAYER_CHOSEN_TITLE, 0);
|
target->SetUInt32Value(PLAYER_CHOSEN_TITLE, 0);
|
||||||
handler->PSendSysMessage(LANG_CURRENT_TITLE_RESET, handler->GetNameLink(target).c_str());
|
handler->PSendSysMessage(LANG_CURRENT_TITLE_RESET, handler->GetNameLink(target));
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
Reference in New Issue
Block a user