feat(Core/DBC): rework load DBC (#3002)

* Move DBC load system from TC
* Add db tables for all dbc
* Support override data from db
* Support override spells from db (#2994)
This commit is contained in:
Kargatum
2020-07-22 13:43:16 +07:00
committed by GitHub
parent 3cce44469a
commit 833611f1c5
19 changed files with 13497 additions and 843 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -1,25 +1,24 @@
/*
* Copyright (C) 2016+ AzerothCore <www.azerothcore.org>, released under GNU GPL v2 license: https://github.com/azerothcore/azerothcore-wotlk/blob/master/LICENSE-GPL2
* Copyright (C) 2008-2016 TrinityCore <http://www.trinitycore.org/>
* Copyright (C) 2008-2020 TrinityCore <http://www.trinitycore.org/>
* Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "DBCFileLoader.h"
#include "Errors.h"
DBCFileLoader::DBCFileLoader() : recordSize(0), recordCount(0), fieldCount(0), stringSize(0), fieldsOffset(NULL), data(NULL), stringTable(NULL) { }
DBCFileLoader::DBCFileLoader() : recordSize(0), recordCount(0), fieldCount(0), stringSize(0), fieldsOffset(nullptr), data(nullptr), stringTable(nullptr) { }
bool DBCFileLoader::Load(const char* filename, const char* fmt)
bool DBCFileLoader::Load(char const* filename, char const* fmt)
{
uint32 header;
if (data)
{
delete [] data;
data = NULL;
data = nullptr;
}
FILE* f = fopen(filename, "rb");
@@ -32,7 +31,6 @@ bool DBCFileLoader::Load(const char* filename, const char* fmt)
return false;
}
EndianConvert(header);
if (header != 0x43424457) //'WDBC'
@@ -75,6 +73,7 @@ bool DBCFileLoader::Load(const char* filename, const char* fmt)
fieldsOffset = new uint32[fieldCount];
fieldsOffset[0] = 0;
for (uint32 i = 1; i < fieldCount; ++i)
{
fieldsOffset[i] = fieldsOffset[i - 1];
@@ -100,23 +99,22 @@ bool DBCFileLoader::Load(const char* filename, const char* fmt)
DBCFileLoader::~DBCFileLoader()
{
if (data)
delete [] data;
delete[] data;
if (fieldsOffset)
delete [] fieldsOffset;
delete[] fieldsOffset;
}
DBCFileLoader::Record DBCFileLoader::getRecord(size_t id)
{
assert(data);
ASSERT(data);
return Record(*this, data + id * recordSize);
}
uint32 DBCFileLoader::GetFormatRecordSize(const char* format, int32* index_pos)
uint32 DBCFileLoader::GetFormatRecordSize(char const* format, int32* index_pos)
{
uint32 recordsize = 0;
int32 i = -1;
for (uint32 x = 0; format[x]; ++x)
{
switch (format[x])
@@ -158,7 +156,7 @@ uint32 DBCFileLoader::GetFormatRecordSize(const char* format, int32* index_pos)
return recordsize;
}
char* DBCFileLoader::AutoProduceData(const char* format, uint32& records, char**& indexTable, uint32 sqlRecordCount, uint32 sqlHighestIndex, char*& sqlDataTable)
char* DBCFileLoader::AutoProduceData(char const* format, uint32& records, char**& indexTable)
{
/*
format STRING, NA, FLOAT, NA, INT <=>
@@ -173,7 +171,7 @@ char* DBCFileLoader::AutoProduceData(const char* format, uint32& records, char**
typedef char* ptr;
if (strlen(format) != fieldCount)
return NULL;
return nullptr;
//get struct size and index pos
int32 i;
@@ -190,10 +188,6 @@ char* DBCFileLoader::AutoProduceData(const char* format, uint32& records, char**
maxi = ind;
}
// If higher index avalible from sql - use it instead of dbcs
if (sqlHighestIndex > maxi)
maxi = sqlHighestIndex;
++maxi;
records = maxi;
indexTable = new ptr[maxi];
@@ -201,11 +195,11 @@ char* DBCFileLoader::AutoProduceData(const char* format, uint32& records, char**
}
else
{
records = recordCount + sqlRecordCount;
indexTable = new ptr[recordCount + sqlRecordCount];
records = recordCount;
indexTable = new ptr[recordCount];
}
char* dataTable = new char[(recordCount + sqlRecordCount) * recordsize];
char* dataTable = new char[recordCount * recordsize];
uint32 offset = 0;
@@ -234,7 +228,7 @@ char* DBCFileLoader::AutoProduceData(const char* format, uint32& records, char**
offset += sizeof(uint8);
break;
case FT_STRING:
*((char**)(&dataTable[offset])) = NULL; // will replace non-empty or "" strings in AutoProduceStrings
*((char**)(&dataTable[offset])) = nullptr; // will replace non-empty or "" strings in AutoProduceStrings
offset += sizeof(char*);
break;
case FT_LOGIC:
@@ -251,15 +245,13 @@ char* DBCFileLoader::AutoProduceData(const char* format, uint32& records, char**
}
}
sqlDataTable = dataTable + offset;
return dataTable;
}
char* DBCFileLoader::AutoProduceStrings(const char* format, char* dataTable)
char* DBCFileLoader::AutoProduceStrings(char const* format, char* dataTable)
{
if (strlen(format) != fieldCount)
return NULL;
return nullptr;
char* stringPool = new char[stringSize];
memcpy(stringPool, stringTable, stringSize);
@@ -289,21 +281,21 @@ char* DBCFileLoader::AutoProduceStrings(const char* format, char* dataTable)
if (!*slot || !**slot)
{
const char * st = getRecord(y).getString(x);
*slot=stringPool+(st-(const char*)stringTable);
*slot = stringPool + (st - (char const*)stringTable);
}
offset += sizeof(char*);
break;
}
case FT_LOGIC:
ASSERT(false && "Attempted to load DBC files that does not have field types that match what is in the core. Check DBCfmt.h or your DBC files.");
break;
case FT_NA:
case FT_NA_BYTE:
case FT_SORT:
break;
default:
ASSERT(false && "Unknown field format character in DBCfmt.h");
break;
}
case FT_LOGIC:
ASSERT(false && "Attempted to load DBC files that does not have field types that match what is in the core. Check DBCfmt.h or your DBC files.");
break;
case FT_NA:
case FT_NA_BYTE:
case FT_SORT:
break;
default:
ASSERT(false && "Unknown field format character in DBCfmt.h");
break;
}
}
}

View File

@@ -1,98 +1,102 @@
/*
* Copyright (C) 2016+ AzerothCore <www.azerothcore.org>, released under GNU GPL v2 license: https://github.com/azerothcore/azerothcore-wotlk/blob/master/LICENSE-GPL2
* Copyright (C) 2008-2016 TrinityCore <http://www.trinitycore.org/>
* Copyright (C) 2008-2020 TrinityCore <http://www.trinitycore.org/>
* Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
*/
#ifndef DBC_FILE_LOADER_H
#define DBC_FILE_LOADER_H
#include "Define.h"
#include "Errors.h"
#include "Utilities/ByteConverter.h"
#include <cassert>
enum DbcFieldFormat
{
FT_NA='x', //not used or unknown, 4 byte size
FT_NA_BYTE='X', //not used or unknown, byte
FT_STRING='s', //char*
FT_FLOAT='f', //float
FT_INT='i', //uint32
FT_BYTE='b', //uint8
FT_SORT='d', //sorted by this field, field is not included
FT_IND='n', //the same, but parsed to data
FT_LOGIC='l', //Logical (boolean)
FT_SQL_PRESENT='p', //Used in sql format to mark column present in sql dbc
FT_SQL_ABSENT='a' //Used in sql format to mark column absent in sql dbc
FT_NA = 'x', //not used or unknown, 4 byte size
FT_NA_BYTE = 'X', //not used or unknown, byte
FT_STRING = 's', //char*
FT_FLOAT = 'f', //float
FT_INT = 'i', //uint32
FT_BYTE = 'b', //uint8
FT_SORT = 'd', //sorted by this field, field is not included
FT_IND = 'n', //the same, but parsed to data
FT_LOGIC = 'l' //Logical (boolean)
};
class DBCFileLoader
{
public:
DBCFileLoader();
~DBCFileLoader();
bool Load(const char *filename, const char *fmt);
class Record
{
public:
DBCFileLoader();
~DBCFileLoader();
bool Load(const char *filename, const char *fmt);
class Record
float getFloat(size_t field) const
{
public:
float getFloat(size_t field) const
{
assert(field < file.fieldCount);
float val = *reinterpret_cast<float*>(offset+file.GetOffset(field));
EndianConvert(val);
return val;
}
uint32 getUInt(size_t field) const
{
assert(field < file.fieldCount);
uint32 val = *reinterpret_cast<uint32*>(offset+file.GetOffset(field));
EndianConvert(val);
return val;
}
uint8 getUInt8(size_t field) const
{
assert(field < file.fieldCount);
return *reinterpret_cast<uint8*>(offset+file.GetOffset(field));
}
ASSERT(field < file.fieldCount);
float val = *reinterpret_cast<float*>(offset+file.GetOffset(field));
EndianConvert(val);
return val;
}
const char *getString(size_t field) const
{
assert(field < file.fieldCount);
size_t stringOffset = getUInt(field);
assert(stringOffset < file.stringSize);
return reinterpret_cast<char*>(file.stringTable + stringOffset);
}
uint32 getUInt(size_t field) const
{
ASSERT(field < file.fieldCount);
uint32 val = *reinterpret_cast<uint32*>(offset+file.GetOffset(field));
EndianConvert(val);
return val;
}
private:
Record(DBCFileLoader &file_, unsigned char *offset_): offset(offset_), file(file_) { }
unsigned char *offset;
DBCFileLoader &file;
uint8 getUInt8(size_t field) const
{
ASSERT(field < file.fieldCount);
return *reinterpret_cast<uint8*>(offset+file.GetOffset(field));
}
friend class DBCFileLoader;
const char *getString(size_t field) const
{
ASSERT(field < file.fieldCount);
size_t stringOffset = getUInt(field);
ASSERT(stringOffset < file.stringSize);
return reinterpret_cast<char*>(file.stringTable + stringOffset);
}
};
// Get record by id
Record getRecord(size_t id);
/// Get begin iterator over records
uint32 GetNumRows() const { return recordCount; }
uint32 GetRowSize() const { return recordSize; }
uint32 GetCols() const { return fieldCount; }
uint32 GetOffset(size_t id) const { return (fieldsOffset != NULL && id < fieldCount) ? fieldsOffset[id] : 0; }
bool IsLoaded() const { return data != NULL; }
char* AutoProduceData(const char* fmt, uint32& count, char**& indexTable, uint32 sqlRecordCount, uint32 sqlHighestIndex, char *& sqlDataTable);
char* AutoProduceStrings(const char* fmt, char* dataTable);
static uint32 GetFormatRecordSize(const char * format, int32 * index_pos = NULL);
private:
Record(DBCFileLoader &file_, unsigned char *offset_): offset(offset_), file(file_) { }
unsigned char *offset;
DBCFileLoader &file;
uint32 recordSize;
uint32 recordCount;
uint32 fieldCount;
uint32 stringSize;
uint32 *fieldsOffset;
unsigned char *data;
unsigned char *stringTable;
friend class DBCFileLoader;
};
// Get record by id
Record getRecord(size_t id);
uint32 GetNumRows() const { return recordCount; }
uint32 GetRowSize() const { return recordSize; }
uint32 GetCols() const { return fieldCount; }
uint32 GetOffset(size_t id) const { return (fieldsOffset != nullptr && id < fieldCount) ? fieldsOffset[id] : 0; }
bool IsLoaded() const { return data != nullptr; }
char* AutoProduceData(char const* fmt, uint32& count, char**& indexTable);
char* AutoProduceStrings(char const* fmt, char* dataTable);
static uint32 GetFormatRecordSize(const char * format, int32 * index_pos = nullptr);
private:
uint32 recordSize;
uint32 recordCount;
uint32 fieldCount;
uint32 stringSize;
uint32 *fieldsOffset;
unsigned char *data;
unsigned char *stringTable;
DBCFileLoader(DBCFileLoader const& right) = delete;
DBCFileLoader& operator=(DBCFileLoader const& right) = delete;
};
#endif

View File

@@ -1,322 +0,0 @@
/*
* Copyright (C) 2016+ AzerothCore <www.azerothcore.org>, released under GNU GPL v2 license: https://github.com/azerothcore/azerothcore-wotlk/blob/master/LICENSE-GPL2
* Copyright (C) 2008-2016 TrinityCore <http://www.trinitycore.org/>
* Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
*/
#ifndef DBCSTORE_H
#define DBCSTORE_H
#include "DBCFileLoader.h"
#include "Logging/Log.h"
#include "Field.h"
#include "DatabaseWorkerPool.h"
#include "Implementation/WorldDatabase.h"
#include "DatabaseEnv.h"
#include <unordered_map>
struct SqlDbc
{
std::string const* formatString;
std::string const* indexName;
std::string sqlTableName;
int32 indexPos;
int32 sqlIndexPos;
SqlDbc(std::string const* _filename, std::string const* _format, std::string const* _idname, char const* fmt)
: formatString(_format), indexName (_idname), sqlIndexPos(0)
{
// Convert dbc file name to sql table name
sqlTableName = *_filename;
for (uint32 i = 0; i< sqlTableName.size(); ++i)
{
if (isalpha(sqlTableName[i]))
sqlTableName[i] = char(tolower(sqlTableName[i]));
else if (sqlTableName[i] == '.')
sqlTableName[i] = '_';
}
// Get sql index position
DBCFileLoader::GetFormatRecordSize(fmt, &indexPos);
if (indexPos >= 0)
{
uint32 uindexPos = uint32(indexPos);
for (uint32 x = 0; x < formatString->size(); ++x)
{
// Count only fields present in sql
if ((*formatString)[x] == FT_SQL_PRESENT)
{
if (x == uindexPos)
break;
++sqlIndexPos;
}
}
}
}
};
template<class T>
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;
}
~DBCStorage() { Clear(); }
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; }
bool Load(char const* fn, SqlDbc* sql)
{
DBCFileLoader dbc;
// Check if load was sucessful, only then continue
if (!dbc.Load(fn, fmt))
return false;
uint32 sqlRecordCount = 0;
uint32 sqlHighestIndex = 0;
Field* fields = NULL;
QueryResult result = QueryResult(NULL);
// Load data from sql
if (sql)
{
std::string query = "SELECT * FROM " + sql->sqlTableName;
if (sql->indexPos >= 0)
query +=" ORDER BY " + *sql->indexName + " DESC";
query += ';';
result = WorldDatabase.Query(query.c_str());
if (result)
{
sqlRecordCount = uint32(result->GetRowCount());
if (sql->indexPos >= 0)
{
fields = result->Fetch();
sqlHighestIndex = fields[sql->sqlIndexPos].GetUInt32();
}
// Check if sql index pos is valid
if (int32(result->GetFieldCount() - 1) < sql->sqlIndexPos)
{
sLog->outError("Invalid index pos for dbc:'%s'", sql->sqlTableName.c_str());
return false;
}
}
}
char* sqlDataTable = NULL;
fieldCount = dbc.GetCols();
dataTable = reinterpret_cast<T*>(dbc.AutoProduceData(fmt, nCount, indexTable.asChar,
sqlRecordCount, sqlHighestIndex, sqlDataTable));
stringPoolList.push_back(dbc.AutoProduceStrings(fmt, reinterpret_cast<char*>(dataTable)));
// Insert sql data into arrays
if (result)
{
if (indexTable.asT)
{
uint32 offset = 0;
uint32 rowIndex = dbc.GetNumRows();
do
{
if (!fields)
fields = result->Fetch();
if (sql->indexPos >= 0)
{
uint32 id = fields[sql->sqlIndexPos].GetUInt32();
if (indexTable.asT[id])
{
sLog->outError("Index %d already exists in dbc:'%s'", id, sql->sqlTableName.c_str());
return false;
}
indexTable.asT[id] = reinterpret_cast<T*>(&sqlDataTable[offset]);
}
else
indexTable.asT[rowIndex]= reinterpret_cast<T*>(&sqlDataTable[offset]);
uint32 columnNumber = 0;
uint32 sqlColumnNumber = 0;
for (; columnNumber < sql->formatString->size(); ++columnNumber)
{
if ((*sql->formatString)[columnNumber] == FT_SQL_ABSENT)
{
switch (fmt[columnNumber])
{
case FT_FLOAT:
*reinterpret_cast<float*>(&sqlDataTable[offset]) = 0.0f;
offset += 4;
break;
case FT_IND:
case FT_INT:
*reinterpret_cast<uint32*>(&sqlDataTable[offset]) = uint32(0);
offset += 4;
break;
case FT_BYTE:
*reinterpret_cast<uint8*>(&sqlDataTable[offset]) = uint8(0);
offset += 1;
break;
case FT_STRING:
// Beginning of the pool - empty string
*reinterpret_cast<char**>(&sqlDataTable[offset]) = stringPoolList.back();
offset += sizeof(char*);
break;
}
}
else if ((*sql->formatString)[columnNumber] == FT_SQL_PRESENT)
{
bool validSqlColumn = true;
switch (fmt[columnNumber])
{
case FT_FLOAT:
*reinterpret_cast<float*>(&sqlDataTable[offset]) = fields[sqlColumnNumber].GetFloat();
offset += 4;
break;
case FT_IND:
case FT_INT:
*reinterpret_cast<uint32*>(&sqlDataTable[offset]) = fields[sqlColumnNumber].GetUInt32();
offset += 4;
break;
case FT_BYTE:
*reinterpret_cast<uint8*>(&sqlDataTable[offset]) = fields[sqlColumnNumber].GetUInt8();
offset += 1;
break;
case FT_STRING:
sLog->outError("Unsupported data type in table '%s' at char %d", sql->sqlTableName.c_str(), columnNumber);
return false;
case FT_SORT:
break;
default:
validSqlColumn = false;
break;
}
if (validSqlColumn && (columnNumber != (sql->formatString->size()-1)))
sqlColumnNumber++;
}
else
{
sLog->outError("Incorrect sql format string '%s' at char %d", sql->sqlTableName.c_str(), columnNumber);
return false;
}
}
if (sqlColumnNumber != (result->GetFieldCount() - 1))
{
sLog->outError("SQL and DBC format strings are not matching for table: '%s'", sql->sqlTableName.c_str());
return false;
}
fields = NULL;
++rowIndex;
} while (result->NextRow());
}
}
// error in dbc file at loading if NULL
return indexTable.asT != NULL;
}
bool LoadStringsFrom(char const* fn)
{
// DBC must be already loaded using Load
if (!indexTable.asT)
return false;
DBCFileLoader dbc;
// Check if load was successful, only then continue
if (!dbc.Load(fn, fmt))
return false;
stringPoolList.push_back(dbc.AutoProduceStrings(fmt, reinterpret_cast<char*>(dataTable)));
return true;
}
void Clear()
{
#ifdef ELUNA
data.clear();
maxdatacount = 0;
mindatacount = std::numeric_limits<uint32>::max();
#endif
if (!indexTable.asT)
return;
delete[] reinterpret_cast<char*>(indexTable.asT);
indexTable.asT = NULL;
delete[] reinterpret_cast<char*>(dataTable);
dataTable = NULL;
while (!stringPoolList.empty())
{
delete[] stringPoolList.front();
stringPoolList.pop_front();
}
nCount = 0;
}
private:
char const* fmt;
uint32 nCount;
uint32 fieldCount;
union
{
T** asT;
char** asChar;
}
indexTable;
T* dataTable;
StringPoolList stringPoolList;
#ifdef ELUNA
uint32 maxdatacount;
uint32 mindatacount;
std::unordered_map<uint32, T const*> data;
#endif
};
#endif

