Compare commits

..

3 Commits

Author SHA1 Message Date
bashermens
b0dc63da67 Update windows_build.yml 2026-01-16 16:13:12 +01:00
bashermens
944940bd6f Update windows_build.yml 2026-01-16 16:06:37 +01:00
bashermens
9e0250b973 shorter build paths 2026-01-16 16:05:47 +01:00
1160 changed files with 232 additions and 233 deletions

View File

@@ -1 +0,0 @@
void AddPlayerbotsCommandscripts();

View File

@@ -1,21 +0,0 @@
#ifndef _PLAYERBOT_WOTLKDUNGEONACTIONCONTEXT_H
#define _PLAYERBOT_WOTLKDUNGEONACTIONCONTEXT_H
#include "UtgardeKeep/UtgardeKeepActionContext.h"
#include "Nexus/NexusActionContext.h"
#include "AzjolNerub/AzjolNerubActionContext.h"
#include "OldKingdom/OldKingdomActionContext.h"
#include "DraktharonKeep/DrakTharonKeepActionContext.h"
#include "VioletHold/VioletHoldActionContext.h"
#include "Gundrak/GundrakActionContext.h"
#include "HallsOfStone/HallsOfStoneActionContext.h"
#include "HallsOfLightning/HallsOfLightningActionContext.h"
#include "Oculus/OculusActionContext.h"
#include "UtgardePinnacle/UtgardePinnacleActionContext.h"
#include "CullingOfStratholme/CullingOfStratholmeActionContext.h"
#include "ForgeOfSouls/ForgeOfSoulsActionContext.h"
#include "PitOfSaron/PitOfSaronActionContext.h"
#include "TrialOfTheChampion/TrialOfTheChampionActionContext.h"
// #include "HallsOfReflection/HallsOfReflectionActionContext.h"
#endif

View File

@@ -1,21 +0,0 @@
#ifndef _PLAYERBOT_WOTLKDUNGEONTRIGGERCONTEXT_H
#define _PLAYERBOT_WOTLKDUNGEONTRIGGERCONTEXT_H
#include "UtgardeKeep/UtgardeKeepTriggerContext.h"
#include "Nexus/NexusTriggerContext.h"
#include "AzjolNerub/AzjolNerubTriggerContext.h"
#include "OldKingdom/OldKingdomTriggerContext.h"
#include "DraktharonKeep/DrakTharonKeepTriggerContext.h"
#include "VioletHold/VioletHoldTriggerContext.h"
#include "Gundrak/GundrakTriggerContext.h"
#include "HallsOfStone/HallsOfStoneTriggerContext.h"
#include "HallsOfLightning/HallsOfLightningTriggerContext.h"
#include "Oculus/OculusTriggerContext.h"
#include "UtgardePinnacle/UtgardePinnacleTriggerContext.h"
#include "CullingOfStratholme/CullingOfStratholmeTriggerContext.h"
#include "ForgeOfSouls/ForgeOfSoulsTriggerContext.h"
#include "PitOfSaron/PitOfSaronTriggerContext.h"
#include "TrialOfTheChampion/TrialOfTheChampionTriggerContext.h"
// #include "HallsOfReflection/HallsOfReflectionTriggerContext.h"
#endif

View File

