mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-13 01:08:35 +00:00
refactor(Core): apply clang-tidy modernize-* (#9975)
Co-authored-by: Kitzunu <24550914+Kitzunu@users.noreply.github.com>
This commit is contained in:
@@ -50,9 +50,9 @@ namespace MMAP
|
||||
|
||||
~MMapData()
|
||||
{
|
||||
for (NavMeshQuerySet::iterator i = navMeshQueries.begin(); i != navMeshQueries.end(); ++i)
|
||||
for (auto& navMeshQuerie : navMeshQueries)
|
||||
{
|
||||
dtFreeNavMeshQuery(i->second);
|
||||
dtFreeNavMeshQuery(navMeshQuerie.second);
|
||||
}
|
||||
|
||||
if (navMesh)
|
||||
@@ -74,7 +74,7 @@ namespace MMAP
|
||||
class MMapMgr
|
||||
{
|
||||
public:
|
||||
MMapMgr() : loadedTiles(0), thread_safe_environment(true) { }
|
||||
MMapMgr() = default;
|
||||
~MMapMgr();
|
||||
|
||||
void InitializeThreadUnsafe(const std::vector<uint32>& mapIds);
|
||||
@@ -87,17 +87,17 @@ namespace MMAP
|
||||
dtNavMeshQuery const* GetNavMeshQuery(uint32 mapId, uint32 instanceId);
|
||||
dtNavMesh const* GetNavMesh(uint32 mapId);
|
||||
|
||||
uint32 getLoadedTilesCount() const { return loadedTiles; }
|
||||
uint32 getLoadedMapsCount() const { return loadedMMaps.size(); }
|
||||
[[nodiscard]] uint32 getLoadedTilesCount() const { return loadedTiles; }
|
||||
[[nodiscard]] uint32 getLoadedMapsCount() const { return loadedMMaps.size(); }
|
||||
|
||||
private:
|
||||
bool loadMapData(uint32 mapId);
|
||||
uint32 packTileID(int32 x, int32 y);
|
||||
MMapDataSet::const_iterator GetMMapData(uint32 mapId) const;
|
||||
[[nodiscard]] MMapDataSet::const_iterator GetMMapData(uint32 mapId) const;
|
||||
|
||||
MMapDataSet loadedMMaps;
|
||||
uint32 loadedTiles;
|
||||
bool thread_safe_environment;
|
||||
uint32 loadedTiles{0};
|
||||
bool thread_safe_environment{true};
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -39,18 +39,18 @@ class GameObjectModelOwnerBase
|
||||
public:
|
||||
virtual ~GameObjectModelOwnerBase() = default;
|
||||
|
||||
virtual bool IsSpawned() const = 0;
|
||||
virtual uint32 GetDisplayId() const = 0;
|
||||
virtual uint32 GetPhaseMask() const = 0;
|
||||
virtual G3D::Vector3 GetPosition() const = 0;
|
||||
virtual float GetOrientation() const = 0;
|
||||
virtual float GetScale() const = 0;
|
||||
[[nodiscard]] virtual bool IsSpawned() const = 0;
|
||||
[[nodiscard]] virtual uint32 GetDisplayId() const = 0;
|
||||
[[nodiscard]] virtual uint32 GetPhaseMask() const = 0;
|
||||
[[nodiscard]] virtual G3D::Vector3 GetPosition() const = 0;
|
||||
[[nodiscard]] virtual float GetOrientation() const = 0;
|
||||
[[nodiscard]] virtual float GetScale() const = 0;
|
||||
virtual void DebugVisualizeCorner(G3D::Vector3 const& /*corner*/) const = 0;
|
||||
};
|
||||
|
||||
class GameObjectModel
|
||||
{
|
||||
GameObjectModel() : phasemask(0), iInvScale(0), iScale(0), iModel(nullptr), isWmo(false) { }
|
||||
GameObjectModel() = default;
|
||||
|
||||
public:
|
||||
std::string name;
|
||||
@@ -80,15 +80,15 @@ public:
|
||||
private:
|
||||
bool initialize(std::unique_ptr<GameObjectModelOwnerBase> modelOwner, std::string const& dataPath);
|
||||
|
||||
uint32 phasemask;
|
||||
uint32 phasemask{0};
|
||||
G3D::AABox iBound;
|
||||
G3D::Matrix3 iInvRot;
|
||||
G3D::Vector3 iPos;
|
||||
float iInvScale;
|
||||
float iScale;
|
||||
VMAP::WorldModel* iModel;
|
||||
float iInvScale{0};
|
||||
float iScale{0};
|
||||
VMAP::WorldModel* iModel{nullptr};
|
||||
std::unique_ptr<GameObjectModelOwnerBase> owner;
|
||||
bool isWmo;
|
||||
bool isWmo{false};
|
||||
};
|
||||
|
||||
void LoadGameObjectModelList(std::string const& dataPath);
|
||||
|
||||
@@ -41,7 +41,7 @@ public:
|
||||
|
||||
std::string const GetFilename();
|
||||
std::string const GetConfigPath();
|
||||
std::vector<std::string> const& GetArguments() const;
|
||||
[[nodiscard]] std::vector<std::string> const& GetArguments() const;
|
||||
std::vector<std::string> GetKeysByString(std::string const& name);
|
||||
|
||||
template<class T>
|
||||
|
||||
@@ -85,28 +85,28 @@ public:
|
||||
return t <<= n;
|
||||
}
|
||||
|
||||
int CompareTo(BigNumber const& bn) const;
|
||||
[[nodiscard]] int CompareTo(BigNumber const& bn) const;
|
||||
bool operator<=(BigNumber const& bn) const { return (CompareTo(bn) <= 0); }
|
||||
bool operator==(BigNumber const& bn) const { return (CompareTo(bn) == 0); }
|
||||
bool operator>=(BigNumber const& bn) const { return (CompareTo(bn) >= 0); }
|
||||
bool operator<(BigNumber const& bn) const { return (CompareTo(bn) < 0); }
|
||||
bool operator>(BigNumber const& bn) const { return (CompareTo(bn) > 0); }
|
||||
|
||||
bool IsZero() const;
|
||||
bool IsNegative() const;
|
||||
[[nodiscard]] bool IsZero() const;
|
||||
[[nodiscard]] bool IsNegative() const;
|
||||
|
||||
BigNumber ModExp(BigNumber const& bn1, BigNumber const& bn2) const;
|
||||
BigNumber Exp(BigNumber const&) const;
|
||||
[[nodiscard]] BigNumber ModExp(BigNumber const& bn1, BigNumber const& bn2) const;
|
||||
[[nodiscard]] BigNumber Exp(BigNumber const&) const;
|
||||
|
||||
int32 GetNumBytes() const;
|
||||
[[nodiscard]] int32 GetNumBytes() const;
|
||||
|
||||
struct bignum_st* BN() { return _bn; }
|
||||
struct bignum_st const* BN() const { return _bn; }
|
||||
[[nodiscard]] struct bignum_st const* BN() const { return _bn; }
|
||||
|
||||
uint32 AsDword() const;
|
||||
[[nodiscard]] uint32 AsDword() const;
|
||||
|
||||
void GetBytes(uint8* buf, size_t bufsize, bool littleEndian = true) const;
|
||||
std::vector<uint8> ToByteVector(int32 minSize = 0, bool littleEndian = true) const;
|
||||
[[nodiscard]] std::vector<uint8> ToByteVector(int32 minSize = 0, bool littleEndian = true) const;
|
||||
|
||||
template <std::size_t Size>
|
||||
std::array<uint8, Size> ToByteArray(bool littleEndian = true) const
|
||||
@@ -116,8 +116,8 @@ public:
|
||||
return buf;
|
||||
}
|
||||
|
||||
std::string AsHexStr() const;
|
||||
std::string AsDecStr() const;
|
||||
[[nodiscard]] std::string AsHexStr() const;
|
||||
[[nodiscard]] std::string AsDecStr() const;
|
||||
|
||||
private:
|
||||
struct bignum_st* _bn;
|
||||
|
||||
@@ -29,10 +29,10 @@ class LinkedListElement
|
||||
private:
|
||||
friend class LinkedListHead;
|
||||
|
||||
LinkedListElement* iNext;
|
||||
LinkedListElement* iPrev;
|
||||
LinkedListElement* iNext{nullptr};
|
||||
LinkedListElement* iPrev{nullptr};
|
||||
public:
|
||||
LinkedListElement(): iNext(nullptr), iPrev(nullptr) { }
|
||||
LinkedListElement() = default;
|
||||
~LinkedListElement() { delink(); }
|
||||
|
||||
[[nodiscard]] bool hasNext() const { return (iNext && iNext->iNext != nullptr); }
|
||||
|
||||
@@ -150,7 +150,7 @@ public:
|
||||
}
|
||||
|
||||
template<class SPECIFIC_TYPE>
|
||||
std::size_t Size() const
|
||||
[[nodiscard]] std::size_t Size() const
|
||||
{
|
||||
std::size_t size = 0;
|
||||
Acore::Size(_elements, &size, (SPECIFIC_TYPE*)nullptr);
|
||||
@@ -158,7 +158,7 @@ public:
|
||||
}
|
||||
|
||||
ContainerUnorderedMap<OBJECT_TYPES, KEY_TYPE>& GetElements() { return _elements; }
|
||||
ContainerUnorderedMap<OBJECT_TYPES, KEY_TYPE> const& GetElements() const { return _elements; }
|
||||
[[nodiscard]] ContainerUnorderedMap<OBJECT_TYPES, KEY_TYPE> const& GetElements() const { return _elements; }
|
||||
|
||||
private:
|
||||
ContainerUnorderedMap<OBJECT_TYPES, KEY_TYPE> _elements;
|
||||
|
||||
@@ -57,7 +57,7 @@ public:
|
||||
void Initialize();
|
||||
void LoadFromConfig();
|
||||
void Close();
|
||||
bool ShouldLog(std::string const& type, LogLevel level) const;
|
||||
[[nodiscard]] bool ShouldLog(std::string const& type, LogLevel level) const;
|
||||
bool SetLogLevel(std::string const& name, int32 level, bool isLogger = true);
|
||||
|
||||
template<typename Format, typename... Args>
|
||||
@@ -93,8 +93,8 @@ public:
|
||||
RegisterAppender(AppenderImpl::type, &CreateAppender<AppenderImpl>);
|
||||
}
|
||||
|
||||
std::string const& GetLogsDir() const { return m_logsDir; }
|
||||
std::string const& GetLogsTimestamp() const { return m_logsTimestamp; }
|
||||
[[nodiscard]] std::string const& GetLogsDir() const { return m_logsDir; }
|
||||
[[nodiscard]] std::string const& GetLogsTimestamp() const { return m_logsTimestamp; }
|
||||
|
||||
// Deprecated functions
|
||||
template<typename Format, typename... Args>
|
||||
@@ -185,7 +185,7 @@ private:
|
||||
static std::string GetTimestampStr();
|
||||
void write(std::unique_ptr<LogMessage>&& msg) const;
|
||||
|
||||
Logger const* GetLoggerByType(std::string const& type) const;
|
||||
[[nodiscard]] Logger const* GetLoggerByType(std::string const& type) const;
|
||||
Appender* GetAppenderByName(std::string_view name);
|
||||
uint8 NextAppenderId();
|
||||
void CreateAppenderFromConfig(std::string const& name);
|
||||
|
||||
@@ -31,20 +31,15 @@ class LockedQueue
|
||||
StorageType _queue;
|
||||
|
||||
//! Cancellation flag.
|
||||
volatile bool _canceled;
|
||||
volatile bool _canceled{false};
|
||||
|
||||
public:
|
||||
|
||||
//! Create a LockedQueue.
|
||||
LockedQueue()
|
||||
: _canceled(false)
|
||||
{
|
||||
}
|
||||
LockedQueue() = default;
|
||||
|
||||
//! Destroy a LockedQueue.
|
||||
virtual ~LockedQueue()
|
||||
{
|
||||
}
|
||||
virtual ~LockedQueue() = default;
|
||||
|
||||
//! Adds an item to the queue.
|
||||
void add(const T& item)
|
||||
|
||||
@@ -51,7 +51,7 @@ public:
|
||||
return _queue.empty();
|
||||
}
|
||||
|
||||
size_t Size() const
|
||||
[[nodiscard]] size_t Size() const
|
||||
{
|
||||
return _queue.size();
|
||||
}
|
||||
|
||||
@@ -40,24 +40,24 @@ public:
|
||||
full_ = head_ == tail_;
|
||||
}
|
||||
|
||||
bool empty() const
|
||||
[[nodiscard]] bool empty() const
|
||||
{
|
||||
//if head and tail are equal, we are empty
|
||||
return (!full_ && (head_ == tail_));
|
||||
}
|
||||
|
||||
bool full() const
|
||||
[[nodiscard]] bool full() const
|
||||
{
|
||||
//If tail is ahead the head by 1, we are full
|
||||
return full_;
|
||||
}
|
||||
|
||||
size_t capacity() const
|
||||
[[nodiscard]] size_t capacity() const
|
||||
{
|
||||
return max_size_;
|
||||
}
|
||||
|
||||
size_t size() const
|
||||
[[nodiscard]] size_t size() const
|
||||
{
|
||||
size_t size = max_size_;
|
||||
|
||||
@@ -98,6 +98,6 @@ private:
|
||||
size_t head_ = 0;
|
||||
size_t tail_ = 0;
|
||||
const size_t max_size_;
|
||||
bool full_ = 0;
|
||||
bool full_ = false;
|
||||
};
|
||||
#endif
|
||||
|
||||
@@ -43,9 +43,9 @@ class BasicEvent
|
||||
|
||||
public:
|
||||
BasicEvent()
|
||||
: m_abortState(AbortState::STATE_RUNNING), m_addTime(0), m_execTime(0) { }
|
||||
= default;
|
||||
|
||||
virtual ~BasicEvent() { } // override destructor to perform some actions on event removal
|
||||
virtual ~BasicEvent() = default; // override destructor to perform some actions on event removal
|
||||
|
||||
// this method executes when the event is triggered
|
||||
// return false if event does not want to be deleted
|
||||
@@ -61,15 +61,15 @@ class BasicEvent
|
||||
|
||||
private:
|
||||
void SetAborted();
|
||||
bool IsRunning() const { return (m_abortState == AbortState::STATE_RUNNING); }
|
||||
bool IsAbortScheduled() const { return (m_abortState == AbortState::STATE_ABORT_SCHEDULED); }
|
||||
bool IsAborted() const { return (m_abortState == AbortState::STATE_ABORTED); }
|
||||
[[nodiscard]] bool IsRunning() const { return (m_abortState == AbortState::STATE_RUNNING); }
|
||||
[[nodiscard]] bool IsAbortScheduled() const { return (m_abortState == AbortState::STATE_ABORT_SCHEDULED); }
|
||||
[[nodiscard]] bool IsAborted() const { return (m_abortState == AbortState::STATE_ABORTED); }
|
||||
|
||||
AbortState m_abortState; // set by externals when the event is aborted, aborted events don't execute
|
||||
AbortState m_abortState{AbortState::STATE_RUNNING}; // set by externals when the event is aborted, aborted events don't execute
|
||||
|
||||
// these can be used for time offset control
|
||||
uint64 m_addTime; // time when the event was added to queue, filled by event handler
|
||||
uint64 m_execTime; // planned time of next execution, filled by event handler
|
||||
uint64 m_addTime{0}; // time when the event was added to queue, filled by event handler
|
||||
uint64 m_execTime{0}; // planned time of next execution, filled by event handler
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
@@ -97,7 +97,7 @@ typedef std::multimap<uint64, BasicEvent*> EventList;
|
||||
class EventProcessor
|
||||
{
|
||||
public:
|
||||
EventProcessor() : m_time(0) { }
|
||||
EventProcessor() = default;
|
||||
~EventProcessor();
|
||||
|
||||
void Update(uint32 p_time);
|
||||
@@ -118,7 +118,7 @@ class EventProcessor
|
||||
[[nodiscard]] uint64 CalculateQueueTime(uint64 delay) const;
|
||||
|
||||
protected:
|
||||
uint64 m_time;
|
||||
uint64 m_time{0};
|
||||
EventList m_events;
|
||||
bool m_aborting;
|
||||
};
|
||||
|
||||
@@ -27,7 +27,7 @@ class MessageBuffer
|
||||
using size_type = std::vector<uint8>::size_type;
|
||||
|
||||
public:
|
||||
MessageBuffer() : _wpos(0), _rpos(0), _storage()
|
||||
MessageBuffer() : _storage()
|
||||
{
|
||||
_storage.resize(4096);
|
||||
}
|
||||
@@ -132,8 +132,8 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
size_type _wpos;
|
||||
size_type _rpos;
|
||||
size_type _wpos{0};
|
||||
size_type _rpos{0};
|
||||
std::vector<uint8> _storage;
|
||||
};
|
||||
|
||||
|
||||
@@ -68,8 +68,7 @@ struct IntervalTimer
|
||||
public:
|
||||
IntervalTimer()
|
||||
|
||||
{
|
||||
}
|
||||
= default;
|
||||
|
||||
void Update(time_t diff)
|
||||
{
|
||||
|
||||
@@ -653,7 +653,7 @@ class EventMap
|
||||
typedef std::multimap<uint32, uint32> EventStore;
|
||||
|
||||
public:
|
||||
EventMap() { }
|
||||
EventMap() = default;
|
||||
|
||||
/**
|
||||
* @name Reset
|
||||
|
||||
@@ -57,7 +57,7 @@ public:
|
||||
//! Prepares all prepared statements
|
||||
bool PrepareStatements();
|
||||
|
||||
inline MySQLConnectionInfo const* GetConnectionInfo() const
|
||||
[[nodiscard]] inline MySQLConnectionInfo const* GetConnectionInfo() const
|
||||
{
|
||||
return _connectionInfo.get();
|
||||
}
|
||||
@@ -213,7 +213,7 @@ public:
|
||||
#endif
|
||||
}
|
||||
|
||||
size_t QueueSize() const;
|
||||
[[nodiscard]] size_t QueueSize() const;
|
||||
|
||||
private:
|
||||
uint32 OpenConnections(InternalIndex type, uint8 numConnections);
|
||||
@@ -226,7 +226,7 @@ private:
|
||||
//! Caller MUST call t->Unlock() after touching the MySQL context to prevent deadlocks.
|
||||
T* GetFreeConnection();
|
||||
|
||||
char const* GetDatabaseName() const;
|
||||
[[nodiscard]] char const* GetDatabaseName() const;
|
||||
|
||||
//! Queue shared by async worker threads.
|
||||
std::unique_ptr<ProducerConsumerQueue<SQLOperation*>> _queue;
|
||||
|
||||
@@ -89,25 +89,25 @@ public:
|
||||
Field();
|
||||
~Field();
|
||||
|
||||
bool GetBool() const // Wrapper, actually gets integer
|
||||
[[nodiscard]] bool GetBool() const // Wrapper, actually gets integer
|
||||
{
|
||||
return GetUInt8() == 1 ? true : false;
|
||||
}
|
||||
|
||||
uint8 GetUInt8() const;
|
||||
int8 GetInt8() const;
|
||||
uint16 GetUInt16() const;
|
||||
int16 GetInt16() const;
|
||||
uint32 GetUInt32() const;
|
||||
int32 GetInt32() const;
|
||||
uint64 GetUInt64() const;
|
||||
int64 GetInt64() const;
|
||||
float GetFloat() const;
|
||||
double GetDouble() const;
|
||||
char const* GetCString() const;
|
||||
std::string GetString() const;
|
||||
std::string_view GetStringView() const;
|
||||
std::vector<uint8> GetBinary() const;
|
||||
[[nodiscard]] uint8 GetUInt8() const;
|
||||
[[nodiscard]] int8 GetInt8() const;
|
||||
[[nodiscard]] uint16 GetUInt16() const;
|
||||
[[nodiscard]] int16 GetInt16() const;
|
||||
[[nodiscard]] uint32 GetUInt32() const;
|
||||
[[nodiscard]] int32 GetInt32() const;
|
||||
[[nodiscard]] uint64 GetUInt64() const;
|
||||
[[nodiscard]] int64 GetInt64() const;
|
||||
[[nodiscard]] float GetFloat() const;
|
||||
[[nodiscard]] double GetDouble() const;
|
||||
[[nodiscard]] char const* GetCString() const;
|
||||
[[nodiscard]] std::string GetString() const;
|
||||
[[nodiscard]] std::string_view GetStringView() const;
|
||||
[[nodiscard]] std::vector<uint8> GetBinary() const;
|
||||
|
||||
template <size_t S>
|
||||
std::array<uint8, S> GetBinary() const
|
||||
@@ -117,7 +117,7 @@ public:
|
||||
return buf;
|
||||
}
|
||||
|
||||
bool IsNull() const
|
||||
[[nodiscard]] bool IsNull() const
|
||||
{
|
||||
return data.value == nullptr;
|
||||
}
|
||||
@@ -134,8 +134,8 @@ protected:
|
||||
|
||||
void SetByteValue(char const* newValue, uint32 length);
|
||||
void SetStructuredValue(char const* newValue, uint32 length);
|
||||
bool IsType(DatabaseFieldTypes type) const;
|
||||
bool IsNumeric() const;
|
||||
[[nodiscard]] bool IsType(DatabaseFieldTypes type) const;
|
||||
[[nodiscard]] bool IsNumeric() const;
|
||||
|
||||
private:
|
||||
QueryResultFieldMetadata const* meta;
|
||||
|
||||
@@ -523,7 +523,7 @@ public:
|
||||
//- Constructors for sync and async connections
|
||||
CharacterDatabaseConnection(MySQLConnectionInfo& connInfo);
|
||||
CharacterDatabaseConnection(ProducerConsumerQueue<SQLOperation*>* q, MySQLConnectionInfo& connInfo);
|
||||
~CharacterDatabaseConnection();
|
||||
~CharacterDatabaseConnection() override;
|
||||
|
||||
//- Loads database type specific prepared statements
|
||||
void DoPrepareStatements() override;
|
||||
|
||||
@@ -128,7 +128,7 @@ public:
|
||||
//- Constructors for sync and async connections
|
||||
LoginDatabaseConnection(MySQLConnectionInfo& connInfo);
|
||||
LoginDatabaseConnection(ProducerConsumerQueue<SQLOperation*>* q, MySQLConnectionInfo& connInfo);
|
||||
~LoginDatabaseConnection();
|
||||
~LoginDatabaseConnection() override;
|
||||
|
||||
//- Loads database type specific prepared statements
|
||||
void DoPrepareStatements() override;
|
||||
|
||||
@@ -112,7 +112,7 @@ public:
|
||||
//- Constructors for sync and async connections
|
||||
WorldDatabaseConnection(MySQLConnectionInfo& connInfo);
|
||||
WorldDatabaseConnection(ProducerConsumerQueue<SQLOperation*>* q, MySQLConnectionInfo& connInfo);
|
||||
~WorldDatabaseConnection();
|
||||
~WorldDatabaseConnection() override;
|
||||
|
||||
//- Loads database type specific prepared statements
|
||||
void DoPrepareStatements() override;
|
||||
|
||||
@@ -91,7 +91,7 @@ protected:
|
||||
/// Called by parent databasepool. Will let other threads access this connection
|
||||
void Unlock();
|
||||
|
||||
uint32 GetServerVersion() const;
|
||||
[[nodiscard]] uint32 GetServerVersion() const;
|
||||
MySQLPreparedStatement* GetPreparedStatement(uint32 index);
|
||||
void PrepareStatement(uint32 index, std::string const& sql, ConnectionFlags flags);
|
||||
|
||||
|
||||
@@ -85,8 +85,8 @@ public:
|
||||
setBinary(index, vec);
|
||||
}
|
||||
|
||||
uint32 GetIndex() const { return m_index; }
|
||||
std::vector<PreparedStatementData> const& GetParameters() const { return statement_data; }
|
||||
[[nodiscard]] uint32 GetIndex() const { return m_index; }
|
||||
[[nodiscard]] std::vector<PreparedStatementData> const& GetParameters() const { return statement_data; }
|
||||
|
||||
protected:
|
||||
uint32 m_index;
|
||||
@@ -116,7 +116,7 @@ class AC_DATABASE_API PreparedStatementTask : public SQLOperation
|
||||
{
|
||||
public:
|
||||
PreparedStatementTask(PreparedStatementBase* stmt, bool async = false);
|
||||
~PreparedStatementTask();
|
||||
~PreparedStatementTask() override;
|
||||
|
||||
bool Execute() override;
|
||||
PreparedQueryResultFuture GetFuture() { return m_result->get_future(); }
|
||||
|
||||
@@ -29,11 +29,11 @@ public:
|
||||
~ResultSet();
|
||||
|
||||
bool NextRow();
|
||||
uint64 GetRowCount() const { return _rowCount; }
|
||||
uint32 GetFieldCount() const { return _fieldCount; }
|
||||
std::string GetFieldName(uint32 index) const;
|
||||
[[nodiscard]] uint64 GetRowCount() const { return _rowCount; }
|
||||
[[nodiscard]] uint32 GetFieldCount() const { return _fieldCount; }
|
||||
[[nodiscard]] std::string GetFieldName(uint32 index) const;
|
||||
|
||||
Field* Fetch() const { return _currentRow; }
|
||||
[[nodiscard]] Field* Fetch() const { return _currentRow; }
|
||||
Field const& operator[](std::size_t index) const;
|
||||
|
||||
protected:
|
||||
@@ -58,10 +58,10 @@ public:
|
||||
~PreparedResultSet();
|
||||
|
||||
bool NextRow();
|
||||
uint64 GetRowCount() const { return m_rowCount; }
|
||||
uint32 GetFieldCount() const { return m_fieldCount; }
|
||||
[[nodiscard]] uint64 GetRowCount() const { return m_rowCount; }
|
||||
[[nodiscard]] uint32 GetFieldCount() const { return m_fieldCount; }
|
||||
|
||||
Field* Fetch() const;
|
||||
[[nodiscard]] Field* Fetch() const;
|
||||
Field const& operator[](std::size_t index) const;
|
||||
|
||||
protected:
|
||||
|
||||
@@ -47,8 +47,8 @@ class MySQLConnection;
|
||||
class AC_DATABASE_API SQLOperation
|
||||
{
|
||||
public:
|
||||
SQLOperation(): m_conn(nullptr) { }
|
||||
virtual ~SQLOperation() { }
|
||||
SQLOperation() = default;
|
||||
virtual ~SQLOperation() = default;
|
||||
|
||||
virtual int call()
|
||||
{
|
||||
@@ -58,7 +58,7 @@ public:
|
||||
virtual bool Execute() = 0;
|
||||
virtual void SetConnection(MySQLConnection* con) { m_conn = con; }
|
||||
|
||||
MySQLConnection* m_conn;
|
||||
MySQLConnection* m_conn{nullptr};
|
||||
|
||||
private:
|
||||
SQLOperation(SQLOperation const& right) = delete;
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
#include "StringFormat.h"
|
||||
#include <functional>
|
||||
#include <mutex>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
/*! Transactions, high level class. */
|
||||
@@ -36,7 +37,7 @@ template <typename T>
|
||||
friend class DatabaseWorkerPool;
|
||||
|
||||
public:
|
||||
TransactionBase() : _cleanedUp(false) { }
|
||||
TransactionBase() = default;
|
||||
virtual ~TransactionBase() { Cleanup(); }
|
||||
|
||||
void Append(char const* sql);
|
||||
@@ -46,7 +47,7 @@ public:
|
||||
Append(Acore::StringFormat(std::forward<Format>(sql), std::forward<Args>(args)...).c_str());
|
||||
}
|
||||
|
||||
std::size_t GetSize() const { return m_queries.size(); }
|
||||
[[nodiscard]] std::size_t GetSize() const { return m_queries.size(); }
|
||||
|
||||
protected:
|
||||
void AppendPreparedStatement(PreparedStatementBase* statement);
|
||||
@@ -54,7 +55,7 @@ protected:
|
||||
std::vector<SQLElementData> m_queries;
|
||||
|
||||
private:
|
||||
bool _cleanedUp;
|
||||
bool _cleanedUp{false};
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
@@ -76,8 +77,8 @@ friend class DatabaseWorker;
|
||||
friend class TransactionCallback;
|
||||
|
||||
public:
|
||||
TransactionTask(std::shared_ptr<TransactionBase> trans) : m_trans(trans) { }
|
||||
~TransactionTask() { }
|
||||
TransactionTask(std::shared_ptr<TransactionBase> trans) : m_trans(std::move(trans)) { }
|
||||
~TransactionTask() override = default;
|
||||
|
||||
protected:
|
||||
bool Execute() override;
|
||||
|
||||
@@ -225,7 +225,7 @@ struct AchievementCriteriaData
|
||||
|
||||
struct AchievementCriteriaDataSet
|
||||
{
|
||||
AchievementCriteriaDataSet() {}
|
||||
AchievementCriteriaDataSet() = default;
|
||||
typedef std::vector<AchievementCriteriaData> Storage;
|
||||
void Add(AchievementCriteriaData const& data) { storage.push_back(data); }
|
||||
bool Meets(Player const* source, Unit const* target, uint32 miscvalue = 0) const;
|
||||
|
||||
@@ -89,10 +89,10 @@ enum AuctionSortOrder
|
||||
|
||||
struct AuctionSortInfo
|
||||
{
|
||||
AuctionSortInfo() : sortOrder(AUCTION_SORT_MAX), isDesc(true) { }
|
||||
AuctionSortInfo() = default;
|
||||
|
||||
AuctionSortOrder sortOrder;
|
||||
bool isDesc;
|
||||
AuctionSortOrder sortOrder{AUCTION_SORT_MAX};
|
||||
bool isDesc{true};
|
||||
};
|
||||
|
||||
typedef std::vector<AuctionSortInfo> AuctionSortOrderVector;
|
||||
|
||||
@@ -187,7 +187,7 @@ enum BattlegroundTeams
|
||||
|
||||
struct BattlegroundObjectInfo
|
||||
{
|
||||
BattlegroundObjectInfo() {}
|
||||
BattlegroundObjectInfo() = default;
|
||||
|
||||
GameObject* object{nullptr};
|
||||
int32 timer{0};
|
||||
@@ -286,7 +286,7 @@ struct BattlegroundScore
|
||||
class ArenaLogEntryData
|
||||
{
|
||||
public:
|
||||
ArenaLogEntryData() {}
|
||||
ArenaLogEntryData() = default;
|
||||
void Fill(const char* name, ObjectGuid::LowType guid, uint32 acc, uint32 arenaTeamId, std::string ip)
|
||||
{
|
||||
Name = std::string(name);
|
||||
|
||||
@@ -62,22 +62,22 @@ class AC_GAME_API CharacterCache
|
||||
void DecreaseCharacterMailCount(ObjectGuid const& guid) { UpdateCharacterMailCount(guid, -1); };
|
||||
void IncreaseCharacterMailCount(ObjectGuid const& guid) { UpdateCharacterMailCount(guid, 1); };
|
||||
|
||||
bool HasCharacterCacheEntry(ObjectGuid const& guid) const;
|
||||
CharacterCacheEntry const* GetCharacterCacheByGuid(ObjectGuid const& guid) const;
|
||||
CharacterCacheEntry const* GetCharacterCacheByName(std::string const& name) const;
|
||||
[[nodiscard]] bool HasCharacterCacheEntry(ObjectGuid const& guid) const;
|
||||
[[nodiscard]] CharacterCacheEntry const* GetCharacterCacheByGuid(ObjectGuid const& guid) const;
|
||||
[[nodiscard]] CharacterCacheEntry const* GetCharacterCacheByName(std::string const& name) const;
|
||||
|
||||
void UpdateCharacterGroup(ObjectGuid const& guid, ObjectGuid groupGUID);
|
||||
void ClearCharacterGroup(ObjectGuid const& guid) { UpdateCharacterGroup(guid, ObjectGuid::Empty); };
|
||||
|
||||
ObjectGuid GetCharacterGuidByName(std::string const& name) const;
|
||||
[[nodiscard]] ObjectGuid GetCharacterGuidByName(std::string const& name) const;
|
||||
bool GetCharacterNameByGuid(ObjectGuid guid, std::string& name) const;
|
||||
uint32 GetCharacterTeamByGuid(ObjectGuid guid) const;
|
||||
uint32 GetCharacterAccountIdByGuid(ObjectGuid guid) const;
|
||||
uint32 GetCharacterAccountIdByName(std::string const& name) const;
|
||||
uint8 GetCharacterLevelByGuid(ObjectGuid guid) const;
|
||||
ObjectGuid::LowType GetCharacterGuildIdByGuid(ObjectGuid guid) const;
|
||||
uint32 GetCharacterArenaTeamIdByGuid(ObjectGuid guid, uint8 type) const;
|
||||
ObjectGuid GetCharacterGroupGuidByGuid(ObjectGuid guid) const;
|
||||
[[nodiscard]] uint32 GetCharacterTeamByGuid(ObjectGuid guid) const;
|
||||
[[nodiscard]] uint32 GetCharacterAccountIdByGuid(ObjectGuid guid) const;
|
||||
[[nodiscard]] uint32 GetCharacterAccountIdByName(std::string const& name) const;
|
||||
[[nodiscard]] uint8 GetCharacterLevelByGuid(ObjectGuid guid) const;
|
||||
[[nodiscard]] ObjectGuid::LowType GetCharacterGuildIdByGuid(ObjectGuid guid) const;
|
||||
[[nodiscard]] uint32 GetCharacterArenaTeamIdByGuid(ObjectGuid guid, uint8 type) const;
|
||||
[[nodiscard]] ObjectGuid GetCharacterGroupGuidByGuid(ObjectGuid guid) const;
|
||||
};
|
||||
|
||||
#define sCharacterCache CharacterCache::instance()
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
#include <list>
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
|
||||
class Player;
|
||||
|
||||
@@ -121,10 +122,10 @@ enum ChannelMemberFlags
|
||||
class ChannelRights
|
||||
{
|
||||
public:
|
||||
ChannelRights() : flags(0), speakDelay(0) {}
|
||||
ChannelRights(const uint32& f, const uint32& d, const std::string& jm, const std::string& sm, const std::set<uint32>& ml) : flags(f), speakDelay(d), joinMessage(jm), speakMessage(sm), moderators(ml) {}
|
||||
uint32 flags;
|
||||
uint32 speakDelay;
|
||||
ChannelRights() = default;
|
||||
ChannelRights(const uint32& f, const uint32& d, std::string jm, std::string sm, std::set<uint32> ml) : flags(f), speakDelay(d), joinMessage(std::move(jm)), speakMessage(std::move(sm)), moderators(std::move(ml)) {}
|
||||
uint32 flags{0};
|
||||
uint32 speakDelay{0};
|
||||
std::string joinMessage;
|
||||
std::string speakMessage;
|
||||
std::set<uint32> moderators;
|
||||
@@ -152,23 +153,23 @@ class Channel
|
||||
uint64 lastSpeakTime; // pussywizard
|
||||
Player* plrPtr; // pussywizard
|
||||
|
||||
bool HasFlag(uint8 flag) const { return flags & flag; }
|
||||
[[nodiscard]] bool HasFlag(uint8 flag) const { return flags & flag; }
|
||||
void SetFlag(uint8 flag) { if (!HasFlag(flag)) flags |= flag; }
|
||||
bool IsOwner() const { return flags & MEMBER_FLAG_OWNER; }
|
||||
[[nodiscard]] bool IsOwner() const { return flags & MEMBER_FLAG_OWNER; }
|
||||
void SetOwner(bool state)
|
||||
{
|
||||
if (state) flags |= MEMBER_FLAG_OWNER;
|
||||
else flags &= ~MEMBER_FLAG_OWNER;
|
||||
}
|
||||
bool IsOwnerGM() const { return _gmStatus; }
|
||||
[[nodiscard]] bool IsOwnerGM() const { return _gmStatus; }
|
||||
void SetOwnerGM(bool on) { _gmStatus = on; }
|
||||
bool IsModerator() const { return flags & MEMBER_FLAG_MODERATOR; }
|
||||
[[nodiscard]] bool IsModerator() const { return flags & MEMBER_FLAG_MODERATOR; }
|
||||
void SetModerator(bool state)
|
||||
{
|
||||
if (state) flags |= MEMBER_FLAG_MODERATOR;
|
||||
else flags &= ~MEMBER_FLAG_MODERATOR;
|
||||
}
|
||||
bool IsMuted() const { return flags & MEMBER_FLAG_MUTED; }
|
||||
[[nodiscard]] bool IsMuted() const { return flags & MEMBER_FLAG_MUTED; }
|
||||
void SetMuted(bool state)
|
||||
{
|
||||
if (state) flags |= MEMBER_FLAG_MUTED;
|
||||
@@ -190,16 +191,16 @@ class Channel
|
||||
|
||||
public:
|
||||
Channel(std::string const& name, uint32 channel_id, uint32 channelDBId, TeamId teamId = TEAM_NEUTRAL, bool announce = true, bool ownership = true);
|
||||
std::string const& GetName() const { return _name; }
|
||||
uint32 GetChannelId() const { return _channelId; }
|
||||
bool IsConstant() const { return _channelId != 0; }
|
||||
bool IsAnnounce() const { return _announce; }
|
||||
bool IsLFG() const { return GetFlags() & CHANNEL_FLAG_LFG; }
|
||||
std::string const& GetPassword() const { return _password; }
|
||||
[[nodiscard]] std::string const& GetName() const { return _name; }
|
||||
[[nodiscard]] uint32 GetChannelId() const { return _channelId; }
|
||||
[[nodiscard]] bool IsConstant() const { return _channelId != 0; }
|
||||
[[nodiscard]] bool IsAnnounce() const { return _announce; }
|
||||
[[nodiscard]] bool IsLFG() const { return GetFlags() & CHANNEL_FLAG_LFG; }
|
||||
[[nodiscard]] std::string const& GetPassword() const { return _password; }
|
||||
void SetPassword(std::string const& npassword) { _password = npassword; }
|
||||
uint32 GetNumPlayers() const { return playersStore.size(); }
|
||||
uint8 GetFlags() const { return _flags; }
|
||||
bool HasFlag(uint8 flag) const { return _flags & flag; }
|
||||
[[nodiscard]] uint32 GetNumPlayers() const { return playersStore.size(); }
|
||||
[[nodiscard]] uint8 GetFlags() const { return _flags; }
|
||||
[[nodiscard]] bool HasFlag(uint8 flag) const { return _flags & flag; }
|
||||
|
||||
void JoinChannel(Player* player, std::string const& pass);
|
||||
void LeaveChannel(Player* player, bool send = true);
|
||||
@@ -280,15 +281,15 @@ private:
|
||||
void SendToOne(WorldPacket* data, ObjectGuid who);
|
||||
void SendToAllWatching(WorldPacket* data);
|
||||
|
||||
bool IsOn(ObjectGuid who) const { return playersStore.find(who) != playersStore.end(); }
|
||||
bool IsBanned(ObjectGuid guid) const;
|
||||
[[nodiscard]] bool IsOn(ObjectGuid who) const { return playersStore.find(who) != playersStore.end(); }
|
||||
[[nodiscard]] bool IsBanned(ObjectGuid guid) const;
|
||||
|
||||
void UpdateChannelInDB() const;
|
||||
void UpdateChannelUseageInDB() const;
|
||||
void AddChannelBanToDB(ObjectGuid guid, uint32 time) const;
|
||||
void RemoveChannelBanFromDB(ObjectGuid guid) const;
|
||||
|
||||
uint8 GetPlayerFlags(ObjectGuid guid) const
|
||||
[[nodiscard]] uint8 GetPlayerFlags(ObjectGuid guid) const
|
||||
{
|
||||
PlayerContainer::const_iterator itr = playersStore.find(guid);
|
||||
return itr != playersStore.end() ? itr->second.flags : 0;
|
||||
|
||||
@@ -139,7 +139,7 @@ class ThreatContainer
|
||||
public:
|
||||
typedef std::list<HostileReference*> StorageType;
|
||||
|
||||
ThreatContainer() { }
|
||||
ThreatContainer() = default;
|
||||
|
||||
~ThreatContainer() { clearReferences(); }
|
||||
|
||||
|
||||
@@ -147,10 +147,10 @@ namespace lfg
|
||||
~Lfg5Guids() { delete roles; }
|
||||
void addRoles(LfgRolesMap const& r) { roles = new LfgRolesMap(r); }
|
||||
void clear() { guids.fill(ObjectGuid::Empty); }
|
||||
bool empty() const { return guids[0] == ObjectGuid::Empty; }
|
||||
ObjectGuid front() const { return guids[0]; }
|
||||
[[nodiscard]] bool empty() const { return guids[0] == ObjectGuid::Empty; }
|
||||
[[nodiscard]] ObjectGuid front() const { return guids[0]; }
|
||||
|
||||
uint8 size() const
|
||||
[[nodiscard]] uint8 size() const
|
||||
{
|
||||
if (guids[2])
|
||||
{
|
||||
@@ -422,7 +422,7 @@ namespace lfg
|
||||
}
|
||||
}
|
||||
|
||||
bool hasGuid(const ObjectGuid& g) const
|
||||
[[nodiscard]] bool hasGuid(const ObjectGuid& g) const
|
||||
{
|
||||
return g && (guids[0] == g || guids[1] == g || guids[2] == g || guids[3] == g || guids[4] == g);
|
||||
}
|
||||
@@ -481,7 +481,7 @@ namespace lfg
|
||||
roles = x.roles ? (new LfgRolesMap(*(x.roles))) : nullptr;
|
||||
}
|
||||
|
||||
std::string toString() const // for debugging
|
||||
[[nodiscard]] std::string toString() const // for debugging
|
||||
{
|
||||
std::ostringstream o;
|
||||
o << guids[0].ToString().c_str() << "," << guids[1].ToString().c_str() << "," << guids[2].ToString().c_str() << "," << guids[3].ToString().c_str() << "," << guids[4].ToString().c_str() << ":" << (roles ? 1 : 0);
|
||||
|
||||
@@ -48,17 +48,17 @@ namespace lfg
|
||||
void DecreaseKicksLeft();
|
||||
|
||||
// General
|
||||
LfgState GetState() const;
|
||||
LfgState GetOldState() const;
|
||||
LfgGuidSet const& GetPlayers() const;
|
||||
uint8 GetPlayerCount() const;
|
||||
ObjectGuid GetLeader() const;
|
||||
[[nodiscard]] LfgState GetState() const;
|
||||
[[nodiscard]] LfgState GetOldState() const;
|
||||
[[nodiscard]] LfgGuidSet const& GetPlayers() const;
|
||||
[[nodiscard]] uint8 GetPlayerCount() const;
|
||||
[[nodiscard]] ObjectGuid GetLeader() const;
|
||||
|
||||
// Dungeon
|
||||
uint32 GetDungeon(bool asId = true) const;
|
||||
[[nodiscard]] uint32 GetDungeon(bool asId = true) const;
|
||||
|
||||
// VoteKick
|
||||
uint8 GetKicksLeft() const;
|
||||
[[nodiscard]] uint8 GetKicksLeft() const;
|
||||
|
||||
private:
|
||||
// General
|
||||
|
||||
@@ -18,6 +18,8 @@
|
||||
#ifndef _LFGMGR_H
|
||||
#define _LFGMGR_H
|
||||
|
||||
#include <utility>
|
||||
|
||||
#include "DBCStructure.h"
|
||||
#include "Field.h"
|
||||
#include "LFG.h"
|
||||
@@ -150,8 +152,8 @@ namespace lfg
|
||||
|
||||
struct RBEntryInfo
|
||||
{
|
||||
RBEntryInfo() {}
|
||||
RBEntryInfo(uint8 _roles, std::string const& _comment) : roles(_roles), comment(_comment) {}
|
||||
RBEntryInfo() = default;
|
||||
RBEntryInfo(uint8 _roles, std::string _comment) : roles(_roles), comment(std::move(_comment)) {}
|
||||
uint8 roles;
|
||||
std::string comment;
|
||||
};
|
||||
@@ -199,21 +201,21 @@ namespace lfg
|
||||
uint32 _hasteRating;
|
||||
uint32 _expertiseRating;
|
||||
|
||||
RBInternalInfo() {}
|
||||
RBInternalInfo(ObjectGuid guid, std::string const& comment, bool isGroupLeader, ObjectGuid groupGuid, uint8 roles, uint32 encounterMask, ObjectGuid instanceGuid,
|
||||
RBInternalInfo() = default;
|
||||
RBInternalInfo(ObjectGuid guid, std::string comment, bool isGroupLeader, ObjectGuid groupGuid, uint8 roles, uint32 encounterMask, ObjectGuid instanceGuid,
|
||||
uint8 _online, uint8 _level, uint8 _class, uint8 _race, float _avgItemLevel,
|
||||
uint8 (&_talents)[3], uint32 _area, uint32 _armor, uint32 _spellDamage, uint32 _spellHeal,
|
||||
uint32 _critRatingMelee, uint32 _critRatingRanged, uint32 _critRatingSpell, float _mp5, float _mp5combat,
|
||||
uint32 _attackPower, uint32 _agility, uint32 _health, uint32 _mana, uint32 _defenseSkill,
|
||||
uint32 _dodgeRating, uint32 _blockRating, uint32 _parryRating, uint32 _hasteRating, uint32 _expertiseRating)
|
||||
: guid(guid), comment(comment), isGroupLeader(isGroupLeader), groupGuid(groupGuid), roles(roles), encounterMask(encounterMask), instanceGuid(instanceGuid),
|
||||
: guid(guid), comment(std::move(comment)), isGroupLeader(isGroupLeader), groupGuid(groupGuid), roles(roles), encounterMask(encounterMask), instanceGuid(instanceGuid),
|
||||
_online(_online), _level(_level), _class(_class), _race(_race), _avgItemLevel(_avgItemLevel),
|
||||
_talents0(_talents[0]), _talents1(_talents[1]), _talents2(_talents[2]), _area(_area), _armor(_armor), _spellDamage(_spellDamage), _spellHeal(_spellHeal),
|
||||
_critRatingMelee(_critRatingMelee), _critRatingRanged(_critRatingRanged), _critRatingSpell(_critRatingSpell), _mp5(_mp5), _mp5combat(_mp5combat),
|
||||
_attackPower(_attackPower), _agility(_agility), _health(_health), _mana(_mana), _defenseSkill(_defenseSkill),
|
||||
_dodgeRating(_dodgeRating), _blockRating(_blockRating), _parryRating(_parryRating), _hasteRating(_hasteRating), _expertiseRating(_expertiseRating)
|
||||
{}
|
||||
bool PlayerSameAs(RBInternalInfo const& i) const
|
||||
[[nodiscard]] bool PlayerSameAs(RBInternalInfo const& i) const
|
||||
{
|
||||
return isGroupLeader == i.isGroupLeader && groupGuid == i.groupGuid && roles == i.roles && (isGroupLeader || (comment == i.comment && encounterMask == i.encounterMask && instanceGuid == i.instanceGuid))
|
||||
&& _online == i._online && _level == i._level && _class == i._class && _race == i._race && std::fabs(_avgItemLevel - i._avgItemLevel) < 0.01f
|
||||
@@ -285,14 +287,14 @@ namespace lfg
|
||||
// Data needed by SMSG_LFG_UPDATE_PARTY and SMSG_LFG_UPDATE_PLAYER
|
||||
struct LfgUpdateData
|
||||
{
|
||||
LfgUpdateData(LfgUpdateType _type = LFG_UPDATETYPE_DEFAULT): updateType(_type), state(LFG_STATE_NONE), comment("") { }
|
||||
LfgUpdateData(LfgUpdateType _type, LfgDungeonSet const& _dungeons, std::string const& _comment):
|
||||
updateType(_type), state(LFG_STATE_NONE), dungeons(_dungeons), comment(_comment) { }
|
||||
LfgUpdateData(LfgUpdateType _type, LfgState _state, LfgDungeonSet const& _dungeons, std::string const& _comment = ""):
|
||||
updateType(_type), state(_state), dungeons(_dungeons), comment(_comment) { }
|
||||
LfgUpdateData(LfgUpdateType _type = LFG_UPDATETYPE_DEFAULT): updateType(_type), comment("") { }
|
||||
LfgUpdateData(LfgUpdateType _type, LfgDungeonSet _dungeons, std::string _comment):
|
||||
updateType(_type), state(LFG_STATE_NONE), dungeons(std::move(_dungeons)), comment(std::move(_comment)) { }
|
||||
LfgUpdateData(LfgUpdateType _type, LfgState _state, LfgDungeonSet _dungeons, std::string _comment = ""):
|
||||
updateType(_type), state(_state), dungeons(std::move(_dungeons)), comment(std::move(_comment)) { }
|
||||
|
||||
LfgUpdateType updateType;
|
||||
LfgState state;
|
||||
LfgState state{LFG_STATE_NONE};
|
||||
LfgDungeonSet dungeons;
|
||||
std::string comment;
|
||||
};
|
||||
@@ -341,26 +343,26 @@ namespace lfg
|
||||
/// Stores player data related to proposal to join
|
||||
struct LfgProposalPlayer
|
||||
{
|
||||
LfgProposalPlayer(): role(0), accept(LFG_ANSWER_PENDING) { }
|
||||
uint8 role; ///< Proposed role
|
||||
LfgAnswer accept; ///< Accept status (-1 not answer | 0 Not agree | 1 agree)
|
||||
LfgProposalPlayer() = default;
|
||||
uint8 role{0}; ///< Proposed role
|
||||
LfgAnswer accept{LFG_ANSWER_PENDING}; ///< Accept status (-1 not answer | 0 Not agree | 1 agree)
|
||||
ObjectGuid group; ///< Original group guid. 0 if no original group
|
||||
};
|
||||
|
||||
/// Stores group data related to proposal to join
|
||||
struct LfgProposal
|
||||
{
|
||||
LfgProposal(uint32 dungeon = 0): id(0), dungeonId(dungeon), state(LFG_PROPOSAL_INITIATING), cancelTime(0), encounters(0), isNew(true)
|
||||
LfgProposal(uint32 dungeon = 0): dungeonId(dungeon)
|
||||
{ }
|
||||
|
||||
uint32 id; ///< Proposal Id
|
||||
uint32 id{0}; ///< Proposal Id
|
||||
uint32 dungeonId; ///< Dungeon to join
|
||||
LfgProposalState state; ///< State of the proposal
|
||||
LfgProposalState state{LFG_PROPOSAL_INITIATING}; ///< State of the proposal
|
||||
ObjectGuid group; ///< Proposal group (0 if new)
|
||||
ObjectGuid leader; ///< Leader guid.
|
||||
time_t cancelTime; ///< Time when we will cancel this proposal
|
||||
uint32 encounters; ///< Dungeon Encounters
|
||||
bool isNew; ///< Determines if it's new group or not
|
||||
time_t cancelTime{0}; ///< Time when we will cancel this proposal
|
||||
uint32 encounters{0}; ///< Dungeon Encounters
|
||||
bool isNew{true}; ///< Determines if it's new group or not
|
||||
Lfg5Guids queues; ///< Queue Ids to remove/readd
|
||||
LfgGuidList showorder; ///< Show order in update window
|
||||
LfgProposalPlayerContainer players; ///< Players data
|
||||
@@ -389,8 +391,7 @@ namespace lfg
|
||||
|
||||
struct LFGDungeonData
|
||||
{
|
||||
LFGDungeonData(): id(0), name(""), map(0), type(0), expansion(0), group(0), minlevel(0),
|
||||
maxlevel(0), difficulty(REGULAR_DIFFICULTY), seasonal(false), x(0.0f), y(0.0f), z(0.0f), o(0.0f)
|
||||
LFGDungeonData(): name("")
|
||||
{ }
|
||||
LFGDungeonData(LFGDungeonEntry const* dbc): id(dbc->ID), name(dbc->name[0]), map(dbc->map),
|
||||
type(dbc->type), expansion(dbc->expansion), group(dbc->grouptype),
|
||||
@@ -398,20 +399,20 @@ namespace lfg
|
||||
seasonal(dbc->flags & LFG_FLAG_SEASONAL), x(0.0f), y(0.0f), z(0.0f), o(0.0f)
|
||||
{ }
|
||||
|
||||
uint32 id;
|
||||
uint32 id{0};
|
||||
std::string name;
|
||||
uint16 map;
|
||||
uint8 type;
|
||||
uint8 expansion;
|
||||
uint8 group;
|
||||
uint8 minlevel;
|
||||
uint8 maxlevel;
|
||||
Difficulty difficulty;
|
||||
bool seasonal;
|
||||
float x, y, z, o;
|
||||
uint16 map{0};
|
||||
uint8 type{0};
|
||||
uint8 expansion{0};
|
||||
uint8 group{0};
|
||||
uint8 minlevel{0};
|
||||
uint8 maxlevel{0};
|
||||
Difficulty difficulty{REGULAR_DIFFICULTY};
|
||||
bool seasonal{false};
|
||||
float x{0.0f}, y{0.0f}, z{0.0f}, o{0.0f};
|
||||
|
||||
// Helpers
|
||||
uint32 Entry() const { return id + (type << 24); }
|
||||
[[nodiscard]] uint32 Entry() const { return id + (type << 24); }
|
||||
};
|
||||
|
||||
class LFGMgr
|
||||
|
||||
@@ -47,19 +47,19 @@ namespace lfg
|
||||
void SetSelectedDungeons(const LfgDungeonSet& dungeons);
|
||||
|
||||
// General
|
||||
LfgState GetState() const;
|
||||
LfgState GetOldState() const;
|
||||
LfgLockMap const& GetLockedDungeons() const;
|
||||
TeamId GetTeam() const;
|
||||
ObjectGuid GetGroup() const;
|
||||
uint8 GetRandomPlayersCount() const;
|
||||
[[nodiscard]] LfgState GetState() const;
|
||||
[[nodiscard]] LfgState GetOldState() const;
|
||||
[[nodiscard]] LfgLockMap const& GetLockedDungeons() const;
|
||||
[[nodiscard]] TeamId GetTeam() const;
|
||||
[[nodiscard]] ObjectGuid GetGroup() const;
|
||||
[[nodiscard]] uint8 GetRandomPlayersCount() const;
|
||||
void SetCanOverrideRBState(bool val) { m_canOverrideRBState = val; }
|
||||
bool CanOverrideRBState() const { return m_canOverrideRBState; }
|
||||
[[nodiscard]] bool CanOverrideRBState() const { return m_canOverrideRBState; }
|
||||
|
||||
// Queue
|
||||
uint8 GetRoles() const;
|
||||
std::string const& GetComment() const;
|
||||
LfgDungeonSet const& GetSelectedDungeons() const;
|
||||
[[nodiscard]] uint8 GetRoles() const;
|
||||
[[nodiscard]] std::string const& GetComment() const;
|
||||
[[nodiscard]] LfgDungeonSet const& GetSelectedDungeons() const;
|
||||
|
||||
private:
|
||||
// General
|
||||
|
||||
@@ -18,6 +18,8 @@
|
||||
#ifndef _LFGQUEUE_H
|
||||
#define _LFGQUEUE_H
|
||||
|
||||
#include <utility>
|
||||
|
||||
#include "LFG.h"
|
||||
|
||||
namespace lfg
|
||||
@@ -39,20 +41,19 @@ namespace lfg
|
||||
/// Stores player or group queue info
|
||||
struct LfgQueueData
|
||||
{
|
||||
LfgQueueData(): joinTime(time_t(time(nullptr))), lastRefreshTime(joinTime), tanks(LFG_TANKS_NEEDED),
|
||||
healers(LFG_HEALERS_NEEDED), dps(LFG_DPS_NEEDED)
|
||||
LfgQueueData(): joinTime(time_t(time(nullptr))), lastRefreshTime(joinTime)
|
||||
{ }
|
||||
|
||||
LfgQueueData(time_t _joinTime, LfgDungeonSet const& _dungeons, LfgRolesMap const& _roles):
|
||||
LfgQueueData(time_t _joinTime, LfgDungeonSet _dungeons, LfgRolesMap _roles):
|
||||
joinTime(_joinTime), lastRefreshTime(_joinTime), tanks(LFG_TANKS_NEEDED), healers(LFG_HEALERS_NEEDED),
|
||||
dps(LFG_DPS_NEEDED), dungeons(_dungeons), roles(_roles)
|
||||
dps(LFG_DPS_NEEDED), dungeons(std::move(_dungeons)), roles(std::move(_roles))
|
||||
{ }
|
||||
|
||||
time_t joinTime; ///< Player queue join time (to calculate wait times)
|
||||
time_t lastRefreshTime; ///< pussywizard
|
||||
uint8 tanks; ///< Tanks needed
|
||||
uint8 healers; ///< Healers needed
|
||||
uint8 dps; ///< Dps needed
|
||||
uint8 tanks{LFG_TANKS_NEEDED}; ///< Tanks needed
|
||||
uint8 healers{LFG_HEALERS_NEEDED}; ///< Healers needed
|
||||
uint8 dps{LFG_DPS_NEEDED}; ///< Dps needed
|
||||
LfgDungeonSet dungeons; ///< Selected Player/Group Dungeon/s
|
||||
LfgRolesMap roles; ///< Selected Player Role/s
|
||||
Lfg5Guids bestCompatible; ///< Best compatible combination of people queued
|
||||
@@ -60,9 +61,9 @@ namespace lfg
|
||||
|
||||
struct LfgWaitTime
|
||||
{
|
||||
LfgWaitTime(): time(-1), number(0) {}
|
||||
int32 time; ///< Wait time
|
||||
uint32 number; ///< Number of people used to get that wait time
|
||||
LfgWaitTime() = default;
|
||||
int32 time{-1}; ///< Wait time
|
||||
uint32 number{0}; ///< Number of people used to get that wait time
|
||||
};
|
||||
|
||||
typedef std::map<uint32, LfgWaitTime> LfgWaitTimesContainer;
|
||||
|
||||
@@ -69,7 +69,7 @@ public:
|
||||
void ResetGhostTime() { m_time = time(nullptr); }
|
||||
[[nodiscard]] CorpseType GetType() const { return m_type; }
|
||||
|
||||
CellCoord const& GetCellCoord() const { return _cellCoord; }
|
||||
[[nodiscard]] CellCoord const& GetCellCoord() const { return _cellCoord; }
|
||||
void SetCellCoord(CellCoord const& cellCoord) { _cellCoord = cellCoord; }
|
||||
|
||||
Loot loot; // remove insignia ONLY at BG
|
||||
|
||||
@@ -258,7 +258,7 @@ public:
|
||||
bool HasSearchedAssistance() { return m_AlreadySearchedAssistance; }
|
||||
bool CanAssistTo(const Unit* u, const Unit* enemy, bool checkfaction = true) const;
|
||||
bool _IsTargetAcceptable(const Unit* target) const;
|
||||
bool CanIgnoreFeignDeath() const { return (GetCreatureTemplate()->flags_extra & CREATURE_FLAG_EXTRA_IGNORE_FEIGN_DEATH) != 0; }
|
||||
[[nodiscard]] bool CanIgnoreFeignDeath() const { return (GetCreatureTemplate()->flags_extra & CREATURE_FLAG_EXTRA_IGNORE_FEIGN_DEATH) != 0; }
|
||||
|
||||
// pussywizard: updated at faction change, disable move in line of sight if actual faction is not hostile to anyone
|
||||
void UpdateMoveInLineOfSightState();
|
||||
@@ -360,7 +360,7 @@ public:
|
||||
void SetTarget(ObjectGuid guid = ObjectGuid::Empty) override;
|
||||
void FocusTarget(Spell const* focusSpell, WorldObject const* target);
|
||||
void ReleaseFocus(Spell const* focusSpell);
|
||||
bool IsMovementPreventedByCasting() const override;
|
||||
[[nodiscard]] bool IsMovementPreventedByCasting() const override;
|
||||
|
||||
// Part of Evade mechanics
|
||||
[[nodiscard]] time_t GetLastDamagedTime() const;
|
||||
@@ -374,7 +374,7 @@ public:
|
||||
uint32 m_moveCircleMovementTime = MOVE_CIRCLE_CHECK_INTERVAL;
|
||||
uint32 m_moveBackwardsMovementTime = MOVE_BACKWARDS_CHECK_INTERVAL;
|
||||
|
||||
bool HasSwimmingFlagOutOfCombat() const
|
||||
[[nodiscard]] bool HasSwimmingFlagOutOfCombat() const
|
||||
{
|
||||
return !_isMissingSwimmingFlagOutOfCombat;
|
||||
}
|
||||
|
||||
@@ -358,8 +358,8 @@ typedef std::unordered_map<uint32, EquipmentInfoContainerInternal> EquipmentInfo
|
||||
// from `creature` table
|
||||
struct CreatureData
|
||||
{
|
||||
CreatureData() { }
|
||||
uint32 id1{0}; // entry in creature_template
|
||||
CreatureData() = default;
|
||||
uint32 id1{0}; // entry in creature_template
|
||||
uint32 id2{0}; // entry in creature_template
|
||||
uint32 id3{0}; // entry in creature_template
|
||||
uint16 mapid{0};
|
||||
@@ -519,7 +519,7 @@ typedef std::unordered_map<uint32 /*spellid*/, TrainerSpell> TrainerSpellMap;
|
||||
|
||||
struct TrainerSpellData
|
||||
{
|
||||
TrainerSpellData() {}
|
||||
TrainerSpellData() = default;
|
||||
~TrainerSpellData() { spellList.clear(); }
|
||||
|
||||
TrainerSpellMap spellList;
|
||||
@@ -530,11 +530,11 @@ struct TrainerSpellData
|
||||
|
||||
struct CreatureSpellCooldown
|
||||
{
|
||||
CreatureSpellCooldown() : category(0), end(0) { }
|
||||
CreatureSpellCooldown() = default;
|
||||
CreatureSpellCooldown(uint16 categoryId, uint32 endTime) : category(categoryId), end(endTime) { }
|
||||
|
||||
uint16 category;
|
||||
uint32 end;
|
||||
uint16 category{0};
|
||||
uint32 end{0};
|
||||
};
|
||||
|
||||
typedef std::map<uint32, CreatureSpellCooldown> CreatureSpellCooldowns;
|
||||
|
||||
@@ -720,7 +720,7 @@ enum GOState
|
||||
// from `gameobject`
|
||||
struct GameObjectData
|
||||
{
|
||||
explicit GameObjectData() { }
|
||||
explicit GameObjectData() = default;
|
||||
uint32 id{0}; // entry in gamobject_template
|
||||
uint16 mapid{0};
|
||||
uint32 phaseMask{0};
|
||||
|
||||
@@ -101,7 +101,7 @@ public:
|
||||
[[nodiscard]] uint32 GetEntry() const { return GetUInt32Value(OBJECT_FIELD_ENTRY); }
|
||||
void SetEntry(uint32 entry) { SetUInt32Value(OBJECT_FIELD_ENTRY, entry); }
|
||||
|
||||
float GetObjectScale() const { return GetFloatValue(OBJECT_FIELD_SCALE_X); }
|
||||
[[nodiscard]] float GetObjectScale() const { return GetFloatValue(OBJECT_FIELD_SCALE_X); }
|
||||
virtual void SetObjectScale(float scale) { SetFloatValue(OBJECT_FIELD_SCALE_X, scale); }
|
||||
|
||||
[[nodiscard]] TypeID GetTypeId() const { return m_objectTypeId; }
|
||||
@@ -375,26 +375,26 @@ struct Position
|
||||
return dx*dx + dy*dy;
|
||||
}
|
||||
|
||||
float GetExactDist2dSq(Position const& pos) const { return GetExactDist2dSq(pos.m_positionX, pos.m_positionY); }
|
||||
[[nodiscard]] float GetExactDist2dSq(Position const& pos) const { return GetExactDist2dSq(pos.m_positionX, pos.m_positionY); }
|
||||
float GetExactDist2dSq(Position const* pos) const { return GetExactDist2dSq(*pos); }
|
||||
float GetExactDist2d(const float x, const float y) const { return std::sqrt(GetExactDist2dSq(x, y)); }
|
||||
float GetExactDist2d(Position const& pos) const { return GetExactDist2d(pos.m_positionX, pos.m_positionY); }
|
||||
[[nodiscard]] float GetExactDist2d(const float x, const float y) const { return std::sqrt(GetExactDist2dSq(x, y)); }
|
||||
[[nodiscard]] float GetExactDist2d(Position const& pos) const { return GetExactDist2d(pos.m_positionX, pos.m_positionY); }
|
||||
float GetExactDist2d(Position const* pos) const { return GetExactDist2d(*pos); }
|
||||
|
||||
float GetExactDistSq(float x, float y, float z) const
|
||||
[[nodiscard]] float GetExactDistSq(float x, float y, float z) const
|
||||
{
|
||||
float dz = z - m_positionZ;
|
||||
return GetExactDist2dSq(x, y) + dz*dz;
|
||||
}
|
||||
|
||||
float GetExactDistSq(Position const& pos) const { return GetExactDistSq(pos.m_positionX, pos.m_positionY, pos.m_positionZ); }
|
||||
[[nodiscard]] float GetExactDistSq(Position const& pos) const { return GetExactDistSq(pos.m_positionX, pos.m_positionY, pos.m_positionZ); }
|
||||
float GetExactDistSq(Position const* pos) const { return GetExactDistSq(*pos); }
|
||||
float GetExactDist(float x, float y, float z) const { return std::sqrt(GetExactDistSq(x, y, z)); }
|
||||
float GetExactDist(Position const& pos) const { return GetExactDist(pos.m_positionX, pos.m_positionY, pos.m_positionZ); }
|
||||
[[nodiscard]] float GetExactDist(float x, float y, float z) const { return std::sqrt(GetExactDistSq(x, y, z)); }
|
||||
[[nodiscard]] float GetExactDist(Position const& pos) const { return GetExactDist(pos.m_positionX, pos.m_positionY, pos.m_positionZ); }
|
||||
float GetExactDist(Position const* pos) const { return GetExactDist(*pos); }
|
||||
|
||||
void GetPositionOffsetTo(const Position& endPos, Position& retOffset) const;
|
||||
Position GetPositionWithOffset(Position const& offset) const;
|
||||
[[nodiscard]] Position GetPositionWithOffset(Position const& offset) const;
|
||||
|
||||
float GetAngle(const Position* pos) const;
|
||||
[[nodiscard]] float GetAngle(float x, float y) const;
|
||||
@@ -413,7 +413,7 @@ struct Position
|
||||
return GetAngle(pos) - m_orientation;
|
||||
}
|
||||
[[nodiscard]] float GetRelativeAngle(float x, float y) const { return GetAngle(x, y) - m_orientation; }
|
||||
float ToAbsoluteAngle(float relAngle) const { return NormalizeOrientation(relAngle + m_orientation); }
|
||||
[[nodiscard]] float ToAbsoluteAngle(float relAngle) const { return NormalizeOrientation(relAngle + m_orientation); }
|
||||
|
||||
void GetSinCos(float x, float y, float& vsin, float& vcos) const;
|
||||
|
||||
@@ -655,7 +655,7 @@ class MovableMapObject
|
||||
template<class T> friend class RandomMovementGenerator;
|
||||
|
||||
protected:
|
||||
MovableMapObject() {}
|
||||
MovableMapObject() = default;
|
||||
|
||||
private:
|
||||
[[nodiscard]] Cell const& GetCurrentCell() const { return _currentCell; }
|
||||
@@ -702,7 +702,7 @@ public:
|
||||
void UpdateAllowedPositionZ(float x, float y, float& z, float* groundZ = nullptr) const;
|
||||
|
||||
void GetRandomPoint(const Position& srcPos, float distance, float& rand_x, float& rand_y, float& rand_z) const;
|
||||
Position GetRandomPoint(const Position& srcPos, float distance) const;
|
||||
[[nodiscard]] Position GetRandomPoint(const Position& srcPos, float distance) const;
|
||||
|
||||
[[nodiscard]] uint32 GetInstanceId() const { return m_InstanceId; }
|
||||
|
||||
@@ -715,9 +715,9 @@ public:
|
||||
[[nodiscard]] uint32 GetAreaId() const;
|
||||
void GetZoneAndAreaId(uint32& zoneid, uint32& areaid) const;
|
||||
[[nodiscard]] bool IsOutdoors() const;
|
||||
LiquidData const& GetLiquidData() const;
|
||||
[[nodiscard]] LiquidData const& GetLiquidData() const;
|
||||
|
||||
InstanceScript* GetInstanceScript() const;
|
||||
[[nodiscard]] InstanceScript* GetInstanceScript() const;
|
||||
|
||||
[[nodiscard]] std::string const& GetName() const { return m_name; }
|
||||
void SetName(std::string const& newname) { m_name = newname; }
|
||||
|
||||
@@ -129,7 +129,7 @@ class ObjectGuid
|
||||
template<HighGuid type>
|
||||
static typename std::enable_if<ObjectGuidTraits<type>::MapSpecific, ObjectGuid>::type Create(uint32 entry, LowType counter) { return MapSpecific(type, entry, counter); }
|
||||
|
||||
ObjectGuid() : _guid(0) { }
|
||||
ObjectGuid() = default;
|
||||
explicit ObjectGuid(uint64 guid) : _guid(guid) { }
|
||||
ObjectGuid(HighGuid hi, uint32 entry, LowType counter) : _guid(counter ? uint64(counter) | (uint64(entry) << 24) | (uint64(hi) << 48) : 0) { }
|
||||
ObjectGuid(HighGuid hi, LowType counter) : _guid(counter ? uint64(counter) | (uint64(hi) << 48) : 0) { }
|
||||
@@ -139,12 +139,12 @@ class ObjectGuid
|
||||
void Set(uint64 guid) { _guid = guid; }
|
||||
void Clear() { _guid = 0; }
|
||||
|
||||
PackedGuid WriteAsPacked() const;
|
||||
[[nodiscard]] PackedGuid WriteAsPacked() const;
|
||||
|
||||
uint64 GetRawValue() const { return _guid; }
|
||||
HighGuid GetHigh() const { return HighGuid((_guid >> 48) & 0x0000FFFF); }
|
||||
uint32 GetEntry() const { return HasEntry() ? uint32((_guid >> 24) & UI64LIT(0x0000000000FFFFFF)) : 0; }
|
||||
LowType GetCounter() const
|
||||
[[nodiscard]] uint64 GetRawValue() const { return _guid; }
|
||||
[[nodiscard]] HighGuid GetHigh() const { return HighGuid((_guid >> 48) & 0x0000FFFF); }
|
||||
[[nodiscard]] uint32 GetEntry() const { return HasEntry() ? uint32((_guid >> 24) & UI64LIT(0x0000000000FFFFFF)) : 0; }
|
||||
[[nodiscard]] LowType GetCounter() const
|
||||
{
|
||||
return HasEntry()
|
||||
? LowType(_guid & UI64LIT(0x0000000000FFFFFF))
|
||||
@@ -158,26 +158,26 @@ class ObjectGuid
|
||||
: LowType(0xFFFFFFFF);
|
||||
}
|
||||
|
||||
ObjectGuid::LowType GetMaxCounter() const { return GetMaxCounter(GetHigh()); }
|
||||
[[nodiscard]] ObjectGuid::LowType GetMaxCounter() const { return GetMaxCounter(GetHigh()); }
|
||||
|
||||
bool IsEmpty() const { return _guid == 0; }
|
||||
bool IsCreature() const { return GetHigh() == HighGuid::Unit; }
|
||||
bool IsPet() const { return GetHigh() == HighGuid::Pet; }
|
||||
bool IsVehicle() const { return GetHigh() == HighGuid::Vehicle; }
|
||||
bool IsCreatureOrPet() const { return IsCreature() || IsPet(); }
|
||||
bool IsCreatureOrVehicle() const { return IsCreature() || IsVehicle(); }
|
||||
bool IsAnyTypeCreature() const { return IsCreature() || IsPet() || IsVehicle(); }
|
||||
bool IsPlayer() const { return !IsEmpty() && GetHigh() == HighGuid::Player; }
|
||||
bool IsUnit() const { return IsAnyTypeCreature() || IsPlayer(); }
|
||||
bool IsItem() const { return GetHigh() == HighGuid::Item; }
|
||||
bool IsGameObject() const { return GetHigh() == HighGuid::GameObject; }
|
||||
bool IsDynamicObject() const { return GetHigh() == HighGuid::DynamicObject; }
|
||||
bool IsCorpse() const { return GetHigh() == HighGuid::Corpse; }
|
||||
bool IsTransport() const { return GetHigh() == HighGuid::Transport; }
|
||||
bool IsMOTransport() const { return GetHigh() == HighGuid::Mo_Transport; }
|
||||
bool IsAnyTypeGameObject() const { return IsGameObject() || IsTransport() || IsMOTransport(); }
|
||||
bool IsInstance() const { return GetHigh() == HighGuid::Instance; }
|
||||
bool IsGroup() const { return GetHigh() == HighGuid::Group; }
|
||||
[[nodiscard]] bool IsEmpty() const { return _guid == 0; }
|
||||
[[nodiscard]] bool IsCreature() const { return GetHigh() == HighGuid::Unit; }
|
||||
[[nodiscard]] bool IsPet() const { return GetHigh() == HighGuid::Pet; }
|
||||
[[nodiscard]] bool IsVehicle() const { return GetHigh() == HighGuid::Vehicle; }
|
||||
[[nodiscard]] bool IsCreatureOrPet() const { return IsCreature() || IsPet(); }
|
||||
[[nodiscard]] bool IsCreatureOrVehicle() const { return IsCreature() || IsVehicle(); }
|
||||
[[nodiscard]] bool IsAnyTypeCreature() const { return IsCreature() || IsPet() || IsVehicle(); }
|
||||
[[nodiscard]] bool IsPlayer() const { return !IsEmpty() && GetHigh() == HighGuid::Player; }
|
||||
[[nodiscard]] bool IsUnit() const { return IsAnyTypeCreature() || IsPlayer(); }
|
||||
[[nodiscard]] bool IsItem() const { return GetHigh() == HighGuid::Item; }
|
||||
[[nodiscard]] bool IsGameObject() const { return GetHigh() == HighGuid::GameObject; }
|
||||
[[nodiscard]] bool IsDynamicObject() const { return GetHigh() == HighGuid::DynamicObject; }
|
||||
[[nodiscard]] bool IsCorpse() const { return GetHigh() == HighGuid::Corpse; }
|
||||
[[nodiscard]] bool IsTransport() const { return GetHigh() == HighGuid::Transport; }
|
||||
[[nodiscard]] bool IsMOTransport() const { return GetHigh() == HighGuid::Mo_Transport; }
|
||||
[[nodiscard]] bool IsAnyTypeGameObject() const { return IsGameObject() || IsTransport() || IsMOTransport(); }
|
||||
[[nodiscard]] bool IsInstance() const { return GetHigh() == HighGuid::Instance; }
|
||||
[[nodiscard]] bool IsGroup() const { return GetHigh() == HighGuid::Group; }
|
||||
|
||||
static TypeID GetTypeId(HighGuid high)
|
||||
{
|
||||
@@ -200,7 +200,7 @@ class ObjectGuid
|
||||
}
|
||||
}
|
||||
|
||||
TypeID GetTypeId() const { return GetTypeId(GetHigh()); }
|
||||
[[nodiscard]] TypeID GetTypeId() const { return GetTypeId(GetHigh()); }
|
||||
|
||||
operator bool() const { return !IsEmpty(); }
|
||||
bool operator!() const { return !(bool(*this)); }
|
||||
@@ -210,8 +210,8 @@ class ObjectGuid
|
||||
bool operator<= (ObjectGuid const& guid) const { return GetRawValue() <= guid.GetRawValue(); }
|
||||
|
||||
static char const* GetTypeName(HighGuid high);
|
||||
char const* GetTypeName() const { return !IsEmpty() ? GetTypeName(GetHigh()) : "None"; }
|
||||
std::string ToString() const;
|
||||
[[nodiscard]] char const* GetTypeName() const { return !IsEmpty() ? GetTypeName(GetHigh()) : "None"; }
|
||||
[[nodiscard]] std::string ToString() const;
|
||||
|
||||
private:
|
||||
static bool HasEntry(HighGuid high)
|
||||
@@ -236,7 +236,7 @@ class ObjectGuid
|
||||
}
|
||||
}
|
||||
|
||||
bool HasEntry() const { return HasEntry(GetHigh()); }
|
||||
[[nodiscard]] bool HasEntry() const { return HasEntry(GetHigh()); }
|
||||
|
||||
static ObjectGuid Global(HighGuid type, LowType counter);
|
||||
static ObjectGuid MapSpecific(HighGuid type, uint32 entry, LowType counter);
|
||||
@@ -248,7 +248,7 @@ class ObjectGuid
|
||||
// used to catch wrong type assignment
|
||||
operator int64() const = delete;
|
||||
|
||||
uint64 _guid;
|
||||
uint64 _guid{0};
|
||||
};
|
||||
|
||||
// Some Shared defines
|
||||
@@ -273,7 +273,7 @@ class PackedGuid
|
||||
void Set(uint64 guid) { _packedGuid.wpos(0); _packedGuid.appendPackGUID(guid); }
|
||||
void Set(ObjectGuid guid) { _packedGuid.wpos(0); _packedGuid.appendPackGUID(guid.GetRawValue()); }
|
||||
|
||||
std::size_t size() const { return _packedGuid.size(); }
|
||||
[[nodiscard]] std::size_t size() const { return _packedGuid.size(); }
|
||||
|
||||
private:
|
||||
ByteBuffer _packedGuid;
|
||||
@@ -286,8 +286,8 @@ public:
|
||||
|
||||
virtual void Set(ObjectGuid::LowType val) { _nextGuid = val; }
|
||||
virtual ObjectGuid::LowType Generate() = 0;
|
||||
ObjectGuid::LowType GetNextAfterMaxUsed() const { return _nextGuid; }
|
||||
virtual ~ObjectGuidGeneratorBase() { }
|
||||
[[nodiscard]] ObjectGuid::LowType GetNextAfterMaxUsed() const { return _nextGuid; }
|
||||
virtual ~ObjectGuidGeneratorBase() = default;
|
||||
|
||||
protected:
|
||||
static void HandleCounterOverflow(HighGuid high);
|
||||
|
||||
@@ -33,9 +33,9 @@ public:
|
||||
CLIENT_UPDATE_MASK_BITS = sizeof(ClientUpdateMaskType) * 8,
|
||||
};
|
||||
|
||||
UpdateMask() { }
|
||||
UpdateMask() = default;
|
||||
|
||||
UpdateMask(UpdateMask const& right) : _bits(nullptr)
|
||||
UpdateMask(UpdateMask const& right)
|
||||
{
|
||||
SetCount(right.GetCount());
|
||||
memcpy(_bits, right._bits, sizeof(uint8) * _blockCount * 32);
|
||||
|
||||
@@ -221,7 +221,7 @@ public:
|
||||
uint32 MaxStabledPets = 0;
|
||||
std::vector<PetInfo> UnslottedPets; // PET_SAVE_NOT_IN_SLOT
|
||||
|
||||
PetInfo const* GetUnslottedHunterPet() const
|
||||
[[nodiscard]] PetInfo const* GetUnslottedHunterPet() const
|
||||
{
|
||||
return UnslottedPets.size() == 1 && UnslottedPets[0].Type == HUNTER_PET ? &UnslottedPets[0] : nullptr;
|
||||
}
|
||||
|
||||
@@ -248,7 +248,7 @@ enum ReputationSource
|
||||
|
||||
struct ActionButton
|
||||
{
|
||||
ActionButton() {}
|
||||
ActionButton() = default;
|
||||
|
||||
uint32 packedData{0};
|
||||
ActionButtonUpdateState uState{ACTIONBUTTON_NEW};
|
||||
@@ -284,14 +284,14 @@ typedef std::list<PlayerCreateInfoItem> PlayerCreateInfoItems;
|
||||
|
||||
struct PlayerClassLevelInfo
|
||||
{
|
||||
PlayerClassLevelInfo() {}
|
||||
PlayerClassLevelInfo() = default;
|
||||
uint16 basehealth{0};
|
||||
uint16 basemana{0};
|
||||
};
|
||||
|
||||
struct PlayerClassInfo
|
||||
{
|
||||
PlayerClassInfo() { }
|
||||
PlayerClassInfo() = default;
|
||||
|
||||
PlayerClassLevelInfo* levelInfo{nullptr}; //[level-1] 0..MaxPlayerLevel-1
|
||||
};
|
||||
@@ -307,7 +307,7 @@ typedef std::list<uint32> PlayerCreateInfoSpells;
|
||||
|
||||
struct PlayerCreateInfoAction
|
||||
{
|
||||
PlayerCreateInfoAction() {}
|
||||
PlayerCreateInfoAction() = default;
|
||||
PlayerCreateInfoAction(uint8 _button, uint32 _action, uint8 _type) : button(_button), type(_type), action(_action) {}
|
||||
|
||||
uint8 button{0};
|
||||
@@ -328,7 +328,7 @@ typedef std::list<PlayerCreateInfoSkill> PlayerCreateInfoSkills;
|
||||
struct PlayerInfo
|
||||
{
|
||||
// existence checked by displayId != 0
|
||||
PlayerInfo() { }
|
||||
PlayerInfo() = default;
|
||||
|
||||
uint32 mapId{0};
|
||||
uint32 areaId{0};
|
||||
@@ -349,7 +349,7 @@ struct PlayerInfo
|
||||
|
||||
struct PvPInfo
|
||||
{
|
||||
PvPInfo() {}
|
||||
PvPInfo() = default;
|
||||
|
||||
bool IsHostile{false};
|
||||
bool IsInHostileArea{false}; ///> Marks if player is in an area which forces PvP flag
|
||||
@@ -433,7 +433,7 @@ struct Runes
|
||||
|
||||
struct EnchantDuration
|
||||
{
|
||||
EnchantDuration() {};
|
||||
EnchantDuration() = default;;
|
||||
EnchantDuration(Item* _item, EnchantmentSlot _slot, uint32 _leftduration) : item(_item), slot(_slot),
|
||||
leftduration(_leftduration) { ASSERT(item); };
|
||||
|
||||
@@ -739,7 +739,7 @@ enum EquipmentSetUpdateState
|
||||
|
||||
struct EquipmentSet
|
||||
{
|
||||
EquipmentSet() { }
|
||||
EquipmentSet() = default;
|
||||
|
||||
uint64 Guid;
|
||||
std::string Name;
|
||||
@@ -1003,7 +1003,7 @@ class Player;
|
||||
// holder for Battleground data (pussywizard: not stored in db)
|
||||
struct BGData
|
||||
{
|
||||
BGData() {}
|
||||
BGData() = default;
|
||||
|
||||
uint32 bgInstanceID{0};
|
||||
BattlegroundTypeId bgTypeID{BATTLEGROUND_TYPE_NONE};
|
||||
@@ -1161,14 +1161,14 @@ public:
|
||||
[[nodiscard]] float GetRestBonus() const { return _restBonus; }
|
||||
void SetRestBonus(float rest_bonus_new);
|
||||
|
||||
bool HasRestFlag(RestFlag restFlag) const { return (_restFlagMask & restFlag) != 0; }
|
||||
[[nodiscard]] bool HasRestFlag(RestFlag restFlag) const { return (_restFlagMask & restFlag) != 0; }
|
||||
void SetRestFlag(RestFlag restFlag, uint32 triggerId = 0);
|
||||
void RemoveRestFlag(RestFlag restFlag);
|
||||
[[nodiscard]] uint32 GetInnTriggerId() const { return _innTriggerId; }
|
||||
|
||||
PetStable* GetPetStable() { return m_petStable.get(); }
|
||||
PetStable& GetOrInitPetStable();
|
||||
PetStable const* GetPetStable() const { return m_petStable.get(); }
|
||||
[[nodiscard]] PetStable const* GetPetStable() const { return m_petStable.get(); }
|
||||
|
||||
[[nodiscard]] Pet* GetPet() const;
|
||||
Pet* SummonPet(uint32 entry, float x, float y, float z, float ang, PetType petType, Milliseconds duration = 0s);
|
||||
@@ -1598,7 +1598,7 @@ public:
|
||||
uint32 GetMailSize() { return m_mail.size();}
|
||||
Mail* GetMail(uint32 id);
|
||||
|
||||
PlayerMails const& GetMails() const { return m_mail; }
|
||||
[[nodiscard]] PlayerMails const& GetMails() const { return m_mail; }
|
||||
void SendItemRetrievalMail(uint32 itemEntry, uint32 count); // Item retrieval mails sent by The Postmaster (34337)
|
||||
void SendItemRetrievalMail(std::vector<std::pair<uint32, uint32>> mailItems); // Item retrieval mails sent by The Postmaster (34337)
|
||||
|
||||
@@ -1861,7 +1861,7 @@ public:
|
||||
SetArenaTeamInfoField(slot, ARENA_TEAM_TYPE, type);
|
||||
}
|
||||
void SetArenaTeamInfoField(uint8 slot, ArenaTeamInfoType type, uint32 value);
|
||||
uint32 GetArenaPersonalRating(uint8 slot) const;
|
||||
[[nodiscard]] uint32 GetArenaPersonalRating(uint8 slot) const;
|
||||
static uint32 GetArenaTeamIdFromDB(ObjectGuid guid, uint8 slot);
|
||||
static void LeaveAllArenaTeams(ObjectGuid guid);
|
||||
[[nodiscard]] uint32 GetArenaTeamId(uint8 slot) const;
|
||||
@@ -1987,8 +1987,8 @@ public:
|
||||
void RemoveCorpse();
|
||||
void KillPlayer();
|
||||
static void OfflineResurrect(ObjectGuid const guid, CharacterDatabaseTransaction trans);
|
||||
bool HasCorpse() const { return _corpseLocation.GetMapId() != MAPID_INVALID; }
|
||||
WorldLocation GetCorpseLocation() const { return _corpseLocation; }
|
||||
[[nodiscard]] bool HasCorpse() const { return _corpseLocation.GetMapId() != MAPID_INVALID; }
|
||||
[[nodiscard]] WorldLocation GetCorpseLocation() const { return _corpseLocation; }
|
||||
uint32 GetResurrectionSpellId();
|
||||
void ResurrectPlayer(float restore_percent, bool applySickness = false);
|
||||
void BuildPlayerRepop();
|
||||
@@ -2394,7 +2394,7 @@ public:
|
||||
void SendCinematicStart(uint32 CinematicSequenceId);
|
||||
void SendMovieStart(uint32 MovieId);
|
||||
|
||||
uint16 GetMaxSkillValueForLevel() const;
|
||||
[[nodiscard]] uint16 GetMaxSkillValueForLevel() const;
|
||||
bool IsFFAPvP();
|
||||
bool IsPvP();
|
||||
|
||||
@@ -2591,7 +2591,7 @@ public:
|
||||
|
||||
void SetFarSightDistance(float radius);
|
||||
void ResetFarSightDistance();
|
||||
Optional<float> GetFarSightDistance() const;
|
||||
[[nodiscard]] Optional<float> GetFarSightDistance() const;
|
||||
|
||||
float GetSightRange(const WorldObject* target = nullptr) const override;
|
||||
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
#include "SpellDefines.h"
|
||||
#include "ThreatMgr.h"
|
||||
#include <functional>
|
||||
#include <utility>
|
||||
|
||||
#define WORLD_TRIGGER 12999
|
||||
|
||||
@@ -909,7 +910,7 @@ uint32 createProcExtendMask(SpellNonMeleeDamage* damageInfo, SpellMissInfo missC
|
||||
|
||||
struct RedirectThreatInfo
|
||||
{
|
||||
RedirectThreatInfo() { }
|
||||
RedirectThreatInfo() = default;
|
||||
ObjectGuid _targetGUID;
|
||||
uint32 _threatPct{0};
|
||||
|
||||
@@ -1138,7 +1139,7 @@ private:
|
||||
};
|
||||
|
||||
struct AttackPosition {
|
||||
AttackPosition(Position pos) : _pos(pos), _taken(false) {}
|
||||
AttackPosition(Position pos) : _pos(std::move(pos)), _taken(false) {}
|
||||
bool operator==(const int val)
|
||||
{
|
||||
return !val;
|
||||
@@ -1982,7 +1983,7 @@ public:
|
||||
[[nodiscard]] Spell* FindCurrentSpellBySpellId(uint32 spell_id) const;
|
||||
[[nodiscard]] int32 GetCurrentSpellCastTime(uint32 spell_id) const;
|
||||
|
||||
virtual bool IsMovementPreventedByCasting() const;
|
||||
[[nodiscard]] virtual bool IsMovementPreventedByCasting() const;
|
||||
|
||||
ObjectGuid m_SummonSlot[MAX_SUMMON_SLOT];
|
||||
ObjectGuid m_ObjectSlot[MAX_GAMEOBJECT_SLOT];
|
||||
@@ -2506,7 +2507,7 @@ private:
|
||||
|
||||
uint32 _oldFactionId; ///< faction before charm
|
||||
|
||||
float processDummyAuras(float TakenTotalMod) const;
|
||||
[[nodiscard]] float processDummyAuras(float TakenTotalMod) const;
|
||||
};
|
||||
|
||||
namespace Acore
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
#include "ObjectGuid.h"
|
||||
#include "SharedDefines.h"
|
||||
#include <map>
|
||||
#include <unordered_map>
|
||||
|
||||
#define max_ge_check_delay DAY // 1 day in seconds
|
||||
|
||||
@@ -54,7 +55,7 @@ typedef std::map<uint32 /*condition id*/, GameEventFinishCondition> GameEventCon
|
||||
|
||||
struct GameEventData
|
||||
{
|
||||
GameEventData() { }
|
||||
GameEventData() = default;
|
||||
uint32 eventId;
|
||||
time_t start{1}; // occurs after this time
|
||||
time_t end{0}; // occurs before this time
|
||||
|
||||
@@ -44,7 +44,7 @@ template <class T>
|
||||
class HashMapHolder
|
||||
{
|
||||
//Non instanceable only static
|
||||
HashMapHolder() { }
|
||||
HashMapHolder() = default;
|
||||
|
||||
public:
|
||||
|
||||
|
||||
@@ -531,7 +531,7 @@ struct PetLevelInfo
|
||||
|
||||
struct MailLevelReward
|
||||
{
|
||||
MailLevelReward() {}
|
||||
MailLevelReward() = default;
|
||||
MailLevelReward(uint32 _raceMask, uint32 _mailTemplateId, uint32 _senderEntry) : raceMask(_raceMask), mailTemplateId(_mailTemplateId), senderEntry(_senderEntry) {}
|
||||
|
||||
uint32 raceMask{0};
|
||||
@@ -622,7 +622,7 @@ struct QuestPOIPoint
|
||||
int32 x{0};
|
||||
int32 y{0};
|
||||
|
||||
QuestPOIPoint() {}
|
||||
QuestPOIPoint() = default;
|
||||
QuestPOIPoint(int32 _x, int32 _y) : x(_x), y(_y) {}
|
||||
};
|
||||
|
||||
@@ -637,7 +637,7 @@ struct QuestPOI
|
||||
uint32 Unk4{0};
|
||||
std::vector<QuestPOIPoint> points;
|
||||
|
||||
QuestPOI() {}
|
||||
QuestPOI() = default;
|
||||
QuestPOI(uint32 id, int32 objIndex, uint32 mapId, uint32 areaId, uint32 floorId, uint32 unk3, uint32 unk4) : Id(id), ObjectiveIndex(objIndex), MapId(mapId), AreaId(areaId), FloorId(floorId), Unk3(unk3), Unk4(unk4) {}
|
||||
};
|
||||
|
||||
@@ -1153,7 +1153,7 @@ public:
|
||||
return &itr->second;
|
||||
return nullptr;
|
||||
}
|
||||
CreatureDataContainer const& GetAllCreatureData() const { return _creatureDataStore; }
|
||||
[[nodiscard]] CreatureDataContainer const& GetAllCreatureData() const { return _creatureDataStore; }
|
||||
[[nodiscard]] CreatureData const* GetCreatureData(ObjectGuid::LowType spawnId) const
|
||||
{
|
||||
CreatureDataContainer::const_iterator itr = _creatureDataStore.find(spawnId);
|
||||
@@ -1170,7 +1170,7 @@ public:
|
||||
return itr->second;
|
||||
}
|
||||
|
||||
GameObjectDataContainer const& GetAllGOData() const { return _gameObjectDataStore; }
|
||||
[[nodiscard]] GameObjectDataContainer const& GetAllGOData() const { return _gameObjectDataStore; }
|
||||
[[nodiscard]] GameObjectData const* GetGOData(ObjectGuid::LowType spawnId) const
|
||||
{
|
||||
GameObjectDataContainer::const_iterator itr = _gameObjectDataStore.find(spawnId);
|
||||
|
||||
@@ -108,7 +108,7 @@ class InstanceSaveMgr
|
||||
friend class InstanceSave;
|
||||
|
||||
private:
|
||||
InstanceSaveMgr() {};
|
||||
InstanceSaveMgr() = default;;
|
||||
~InstanceSaveMgr();
|
||||
|
||||
public:
|
||||
|
||||
@@ -188,7 +188,7 @@ struct QuestItem
|
||||
bool is_looted{false};
|
||||
|
||||
QuestItem()
|
||||
{}
|
||||
= default;
|
||||
|
||||
QuestItem(uint8 _index, bool _islooted = false)
|
||||
: index(_index), is_looted(_islooted) {}
|
||||
@@ -380,7 +380,7 @@ struct Loot
|
||||
|
||||
LootItem* LootItemInSlot(uint32 lootslot, Player* player, QuestItem** qitem = nullptr, QuestItem** ffaitem = nullptr, QuestItem** conditem = nullptr);
|
||||
uint32 GetMaxSlotInLootFor(Player* player) const;
|
||||
bool hasItemForAll() const;
|
||||
[[nodiscard]] bool hasItemForAll() const;
|
||||
bool hasItemFor(Player* player) const;
|
||||
[[nodiscard]] bool hasOverThresholdItem() const;
|
||||
void FillNotNormalLootFor(Player* player);
|
||||
|
||||
@@ -162,21 +162,21 @@ enum LiquidStatus
|
||||
|
||||
struct LiquidData
|
||||
{
|
||||
LiquidData() : Entry(0), Flags(0), Level(INVALID_HEIGHT), DepthLevel(INVALID_HEIGHT), Status(LIQUID_MAP_NO_WATER) { }
|
||||
LiquidData() = default;
|
||||
|
||||
uint32 Entry;
|
||||
uint32 Flags;
|
||||
float Level;
|
||||
float DepthLevel;
|
||||
LiquidStatus Status;
|
||||
uint32 Entry{0};
|
||||
uint32 Flags{0};
|
||||
float Level{INVALID_HEIGHT};
|
||||
float DepthLevel{INVALID_HEIGHT};
|
||||
LiquidStatus Status{LIQUID_MAP_NO_WATER};
|
||||
};
|
||||
|
||||
struct PositionFullTerrainStatus
|
||||
{
|
||||
PositionFullTerrainStatus() : areaId(0), floorZ(INVALID_HEIGHT), outdoors(false) { }
|
||||
uint32 areaId;
|
||||
float floorZ;
|
||||
bool outdoors;
|
||||
PositionFullTerrainStatus() = default;
|
||||
uint32 areaId{0};
|
||||
float floorZ{INVALID_HEIGHT};
|
||||
bool outdoors{false};
|
||||
LiquidData liquidInfo;
|
||||
};
|
||||
|
||||
@@ -229,7 +229,7 @@ class GridMap
|
||||
bool loadHeightData(FILE* in, uint32 offset, uint32 size);
|
||||
bool loadLiquidData(FILE* in, uint32 offset, uint32 size);
|
||||
bool loadHolesData(FILE* in, uint32 offset, uint32 size);
|
||||
bool isHole(int row, int col) const;
|
||||
[[nodiscard]] bool isHole(int row, int col) const;
|
||||
|
||||
// Get height functions and pointers
|
||||
typedef float (GridMap::*GetHeightPtr) (float x, float y) const;
|
||||
@@ -249,7 +249,7 @@ public:
|
||||
[[nodiscard]] inline float getHeight(float x, float y) const {return (this->*_gridGetHeight)(x, y);}
|
||||
[[nodiscard]] float getMinHeight(float x, float y) const;
|
||||
[[nodiscard]] float getLiquidLevel(float x, float y) const;
|
||||
LiquidData const GetLiquidData(float x, float y, float z, float collisionHeight, uint8 ReqLiquidType) const;
|
||||
[[nodiscard]] LiquidData const GetLiquidData(float x, float y, float z, float collisionHeight, uint8 ReqLiquidType) const;
|
||||
};
|
||||
|
||||
// GCC have alternative #pragma pack(N) syntax and old gcc version not support pack(push, N), also any gcc version not support it at some platform
|
||||
@@ -394,7 +394,7 @@ public:
|
||||
void GetZoneAndAreaId(uint32 phaseMask, uint32& zoneid, uint32& areaid, float x, float y, float z) const;
|
||||
|
||||
[[nodiscard]] float GetWaterLevel(float x, float y) const;
|
||||
bool IsInWater(uint32 phaseMask, float x, float y, float z, float collisionHeight) const;
|
||||
[[nodiscard]] bool IsInWater(uint32 phaseMask, float x, float y, float z, float collisionHeight) const;
|
||||
[[nodiscard]] bool IsUnderWater(uint32 phaseMask, float x, float y, float z, float collisionHeight) const;
|
||||
[[nodiscard]] bool HasEnoughWater(WorldObject const* searcher, float x, float y, float z) const;
|
||||
[[nodiscard]] bool HasEnoughWater(WorldObject const* searcher, LiquidData const& liquidData) const;
|
||||
@@ -509,7 +509,7 @@ public:
|
||||
typedef std::unordered_multimap<ObjectGuid::LowType, GameObject*> GameObjectBySpawnIdContainer;
|
||||
GameObjectBySpawnIdContainer& GetGameObjectBySpawnIdStore() { return _gameobjectBySpawnIdStore; }
|
||||
|
||||
std::unordered_set<Corpse*> const* GetCorpsesInCell(uint32 cellId) const
|
||||
[[nodiscard]] std::unordered_set<Corpse*> const* GetCorpsesInCell(uint32 cellId) const
|
||||
{
|
||||
auto itr = _corpsesByCell.find(cellId);
|
||||
if (itr != _corpsesByCell.end())
|
||||
@@ -518,7 +518,7 @@ public:
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Corpse* GetCorpseByPlayer(ObjectGuid const& ownerGuid) const
|
||||
[[nodiscard]] Corpse* GetCorpseByPlayer(ObjectGuid const& ownerGuid) const
|
||||
{
|
||||
auto itr = _corpsesByPlayer.find(ownerGuid);
|
||||
if (itr != _corpsesByPlayer.end())
|
||||
|
||||
@@ -98,9 +98,9 @@ struct ChaseAngle
|
||||
float RelativeAngle; // we want to be at this angle relative to the target (0 = front, M_PI = back)
|
||||
float Tolerance; // but we'll tolerate anything within +- this much
|
||||
|
||||
float UpperBound() const;
|
||||
float LowerBound() const;
|
||||
bool IsAngleOkay(float relativeAngle) const;
|
||||
[[nodiscard]] float UpperBound() const;
|
||||
[[nodiscard]] float LowerBound() const;
|
||||
[[nodiscard]] bool IsAngleOkay(float relativeAngle) const;
|
||||
};
|
||||
|
||||
// assume it is 25 yard per 0.6 second
|
||||
|
||||
@@ -84,18 +84,18 @@ class PathGenerator
|
||||
void SetUseRaycast(bool useRaycast) { _useRaycast = useRaycast; }
|
||||
|
||||
// result getters
|
||||
G3D::Vector3 const& GetStartPosition() const { return _startPosition; }
|
||||
G3D::Vector3 const& GetEndPosition() const { return _endPosition; }
|
||||
G3D::Vector3 const& GetActualEndPosition() const { return _actualEndPosition; }
|
||||
[[nodiscard]] G3D::Vector3 const& GetStartPosition() const { return _startPosition; }
|
||||
[[nodiscard]] G3D::Vector3 const& GetEndPosition() const { return _endPosition; }
|
||||
[[nodiscard]] G3D::Vector3 const& GetActualEndPosition() const { return _actualEndPosition; }
|
||||
|
||||
Movement::PointsArray const& GetPath() const { return _pathPoints; }
|
||||
[[nodiscard]] Movement::PointsArray const& GetPath() const { return _pathPoints; }
|
||||
|
||||
PathType GetPathType() const { return _type; }
|
||||
[[nodiscard]] PathType GetPathType() const { return _type; }
|
||||
|
||||
// shortens the path until the destination is the specified distance from the target point
|
||||
void ShortenPathUntilDist(G3D::Vector3 const& point, float dist);
|
||||
|
||||
float getPathLength() const
|
||||
[[nodiscard]] float getPathLength() const
|
||||
{
|
||||
float len = 0.0f;
|
||||
float dx, dy, dz;
|
||||
@@ -156,19 +156,19 @@ class PathGenerator
|
||||
void SetActualEndPosition(G3D::Vector3 const& point) { _actualEndPosition = point; }
|
||||
void NormalizePath();
|
||||
|
||||
bool InRange(G3D::Vector3 const& p1, G3D::Vector3 const& p2, float r, float h) const;
|
||||
float Dist3DSqr(G3D::Vector3 const& p1, G3D::Vector3 const& p2) const;
|
||||
[[nodiscard]] bool InRange(G3D::Vector3 const& p1, G3D::Vector3 const& p2, float r, float h) const;
|
||||
[[nodiscard]] float Dist3DSqr(G3D::Vector3 const& p1, G3D::Vector3 const& p2) const;
|
||||
bool InRangeYZX(float const* v1, float const* v2, float r, float h) const;
|
||||
|
||||
dtPolyRef GetPathPolyByPosition(dtPolyRef const* polyPath, uint32 polyPathSize, float const* Point, float* Distance = nullptr) const;
|
||||
dtPolyRef GetPolyByLocation(float const* Point, float* Distance) const;
|
||||
bool HaveTile(G3D::Vector3 const& p) const;
|
||||
[[nodiscard]] bool HaveTile(G3D::Vector3 const& p) const;
|
||||
|
||||
void BuildPolyPath(G3D::Vector3 const& startPos, G3D::Vector3 const& endPos);
|
||||
void BuildPointPath(float const* startPoint, float const* endPoint);
|
||||
void BuildShortcut();
|
||||
|
||||
NavTerrain GetNavTerrain(float x, float y, float z) const;
|
||||
[[nodiscard]] NavTerrain GetNavTerrain(float x, float y, float z) const;
|
||||
void CreateFilter();
|
||||
void UpdateFilter();
|
||||
|
||||
|
||||
@@ -25,9 +25,9 @@ namespace Movement
|
||||
{
|
||||
struct Location : public Vector3
|
||||
{
|
||||
Location() {}
|
||||
Location() = default;
|
||||
Location(float x, float y, float z, float o) : Vector3(x, y, z), orientation(o) {}
|
||||
Location(const Vector3& v) : Vector3(v), orientation(0) {}
|
||||
Location(const Vector3& v) : Vector3(v) {}
|
||||
Location(const Vector3& v, float o) : Vector3(v), orientation(o) {}
|
||||
|
||||
float orientation{0};
|
||||
|
||||
@@ -89,7 +89,7 @@ namespace Movement
|
||||
void UninitializedSplineInitMethod(Vector3 const*, index_type, bool, index_type) { ABORT(); }
|
||||
|
||||
public:
|
||||
explicit SplineBase() {}
|
||||
explicit SplineBase() = default;
|
||||
|
||||
/** Caclulates the position for given segment Idx, and percent of segment length t
|
||||
@param t - percent of segment length, assumes that t in range [0, 1]
|
||||
|
||||
@@ -213,7 +213,7 @@ public:
|
||||
void LoadQuestOfferReward(Field* fields);
|
||||
void LoadQuestTemplateAddon(Field* fields);
|
||||
|
||||
uint32 XPValue(uint8 playerLevel = 0) const;
|
||||
[[nodiscard]] uint32 XPValue(uint8 playerLevel = 0) const;
|
||||
|
||||
[[nodiscard]] bool HasFlag(uint32 flag) const { return (Flags & flag) != 0; }
|
||||
void SetFlag(uint32 flag) { Flags |= flag; }
|
||||
|
||||
@@ -1726,7 +1726,7 @@ protected:
|
||||
|
||||
public:
|
||||
|
||||
bool IsDatabaseBound() const { return false; }
|
||||
[[nodiscard]] bool IsDatabaseBound() const override { return false; }
|
||||
|
||||
// After complete global acvievement
|
||||
virtual void SetRealmCompleted(AchievementEntry const* /*achievement*/) { }
|
||||
@@ -1748,7 +1748,7 @@ protected:
|
||||
|
||||
public:
|
||||
|
||||
bool IsDatabaseBound() const { return false; }
|
||||
[[nodiscard]] bool IsDatabaseBound() const override { return false; }
|
||||
|
||||
virtual void OnInitStatsForLevel(Guardian* /*guardian*/, uint8 /*petlevel*/) { }
|
||||
|
||||
@@ -1776,7 +1776,7 @@ protected:
|
||||
|
||||
public:
|
||||
|
||||
bool IsDatabaseBound() const { return false; }
|
||||
[[nodiscard]] bool IsDatabaseBound() const override { return false; }
|
||||
|
||||
[[nodiscard]] virtual bool CanAddMember(ArenaTeam* /*team*/, ObjectGuid /*PlayerGuid*/) { return true; }
|
||||
|
||||
@@ -1793,7 +1793,7 @@ protected:
|
||||
|
||||
public:
|
||||
|
||||
bool IsDatabaseBound() const { return false; }
|
||||
[[nodiscard]] bool IsDatabaseBound() const override { return false; }
|
||||
|
||||
virtual void OnConstructObject(Object* /*origin*/) { }
|
||||
|
||||
@@ -1846,7 +1846,7 @@ protected:
|
||||
|
||||
public:
|
||||
|
||||
bool IsDatabaseBound() const { return false; }
|
||||
[[nodiscard]] bool IsDatabaseBound() const override { return false; }
|
||||
|
||||
virtual void OnHandleDevCommand(Player* /*player*/, bool& /*enable*/) { }
|
||||
|
||||
@@ -1867,7 +1867,7 @@ protected:
|
||||
|
||||
public:
|
||||
|
||||
bool IsDatabaseBound() const { return false; }
|
||||
[[nodiscard]] bool IsDatabaseBound() const override { return false; }
|
||||
|
||||
virtual void OnAfterDatabasesLoaded(uint32 /*updateFlags*/) { }
|
||||
};
|
||||
@@ -1880,7 +1880,7 @@ protected:
|
||||
|
||||
public:
|
||||
|
||||
bool IsDatabaseBound() const { return false; }
|
||||
[[nodiscard]] bool IsDatabaseBound() const override { return false; }
|
||||
|
||||
/**
|
||||
* @brief This hook called before destroy world object
|
||||
@@ -1927,7 +1927,7 @@ protected:
|
||||
|
||||
public:
|
||||
|
||||
bool IsDatabaseBound() const { return false; }
|
||||
[[nodiscard]] bool IsDatabaseBound() const override { return false; }
|
||||
|
||||
/**
|
||||
* @brief This hook called before money loot
|
||||
@@ -2525,7 +2525,7 @@ public:
|
||||
GenericSpellAndAuraScriptLoader(char const* name, ArgsType&& args) : SpellScriptLoader(name), _args(std::move(args)) { }
|
||||
|
||||
private:
|
||||
SpellScript* GetSpellScript() const override
|
||||
[[nodiscard]] SpellScript* GetSpellScript() const override
|
||||
{
|
||||
if constexpr (!std::is_same_v<SpellScriptType, Acore::find_type_end>)
|
||||
{
|
||||
@@ -2537,7 +2537,7 @@ private:
|
||||
}
|
||||
}
|
||||
|
||||
AuraScript* GetAuraScript() const override
|
||||
[[nodiscard]] AuraScript* GetAuraScript() const override
|
||||
{
|
||||
if constexpr (!std::is_same_v<AuraScriptType, Acore::find_type_end>)
|
||||
{
|
||||
|
||||
@@ -35,8 +35,8 @@ namespace WorldPackets
|
||||
virtual WorldPacket const* Write() = 0;
|
||||
virtual void Read() = 0;
|
||||
|
||||
WorldPacket const* GetRawPacket() const { return &_worldPacket; }
|
||||
size_t GetSize() const { return _worldPacket.size(); }
|
||||
[[nodiscard]] WorldPacket const* GetRawPacket() const { return &_worldPacket; }
|
||||
[[nodiscard]] size_t GetSize() const { return _worldPacket.size(); }
|
||||
|
||||
protected:
|
||||
WorldPacket _worldPacket;
|
||||
@@ -53,7 +53,7 @@ namespace WorldPackets
|
||||
WorldPacket&& Move() { return std::move(_worldPacket); }
|
||||
void ShrinkToFit() { _worldPacket.shrink_to_fit(); }
|
||||
|
||||
OpcodeServer GetOpcode() const { return OpcodeServer(_worldPacket.GetOpcode()); }
|
||||
[[nodiscard]] OpcodeServer GetOpcode() const { return OpcodeServer(_worldPacket.GetOpcode()); }
|
||||
};
|
||||
|
||||
class AC_GAME_API ClientPacket : public Packet
|
||||
@@ -64,7 +64,7 @@ namespace WorldPackets
|
||||
|
||||
WorldPacket const* Write() final;
|
||||
|
||||
OpcodeClient GetOpcode() const { return OpcodeClient(_worldPacket.GetOpcode()); }
|
||||
[[nodiscard]] OpcodeClient GetOpcode() const { return OpcodeClient(_worldPacket.GetOpcode()); }
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -1374,7 +1374,7 @@ class OpcodeHandler
|
||||
{
|
||||
public:
|
||||
OpcodeHandler(char const* name, SessionStatus status) : Name(name), Status(status) { }
|
||||
virtual ~OpcodeHandler() { }
|
||||
virtual ~OpcodeHandler() = default;
|
||||
|
||||
char const* Name;
|
||||
SessionStatus Status;
|
||||
|
||||
@@ -27,7 +27,7 @@ class WorldPacket : public ByteBuffer
|
||||
{
|
||||
public:
|
||||
// just container for later use
|
||||
WorldPacket() : ByteBuffer(0), m_opcode(NULL_OPCODE) { }
|
||||
WorldPacket() : ByteBuffer(0) { }
|
||||
|
||||
explicit WorldPacket(uint16 opcode, size_t res = 200) :
|
||||
ByteBuffer(res), m_opcode(opcode) { }
|
||||
@@ -79,7 +79,7 @@ public:
|
||||
[[nodiscard]] TimePoint GetReceivedTime() const { return m_receivedTime; }
|
||||
|
||||
protected:
|
||||
uint16 m_opcode;
|
||||
uint16 m_opcode{NULL_OPCODE};
|
||||
TimePoint m_receivedTime; // only set for a specific set of opcodes, for performance reasons.
|
||||
};
|
||||
|
||||
|
||||
@@ -699,7 +699,7 @@ public:
|
||||
// SpellInfo object management
|
||||
[[nodiscard]] SpellInfo const* GetSpellInfo(uint32 spellId) const { return spellId < GetSpellInfoStoreSize() ? mSpellInfoMap[spellId] : nullptr; }
|
||||
// Use this only with 100% valid spellIds
|
||||
SpellInfo const* AssertSpellInfo(uint32 spellId) const
|
||||
[[nodiscard]] SpellInfo const* AssertSpellInfo(uint32 spellId) const
|
||||
{
|
||||
ASSERT(spellId < GetSpellInfoStoreSize());
|
||||
SpellInfo const* spellInfo = mSpellInfoMap[spellId];
|
||||
@@ -707,7 +707,7 @@ public:
|
||||
return spellInfo;
|
||||
}
|
||||
// use this instead of AssertSpellInfo to have the problem logged instead of crashing the server
|
||||
SpellInfo const* CheckSpellInfo(uint32 spellId) const
|
||||
[[nodiscard]] SpellInfo const* CheckSpellInfo(uint32 spellId) const
|
||||
{
|
||||
if (spellId >= GetSpellInfoStoreSize())
|
||||
{
|
||||
|
||||
@@ -492,51 +492,51 @@ enum Rates
|
||||
class IWorld
|
||||
{
|
||||
public:
|
||||
virtual ~IWorld() {}
|
||||
virtual WorldSession* FindSession(uint32 id) const = 0;
|
||||
virtual WorldSession* FindOfflineSession(uint32 id) const = 0;
|
||||
virtual WorldSession* FindOfflineSessionForCharacterGUID(ObjectGuid::LowType guidLow) const = 0;
|
||||
virtual ~IWorld() = default;
|
||||
[[nodiscard]] virtual WorldSession* FindSession(uint32 id) const = 0;
|
||||
[[nodiscard]] virtual WorldSession* FindOfflineSession(uint32 id) const = 0;
|
||||
[[nodiscard]] virtual WorldSession* FindOfflineSessionForCharacterGUID(ObjectGuid::LowType guidLow) const = 0;
|
||||
virtual void AddSession(WorldSession* s) = 0;
|
||||
virtual void SendAutoBroadcast() = 0;
|
||||
virtual bool KickSession(uint32 id) = 0;
|
||||
virtual void UpdateMaxSessionCounters() = 0;
|
||||
virtual const SessionMap& GetAllSessions() const = 0;
|
||||
virtual uint32 GetActiveAndQueuedSessionCount() const = 0;
|
||||
virtual uint32 GetActiveSessionCount() const = 0;
|
||||
virtual uint32 GetQueuedSessionCount() const = 0;
|
||||
virtual uint32 GetMaxQueuedSessionCount() const = 0;
|
||||
virtual uint32 GetMaxActiveSessionCount() const = 0;
|
||||
virtual uint32 GetPlayerCount() const = 0;
|
||||
virtual uint32 GetMaxPlayerCount() const = 0;
|
||||
[[nodiscard]] virtual const SessionMap& GetAllSessions() const = 0;
|
||||
[[nodiscard]] virtual uint32 GetActiveAndQueuedSessionCount() const = 0;
|
||||
[[nodiscard]] virtual uint32 GetActiveSessionCount() const = 0;
|
||||
[[nodiscard]] virtual uint32 GetQueuedSessionCount() const = 0;
|
||||
[[nodiscard]] virtual uint32 GetMaxQueuedSessionCount() const = 0;
|
||||
[[nodiscard]] virtual uint32 GetMaxActiveSessionCount() const = 0;
|
||||
[[nodiscard]] virtual uint32 GetPlayerCount() const = 0;
|
||||
[[nodiscard]] virtual uint32 GetMaxPlayerCount() const = 0;
|
||||
virtual void IncreasePlayerCount() = 0;
|
||||
virtual void DecreasePlayerCount() = 0;
|
||||
virtual Player* FindPlayerInZone(uint32 zone) = 0;
|
||||
virtual bool IsClosed() const = 0;
|
||||
[[nodiscard]] virtual bool IsClosed() const = 0;
|
||||
virtual void SetClosed(bool val) = 0;
|
||||
virtual AccountTypes GetPlayerSecurityLimit() const = 0;
|
||||
[[nodiscard]] virtual AccountTypes GetPlayerSecurityLimit() const = 0;
|
||||
virtual void SetPlayerSecurityLimit(AccountTypes sec) = 0;
|
||||
virtual void LoadDBAllowedSecurityLevel() = 0;
|
||||
virtual void SetPlayerAmountLimit(uint32 limit) = 0;
|
||||
virtual uint32 GetPlayerAmountLimit() const = 0;
|
||||
[[nodiscard]] virtual uint32 GetPlayerAmountLimit() const = 0;
|
||||
virtual void AddQueuedPlayer(WorldSession*) = 0;
|
||||
virtual bool RemoveQueuedPlayer(WorldSession* session) = 0;
|
||||
virtual int32 GetQueuePos(WorldSession*) = 0;
|
||||
virtual bool HasRecentlyDisconnected(WorldSession*) = 0;
|
||||
virtual bool getAllowMovement() const = 0;
|
||||
[[nodiscard]] virtual bool getAllowMovement() const = 0;
|
||||
virtual void SetAllowMovement(bool allow) = 0;
|
||||
virtual void SetNewCharString(std::string const& str) = 0;
|
||||
virtual std::string const& GetNewCharString() const = 0;
|
||||
virtual LocaleConstant GetDefaultDbcLocale() const = 0;
|
||||
virtual std::string const& GetDataPath() const = 0;
|
||||
virtual time_t const& GetStartTime() const = 0;
|
||||
virtual time_t const& GetGameTime() const = 0;
|
||||
virtual uint32 GetUptime() const = 0;
|
||||
virtual uint32 GetUpdateTime() const = 0;
|
||||
[[nodiscard]] virtual std::string const& GetNewCharString() const = 0;
|
||||
[[nodiscard]] virtual LocaleConstant GetDefaultDbcLocale() const = 0;
|
||||
[[nodiscard]] virtual std::string const& GetDataPath() const = 0;
|
||||
[[nodiscard]] virtual time_t const& GetStartTime() const = 0;
|
||||
[[nodiscard]] virtual time_t const& GetGameTime() const = 0;
|
||||
[[nodiscard]] virtual uint32 GetUptime() const = 0;
|
||||
[[nodiscard]] virtual uint32 GetUpdateTime() const = 0;
|
||||
virtual void SetRecordDiffInterval(int32 t) = 0;
|
||||
virtual time_t GetNextDailyQuestsResetTime() const = 0;
|
||||
virtual time_t GetNextWeeklyQuestsResetTime() const = 0;
|
||||
virtual time_t GetNextRandomBGResetTime() const = 0;
|
||||
virtual uint16 GetConfigMaxSkillValue() const = 0;
|
||||
[[nodiscard]] virtual time_t GetNextDailyQuestsResetTime() const = 0;
|
||||
[[nodiscard]] virtual time_t GetNextWeeklyQuestsResetTime() const = 0;
|
||||
[[nodiscard]] virtual time_t GetNextRandomBGResetTime() const = 0;
|
||||
[[nodiscard]] virtual uint16 GetConfigMaxSkillValue() const = 0;
|
||||
virtual void SetInitialWorldSettings() = 0;
|
||||
virtual void LoadConfigSettings(bool reload = false) = 0;
|
||||
virtual void SendWorldText(uint32 string_id, ...) = 0;
|
||||
@@ -548,26 +548,26 @@ public:
|
||||
virtual bool SendZoneMessage(uint32 zone, WorldPacket const* packet, WorldSession* self = nullptr, TeamId teamId = TEAM_NEUTRAL) = 0;
|
||||
virtual void SendZoneText(uint32 zone, const char* text, WorldSession* self = nullptr, TeamId teamId = TEAM_NEUTRAL) = 0;
|
||||
virtual void SendServerMessage(ServerMessageType messageID, std::string stringParam = "", Player* player = nullptr) = 0;
|
||||
virtual bool IsShuttingDown() const = 0;
|
||||
virtual uint32 GetShutDownTimeLeft() const = 0;
|
||||
[[nodiscard]] virtual bool IsShuttingDown() const = 0;
|
||||
[[nodiscard]] virtual uint32 GetShutDownTimeLeft() const = 0;
|
||||
virtual void ShutdownServ(uint32 time, uint32 options, uint8 exitcode, const std::string& reason = std::string()) = 0;
|
||||
virtual void ShutdownCancel() = 0;
|
||||
virtual void ShutdownMsg(bool show = false, Player* player = nullptr, const std::string& reason = std::string()) = 0;
|
||||
virtual void Update(uint32 diff) = 0;
|
||||
virtual void UpdateSessions(uint32 diff) = 0;
|
||||
virtual void setRate(Rates rate, float value) = 0;
|
||||
virtual float getRate(Rates rate) const = 0;
|
||||
[[nodiscard]] virtual float getRate(Rates rate) const = 0;
|
||||
virtual void setBoolConfig(WorldBoolConfigs index, bool value) = 0;
|
||||
virtual bool getBoolConfig(WorldBoolConfigs index) const = 0;
|
||||
[[nodiscard]] virtual bool getBoolConfig(WorldBoolConfigs index) const = 0;
|
||||
virtual void setFloatConfig(WorldFloatConfigs index, float value) = 0;
|
||||
virtual float getFloatConfig(WorldFloatConfigs index) const = 0;
|
||||
[[nodiscard]] virtual float getFloatConfig(WorldFloatConfigs index) const = 0;
|
||||
virtual void setIntConfig(WorldIntConfigs index, uint32 value) = 0;
|
||||
virtual uint32 getIntConfig(WorldIntConfigs index) const = 0;
|
||||
[[nodiscard]] virtual uint32 getIntConfig(WorldIntConfigs index) const = 0;
|
||||
virtual void setWorldState(uint32 index, uint64 value) = 0;
|
||||
virtual uint64 getWorldState(uint32 index) const = 0;
|
||||
[[nodiscard]] virtual uint64 getWorldState(uint32 index) const = 0;
|
||||
virtual void LoadWorldStates() = 0;
|
||||
virtual bool IsPvPRealm() const = 0;
|
||||
virtual bool IsFFAPvPRealm() const = 0;
|
||||
[[nodiscard]] virtual bool IsPvPRealm() const = 0;
|
||||
[[nodiscard]] virtual bool IsFFAPvPRealm() const = 0;
|
||||
virtual void KickAll() = 0;
|
||||
virtual void KickAllLess(AccountTypes sec) = 0;
|
||||
virtual uint32 GetNextWhoListUpdateDelaySecs() = 0;
|
||||
@@ -575,21 +575,21 @@ public:
|
||||
virtual void QueueCliCommand(CliCommandHolder* commandHolder) = 0;
|
||||
virtual void ForceGameEventUpdate() = 0;
|
||||
virtual void UpdateRealmCharCount(uint32 accid) = 0;
|
||||
virtual LocaleConstant GetAvailableDbcLocale(LocaleConstant locale) const = 0;
|
||||
[[nodiscard]] virtual LocaleConstant GetAvailableDbcLocale(LocaleConstant locale) const = 0;
|
||||
virtual void LoadDBVersion() = 0;
|
||||
virtual void LoadDBRevision() = 0;
|
||||
virtual char const* GetDBVersion() const = 0;
|
||||
virtual char const* GetWorldDBRevision() const = 0;
|
||||
virtual char const* GetCharacterDBRevision() const = 0;
|
||||
virtual char const* GetAuthDBRevision() const = 0;
|
||||
[[nodiscard]] virtual char const* GetDBVersion() const = 0;
|
||||
[[nodiscard]] virtual char const* GetWorldDBRevision() const = 0;
|
||||
[[nodiscard]] virtual char const* GetCharacterDBRevision() const = 0;
|
||||
[[nodiscard]] virtual char const* GetAuthDBRevision() const = 0;
|
||||
virtual void LoadAutobroadcasts() = 0;
|
||||
virtual void UpdateAreaDependentAuras() = 0;
|
||||
virtual uint32 GetCleaningFlags() const = 0;
|
||||
[[nodiscard]] virtual uint32 GetCleaningFlags() const = 0;
|
||||
virtual void SetCleaningFlags(uint32 flags) = 0;
|
||||
virtual void ResetEventSeasonalQuests(uint16 event_id) = 0;
|
||||
virtual time_t GetNextTimeWithDayAndHour(int8 dayOfWeek, int8 hour) = 0;
|
||||
virtual time_t GetNextTimeWithMonthAndHour(int8 month, int8 hour) = 0;
|
||||
virtual std::string const& GetRealmName() const = 0;
|
||||
[[nodiscard]] virtual std::string const& GetRealmName() const = 0;
|
||||
virtual void SetRealmName(std::string name) = 0;
|
||||
virtual void RemoveOldCorpses() = 0;
|
||||
};
|
||||
|
||||
@@ -153,184 +153,184 @@ class World: public IWorld
|
||||
{
|
||||
public:
|
||||
World();
|
||||
~World();
|
||||
~World() override;
|
||||
|
||||
static World* instance();
|
||||
|
||||
static uint32 m_worldLoopCounter;
|
||||
|
||||
WorldSession* FindSession(uint32 id) const;
|
||||
WorldSession* FindOfflineSession(uint32 id) const;
|
||||
WorldSession* FindOfflineSessionForCharacterGUID(ObjectGuid::LowType guidLow) const;
|
||||
void AddSession(WorldSession* s);
|
||||
void SendAutoBroadcast();
|
||||
bool KickSession(uint32 id);
|
||||
[[nodiscard]] WorldSession* FindSession(uint32 id) const override;
|
||||
[[nodiscard]] WorldSession* FindOfflineSession(uint32 id) const override;
|
||||
[[nodiscard]] WorldSession* FindOfflineSessionForCharacterGUID(ObjectGuid::LowType guidLow) const override;
|
||||
void AddSession(WorldSession* s) override;
|
||||
void SendAutoBroadcast() override;
|
||||
bool KickSession(uint32 id) override;
|
||||
/// Get the number of current active sessions
|
||||
void UpdateMaxSessionCounters();
|
||||
const SessionMap& GetAllSessions() const { return m_sessions; }
|
||||
uint32 GetActiveAndQueuedSessionCount() const { return m_sessions.size(); }
|
||||
uint32 GetActiveSessionCount() const { return m_sessions.size() - m_QueuedPlayer.size(); }
|
||||
uint32 GetQueuedSessionCount() const { return m_QueuedPlayer.size(); }
|
||||
void UpdateMaxSessionCounters() override;
|
||||
[[nodiscard]] const SessionMap& GetAllSessions() const override { return m_sessions; }
|
||||
[[nodiscard]] uint32 GetActiveAndQueuedSessionCount() const override { return m_sessions.size(); }
|
||||
[[nodiscard]] uint32 GetActiveSessionCount() const override { return m_sessions.size() - m_QueuedPlayer.size(); }
|
||||
[[nodiscard]] uint32 GetQueuedSessionCount() const override { return m_QueuedPlayer.size(); }
|
||||
/// Get the maximum number of parallel sessions on the server since last reboot
|
||||
uint32 GetMaxQueuedSessionCount() const { return m_maxQueuedSessionCount; }
|
||||
uint32 GetMaxActiveSessionCount() const { return m_maxActiveSessionCount; }
|
||||
[[nodiscard]] uint32 GetMaxQueuedSessionCount() const override { return m_maxQueuedSessionCount; }
|
||||
[[nodiscard]] uint32 GetMaxActiveSessionCount() const override { return m_maxActiveSessionCount; }
|
||||
/// Get number of players
|
||||
inline uint32 GetPlayerCount() const { return m_PlayerCount; }
|
||||
inline uint32 GetMaxPlayerCount() const { return m_MaxPlayerCount; }
|
||||
[[nodiscard]] inline uint32 GetPlayerCount() const override { return m_PlayerCount; }
|
||||
[[nodiscard]] inline uint32 GetMaxPlayerCount() const override { return m_MaxPlayerCount; }
|
||||
|
||||
/// Increase/Decrease number of players
|
||||
inline void IncreasePlayerCount()
|
||||
inline void IncreasePlayerCount() override
|
||||
{
|
||||
m_PlayerCount++;
|
||||
m_MaxPlayerCount = std::max(m_MaxPlayerCount, m_PlayerCount);
|
||||
}
|
||||
inline void DecreasePlayerCount() { m_PlayerCount--; }
|
||||
inline void DecreasePlayerCount() override { m_PlayerCount--; }
|
||||
|
||||
Player* FindPlayerInZone(uint32 zone);
|
||||
Player* FindPlayerInZone(uint32 zone) override;
|
||||
|
||||
/// Deny clients?
|
||||
bool IsClosed() const;
|
||||
[[nodiscard]] bool IsClosed() const override;
|
||||
|
||||
/// Close world
|
||||
void SetClosed(bool val);
|
||||
void SetClosed(bool val) override;
|
||||
|
||||
/// Security level limitations
|
||||
AccountTypes GetPlayerSecurityLimit() const { return m_allowedSecurityLevel; }
|
||||
void SetPlayerSecurityLimit(AccountTypes sec);
|
||||
void LoadDBAllowedSecurityLevel();
|
||||
[[nodiscard]] AccountTypes GetPlayerSecurityLimit() const override { return m_allowedSecurityLevel; }
|
||||
void SetPlayerSecurityLimit(AccountTypes sec) override;
|
||||
void LoadDBAllowedSecurityLevel() override;
|
||||
|
||||
/// Active session server limit
|
||||
void SetPlayerAmountLimit(uint32 limit) { m_playerLimit = limit; }
|
||||
uint32 GetPlayerAmountLimit() const { return m_playerLimit; }
|
||||
void SetPlayerAmountLimit(uint32 limit) override { m_playerLimit = limit; }
|
||||
[[nodiscard]] uint32 GetPlayerAmountLimit() const override { return m_playerLimit; }
|
||||
|
||||
//player Queue
|
||||
typedef std::list<WorldSession*> Queue;
|
||||
void AddQueuedPlayer(WorldSession*);
|
||||
bool RemoveQueuedPlayer(WorldSession* session);
|
||||
int32 GetQueuePos(WorldSession*);
|
||||
bool HasRecentlyDisconnected(WorldSession*);
|
||||
void AddQueuedPlayer(WorldSession*) override;
|
||||
bool RemoveQueuedPlayer(WorldSession* session) override;
|
||||
int32 GetQueuePos(WorldSession*) override;
|
||||
bool HasRecentlyDisconnected(WorldSession*) override;
|
||||
|
||||
/// \todo Actions on m_allowMovement still to be implemented
|
||||
/// Is movement allowed?
|
||||
bool getAllowMovement() const { return m_allowMovement; }
|
||||
[[nodiscard]] bool getAllowMovement() const override { return m_allowMovement; }
|
||||
/// Allow/Disallow object movements
|
||||
void SetAllowMovement(bool allow) { m_allowMovement = allow; }
|
||||
void SetAllowMovement(bool allow) override { m_allowMovement = allow; }
|
||||
|
||||
/// Set the string for new characters (first login)
|
||||
void SetNewCharString(std::string const& str) { m_newCharString = str; }
|
||||
void SetNewCharString(std::string const& str) override { m_newCharString = str; }
|
||||
/// Get the string for new characters (first login)
|
||||
std::string const& GetNewCharString() const { return m_newCharString; }
|
||||
[[nodiscard]] std::string const& GetNewCharString() const override { return m_newCharString; }
|
||||
|
||||
LocaleConstant GetDefaultDbcLocale() const { return m_defaultDbcLocale; }
|
||||
[[nodiscard]] LocaleConstant GetDefaultDbcLocale() const override { return m_defaultDbcLocale; }
|
||||
|
||||
/// Get the path where data (dbc, maps) are stored on disk
|
||||
std::string const& GetDataPath() const { return m_dataPath; }
|
||||
[[nodiscard]] std::string const& GetDataPath() const override { return m_dataPath; }
|
||||
|
||||
/// When server started?
|
||||
time_t const& GetStartTime() const { return m_startTime; }
|
||||
[[nodiscard]] time_t const& GetStartTime() const override { return m_startTime; }
|
||||
/// What time is it?
|
||||
time_t const& GetGameTime() const { return m_gameTime; }
|
||||
[[nodiscard]] time_t const& GetGameTime() const override { return m_gameTime; }
|
||||
/// What time is it? in ms
|
||||
static uint32 GetGameTimeMS() { return m_gameMSTime; }
|
||||
/// Uptime (in secs)
|
||||
uint32 GetUptime() const { return uint32(m_gameTime - m_startTime); }
|
||||
[[nodiscard]] uint32 GetUptime() const override { return uint32(m_gameTime - m_startTime); }
|
||||
/// Update time
|
||||
uint32 GetUpdateTime() const { return m_updateTime; }
|
||||
void SetRecordDiffInterval(int32 t) { if (t >= 0) m_int_configs[CONFIG_INTERVAL_LOG_UPDATE] = (uint32)t; }
|
||||
[[nodiscard]] uint32 GetUpdateTime() const override { return m_updateTime; }
|
||||
void SetRecordDiffInterval(int32 t) override { if (t >= 0) m_int_configs[CONFIG_INTERVAL_LOG_UPDATE] = (uint32)t; }
|
||||
|
||||
/// Next daily quests and random bg reset time
|
||||
time_t GetNextDailyQuestsResetTime() const { return m_NextDailyQuestReset; }
|
||||
time_t GetNextWeeklyQuestsResetTime() const { return m_NextWeeklyQuestReset; }
|
||||
time_t GetNextRandomBGResetTime() const { return m_NextRandomBGReset; }
|
||||
[[nodiscard]] time_t GetNextDailyQuestsResetTime() const override { return m_NextDailyQuestReset; }
|
||||
[[nodiscard]] time_t GetNextWeeklyQuestsResetTime() const override { return m_NextWeeklyQuestReset; }
|
||||
[[nodiscard]] time_t GetNextRandomBGResetTime() const override { return m_NextRandomBGReset; }
|
||||
|
||||
/// Get the maximum skill level a player can reach
|
||||
uint16 GetConfigMaxSkillValue() const
|
||||
[[nodiscard]] uint16 GetConfigMaxSkillValue() const override
|
||||
{
|
||||
uint16 lvl = uint16(getIntConfig(CONFIG_MAX_PLAYER_LEVEL));
|
||||
return lvl > 60 ? 300 + ((lvl - 60) * 75) / 10 : lvl * 5;
|
||||
}
|
||||
|
||||
void SetInitialWorldSettings();
|
||||
void LoadConfigSettings(bool reload = false);
|
||||
void SetInitialWorldSettings() override;
|
||||
void LoadConfigSettings(bool reload = false) override;
|
||||
|
||||
void SendWorldText(uint32 string_id, ...);
|
||||
void SendGlobalText(const char* text, WorldSession* self);
|
||||
void SendGMText(uint32 string_id, ...);
|
||||
void SendGlobalMessage(WorldPacket const* packet, WorldSession* self = nullptr, TeamId teamId = TEAM_NEUTRAL);
|
||||
void SendGlobalGMMessage(WorldPacket const* packet, WorldSession* self = nullptr, TeamId teamId = TEAM_NEUTRAL);
|
||||
bool SendZoneMessage(uint32 zone, WorldPacket const* packet, WorldSession* self = nullptr, TeamId teamId = TEAM_NEUTRAL);
|
||||
void SendZoneText(uint32 zone, const char* text, WorldSession* self = nullptr, TeamId teamId = TEAM_NEUTRAL);
|
||||
void SendServerMessage(ServerMessageType messageID, std::string stringParam = "", Player* player = nullptr);
|
||||
void SendWorldText(uint32 string_id, ...) override;
|
||||
void SendGlobalText(const char* text, WorldSession* self) override;
|
||||
void SendGMText(uint32 string_id, ...) override;
|
||||
void SendGlobalMessage(WorldPacket const* packet, WorldSession* self = nullptr, TeamId teamId = TEAM_NEUTRAL) override;
|
||||
void SendGlobalGMMessage(WorldPacket const* packet, WorldSession* self = nullptr, TeamId teamId = TEAM_NEUTRAL) override;
|
||||
bool SendZoneMessage(uint32 zone, WorldPacket const* packet, WorldSession* self = nullptr, TeamId teamId = TEAM_NEUTRAL) override;
|
||||
void SendZoneText(uint32 zone, const char* text, WorldSession* self = nullptr, TeamId teamId = TEAM_NEUTRAL) override;
|
||||
void SendServerMessage(ServerMessageType messageID, std::string stringParam = "", Player* player = nullptr) override;
|
||||
|
||||
void SendWorldTextOptional(uint32 string_id, uint32 flag, ...);
|
||||
void SendWorldTextOptional(uint32 string_id, uint32 flag, ...) override;
|
||||
|
||||
/// Are we in the middle of a shutdown?
|
||||
bool IsShuttingDown() const { return m_ShutdownTimer > 0; }
|
||||
uint32 GetShutDownTimeLeft() const { return m_ShutdownTimer; }
|
||||
void ShutdownServ(uint32 time, uint32 options, uint8 exitcode, const std::string& reason = std::string());
|
||||
void ShutdownCancel();
|
||||
void ShutdownMsg(bool show = false, Player* player = nullptr, const std::string& reason = std::string());
|
||||
[[nodiscard]] bool IsShuttingDown() const override { return m_ShutdownTimer > 0; }
|
||||
[[nodiscard]] uint32 GetShutDownTimeLeft() const override { return m_ShutdownTimer; }
|
||||
void ShutdownServ(uint32 time, uint32 options, uint8 exitcode, const std::string& reason = std::string()) override;
|
||||
void ShutdownCancel() override;
|
||||
void ShutdownMsg(bool show = false, Player* player = nullptr, const std::string& reason = std::string()) override;
|
||||
static uint8 GetExitCode() { return m_ExitCode; }
|
||||
static void StopNow(uint8 exitcode) { m_stopEvent = true; m_ExitCode = exitcode; }
|
||||
static bool IsStopped() { return m_stopEvent; }
|
||||
|
||||
void Update(uint32 diff);
|
||||
void Update(uint32 diff) override;
|
||||
|
||||
void UpdateSessions(uint32 diff);
|
||||
void UpdateSessions(uint32 diff) override;
|
||||
/// Set a server rate (see #Rates)
|
||||
void setRate(Rates rate, float value) { rate_values[rate] = value; }
|
||||
void setRate(Rates rate, float value) override { rate_values[rate] = value; }
|
||||
/// Get a server rate (see #Rates)
|
||||
float getRate(Rates rate) const { return rate_values[rate]; }
|
||||
[[nodiscard]] float getRate(Rates rate) const override { return rate_values[rate]; }
|
||||
|
||||
/// Set a server configuration element (see #WorldConfigs)
|
||||
void setBoolConfig(WorldBoolConfigs index, bool value)
|
||||
void setBoolConfig(WorldBoolConfigs index, bool value) override
|
||||
{
|
||||
if (index < BOOL_CONFIG_VALUE_COUNT)
|
||||
m_bool_configs[index] = value;
|
||||
}
|
||||
|
||||
/// Get a server configuration element (see #WorldConfigs)
|
||||
bool getBoolConfig(WorldBoolConfigs index) const
|
||||
[[nodiscard]] bool getBoolConfig(WorldBoolConfigs index) const override
|
||||
{
|
||||
return index < BOOL_CONFIG_VALUE_COUNT ? m_bool_configs[index] : false;
|
||||
}
|
||||
|
||||
/// Set a server configuration element (see #WorldConfigs)
|
||||
void setFloatConfig(WorldFloatConfigs index, float value)
|
||||
void setFloatConfig(WorldFloatConfigs index, float value) override
|
||||
{
|
||||
if (index < FLOAT_CONFIG_VALUE_COUNT)
|
||||
m_float_configs[index] = value;
|
||||
}
|
||||
|
||||
/// Get a server configuration element (see #WorldConfigs)
|
||||
float getFloatConfig(WorldFloatConfigs index) const
|
||||
[[nodiscard]] float getFloatConfig(WorldFloatConfigs index) const override
|
||||
{
|
||||
return index < FLOAT_CONFIG_VALUE_COUNT ? m_float_configs[index] : 0;
|
||||
}
|
||||
|
||||
/// Set a server configuration element (see #WorldConfigs)
|
||||
void setIntConfig(WorldIntConfigs index, uint32 value)
|
||||
void setIntConfig(WorldIntConfigs index, uint32 value) override
|
||||
{
|
||||
if (index < INT_CONFIG_VALUE_COUNT)
|
||||
m_int_configs[index] = value;
|
||||
}
|
||||
|
||||
/// Get a server configuration element (see #WorldConfigs)
|
||||
uint32 getIntConfig(WorldIntConfigs index) const
|
||||
[[nodiscard]] uint32 getIntConfig(WorldIntConfigs index) const override
|
||||
{
|
||||
return index < INT_CONFIG_VALUE_COUNT ? m_int_configs[index] : 0;
|
||||
}
|
||||
|
||||
void setWorldState(uint32 index, uint64 value);
|
||||
uint64 getWorldState(uint32 index) const;
|
||||
void LoadWorldStates();
|
||||
void setWorldState(uint32 index, uint64 value) override;
|
||||
[[nodiscard]] uint64 getWorldState(uint32 index) const override;
|
||||
void LoadWorldStates() override;
|
||||
|
||||
/// Are we on a "Player versus Player" server?
|
||||
[[nodiscard]] bool IsPvPRealm() const;
|
||||
[[nodiscard]] bool IsFFAPvPRealm() const;
|
||||
[[nodiscard]] bool IsPvPRealm() const override;
|
||||
[[nodiscard]] bool IsFFAPvPRealm() const override;
|
||||
|
||||
void KickAll();
|
||||
void KickAllLess(AccountTypes sec);
|
||||
void KickAll() override;
|
||||
void KickAllLess(AccountTypes sec) override;
|
||||
|
||||
// for max speed access
|
||||
static float GetMaxVisibleDistanceOnContinents() { return m_MaxVisibleDistanceOnContinents; }
|
||||
@@ -338,40 +338,40 @@ public:
|
||||
static float GetMaxVisibleDistanceInBGArenas() { return m_MaxVisibleDistanceInBGArenas; }
|
||||
|
||||
// our: needed for arena spectator subscriptions
|
||||
uint32 GetNextWhoListUpdateDelaySecs();
|
||||
uint32 GetNextWhoListUpdateDelaySecs() override;
|
||||
|
||||
void ProcessCliCommands();
|
||||
void QueueCliCommand(CliCommandHolder* commandHolder) { cliCmdQueue.add(commandHolder); }
|
||||
void ProcessCliCommands() override;
|
||||
void QueueCliCommand(CliCommandHolder* commandHolder) override { cliCmdQueue.add(commandHolder); }
|
||||
|
||||
void ForceGameEventUpdate();
|
||||
void ForceGameEventUpdate() override;
|
||||
|
||||
void UpdateRealmCharCount(uint32 accid);
|
||||
void UpdateRealmCharCount(uint32 accid) override;
|
||||
|
||||
LocaleConstant GetAvailableDbcLocale(LocaleConstant locale) const { if (m_availableDbcLocaleMask & (1 << locale)) return locale; else return m_defaultDbcLocale; }
|
||||
[[nodiscard]] LocaleConstant GetAvailableDbcLocale(LocaleConstant locale) const override { if (m_availableDbcLocaleMask & (1 << locale)) return locale; else return m_defaultDbcLocale; }
|
||||
|
||||
// used World DB version
|
||||
void LoadDBVersion();
|
||||
void LoadDBRevision();
|
||||
char const* GetDBVersion() const { return m_DBVersion.c_str(); }
|
||||
char const* GetWorldDBRevision() const { return m_WorldDBRevision.c_str(); }
|
||||
char const* GetCharacterDBRevision() const { return m_CharacterDBRevision.c_str(); }
|
||||
char const* GetAuthDBRevision() const { return m_AuthDBRevision.c_str(); }
|
||||
void LoadDBVersion() override;
|
||||
void LoadDBRevision() override;
|
||||
[[nodiscard]] char const* GetDBVersion() const override { return m_DBVersion.c_str(); }
|
||||
[[nodiscard]] char const* GetWorldDBRevision() const override { return m_WorldDBRevision.c_str(); }
|
||||
[[nodiscard]] char const* GetCharacterDBRevision() const override { return m_CharacterDBRevision.c_str(); }
|
||||
[[nodiscard]] char const* GetAuthDBRevision() const override { return m_AuthDBRevision.c_str(); }
|
||||
|
||||
void LoadAutobroadcasts();
|
||||
void LoadAutobroadcasts() override;
|
||||
|
||||
void UpdateAreaDependentAuras();
|
||||
void UpdateAreaDependentAuras() override;
|
||||
|
||||
uint32 GetCleaningFlags() const { return m_CleaningFlags; }
|
||||
void SetCleaningFlags(uint32 flags) { m_CleaningFlags = flags; }
|
||||
void ResetEventSeasonalQuests(uint16 event_id);
|
||||
[[nodiscard]] uint32 GetCleaningFlags() const override { return m_CleaningFlags; }
|
||||
void SetCleaningFlags(uint32 flags) override { m_CleaningFlags = flags; }
|
||||
void ResetEventSeasonalQuests(uint16 event_id) override;
|
||||
|
||||
time_t GetNextTimeWithDayAndHour(int8 dayOfWeek, int8 hour); // pussywizard
|
||||
time_t GetNextTimeWithMonthAndHour(int8 month, int8 hour); // pussywizard
|
||||
time_t GetNextTimeWithDayAndHour(int8 dayOfWeek, int8 hour) override; // pussywizard
|
||||
time_t GetNextTimeWithMonthAndHour(int8 month, int8 hour) override; // pussywizard
|
||||
|
||||
std::string const& GetRealmName() const { return _realmName; } // pussywizard
|
||||
void SetRealmName(std::string name) { _realmName = name; } // pussywizard
|
||||
[[nodiscard]] std::string const& GetRealmName() const override { return _realmName; } // pussywizard
|
||||
void SetRealmName(std::string name) override { _realmName = name; } // pussywizard
|
||||
|
||||
void RemoveOldCorpses();
|
||||
void RemoveOldCorpses() override;
|
||||
|
||||
protected:
|
||||
void _UpdateGameTime();
|
||||
|
||||
@@ -2144,7 +2144,7 @@ struct WorldStateUI
|
||||
// Structures not used for casting to loaded DBC data and not required then packing
|
||||
struct MapDifficulty
|
||||
{
|
||||
MapDifficulty() {}
|
||||
MapDifficulty() = default;
|
||||
MapDifficulty(uint32 _resetTime, uint32 _maxPlayers, bool _hasErrorMessage) : resetTime(_resetTime), maxPlayers(_maxPlayers), hasErrorMessage(_hasErrorMessage) {}
|
||||
|
||||
uint32 resetTime{0};
|
||||
@@ -2154,7 +2154,7 @@ struct MapDifficulty
|
||||
|
||||
struct TalentSpellPos
|
||||
{
|
||||
TalentSpellPos() {}
|
||||
TalentSpellPos() = default;
|
||||
TalentSpellPos(uint16 _talent_id, uint8 _rank) : talent_id(_talent_id), rank(_rank) {}
|
||||
|
||||
uint16 talent_id{0};
|
||||
@@ -2165,7 +2165,7 @@ typedef std::map<uint32, TalentSpellPos> TalentSpellPosMap;
|
||||
|
||||
struct TaxiPathBySourceAndDestination
|
||||
{
|
||||
TaxiPathBySourceAndDestination() {}
|
||||
TaxiPathBySourceAndDestination() = default;
|
||||
TaxiPathBySourceAndDestination(uint32 _id, uint32 _price) : ID(_id), price(_price) {}
|
||||
|
||||
uint32 ID{0};
|
||||
|
||||
@@ -31,9 +31,9 @@ class MessageBuffer;
|
||||
class AC_SHARED_API ByteBufferException : public std::exception
|
||||
{
|
||||
public:
|
||||
~ByteBufferException() noexcept = default;
|
||||
~ByteBufferException() noexcept override = default;
|
||||
|
||||
char const* what() const noexcept override { return msg_.c_str(); }
|
||||
[[nodiscard]] char const* what() const noexcept override { return msg_.c_str(); }
|
||||
|
||||
protected:
|
||||
std::string & message() noexcept { return msg_; }
|
||||
@@ -47,7 +47,7 @@ class AC_SHARED_API ByteBufferPositionException : public ByteBufferException
|
||||
public:
|
||||
ByteBufferPositionException(bool add, size_t pos, size_t size, size_t valueSize);
|
||||
|
||||
~ByteBufferPositionException() noexcept = default;
|
||||
~ByteBufferPositionException() noexcept override = default;
|
||||
};
|
||||
|
||||
class AC_SHARED_API ByteBufferSourceException : public ByteBufferException
|
||||
@@ -55,7 +55,7 @@ class AC_SHARED_API ByteBufferSourceException : public ByteBufferException
|
||||
public:
|
||||
ByteBufferSourceException(size_t pos, size_t size, size_t valueSize);
|
||||
|
||||
~ByteBufferSourceException() noexcept = default;
|
||||
~ByteBufferSourceException() noexcept override = default;
|
||||
};
|
||||
|
||||
class AC_SHARED_API ByteBufferInvalidValueException : public ByteBufferException
|
||||
@@ -63,7 +63,7 @@ class AC_SHARED_API ByteBufferInvalidValueException : public ByteBufferException
|
||||
public:
|
||||
ByteBufferInvalidValueException(char const* type, char const* value);
|
||||
|
||||
~ByteBufferInvalidValueException() noexcept = default;
|
||||
~ByteBufferInvalidValueException() noexcept override = default;
|
||||
};
|
||||
|
||||
class AC_SHARED_API ByteBuffer
|
||||
@@ -72,7 +72,7 @@ public:
|
||||
constexpr static size_t DEFAULT_SIZE = 0x1000;
|
||||
|
||||
// constructor
|
||||
ByteBuffer() : _rpos(0), _wpos(0)
|
||||
ByteBuffer()
|
||||
{
|
||||
_storage.reserve(DEFAULT_SIZE);
|
||||
}
|
||||
@@ -355,7 +355,7 @@ public:
|
||||
return r;
|
||||
}
|
||||
|
||||
template <typename T> T read(size_t pos) const
|
||||
template <typename T> [[nodiscard]] T read(size_t pos) const
|
||||
{
|
||||
if (pos + sizeof(T) > size())
|
||||
{
|
||||
@@ -528,7 +528,7 @@ public:
|
||||
void hexlike() const;
|
||||
|
||||
protected:
|
||||
size_t _rpos, _wpos;
|
||||
size_t _rpos{0}, _wpos{0};
|
||||
std::vector<uint8> _storage;
|
||||
};
|
||||
|
||||
|
||||
@@ -36,10 +36,10 @@ enum RealmFlags
|
||||
|
||||
struct AC_SHARED_API RealmHandle
|
||||
{
|
||||
RealmHandle() : Realm(0) { }
|
||||
RealmHandle() = default;
|
||||
RealmHandle(uint32 index) : Realm(index) { }
|
||||
|
||||
uint32 Realm; // primary key in `realmlist` table
|
||||
uint32 Realm{0}; // primary key in `realmlist` table
|
||||
|
||||
bool operator<(RealmHandle const& r) const
|
||||
{
|
||||
@@ -78,7 +78,7 @@ struct AC_SHARED_API Realm
|
||||
AccountTypes AllowedSecurityLevel;
|
||||
float PopulationLevel;
|
||||
|
||||
boost::asio::ip::tcp_endpoint GetAddressForClient(boost::asio::ip::address const& clientAddr) const;
|
||||
[[nodiscard]] boost::asio::ip::tcp_endpoint GetAddressForClient(boost::asio::ip::address const& clientAddr) const;
|
||||
};
|
||||
|
||||
#endif // Realm_h__
|
||||
|
||||
@@ -24,8 +24,7 @@
|
||||
#include "Util.h"
|
||||
#include <boost/asio/ip/tcp.hpp>
|
||||
|
||||
RealmList::RealmList() :
|
||||
_updateInterval(0) { }
|
||||
RealmList::RealmList() : _updateInterval(0) { }
|
||||
|
||||
RealmList* RealmList::Instance()
|
||||
{
|
||||
|
||||
@@ -52,10 +52,10 @@ public:
|
||||
void Initialize(Acore::Asio::IoContext& ioContext, uint32 updateInterval);
|
||||
void Close();
|
||||
|
||||
RealmMap const& GetRealms() const { return _realms; }
|
||||
Realm const* GetRealm(RealmHandle const& id) const;
|
||||
[[nodiscard]] RealmMap const& GetRealms() const { return _realms; }
|
||||
[[nodiscard]] Realm const* GetRealm(RealmHandle const& id) const;
|
||||
|
||||
RealmBuildInfo const* GetBuildInfo(uint32 build) const;
|
||||
[[nodiscard]] RealmBuildInfo const* GetBuildInfo(uint32 build) const;
|
||||
|
||||
private:
|
||||
RealmList();
|
||||
@@ -69,7 +69,7 @@ private:
|
||||
|
||||
std::vector<RealmBuildInfo> _builds;
|
||||
RealmMap _realms;
|
||||
uint32 _updateInterval;
|
||||
uint32 _updateInterval{0};
|
||||
std::unique_ptr<Acore::Asio::DeadlineTimer> _updateTimer;
|
||||
std::unique_ptr<Acore::Asio::Resolver> _resolver;
|
||||
};
|
||||
|
||||
@@ -42,7 +42,7 @@ struct SecretInfo
|
||||
int bits;
|
||||
ServerProcessTypes owner;
|
||||
uint64 _flags;
|
||||
uint16 flags() const { return static_cast<uint16>(_flags >> (16*THIS_SERVER_PROCESS)); }
|
||||
[[nodiscard]] uint16 flags() const { return static_cast<uint16>(_flags >> (16*THIS_SERVER_PROCESS)); }
|
||||
};
|
||||
|
||||
static constexpr SecretInfo secret_info[NUM_SECRETS] =
|
||||
|
||||
@@ -37,8 +37,8 @@ enum Secrets : uint32
|
||||
class AC_SHARED_API SecretMgr
|
||||
{
|
||||
private:
|
||||
SecretMgr() {}
|
||||
~SecretMgr() {}
|
||||
SecretMgr() = default;
|
||||
~SecretMgr() = default;
|
||||
|
||||
public:
|
||||
SecretMgr(SecretMgr const&) = delete;
|
||||
@@ -50,7 +50,7 @@ public:
|
||||
explicit operator bool() const { return (state == PRESENT); }
|
||||
BigNumber const& operator*() const { return value; }
|
||||
BigNumber const* operator->() const { return &value; }
|
||||
bool IsAvailable() const { return (state != NOT_LOADED_YET) && (state != LOAD_FAILED); }
|
||||
[[nodiscard]] bool IsAvailable() const { return (state != NOT_LOADED_YET) && (state != LOAD_FAILED); }
|
||||
|
||||
private:
|
||||
std::mutex lock;
|
||||
@@ -65,7 +65,7 @@ public:
|
||||
|
||||
private:
|
||||
void AttemptLoad(Secrets i, LogLevel errorLevel, std::unique_lock<std::mutex> const&);
|
||||
Optional<std::string> AttemptTransition(Secrets i, Optional<BigNumber> const& newSecret, Optional<BigNumber> const& oldSecret, bool hadOldSecret) const;
|
||||
[[nodiscard]] Optional<std::string> AttemptTransition(Secrets i, Optional<BigNumber> const& newSecret, Optional<BigNumber> const& oldSecret, bool hadOldSecret) const;
|
||||
|
||||
std::array<Secret, NUM_SECRETS> _secrets;
|
||||
};
|
||||
|
||||
@@ -159,7 +159,7 @@ AC_API_EXPORT EnumText EnumUtils<SpellAttr0>::ToString(SpellAttr0 value)
|
||||
{
|
||||
case SPELL_ATTR0_PROC_FAILURE_BURNS_CHARGE: return { "SPELL_ATTR0_PROC_FAILURE_BURNS_CHARGE", "Unknown attribute 0@Attr0", "" };
|
||||
case SPELL_ATTR0_USES_RANGED_SLOT: return { "SPELL_ATTR0_USES_RANGED_SLOT", "Treat as ranged attack", "Use ammo, ranged attack range modifiers, ranged haste, etc." };
|
||||
case SPELL_ATTR0_ON_NEXT_SWING_NO_DAMAGE: return { "SPELL_ATTR0_ON_NEXT_SWING_NO_DAMAGE", "On next melee (type 1)", "Both \042on next swing\042 attributes have identical handling in server & client" };
|
||||
case SPELL_ATTR0_ON_NEXT_SWING_NO_DAMAGE: return { "SPELL_ATTR0_ON_NEXT_SWING_NO_DAMAGE", "On next melee (type 1)", R"(Both "on next swing" attributes have identical handling in server & client)" };
|
||||
case SPELL_ATTR0_DO_NOT_LOG_IMMUNE_MISSES: return { "SPELL_ATTR0_DO_NOT_LOG_IMMUNE_MISSES", "Replenishment (client only)", "" };
|
||||
case SPELL_ATTR0_IS_ABILITY: return { "SPELL_ATTR0_IS_ABILITY", "Treat as ability", "Cannot be reflected, not affected by cast speed modifiers, etc." };
|
||||
case SPELL_ATTR0_IS_TRADESKILL: return { "SPELL_ATTR0_IS_TRADESKILL", "Trade skill recipe", "Displayed in recipe list, not affected by cast speed modifiers" };
|
||||
@@ -167,7 +167,7 @@ AC_API_EXPORT EnumText EnumUtils<SpellAttr0>::ToString(SpellAttr0 value)
|
||||
case SPELL_ATTR0_DO_NOT_DISPLAY: return { "SPELL_ATTR0_DO_NOT_DISPLAY", "Hidden in UI (client only)", "Not visible in spellbook or aura bar (Spellbook, Aura Icon, Combat Log)" };
|
||||
case SPELL_ATTR0_DO_NOT_LOG: return { "SPELL_ATTR0_DO_NOT_LOG", "Hidden in combat log (client only)", "Spell will not appear in combat logs" };
|
||||
case SPELL_ATTR0_HELD_ITEM_ONLY: return { "SPELL_ATTR0_HELD_ITEM_ONLY", "Auto-target mainhand item (client only)", "Client will automatically select main-hand item as cast target" };
|
||||
case SPELL_ATTR0_ON_NEXT_SWING: return { "SPELL_ATTR0_ON_NEXT_SWING", "On next melee (type 2)", "Both \042on next swing\042 attributes have identical handling in server & client" };
|
||||
case SPELL_ATTR0_ON_NEXT_SWING: return { "SPELL_ATTR0_ON_NEXT_SWING", "On next melee (type 2)", R"(Both "on next swing" attributes have identical handling in server & client)" };
|
||||
case SPELL_ATTR0_WEARER_CASTS_PROC_TRIGGER: return { "SPELL_ATTR0_WEARER_CASTS_PROC_TRIGGER", "Unknown attribute 11@Attr0", "" };
|
||||
case SPELL_ATTR0_SERVER_ONLY: return { "SPELL_ATTR0_SERVER_ONLY", "Only usable during daytime (unused)", "" };
|
||||
case SPELL_ATTR0_ALLOW_ITEM_SPELL_IN_PVP: return { "SPELL_ATTR0_ALLOW_ITEM_SPELL_IN_PVP", "Only usable during nighttime (unused)", "" };
|
||||
@@ -288,11 +288,11 @@ AC_API_EXPORT EnumText EnumUtils<SpellAttr1>::ToString(SpellAttr1 value)
|
||||
{
|
||||
case SPELL_ATTR1_DISMISS_PET_FIRST: return { "SPELL_ATTR1_DISMISS_PET_FIRST", "Dismiss Pet on cast", "Without this attribute, summoning spells will fail if caster already has a pet" };
|
||||
case SPELL_ATTR1_USE_ALL_MANA: return { "SPELL_ATTR1_USE_ALL_MANA", "Drain all power", "Ignores listed power cost and drains entire pool instead" };
|
||||
case SPELL_ATTR1_IS_CHANNELED: return { "SPELL_ATTR1_IS_CHANNELED", "Channeled (type 1)", "Both \042channeled\042 attributes have identical handling in server & client" };
|
||||
case SPELL_ATTR1_IS_CHANNELED: return { "SPELL_ATTR1_IS_CHANNELED", "Channeled (type 1)", R"(Both "channeled" attributes have identical handling in server & client)" };
|
||||
case SPELL_ATTR1_NO_REDIRECTION: return { "SPELL_ATTR1_NO_REDIRECTION", "Ignore redirection effects", "Spell will not be attracted by SPELL_MAGNET auras (Grounding Totem)" };
|
||||
case SPELL_ATTR1_NO_SKILL_INCREASE: return { "SPELL_ATTR1_NO_SKILL_INCREASE", "Unknown attribute 4@Attr1", "stealth and whirlwind" };
|
||||
case SPELL_ATTR1_ALLOW_WHILE_STEALTHED: return { "SPELL_ATTR1_ALLOW_WHILE_STEALTHED", "Does not break stealth", "" };
|
||||
case SPELL_ATTR1_IS_SELF_CHANNELED: return { "SPELL_ATTR1_IS_SELF_CHANNELED", "Channeled (type 2)", "Both \042channeled\042 attributes have identical handling in server & client" };
|
||||
case SPELL_ATTR1_IS_SELF_CHANNELED: return { "SPELL_ATTR1_IS_SELF_CHANNELED", "Channeled (type 2)", R"(Both "channeled" attributes have identical handling in server & client)" };
|
||||
case SPELL_ATTR1_NO_REFLECTION: return { "SPELL_ATTR1_NO_REFLECTION", "Ignore reflection effects", "Spell will pierce through Spell Reflection and similar" };
|
||||
case SPELL_ATTR1_ONLY_PEACEFUL_TARGETS: return { "SPELL_ATTR1_ONLY_PEACEFUL_TARGETS", "Target cannot be in combat", "" };
|
||||
case SPELL_ATTR1_INITIATE_COMBAT: return { "SPELL_ATTR1_INITIATE_COMBAT", "Enables Auto-Attack (client only)", "Caster will begin auto-attacking the target on cast" };
|
||||
|
||||
Reference in New Issue
Block a user