Skip to content

Commit

Permalink
Rename BUILD_PLAYERBOT option to BUILD_DEPRECATED_PLAYERBOT
Browse files Browse the repository at this point in the history
In preparation for new playerbot version

Current player bot will still work as before, just use BUILD_DEPRECATED_PLAYERBOT=ON from now on.
This may be removed in some future.
 master
  • Loading branch information
cyberium committed Mar 6, 2024
1 parent d8513b7 commit bb5c608
Show file tree
Hide file tree
Showing 20 changed files with 75 additions and 74 deletions.
8 changes: 4 additions & 4 deletions CMakeLists.txt
Expand Up @@ -324,13 +324,13 @@ if(NOT BUILD_GAME_SERVER AND BUILD_SCRIPTDEV)
message(STATUS "BUILD_SCRIPTDEV forced to OFF due to BUILD_GAME_SERVER is not set")
endif()

if(NOT BUILD_GAME_SERVER AND BUILD_PLAYERBOT)
set(BUILD_PLAYERBOT OFF)
message(STATUS "BUILD_PLAYERBOT forced to OFF due to BUILD_GAME_SERVER is not set")
if(NOT BUILD_GAME_SERVER AND BUILD_DEPRECATED_PLAYERBOT)
set(BUILD_DEPRECATED_PLAYERBOT OFF)
message(STATUS "BUILD_DEPRECATED_PLAYERBOT forced to OFF due to BUILD_GAME_SERVER is not set")
endif()

if(PCH)
if(${CMAKE_VERSION} VERSION_LESS "3.16")
if(${CMAKE_VERSION} VERSION_LESS "3.16")
message("PCH is not supported by your CMake version")
message("Please consider to switch to CMake 3.16")
message("PCH is forced to OFF")
Expand Down
35 changes: 18 additions & 17 deletions cmake/options.cmake
@@ -1,18 +1,18 @@
option(DEBUG "Include additional debug-code in core" OFF)
option(WARNINGS "Show all warnings during compile" OFF)
option(POSTGRESQL "Use PostgreSQL" OFF)
option(PCH "Use precompiled headers" ON)
option(BUILD_GAME_SERVER "Build game server" ON)
option(BUILD_LOGIN_SERVER "Build login server" ON)
option(BUILD_EXTRACTORS "Build map/dbc/vmap/mmap extractors" OFF)
option(BUILD_SCRIPTDEV "Build ScriptDev. (OFF Speedup build)" ON)
option(BUILD_PLAYERBOT "Build Playerbot mod" OFF)
option(BUILD_AHBOT "Build Auction House Bot mod" OFF)
option(BUILD_METRICS "Build Metrics, generate data for Grafana" OFF)
option(BUILD_RECASTDEMOMOD "Build map/vmap/mmap viewer" OFF)
option(BUILD_GIT_ID "Build git_id" OFF)
option(BUILD_DOCS "Build documentation with doxygen" OFF)
option(CMAKE_INTERPROCEDURAL_OPTIMIZATION "Enable link-time optimizations" OFF)
option(DEBUG "Include additional debug-code in core" OFF)
option(WARNINGS "Show all warnings during compile" OFF)
option(POSTGRESQL "Use PostgreSQL" OFF)
option(PCH "Use precompiled headers" ON)
option(BUILD_GAME_SERVER "Build game server" ON)
option(BUILD_LOGIN_SERVER "Build login server" ON)
option(BUILD_EXTRACTORS "Build map/dbc/vmap/mmap extractors" OFF)
option(BUILD_SCRIPTDEV "Build ScriptDev. (OFF Speedup build)" ON)
option(BUILD_AHBOT "Build Auction House Bot mod" OFF)
option(BUILD_METRICS "Build Metrics, generate data for Grafana" OFF)
option(BUILD_RECASTDEMOMOD "Build map/vmap/mmap viewer" OFF)
option(BUILD_GIT_ID "Build git_id" OFF)
option(BUILD_DOCS "Build documentation with doxygen" OFF)
option(CMAKE_INTERPROCEDURAL_OPTIMIZATION "Enable link-time optimizations" OFF)
option(BUILD_DEPRECATED_PLAYERBOT "Build previous version of Playerbot mod" OFF)
set(DEV_BINARY_DIR ${CMAKE_BINARY_DIR} CACHE STRING "Executable directory on Windows")