@@ -3,11 +3,11 @@
* and/or modify it under version 3 of the License, or (at your option), any later version.
*/
#include "PerfMonitor.h"
#include "PerformanceMonitor.h"
#include "Playerbots.h"
PerfMonitorOperation* PerfMonitor::start(PerformanceMetric metric, std::string const name,
PerformanceMonitorOperation* PerformanceMonitor::start(PerformanceMetric metric, std::string const name,
PerformanceStack* stack)
{
if (!sPlayerbotAIConfig->perfMonEnabled)
@@ -45,10 +45,10 @@ PerfMonitorOperation* PerfMonitor::start(PerformanceMetric metric, std::string c
data[metric][stackName] = pd;
}
return new PerfMonitorOperation(pd, name, stack);
return new PerformanceMonitorOperation(pd, name, stack);
}
void PerfMonitor::PrintStats(bool perTick, bool fullStack)
void PerformanceMonitor::PrintStats(bool perTick, bool fullStack)
{
if (data.empty())
return;
@@ -247,7 +247,7 @@ void PerfMonitor::PrintStats(bool perTick, bool fullStack)
}
}
void PerfMonitor::Reset()
void PerformanceMonitor::Reset()
{
for (std::map<PerformanceMetric, std::map<std::string, PerformanceData*>>::iterator i = data.begin();
i != data.end(); ++i)
@@ -265,7 +265,7 @@ void PerfMonitor::Reset()
}
}
PerfMonitorOperation::PerfMonitorOperation(PerformanceData* data, std::string const name,
PerformanceMonitorOperation::PerformanceMonitorOperation(PerformanceData* data, std::string const name,
PerformanceStack* stack)
: data(data), name(name), stack(stack)
{
@@ -273,7 +273,7 @@ PerfMonitorOperation::PerfMonitorOperation(PerformanceData* data, std::string co
.time_since_epoch();
}
void PerfMonitorOperation::finish()
void PerformanceMonitorOperation::finish()
{
std::chrono::microseconds finished =
(std::chrono::time_point_cast<std::chrono::microseconds>(std::chrono::high_resolution_clock::now()))

View File

@@ -34,10 +34,10 @@ enum PerformanceMetric
PERF_MON_TOTAL
};
class PerfMonitorOperation
class PerformanceMonitorOperation
{
public:
PerfMonitorOperation(PerformanceData* data, std::string const name, PerformanceStack* stack);
PerformanceMonitorOperation(PerformanceData* data, std::string const name, PerformanceStack* stack);
void finish();
private:
@@ -47,19 +47,19 @@ private:
std::chrono::microseconds started;
};
class PerfMonitor
class PerformanceMonitor
{
public:
PerfMonitor(){};
virtual ~PerfMonitor(){};
static PerfMonitor* instance()
PerformanceMonitor(){};
virtual ~PerformanceMonitor(){};
static PerformanceMonitor* instance()
{
static PerfMonitor instance;
static PerformanceMonitor instance;
return &instance;
}
public:
PerfMonitorOperation* start(PerformanceMetric metric, std::string const name,
PerformanceMonitorOperation* start(PerformanceMetric metric, std::string const name,
PerformanceStack* stack = nullptr);
void PrintStats(bool perTick = false, bool fullStack = false);
void Reset();
@@ -69,6 +69,6 @@ private:
std::mutex lock;
};
#define sPerfMonitor PerfMonitor::instance()
#define sPerformanceMonitor PerformanceMonitor::instance()
#endif

View File

@@ -10,7 +10,7 @@
#include "Common.h"
#include "Player.h"
#include "PlayerbotDungeonRepository.h"
#include "PlayerbotDungeonSuggestionMgr.h"
typedef std::map<std::string, std::string> PlaceholderMap;

View File

@@ -38,10 +38,10 @@
#include "NewRpgStrategy.h"
#include "ObjectGuid.h"
#include "ObjectMgr.h"
#include "PerfMonitor.h"
#include "PerformanceMonitor.h"
#include "Player.h"
#include "PlayerbotAIConfig.h"
#include "PlayerbotRepository.h"
#include "PlayerbotDbStore.h"
#include "PlayerbotMgr.h"
#include "PlayerbotGuildMgr.h"
#include "Playerbots.h"
@@ -441,8 +441,8 @@ void PlayerbotAI::UpdateAIInternal([[maybe_unused]] uint32 elapsed, bool minimal
return;
std::string const mapString = WorldPosition(bot).isOverworld() ? std::to_string(bot->GetMapId()) : "I";
PerfMonitorOperation* pmo =
sPerfMonitor->start(PERF_MON_TOTAL, "PlayerbotAI::UpdateAIInternal " + mapString);
PerformanceMonitorOperation* pmo =
sPerformanceMonitor->start(PERF_MON_TOTAL, "PlayerbotAI::UpdateAIInternal " + mapString);
ExternalEventHelper helper(aiObjectContext);
// chat replies
@@ -1731,7 +1731,7 @@ void PlayerbotAI::ResetStrategies(bool load)
engines[i]->Init();
// if (load)
// sPlayerbotRepository->Load(this);
// sPlayerbotDbStore->Load(this);
}
bool PlayerbotAI::IsRanged(Player* player, bool bySpec)

View File

@@ -14,7 +14,7 @@ void PlayerbotAIBase::UpdateAI(uint32 elapsed, bool minimal)
if (totalPmo)
totalPmo->finish();
totalPmo = sPerfMonitor->start(PERF_MON_TOTAL, "PlayerbotAIBase::FullTick");
totalPmo = sPerformanceMonitor->start(PERF_MON_TOTAL, "PlayerbotAIBase::FullTick");
if (nextAICheckDelay > elapsed)
nextAICheckDelay -= elapsed;

View File

@@ -25,7 +25,7 @@ public:
protected:
uint32 nextAICheckDelay;
class PerfMonitorOperation* totalPmo = nullptr;
class PerformanceMonitorOperation* totalPmo = nullptr;
private:
bool _isBotAI;

View File

@@ -7,7 +7,7 @@
#include <iostream>
#include "Config.h"
#include "NewRpgInfo.h"
#include "PlayerbotDungeonRepository.h"
#include "PlayerbotDungeonSuggestionMgr.h"
#include "PlayerbotFactory.h"
#include "Playerbots.h"
#include "PlayerbotGuildMgr.h"
@@ -678,7 +678,7 @@ bool PlayerbotAIConfig::Initialize()
if (sPlayerbotAIConfig->randomBotSuggestDungeons)
{
sPlayerbotDungeonRepository->LoadDungeonSuggestions();
sPlayerbotDungeonSuggestionMgr->LoadDungeonSuggestions();
}
excludedHunterPetFamilies.clear();

View File

@@ -3,13 +3,13 @@
* and/or modify it under version 3 of the License, or (at your option), any later version.
*/
#include "PlayerbotRepository.h"
#include "PlayerbotDbStore.h"
#include <iostream>
#include "Playerbots.h"
void PlayerbotRepository::Load(PlayerbotAI* botAI)
void PlayerbotDbStore::Load(PlayerbotAI* botAI)
{
ObjectGuid::LowType guid = botAI->GetBot()->GetGUID().GetCounter();
@@ -46,7 +46,7 @@ void PlayerbotRepository::Load(PlayerbotAI* botAI)
}
}
void PlayerbotRepository::Save(PlayerbotAI* botAI)
void PlayerbotDbStore::Save(PlayerbotAI* botAI)
{
ObjectGuid::LowType guid = botAI->GetBot()->GetGUID().GetCounter();
@@ -68,7 +68,7 @@ void PlayerbotRepository::Save(PlayerbotAI* botAI)
SaveValue(guid, "dead", FormatStrategies("dead", botAI->GetStrategies(BOT_STATE_DEAD)));
}
std::string const PlayerbotRepository::FormatStrategies(std::string const type, std::vector<std::string> strategies)
std::string const PlayerbotDbStore::FormatStrategies(std::string const type, std::vector<std::string> strategies)
{
std::ostringstream out;
for (std::vector<std::string>::iterator i = strategies.begin(); i != strategies.end(); ++i)
@@ -78,7 +78,7 @@ std::string const PlayerbotRepository::FormatStrategies(std::string const type,
return res.substr(0, res.size() - 1);
}
void PlayerbotRepository::Reset(PlayerbotAI* botAI)
void PlayerbotDbStore::Reset(PlayerbotAI* botAI)
{
ObjectGuid::LowType guid = botAI->GetBot()->GetGUID().GetCounter();
@@ -87,7 +87,7 @@ void PlayerbotRepository::Reset(PlayerbotAI* botAI)
PlayerbotsDatabase.Execute(stmt);
}
void PlayerbotRepository::SaveValue(uint32 guid, std::string const key, std::string const value)
void PlayerbotDbStore::SaveValue(uint32 guid, std::string const key, std::string const value)
{
PlayerbotsDatabasePreparedStatement* stmt = PlayerbotsDatabase.GetPreparedStatement(PLAYERBOTS_INS_DB_STORE);
stmt->SetData(0, guid);

View File

@@ -3,8 +3,8 @@
* and/or modify it under version 3 of the License, or (at your option), any later version.
*/
#ifndef _PLAYERBOT_PLAYERBOTREPOSITORY_H
#define _PLAYERBOT_PLAYERBOTREPOSITORY_H
#ifndef _PLAYERBOT_PLAYERBOTDBSTORE_H
#define _PLAYERBOT_PLAYERBOTDBSTORE_H
#include <vector>
@@ -12,14 +12,14 @@
class PlayerbotAI;
class PlayerbotRepository
class PlayerbotDbStore
{
public:
PlayerbotRepository() {}
virtual ~PlayerbotRepository() {}
static PlayerbotRepository* instance()
PlayerbotDbStore() {}
virtual ~PlayerbotDbStore() {}
static PlayerbotDbStore* instance()
{
static PlayerbotRepository instance;
static PlayerbotDbStore instance;
return &instance;
}
@@ -32,6 +32,6 @@ private:
std::string const FormatStrategies(std::string const type, std::vector<std::string> strategies);
};
#define sPlayerbotRepository PlayerbotRepository::instance()
#define sPlayerbotDbStore PlayerbotDbStore::instance()
#endif

View File

@@ -3,16 +3,16 @@
* and/or modify it under version 3 of the License, or (at your option), any later version.
*/
#include "PlayerbotDungeonRepository.h"
#include "PlayerbotDungeonSuggestionMgr.h"
#include "Playerbots.h"
std::vector<DungeonSuggestion> const PlayerbotDungeonRepository::GetDungeonSuggestions()
std::vector<DungeonSuggestion> const PlayerbotDungeonSuggestionMgr::GetDungeonSuggestions()
{
return m_dungeonSuggestions;
}
void PlayerbotDungeonRepository::LoadDungeonSuggestions()
void PlayerbotDungeonSuggestionMgr::LoadDungeonSuggestions()
{
LOG_INFO("server.loading", "Loading playerbots dungeon suggestions...");
uint32 oldMSTime = getMSTime();

View File

@@ -3,8 +3,8 @@
* and/or modify it under version 3 of the License, or (at your option), any later version.
*/
#ifndef _PLAYERBOT_PLAYERBOTDUNGEONREPOSITORY_H
#define _PLAYERBOT_PLAYERBOTDUNGEONREPOSITORY_H
#ifndef _PLAYERBOT_PLAYERBOTDUNGEONSUGGESTIONMGR_H
#define _PLAYERBOT_PLAYERBOTDUNGEONSUGGESTIONMGR_H
#include <map>
#include <vector>
@@ -22,14 +22,14 @@ struct DungeonSuggestion
std::string strategy;
};
class PlayerbotDungeonRepository
class PlayerbotDungeonSuggestionMgr
{
public:
PlayerbotDungeonRepository(){};
~PlayerbotDungeonRepository(){};
static PlayerbotDungeonRepository* instance()
PlayerbotDungeonSuggestionMgr(){};
~PlayerbotDungeonSuggestionMgr(){};
static PlayerbotDungeonSuggestionMgr* instance()
{
static PlayerbotDungeonRepository instance;
static PlayerbotDungeonSuggestionMgr instance;
return &instance;
}
@@ -40,6 +40,6 @@ private:
std::vector<DungeonSuggestion> m_dungeonSuggestions;
};
#define sPlayerbotDungeonRepository PlayerbotDungeonRepository::instance()
#define sPlayerbotDungeonSuggestionMgr PlayerbotDungeonSuggestionMgr::instance()
#endif

View File

@@ -26,7 +26,7 @@
#include "ObjectGuid.h"
#include "ObjectMgr.h"
#include "PlayerbotAIConfig.h"
#include "PlayerbotRepository.h"
#include "PlayerbotDbStore.h"
#include "PlayerbotFactory.h"
#include "PlayerbotOperations.h"
#include "PlayerbotSecurity.h"
@@ -442,7 +442,7 @@ void PlayerbotHolder::DisablePlayerBot(ObjectGuid guid)
Group* group = bot->GetGroup();
if (group && !bot->InBattleground() && !bot->InBattlegroundQueue() && botAI->HasActivePlayerMaster())
{
sPlayerbotRepository->Save(botAI);
sPlayerbotDbStore->Save(botAI);
}
LOG_DEBUG("playerbots", "Bot {} logged out", bot->GetName().c_str());
@@ -554,7 +554,7 @@ void PlayerbotHolder::OnBotLogin(Player* const bot)
{
botAI->ResetStrategies(!sRandomPlayerbotMgr->IsRandomBot(bot));
}
sPlayerbotRepository->Load(botAI);
sPlayerbotDbStore->Load(botAI);
if (master && !master->HasUnitState(UNIT_STATE_IN_FLIGHT))
{

View File

@@ -15,7 +15,7 @@
#include "Player.h"
#include "PlayerbotAI.h"
#include "PlayerbotMgr.h"
#include "PlayerbotRepository.h"
#include "PlayerbotDbStore.h"
#include "RandomPlayerbotMgr.h"
#include "WorldSession.h"
#include "WorldSessionMgr.h"
@@ -418,7 +418,7 @@ public:
Group* group = bot->GetGroup();
if (group && !bot->InBattleground() && !bot->InBattlegroundQueue() && botAI->HasActivePlayerMaster())
sPlayerbotRepository->Save(botAI);
sPlayerbotDbStore->Save(botAI);
return true;
}

View File

@@ -26,11 +26,11 @@
#include "PlayerScript.h"
#include "PlayerbotAIConfig.h"
#include "PlayerbotGuildMgr.h"
#include "PlayerbotSpellRepository.h"
#include "PlayerbotSpellCache.h"
#include "PlayerbotWorldThreadProcessor.h"
#include "RandomPlayerbotMgr.h"
#include "ScriptMgr.h"
#include "PlayerbotCommandScript.h"
#include "cs_playerbots.h"
#include "cmath"
#include "BattleGroundTactics.h"
@@ -365,7 +365,7 @@ public:
LOG_INFO("server.loading", ">> Loaded playerbots config in {} ms", GetMSTimeDiffToNow(oldMSTime));
LOG_INFO("server.loading", " ");
sPlayerbotSpellRepository->Initialize();
sPlayerbotSpellCache->Initialize();
LOG_INFO("server.loading", "Playerbots World Thread Processor initialized");
}
@@ -515,6 +515,6 @@ void AddPlayerbotsScripts()
new PlayerbotsScript();
new PlayerBotsBGScript();
AddPlayerbotsSecureLoginScripts();
AddPlayerbotsCommandscripts();
AddSC_playerbots_commandscript();
PlayerBotsGuildValidationScript();
}

View File

@@ -35,7 +35,7 @@
#include "NewRpgInfo.h"
#include "NewRpgStrategy.h"
#include "ObjectGuid.h"
#include "PerfMonitor.h"
#include "PerformanceMonitor.h"
#include "Player.h"
#include "PlayerbotAI.h"
#include "PlayerbotAIConfig.h"
@@ -358,7 +358,7 @@ void RandomPlayerbotMgr::UpdateAIInternal(uint32 elapsed, bool /*minimal*/)
if (totalPmo)
totalPmo->finish();
totalPmo = sPerfMonitor->start(PERF_MON_TOTAL, "RandomPlayerbotMgr::FullTick");
totalPmo = sPerformanceMonitor->start(PERF_MON_TOTAL, "RandomPlayerbotMgr::FullTick");
if (!sPlayerbotAIConfig->randomBotAutologin || !sPlayerbotAIConfig->enabled)
return;
@@ -401,7 +401,7 @@ void RandomPlayerbotMgr::UpdateAIInternal(uint32 elapsed, bool /*minimal*/)
uint32 updateIntervalTurboBoost = _isBotInitializing ? 1 : sPlayerbotAIConfig->randomBotUpdateInterval;
SetNextCheckDelay(updateIntervalTurboBoost * (onlineBotFocus + 25) * 10);
PerfMonitorOperation* pmo = sPerfMonitor->start(
PerformanceMonitorOperation* pmo = sPerformanceMonitor->start(
PERF_MON_TOTAL,
onlineBotCount < maxAllowedBotCount ? "RandomPlayerbotMgr::Login" : "RandomPlayerbotMgr::UpdateAIInternal");
@@ -1707,7 +1707,7 @@ void RandomPlayerbotMgr::RandomTeleport(Player* bot, std::vector<WorldLocation>&
return;
}
PerfMonitorOperation* pmo = sPerfMonitor->start(PERF_MON_RNDBOT, "RandomTeleportByLocations");
PerformanceMonitorOperation* pmo = sPerformanceMonitor->start(PERF_MON_RNDBOT, "RandomTeleportByLocations");
std::shuffle(std::begin(tlocs), std::end(tlocs), RandomEngine::Instance());
for (uint32 i = 0; i < tlocs.size(); i++)
@@ -2300,7 +2300,7 @@ void RandomPlayerbotMgr::RandomTeleport(Player* bot)
if (bot->InBattleground())
return;
PerfMonitorOperation* pmo = sPerfMonitor->start(PERF_MON_RNDBOT, "RandomTeleport");
PerformanceMonitorOperation* pmo = sPerformanceMonitor->start(PERF_MON_RNDBOT, "RandomTeleport");
std::vector<WorldLocation> locs;
std::list<Unit*> targets;
@@ -2362,7 +2362,7 @@ void RandomPlayerbotMgr::IncreaseLevel(Player* bot)
if (maxLevel > sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL))
maxLevel = sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL);
PerfMonitorOperation* pmo = sPerfMonitor->start(PERF_MON_RNDBOT, "IncreaseLevel");
PerformanceMonitorOperation* pmo = sPerformanceMonitor->start(PERF_MON_RNDBOT, "IncreaseLevel");
uint32 lastLevel = GetValue(bot, "level");
uint8 level = bot->GetLevel() + 1;
if (level > maxLevel)
@@ -2401,7 +2401,7 @@ void RandomPlayerbotMgr::RandomizeFirst(Player* bot)
minLevel = std::max(minLevel, sWorld->getIntConfig(CONFIG_START_HEROIC_PLAYER_LEVEL));
}
PerfMonitorOperation* pmo = sPerfMonitor->start(PERF_MON_RNDBOT, "RandomizeFirst");
PerformanceMonitorOperation* pmo = sPerformanceMonitor->start(PERF_MON_RNDBOT, "RandomizeFirst");
uint32 level;
@@ -2480,7 +2480,7 @@ void RandomPlayerbotMgr::RandomizeMin(Player* bot)
if (!botAI)
return;
PerfMonitorOperation* pmo = sPerfMonitor->start(PERF_MON_RNDBOT, "RandomizeMin");
PerformanceMonitorOperation* pmo = sPerformanceMonitor->start(PERF_MON_RNDBOT, "RandomizeMin");
uint32 level = sPlayerbotAIConfig->randomBotMinLevel;
SetValue(bot, "level", level);
PlayerbotFactory factory(bot, level);
@@ -2569,7 +2569,7 @@ void RandomPlayerbotMgr::Refresh(Player* bot)
LOG_DEBUG("playerbots", "Refreshing bot {} <{}>", bot->GetGUID().ToString().c_str(), bot->GetName().c_str());
PerfMonitorOperation* pmo = sPerfMonitor->start(PERF_MON_RNDBOT, "Refresh");
PerformanceMonitorOperation* pmo = sPerformanceMonitor->start(PERF_MON_RNDBOT, "Refresh");
botAI->Reset();

