Skip to content

Commit

Permalink
Improvements and changes for Playerbots mergeÃ
Browse files Browse the repository at this point in the history
  • Loading branch information
cyberium committed Mar 4, 2024
1 parent 222f4c5 commit 7e77a0d
Show file tree
Hide file tree
Showing 119 changed files with 174 additions and 333 deletions.
5 changes: 0 additions & 5 deletions contrib/mmap/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -117,11 +117,6 @@ if (BUILD_EXTRACTORS)
add_custom_command(TARGET ${EXECUTABLE_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${FILES_LIST_TO_COPY} \"$<TARGET_FILE_DIR:${EXECUTABLE_NAME}>\")
endif()

# Define ENABLE_PLAYERBOTS if need
if (BUILD_PLAYERBOTS)
add_definitions(-DENABLE_PLAYERBOTS)
endif()

install(TARGETS ${EXECUTABLE_NAME} DESTINATION ${BIN_DIR}/tools)
install(PROGRAMS "${CMAKE_SOURCE_DIR}/contrib/extractor_scripts/MoveMapGen.sh" DESTINATION ${BIN_DIR}/tools)
Expand Down
7 changes: 3 additions & 4 deletions contrib/mmap/src/MapBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@

using namespace VMAP;

#ifdef ENABLE_MANGOSBOTS
void rcModAlmostUnwalkableTriangles(rcContext* ctx, const float walkableSlopeAngle,
const float* verts, int /*nv*/,
const int* tris, int nt,
Expand Down Expand Up @@ -61,7 +60,6 @@ void rcModAlmostUnwalkableTriangles(rcContext* ctx, const float walkableSlopeAng
}
}
}
#endif

void from_json(const json& j, rcConfig& config)
{
Expand Down Expand Up @@ -1029,9 +1027,10 @@ namespace MMAP
unsigned char* triFlags = new unsigned char[tTriCount];
memset(triFlags, NAV_AREA_GROUND, tTriCount * sizeof(unsigned char));
rcClearUnwalkableTriangles(m_rcContext, tileCfg.walkableSlopeAngle, tVerts, tVertCount, tTris, tTriCount, triFlags);
#ifdef ENABLE_MANGOSBOTS

// mark almost unwalkable triangles with steep flag
rcModAlmostUnwalkableTriangles(m_rcContext, 50.0f, tVerts, tVertCount, tTris, tTriCount, triFlags);
#endif

rcRasterizeTriangles(m_rcContext, tVerts, tVertCount, tTris, triFlags, tTriCount, *tile.solid, tileCfg.walkableClimb);
delete[] triFlags;

Expand Down
54 changes: 28 additions & 26 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,41 +21,43 @@ if(BUILD_GAME_SERVER OR BUILD_LOGIN_SERVER OR BUILD_EXTRACTORS)
add_subdirectory(shared)
endif()

if(BUILD_GAME_SERVER)
add_subdirectory(game)
add_subdirectory(mangosd)
endif()

if(BUILD_LOGIN_SERVER)
add_subdirectory(realmd)
endif()

# Playerbots module
if(BUILD_PLAYERBOTS)
include(FetchContent)

FetchContent_Declare(
playerbots
PlayerBots
SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/modules/PlayerBots"
GIT_REPOSITORY "https://github.com/cmangos/playerbots.git"
GIT_TAG "master"
GIT_TAG "master"
)

if(NOT playerbots_POPULATED)
message(STATUS "Fetching Playerbots module...")

FetchContent_Populate(playerbots)

if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/modules/Bots)
file(REMOVE_RECURSE ${CMAKE_CURRENT_SOURCE_DIR}/modules/Bots)
endif()

file(COPY ${playerbots_SOURCE_DIR}/. DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}/modules/Bots)
message(STATUS "Playerbots module fetched and populated in ${CMAKE_CURRENT_SOURCE_DIR}/modules/Bots")
FetchContent_GetProperties(PlayerBots)
if (NOT playerbots_POPULATED)
FetchContent_Populate(PlayerBots)
message(STATUS "Playerbots module source dir: ${playerbots_SOURCE_DIR}")
else()
message(STATUS "Playerbots module already populated: ${playerbots_POPULATED}")
endif()

add_subdirectory(modules/Bots)
#target_include_directories(Bots PUBLIC ${playerbots_SOURCE_DIR})
message(STATUS "Playerbots module source dir: ${playerbots_SOURCE_DIR}")
message(STATUS "Playerbots module binary dir: ${playerbots_BINARY_DIR}")
message(STATUS "Playerbots module populated: ${playerbots_POPULATED}")

