Add WoW Forever Bots by Karrz (optional, -DBUILD_PLAYERBOT_V2=1, default off)

Imported from Karrz's karrz-bots branch (12a3d94547) on top of forever: the
PlayerbotV2 module, the ForeverBots add-on (/fb), the bot SQL, the core hooks
and API it needs, and the Classic battleground, raid, auction house and road
navigation changes it was tested with.

Left out of this import: the world editor, tests, protocol research and data
generator tools, dev setup scripts, the realm example config, the design notes,
the older PlayerbotControl add-on, and changes to sql/create, the Boost
minimum, and the build revision files. These stay in Karrz's own repository.
This commit is contained in:
Karrz1
2026-10-13 09:21:34 +08:00
committed by Advocaite
parent 8c5325b37d
commit d13cdf728d
927 changed files with 369512 additions and 483 deletions
+35
View File
@@ -0,0 +1,35 @@
# Test Module - Demonstrates Shared Module API Access
#
# This module tests that the shared Common module infrastructure
# can be accessed by any module in the system.
add_library(test-module STATIC)
CollectAndAddSourceFiles(
test-module
${CMAKE_CURRENT_SOURCE_DIR})
target_include_directories(test-module
PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_SOURCE_DIR}/src/modules/Common
PRIVATE
${CMAKE_SOURCE_DIR}/src/server
${CMAKE_SOURCE_DIR}/src/server/shared
${CMAKE_SOURCE_DIR}/src/server/database
${CMAKE_SOURCE_DIR}/src/common
)
target_link_libraries(test-module
PUBLIC
trinity-core-interface
modules-common
PRIVATE
shared
common
)
set_target_properties(test-module
PROPERTIES
FOLDER "src/modules"
)
+78
View File
@@ -0,0 +1,78 @@
#include "TestModule.h"
#include "Log.h"
bool TestModule::Initialize()
{
// Register this test module with the shared logging API
if (!sModuleLogManager->RegisterModule("testmodule", 4, "TestModule.log"))
{
TC_LOG_ERROR("server.loading", "TestModule: Failed to register with shared ModuleLogManager");
return false;
}
// Initialize the logging
if (!sModuleLogManager->InitializeModuleLogging("testmodule"))
{
TC_LOG_ERROR("server.loading", "TestModule: Failed to initialize module logging");
return false;
}
TC_LOG_INFO("server.loading", "TestModule: Successfully initialized with shared Module Logging API");
// Test the shared logging
TestSharedLogging();
// Register with the shared ModuleUpdateManager for world updates
if (!sModuleUpdateManager->RegisterModule("testmodule", [](uint32 diff) { TestSharedUpdate(diff); }))
{
TC_LOG_ERROR("server.loading", "TestModule: Failed to register with shared ModuleUpdateManager");
return false;
}
TC_LOG_INFO("server.loading", "TestModule: Successfully registered with shared Module Update API");
return true;
}
void TestModule::TestSharedLogging()
{
// Test using the TC_LOG macros with our module logger
TC_LOG_INFO("module.testmodule.file", "TEST: This message should appear in TestModule.log");
TC_LOG_ERROR("module.testmodule.file", "TEST: Error level message from TestModule");
TC_LOG_WARN("module.testmodule.file", "TEST: Warning level message from TestModule");
// Test using the convenience macros
TC_LOG_MODULE_INFO("testmodule", "TEST: Using TC_LOG_MODULE_INFO macro");
TC_LOG_MODULE_ERROR("testmodule", "TEST: Using TC_LOG_MODULE_ERROR macro");
TC_LOG_INFO("server.loading", "TestModule: Shared logging API test completed - check TestModule.log");
}
void TestModule::TestSharedUpdate(uint32 diff)
{
static uint32 updateCounter = 0;
static uint32 lastLogTime = 0;
updateCounter++;
lastLogTime += diff;
// Log every 10 seconds to prove the update system is working
if (lastLogTime >= 10000) // 10000ms = 10 seconds
{
TC_LOG_INFO("module.testmodule.file", "TEST: TestModule update called {} times in 10 seconds (diff={}ms)",
updateCounter, diff);
lastLogTime = 0;
updateCounter = 0;
}
}
void TestModule::Shutdown()
{
TC_LOG_INFO("server.loading", "TestModule: Shutting down...");
// Unregister from ModuleUpdateManager
sModuleUpdateManager->UnregisterModule("testmodule");
TC_LOG_INFO("server.loading", "TestModule: Unregistered from ModuleUpdateManager");
TC_LOG_INFO("server.loading", "TestModule: Shutdown complete");
}
+13
View File
@@ -0,0 +1,13 @@
#pragma once
#include "Logging/ModuleLogManager.h"
#include "Update/ModuleUpdateManager.h"
class TestModule
{
public:
static bool Initialize();
static void TestSharedLogging();
static void TestSharedUpdate(uint32 diff);
static void Shutdown();
};