refactor(Core/Misc): acore to Acore (#6043)

This commit is contained in:
Kitzunu
2021-05-31 14:21:54 +02:00
committed by GitHub
parent 7eeae6866e
commit 897a02bb75
224 changed files with 942 additions and 942 deletions
+1 -1
View File
@@ -98,7 +98,7 @@ def processFile(path, filename):
output.write('#include "SmartEnum.h"\n') output.write('#include "SmartEnum.h"\n')
output.write('#include <stdexcept>\n') output.write('#include <stdexcept>\n')
output.write('\n') output.write('\n')
output.write('namespace acore::Impl::EnumUtilsImpl\n') output.write('namespace Acore::Impl::EnumUtilsImpl\n')
output.write('{\n') output.write('{\n')
for name, prefix, values in enums: for name, prefix, values in enums:
tag = ('data for enum \'%s\' in \'%s.h\' auto-generated' % (name, filename)) tag = ('data for enum \'%s\' in \'%s.h\' auto-generated' % (name, filename))
+1 -1
View File
@@ -33,7 +33,7 @@ namespace boost::asio::ip
typedef basic_endpoint<tcp> tcp_endpoint; typedef basic_endpoint<tcp> tcp_endpoint;
} }
namespace acore::Asio namespace Acore::Asio
{ {
class DeadlineTimer; class DeadlineTimer;
class IoContext; class IoContext;
+1 -1
View File
@@ -18,7 +18,7 @@
#define DeadlineTimerBase boost::asio::basic_deadline_timer<boost::posix_time::ptime, boost::asio::time_traits<boost::posix_time::ptime> BasicDeadlineTimerThirdTemplateArg> #define DeadlineTimerBase boost::asio::basic_deadline_timer<boost::posix_time::ptime, boost::asio::time_traits<boost::posix_time::ptime> BasicDeadlineTimerThirdTemplateArg>
namespace acore::Asio namespace Acore::Asio
{ {
class DeadlineTimer : public DeadlineTimerBase class DeadlineTimer : public DeadlineTimerBase
{ {
+1 -1
View File
@@ -19,7 +19,7 @@
#define IoContextBase io_service #define IoContextBase io_service
#endif #endif
namespace acore::Asio namespace Acore::Asio
{ {
class IoContext class IoContext
{ {
+1 -1
View File
@@ -9,7 +9,7 @@
#include "Define.h" #include "Define.h"
#include <boost/asio/ip/address.hpp> #include <boost/asio/ip/address.hpp>
namespace acore::Net namespace Acore::Net
{ {
#if BOOST_VERSION >= 106600 #if BOOST_VERSION >= 106600
using boost::asio::ip::make_address; using boost::asio::ip::make_address;
+1 -1
View File
@@ -15,7 +15,7 @@
#include <boost/asio/ip/network_v6.hpp> #include <boost/asio/ip/network_v6.hpp>
#endif #endif
namespace acore::Net namespace Acore::Net
{ {
inline bool IsInNetwork(boost::asio::ip::address_v4 const& networkAddress, boost::asio::ip::address_v4 const& mask, boost::asio::ip::address_v4 const& clientAddress) inline bool IsInNetwork(boost::asio::ip::address_v4 const& networkAddress, boost::asio::ip::address_v4 const& mask, boost::asio::ip::address_v4 const& clientAddress)
{ {
+1 -1
View File
@@ -11,7 +11,7 @@
#include <boost/asio/ip/tcp.hpp> #include <boost/asio/ip/tcp.hpp>
#include <string> #include <string>
namespace acore::Asio namespace Acore::Asio
{ {
/** /**
Hack to make it possible to forward declare resolver (one of its template arguments is a typedef to something super long and using nested classes) Hack to make it possible to forward declare resolver (one of its template arguments is a typedef to something super long and using nested classes)
+1 -1
View File
@@ -13,7 +13,7 @@
#include <boost/asio/bind_executor.hpp> #include <boost/asio/bind_executor.hpp>
#endif #endif
namespace acore::Asio namespace Acore::Asio
{ {
/** /**
Hack to make it possible to forward declare strand (which is a inner class) Hack to make it possible to forward declare strand (which is a inner class)
+2 -2
View File
@@ -6,9 +6,9 @@
#include "GitRevision.h" #include "GitRevision.h"
#include "StringFormat.h" #include "StringFormat.h"
void acore::Banner::Show(char const* applicationName, void(*log)(char const* text), void(*logExtraInfo)()) void Acore::Banner::Show(char const* applicationName, void(*log)(char const* text), void(*logExtraInfo)())
{ {
log(acore::StringFormat("%s (%s)", GitRevision::GetFullVersion(), applicationName).c_str()); log(Acore::StringFormat("%s (%s)", GitRevision::GetFullVersion(), applicationName).c_str());
log("<Ctrl-C> to stop.\n"); log("<Ctrl-C> to stop.\n");
log(" █████╗ ███████╗███████╗██████╗ ██████╗ ████████╗██╗ ██╗"); log(" █████╗ ███████╗███████╗██████╗ ██████╗ ████████╗██╗ ██╗");
log(" ██╔══██╗╚══███╔╝██╔════╝██╔══██╗██╔═══██╗╚══██╔══╝██║ ██║"); log(" ██╔══██╗╚══███╔╝██╔════╝██╔══██╗██╔═══██╗╚══██╔══╝██║ ██║");
+1 -1
View File
@@ -7,7 +7,7 @@
#include "Define.h" #include "Define.h"
namespace acore namespace Acore
{ {
namespace Banner namespace Banner
{ {
@@ -63,7 +63,7 @@ namespace MMAP
} }
// load and init dtNavMesh - read parameters from file // load and init dtNavMesh - read parameters from file
std::string fileName = acore::StringFormat(MAP_FILE_NAME_FORMAT, sConfigMgr->GetOption<std::string>("DataDir", ".").c_str(), mapId); std::string fileName = Acore::StringFormat(MAP_FILE_NAME_FORMAT, sConfigMgr->GetOption<std::string>("DataDir", ".").c_str(), mapId);
FILE* file = fopen(fileName.c_str(), "rb"); FILE* file = fopen(fileName.c_str(), "rb");
if (!file) if (!file)
@@ -122,7 +122,7 @@ namespace MMAP
} }
// load this tile :: mmaps/MMMXXYY.mmtile // load this tile :: mmaps/MMMXXYY.mmtile
std::string fileName = acore::StringFormat(TILE_FILE_NAME_FORMAT, sConfigMgr->GetOption<std::string>("DataDir", ".").c_str(), mapId, x, y); std::string fileName = Acore::StringFormat(TILE_FILE_NAME_FORMAT, sConfigMgr->GetOption<std::string>("DataDir", ".").c_str(), mapId, x, y);
FILE* file = fopen(fileName.c_str(), "rb"); FILE* file = fopen(fileName.c_str(), "rb");
if (!file) if (!file)
{ {
+1 -1
View File
@@ -98,7 +98,7 @@ AC_COMMON_API void CleanStringForMysqlQuery(std::string& str);
#define MAX_QUERY_LEN 32*1024 #define MAX_QUERY_LEN 32*1024
namespace acore namespace Acore
{ {
template<class ArgumentType, class ResultType> template<class ArgumentType, class ResultType>
struct unary_function struct unary_function
+11 -11
View File
@@ -41,7 +41,7 @@ namespace
template<typename Format, typename... Args> template<typename Format, typename... Args>
inline void PrintError(std::string_view filename, Format&& fmt, Args&& ... args) inline void PrintError(std::string_view filename, Format&& fmt, Args&& ... args)
{ {
std::string message = acore::StringFormat(std::forward<Format>(fmt), std::forward<Args>(args)...); std::string message = Acore::StringFormat(std::forward<Format>(fmt), std::forward<Args>(args)...);
if (IsAppConfig(filename)) if (IsAppConfig(filename))
{ {
@@ -76,7 +76,7 @@ namespace
if (in.fail()) if (in.fail())
{ {
throw ConfigException(acore::StringFormat("Config::LoadFile: Failed open file '%s'", file.c_str())); throw ConfigException(Acore::StringFormat("Config::LoadFile: Failed open file '%s'", file.c_str()));
} }
uint32 count = 0; uint32 count = 0;
@@ -104,11 +104,11 @@ namespace
// read line error // read line error
if (!in.good() && !in.eof()) if (!in.good() && !in.eof())
{ {
throw ConfigException(acore::StringFormat("> Config::LoadFile: Failure to read line number %u in file '%s'", lineNumber, file.c_str())); throw ConfigException(Acore::StringFormat("> Config::LoadFile: Failure to read line number %u in file '%s'", lineNumber, file.c_str()));
} }
// remove whitespace in line // remove whitespace in line
line = acore::String::Trim(line, in.getloc()); line = Acore::String::Trim(line, in.getloc());
if (line.empty()) if (line.empty())
{ {
@@ -135,8 +135,8 @@ namespace
continue; continue;
} }
auto entry = acore::String::Trim(line.substr(0, equal_pos), in.getloc()); auto entry = Acore::String::Trim(line.substr(0, equal_pos), in.getloc());
auto value = acore::String::Trim(line.substr(equal_pos + 1, std::string::npos), in.getloc()); auto value = Acore::String::Trim(line.substr(equal_pos + 1, std::string::npos), in.getloc());
value.erase(std::remove(value.begin(), value.end(), '"'), value.end()); value.erase(std::remove(value.begin(), value.end(), '"'), value.end());
@@ -153,7 +153,7 @@ namespace
// No lines read // No lines read
if (!count) if (!count)
throw ConfigException(acore::StringFormat("Config::LoadFile: Empty file '%s'", file.c_str())); throw ConfigException(Acore::StringFormat("Config::LoadFile: Empty file '%s'", file.c_str()));
// Add correct keys if file load without errors // Add correct keys if file load without errors
for (auto const& [entry, key] : fileConfigs) for (auto const& [entry, key] : fileConfigs)
@@ -214,19 +214,19 @@ T ConfigMgr::GetValueDefault(std::string const& name, T const& def, bool showLog
if (showLogs) if (showLogs)
{ {
LOG_ERROR("server", "> Config: Missing name %s in config, add \"%s = %s\"", LOG_ERROR("server", "> Config: Missing name %s in config, add \"%s = %s\"",
name.c_str(), name.c_str(), acore::ToString(def).c_str()); name.c_str(), name.c_str(), Acore::ToString(def).c_str());
} }
return def; return def;
} }
auto value = acore::StringTo<T>(itr->second); auto value = Acore::StringTo<T>(itr->second);
if (!value) if (!value)
{ {
if (showLogs) if (showLogs)
{ {
LOG_ERROR("server", "> Config: Bad value defined for name '%s', going to use '%s' instead", LOG_ERROR("server", "> Config: Bad value defined for name '%s', going to use '%s' instead",
name.c_str(), acore::ToString(def).c_str()); name.c_str(), Acore::ToString(def).c_str());
} }
return def; return def;
@@ -264,7 +264,7 @@ bool ConfigMgr::GetOption<bool>(std::string const& name, bool const& def, bool s
{ {
std::string val = GetValueDefault(name, std::string(def ? "1" : "0"), showLogs); std::string val = GetValueDefault(name, std::string(def ? "1" : "0"), showLogs);
auto boolVal = acore::StringTo<bool>(val); auto boolVal = Acore::StringTo<bool>(val);
if (!boolVal) if (!boolVal)
{ {
if (showLogs) if (showLogs)
+4 -4
View File
@@ -7,25 +7,25 @@
#include "Errors.h" #include "Errors.h"
#include <limits> #include <limits>
acore::Crypto::AES::AES(bool encrypting) : _ctx(EVP_CIPHER_CTX_new()), _encrypting(encrypting) Acore::Crypto::AES::AES(bool encrypting) : _ctx(EVP_CIPHER_CTX_new()), _encrypting(encrypting)
{ {
EVP_CIPHER_CTX_init(_ctx); EVP_CIPHER_CTX_init(_ctx);
int status = EVP_CipherInit_ex(_ctx, EVP_aes_128_gcm(), nullptr, nullptr, nullptr, _encrypting ? 1 : 0); int status = EVP_CipherInit_ex(_ctx, EVP_aes_128_gcm(), nullptr, nullptr, nullptr, _encrypting ? 1 : 0);
ASSERT(status); ASSERT(status);
} }
acore::Crypto::AES::~AES() Acore::Crypto::AES::~AES()
{ {
EVP_CIPHER_CTX_free(_ctx); EVP_CIPHER_CTX_free(_ctx);
} }
void acore::Crypto::AES::Init(Key const& key) void Acore::Crypto::AES::Init(Key const& key)
{ {
int status = EVP_CipherInit_ex(_ctx, nullptr, nullptr, key.data(), nullptr, -1); int status = EVP_CipherInit_ex(_ctx, nullptr, nullptr, key.data(), nullptr, -1);
ASSERT(status); ASSERT(status);
} }
bool acore::Crypto::AES::Process(IV const& iv, uint8* data, size_t length, Tag& tag) bool Acore::Crypto::AES::Process(IV const& iv, uint8* data, size_t length, Tag& tag)
{ {
ASSERT(length <= static_cast<size_t>(std::numeric_limits<int>::max())); ASSERT(length <= static_cast<size_t>(std::numeric_limits<int>::max()));
int len = static_cast<int>(length); int len = static_cast<int>(length);
+1 -1
View File
@@ -10,7 +10,7 @@
#include <array> #include <array>
#include <openssl/evp.h> #include <openssl/evp.h>
namespace acore::Crypto namespace Acore::Crypto
{ {
class AC_COMMON_API AES class AC_COMMON_API AES
{ {
+4 -4
View File
@@ -7,7 +7,7 @@
#include "ARC4.h" #include "ARC4.h"
#include "Errors.h" #include "Errors.h"
acore::Crypto::ARC4::ARC4() Acore::Crypto::ARC4::ARC4()
: _ctx(EVP_CIPHER_CTX_new()) : _ctx(EVP_CIPHER_CTX_new())
{ {
EVP_CIPHER_CTX_init(_ctx); EVP_CIPHER_CTX_init(_ctx);
@@ -15,12 +15,12 @@ acore::Crypto::ARC4::ARC4()
ASSERT(result == 1); ASSERT(result == 1);
} }
acore::Crypto::ARC4::~ARC4() Acore::Crypto::ARC4::~ARC4()
{ {
EVP_CIPHER_CTX_free(_ctx); EVP_CIPHER_CTX_free(_ctx);
} }
void acore::Crypto::ARC4::Init(uint8 const* seed, size_t len) void Acore::Crypto::ARC4::Init(uint8 const* seed, size_t len)
{ {
int result1 = EVP_CIPHER_CTX_set_key_length(_ctx, len); int result1 = EVP_CIPHER_CTX_set_key_length(_ctx, len);
ASSERT(result1 == 1); ASSERT(result1 == 1);
@@ -28,7 +28,7 @@ void acore::Crypto::ARC4::Init(uint8 const* seed, size_t len)
ASSERT(result2 == 1); ASSERT(result2 == 1);
} }
void acore::Crypto::ARC4::UpdateData(uint8* data, size_t len) void Acore::Crypto::ARC4::UpdateData(uint8* data, size_t len)
{ {
int outlen = 0; int outlen = 0;
int result1 = EVP_EncryptUpdate(_ctx, data, &outlen, data, len); int result1 = EVP_EncryptUpdate(_ctx, data, &outlen, data, len);
+1 -1
View File
@@ -11,7 +11,7 @@
#include <array> #include <array>
#include <openssl/evp.h> #include <openssl/evp.h>
namespace acore::Crypto namespace Acore::Crypto
{ {
class ARC4 class ARC4
{ {
+2 -2
View File
@@ -6,7 +6,7 @@
#include "Argon2.h" #include "Argon2.h"
#include <argon2/argon2.h> #include <argon2/argon2.h>
/*static*/ Optional<std::string> acore::Crypto::Argon2::Hash(std::string const& password, BigNumber const& salt, uint32 nIterations, uint32 kibMemoryCost) /*static*/ Optional<std::string> Acore::Crypto::Argon2::Hash(std::string const& password, BigNumber const& salt, uint32 nIterations, uint32 kibMemoryCost)
{ {
char buf[ENCODED_HASH_LEN]; char buf[ENCODED_HASH_LEN];
std::vector<uint8> saltBytes = salt.ToByteVector(); std::vector<uint8> saltBytes = salt.ToByteVector();
@@ -25,7 +25,7 @@
return {}; return {};
} }
/*static*/ bool acore::Crypto::Argon2::Verify(std::string const& password, std::string const& hash) /*static*/ bool Acore::Crypto::Argon2::Verify(std::string const& password, std::string const& hash)
{ {
int status = argon2id_verify(hash.c_str(), password.c_str(), password.length()); int status = argon2id_verify(hash.c_str(), password.c_str(), password.length());
return (status == ARGON2_OK); return (status == ARGON2_OK);
+1 -1
View File
@@ -11,7 +11,7 @@
#include "Optional.h" #include "Optional.h"
#include <string> #include <string>
namespace acore::Crypto namespace Acore::Crypto
{ {
struct AC_COMMON_API Argon2 struct AC_COMMON_API Argon2
{ {
@@ -16,9 +16,9 @@ AuthCrypt::AuthCrypt() : _initialized(false)
void AuthCrypt::Init(SessionKey const& K) void AuthCrypt::Init(SessionKey const& K)
{ {
uint8 ServerEncryptionKey[] = { 0xCC, 0x98, 0xAE, 0x04, 0xE8, 0x97, 0xEA, 0xCA, 0x12, 0xDD, 0xC0, 0x93, 0x42, 0x91, 0x53, 0x57 }; uint8 ServerEncryptionKey[] = { 0xCC, 0x98, 0xAE, 0x04, 0xE8, 0x97, 0xEA, 0xCA, 0x12, 0xDD, 0xC0, 0x93, 0x42, 0x91, 0x53, 0x57 };
_serverEncrypt.Init(acore::Crypto::HMAC_SHA1::GetDigestOf(ServerEncryptionKey, K)); _serverEncrypt.Init(Acore::Crypto::HMAC_SHA1::GetDigestOf(ServerEncryptionKey, K));
uint8 ServerDecryptionKey[] = { 0xC2, 0xB3, 0x72, 0x3C, 0xC6, 0xAE, 0xD9, 0xB5, 0x34, 0x3C, 0x53, 0xEE, 0x2F, 0x43, 0x67, 0xCE }; uint8 ServerDecryptionKey[] = { 0xC2, 0xB3, 0x72, 0x3C, 0xC6, 0xAE, 0xD9, 0xB5, 0x34, 0x3C, 0x53, 0xEE, 0x2F, 0x43, 0x67, 0xCE };
_clientDecrypt.Init(acore::Crypto::HMAC_SHA1::GetDigestOf(ServerDecryptionKey, K)); _clientDecrypt.Init(Acore::Crypto::HMAC_SHA1::GetDigestOf(ServerDecryptionKey, K));
// Drop first 1024 bytes, as WoW uses ARC4-drop1024. // Drop first 1024 bytes, as WoW uses ARC4-drop1024.
std::array<uint8, 1024> syncBuf; std::array<uint8, 1024> syncBuf;
@@ -23,8 +23,8 @@ public:
bool IsInitialized() const { return _initialized; } bool IsInitialized() const { return _initialized; }
private: private:
acore::Crypto::ARC4 _clientDecrypt; Acore::Crypto::ARC4 _clientDecrypt;
acore::Crypto::ARC4 _serverEncrypt; Acore::Crypto::ARC4 _serverEncrypt;
bool _initialized; bool _initialized;
}; };
#endif #endif
@@ -9,8 +9,8 @@
#include <algorithm> #include <algorithm>
#include <functional> #include <functional>
using SHA1 = acore::Crypto::SHA1; using SHA1 = Acore::Crypto::SHA1;
using SRP6 = acore::Crypto::SRP6; using SRP6 = Acore::Crypto::SRP6;
/*static*/ std::array<uint8, 1> const SRP6::g = { 7 }; /*static*/ std::array<uint8, 1> const SRP6::g = { 7 };
/*static*/ std::array<uint8, 32> const SRP6::N = HexStrToByteArray<32>("894B645E89E1535BBDAD5B8B290650530801B18EBFBF5E8FAB3C82872A3E9BB7", true); /*static*/ std::array<uint8, 32> const SRP6::N = HexStrToByteArray<32>("894B645E89E1535BBDAD5B8B290650530801B18EBFBF5E8FAB3C82872A3E9BB7", true);
@@ -14,7 +14,7 @@
#include <array> #include <array>
#include <optional> #include <optional>
namespace acore::Crypto namespace Acore::Crypto
{ {
class SRP6 class SRP6
{ {
+1 -1
View File
@@ -8,7 +8,7 @@
#include "Define.h" #include "Define.h"
namespace acore::Crypto namespace Acore::Crypto
{ {
struct Constants struct Constants
{ {
+8 -8
View File
@@ -13,7 +13,7 @@
#include <iterator> #include <iterator>
#include <vector> #include <vector>
namespace acore::Impl namespace Acore::Impl
{ {
struct CryptoGenericsImpl struct CryptoGenericsImpl
{ {
@@ -21,7 +21,7 @@ namespace acore::Impl
static typename Cipher::IV GenerateRandomIV() static typename Cipher::IV GenerateRandomIV()
{ {
typename Cipher::IV iv; typename Cipher::IV iv;
acore::Crypto::GetRandomBytes(iv); Acore::Crypto::GetRandomBytes(iv);
return iv; return iv;
} }
@@ -44,7 +44,7 @@ namespace acore::Impl
}; };
} }
namespace acore::Crypto namespace Acore::Crypto
{ {
template <typename Cipher> template <typename Cipher>
void AEEncryptWithRandomIV(std::vector<uint8>& data, typename Cipher::Key const& key) void AEEncryptWithRandomIV(std::vector<uint8>& data, typename Cipher::Key const& key)
@@ -52,7 +52,7 @@ namespace acore::Crypto
using IV = typename Cipher::IV; using IV = typename Cipher::IV;
using Tag = typename Cipher::Tag; using Tag = typename Cipher::Tag;
// select random IV // select random IV
IV iv = acore::Impl::CryptoGenericsImpl::GenerateRandomIV<Cipher>(); IV iv = Acore::Impl::CryptoGenericsImpl::GenerateRandomIV<Cipher>();
Tag tag; Tag tag;
// encrypt data // encrypt data
@@ -62,8 +62,8 @@ namespace acore::Crypto
ASSERT(success); ASSERT(success);
// append trailing IV and tag // append trailing IV and tag
acore::Impl::CryptoGenericsImpl::AppendToBack(data, iv); Acore::Impl::CryptoGenericsImpl::AppendToBack(data, iv);
acore::Impl::CryptoGenericsImpl::AppendToBack(data, tag); Acore::Impl::CryptoGenericsImpl::AppendToBack(data, tag);
} }
template <typename Cipher> template <typename Cipher>
@@ -80,8 +80,8 @@ namespace acore::Crypto
// extract trailing IV and tag // extract trailing IV and tag
IV iv; IV iv;
Tag tag; Tag tag;
acore::Impl::CryptoGenericsImpl::SplitFromBack(data, tag); Acore::Impl::CryptoGenericsImpl::SplitFromBack(data, tag);
acore::Impl::CryptoGenericsImpl::SplitFromBack(data, iv); Acore::Impl::CryptoGenericsImpl::SplitFromBack(data, iv);
// decrypt data // decrypt data
Cipher cipher(false); Cipher cipher(false);
+4 -4
View File
@@ -16,7 +16,7 @@
class BigNumber; class BigNumber;
namespace acore::Impl namespace Acore::Impl
{ {
struct GenericHashImpl struct GenericHashImpl
{ {
@@ -98,10 +98,10 @@ namespace acore::Impl
}; };
} }
namespace acore::Crypto namespace Acore::Crypto
{ {
using SHA1 = acore::Impl::GenericHash<EVP_sha1, Constants::SHA1_DIGEST_LENGTH_BYTES>; using SHA1 = Acore::Impl::GenericHash<EVP_sha1, Constants::SHA1_DIGEST_LENGTH_BYTES>;
using SHA256 = acore::Impl::GenericHash<EVP_sha256, Constants::SHA256_DIGEST_LENGTH_BYTES>; using SHA256 = Acore::Impl::GenericHash<EVP_sha256, Constants::SHA256_DIGEST_LENGTH_BYTES>;
} }
#endif #endif
+1 -1
View File
@@ -7,7 +7,7 @@
#include "Errors.h" #include "Errors.h"
#include <openssl/rand.h> #include <openssl/rand.h>
void acore::Crypto::GetRandomBytes(uint8* buf, size_t len) void Acore::Crypto::GetRandomBytes(uint8* buf, size_t len)
{ {
int result = RAND_bytes(buf, len); int result = RAND_bytes(buf, len);
ASSERT(result == 1); ASSERT(result == 1);
+1 -1
View File
@@ -9,7 +9,7 @@
#include "Define.h" #include "Define.h"
#include <array> #include <array>
namespace acore::Crypto namespace Acore::Crypto
{ {
void GetRandomBytes(uint8* buf, size_t len); void GetRandomBytes(uint8* buf, size_t len);
+4 -4
View File
@@ -16,7 +16,7 @@
class BigNumber; class BigNumber;
namespace acore::Impl namespace Acore::Impl
{ {
struct HMACImpl struct HMACImpl
{ {
@@ -110,9 +110,9 @@ namespace acore::Impl
}; };
} }
namespace acore::Crypto namespace Acore::Crypto
{ {
using HMAC_SHA1 = acore::Impl::GenericHMAC<EVP_sha1, Constants::SHA1_DIGEST_LENGTH_BYTES>; using HMAC_SHA1 = Acore::Impl::GenericHMAC<EVP_sha1, Constants::SHA1_DIGEST_LENGTH_BYTES>;
using HMAC_SHA256 = acore::Impl::GenericHMAC<EVP_sha256, Constants::SHA256_DIGEST_LENGTH_BYTES>; using HMAC_SHA256 = Acore::Impl::GenericHMAC<EVP_sha256, Constants::SHA256_DIGEST_LENGTH_BYTES>;
} }
#endif #endif
+3 -3
View File
@@ -8,11 +8,11 @@
#include <openssl/evp.h> #include <openssl/evp.h>
#include <openssl/hmac.h> #include <openssl/hmac.h>
constexpr std::size_t acore::Crypto::TOTP::RECOMMENDED_SECRET_LENGTH; constexpr std::size_t Acore::Crypto::TOTP::RECOMMENDED_SECRET_LENGTH;
static constexpr uint32 TOTP_INTERVAL = 30; static constexpr uint32 TOTP_INTERVAL = 30;
static constexpr uint32 HMAC_RESULT_SIZE = 20; static constexpr uint32 HMAC_RESULT_SIZE = 20;
/*static*/ uint32 acore::Crypto::TOTP::GenerateToken(Secret const& secret, time_t timestamp) /*static*/ uint32 Acore::Crypto::TOTP::GenerateToken(Secret const& secret, time_t timestamp)
{ {
timestamp /= TOTP_INTERVAL; timestamp /= TOTP_INTERVAL;
unsigned char challenge[8]; unsigned char challenge[8];
@@ -31,7 +31,7 @@ static constexpr uint32 HMAC_RESULT_SIZE = 20;
return (truncated % 1000000); return (truncated % 1000000);
} }
/*static*/ bool acore::Crypto::TOTP::ValidateToken(Secret const& secret, uint32 token) /*static*/ bool Acore::Crypto::TOTP::ValidateToken(Secret const& secret, uint32 token)
{ {
time_t now = time(nullptr); time_t now = time(nullptr);
return ( return (
+1 -1
View File
@@ -10,7 +10,7 @@
#include <ctime> #include <ctime>
#include <vector> #include <vector>
namespace acore::Crypto namespace Acore::Crypto
{ {
struct AC_COMMON_API TOTP struct AC_COMMON_API TOTP
{ {
+8 -8
View File
@@ -54,11 +54,11 @@ namespace
} }
} }
namespace acore namespace Acore
{ {
void Assert(char const* file, int line, char const* function, std::string const& debugInfo, char const* message) void Assert(char const* file, int line, char const* function, std::string const& debugInfo, char const* message)
{ {
std::string formattedMessage = acore::StringFormat("\n%s:%i in %s ASSERTION FAILED:\n %s\n", file, line, function, message) + debugInfo + '\n'; std::string formattedMessage = Acore::StringFormat("\n%s:%i in %s ASSERTION FAILED:\n %s\n", file, line, function, message) + debugInfo + '\n';
fprintf(stderr, "%s", formattedMessage.c_str()); fprintf(stderr, "%s", formattedMessage.c_str());
fflush(stderr); fflush(stderr);
Crash(formattedMessage.c_str()); Crash(formattedMessage.c_str());
@@ -69,7 +69,7 @@ namespace acore
va_list args; va_list args;
va_start(args, format); va_start(args, format);
std::string formattedMessage = acore::StringFormat("\n%s:%i in %s ASSERTION FAILED:\n %s\n", file, line, function, message) + FormatAssertionMessage(format, args) + '\n' + debugInfo + '\n'; std::string formattedMessage = Acore::StringFormat("\n%s:%i in %s ASSERTION FAILED:\n %s\n", file, line, function, message) + FormatAssertionMessage(format, args) + '\n' + debugInfo + '\n';
va_end(args); va_end(args);
fprintf(stderr, "%s", formattedMessage.c_str()); fprintf(stderr, "%s", formattedMessage.c_str());
@@ -83,7 +83,7 @@ namespace acore
va_list args; va_list args;
va_start(args, message); va_start(args, message);
std::string formattedMessage = acore::StringFormat("\n%s:%i in %s FATAL ERROR:\n", file, line, function) + FormatAssertionMessage(message, args) + '\n'; std::string formattedMessage = Acore::StringFormat("\n%s:%i in %s FATAL ERROR:\n", file, line, function) + FormatAssertionMessage(message, args) + '\n';
va_end(args); va_end(args);
fprintf(stderr, "%s", formattedMessage.c_str()); fprintf(stderr, "%s", formattedMessage.c_str());
@@ -95,7 +95,7 @@ namespace acore
void Error(char const* file, int line, char const* function, char const* message) void Error(char const* file, int line, char const* function, char const* message)
{ {
std::string formattedMessage = acore::StringFormat("\n%s:%i in %s ERROR:\n %s\n", file, line, function, message); std::string formattedMessage = Acore::StringFormat("\n%s:%i in %s ERROR:\n %s\n", file, line, function, message);
fprintf(stderr, "%s", formattedMessage.c_str()); fprintf(stderr, "%s", formattedMessage.c_str());
fflush(stderr); fflush(stderr);
Crash(formattedMessage.c_str()); Crash(formattedMessage.c_str());
@@ -109,7 +109,7 @@ namespace acore
void Abort(char const* file, int line, char const* function) void Abort(char const* file, int line, char const* function)
{ {
std::string formattedMessage = acore::StringFormat("\n%s:%i in %s ABORTED.\n", file, line, function); std::string formattedMessage = Acore::StringFormat("\n%s:%i in %s ABORTED.\n", file, line, function);
fprintf(stderr, "%s", formattedMessage.c_str()); fprintf(stderr, "%s", formattedMessage.c_str());
fflush(stderr); fflush(stderr);
Crash(formattedMessage.c_str()); Crash(formattedMessage.c_str());
@@ -132,13 +132,13 @@ namespace acore
void AbortHandler(int sigval) void AbortHandler(int sigval)
{ {
// nothing useful to log here, no way to pass args // nothing useful to log here, no way to pass args
std::string formattedMessage = acore::StringFormat("Caught signal %i\n", sigval); std::string formattedMessage = Acore::StringFormat("Caught signal %i\n", sigval);
fprintf(stderr, "%s", formattedMessage.c_str()); fprintf(stderr, "%s", formattedMessage.c_str());
fflush(stderr); fflush(stderr);
Crash(formattedMessage.c_str()); Crash(formattedMessage.c_str());
} }
} // namespace acore } // namespace Acore
std::string GetDebugInfo() std::string GetDebugInfo()
{ {
+9 -9
View File
@@ -10,7 +10,7 @@
#include "Define.h" #include "Define.h"
#include <string> #include <string>
namespace acore namespace Acore
{ {
DECLSPEC_NORETURN void Assert(char const* file, int line, char const* function, std::string const& debugInfo, char const* message) ATTR_NORETURN; DECLSPEC_NORETURN void Assert(char const* file, int line, char const* function, std::string const& debugInfo, char const* message) ATTR_NORETURN;
DECLSPEC_NORETURN void Assert(char const* file, int line, char const* function, std::string const& debugInfo, char const* message, char const* format, ...) ATTR_NORETURN ATTR_PRINTF(6, 7); DECLSPEC_NORETURN void Assert(char const* file, int line, char const* function, std::string const& debugInfo, char const* message, char const* format, ...) ATTR_NORETURN ATTR_PRINTF(6, 7);
@@ -27,7 +27,7 @@ namespace acore
DECLSPEC_NORETURN void AbortHandler(int sigval) ATTR_NORETURN; DECLSPEC_NORETURN void AbortHandler(int sigval) ATTR_NORETURN;
} // namespace acore } // namespace Acore
std::string GetDebugInfo(); std::string GetDebugInfo();
@@ -43,13 +43,13 @@ std::string GetDebugInfo();
#define EXCEPTION_ASSERTION_FAILURE 0xC0000420L #define EXCEPTION_ASSERTION_FAILURE 0xC0000420L
#endif #endif
#define WPAssert(cond, ...) ASSERT_BEGIN do { if (!(cond)) acore::Assert(__FILE__, __LINE__, __FUNCTION__, GetDebugInfo(), #cond, ##__VA_ARGS__); } while(0) ASSERT_END #define WPAssert(cond, ...) ASSERT_BEGIN do { if (!(cond)) Acore::Assert(__FILE__, __LINE__, __FUNCTION__, GetDebugInfo(), #cond, ##__VA_ARGS__); } while(0) ASSERT_END
#define WPAssert_NODEBUGINFO(cond, ...) ASSERT_BEGIN do { if (!(cond)) acore::Assert(__FILE__, __LINE__, __FUNCTION__, "", #cond, ##__VA_ARGS__); } while(0) ASSERT_END #define WPAssert_NODEBUGINFO(cond, ...) ASSERT_BEGIN do { if (!(cond)) Acore::Assert(__FILE__, __LINE__, __FUNCTION__, "", #cond, ##__VA_ARGS__); } while(0) ASSERT_END
#define WPFatal(cond, ...) ASSERT_BEGIN do { if (!(cond)) acore::Fatal(__FILE__, __LINE__, __FUNCTION__, ##__VA_ARGS__); } while(0) ASSERT_END #define WPFatal(cond, ...) ASSERT_BEGIN do { if (!(cond)) Acore::Fatal(__FILE__, __LINE__, __FUNCTION__, ##__VA_ARGS__); } while(0) ASSERT_END
#define WPError(cond, msg) ASSERT_BEGIN do { if (!(cond)) acore::Error(__FILE__, __LINE__, __FUNCTION__, (msg)); } while(0) ASSERT_END #define WPError(cond, msg) ASSERT_BEGIN do { if (!(cond)) Acore::Error(__FILE__, __LINE__, __FUNCTION__, (msg)); } while(0) ASSERT_END
#define WPWarning(cond, msg) ASSERT_BEGIN do { if (!(cond)) acore::Warning(__FILE__, __LINE__, __FUNCTION__, (msg)); } while(0) ASSERT_END #define WPWarning(cond, msg) ASSERT_BEGIN do { if (!(cond)) Acore::Warning(__FILE__, __LINE__, __FUNCTION__, (msg)); } while(0) ASSERT_END
#define WPAbort() ASSERT_BEGIN do { acore::Abort(__FILE__, __LINE__, __FUNCTION__); } while(0) ASSERT_END #define WPAbort() ASSERT_BEGIN do { Acore::Abort(__FILE__, __LINE__, __FUNCTION__); } while(0) ASSERT_END
#define WPAbort_MSG(msg, ...) ASSERT_BEGIN do { acore::Abort(__FILE__, __LINE__, __FUNCTION__, (msg), ##__VA_ARGS__); } while(0) ASSERT_END #define WPAbort_MSG(msg, ...) ASSERT_BEGIN do { Acore::Abort(__FILE__, __LINE__, __FUNCTION__, (msg), ##__VA_ARGS__); } while(0) ASSERT_END
#ifdef PERFORMANCE_PROFILING #ifdef PERFORMANCE_PROFILING
#define ASSERT(cond, ...) ((void)0) #define ASSERT(cond, ...) ((void)0)
+6 -6
View File
@@ -91,13 +91,13 @@ template<class OBJECT_TYPES>
class TypeMapContainer class TypeMapContainer
{ {
public: public:
template<class SPECIFIC_TYPE> [[nodiscard]] size_t Count() const { return acore::Count(i_elements, (SPECIFIC_TYPE*)nullptr); } template<class SPECIFIC_TYPE> [[nodiscard]] size_t Count() const { return Acore::Count(i_elements, (SPECIFIC_TYPE*)nullptr); }
/// inserts a specific object into the container /// inserts a specific object into the container
template<class SPECIFIC_TYPE> template<class SPECIFIC_TYPE>
bool insert(SPECIFIC_TYPE* obj) bool insert(SPECIFIC_TYPE* obj)
{ {
SPECIFIC_TYPE* t = acore::Insert(i_elements, obj); SPECIFIC_TYPE* t = Acore::Insert(i_elements, obj);
return (t != nullptr); return (t != nullptr);
} }
@@ -105,7 +105,7 @@ public:
//template<class SPECIFIC_TYPE> //template<class SPECIFIC_TYPE>
// bool remove(SPECIFIC_TYPE* obj) // bool remove(SPECIFIC_TYPE* obj)
//{ //{
// SPECIFIC_TYPE* t = acore::Remove(i_elements, obj); // SPECIFIC_TYPE* t = Acore::Remove(i_elements, obj);
// return (t != nullptr); // return (t != nullptr);
//} //}
@@ -123,19 +123,19 @@ public:
template<class SPECIFIC_TYPE> template<class SPECIFIC_TYPE>
bool Insert(KEY_TYPE const& handle, SPECIFIC_TYPE* obj) bool Insert(KEY_TYPE const& handle, SPECIFIC_TYPE* obj)
{ {
return acore::Insert(_elements, handle, obj); return Acore::Insert(_elements, handle, obj);
} }
template<class SPECIFIC_TYPE> template<class SPECIFIC_TYPE>
bool Remove(KEY_TYPE const& handle) bool Remove(KEY_TYPE const& handle)
{ {
return acore::Remove(_elements, handle, (SPECIFIC_TYPE*)nullptr); return Acore::Remove(_elements, handle, (SPECIFIC_TYPE*)nullptr);
} }
template<class SPECIFIC_TYPE> template<class SPECIFIC_TYPE>
SPECIFIC_TYPE* Find(KEY_TYPE const& handle) SPECIFIC_TYPE* Find(KEY_TYPE const& handle)
{ {
return acore::Find(_elements, handle, (SPECIFIC_TYPE*)nullptr); return Acore::Find(_elements, handle, (SPECIFIC_TYPE*)nullptr);
} }
ContainerUnorderedMap<OBJECT_TYPES, KEY_TYPE>& GetElements() { return _elements; } ContainerUnorderedMap<OBJECT_TYPES, KEY_TYPE>& GetElements() { return _elements; }
+1 -1
View File
@@ -18,7 +18,7 @@
#include <map> #include <map>
#include <unordered_map> #include <unordered_map>
namespace acore namespace Acore
{ {
// Helpers // Helpers
// Insert helpers // Insert helpers
@@ -17,7 +17,7 @@
#include "Utilities/TypeList.h" #include "Utilities/TypeList.h"
#include <map> #include <map>
namespace acore namespace Acore
{ {
/* ContainerMapList Helpers */ /* ContainerMapList Helpers */
// count functions // count functions
+4 -4
View File
@@ -32,12 +32,12 @@ struct B32Impl
} }
}; };
/*static*/ std::string acore::Encoding::Base32::Encode(std::vector<uint8> const& data) /*static*/ std::string Acore::Encoding::Base32::Encode(std::vector<uint8> const& data)
{ {
return acore::Impl::GenericBaseEncoding<B32Impl>::Encode(data); return Acore::Impl::GenericBaseEncoding<B32Impl>::Encode(data);
} }
/*static*/ Optional<std::vector<uint8>> acore::Encoding::Base32::Decode(std::string const& data) /*static*/ Optional<std::vector<uint8>> Acore::Encoding::Base32::Decode(std::string const& data)
{ {
return acore::Impl::GenericBaseEncoding<B32Impl>::Decode(data); return Acore::Impl::GenericBaseEncoding<B32Impl>::Decode(data);
} }
+1 -1
View File
@@ -11,7 +11,7 @@
#include <string> #include <string>
#include <vector> #include <vector>
namespace acore::Encoding namespace Acore::Encoding
{ {
struct AC_COMMON_API Base32 struct AC_COMMON_API Base32
{ {
+4 -4
View File
@@ -34,12 +34,12 @@ struct B64Impl
} }
}; };
/*static*/ std::string acore::Encoding::Base64::Encode(std::vector<uint8> const& data) /*static*/ std::string Acore::Encoding::Base64::Encode(std::vector<uint8> const& data)
{ {
return acore::Impl::GenericBaseEncoding<B64Impl>::Encode(data); return Acore::Impl::GenericBaseEncoding<B64Impl>::Encode(data);
} }
/*static*/ Optional<std::vector<uint8>> acore::Encoding::Base64::Decode(std::string const& data) /*static*/ Optional<std::vector<uint8>> Acore::Encoding::Base64::Decode(std::string const& data)
{ {
return acore::Impl::GenericBaseEncoding<B64Impl>::Decode(data); return Acore::Impl::GenericBaseEncoding<B64Impl>::Decode(data);
} }
+1 -1
View File
@@ -11,7 +11,7 @@
#include <string> #include <string>
#include <vector> #include <vector>
namespace acore::Encoding namespace Acore::Encoding
{ {
struct AC_COMMON_API Base64 struct AC_COMMON_API Base64
{ {
+1 -1
View File
@@ -12,7 +12,7 @@
#include <string> #include <string>
#include <vector> #include <vector>
namespace acore::Impl namespace Acore::Impl
{ {
template <typename Encoding> template <typename Encoding>
struct GenericBaseEncoding struct GenericBaseEncoding
+1 -1
View File
@@ -49,7 +49,7 @@ void Appender::write(LogMessage* message)
ss << message->getTimeStr() << ' '; ss << message->getTimeStr() << ' ';
if (flags & APPENDER_FLAGS_PREFIX_LOGLEVEL) if (flags & APPENDER_FLAGS_PREFIX_LOGLEVEL)
ss << acore::StringFormat("%-5s ", Appender::getLogLevelString(message->level)); ss << Acore::StringFormat("%-5s ", Appender::getLogLevelString(message->level));
if (flags & APPENDER_FLAGS_PREFIX_LOGFILTERTYPE) if (flags & APPENDER_FLAGS_PREFIX_LOGFILTERTYPE)
ss << '[' << message->type << "] "; ss << '[' << message->type << "] ";
+4 -4
View File
@@ -34,20 +34,20 @@ void AppenderConsole::InitColors(std::string const& name, std::string_view str)
return; return;
} }
std::vector<std::string_view> colorStrs = acore::Tokenize(str, ' ', false); std::vector<std::string_view> colorStrs = Acore::Tokenize(str, ' ', false);
if (colorStrs.size() != NUM_ENABLED_LOG_LEVELS) if (colorStrs.size() != NUM_ENABLED_LOG_LEVELS)
{ {
throw InvalidAppenderArgsException(acore::StringFormat("Log::CreateAppenderFromConfig: Invalid color data '%s' for console appender %s (expected %u entries, got %zu)", throw InvalidAppenderArgsException(Acore::StringFormat("Log::CreateAppenderFromConfig: Invalid color data '%s' for console appender %s (expected %u entries, got %zu)",
std::string(str).c_str(), name.c_str(), NUM_ENABLED_LOG_LEVELS, colorStrs.size())); std::string(str).c_str(), name.c_str(), NUM_ENABLED_LOG_LEVELS, colorStrs.size()));
} }
for (uint8 i = 0; i < NUM_ENABLED_LOG_LEVELS; ++i) for (uint8 i = 0; i < NUM_ENABLED_LOG_LEVELS; ++i)
{ {
if (Optional<uint8> color = acore::StringTo<uint8>(colorStrs[i]); color && EnumUtils::IsValid<ColorTypes>(*color)) if (Optional<uint8> color = Acore::StringTo<uint8>(colorStrs[i]); color && EnumUtils::IsValid<ColorTypes>(*color))
_colors[i] = static_cast<ColorTypes>(*color); _colors[i] = static_cast<ColorTypes>(*color);
else else
{ {
throw InvalidAppenderArgsException(acore::StringFormat("Log::CreateAppenderFromConfig: Invalid color '%s' for log level %s on console appender %s", throw InvalidAppenderArgsException(Acore::StringFormat("Log::CreateAppenderFromConfig: Invalid color '%s' for log level %s on console appender %s",
std::string(colorStrs[i]).c_str(), EnumUtils::ToTitle(static_cast<LogLevel>(i)), name.c_str())); std::string(colorStrs[i]).c_str(), EnumUtils::ToTitle(static_cast<LogLevel>(i)), name.c_str()));
} }
} }
+3 -3
View File
@@ -18,7 +18,7 @@ AppenderFile::AppenderFile(uint8 id, std::string const& name, LogLevel level, Ap
_fileSize(0) _fileSize(0)
{ {
if (args.size() < 4) if (args.size() < 4)
throw InvalidAppenderArgsException(acore::StringFormat("Log::CreateAppenderFromConfig: Missing file name for appender %s", name.c_str())); throw InvalidAppenderArgsException(Acore::StringFormat("Log::CreateAppenderFromConfig: Missing file name for appender %s", name.c_str()));
_fileName.assign(args[3]); _fileName.assign(args[3]);
@@ -37,10 +37,10 @@ AppenderFile::AppenderFile(uint8 id, std::string const& name, LogLevel level, Ap
if (5 < args.size()) if (5 < args.size())
{ {
if (Optional<uint32> size = acore::StringTo<uint32>(args[5])) if (Optional<uint32> size = Acore::StringTo<uint32>(args[5]))
_maxFileSize = *size; _maxFileSize = *size;
else else
throw InvalidAppenderArgsException(acore::StringFormat("Log::CreateAppenderFromConfig: Invalid size '%s' for appender %s", std::string(args[5]).c_str(), name.c_str())); throw InvalidAppenderArgsException(Acore::StringFormat("Log::CreateAppenderFromConfig: Invalid size '%s' for appender %s", std::string(args[5]).c_str(), name.c_str()));
} }
_dynamicName = std::string::npos != _fileName.find("%s"); _dynamicName = std::string::npos != _fileName.find("%s");
+8 -8
View File
@@ -54,7 +54,7 @@ void Log::CreateAppenderFromConfig(std::string const& appenderName)
// if type = Console. optional1 = Color // if type = Console. optional1 = Color
std::string options = sConfigMgr->GetStringDefault(appenderName, ""); std::string options = sConfigMgr->GetStringDefault(appenderName, "");
std::vector<std::string_view> tokens = acore::Tokenize(options, ',', true); std::vector<std::string_view> tokens = Acore::Tokenize(options, ',', true);
size_t const size = tokens.size(); size_t const size = tokens.size();
std::string name = appenderName.substr(9); std::string name = appenderName.substr(9);
@@ -66,8 +66,8 @@ void Log::CreateAppenderFromConfig(std::string const& appenderName)
} }
AppenderFlags flags = APPENDER_FLAGS_NONE; AppenderFlags flags = APPENDER_FLAGS_NONE;
AppenderType type = AppenderType(acore::StringTo<uint8>(tokens[0]).value_or(APPENDER_INVALID)); AppenderType type = AppenderType(Acore::StringTo<uint8>(tokens[0]).value_or(APPENDER_INVALID));
LogLevel level = LogLevel(acore::StringTo<uint8>(tokens[1]).value_or(LOG_LEVEL_INVALID)); LogLevel level = LogLevel(Acore::StringTo<uint8>(tokens[1]).value_or(LOG_LEVEL_INVALID));
auto factoryFunction = appenderFactory.find(type); auto factoryFunction = appenderFactory.find(type);
if (factoryFunction == appenderFactory.end()) if (factoryFunction == appenderFactory.end())
@@ -84,7 +84,7 @@ void Log::CreateAppenderFromConfig(std::string const& appenderName)
if (size > 2) if (size > 2)
{ {
if (Optional<uint8> flagsVal = acore::StringTo<uint8>(tokens[2])) if (Optional<uint8> flagsVal = Acore::StringTo<uint8>(tokens[2]))
flags = AppenderFlags(*flagsVal); flags = AppenderFlags(*flagsVal);
else else
{ {
@@ -120,7 +120,7 @@ void Log::CreateLoggerFromConfig(std::string const& appenderName)
return; return;
} }
std::vector<std::string_view> tokens = acore::Tokenize(options, ',', true); std::vector<std::string_view> tokens = Acore::Tokenize(options, ',', true);
if (tokens.size() != 2) if (tokens.size() != 2)
{ {
@@ -135,7 +135,7 @@ void Log::CreateLoggerFromConfig(std::string const& appenderName)
return; return;
} }
level = LogLevel(acore::StringTo<uint8>(tokens[0]).value_or(LOG_LEVEL_INVALID)); level = LogLevel(Acore::StringTo<uint8>(tokens[0]).value_or(LOG_LEVEL_INVALID));
if (level > NUM_ENABLED_LOG_LEVELS) if (level > NUM_ENABLED_LOG_LEVELS)
{ {
fprintf(stderr, "Log::CreateLoggerFromConfig: Wrong Log Level '%s' for logger %s\n", std::string(tokens[0]).c_str(), name.c_str()); fprintf(stderr, "Log::CreateLoggerFromConfig: Wrong Log Level '%s' for logger %s\n", std::string(tokens[0]).c_str(), name.c_str());
@@ -148,7 +148,7 @@ void Log::CreateLoggerFromConfig(std::string const& appenderName)
logger = std::make_unique<Logger>(name, level); logger = std::make_unique<Logger>(name, level);
//fprintf(stdout, "Log::CreateLoggerFromConfig: Created Logger %s, Level %u\n", name.c_str(), level); //fprintf(stdout, "Log::CreateLoggerFromConfig: Created Logger %s, Level %u\n", name.c_str(), level);
for (std::string_view appenderName : acore::Tokenize(tokens[1], ' ', false)) for (std::string_view appenderName : Acore::Tokenize(tokens[1], ' ', false))
{ {
if (Appender* appender = GetAppenderByName(appenderName)) if (Appender* appender = GetAppenderByName(appenderName))
{ {
@@ -248,7 +248,7 @@ std::string Log::GetTimestampStr()
// HH hour (2 digits 00-23) // HH hour (2 digits 00-23)
// MM minutes (2 digits 00-59) // MM minutes (2 digits 00-59)
// SS seconds (2 digits 00-59) // SS seconds (2 digits 00-59)
return acore::StringFormat("%04d-%02d-%02d_%02d-%02d-%02d", return Acore::StringFormat("%04d-%02d-%02d_%02d-%02d-%02d",
aTm.tm_year + 1900, aTm.tm_mon + 1, aTm.tm_mday, aTm.tm_hour, aTm.tm_min, aTm.tm_sec); aTm.tm_year + 1900, aTm.tm_mon + 1, aTm.tm_mday, aTm.tm_hour, aTm.tm_min, aTm.tm_sec);
} }
+11 -11
View File
@@ -52,7 +52,7 @@ public:
template<typename Format, typename... Args> template<typename Format, typename... Args>
inline void outMessage(std::string const& filter, LogLevel const level, Format&& fmt, Args&&... args) inline void outMessage(std::string const& filter, LogLevel const level, Format&& fmt, Args&&... args)
{ {
outMessage(filter, level, acore::StringFormat(std::forward<Format>(fmt), std::forward<Args>(args)...)); outMessage(filter, level, Acore::StringFormat(std::forward<Format>(fmt), std::forward<Args>(args)...));
} }
template<typename Format, typename... Args> template<typename Format, typename... Args>
@@ -61,7 +61,7 @@ public:
if (!ShouldLog("commands.gm", LOG_LEVEL_INFO)) if (!ShouldLog("commands.gm", LOG_LEVEL_INFO))
return; return;
outCommand(acore::StringFormat(std::forward<Format>(fmt), std::forward<Args>(args)...), std::to_string(account)); outCommand(Acore::StringFormat(std::forward<Format>(fmt), std::forward<Args>(args)...), std::to_string(account));
} }
void outCharDump(char const* str, uint32 account_id, uint64 guid, char const* name); void outCharDump(char const* str, uint32 account_id, uint64 guid, char const* name);
@@ -81,7 +81,7 @@ public:
template<typename Format, typename... Args> template<typename Format, typename... Args>
inline void outString(Format&& fmt, Args&& ... args) inline void outString(Format&& fmt, Args&& ... args)
{ {
outMessage("server", LOG_LEVEL_INFO, acore::StringFormat(std::forward<Format>(fmt), std::forward<Args>(args)...)); outMessage("server", LOG_LEVEL_INFO, Acore::StringFormat(std::forward<Format>(fmt), std::forward<Args>(args)...));
} }
inline void outString() inline void outString()
@@ -92,7 +92,7 @@ public:
template<typename Format, typename... Args> template<typename Format, typename... Args>
inline void outError(Format&& fmt, Args&& ... args) inline void outError(Format&& fmt, Args&& ... args)
{ {
outMessage("server", LOG_LEVEL_ERROR, acore::StringFormat(std::forward<Format>(fmt), std::forward<Args>(args)...)); outMessage("server", LOG_LEVEL_ERROR, Acore::StringFormat(std::forward<Format>(fmt), std::forward<Args>(args)...));
} }
template<typename Format, typename... Args> template<typename Format, typename... Args>
@@ -101,19 +101,19 @@ public:
if (!ShouldLog("sql.sql", LOG_LEVEL_ERROR)) if (!ShouldLog("sql.sql", LOG_LEVEL_ERROR))
return; return;
outMessage("sql.sql", LOG_LEVEL_ERROR, acore::StringFormat(std::forward<Format>(fmt), std::forward<Args>(args)...)); outMessage("sql.sql", LOG_LEVEL_ERROR, Acore::StringFormat(std::forward<Format>(fmt), std::forward<Args>(args)...));
} }
template<typename Format, typename... Args> template<typename Format, typename... Args>
inline void outBasic(Format&& fmt, Args&& ... args) inline void outBasic(Format&& fmt, Args&& ... args)
{ {
outMessage("server", LOG_LEVEL_INFO, acore::StringFormat(std::forward<Format>(fmt), std::forward<Args>(args)...)); outMessage("server", LOG_LEVEL_INFO, Acore::StringFormat(std::forward<Format>(fmt), std::forward<Args>(args)...));
} }
template<typename Format, typename... Args> template<typename Format, typename... Args>
inline void outDetail(Format&& fmt, Args&& ... args) inline void outDetail(Format&& fmt, Args&& ... args)
{ {
outMessage("server", LOG_LEVEL_INFO, acore::StringFormat(std::forward<Format>(fmt), std::forward<Args>(args)...)); outMessage("server", LOG_LEVEL_INFO, Acore::StringFormat(std::forward<Format>(fmt), std::forward<Args>(args)...));
} }
template<typename Format, typename... Args> template<typename Format, typename... Args>
@@ -122,7 +122,7 @@ public:
if (!ShouldLog("sql.dev", LOG_LEVEL_INFO)) if (!ShouldLog("sql.dev", LOG_LEVEL_INFO))
return; return;
outMessage("sql.dev", LOG_LEVEL_INFO, acore::StringFormat(std::forward<Format>(fmt), std::forward<Args>(args)...)); outMessage("sql.dev", LOG_LEVEL_INFO, Acore::StringFormat(std::forward<Format>(fmt), std::forward<Args>(args)...));
} }
template<typename Format, typename... Args> template<typename Format, typename... Args>
@@ -131,13 +131,13 @@ public:
if (!ShouldLog("sql.driver", LOG_LEVEL_INFO)) if (!ShouldLog("sql.driver", LOG_LEVEL_INFO))
return; return;
outMessage("sql.driver", LOG_LEVEL_INFO, acore::StringFormat(std::forward<Format>(fmt), std::forward<Args>(args)...)); outMessage("sql.driver", LOG_LEVEL_INFO, Acore::StringFormat(std::forward<Format>(fmt), std::forward<Args>(args)...));
} }
template<typename Format, typename... Args> template<typename Format, typename... Args>
inline void outMisc(Format&& fmt, Args&& ... args) inline void outMisc(Format&& fmt, Args&& ... args)
{ {
outMessage("server", LOG_LEVEL_INFO, acore::StringFormat(std::forward<Format>(fmt), std::forward<Args>(args)...)); outMessage("server", LOG_LEVEL_INFO, Acore::StringFormat(std::forward<Format>(fmt), std::forward<Args>(args)...));
} }
template<typename Format, typename... Args> template<typename Format, typename... Args>
@@ -149,7 +149,7 @@ public:
if (!ShouldLog("server", LOG_LEVEL_DEBUG)) if (!ShouldLog("server", LOG_LEVEL_DEBUG))
return; return;
outMessage("server", LOG_LEVEL_DEBUG, acore::StringFormat(std::forward<Format>(fmt), std::forward<Args>(args)...)); outMessage("server", LOG_LEVEL_DEBUG, Acore::StringFormat(std::forward<Format>(fmt), std::forward<Args>(args)...));
} }
private: private:
+1 -1
View File
@@ -21,7 +21,7 @@ std::string LogMessage::getTimeStr(time_t time)
{ {
tm aTm; tm aTm;
localtime_r(&time, &aTm); localtime_r(&time, &aTm);
return acore::StringFormat("%04d-%02d-%02d_%02d:%02d:%02d", aTm.tm_year + 1900, aTm.tm_mon + 1, aTm.tm_mday, aTm.tm_hour, aTm.tm_min, aTm.tm_sec); return Acore::StringFormat("%04d-%02d-%02d_%02d:%02d:%02d", aTm.tm_year + 1900, aTm.tm_mon + 1, aTm.tm_mday, aTm.tm_hour, aTm.tm_min, aTm.tm_sec);
} }
std::string LogMessage::getTimeStr() const std::string LogMessage::getTimeStr() const
@@ -9,7 +9,7 @@
#include "SmartEnum.h" #include "SmartEnum.h"
#include <stdexcept> #include <stdexcept>
namespace acore::Impl::EnumUtilsImpl namespace Acore::Impl::EnumUtilsImpl
{ {
/********************************************************************\ /********************************************************************\
+1 -1
View File
@@ -9,7 +9,7 @@
#include "SmartEnum.h" #include "SmartEnum.h"
#include <stdexcept> #include <stdexcept>
namespace acore::Impl::EnumUtilsImpl namespace Acore::Impl::EnumUtilsImpl
{ {
/************************************************************\ /************************************************************\
+1 -1
View File
@@ -13,7 +13,7 @@
#ifdef WIN32 #ifdef WIN32
#include <windows.h> #include <windows.h>
#endif // WIN32 #endif // WIN32
using namespace acore; using namespace Acore;
Thread::Thread() : m_task(nullptr), m_iThreadId(), m_ThreadImp() Thread::Thread() : m_task(nullptr), m_iThreadId(), m_ThreadImp()
{ {
+1 -1
View File
@@ -10,7 +10,7 @@
#include <thread> #include <thread>
#include <atomic> #include <atomic>
namespace acore namespace Acore
{ {
class Runnable class Runnable
{ {
+3 -3
View File
@@ -14,7 +14,7 @@
#include "Define.h" #include "Define.h"
namespace acore namespace Acore
{ {
template<typename MUTEX> template<typename MUTEX>
class GeneralLock class GeneralLock
@@ -126,9 +126,9 @@ namespace acore
}; };
} }
template<class T, class MUTEX> MUTEX acore::ClassLevelLockable<T, MUTEX>::si_mtx; template<class T, class MUTEX> MUTEX Acore::ClassLevelLockable<T, MUTEX>::si_mtx;
#define INSTANTIATE_CLASS_MUTEX(CTYPE, MUTEX) \ #define INSTANTIATE_CLASS_MUTEX(CTYPE, MUTEX) \
template class acore::ClassLevelLockable<CTYPE, MUTEX> template class Acore::ClassLevelLockable<CTYPE, MUTEX>
#endif #endif
+4 -4
View File
@@ -16,7 +16,7 @@
#include <utility> #include <utility>
#include <vector> #include <vector>
namespace acore namespace Acore
{ {
template<class T> template<class T>
constexpr inline T* AddressOrSelf(T* ptr) constexpr inline T* AddressOrSelf(T* ptr)
@@ -60,14 +60,14 @@ namespace acore
}; };
} }
namespace acore::Containers namespace Acore::Containers
{ {
// resizes <container> to have at most <requestedSize> elements // resizes <container> to have at most <requestedSize> elements
// if it has more than <requestedSize> elements, the elements to keep are selected randomly // if it has more than <requestedSize> elements, the elements to keep are selected randomly
template<class C> template<class C>
void RandomResize(C& container, std::size_t requestedSize) void RandomResize(C& container, std::size_t requestedSize)
{ {
static_assert(std::is_base_of<std::forward_iterator_tag, typename std::iterator_traits<typename C::iterator>::iterator_category>::value, "Invalid container passed to acore::Containers::RandomResize"); static_assert(std::is_base_of<std::forward_iterator_tag, typename std::iterator_traits<typename C::iterator>::iterator_category>::value, "Invalid container passed to Acore::Containers::RandomResize");
if (std::size(container) <= requestedSize) if (std::size(container) <= requestedSize)
return; return;
@@ -176,7 +176,7 @@ namespace acore::Containers
} }
/* /*
* @fn void acore::Containers::RandomShuffle(C& container) * @fn void Acore::Containers::RandomShuffle(C& container)
* *
* @brief Reorder the elements of the container randomly. * @brief Reorder the elements of the container randomly.
* *
+2 -2
View File
@@ -9,7 +9,7 @@
#include "Define.h" #include "Define.h"
#include <utility> #include <utility>
namespace acore namespace Acore
{ {
/** /**
* @class IteratorPair * @class IteratorPair
@@ -41,6 +41,6 @@ namespace acore
} }
//! namespace Containers //! namespace Containers
} }
//! namespace acore //! namespace Acore
#endif // IteratorPair_h__ #endif // IteratorPair_h__
+1 -1
View File
@@ -11,7 +11,7 @@
#include <unordered_set> #include <unordered_set>
#include <mutex> #include <mutex>
namespace acore namespace Acore
{ {
/// Handle termination signals /// Handle termination signals
class SignalHandler class SignalHandler
+7 -7
View File
@@ -20,7 +20,7 @@ struct EnumText
char const* const Description; char const* const Description;
}; };
namespace acore::Impl::EnumUtilsImpl namespace Acore::Impl::EnumUtilsImpl
{ {
template <typename Enum> template <typename Enum>
struct EnumUtils struct EnumUtils
@@ -36,20 +36,20 @@ class EnumUtils
{ {
public: public:
template <typename Enum> template <typename Enum>
static size_t Count() { return acore::Impl::EnumUtilsImpl::EnumUtils<Enum>::Count(); } static size_t Count() { return Acore::Impl::EnumUtilsImpl::EnumUtils<Enum>::Count(); }
template <typename Enum> template <typename Enum>
static EnumText ToString(Enum value) { return acore::Impl::EnumUtilsImpl::EnumUtils<Enum>::ToString(value); } static EnumText ToString(Enum value) { return Acore::Impl::EnumUtilsImpl::EnumUtils<Enum>::ToString(value); }
template <typename Enum> template <typename Enum>
static Enum FromIndex(size_t index) { return acore::Impl::EnumUtilsImpl::EnumUtils<Enum>::FromIndex(index); } static Enum FromIndex(size_t index) { return Acore::Impl::EnumUtilsImpl::EnumUtils<Enum>::FromIndex(index); }
template <typename Enum> template <typename Enum>
static uint32 ToIndex(Enum value) { return acore::Impl::EnumUtilsImpl::EnumUtils<Enum>::ToIndex(value);} static uint32 ToIndex(Enum value) { return Acore::Impl::EnumUtilsImpl::EnumUtils<Enum>::ToIndex(value);}
template<typename Enum> template<typename Enum>
static bool IsValid(Enum value) static bool IsValid(Enum value)
{ {
try try
{ {
acore::Impl::EnumUtilsImpl::EnumUtils<Enum>::ToIndex(value); Acore::Impl::EnumUtilsImpl::EnumUtils<Enum>::ToIndex(value);
return true; return true;
} catch (...) } catch (...)
{ {
@@ -105,7 +105,7 @@ class EnumUtils
static Iterator<Enum> End() { return Iterator<Enum>(); } static Iterator<Enum> End() { return Iterator<Enum>(); }
template <typename Enum> template <typename Enum>
static acore::IteratorPair<Iterator<Enum>> Iterate() { return { Begin<Enum>(), End<Enum>() }; } static Acore::IteratorPair<Iterator<Enum>> Iterate() { return { Begin<Enum>(), End<Enum>() }; }
template <typename Enum> template <typename Enum>
static char const* ToConstant(Enum value) { return ToString(value).Constant; } static char const* ToConstant(Enum value) { return ToString(value).Constant; }
+5 -5
View File
@@ -16,11 +16,11 @@
#include <string_view> #include <string_view>
#include <type_traits> #include <type_traits>
namespace acore::Impl::StringConvertImpl namespace Acore::Impl::StringConvertImpl
{ {
template <typename T, typename = void> struct For template <typename T, typename = void> struct For
{ {
static_assert(acore::dependant_false_v<T>, "Unsupported type used for ToString or StringTo"); static_assert(Acore::dependant_false_v<T>, "Unsupported type used for ToString or StringTo");
}; };
template <typename T> template <typename T>
@@ -241,18 +241,18 @@ namespace acore::Impl::StringConvertImpl
#endif #endif
} }
namespace acore namespace Acore
{ {
template <typename Result, typename... Params> template <typename Result, typename... Params>
Optional<Result> StringTo(std::string_view str, Params&&... params) Optional<Result> StringTo(std::string_view str, Params&&... params)
{ {
return acore::Impl::StringConvertImpl::For<Result>::FromString(str, std::forward<Params>(params)...); return Acore::Impl::StringConvertImpl::For<Result>::FromString(str, std::forward<Params>(params)...);
} }
template <typename Type, typename... Params> template <typename Type, typename... Params>
std::string ToString(Type&& val, Params&&... params) std::string ToString(Type&& val, Params&&... params)
{ {
return acore::Impl::StringConvertImpl::For<std::decay_t<Type>>::ToString(std::forward<Type>(val), std::forward<Params>(params)...); return Acore::Impl::StringConvertImpl::For<std::decay_t<Type>>::ToString(std::forward<Type>(val), std::forward<Params>(params)...);
} }
} }
+2 -2
View File
@@ -7,7 +7,7 @@
#include <locale> #include <locale>
template<class Str> template<class Str>
Str acore::String::Trim(const Str& s, const std::locale& loc /*= std::locale()*/) Str Acore::String::Trim(const Str& s, const std::locale& loc /*= std::locale()*/)
{ {
typename Str::const_iterator first = s.begin(); typename Str::const_iterator first = s.begin();
typename Str::const_iterator end = s.end(); typename Str::const_iterator end = s.end();
@@ -31,4 +31,4 @@ Str acore::String::Trim(const Str& s, const std::locale& loc /*= std::locale()*/
} }
// Template Trim // Template Trim
template std::string acore::String::Trim<std::string>(const std::string& s, const std::locale& loc /*= std::locale()*/); template std::string Acore::String::Trim<std::string>(const std::string& s, const std::locale& loc /*= std::locale()*/);
+2 -2
View File
@@ -10,7 +10,7 @@
#include <fmt/printf.h> #include <fmt/printf.h>
namespace acore namespace Acore
{ {
/// Default AC string format function. /// Default AC string format function.
template<typename Format, typename... Args> template<typename Format, typename... Args>
@@ -40,7 +40,7 @@ namespace acore
} }
} }
namespace acore::String namespace Acore::String
{ {
template<class Str> template<class Str>
Str Trim(const Str& s, const std::locale& loc = std::locale()); Str Trim(const Str& s, const std::locale& loc = std::locale());
+1 -1
View File
@@ -5,7 +5,7 @@
#include "Tokenize.h" #include "Tokenize.h"
std::vector<std::string_view> acore::Tokenize(std::string_view str, char sep, bool keepEmpty) std::vector<std::string_view> Acore::Tokenize(std::string_view str, char sep, bool keepEmpty)
{ {
std::vector<std::string_view> tokens; std::vector<std::string_view> tokens;
+1 -1
View File
@@ -10,7 +10,7 @@
#include <string_view> #include <string_view>
#include <vector> #include <vector>
namespace acore namespace Acore
{ {
std::vector<std::string_view> Tokenize(std::string_view str, char sep, bool keepEmpty); std::vector<std::string_view> Tokenize(std::string_view str, char sep, bool keepEmpty);
+1 -1
View File
@@ -8,7 +8,7 @@
#include <tuple> #include <tuple>
namespace acore namespace Acore
{ {
template <typename T, typename Tuple> template <typename T, typename Tuple>
struct has_type; struct has_type;
+4 -4
View File
@@ -8,7 +8,7 @@
#include "advstd.h" #include "advstd.h"
namespace acore namespace Acore
{ {
// end "iterator" tag for find_type_if // end "iterator" tag for find_type_if
struct find_type_end; struct find_type_end;
@@ -35,11 +35,11 @@ namespace acore
template<typename... Ts> template<typename... Ts>
struct Example struct Example
{ {
using TupleArg = acore::find_type_if_t<acore::is_tuple, Ts...>; using TupleArg = Acore::find_type_if_t<Acore::is_tuple, Ts...>;
bool HasTuple() bool HasTuple()
{ {
return !std::is_same_v<TupleArg, acore::find_type_end>; return !std::is_same_v<TupleArg, Acore::find_type_end>;
} }
}; };
@@ -47,7 +47,7 @@ namespace acore
example.HasTuple() == true; // TupleArg is std::tuple<int, int, int> example.HasTuple() == true; // TupleArg is std::tuple<int, int, int>
Example<int, std::string, char> example2; Example<int, std::string, char> example2;
example2.HasTuple() == false; // TupleArg is acore::find_type_end example2.HasTuple() == false; // TupleArg is Acore::find_type_end
*/ */
template<template<typename...> typename Check, typename... Ts> template<template<typename...> typename Check, typename... Ts>
+3 -3
View File
@@ -343,7 +343,7 @@ bool Utf8toWStr(char const* utf8str, size_t csize, wchar_t* wstr, size_t& wsize)
{ {
try try
{ {
acore::CheckedBufferOutputIterator<wchar_t> out(wstr, wsize); Acore::CheckedBufferOutputIterator<wchar_t> out(wstr, wsize);
out = utf8::utf8to16(utf8str, utf8str + csize, out); out = utf8::utf8to16(utf8str, utf8str + csize, out);
wsize -= out.remaining(); // remaining unused space wsize -= out.remaining(); // remaining unused space
wstr[wsize] = L'\0'; wstr[wsize] = L'\0';
@@ -585,7 +585,7 @@ bool Utf8ToUpperOnlyLatin(std::string& utf8String)
return WStrToUtf8(wstr, utf8String); return WStrToUtf8(wstr, utf8String);
} }
std::string acore::Impl::ByteArrayToHexStr(uint8 const* bytes, size_t arrayLen, bool reverse /* = false */) std::string Acore::Impl::ByteArrayToHexStr(uint8 const* bytes, size_t arrayLen, bool reverse /* = false */)
{ {
int32 init = 0; int32 init = 0;
int32 end = arrayLen; int32 end = arrayLen;
@@ -609,7 +609,7 @@ std::string acore::Impl::ByteArrayToHexStr(uint8 const* bytes, size_t arrayLen,
return ss.str(); return ss.str();
} }
void acore::Impl::HexStrToByteArray(std::string const& str, uint8* out, size_t outlen, bool reverse /*= false*/) void Acore::Impl::HexStrToByteArray(std::string const& str, uint8* out, size_t outlen, bool reverse /*= false*/)
{ {
ASSERT(str.size() == (2 * outlen)); ASSERT(str.size() == (2 * outlen));
+3 -3
View File
@@ -314,7 +314,7 @@ uint32 GetPID();
bool StringEqualI(std::string_view str1, std::string_view str2); bool StringEqualI(std::string_view str1, std::string_view str2);
namespace acore::Impl namespace Acore::Impl
{ {
std::string ByteArrayToHexStr(uint8 const* bytes, size_t length, bool reverse = false); std::string ByteArrayToHexStr(uint8 const* bytes, size_t length, bool reverse = false);
void HexStrToByteArray(std::string const& str, uint8* out, size_t outlen, bool reverse = false); void HexStrToByteArray(std::string const& str, uint8* out, size_t outlen, bool reverse = false);
@@ -323,13 +323,13 @@ namespace acore::Impl
template<typename Container> template<typename Container>
std::string ByteArrayToHexStr(Container const& c, bool reverse = false) std::string ByteArrayToHexStr(Container const& c, bool reverse = false)
{ {
return acore::Impl::ByteArrayToHexStr(std::data(c), std::size(c), reverse); return Acore::Impl::ByteArrayToHexStr(std::data(c), std::size(c), reverse);
} }
template<size_t Size> template<size_t Size>
void HexStrToByteArray(std::string const& str, std::array<uint8, Size>& buf, bool reverse = false) void HexStrToByteArray(std::string const& str, std::array<uint8, Size>& buf, bool reverse = false)
{ {
acore::Impl::HexStrToByteArray(str, buf.data(), Size, reverse); Acore::Impl::HexStrToByteArray(str, buf.data(), Size, reverse);
} }
template<size_t Size> template<size_t Size>
std::array<uint8, Size> HexStrToByteArray(std::string const& str, bool reverse = false) std::array<uint8, Size> HexStrToByteArray(std::string const& str, bool reverse = false)
+3 -3
View File
@@ -61,7 +61,7 @@ void usage(const char* prog)
/// Launch the auth server /// Launch the auth server
extern int main(int argc, char** argv) extern int main(int argc, char** argv)
{ {
acore::Impl::CurrentServerProcessHolder::_type = SERVER_PROCESS_AUTHSERVER; Acore::Impl::CurrentServerProcessHolder::_type = SERVER_PROCESS_AUTHSERVER;
// Command line parsing to get the configuration file name // Command line parsing to get the configuration file name
std::string configFile = sConfigMgr->GetConfigPath() + std::string(_ACORE_REALM_CONFIG); std::string configFile = sConfigMgr->GetConfigPath() + std::string(_ACORE_REALM_CONFIG);
@@ -92,7 +92,7 @@ extern int main(int argc, char** argv)
sLog->RegisterAppender<AppenderDB>(); sLog->RegisterAppender<AppenderDB>();
sLog->Initialize(); sLog->Initialize();
acore::Banner::Show("authserver", Acore::Banner::Show("authserver",
[](char const* text) [](char const* text)
{ {
LOG_INFO("server.authserver", "%s", text); LOG_INFO("server.authserver", "%s", text);
@@ -164,7 +164,7 @@ extern int main(int argc, char** argv)
LOG_INFO("server.authserver", "Authserver listening to %s:%d", bind_ip.c_str(), rmport); LOG_INFO("server.authserver", "Authserver listening to %s:%d", bind_ip.c_str(), rmport);
// Initialize the signal handlers // Initialize the signal handlers
acore::SignalHandler signalHandler; Acore::SignalHandler signalHandler;
auto const _handler = [](int) { stopEvent = true; }; auto const _handler = [](int) { stopEvent = true; };
// Register authservers's signal handlers // Register authservers's signal handlers
+16 -16
View File
@@ -69,9 +69,9 @@ typedef struct AUTH_LOGON_CHALLENGE_C
typedef struct AUTH_LOGON_PROOF_C typedef struct AUTH_LOGON_PROOF_C
{ {
uint8 cmd; uint8 cmd;
acore::Crypto::SRP6::EphemeralKey A; Acore::Crypto::SRP6::EphemeralKey A;
acore::Crypto::SHA1::Digest clientM; Acore::Crypto::SHA1::Digest clientM;
acore::Crypto::SHA1::Digest crc_hash; Acore::Crypto::SHA1::Digest crc_hash;
uint8 number_of_keys; uint8 number_of_keys;
uint8 securityFlags; // 0x00-0x04 uint8 securityFlags; // 0x00-0x04
} sAuthLogonProof_C; } sAuthLogonProof_C;
@@ -80,7 +80,7 @@ typedef struct AUTH_LOGON_PROOF_S
{ {
uint8 cmd; uint8 cmd;
uint8 error; uint8 error;
acore::Crypto::SHA1::Digest M2; Acore::Crypto::SHA1::Digest M2;
uint32 unk1; uint32 unk1;
uint32 unk2; uint32 unk2;
uint16 unk3; uint16 unk3;
@@ -90,7 +90,7 @@ typedef struct AUTH_LOGON_PROOF_S_OLD
{ {
uint8 cmd; uint8 cmd;
uint8 error; uint8 error;
acore::Crypto::SHA1::Digest M2; Acore::Crypto::SHA1::Digest M2;
uint32 unk2; uint32 unk2;
} sAuthLogonProof_S_Old; } sAuthLogonProof_S_Old;
@@ -98,7 +98,7 @@ typedef struct AUTH_RECONNECT_PROOF_C
{ {
uint8 cmd; uint8 cmd;
uint8 R1[16]; uint8 R1[16];
acore::Crypto::SHA1::Digest R2, R3; Acore::Crypto::SHA1::Digest R2, R3;
uint8 number_of_keys; uint8 number_of_keys;
} sAuthReconnectProof_C; } sAuthReconnectProof_C;
@@ -133,7 +133,7 @@ typedef struct AuthHandler
#endif #endif
// Launch a thread to transfer a patch to the client // Launch a thread to transfer a patch to the client
class PatcherRunnable: public acore::Runnable class PatcherRunnable: public Acore::Runnable
{ {
public: public:
PatcherRunnable(class AuthSocket*); PatcherRunnable(class AuthSocket*);
@@ -477,7 +477,7 @@ bool AuthSocket::_HandleLogonChallenge()
_totpSecret = fields[9].GetBinary(); _totpSecret = fields[9].GetBinary();
if (auto const& secret = sSecretMgr->GetSecret(SECRET_TOTP_MASTER_KEY)) if (auto const& secret = sSecretMgr->GetSecret(SECRET_TOTP_MASTER_KEY))
{ {
bool success = acore::Crypto::AEDecrypt<acore::Crypto::AES>(*_totpSecret, *secret); bool success = Acore::Crypto::AEDecrypt<Acore::Crypto::AES>(*_totpSecret, *secret);
if (!success) if (!success)
{ {
pkt << uint8(WOW_FAIL_DB_BUSY); pkt << uint8(WOW_FAIL_DB_BUSY);
@@ -490,8 +490,8 @@ bool AuthSocket::_HandleLogonChallenge()
_srp6.emplace( _srp6.emplace(
_accountInfo.Login, _accountInfo.Login,
fields[10].GetBinary<acore::Crypto::SRP6::SALT_LENGTH>(), fields[10].GetBinary<Acore::Crypto::SRP6::SALT_LENGTH>(),
fields[11].GetBinary<acore::Crypto::SRP6::VERIFIER_LENGTH>()); fields[11].GetBinary<Acore::Crypto::SRP6::VERIFIER_LENGTH>());
// Fill the response packet with the result // Fill the response packet with the result
if (!AuthHelper::IsAcceptedClientBuild(_build)) if (!AuthHelper::IsAcceptedClientBuild(_build))
@@ -583,7 +583,7 @@ bool AuthSocket::_HandleLogonProof()
unsigned int incomingToken = atoi(token); unsigned int incomingToken = atoi(token);
delete[] token; delete[] token;
tokenSuccess = acore::Crypto::TOTP::ValidateToken(*_totpSecret, incomingToken); tokenSuccess = Acore::Crypto::TOTP::ValidateToken(*_totpSecret, incomingToken);
memset(_totpSecret->data(), 0, _totpSecret->size()); memset(_totpSecret->data(), 0, _totpSecret->size());
} }
else if (!sentToken && !_totpSecret) else if (!sentToken && !_totpSecret)
@@ -609,7 +609,7 @@ bool AuthSocket::_HandleLogonProof()
LoginDatabase.DirectExecute(stmt); LoginDatabase.DirectExecute(stmt);
// Finish SRP6 and send the final result to the client // Finish SRP6 and send the final result to the client
acore::Crypto::SHA1::Digest M2 = acore::Crypto::SRP6::GetSessionVerifier(lp.A, lp.clientM, _sessionKey); Acore::Crypto::SHA1::Digest M2 = Acore::Crypto::SRP6::GetSessionVerifier(lp.A, lp.clientM, _sessionKey);
if (_expversion & POST_BC_EXP_FLAG) // 2.x and 3.x clients if (_expversion & POST_BC_EXP_FLAG) // 2.x and 3.x clients
{ {
@@ -765,7 +765,7 @@ bool AuthSocket::_HandleReconnectChallenge()
std::reverse(_os.begin(), _os.end()); std::reverse(_os.begin(), _os.end());
_sessionKey = fields[9].GetBinary<SESSION_KEY_LENGTH>(); _sessionKey = fields[9].GetBinary<SESSION_KEY_LENGTH>();
acore::Crypto::GetRandomBytes(_reconnectProof); Acore::Crypto::GetRandomBytes(_reconnectProof);
///- All good, await client's proof ///- All good, await client's proof
_status = STATUS_RECON_PROOF; _status = STATUS_RECON_PROOF;
@@ -799,7 +799,7 @@ bool AuthSocket::_HandleReconnectProof()
BigNumber t1; BigNumber t1;
t1.SetBinary(lp.R1, 16); t1.SetBinary(lp.R1, 16);
acore::Crypto::SHA1 sha; Acore::Crypto::SHA1 sha;
sha.UpdateData(_accountInfo.Login); sha.UpdateData(_accountInfo.Login);
sha.UpdateData(t1.ToByteArray<16>()); sha.UpdateData(t1.ToByteArray<16>());
sha.UpdateData(_reconnectProof); sha.UpdateData(_reconnectProof);
@@ -1005,7 +1005,7 @@ bool AuthSocket::_HandleXferResume()
socket().recv((char*)&start, sizeof(start)); socket().recv((char*)&start, sizeof(start));
fseek(pPatch, long(start), 0); fseek(pPatch, long(start), 0);
acore::Thread u(new PatcherRunnable(this)); Acore::Thread u(new PatcherRunnable(this));
return true; return true;
} }
@@ -1041,7 +1041,7 @@ bool AuthSocket::_HandleXferAccept()
socket().recv_skip(1); // clear input buffer socket().recv_skip(1); // clear input buffer
fseek(pPatch, 0, 0); fseek(pPatch, 0, 0);
acore::Thread u(new PatcherRunnable(this)); Acore::Thread u(new PatcherRunnable(this));
return true; return true;
} }
+1 -1
View File
@@ -76,7 +76,7 @@ private:
RealmSocket& socket_; RealmSocket& socket_;
RealmSocket& socket() { return socket_; } RealmSocket& socket() { return socket_; }
std::optional<acore::Crypto::SRP6> _srp6; std::optional<Acore::Crypto::SRP6> _srp6;
SessionKey _sessionKey = {}; SessionKey _sessionKey = {};
std::array<uint8, 16> _reconnectProof = {}; std::array<uint8, 16> _reconnectProof = {};
@@ -63,10 +63,10 @@ public:
template<typename Format, typename... Args> template<typename Format, typename... Args>
void PExecute(Format&& sql, Args&& ... args) void PExecute(Format&& sql, Args&& ... args)
{ {
if (acore::IsFormatEmptyOrNull(sql)) if (Acore::IsFormatEmptyOrNull(sql))
return; return;
Execute(acore::StringFormat(std::forward<Format>(sql), std::forward<Args>(args)...).c_str()); Execute(Acore::StringFormat(std::forward<Format>(sql), std::forward<Args>(args)...).c_str());
} }
//! Enqueues a one-way SQL operation in prepared statement format that will be executed asynchronously. //! Enqueues a one-way SQL operation in prepared statement format that will be executed asynchronously.
@@ -86,10 +86,10 @@ public:
template<typename Format, typename... Args> template<typename Format, typename... Args>
void DirectPExecute(Format&& sql, Args&& ... args) void DirectPExecute(Format&& sql, Args&& ... args)
{ {
if (acore::IsFormatEmptyOrNull(sql)) if (Acore::IsFormatEmptyOrNull(sql))
return; return;
DirectExecute(acore::StringFormat(std::forward<Format>(sql), std::forward<Args>(args)...).c_str()); DirectExecute(Acore::StringFormat(std::forward<Format>(sql), std::forward<Args>(args)...).c_str());
} }
//! Directly executes a one-way SQL operation in prepared statement format, that will block the calling thread until finished. //! Directly executes a one-way SQL operation in prepared statement format, that will block the calling thread until finished.
@@ -109,10 +109,10 @@ public:
template<typename Format, typename... Args> template<typename Format, typename... Args>
QueryResult PQuery(Format&& sql, T* conn, Args&& ... args) QueryResult PQuery(Format&& sql, T* conn, Args&& ... args)
{ {
if (acore::IsFormatEmptyOrNull(sql)) if (Acore::IsFormatEmptyOrNull(sql))
return QueryResult(nullptr); return QueryResult(nullptr);
return Query(acore::StringFormat(std::forward<Format>(sql), std::forward<Args>(args)...).c_str(), conn); return Query(Acore::StringFormat(std::forward<Format>(sql), std::forward<Args>(args)...).c_str(), conn);
} }
//! Directly executes an SQL query in string format -with variable args- that will block the calling thread until finished. //! Directly executes an SQL query in string format -with variable args- that will block the calling thread until finished.
@@ -120,10 +120,10 @@ public:
template<typename Format, typename... Args> template<typename Format, typename... Args>
QueryResult PQuery(Format&& sql, Args&& ... args) QueryResult PQuery(Format&& sql, Args&& ... args)
{ {
if (acore::IsFormatEmptyOrNull(sql)) if (Acore::IsFormatEmptyOrNull(sql))
return QueryResult(nullptr); return QueryResult(nullptr);
return Query(acore::StringFormat(std::forward<Format>(sql), std::forward<Args>(args)...).c_str()); return Query(Acore::StringFormat(std::forward<Format>(sql), std::forward<Args>(args)...).c_str());
} }
//! Directly executes an SQL query in prepared format that will block the calling thread until finished. //! Directly executes an SQL query in prepared format that will block the calling thread until finished.
@@ -144,10 +144,10 @@ public:
template<typename Format, typename... Args> template<typename Format, typename... Args>
QueryResultFuture AsyncPQuery(Format&& sql, Args&& ... args) QueryResultFuture AsyncPQuery(Format&& sql, Args&& ... args)
{ {
if (acore::IsFormatEmptyOrNull(sql)) if (Acore::IsFormatEmptyOrNull(sql))
return QueryResult(nullptr); return QueryResult(nullptr);
return AsyncQuery(acore::StringFormat(std::forward<Format>(sql), std::forward<Args>(args)...).c_str()); return AsyncQuery(Acore::StringFormat(std::forward<Format>(sql), std::forward<Args>(args)...).c_str());
} }
//! Enqueues a query in prepared format that will set the value of the PreparedQueryResultFuture return object as soon as the query is executed. //! Enqueues a query in prepared format that will set the value of the PreparedQueryResultFuture return object as soon as the query is executed.
+2 -2
View File
@@ -71,8 +71,8 @@ void TotemAI::UpdateAI(uint32 /*diff*/)
me->IsFriendlyTo(victim) || !me->CanSeeOrDetect(victim)) me->IsFriendlyTo(victim) || !me->CanSeeOrDetect(victim))
{ {
victim = nullptr; victim = nullptr;
acore::NearestAttackableUnitInObjectRangeCheck u_check(me, me, max_range); Acore::NearestAttackableUnitInObjectRangeCheck u_check(me, me, max_range);
acore::UnitLastSearcher<acore::NearestAttackableUnitInObjectRangeCheck> checker(me, victim, u_check); Acore::UnitLastSearcher<Acore::NearestAttackableUnitInObjectRangeCheck> checker(me, victim, u_check);
me->VisitNearbyObject(max_range, checker); me->VisitNearbyObject(max_range, checker);
} }
+10 -10
View File
@@ -28,7 +28,7 @@ enum SelectAggroTarget
}; };
// default predicate function to select target based on distance, player and/or aura criteria // default predicate function to select target based on distance, player and/or aura criteria
struct DefaultTargetSelector : public acore::unary_function<Unit*, bool> struct DefaultTargetSelector : public Acore::unary_function<Unit*, bool>
{ {
const Unit* me; const Unit* me;
float m_dist; float m_dist;
@@ -78,7 +78,7 @@ struct DefaultTargetSelector : public acore::unary_function<Unit*, bool>
// Target selector for spell casts checking range, auras and attributes // Target selector for spell casts checking range, auras and attributes
// TODO: Add more checks from Spell::CheckCast // TODO: Add more checks from Spell::CheckCast
struct SpellTargetSelector : public acore::unary_function<Unit*, bool> struct SpellTargetSelector : public Acore::unary_function<Unit*, bool>
{ {
public: public:
SpellTargetSelector(Unit* caster, uint32 spellId); SpellTargetSelector(Unit* caster, uint32 spellId);
@@ -92,7 +92,7 @@ private:
// Very simple target selector, will just skip main target // Very simple target selector, will just skip main target
// NOTE: When passing to UnitAI::SelectTarget remember to use 0 as position for random selection // NOTE: When passing to UnitAI::SelectTarget remember to use 0 as position for random selection
// because tank will not be in the temporary list // because tank will not be in the temporary list
struct NonTankTargetSelector : public acore::unary_function<Unit*, bool> struct NonTankTargetSelector : public Acore::unary_function<Unit*, bool>
{ {
public: public:
NonTankTargetSelector(Creature* source, bool playerOnly = true) : _source(source), _playerOnly(playerOnly) { } NonTankTargetSelector(Creature* source, bool playerOnly = true) : _source(source), _playerOnly(playerOnly) { }
@@ -104,7 +104,7 @@ private:
}; };
// Simple selector for units using mana // Simple selector for units using mana
struct PowerUsersSelector : public acore::unary_function<Unit*, bool> struct PowerUsersSelector : public Acore::unary_function<Unit*, bool>
{ {
Unit const* _me; Unit const* _me;
Powers const _power; Powers const _power;
@@ -134,7 +134,7 @@ struct PowerUsersSelector : public acore::unary_function<Unit*, bool>
} }
}; };
struct FarthestTargetSelector : public acore::unary_function<Unit*, bool> struct FarthestTargetSelector : public Acore::unary_function<Unit*, bool>
{ {
FarthestTargetSelector(Unit const* unit, float dist, bool playerOnly, bool inLos) : _me(unit), _dist(dist), _playerOnly(playerOnly), _inLos(inLos) {} FarthestTargetSelector(Unit const* unit, float dist, bool playerOnly, bool inLos) : _me(unit), _dist(dist), _playerOnly(playerOnly), _inLos(inLos) {}
@@ -190,7 +190,7 @@ public:
Unit* SelectTarget(SelectAggroTarget targetType, uint32 position = 0, float dist = 0.0f, bool playerOnly = false, int32 aura = 0); Unit* SelectTarget(SelectAggroTarget targetType, uint32 position = 0, float dist = 0.0f, bool playerOnly = false, int32 aura = 0);
// Select the targets satifying the predicate. // Select the targets satifying the predicate.
// predicate shall extend acore::unary_function<Unit*, bool> // predicate shall extend Acore::unary_function<Unit*, bool>
template <class PREDICATE> Unit* SelectTarget(SelectAggroTarget targetType, uint32 position, PREDICATE const& predicate) template <class PREDICATE> Unit* SelectTarget(SelectAggroTarget targetType, uint32 position, PREDICATE const& predicate)
{ {
ThreatContainer::StorageType const& threatlist = me->getThreatManager().getThreatList(); ThreatContainer::StorageType const& threatlist = me->getThreatManager().getThreatList();
@@ -206,7 +206,7 @@ public:
return nullptr; return nullptr;
if (targetType == SELECT_TARGET_NEAREST || targetType == SELECT_TARGET_FARTHEST) if (targetType == SELECT_TARGET_NEAREST || targetType == SELECT_TARGET_FARTHEST)
targetList.sort(acore::ObjectDistanceOrderPred(me)); targetList.sort(Acore::ObjectDistanceOrderPred(me));
switch (targetType) switch (targetType)
{ {
@@ -240,7 +240,7 @@ public:
void SelectTargetList(std::list<Unit*>& targetList, uint32 num, SelectAggroTarget targetType, float dist = 0.0f, bool playerOnly = false, int32 aura = 0); void SelectTargetList(std::list<Unit*>& targetList, uint32 num, SelectAggroTarget targetType, float dist = 0.0f, bool playerOnly = false, int32 aura = 0);
// Select the targets satifying the predicate. // Select the targets satifying the predicate.
// predicate shall extend acore::unary_function<Unit*, bool> // predicate shall extend Acore::unary_function<Unit*, bool>
template <class PREDICATE> void SelectTargetList(std::list<Unit*>& targetList, PREDICATE const& predicate, uint32 maxTargets, SelectAggroTarget targetType) template <class PREDICATE> void SelectTargetList(std::list<Unit*>& targetList, PREDICATE const& predicate, uint32 maxTargets, SelectAggroTarget targetType)
{ {
ThreatContainer::StorageType const& threatlist = me->getThreatManager().getThreatList(); ThreatContainer::StorageType const& threatlist = me->getThreatManager().getThreatList();
@@ -255,13 +255,13 @@ public:
return; return;
if (targetType == SELECT_TARGET_NEAREST || targetType == SELECT_TARGET_FARTHEST) if (targetType == SELECT_TARGET_NEAREST || targetType == SELECT_TARGET_FARTHEST)
targetList.sort(acore::ObjectDistanceOrderPred(me)); targetList.sort(Acore::ObjectDistanceOrderPred(me));
if (targetType == SELECT_TARGET_FARTHEST || targetType == SELECT_TARGET_BOTTOMAGGRO) if (targetType == SELECT_TARGET_FARTHEST || targetType == SELECT_TARGET_BOTTOMAGGRO)
targetList.reverse(); targetList.reverse();
if (targetType == SELECT_TARGET_RANDOM) if (targetType == SELECT_TARGET_RANDOM)
acore::Containers::RandomResize(targetList, maxTargets); Acore::Containers::RandomResize(targetList, maxTargets);
else else
targetList.resize(maxTargets); targetList.resize(maxTargets);
} }
@@ -379,8 +379,8 @@ void ScriptedAI::DoTeleportAll(float x, float y, float z, float o)
Unit* ScriptedAI::DoSelectLowestHpFriendly(float range, uint32 minHPDiff) Unit* ScriptedAI::DoSelectLowestHpFriendly(float range, uint32 minHPDiff)
{ {
Unit* unit = nullptr; Unit* unit = nullptr;
acore::MostHPMissingInRange u_check(me, range, minHPDiff); Acore::MostHPMissingInRange u_check(me, range, minHPDiff);
acore::UnitLastSearcher<acore::MostHPMissingInRange> searcher(me, unit, u_check); Acore::UnitLastSearcher<Acore::MostHPMissingInRange> searcher(me, unit, u_check);
me->VisitNearbyObject(range, searcher); me->VisitNearbyObject(range, searcher);
return unit; return unit;
@@ -389,8 +389,8 @@ Unit* ScriptedAI::DoSelectLowestHpFriendly(float range, uint32 minHPDiff)
std::list<Creature*> ScriptedAI::DoFindFriendlyCC(float range) std::list<Creature*> ScriptedAI::DoFindFriendlyCC(float range)
{ {
std::list<Creature*> list; std::list<Creature*> list;
acore::FriendlyCCedInRange u_check(me, range); Acore::FriendlyCCedInRange u_check(me, range);
acore::CreatureListSearcher<acore::FriendlyCCedInRange> searcher(me, list, u_check); Acore::CreatureListSearcher<Acore::FriendlyCCedInRange> searcher(me, list, u_check);
me->VisitNearbyObject(range, searcher); me->VisitNearbyObject(range, searcher);
return list; return list;
} }
@@ -398,8 +398,8 @@ std::list<Creature*> ScriptedAI::DoFindFriendlyCC(float range)
std::list<Creature*> ScriptedAI::DoFindFriendlyMissingBuff(float range, uint32 uiSpellid) std::list<Creature*> ScriptedAI::DoFindFriendlyMissingBuff(float range, uint32 uiSpellid)
{ {
std::list<Creature*> list; std::list<Creature*> list;
acore::FriendlyMissingBuffInRange u_check(me, range, uiSpellid); Acore::FriendlyMissingBuffInRange u_check(me, range, uiSpellid);
acore::CreatureListSearcher<acore::FriendlyMissingBuffInRange> searcher(me, list, u_check); Acore::CreatureListSearcher<Acore::FriendlyMissingBuffInRange> searcher(me, list, u_check);
me->VisitNearbyObject(range, searcher); me->VisitNearbyObject(range, searcher);
return list; return list;
} }
@@ -408,13 +408,13 @@ Player* ScriptedAI::GetPlayerAtMinimumRange(float minimumRange)
{ {
Player* player = nullptr; Player* player = nullptr;
CellCoord pair(acore::ComputeCellCoord(me->GetPositionX(), me->GetPositionY())); CellCoord pair(Acore::ComputeCellCoord(me->GetPositionX(), me->GetPositionY()));
Cell cell(pair); Cell cell(pair);
cell.SetNoCreate(); cell.SetNoCreate();
acore::PlayerAtMinimumRangeAway check(me, minimumRange); Acore::PlayerAtMinimumRangeAway check(me, minimumRange);
acore::PlayerSearcher<acore::PlayerAtMinimumRangeAway> searcher(me, player, check); Acore::PlayerSearcher<Acore::PlayerAtMinimumRangeAway> searcher(me, player, check);
TypeContainerVisitor<acore::PlayerSearcher<acore::PlayerAtMinimumRangeAway>, GridTypeMapContainer> visitor(searcher); TypeContainerVisitor<Acore::PlayerSearcher<Acore::PlayerAtMinimumRangeAway>, GridTypeMapContainer> visitor(searcher);
cell.Visit(pair, visitor, *me->GetMap(), *me, minimumRange); cell.Visit(pair, visitor, *me->GetMap(), *me, minimumRange);
@@ -107,7 +107,7 @@ public:
// We need to use a copy of SummonList here, otherwise original SummonList would be modified // We need to use a copy of SummonList here, otherwise original SummonList would be modified
StorageType listCopy = storage_; StorageType listCopy = storage_;
acore::Containers::RandomResize<StorageType, Predicate>(listCopy, std::forward<Predicate>(predicate), max); Acore::Containers::RandomResize<StorageType, Predicate>(listCopy, std::forward<Predicate>(predicate), max);
for (auto const& guid : listCopy) for (auto const& guid : listCopy)
{ {
+20 -20
View File
@@ -734,7 +734,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
caster = unit->SummonTrigger(unit->GetPositionX(), unit->GetPositionY(), unit->GetPositionZ(), unit->GetOrientation(), 5000); caster = unit->SummonTrigger(unit->GetPositionX(), unit->GetPositionY(), unit->GetPositionZ(), unit->GetOrientation(), 5000);
if (e.action.cast.targetsLimit > 0 && targets->size() > e.action.cast.targetsLimit) if (e.action.cast.targetsLimit > 0 && targets->size() > e.action.cast.targetsLimit)
acore::Containers::RandomResize(*targets, e.action.cast.targetsLimit); Acore::Containers::RandomResize(*targets, e.action.cast.targetsLimit);
for (ObjectList::const_iterator itr = targets->begin(); itr != targets->end(); ++itr) for (ObjectList::const_iterator itr = targets->begin(); itr != targets->end(); ++itr)
{ {
@@ -793,7 +793,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
break; break;
if (e.action.cast.targetsLimit > 0 && targets->size() > e.action.cast.targetsLimit) if (e.action.cast.targetsLimit > 0 && targets->size() > e.action.cast.targetsLimit)
acore::Containers::RandomResize(*targets, e.action.cast.targetsLimit); Acore::Containers::RandomResize(*targets, e.action.cast.targetsLimit);
for (ObjectList::const_iterator itr = targets->begin(); itr != targets->end(); ++itr) for (ObjectList::const_iterator itr = targets->begin(); itr != targets->end(); ++itr)
{ {
@@ -1527,7 +1527,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
break; break;
// xinef: attack random target // xinef: attack random target
if (Unit* target = acore::Containers::SelectRandomContainerElement(*targets)->ToUnit()) if (Unit* target = Acore::Containers::SelectRandomContainerElement(*targets)->ToUnit())
me->AI()->AttackStart(target); me->AI()->AttackStart(target);
delete targets; delete targets;
@@ -1944,7 +1944,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
if (ObjectList* targets = GetTargets(e, unit)) if (ObjectList* targets = GetTargets(e, unit))
{ {
// xinef: we want to move to random element // xinef: we want to move to random element
target = acore::Containers::SelectRandomContainerElement(*targets); target = Acore::Containers::SelectRandomContainerElement(*targets);
delete targets; delete targets;
} }
} }
@@ -2515,7 +2515,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
// xinef: my implementation // xinef: my implementation
if (e.action.jump.selfJump) if (e.action.jump.selfJump)
{ {
if (WorldObject* target = acore::Containers::SelectRandomContainerElement(*targets)) if (WorldObject* target = Acore::Containers::SelectRandomContainerElement(*targets))
if (me) if (me)
me->GetMotionMaster()->MoveJump(target->GetPositionX() + e.target.x, target->GetPositionY() + e.target.y, target->GetPositionZ() + e.target.z, (float)e.action.jump.speedxy, (float)e.action.jump.speedz); me->GetMotionMaster()->MoveJump(target->GetPositionX() + e.target.x, target->GetPositionY() + e.target.y, target->GetPositionZ() + e.target.z, (float)e.action.jump.speedxy, (float)e.action.jump.speedz);
} }
@@ -3680,7 +3680,7 @@ ObjectList* SmartScript::GetTargets(SmartScriptHolder const& e, Unit* invoker /*
l->push_back(*itr); l->push_back(*itr);
if (e.target.playerRange.maxCount > 0) if (e.target.playerRange.maxCount > 0)
acore::Containers::RandomResize(*l, e.target.playerRange.maxCount); Acore::Containers::RandomResize(*l, e.target.playerRange.maxCount);
} }
delete units; delete units;
@@ -3800,7 +3800,7 @@ ObjectList* SmartScript::GetTargets(SmartScriptHolder const& e, Unit* invoker /*
l->push_back(*itr); l->push_back(*itr);
if (e.target.o > 0) if (e.target.o > 0)
acore::Containers::RandomResize(*l, e.target.o); Acore::Containers::RandomResize(*l, e.target.o);
delete units; delete units;
break; break;
@@ -3842,7 +3842,7 @@ ObjectList* SmartScript::GetTargets(SmartScriptHolder const& e, Unit* invoker /*
} }
if (e.target.roleSelection.resize > 0) if (e.target.roleSelection.resize > 0)
acore::Containers::RandomResize(*l, e.target.roleSelection.resize); Acore::Containers::RandomResize(*l, e.target.roleSelection.resize);
delete units; delete units;
break; break;
@@ -3879,8 +3879,8 @@ ObjectList* SmartScript::GetWorldObjectsInDist(float dist)
WorldObject* obj = GetBaseObject(); WorldObject* obj = GetBaseObject();
if (obj) if (obj)
{ {
acore::AllWorldObjectsInRange u_check(obj, dist); Acore::AllWorldObjectsInRange u_check(obj, dist);
acore::WorldObjectListSearcher<acore::AllWorldObjectsInRange> searcher(obj, *targets, u_check); Acore::WorldObjectListSearcher<Acore::AllWorldObjectsInRange> searcher(obj, *targets, u_check);
obj->VisitNearbyObject(dist, searcher); obj->VisitNearbyObject(dist, searcher);
} }
return targets; return targets;
@@ -4010,7 +4010,7 @@ void SmartScript::ProcessEvent(SmartScriptHolder& e, Unit* unit, uint32 var0, ui
RecalcTimer(e, 1000, 3000); RecalcTimer(e, 1000, 3000);
return; return;
} }
ProcessTimedAction(e, e.event.friendlyCC.repeatMin, e.event.friendlyCC.repeatMax, acore::Containers::SelectRandomContainerElement(pList)); ProcessTimedAction(e, e.event.friendlyCC.repeatMin, e.event.friendlyCC.repeatMax, Acore::Containers::SelectRandomContainerElement(pList));
break; break;
} }
case SMART_EVENT_FRIENDLY_MISSING_BUFF: case SMART_EVENT_FRIENDLY_MISSING_BUFF:
@@ -4021,7 +4021,7 @@ void SmartScript::ProcessEvent(SmartScriptHolder& e, Unit* unit, uint32 var0, ui
if (pList.empty()) if (pList.empty())
return; return;
ProcessTimedAction(e, e.event.missingBuff.repeatMin, e.event.missingBuff.repeatMax, acore::Containers::SelectRandomContainerElement(pList)); ProcessTimedAction(e, e.event.missingBuff.repeatMin, e.event.missingBuff.repeatMax, Acore::Containers::SelectRandomContainerElement(pList));
break; break;
} }
case SMART_EVENT_HAS_AURA: case SMART_EVENT_HAS_AURA:
@@ -4862,8 +4862,8 @@ Unit* SmartScript::DoSelectLowestHpFriendly(float range, uint32 MinHPDiff)
Unit* unit = nullptr; Unit* unit = nullptr;
acore::MostHPMissingInRange u_check(me, range, MinHPDiff); Acore::MostHPMissingInRange u_check(me, range, MinHPDiff);
acore::UnitLastSearcher<acore::MostHPMissingInRange> searcher(me, unit, u_check); Acore::UnitLastSearcher<Acore::MostHPMissingInRange> searcher(me, unit, u_check);
me->VisitNearbyObject(range, searcher); me->VisitNearbyObject(range, searcher);
return unit; return unit;
} }
@@ -4873,8 +4873,8 @@ void SmartScript::DoFindFriendlyCC(std::list<Creature*>& _list, float range)
if (!me) if (!me)
return; return;
acore::FriendlyCCedInRange u_check(me, range); Acore::FriendlyCCedInRange u_check(me, range);
acore::CreatureListSearcher<acore::FriendlyCCedInRange> searcher(me, _list, u_check); Acore::CreatureListSearcher<Acore::FriendlyCCedInRange> searcher(me, _list, u_check);
me->VisitNearbyObject(range, searcher); me->VisitNearbyObject(range, searcher);
} }
@@ -4883,8 +4883,8 @@ void SmartScript::DoFindFriendlyMissingBuff(std::list<Creature*>& list, float ra
if (!me) if (!me)
return; return;
acore::FriendlyMissingBuffInRange u_check(me, range, spellid); Acore::FriendlyMissingBuffInRange u_check(me, range, spellid);
acore::CreatureListSearcher<acore::FriendlyMissingBuffInRange> searcher(me, list, u_check); Acore::CreatureListSearcher<Acore::FriendlyMissingBuffInRange> searcher(me, list, u_check);
me->VisitNearbyObject(range, searcher); me->VisitNearbyObject(range, searcher);
} }
@@ -4894,8 +4894,8 @@ Unit* SmartScript::DoFindClosestFriendlyInRange(float range, bool playerOnly)
return nullptr; return nullptr;
Unit* unit = nullptr; Unit* unit = nullptr;
acore::AnyFriendlyNotSelfUnitInObjectRangeCheck u_check(me, me, range, playerOnly); Acore::AnyFriendlyNotSelfUnitInObjectRangeCheck u_check(me, me, range, playerOnly);
acore::UnitLastSearcher<acore::AnyFriendlyNotSelfUnitInObjectRangeCheck> searcher(me, unit, u_check); Acore::UnitLastSearcher<Acore::AnyFriendlyNotSelfUnitInObjectRangeCheck> searcher(me, unit, u_check);
me->VisitNearbyObject(range, searcher); me->VisitNearbyObject(range, searcher);
return unit; return unit;
} }
@@ -1120,7 +1120,7 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
} }
case SMART_ACTION_LOAD_GRID: case SMART_ACTION_LOAD_GRID:
{ {
if (!acore::IsValidMapCoord(e.target.x, e.target.y)) if (!Acore::IsValidMapCoord(e.target.x, e.target.y))
{ {
LOG_ERROR("server", "SmartScript: SMART_ACTION_LOAD_GRID uses invalid map coords: %u, skipped.", e.entryOrGuid); LOG_ERROR("server", "SmartScript: SMART_ACTION_LOAD_GRID uses invalid map coords: %u, skipped.", e.entryOrGuid);
return false; return false;
+6 -6
View File
@@ -34,7 +34,7 @@ namespace AccountMgr
PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_INS_ACCOUNT); PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_INS_ACCOUNT);
stmt->setString(0, username); stmt->setString(0, username);
auto [salt, verifier] = acore::Crypto::SRP6::MakeRegistrationData(username, password); auto [salt, verifier] = Acore::Crypto::SRP6::MakeRegistrationData(username, password);
stmt->setBinary(1, salt); stmt->setBinary(1, salt);
stmt->setBinary(2, verifier); stmt->setBinary(2, verifier);
stmt->setInt8(3, uint8(sWorld->getIntConfig(CONFIG_EXPANSION))); stmt->setInt8(3, uint8(sWorld->getIntConfig(CONFIG_EXPANSION)));
@@ -147,7 +147,7 @@ namespace AccountMgr
stmt->setUInt32(1, accountId); stmt->setUInt32(1, accountId);
LoginDatabase.Execute(stmt); LoginDatabase.Execute(stmt);
auto [salt, verifier] = acore::Crypto::SRP6::MakeRegistrationData(newUsername, newPassword); auto [salt, verifier] = Acore::Crypto::SRP6::MakeRegistrationData(newUsername, newPassword);
stmt = LoginDatabase.GetPreparedStatement(LOGIN_UPD_LOGON); stmt = LoginDatabase.GetPreparedStatement(LOGIN_UPD_LOGON);
stmt->setBinary(0, salt); stmt->setBinary(0, salt);
stmt->setBinary(1, verifier); stmt->setBinary(1, verifier);
@@ -176,7 +176,7 @@ namespace AccountMgr
Utf8ToUpperOnlyLatin(username); Utf8ToUpperOnlyLatin(username);
Utf8ToUpperOnlyLatin(newPassword); Utf8ToUpperOnlyLatin(newPassword);
auto [salt, verifier] = acore::Crypto::SRP6::MakeRegistrationData(username, newPassword); auto [salt, verifier] = Acore::Crypto::SRP6::MakeRegistrationData(username, newPassword);
PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_UPD_LOGON); PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_UPD_LOGON);
stmt->setBinary(0, salt); stmt->setBinary(0, salt);
@@ -245,9 +245,9 @@ namespace AccountMgr
stmt->setUInt32(0, accountId); stmt->setUInt32(0, accountId);
if (PreparedQueryResult result = LoginDatabase.Query(stmt)) if (PreparedQueryResult result = LoginDatabase.Query(stmt))
{ {
acore::Crypto::SRP6::Salt salt = (*result)[0].GetBinary<acore::Crypto::SRP6::SALT_LENGTH>(); Acore::Crypto::SRP6::Salt salt = (*result)[0].GetBinary<Acore::Crypto::SRP6::SALT_LENGTH>();
acore::Crypto::SRP6::Verifier verifier = (*result)[1].GetBinary<acore::Crypto::SRP6::VERIFIER_LENGTH>(); Acore::Crypto::SRP6::Verifier verifier = (*result)[1].GetBinary<Acore::Crypto::SRP6::VERIFIER_LENGTH>();
if (acore::Crypto::SRP6::CheckLogin(username, password, salt, verifier)) if (Acore::Crypto::SRP6::CheckLogin(username, password, salt, verifier))
return true; return true;
} }
@@ -32,7 +32,7 @@
#include "World.h" #include "World.h"
#include "WorldPacket.h" #include "WorldPacket.h"
namespace acore namespace Acore
{ {
class AchievementChatBuilder class AchievementChatBuilder
{ {
@@ -52,7 +52,7 @@ namespace acore
int32 i_textId; int32 i_textId;
uint32 i_achievementId; uint32 i_achievementId;
}; };
} // namespace acore } // namespace Acore
bool AchievementCriteriaData::IsValid(AchievementCriteriaEntry const* criteria) bool AchievementCriteriaData::IsValid(AchievementCriteriaEntry const* criteria)
{ {
@@ -668,8 +668,8 @@ void AchievementMgr::SendAchievementEarned(AchievementEntry const* achievement)
Guild* guild = sGuildMgr->GetGuildById(GetPlayer()->GetGuildId()); Guild* guild = sGuildMgr->GetGuildById(GetPlayer()->GetGuildId());
if (guild) if (guild)
{ {
acore::AchievementChatBuilder say_builder(*GetPlayer(), CHAT_MSG_GUILD_ACHIEVEMENT, LANG_ACHIEVEMENT_EARNED, achievement->ID); Acore::AchievementChatBuilder say_builder(*GetPlayer(), CHAT_MSG_GUILD_ACHIEVEMENT, LANG_ACHIEVEMENT_EARNED, achievement->ID);
acore::LocalizedPacketDo<acore::AchievementChatBuilder> say_do(say_builder); Acore::LocalizedPacketDo<Acore::AchievementChatBuilder> say_do(say_builder);
guild->BroadcastWorker(say_do, GetPlayer()); guild->BroadcastWorker(say_do, GetPlayer());
} }
@@ -706,15 +706,15 @@ void AchievementMgr::SendAchievementEarned(AchievementEntry const* achievement)
// if player is in world he can tell his friends about new achievement // if player is in world he can tell his friends about new achievement
else if (GetPlayer()->IsInWorld()) else if (GetPlayer()->IsInWorld())
{ {
CellCoord p = acore::ComputeCellCoord(GetPlayer()->GetPositionX(), GetPlayer()->GetPositionY()); CellCoord p = Acore::ComputeCellCoord(GetPlayer()->GetPositionX(), GetPlayer()->GetPositionY());
Cell cell(p); Cell cell(p);
cell.SetNoCreate(); cell.SetNoCreate();
acore::AchievementChatBuilder say_builder(*GetPlayer(), CHAT_MSG_ACHIEVEMENT, LANG_ACHIEVEMENT_EARNED, achievement->ID); Acore::AchievementChatBuilder say_builder(*GetPlayer(), CHAT_MSG_ACHIEVEMENT, LANG_ACHIEVEMENT_EARNED, achievement->ID);
acore::LocalizedPacketDo<acore::AchievementChatBuilder> say_do(say_builder); Acore::LocalizedPacketDo<Acore::AchievementChatBuilder> say_do(say_builder);
acore::PlayerDistWorker<acore::LocalizedPacketDo<acore::AchievementChatBuilder> > say_worker(GetPlayer(), sWorld->getFloatConfig(CONFIG_LISTEN_RANGE_SAY), say_do); Acore::PlayerDistWorker<Acore::LocalizedPacketDo<Acore::AchievementChatBuilder> > say_worker(GetPlayer(), sWorld->getFloatConfig(CONFIG_LISTEN_RANGE_SAY), say_do);
TypeContainerVisitor<acore::PlayerDistWorker<acore::LocalizedPacketDo<acore::AchievementChatBuilder> >, WorldTypeMapContainer > message(say_worker); TypeContainerVisitor<Acore::PlayerDistWorker<Acore::LocalizedPacketDo<Acore::AchievementChatBuilder> >, WorldTypeMapContainer > message(say_worker);
cell.Visit(p, message, *GetPlayer()->GetMap(), *GetPlayer(), sWorld->getFloatConfig(CONFIG_LISTEN_RANGE_SAY)); cell.Visit(p, message, *GetPlayer()->GetMap(), *GetPlayer(), sWorld->getFloatConfig(CONFIG_LISTEN_RANGE_SAY));
} }
+2 -2
View File
@@ -1003,8 +1003,8 @@ bool BfCapturePoint::Update(uint32 diff)
} }
std::list<Player*> players; std::list<Player*> players;
acore::AnyPlayerInObjectRangeCheck checker(capturePoint, radius); Acore::AnyPlayerInObjectRangeCheck checker(capturePoint, radius);
acore::PlayerListSearcher<acore::AnyPlayerInObjectRangeCheck> searcher(capturePoint, players, checker); Acore::PlayerListSearcher<Acore::AnyPlayerInObjectRangeCheck> searcher(capturePoint, players, checker);
capturePoint->VisitNearbyWorldObject(radius, searcher); capturePoint->VisitNearbyWorldObject(radius, searcher);
for (std::list<Player*>::iterator itr = players.begin(); itr != players.end(); ++itr) for (std::list<Player*>::iterator itr = players.begin(); itr != players.end(); ++itr)
@@ -37,7 +37,7 @@
#ifdef ELUNA #ifdef ELUNA
#include "LuaEngine.h" #include "LuaEngine.h"
#endif #endif
namespace acore namespace Acore
{ {
class BattlegroundChatBuilder class BattlegroundChatBuilder
{ {
@@ -101,7 +101,7 @@ namespace acore
uint32 _arg1; uint32 _arg1;
uint32 _arg2; uint32 _arg2;
}; };
} // namespace acore } // namespace Acore
template<class Do> template<class Do>
void Battleground::BroadcastWorker(Do& _do) void Battleground::BroadcastWorker(Do& _do)
@@ -1067,7 +1067,7 @@ uint32 Battleground::GetBonusHonorFromKill(uint32 kills) const
{ {
//variable kills means how many honorable kills you scored (so we need kills * honor_for_one_kill) //variable kills means how many honorable kills you scored (so we need kills * honor_for_one_kill)
uint32 maxLevel = std::min<uint32>(GetMaxLevel(), 80U); uint32 maxLevel = std::min<uint32>(GetMaxLevel(), 80U);
return acore::Honor::hk_honor_at_level(maxLevel, float(kills)); return Acore::Honor::hk_honor_at_level(maxLevel, float(kills));
} }
void Battleground::BlockMovement(Player* player) void Battleground::BlockMovement(Player* player)
@@ -1749,8 +1749,8 @@ void Battleground::SendMessageToAll(uint32 entry, ChatMsg type, Player const* so
if (!entry) if (!entry)
return; return;
acore::BattlegroundChatBuilder bg_builder(type, entry, source); Acore::BattlegroundChatBuilder bg_builder(type, entry, source);
acore::LocalizedPacketDo<acore::BattlegroundChatBuilder> bg_do(bg_builder); Acore::LocalizedPacketDo<Acore::BattlegroundChatBuilder> bg_do(bg_builder);
BroadcastWorker(bg_do); BroadcastWorker(bg_do);
} }
@@ -1762,8 +1762,8 @@ void Battleground::PSendMessageToAll(uint32 entry, ChatMsg type, Player const* s
va_list ap; va_list ap;
va_start(ap, source); va_start(ap, source);
acore::BattlegroundChatBuilder bg_builder(type, entry, source, &ap); Acore::BattlegroundChatBuilder bg_builder(type, entry, source, &ap);
acore::LocalizedPacketDo<acore::BattlegroundChatBuilder> bg_do(bg_builder); Acore::LocalizedPacketDo<Acore::BattlegroundChatBuilder> bg_do(bg_builder);
BroadcastWorker(bg_do); BroadcastWorker(bg_do);
va_end(ap); va_end(ap);
@@ -1796,8 +1796,8 @@ void Battleground::SendWarningToAll(uint32 entry, ...)
void Battleground::SendMessage2ToAll(uint32 entry, ChatMsg type, Player const* source, uint32 arg1, uint32 arg2) void Battleground::SendMessage2ToAll(uint32 entry, ChatMsg type, Player const* source, uint32 arg1, uint32 arg2)
{ {
acore::Battleground2ChatBuilder bg_builder(type, entry, source, arg1, arg2); Acore::Battleground2ChatBuilder bg_builder(type, entry, source, arg1, arg2);
acore::LocalizedPacketDo<acore::Battleground2ChatBuilder> bg_do(bg_builder); Acore::LocalizedPacketDo<Acore::Battleground2ChatBuilder> bg_do(bg_builder);
BroadcastWorker(bg_do); BroadcastWorker(bg_do);
} }
@@ -655,8 +655,8 @@ void BattlegroundMgr::BuildBattlegroundListPacket(WorldPacket* data, ObjectGuid
uint32 winner_arena = player->GetRandomWinner() ? sWorld->getIntConfig(CONFIG_BG_REWARD_WINNER_ARENA_LAST) : sWorld->getIntConfig(CONFIG_BG_REWARD_WINNER_ARENA_FIRST); uint32 winner_arena = player->GetRandomWinner() ? sWorld->getIntConfig(CONFIG_BG_REWARD_WINNER_ARENA_LAST) : sWorld->getIntConfig(CONFIG_BG_REWARD_WINNER_ARENA_FIRST);
uint32 loser_kills = player->GetRandomWinner() ? sWorld->getIntConfig(CONFIG_BG_REWARD_LOSER_HONOR_LAST) : sWorld->getIntConfig(CONFIG_BG_REWARD_LOSER_HONOR_FIRST); uint32 loser_kills = player->GetRandomWinner() ? sWorld->getIntConfig(CONFIG_BG_REWARD_LOSER_HONOR_LAST) : sWorld->getIntConfig(CONFIG_BG_REWARD_LOSER_HONOR_FIRST);
winner_kills = acore::Honor::hk_honor_at_level(player->getLevel(), float(winner_kills)); winner_kills = Acore::Honor::hk_honor_at_level(player->getLevel(), float(winner_kills));
loser_kills = acore::Honor::hk_honor_at_level(player->getLevel(), float(loser_kills)); loser_kills = Acore::Honor::hk_honor_at_level(player->getLevel(), float(loser_kills));
data->Initialize(SMSG_BATTLEFIELD_LIST); data->Initialize(SMSG_BATTLEFIELD_LIST);
*data << guid; // battlemaster guid *data << guid; // battlemaster guid
@@ -971,7 +971,7 @@ BattlegroundTypeId BattlegroundMgr::GetRandomBG(BattlegroundTypeId bgTypeId)
} }
} }
return *acore::Containers::SelectRandomWeightedContainerElement(ids, weights); return *Acore::Containers::SelectRandomWeightedContainerElement(ids, weights);
} }
return BATTLEGROUND_TYPE_NONE; return BATTLEGROUND_TYPE_NONE;
+2 -2
View File
@@ -886,8 +886,8 @@ GameObject* ChatHandler::GetNearbyGameObject()
Player* pl = m_session->GetPlayer(); Player* pl = m_session->GetPlayer();
GameObject* obj = nullptr; GameObject* obj = nullptr;
acore::NearestGameObjectCheck check(*pl); Acore::NearestGameObjectCheck check(*pl);
acore::GameObjectLastSearcher<acore::NearestGameObjectCheck> searcher(pl, obj, check); Acore::GameObjectLastSearcher<Acore::NearestGameObjectCheck> searcher(pl, obj, check);
pl->VisitNearbyGridObject(SIZE_OF_GRIDS, searcher); pl->VisitNearbyGridObject(SIZE_OF_GRIDS, searcher);
return obj; return obj;
} }
+1 -1
View File
@@ -280,7 +280,7 @@ void ThreatContainer::modifyThreatPercent(Unit* victim, int32 percent)
void ThreatContainer::update() void ThreatContainer::update()
{ {
if (iDirty && iThreatList.size() > 1) if (iDirty && iThreatList.size() > 1)
iThreatList.sort(acore::ThreatOrderPred()); iThreatList.sort(Acore::ThreatOrderPred());
iDirty = false; iDirty = false;
} }
+1 -1
View File
@@ -256,7 +256,7 @@ private:
//================================================= //=================================================
namespace acore namespace Acore
{ {
// Binary predicate for sorting HostileReferences based on threat value // Binary predicate for sorting HostileReferences based on threat value
class ThreatOrderPred class ThreatOrderPred
+1 -1
View File
@@ -413,7 +413,7 @@ namespace lfg
proposal.cancelTime = time(nullptr) + LFG_TIME_PROPOSAL; proposal.cancelTime = time(nullptr) + LFG_TIME_PROPOSAL;
proposal.state = LFG_PROPOSAL_INITIATING; proposal.state = LFG_PROPOSAL_INITIATING;
proposal.leader.Clear(); proposal.leader.Clear();
proposal.dungeonId = acore::Containers::SelectRandomContainerElement(proposalDungeons); proposal.dungeonId = Acore::Containers::SelectRandomContainerElement(proposalDungeons);
bool leader = false; bool leader = false;
for (LfgRolesMap::const_iterator itRoles = proposalRoles.begin(); itRoles != proposalRoles.end(); ++itRoles) for (LfgRolesMap::const_iterator itRoles = proposalRoles.begin(); itRoles != proposalRoles.end(); ++itRoles)
+2 -2
View File
@@ -74,7 +74,7 @@ bool Corpse::Create(ObjectGuid::LowType guidlow, Player* owner)
SetObjectScale(1); SetObjectScale(1);
SetGuidValue(CORPSE_FIELD_OWNER, owner->GetGUID()); SetGuidValue(CORPSE_FIELD_OWNER, owner->GetGUID());
_cellCoord = acore::ComputeCellCoord(GetPositionX(), GetPositionY()); _cellCoord = Acore::ComputeCellCoord(GetPositionX(), GetPositionY());
return true; return true;
} }
@@ -162,7 +162,7 @@ bool Corpse::LoadCorpseFromDB(ObjectGuid::LowType guid, Field* fields)
return false; return false;
} }
_cellCoord = acore::ComputeCellCoord(GetPositionX(), GetPositionY()); _cellCoord = Acore::ComputeCellCoord(GetPositionX(), GetPositionY());
return true; return true;
} }
+25 -25
View File
@@ -254,7 +254,7 @@ void Creature::RemoveFromWorld()
Unit::RemoveFromWorld(); Unit::RemoveFromWorld();
if (m_spawnId) if (m_spawnId)
acore::Containers::MultimapErasePair(GetMap()->GetCreatureBySpawnIdStore(), m_spawnId, this); Acore::Containers::MultimapErasePair(GetMap()->GetCreatureBySpawnIdStore(), m_spawnId, this);
GetMap()->GetObjectsStore().Remove<Creature>(GetGUID()); GetMap()->GetObjectsStore().Remove<Creature>(GetGUID());
} }
@@ -888,13 +888,13 @@ void Creature::DoFleeToGetAssistance()
{ {
Creature* creature = nullptr; Creature* creature = nullptr;
CellCoord p(acore::ComputeCellCoord(GetPositionX(), GetPositionY())); CellCoord p(Acore::ComputeCellCoord(GetPositionX(), GetPositionY()));
Cell cell(p); Cell cell(p);
cell.SetNoCreate(); cell.SetNoCreate();
acore::NearestAssistCreatureInCreatureRangeCheck u_check(this, GetVictim(), radius); Acore::NearestAssistCreatureInCreatureRangeCheck u_check(this, GetVictim(), radius);
acore::CreatureLastSearcher<acore::NearestAssistCreatureInCreatureRangeCheck> searcher(this, creature, u_check); Acore::CreatureLastSearcher<Acore::NearestAssistCreatureInCreatureRangeCheck> searcher(this, creature, u_check);
TypeContainerVisitor<acore::CreatureLastSearcher<acore::NearestAssistCreatureInCreatureRangeCheck>, GridTypeMapContainer > grid_creature_searcher(searcher); TypeContainerVisitor<Acore::CreatureLastSearcher<Acore::NearestAssistCreatureInCreatureRangeCheck>, GridTypeMapContainer > grid_creature_searcher(searcher);
cell.Visit(p, grid_creature_searcher, *GetMap(), *this, radius); cell.Visit(p, grid_creature_searcher, *GetMap(), *this, radius);
@@ -1545,7 +1545,7 @@ bool Creature::LoadCreatureFromDB(ObjectGuid::LowType spawnId, Map* map, bool ad
if (CanFly()) if (CanFly())
{ {
float tz = map->GetHeight(GetPhaseMask(), data->posX, data->posY, data->posZ, true, MAX_FALL_DISTANCE); float tz = map->GetHeight(GetPhaseMask(), data->posX, data->posY, data->posZ, true, MAX_FALL_DISTANCE);
if (data->posZ - tz > 0.1f && acore::IsValidMapCoord(tz)) if (data->posZ - tz > 0.1f && Acore::IsValidMapCoord(tz))
{ {
Relocate(data->posX, data->posY, tz); Relocate(data->posX, data->posY, tz);
} }
@@ -2077,7 +2077,7 @@ SpellInfo const* Creature::reachWithSpellCure(Unit* victim)
// select nearest hostile unit within the given distance (regardless of threat list). // select nearest hostile unit within the given distance (regardless of threat list).
Unit* Creature::SelectNearestTarget(float dist, bool playerOnly /* = false */) const Unit* Creature::SelectNearestTarget(float dist, bool playerOnly /* = false */) const
{ {
CellCoord p(acore::ComputeCellCoord(GetPositionX(), GetPositionY())); CellCoord p(Acore::ComputeCellCoord(GetPositionX(), GetPositionY()));
Cell cell(p); Cell cell(p);
cell.SetNoCreate(); cell.SetNoCreate();
@@ -2087,11 +2087,11 @@ Unit* Creature::SelectNearestTarget(float dist, bool playerOnly /* = false */) c
if (dist == 0.0f) if (dist == 0.0f)
dist = MAX_SEARCHER_DISTANCE; dist = MAX_SEARCHER_DISTANCE;
acore::NearestHostileUnitCheck u_check(this, dist, playerOnly); Acore::NearestHostileUnitCheck u_check(this, dist, playerOnly);
acore::UnitLastSearcher<acore::NearestHostileUnitCheck> searcher(this, target, u_check); Acore::UnitLastSearcher<Acore::NearestHostileUnitCheck> searcher(this, target, u_check);
TypeContainerVisitor<acore::UnitLastSearcher<acore::NearestHostileUnitCheck>, WorldTypeMapContainer > world_unit_searcher(searcher); TypeContainerVisitor<Acore::UnitLastSearcher<Acore::NearestHostileUnitCheck>, WorldTypeMapContainer > world_unit_searcher(searcher);
TypeContainerVisitor<acore::UnitLastSearcher<acore::NearestHostileUnitCheck>, GridTypeMapContainer > grid_unit_searcher(searcher); TypeContainerVisitor<Acore::UnitLastSearcher<Acore::NearestHostileUnitCheck>, GridTypeMapContainer > grid_unit_searcher(searcher);
cell.Visit(p, world_unit_searcher, *GetMap(), *this, dist); cell.Visit(p, world_unit_searcher, *GetMap(), *this, dist);
cell.Visit(p, grid_unit_searcher, *GetMap(), *this, dist); cell.Visit(p, grid_unit_searcher, *GetMap(), *this, dist);
@@ -2103,7 +2103,7 @@ Unit* Creature::SelectNearestTarget(float dist, bool playerOnly /* = false */) c
// select nearest hostile unit within the given attack distance (i.e. distance is ignored if > than ATTACK_DISTANCE), regardless of threat list. // select nearest hostile unit within the given attack distance (i.e. distance is ignored if > than ATTACK_DISTANCE), regardless of threat list.
Unit* Creature::SelectNearestTargetInAttackDistance(float dist) const Unit* Creature::SelectNearestTargetInAttackDistance(float dist) const
{ {
CellCoord p(acore::ComputeCellCoord(GetPositionX(), GetPositionY())); CellCoord p(Acore::ComputeCellCoord(GetPositionX(), GetPositionY()));
Cell cell(p); Cell cell(p);
cell.SetNoCreate(); cell.SetNoCreate();
@@ -2115,11 +2115,11 @@ Unit* Creature::SelectNearestTargetInAttackDistance(float dist) const
dist = MAX_SEARCHER_DISTANCE; dist = MAX_SEARCHER_DISTANCE;
{ {
acore::NearestHostileUnitInAttackDistanceCheck u_check(this, dist); Acore::NearestHostileUnitInAttackDistanceCheck u_check(this, dist);
acore::UnitLastSearcher<acore::NearestHostileUnitInAttackDistanceCheck> searcher(this, target, u_check); Acore::UnitLastSearcher<Acore::NearestHostileUnitInAttackDistanceCheck> searcher(this, target, u_check);
TypeContainerVisitor<acore::UnitLastSearcher<acore::NearestHostileUnitInAttackDistanceCheck>, WorldTypeMapContainer > world_unit_searcher(searcher); TypeContainerVisitor<Acore::UnitLastSearcher<Acore::NearestHostileUnitInAttackDistanceCheck>, WorldTypeMapContainer > world_unit_searcher(searcher);
TypeContainerVisitor<acore::UnitLastSearcher<acore::NearestHostileUnitInAttackDistanceCheck>, GridTypeMapContainer > grid_unit_searcher(searcher); TypeContainerVisitor<Acore::UnitLastSearcher<Acore::NearestHostileUnitInAttackDistanceCheck>, GridTypeMapContainer > grid_unit_searcher(searcher);
cell.Visit(p, world_unit_searcher, *GetMap(), *this, dist); cell.Visit(p, world_unit_searcher, *GetMap(), *this, dist);
cell.Visit(p, grid_unit_searcher, *GetMap(), *this, dist); cell.Visit(p, grid_unit_searcher, *GetMap(), *this, dist);
@@ -2155,14 +2155,14 @@ void Creature::CallAssistance()
std::list<Creature*> assistList; std::list<Creature*> assistList;
{ {
CellCoord p(acore::ComputeCellCoord(GetPositionX(), GetPositionY())); CellCoord p(Acore::ComputeCellCoord(GetPositionX(), GetPositionY()));
Cell cell(p); Cell cell(p);
cell.SetNoCreate(); cell.SetNoCreate();
acore::AnyAssistCreatureInRangeCheck u_check(this, GetVictim(), radius); Acore::AnyAssistCreatureInRangeCheck u_check(this, GetVictim(), radius);
acore::CreatureListSearcher<acore::AnyAssistCreatureInRangeCheck> searcher(this, assistList, u_check); Acore::CreatureListSearcher<Acore::AnyAssistCreatureInRangeCheck> searcher(this, assistList, u_check);
TypeContainerVisitor<acore::CreatureListSearcher<acore::AnyAssistCreatureInRangeCheck>, GridTypeMapContainer > grid_creature_searcher(searcher); TypeContainerVisitor<Acore::CreatureListSearcher<Acore::AnyAssistCreatureInRangeCheck>, GridTypeMapContainer > grid_creature_searcher(searcher);
cell.Visit(p, grid_creature_searcher, *GetMap(), *this, radius); cell.Visit(p, grid_creature_searcher, *GetMap(), *this, radius);
} }
@@ -2187,14 +2187,14 @@ void Creature::CallForHelp(float radius)
if (radius <= 0.0f || !GetVictim() || IsPet() || IsCharmed()) if (radius <= 0.0f || !GetVictim() || IsPet() || IsCharmed())
return; return;
CellCoord p(acore::ComputeCellCoord(GetPositionX(), GetPositionY())); CellCoord p(Acore::ComputeCellCoord(GetPositionX(), GetPositionY()));
Cell cell(p); Cell cell(p);
cell.SetNoCreate(); cell.SetNoCreate();
acore::CallOfHelpCreatureInRangeDo u_do(this, GetVictim(), radius); Acore::CallOfHelpCreatureInRangeDo u_do(this, GetVictim(), radius);
acore::CreatureWorker<acore::CallOfHelpCreatureInRangeDo> worker(this, u_do); Acore::CreatureWorker<Acore::CallOfHelpCreatureInRangeDo> worker(this, u_do);
TypeContainerVisitor<acore::CreatureWorker<acore::CallOfHelpCreatureInRangeDo>, GridTypeMapContainer > grid_creature_searcher(worker); TypeContainerVisitor<Acore::CreatureWorker<Acore::CallOfHelpCreatureInRangeDo>, GridTypeMapContainer > grid_creature_searcher(worker);
cell.Visit(p, grid_creature_searcher, *GetMap(), *this, radius); cell.Visit(p, grid_creature_searcher, *GetMap(), *this, radius);
} }
@@ -2828,7 +2828,7 @@ std::string const& Creature::GetNameForLocaleIdx(LocaleConstant loc_idx) const
void Creature::SetPosition(float x, float y, float z, float o) void Creature::SetPosition(float x, float y, float z, float o)
{ {
if (!acore::IsValidMapCoord(x, y, z, o)) if (!Acore::IsValidMapCoord(x, y, z, o))
return; return;
GetMap()->CreatureRelocation(this, x, y, z, o); GetMap()->CreatureRelocation(this, x, y, z, o);
@@ -262,8 +262,8 @@ void CreatureGroup::LeaderMoveTo(float x, float y, float z, bool run)
float dy = y + sin(followAngle + pathAngle) * followDist; float dy = y + sin(followAngle + pathAngle) * followDist;
float dz = z; float dz = z;
acore::NormalizeMapCoord(dx); Acore::NormalizeMapCoord(dx);
acore::NormalizeMapCoord(dy); Acore::NormalizeMapCoord(dy);
member->UpdateGroundPositionZ(dx, dy, dz); member->UpdateGroundPositionZ(dx, dy, dz);
@@ -175,7 +175,7 @@ void GameObject::RemoveFromWorld()
WorldObject::RemoveFromWorld(); WorldObject::RemoveFromWorld();
if (m_spawnId) if (m_spawnId)
acore::Containers::MultimapErasePair(GetMap()->GetGameObjectBySpawnIdStore(), m_spawnId, this); Acore::Containers::MultimapErasePair(GetMap()->GetGameObjectBySpawnIdStore(), m_spawnId, this);
GetMap()->GetObjectsStore().Remove<GameObject>(GetGUID()); GetMap()->GetObjectsStore().Remove<GameObject>(GetGUID());
} }
} }
@@ -459,7 +459,7 @@ void GameObject::Update(uint32 diff)
if (info->summoningRitual.casterTargetSpell && info->summoningRitual.casterTargetSpell != 1) // No idea why this field is a bool in some cases if (info->summoningRitual.casterTargetSpell && info->summoningRitual.casterTargetSpell != 1) // No idea why this field is a bool in some cases
for (uint32 i = 0; i < info->summoningRitual.casterTargetSpellTargets; i++) for (uint32 i = 0; i < info->summoningRitual.casterTargetSpellTargets; i++)
// m_unique_users can contain only player GUIDs // m_unique_users can contain only player GUIDs
if (Player* target = ObjectAccessor::GetPlayer(*this, acore::Containers::SelectRandomContainerElement(m_unique_users))) if (Player* target = ObjectAccessor::GetPlayer(*this, Acore::Containers::SelectRandomContainerElement(m_unique_users)))
spellCaster->CastSpell(target, info->summoningRitual.casterTargetSpell, true); spellCaster->CastSpell(target, info->summoningRitual.casterTargetSpell, true);
// finish owners spell // finish owners spell
@@ -608,8 +608,8 @@ void GameObject::Update(uint32 diff)
// search unfriendly creature // search unfriendly creature
if (owner) // hunter trap if (owner) // hunter trap
{ {
acore::AnyUnfriendlyNoTotemUnitInObjectRangeCheck checker(this, owner, radius); Acore::AnyUnfriendlyNoTotemUnitInObjectRangeCheck checker(this, owner, radius);
acore::UnitSearcher<acore::AnyUnfriendlyNoTotemUnitInObjectRangeCheck> searcher(this, target, checker); Acore::UnitSearcher<Acore::AnyUnfriendlyNoTotemUnitInObjectRangeCheck> searcher(this, target, checker);
VisitNearbyGridObject(radius, searcher); VisitNearbyGridObject(radius, searcher);
if (!target) if (!target)
VisitNearbyWorldObject(radius, searcher); VisitNearbyWorldObject(radius, searcher);
@@ -619,8 +619,8 @@ void GameObject::Update(uint32 diff)
// environmental damage spells already have around enemies targeting but this not help in case not existed GO casting support // environmental damage spells already have around enemies targeting but this not help in case not existed GO casting support
// affect only players // affect only players
Player* player = nullptr; Player* player = nullptr;
acore::AnyPlayerInObjectRangeCheck checker(this, radius, true, true); Acore::AnyPlayerInObjectRangeCheck checker(this, radius, true, true);
acore::PlayerSearcher<acore::AnyPlayerInObjectRangeCheck> searcher(this, player, checker); Acore::PlayerSearcher<Acore::AnyPlayerInObjectRangeCheck> searcher(this, player, checker);
VisitNearbyWorldObject(radius, searcher); VisitNearbyWorldObject(radius, searcher);
target = player; target = player;
} }
@@ -1189,13 +1189,13 @@ void GameObject::TriggeringLinkedGameObject(uint32 trapEntry, Unit* target)
GameObject* trapGO = nullptr; GameObject* trapGO = nullptr;
{ {
// using original GO distance // using original GO distance
CellCoord p(acore::ComputeCellCoord(GetPositionX(), GetPositionY())); CellCoord p(Acore::ComputeCellCoord(GetPositionX(), GetPositionY()));
Cell cell(p); Cell cell(p);
acore::NearestGameObjectEntryInObjectRangeCheck go_check(*target, trapEntry, range); Acore::NearestGameObjectEntryInObjectRangeCheck go_check(*target, trapEntry, range);
acore::GameObjectLastSearcher<acore::NearestGameObjectEntryInObjectRangeCheck> checker(this, trapGO, go_check); Acore::GameObjectLastSearcher<Acore::NearestGameObjectEntryInObjectRangeCheck> checker(this, trapGO, go_check);
TypeContainerVisitor<acore::GameObjectLastSearcher<acore::NearestGameObjectEntryInObjectRangeCheck>, GridTypeMapContainer > object_checker(checker); TypeContainerVisitor<Acore::GameObjectLastSearcher<Acore::NearestGameObjectEntryInObjectRangeCheck>, GridTypeMapContainer > object_checker(checker);
cell.Visit(p, object_checker, *GetMap(), *target, range); cell.Visit(p, object_checker, *GetMap(), *target, range);
} }
@@ -1209,12 +1209,12 @@ GameObject* GameObject::LookupFishingHoleAround(float range)
{ {
GameObject* ok = nullptr; GameObject* ok = nullptr;
CellCoord p(acore::ComputeCellCoord(GetPositionX(), GetPositionY())); CellCoord p(Acore::ComputeCellCoord(GetPositionX(), GetPositionY()));
Cell cell(p); Cell cell(p);
acore::NearestGameObjectFishingHole u_check(*this, range); Acore::NearestGameObjectFishingHole u_check(*this, range);
acore::GameObjectSearcher<acore::NearestGameObjectFishingHole> checker(this, ok, u_check); Acore::GameObjectSearcher<Acore::NearestGameObjectFishingHole> checker(this, ok, u_check);
TypeContainerVisitor<acore::GameObjectSearcher<acore::NearestGameObjectFishingHole>, GridTypeMapContainer > grid_object_checker(checker); TypeContainerVisitor<Acore::GameObjectSearcher<Acore::NearestGameObjectFishingHole>, GridTypeMapContainer > grid_object_checker(checker);
cell.Visit(p, grid_object_checker, *GetMap(), *this, range); cell.Visit(p, grid_object_checker, *GetMap(), *this, range);
return ok; return ok;
@@ -1977,7 +1977,7 @@ void GameObject::SendMessageToSetInRange(WorldPacket* data, float dist, bool /*s
dist += GetObjectSize(); dist += GetObjectSize();
if (includeMargin) if (includeMargin)
dist += VISIBILITY_COMPENSATION * 2.0f; // pussywizard: to ensure everyone receives all important packets dist += VISIBILITY_COMPENSATION * 2.0f; // pussywizard: to ensure everyone receives all important packets
acore::MessageDistDeliverer notifier(this, data, dist, false, skipped_rcvr); Acore::MessageDistDeliverer notifier(this, data, dist, false, skipped_rcvr);
VisitNearbyWorldObject(dist, notifier); VisitNearbyWorldObject(dist, notifier);
} }
@@ -2481,7 +2481,7 @@ void GameObject::SetPosition(float x, float y, float z, float o)
{ {
// pussywizard: do not call for MotionTransport and other gobjects not in grid // pussywizard: do not call for MotionTransport and other gobjects not in grid
if (!acore::IsValidMapCoord(x, y, z, o)) if (!Acore::IsValidMapCoord(x, y, z, o))
return; return;
GetMap()->GameObjectRelocation(this, x, y, z, o); GetMap()->GameObjectRelocation(this, x, y, z, o);
+63 -63
View File
@@ -1410,8 +1410,8 @@ void WorldObject::GetRandomPoint(const Position& pos, float distance, float& ran
rand_y = pos.m_positionY + new_dist * sin(angle); rand_y = pos.m_positionY + new_dist * sin(angle);
rand_z = pos.m_positionZ; rand_z = pos.m_positionZ;
acore::NormalizeMapCoord(rand_x); Acore::NormalizeMapCoord(rand_x);
acore::NormalizeMapCoord(rand_y); Acore::NormalizeMapCoord(rand_y);
UpdateGroundPositionZ(rand_x, rand_y, rand_z); // update to LOS height if available UpdateGroundPositionZ(rand_x, rand_y, rand_z); // update to LOS height if available
} }
@@ -1510,7 +1510,7 @@ void WorldObject::UpdateAllowedPositionZ(float x, float y, float& z, float* grou
bool Position::IsPositionValid() const bool Position::IsPositionValid() const
{ {
return acore::IsValidMapCoord(m_positionX, m_positionY, m_positionZ, m_orientation); return Acore::IsValidMapCoord(m_positionX, m_positionY, m_positionZ, m_orientation);
} }
float WorldObject::GetGridActivationRange() const float WorldObject::GetGridActivationRange() const
@@ -1900,7 +1900,7 @@ void Object::ForceValuesUpdateAtIndex(uint32 i)
AddToObjectUpdateIfNeeded(); AddToObjectUpdateIfNeeded();
} }
namespace acore namespace Acore
{ {
class MonsterChatBuilder class MonsterChatBuilder
{ {
@@ -1948,61 +1948,61 @@ namespace acore
Language i_language; Language i_language;
WorldObject const* i_target; WorldObject const* i_target;
}; };
} // namespace acore } // namespace Acore
void WorldObject::MonsterSay(const char* text, uint32 language, WorldObject const* target) void WorldObject::MonsterSay(const char* text, uint32 language, WorldObject const* target)
{ {
CellCoord p = acore::ComputeCellCoord(GetPositionX(), GetPositionY()); CellCoord p = Acore::ComputeCellCoord(GetPositionX(), GetPositionY());
Cell cell(p); Cell cell(p);
cell.SetNoCreate(); cell.SetNoCreate();
acore::MonsterCustomChatBuilder say_build(this, CHAT_MSG_MONSTER_SAY, text, language, target); Acore::MonsterCustomChatBuilder say_build(this, CHAT_MSG_MONSTER_SAY, text, language, target);
acore::LocalizedPacketDo<acore::MonsterCustomChatBuilder> say_do(say_build); Acore::LocalizedPacketDo<Acore::MonsterCustomChatBuilder> say_do(say_build);
acore::PlayerDistWorker<acore::LocalizedPacketDo<acore::MonsterCustomChatBuilder> > say_worker(this, sWorld->getFloatConfig(CONFIG_LISTEN_RANGE_SAY), say_do); Acore::PlayerDistWorker<Acore::LocalizedPacketDo<Acore::MonsterCustomChatBuilder> > say_worker(this, sWorld->getFloatConfig(CONFIG_LISTEN_RANGE_SAY), say_do);
TypeContainerVisitor<acore::PlayerDistWorker<acore::LocalizedPacketDo<acore::MonsterCustomChatBuilder> >, WorldTypeMapContainer > message(say_worker); TypeContainerVisitor<Acore::PlayerDistWorker<Acore::LocalizedPacketDo<Acore::MonsterCustomChatBuilder> >, WorldTypeMapContainer > message(say_worker);
cell.Visit(p, message, *GetMap(), *this, sWorld->getFloatConfig(CONFIG_LISTEN_RANGE_SAY)); cell.Visit(p, message, *GetMap(), *this, sWorld->getFloatConfig(CONFIG_LISTEN_RANGE_SAY));
} }
void WorldObject::MonsterSay(int32 textId, uint32 language, WorldObject const* target) void WorldObject::MonsterSay(int32 textId, uint32 language, WorldObject const* target)
{ {
CellCoord p = acore::ComputeCellCoord(GetPositionX(), GetPositionY()); CellCoord p = Acore::ComputeCellCoord(GetPositionX(), GetPositionY());
Cell cell(p); Cell cell(p);
cell.SetNoCreate(); cell.SetNoCreate();
acore::MonsterChatBuilder say_build(this, CHAT_MSG_MONSTER_SAY, textId, language, target); Acore::MonsterChatBuilder say_build(this, CHAT_MSG_MONSTER_SAY, textId, language, target);
acore::LocalizedPacketDo<acore::MonsterChatBuilder> say_do(say_build); Acore::LocalizedPacketDo<Acore::MonsterChatBuilder> say_do(say_build);
acore::PlayerDistWorker<acore::LocalizedPacketDo<acore::MonsterChatBuilder> > say_worker(this, sWorld->getFloatConfig(CONFIG_LISTEN_RANGE_SAY), say_do); Acore::PlayerDistWorker<Acore::LocalizedPacketDo<Acore::MonsterChatBuilder> > say_worker(this, sWorld->getFloatConfig(CONFIG_LISTEN_RANGE_SAY), say_do);
TypeContainerVisitor<acore::PlayerDistWorker<acore::LocalizedPacketDo<acore::MonsterChatBuilder> >, WorldTypeMapContainer > message(say_worker); TypeContainerVisitor<Acore::PlayerDistWorker<Acore::LocalizedPacketDo<Acore::MonsterChatBuilder> >, WorldTypeMapContainer > message(say_worker);
cell.Visit(p, message, *GetMap(), *this, sWorld->getFloatConfig(CONFIG_LISTEN_RANGE_SAY)); cell.Visit(p, message, *GetMap(), *this, sWorld->getFloatConfig(CONFIG_LISTEN_RANGE_SAY));
} }
void WorldObject::MonsterYell(const char* text, uint32 language, WorldObject const* target) void WorldObject::MonsterYell(const char* text, uint32 language, WorldObject const* target)
{ {
CellCoord p = acore::ComputeCellCoord(GetPositionX(), GetPositionY()); CellCoord p = Acore::ComputeCellCoord(GetPositionX(), GetPositionY());
Cell cell(p); Cell cell(p);
cell.SetNoCreate(); cell.SetNoCreate();
acore::MonsterCustomChatBuilder say_build(this, CHAT_MSG_MONSTER_YELL, text, language, target); Acore::MonsterCustomChatBuilder say_build(this, CHAT_MSG_MONSTER_YELL, text, language, target);
acore::LocalizedPacketDo<acore::MonsterCustomChatBuilder> say_do(say_build); Acore::LocalizedPacketDo<Acore::MonsterCustomChatBuilder> say_do(say_build);
acore::PlayerDistWorker<acore::LocalizedPacketDo<acore::MonsterCustomChatBuilder> > say_worker(this, sWorld->getFloatConfig(CONFIG_LISTEN_RANGE_YELL), say_do); Acore::PlayerDistWorker<Acore::LocalizedPacketDo<Acore::MonsterCustomChatBuilder> > say_worker(this, sWorld->getFloatConfig(CONFIG_LISTEN_RANGE_YELL), say_do);
TypeContainerVisitor<acore::PlayerDistWorker<acore::LocalizedPacketDo<acore::MonsterCustomChatBuilder> >, WorldTypeMapContainer > message(say_worker); TypeContainerVisitor<Acore::PlayerDistWorker<Acore::LocalizedPacketDo<Acore::MonsterCustomChatBuilder> >, WorldTypeMapContainer > message(say_worker);
cell.Visit(p, message, *GetMap(), *this, sWorld->getFloatConfig(CONFIG_LISTEN_RANGE_YELL)); cell.Visit(p, message, *GetMap(), *this, sWorld->getFloatConfig(CONFIG_LISTEN_RANGE_YELL));
} }
void WorldObject::MonsterYell(int32 textId, uint32 language, WorldObject const* target) void WorldObject::MonsterYell(int32 textId, uint32 language, WorldObject const* target)
{ {
CellCoord p = acore::ComputeCellCoord(GetPositionX(), GetPositionY()); CellCoord p = Acore::ComputeCellCoord(GetPositionX(), GetPositionY());
Cell cell(p); Cell cell(p);
cell.SetNoCreate(); cell.SetNoCreate();
acore::MonsterChatBuilder say_build(this, CHAT_MSG_MONSTER_YELL, textId, language, target); Acore::MonsterChatBuilder say_build(this, CHAT_MSG_MONSTER_YELL, textId, language, target);
acore::LocalizedPacketDo<acore::MonsterChatBuilder> say_do(say_build); Acore::LocalizedPacketDo<Acore::MonsterChatBuilder> say_do(say_build);
acore::PlayerDistWorker<acore::LocalizedPacketDo<acore::MonsterChatBuilder> > say_worker(this, sWorld->getFloatConfig(CONFIG_LISTEN_RANGE_YELL), say_do); Acore::PlayerDistWorker<Acore::LocalizedPacketDo<Acore::MonsterChatBuilder> > say_worker(this, sWorld->getFloatConfig(CONFIG_LISTEN_RANGE_YELL), say_do);
TypeContainerVisitor<acore::PlayerDistWorker<acore::LocalizedPacketDo<acore::MonsterChatBuilder> >, WorldTypeMapContainer > message(say_worker); TypeContainerVisitor<Acore::PlayerDistWorker<Acore::LocalizedPacketDo<Acore::MonsterChatBuilder> >, WorldTypeMapContainer > message(say_worker);
cell.Visit(p, message, *GetMap(), *this, sWorld->getFloatConfig(CONFIG_LISTEN_RANGE_YELL)); cell.Visit(p, message, *GetMap(), *this, sWorld->getFloatConfig(CONFIG_LISTEN_RANGE_YELL));
} }
@@ -2016,15 +2016,15 @@ void WorldObject::MonsterTextEmote(const char* text, WorldObject const* target,
void WorldObject::MonsterTextEmote(int32 textId, WorldObject const* target, bool IsBossEmote) void WorldObject::MonsterTextEmote(int32 textId, WorldObject const* target, bool IsBossEmote)
{ {
CellCoord p = acore::ComputeCellCoord(GetPositionX(), GetPositionY()); CellCoord p = Acore::ComputeCellCoord(GetPositionX(), GetPositionY());
Cell cell(p); Cell cell(p);
cell.SetNoCreate(); cell.SetNoCreate();
acore::MonsterChatBuilder say_build(this, IsBossEmote ? CHAT_MSG_RAID_BOSS_EMOTE : CHAT_MSG_MONSTER_EMOTE, textId, LANG_UNIVERSAL, target); Acore::MonsterChatBuilder say_build(this, IsBossEmote ? CHAT_MSG_RAID_BOSS_EMOTE : CHAT_MSG_MONSTER_EMOTE, textId, LANG_UNIVERSAL, target);
acore::LocalizedPacketDo<acore::MonsterChatBuilder> say_do(say_build); Acore::LocalizedPacketDo<Acore::MonsterChatBuilder> say_do(say_build);
acore::PlayerDistWorker<acore::LocalizedPacketDo<acore::MonsterChatBuilder> > say_worker(this, (IsBossEmote ? 200.0f : sWorld->getFloatConfig(CONFIG_LISTEN_RANGE_TEXTEMOTE)), say_do); Acore::PlayerDistWorker<Acore::LocalizedPacketDo<Acore::MonsterChatBuilder> > say_worker(this, (IsBossEmote ? 200.0f : sWorld->getFloatConfig(CONFIG_LISTEN_RANGE_TEXTEMOTE)), say_do);
TypeContainerVisitor<acore::PlayerDistWorker<acore::LocalizedPacketDo<acore::MonsterChatBuilder> >, WorldTypeMapContainer > message(say_worker); TypeContainerVisitor<Acore::PlayerDistWorker<Acore::LocalizedPacketDo<Acore::MonsterChatBuilder> >, WorldTypeMapContainer > message(say_worker);
cell.Visit(p, message, *GetMap(), *this, (IsBossEmote ? 200.0f : sWorld->getFloatConfig(CONFIG_LISTEN_RANGE_TEXTEMOTE))); cell.Visit(p, message, *GetMap(), *this, (IsBossEmote ? 200.0f : sWorld->getFloatConfig(CONFIG_LISTEN_RANGE_TEXTEMOTE)));
} }
@@ -2072,7 +2072,7 @@ void WorldObject::SendMessageToSetInRange(WorldPacket* data, float dist, bool /*
dist += GetObjectSize(); dist += GetObjectSize();
if (includeMargin) if (includeMargin)
dist += VISIBILITY_COMPENSATION; // pussywizard: to ensure everyone receives all important packets dist += VISIBILITY_COMPENSATION; // pussywizard: to ensure everyone receives all important packets
acore::MessageDistDeliverer notifier(this, data, dist, false, skipped_rcvr); Acore::MessageDistDeliverer notifier(this, data, dist, false, skipped_rcvr);
VisitNearbyWorldObject(dist, notifier); VisitNearbyWorldObject(dist, notifier);
} }
@@ -2404,8 +2404,8 @@ void WorldObject::SummonCreatureGroup(uint8 group, std::list<TempSummon*>* list
Creature* WorldObject::FindNearestCreature(uint32 entry, float range, bool alive) const Creature* WorldObject::FindNearestCreature(uint32 entry, float range, bool alive) const
{ {
Creature* creature = nullptr; Creature* creature = nullptr;
acore::NearestCreatureEntryWithLiveStateInObjectRangeCheck checker(*this, entry, alive, range); Acore::NearestCreatureEntryWithLiveStateInObjectRangeCheck checker(*this, entry, alive, range);
acore::CreatureLastSearcher<acore::NearestCreatureEntryWithLiveStateInObjectRangeCheck> searcher(this, creature, checker); Acore::CreatureLastSearcher<Acore::NearestCreatureEntryWithLiveStateInObjectRangeCheck> searcher(this, creature, checker);
VisitNearbyObject(range, searcher); VisitNearbyObject(range, searcher);
return creature; return creature;
} }
@@ -2413,8 +2413,8 @@ Creature* WorldObject::FindNearestCreature(uint32 entry, float range, bool alive
GameObject* WorldObject::FindNearestGameObject(uint32 entry, float range) const GameObject* WorldObject::FindNearestGameObject(uint32 entry, float range) const
{ {
GameObject* go = nullptr; GameObject* go = nullptr;
acore::NearestGameObjectEntryInObjectRangeCheck checker(*this, entry, range); Acore::NearestGameObjectEntryInObjectRangeCheck checker(*this, entry, range);
acore::GameObjectLastSearcher<acore::NearestGameObjectEntryInObjectRangeCheck> searcher(this, go, checker); Acore::GameObjectLastSearcher<Acore::NearestGameObjectEntryInObjectRangeCheck> searcher(this, go, checker);
VisitNearbyGridObject(range, searcher); VisitNearbyGridObject(range, searcher);
return go; return go;
} }
@@ -2422,8 +2422,8 @@ GameObject* WorldObject::FindNearestGameObject(uint32 entry, float range) const
GameObject* WorldObject::FindNearestGameObjectOfType(GameobjectTypes type, float range) const GameObject* WorldObject::FindNearestGameObjectOfType(GameobjectTypes type, float range) const
{ {
GameObject* go = nullptr; GameObject* go = nullptr;
acore::NearestGameObjectTypeInObjectRangeCheck checker(*this, type, range); Acore::NearestGameObjectTypeInObjectRangeCheck checker(*this, type, range);
acore::GameObjectLastSearcher<acore::NearestGameObjectTypeInObjectRangeCheck> searcher(this, go, checker); Acore::GameObjectLastSearcher<Acore::NearestGameObjectTypeInObjectRangeCheck> searcher(this, go, checker);
VisitNearbyGridObject(range, searcher); VisitNearbyGridObject(range, searcher);
return go; return go;
} }
@@ -2432,8 +2432,8 @@ Player* WorldObject::SelectNearestPlayer(float distance) const
{ {
Player* target = nullptr; Player* target = nullptr;
acore::NearestPlayerInObjectRangeCheck checker(this, distance); Acore::NearestPlayerInObjectRangeCheck checker(this, distance);
acore::PlayerLastSearcher<acore::NearestPlayerInObjectRangeCheck> searcher(this, target, checker); Acore::PlayerLastSearcher<Acore::NearestPlayerInObjectRangeCheck> searcher(this, target, checker);
VisitNearbyObject(distance, searcher); VisitNearbyObject(distance, searcher);
return target; return target;
@@ -2441,32 +2441,32 @@ Player* WorldObject::SelectNearestPlayer(float distance) const
void WorldObject::GetGameObjectListWithEntryInGrid(std::list<GameObject*>& gameobjectList, uint32 entry, float maxSearchRange) const void WorldObject::GetGameObjectListWithEntryInGrid(std::list<GameObject*>& gameobjectList, uint32 entry, float maxSearchRange) const
{ {
CellCoord pair(acore::ComputeCellCoord(this->GetPositionX(), this->GetPositionY())); CellCoord pair(Acore::ComputeCellCoord(this->GetPositionX(), this->GetPositionY()));
Cell cell(pair); Cell cell(pair);
cell.SetNoCreate(); cell.SetNoCreate();
acore::AllGameObjectsWithEntryInRange check(this, entry, maxSearchRange); Acore::AllGameObjectsWithEntryInRange check(this, entry, maxSearchRange);
acore::GameObjectListSearcher<acore::AllGameObjectsWithEntryInRange> searcher(this, gameobjectList, check); Acore::GameObjectListSearcher<Acore::AllGameObjectsWithEntryInRange> searcher(this, gameobjectList, check);
TypeContainerVisitor<acore::GameObjectListSearcher<acore::AllGameObjectsWithEntryInRange>, GridTypeMapContainer> visitor(searcher); TypeContainerVisitor<Acore::GameObjectListSearcher<Acore::AllGameObjectsWithEntryInRange>, GridTypeMapContainer> visitor(searcher);
cell.Visit(pair, visitor, *(this->GetMap()), *this, maxSearchRange); cell.Visit(pair, visitor, *(this->GetMap()), *this, maxSearchRange);
} }
void WorldObject::GetCreatureListWithEntryInGrid(std::list<Creature*>& creatureList, uint32 entry, float maxSearchRange) const void WorldObject::GetCreatureListWithEntryInGrid(std::list<Creature*>& creatureList, uint32 entry, float maxSearchRange) const
{ {
CellCoord pair(acore::ComputeCellCoord(this->GetPositionX(), this->GetPositionY())); CellCoord pair(Acore::ComputeCellCoord(this->GetPositionX(), this->GetPositionY()));
Cell cell(pair); Cell cell(pair);
cell.SetNoCreate(); cell.SetNoCreate();
acore::AllCreaturesOfEntryInRange check(this, entry, maxSearchRange); Acore::AllCreaturesOfEntryInRange check(this, entry, maxSearchRange);
acore::CreatureListSearcher<acore::AllCreaturesOfEntryInRange> searcher(this, creatureList, check); Acore::CreatureListSearcher<Acore::AllCreaturesOfEntryInRange> searcher(this, creatureList, check);
TypeContainerVisitor<acore::CreatureListSearcher<acore::AllCreaturesOfEntryInRange>, GridTypeMapContainer> visitor(searcher); TypeContainerVisitor<Acore::CreatureListSearcher<Acore::AllCreaturesOfEntryInRange>, GridTypeMapContainer> visitor(searcher);
cell.Visit(pair, visitor, *(this->GetMap()), *this, maxSearchRange); cell.Visit(pair, visitor, *(this->GetMap()), *this, maxSearchRange);
} }
/* /*
namespace acore namespace Acore
{ {
class NearUsedPosDo class NearUsedPosDo
{ {
@@ -2535,7 +2535,7 @@ namespace acore
float i_angle; float i_angle;
ObjectPosSelector& i_selector; ObjectPosSelector& i_selector;
}; };
} // namespace acore } // namespace Acore
*/ */
//=================================================================================================== //===================================================================================================
@@ -2565,8 +2565,8 @@ void WorldObject::GetNearPoint2D(WorldObject const* searcher, float& x, float& y
x = GetPositionX() + (effectiveReach + distance2d) * std::cos(absAngle); x = GetPositionX() + (effectiveReach + distance2d) * std::cos(absAngle);
y = GetPositionY() + (effectiveReach + distance2d) * std::sin(absAngle); y = GetPositionY() + (effectiveReach + distance2d) * std::sin(absAngle);
acore::NormalizeMapCoord(x); Acore::NormalizeMapCoord(x);
acore::NormalizeMapCoord(y); Acore::NormalizeMapCoord(y);
} }
void WorldObject::GetNearPoint2D(float& x, float& y, float distance2d, float absAngle) const void WorldObject::GetNearPoint2D(float& x, float& y, float distance2d, float absAngle) const
@@ -2702,7 +2702,7 @@ void WorldObject::MovePosition(Position& pos, float dist, float angle)
desty = pos.m_positionY + dist * sin(angle); desty = pos.m_positionY + dist * sin(angle);
// Prevent invalid coordinates here, position is unchanged // Prevent invalid coordinates here, position is unchanged
if (!acore::IsValidMapCoord(destx, desty)) if (!Acore::IsValidMapCoord(destx, desty))
{ {
LOG_FATAL("server", "WorldObject::MovePosition invalid coordinates X: %f and Y: %f were passed!", destx, desty); LOG_FATAL("server", "WorldObject::MovePosition invalid coordinates X: %f and Y: %f were passed!", destx, desty);
return; return;
@@ -2733,8 +2733,8 @@ void WorldObject::MovePosition(Position& pos, float dist, float angle)
} }
} }
acore::NormalizeMapCoord(pos.m_positionX); Acore::NormalizeMapCoord(pos.m_positionX);
acore::NormalizeMapCoord(pos.m_positionY); Acore::NormalizeMapCoord(pos.m_positionY);
UpdateGroundPositionZ(pos.m_positionX, pos.m_positionY, pos.m_positionZ); UpdateGroundPositionZ(pos.m_positionX, pos.m_positionY, pos.m_positionZ);
pos.m_orientation = m_orientation; pos.m_orientation = m_orientation;
} }
@@ -2841,8 +2841,8 @@ void WorldObject::DestroyForNearbyPlayers()
return; return;
std::list<Player*> targets; std::list<Player*> targets;
acore::AnyPlayerInObjectRangeCheck check(this, GetVisibilityRange() + VISIBILITY_COMPENSATION, false); Acore::AnyPlayerInObjectRangeCheck check(this, GetVisibilityRange() + VISIBILITY_COMPENSATION, false);
acore::PlayerListSearcherWithSharedVision<acore::AnyPlayerInObjectRangeCheck> searcher(this, targets, check); Acore::PlayerListSearcherWithSharedVision<Acore::AnyPlayerInObjectRangeCheck> searcher(this, targets, check);
VisitNearbyWorldObject(GetVisibilityRange() + VISIBILITY_COMPENSATION, searcher); VisitNearbyWorldObject(GetVisibilityRange() + VISIBILITY_COMPENSATION, searcher);
for (std::list<Player*>::const_iterator iter = targets.begin(); iter != targets.end(); ++iter) for (std::list<Player*>::const_iterator iter = targets.begin(); iter != targets.end(); ++iter)
{ {
@@ -2865,7 +2865,7 @@ void WorldObject::DestroyForNearbyPlayers()
void WorldObject::UpdateObjectVisibility(bool /*forced*/, bool /*fromUpdate*/) void WorldObject::UpdateObjectVisibility(bool /*forced*/, bool /*fromUpdate*/)
{ {
//updates object's visibility for nearby players //updates object's visibility for nearby players
acore::VisibleChangesNotifier notifier(*this); Acore::VisibleChangesNotifier notifier(*this);
VisitNearbyWorldObject(GetVisibilityRange() + VISIBILITY_COMPENSATION, notifier); VisitNearbyWorldObject(GetVisibilityRange() + VISIBILITY_COMPENSATION, notifier);
} }
@@ -2970,7 +2970,7 @@ struct WorldObjectChangeAccumulator
void WorldObject::BuildUpdate(UpdateDataMapType& data_map, UpdatePlayerSet& player_set) void WorldObject::BuildUpdate(UpdateDataMapType& data_map, UpdatePlayerSet& player_set)
{ {
CellCoord p = acore::ComputeCellCoord(GetPositionX(), GetPositionY()); CellCoord p = Acore::ComputeCellCoord(GetPositionX(), GetPositionY());
Cell cell(p); Cell cell(p);
cell.SetNoCreate(); cell.SetNoCreate();
WorldObjectChangeAccumulator notifier(*this, data_map, player_set); WorldObjectChangeAccumulator notifier(*this, data_map, player_set);
@@ -2984,17 +2984,17 @@ void WorldObject::BuildUpdate(UpdateDataMapType& data_map, UpdatePlayerSet& play
void WorldObject::GetCreaturesWithEntryInRange(std::list<Creature*>& creatureList, float radius, uint32 entry) void WorldObject::GetCreaturesWithEntryInRange(std::list<Creature*>& creatureList, float radius, uint32 entry)
{ {
CellCoord pair(acore::ComputeCellCoord(this->GetPositionX(), this->GetPositionY())); CellCoord pair(Acore::ComputeCellCoord(this->GetPositionX(), this->GetPositionY()));
Cell cell(pair); Cell cell(pair);
cell.SetNoCreate(); cell.SetNoCreate();
acore::AllCreaturesOfEntryInRange check(this, entry, radius); Acore::AllCreaturesOfEntryInRange check(this, entry, radius);
acore::CreatureListSearcher<acore::AllCreaturesOfEntryInRange> searcher(this, creatureList, check); Acore::CreatureListSearcher<Acore::AllCreaturesOfEntryInRange> searcher(this, creatureList, check);
TypeContainerVisitor<acore::CreatureListSearcher<acore::AllCreaturesOfEntryInRange>, WorldTypeMapContainer> world_visitor(searcher); TypeContainerVisitor<Acore::CreatureListSearcher<Acore::AllCreaturesOfEntryInRange>, WorldTypeMapContainer> world_visitor(searcher);
cell.Visit(pair, world_visitor, *(this->GetMap()), *this, radius); cell.Visit(pair, world_visitor, *(this->GetMap()), *this, radius);
TypeContainerVisitor<acore::CreatureListSearcher<acore::AllCreaturesOfEntryInRange>, GridTypeMapContainer> grid_visitor(searcher); TypeContainerVisitor<Acore::CreatureListSearcher<Acore::AllCreaturesOfEntryInRange>, GridTypeMapContainer> grid_visitor(searcher);
cell.Visit(pair, grid_visitor, *(this->GetMap()), *this, radius); cell.Visit(pair, grid_visitor, *(this->GetMap()), *this, radius);
} }
+1 -1
View File
@@ -1095,7 +1095,7 @@ private:
bool CanDetectStealthOf(WorldObject const* obj, bool checkAlert = false) const; bool CanDetectStealthOf(WorldObject const* obj, bool checkAlert = false) const;
}; };
namespace acore namespace Acore
{ {
// Binary predicate to sort WorldObjects based on the distance to a reference WorldObject // Binary predicate to sort WorldObjects based on the distance to a reference WorldObject
class ObjectDistanceOrderPred class ObjectDistanceOrderPred
+15 -15
View File
@@ -517,7 +517,7 @@ inline void KillRewarder::_InitGroupData()
} }
// 2.4. _maxNotGrayMember - maximum level of alive group member within reward distance, // 2.4. _maxNotGrayMember - maximum level of alive group member within reward distance,
// for whom victim is not gray; // for whom victim is not gray;
uint32 grayLevel = acore::XP::GetGrayLevel(lvl); uint32 grayLevel = Acore::XP::GetGrayLevel(lvl);
if (_victim->getLevel() > grayLevel && (!_maxNotGrayMember || _maxNotGrayMember->getLevel() < lvl)) if (_victim->getLevel() > grayLevel && (!_maxNotGrayMember || _maxNotGrayMember->getLevel() < lvl))
{ {
_maxNotGrayMember = member; _maxNotGrayMember = member;
@@ -542,7 +542,7 @@ inline void KillRewarder::_InitXP(Player* player)
// * otherwise, not in PvP; // * otherwise, not in PvP;
// * not if killer is on vehicle. // * not if killer is on vehicle.
if (_victim && (_isBattleGround || (!_isPvP && !_killer->GetVehicle()))) if (_victim && (_isBattleGround || (!_isPvP && !_killer->GetVehicle())))
_xp = acore::XP::Gain(player, _victim, _isBattleGround); _xp = Acore::XP::Gain(player, _victim, _isBattleGround);
if (_xp && !_isBattleGround && _victim) // pussywizard: npcs with relatively low hp give lower exp if (_xp && !_isBattleGround && _victim) // pussywizard: npcs with relatively low hp give lower exp
if (_victim->GetTypeId() == TYPEID_UNIT) if (_victim->GetTypeId() == TYPEID_UNIT)
@@ -658,7 +658,7 @@ void KillRewarder::_RewardGroup()
{ {
// 3.1.2. Alter group rate if group is in raid (not for battlegrounds). // 3.1.2. Alter group rate if group is in raid (not for battlegrounds).
const bool isRaid = !_isPvP && sMapStore.LookupEntry(_killer->GetMapId())->IsRaid() && _group->isRaidGroup(); const bool isRaid = !_isPvP && sMapStore.LookupEntry(_killer->GetMapId())->IsRaid() && _group->isRaidGroup();
_groupRate = acore::XP::xp_in_group_rate(_count, isRaid); _groupRate = Acore::XP::xp_in_group_rate(_count, isRaid);
} }
// 3.1.3. Reward each group member (even dead or corpse) within reward distance. // 3.1.3. Reward each group member (even dead or corpse) within reward distance.
@@ -6564,7 +6564,7 @@ void Player::UpdateWeaponSkill(Unit* victim, WeaponAttackType attType)
void Player::UpdateCombatSkills(Unit* victim, WeaponAttackType attType, bool defence) void Player::UpdateCombatSkills(Unit* victim, WeaponAttackType attType, bool defence)
{ {
uint8 plevel = getLevel(); // if defense than victim == attacker uint8 plevel = getLevel(); // if defense than victim == attacker
uint8 greylevel = acore::XP::GetGrayLevel(plevel); uint8 greylevel = Acore::XP::GetGrayLevel(plevel);
uint8 moblevel = victim->getLevelForTarget(this); uint8 moblevel = victim->getLevelForTarget(this);
/*if (moblevel < greylevel) /*if (moblevel < greylevel)
return;*/ // Patch 3.0.8 (2009-01-20): You can no longer skill up weapons on mobs that are immune to damage. return;*/ // Patch 3.0.8 (2009-01-20): You can no longer skill up weapons on mobs that are immune to damage.
@@ -7065,7 +7065,7 @@ void Player::SendMessageToSetInRange(WorldPacket* data, float dist, bool self, b
dist += GetObjectSize(); dist += GetObjectSize();
if (includeMargin) if (includeMargin)
dist += VISIBILITY_COMPENSATION; // pussywizard: to ensure everyone receives all important packets dist += VISIBILITY_COMPENSATION; // pussywizard: to ensure everyone receives all important packets
acore::MessageDistDeliverer notifier(this, data, dist, false, skipped_rcvr); Acore::MessageDistDeliverer notifier(this, data, dist, false, skipped_rcvr);
VisitNearbyWorldObject(dist, notifier); VisitNearbyWorldObject(dist, notifier);
} }
@@ -7075,7 +7075,7 @@ void Player::SendMessageToSetInRange_OwnTeam(WorldPacket* data, float dist, bool
if (self) if (self)
GetSession()->SendPacket(data); GetSession()->SendPacket(data);
acore::MessageDistDeliverer notifier(this, data, dist, true); Acore::MessageDistDeliverer notifier(this, data, dist, true);
VisitNearbyWorldObject(dist, notifier); VisitNearbyWorldObject(dist, notifier);
} }
@@ -7258,7 +7258,7 @@ int32 Player::CalculateReputationGain(ReputationSource source, uint32 creatureOr
break; break;
} }
if (rate != 1.0f && creatureOrQuestLevel <= acore::XP::GetGrayLevel(getLevel())) if (rate != 1.0f && creatureOrQuestLevel <= Acore::XP::GetGrayLevel(getLevel()))
percent *= rate; percent *= rate;
if (percent <= 0.0f) if (percent <= 0.0f)
@@ -7498,7 +7498,7 @@ bool Player::RewardHonor(Unit* uVictim, uint32 groupsize, int32 honor, bool awar
return false; return false;
uint8 k_level = getLevel(); uint8 k_level = getLevel();
uint8 k_grey = acore::XP::GetGrayLevel(k_level); uint8 k_grey = Acore::XP::GetGrayLevel(k_level);
uint8 v_level = victim->getLevel(); uint8 v_level = victim->getLevel();
if (v_level <= k_grey) if (v_level <= k_grey)
@@ -7527,7 +7527,7 @@ bool Player::RewardHonor(Unit* uVictim, uint32 groupsize, int32 honor, bool awar
else else
victim_guid.Clear(); // Don't show HK: <rank> message, only log. victim_guid.Clear(); // Don't show HK: <rank> message, only log.
honor_f = ceil(acore::Honor::hk_honor_at_level_f(k_level) * (v_level - k_grey) / (k_level - k_grey)); honor_f = ceil(Acore::Honor::hk_honor_at_level_f(k_level) * (v_level - k_grey) / (k_level - k_grey));
// count the number of playerkills in one day // count the number of playerkills in one day
ApplyModUInt32Value(PLAYER_FIELD_KILLS, 1, true); ApplyModUInt32Value(PLAYER_FIELD_KILLS, 1, true);
@@ -18335,7 +18335,7 @@ bool Player::LoadFromDB(ObjectGuid playerGuid, SQLQueryHolder* holder)
m_movementInfo.transport.pos.Relocate(x, y, z, o); m_movementInfo.transport.pos.Relocate(x, y, z, o);
m_transport->CalculatePassengerPosition(x, y, z, &o); m_transport->CalculatePassengerPosition(x, y, z, &o);
if (!acore::IsValidMapCoord(x, y, z, o) || std::fabs(m_movementInfo.transport.pos.GetPositionX()) > 75.0f || std::fabs(m_movementInfo.transport.pos.GetPositionY()) > 75.0f || std::fabs(m_movementInfo.transport.pos.GetPositionZ()) > 75.0f) if (!Acore::IsValidMapCoord(x, y, z, o) || std::fabs(m_movementInfo.transport.pos.GetPositionX()) > 75.0f || std::fabs(m_movementInfo.transport.pos.GetPositionY()) > 75.0f || std::fabs(m_movementInfo.transport.pos.GetPositionZ()) > 75.0f)
{ {
m_transport = nullptr; m_transport = nullptr;
m_movementInfo.transport.Reset(); m_movementInfo.transport.Reset();
@@ -21526,8 +21526,8 @@ void Player::TextEmote(const std::string& text)
WorldPacket data; WorldPacket data;
std::list<Player*> players; std::list<Player*> players;
acore::AnyPlayerInObjectRangeCheck checker(this, sWorld->getFloatConfig(CONFIG_LISTEN_RANGE_TEXTEMOTE)); Acore::AnyPlayerInObjectRangeCheck checker(this, sWorld->getFloatConfig(CONFIG_LISTEN_RANGE_TEXTEMOTE));
acore::PlayerListSearcher<acore::AnyPlayerInObjectRangeCheck> searcher(this, players, checker); Acore::PlayerListSearcher<Acore::AnyPlayerInObjectRangeCheck> searcher(this, players, checker);
this->VisitNearbyWorldObject(sWorld->getFloatConfig(CONFIG_LISTEN_RANGE_TEXTEMOTE), searcher); this->VisitNearbyWorldObject(sWorld->getFloatConfig(CONFIG_LISTEN_RANGE_TEXTEMOTE), searcher);
for (auto const& itr : players) for (auto const& itr : players)
@@ -23680,10 +23680,10 @@ void Player::UpdateObjectVisibility(bool forced, bool fromUpdate)
void Player::UpdateVisibilityForPlayer(bool mapChange) void Player::UpdateVisibilityForPlayer(bool mapChange)
{ {
acore::VisibleNotifier notifierNoLarge(*this, mapChange, false); // visit only objects which are not large; default distance Acore::VisibleNotifier notifierNoLarge(*this, mapChange, false); // visit only objects which are not large; default distance
m_seer->VisitNearbyObject(GetSightRange() + VISIBILITY_INC_FOR_GOBJECTS, notifierNoLarge); m_seer->VisitNearbyObject(GetSightRange() + VISIBILITY_INC_FOR_GOBJECTS, notifierNoLarge);
notifierNoLarge.SendToSelf(); notifierNoLarge.SendToSelf();
acore::VisibleNotifier notifierLarge(*this, mapChange, true); // visit only large objects; maximum distance Acore::VisibleNotifier notifierLarge(*this, mapChange, true); // visit only large objects; maximum distance
m_seer->VisitNearbyObject(MAX_VISIBILITY_DISTANCE, notifierLarge); m_seer->VisitNearbyObject(MAX_VISIBILITY_DISTANCE, notifierLarge);
notifierLarge.SendToSelf(); notifierLarge.SendToSelf();
@@ -24753,7 +24753,7 @@ uint32 Player::GetResurrectionSpellId()
bool Player::isHonorOrXPTarget(Unit* victim) const bool Player::isHonorOrXPTarget(Unit* victim) const
{ {
uint8 v_level = victim->getLevel(); uint8 v_level = victim->getLevel();
uint8 k_grey = acore::XP::GetGrayLevel(getLevel()); uint8 k_grey = Acore::XP::GetGrayLevel(getLevel());
// Victim level less gray level // Victim level less gray level
if (v_level <= k_grey) if (v_level <= k_grey)
@@ -609,7 +609,7 @@ void MotionTransport::UpdatePassengerPositions(PassengerSet& passengers)
CalculatePassengerPosition(x, y, z, &o); CalculatePassengerPosition(x, y, z, &o);
// check if position is valid // check if position is valid
if (!acore::IsValidMapCoord(x, y, z)) if (!Acore::IsValidMapCoord(x, y, z))
continue; continue;
switch (passenger->GetTypeId()) switch (passenger->GetTypeId())
@@ -875,7 +875,7 @@ void StaticTransport::RelocateToProgress(uint32 progress)
float oriRotAngle = oriRotAngleCurr + percRot * (oriRotAngleNext - oriRotAngleCurr); float oriRotAngle = oriRotAngleCurr + percRot * (oriRotAngleNext - oriRotAngleCurr);
// check if position is valid // check if position is valid
if (!acore::IsValidMapCoord(pos.x, pos.y, pos.z)) if (!Acore::IsValidMapCoord(pos.x, pos.y, pos.z))
return; return;
// update position to new one // update position to new one
@@ -910,7 +910,7 @@ void StaticTransport::UpdatePassengerPositions()
CalculatePassengerPosition(x, y, z, &o); CalculatePassengerPosition(x, y, z, &o);
// check if position is valid // check if position is valid
if (!acore::IsValidMapCoord(x, y, z)) if (!Acore::IsValidMapCoord(x, y, z))
continue; continue;
switch (passenger->GetTypeId()) switch (passenger->GetTypeId())
+16 -16
View File
@@ -1893,7 +1893,7 @@ void Unit::CalcAbsorbResist(Unit* attacker, Unit* victim, SpellSchoolMask school
// We're going to call functions which can modify content of the list during iteration over it's elements // We're going to call functions which can modify content of the list during iteration over it's elements
// Let's copy the list so we can prevent iterator invalidation // Let's copy the list so we can prevent iterator invalidation
AuraEffectList vSchoolAbsorbCopy(victim->GetAuraEffectsByType(SPELL_AURA_SCHOOL_ABSORB)); AuraEffectList vSchoolAbsorbCopy(victim->GetAuraEffectsByType(SPELL_AURA_SCHOOL_ABSORB));
vSchoolAbsorbCopy.sort(acore::AbsorbAuraOrderPred()); vSchoolAbsorbCopy.sort(Acore::AbsorbAuraOrderPred());
// absorb without mana cost // absorb without mana cost
for (AuraEffectList::iterator itr = vSchoolAbsorbCopy.begin(); (itr != vSchoolAbsorbCopy.end()) && (dmgInfo.GetDamage() > 0); ++itr) for (AuraEffectList::iterator itr = vSchoolAbsorbCopy.begin(); (itr != vSchoolAbsorbCopy.end()) && (dmgInfo.GetDamage() > 0); ++itr)
@@ -16294,8 +16294,8 @@ void Unit::UpdateReactives(uint32 p_time)
Unit* Unit::SelectNearbyTarget(Unit* exclude, float dist) const Unit* Unit::SelectNearbyTarget(Unit* exclude, float dist) const
{ {
std::list<Unit*> targets; std::list<Unit*> targets;
acore::AnyUnfriendlyUnitInObjectRangeCheck u_check(this, this, dist); Acore::AnyUnfriendlyUnitInObjectRangeCheck u_check(this, this, dist);
acore::UnitListSearcher<acore::AnyUnfriendlyUnitInObjectRangeCheck> searcher(this, targets, u_check); Acore::UnitListSearcher<Acore::AnyUnfriendlyUnitInObjectRangeCheck> searcher(this, targets, u_check);
VisitNearbyObject(dist, searcher); VisitNearbyObject(dist, searcher);
// remove current target // remove current target
@@ -16323,14 +16323,14 @@ Unit* Unit::SelectNearbyTarget(Unit* exclude, float dist) const
return nullptr; return nullptr;
// select random // select random
return acore::Containers::SelectRandomContainerElement(targets); return Acore::Containers::SelectRandomContainerElement(targets);
} }
Unit* Unit::SelectNearbyNoTotemTarget(Unit* exclude, float dist) const Unit* Unit::SelectNearbyNoTotemTarget(Unit* exclude, float dist) const
{ {
std::list<Unit*> targets; std::list<Unit*> targets;
acore::AnyUnfriendlyNoTotemUnitInObjectRangeCheck u_check(this, this, dist); Acore::AnyUnfriendlyNoTotemUnitInObjectRangeCheck u_check(this, this, dist);
acore::UnitListSearcher<acore::AnyUnfriendlyNoTotemUnitInObjectRangeCheck> searcher(this, targets, u_check); Acore::UnitListSearcher<Acore::AnyUnfriendlyNoTotemUnitInObjectRangeCheck> searcher(this, targets, u_check);
VisitNearbyObject(dist, searcher); VisitNearbyObject(dist, searcher);
// remove current target // remove current target
@@ -16358,7 +16358,7 @@ Unit* Unit::SelectNearbyNoTotemTarget(Unit* exclude, float dist) const
return nullptr; return nullptr;
// select random // select random
return acore::Containers::SelectRandomContainerElement(targets); return Acore::Containers::SelectRandomContainerElement(targets);
} }
void Unit::ApplyAttackTimePercentMod(WeaponAttackType att, float val, bool apply) void Unit::ApplyAttackTimePercentMod(WeaponAttackType att, float val, bool apply)
@@ -16893,7 +16893,7 @@ bool Unit::HandleAuraRaidProcFromChargeWithValue(AuraEffect* triggeredByAura)
if (!nearMembers.empty()) if (!nearMembers.empty())
{ {
nearMembers.sort(acore::HealthPctOrderPred()); nearMembers.sort(Acore::HealthPctOrderPred());
if (Unit* target = nearMembers.front()) if (Unit* target = nearMembers.front())
{ {
CastSpell(target, 41637 /*Dummy visual effect triggered by main spell cast*/, true); CastSpell(target, 41637 /*Dummy visual effect triggered by main spell cast*/, true);
@@ -18369,7 +18369,7 @@ void Unit::UpdateObjectVisibility(bool forced, bool /*fromUpdate*/)
// pussywizard: generally this is not needed here, delayed notifier will handle this, call only for pets // pussywizard: generally this is not needed here, delayed notifier will handle this, call only for pets
if ((IsGuardian() || IsPet()) && GetOwnerGUID().IsPlayer()) if ((IsGuardian() || IsPet()) && GetOwnerGUID().IsPlayer())
{ {
acore::AIRelocationNotifier notifier(*this); Acore::AIRelocationNotifier notifier(*this);
float radius = 60.0f; float radius = 60.0f;
VisitNearbyObject(radius, notifier); VisitNearbyObject(radius, notifier);
} }
@@ -19220,7 +19220,7 @@ void Unit::SendTeleportPacket(Position& pos)
bool Unit::UpdatePosition(float x, float y, float z, float orientation, bool teleport) bool Unit::UpdatePosition(float x, float y, float z, float orientation, bool teleport)
{ {
if (!acore::IsValidMapCoord(x, y, z, orientation)) if (!Acore::IsValidMapCoord(x, y, z, orientation))
return false; return false;
float old_orientation = GetOrientation(); float old_orientation = GetOrientation();
@@ -19743,10 +19743,10 @@ void Unit::ExecuteDelayedUnitRelocationEvent()
//active->m_last_notify_position.Relocate(active->GetPositionX(), active->GetPositionY(), active->GetPositionZ()); //active->m_last_notify_position.Relocate(active->GetPositionX(), active->GetPositionY(), active->GetPositionZ());
} }
acore::PlayerRelocationNotifier relocateNoLarge(*player, false); // visit only objects which are not large; default distance Acore::PlayerRelocationNotifier relocateNoLarge(*player, false); // visit only objects which are not large; default distance
viewPoint->VisitNearbyObject(player->GetSightRange() + VISIBILITY_INC_FOR_GOBJECTS, relocateNoLarge); viewPoint->VisitNearbyObject(player->GetSightRange() + VISIBILITY_INC_FOR_GOBJECTS, relocateNoLarge);
relocateNoLarge.SendToSelf(); relocateNoLarge.SendToSelf();
acore::PlayerRelocationNotifier relocateLarge(*player, true); // visit only large objects; maximum distance Acore::PlayerRelocationNotifier relocateLarge(*player, true); // visit only large objects; maximum distance
viewPoint->VisitNearbyObject(MAX_VISIBILITY_DISTANCE, relocateLarge); viewPoint->VisitNearbyObject(MAX_VISIBILITY_DISTANCE, relocateLarge);
relocateLarge.SendToSelf(); relocateLarge.SendToSelf();
} }
@@ -19777,10 +19777,10 @@ void Unit::ExecuteDelayedUnitRelocationEvent()
active->m_last_notify_position.Relocate(active->GetPositionX(), active->GetPositionY(), active->GetPositionZ()); active->m_last_notify_position.Relocate(active->GetPositionX(), active->GetPositionY(), active->GetPositionZ());
} }
acore::PlayerRelocationNotifier relocateNoLarge(*player, false); // visit only objects which are not large; default distance Acore::PlayerRelocationNotifier relocateNoLarge(*player, false); // visit only objects which are not large; default distance
viewPoint->VisitNearbyObject(player->GetSightRange() + VISIBILITY_INC_FOR_GOBJECTS, relocateNoLarge); viewPoint->VisitNearbyObject(player->GetSightRange() + VISIBILITY_INC_FOR_GOBJECTS, relocateNoLarge);
relocateNoLarge.SendToSelf(); relocateNoLarge.SendToSelf();
acore::PlayerRelocationNotifier relocateLarge(*player, true); // visit only large objects; maximum distance Acore::PlayerRelocationNotifier relocateLarge(*player, true); // visit only large objects; maximum distance
viewPoint->VisitNearbyObject(MAX_VISIBILITY_DISTANCE, relocateLarge); viewPoint->VisitNearbyObject(MAX_VISIBILITY_DISTANCE, relocateLarge);
relocateLarge.SendToSelf(); relocateLarge.SendToSelf();
@@ -19801,7 +19801,7 @@ void Unit::ExecuteDelayedUnitRelocationEvent()
unit->m_last_notify_position.Relocate(unit->GetPositionX(), unit->GetPositionY(), unit->GetPositionZ()); unit->m_last_notify_position.Relocate(unit->GetPositionX(), unit->GetPositionY(), unit->GetPositionZ());
acore::CreatureRelocationNotifier relocate(*unit); Acore::CreatureRelocationNotifier relocate(*unit);
unit->VisitNearbyObject(unit->GetVisibilityRange() + VISIBILITY_COMPENSATION, relocate); unit->VisitNearbyObject(unit->GetVisibilityRange() + VISIBILITY_COMPENSATION, relocate);
this->AddToNotify(NOTIFY_AI_RELOCATION); this->AddToNotify(NOTIFY_AI_RELOCATION);
@@ -19814,7 +19814,7 @@ void Unit::ExecuteDelayedUnitAINotifyEvent()
if (!this->IsInWorld() || this->IsDuringRemoveFromWorld()) if (!this->IsInWorld() || this->IsDuringRemoveFromWorld())
return; return;
acore::AIRelocationNotifier notifier(*this); Acore::AIRelocationNotifier notifier(*this);
float radius = 60.0f; float radius = 60.0f;
this->VisitNearbyObject(radius, notifier); this->VisitNearbyObject(radius, notifier);
} }
+1 -1
View File
@@ -2627,7 +2627,7 @@ private:
float processDummyAuras(float TakenTotalMod) const; float processDummyAuras(float TakenTotalMod) const;
}; };
namespace acore namespace Acore
{ {
// Binary predicate for sorting Units based on percent value of a power // Binary predicate for sorting Units based on percent value of a power
class PowerPctOrderPred class PowerPctOrderPred
+7 -7
View File
@@ -1985,7 +1985,7 @@ void ObjectMgr::AddCreatureToGrid(ObjectGuid::LowType guid, CreatureData const*
{ {
if (mask & 1) if (mask & 1)
{ {
CellCoord cellCoord = acore::ComputeCellCoord(data->posX, data->posY); CellCoord cellCoord = Acore::ComputeCellCoord(data->posX, data->posY);
CellObjectGuids& cell_guids = _mapObjectGuidsStore[MAKE_PAIR32(data->mapid, i)][cellCoord.GetId()]; CellObjectGuids& cell_guids = _mapObjectGuidsStore[MAKE_PAIR32(data->mapid, i)][cellCoord.GetId()];
cell_guids.creatures.insert(guid); cell_guids.creatures.insert(guid);
} }
@@ -1999,7 +1999,7 @@ void ObjectMgr::RemoveCreatureFromGrid(ObjectGuid::LowType guid, CreatureData co
{ {
if (mask & 1) if (mask & 1)
{ {
CellCoord cellCoord = acore::ComputeCellCoord(data->posX, data->posY); CellCoord cellCoord = Acore::ComputeCellCoord(data->posX, data->posY);
CellObjectGuids& cell_guids = _mapObjectGuidsStore[MAKE_PAIR32(data->mapid, i)][cellCoord.GetId()]; CellObjectGuids& cell_guids = _mapObjectGuidsStore[MAKE_PAIR32(data->mapid, i)][cellCoord.GetId()];
cell_guids.creatures.erase(guid); cell_guids.creatures.erase(guid);
} }
@@ -2286,7 +2286,7 @@ void ObjectMgr::AddGameobjectToGrid(ObjectGuid::LowType guid, GameObjectData con
{ {
if (mask & 1) if (mask & 1)
{ {
CellCoord cellCoord = acore::ComputeCellCoord(data->posX, data->posY); CellCoord cellCoord = Acore::ComputeCellCoord(data->posX, data->posY);
CellObjectGuids& cell_guids = _mapObjectGuidsStore[MAKE_PAIR32(data->mapid, i)][cellCoord.GetId()]; CellObjectGuids& cell_guids = _mapObjectGuidsStore[MAKE_PAIR32(data->mapid, i)][cellCoord.GetId()];
cell_guids.gameobjects.insert(guid); cell_guids.gameobjects.insert(guid);
} }
@@ -2300,7 +2300,7 @@ void ObjectMgr::RemoveGameobjectFromGrid(ObjectGuid::LowType guid, GameObjectDat
{ {
if (mask & 1) if (mask & 1)
{ {
CellCoord cellCoord = acore::ComputeCellCoord(data->posX, data->posY); CellCoord cellCoord = Acore::ComputeCellCoord(data->posX, data->posY);
CellObjectGuids& cell_guids = _mapObjectGuidsStore[MAKE_PAIR32(data->mapid, i)][cellCoord.GetId()]; CellObjectGuids& cell_guids = _mapObjectGuidsStore[MAKE_PAIR32(data->mapid, i)][cellCoord.GetId()];
cell_guids.gameobjects.erase(guid); cell_guids.gameobjects.erase(guid);
} }
@@ -4833,7 +4833,7 @@ void ObjectMgr::LoadScripts(ScriptsType type)
continue; continue;
} }
if (!acore::IsValidMapCoord(tmp.TeleportTo.DestX, tmp.TeleportTo.DestY, tmp.TeleportTo.DestZ, tmp.TeleportTo.Orientation)) if (!Acore::IsValidMapCoord(tmp.TeleportTo.DestX, tmp.TeleportTo.DestY, tmp.TeleportTo.DestZ, tmp.TeleportTo.Orientation))
{ {
LOG_ERROR("sql.sql", "Table `%s` has invalid coordinates (X: %f Y: %f Z: %f O: %f) in SCRIPT_COMMAND_TELEPORT_TO for script id %u", LOG_ERROR("sql.sql", "Table `%s` has invalid coordinates (X: %f Y: %f Z: %f O: %f) in SCRIPT_COMMAND_TELEPORT_TO for script id %u",
tableName.c_str(), tmp.TeleportTo.DestX, tmp.TeleportTo.DestY, tmp.TeleportTo.DestZ, tmp.TeleportTo.Orientation, tmp.id); tableName.c_str(), tmp.TeleportTo.DestX, tmp.TeleportTo.DestY, tmp.TeleportTo.DestZ, tmp.TeleportTo.Orientation, tmp.id);
@@ -4931,7 +4931,7 @@ void ObjectMgr::LoadScripts(ScriptsType type)
case SCRIPT_COMMAND_TEMP_SUMMON_CREATURE: case SCRIPT_COMMAND_TEMP_SUMMON_CREATURE:
{ {
if (!acore::IsValidMapCoord(tmp.TempSummonCreature.PosX, tmp.TempSummonCreature.PosY, tmp.TempSummonCreature.PosZ, tmp.TempSummonCreature.Orientation)) if (!Acore::IsValidMapCoord(tmp.TempSummonCreature.PosX, tmp.TempSummonCreature.PosY, tmp.TempSummonCreature.PosZ, tmp.TempSummonCreature.Orientation))
{ {
LOG_ERROR("sql.sql", "Table `%s` has invalid coordinates (X: %f Y: %f Z: %f O: %f) in SCRIPT_COMMAND_TEMP_SUMMON_CREATURE for script id %u", LOG_ERROR("sql.sql", "Table `%s` has invalid coordinates (X: %f Y: %f Z: %f O: %f) in SCRIPT_COMMAND_TEMP_SUMMON_CREATURE for script id %u",
tableName.c_str(), tmp.TempSummonCreature.PosX, tmp.TempSummonCreature.PosY, tmp.TempSummonCreature.PosZ, tmp.TempSummonCreature.Orientation, tmp.id); tableName.c_str(), tmp.TempSummonCreature.PosX, tmp.TempSummonCreature.PosY, tmp.TempSummonCreature.PosZ, tmp.TempSummonCreature.Orientation, tmp.id);
@@ -7221,7 +7221,7 @@ void ObjectMgr::LoadPointsOfInterest()
POI.Importance = fields[5].GetUInt32(); POI.Importance = fields[5].GetUInt32();
POI.Name = fields[6].GetString(); POI.Name = fields[6].GetString();
if (!acore::IsValidMapCoord(POI.PositionX, POI.PositionY)) if (!Acore::IsValidMapCoord(POI.PositionX, POI.PositionY))
{ {
LOG_ERROR("sql.sql", "Table `points_of_interest` (ID: %u) have invalid coordinates (X: %f Y: %f), ignored.", point_id, POI.PositionX, POI.PositionY); LOG_ERROR("sql.sql", "Table `points_of_interest` (ID: %u) have invalid coordinates (X: %f Y: %f), ignored.", point_id, POI.PositionX, POI.PositionY);
continue; continue;
+4 -4
View File
@@ -24,7 +24,7 @@ inline Cell::Cell(CellCoord const& p)
inline Cell::Cell(float x, float y) inline Cell::Cell(float x, float y)
{ {
CellCoord p = acore::ComputeCellCoord(x, y); CellCoord p = Acore::ComputeCellCoord(x, y);
data.Part.grid_x = p.x_coord / MAX_NUMBER_OF_CELLS; data.Part.grid_x = p.x_coord / MAX_NUMBER_OF_CELLS;
data.Part.grid_y = p.y_coord / MAX_NUMBER_OF_CELLS; data.Part.grid_y = p.y_coord / MAX_NUMBER_OF_CELLS;
data.Part.cell_x = p.x_coord % MAX_NUMBER_OF_CELLS; data.Part.cell_x = p.x_coord % MAX_NUMBER_OF_CELLS;
@@ -37,12 +37,12 @@ inline CellArea Cell::CalculateCellArea(float x, float y, float radius)
{ {
if (radius <= 0.0f) if (radius <= 0.0f)
{ {
CellCoord center = acore::ComputeCellCoord(x, y).normalize(); CellCoord center = Acore::ComputeCellCoord(x, y).normalize();
return CellArea(center, center); return CellArea(center, center);
} }
CellCoord centerX = acore::ComputeCellCoord(x - radius, y - radius).normalize(); CellCoord centerX = Acore::ComputeCellCoord(x - radius, y - radius).normalize();
CellCoord centerY = acore::ComputeCellCoord(x + radius, y + radius).normalize(); CellCoord centerY = Acore::ComputeCellCoord(x + radius, y + radius).normalize();
return CellArea(centerX, centerY); return CellArea(centerX, centerY);
} }
+1 -1
View File
@@ -158,7 +158,7 @@ bool operator!=(const CoordPair<LIMIT>& p1, const CoordPair<LIMIT>& p2)
typedef CoordPair<MAX_NUMBER_OF_GRIDS> GridCoord; typedef CoordPair<MAX_NUMBER_OF_GRIDS> GridCoord;
typedef CoordPair<TOTAL_NUMBER_OF_CELLS_PER_MAP> CellCoord; typedef CoordPair<TOTAL_NUMBER_OF_CELLS_PER_MAP> CellCoord;
namespace acore namespace Acore
{ {
template<class RET_TYPE, int CENTER_VAL> template<class RET_TYPE, int CENTER_VAL>
inline RET_TYPE Compute(float x, float y, float center_offset, float size) inline RET_TYPE Compute(float x, float y, float center_offset, float size)
@@ -16,7 +16,7 @@
#include "WorldPacket.h" #include "WorldPacket.h"
#include "WorldSession.h" #include "WorldSession.h"
using namespace acore; using namespace Acore;
void VisibleNotifier::Visit(GameObjectMapType& m) void VisibleNotifier::Visit(GameObjectMapType& m)
{ {
@@ -23,7 +23,7 @@
class Player; class Player;
//class Map; //class Map;
namespace acore namespace Acore
{ {
struct VisibleNotifier struct VisibleNotifier
{ {
@@ -17,7 +17,7 @@
#include "WorldPacket.h" #include "WorldPacket.h"
template<class T> template<class T>
inline void acore::VisibleNotifier::Visit(GridRefManager<T>& m) inline void Acore::VisibleNotifier::Visit(GridRefManager<T>& m)
{ {
// Xinef: Update gameobjects only // Xinef: Update gameobjects only
if (i_gobjOnly) if (i_gobjOnly)
@@ -37,7 +37,7 @@ inline void acore::VisibleNotifier::Visit(GridRefManager<T>& m)
// WorldObject searchers & workers // WorldObject searchers & workers
template<class Check> template<class Check>
void acore::WorldObjectSearcher<Check>::Visit(GameObjectMapType& m) void Acore::WorldObjectSearcher<Check>::Visit(GameObjectMapType& m)
{ {
if (!(i_mapTypeMask & GRID_MAP_TYPE_MASK_GAMEOBJECT)) if (!(i_mapTypeMask & GRID_MAP_TYPE_MASK_GAMEOBJECT))
return; return;
@@ -60,7 +60,7 @@ void acore::WorldObjectSearcher<Check>::Visit(GameObjectMapType& m)
} }
template<class Check> template<class Check>
void acore::WorldObjectSearcher<Check>::Visit(PlayerMapType& m) void Acore::WorldObjectSearcher<Check>::Visit(PlayerMapType& m)
{ {
if (!(i_mapTypeMask & GRID_MAP_TYPE_MASK_PLAYER)) if (!(i_mapTypeMask & GRID_MAP_TYPE_MASK_PLAYER))
return; return;
@@ -83,7 +83,7 @@ void acore::WorldObjectSearcher<Check>::Visit(PlayerMapType& m)
} }
template<class Check> template<class Check>
void acore::WorldObjectSearcher<Check>::Visit(CreatureMapType& m) void Acore::WorldObjectSearcher<Check>::Visit(CreatureMapType& m)
{ {
if (!(i_mapTypeMask & GRID_MAP_TYPE_MASK_CREATURE)) if (!(i_mapTypeMask & GRID_MAP_TYPE_MASK_CREATURE))
return; return;
@@ -106,7 +106,7 @@ void acore::WorldObjectSearcher<Check>::Visit(CreatureMapType& m)
} }
template<class Check> template<class Check>
void acore::WorldObjectSearcher<Check>::Visit(CorpseMapType& m) void Acore::WorldObjectSearcher<Check>::Visit(CorpseMapType& m)
{ {
if (!(i_mapTypeMask & GRID_MAP_TYPE_MASK_CORPSE)) if (!(i_mapTypeMask & GRID_MAP_TYPE_MASK_CORPSE))
return; return;
@@ -129,7 +129,7 @@ void acore::WorldObjectSearcher<Check>::Visit(CorpseMapType& m)
} }
template<class Check> template<class Check>
void acore::WorldObjectSearcher<Check>::Visit(DynamicObjectMapType& m) void Acore::WorldObjectSearcher<Check>::Visit(DynamicObjectMapType& m)
{ {
if (!(i_mapTypeMask & GRID_MAP_TYPE_MASK_DYNAMICOBJECT)) if (!(i_mapTypeMask & GRID_MAP_TYPE_MASK_DYNAMICOBJECT))
return; return;
@@ -152,7 +152,7 @@ void acore::WorldObjectSearcher<Check>::Visit(DynamicObjectMapType& m)
} }
template<class Check> template<class Check>
void acore::WorldObjectLastSearcher<Check>::Visit(GameObjectMapType& m) void Acore::WorldObjectLastSearcher<Check>::Visit(GameObjectMapType& m)
{ {
if (!(i_mapTypeMask & GRID_MAP_TYPE_MASK_GAMEOBJECT)) if (!(i_mapTypeMask & GRID_MAP_TYPE_MASK_GAMEOBJECT))
return; return;
@@ -168,7 +168,7 @@ void acore::WorldObjectLastSearcher<Check>::Visit(GameObjectMapType& m)
} }
template<class Check> template<class Check>
void acore::WorldObjectLastSearcher<Check>::Visit(PlayerMapType& m) void Acore::WorldObjectLastSearcher<Check>::Visit(PlayerMapType& m)
{ {
if (!(i_mapTypeMask & GRID_MAP_TYPE_MASK_PLAYER)) if (!(i_mapTypeMask & GRID_MAP_TYPE_MASK_PLAYER))
return; return;
@@ -184,7 +184,7 @@ void acore::WorldObjectLastSearcher<Check>::Visit(PlayerMapType& m)
} }
template<class Check> template<class Check>
void acore::WorldObjectLastSearcher<Check>::Visit(CreatureMapType& m) void Acore::WorldObjectLastSearcher<Check>::Visit(CreatureMapType& m)
{ {
if (!(i_mapTypeMask & GRID_MAP_TYPE_MASK_CREATURE)) if (!(i_mapTypeMask & GRID_MAP_TYPE_MASK_CREATURE))
return; return;
@@ -200,7 +200,7 @@ void acore::WorldObjectLastSearcher<Check>::Visit(CreatureMapType& m)
} }
template<class Check> template<class Check>
void acore::WorldObjectLastSearcher<Check>::Visit(CorpseMapType& m) void Acore::WorldObjectLastSearcher<Check>::Visit(CorpseMapType& m)
{ {
if (!(i_mapTypeMask & GRID_MAP_TYPE_MASK_CORPSE)) if (!(i_mapTypeMask & GRID_MAP_TYPE_MASK_CORPSE))
return; return;
@@ -216,7 +216,7 @@ void acore::WorldObjectLastSearcher<Check>::Visit(CorpseMapType& m)
} }
template<class Check> template<class Check>
void acore::WorldObjectLastSearcher<Check>::Visit(DynamicObjectMapType& m) void Acore::WorldObjectLastSearcher<Check>::Visit(DynamicObjectMapType& m)
{ {
if (!(i_mapTypeMask & GRID_MAP_TYPE_MASK_DYNAMICOBJECT)) if (!(i_mapTypeMask & GRID_MAP_TYPE_MASK_DYNAMICOBJECT))
return; return;
@@ -232,7 +232,7 @@ void acore::WorldObjectLastSearcher<Check>::Visit(DynamicObjectMapType& m)
} }
template<class Check> template<class Check>
void acore::WorldObjectListSearcher<Check>::Visit(PlayerMapType& m) void Acore::WorldObjectListSearcher<Check>::Visit(PlayerMapType& m)
{ {
if (!(i_mapTypeMask & GRID_MAP_TYPE_MASK_PLAYER)) if (!(i_mapTypeMask & GRID_MAP_TYPE_MASK_PLAYER))
return; return;
@@ -243,7 +243,7 @@ void acore::WorldObjectListSearcher<Check>::Visit(PlayerMapType& m)
} }
template<class Check> template<class Check>
void acore::WorldObjectListSearcher<Check>::Visit(CreatureMapType& m) void Acore::WorldObjectListSearcher<Check>::Visit(CreatureMapType& m)
{ {
if (!(i_mapTypeMask & GRID_MAP_TYPE_MASK_CREATURE)) if (!(i_mapTypeMask & GRID_MAP_TYPE_MASK_CREATURE))
return; return;
@@ -254,7 +254,7 @@ void acore::WorldObjectListSearcher<Check>::Visit(CreatureMapType& m)
} }
template<class Check> template<class Check>
void acore::WorldObjectListSearcher<Check>::Visit(CorpseMapType& m) void Acore::WorldObjectListSearcher<Check>::Visit(CorpseMapType& m)
{ {
if (!(i_mapTypeMask & GRID_MAP_TYPE_MASK_CORPSE)) if (!(i_mapTypeMask & GRID_MAP_TYPE_MASK_CORPSE))
return; return;
@@ -265,7 +265,7 @@ void acore::WorldObjectListSearcher<Check>::Visit(CorpseMapType& m)
} }
template<class Check> template<class Check>
void acore::WorldObjectListSearcher<Check>::Visit(GameObjectMapType& m) void Acore::WorldObjectListSearcher<Check>::Visit(GameObjectMapType& m)
{ {
if (!(i_mapTypeMask & GRID_MAP_TYPE_MASK_GAMEOBJECT)) if (!(i_mapTypeMask & GRID_MAP_TYPE_MASK_GAMEOBJECT))
return; return;
@@ -276,7 +276,7 @@ void acore::WorldObjectListSearcher<Check>::Visit(GameObjectMapType& m)
} }
template<class Check> template<class Check>
void acore::WorldObjectListSearcher<Check>::Visit(DynamicObjectMapType& m) void Acore::WorldObjectListSearcher<Check>::Visit(DynamicObjectMapType& m)
{ {
if (!(i_mapTypeMask & GRID_MAP_TYPE_MASK_DYNAMICOBJECT)) if (!(i_mapTypeMask & GRID_MAP_TYPE_MASK_DYNAMICOBJECT))
return; return;
@@ -289,7 +289,7 @@ void acore::WorldObjectListSearcher<Check>::Visit(DynamicObjectMapType& m)
// Gameobject searchers // Gameobject searchers
template<class Check> template<class Check>
void acore::GameObjectSearcher<Check>::Visit(GameObjectMapType& m) void Acore::GameObjectSearcher<Check>::Visit(GameObjectMapType& m)
{ {
// already found // already found
if (i_object) if (i_object)
@@ -309,7 +309,7 @@ void acore::GameObjectSearcher<Check>::Visit(GameObjectMapType& m)
} }
template<class Check> template<class Check>
void acore::GameObjectLastSearcher<Check>::Visit(GameObjectMapType& m) void Acore::GameObjectLastSearcher<Check>::Visit(GameObjectMapType& m)
{ {
for (GameObjectMapType::iterator itr = m.begin(); itr != m.end(); ++itr) for (GameObjectMapType::iterator itr = m.begin(); itr != m.end(); ++itr)
{ {
@@ -322,7 +322,7 @@ void acore::GameObjectLastSearcher<Check>::Visit(GameObjectMapType& m)
} }
template<class Check> template<class Check>
void acore::GameObjectListSearcher<Check>::Visit(GameObjectMapType& m) void Acore::GameObjectListSearcher<Check>::Visit(GameObjectMapType& m)
{ {
for (GameObjectMapType::iterator itr = m.begin(); itr != m.end(); ++itr) for (GameObjectMapType::iterator itr = m.begin(); itr != m.end(); ++itr)
if (itr->GetSource()->InSamePhase(i_phaseMask)) if (itr->GetSource()->InSamePhase(i_phaseMask))
@@ -333,7 +333,7 @@ void acore::GameObjectListSearcher<Check>::Visit(GameObjectMapType& m)
// Unit searchers // Unit searchers
template<class Check> template<class Check>
void acore::UnitSearcher<Check>::Visit(CreatureMapType& m) void Acore::UnitSearcher<Check>::Visit(CreatureMapType& m)
{ {
// already found // already found
if (i_object) if (i_object)
@@ -353,7 +353,7 @@ void acore::UnitSearcher<Check>::Visit(CreatureMapType& m)
} }
template<class Check> template<class Check>
void acore::UnitSearcher<Check>::Visit(PlayerMapType& m) void Acore::UnitSearcher<Check>::Visit(PlayerMapType& m)
{ {
// already found // already found
if (i_object) if (i_object)
@@ -373,7 +373,7 @@ void acore::UnitSearcher<Check>::Visit(PlayerMapType& m)
} }
template<class Check> template<class Check>
void acore::UnitLastSearcher<Check>::Visit(CreatureMapType& m) void Acore::UnitLastSearcher<Check>::Visit(CreatureMapType& m)
{ {
for (CreatureMapType::iterator itr = m.begin(); itr != m.end(); ++itr) for (CreatureMapType::iterator itr = m.begin(); itr != m.end(); ++itr)
{ {
@@ -386,7 +386,7 @@ void acore::UnitLastSearcher<Check>::Visit(CreatureMapType& m)
} }
template<class Check> template<class Check>
void acore::UnitLastSearcher<Check>::Visit(PlayerMapType& m) void Acore::UnitLastSearcher<Check>::Visit(PlayerMapType& m)
{ {
for (PlayerMapType::iterator itr = m.begin(); itr != m.end(); ++itr) for (PlayerMapType::iterator itr = m.begin(); itr != m.end(); ++itr)
{ {
@@ -399,7 +399,7 @@ void acore::UnitLastSearcher<Check>::Visit(PlayerMapType& m)
} }
template<class Check> template<class Check>
void acore::UnitListSearcher<Check>::Visit(PlayerMapType& m) void Acore::UnitListSearcher<Check>::Visit(PlayerMapType& m)
{ {
for (PlayerMapType::iterator itr = m.begin(); itr != m.end(); ++itr) for (PlayerMapType::iterator itr = m.begin(); itr != m.end(); ++itr)
if (itr->GetSource()->InSamePhase(i_phaseMask)) if (itr->GetSource()->InSamePhase(i_phaseMask))
@@ -408,7 +408,7 @@ void acore::UnitListSearcher<Check>::Visit(PlayerMapType& m)
} }
template<class Check> template<class Check>
void acore::UnitListSearcher<Check>::Visit(CreatureMapType& m) void Acore::UnitListSearcher<Check>::Visit(CreatureMapType& m)
{ {
for (CreatureMapType::iterator itr = m.begin(); itr != m.end(); ++itr) for (CreatureMapType::iterator itr = m.begin(); itr != m.end(); ++itr)
if (itr->GetSource()->InSamePhase(i_phaseMask)) if (itr->GetSource()->InSamePhase(i_phaseMask))
@@ -419,7 +419,7 @@ void acore::UnitListSearcher<Check>::Visit(CreatureMapType& m)
// Creature searchers // Creature searchers
template<class Check> template<class Check>
void acore::CreatureSearcher<Check>::Visit(CreatureMapType& m) void Acore::CreatureSearcher<Check>::Visit(CreatureMapType& m)
{ {
// already found // already found
if (i_object) if (i_object)
@@ -439,7 +439,7 @@ void acore::CreatureSearcher<Check>::Visit(CreatureMapType& m)
} }
template<class Check> template<class Check>
void acore::CreatureLastSearcher<Check>::Visit(CreatureMapType& m) void Acore::CreatureLastSearcher<Check>::Visit(CreatureMapType& m)
{ {
for (CreatureMapType::iterator itr = m.begin(); itr != m.end(); ++itr) for (CreatureMapType::iterator itr = m.begin(); itr != m.end(); ++itr)
{ {
@@ -452,7 +452,7 @@ void acore::CreatureLastSearcher<Check>::Visit(CreatureMapType& m)
} }
template<class Check> template<class Check>
void acore::CreatureListSearcher<Check>::Visit(CreatureMapType& m) void Acore::CreatureListSearcher<Check>::Visit(CreatureMapType& m)
{ {
for (CreatureMapType::iterator itr = m.begin(); itr != m.end(); ++itr) for (CreatureMapType::iterator itr = m.begin(); itr != m.end(); ++itr)
if (itr->GetSource()->InSamePhase(i_phaseMask)) if (itr->GetSource()->InSamePhase(i_phaseMask))
@@ -461,7 +461,7 @@ void acore::CreatureListSearcher<Check>::Visit(CreatureMapType& m)
} }
template<class Check> template<class Check>
void acore::PlayerListSearcher<Check>::Visit(PlayerMapType& m) void Acore::PlayerListSearcher<Check>::Visit(PlayerMapType& m)
{ {
for (PlayerMapType::iterator itr = m.begin(); itr != m.end(); ++itr) for (PlayerMapType::iterator itr = m.begin(); itr != m.end(); ++itr)
if (itr->GetSource()->InSamePhase(i_phaseMask)) if (itr->GetSource()->InSamePhase(i_phaseMask))
@@ -470,7 +470,7 @@ void acore::PlayerListSearcher<Check>::Visit(PlayerMapType& m)
} }
template<class Check> template<class Check>
void acore::PlayerListSearcherWithSharedVision<Check>::Visit(PlayerMapType& m) void Acore::PlayerListSearcherWithSharedVision<Check>::Visit(PlayerMapType& m)
{ {
for (PlayerMapType::iterator itr = m.begin(); itr != m.end(); ++itr) for (PlayerMapType::iterator itr = m.begin(); itr != m.end(); ++itr)
if (itr->GetSource()->InSamePhase(i_phaseMask)) if (itr->GetSource()->InSamePhase(i_phaseMask))
@@ -479,7 +479,7 @@ void acore::PlayerListSearcherWithSharedVision<Check>::Visit(PlayerMapType& m)
} }
template<class Check> template<class Check>
void acore::PlayerListSearcherWithSharedVision<Check>::Visit(CreatureMapType& m) void Acore::PlayerListSearcherWithSharedVision<Check>::Visit(CreatureMapType& m)
{ {
for (CreatureMapType::iterator itr = m.begin(); itr != m.end(); ++itr) for (CreatureMapType::iterator itr = m.begin(); itr != m.end(); ++itr)
if (itr->GetSource()->InSamePhase(i_phaseMask) && itr->GetSource()->HasSharedVision()) if (itr->GetSource()->InSamePhase(i_phaseMask) && itr->GetSource()->HasSharedVision())
@@ -489,7 +489,7 @@ void acore::PlayerListSearcherWithSharedVision<Check>::Visit(CreatureMapType& m)
} }
template<class Check> template<class Check>
void acore::PlayerSearcher<Check>::Visit(PlayerMapType& m) void Acore::PlayerSearcher<Check>::Visit(PlayerMapType& m)
{ {
// already found // already found
if (i_object) if (i_object)
@@ -509,7 +509,7 @@ void acore::PlayerSearcher<Check>::Visit(PlayerMapType& m)
} }
template<class Check> template<class Check>
void acore::PlayerLastSearcher<Check>::Visit(PlayerMapType& m) void Acore::PlayerLastSearcher<Check>::Visit(PlayerMapType& m)
{ {
for (PlayerMapType::iterator itr = m.begin(); itr != m.end(); ++itr) for (PlayerMapType::iterator itr = m.begin(); itr != m.end(); ++itr)
{ {
@@ -522,7 +522,7 @@ void acore::PlayerLastSearcher<Check>::Visit(PlayerMapType& m)
} }
template<class Builder> template<class Builder>
void acore::LocalizedPacketDo<Builder>::operator()(Player* p) void Acore::LocalizedPacketDo<Builder>::operator()(Player* p)
{ {
LocaleConstant loc_idx = p->GetSession()->GetSessionDbLocaleIndex(); LocaleConstant loc_idx = p->GetSession()->GetSessionDbLocaleIndex();
uint32 cache_idx = loc_idx + 1; uint32 cache_idx = loc_idx + 1;
@@ -547,7 +547,7 @@ void acore::LocalizedPacketDo<Builder>::operator()(Player* p)
} }
template<class Builder> template<class Builder>
void acore::LocalizedPacketListDo<Builder>::operator()(Player* p) void Acore::LocalizedPacketListDo<Builder>::operator()(Player* p)
{ {
LocaleConstant loc_idx = p->GetSession()->GetSessionDbLocaleIndex(); LocaleConstant loc_idx = p->GetSession()->GetSessionDbLocaleIndex();
uint32 cache_idx = loc_idx + 1; uint32 cache_idx = loc_idx + 1;

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