add_subdirectory(${playerbots_SOURCE_DIR})

else()
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/modules/Bots)
file(REMOVE_RECURSE ${CMAKE_CURRENT_SOURCE_DIR}/modules/Bots)
endif()
# if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/modules/PlayerBots)
# file(REMOVE_RECURSE ${CMAKE_CURRENT_SOURCE_DIR}/modules/PlayerBots)
# endif()
endif()

if(BUILD_GAME_SERVER)
add_subdirectory(game)
add_subdirectory(mangosd)
endif()

if(BUILD_LOGIN_SERVER)
add_subdirectory(realmd)
endif()
2 changes: 1 addition & 1 deletion src/game/AI/CreatureAISelector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
#include "AI/ScriptDevAI/ScriptDevAIMgr.h"
#include "Entities/Pet.h"
#include "Entities/Player.h"
#include "Log.h"
#include "Log/Log.h"
#include "BaseAI/PetAI.h"
#include "BaseAI/PossessedAI.h"
#include "AI/PlayerAI/PlayerAI.h"
Expand Down
2 changes: 1 addition & 1 deletion src/game/AI/ScriptDevAI/base/TimerAI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

#include "TimerAI.h"
#include "Chat/Chat.h"
#include "Log.h"
#include "Log/Log.h"
#include <string>

Timer::Timer(uint32 id, std::function<void()> functor, uint32 timerMin, uint32 timerMax, TimerCombat combatSetting, bool disabled)
Expand Down
2 changes: 1 addition & 1 deletion src/game/Addons/AddonHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#include "Addons/AddonHandler.h"
#include "Database/DatabaseEnv.h"
#include "Server/Opcodes.h"
#include "Log.h"
#include "Log/Log.h"
#include "Policies/Singleton.h"

INSTANTIATE_SINGLETON_1(AddonHandler);
Expand Down
2 changes: 1 addition & 1 deletion src/game/Anticheat/module/AddonHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#include "libanticheat.hpp"
#include "config.hpp"
#include "Server/WorldPacket.h"
#include "Log.h"
#include "Log/Log.h"

#include "Util/Util.h"
#include "Database/DatabaseEnv.h"
Expand Down
2 changes: 1 addition & 1 deletion src/game/Anticheat/module/Antispam/antispammgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#include "Server/WorldSession.h"
#include "World/World.h"
#include "Accounts/AccountMgr.h"
#include "Log.h"
#include "Log/Log.h"

#include "Database/DatabaseEnv.h"
#include "Policies/Singleton.h"
Expand Down
2 changes: 1 addition & 1 deletion src/game/Anticheat/module/Movement/movement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#include "World/World.h"
#include "Tools/Language.h"
#include "Movement/MoveSpline.h"
#include "Log.h"
#include "Log/Log.h"

namespace
{
Expand Down
2 changes: 1 addition & 1 deletion src/game/Anticheat/module/Warden/warden.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#include "Server/WorldPacket.h"
#include "Server/WorldSession.h"
#include "World/World.h"
#include "Log.h"
#include "Log/Log.h"
#include "Server/Opcodes.h"
#include "Util/ByteBuffer.h"
#include "Database/DatabaseEnv.h"
Expand Down
2 changes: 1 addition & 1 deletion src/game/Anticheat/module/Warden/wardenmac.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#include "Auth/CryptoHash.h"
#include "World/World.h"
#include "../config.hpp"
#include "Log.h"
#include "Log/Log.h"

#include <memory>
#include <vector>
Expand Down
2 changes: 1 addition & 1 deletion src/game/Anticheat/module/Warden/wardenmodulemgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#include "Platform/Define.h"
#include "Policies/Singleton.h"
#include "Util/Util.h"
#include "Log.h"
#include "Log/Log.h"

#include <vector>
#include <string>
Expand Down
2 changes: 1 addition & 1 deletion src/game/Anticheat/module/Warden/wardenwin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#include "Util/ByteBuffer.h"
#include "Database/DatabaseEnv.h"
#include "Entities/Player.h"
#include "Log.h"
#include "Log/Log.h"

#include <string>
#include <vector>
Expand Down
2 changes: 1 addition & 1 deletion src/game/Anticheat/module/libanticheat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#include "Chat/Chat.h"
#include "Tools/Language.h"
#include "Globals/ObjectMgr.h"
#include "Log.h"
#include "Log/Log.h"

#include "Antispam/antispammgr.hpp"
#include "Antispam/antispam.hpp"
Expand Down
2 changes: 1 addition & 1 deletion src/game/AuctionHouse/AuctionHouseHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#include "Server/WorldPacket.h"
#include "Server/WorldSession.h"
#include "Server/Opcodes.h"
#include "Log.h"
#include "Log/Log.h"
#include "World/World.h"
#include "Globals/ObjectMgr.h"
#include "Entities/ObjectGuid.h"
Expand Down
2 changes: 1 addition & 1 deletion src/game/AuctionHouse/AuctionHouseMgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
#include "Accounts/AccountMgr.h"
#include "Entities/Item.h"
#include "Tools/Language.h"
#include "Log.h"
#include "Log/Log.h"
#include "Globals/ObjectMgr.h"
#include "Entities/ObjectGuid.h"
#include "Entities/Player.h"
Expand Down
2 changes: 1 addition & 1 deletion src/game/AuctionHouseBot/AuctionHouseBot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

#include "AuctionHouseBot.h"
#include "Globals/ObjectMgr.h"
#include "Log.h"
#include "Log/Log.h"
#include "Policies/Singleton.h"
#include "Util/ProgressBar.h"
#include "SystemConfig.h"
Expand Down
2 changes: 0 additions & 2 deletions src/game/BattleGround/BattleGround.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1465,7 +1465,6 @@ uint32 BattleGround::GetSingleCreatureGuid(uint8 event1, uint8 event2)
return ObjectGuid();
}