# TODO: options that should be checked/created:
Expand All @@ -33,14 +33,15 @@ message(STATUS
BUILD_GAME_SERVER Build game server (core server)
BUILD_LOGIN_SERVER Build login server (auth server)
BUILD_EXTRACTORS Build map/dbc/vmap/mmap extractor
BUILD_SCRIPTDEV Build scriptdev. (Disable it to speedup build in dev mode by not including scripts)
BUILD_PLAYERBOT Build Playerbot mod
BUILD_AHBOT Build Auction House Bot mod
BUILD_METRICS Build Metrics, generate data for Grafana
BUILD_RECASTDEMOMOD Build map/vmap/mmap viewer
BUILD_GIT_ID Build git_id
BUILD_DOCS Build documentation with doxygen
CMAKE_INTERPROCEDURAL_OPTIMIZATION Enable link-time optimizations
BUILD_DEPRECATED_PLAYERBOT Build Playerbot mod (deprecated)
BUILD_SCRIPTDEV Build scriptdev. (Disable it to speedup build
in dev mode by not including scripts)
DEV_BINARY_DIR Target directory for executables on Windows only
Expand Down
6 changes: 3 additions & 3 deletions cmake/showoptions.cmake
Expand Up @@ -61,10 +61,10 @@ else()
message(STATUS "Build METRICs : No (default)")
endif()

if(BUILD_PLAYERBOT)
message(STATUS "Build Playerbot : Yes")
if(BUILD_DEPRECATED_PLAYERBOT)
message(STATUS "Build OLD Playerbot : Yes")
else()
message(STATUS "Build Playerbot : No (default)")
message(STATUS "Build OLD Playerbot : No (default)")
endif()

if(BUILD_EXTRACTORS)
Expand Down
8 changes: 4 additions & 4 deletions src/game/CMakeLists.txt
Expand Up @@ -40,7 +40,7 @@ if(NOT BUILD_SCRIPTDEV)
endforeach()
endif()

if(NOT BUILD_PLAYERBOT)
if(NOT BUILD_DEPRECATED_PLAYERBOT)
# exclude Playerbot folder
set (EXCLUDE_DIR "PlayerBot/")
foreach (TMP_PATH ${LIBRARY_SRCS})
Expand Down Expand Up @@ -122,9 +122,9 @@ if (BUILD_METRICS)
add_definitions(-DBUILD_METRICS)
endif()

# Define BUILD_PLAYERBOT if need
if (BUILD_PLAYERBOT)
add_definitions(-DBUILD_PLAYERBOT)
# Define BUILD_DEPRECATED_PLAYERBOT if need
if (BUILD_DEPRECATED_PLAYERBOT)
add_definitions(-DBUILD_DEPRECATED_PLAYERBOT)
endif()

if (MSVC)
Expand Down
2 changes: 1 addition & 1 deletion src/game/Chat/Chat.cpp
Expand Up @@ -1082,7 +1082,7 @@ ChatCommand* ChatHandler::getCommandTable()
{ "mmap", SEC_GAMEMASTER, false, nullptr, "", mmapCommandTable },
{ "worldstate", SEC_ADMINISTRATOR, false, nullptr, "", worldStateTable },
{ "loot", SEC_GAMEMASTER, true, nullptr, "", lootCommandTable },
#ifdef BUILD_PLAYERBOT
#ifdef BUILD_DEPRECATED_PLAYERBOT
{ "bot", SEC_PLAYER, false, &ChatHandler::HandlePlayerbotCommand, "", nullptr },
#endif

Expand Down
2 changes: 1 addition & 1 deletion src/game/Chat/Chat.h
Expand Up @@ -796,7 +796,7 @@ class ChatHandler
bool HandleWaterwalkCommand(char* args);
bool HandleQuitCommand(char* args);
bool HandleShowGearScoreCommand(char* args);
#ifdef BUILD_PLAYERBOT
#ifdef BUILD_DEPRECATED_PLAYERBOT
bool HandlePlayerbotCommand(char* args);
#endif

Expand Down
2 changes: 1 addition & 1 deletion src/game/Chat/ChatHandler.cpp
Expand Up @@ -39,7 +39,7 @@

bool WorldSession::CheckChatMessage(std::string& msg, bool addon/* = false*/)
{
#ifdef BUILD_PLAYERBOT
#ifdef BUILD_DEPRECATED_PLAYERBOT
// bot check can be avoided
if (_player->GetPlayerbotAI())
return true;
Expand Down
6 changes: 3 additions & 3 deletions src/game/Entities/CharacterHandler.cpp
Expand Up @@ -41,7 +41,7 @@
#include "AI/ScriptDevAI/ScriptDevAIMgr.h"
#include "Anticheat/Anticheat.hpp"

#ifdef BUILD_PLAYERBOT
#ifdef BUILD_DEPRECATED_PLAYERBOT
#include "PlayerBot/Base/PlayerbotMgr.h"
#endif

Expand Down Expand Up @@ -138,7 +138,7 @@ class CharacterHandler
if (WorldSession* session = sWorld.FindSession(((LoginQueryHolder*)holder)->GetAccountId()))
session->HandlePlayerLogin((LoginQueryHolder*)holder);
}
#ifdef BUILD_PLAYERBOT
#ifdef BUILD_DEPRECATED_PLAYERBOT
// This callback is different from the normal HandlePlayerLoginCallback in that it
// sets up the bot's world session and also stores the pointer to the bot player in the master's
// world session m_playerBots map
Expand Down Expand Up @@ -643,7 +643,7 @@ void WorldSession::HandlePlayerLoginOpcode(WorldPacket& recv_data)
CharacterDatabase.DelayQueryHolder(&chrHandler, &CharacterHandler::HandlePlayerLoginCallback, holder);
}