View File

@@ -43,7 +43,7 @@ struct BattlegroundInfo
};
class ChatHandler;
class PerfMonitorOperation;
class PerformanceMonitorOperation;
class WorldLocation;
struct CachedEvent

View File

@@ -16,7 +16,7 @@
#include "BattleGroundTactics.h"
#include "Chat.h"
#include "GuildTaskMgr.h"
#include "PerfMonitor.h"
#include "PerformanceMonitor.h"
#include "PlayerbotMgr.h"
#include "RandomPlayerbotMgr.h"
#include "ScriptMgr.h"
@@ -76,19 +76,19 @@ public:
{
if (!strcmp(args, "reset"))
{
sPerfMonitor->Reset();
sPerformanceMonitor->Reset();
return true;
}
if (!strcmp(args, "tick"))
{
sPerfMonitor->PrintStats(true, false);
sPerformanceMonitor->PrintStats(true, false);
return true;
}
if (!strcmp(args, "stack"))
{
sPerfMonitor->PrintStats(false, true);
sPerformanceMonitor->PrintStats(false, true);
return true;
}
@@ -102,7 +102,7 @@ public:
return true;
}
sPerfMonitor->PrintStats();
sPerformanceMonitor->PrintStats();
return true;
}
@@ -209,4 +209,4 @@ public:
}
};
void AddPlayerbotsCommandscripts() { new playerbots_commandscript(); }
void AddSC_playerbots_commandscript() { new playerbots_commandscript(); }

