mirror of
https://github.com/mod-playerbots/mod-playerbots.git
synced 2026-01-18 03:05:43 +00:00
Compare commits
3 Commits
master
...
hermensbas
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b0dc63da67 | ||
|
|
944940bd6f | ||
|
|
9e0250b973 |
50
src/Helpers.cpp
Normal file
50
src/Helpers.cpp
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2016+ AzerothCore <www.azerothcore.org>, released under GNU AGPL v3 license, you may redistribute it
|
||||||
|
* and/or modify it under version 3 of the License, or (at your option), any later version.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "Helpers.h"
|
||||||
|
|
||||||
|
char* strstri(char const* haystack, char const* needle)
|
||||||
|
{
|
||||||
|
if (!*needle)
|
||||||
|
{
|
||||||
|
return (char*)haystack;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (; *haystack; ++haystack)
|
||||||
|
{
|
||||||
|
if (tolower(*haystack) == tolower(*needle))
|
||||||
|
{
|
||||||
|
char const *h = haystack, *n = needle;
|
||||||
|
for (; *h && *n; ++h, ++n)
|
||||||
|
{
|
||||||
|
if (tolower(*h) != tolower(*n))
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!*n)
|
||||||
|
{
|
||||||
|
return (char*)haystack;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string& ltrim(std::string& s)
|
||||||
|
{
|
||||||
|
s.erase(s.begin(), std::find_if(s.begin(), s.end(), [](int c) { return !std::isspace(c); }));
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string& rtrim(std::string& s)
|
||||||
|
{
|
||||||
|
s.erase(std::find_if(s.rbegin(), s.rend(), [](int c) { return !std::isspace(c); }).base(), s.end());
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string& trim(std::string& s) { return ltrim(rtrim(s)); }
|
||||||
55
src/Helpers.h
Normal file
55
src/Helpers.h
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2016+ AzerothCore <www.azerothcore.org>, released under GNU AGPL v3 license, you may redistribute it
|
||||||
|
* and/or modify it under version 3 of the License, or (at your option), any later version.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _PLAYERBOT_HELPERS_H
|
||||||
|
#define _PLAYERBOT_HELPERS_H
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
|
#include <cctype>
|
||||||
|
#include <functional>
|
||||||
|
#include <locale>
|
||||||
|
#include <map>
|
||||||
|
#include <sstream>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
#include "Common.h"
|
||||||
|
|
||||||
|
void split(std::vector<std::string>& dest, std::string const str, char const* delim)
|
||||||
|
{
|
||||||
|
char* pTempStr = strdup(str.c_str());
|
||||||
|
char* pWord = strtok(pTempStr, delim);
|
||||||
|
|
||||||
|
while (pWord != nullptr)
|
||||||
|
{
|
||||||
|
dest.push_back(pWord);
|
||||||
|
pWord = strtok(nullptr, delim);
|
||||||
|
}
|
||||||
|
|
||||||
|
free(pTempStr);
|
||||||
|
}
|
||||||
|
|
||||||
|
std::vector<std::string>& split(std::string const s, char delim, std::vector<std::string>& elems)
|
||||||
|
{
|
||||||
|
std::stringstream ss(s);
|
||||||
|
std::string item;
|
||||||
|
|
||||||
|
while (getline(ss, item, delim))
|
||||||
|
{
|
||||||
|
elems.push_back(item);
|
||||||
|
}
|
||||||
|
|
||||||
|
return elems;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::vector<std::string> split(std::string const s, char delim)
|
||||||
|
{
|
||||||
|
std::vector<std::string> elems;
|
||||||
|
return split(s, delim, elems);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
39
src/LazyCalculatedValue.h
Normal file
39
src/LazyCalculatedValue.h
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2016+ AzerothCore <www.azerothcore.org>, released under GNU AGPL v3 license, you may redistribute it
|
||||||
|
* and/or modify it under version 3 of the License, or (at your option), any later version.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _PLAYERBOT_LAZYCALCULATEDVALUE_H
|
||||||
|
#define _PLAYERBOT_LAZYCALCULATEDVALUE_H
|
||||||
|
|
||||||
|
template <class TValue, class TOwner>
|
||||||
|
class LazyCalculatedValue
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
typedef TValue (TOwner::*Calculator)();
|
||||||
|
|
||||||
|
public:
|
||||||
|
LazyCalculatedValue(TOwner* owner, Calculator calculator) : calculator(calculator), owner(owner) { Reset(); }
|
||||||
|
|
||||||
|
public:
|
||||||
|
TValue GetValue()
|
||||||
|
{
|
||||||
|
if (!calculated)
|
||||||
|
{
|
||||||
|
value = (owner->*calculator)();
|
||||||
|
calculated = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Reset() { calculated = false; }
|
||||||
|
|
||||||
|
protected:
|
||||||
|
Calculator calculator;
|
||||||
|
TOwner* owner;
|
||||||
|
bool calculated;
|
||||||
|
TValue value;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -3,11 +3,11 @@
|
|||||||
* and/or modify it under version 3 of the License, or (at your option), any later version.
|
* 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"
|
#include "Playerbots.h"
|
||||||
|
|
||||||
PerfMonitorOperation* PerfMonitor::start(PerformanceMetric metric, std::string const name,
|
PerformanceMonitorOperation* PerformanceMonitor::start(PerformanceMetric metric, std::string const name,
|
||||||
PerformanceStack* stack)
|
PerformanceStack* stack)
|
||||||
{
|
{
|
||||||
if (!sPlayerbotAIConfig->perfMonEnabled)
|
if (!sPlayerbotAIConfig->perfMonEnabled)
|
||||||
@@ -45,10 +45,10 @@ PerfMonitorOperation* PerfMonitor::start(PerformanceMetric metric, std::string c
|
|||||||
data[metric][stackName] = pd;
|
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())
|
if (data.empty())
|
||||||
return;
|
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();
|
for (std::map<PerformanceMetric, std::map<std::string, PerformanceData*>>::iterator i = data.begin();
|
||||||
i != data.end(); ++i)
|
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)
|
PerformanceStack* stack)
|
||||||
: data(data), name(name), stack(stack)
|
: data(data), name(name), stack(stack)
|
||||||
{
|
{
|
||||||
@@ -273,7 +273,7 @@ PerfMonitorOperation::PerfMonitorOperation(PerformanceData* data, std::string co
|
|||||||
.time_since_epoch();
|
.time_since_epoch();
|
||||||
}
|
}
|
||||||
|
|
||||||
void PerfMonitorOperation::finish()
|
void PerformanceMonitorOperation::finish()
|
||||||
{
|
{
|
||||||
std::chrono::microseconds finished =
|
std::chrono::microseconds finished =
|
||||||
(std::chrono::time_point_cast<std::chrono::microseconds>(std::chrono::high_resolution_clock::now()))
|
(std::chrono::time_point_cast<std::chrono::microseconds>(std::chrono::high_resolution_clock::now()))
|
||||||
@@ -34,10 +34,10 @@ enum PerformanceMetric
|
|||||||
PERF_MON_TOTAL
|
PERF_MON_TOTAL
|
||||||
};
|
};
|
||||||
|
|
||||||
class PerfMonitorOperation
|
class PerformanceMonitorOperation
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
PerfMonitorOperation(PerformanceData* data, std::string const name, PerformanceStack* stack);
|
PerformanceMonitorOperation(PerformanceData* data, std::string const name, PerformanceStack* stack);
|
||||||
void finish();
|
void finish();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@@ -47,19 +47,19 @@ private:
|
|||||||
std::chrono::microseconds started;
|
std::chrono::microseconds started;
|
||||||
};
|
};
|
||||||
|
|
||||||
class PerfMonitor
|
class PerformanceMonitor
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
PerfMonitor(){};
|
PerformanceMonitor(){};
|
||||||
virtual ~PerfMonitor(){};
|
virtual ~PerformanceMonitor(){};
|
||||||
static PerfMonitor* instance()
|
static PerformanceMonitor* instance()
|
||||||
{
|
{
|
||||||
static PerfMonitor instance;
|
static PerformanceMonitor instance;
|
||||||
return &instance;
|
return &instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
PerfMonitorOperation* start(PerformanceMetric metric, std::string const name,
|
PerformanceMonitorOperation* start(PerformanceMetric metric, std::string const name,
|
||||||
PerformanceStack* stack = nullptr);
|
PerformanceStack* stack = nullptr);
|
||||||
void PrintStats(bool perTick = false, bool fullStack = false);
|
void PrintStats(bool perTick = false, bool fullStack = false);
|
||||||
void Reset();
|
void Reset();
|
||||||
@@ -69,6 +69,6 @@ private:
|
|||||||
std::mutex lock;
|
std::mutex lock;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define sPerfMonitor PerfMonitor::instance()
|
#define sPerformanceMonitor PerformanceMonitor::instance()
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
#include "Common.h"
|
#include "Common.h"
|
||||||
#include "Player.h"
|
#include "Player.h"
|
||||||
#include "PlayerbotDungeonRepository.h"
|
#include "PlayerbotDungeonSuggestionMgr.h"
|
||||||
|
|
||||||
typedef std::map<std::string, std::string> PlaceholderMap;
|
typedef std::map<std::string, std::string> PlaceholderMap;
|
||||||
|
|
||||||
@@ -38,10 +38,10 @@
|
|||||||
#include "NewRpgStrategy.h"
|
#include "NewRpgStrategy.h"
|
||||||
#include "ObjectGuid.h"
|
#include "ObjectGuid.h"
|
||||||
#include "ObjectMgr.h"
|
#include "ObjectMgr.h"
|
||||||
#include "PerfMonitor.h"
|
#include "PerformanceMonitor.h"
|
||||||
#include "Player.h"
|
#include "Player.h"
|
||||||
#include "PlayerbotAIConfig.h"
|
#include "PlayerbotAIConfig.h"
|
||||||
#include "PlayerbotRepository.h"
|
#include "PlayerbotDbStore.h"
|
||||||
#include "PlayerbotMgr.h"
|
#include "PlayerbotMgr.h"
|
||||||
#include "PlayerbotGuildMgr.h"
|
#include "PlayerbotGuildMgr.h"
|
||||||
#include "Playerbots.h"
|
#include "Playerbots.h"
|
||||||
@@ -441,8 +441,8 @@ void PlayerbotAI::UpdateAIInternal([[maybe_unused]] uint32 elapsed, bool minimal
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
std::string const mapString = WorldPosition(bot).isOverworld() ? std::to_string(bot->GetMapId()) : "I";
|
std::string const mapString = WorldPosition(bot).isOverworld() ? std::to_string(bot->GetMapId()) : "I";
|
||||||
PerfMonitorOperation* pmo =
|
PerformanceMonitorOperation* pmo =
|
||||||
sPerfMonitor->start(PERF_MON_TOTAL, "PlayerbotAI::UpdateAIInternal " + mapString);
|
sPerformanceMonitor->start(PERF_MON_TOTAL, "PlayerbotAI::UpdateAIInternal " + mapString);
|
||||||
ExternalEventHelper helper(aiObjectContext);
|
ExternalEventHelper helper(aiObjectContext);
|
||||||
|
|
||||||
// chat replies
|
// chat replies
|
||||||
@@ -1731,7 +1731,7 @@ void PlayerbotAI::ResetStrategies(bool load)
|
|||||||
engines[i]->Init();
|
engines[i]->Init();
|
||||||
|
|
||||||
// if (load)
|
// if (load)
|
||||||
// sPlayerbotRepository->Load(this);
|
// sPlayerbotDbStore->Load(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PlayerbotAI::IsRanged(Player* player, bool bySpec)
|
bool PlayerbotAI::IsRanged(Player* player, bool bySpec)
|
||||||
@@ -14,7 +14,7 @@ void PlayerbotAIBase::UpdateAI(uint32 elapsed, bool minimal)
|
|||||||
if (totalPmo)
|
if (totalPmo)
|
||||||
totalPmo->finish();
|
totalPmo->finish();
|
||||||
|
|
||||||
totalPmo = sPerfMonitor->start(PERF_MON_TOTAL, "PlayerbotAIBase::FullTick");
|
totalPmo = sPerformanceMonitor->start(PERF_MON_TOTAL, "PlayerbotAIBase::FullTick");
|
||||||
|
|
||||||
if (nextAICheckDelay > elapsed)
|
if (nextAICheckDelay > elapsed)
|
||||||
nextAICheckDelay -= elapsed;
|
nextAICheckDelay -= elapsed;
|
||||||
@@ -25,7 +25,7 @@ public:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
uint32 nextAICheckDelay;
|
uint32 nextAICheckDelay;
|
||||||
class PerfMonitorOperation* totalPmo = nullptr;
|
class PerformanceMonitorOperation* totalPmo = nullptr;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool _isBotAI;
|
bool _isBotAI;
|
||||||
@@ -7,7 +7,7 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include "Config.h"
|
#include "Config.h"
|
||||||
#include "NewRpgInfo.h"
|
#include "NewRpgInfo.h"
|
||||||
#include "PlayerbotDungeonRepository.h"
|
#include "PlayerbotDungeonSuggestionMgr.h"
|
||||||
#include "PlayerbotFactory.h"
|
#include "PlayerbotFactory.h"
|
||||||
#include "Playerbots.h"
|
#include "Playerbots.h"
|
||||||
#include "PlayerbotGuildMgr.h"
|
#include "PlayerbotGuildMgr.h"
|
||||||
@@ -678,7 +678,7 @@ bool PlayerbotAIConfig::Initialize()
|
|||||||
|
|
||||||
if (sPlayerbotAIConfig->randomBotSuggestDungeons)
|
if (sPlayerbotAIConfig->randomBotSuggestDungeons)
|
||||||
{
|
{
|
||||||
sPlayerbotDungeonRepository->LoadDungeonSuggestions();
|
sPlayerbotDungeonSuggestionMgr->LoadDungeonSuggestions();
|
||||||
}
|
}
|
||||||
|
|
||||||
excludedHunterPetFamilies.clear();
|
excludedHunterPetFamilies.clear();
|
||||||
@@ -3,13 +3,13 @@
|
|||||||
* and/or modify it under version 3 of the License, or (at your option), any later version.
|
* 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 <iostream>
|
||||||
|
|
||||||
#include "Playerbots.h"
|
#include "Playerbots.h"
|
||||||
|
|
||||||
void PlayerbotRepository::Load(PlayerbotAI* botAI)
|
void PlayerbotDbStore::Load(PlayerbotAI* botAI)
|
||||||
{
|
{
|
||||||
ObjectGuid::LowType guid = botAI->GetBot()->GetGUID().GetCounter();
|
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();
|
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)));
|
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;
|
std::ostringstream out;
|
||||||
for (std::vector<std::string>::iterator i = strategies.begin(); i != strategies.end(); ++i)
|
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);
|
return res.substr(0, res.size() - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PlayerbotRepository::Reset(PlayerbotAI* botAI)
|
void PlayerbotDbStore::Reset(PlayerbotAI* botAI)
|
||||||
{
|
{
|
||||||
ObjectGuid::LowType guid = botAI->GetBot()->GetGUID().GetCounter();
|
ObjectGuid::LowType guid = botAI->GetBot()->GetGUID().GetCounter();
|
||||||
|
|
||||||
@@ -87,7 +87,7 @@ void PlayerbotRepository::Reset(PlayerbotAI* botAI)
|
|||||||
PlayerbotsDatabase.Execute(stmt);
|
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);
|
PlayerbotsDatabasePreparedStatement* stmt = PlayerbotsDatabase.GetPreparedStatement(PLAYERBOTS_INS_DB_STORE);
|
||||||
stmt->SetData(0, guid);
|
stmt->SetData(0, guid);
|
||||||
@@ -3,8 +3,8 @@
|
|||||||
* and/or modify it under version 3 of the License, or (at your option), any later version.
|
* and/or modify it under version 3 of the License, or (at your option), any later version.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _PLAYERBOT_PLAYERBOTREPOSITORY_H
|
#ifndef _PLAYERBOT_PLAYERBOTDBSTORE_H
|
||||||
#define _PLAYERBOT_PLAYERBOTREPOSITORY_H
|
#define _PLAYERBOT_PLAYERBOTDBSTORE_H
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
@@ -12,14 +12,14 @@
|
|||||||
|
|
||||||
class PlayerbotAI;
|
class PlayerbotAI;
|
||||||
|
|
||||||
class PlayerbotRepository
|
class PlayerbotDbStore
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
PlayerbotRepository() {}
|
PlayerbotDbStore() {}
|
||||||
virtual ~PlayerbotRepository() {}
|
virtual ~PlayerbotDbStore() {}
|
||||||
static PlayerbotRepository* instance()
|
static PlayerbotDbStore* instance()
|
||||||
{
|
{
|
||||||
static PlayerbotRepository instance;
|
static PlayerbotDbStore instance;
|
||||||
return &instance;
|
return &instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -32,6 +32,6 @@ private:
|
|||||||
std::string const FormatStrategies(std::string const type, std::vector<std::string> strategies);
|
std::string const FormatStrategies(std::string const type, std::vector<std::string> strategies);
|
||||||
};
|
};
|
||||||
|
|
||||||
#define sPlayerbotRepository PlayerbotRepository::instance()
|
#define sPlayerbotDbStore PlayerbotDbStore::instance()
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -3,16 +3,16 @@
|
|||||||
* and/or modify it under version 3 of the License, or (at your option), any later version.
|
* 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"
|
#include "Playerbots.h"
|
||||||
|
|
||||||
std::vector<DungeonSuggestion> const PlayerbotDungeonRepository::GetDungeonSuggestions()
|
std::vector<DungeonSuggestion> const PlayerbotDungeonSuggestionMgr::GetDungeonSuggestions()
|
||||||
{
|
{
|
||||||
return m_dungeonSuggestions;
|
return m_dungeonSuggestions;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PlayerbotDungeonRepository::LoadDungeonSuggestions()
|
void PlayerbotDungeonSuggestionMgr::LoadDungeonSuggestions()
|
||||||
{
|
{
|
||||||
LOG_INFO("server.loading", "Loading playerbots dungeon suggestions...");
|
LOG_INFO("server.loading", "Loading playerbots dungeon suggestions...");
|
||||||
uint32 oldMSTime = getMSTime();
|
uint32 oldMSTime = getMSTime();
|
||||||
@@ -3,8 +3,8 @@
|
|||||||
* and/or modify it under version 3 of the License, or (at your option), any later version.
|
* and/or modify it under version 3 of the License, or (at your option), any later version.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _PLAYERBOT_PLAYERBOTDUNGEONREPOSITORY_H
|
#ifndef _PLAYERBOT_PLAYERBOTDUNGEONSUGGESTIONMGR_H
|
||||||
#define _PLAYERBOT_PLAYERBOTDUNGEONREPOSITORY_H
|
#define _PLAYERBOT_PLAYERBOTDUNGEONSUGGESTIONMGR_H
|
||||||
|
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
@@ -22,14 +22,14 @@ struct DungeonSuggestion
|
|||||||
std::string strategy;
|
std::string strategy;
|
||||||
};
|
};
|
||||||
|
|
||||||
class PlayerbotDungeonRepository
|
class PlayerbotDungeonSuggestionMgr
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
PlayerbotDungeonRepository(){};
|
PlayerbotDungeonSuggestionMgr(){};
|
||||||
~PlayerbotDungeonRepository(){};
|
~PlayerbotDungeonSuggestionMgr(){};
|
||||||
static PlayerbotDungeonRepository* instance()
|
static PlayerbotDungeonSuggestionMgr* instance()
|
||||||
{
|
{
|
||||||
static PlayerbotDungeonRepository instance;
|
static PlayerbotDungeonSuggestionMgr instance;
|
||||||
return &instance;
|
return &instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -40,6 +40,6 @@ private:
|
|||||||
std::vector<DungeonSuggestion> m_dungeonSuggestions;
|
std::vector<DungeonSuggestion> m_dungeonSuggestions;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define sPlayerbotDungeonRepository PlayerbotDungeonRepository::instance()
|
#define sPlayerbotDungeonSuggestionMgr PlayerbotDungeonSuggestionMgr::instance()
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -26,7 +26,7 @@
|
|||||||
#include "ObjectGuid.h"
|
#include "ObjectGuid.h"
|
||||||
#include "ObjectMgr.h"
|
#include "ObjectMgr.h"
|
||||||
#include "PlayerbotAIConfig.h"
|
#include "PlayerbotAIConfig.h"
|
||||||
#include "PlayerbotRepository.h"
|
#include "PlayerbotDbStore.h"
|
||||||
#include "PlayerbotFactory.h"
|
#include "PlayerbotFactory.h"
|
||||||
#include "PlayerbotOperations.h"
|
#include "PlayerbotOperations.h"
|
||||||
#include "PlayerbotSecurity.h"
|
#include "PlayerbotSecurity.h"
|
||||||
@@ -442,7 +442,7 @@ void PlayerbotHolder::DisablePlayerBot(ObjectGuid guid)
|
|||||||
Group* group = bot->GetGroup();
|
Group* group = bot->GetGroup();
|
||||||
if (group && !bot->InBattleground() && !bot->InBattlegroundQueue() && botAI->HasActivePlayerMaster())
|
if (group && !bot->InBattleground() && !bot->InBattlegroundQueue() && botAI->HasActivePlayerMaster())
|
||||||
{
|
{
|
||||||
sPlayerbotRepository->Save(botAI);
|
sPlayerbotDbStore->Save(botAI);
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG_DEBUG("playerbots", "Bot {} logged out", bot->GetName().c_str());
|
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));
|
botAI->ResetStrategies(!sRandomPlayerbotMgr->IsRandomBot(bot));
|
||||||
}
|
}
|
||||||
sPlayerbotRepository->Load(botAI);
|
sPlayerbotDbStore->Load(botAI);
|
||||||
|
|
||||||
if (master && !master->HasUnitState(UNIT_STATE_IN_FLIGHT))
|
if (master && !master->HasUnitState(UNIT_STATE_IN_FLIGHT))
|
||||||
{
|
{
|
||||||
@@ -15,7 +15,7 @@
|
|||||||
#include "Player.h"
|
#include "Player.h"
|
||||||
#include "PlayerbotAI.h"
|
#include "PlayerbotAI.h"
|
||||||
#include "PlayerbotMgr.h"
|
#include "PlayerbotMgr.h"
|
||||||
#include "PlayerbotRepository.h"
|
#include "PlayerbotDbStore.h"
|
||||||
#include "RandomPlayerbotMgr.h"
|
#include "RandomPlayerbotMgr.h"
|
||||||
#include "WorldSession.h"
|
#include "WorldSession.h"
|
||||||
#include "WorldSessionMgr.h"
|
#include "WorldSessionMgr.h"
|
||||||
@@ -418,7 +418,7 @@ public:
|
|||||||
|
|
||||||
Group* group = bot->GetGroup();
|
Group* group = bot->GetGroup();
|
||||||
if (group && !bot->InBattleground() && !bot->InBattlegroundQueue() && botAI->HasActivePlayerMaster())
|
if (group && !bot->InBattleground() && !bot->InBattlegroundQueue() && botAI->HasActivePlayerMaster())
|
||||||
sPlayerbotRepository->Save(botAI);
|
sPlayerbotDbStore->Save(botAI);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -26,11 +26,11 @@
|
|||||||
#include "PlayerScript.h"
|
#include "PlayerScript.h"
|
||||||
#include "PlayerbotAIConfig.h"
|
#include "PlayerbotAIConfig.h"
|
||||||
#include "PlayerbotGuildMgr.h"
|
#include "PlayerbotGuildMgr.h"
|
||||||
#include "PlayerbotSpellRepository.h"
|
#include "PlayerbotSpellCache.h"
|
||||||
#include "PlayerbotWorldThreadProcessor.h"
|
#include "PlayerbotWorldThreadProcessor.h"
|
||||||
#include "RandomPlayerbotMgr.h"
|
#include "RandomPlayerbotMgr.h"
|
||||||
#include "ScriptMgr.h"
|
#include "ScriptMgr.h"
|
||||||
#include "PlayerbotCommandScript.h"
|
#include "cs_playerbots.h"
|
||||||
#include "cmath"
|
#include "cmath"
|
||||||
#include "BattleGroundTactics.h"
|
#include "BattleGroundTactics.h"
|
||||||
|
|
||||||
@@ -365,7 +365,7 @@ public:
|
|||||||
LOG_INFO("server.loading", ">> Loaded playerbots config in {} ms", GetMSTimeDiffToNow(oldMSTime));
|
LOG_INFO("server.loading", ">> Loaded playerbots config in {} ms", GetMSTimeDiffToNow(oldMSTime));
|
||||||
LOG_INFO("server.loading", " ");
|
LOG_INFO("server.loading", " ");
|
||||||
|
|
||||||
sPlayerbotSpellRepository->Initialize();
|
sPlayerbotSpellCache->Initialize();
|
||||||
|
|
||||||
LOG_INFO("server.loading", "Playerbots World Thread Processor initialized");
|
LOG_INFO("server.loading", "Playerbots World Thread Processor initialized");
|
||||||
}
|
}
|
||||||
@@ -515,6 +515,6 @@ void AddPlayerbotsScripts()
|
|||||||
new PlayerbotsScript();
|
new PlayerbotsScript();
|
||||||
new PlayerBotsBGScript();
|
new PlayerBotsBGScript();
|
||||||
AddPlayerbotsSecureLoginScripts();
|
AddPlayerbotsSecureLoginScripts();
|
||||||
AddPlayerbotsCommandscripts();
|
AddSC_playerbots_commandscript();
|
||||||
PlayerBotsGuildValidationScript();
|
PlayerBotsGuildValidationScript();
|
||||||
}
|
}
|
||||||
@@ -35,7 +35,7 @@
|
|||||||
#include "NewRpgInfo.h"
|
#include "NewRpgInfo.h"
|
||||||
#include "NewRpgStrategy.h"
|
#include "NewRpgStrategy.h"
|
||||||
#include "ObjectGuid.h"
|
#include "ObjectGuid.h"
|
||||||
#include "PerfMonitor.h"
|
#include "PerformanceMonitor.h"
|
||||||
#include "Player.h"
|
#include "Player.h"
|
||||||
#include "PlayerbotAI.h"
|
#include "PlayerbotAI.h"
|
||||||
#include "PlayerbotAIConfig.h"
|
#include "PlayerbotAIConfig.h"
|
||||||
@@ -358,7 +358,7 @@ void RandomPlayerbotMgr::UpdateAIInternal(uint32 elapsed, bool /*minimal*/)
|
|||||||
if (totalPmo)
|
if (totalPmo)
|
||||||
totalPmo->finish();
|
totalPmo->finish();
|
||||||
|
|
||||||
totalPmo = sPerfMonitor->start(PERF_MON_TOTAL, "RandomPlayerbotMgr::FullTick");
|
totalPmo = sPerformanceMonitor->start(PERF_MON_TOTAL, "RandomPlayerbotMgr::FullTick");
|
||||||
|
|
||||||
if (!sPlayerbotAIConfig->randomBotAutologin || !sPlayerbotAIConfig->enabled)
|
if (!sPlayerbotAIConfig->randomBotAutologin || !sPlayerbotAIConfig->enabled)
|
||||||
return;
|
return;
|
||||||
@@ -401,7 +401,7 @@ void RandomPlayerbotMgr::UpdateAIInternal(uint32 elapsed, bool /*minimal*/)
|
|||||||
uint32 updateIntervalTurboBoost = _isBotInitializing ? 1 : sPlayerbotAIConfig->randomBotUpdateInterval;
|
uint32 updateIntervalTurboBoost = _isBotInitializing ? 1 : sPlayerbotAIConfig->randomBotUpdateInterval;
|
||||||
SetNextCheckDelay(updateIntervalTurboBoost * (onlineBotFocus + 25) * 10);
|
SetNextCheckDelay(updateIntervalTurboBoost * (onlineBotFocus + 25) * 10);
|
||||||
|
|
||||||
PerfMonitorOperation* pmo = sPerfMonitor->start(
|
PerformanceMonitorOperation* pmo = sPerformanceMonitor->start(
|
||||||
PERF_MON_TOTAL,
|
PERF_MON_TOTAL,
|
||||||
onlineBotCount < maxAllowedBotCount ? "RandomPlayerbotMgr::Login" : "RandomPlayerbotMgr::UpdateAIInternal");
|
onlineBotCount < maxAllowedBotCount ? "RandomPlayerbotMgr::Login" : "RandomPlayerbotMgr::UpdateAIInternal");
|
||||||
|
|
||||||
@@ -1707,7 +1707,7 @@ void RandomPlayerbotMgr::RandomTeleport(Player* bot, std::vector<WorldLocation>&
|
|||||||
return;
|
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());
|
std::shuffle(std::begin(tlocs), std::end(tlocs), RandomEngine::Instance());
|
||||||
for (uint32 i = 0; i < tlocs.size(); i++)
|
for (uint32 i = 0; i < tlocs.size(); i++)
|
||||||
@@ -2300,7 +2300,7 @@ void RandomPlayerbotMgr::RandomTeleport(Player* bot)
|
|||||||
if (bot->InBattleground())
|
if (bot->InBattleground())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
PerfMonitorOperation* pmo = sPerfMonitor->start(PERF_MON_RNDBOT, "RandomTeleport");
|
PerformanceMonitorOperation* pmo = sPerformanceMonitor->start(PERF_MON_RNDBOT, "RandomTeleport");
|
||||||
std::vector<WorldLocation> locs;
|
std::vector<WorldLocation> locs;
|
||||||
|
|
||||||
std::list<Unit*> targets;
|
std::list<Unit*> targets;
|
||||||
@@ -2362,7 +2362,7 @@ void RandomPlayerbotMgr::IncreaseLevel(Player* bot)
|
|||||||
if (maxLevel > sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL))
|
if (maxLevel > sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL))
|
||||||
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");
|
uint32 lastLevel = GetValue(bot, "level");
|
||||||
uint8 level = bot->GetLevel() + 1;
|
uint8 level = bot->GetLevel() + 1;
|
||||||
if (level > maxLevel)
|
if (level > maxLevel)
|
||||||
@@ -2401,7 +2401,7 @@ void RandomPlayerbotMgr::RandomizeFirst(Player* bot)
|
|||||||
minLevel = std::max(minLevel, sWorld->getIntConfig(CONFIG_START_HEROIC_PLAYER_LEVEL));
|
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;
|
uint32 level;
|
||||||
|
|
||||||
@@ -2480,7 +2480,7 @@ void RandomPlayerbotMgr::RandomizeMin(Player* bot)
|
|||||||
if (!botAI)
|
if (!botAI)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
PerfMonitorOperation* pmo = sPerfMonitor->start(PERF_MON_RNDBOT, "RandomizeMin");
|
PerformanceMonitorOperation* pmo = sPerformanceMonitor->start(PERF_MON_RNDBOT, "RandomizeMin");
|
||||||
uint32 level = sPlayerbotAIConfig->randomBotMinLevel;
|
uint32 level = sPlayerbotAIConfig->randomBotMinLevel;
|
||||||
SetValue(bot, "level", level);
|
SetValue(bot, "level", level);
|
||||||
PlayerbotFactory factory(bot, 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());
|
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();
|
botAI->Reset();
|
||||||
|
|
||||||
@@ -43,7 +43,7 @@ struct BattlegroundInfo
|
|||||||
};
|
};
|
||||||
|
|
||||||
class ChatHandler;
|
class ChatHandler;
|
||||||
class PerfMonitorOperation;
|
class PerformanceMonitorOperation;
|
||||||
class WorldLocation;
|
class WorldLocation;
|
||||||
|
|
||||||
struct CachedEvent
|
struct CachedEvent
|
||||||
@@ -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
|
|
||||||
@@ -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
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
void AddPlayerbotsCommandscripts();
|
|
||||||
@@ -45,13 +45,11 @@ void ServerFacade::SetFacingTo(Player* bot, WorldObject* wo, bool force)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
float angle = bot->GetAngle(wo);
|
float angle = bot->GetAngle(wo);
|
||||||
|
|
||||||
// if (!force && bot->isMoving())
|
// if (!force && bot->isMoving())
|
||||||
// bot->SetFacingTo(bot->GetAngle(wo));
|
// bot->SetFacingTo(bot->GetAngle(wo));
|
||||||
// else
|
// else
|
||||||
// {
|
// {
|
||||||
bot->SetOrientation(angle);
|
bot->SetOrientation(angle);
|
||||||
|
|
||||||
if (!bot->IsRooted())
|
if (!bot->IsRooted())
|
||||||
bot->SendMovementFlagUpdate();
|
bot->SendMovementFlagUpdate();
|
||||||
// }
|
// }
|
||||||
@@ -66,14 +64,16 @@ Unit* ServerFacade::GetChaseTarget(Unit* target)
|
|||||||
{
|
{
|
||||||
return static_cast<ChaseMovementGenerator<Player> const*>(movementGen)->GetTarget();
|
return static_cast<ChaseMovementGenerator<Player> const*>(movementGen)->GetTarget();
|
||||||
}
|
}
|
||||||
|
else
|
||||||
return static_cast<ChaseMovementGenerator<Creature> const*>(movementGen)->GetTarget();
|
{
|
||||||
|
return static_cast<ChaseMovementGenerator<Creature> const*>(movementGen)->GetTarget();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ServerFacade::SendPacket(Player* player, WorldPacket* packet)
|
void ServerFacade::SendPacket(Player *player, WorldPacket *packet)
|
||||||
{
|
{
|
||||||
player->GetSession()->SendPacket(packet);
|
return player->GetSession()->SendPacket(packet);
|
||||||
}
|
}
|
||||||
43
src/ServerFacade.h
Normal file
43
src/ServerFacade.h
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2016+ AzerothCore <www.azerothcore.org>, released under GNU AGPL v3 license, you may redistribute it
|
||||||
|
* and/or modify it under version 3 of the License, or (at your option), any later version.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _PLAYERBOT_SERVERFACADE_H
|
||||||
|
#define _PLAYERBOT_SERVERFACADE_H
|
||||||
|
|
||||||
|
#include "Common.h"
|
||||||
|
|
||||||
|
class Player;
|
||||||
|
class Unit;
|
||||||
|
class WorldObject;
|
||||||
|
class WorldPacket;
|
||||||
|
|
||||||
|
class ServerFacade
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
ServerFacade(){};
|
||||||
|
virtual ~ServerFacade(){};
|
||||||
|
static ServerFacade* instance()
|
||||||
|
{
|
||||||
|
static ServerFacade instance;
|
||||||
|
return &instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
public:
|
||||||
|
float GetDistance2d(Unit* unit, WorldObject* wo);
|
||||||
|
float GetDistance2d(Unit* unit, float x, float y);
|
||||||
|
bool IsDistanceLessThan(float dist1, float dist2);
|
||||||
|
bool IsDistanceGreaterThan(float dist1, float dist2);
|
||||||
|
bool IsDistanceGreaterOrEqualThan(float dist1, float dist2);
|
||||||
|
bool IsDistanceLessOrEqualThan(float dist1, float dist2);
|
||||||
|
|
||||||
|
void SetFacingTo(Player* bot, WorldObject* wo, bool force = false);
|
||||||
|
Unit* GetChaseTarget(Unit* target);
|
||||||
|
|
||||||
|
void SendPacket(Player *player, WorldPacket* packet);
|
||||||
|
};
|
||||||
|
|
||||||
|
#define sServerFacade ServerFacade::instance()
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -1,114 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2016+ AzerothCore <www.azerothcore.org>, released under GNU AGPL v3 license, you may redistribute it
|
|
||||||
* and/or modify it under version 3 of the License, or (at your option), any later version.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "Helpers.h"
|
|
||||||
|
|
||||||
#include <algorithm>
|
|
||||||
#include <cctype>
|
|
||||||
#include <cstdlib>
|
|
||||||
#include <cstring>
|
|
||||||
#include <sstream>
|
|
||||||
#include <string>
|
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Case-insensitive substring search.
|
|
||||||
*/
|
|
||||||
char* strstri(char const* haystack, char const* needle)
|
|
||||||
{
|
|
||||||
if (!*needle)
|
|
||||||
{
|
|
||||||
return (char*)haystack;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (; *haystack; ++haystack)
|
|
||||||
{
|
|
||||||
if (tolower(*haystack) == tolower(*needle))
|
|
||||||
{
|
|
||||||
char const* h = haystack;
|
|
||||||
char const* n = needle;
|
|
||||||
|
|
||||||
for (; *h && *n; ++h, ++n)
|
|
||||||
{
|
|
||||||
if (tolower(*h) != tolower(*n))
|
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!*n)
|
|
||||||
{
|
|
||||||
return (char*)haystack;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Trim whitespace from the left side of a string (in place).
|
|
||||||
*/
|
|
||||||
std::string& ltrim(std::string& s)
|
|
||||||
{
|
|
||||||
s.erase(s.begin(), std::find_if(s.begin(), s.end(), [](int c) { return !std::isspace(c); }));
|
|
||||||
return s;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Trim whitespace from the right side of a string (in place).
|
|
||||||
*/
|
|
||||||
std::string& rtrim(std::string& s)
|
|
||||||
{
|
|
||||||
s.erase(std::find_if(s.rbegin(), s.rend(), [](int c) { return !std::isspace(c); }).base(), s.end());
|
|
||||||
return s;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Trim whitespace from both ends of a string (in place).
|
|
||||||
*/
|
|
||||||
std::string& trim(std::string& s) { return ltrim(rtrim(s)); }
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Split a string using a C-string delimiter.
|
|
||||||
*/
|
|
||||||
void split(std::vector<std::string>& dest, std::string const str, char const* delim)
|
|
||||||
{
|
|
||||||
char* pTempStr = strdup(str.c_str());
|
|
||||||
char* pWord = strtok(pTempStr, delim);
|
|
||||||
|
|
||||||
while (pWord != nullptr)
|
|
||||||
{
|
|
||||||
dest.push_back(pWord);
|
|
||||||
pWord = strtok(nullptr, delim);
|
|
||||||
}
|
|
||||||
|
|
||||||
free(pTempStr);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Split a string using a single character delimiter.
|
|
||||||
*/
|
|
||||||
std::vector<std::string>& split(std::string const s, char delim, std::vector<std::string>& elems)
|
|
||||||
{
|
|
||||||
std::stringstream ss(s);
|
|
||||||
std::string item;
|
|
||||||
|
|
||||||
while (getline(ss, item, delim))
|
|
||||||
{
|
|
||||||
elems.push_back(item);
|
|
||||||
}
|
|
||||||
|
|
||||||
return elems;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Split a string using a single character delimiter.
|
|
||||||
*/
|
|
||||||
std::vector<std::string> split(std::string const s, char delim)
|
|
||||||
{
|
|
||||||
std::vector<std::string> elems;
|
|
||||||
return split(s, delim, elems);
|
|
||||||
}
|
|
||||||
@@ -1,73 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2016+ AzerothCore <www.azerothcore.org>, released under GNU AGPL v3 license, you may redistribute it
|
|
||||||
* and/or modify it under version 3 of the License, or (at your option), any later version.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef _PLAYERBOT_HELPERS_H
|
|
||||||
#define _PLAYERBOT_HELPERS_H
|
|
||||||
|
|
||||||
#include <string>
|
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Case-insensitive substring search.
|
|
||||||
*
|
|
||||||
* @param haystack The string to search in
|
|
||||||
* @param needle The substring to search for
|
|
||||||
* @return Pointer to the first matching position in haystack, or nullptr if not found.
|
|
||||||
*/
|
|
||||||
char* strstri(char const* haystack, char const* needle);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Trim whitespace from the left side of a string (in place).
|
|
||||||
*
|
|
||||||
* @param s The string to trim
|
|
||||||
* @return Reference to the modified string
|
|
||||||
*/
|
|
||||||
std::string& ltrim(std::string& s);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Trim whitespace from the right side of a string (in place).
|
|
||||||
*
|
|
||||||
* @param s The string to trim
|
|
||||||
* @return Reference to the modified string
|
|
||||||
*/
|
|
||||||
std::string& rtrim(std::string& s);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Trim whitespace from both ends of a string (in place).
|
|
||||||
*
|
|
||||||
* @param s The string to trim
|
|
||||||
* @return Reference to the modified string
|
|
||||||
*/
|
|
||||||
std::string& trim(std::string& s);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Split a string using a C-string delimiter.
|
|
||||||
*
|
|
||||||
* @param dest Vector to store split tokens
|
|
||||||
* @param str String to split
|
|
||||||
* @param delim C-string delimiter
|
|
||||||
*/
|
|
||||||
void split(std::vector<std::string>& dest, std::string const str, char const* delim);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Split a string using a single character delimiter.
|
|
||||||
*
|
|
||||||
* @param s String to split
|
|
||||||
* @param delim Delimiter character
|
|
||||||
* @param elems Vector to store split tokens
|
|
||||||
* @return Reference to the vector containing tokens
|
|
||||||
*/
|
|
||||||
std::vector<std::string>& split(std::string const s, char delim, std::vector<std::string>& elems);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Split a string using a single character delimiter.
|
|
||||||
*
|
|
||||||
* @param s String to split
|
|
||||||
* @param delim Delimiter character
|
|
||||||
* @return Vector containing split tokens
|
|
||||||
*/
|
|
||||||
std::vector<std::string> split(std::string const s, char delim);
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -1,74 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2016+ AzerothCore <www.azerothcore.org>, released under GNU AGPL v3 license, you may redistribute it
|
|
||||||
* and/or modify it under version 3 of the License, or (at your option), any later version.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef _PLAYERBOT_LAZYCALCULATEDVALUE_H
|
|
||||||
#define _PLAYERBOT_LAZYCALCULATEDVALUE_H
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Lazy calculation helper.
|
|
||||||
*
|
|
||||||
* Stores a function pointer (calculator) and its owner instance, and
|
|
||||||
* calculates the value only when it is requested for the first time.
|
|
||||||
* The result is cached until Reset() is called.
|
|
||||||
*
|
|
||||||
* @tparam TValue Type of the calculated value.
|
|
||||||
* @tparam TOwner Type of the owner class containing the calculator function.
|
|
||||||
*/
|
|
||||||
template <class TValue, class TOwner>
|
|
||||||
class LazyCalculatedValue
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
/**
|
|
||||||
* @brief Type of the calculator function.
|
|
||||||
*
|
|
||||||
* This is a pointer to a member function of TOwner returning TValue.
|
|
||||||
*/
|
|
||||||
typedef TValue (TOwner::*Calculator)();
|
|
||||||
|
|
||||||
public:
|
|
||||||
/**
|
|
||||||
* @brief Constructor.
|
|
||||||
*
|
|
||||||
* @param owner Pointer to the owner object.
|
|
||||||
* @param calculator Pointer to the member function used to calculate the value.
|
|
||||||
*/
|
|
||||||
LazyCalculatedValue(TOwner* owner, Calculator calculator) : calculator(calculator), owner(owner) { Reset(); }
|
|
||||||
|
|
||||||
public:
|
|
||||||
/**
|
|
||||||
* @brief Get the cached value or calculate it if needed.
|
|
||||||
*
|
|
||||||
* If the value has not been calculated yet, it calls the calculator
|
|
||||||
* on the owner and caches the result.
|
|
||||||
*
|
|
||||||
* @return TValue The calculated or cached value.
|
|
||||||
*/
|
|
||||||
TValue GetValue()
|
|
||||||
{
|
|
||||||
if (!calculated)
|
|
||||||
{
|
|
||||||
value = (owner->*calculator)();
|
|
||||||
calculated = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Reset the cached state.
|
|
||||||
*
|
|
||||||
* After calling Reset(), the next call to GetValue() will recalculate
|
|
||||||
* the value again.
|
|
||||||
*/
|
|
||||||
void Reset() { calculated = false; }
|
|
||||||
|
|
||||||
protected:
|
|
||||||
Calculator calculator; ///< Pointer to calculator member function
|
|
||||||
TOwner* owner; ///< Owner instance
|
|
||||||
bool calculated; ///< Whether value has already been calculated
|
|
||||||
TValue value; ///< Cached value
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -1,129 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2016+ AzerothCore <www.azerothcore.org>, released under GNU AGPL v3 license, you may redistribute it
|
|
||||||
* and/or modify it under version 3 of the License, or (at your option), any later version.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef _PLAYERBOT_SERVERFACADE_H
|
|
||||||
#define _PLAYERBOT_SERVERFACADE_H
|
|
||||||
|
|
||||||
#include "Common.h"
|
|
||||||
|
|
||||||
class Player;
|
|
||||||
class Unit;
|
|
||||||
class WorldObject;
|
|
||||||
class WorldPacket;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Provides a simplified interface to server engine operations.
|
|
||||||
*
|
|
||||||
* ServerFacade acts as a wrapper around common server functions used by
|
|
||||||
* the Playerbot system. It centralizes utility methods for distance
|
|
||||||
* calculations, facing, chase target retrieval, and packet sending.
|
|
||||||
*/
|
|
||||||
class ServerFacade
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
ServerFacade() {}
|
|
||||||
virtual ~ServerFacade() {}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Get singleton instance.
|
|
||||||
*
|
|
||||||
* @return ServerFacade* Pointer to the singleton instance.
|
|
||||||
*/
|
|
||||||
static ServerFacade* instance()
|
|
||||||
{
|
|
||||||
static ServerFacade instance;
|
|
||||||
return &instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
public:
|
|
||||||
/**
|
|
||||||
* @brief Get 2D distance between a unit and a world object.
|
|
||||||
*
|
|
||||||
* The result is rounded to one decimal place.
|
|
||||||
*
|
|
||||||
* @param unit Source unit.
|
|
||||||
* @param wo Target world object.
|
|
||||||
* @return float Distance in yards.
|
|
||||||
*/
|
|
||||||
float GetDistance2d(Unit* unit, WorldObject* wo);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Get 2D distance between a unit and coordinates.
|
|
||||||
*
|
|
||||||
* The result is rounded to one decimal place.
|
|
||||||
*
|
|
||||||
* @param unit Source unit.
|
|
||||||
* @param x Target X coordinate.
|
|
||||||
* @param y Target Y coordinate.
|
|
||||||
* @return float Distance in yards.
|
|
||||||
*/
|
|
||||||
float GetDistance2d(Unit* unit, float x, float y);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Compare two distances.
|
|
||||||
*
|
|
||||||
* @param dist1 First distance.
|
|
||||||
* @param dist2 Second distance.
|
|
||||||
* @return true if dist1 < dist2.
|
|
||||||
*/
|
|
||||||
bool IsDistanceLessThan(float dist1, float dist2);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Compare two distances.
|
|
||||||
*
|
|
||||||
* @param dist1 First distance.
|
|
||||||
* @param dist2 Second distance.
|
|
||||||
* @return true if dist1 > dist2.
|
|
||||||
*/
|
|
||||||
bool IsDistanceGreaterThan(float dist1, float dist2);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Compare two distances.
|
|
||||||
*
|
|
||||||
* @param dist1 First distance.
|
|
||||||
* @param dist2 Second distance.
|
|
||||||
* @return true if dist1 >= dist2.
|
|
||||||
*/
|
|
||||||
bool IsDistanceGreaterOrEqualThan(float dist1, float dist2);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Compare two distances.
|
|
||||||
*
|
|
||||||
* @param dist1 First distance.
|
|
||||||
* @param dist2 Second distance.
|
|
||||||
* @return true if dist1 <= dist2.
|
|
||||||
*/
|
|
||||||
bool IsDistanceLessOrEqualThan(float dist1, float dist2);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Set bot facing towards a world object.
|
|
||||||
*
|
|
||||||
* @param bot Player bot to rotate.
|
|
||||||
* @param wo Target world object.
|
|
||||||
* @param force If true, force facing even while moving.
|
|
||||||
*/
|
|
||||||
void SetFacingTo(Player* bot, WorldObject* wo, bool force = false);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Get the current chase target of a unit.
|
|
||||||
*
|
|
||||||
* @param target Unit that is chasing.
|
|
||||||
* @return Unit* The chase target, or nullptr if not chasing.
|
|
||||||
*/
|
|
||||||
Unit* GetChaseTarget(Unit* target);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Send a raw packet to a player.
|
|
||||||
*
|
|
||||||
* @param player Player to receive the packet.
|
|
||||||
* @param packet Packet to send.
|
|
||||||
*/
|
|
||||||
void SendPacket(Player* player, WorldPacket* packet);
|
|
||||||
};
|
|
||||||
|
|
||||||
/** Global singleton accessor. */
|
|
||||||
#define sServerFacade ServerFacade::instance()
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -16,7 +16,7 @@
|
|||||||
#include "BattleGroundTactics.h"
|
#include "BattleGroundTactics.h"
|
||||||
#include "Chat.h"
|
#include "Chat.h"
|
||||||
#include "GuildTaskMgr.h"
|
#include "GuildTaskMgr.h"
|
||||||
#include "PerfMonitor.h"
|
#include "PerformanceMonitor.h"
|
||||||
#include "PlayerbotMgr.h"
|
#include "PlayerbotMgr.h"
|
||||||
#include "RandomPlayerbotMgr.h"
|
#include "RandomPlayerbotMgr.h"
|
||||||
#include "ScriptMgr.h"
|
#include "ScriptMgr.h"
|
||||||
@@ -76,19 +76,19 @@ public:
|
|||||||
{
|
{
|
||||||
if (!strcmp(args, "reset"))
|
if (!strcmp(args, "reset"))
|
||||||
{
|
{
|
||||||
sPerfMonitor->Reset();
|
sPerformanceMonitor->Reset();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!strcmp(args, "tick"))
|
if (!strcmp(args, "tick"))
|
||||||
{
|
{
|
||||||
sPerfMonitor->PrintStats(true, false);
|
sPerformanceMonitor->PrintStats(true, false);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!strcmp(args, "stack"))
|
if (!strcmp(args, "stack"))
|
||||||
{
|
{
|
||||||
sPerfMonitor->PrintStats(false, true);
|
sPerformanceMonitor->PrintStats(false, true);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -102,7 +102,7 @@ public:
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
sPerfMonitor->PrintStats();
|
sPerformanceMonitor->PrintStats();
|
||||||
return true;
|
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
1
src/cs_playerbots.h
Normal file
@@ -0,0 +1 @@
|
|||||||
|
void AddSC_playerbots_commandscript();
|
||||||
@@ -1,10 +1,9 @@
|
|||||||
#include "PlayerbotSpellRepository.h"
|
#include "PlayerbotSpellCache.h"
|
||||||
|
|
||||||
// caches the result set
|
void PlayerbotSpellCache::Initialize()
|
||||||
void PlayerbotSpellRepository::Initialize()
|
|
||||||
{
|
{
|
||||||
LOG_INFO("playerbots", "Playerbots: ListSpellsAction caches initialized");
|
LOG_INFO("playerbots",
|
||||||
|
"Playerbots: ListSpellsAction caches initialized");
|
||||||
for (uint32 j = 0; j < sSkillLineAbilityStore.GetNumRows(); ++j)
|
for (uint32 j = 0; j < sSkillLineAbilityStore.GetNumRows(); ++j)
|
||||||
{
|
{
|
||||||
if (SkillLineAbilityEntry const* skillLine = sSkillLineAbilityStore.LookupEntry(j))
|
if (SkillLineAbilityEntry const* skillLine = sSkillLineAbilityStore.LookupEntry(j))
|
||||||
@@ -32,7 +31,7 @@ void PlayerbotSpellRepository::Initialize()
|
|||||||
skillSpells.size(), vendorItems.size());
|
skillSpells.size(), vendorItems.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
SkillLineAbilityEntry const* PlayerbotSpellRepository::GetSkillLine(uint32 spellId) const
|
SkillLineAbilityEntry const* PlayerbotSpellCache::GetSkillLine(uint32 spellId) const
|
||||||
{
|
{
|
||||||
auto itr = skillSpells.find(spellId);
|
auto itr = skillSpells.find(spellId);
|
||||||
if (itr != skillSpells.end())
|
if (itr != skillSpells.end())
|
||||||
@@ -40,7 +39,7 @@ SkillLineAbilityEntry const* PlayerbotSpellRepository::GetSkillLine(uint32 spell
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PlayerbotSpellRepository::IsItemBuyable(uint32 itemId) const
|
bool PlayerbotSpellCache::IsItemBuyable(uint32 itemId) const
|
||||||
{
|
{
|
||||||
return vendorItems.find(itemId) != vendorItems.end();
|
return vendorItems.find(itemId) != vendorItems.end();
|
||||||
}
|
}
|
||||||
@@ -3,17 +3,17 @@
|
|||||||
* and/or modify it under version 3 of the License, or (at your option), any later version.
|
* and/or modify it under version 3 of the License, or (at your option), any later version.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _PLAYERBOT_PLAYERBOTSPELLREPOSITORY_H
|
#ifndef _PLAYERBOT_PLAYERBOTSPELLCACHE_H
|
||||||
#define _PLAYERBOT_PLAYERBOTSPELLREPOSITORY_H
|
#define _PLAYERBOT_PLAYERBOTSPELLCACHE_H
|
||||||
|
|
||||||
#include "Playerbots.h"
|
#include "Playerbots.h"
|
||||||
|
|
||||||
class PlayerbotSpellRepository
|
class PlayerbotSpellCache
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static PlayerbotSpellRepository* Instance()
|
static PlayerbotSpellCache* Instance()
|
||||||
{
|
{
|
||||||
static PlayerbotSpellRepository instance;
|
static PlayerbotSpellCache instance;
|
||||||
return &instance;
|
return &instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -23,12 +23,12 @@ public:
|
|||||||
bool IsItemBuyable(uint32 itemId) const;
|
bool IsItemBuyable(uint32 itemId) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
PlayerbotSpellRepository() = default;
|
PlayerbotSpellCache() = default;
|
||||||
|
|
||||||
std::map<uint32, SkillLineAbilityEntry const*> skillSpells;
|
std::map<uint32, SkillLineAbilityEntry const*> skillSpells;
|
||||||
std::set<uint32> vendorItems;
|
std::set<uint32> vendorItems;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define sPlayerbotSpellRepository PlayerbotSpellRepository::Instance()
|
#define sPlayerbotSpellCache PlayerbotSpellCache::Instance()
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -24,12 +24,12 @@
|
|||||||
#include "LootMgr.h"
|
#include "LootMgr.h"
|
||||||
#include "MapMgr.h"
|
#include "MapMgr.h"
|
||||||
#include "ObjectMgr.h"
|
#include "ObjectMgr.h"
|
||||||
#include "PerfMonitor.h"
|
#include "PerformanceMonitor.h"
|
||||||
#include "PetDefines.h"
|
#include "PetDefines.h"
|
||||||
#include "Player.h"
|
#include "Player.h"
|
||||||
#include "PlayerbotAI.h"
|
#include "PlayerbotAI.h"
|
||||||
#include "PlayerbotAIConfig.h"
|
#include "PlayerbotAIConfig.h"
|
||||||
#include "PlayerbotRepository.h"
|
#include "PlayerbotDbStore.h"
|
||||||
#include "PlayerbotGuildMgr.h"
|
#include "PlayerbotGuildMgr.h"
|
||||||
#include "Playerbots.h"
|
#include "Playerbots.h"
|
||||||
#include "QuestDef.h"
|
#include "QuestDef.h"
|
||||||
@@ -240,7 +240,7 @@ void PlayerbotFactory::Randomize(bool incremental)
|
|||||||
// LOG_DEBUG("playerbots", "Preparing to {} randomize...", (incremental ? "incremental" : "full"));
|
// LOG_DEBUG("playerbots", "Preparing to {} randomize...", (incremental ? "incremental" : "full"));
|
||||||
Prepare();
|
Prepare();
|
||||||
LOG_DEBUG("playerbots", "Resetting player...");
|
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)
|
if (!sPlayerbotAIConfig->equipmentPersistence || level < sPlayerbotAIConfig->equipmentPersistenceLevel)
|
||||||
{
|
{
|
||||||
bot->resetTalents(true);
|
bot->resetTalents(true);
|
||||||
@@ -266,7 +266,7 @@ void PlayerbotFactory::Randomize(bool incremental)
|
|||||||
if (pmo)
|
if (pmo)
|
||||||
pmo->finish();
|
pmo->finish();
|
||||||
|
|
||||||
// pmo = sPerfMonitor->start(PERF_MON_RNDBOT, "PlayerbotFactory_Immersive");
|
// pmo = sPerformanceMonitor->start(PERF_MON_RNDBOT, "PlayerbotFactory_Immersive");
|
||||||
// LOG_INFO("playerbots", "Initializing immersive...");
|
// LOG_INFO("playerbots", "Initializing immersive...");
|
||||||
// InitImmersive();
|
// InitImmersive();
|
||||||
// if (pmo)
|
// if (pmo)
|
||||||
@@ -274,7 +274,7 @@ void PlayerbotFactory::Randomize(bool incremental)
|
|||||||
|
|
||||||
if (sPlayerbotAIConfig->randomBotPreQuests)
|
if (sPlayerbotAIConfig->randomBotPreQuests)
|
||||||
{
|
{
|
||||||
pmo = sPerfMonitor->start(PERF_MON_RNDBOT, "PlayerbotFactory_Quests");
|
pmo = sPerformanceMonitor->start(PERF_MON_RNDBOT, "PlayerbotFactory_Quests");
|
||||||
InitInstanceQuests();
|
InitInstanceQuests();
|
||||||
InitAttunementQuests();
|
InitAttunementQuests();
|
||||||
if (pmo)
|
if (pmo)
|
||||||
@@ -282,27 +282,27 @@ void PlayerbotFactory::Randomize(bool incremental)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
pmo = sPerfMonitor->start(PERF_MON_RNDBOT, "PlayerbotFactory_Quests");
|
pmo = sPerformanceMonitor->start(PERF_MON_RNDBOT, "PlayerbotFactory_Quests");
|
||||||
InitAttunementQuests();
|
InitAttunementQuests();
|
||||||
if (pmo)
|
if (pmo)
|
||||||
pmo->finish();
|
pmo->finish();
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG_DEBUG("playerbots", "Initializing skills (step 1)...");
|
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();
|
bot->LearnDefaultSkills();
|
||||||
InitSkills();
|
InitSkills();
|
||||||
if (pmo)
|
if (pmo)
|
||||||
pmo->finish();
|
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)...");
|
LOG_DEBUG("playerbots", "Initializing spells (step 1)...");
|
||||||
InitClassSpells();
|
InitClassSpells();
|
||||||
InitAvailableSpells();
|
InitAvailableSpells();
|
||||||
if (pmo)
|
if (pmo)
|
||||||
pmo->finish();
|
pmo->finish();
|
||||||
|
|
||||||
pmo = sPerfMonitor->start(PERF_MON_RNDBOT, "PlayerbotFactory_Talents");
|
pmo = sPerformanceMonitor->start(PERF_MON_RNDBOT, "PlayerbotFactory_Talents");
|
||||||
LOG_DEBUG("playerbots", "Initializing talents...");
|
LOG_DEBUG("playerbots", "Initializing talents...");
|
||||||
if (!incremental || !sPlayerbotAIConfig->equipmentPersistence ||
|
if (!incremental || !sPlayerbotAIConfig->equipmentPersistence ||
|
||||||
bot->GetLevel() < sPlayerbotAIConfig->equipmentPersistenceLevel)
|
bot->GetLevel() < sPlayerbotAIConfig->equipmentPersistenceLevel)
|
||||||
@@ -312,45 +312,45 @@ void PlayerbotFactory::Randomize(bool incremental)
|
|||||||
sRandomPlayerbotMgr->SetValue(bot->GetGUID().GetCounter(), "specNo", 0);
|
sRandomPlayerbotMgr->SetValue(bot->GetGUID().GetCounter(), "specNo", 0);
|
||||||
if (botAI)
|
if (botAI)
|
||||||
{
|
{
|
||||||
sPlayerbotRepository->Reset(botAI);
|
sPlayerbotDbStore->Reset(botAI);
|
||||||
// botAI->DoSpecificAction("auto talents");
|
// botAI->DoSpecificAction("auto talents");
|
||||||
botAI->ResetStrategies(false); // fix wrong stored strategy
|
botAI->ResetStrategies(false); // fix wrong stored strategy
|
||||||
}
|
}
|
||||||
if (pmo)
|
if (pmo)
|
||||||
pmo->finish();
|
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)...");
|
LOG_DEBUG("playerbots", "Initializing spells (step 2)...");
|
||||||
InitAvailableSpells();
|
InitAvailableSpells();
|
||||||
if (pmo)
|
if (pmo)
|
||||||
pmo->finish();
|
pmo->finish();
|
||||||
|
|
||||||
pmo = sPerfMonitor->start(PERF_MON_RNDBOT, "PlayerbotFactory_Reputation");
|
pmo = sPerformanceMonitor->start(PERF_MON_RNDBOT, "PlayerbotFactory_Reputation");
|
||||||
LOG_DEBUG("playerbots", "Initializing reputation...");
|
LOG_DEBUG("playerbots", "Initializing reputation...");
|
||||||
InitReputation();
|
InitReputation();
|
||||||
if (pmo)
|
if (pmo)
|
||||||
pmo->finish();
|
pmo->finish();
|
||||||
|
|
||||||
LOG_DEBUG("playerbots", "Initializing special spells...");
|
LOG_DEBUG("playerbots", "Initializing special spells...");
|
||||||
pmo = sPerfMonitor->start(PERF_MON_RNDBOT, "PlayerbotFactory_Spells3");
|
pmo = sPerformanceMonitor->start(PERF_MON_RNDBOT, "PlayerbotFactory_Spells3");
|
||||||
InitSpecialSpells();
|
InitSpecialSpells();
|
||||||
if (pmo)
|
if (pmo)
|
||||||
pmo->finish();
|
pmo->finish();
|
||||||
|
|
||||||
pmo = sPerfMonitor->start(PERF_MON_RNDBOT, "PlayerbotFactory_Mounts");
|
pmo = sPerformanceMonitor->start(PERF_MON_RNDBOT, "PlayerbotFactory_Mounts");
|
||||||
LOG_DEBUG("playerbots", "Initializing mounts...");
|
LOG_DEBUG("playerbots", "Initializing mounts...");
|
||||||
InitMounts();
|
InitMounts();
|
||||||
// bot->SaveToDB(false, false);
|
// bot->SaveToDB(false, false);
|
||||||
if (pmo)
|
if (pmo)
|
||||||
pmo->finish();
|
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)...");
|
// LOG_INFO("playerbots", "Initializing skills (step 2)...");
|
||||||
// UpdateTradeSkills();
|
// UpdateTradeSkills();
|
||||||
// if (pmo)
|
// if (pmo)
|
||||||
// pmo->finish();
|
// pmo->finish();
|
||||||
|
|
||||||
pmo = sPerfMonitor->start(PERF_MON_RNDBOT, "PlayerbotFactory_Equip");
|
pmo = sPerformanceMonitor->start(PERF_MON_RNDBOT, "PlayerbotFactory_Equip");
|
||||||
LOG_DEBUG("playerbots", "Initializing equipmemt...");
|
LOG_DEBUG("playerbots", "Initializing equipmemt...");
|
||||||
if (!incremental || !sPlayerbotAIConfig->equipmentPersistence ||
|
if (!incremental || !sPlayerbotAIConfig->equipmentPersistence ||
|
||||||
bot->GetLevel() < sPlayerbotAIConfig->equipmentPersistenceLevel)
|
bot->GetLevel() < sPlayerbotAIConfig->equipmentPersistenceLevel)
|
||||||
@@ -364,51 +364,51 @@ void PlayerbotFactory::Randomize(bool incremental)
|
|||||||
|
|
||||||
// if (bot->GetLevel() >= sPlayerbotAIConfig->minEnchantingBotLevel)
|
// 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...");
|
// LOG_INFO("playerbots", "Initializing enchant templates...");
|
||||||
// LoadEnchantContainer();
|
// LoadEnchantContainer();
|
||||||
// if (pmo)
|
// if (pmo)
|
||||||
// pmo->finish();
|
// pmo->finish();
|
||||||
// }
|
// }
|
||||||
|
|
||||||
pmo = sPerfMonitor->start(PERF_MON_RNDBOT, "PlayerbotFactory_Bags");
|
pmo = sPerformanceMonitor->start(PERF_MON_RNDBOT, "PlayerbotFactory_Bags");
|
||||||
LOG_DEBUG("playerbots", "Initializing bags...");
|
LOG_DEBUG("playerbots", "Initializing bags...");
|
||||||
InitBags();
|
InitBags();
|
||||||
// bot->SaveToDB(false, false);
|
// bot->SaveToDB(false, false);
|
||||||
if (pmo)
|
if (pmo)
|
||||||
pmo->finish();
|
pmo->finish();
|
||||||
|
|
||||||
pmo = sPerfMonitor->start(PERF_MON_RNDBOT, "PlayerbotFactory_Ammo");
|
pmo = sPerformanceMonitor->start(PERF_MON_RNDBOT, "PlayerbotFactory_Ammo");
|
||||||
LOG_DEBUG("playerbots", "Initializing ammo...");
|
LOG_DEBUG("playerbots", "Initializing ammo...");
|
||||||
InitAmmo();
|
InitAmmo();
|
||||||
if (pmo)
|
if (pmo)
|
||||||
pmo->finish();
|
pmo->finish();
|
||||||
|
|
||||||
pmo = sPerfMonitor->start(PERF_MON_RNDBOT, "PlayerbotFactory_Food");
|
pmo = sPerformanceMonitor->start(PERF_MON_RNDBOT, "PlayerbotFactory_Food");
|
||||||
LOG_DEBUG("playerbots", "Initializing food...");
|
LOG_DEBUG("playerbots", "Initializing food...");
|
||||||
InitFood();
|
InitFood();
|
||||||
if (pmo)
|
if (pmo)
|
||||||
pmo->finish();
|
pmo->finish();
|
||||||
|
|
||||||
pmo = sPerfMonitor->start(PERF_MON_RNDBOT, "PlayerbotFactory_Potions");
|
pmo = sPerformanceMonitor->start(PERF_MON_RNDBOT, "PlayerbotFactory_Potions");
|
||||||
LOG_DEBUG("playerbots", "Initializing potions...");
|
LOG_DEBUG("playerbots", "Initializing potions...");
|
||||||
InitPotions();
|
InitPotions();
|
||||||
if (pmo)
|
if (pmo)
|
||||||
pmo->finish();
|
pmo->finish();
|
||||||
|
|
||||||
pmo = sPerfMonitor->start(PERF_MON_RNDBOT, "PlayerbotFactory_Reagents");
|
pmo = sPerformanceMonitor->start(PERF_MON_RNDBOT, "PlayerbotFactory_Reagents");
|
||||||
LOG_DEBUG("playerbots", "Initializing reagents...");
|
LOG_DEBUG("playerbots", "Initializing reagents...");
|
||||||
InitReagents();
|
InitReagents();
|
||||||
if (pmo)
|
if (pmo)
|
||||||
pmo->finish();
|
pmo->finish();
|
||||||
|
|
||||||
pmo = sPerfMonitor->start(PERF_MON_RNDBOT, "PlayerbotFactory_Keys");
|
pmo = sPerformanceMonitor->start(PERF_MON_RNDBOT, "PlayerbotFactory_Keys");
|
||||||
LOG_DEBUG("playerbots", "Initializing keys...");
|
LOG_DEBUG("playerbots", "Initializing keys...");
|
||||||
InitKeyring();
|
InitKeyring();
|
||||||
if (pmo)
|
if (pmo)
|
||||||
pmo->finish();
|
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...");
|
// LOG_DEBUG("playerbots", "Initializing second equipment set...");
|
||||||
// InitSecondEquipmentSet();
|
// InitSecondEquipmentSet();
|
||||||
// if (pmo)
|
// if (pmo)
|
||||||
@@ -419,20 +419,20 @@ void PlayerbotFactory::Randomize(bool incremental)
|
|||||||
ApplyEnchantAndGemsNew();
|
ApplyEnchantAndGemsNew();
|
||||||
}
|
}
|
||||||
// {
|
// {
|
||||||
// pmo = sPerfMonitor->start(PERF_MON_RNDBOT, "PlayerbotFactory_EnchantTemplate");
|
// pmo = sPerformanceMonitor->start(PERF_MON_RNDBOT, "PlayerbotFactory_EnchantTemplate");
|
||||||
// LOG_INFO("playerbots", "Initializing enchant templates...");
|
// LOG_INFO("playerbots", "Initializing enchant templates...");
|
||||||
// ApplyEnchantTemplate();
|
// ApplyEnchantTemplate();
|
||||||
// if (pmo)
|
// if (pmo)
|
||||||
// pmo->finish();
|
// pmo->finish();
|
||||||
// }
|
// }
|
||||||
|
|
||||||
pmo = sPerfMonitor->start(PERF_MON_RNDBOT, "PlayerbotFactory_Inventory");
|
pmo = sPerformanceMonitor->start(PERF_MON_RNDBOT, "PlayerbotFactory_Inventory");
|
||||||
LOG_DEBUG("playerbots", "Initializing inventory...");
|
LOG_DEBUG("playerbots", "Initializing inventory...");
|
||||||
// InitInventory();
|
// InitInventory();
|
||||||
if (pmo)
|
if (pmo)
|
||||||
pmo->finish();
|
pmo->finish();
|
||||||
|
|
||||||
pmo = sPerfMonitor->start(PERF_MON_RNDBOT, "PlayerbotFactory_Consumable");
|
pmo = sPerformanceMonitor->start(PERF_MON_RNDBOT, "PlayerbotFactory_Consumable");
|
||||||
LOG_DEBUG("playerbots", "Initializing consumables...");
|
LOG_DEBUG("playerbots", "Initializing consumables...");
|
||||||
InitConsumables();
|
InitConsumables();
|
||||||
if (pmo)
|
if (pmo)
|
||||||
@@ -442,7 +442,7 @@ void PlayerbotFactory::Randomize(bool incremental)
|
|||||||
InitGlyphs();
|
InitGlyphs();
|
||||||
// bot->SaveToDB(false, false);
|
// bot->SaveToDB(false, false);
|
||||||
|
|
||||||
pmo = sPerfMonitor->start(PERF_MON_RNDBOT, "PlayerbotFactory_Guilds");
|
pmo = sPerformanceMonitor->start(PERF_MON_RNDBOT, "PlayerbotFactory_Guilds");
|
||||||
// bot->SaveToDB(false, false);
|
// bot->SaveToDB(false, false);
|
||||||
if (sPlayerbotAIConfig->randomBotGuildCount > 0)
|
if (sPlayerbotAIConfig->randomBotGuildCount > 0)
|
||||||
{
|
{
|
||||||
@@ -455,7 +455,7 @@ void PlayerbotFactory::Randomize(bool incremental)
|
|||||||
|
|
||||||
if (bot->GetLevel() >= 70)
|
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...");
|
// LOG_INFO("playerbots", "Initializing arena teams...");
|
||||||
InitArenaTeam();
|
InitArenaTeam();
|
||||||
if (pmo)
|
if (pmo)
|
||||||
@@ -470,7 +470,7 @@ void PlayerbotFactory::Randomize(bool incremental)
|
|||||||
}
|
}
|
||||||
if (bot->GetLevel() >= 10)
|
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...");
|
LOG_DEBUG("playerbots", "Initializing pet...");
|
||||||
InitPet();
|
InitPet();
|
||||||
// bot->SaveToDB(false, false);
|
// bot->SaveToDB(false, false);
|
||||||
@@ -479,7 +479,7 @@ void PlayerbotFactory::Randomize(bool incremental)
|
|||||||
pmo->finish();
|
pmo->finish();
|
||||||
}
|
}
|
||||||
|
|
||||||
pmo = sPerfMonitor->start(PERF_MON_RNDBOT, "PlayerbotFactory_Save");
|
pmo = sPerformanceMonitor->start(PERF_MON_RNDBOT, "PlayerbotFactory_Save");
|
||||||
LOG_DEBUG("playerbots", "Saving to DB...");
|
LOG_DEBUG("playerbots", "Saving to DB...");
|
||||||
bot->SetMoney(urand(level * 100000, level * 5 * 100000));
|
bot->SetMoney(urand(level * 100000, level * 5 * 100000));
|
||||||
bot->SetHealth(bot->GetMaxHealth());
|
bot->SetHealth(bot->GetMaxHealth());
|
||||||
@@ -27,32 +27,32 @@
|
|||||||
#include "WarriorAiObjectContext.h"
|
#include "WarriorAiObjectContext.h"
|
||||||
#include "WorldPacketActionContext.h"
|
#include "WorldPacketActionContext.h"
|
||||||
#include "WorldPacketTriggerContext.h"
|
#include "WorldPacketTriggerContext.h"
|
||||||
#include "Scenario/DungeonAi/DungeonStrategyContext.h"
|
#include "dungeons/DungeonStrategyContext.h"
|
||||||
#include "Scenario/DungeonAi/WotlkDungeonActionContext.h"
|
#include "dungeons/wotlk/WotlkDungeonActionContext.h"
|
||||||
#include "Scenario/DungeonAi/WotlkDungeonTriggerContext.h"
|
#include "dungeons/wotlk/WotlkDungeonTriggerContext.h"
|
||||||
#include "Scenario/RaidAi/RaidStrategyContext.h"
|
#include "raids/RaidStrategyContext.h"
|
||||||
#include "Scenario/RaidAi/Aq20/RaidAq20ActionContext.h"
|
#include "raids/aq20/RaidAq20ActionContext.h"
|
||||||
#include "Scenario/RaidAi/Aq20/RaidAq20TriggerContext.h"
|
#include "raids/aq20/RaidAq20TriggerContext.h"
|
||||||
#include "Scenario/RaidAi/MoltenCore/RaidMcActionContext.h"
|
#include "raids/moltencore/RaidMcActionContext.h"
|
||||||
#include "Scenario/RaidAi/MoltenCore/RaidMcTriggerContext.h"
|
#include "raids/moltencore/RaidMcTriggerContext.h"
|
||||||
#include "Scenario/RaidAi/BlackwingLair/RaidBwlActionContext.h"
|
#include "raids/blackwinglair/RaidBwlActionContext.h"
|
||||||
#include "Scenario/RaidAi/BlackwingLair/RaidBwlTriggerContext.h"
|
#include "raids/blackwinglair/RaidBwlTriggerContext.h"
|
||||||
#include "Scenario/RaidAi/Karazhan/RaidKarazhanActionContext.h"
|
#include "raids/karazhan/RaidKarazhanActionContext.h"
|
||||||
#include "Scenario/RaidAi/Karazhan/RaidKarazhanTriggerContext.h"
|
#include "raids/karazhan/RaidKarazhanTriggerContext.h"
|
||||||
#include "Scenario/RaidAi/Magtheridon/RaidMagtheridonActionContext.h"
|
#include "raids/magtheridon/RaidMagtheridonActionContext.h"
|
||||||
#include "Scenario/RaidAi/Magtheridon/RaidMagtheridonTriggerContext.h"
|
#include "raids/magtheridon/RaidMagtheridonTriggerContext.h"
|
||||||
#include "Scenario/RaidAi/GruulsLair/RaidGruulsLairActionContext.h"
|
#include "raids/gruulslair/RaidGruulsLairActionContext.h"
|
||||||
#include "Scenario/RaidAi/GruulsLair/RaidGruulsLairTriggerContext.h"
|
#include "raids/gruulslair/RaidGruulsLairTriggerContext.h"
|
||||||
#include "Scenario/RaidAi/EyeOfEternity/RaidEoEActionContext.h"
|
#include "raids/eyeofeternity/RaidEoEActionContext.h"
|
||||||
#include "Scenario/RaidAi/EyeOfEternity/RaidEoETriggerContext.h"
|
#include "raids/eyeofeternity/RaidEoETriggerContext.h"
|
||||||
#include "Scenario/RaidAi/VaultOfArchavon/RaidVoAActionContext.h"
|
#include "raids/vaultofarchavon/RaidVoAActionContext.h"
|
||||||
#include "Scenario/RaidAi/VaultOfArchavon/RaidVoATriggerContext.h"
|
#include "raids/vaultofarchavon/RaidVoATriggerContext.h"
|
||||||
#include "Scenario/RaidAi/ObsidianSanctum/RaidOsActionContext.h"
|
#include "raids/obsidiansanctum/RaidOsActionContext.h"
|
||||||
#include "Scenario/RaidAi/ObsidianSanctum/RaidOsTriggerContext.h"
|
#include "raids/obsidiansanctum/RaidOsTriggerContext.h"
|
||||||
#include "Scenario/RaidAi/Onyxia/RaidOnyxiaActionContext.h"
|
#include "raids/onyxia/RaidOnyxiaActionContext.h"
|
||||||
#include "Scenario/RaidAi/Onyxia/RaidOnyxiaTriggerContext.h"
|
#include "raids/onyxia/RaidOnyxiaTriggerContext.h"
|
||||||
#include "Scenario/RaidAi/Icecrown/RaidIccActionContext.h"
|
#include "raids/icecrown/RaidIccActionContext.h"
|
||||||
#include "Scenario/RaidAi/Icecrown/RaidIccTriggerContext.h"
|
#include "raids/icecrown/RaidIccTriggerContext.h"
|
||||||
|
|
||||||
SharedNamedObjectContextList<Strategy> AiObjectContext::sharedStrategyContexts;
|
SharedNamedObjectContextList<Strategy> AiObjectContext::sharedStrategyContexts;
|
||||||
SharedNamedObjectContextList<Action> AiObjectContext::sharedActionContexts;
|
SharedNamedObjectContextList<Action> AiObjectContext::sharedActionContexts;
|
||||||
@@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
#include "Action.h"
|
#include "Action.h"
|
||||||
#include "Event.h"
|
#include "Event.h"
|
||||||
#include "PerfMonitor.h"
|
#include "PerformanceMonitor.h"
|
||||||
#include "Playerbots.h"
|
#include "Playerbots.h"
|
||||||
#include "Queue.h"
|
#include "Queue.h"
|
||||||
#include "Strategy.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);
|
actionExecuted = ListenAndExecute(action, event);
|
||||||
if (pmo)
|
if (pmo)
|
||||||
pmo->finish();
|
pmo->finish();
|
||||||
@@ -456,8 +456,8 @@ void Engine::ProcessTriggers(bool minimal)
|
|||||||
if (minimal && node->getFirstRelevance() < 100)
|
if (minimal && node->getFirstRelevance() < 100)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
PerfMonitorOperation* pmo =
|
PerformanceMonitorOperation* pmo =
|
||||||
sPerfMonitor->start(PERF_MON_TRIGGER, trigger->getName(), &aiObjectContext->performanceStack);
|
sPerformanceMonitor->start(PERF_MON_TRIGGER, trigger->getName(), &aiObjectContext->performanceStack);
|
||||||
Event event = trigger->Check();
|
Event event = trigger->Check();
|
||||||
if (pmo)
|
if (pmo)
|
||||||
pmo->finish();
|
pmo->finish();
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user