#ifdef BUILD_PLAYERBOT
#ifdef BUILD_DEPRECATED_PLAYERBOT
// Can't easily reuse HandlePlayerLoginOpcode for logging in bots because it assumes
// a WorldSession exists for the bot. The WorldSession for a bot is created after the character is loaded.
void PlayerbotMgr::LoginPlayerBot(ObjectGuid playerGuid)
Expand Down
2 changes: 1 addition & 1 deletion src/game/Entities/Creature.h
Expand Up @@ -574,7 +574,7 @@ class Creature : public Unit
bool IsTemporarySummon() const { return m_subtype == CREATURE_SUBTYPE_TEMPORARY_SUMMON; }
bool IsCritter() const { return m_creatureInfo->CreatureType == CREATURE_TYPE_CRITTER; }

#ifdef BUILD_PLAYERBOT
#ifdef BUILD_DEPRECATED_PLAYERBOT
// Adds functionality to load/unload bots from NPC, also need to apply SQL scripts
void LoadBotMenu(Player* pPlayer);
#endif
Expand Down
18 changes: 9 additions & 9 deletions src/game/Entities/Player.cpp
Expand Up @@ -70,7 +70,7 @@
#include "World/WorldState.h"
#include "Anticheat/Anticheat.hpp"

#ifdef BUILD_PLAYERBOT
#ifdef BUILD_DEPRECATED_PLAYERBOT
#include "PlayerBot/Base/PlayerbotAI.h"
#include "PlayerBot/Base/PlayerbotMgr.h"
#include "Config/Config.h"
Expand All @@ -92,7 +92,7 @@
#define SKILL_PERM_BONUS(x) int16(PAIR32_HIPART(x))
#define MAKE_SKILL_BONUS(t, p) MAKE_PAIR32(t,p)