1
src/cs_playerbots.h Normal file
View File

@@ -0,0 +1 @@
void AddSC_playerbots_commandscript();

View File

@@ -1,10 +1,9 @@
#include "PlayerbotSpellRepository.h"
#include "PlayerbotSpellCache.h"
// caches the result set
void PlayerbotSpellRepository::Initialize()
void PlayerbotSpellCache::Initialize()
{
LOG_INFO("playerbots", "Playerbots: ListSpellsAction caches initialized");
LOG_INFO("playerbots",
"Playerbots: ListSpellsAction caches initialized");
for (uint32 j = 0; j < sSkillLineAbilityStore.GetNumRows(); ++j)
{
if (SkillLineAbilityEntry const* skillLine = sSkillLineAbilityStore.LookupEntry(j))
@@ -32,7 +31,7 @@ void PlayerbotSpellRepository::Initialize()
skillSpells.size(), vendorItems.size());
}
SkillLineAbilityEntry const* PlayerbotSpellRepository::GetSkillLine(uint32 spellId) const
SkillLineAbilityEntry const* PlayerbotSpellCache::GetSkillLine(uint32 spellId) const
{
auto itr = skillSpells.find(spellId);
if (itr != skillSpells.end())
@@ -40,7 +39,7 @@ SkillLineAbilityEntry const* PlayerbotSpellRepository::GetSkillLine(uint32 spell
return nullptr;
}
bool PlayerbotSpellRepository::IsItemBuyable(uint32 itemId) const
bool PlayerbotSpellCache::IsItemBuyable(uint32 itemId) const
{
return vendorItems.find(itemId) != vendorItems.end();
}

View File

@@ -3,17 +3,17 @@
* and/or modify it under version 3 of the License, or (at your option), any later version.
*/
#ifndef _PLAYERBOT_PLAYERBOTSPELLREPOSITORY_H
#define _PLAYERBOT_PLAYERBOTSPELLREPOSITORY_H
#ifndef _PLAYERBOT_PLAYERBOTSPELLCACHE_H
#define _PLAYERBOT_PLAYERBOTSPELLCACHE_H
#include "Playerbots.h"
class PlayerbotSpellRepository
class PlayerbotSpellCache
{
public:
static PlayerbotSpellRepository* Instance()
static PlayerbotSpellCache* Instance()
{
static PlayerbotSpellRepository instance;
static PlayerbotSpellCache instance;
return &instance;
}
@@ -23,12 +23,12 @@ public:
bool IsItemBuyable(uint32 itemId) const;
private:
PlayerbotSpellRepository() = default;
PlayerbotSpellCache() = default;
std::map<uint32, SkillLineAbilityEntry const*> skillSpells;
std::set<uint32> vendorItems;
};
#define sPlayerbotSpellRepository PlayerbotSpellRepository::Instance()
#define sPlayerbotSpellCache PlayerbotSpellCache::Instance()
#endif

View File

@@ -24,12 +24,12 @@
#include "LootMgr.h"
#include "MapMgr.h"
#include "ObjectMgr.h"
#include "PerfMonitor.h"
#include "PerformanceMonitor.h"
#include "PetDefines.h"
#include "Player.h"
#include "PlayerbotAI.h"
#include "PlayerbotAIConfig.h"
#include "PlayerbotRepository.h"
#include "PlayerbotDbStore.h"
#include "PlayerbotGuildMgr.h"
#include "Playerbots.h"
#include "QuestDef.h"
@@ -240,7 +240,7 @@ void PlayerbotFactory::Randomize(bool incremental)
// LOG_DEBUG("playerbots", "Preparing to {} randomize...", (incremental ? "incremental" : "full"));
Prepare();
LOG_DEBUG("playerbots", "Resetting player...");
PerfMonitorOperation* pmo = sPerfMonitor->start(PERF_MON_RNDBOT, "PlayerbotFactory_Reset");
PerformanceMonitorOperation* pmo = sPerformanceMonitor->start(PERF_MON_RNDBOT, "PlayerbotFactory_Reset");
if (!sPlayerbotAIConfig->equipmentPersistence || level < sPlayerbotAIConfig->equipmentPersistenceLevel)
{
bot->resetTalents(true);
@@ -266,7 +266,7 @@ void PlayerbotFactory::Randomize(bool incremental)
if (pmo)
pmo->finish();
// pmo = sPerfMonitor->start(PERF_MON_RNDBOT, "PlayerbotFactory_Immersive");
// pmo = sPerformanceMonitor->start(PERF_MON_RNDBOT, "PlayerbotFactory_Immersive");
// LOG_INFO("playerbots", "Initializing immersive...");
// InitImmersive();
// if (pmo)
@@ -274,7 +274,7 @@ void PlayerbotFactory::Randomize(bool incremental)
if (sPlayerbotAIConfig->randomBotPreQuests)
{
pmo = sPerfMonitor->start(PERF_MON_RNDBOT, "PlayerbotFactory_Quests");
pmo = sPerformanceMonitor->start(PERF_MON_RNDBOT, "PlayerbotFactory_Quests");
InitInstanceQuests();
InitAttunementQuests();
if (pmo)
@@ -282,27 +282,27 @@ void PlayerbotFactory::Randomize(bool incremental)
}
else
{
pmo = sPerfMonitor->start(PERF_MON_RNDBOT, "PlayerbotFactory_Quests");
pmo = sPerformanceMonitor->start(PERF_MON_RNDBOT, "PlayerbotFactory_Quests");
InitAttunementQuests();
if (pmo)
pmo->finish();
}
LOG_DEBUG("playerbots", "Initializing skills (step 1)...");
pmo = sPerfMonitor->start(PERF_MON_RNDBOT, "PlayerbotFactory_Skills1");
pmo = sPerformanceMonitor->start(PERF_MON_RNDBOT, "PlayerbotFactory_Skills1");
bot->LearnDefaultSkills();
InitSkills();
if (pmo)
pmo->finish();
pmo = sPerfMonitor->start(PERF_MON_RNDBOT, "PlayerbotFactory_Spells1");
pmo = sPerformanceMonitor->start(PERF_MON_RNDBOT, "PlayerbotFactory_Spells1");
LOG_DEBUG("playerbots", "Initializing spells (step 1)...");
InitClassSpells();
InitAvailableSpells();
if (pmo)
pmo->finish();
pmo = sPerfMonitor->start(PERF_MON_RNDBOT, "PlayerbotFactory_Talents");
pmo = sPerformanceMonitor->start(PERF_MON_RNDBOT, "PlayerbotFactory_Talents");
LOG_DEBUG("playerbots", "Initializing talents...");
if (!incremental || !sPlayerbotAIConfig->equipmentPersistence ||
bot->GetLevel() < sPlayerbotAIConfig->equipmentPersistenceLevel)
@@ -312,45 +312,45 @@ void PlayerbotFactory::Randomize(bool incremental)
sRandomPlayerbotMgr->SetValue(bot->GetGUID().GetCounter(), "specNo", 0);
if (botAI)
{
sPlayerbotRepository->Reset(botAI);
sPlayerbotDbStore->Reset(botAI);
// botAI->DoSpecificAction("auto talents");
botAI->ResetStrategies(false); // fix wrong stored strategy
}
if (pmo)
pmo->finish();
pmo = sPerfMonitor->start(PERF_MON_RNDBOT, "PlayerbotFactory_Spells2");
pmo = sPerformanceMonitor->start(PERF_MON_RNDBOT, "PlayerbotFactory_Spells2");
LOG_DEBUG("playerbots", "Initializing spells (step 2)...");
InitAvailableSpells();
if (pmo)
pmo->finish();
pmo = sPerfMonitor->start(PERF_MON_RNDBOT, "PlayerbotFactory_Reputation");
pmo = sPerformanceMonitor->start(PERF_MON_RNDBOT, "PlayerbotFactory_Reputation");
LOG_DEBUG("playerbots", "Initializing reputation...");
InitReputation();
if (pmo)
pmo->finish();
LOG_DEBUG("playerbots", "Initializing special spells...");
pmo = sPerfMonitor->start(PERF_MON_RNDBOT, "PlayerbotFactory_Spells3");
pmo = sPerformanceMonitor->start(PERF_MON_RNDBOT, "PlayerbotFactory_Spells3");
InitSpecialSpells();
if (pmo)
pmo->finish();
pmo = sPerfMonitor->start(PERF_MON_RNDBOT, "PlayerbotFactory_Mounts");
pmo = sPerformanceMonitor->start(PERF_MON_RNDBOT, "PlayerbotFactory_Mounts");
LOG_DEBUG("playerbots", "Initializing mounts...");
InitMounts();
// bot->SaveToDB(false, false);
if (pmo)
pmo->finish();
// pmo = sPerfMonitor->start(PERF_MON_RNDBOT, "PlayerbotFactory_Skills2");
// pmo = sPerformanceMonitor->start(PERF_MON_RNDBOT, "PlayerbotFactory_Skills2");
// LOG_INFO("playerbots", "Initializing skills (step 2)...");
// UpdateTradeSkills();
// if (pmo)
// pmo->finish();
pmo = sPerfMonitor->start(PERF_MON_RNDBOT, "PlayerbotFactory_Equip");
pmo = sPerformanceMonitor->start(PERF_MON_RNDBOT, "PlayerbotFactory_Equip");
LOG_DEBUG("playerbots", "Initializing equipmemt...");
if (!incremental || !sPlayerbotAIConfig->equipmentPersistence ||
bot->GetLevel() < sPlayerbotAIConfig->equipmentPersistenceLevel)
@@ -364,51 +364,51 @@ void PlayerbotFactory::Randomize(bool incremental)
// if (bot->GetLevel() >= sPlayerbotAIConfig->minEnchantingBotLevel)
// {
// pmo = sPerfMonitor->start(PERF_MON_RNDBOT, "PlayerbotFactory_Enchant");
// pmo = sPerformanceMonitor->start(PERF_MON_RNDBOT, "PlayerbotFactory_Enchant");
// LOG_INFO("playerbots", "Initializing enchant templates...");
// LoadEnchantContainer();
// if (pmo)
// pmo->finish();
// }
pmo = sPerfMonitor->start(PERF_MON_RNDBOT, "PlayerbotFactory_Bags");
pmo = sPerformanceMonitor->start(PERF_MON_RNDBOT, "PlayerbotFactory_Bags");
LOG_DEBUG("playerbots", "Initializing bags...");
InitBags();
// bot->SaveToDB(false, false);
if (pmo)
pmo->finish();
pmo = sPerfMonitor->start(PERF_MON_RNDBOT, "PlayerbotFactory_Ammo");
pmo = sPerformanceMonitor->start(PERF_MON_RNDBOT, "PlayerbotFactory_Ammo");
LOG_DEBUG("playerbots", "Initializing ammo...");
InitAmmo();
if (pmo)
pmo->finish();
pmo = sPerfMonitor->start(PERF_MON_RNDBOT, "PlayerbotFactory_Food");
pmo = sPerformanceMonitor->start(PERF_MON_RNDBOT, "PlayerbotFactory_Food");
LOG_DEBUG("playerbots", "Initializing food...");
InitFood();
if (pmo)
pmo->finish();
pmo = sPerfMonitor->start(PERF_MON_RNDBOT, "PlayerbotFactory_Potions");
pmo = sPerformanceMonitor->start(PERF_MON_RNDBOT, "PlayerbotFactory_Potions");
LOG_DEBUG("playerbots", "Initializing potions...");
InitPotions();
if (pmo)
pmo->finish();
pmo = sPerfMonitor->start(PERF_MON_RNDBOT, "PlayerbotFactory_Reagents");
pmo = sPerformanceMonitor->start(PERF_MON_RNDBOT, "PlayerbotFactory_Reagents");
LOG_DEBUG("playerbots", "Initializing reagents...");
InitReagents();
if (pmo)
pmo->finish();
pmo = sPerfMonitor->start(PERF_MON_RNDBOT, "PlayerbotFactory_Keys");
pmo = sPerformanceMonitor->start(PERF_MON_RNDBOT, "PlayerbotFactory_Keys");
LOG_DEBUG("playerbots", "Initializing keys...");
InitKeyring();
if (pmo)
pmo->finish();
// pmo = sPerfMonitor->start(PERF_MON_RNDBOT, "PlayerbotFactory_EqSets");
// pmo = sPerformanceMonitor->start(PERF_MON_RNDBOT, "PlayerbotFactory_EqSets");
// LOG_DEBUG("playerbots", "Initializing second equipment set...");
// InitSecondEquipmentSet();
// if (pmo)
@@ -419,20 +419,20 @@ void PlayerbotFactory::Randomize(bool incremental)
ApplyEnchantAndGemsNew();
}
// {
// pmo = sPerfMonitor->start(PERF_MON_RNDBOT, "PlayerbotFactory_EnchantTemplate");
// pmo = sPerformanceMonitor->start(PERF_MON_RNDBOT, "PlayerbotFactory_EnchantTemplate");
// LOG_INFO("playerbots", "Initializing enchant templates...");
// ApplyEnchantTemplate();
// if (pmo)
// pmo->finish();
// }
pmo = sPerfMonitor->start(PERF_MON_RNDBOT, "PlayerbotFactory_Inventory");
pmo = sPerformanceMonitor->start(PERF_MON_RNDBOT, "PlayerbotFactory_Inventory");
LOG_DEBUG("playerbots", "Initializing inventory...");
// InitInventory();
if (pmo)
pmo->finish();
pmo = sPerfMonitor->start(PERF_MON_RNDBOT, "PlayerbotFactory_Consumable");
pmo = sPerformanceMonitor->start(PERF_MON_RNDBOT, "PlayerbotFactory_Consumable");
LOG_DEBUG("playerbots", "Initializing consumables...");
InitConsumables();
if (pmo)
@@ -442,7 +442,7 @@ void PlayerbotFactory::Randomize(bool incremental)
InitGlyphs();
// bot->SaveToDB(false, false);
pmo = sPerfMonitor->start(PERF_MON_RNDBOT, "PlayerbotFactory_Guilds");
pmo = sPerformanceMonitor->start(PERF_MON_RNDBOT, "PlayerbotFactory_Guilds");
// bot->SaveToDB(false, false);
if (sPlayerbotAIConfig->randomBotGuildCount > 0)
{
@@ -455,7 +455,7 @@ void PlayerbotFactory::Randomize(bool incremental)
if (bot->GetLevel() >= 70)
{
pmo = sPerfMonitor->start(PERF_MON_RNDBOT, "PlayerbotFactory_Arenas");
pmo = sPerformanceMonitor->start(PERF_MON_RNDBOT, "PlayerbotFactory_Arenas");
// LOG_INFO("playerbots", "Initializing arena teams...");
InitArenaTeam();
if (pmo)
@@ -470,7 +470,7 @@ void PlayerbotFactory::Randomize(bool incremental)
}
if (bot->GetLevel() >= 10)
{
pmo = sPerfMonitor->start(PERF_MON_RNDBOT, "PlayerbotFactory_Pet");
pmo = sPerformanceMonitor->start(PERF_MON_RNDBOT, "PlayerbotFactory_Pet");
LOG_DEBUG("playerbots", "Initializing pet...");
InitPet();
// bot->SaveToDB(false, false);
@@ -479,7 +479,7 @@ void PlayerbotFactory::Randomize(bool incremental)
pmo->finish();
}
pmo = sPerfMonitor->start(PERF_MON_RNDBOT, "PlayerbotFactory_Save");
pmo = sPerformanceMonitor->start(PERF_MON_RNDBOT, "PlayerbotFactory_Save");
LOG_DEBUG("playerbots", "Saving to DB...");
bot->SetMoney(urand(level * 100000, level * 5 * 100000));
bot->SetHealth(bot->GetMaxHealth());

View File

@@ -27,32 +27,32 @@
#include "WarriorAiObjectContext.h"
#include "WorldPacketActionContext.h"
#include "WorldPacketTriggerContext.h"
#include "Extend/DungeonAi/DungeonStrategyContext.h"
#include "Extend/DungeonAi/Wotlk/WotlkDungeonActionContext.h"
#include "Extend/DungeonAi/Wotlk/WotlkDungeonTriggerContext.h"
#include "Extend/RaidAi/RaidStrategyContext.h"
#include "Extend/RaidAi/Aq20/RaidAq20ActionContext.h"
#include "Extend/RaidAi/Aq20/RaidAq20TriggerContext.h"
#include "Extend/RaidAi/MoltenCore/RaidMcActionContext.h"
#include "Extend/RaidAi/MoltenCore/RaidMcTriggerContext.h"
#include "Extend/RaidAi/BlackwingLair/RaidBwlActionContext.h"
#include "Extend/RaidAi/BlackwingLair/RaidBwlTriggerContext.h"
#include "Extend/RaidAi/Karazhan/RaidKarazhanActionContext.h"
#include "Extend/RaidAi/Karazhan/RaidKarazhanTriggerContext.h"
#include "Extend/RaidAi/Magtheridon/RaidMagtheridonActionContext.h"
#include "Extend/RaidAi/Magtheridon/RaidMagtheridonTriggerContext.h"
#include "Extend/RaidAi/GruulsLair/RaidGruulsLairActionContext.h"
#include "Extend/RaidAi/GruulsLair/RaidGruulsLairTriggerContext.h"
#include "Extend/RaidAi/EyeOfEternity/RaidEoEActionContext.h"
#include "Extend/RaidAi/EyeOfEternity/RaidEoETriggerContext.h"
#include "Extend/RaidAi/VaultOfArchavon/RaidVoAActionContext.h"
#include "Extend/RaidAi/VaultOfArchavon/RaidVoATriggerContext.h"
#include "Extend/RaidAi/ObsidianSanctum/RaidOsActionContext.h"
#include "Extend/RaidAi/ObsidianSanctum/RaidOsTriggerContext.h"
#include "Extend/RaidAi/Onyxia/RaidOnyxiaActionContext.h"
#include "Extend/RaidAi/Onyxia/RaidOnyxiaTriggerContext.h"
#include "Extend/RaidAi/Icecrown/RaidIccActionContext.h"
#include "Extend/RaidAi/Icecrown/RaidIccTriggerContext.h"
#include "dungeons/DungeonStrategyContext.h"
#include "dungeons/wotlk/WotlkDungeonActionContext.h"
#include "dungeons/wotlk/WotlkDungeonTriggerContext.h"
#include "raids/RaidStrategyContext.h"
#include "raids/aq20/RaidAq20ActionContext.h"
#include "raids/aq20/RaidAq20TriggerContext.h"
#include "raids/moltencore/RaidMcActionContext.h"
#include "raids/moltencore/RaidMcTriggerContext.h"
#include "raids/blackwinglair/RaidBwlActionContext.h"
#include "raids/blackwinglair/RaidBwlTriggerContext.h"
#include "raids/karazhan/RaidKarazhanActionContext.h"
#include "raids/karazhan/RaidKarazhanTriggerContext.h"
#include "raids/magtheridon/RaidMagtheridonActionContext.h"
#include "raids/magtheridon/RaidMagtheridonTriggerContext.h"
#include "raids/gruulslair/RaidGruulsLairActionContext.h"
#include "raids/gruulslair/RaidGruulsLairTriggerContext.h"
#include "raids/eyeofeternity/RaidEoEActionContext.h"
#include "raids/eyeofeternity/RaidEoETriggerContext.h"
#include "raids/vaultofarchavon/RaidVoAActionContext.h"
#include "raids/vaultofarchavon/RaidVoATriggerContext.h"
#include "raids/obsidiansanctum/RaidOsActionContext.h"
#include "raids/obsidiansanctum/RaidOsTriggerContext.h"
#include "raids/onyxia/RaidOnyxiaActionContext.h"
#include "raids/onyxia/RaidOnyxiaTriggerContext.h"
#include "raids/icecrown/RaidIccActionContext.h"
#include "raids/icecrown/RaidIccTriggerContext.h"
SharedNamedObjectContextList<Strategy> AiObjectContext::sharedStrategyContexts;
SharedNamedObjectContextList<Action> AiObjectContext::sharedActionContexts;

View File

@@ -7,7 +7,7 @@
#include "Action.h"
#include "Event.h"
#include "PerfMonitor.h"
#include "PerformanceMonitor.h"
#include "Playerbots.h"
#include "Queue.h"
#include "Strategy.h"
@@ -204,7 +204,7 @@ bool Engine::DoNextAction(Unit* unit, uint32 depth, bool minimal)
}
}
PerfMonitorOperation* pmo = sPerfMonitor->start(PERF_MON_ACTION, action->getName(), &aiObjectContext->performanceStack);
PerformanceMonitorOperation* pmo = sPerformanceMonitor->start(PERF_MON_ACTION, action->getName(), &aiObjectContext->performanceStack);
actionExecuted = ListenAndExecute(action, event);
if (pmo)
pmo->finish();
@@ -456,8 +456,8 @@ void Engine::ProcessTriggers(bool minimal)
if (minimal && node->getFirstRelevance() < 100)
continue;
PerfMonitorOperation* pmo =
sPerfMonitor->start(PERF_MON_TRIGGER, trigger->getName(), &aiObjectContext->performanceStack);
PerformanceMonitorOperation* pmo =
sPerformanceMonitor->start(PERF_MON_TRIGGER, trigger->getName(), &aiObjectContext->performanceStack);
Event event = trigger->Check();
if (pmo)
pmo->finish();

Some files were not shown because too many files have changed in this diff Show More