#ifdef ENABLE_PLAYERBOTS
/**
Function returns a gameobject guid from event map
Expand All @@ -1482,7 +1481,6 @@ uint32 BattleGround::GetSingleGameObjectGuid(uint8 event1, uint8 event2)

return ObjectGuid();
}
#endif

/**
Method that handles gameobject load from DB event map
Expand Down
2 changes: 0 additions & 2 deletions src/game/BattleGround/BattleGround.h
Original file line number Diff line number Diff line change
Expand Up @@ -507,10 +507,8 @@ class BattleGround
// Get creature guid from event
uint32 GetSingleCreatureGuid(uint8 /*event1*/, uint8 /*event2*/);

#ifdef ENABLE_PLAYERBOTS
// Get gameobject guid from event
uint32 GetSingleGameObjectGuid(uint8 /*event1*/, uint8 /*event2*/);
#endif

// Handle door events
void OpenDoorEvent(uint8 /*event1*/, uint8 event2 = 0);
Expand Down
2 changes: 1 addition & 1 deletion src/game/BattleGround/BattleGroundHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#include "Common.h"
#include "Server/WorldPacket.h"
#include "Server/Opcodes.h"
#include "Log.h"
#include "Log/Log.h"
#include "Entities/Player.h"
#include "Globals/ObjectMgr.h"
#include "Server/WorldSession.h"
Expand Down
63 changes: 3 additions & 60 deletions src/game/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -124,66 +124,9 @@ target_include_directories(${LIBRARY_NAME}
)

