Eluna implementation (#847)

* azerothcore + eluna done.

* Remove the Eluna single thread limit.

* Read Eluna Settings file.

* submodule change.

* fix(test)  Ubuntu - Cant Link Library after Compile

* The ELUNA is disabled by default.

* remove submodule luaEngine.

* some change

* fix a error

* change cmake

* fix: some onplayerchat does not have hooks.

* Eluna: Add BG event Hooks.

* fix:cmake hook AFTER_LOAD_CONF not work.

* Remove the eluna switch.

* Remove some define in the core.

* fix conf file not read in the linux.

* eluna : change bg hook parameter type

* Remove TC log function call

* change bg hook OnBGEnd parameter type.


Note: to enable Eluna, the module is required
This commit is contained in:
ayase
2018-05-23 02:22:11 +08:00
committed by Barbz
parent 0da1f8c706
commit 00777a80ae
38 changed files with 854 additions and 62 deletions

View File

@@ -59,7 +59,11 @@ class DBCStorage
typedef std::list<char*> StringPoolList;
public:
explicit DBCStorage(char const* f)
#ifndef ELUNA
: fmt(f), nCount(0), fieldCount(0), dataTable(NULL)
#else
: fmt(f), nCount(0), fieldCount(0), dataTable(NULL), maxdatacount(0), mindatacount(std::numeric_limits<uint32>::max())
#endif
{
indexTable.asT = NULL;
}
@@ -68,10 +72,32 @@ class DBCStorage
T const* LookupEntry(uint32 id) const
{
#ifdef ELUNA
if (id <= maxdatacount && id >= mindatacount)
{
typename std::unordered_map<uint32, T const*>::const_iterator it = data.find(id);
if (it != data.end())
return it->second;
}
#endif
return (id >= nCount) ? NULL : indexTable.asT[id];
}
#ifdef ELUNA
void SetEntry(uint32 id, T* t)
{
delete data[id];
data[id] = t;
maxdatacount = std::max(maxdatacount, id);
mindatacount = std::min(mindatacount, id);
}
#endif
#ifndef ELUNA
uint32 GetNumRows() const { return nCount; }
#else
uint32 GetNumRows() const { return std::max(maxdatacount + 1, nCount); }
#endif
char const* GetFormat() const { return fmt; }
uint32 GetFieldCount() const { return fieldCount; }
@@ -248,6 +274,11 @@ class DBCStorage
void Clear()
{
#ifdef ELUNA
data.clear();
maxdatacount = 0;
mindatacount = std::numeric_limits<uint32>::max();
#endif
if (!indexTable.asT)
return;
@@ -279,6 +310,12 @@ class DBCStorage
T* dataTable;
StringPoolList stringPoolList;
#ifdef ELUNA
uint32 maxdatacount;
uint32 mindatacount;
std::unordered_map<uint32, T const*> data;
#endif
};
#endif

View File

@@ -61,6 +61,13 @@ class Field
return static_cast<int8>(atol((char*)data.value));
}
#ifdef ELUNA
enum_field_types GetType() const
{
return data.type;
}
#endif
uint16 GetUInt16() const
{
if (!data.value)

View File

@@ -185,6 +185,14 @@ bool PreparedResultSet::_NextRow()
return retval;
}
#ifdef ELUNA
char* ResultSet::GetFieldName(uint32 index) const
{
ASSERT(index < _fieldCount);
return _fields[index].name;
}
#endif
void ResultSet::CleanUp()
{
if (_currentRow)

View File

@@ -27,7 +27,9 @@ class ResultSet
bool NextRow();
uint64 GetRowCount() const { return _rowCount; }
uint32 GetFieldCount() const { return _fieldCount; }
#ifdef ELUNA
char* GetFieldName(uint32 index) const;
#endif
Field* Fetch() const { return _currentRow; }
const Field & operator [] (uint32 index) const
{