#ifdef BUILD_PLAYERBOT
#ifdef BUILD_DEPRECATED_PLAYERBOT
extern Config botConfig;
#endif

Expand Down Expand Up @@ -499,7 +499,7 @@ void TradeData::SetAccepted(bool state, bool crosssend /*= false*/)
//== Player ====================================================
Player::Player(WorldSession* session): Unit(), m_taxiTracker(*this), m_mover(this), m_camera(this), m_achievementMgr(this), m_reputationMgr(this), m_launched(false)
{
#ifdef BUILD_PLAYERBOT
#ifdef BUILD_DEPRECATED_PLAYERBOT
m_playerbotAI = 0;
m_playerbotMgr = 0;
#endif
Expand Down Expand Up @@ -735,7 +735,7 @@ Player::~Player()
delete m_declinedname;
delete m_runes;

#ifdef BUILD_PLAYERBOT
#ifdef BUILD_DEPRECATED_PLAYERBOT
if (m_playerbotAI)
{
delete m_playerbotAI;
Expand Down Expand Up @@ -1721,7 +1721,7 @@ void Player::Update(const uint32 diff)
if (IsHasDelayedTeleport() && !m_semaphoreTeleport_Near)
TeleportTo(m_teleport_dest, m_teleport_options);

#ifdef BUILD_PLAYERBOT
#ifdef BUILD_DEPRECATED_PLAYERBOT
if (m_playerbotAI)
m_playerbotAI->UpdateAI(diff);
else if (m_playerbotMgr)
Expand Down Expand Up @@ -2050,7 +2050,7 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati

MapEntry const* mEntry = sMapStore.LookupEntry(mapid); // Validity checked in IsValidMapCoord

#ifdef BUILD_PLAYERBOT
#ifdef BUILD_DEPRECATED_PLAYERBOT
// If this user has bots, tell them to stop following master
// so they don't try to follow the master after the master teleports
if (GetPlayerbotMgr())
Expand Down Expand Up @@ -2989,7 +2989,7 @@ void Player::GiveLevel(uint32 level)
MailDraft(mailReward->mailTemplateId).SendMailTo(this, MailSender(MAIL_CREATURE, mailReward->senderEntry));

GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_REACH_LEVEL);
#ifdef BUILD_PLAYERBOT
#ifdef BUILD_DEPRECATED_PLAYERBOT
if (m_playerbotAI)
m_playerbotAI->GiveLevel(level);
#endif
Expand Down Expand Up @@ -13414,7 +13414,7 @@ void Player::PrepareGossipMenu(WorldObject* pSource, uint32 menuId, bool forceQu
break; // no checks
case GOSSIP_OPTION_BOT:
{
#ifdef BUILD_PLAYERBOT
#ifdef BUILD_DEPRECATED_PLAYERBOT
if (botConfig.GetBoolDefault("PlayerbotAI.DisableBots", false) && !pCreature->isInnkeeper())
{
ChatHandler(this).PSendSysMessage("|cffff0000Playerbot system is currently disabled!");
Expand Down Expand Up @@ -13713,7 +13713,7 @@ void Player::OnGossipSelect(WorldObject* pSource, uint32 gossipListId, uint32 me
GetSession()->SendBattleGroundList(guid, bgTypeId);
break;
}
#ifdef BUILD_PLAYERBOT
#ifdef BUILD_DEPRECATED_PLAYERBOT
case GOSSIP_OPTION_BOT:
{
// DEBUG_LOG("GOSSIP_OPTION_BOT");
Expand Down
8 changes: 4 additions & 4 deletions src/game/Entities/Player.h
Expand Up @@ -60,7 +60,7 @@ class Spell;
class Item;
struct FactionTemplateEntry;

#ifdef BUILD_PLAYERBOT
#ifdef BUILD_DEPRECATED_PLAYERBOT
#include "PlayerBot/Base/PlayerbotMgr.h"
#include "PlayerBot/Base/PlayerbotAI.h"
#endif
Expand Down Expand Up @@ -1562,7 +1562,7 @@ class Player : public Unit
void AddTimedQuest(uint32 quest_id) { m_timedquests.insert(quest_id); }
void RemoveTimedQuest(uint32 quest_id) { m_timedquests.erase(quest_id); }

#ifdef BUILD_PLAYERBOT
#ifdef BUILD_DEPRECATED_PLAYERBOT
PlayerTalentMap GetTalents(uint8 spec) { return m_talents[spec]; }
void chompAndTrim(std::string& str);
bool getNextQuestId(const std::string& pString, unsigned int& pStartPos, unsigned int& pId);
Expand Down Expand Up @@ -2506,7 +2506,7 @@ class Player : public Unit

void SendMessageToPlayer(std::string const& message) const; // debugging purposes

#ifdef BUILD_PLAYERBOT
#ifdef BUILD_DEPRECATED_PLAYERBOT
// A Player can either have a playerbotMgr (to manage its bots), or have playerbotAI (if it is a bot), or
// neither. Code that enables bots must create the playerbotMgr and set it using SetPlayerbotMgr.
void SetPlayerbotAI(PlayerbotAI* ai) { assert(!m_playerbotAI && !m_playerbotMgr); m_playerbotAI = ai; }
Expand Down Expand Up @@ -2872,7 +2872,7 @@ class Player : public Unit
MapReference m_mapRef;
std::unique_ptr<PlayerMenu> m_playerMenu;

#ifdef BUILD_PLAYERBOT
#ifdef BUILD_DEPRECATED_PLAYERBOT
PlayerbotAI* m_playerbotAI;
PlayerbotMgr* m_playerbotMgr;
#endif
Expand Down
4 changes: 2 additions & 2 deletions src/game/Groups/Group.cpp
Expand Up @@ -33,7 +33,7 @@
#include "Maps/MapManager.h"
#include "Maps/MapPersistentStateMgr.h"
#include "Spells/SpellAuras.h"
#ifdef BUILD_PLAYERBOT
#ifdef BUILD_DEPRECATED_PLAYERBOT
#include "PlayerBot/Base/PlayerbotMgr.h"
#include "Config/Config.h"
extern Config botConfig;
Expand Down Expand Up @@ -406,7 +406,7 @@ bool Group::AddMember(ObjectGuid guid, const char* name)
uint32 Group::RemoveMember(ObjectGuid guid, uint8 method)
{
Player* player = sObjectMgr.GetPlayer(guid);
#ifdef BUILD_PLAYERBOT
#ifdef BUILD_DEPRECATED_PLAYERBOT
// if master leaves group, all bots leave group
if (!botConfig.GetBoolDefault("PlayerbotAI.DisableBots", false))
{
Expand Down
6 changes: 3 additions & 3 deletions src/game/Quests/QuestHandler.cpp
Expand Up @@ -31,7 +31,7 @@
#include "Groups/Group.h"
#include "Tools/Formulas.h"

#ifdef BUILD_PLAYERBOT
#ifdef BUILD_DEPRECATED_PLAYERBOT
#include "PlayerBot/Base/PlayerbotAI.h"
#endif

Expand Down Expand Up @@ -629,12 +629,12 @@ void WorldSession::HandlePushQuestToParty(WorldPacket& recvPacket)
continue;
}

#ifndef BUILD_PLAYERBOT
#ifndef BUILD_DEPRECATED_PLAYERBOT
pPlayer->GetPlayerMenu()->SendQuestGiverQuestDetails(pQuest, _player->GetObjectGuid(), true);
#endif
pPlayer->SetDividerGuid(_player->GetObjectGuid());

#ifdef BUILD_PLAYERBOT
#ifdef BUILD_DEPRECATED_PLAYERBOT
if (pPlayer->GetPlayerbotAI())
pPlayer->GetPlayerbotAI()->AcceptQuest(pQuest, _player);
else
Expand Down

0 comments on commit bb5c608

Please sign in to comment.