View File

@@ -37,7 +37,8 @@ target_include_directories(game-interface
target_link_libraries(game-interface
INTERFACE
common)
common
shared)
add_library(game STATIC
${PRIVATE_SOURCES}

View File

@@ -1,42 +1,26 @@
/*
* Copyright (C) 2016+ AzerothCore <www.azerothcore.org>, released under GNU GPL v2 license: https://github.com/azerothcore/azerothcore-wotlk/blob/master/LICENSE-GPL2
* Copyright (C) 2008-2016 TrinityCore <http://www.trinitycore.org/>
* Copyright (C) 2008-2020 TrinityCore <http://www.trinitycore.org/>
* Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
*/
#include "DBCStores.h"
#include "DBCFileLoader.h"
#include "DBCfmt.h"
#include "Errors.h"
#include "Log.h"
#include "SharedDefines.h"
#include "SpellMgr.h"
#include "TransportMgr.h"
#include "DBCfmt.h"
#include "BattlegroundMgr.h"
#include "World.h"
#include <map>
typedef std::map<uint16, uint32> AreaFlagByAreaID;
typedef std::map<uint32, uint32> AreaFlagByMapID;
struct WMOAreaTableTripple
{
WMOAreaTableTripple(int32 r, int32 a, int32 g) : groupId(g), rootId(r), adtId(a)
{
}
bool operator <(const WMOAreaTableTripple& b) const
{
return memcmp(this, &b, sizeof(WMOAreaTableTripple))<0;
}
// ordered by entropy; that way memcmp will have a minimal medium runtime
int32 groupId;
int32 rootId;
int32 adtId;
};
typedef std::map<WMOAreaTableTripple, WMOAreaTableEntry const*> WMOAreaInfoByTripple;
typedef std::tuple<int16, int8, int32> WMOAreaTableKey;
typedef std::map<WMOAreaTableKey, WMOAreaTableEntry const*> WMOAreaInfoByTripple;
DBCStorage <AreaTableEntry> sAreaTableStore(AreaTableEntryfmt);
DBCStorage <AreaGroupEntry> sAreaGroupStore(AreaGroupEntryfmt);
@@ -200,18 +184,16 @@ static bool LoadDBC_assert_print(uint32 fsize, uint32 rsize, const std::string&
}
template<class T>
inline void LoadDBC(uint32& availableDbcLocales, StoreProblemList& errors, DBCStorage<T>& storage, std::string const& dbcPath, std::string const& filename, std::string const* customFormat = NULL, std::string const* customIndexName = NULL)
inline void LoadDBC(uint32& availableDbcLocales, StoreProblemList& errors, DBCStorage<T>& storage, std::string const& dbcPath, std::string const& filename, char const* dbTable = nullptr)
{
// compatibility format and C++ structure sizes
ASSERT(DBCFileLoader::GetFormatRecordSize(storage.GetFormat()) == sizeof(T) || LoadDBC_assert_print(DBCFileLoader::GetFormatRecordSize(storage.GetFormat()), sizeof(T), filename));
++DBCFileCount;
std::string dbcFilename = dbcPath + filename;
SqlDbc * sql = NULL;
if (customFormat)
sql = new SqlDbc(&filename, customFormat, customIndexName, storage.GetFormat());
bool existDBData = false;
if (storage.Load(dbcFilename.c_str(), sql))
if (storage.Load(dbcFilename.c_str()))
{
for (uint8 i = 0; i < TOTAL_LOCALES; ++i)
{
@@ -224,10 +206,17 @@ inline void LoadDBC(uint32& availableDbcLocales, StoreProblemList& errors, DBCSt
localizedName.append(filename);
if (!storage.LoadStringsFrom(localizedName.c_str()))
availableDbcLocales &= ~(1<<i); // mark as not available for speedup next checks
availableDbcLocales &= ~(1 << i); // mark as not available for speedup next checks
}
}
else
if (dbTable)
storage.LoadFromDB(dbTable, storage.GetFormat());
if (storage.GetNumRows())
existDBData = true;
if (!existDBData)
{
// sort problematic dbc to (1) non compatible and (2) non-existed
if (FILE* f = fopen(dbcFilename.c_str(), "rb"))
@@ -241,236 +230,215 @@ inline void LoadDBC(uint32& availableDbcLocales, StoreProblemList& errors, DBCSt
else
errors.push_back(dbcFilename);
}
delete sql;
}
void LoadDBCStores(const std::string& dataPath)
{
uint32 oldMSTime = getMSTime();
std::string dbcPath = dataPath+"dbc/";
std::string dbcPath = dataPath + "dbc/";
StoreProblemList bad_dbc_files;
uint32 availableDbcLocales = 0xFFFFFFFF;
LoadDBC(availableDbcLocales, bad_dbc_files, sAreaTableStore, dbcPath, "AreaTable.dbc");
#define LOAD_DBC(store, file, dbtable) LoadDBC(availableDbcLocales, bad_dbc_files, store, dbcPath, file, dbtable)
LoadDBC(availableDbcLocales, bad_dbc_files, sAchievementStore, dbcPath, "Achievement.dbc", &CustomAchievementfmt, &CustomAchievementIndex);
LoadDBC(availableDbcLocales, bad_dbc_files, sAchievementCategoryStore, dbcPath, "Achievement_Category.dbc");
LoadDBC(availableDbcLocales, bad_dbc_files, sAchievementCriteriaStore, dbcPath, "Achievement_Criteria.dbc");
LoadDBC(availableDbcLocales, bad_dbc_files, sAreaGroupStore, dbcPath, "AreaGroup.dbc");
LoadDBC(availableDbcLocales, bad_dbc_files, sAreaPOIStore, dbcPath, "AreaPOI.dbc");
LoadDBC(availableDbcLocales, bad_dbc_files, sAuctionHouseStore, dbcPath, "AuctionHouse.dbc");
LoadDBC(availableDbcLocales, bad_dbc_files, sBankBagSlotPricesStore, dbcPath, "BankBagSlotPrices.dbc");
LoadDBC(availableDbcLocales, bad_dbc_files, sBattlemasterListStore, dbcPath, "BattlemasterList.dbc");
LoadDBC(availableDbcLocales, bad_dbc_files, sBarberShopStyleStore, dbcPath, "BarberShopStyle.dbc");
LoadDBC(availableDbcLocales, bad_dbc_files, sCharStartOutfitStore, dbcPath, "CharStartOutfit.dbc");
for (uint32 i = 0; i < sCharStartOutfitStore.GetNumRows(); ++i)
if (CharStartOutfitEntry const* outfit = sCharStartOutfitStore.LookupEntry(i))
sCharStartOutfitMap[outfit->Race | (outfit->Class << 8) | (outfit->Gender << 16)] = outfit;
LOAD_DBC(sAreaTableStore, "AreaTable.dbc", "areatable_dbc");
LOAD_DBC(sAchievementStore, "Achievement.dbc", "achievement_dbc");
LOAD_DBC(sAchievementCategoryStore, "Achievement_Category.dbc", "achievement_category_dbc");
LOAD_DBC(sAchievementCriteriaStore, "Achievement_Criteria.dbc", "achievement_criteria_dbc");
LOAD_DBC(sAreaGroupStore, "AreaGroup.dbc", "areagroup_dbc");
LOAD_DBC(sAreaPOIStore, "AreaPOI.dbc", "areapoi_dbc");
LOAD_DBC(sAuctionHouseStore, "AuctionHouse.dbc", "auctionhouse_dbc");
LOAD_DBC(sBankBagSlotPricesStore, "BankBagSlotPrices.dbc", "bankbagslotprices_dbc");
LOAD_DBC(sBattlemasterListStore, "BattlemasterList.dbc", "battlemasterlist_dbc");
LOAD_DBC(sBarberShopStyleStore, "BarberShopStyle.dbc", "barbershopstyle_dbc");
LOAD_DBC(sCharStartOutfitStore, "CharStartOutfit.dbc", "charstartoutfit_dbc");
LOAD_DBC(sCharTitlesStore, "CharTitles.dbc", "chartitles_dbc");
LOAD_DBC(sChatChannelsStore, "ChatChannels.dbc", "chatchannels_dbc");
LOAD_DBC(sChrClassesStore, "ChrClasses.dbc", "chrclasses_dbc");
LOAD_DBC(sChrRacesStore, "ChrRaces.dbc", "chrraces_dbc");
LOAD_DBC(sCinematicSequencesStore, "CinematicSequences.dbc", "cinematicsequences_dbc");
LOAD_DBC(sCreatureDisplayInfoStore, "CreatureDisplayInfo.dbc", "creaturedisplayinfo_dbc");
LOAD_DBC(sCreatureFamilyStore, "CreatureFamily.dbc", "creaturefamily_dbc");
LOAD_DBC(sCreatureModelDataStore, "CreatureModelData.dbc", "creaturemodeldata_dbc");
LOAD_DBC(sCreatureSpellDataStore, "CreatureSpellData.dbc", "creaturespelldata_dbc");
LOAD_DBC(sCreatureTypeStore, "CreatureType.dbc", "creaturetype_dbc");
LOAD_DBC(sCurrencyTypesStore, "CurrencyTypes.dbc", "currencytypes_dbc");
LOAD_DBC(sDestructibleModelDataStore, "DestructibleModelData.dbc", "destructiblemodeldata_dbc");
LOAD_DBC(sDungeonEncounterStore, "DungeonEncounter.dbc", "dungeonencounter_dbc");
LOAD_DBC(sDurabilityCostsStore, "DurabilityCosts.dbc", "durabilitycosts_dbc");
LOAD_DBC(sDurabilityQualityStore, "DurabilityQuality.dbc", "durabilityquality_dbc");
LOAD_DBC(sEmotesStore, "Emotes.dbc", "emotes_dbc");
LOAD_DBC(sEmotesTextStore, "EmotesText.dbc", "emotestext_dbc");
LOAD_DBC(sFactionStore, "Faction.dbc", "faction_dbc");
LOAD_DBC(sFactionTemplateStore, "FactionTemplate.dbc", "factiontemplate_dbc");
LOAD_DBC(sGameObjectDisplayInfoStore, "GameObjectDisplayInfo.dbc", "gameobjectdisplayinfo_dbc");
LOAD_DBC(sGemPropertiesStore, "GemProperties.dbc", "gemproperties_dbc");
LOAD_DBC(sGlyphPropertiesStore, "GlyphProperties.dbc", "glyphproperties_dbc");
LOAD_DBC(sGlyphSlotStore, "GlyphSlot.dbc", "glyphslot_dbc");
LOAD_DBC(sGtBarberShopCostBaseStore, "gtBarberShopCostBase.dbc", "gtbarbershopcostbase_dbc");
LOAD_DBC(sGtCombatRatingsStore, "gtCombatRatings.dbc", "gtcombatratings_dbc");
LOAD_DBC(sGtChanceToMeleeCritBaseStore, "gtChanceToMeleeCritBase.dbc", "gtchancetomeleecritbase_dbc");
LOAD_DBC(sGtChanceToMeleeCritStore, "gtChanceToMeleeCrit.dbc", "gtchancetomeleecrit_dbc");
LOAD_DBC(sGtChanceToSpellCritBaseStore, "gtChanceToSpellCritBase.dbc", "gtchancetospellcritbase_dbc");
LOAD_DBC(sGtChanceToSpellCritStore, "gtChanceToSpellCrit.dbc", "gtchancetospellcrit_dbc");
LOAD_DBC(sGtNPCManaCostScalerStore, "gtNPCManaCostScaler.dbc", "gtnpcmanacostscaler_dbc");
LOAD_DBC(sGtOCTClassCombatRatingScalarStore, "gtOCTClassCombatRatingScalar.dbc", "gtoctclasscombatratingscalar_dbc");
LOAD_DBC(sGtOCTRegenHPStore, "gtOCTRegenHP.dbc", "gtoctregenhp_dbc");
//LOAD_DBC(sGtOCTRegenMPStore, "gtOCTRegenMP.dbc", "gtoctregenmp_dbc"); -- not used currently
LOAD_DBC(sGtRegenHPPerSptStore, "gtRegenHPPerSpt.dbc", "gtregenhpperspt_dbc");
LOAD_DBC(sGtRegenMPPerSptStore, "gtRegenMPPerSpt.dbc", "gtregenmpperspt_dbc");
LOAD_DBC(sHolidaysStore, "Holidays.dbc", "holidays_dbc");
LOAD_DBC(sItemBagFamilyStore, "ItemBagFamily.dbc", "itembagfamily_dbc");
LOAD_DBC(sItemDisplayInfoStore, "ItemDisplayInfo.dbc", "itemdisplayinfo_dbc");
//LOAD_DBC(sItemCondExtCostsStore, "ItemCondExtCosts.dbc", "itemcondextcosts_dbc");
LOAD_DBC(sItemExtendedCostStore, "ItemExtendedCost.dbc", "itemextendedcost_dbc");
LOAD_DBC(sItemLimitCategoryStore, "ItemLimitCategory.dbc", "itemlimitcategory_dbc");
LOAD_DBC(sItemRandomPropertiesStore, "ItemRandomProperties.dbc", "itemrandomproperties_dbc");
LOAD_DBC(sItemRandomSuffixStore, "ItemRandomSuffix.dbc", "itemrandomsuffix_dbc");
LOAD_DBC(sItemSetStore, "ItemSet.dbc", "itemset_dbc");
LOAD_DBC(sLFGDungeonStore, "LFGDungeons.dbc", "lfgdungeons_dbc");
LOAD_DBC(sLightStore, "Light.dbc", "light_dbc");
LOAD_DBC(sLiquidTypeStore, "LiquidType.dbc", "liquidtype_dbc");
LOAD_DBC(sLockStore, "Lock.dbc", "lock_dbc");
LOAD_DBC(sMailTemplateStore, "MailTemplate.dbc", "mailtemplate_dbc");
LOAD_DBC(sMapStore, "Map.dbc", "map_dbc");
LOAD_DBC(sMapDifficultyStore, "MapDifficulty.dbc", "mapdifficulty_dbc");
LOAD_DBC(sMovieStore, "Movie.dbc", "movie_dbc");
LOAD_DBC(sOverrideSpellDataStore, "OverrideSpellData.dbc", "overridespelldata_dbc");
LOAD_DBC(sPowerDisplayStore, "PowerDisplay.dbc", "powerdisplay_dbc");
LOAD_DBC(sPvPDifficultyStore, "PvpDifficulty.dbc", "pvpdifficulty_dbc");
LOAD_DBC(sQuestXPStore, "QuestXP.dbc", "questxp_dbc");
LOAD_DBC(sQuestFactionRewardStore, "QuestFactionReward.dbc", "questfactionreward_dbc");
LOAD_DBC(sQuestSortStore, "QuestSort.dbc", "questsort_dbc");
LOAD_DBC(sRandomPropertiesPointsStore, "RandPropPoints.dbc", "randproppoints_dbc");
LOAD_DBC(sScalingStatDistributionStore, "ScalingStatDistribution.dbc", "scalingstatdistribution_dbc");
LOAD_DBC(sScalingStatValuesStore, "ScalingStatValues.dbc", "scalingstatvalues_dbc");
LOAD_DBC(sSkillLineStore, "SkillLine.dbc", "skillline_dbc");
LOAD_DBC(sSkillLineAbilityStore, "SkillLineAbility.dbc", "skilllineability_dbc");
LOAD_DBC(sSoundEntriesStore, "SoundEntries.dbc", "soundentries_dbc");
LOAD_DBC(sSpellStore, "Spell.dbc", "spell_dbc");
LOAD_DBC(sSpellCastTimesStore, "SpellCastTimes.dbc", "spellcasttimes_dbc");
LOAD_DBC(sSpellCategoryStore, "SpellCategory.dbc", "spellcategory_dbc");
LOAD_DBC(sSpellDifficultyStore, "SpellDifficulty.dbc", "spelldifficulty_dbc");
LOAD_DBC(sSpellDurationStore, "SpellDuration.dbc", "spellduration_dbc");
LOAD_DBC(sSpellFocusObjectStore, "SpellFocusObject.dbc", "spellfocusobject_dbc");
LOAD_DBC(sSpellItemEnchantmentStore, "SpellItemEnchantment.dbc", "spellitemenchantment_dbc");
LOAD_DBC(sSpellItemEnchantmentConditionStore, "SpellItemEnchantmentCondition.dbc", "spellitemenchantmentcondition_dbc");
LOAD_DBC(sSpellRadiusStore, "SpellRadius.dbc", "spellradius_dbc");
LOAD_DBC(sSpellRangeStore, "SpellRange.dbc", "spellrange_dbc");
LOAD_DBC(sSpellRuneCostStore, "SpellRuneCost.dbc", "spellrunecost_dbc");
LOAD_DBC(sSpellShapeshiftStore, "SpellShapeshiftForm.dbc", "spellshapeshiftform_dbc");
LOAD_DBC(sStableSlotPricesStore, "StableSlotPrices.dbc", "stableslotprices_dbc");
LOAD_DBC(sSummonPropertiesStore, "SummonProperties.dbc", "summonproperties_dbc");
LOAD_DBC(sTalentStore, "Talent.dbc", "talent_dbc");
LOAD_DBC(sTalentTabStore, "TalentTab.dbc", "talenttab_dbc");
LOAD_DBC(sTaxiNodesStore, "TaxiNodes.dbc", "taxinodes_dbc");
LOAD_DBC(sTaxiPathStore, "TaxiPath.dbc", "taxipath_dbc");
LOAD_DBC(sTaxiPathNodeStore, "TaxiPathNode.dbc", "taxipathnode_dbc");
LOAD_DBC(sTeamContributionPointsStore, "TeamContributionPoints.dbc", "teamcontributionpoints_dbc");
LOAD_DBC(sTotemCategoryStore, "TotemCategory.dbc", "totemcategory_dbc");
LOAD_DBC(sTransportAnimationStore, "TransportAnimation.dbc", "transportanimation_dbc");
LOAD_DBC(sTransportRotationStore, "TransportRotation.dbc", "transportrotation_dbc");
LOAD_DBC(sVehicleStore, "Vehicle.dbc", "vehicle_dbc");
LOAD_DBC(sVehicleSeatStore, "VehicleSeat.dbc", "vehicleseat_dbc");
LOAD_DBC(sWMOAreaTableStore, "WMOAreaTable.dbc", "wmoareatable_dbc");
LOAD_DBC(sWorldMapAreaStore, "WorldMapArea.dbc", "worldmaparea_dbc");
LOAD_DBC(sWorldMapOverlayStore, "WorldMapOverlay.dbc", "worldmapoverlay_dbc");
LoadDBC(availableDbcLocales, bad_dbc_files, sCharTitlesStore, dbcPath, "CharTitles.dbc");
LoadDBC(availableDbcLocales, bad_dbc_files, sChatChannelsStore, dbcPath, "ChatChannels.dbc");
LoadDBC(availableDbcLocales, bad_dbc_files, sChrClassesStore, dbcPath, "ChrClasses.dbc");
LoadDBC(availableDbcLocales, bad_dbc_files, sChrRacesStore, dbcPath, "ChrRaces.dbc");
LoadDBC(availableDbcLocales, bad_dbc_files, sCinematicSequencesStore, dbcPath, "CinematicSequences.dbc");
LoadDBC(availableDbcLocales, bad_dbc_files, sCreatureDisplayInfoStore, dbcPath, "CreatureDisplayInfo.dbc");
LoadDBC(availableDbcLocales, bad_dbc_files, sCreatureFamilyStore, dbcPath, "CreatureFamily.dbc");
LoadDBC(availableDbcLocales, bad_dbc_files, sCreatureModelDataStore, dbcPath, "CreatureModelData.dbc");
LoadDBC(availableDbcLocales, bad_dbc_files, sCreatureSpellDataStore, dbcPath, "CreatureSpellData.dbc");
LoadDBC(availableDbcLocales, bad_dbc_files, sCreatureTypeStore, dbcPath, "CreatureType.dbc");
LoadDBC(availableDbcLocales, bad_dbc_files, sCurrencyTypesStore, dbcPath, "CurrencyTypes.dbc");
LoadDBC(availableDbcLocales, bad_dbc_files, sDestructibleModelDataStore, dbcPath, "DestructibleModelData.dbc");
LoadDBC(availableDbcLocales, bad_dbc_files, sDungeonEncounterStore, dbcPath, "DungeonEncounter.dbc");
LoadDBC(availableDbcLocales, bad_dbc_files, sDurabilityCostsStore, dbcPath, "DurabilityCosts.dbc");
LoadDBC(availableDbcLocales, bad_dbc_files, sDurabilityQualityStore, dbcPath, "DurabilityQuality.dbc");
LoadDBC(availableDbcLocales, bad_dbc_files, sEmotesStore, dbcPath, "Emotes.dbc");
LoadDBC(availableDbcLocales, bad_dbc_files, sEmotesTextStore, dbcPath, "EmotesText.dbc");
LoadDBC(availableDbcLocales, bad_dbc_files, sFactionStore, dbcPath, "Faction.dbc");
for (uint32 i=0; i<sFactionStore.GetNumRows(); ++i)
#undef LOAD_DBC
for (CharStartOutfitEntry const* outfit : sCharStartOutfitStore)
sCharStartOutfitMap[outfit->Race | (outfit->Class << 8) | (outfit->Gender << 16)] = outfit;
for (FactionEntry const* faction : sFactionStore)
{
FactionEntry const* faction = sFactionStore.LookupEntry(i);
if (faction && faction->team)
if (faction->team)
{
SimpleFactionsList &flist = sFactionTeamMap[faction->team];
flist.push_back(i);
SimpleFactionsList& flist = sFactionTeamMap[faction->team];
flist.push_back(faction->ID);
}
}
LoadDBC(availableDbcLocales, bad_dbc_files, sFactionTemplateStore, dbcPath, "FactionTemplate.dbc");
LoadDBC(availableDbcLocales, bad_dbc_files, sGameObjectDisplayInfoStore, dbcPath, "GameObjectDisplayInfo.dbc");
for (uint32 i = 0; i < sGameObjectDisplayInfoStore.GetNumRows(); ++i)
for (GameObjectDisplayInfoEntry const* info : sGameObjectDisplayInfoStore)
{
if (GameObjectDisplayInfoEntry const* info = sGameObjectDisplayInfoStore.LookupEntry(i))
{
if (info->maxX < info->minX)
std::swap(*(float*)(&info->maxX), *(float*)(&info->minX));
if (info->maxY < info->minY)
std::swap(*(float*)(&info->maxY), *(float*)(&info->minY));
if (info->maxZ < info->minZ)
std::swap(*(float*)(&info->maxZ), *(float*)(&info->minZ));
}
if (info->maxX < info->minX)
std::swap(*(float*)(&info->maxX), *(float*)(&info->minX));
if (info->maxY < info->minY)
std::swap(*(float*)(&info->maxY), *(float*)(&info->minY));
if (info->maxZ < info->minZ)
std::swap(*(float*)(&info->maxZ), *(float*)(&info->minZ));
}
LoadDBC(availableDbcLocales, bad_dbc_files, sGemPropertiesStore, dbcPath, "GemProperties.dbc");
LoadDBC(availableDbcLocales, bad_dbc_files, sGlyphPropertiesStore, dbcPath, "GlyphProperties.dbc");
LoadDBC(availableDbcLocales, bad_dbc_files, sGlyphSlotStore, dbcPath, "GlyphSlot.dbc");
LoadDBC(availableDbcLocales, bad_dbc_files, sGtBarberShopCostBaseStore, dbcPath, "gtBarberShopCostBase.dbc");
LoadDBC(availableDbcLocales, bad_dbc_files, sGtCombatRatingsStore, dbcPath, "gtCombatRatings.dbc");
LoadDBC(availableDbcLocales, bad_dbc_files, sGtChanceToMeleeCritBaseStore, dbcPath, "gtChanceToMeleeCritBase.dbc");
LoadDBC(availableDbcLocales, bad_dbc_files, sGtChanceToMeleeCritStore, dbcPath, "gtChanceToMeleeCrit.dbc");
LoadDBC(availableDbcLocales, bad_dbc_files, sGtChanceToSpellCritBaseStore, dbcPath, "gtChanceToSpellCritBase.dbc");
LoadDBC(availableDbcLocales, bad_dbc_files, sGtChanceToSpellCritStore, dbcPath, "gtChanceToSpellCrit.dbc");
LoadDBC(availableDbcLocales, bad_dbc_files, sGtNPCManaCostScalerStore, dbcPath, "gtNPCManaCostScaler.dbc");
LoadDBC(availableDbcLocales, bad_dbc_files, sGtOCTClassCombatRatingScalarStore, dbcPath, "gtOCTClassCombatRatingScalar.dbc");
LoadDBC(availableDbcLocales, bad_dbc_files, sGtOCTRegenHPStore, dbcPath, "gtOCTRegenHP.dbc");
//LoadDBC(dbcCount, availableDbcLocales, bad_dbc_files, sGtOCTRegenMPStore, dbcPath, "gtOCTRegenMP.dbc"); -- not used currently
LoadDBC(availableDbcLocales, bad_dbc_files, sGtRegenHPPerSptStore, dbcPath, "gtRegenHPPerSpt.dbc");
LoadDBC(availableDbcLocales, bad_dbc_files, sGtRegenMPPerSptStore, dbcPath, "gtRegenMPPerSpt.dbc");
LoadDBC(availableDbcLocales, bad_dbc_files, sHolidaysStore, dbcPath, "Holidays.dbc");
LoadDBC(availableDbcLocales, bad_dbc_files, sItemBagFamilyStore, dbcPath, "ItemBagFamily.dbc");
LoadDBC(availableDbcLocales, bad_dbc_files, sItemDisplayInfoStore, dbcPath, "ItemDisplayInfo.dbc");
//LoadDBC(dbcCount, availableDbcLocales, bad_dbc_files, sItemCondExtCostsStore, dbcPath, "ItemCondExtCosts.dbc");
LoadDBC(availableDbcLocales, bad_dbc_files, sItemExtendedCostStore, dbcPath, "ItemExtendedCost.dbc");
LoadDBC(availableDbcLocales, bad_dbc_files, sItemLimitCategoryStore, dbcPath, "ItemLimitCategory.dbc");
LoadDBC(availableDbcLocales, bad_dbc_files, sItemRandomPropertiesStore, dbcPath, "ItemRandomProperties.dbc");
LoadDBC(availableDbcLocales, bad_dbc_files, sItemRandomSuffixStore, dbcPath, "ItemRandomSuffix.dbc");
LoadDBC(availableDbcLocales, bad_dbc_files, sItemSetStore, dbcPath, "ItemSet.dbc");
LoadDBC(availableDbcLocales, bad_dbc_files, sLFGDungeonStore, dbcPath, "LFGDungeons.dbc");
LoadDBC(availableDbcLocales, bad_dbc_files, sLightStore, dbcPath, "Light.dbc");
LoadDBC(availableDbcLocales, bad_dbc_files, sLiquidTypeStore, dbcPath, "LiquidType.dbc");
LoadDBC(availableDbcLocales, bad_dbc_files, sLockStore, dbcPath, "Lock.dbc");
LoadDBC(availableDbcLocales, bad_dbc_files, sMailTemplateStore, dbcPath, "MailTemplate.dbc");
LoadDBC(availableDbcLocales, bad_dbc_files, sMapStore, dbcPath, "Map.dbc");
LoadDBC(availableDbcLocales, bad_dbc_files, sMapDifficultyStore, dbcPath, "MapDifficulty.dbc");
// fill data
for (uint32 i = 1; i < sMapDifficultyStore.GetNumRows(); ++i)
if (MapDifficultyEntry const* entry = sMapDifficultyStore.LookupEntry(i))
sMapDifficultyMap[MAKE_PAIR32(entry->MapId, entry->Difficulty)] = MapDifficulty(entry->resetTime, entry->maxPlayers, entry->areaTriggerText[0] != '\0');
sMapDifficultyStore.Clear();
for (MapDifficultyEntry const* entry : sMapDifficultyStore)
sMapDifficultyMap[MAKE_PAIR32(entry->MapId, entry->Difficulty)] = MapDifficulty(entry->resetTime, entry->maxPlayers, entry->areaTriggerText[0] != '\0');
LoadDBC(availableDbcLocales, bad_dbc_files, sMovieStore, dbcPath, "Movie.dbc");
for (PvPDifficultyEntry const* entry : sPvPDifficultyStore)
if (entry->bracketId > MAX_BATTLEGROUND_BRACKETS)
ASSERT(false && "Need update MAX_BATTLEGROUND_BRACKETS by DBC data");
for (auto i : sSpellStore)
if (i->Category)
sSpellsByCategoryStore[i->Category].insert(i->Id);
LoadDBC(availableDbcLocales, bad_dbc_files, sOverrideSpellDataStore, dbcPath, "OverrideSpellData.dbc");
LoadDBC(availableDbcLocales, bad_dbc_files, sPowerDisplayStore, dbcPath, "PowerDisplay.dbc");
LoadDBC(availableDbcLocales, bad_dbc_files, sPvPDifficultyStore, dbcPath, "PvpDifficulty.dbc");
for (uint32 i = 0; i < sPvPDifficultyStore.GetNumRows(); ++i)
if (PvPDifficultyEntry const* entry = sPvPDifficultyStore.LookupEntry(i))
if (entry->bracketId > MAX_BATTLEGROUND_BRACKETS)
ASSERT(false && "Need update MAX_BATTLEGROUND_BRACKETS by DBC data");
LoadDBC(availableDbcLocales, bad_dbc_files, sQuestXPStore, dbcPath, "QuestXP.dbc");
LoadDBC(availableDbcLocales, bad_dbc_files, sQuestFactionRewardStore, dbcPath, "QuestFactionReward.dbc");
LoadDBC(availableDbcLocales, bad_dbc_files, sQuestSortStore, dbcPath, "QuestSort.dbc");
LoadDBC(availableDbcLocales, bad_dbc_files, sRandomPropertiesPointsStore, dbcPath, "RandPropPoints.dbc");
LoadDBC(availableDbcLocales, bad_dbc_files, sScalingStatDistributionStore, dbcPath, "ScalingStatDistribution.dbc");
LoadDBC(availableDbcLocales, bad_dbc_files, sScalingStatValuesStore, dbcPath, "ScalingStatValues.dbc");
LoadDBC(availableDbcLocales, bad_dbc_files, sSkillLineStore, dbcPath, "SkillLine.dbc");
LoadDBC(availableDbcLocales, bad_dbc_files, sSkillLineAbilityStore, dbcPath, "SkillLineAbility.dbc");
LoadDBC(availableDbcLocales, bad_dbc_files, sSoundEntriesStore, dbcPath, "SoundEntries.dbc");
LoadDBC(availableDbcLocales, bad_dbc_files, sSpellStore, dbcPath, "Spell.dbc", &CustomSpellEntryfmt, &CustomSpellEntryIndex);
for (uint32 i = 1; i < sSpellStore.GetNumRows(); ++i)
for (SkillLineAbilityEntry const* skillLine : sSkillLineAbilityStore)
{
SpellEntry const* spell = sSpellStore.LookupEntry(i);
if (spell && spell->Category)
sSpellsByCategoryStore[spell->Category].insert(i);
}
for (uint32 j = 0; j < sSkillLineAbilityStore.GetNumRows(); ++j)
{
SkillLineAbilityEntry const* skillLine = sSkillLineAbilityStore.LookupEntry(j);
if (!skillLine)
continue;
SpellEntry const* spellInfo = sSpellStore.LookupEntry(skillLine->spellId);
if (spellInfo && (spellInfo->Attributes & SPELL_ATTR0_PASSIVE))
if (spellInfo && spellInfo->Attributes & SPELL_ATTR0_PASSIVE)
{
for (uint32 i = 1; i < sCreatureFamilyStore.GetNumRows(); ++i)
for (CreatureFamilyEntry const* cFamily : sCreatureFamilyStore)
{
CreatureFamilyEntry const* cFamily = sCreatureFamilyStore.LookupEntry(i);
if (!cFamily)
continue;
if (skillLine->skillId != cFamily->skillLine[0] && skillLine->skillId != cFamily->skillLine[1])
continue;
if (spellInfo->spellLevel)
continue;
if (skillLine->learnOnGetSkill != ABILITY_LEARNED_ON_GET_RACE_OR_CLASS_SKILL)
continue;
sPetFamilySpellsStore[i].insert(spellInfo->Id);
sPetFamilySpellsStore[cFamily->ID].insert(spellInfo->Id);
}
}
}
LoadDBC(availableDbcLocales, bad_dbc_files, sSpellCastTimesStore, dbcPath, "SpellCastTimes.dbc");
LoadDBC(availableDbcLocales, bad_dbc_files, sSpellCategoryStore, dbcPath, "SpellCategory.dbc");
LoadDBC(availableDbcLocales, bad_dbc_files, sSpellDifficultyStore, dbcPath, "SpellDifficulty.dbc", &CustomSpellDifficultyfmt, &CustomSpellDifficultyIndex);
LoadDBC(availableDbcLocales, bad_dbc_files, sSpellDurationStore, dbcPath, "SpellDuration.dbc");
LoadDBC(availableDbcLocales, bad_dbc_files, sSpellFocusObjectStore, dbcPath, "SpellFocusObject.dbc");
LoadDBC(availableDbcLocales, bad_dbc_files, sSpellItemEnchantmentStore, dbcPath, "SpellItemEnchantment.dbc");
LoadDBC(availableDbcLocales, bad_dbc_files, sSpellItemEnchantmentConditionStore, dbcPath, "SpellItemEnchantmentCondition.dbc");
LoadDBC(availableDbcLocales, bad_dbc_files, sSpellRadiusStore, dbcPath, "SpellRadius.dbc");
LoadDBC(availableDbcLocales, bad_dbc_files, sSpellRangeStore, dbcPath, "SpellRange.dbc");
LoadDBC(availableDbcLocales, bad_dbc_files, sSpellRuneCostStore, dbcPath, "SpellRuneCost.dbc");
LoadDBC(availableDbcLocales, bad_dbc_files, sSpellShapeshiftStore, dbcPath, "SpellShapeshiftForm.dbc");
LoadDBC(availableDbcLocales, bad_dbc_files, sStableSlotPricesStore, dbcPath, "StableSlotPrices.dbc");
LoadDBC(availableDbcLocales, bad_dbc_files, sSummonPropertiesStore, dbcPath, "SummonProperties.dbc");
LoadDBC(availableDbcLocales, bad_dbc_files, sTalentStore, dbcPath, "Talent.dbc");
// Create Spelldifficulty searcher
for (uint32 i = 0; i < sSpellDifficultyStore.GetNumRows(); ++i)
for (SpellDifficultyEntry const* spellDiff : sSpellDifficultyStore)
{
SpellDifficultyEntry const* spellDiff = sSpellDifficultyStore.LookupEntry(i);
if (!spellDiff)
continue;
SpellDifficultyEntry newEntry;
memset(newEntry.SpellID, 0, 4*sizeof(uint32));
for (int x = 0; x < MAX_DIFFICULTY; ++x)
memset(newEntry.SpellID, 0, 4 * sizeof(uint32));
for (uint8 x = 0; x < MAX_DIFFICULTY; ++x)
{
if (spellDiff->SpellID[x] <= 0 || !sSpellStore.LookupEntry(spellDiff->SpellID[x]))
{
if (spellDiff->SpellID[x] > 0)//don't show error if spell is <= 0, not all modes have spells and there are unknown negative values
sLog->outErrorDb("spelldifficulty_dbc: spell %i at field id:%u at spellid%i does not exist in SpellStore (spell.dbc), loaded as 0", spellDiff->SpellID[x], spellDiff->ID, x);
newEntry.SpellID[x] = 0;//spell was <= 0 or invalid, set to 0
if (spellDiff->SpellID[x] > 0) //don't show error if spell is <= 0, not all modes have spells and there are unknown negative values
sLog->outErrorDb("spelldifficulty_dbc: spell %i at field id: %u at spellid %i does not exist in SpellStore (spell.dbc), loaded as 0", spellDiff->SpellID[x], spellDiff->ID, x);
newEntry.SpellID[x] = 0; // spell was <= 0 or invalid, set to 0
}
else
newEntry.SpellID[x] = spellDiff->SpellID[x];
}
if (newEntry.SpellID[0] <= 0 || newEntry.SpellID[1] <= 0)//id0-1 must be always set!
if (newEntry.SpellID[0] <= 0 || newEntry.SpellID[1] <= 0) // id0-1 must be always set!
continue;
for (int x = 0; x < MAX_DIFFICULTY; ++x)
for (uint8 x = 0; x < MAX_DIFFICULTY; ++x)
if (newEntry.SpellID[x])
sSpellMgr->SetSpellDifficultyId(uint32(newEntry.SpellID[x]), spellDiff->ID);
}
// create talent spells set
for (uint32 i = 0; i < sTalentStore.GetNumRows(); ++i)
{
TalentEntry const* talentInfo = sTalentStore.LookupEntry(i);
if (!talentInfo)
continue;
for (int j = 0; j < MAX_TALENT_RANK; j++)
for (TalentEntry const* talentInfo : sTalentStore)
for (uint8 j = 0; j < MAX_TALENT_RANK; ++j)
if (talentInfo->RankID[j])
sTalentSpellPosMap[talentInfo->RankID[j]] = TalentSpellPos(i, j);
}
LoadDBC(availableDbcLocales, bad_dbc_files, sTalentTabStore, dbcPath, "TalentTab.dbc");
sTalentSpellPosMap[talentInfo->RankID[j]] = TalentSpellPos(talentInfo->TalentID, j);
// prepare fast data access to bit pos of talent ranks for use at inspecting
{
@@ -491,49 +459,47 @@ void LoadDBCStores(const std::string& dataPath)
sTalentTabPages[cls][talentTabInfo->tabpage] = talentTabId;
}
}
LoadDBC(availableDbcLocales, bad_dbc_files, sTaxiNodesStore, dbcPath, "TaxiNodes.dbc");
LoadDBC(availableDbcLocales, bad_dbc_files, sTaxiPathStore, dbcPath, "TaxiPath.dbc");
for (uint32 i = 1; i < sTaxiPathStore.GetNumRows(); ++i)
if (TaxiPathEntry const* entry = sTaxiPathStore.LookupEntry(i))
sTaxiPathSetBySource[entry->from][entry->to] = TaxiPathBySourceAndDestination(entry->ID, entry->price);
uint32 pathCount = sTaxiPathStore.GetNumRows();
//## TaxiPathNode.dbc ## Loaded only for initialization different structures
LoadDBC(availableDbcLocales, bad_dbc_files, sTaxiPathNodeStore, dbcPath, "TaxiPathNode.dbc");
// Calculate path nodes count
uint32 pathCount = sTaxiPathStore.GetNumRows();
std::vector<uint32> pathLength;
pathLength.resize(pathCount); // 0 and some other indexes not used
for (uint32 i = 1; i < sTaxiPathNodeStore.GetNumRows(); ++i)
if (TaxiPathNodeEntry const* entry = sTaxiPathNodeStore.LookupEntry(i))
{
if (pathLength[entry->path] < entry->index + 1)
pathLength[entry->path] = entry->index + 1;
}
// Set path length
sTaxiPathNodesByPath.resize(pathCount); // 0 and some other indexes not used
for (uint32 i = 1; i < sTaxiPathNodesByPath.size(); ++i)
sTaxiPathNodesByPath[i].resize(pathLength[i]);
// fill data
for (uint32 i = 1; i < sTaxiPathNodeStore.GetNumRows(); ++i)
if (TaxiPathNodeEntry const* entry = sTaxiPathNodeStore.LookupEntry(i))
sTaxiPathNodesByPath[entry->path][entry->index] = entry;
for (TaxiPathNodeEntry const* entry : sTaxiPathNodeStore)
sTaxiPathNodesByPath[entry->path][entry->index] = entry;
// Initialize global taxinodes mask
// include existed nodes that have at least single not spell base (scripted) path
{
std::set<uint32> spellPaths;
for (uint32 i = 1; i < sSpellStore.GetNumRows(); ++i)
if (SpellEntry const* sInfo = sSpellStore.LookupEntry (i))
for (int j = 0; j < MAX_SPELL_EFFECTS; ++j)
if (sInfo->Effect[j] == SPELL_EFFECT_SEND_TAXI)
spellPaths.insert(sInfo->EffectMiscValue[j]);
for (SpellEntry const* sInfo : sSpellStore)
for (uint8 j = 0; j < MAX_SPELL_EFFECTS; ++j)
if (sInfo->Effect[j] == SPELL_EFFECT_SEND_TAXI)
spellPaths.insert(sInfo->EffectMiscValue[j]);
memset(sTaxiNodesMask, 0, sizeof(sTaxiNodesMask));
memset(sOldContinentsNodesMask, 0, sizeof(sOldContinentsNodesMask));
memset(sHordeTaxiNodesMask, 0, sizeof(sHordeTaxiNodesMask));
memset(sAllianceTaxiNodesMask, 0, sizeof(sAllianceTaxiNodesMask));
memset(sDeathKnightTaxiNodesMask, 0, sizeof(sDeathKnightTaxiNodesMask));
for (uint32 i = 1; i < sTaxiNodesStore.GetNumRows(); ++i)
{
TaxiNodesEntry const* node = sTaxiNodesStore.LookupEntry(i);
@@ -565,8 +531,10 @@ void LoadDBCStores(const std::string& dataPath)
if (node->MountCreatureID[0] && node->MountCreatureID[0] != 32981)
sHordeTaxiNodesMask[field] |= submask;
if (node->MountCreatureID[1] && node->MountCreatureID[1] != 32981)
sAllianceTaxiNodesMask[field] |= submask;
if (node->MountCreatureID[0] == 32981 || node->MountCreatureID[1] == 32981)
sDeathKnightTaxiNodesMask[field] |= submask;
@@ -580,37 +548,14 @@ void LoadDBCStores(const std::string& dataPath)
}
}
LoadDBC(availableDbcLocales, bad_dbc_files, sTeamContributionPointsStore, dbcPath, "TeamContributionPoints.dbc");
LoadDBC(availableDbcLocales, bad_dbc_files, sTotemCategoryStore, dbcPath, "TotemCategory.dbc");
LoadDBC(availableDbcLocales, bad_dbc_files, sTransportAnimationStore, dbcPath, "TransportAnimation.dbc");
for (uint32 i = 0; i < sTransportAnimationStore.GetNumRows(); ++i)
{
TransportAnimationEntry const* anim = sTransportAnimationStore.LookupEntry(i);
if (!anim)
continue;
for (TransportAnimationEntry const* anim : sTransportAnimationStore)
sTransportMgr->AddPathNodeToTransport(anim->TransportEntry, anim->TimeSeg, anim);
}
LoadDBC(availableDbcLocales, bad_dbc_files, sTransportRotationStore, dbcPath, "TransportRotation.dbc");
for (uint32 i = 0; i < sTransportRotationStore.GetNumRows(); ++i)
{
TransportRotationEntry const* rot = sTransportRotationStore.LookupEntry(i);
if (!rot)
continue;
for (TransportRotationEntry const* rot : sTransportRotationStore)
sTransportMgr->AddPathRotationToTransport(rot->TransportEntry, rot->TimeSeg, rot);
}
LoadDBC(availableDbcLocales, bad_dbc_files, sVehicleStore, dbcPath, "Vehicle.dbc");
LoadDBC(availableDbcLocales, bad_dbc_files, sVehicleSeatStore, dbcPath, "VehicleSeat.dbc");
LoadDBC(availableDbcLocales, bad_dbc_files, sWMOAreaTableStore, dbcPath, "WMOAreaTable.dbc");
for (uint32 i = 0; i < sWMOAreaTableStore.GetNumRows(); ++i)
if (WMOAreaTableEntry const* entry = sWMOAreaTableStore.LookupEntry(i))
sWMOAreaInfoByTripple.insert(WMOAreaInfoByTripple::value_type(WMOAreaTableTripple(entry->rootId, entry->adtId, entry->groupId), entry));
LoadDBC(availableDbcLocales, bad_dbc_files, sWorldMapAreaStore, dbcPath, "WorldMapArea.dbc");
LoadDBC(availableDbcLocales, bad_dbc_files, sWorldMapOverlayStore, dbcPath, "WorldMapOverlay.dbc");
for (WMOAreaTableEntry const* entry : sWMOAreaTableStore)
sWMOAreaInfoByTripple[WMOAreaTableKey(entry->rootId, entry->adtId, entry->groupId)] = entry;
// error checks
if (bad_dbc_files.size() >= DBCFileCount)
@@ -636,7 +581,7 @@ void LoadDBCStores(const std::string& dataPath)
!sMapStore.LookupEntry(724) || // last map added in 3.3.5a
!sSpellStore.LookupEntry(80864) ) // last client known item added in 3.3.5a
{
sLog->outError("You have _outdated_ DBC files. Please extract correct versions from current using client.");
sLog->outError("You have _outdated_ DBC data. Please extract correct versions from current using client.");
exit(1);
}
@@ -650,24 +595,26 @@ SimpleFactionsList const* GetFactionTeamList(uint32 faction)
if (itr != sFactionTeamMap.end())
return &itr->second;
return NULL;
return nullptr;
}
char* GetPetName(uint32 petfamily, uint32 dbclang)
{
if (!petfamily)
return NULL;
return nullptr;
CreatureFamilyEntry const* pet_family = sCreatureFamilyStore.LookupEntry(petfamily);
if (!pet_family)
return NULL;
return pet_family->Name[dbclang]?pet_family->Name[dbclang]:NULL;
return nullptr;
return pet_family->Name[dbclang] ? pet_family->Name[dbclang] : nullptr;
}
TalentSpellPos const* GetTalentSpellPos(uint32 spellId)
{
TalentSpellPosMap::const_iterator itr = sTalentSpellPosMap.find(spellId);
if (itr == sTalentSpellPosMap.end())
return NULL;
return nullptr;
return &itr->second;
}
@@ -682,9 +629,10 @@ uint32 GetTalentSpellCost(uint32 spellId)
WMOAreaTableEntry const* GetWMOAreaTableEntryByTripple(int32 rootid, int32 adtid, int32 groupid)
{
WMOAreaInfoByTripple::iterator i = sWMOAreaInfoByTripple.find(WMOAreaTableTripple(rootid, adtid, groupid));
if (i == sWMOAreaInfoByTripple.end())
return NULL;
auto i = sWMOAreaInfoByTripple.find(WMOAreaTableKey(int16(rootid), int8(adtid), groupid));
if (i != sWMOAreaInfoByTripple.end())
return i->second;
return i->second;
}
@@ -746,12 +694,13 @@ void Map2ZoneCoordinates(float& x, float& y, uint32 zone)
MapDifficulty const* GetMapDifficultyData(uint32 mapId, Difficulty difficulty)
{
MapDifficultyMap::const_iterator itr = sMapDifficultyMap.find(MAKE_PAIR32(mapId, difficulty));
return itr != sMapDifficultyMap.end() ? &itr->second : NULL;
return itr != sMapDifficultyMap.end() ? &itr->second : nullptr;
}
MapDifficulty const* GetDownscaledMapDifficultyData(uint32 mapId, Difficulty &difficulty)
{
uint32 tmpDiff = difficulty;
MapDifficulty const* mapDiff = GetMapDifficultyData(mapId, Difficulty(tmpDiff));
if (!mapDiff)
{
@@ -770,28 +719,27 @@ MapDifficulty const* GetDownscaledMapDifficultyData(uint32 mapId, Difficulty &di
}
difficulty = Difficulty(tmpDiff);
return mapDiff;
}
PvPDifficultyEntry const* GetBattlegroundBracketByLevel(uint32 mapid, uint32 level)
{
PvPDifficultyEntry const* maxEntry = NULL; // used for level > max listed level case
for (uint32 i = 0; i < sPvPDifficultyStore.GetNumRows(); ++i)
PvPDifficultyEntry const* maxEntry = nullptr; // used for level > max listed level case
for (PvPDifficultyEntry const* entry : sPvPDifficultyStore)
{
if (PvPDifficultyEntry const* entry = sPvPDifficultyStore.LookupEntry(i))
{
// skip unrelated and too-high brackets
if (entry->mapId != mapid || entry->minLevel > level)
continue;
// skip unrelated and too-high brackets
if (entry->mapId != mapid || entry->minLevel > level)
continue;
// exactly fit
if (entry->maxLevel >= level)
return entry;
// exactly fit
if (entry->maxLevel >= level)
return entry;
// remember for possible out-of-range case (search higher from existed)
if (!maxEntry || maxEntry->maxLevel < entry->maxLevel)
maxEntry = entry;
}
// remember for possible out-of-range case (search higher from existed)
if (!maxEntry || maxEntry->maxLevel < entry->maxLevel)
maxEntry = entry;
}
return maxEntry;
@@ -799,12 +747,11 @@ PvPDifficultyEntry const* GetBattlegroundBracketByLevel(uint32 mapid, uint32 lev
PvPDifficultyEntry const* GetBattlegroundBracketById(uint32 mapid, BattlegroundBracketId id)
{
for (uint32 i = 0; i < sPvPDifficultyStore.GetNumRows(); ++i)
if (PvPDifficultyEntry const* entry = sPvPDifficultyStore.LookupEntry(i))
if (entry->mapId == mapid && entry->GetBracketId() == id)
return entry;
for (PvPDifficultyEntry const* entry : sPvPDifficultyStore)
if (entry->mapId == mapid && entry->GetBracketId() == id)
return entry;
return NULL;
return nullptr;
}
uint32 const* GetTalentTabPages(uint8 cls)
@@ -813,7 +760,7 @@ uint32 const* GetTalentTabPages(uint8 cls)
}
bool IsSharedDifficultyMap(uint32 mapid)
{
{
return sWorld->getBoolConfig(CONFIG_INSTANCE_SHARED_ID) && (mapid == 631 || mapid == 724);
}
@@ -829,7 +776,7 @@ CharStartOutfitEntry const* GetCharStartOutfitEntry(uint8 race, uint8 class_, ui
{
std::map<uint32, CharStartOutfitEntry const*>::const_iterator itr = sCharStartOutfitMap.find(race | (class_ << 8) | (gender << 16));
if (itr == sCharStartOutfitMap.end())
return NULL;
return nullptr;
return itr->second;
}
@@ -837,17 +784,11 @@ CharStartOutfitEntry const* GetCharStartOutfitEntry(uint8 race, uint8 class_, ui
/// Returns LFGDungeonEntry for a specific map and difficulty. Will return first found entry if multiple dungeons use the same map (such as Scarlet Monastery)
LFGDungeonEntry const* GetLFGDungeon(uint32 mapId, Difficulty difficulty)
{
for (uint32 i = 0; i < sLFGDungeonStore.GetNumRows(); ++i)
{
LFGDungeonEntry const* dungeon = sLFGDungeonStore.LookupEntry(i);
if (!dungeon)
continue;
for (LFGDungeonEntry const* dungeon : sLFGDungeonStore)
if (dungeon->map == int32(mapId) && Difficulty(dungeon->difficulty) == difficulty)
return dungeon;
}
return NULL;
return nullptr;
}
uint32 GetDefaultMapLight(uint32 mapId)

View File

@@ -10,7 +10,6 @@
#include "Common.h"
#include "DBCStore.h"
#include "DBCStructure.h"
#include <list>
typedef std::list<uint32> SimpleFactionsList;

View File

@@ -1,120 +0,0 @@
/*
* Copyright (C) 2016+ AzerothCore <www.azerothcore.org>, released under GNU GPL v2 license: https://github.com/azerothcore/azerothcore-wotlk/blob/master/LICENSE-GPL2
* Copyright (C) 2008-2016 TrinityCore <http://www.trinitycore.org/>
* Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
*/
#ifndef ACORE_DBCSFRM_H
#define ACORE_DBCSFRM_H
char const Achievementfmt[] = "niixssssssssssssssssxxxxxxxxxxxxxxxxxxiixixxxxxxxxxxxxxxxxxxii";
const std::string CustomAchievementfmt="pppaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaapapaaaaaaaaaaaaaaaaaapp";
const std::string CustomAchievementIndex = "ID";
char const AchievementCategoryfmt[] = "nixxxxxxxxxxxxxxxxxx";
char const AchievementCriteriafmt[] = "niiiiiiiixxxxxxxxxxxxxxxxxiiiix";
char const AreaTableEntryfmt[] = "niiiixxxxxissssssssssssssssxiiiiixxx";
char const AreaGroupEntryfmt[] = "niiiiiii";
char const AreaPOIEntryfmt[] = "niiiiiiiiiiifffixixxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxix";
char const AuctionHouseEntryfmt[] = "niiixxxxxxxxxxxxxxxxx";
char const BankBagSlotPricesEntryfmt[] = "ni";
char const BarberShopStyleEntryfmt[] = "nixxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxiii";
char const BattlemasterListEntryfmt[] = "niiiiiiiiixssssssssssssssssxiixx";
char const CharStartOutfitEntryfmt[] = "dbbbXiiiiiiiiiiiiiiiiiiiiiiiixxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
char const CharTitlesEntryfmt[] = "nxssssssssssssssssxssssssssssssssssxi";
char const ChatChannelsEntryfmt[] = "nixssssssssssssssssxxxxxxxxxxxxxxxxxx"; // ChatChannelsEntryfmt, index not used (more compact store)
char const ChrClassesEntryfmt[] = "nxixssssssssssssssssxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxixii";
char const ChrRacesEntryfmt[] = "nxixiixixxxxixssssssssssssssssxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxi";
char const CinematicSequencesEntryfmt[] = "nxxxxxxxxx";
char const CreatureDisplayInfofmt[] = "nixxfxxxxxxxxxxx";
char const CreatureFamilyfmt[] = "nfifiiiiixssssssssssssssssxx";
char const CreatureModelDatafmt[] = "nxxxfxxxxxxxxxxffxxxxxxxxxxx";
char const CreatureSpellDatafmt[] = "niiiixxxx";
char const CreatureTypefmt[] = "nxxxxxxxxxxxxxxxxxx";
char const CurrencyTypesfmt[] = "xnxi";
char const DestructibleModelDatafmt[] = "nxxixxxixxxixxxixxx";
char const DungeonEncounterfmt[] = "niixissssssssssssssssxx";
char const DurabilityCostsfmt[] = "niiiiiiiiiiiiiiiiiiiiiiiiiiiii";
char const DurabilityQualityfmt[] = "nf";
char const EmotesEntryfmt[] = "nxxiiix";
char const EmotesTextEntryfmt[] = "nxixxxxxxxxxxxxxxxx";
char const FactionEntryfmt[] = "niiiiiiiiiiiiiiiiiiffixssssssssssssssssxxxxxxxxxxxxxxxxxx";
char const FactionTemplateEntryfmt[] = "niiiiiiiiiiiii";
char const GameObjectDisplayInfofmt[] = "nsxxxxxxxxxxffffffx";
char const GemPropertiesEntryfmt[] = "nixxi";
char const GlyphPropertiesfmt[] = "niii";
char const GlyphSlotfmt[] = "nii";
char const GtBarberShopCostBasefmt[] = "f";
char const GtCombatRatingsfmt[] = "f";
char const GtChanceToMeleeCritBasefmt[] = "f";
char const GtChanceToMeleeCritfmt[] = "f";
char const GtChanceToSpellCritBasefmt[] = "f";
char const GtChanceToSpellCritfmt[] = "f";
char const GtNPCManaCostScalerfmt[] = "f";
char const GtOCTClassCombatRatingScalarfmt[] = "df";
char const GtOCTRegenHPfmt[] = "f";
//char const GtOCTRegenMPfmt[] = "f";
char const GtRegenHPPerSptfmt[] = "f";
char const GtRegenMPPerSptfmt[] = "f";
char const Holidaysfmt[] = "niiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiixxsiix";
char const ItemBagFamilyfmt[] = "nxxxxxxxxxxxxxxxxx";
char const ItemDisplayTemplateEntryfmt[] = "nxxxxsxxxxxxxxxxxxxxxxxxx";
//char const ItemCondExtCostsEntryfmt[] = "xiii";
char const ItemExtendedCostEntryfmt[] = "niiiiiiiiiiiiiix";
char const ItemLimitCategoryEntryfmt[] = "nxxxxxxxxxxxxxxxxxii";
char const ItemRandomPropertiesfmt[] = "nxiiiiissssssssssssssssx";
char const ItemRandomSuffixfmt[] = "nssssssssssssssssxxiiiiiiiiii";
char const ItemSetEntryfmt[] = "dssssssssssssssssxiiiiiiiiiixxxxxxxiiiiiiiiiiiiiiiiii";
char const LFGDungeonEntryfmt[] = "nssssssssssssssssxiiiiiiiiixxixixxxxxxxxxxxxxxxxx";
char const LightEntryfmt[] = "nifffxxxxxxxxxx";
char const LiquidTypefmt[] = "nxxixixxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
char const LockEntryfmt[] = "niiiiiiiiiiiiiiiiiiiiiiiixxxxxxxx";
char const MailTemplateEntryfmt[] = "nxxxxxxxxxxxxxxxxxssssssssssssssssx";
char const MapEntryfmt[] = "nxiixssssssssssssssssxixxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxixiffxiii";
char const MapDifficultyEntryfmt[] = "diisxxxxxxxxxxxxxxxxiix";
char const MovieEntryfmt[] = "nxx";
char const OverrideSpellDatafmt[] = "niiiiiiiiiix";
char const PowerDisplayfmt[] = "nixxxx";
char const QuestSortEntryfmt[] = "nxxxxxxxxxxxxxxxxx";
char const QuestXPfmt[] = "niiiiiiiiii";
char const QuestFactionRewardfmt[] = "niiiiiiiiii";
char const PvPDifficultyfmt[] = "diiiii";
char const RandomPropertiesPointsfmt[] = "niiiiiiiiiiiiiii";
char const ScalingStatDistributionfmt[] = "niiiiiiiiiiiiiiiiiiiii";
char const ScalingStatValuesfmt[] = "iniiiiiiiiiiiiiiiiiiiiii";
char const SkillLinefmt[] = "nixssssssssssssssssxxxxxxxxxxxxxxxxxxixxxxxxxxxxxxxxxxxi";
char const SkillLineAbilityfmt[] = "niiiixxiiiiixx";
char const SoundEntriesfmt[] = "nxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
char const SpellCastTimefmt[] = "nixx";
char const SpellCategoryfmt[] = "ni";
char const SpellDifficultyfmt[] = "niiii";
const std::string CustomSpellDifficultyfmt="ppppp";
const std::string CustomSpellDifficultyIndex="id";
char const SpellDurationfmt[] = "niii";
char const SpellEntryfmt[] = "niiiiiiiiiiiixixiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiifxiiiiiiiiiiiiiiiiiiiiiiiiiiiifffiiiiiiiiiiiiiiiiiiiiifffiiiiiiiiiiiiiiifffiiiiiiiiiiiiixssssssssssssssssxssssssssssssssssxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxiiiiiiiiiiixfffxxxiiiiixxfffxx";
const std::string CustomSpellEntryfmt = "papppppppppppapapaaaaaaaaaaapaaapapppppppaaaaapaapaaaaaaaaaaaaaaaaaappppppppppppppppppppppppppppppppppppaaappppppppppppaaapppppppppaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaappppppppapppaaaaappaaaaaaa";
const std::string CustomSpellEntryIndex = "Id";
char const SpellFocusObjectfmt[] = "nxxxxxxxxxxxxxxxxx";
char const SpellItemEnchantmentfmt[] = "niiiiiiixxxiiissssssssssssssssxiiiiiii";
char const SpellItemEnchantmentConditionfmt[] = "nbbbbbxxxxxbbbbbbbbbbiiiiiXXXXX";
char const SpellRadiusfmt[] = "nfff";
char const SpellRangefmt[] = "nffffixxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
char const SpellRuneCostfmt[] = "niiii";
char const SpellShapeshiftfmt[] = "nxxxxxxxxxxxxxxxxxxiixiiixxiiiiiiii";
char const StableSlotPricesfmt[] = "ni";
char const SummonPropertiesfmt[] = "niiiii";
char const TalentEntryfmt[] = "niiiiiiiixxxxixxixxixxx";
char const TalentTabEntryfmt[] = "nxxxxxxxxxxxxxxxxxxxiiix";
char const TaxiNodesEntryfmt[] = "nifffssssssssssssssssxii";
char const TaxiPathEntryfmt[] = "niii";
char const TaxiPathNodeEntryfmt[] = "diiifffiiii";
char const TeamContributionPointsfmt[] = "df";
char const TotemCategoryEntryfmt[] = "nxxxxxxxxxxxxxxxxxii";
char const TransportAnimationfmt[] = "diifffx";
char const TransportRotationfmt[] = "diiffff";
char const VehicleEntryfmt[] = "niffffiiiiiiiifffffffffffffffssssfifiixx";
char const VehicleSeatEntryfmt[] = "niiffffffffffiiiiiifffffffiiifffiiiiiiiffiiiiixxxxxxxxxxxx";
char const WMOAreaTableEntryfmt[] = "niiixxxxxiixxxxxxxxxxxxxxxxx";
char const WorldMapAreaEntryfmt[] = "xinxffffixx";
char const WorldMapOverlayEntryfmt[] = "nxiiiixxxxxxxxxxx";
#endif

View File

@@ -27,7 +27,6 @@
#include "GameObjectModel.h"
#include "Log.h"
#include "DataMap.h"
#include <bitset>
#include <list>

View File

@@ -1,6 +1,7 @@
#include "GameGraveyard.h"
#include "MapManager.h"
#include "DBCStores.h"
#include "DatabaseEnv.h"
#include "Log.h"
Graveyard* Graveyard::instance()

View File

@@ -0,0 +1,129 @@
/*
* Copyright (C) 2016+ AzerothCore <www.azerothcore.org>, released under GNU GPL v2 license: https://github.com/azerothcore/azerothcore-wotlk/blob/master/LICENSE-GPL2
* Copyright (C) 2008-2020 TrinityCore <http://www.trinitycore.org/>
* Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
*/
#include "DBCDatabaseLoader.h"
#include "Common.h"
#include "DatabaseEnv.h"
#include "Errors.h"
#include "Log.h"
#include "StringFormat.h"
#include <sstream>
DBCDatabaseLoader::DBCDatabaseLoader(char const* tableName, char const* dbcFormatString, std::vector<char*>& stringPool)
: _sqlTableName(tableName),
_dbcFormat(dbcFormatString),
_sqlIndexPos(0),
_recordSize(0),
_stringPool(stringPool)
{
// Get sql index position
int32 indexPos = -1;
_recordSize = DBCFileLoader::GetFormatRecordSize(_dbcFormat, &indexPos);
ASSERT(_recordSize);
}
char* DBCDatabaseLoader::Load(uint32& records, char**& indexTable)
{
std::string query = acore::StringFormat("SELECT * FROM `%s` ORDER BY `ID` DESC", _sqlTableName);
// no error if empty set
QueryResult result = WorldDatabase.Query(query.c_str());
if (!result)
return nullptr;
// Check if sql index pos is valid
if (int32(result->GetFieldCount() - 1) < _sqlIndexPos)
{
ASSERT(false, "Invalid index pos for dbc: '%s'", _sqlTableName);
return nullptr;
}
// Resize index table
// database query *MUST* contain ORDER BY `index_field` DESC clause
uint32 indexTableSize = std::max(records, (*result)[_sqlIndexPos].GetUInt32() + 1);
if (indexTableSize > records)
{
char** tmpIdxTable = new char*[indexTableSize];
memset(tmpIdxTable, 0, indexTableSize * sizeof(char*));
memcpy(tmpIdxTable, indexTable, records * sizeof(char*));
delete[] indexTable;
indexTable = tmpIdxTable;
}
std::unique_ptr<char[]> dataTable = std::make_unique<char[]>(result->GetRowCount() * _recordSize);
std::unique_ptr<uint32[]> newIndexes = std::make_unique<uint32[]>(result->GetRowCount());
uint32 newRecords = 0;
// Insert sql data into the data array
do
{
Field* fields = result->Fetch();
uint32 indexValue = fields[_sqlIndexPos].GetUInt32();
char* dataValue = indexTable[indexValue];
// If exist in DBC file override from DB
newIndexes[newRecords] = indexValue;
dataValue = &dataTable[newRecords++ * _recordSize];
uint32 dataOffset = 0;
uint32 sqlColumnNumber = 0;
char const* dbcFormat = _dbcFormat;
for (; (*dbcFormat); ++dbcFormat)
{
switch (*dbcFormat)
{
case FT_FLOAT:
*reinterpret_cast<float*>(&dataValue[dataOffset]) = fields[sqlColumnNumber].GetFloat();
dataOffset += sizeof(float);
break;
case FT_IND:
case FT_INT:
*reinterpret_cast<uint32*>(&dataValue[dataOffset]) = fields[sqlColumnNumber].GetUInt32();
dataOffset += sizeof(uint32);
break;
case FT_BYTE:
*reinterpret_cast<uint8*>(&dataValue[dataOffset]) = fields[sqlColumnNumber].GetUInt8();
dataOffset += sizeof(uint8);
break;
case FT_STRING:
*reinterpret_cast<char**>(&dataValue[dataOffset]) = CloneStringToPool(fields[sqlColumnNumber].GetString());
dataOffset += sizeof(char*);
break;
case FT_SORT:
case FT_NA:
break;
default:
ASSERT(false, "Unsupported data type '%c' in table '%s'", *dbcFormat, _sqlTableName);
return nullptr;
}
++sqlColumnNumber;
}
ASSERT(sqlColumnNumber == result->GetFieldCount(), "SQL format string does not match database for table: '%s'", _sqlTableName);
ASSERT(dataOffset == _recordSize);
} while (result->NextRow());
ASSERT(newRecords == result->GetRowCount());
// insert new records to index table
for (uint32 i = 0; i < newRecords; ++i)
indexTable[newIndexes[i]] = &dataTable[i * _recordSize];
records = indexTableSize;
return dataTable.release();
}
char* DBCDatabaseLoader::CloneStringToPool(std::string const& str)
{
char* buf = new char[str.size() + 1];
memcpy(buf, str.c_str(), str.size() + 1);
_stringPool.push_back(buf);
return buf;
}

View File

@@ -0,0 +1,32 @@
/*
* Copyright (C) 2016+ AzerothCore <www.azerothcore.org>, released under GNU GPL v2 license: https://github.com/azerothcore/azerothcore-wotlk/blob/master/LICENSE-GPL2
* Copyright (C) 2008-2020 TrinityCore <http://www.trinitycore.org/>
* Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
*/
#ifndef DBCDatabaseLoader_h__
#define DBCDatabaseLoader_h__
#include "DBCFileLoader.h"
#include <string>
#include <vector>
struct DBCDatabaseLoader
{
DBCDatabaseLoader(char const* dbTable, char const* dbcFormatString, std::vector<char*>& stringPool);
char* Load(uint32& records, char**& indexTable);
private:
char const* _sqlTableName;
char const* _dbcFormat;
int32 _sqlIndexPos;
uint32 _recordSize;
std::vector<char*>& _stringPool;
char* CloneStringToPool(std::string const& str);
DBCDatabaseLoader(DBCDatabaseLoader const& right) = delete;
DBCDatabaseLoader& operator=(DBCDatabaseLoader const& right) = delete;
};
#endif // DBCDatabaseLoader_h__

View File

@@ -0,0 +1,58 @@
/*
* Copyright (C) 2016+ AzerothCore <www.azerothcore.org>, released under GNU GPL v2 license: https://github.com/azerothcore/azerothcore-wotlk/blob/master/LICENSE-GPL2
* Copyright (C) 2008-2020 TrinityCore <http://www.trinitycore.org/>
* Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
*/
#ifndef DBCStorageIterator_h__
#define DBCStorageIterator_h__
#include "Define.h"
#include <iterator>
template <class T>
class DBCStorageIterator : public std::iterator<std::forward_iterator_tag, T>
{
public:
DBCStorageIterator() : _index(nullptr), _pos(0), _end(0) { }
DBCStorageIterator(T** index, uint32 size, uint32 pos = 0) : _index(index), _pos(pos), _end(size)
{
if (_pos < _end)
{
while (_pos < _end && !_index[_pos])
++_pos;
}
}
T const* operator->() { return _index[_pos]; }
T const* operator*() { return _index[_pos]; }
bool operator==(DBCStorageIterator const& right) const { /*ASSERT(_index == right._index, "Iterator belongs to a different container")*/ return _pos == right._pos; }
bool operator!=(DBCStorageIterator const& right) const { return !(*this == right); }
DBCStorageIterator& operator++()
{
if (_pos < _end)
{
do
++_pos;
while (_pos < _end && !_index[_pos]);
}
return *this;
}
DBCStorageIterator operator++(int)
{
DBCStorageIterator tmp = *this;
++*this;
return tmp;
}
private:
T** _index;
uint32 _pos;
uint32 _end;
};
#endif // DBCStorageIterator_h__

View File

@@ -0,0 +1,66 @@
/*
* Copyright (C) 2016+ AzerothCore <www.azerothcore.org>, released under GNU GPL v2 license: https://github.com/azerothcore/azerothcore-wotlk/blob/master/LICENSE-GPL2
* Copyright (C) 2008-2020 TrinityCore <http://www.trinitycore.org/>
* Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
*/
#include "DBCStore.h"
#include "DBCDatabaseLoader.h"
DBCStorageBase::DBCStorageBase(char const* fmt) : _fieldCount(0), _fileFormat(fmt), _dataTable(nullptr), _indexTableSize(0)
{
}
DBCStorageBase::~DBCStorageBase()
{
delete[] _dataTable;
for (char* strings : _stringPool)
delete[] strings;
}
bool DBCStorageBase::Load(char const* path, char**& indexTable)
{
indexTable = nullptr;
DBCFileLoader dbc;
// Check if load was sucessful, only then continue
if (!dbc.Load(path, _fileFormat))
return false;
_fieldCount = dbc.GetCols();
// load raw non-string data
_dataTable = dbc.AutoProduceData(_fileFormat, _indexTableSize, indexTable);
// load strings from dbc data
if (char* stringBlock = dbc.AutoProduceStrings(_fileFormat, _dataTable))
_stringPool.push_back(stringBlock);
// error in dbc file at loading if NULL
return indexTable != nullptr;
}
bool DBCStorageBase::LoadStringsFrom(char const* path, char** indexTable)
{
// DBC must be already loaded using Load
if (!indexTable)
return false;
DBCFileLoader dbc;
// Check if load was successful, only then continue
if (!dbc.Load(path, _fileFormat))
return false;
// load strings from another locale dbc data
if (char* stringBlock = dbc.AutoProduceStrings(_fileFormat, _dataTable))
_stringPool.push_back(stringBlock);
return true;
}
void DBCStorageBase::LoadFromDB(char const* table, char const* format, char**& indexTable)
{
_stringPool.push_back(DBCDatabaseLoader(table, format, _stringPool).Load(_indexTableSize, indexTable));
}

View File

@@ -0,0 +1,113 @@
/*
* Copyright (C) 2016+ AzerothCore <www.azerothcore.org>, released under GNU GPL v2 license: https://github.com/azerothcore/azerothcore-wotlk/blob/master/LICENSE-GPL2
* Copyright (C) 2008-2020 TrinityCore <http://www.trinitycore.org/>
* Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
*/
#ifndef DBCSTORE_H
#define DBCSTORE_H
#include "Common.h"
#include "DBCStorageIterator.h"
#include "Errors.h"
#include <vector>
/// Interface class for common access
class DBCStorageBase
{
public:
DBCStorageBase(char const* fmt);
virtual ~DBCStorageBase();
char const* GetFormat() const { return _fileFormat; }
uint32 GetFieldCount() const { return _fieldCount; }
virtual bool Load(char const* path) = 0;
virtual bool LoadStringsFrom(char const* path) = 0;
virtual void LoadFromDB(char const* table, char const* format) = 0;
protected:
bool Load(char const* path, char**& indexTable);
bool LoadStringsFrom(char const* path, char** indexTable);
void LoadFromDB(char const* table, char const* format, char**& indexTable);
uint32 _fieldCount;
char const* _fileFormat;
char* _dataTable;
std::vector<char*> _stringPool;
uint32 _indexTableSize;
};
template <class T>
class DBCStorage : public DBCStorageBase
{
public:
typedef DBCStorageIterator<T> iterator;
explicit DBCStorage(char const* fmt) : DBCStorageBase(fmt)
{
_indexTable.AsT = nullptr;
}
~DBCStorage()
{
delete[] reinterpret_cast<char*>(_indexTable.AsT);
}
T const* LookupEntry(uint32 id) const { return (id >= _indexTableSize) ? nullptr : _indexTable.AsT[id]; }
T const* AssertEntry(uint32 id) const { return ASSERT_NOTNULL(LookupEntry(id)); }
#ifdef ELUNA
void SetEntry(uint32 id, T* t)
{
if (id >= _indexTableSize)
{
// Resize
typedef char* ptr;
size_t newSize = id + 1;
ptr* newArr = new ptr[newSize];
memset(newArr, 0, newSize * sizeof(ptr));
memcpy(newArr, _indexTable.AsChar, _indexTableSize * sizeof(ptr));
delete[] reinterpret_cast<char*>(_indexTable.AsT);
_indexTable.AsChar = newArr;
_indexTableSize = newSize;
}
delete _indexTable.AsT[id];
_indexTable.AsT[id] = t;
}
#endif
uint32 GetNumRows() const { return _indexTableSize; }
bool Load(char const* path) override
{
return DBCStorageBase::Load(path, _indexTable.AsChar);
}
bool LoadStringsFrom(char const* path) override
{
return DBCStorageBase::LoadStringsFrom(path, _indexTable.AsChar);
}
void LoadFromDB(char const* table, char const* format) override
{
DBCStorageBase::LoadFromDB(table, format, _indexTable.AsChar);
}
iterator begin() { return iterator(_indexTable.AsT, _indexTableSize); }
iterator end() { return iterator(_indexTable.AsT, _indexTableSize, _indexTableSize); }
private:
union
{
T** AsT;
char** AsChar;
}
_indexTable;
DBCStorage(DBCStorage const& right) = delete;
DBCStorage& operator=(DBCStorage const& right) = delete;
};
#endif

View File

@@ -977,6 +977,7 @@ struct GlyphSlotEntry
// All Gt* DBC store data for 100 levels, some by 100 per class/race
#define GT_MAX_LEVEL 100
// gtOCTClassCombatRatingScalar.dbc stores data for 32 ratings, look at MAX_COMBAT_RATING for real used amount
#define GT_MAX_RATING 32

View File

@@ -0,0 +1,114 @@
/*
* Copyright (C) 2016+ AzerothCore <www.azerothcore.org>, released under GNU GPL v2 license: https://github.com/azerothcore/azerothcore-wotlk/blob/master/LICENSE-GPL2
* Copyright (C) 2008-2020 TrinityCore <http://www.trinitycore.org/>
* Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
*/
#ifndef ACORE_DBCSFRM_H
#define ACORE_DBCSFRM_H
char constexpr Achievementfmt[] = "niixssssssssssssssssxxxxxxxxxxxxxxxxxxiixixxxxxxxxxxxxxxxxxxii";
char constexpr AchievementCategoryfmt[] = "nixxxxxxxxxxxxxxxxxx";
char constexpr AchievementCriteriafmt[] = "niiiiiiiixxxxxxxxxxxxxxxxxiiiix";
char constexpr AreaTableEntryfmt[] = "niiiixxxxxissssssssssssssssxiiiiixxx";
char constexpr AreaGroupEntryfmt[] = "niiiiiii";
char constexpr AreaPOIEntryfmt[] = "niiiiiiiiiiifffixixxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxix";
char constexpr AuctionHouseEntryfmt[] = "niiixxxxxxxxxxxxxxxxx";
char constexpr BankBagSlotPricesEntryfmt[] = "ni";
char constexpr BarberShopStyleEntryfmt[] = "nixxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxiii";
char constexpr BattlemasterListEntryfmt[] = "niiiiiiiiixssssssssssssssssxiixx";
char constexpr CharStartOutfitEntryfmt[] = "dbbbXiiiiiiiiiiiiiiiiiiiiiiiixxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
char constexpr CharTitlesEntryfmt[] = "nxssssssssssssssssxssssssssssssssssxi";
char constexpr ChatChannelsEntryfmt[] = "nixssssssssssssssssxxxxxxxxxxxxxxxxxx"; // ChatChannelsEntryfmt, index not used (more compact store)
char constexpr ChrClassesEntryfmt[] = "nxixssssssssssssssssxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxixii";
char constexpr ChrRacesEntryfmt[] = "nxixiixixxxxixssssssssssssssssxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxi";
char constexpr CinematicSequencesEntryfmt[] = "nxxxxxxxxx";
char constexpr CreatureDisplayInfofmt[] = "nixxfxxxxxxxxxxx";
char constexpr CreatureFamilyfmt[] = "nfifiiiiixssssssssssssssssxx";
char constexpr CreatureModelDatafmt[] = "nxxxfxxxxxxxxxxffxxxxxxxxxxx";
char constexpr CreatureSpellDatafmt[] = "niiiixxxx";
char constexpr CreatureTypefmt[] = "nxxxxxxxxxxxxxxxxxx";
char constexpr CurrencyTypesfmt[] = "xnxi";
char constexpr DestructibleModelDatafmt[] = "nxxixxxixxxixxxixxx";
char constexpr DungeonEncounterfmt[] = "niixissssssssssssssssxx";
char constexpr DurabilityCostsfmt[] = "niiiiiiiiiiiiiiiiiiiiiiiiiiiii";
char constexpr DurabilityQualityfmt[] = "nf";
char constexpr EmotesEntryfmt[] = "nxxiiix";
char constexpr EmotesTextEntryfmt[] = "nxixxxxxxxxxxxxxxxx";
char constexpr FactionEntryfmt[] = "niiiiiiiiiiiiiiiiiiffixssssssssssssssssxxxxxxxxxxxxxxxxxx";
char constexpr FactionTemplateEntryfmt[] = "niiiiiiiiiiiii";
char constexpr GameObjectDisplayInfofmt[] = "nsxxxxxxxxxxffffffx";
char constexpr GemPropertiesEntryfmt[] = "nixxi";
char constexpr GlyphPropertiesfmt[] = "niii";
char constexpr GlyphSlotfmt[] = "nii";
char constexpr GtBarberShopCostBasefmt[] = "df";
char constexpr GtCombatRatingsfmt[] = "df";
char constexpr GtChanceToMeleeCritBasefmt[] = "df";
char constexpr GtChanceToMeleeCritfmt[] = "df";
char constexpr GtChanceToSpellCritBasefmt[] = "df";
char constexpr GtChanceToSpellCritfmt[] = "df";
char constexpr GtNPCManaCostScalerfmt[] = "df";
char constexpr GtOCTClassCombatRatingScalarfmt[] = "df";
char constexpr GtOCTRegenHPfmt[] = "df";
//char constexpr GtOCTRegenMPfmt[] = "f";
char constexpr GtRegenHPPerSptfmt[] = "df";
char constexpr GtRegenMPPerSptfmt[] = "df";
char constexpr Holidaysfmt[] = "niiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiixxsiix";
char constexpr ItemBagFamilyfmt[] = "nxxxxxxxxxxxxxxxxx";
char constexpr ItemDisplayTemplateEntryfmt[] = "nxxxxsxxxxxxxxxxxxxxxxxxx";
//char constexpr ItemCondExtCostsEntryfmt[] = "xiii";
char constexpr ItemExtendedCostEntryfmt[] = "niiiiiiiiiiiiiix";
char constexpr ItemLimitCategoryEntryfmt[] = "nxxxxxxxxxxxxxxxxxii";
char constexpr ItemRandomPropertiesfmt[] = "nxiiiiissssssssssssssssx";
char constexpr ItemRandomSuffixfmt[] = "nssssssssssssssssxxiiiiiiiiii";
char constexpr ItemSetEntryfmt[] = "dssssssssssssssssxiiiiiiiiiixxxxxxxiiiiiiiiiiiiiiiiii";
char constexpr LFGDungeonEntryfmt[] = "nssssssssssssssssxiiiiiiiiixxixixxxxxxxxxxxxxxxxx";
char constexpr LightEntryfmt[] = "nifffxxxxxxxxxx";
char constexpr LiquidTypefmt[] = "nxxixixxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
char constexpr LockEntryfmt[] = "niiiiiiiiiiiiiiiiiiiiiiiixxxxxxxx";
char constexpr MailTemplateEntryfmt[] = "nxxxxxxxxxxxxxxxxxssssssssssssssssx";
char constexpr MapEntryfmt[] = "nxiixssssssssssssssssxixxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxixiffxiii";
char constexpr MapDifficultyEntryfmt[] = "diisxxxxxxxxxxxxxxxxiix";
char constexpr MovieEntryfmt[] = "nxx";
char constexpr OverrideSpellDatafmt[] = "niiiiiiiiiix";
char constexpr PowerDisplayfmt[] = "nixxxx";
char constexpr QuestSortEntryfmt[] = "nxxxxxxxxxxxxxxxxx";
char constexpr QuestXPfmt[] = "niiiiiiiiii";
char constexpr QuestFactionRewardfmt[] = "niiiiiiiiii";
char constexpr PvPDifficultyfmt[] = "diiiii";
char constexpr RandomPropertiesPointsfmt[] = "niiiiiiiiiiiiiii";
char constexpr ScalingStatDistributionfmt[] = "niiiiiiiiiiiiiiiiiiiii";
char constexpr ScalingStatValuesfmt[] = "iniiiiiiiiiiiiiiiiiiiiii";
char constexpr SkillLinefmt[] = "nixssssssssssssssssxxxxxxxxxxxxxxxxxxixxxxxxxxxxxxxxxxxi";
char constexpr SkillLineAbilityfmt[] = "niiiixxiiiiixx";
char constexpr SoundEntriesfmt[] = "nxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
char constexpr SpellCastTimefmt[] = "nixx";
char constexpr SpellCategoryfmt[] = "ni";
char constexpr SpellDifficultyfmt[] = "niiii";
char constexpr SpellDurationfmt[] = "niii";
char constexpr SpellEntryfmt[] = "niiiiiiiiiiiixixiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiifxiiiiiiiiiiiiiiiiiiiiiiiiiiiifffiiiiiiiiiiiiiiiiiiiiifffiiiiiiiiiiiiiiifffiiiiiiiiiiiiixssssssssssssssssxssssssssssssssssxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxiiiiiiiiiiixfffxxxiiiiixxfffxx";
char constexpr SpellFocusObjectfmt[] = "nxxxxxxxxxxxxxxxxx";
char constexpr SpellItemEnchantmentfmt[] = "niiiiiiixxxiiissssssssssssssssxiiiiiii";
char constexpr SpellItemEnchantmentConditionfmt[] = "nbbbbbxxxxxbbbbbbbbbbiiiiiXXXXX";
char constexpr SpellRadiusfmt[] = "nfff";
char constexpr SpellRangefmt[] = "nffffixxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
char constexpr SpellRuneCostfmt[] = "niiii";
char constexpr SpellShapeshiftfmt[] = "nxxxxxxxxxxxxxxxxxxiixiiixxiiiiiiii";
char constexpr StableSlotPricesfmt[] = "ni";
char constexpr SummonPropertiesfmt[] = "niiiii";
char constexpr TalentEntryfmt[] = "niiiiiiiixxxxixxixxixxx";
char constexpr TalentTabEntryfmt[] = "nxxxxxxxxxxxxxxxxxxxiiix";
char constexpr TaxiNodesEntryfmt[] = "nifffssssssssssssssssxii";
char constexpr TaxiPathEntryfmt[] = "niii";
char constexpr TaxiPathNodeEntryfmt[] = "diiifffiiii";
char constexpr TeamContributionPointsfmt[] = "df";
char constexpr TotemCategoryEntryfmt[] = "nxxxxxxxxxxxxxxxxxii";
char constexpr TransportAnimationfmt[] = "diifffx";
char constexpr TransportRotationfmt[] = "diiffff";
char constexpr VehicleEntryfmt[] = "niffffiiiiiiiifffffffffffffffssssfifiixx";
char constexpr VehicleSeatEntryfmt[] = "niiffffffffffiiiiiifffffffiiifffiiiiiiiffiiiiixxxxxxxxxxxx";
char constexpr WMOAreaTableEntryfmt[] = "niiixxxxxiixxxxxxxxxxxxxxxxx";
char constexpr WorldMapAreaEntryfmt[] = "xinxffffixx";
char constexpr WorldMapOverlayEntryfmt[] = "nxiiiixxxxxxxxxxx";
#endif

View File

@@ -60,7 +60,6 @@ target_include_directories(worldserver
target_link_libraries(worldserver
PRIVATE
game-interface
scripts-interface
PUBLIC
game
shared