chore(Core/Misc): Remove deprecated code (#19413)

* Config - Deprecated for 3 years
* ChatCommand - Deprecated for 2 years
* getLevel() - Deprecated for 2 years
* SendGlobalText - Deprecated for 8 years +
This commit is contained in:
Kitzunu
2024-07-20 07:41:01 +02:00
committed by GitHub
parent 5c09a3194e
commit 21f86d1c3c
13 changed files with 52 additions and 132 deletions
-24
View File
@@ -649,30 +649,6 @@ bool ConfigMgr::LoadModulesConfigs(bool isReload /*= false*/, bool isNeedPrintIn
return true; return true;
} }
/// @deprecated DO NOT USE - use GetOption<std::string> instead.
std::string ConfigMgr::GetStringDefault(std::string const& name, const std::string& def, bool showLogs /*= true*/)
{
return GetOption<std::string>(name, def, showLogs);
}
/// @deprecated DO NOT USE - use GetOption<bool> instead.
bool ConfigMgr::GetBoolDefault(std::string const& name, bool def, bool showLogs /*= true*/)
{
return GetOption<bool>(name, def, showLogs);
}
/// @deprecated DO NOT USE - use GetOption<int32> instead.
int ConfigMgr::GetIntDefault(std::string const& name, int def, bool showLogs /*= true*/)
{
return GetOption<int32>(name, def, showLogs);
}
/// @deprecated DO NOT USE - use GetOption<float> instead.
float ConfigMgr::GetFloatDefault(std::string const& name, float def, bool showLogs /*= true*/)
{
return GetOption<float>(name, def, showLogs);
}
#define TEMPLATE_CONFIG_OPTION(__typename) \ #define TEMPLATE_CONFIG_OPTION(__typename) \
template __typename ConfigMgr::GetOption<__typename>(std::string const& name, __typename const& def, bool showLogs /*= true*/) const; template __typename ConfigMgr::GetOption<__typename>(std::string const& name, __typename const& def, bool showLogs /*= true*/) const;
-20
View File
@@ -50,26 +50,6 @@ public:
template<class T> template<class T>
T GetOption(std::string const& name, T const& def, bool showLogs = true) const; T GetOption(std::string const& name, T const& def, bool showLogs = true) const;
/*
* Deprecated geters. This geters will be deleted
*/
[[deprecated("Use GetOption<std::string> instead")]]
std::string GetStringDefault(std::string const& name, const std::string& def, bool showLogs = true);
[[deprecated("Use GetOption<bool> instead")]]
bool GetBoolDefault(std::string const& name, bool def, bool showLogs = true);
[[deprecated("Use GetOption<int32> instead")]]
int GetIntDefault(std::string const& name, int def, bool showLogs = true);
[[deprecated("Use GetOption<float> instead")]]
float GetFloatDefault(std::string const& name, float def, bool showLogs = true);
/*
* End deprecated geters
*/
bool isDryRun() { return dryRun; } bool isDryRun() { return dryRun; }
void setDryRun(bool mode) { dryRun = mode; } void setDryRun(bool mode) { dryRun = mode; }
@@ -248,19 +248,6 @@ namespace Acore::ChatCommands
ChatCommandBuilder(char const* name, std::vector<ChatCommandBuilder> const& subCommands) ChatCommandBuilder(char const* name, std::vector<ChatCommandBuilder> const& subCommands)
: _name{ ASSERT_NOTNULL(name) }, _data{ std::in_place_type<SubCommandEntry>, subCommands } { } : _name{ ASSERT_NOTNULL(name) }, _data{ std::in_place_type<SubCommandEntry>, subCommands } { }
[[deprecated("char const* parameters to command handlers are deprecated; convert this to a typed argument handler instead")]]
ChatCommandBuilder(char const* name, bool(&handler)(ChatHandler*, char const*), uint32 securityLevel, Acore::ChatCommands::Console allowConsole)
: ChatCommandBuilder(name, handler, AcoreStrings(), securityLevel, allowConsole) { }
template <typename TypedHandler>
[[deprecated("you are using the old-style command format; convert this to the new format ({ name, handler (not a pointer!), permission, Console::(Yes/No) })")]]
ChatCommandBuilder(char const* name, uint32 securityLevel, bool console, TypedHandler* handler, char const*)
: ChatCommandBuilder(name, *handler, AcoreStrings(), securityLevel, static_cast<Acore::ChatCommands::Console>(console)) { }
[[deprecated("you are using the old-style command format; convert this to the new format ({ name, subCommands })")]]
ChatCommandBuilder(char const* name, uint32, bool, std::nullptr_t, char const*, std::vector <ChatCommandBuilder> const& sub)
: ChatCommandBuilder(name, sub) { }
private: private:
std::string_view _name; std::string_view _name;
std::variant<InvokerEntry, SubCommandEntry> _data; std::variant<InvokerEntry, SubCommandEntry> _data;
@@ -451,7 +451,7 @@ void PlayerMenu::SendQuestGiverQuestDetails(Quest const* quest, ObjectGuid npcGU
uint32 moneyRew = 0; uint32 moneyRew = 0;
Player* player = _session->GetPlayer(); Player* player = _session->GetPlayer();
if (player && (player->getLevel() >= sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL) || sScriptMgr->ShouldBeRewardedWithMoneyInsteadOfExp(player))) if (player && (player->GetLevel() >= sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL) || sScriptMgr->ShouldBeRewardedWithMoneyInsteadOfExp(player)))
{ {
moneyRew = quest->GetRewMoneyMaxLevel(); moneyRew = quest->GetRewMoneyMaxLevel();
} }
+1 -3
View File
@@ -1506,9 +1506,7 @@ public:
[[nodiscard]] bool IsTotem() const { return m_unitTypeMask & UNIT_MASK_TOTEM; } [[nodiscard]] bool IsTotem() const { return m_unitTypeMask & UNIT_MASK_TOTEM; }
[[nodiscard]] bool IsVehicle() const { return m_unitTypeMask & UNIT_MASK_VEHICLE; } [[nodiscard]] bool IsVehicle() const { return m_unitTypeMask & UNIT_MASK_VEHICLE; }
/// @deprecated Use GetLevel() instead! [[nodiscard]] uint8 GetLevel() const { return uint8(GetUInt32Value(UNIT_FIELD_LEVEL)); }
[[nodiscard]] uint8 getLevel() const { return uint8(GetUInt32Value(UNIT_FIELD_LEVEL)); }
[[nodiscard]] uint8 GetLevel() const { return getLevel(); }
uint8 getLevelForTarget(WorldObject const* /*target*/) const override { return GetLevel(); } uint8 getLevelForTarget(WorldObject const* /*target*/) const override { return GetLevel(); }
void SetLevel(uint8 lvl, bool showLevelChange = true); void SetLevel(uint8 lvl, bool showLevelChange = true);
[[nodiscard]] uint8 getRace(bool original = false) const; [[nodiscard]] uint8 getRace(bool original = false) const;
-1
View File
@@ -567,7 +567,6 @@ public:
virtual void LoadConfigSettings(bool reload = false) = 0; virtual void LoadConfigSettings(bool reload = false) = 0;
virtual void SendWorldText(uint32 string_id, ...) = 0; virtual void SendWorldText(uint32 string_id, ...) = 0;
virtual void SendWorldTextOptional(uint32 string_id, uint32 flag, ...) = 0; virtual void SendWorldTextOptional(uint32 string_id, uint32 flag, ...) = 0;
virtual void SendGlobalText(const char* text, WorldSession* self) = 0;
virtual void SendGMText(uint32 string_id, ...) = 0; virtual void SendGMText(uint32 string_id, ...) = 0;
virtual void SendGlobalMessage(WorldPacket const* packet, WorldSession* self = nullptr, TeamId teamId = TEAM_NEUTRAL) = 0; virtual void SendGlobalMessage(WorldPacket const* packet, WorldSession* self = nullptr, TeamId teamId = TEAM_NEUTRAL) = 0;
virtual void SendGlobalGMMessage(WorldPacket const* packet, WorldSession* self = nullptr, TeamId teamId = TEAM_NEUTRAL) = 0; virtual void SendGlobalGMMessage(WorldPacket const* packet, WorldSession* self = nullptr, TeamId teamId = TEAM_NEUTRAL) = 0;
-18
View File
@@ -2649,24 +2649,6 @@ void World::SendGMText(uint32 string_id, ...)
va_end(ap); va_end(ap);
} }
/// @deprecated only for debug purpose. Send a System Message to all players (except self if mentioned)
void World::SendGlobalText(const char* text, WorldSession* self)
{
WorldPacket data;
// need copy to prevent corruption by strtok call in LineFromMessage original string
char* buf = strdup(text);
char* pos = buf;
while (char* line = ChatHandler::LineFromMessage(pos))
{
ChatHandler::BuildChatPacket(data, CHAT_MSG_SYSTEM, LANG_UNIVERSAL, nullptr, nullptr, line);
SendGlobalMessage(&data, self);
}
free(buf);
}
/// Send a packet to all players (or players selected team) in the zone (except self if mentioned) /// Send a packet to all players (or players selected team) in the zone (except self if mentioned)
bool World::SendZoneMessage(uint32 zone, WorldPacket const* packet, WorldSession* self, TeamId teamId) bool World::SendZoneMessage(uint32 zone, WorldPacket const* packet, WorldSession* self, TeamId teamId)
{ {
-1
View File
@@ -239,7 +239,6 @@ public:
void LoadConfigSettings(bool reload = false) override; void LoadConfigSettings(bool reload = false) override;
void SendWorldText(uint32 string_id, ...) override; void SendWorldText(uint32 string_id, ...) override;
void SendGlobalText(const char* text, WorldSession* self) override;
void SendGMText(uint32 string_id, ...) override; void SendGMText(uint32 string_id, ...) override;
void SendGlobalMessage(WorldPacket const* packet, WorldSession* self = nullptr, TeamId teamId = TEAM_NEUTRAL) override; void SendGlobalMessage(WorldPacket const* packet, WorldSession* self = nullptr, TeamId teamId = TEAM_NEUTRAL) override;
void SendGlobalGMMessage(WorldPacket const* packet, WorldSession* self = nullptr, TeamId teamId = TEAM_NEUTRAL) override; void SendGlobalGMMessage(WorldPacket const* packet, WorldSession* self = nullptr, TeamId teamId = TEAM_NEUTRAL) override;
+20 -20
View File
@@ -52,46 +52,46 @@ public:
{ {
static ChatCommandTable accountSetCommandTable = static ChatCommandTable accountSetCommandTable =
{ {
{ "addon", SEC_GAMEMASTER, true, &HandleAccountSetAddonCommand, "" }, { "addon", HandleAccountSetAddonCommand, SEC_GAMEMASTER, Console::Yes },
{ "gmlevel", SEC_CONSOLE, true, &HandleAccountSetGmLevelCommand, "" }, { "gmlevel", HandleAccountSetGmLevelCommand, SEC_ADMINISTRATOR, Console::Yes },
{ "password", SEC_CONSOLE, true, &HandleAccountSetPasswordCommand, "" }, { "password", HandleAccountSetPasswordCommand, SEC_ADMINISTRATOR, Console::Yes },
{ "2fa", SEC_PLAYER, true, &HandleAccountSet2FACommand, "" } { "2fa", HandleAccountSet2FACommand, SEC_PLAYER, Console::Yes }
}; };
static ChatCommandTable accountLockCommandTable static ChatCommandTable accountLockCommandTable
{ {
{ "country", SEC_PLAYER, true, &HandleAccountLockCountryCommand, "" }, { "country", HandleAccountLockCountryCommand, SEC_PLAYER, Console::Yes },
{ "ip", SEC_PLAYER, true, &HandleAccountLockIpCommand, "" } { "ip", HandleAccountLockIpCommand, SEC_PLAYER, Console::Yes }
}; };
static ChatCommandTable account2faCommandTable static ChatCommandTable account2faCommandTable
{ {
{ "setup", SEC_PLAYER, false, &HandleAccount2FASetupCommand, "" }, { "setup", HandleAccount2FASetupCommand, SEC_PLAYER, Console::No },
{ "remove", SEC_PLAYER, false, &HandleAccount2FARemoveCommand, "" }, { "remove", HandleAccount2FARemoveCommand, SEC_PLAYER, Console::No }
}; };
static ChatCommandTable accountRemoveCommandTable static ChatCommandTable accountRemoveCommandTable
{ {
{ "country", SEC_ADMINISTRATOR, true, &HandleAccountRemoveLockCountryCommand, "" } { "country", HandleAccountRemoveLockCountryCommand, SEC_ADMINISTRATOR, Console::Yes },
}; };
static ChatCommandTable accountCommandTable = static ChatCommandTable accountCommandTable =
{ {
{ "2fa", SEC_PLAYER, true, nullptr, "", account2faCommandTable }, { "2fa", account2faCommandTable },
{ "addon", SEC_MODERATOR, false, &HandleAccountAddonCommand, "" }, { "addon", HandleAccountAddonCommand, SEC_MODERATOR, Console::No },
{ "create", SEC_CONSOLE, true, &HandleAccountCreateCommand, "" }, { "create", HandleAccountCreateCommand, SEC_CONSOLE, Console::Yes },
{ "delete", SEC_CONSOLE, true, &HandleAccountDeleteCommand, "" }, { "delete", HandleAccountDeleteCommand, SEC_CONSOLE, Console::Yes },
{ "onlinelist", SEC_CONSOLE, true, &HandleAccountOnlineListCommand, "" }, { "onlinelist", HandleAccountOnlineListCommand, SEC_CONSOLE, Console::Yes },
{ "lock", SEC_PLAYER, false, nullptr, "", accountLockCommandTable }, { "lock", accountLockCommandTable },
{ "set", SEC_ADMINISTRATOR, true, nullptr, "", accountSetCommandTable }, { "set", accountSetCommandTable },
{ "password", SEC_PLAYER, false, &HandleAccountPasswordCommand, "" }, { "password", HandleAccountPasswordCommand, SEC_PLAYER, Console::No },
{ "remove", SEC_ADMINISTRATOR, true, nullptr, "", accountRemoveCommandTable }, { "remove", accountRemoveCommandTable },
{ "", SEC_PLAYER, false, &HandleAccountCommand, "" } { "", HandleAccountCommand, SEC_PLAYER, Console::No }
}; };
static ChatCommandTable commandTable = static ChatCommandTable commandTable =
{ {
{ "account", SEC_PLAYER, true, nullptr, "", accountCommandTable } { "account", accountCommandTable }
}; };
return commandTable; return commandTable;
+18 -18
View File
@@ -56,40 +56,40 @@ public:
{ {
static ChatCommandTable unbanCommandTable = static ChatCommandTable unbanCommandTable =
{ {
{ "account", SEC_ADMINISTRATOR, true, &HandleUnBanAccountCommand, "" }, { "account", HandleUnBanAccountCommand, SEC_ADMINISTRATOR, Console::Yes },
{ "character", SEC_ADMINISTRATOR, true, &HandleUnBanCharacterCommand, "" }, { "character", HandleUnBanCharacterCommand, SEC_ADMINISTRATOR, Console::Yes },
{ "playeraccount", SEC_ADMINISTRATOR, true, &HandleUnBanAccountByCharCommand, "" }, { "playeraccount", HandleUnBanAccountByCharCommand, SEC_ADMINISTRATOR, Console::Yes },
{ "ip", SEC_ADMINISTRATOR, true, &HandleUnBanIPCommand, "" } { "ip", HandleUnBanIPCommand, SEC_ADMINISTRATOR, Console::Yes }
}; };
static ChatCommandTable banlistCommandTable = static ChatCommandTable banlistCommandTable =
{ {
{ "account", SEC_GAMEMASTER, true, &HandleBanListAccountCommand, "" }, { "account", HandleBanListAccountCommand, SEC_GAMEMASTER, Console::Yes },
{ "character", SEC_GAMEMASTER, true, &HandleBanListCharacterCommand, "" }, { "character", HandleBanListCharacterCommand, SEC_GAMEMASTER, Console::Yes },
{ "ip", SEC_GAMEMASTER, true, &HandleBanListIPCommand, "" } { "ip", HandleBanListIPCommand, SEC_GAMEMASTER, Console::Yes }
}; };
static ChatCommandTable baninfoCommandTable = static ChatCommandTable baninfoCommandTable =
{ {
{ "account", SEC_GAMEMASTER, true, &HandleBanInfoAccountCommand, "" }, { "account", HandleBanInfoAccountCommand, SEC_GAMEMASTER, Console::Yes },
{ "character", SEC_GAMEMASTER, true, &HandleBanInfoCharacterCommand, "" }, { "character", HandleBanInfoCharacterCommand, SEC_GAMEMASTER, Console::Yes },
{ "ip", SEC_GAMEMASTER, true, &HandleBanInfoIPCommand, "" } { "ip", HandleBanInfoIPCommand, SEC_GAMEMASTER, Console::Yes }
}; };
static ChatCommandTable banCommandTable = static ChatCommandTable banCommandTable =
{ {
{ "account", SEC_GAMEMASTER, true, &HandleBanAccountCommand, "" }, { "account", HandleBanAccountCommand, SEC_GAMEMASTER, Console::Yes },
{ "character", SEC_GAMEMASTER, true, &HandleBanCharacterCommand, "" }, { "character", HandleBanCharacterCommand, SEC_GAMEMASTER, Console::Yes },
{ "playeraccount", SEC_GAMEMASTER, true, &HandleBanAccountByCharCommand, "" }, { "playeraccount",HandleBanAccountByCharCommand, SEC_GAMEMASTER, Console::Yes },
{ "ip", SEC_GAMEMASTER, true, &HandleBanIPCommand, "" } { "ip", HandleBanIPCommand, SEC_GAMEMASTER, Console::Yes }
}; };
static ChatCommandTable commandTable = static ChatCommandTable commandTable =
{ {
{ "ban", SEC_GAMEMASTER, true, nullptr, "", banCommandTable }, { "ban", banCommandTable },
{ "baninfo", SEC_GAMEMASTER, true, nullptr, "", baninfoCommandTable }, { "baninfo", baninfoCommandTable },
{ "banlist", SEC_GAMEMASTER, true, nullptr, "", banlistCommandTable }, { "banlist", banlistCommandTable },
{ "unban", SEC_ADMINISTRATOR, true, nullptr, "", unbanCommandTable } { "unban", unbanCommandTable }
}; };
return commandTable; return commandTable;
+8 -8
View File
@@ -42,17 +42,17 @@ public:
{ {
static ChatCommandTable wpCommandTable = static ChatCommandTable wpCommandTable =
{ {
{ "add", SEC_ADMINISTRATOR, false, &HandleWpAddCommand, "" }, { "add", HandleWpAddCommand, SEC_ADMINISTRATOR, Console::No },
{ "event", SEC_ADMINISTRATOR, false, &HandleWpEventCommand, "" }, { "event", HandleWpEventCommand, SEC_ADMINISTRATOR, Console::No },
{ "load", SEC_ADMINISTRATOR, false, &HandleWpLoadCommand, "" }, { "load", HandleWpLoadCommand, SEC_ADMINISTRATOR, Console::No },
{ "modify", SEC_ADMINISTRATOR, false, &HandleWpModifyCommand, "" }, { "modify", HandleWpModifyCommand, SEC_ADMINISTRATOR, Console::No },
{ "unload", SEC_ADMINISTRATOR, false, &HandleWpUnLoadCommand, "" }, { "unload", HandleWpUnLoadCommand, SEC_ADMINISTRATOR, Console::No },
{ "reload", SEC_ADMINISTRATOR, false, &HandleWpReloadCommand, "" }, { "reload", HandleWpReloadCommand, SEC_ADMINISTRATOR, Console::No },
{ "show", SEC_ADMINISTRATOR, false, &HandleWpShowCommand, "" } { "show", HandleWpShowCommand, SEC_ADMINISTRATOR, Console::No }
}; };
static ChatCommandTable commandTable = static ChatCommandTable commandTable =
{ {
{ "wp", SEC_ADMINISTRATOR, false, nullptr, "", wpCommandTable } { "wp", wpCommandTable }
}; };
return commandTable; return commandTable;
} }
-1
View File
@@ -74,7 +74,6 @@ public:
MOCK_METHOD(void, LoadConfigSettings, (bool reload), ()); MOCK_METHOD(void, LoadConfigSettings, (bool reload), ());
void SendWorldText(uint32 string_id, ...) override {} void SendWorldText(uint32 string_id, ...) override {}
void SendWorldTextOptional(uint32 string_id, uint32 flag, ...) override {} void SendWorldTextOptional(uint32 string_id, uint32 flag, ...) override {}
MOCK_METHOD(void, SendGlobalText, (const char* text, WorldSession* self), ());
void SendGMText(uint32 string_id, ...) override {} void SendGMText(uint32 string_id, ...) override {}
MOCK_METHOD(void, SendGlobalMessage, (WorldPacket const* packet, WorldSession* self, TeamId teamId), ()); MOCK_METHOD(void, SendGlobalMessage, (WorldPacket const* packet, WorldSession* self, TeamId teamId), ());
MOCK_METHOD(void, SendGlobalGMMessage, (WorldPacket const* packet, WorldSession* self, TeamId teamId), ()); MOCK_METHOD(void, SendGlobalGMMessage, (WorldPacket const* packet, WorldSession* self, TeamId teamId), ());