if(BUILD_PLAYERBOTS)
include_directories(
${CMAKE_SOURCE_DIR}/src/game
${CMAKE_SOURCE_DIR}/src/game/AI
${CMAKE_SOURCE_DIR}/src/game/Accounts
${CMAKE_SOURCE_DIR}/src/game/Addons
${CMAKE_SOURCE_DIR}/src/game/Arena
${CMAKE_SOURCE_DIR}/src/game/AuctionHouse
${CMAKE_SOURCE_DIR}/src/game/BattleGround
${CMAKE_SOURCE_DIR}/src/game/Chat
${CMAKE_SOURCE_DIR}/src/game/ChatCommands
${CMAKE_SOURCE_DIR}/src/game/Combat
${CMAKE_SOURCE_DIR}/src/game/DBScripts
${CMAKE_SOURCE_DIR}/src/game/Entities
${CMAKE_SOURCE_DIR}/src/game/GMTickets
${CMAKE_SOURCE_DIR}/src/game/GameEvents
${CMAKE_SOURCE_DIR}/src/game/Globals
${CMAKE_SOURCE_DIR}/src/game/Grids
${CMAKE_SOURCE_DIR}/src/game/Groups
${CMAKE_SOURCE_DIR}/src/game/Guilds
${CMAKE_SOURCE_DIR}/src/game/LFG
${CMAKE_SOURCE_DIR}/src/game/Loot
${CMAKE_SOURCE_DIR}/src/game/Mails
${CMAKE_SOURCE_DIR}/src/game/Maps
${CMAKE_SOURCE_DIR}/src/game/MotionGenerators
${CMAKE_SOURCE_DIR}/src/game/Movement
${CMAKE_SOURCE_DIR}/src/game/Object
${CMAKE_SOURCE_DIR}/src/game/OutdoorPvP
${CMAKE_SOURCE_DIR}/src/game/Pools
${CMAKE_SOURCE_DIR}/src/game/Quests
${CMAKE_SOURCE_DIR}/src/game/References
${CMAKE_SOURCE_DIR}/src/game/Reputation
${CMAKE_SOURCE_DIR}/src/game/Server
${CMAKE_SOURCE_DIR}/src/game/Server
${CMAKE_SOURCE_DIR}/src/game/Skills
${CMAKE_SOURCE_DIR}/src/game/Social
${CMAKE_SOURCE_DIR}/src/game/Spells
${CMAKE_SOURCE_DIR}/src/game/Tools
${CMAKE_SOURCE_DIR}/src/game/Trade
${CMAKE_SOURCE_DIR}/src/game/VoiceChat
${CMAKE_SOURCE_DIR}/src/game/Warden
${CMAKE_SOURCE_DIR}/src/game/Weather
${CMAKE_SOURCE_DIR}/src/game/World
${CMAKE_SOURCE_DIR}/src/game/WorldHandlers
${CMAKE_SOURCE_DIR}/src/game/movement
${CMAKE_SOURCE_DIR}/src/game/vmap
${CMAKE_SOURCE_DIR}/src/shared
${CMAKE_SOURCE_DIR}/src/shared/Auth
${CMAKE_SOURCE_DIR}/src/shared/Config
${CMAKE_SOURCE_DIR}/src/shared/Common
${CMAKE_SOURCE_DIR}/src/shared/Database
${CMAKE_SOURCE_DIR}/src/shared/DataStores
${CMAKE_SOURCE_DIR}/src/shared/Utilities
${CMAKE_SOURCE_DIR}/src/shared/Log
${CMAKE_SOURCE_DIR}/src/shared/Threading
${CMAKE_SOURCE_DIR}/src/modules/Bots/playerbot
${CMAKE_SOURCE_DIR}/src/modules/Bots/ahbot
)

target_link_libraries(${LIBRARY_NAME} PUBLIC Bots)
add_dependencies(${LIBRARY_NAME} Bots)
target_link_libraries(${LIBRARY_NAME} PUBLIC playerbots)
target_include_directories(${LIBRARY_NAME} PUBLIC ${CMAKE_SOURCE_DIR}/src/modules/PlayerBots)
add_dependencies(${LIBRARY_NAME} playerbots)
endif()

if(UNIX)
Expand Down
8 changes: 4 additions & 4 deletions src/game/Chat/Chat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#include "Server/WorldPacket.h"
#include "Server/WorldSession.h"
#include "Server/Opcodes.h"
#include "Log.h"
#include "Log/Log.h"
#include "World/World.h"
#include "Globals/ObjectMgr.h"
#include "Globals/ObjectAccessor.h"
Expand All @@ -36,9 +36,9 @@
#include "GameEvents/GameEventMgr.h"

#ifdef ENABLE_PLAYERBOTS
#include "AhBot.h"
#include "playerbot.h"
#include "PlayerbotAIConfig.h"
#include "ahbot/AhBot.h"
#include "playerbot/playerbot.h"
#include "playerbot/PlayerbotAIConfig.h"
#endif

#include <cstdarg>
Expand Down
2 changes: 0 additions & 2 deletions src/game/Chat/Chat.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,7 @@ class ChatHandler

bool HasSentErrorMessage() const { return sentErrorMessage;}

#ifdef ENABLE_PLAYERBOTS
WorldSession* GetSession() { return m_session; }
#endif

/**
* \brief Prepare SMSG_GM_MESSAGECHAT/SMSG_MESSAGECHAT
Expand Down
6 changes: 3 additions & 3 deletions src/game/Chat/ChatHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
*/

#include "Common.h"
#include "Log.h"
#include "Log/Log.h"
#include "Server/WorldPacket.h"
#include "Server/WorldSession.h"
#include "World/World.h"
Expand All @@ -38,8 +38,8 @@
#include "Anticheat/Anticheat.hpp"

#ifdef ENABLE_PLAYERBOTS
#include "playerbot.h"
#include "RandomPlayerbotMgr.h"
#include "playerbot/playerbot.h"
#include "playerbot/RandomPlayerbotMgr.h"
#endif

bool WorldSession::CheckChatMessage(std::string& msg, bool addon/* = false*/)
Expand Down

0 comments on commit 7e77a0d

Please sign in to comment.