Skip to content

Commit

Permalink
chore(Core/Misc): Remove deprecated code (#19413)
Browse files Browse the repository at this point in the history
* Config - Deprecated for 3 years
* ChatCommand - Deprecated for 2 years
* getLevel() - Deprecated for 2 years
* SendGlobalText - Deprecated for 8 years +
  • Loading branch information
Kitzunu authored Jul 20, 2024
1 parent 5c09a31 commit 21f86d1
Show file tree
Hide file tree
Showing 13 changed files with 52 additions and 132 deletions.
24 changes: 0 additions & 24 deletions src/common/Configuration/Config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -649,30 +649,6 @@ bool ConfigMgr::LoadModulesConfigs(bool isReload /*= false*/, bool isNeedPrintIn
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) \
template __typename ConfigMgr::GetOption<__typename>(std::string const& name, __typename const& def, bool showLogs /*= true*/) const;

Expand Down
20 changes: 0 additions & 20 deletions src/common/Configuration/Config.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,26 +50,6 @@ class ConfigMgr
template<class T>
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; }
void setDryRun(bool mode) { dryRun = mode; }

Expand Down
13 changes: 0 additions & 13 deletions src/server/game/Chat/ChatCommands/ChatCommand.h
Original file line number Diff line number Diff line change
Expand Up @@ -248,19 +248,6 @@ namespace Acore::ChatCommands
ChatCommandBuilder(char const* name, std::vector<ChatCommandBuilder> const& 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:
std::string_view _name;
std::variant<InvokerEntry, SubCommandEntry> _data;
Expand Down
2 changes: 1 addition & 1 deletion src/server/game/Entities/Creature/GossipDef.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,7 @@ void PlayerMenu::SendQuestGiverQuestDetails(Quest const* quest, ObjectGuid npcGU

uint32 moneyRew = 0;
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();
}
Expand Down
4 changes: 1 addition & 3 deletions src/server/game/Entities/Unit/Unit.h
Original file line number Diff line number Diff line change
Expand Up @@ -1506,9 +1506,7 @@ class Unit : public WorldObject
[[nodiscard]] bool IsTotem() const { return m_unitTypeMask & UNIT_MASK_TOTEM; }
[[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 getLevel(); }
[[nodiscard]] uint8 GetLevel() const { return uint8(GetUInt32Value(UNIT_FIELD_LEVEL)); }
uint8 getLevelForTarget(WorldObject const* /*target*/) const override { return GetLevel(); }
void SetLevel(uint8 lvl, bool showLevelChange = true);
[[nodiscard]] uint8 getRace(bool original = false) const;
Expand Down
1 change: 0 additions & 1 deletion src/server/game/World/IWorld.h
Original file line number Diff line number Diff line change
Expand Up @@ -567,7 +567,6 @@ class IWorld
virtual void LoadConfigSettings(bool reload = false) = 0;
virtual void SendWorldText(uint32 string_id, ...) = 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 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;
Expand Down
18 changes: 0 additions & 18 deletions src/server/game/World/World.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2649,24 +2649,6 @@ void World::SendGMText(uint32 string_id, ...)
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)
bool World::SendZoneMessage(uint32 zone, WorldPacket const* packet, WorldSession* self, TeamId teamId)
{
Expand Down
1 change: 0 additions & 1 deletion src/server/game/World/World.h
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,6 @@ class World: public IWorld
void LoadConfigSettings(bool reload = false) override;

void SendWorldText(uint32 string_id, ...) override;
void SendGlobalText(const char* text, WorldSession* self) override;
void SendGMText(uint32 string_id, ...) 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;
Expand Down
40 changes: 20 additions & 20 deletions src/server/scripts/Commands/cs_account.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,46 +52,46 @@ class account_commandscript : public CommandScript
{
static ChatCommandTable accountSetCommandTable =
{
{ "addon", SEC_GAMEMASTER, true, &HandleAccountSetAddonCommand, "" },
{ "gmlevel", SEC_CONSOLE, true, &HandleAccountSetGmLevelCommand, "" },
{ "password", SEC_CONSOLE, true, &HandleAccountSetPasswordCommand, "" },
{ "2fa", SEC_PLAYER, true, &HandleAccountSet2FACommand, "" }
{ "addon", HandleAccountSetAddonCommand, SEC_GAMEMASTER, Console::Yes },
{ "gmlevel", HandleAccountSetGmLevelCommand, SEC_ADMINISTRATOR, Console::Yes },
{ "password", HandleAccountSetPasswordCommand, SEC_ADMINISTRATOR, Console::Yes },
{ "2fa", HandleAccountSet2FACommand, SEC_PLAYER, Console::Yes }
};

static ChatCommandTable accountLockCommandTable
{
{ "country", SEC_PLAYER, true, &HandleAccountLockCountryCommand, "" },
{ "ip", SEC_PLAYER, true, &HandleAccountLockIpCommand, "" }
{ "country", HandleAccountLockCountryCommand, SEC_PLAYER, Console::Yes },
{ "ip", HandleAccountLockIpCommand, SEC_PLAYER, Console::Yes }
};

static ChatCommandTable account2faCommandTable
{
{ "setup", SEC_PLAYER, false, &HandleAccount2FASetupCommand, "" },
{ "remove", SEC_PLAYER, false, &HandleAccount2FARemoveCommand, "" },
{ "setup", HandleAccount2FASetupCommand, SEC_PLAYER, Console::No },
{ "remove", HandleAccount2FARemoveCommand, SEC_PLAYER, Console::No }
};

static ChatCommandTable accountRemoveCommandTable
{
{ "country", SEC_ADMINISTRATOR, true, &HandleAccountRemoveLockCountryCommand, "" }
{ "country", HandleAccountRemoveLockCountryCommand, SEC_ADMINISTRATOR, Console::Yes },
};

static ChatCommandTable accountCommandTable =
{
{ "2fa", SEC_PLAYER, true, nullptr, "", account2faCommandTable },
{ "addon", SEC_MODERATOR, false, &HandleAccountAddonCommand, "" },
{ "create", SEC_CONSOLE, true, &HandleAccountCreateCommand, "" },
{ "delete", SEC_CONSOLE, true, &HandleAccountDeleteCommand, "" },
{ "onlinelist", SEC_CONSOLE, true, &HandleAccountOnlineListCommand, "" },
{ "lock", SEC_PLAYER, false, nullptr, "", accountLockCommandTable },
{ "set", SEC_ADMINISTRATOR, true, nullptr, "", accountSetCommandTable },
{ "password", SEC_PLAYER, false, &HandleAccountPasswordCommand, "" },
{ "remove", SEC_ADMINISTRATOR, true, nullptr, "", accountRemoveCommandTable },
{ "", SEC_PLAYER, false, &HandleAccountCommand, "" }
{ "2fa", account2faCommandTable },
{ "addon", HandleAccountAddonCommand, SEC_MODERATOR, Console::No },
{ "create", HandleAccountCreateCommand, SEC_CONSOLE, Console::Yes },
{ "delete", HandleAccountDeleteCommand, SEC_CONSOLE, Console::Yes },
{ "onlinelist", HandleAccountOnlineListCommand, SEC_CONSOLE, Console::Yes },
{ "lock", accountLockCommandTable },
{ "set", accountSetCommandTable },
{ "password", HandleAccountPasswordCommand, SEC_PLAYER, Console::No },
{ "remove", accountRemoveCommandTable },
{ "", HandleAccountCommand, SEC_PLAYER, Console::No }
};

static ChatCommandTable commandTable =
{
{ "account", SEC_PLAYER, true, nullptr, "", accountCommandTable }
{ "account", accountCommandTable }
};

return commandTable;
Expand Down
36 changes: 18 additions & 18 deletions src/server/scripts/Commands/cs_ban.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,40 +56,40 @@ class ban_commandscript : public CommandScript
{
static ChatCommandTable unbanCommandTable =
{
{ "account", SEC_ADMINISTRATOR, true, &HandleUnBanAccountCommand, "" },
{ "character", SEC_ADMINISTRATOR, true, &HandleUnBanCharacterCommand, "" },
{ "playeraccount", SEC_ADMINISTRATOR, true, &HandleUnBanAccountByCharCommand, "" },
{ "ip", SEC_ADMINISTRATOR, true, &HandleUnBanIPCommand, "" }
{ "account", HandleUnBanAccountCommand, SEC_ADMINISTRATOR, Console::Yes },
{ "character", HandleUnBanCharacterCommand, SEC_ADMINISTRATOR, Console::Yes },
{ "playeraccount", HandleUnBanAccountByCharCommand, SEC_ADMINISTRATOR, Console::Yes },
{ "ip", HandleUnBanIPCommand, SEC_ADMINISTRATOR, Console::Yes }
};

static ChatCommandTable banlistCommandTable =
{
{ "account", SEC_GAMEMASTER, true, &HandleBanListAccountCommand, "" },
{ "character", SEC_GAMEMASTER, true, &HandleBanListCharacterCommand, "" },
{ "ip", SEC_GAMEMASTER, true, &HandleBanListIPCommand, "" }
{ "account", HandleBanListAccountCommand, SEC_GAMEMASTER, Console::Yes },
{ "character", HandleBanListCharacterCommand, SEC_GAMEMASTER, Console::Yes },
{ "ip", HandleBanListIPCommand, SEC_GAMEMASTER, Console::Yes }
};

static ChatCommandTable baninfoCommandTable =
{
{ "account", SEC_GAMEMASTER, true, &HandleBanInfoAccountCommand, "" },
{ "character", SEC_GAMEMASTER, true, &HandleBanInfoCharacterCommand, "" },
{ "ip", SEC_GAMEMASTER, true, &HandleBanInfoIPCommand, "" }
{ "account", HandleBanInfoAccountCommand, SEC_GAMEMASTER, Console::Yes },
{ "character", HandleBanInfoCharacterCommand, SEC_GAMEMASTER, Console::Yes },
{ "ip", HandleBanInfoIPCommand, SEC_GAMEMASTER, Console::Yes }
};

static ChatCommandTable banCommandTable =
{
{ "account", SEC_GAMEMASTER, true, &HandleBanAccountCommand, "" },
{ "character", SEC_GAMEMASTER, true, &HandleBanCharacterCommand, "" },
{ "playeraccount", SEC_GAMEMASTER, true, &HandleBanAccountByCharCommand, "" },
{ "ip", SEC_GAMEMASTER, true, &HandleBanIPCommand, "" }
{ "account", HandleBanAccountCommand, SEC_GAMEMASTER, Console::Yes },
{ "character", HandleBanCharacterCommand, SEC_GAMEMASTER, Console::Yes },
{ "playeraccount",HandleBanAccountByCharCommand, SEC_GAMEMASTER, Console::Yes },
{ "ip", HandleBanIPCommand, SEC_GAMEMASTER, Console::Yes }
};

static ChatCommandTable commandTable =
{
{ "ban", SEC_GAMEMASTER, true, nullptr, "", banCommandTable },
{ "baninfo", SEC_GAMEMASTER, true, nullptr, "", baninfoCommandTable },
{ "banlist", SEC_GAMEMASTER, true, nullptr, "", banlistCommandTable },
{ "unban", SEC_ADMINISTRATOR, true, nullptr, "", unbanCommandTable }
{ "ban", banCommandTable },
{ "baninfo", baninfoCommandTable },
{ "banlist", banlistCommandTable },
{ "unban", unbanCommandTable }
};

return commandTable;
Expand Down
8 changes: 4 additions & 4 deletions src/server/scripts/Commands/cs_learn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class learn_commandscript : public CommandScript

static ChatCommandTable learnAllCommandTable =
{
{ "my", learnAllMyCommandTable },
{ "my", learnAllMyCommandTable },
{ "gm", HandleLearnAllGMCommand, SEC_GAMEMASTER, Console::No },
{ "crafts", HandleLearnAllCraftsCommand, SEC_GAMEMASTER, Console::No },
{ "default", HandleLearnAllDefaultCommand, SEC_GAMEMASTER, Console::No },
Expand All @@ -60,14 +60,14 @@ class learn_commandscript : public CommandScript

static ChatCommandTable learnCommandTable =
{
{ "all", learnAllCommandTable },
{ "all", learnAllCommandTable },
{ "", HandleLearnCommand, SEC_GAMEMASTER, Console::No }
};

static ChatCommandTable commandTable =
{
{ "learn", learnCommandTable },
{ "unlearn", HandleUnLearnCommand, SEC_GAMEMASTER, Console::No }
{ "learn", learnCommandTable },
{ "unlearn", HandleUnLearnCommand, SEC_GAMEMASTER, Console::No }
};
return commandTable;
}
Expand Down
16 changes: 8 additions & 8 deletions src/server/scripts/Commands/cs_wp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,17 +42,17 @@ class wp_commandscript : public CommandScript
{
static ChatCommandTable wpCommandTable =
{
{ "add", SEC_ADMINISTRATOR, false, &HandleWpAddCommand, "" },
{ "event", SEC_ADMINISTRATOR, false, &HandleWpEventCommand, "" },
{ "load", SEC_ADMINISTRATOR, false, &HandleWpLoadCommand, "" },
{ "modify", SEC_ADMINISTRATOR, false, &HandleWpModifyCommand, "" },
{ "unload", SEC_ADMINISTRATOR, false, &HandleWpUnLoadCommand, "" },
{ "reload", SEC_ADMINISTRATOR, false, &HandleWpReloadCommand, "" },
{ "show", SEC_ADMINISTRATOR, false, &HandleWpShowCommand, "" }
{ "add", HandleWpAddCommand, SEC_ADMINISTRATOR, Console::No },
{ "event", HandleWpEventCommand, SEC_ADMINISTRATOR, Console::No },
{ "load", HandleWpLoadCommand, SEC_ADMINISTRATOR, Console::No },
{ "modify", HandleWpModifyCommand, SEC_ADMINISTRATOR, Console::No },
{ "unload", HandleWpUnLoadCommand, SEC_ADMINISTRATOR, Console::No },
{ "reload", HandleWpReloadCommand, SEC_ADMINISTRATOR, Console::No },
{ "show", HandleWpShowCommand, SEC_ADMINISTRATOR, Console::No }
};
static ChatCommandTable commandTable =
{
{ "wp", SEC_ADMINISTRATOR, false, nullptr, "", wpCommandTable }
{ "wp", wpCommandTable }
};
return commandTable;
}
Expand Down
1 change: 0 additions & 1 deletion src/test/mocks/WorldMock.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ class WorldMock: public IWorld
MOCK_METHOD(void, LoadConfigSettings, (bool reload), ());
void SendWorldText(uint32 string_id, ...) override {}
void SendWorldTextOptional(uint32 string_id, uint32 flag, ...) override {}
MOCK_METHOD(void, SendGlobalText, (const char* text, WorldSession* self), ());
void SendGMText(uint32 string_id, ...) override {}
MOCK_METHOD(void, SendGlobalMessage, (WorldPacket const* packet, WorldSession* self, TeamId teamId), ());
MOCK_METHOD(void, SendGlobalGMMessage, (WorldPacket const* packet, WorldSession* self, TeamId teamId), ());
Expand Down

4 comments on commit 21f86d1

@Leuansin
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Getting crash at loading Waypoints with this newest commit. idk what to do honestly.

@Kitzunu
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Open an issue and paste a crash log. It doesnt crash on a clean install.

@Leuansin
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did the clean install, exported Data content folders and change to point at the SQL succesfully, still crashing.
I dont know how to open an issue D:
Here's my pastebin
https://pastebin.com/9VU925SX

@Nyeriah
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Leuansin Please open an issue, the crash report leads to a spell in scholazar basin (nothing related to this PR)

Please sign in to comment.