Project tidy up and sync
This commit is contained in:
parent
fe79b0dc29
commit
87b8e0ad13
@ -1,36 +0,0 @@
|
||||
# This code is part of MaNGOS. Contributor & Copyright details are in AUTHORS/THANKS.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
cmake_minimum_required (VERSION 2.8)
|
||||
|
||||
INCLUDE(cmake/FindMySQL.cmake)
|
||||
INCLUDE(cmake/FindPostgreSQL.cmake)
|
||||
|
||||
MESSAGE("-- Check PostgreSQL")
|
||||
FIND_PGSQL()
|
||||
ADD_DEFINITIONS(-DDO_POSTGRESQL)
|
||||
|
||||
MESSAGE("-- Check MySQL")
|
||||
FIND_MYSQL()
|
||||
ADD_DEFINITIONS(-DDO_MYSQL)
|
||||
|
||||
INCLUDE_DIRECTORIES(${MYSQL_INCLUDE_DIR})
|
||||
INCLUDE_DIRECTORIES(${PGSQL_INCLUDE_DIR})
|
||||
|
||||
ADD_EXECUTABLE (mysql2pgsql src/main.cpp)
|
||||
|
||||
TARGET_LINK_LIBRARIES(mysql2pgsql ${PGSQL_LIBRARIES})
|
||||
TARGET_LINK_LIBRARIES(mysql2pgsql ${MYSQL_LIBRARIES})
|
@ -1,47 +0,0 @@
|
||||
MySQL to PostgreSQL converter
|
||||
=============================
|
||||
*mangos* supports both MySQL and PostgreSQL as database backends. As we
|
||||
provide the database structure and content only in MySQL format, this helper
|
||||
application will allow you to export your database from a local MySQL server
|
||||
to a local PostgreSQL server.
|
||||
|
||||
Requirements
|
||||
------------
|
||||
For the converter you will need both [MySQL][10] and [PostgreSQL][11] installed
|
||||
on your system, including development headers.
|
||||
|
||||
Compilation
|
||||
-----------
|
||||
To build the converter you will need [CMake][20], a C/C++ compiler of your
|
||||
choice ([Visual Studio Express for Windows Desktop][21], [GCC][22], and
|
||||
[Clang][23] have been tested).
|
||||
|
||||
Compilation - Linux
|
||||
-------------------
|
||||
Build the command-line utility by executing:
|
||||
|
||||
$ rm -rf _build && mkdir -p _build && cd _build
|
||||
$ cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr ..
|
||||
$ make
|
||||
|
||||
Compilation - Windows
|
||||
---------------------
|
||||
Build the command-line utility by opening this directory with the CMake-GUI.
|
||||
Select a matching Visual Studio generator, and create project files.
|
||||
|
||||
Once done, open the generated project files in Visual Studio and build the
|
||||
converter.
|
||||
|
||||
Usage
|
||||
-----
|
||||
Execute the generated `mysql2pgsql` application to convert the *mangos* databases
|
||||
from MySQL to PostgreSQL.
|
||||
|
||||
|
||||
[10]: http://www.mysql.com/ "MySQL"
|
||||
[11]: http://www.postgresql.org/ "PostgreSQL"
|
||||
|
||||
[20]: http://www.cmake.org/ "CMake · Cross Platform Make"
|
||||
[21]: http://www.microsoft.com/visualstudio/eng/products/visual-studio-express-for-windows-desktop "Visual Studio Express for Windows Desktop"
|
||||
[22]: http://gcc.gnu.org/ "GCC"
|
||||
[23]: http://clang.llvm.org/ "Clang"
|
@ -1,68 +0,0 @@
|
||||
# - Find mysqlclient
|
||||
# Find the native MySQL includes and library
|
||||
#
|
||||
# MYSQL_INCLUDE_DIR - where to find mysql.h, etc.
|
||||
# MYSQL_LIBRARIES - List of libraries when using MySQL.
|
||||
# MYSQL_FOUND - True if MySQL found.
|
||||
MACRO(FIND_MYSQL)
|
||||
|
||||
IF (MYSQL_INCLUDE_DIR)
|
||||
# Already in cache, be silent
|
||||
SET(MySQL_FIND_QUIETLY TRUE)
|
||||
ENDIF (MYSQL_INCLUDE_DIR)
|
||||
|
||||
FIND_PATH(MYSQL_INCLUDE_DIR mysql.h
|
||||
$ENV{ProgramFiles}/MySQL/*/include
|
||||
$ENV{SystemDrive}/MySQL/*/include
|
||||
/usr/local/mysql/include
|
||||
/usr/local/include/mysql
|
||||
/usr/local/include
|
||||
/usr/include/mysql
|
||||
/usr/include
|
||||
/usr/mysql/include
|
||||
)
|
||||
|
||||
IF(MSVC)
|
||||
SET(MYSQL_NAMES libmysql)
|
||||
ELSE(MSVC)
|
||||
SET(MYSQL_NAMES mysqlclient mysqlclient_r)
|
||||
ENDIF(MSVC)
|
||||
SET(MYSQL_SEARCH_LIB_PATHS
|
||||
$ENV{ProgramFiles}/MySQL/*/lib/opt
|
||||
$ENV{SystemDrive}/MySQL/*/lib/opt
|
||||
/usr/local/mysql/lib
|
||||
/usr/local/lib/mysql
|
||||
/usr/local/lib
|
||||
/usr/lib/mysql
|
||||
/usr/lib
|
||||
)
|
||||
FIND_LIBRARY(MYSQL_LIBRARY
|
||||
NAMES ${MYSQL_NAMES}
|
||||
PATHS ${MYSQL_SEARCH_LIB_PATHS}
|
||||
)
|
||||
|
||||
IF (MYSQL_INCLUDE_DIR AND MYSQL_LIBRARY)
|
||||
SET(MYSQL_FOUND TRUE)
|
||||
SET( MYSQL_LIBRARIES ${MYSQL_LIBRARY} )
|
||||
ELSE (MYSQL_INCLUDE_DIR AND MYSQL_LIBRARY)
|
||||
SET(MYSQL_FOUND FALSE)
|
||||
SET( MYSQL_LIBRARIES )
|
||||
ENDIF (MYSQL_INCLUDE_DIR AND MYSQL_LIBRARY)
|
||||
|
||||
IF (MYSQL_FOUND)
|
||||
IF (NOT MySQL_FIND_QUIETLY)
|
||||
MESSAGE(STATUS "Found MySQL: ${MYSQL_LIBRARY}")
|
||||
ENDIF (NOT MySQL_FIND_QUIETLY)
|
||||
ELSE (MYSQL_FOUND)
|
||||
IF (MySQL_FIND_REQUIRED)
|
||||
MESSAGE(STATUS "Looked for MySQL libraries named ${MYSQL_NAMES}.")
|
||||
MESSAGE(FATAL_ERROR "Could NOT find MySQL library")
|
||||
ENDIF (MySQL_FIND_REQUIRED)
|
||||
ENDIF (MYSQL_FOUND)
|
||||
|
||||
MARK_AS_ADVANCED(
|
||||
MYSQL_LIBRARY
|
||||
MYSQL_INCLUDE_DIR
|
||||
)
|
||||
|
||||
ENDMACRO(FIND_MYSQL)
|
@ -1,67 +0,0 @@
|
||||
# - Find libpq
|
||||
# Find the native PostgreSQL includes and library
|
||||
#
|
||||
# PGSQL_INCLUDE_DIR - where to find libpq-fe.h, etc.
|
||||
# PGSQL_LIBRARIES - List of libraries when using PGSQL.
|
||||
# PGSQL_FOUND - True if PGSQL found.
|
||||
|
||||
MACRO(FIND_PGSQL)
|
||||
IF (PGSQL_INCLUDE_DIR)
|
||||
# Already in cache, be silent
|
||||
SET(PostgreSQL_FIND_QUIETLY TRUE)
|
||||
ENDIF (PGSQL_INCLUDE_DIR)
|
||||
|
||||
FIND_PATH(PGSQL_INCLUDE_DIR libpq-fe.h
|
||||
$ENV{ProgramFiles}/PostgreSQL/*/include
|
||||
$ENV{SystemDrive}/PostgreSQL/*/include
|
||||
/usr/local/pgsql/include
|
||||
/usr/local/postgresql/include
|
||||
/usr/local/include/pgsql
|
||||
/usr/local/include/postgresql
|
||||
/usr/local/include
|
||||
/usr/include/pgsql
|
||||
/usr/include/postgresql
|
||||
/usr/include
|
||||
/usr/pgsql/include
|
||||
/usr/postgresql/include
|
||||
)
|
||||
|
||||
SET(PGSQL_NAMES pq libpq)
|
||||
SET(PGSQL_SEARCH_LIB_PATHS
|
||||
${PGSQL_SEARCH_LIB_PATHS}
|
||||
$ENV{ProgramFiles}/PostgreSQL/*/lib
|
||||
$ENV{SystemDrive}/PostgreSQL/*/lib
|
||||
/usr/local/pgsql/lib
|
||||
/usr/local/lib
|
||||
/usr/lib
|
||||
)
|
||||
FIND_LIBRARY(PGSQL_LIBRARY
|
||||
NAMES ${PGSQL_NAMES}
|
||||
PATHS ${PGSQL_SEARCH_LIB_PATHS}
|
||||
)
|
||||
|
||||
IF (PGSQL_INCLUDE_DIR AND PGSQL_LIBRARY)
|
||||
SET(PGSQL_FOUND TRUE)
|
||||
SET( PGSQL_LIBRARIES ${PGSQL_LIBRARY} )
|
||||
ELSE (PGSQL_INCLUDE_DIR AND PGSQL_LIBRARY)
|
||||
SET(PGSQL_FOUND FALSE)
|
||||
SET( PGSQL_LIBRARIES )
|
||||
ENDIF (PGSQL_INCLUDE_DIR AND PGSQL_LIBRARY)
|
||||
|
||||
IF (PGSQL_FOUND)
|
||||
IF (NOT PostgreSQL_FIND_QUIETLY)
|
||||
MESSAGE(STATUS "Found PostgreSQL: ${PGSQL_LIBRARY}")
|
||||
ENDIF (NOT PostgreSQL_FIND_QUIETLY)
|
||||
ELSE (PGSQL_FOUND)
|
||||
IF (PostgreSQL_FIND_REQUIRED)
|
||||
MESSAGE(STATUS "Looked for PostgreSQL libraries named ${PGSQL_NAMES}.")
|
||||
MESSAGE(FATAL_ERROR "Could NOT find PostgreSQL library")
|
||||
ENDIF (PostgreSQL_FIND_REQUIRED)
|
||||
ENDIF (PGSQL_FOUND)
|
||||
|
||||
MARK_AS_ADVANCED(
|
||||
PGSQL_LIBRARY
|
||||
PGSQL_INCLUDE_DIR
|
||||
)
|
||||
ENDMACRO(FIND_PGSQL)
|
||||
|
@ -1,189 +0,0 @@
|
||||
/**
|
||||
* MaNGOS is a full featured server for World of Warcraft, supporting
|
||||
* the following clients: 1.12.x, 2.4.3, 3.3.5a, 4.3.4a and 5.4.8
|
||||
*
|
||||
* Copyright (C) 2005-2020 MaNGOS <https://getmangos.eu>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* World of Warcraft, and all World of Warcraft or Warcraft art, images,
|
||||
* and lore are copyrighted by Blizzard Entertainment, Inc.
|
||||
*/
|
||||
|
||||
#ifndef _DEFINES_
|
||||
#define _DEFINES_
|
||||
|
||||
#ifdef WIN32
|
||||
#include <winsock2.h>
|
||||
#pragma warning(disable:4996)
|
||||
#endif
|
||||
|
||||
#include <libpq-fe.h>
|
||||
#include <mysql.h>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <map>
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
#include <cstdlib>
|
||||
#include <string.h>
|
||||
using namespace std;
|
||||
|
||||
|
||||
#ifdef WIN32
|
||||
typedef unsigned __int64 uint64;
|
||||
typedef unsigned int uint32;
|
||||
#else
|
||||
#include <stdint.h>
|
||||
#ifndef uint64_t
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
typedef uint64_t uint64;
|
||||
typedef unsigned int uint32;
|
||||
#endif
|
||||
|
||||
struct sField
|
||||
{
|
||||
string name; // field name
|
||||
string def; // field default data
|
||||
string type; // field type
|
||||
uint32 flags; // filed flags, see field flags;
|
||||
};
|
||||
typedef vector<sField> T_Table;
|
||||
typedef vector<string> T_TableList;
|
||||
typedef map< string, T_Table > TDataBase;
|
||||
|
||||
static
|
||||
void pg_notice(void* arg, const char* message)
|
||||
{
|
||||
/// Do nothing
|
||||
//printf("%s\n", message);
|
||||
}
|
||||
|
||||
inline
|
||||
string ConvertNativeType(enum_field_types mysqlType, uint32 length)
|
||||
{
|
||||
|
||||
switch (mysqlType)
|
||||
{
|
||||
case FIELD_TYPE_TIMESTAMP:
|
||||
return "timestamp";
|
||||
case FIELD_TYPE_BIT:
|
||||
return "bit(1)";
|
||||
case FIELD_TYPE_DATETIME:
|
||||
return "date";
|
||||
case FIELD_TYPE_YEAR:
|
||||
case FIELD_TYPE_BLOB:
|
||||
case FIELD_TYPE_SET:
|
||||
case FIELD_TYPE_NULL:
|
||||
case FIELD_TYPE_ENUM:
|
||||
return "text";
|
||||
case FIELD_TYPE_TINY:
|
||||
case FIELD_TYPE_SHORT:
|
||||
case FIELD_TYPE_INT24:
|
||||
return "integer";
|
||||
case FIELD_TYPE_LONGLONG:
|
||||
case FIELD_TYPE_LONG:
|
||||
{
|
||||
string temp;
|
||||
char str[10];
|
||||
temp = "numeric";
|
||||
if (length)
|
||||
{
|
||||
temp.append("(");
|
||||
sprintf(str, "%d", length);
|
||||
temp.append(str);
|
||||
temp.append(")");
|
||||
}
|
||||
return temp;
|
||||
}
|
||||
case FIELD_TYPE_DECIMAL:
|
||||
case FIELD_TYPE_FLOAT:
|
||||
case FIELD_TYPE_DOUBLE:
|
||||
return "float";
|
||||
case FIELD_TYPE_STRING:
|
||||
{
|
||||
string temp;
|
||||
char str[10];
|
||||
temp = "char";
|
||||
if (length)
|
||||
{
|
||||
temp.append("(");
|
||||
sprintf(str, "%d", length);
|
||||
temp.append(str);
|
||||
temp.append(")");
|
||||
}
|
||||
return temp;
|
||||
}
|
||||
case FIELD_TYPE_VAR_STRING:
|
||||
{
|
||||
string temp;
|
||||
char str[10];
|
||||
temp = "varchar";
|
||||
if (length)
|
||||
{
|
||||
temp.append("(");
|
||||
sprintf(str, "%d", length);
|
||||
temp.append(str);
|
||||
temp.append(")");
|
||||
}
|
||||
return temp;
|
||||
}
|
||||
default:
|
||||
return "text";
|
||||
}
|
||||
return "text";
|
||||
}
|
||||
|
||||
inline
|
||||
bool IsNeeedEscapeString(enum_field_types mysqlType)
|
||||
{
|
||||
switch (mysqlType)
|
||||
{
|
||||
case FIELD_TYPE_VAR_STRING:
|
||||
case FIELD_TYPE_STRING:
|
||||
case FIELD_TYPE_TINY_BLOB:
|
||||
case FIELD_TYPE_MEDIUM_BLOB:
|
||||
case FIELD_TYPE_LONG_BLOB:
|
||||
case FIELD_TYPE_BLOB:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
inline
|
||||
void PG_Exec_str(string sql, PGconn* mPGconn)
|
||||
{
|
||||
PGresult* res = PQexec(mPGconn, sql.c_str());
|
||||
if (PQresultStatus(res) != PGRES_COMMAND_OK)
|
||||
{
|
||||
printf("SQL: %s", sql.c_str());
|
||||
printf("SQL %s", PQerrorMessage(mPGconn));
|
||||
}
|
||||
}
|
||||
|
||||
void PG_Escape_Str(string& str)
|
||||
{
|
||||
if (str.empty())
|
||||
return;
|
||||
char* buf = new char[str.size() * 2 + 1];
|
||||
PQescapeString(buf, str.c_str(), str.size());
|
||||
str = buf;
|
||||
delete[] buf;
|
||||
}
|
||||
|
||||
#endif
|
@ -1,344 +0,0 @@
|
||||
/**
|
||||
* MaNGOS is a full featured server for World of Warcraft, supporting
|
||||
* the following clients: 1.12.x, 2.4.3, 3.3.5a, 4.3.4a and 5.4.8
|
||||
*
|
||||
* Copyright (C) 2005-2020 MaNGOS <https://getmangos.eu>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* World of Warcraft, and all World of Warcraft or Warcraft art, images,
|
||||
* and lore are copyrighted by Blizzard Entertainment, Inc.
|
||||
*/
|
||||
|
||||
#include "defines.h"
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
char sPGhost[26], sPGport[26], sPGdb[26], sPGuser[26], sPGpass[26];
|
||||
printf("Postgres connection settings\n Host>");
|
||||
scanf("%s", sPGhost);
|
||||
printf(" Port>");
|
||||
scanf("%s", sPGport);
|
||||
printf(" Base>");
|
||||
scanf("%s", sPGdb);
|
||||
printf(" User>");
|
||||
scanf("%s", sPGuser);
|
||||
printf(" Pass>");
|
||||
scanf("%s", sPGpass);
|
||||
|
||||
///////////////////////////////
|
||||
///////PGSQL Connect///////////
|
||||
///////////////////////////////
|
||||
PGconn* mPGconn = NULL;
|
||||
mPGconn = PQsetdbLogin(sPGhost, sPGport, NULL, NULL, sPGdb, sPGuser, sPGpass);
|
||||
|
||||
if (PQstatus(mPGconn) != CONNECTION_OK)
|
||||
{
|
||||
printf("Could not connect to Postgre database at [%s]: \n %s\n", sPGhost, PQerrorMessage(mPGconn));
|
||||
PQfinish(mPGconn);
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("Connected to Postgre database at [%s]\n", sPGhost);
|
||||
printf(" PostgreSQL server ver: [%d]\n\n", PQserverVersion(mPGconn));
|
||||
}
|
||||
|
||||
/// Set dummy notice processor
|
||||
PQsetNoticeProcessor(mPGconn, pg_notice, mPGconn);
|
||||
|
||||
///////////////////////////////
|
||||
///////MySQL Connect///////////
|
||||
///////////////////////////////
|
||||
MYSQL* mysqlInit;
|
||||
mysqlInit = mysql_init(NULL);
|
||||
if (!mysqlInit)
|
||||
{
|
||||
printf("Could not initialize Mysql connection\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
char sMYhost[26], sMYdb[26], sMYuser[26], sMYpass[26];
|
||||
int iMYport;
|
||||
printf("Mysql connection settings \n Host>");
|
||||
scanf("%s", sMYhost);
|
||||
printf(" Port>");
|
||||
scanf("%d", &iMYport);
|
||||
printf(" Base>");
|
||||
scanf("%s", sMYdb);
|
||||
printf(" User>");
|
||||
scanf("%s", sMYuser);
|
||||
printf(" Pass>");
|
||||
scanf("%s", sMYpass);
|
||||
|
||||
mysql_options(mysqlInit, MYSQL_SET_CHARSET_NAME, "utf8");
|
||||
|
||||
MYSQL* mMysql;
|
||||
mMysql = mysql_real_connect(mysqlInit, sMYhost, sMYuser, sMYpass, sMYdb, iMYport, NULL, 0);
|
||||
|
||||
if (mMysql)
|
||||
{
|
||||
printf("Connected to MySQL database at [%s] \n", sMYhost);
|
||||
printf(" MySQL client library: [%s] \n", mysql_get_client_info());
|
||||
printf(" MySQL server ver: [%s] \n\n", mysql_get_server_info(mMysql));
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("Could not connect to MySQL database at [%s]:\n %s\n", sMYhost , mysql_error(mysqlInit));
|
||||
mysql_close(mysqlInit);
|
||||
return 1;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
MYSQL_RES* result = NULL;
|
||||
MYSQL_ROW row;
|
||||
MYSQL_FIELD* fields = NULL;
|
||||
uint64 rowCount = 0;
|
||||
uint32 fieldCount = 0;
|
||||
result = mysql_list_tables(mMysql , NULL);
|
||||
rowCount = mysql_num_rows(result);
|
||||
|
||||
/***********************/
|
||||
/* get list of tables */
|
||||
/***********************/
|
||||
T_TableList mTableList;
|
||||
mTableList.reserve((size_t)rowCount);
|
||||
while ((row = mysql_fetch_row(result)) != NULL)
|
||||
{
|
||||
for (uint32 i = 0; i < mysql_num_fields(result); i++)
|
||||
{
|
||||
mTableList.push_back(row[i]);
|
||||
}
|
||||
}
|
||||
mysql_free_result(result);
|
||||
|
||||
/****************************************/
|
||||
/* convert filed type and default type */
|
||||
/****************************************/
|
||||
T_Table m_Table;
|
||||
TDataBase m_DataBase_Map;
|
||||
m_DataBase_Map.clear();
|
||||
for (uint32 j = 0; j < mTableList.size(); ++j)
|
||||
{
|
||||
result = mysql_list_fields(mMysql, mTableList[j].c_str(), NULL);
|
||||
fieldCount = mysql_num_fields(result);
|
||||
fields = mysql_fetch_fields(result);
|
||||
|
||||
for (uint32 i = 0; i < fieldCount; ++i)
|
||||
{
|
||||
sField mfield;
|
||||
mfield.name = fields[i].name;
|
||||
if (!fields[i].def)
|
||||
{
|
||||
mfield.def = "NULL";
|
||||
}
|
||||
else if (!strcmp(fields[i].def, "0000-00-00 00:00:00"))
|
||||
{
|
||||
/// Convert MySQL Default timestamp to PGSQL Default timestamp
|
||||
mfield.def.append("'1970-01-01 00:00:00'");
|
||||
}
|
||||
else
|
||||
{
|
||||
/// Append '
|
||||
mfield.def.append("'");
|
||||
mfield.def.append(fields[i].def);;
|
||||
mfield.def.append("'");
|
||||
}
|
||||
mfield.type = ConvertNativeType(fields[i].type, fields[i].length);
|
||||
mfield.flags = fields[i].flags;
|
||||
m_Table.push_back(mfield);
|
||||
}
|
||||
m_DataBase_Map[mTableList[j]] = m_Table;
|
||||
m_Table.clear();
|
||||
mysql_free_result(result);
|
||||
}
|
||||
|
||||
/******************************************/
|
||||
/* Conversion of the layout of the tables */
|
||||
/******************************************/
|
||||
|
||||
uint32 count = 0;
|
||||
TDataBase::const_iterator citr;
|
||||
for (citr = m_DataBase_Map.begin(); citr != m_DataBase_Map.end(); ++citr)
|
||||
{
|
||||
ostringstream sql_str;
|
||||
sql_str << "DROP TABLE IF EXISTS " << (*citr).first.c_str() << ";\n";
|
||||
sql_str << "CREATE TABLE " << (*citr).first.c_str() << "(\n";
|
||||
|
||||
T_Table::const_iterator v_iter;
|
||||
ostringstream prim_key_str;
|
||||
ostringstream index_str;
|
||||
for (v_iter = (*citr).second.begin();
|
||||
v_iter != (*citr).second.end();
|
||||
++v_iter)
|
||||
{
|
||||
sql_str << " " << (*v_iter).name;
|
||||
if (((*v_iter).flags & AUTO_INCREMENT_FLAG) != 0)
|
||||
{
|
||||
/// AUTO_INCREMENT fields not have "default" data
|
||||
sql_str << " bigserial";
|
||||
}
|
||||
else
|
||||
{
|
||||
sql_str << " " << (*v_iter).type;
|
||||
sql_str << " default " << (*v_iter).def;
|
||||
}
|
||||
/// IF column have PRIMARY KEY flag then use column in PRIMARY KEY
|
||||
if (IS_PRI_KEY((*v_iter).flags) != 0)
|
||||
{
|
||||
if (prim_key_str.str().size())
|
||||
prim_key_str << ", ";
|
||||
else
|
||||
{
|
||||
prim_key_str << "ALTER TABLE ";
|
||||
prim_key_str << (*citr).first.c_str();
|
||||
prim_key_str << " ADD CONSTRAINT pk_";
|
||||
prim_key_str << (*citr).first.c_str();
|
||||
prim_key_str << "_";
|
||||
prim_key_str << (*v_iter).name;
|
||||
prim_key_str << " PRIMARY KEY (";
|
||||
}
|
||||
prim_key_str << (*v_iter).name;
|
||||
}
|
||||
else if (((*v_iter).flags & MULTIPLE_KEY_FLAG) != 0)
|
||||
{
|
||||
/// IF column have INDEX flag then create INDEX
|
||||
index_str << "CREATE INDEX idx_";
|
||||
index_str << (*citr).first.c_str();
|
||||
index_str << "_";
|
||||
index_str << (*v_iter).name;
|
||||
index_str << " ON ";
|
||||
index_str << (*citr).first.c_str();
|
||||
index_str << " USING btree (";
|
||||
index_str << (*v_iter).name;
|
||||
index_str << ");\n";
|
||||
}
|
||||
else if (((*v_iter).flags & UNIQUE_KEY_FLAG) != 0)
|
||||
{
|
||||
/// IF column have UNIQUE INDEX flag then create INDEX
|
||||
index_str << "CREATE UNIQUE INDEX uidx_";
|
||||
index_str << (*citr).first.c_str();
|
||||
index_str << "_";
|
||||
index_str << (*v_iter).name;
|
||||
index_str << " ON ";
|
||||
index_str << (*citr).first.c_str();
|
||||
index_str << " USING btree (";
|
||||
index_str << (*v_iter).name;
|
||||
index_str << ");\n";
|
||||
}
|
||||
/// don't output "," for last column
|
||||
if (v_iter + 1 != (*citr).second.end())
|
||||
sql_str << ",\n";
|
||||
else
|
||||
sql_str << "\n";
|
||||
}
|
||||
sql_str << ")\n";
|
||||
|
||||
/// Out Table structure
|
||||
PG_Exec_str(sql_str.str(), mPGconn);
|
||||
|
||||
/// out PRIMARY KEY
|
||||
if (prim_key_str.str().size())
|
||||
{
|
||||
prim_key_str << ")";
|
||||
PG_Exec_str(prim_key_str.str(), mPGconn);
|
||||
}
|
||||
|
||||
/// out INDEX's
|
||||
if (index_str.str().size())
|
||||
PG_Exec_str(index_str.str(), mPGconn);
|
||||
|
||||
++count;
|
||||
printf("Convert [%d] tables...\r", count);
|
||||
}
|
||||
printf("Completed the conversion of [%d] tables!\n", count);
|
||||
|
||||
/****************/
|
||||
/* Copying data */
|
||||
/****************/
|
||||
|
||||
count = 0;
|
||||
for (uint32 j = 0; j < mTableList.size(); ++j)
|
||||
{
|
||||
ostringstream sql_str;
|
||||
sql_str << "SELECT * FROM ";
|
||||
sql_str << mTableList[j].c_str();
|
||||
|
||||
if (mysql_query(mysqlInit, sql_str.str().c_str()))
|
||||
continue;
|
||||
if (!(result = mysql_store_result(mysqlInit)))
|
||||
continue;
|
||||
|
||||
while ((row = mysql_fetch_row(result)) != NULL)
|
||||
{
|
||||
ostringstream insert_str;
|
||||
insert_str << "INSERT INTO ";
|
||||
insert_str << mTableList[j].c_str();
|
||||
insert_str << " VALUES (";
|
||||
|
||||
fieldCount = mysql_num_fields(result);
|
||||
fields = mysql_fetch_fields(result);
|
||||
for (uint32 i = 0 ; i < fieldCount ; ++i)
|
||||
{
|
||||
if (!row[i])
|
||||
insert_str << "NULL";
|
||||
else
|
||||
{
|
||||
if (IsNeeedEscapeString(fields[i].type))
|
||||
{
|
||||
string field_str = row[i];
|
||||
PG_Escape_Str(field_str);
|
||||
insert_str << "E'";
|
||||
insert_str << field_str.c_str();
|
||||
insert_str << "'";
|
||||
}
|
||||
else if (!strcmp(row[i], "0000-00-00 00:00:00"))
|
||||
{
|
||||
/// Convert MySQL timestamp to PGSQL timestamp
|
||||
insert_str << "'1970-01-01 00:00:00'";
|
||||
}
|
||||
else
|
||||
{
|
||||
insert_str << "'";
|
||||
insert_str << row[i];
|
||||
insert_str << "'";
|
||||
}
|
||||
}
|
||||
|
||||
/// don't output "," for last column
|
||||
if (i + 1 != fieldCount)
|
||||
insert_str << ",";
|
||||
else
|
||||
insert_str << ")\n";
|
||||
}
|
||||
PG_Exec_str(insert_str.str(), mPGconn);
|
||||
}
|
||||
mysql_free_result(result);
|
||||
++count;
|
||||
printf("Copied data from [%d] tables...\r", count);
|
||||
}
|
||||
printf("Finished copying the data from [%d] tables!\n", count);
|
||||
mTableList.clear();
|
||||
m_DataBase_Map.clear();
|
||||
|
||||
/// Close connections
|
||||
mysql_close(mMysql);
|
||||
PQfinish(mPGconn);
|
||||
|
||||
printf("end\n");
|
||||
return 0;
|
||||
|
||||
}
|
@ -256,10 +256,10 @@ function GetPrerequisites()
|
||||
# Ubuntu 17.10
|
||||
su -c "apt-get -y install build-essential curl autoconf automake cmake libbz2-dev libace-dev libssl-dev libmysqlclient-dev libtool" root
|
||||
;;
|
||||
"bionic")
|
||||
"bionic")
|
||||
# Ubuntu 18.04 LTS
|
||||
su -c "apt-get -y install build-essential curl autoconf automake cmake libbz2-dev libace-dev libssl-dev libmysqlclient-dev libtool" root
|
||||
"disco")
|
||||
"disco")
|
||||
# Ubuntu 19.04
|
||||
su -c "apt-get -y install build-essential curl autoconf automake cmake libbz2-dev libace-dev libssl-dev libmysqlclient-dev libtool" root
|
||||
;;
|
||||
|
@ -213,10 +213,7 @@ bool BattleGroundAB::HandleAreaTrigger(Player* source, uint32 trigger)
|
||||
else
|
||||
{ source->LeaveBattleground(); }
|
||||
break;
|
||||
// break;
|
||||
default:
|
||||
// sLog.outError("WARNING: Unhandled AreaTrigger in Battleground: %u", trigger);
|
||||
// source->GetSession()->SendAreaTriggerMessage("Warning: Unhandled AreaTrigger in Battleground: %u", trigger);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
@ -365,9 +365,7 @@ bool BattleGroundAV::HandleAreaTrigger(Player* source, uint32 trigger)
|
||||
else
|
||||
{ source->LeaveBattleground(); }
|
||||
break;
|
||||
// source->Unmount();
|
||||
default:
|
||||
// source->GetSession()->SendAreaTriggerMessage("Warning: Unhandled AreaTrigger in Battleground: %u", trigger);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
@ -446,8 +446,6 @@ void WorldSession::HandleLeaveBattlefieldOpcode(WorldPacket& recv_data)
|
||||
recv_data.read_skip<uint8>(); // BattleGroundTypeId-1 ?
|
||||
recv_data.read_skip<uint16>(); // unk2 0
|
||||
|
||||
// if(bgTypeId >= MAX_BATTLEGROUND_TYPES) // cheating? but not important in this case
|
||||
// return;
|
||||
|
||||
// not allow leave battleground in combat
|
||||
if (_player->IsInCombat())
|
||||
|
@ -459,8 +459,6 @@ bool BattleGroundWS::HandleAreaTrigger(Player* source, uint32 trigger)
|
||||
if (GetStatus() != STATUS_IN_PROGRESS)
|
||||
{ return false; }
|
||||
|
||||
// uint32 SpellId = 0;
|
||||
// uint64 buff_guid = 0;
|
||||
switch (trigger)
|
||||
{
|
||||
case 3646: // Alliance Flag spawn
|
||||
|
@ -273,7 +273,9 @@ bool ChatHandler::HandleDebugSendOpcodeCommand(char* /*args*/)
|
||||
data << value;
|
||||
}
|
||||
else if (type == "pguid")
|
||||
{ data << unit->GetPackGUID(); }
|
||||
{
|
||||
data << unit->GetPackGUID();
|
||||
}
|
||||
else if (type == "guid")
|
||||
{ data << unit->GetObjectGuid(); }
|
||||
else if(type == "mypguid")
|
||||
|
@ -451,8 +451,6 @@ void PathFinder::BuildPointPath(const float* startPoint, const float* endPoint)
|
||||
for (uint32 i = 0; i < pointCount; ++i)
|
||||
{ m_pathPoints[i] = Vector3(pathPoints[i * VERTEX_SIZE + 2], pathPoints[i * VERTEX_SIZE], pathPoints[i * VERTEX_SIZE + 1]); }
|
||||
|
||||
//NormalizePath(pointCount);
|
||||
|
||||
// first point is always our current location - we need the next one
|
||||
setActualEndPosition(m_pathPoints[pointCount - 1]);
|
||||
|
||||
@ -494,8 +492,6 @@ void PathFinder::BuildShortcut()
|
||||
m_pathPoints[0] = getStartPosition();
|
||||
m_pathPoints[1] = getActualEndPosition();
|
||||
|
||||
//NormalizePath(size);
|
||||
|
||||
m_type = PATHFIND_SHORTCUT;
|
||||
}
|
||||
|
||||
|
@ -277,7 +277,9 @@ bool WaypointMovementGenerator<Creature>::CanMove(int32 diff, Creature& u)
|
||||
{
|
||||
i_nextMoveTime.Update(diff);
|
||||
if (i_nextMoveTime.Passed() && u.hasUnitState(UNIT_STAT_WAYPOINT_PAUSED))
|
||||
{ i_nextMoveTime.Reset(1); }
|
||||
{
|
||||
i_nextMoveTime.Reset(1);
|
||||
}
|
||||
|
||||
return i_nextMoveTime.Passed() && !u.hasUnitState(UNIT_STAT_WAYPOINT_PAUSED);
|
||||
}
|
||||
|
@ -119,8 +119,7 @@ void AggressorAI::EnterEvadeMode()
|
||||
m_creature->SetLootRecipient(NULL);
|
||||
}
|
||||
|
||||
void
|
||||
AggressorAI::UpdateAI(const uint32 /*diff*/)
|
||||
void AggressorAI::UpdateAI(const uint32 /*diff*/)
|
||||
{
|
||||
// update i_victimGuid if m_creature->getVictim() !=0 and changed
|
||||
if (!m_creature->SelectHostileTarget() || !m_creature->getVictim())
|
||||
@ -131,15 +130,13 @@ AggressorAI::UpdateAI(const uint32 /*diff*/)
|
||||
DoMeleeAttackIfReady();
|
||||
}
|
||||
|
||||
bool
|
||||
AggressorAI::IsVisible(Unit* pl) const
|
||||
bool AggressorAI::IsVisible(Unit* pl) const
|
||||
{
|
||||
return m_creature->IsWithinDist(pl, sWorld.getConfig(CONFIG_FLOAT_SIGHT_MONSTER))
|
||||
&& pl->IsVisibleForOrDetect(m_creature, m_creature, true);
|
||||
}
|
||||
|
||||
void
|
||||
AggressorAI::AttackStart(Unit* u)
|
||||
void AggressorAI::AttackStart(Unit* u)
|
||||
{
|
||||
if (!u)
|
||||
{ return; }
|
||||
|
@ -741,12 +741,7 @@ bool AuctionEntry::BuildAuctionInfo(WorldPacket& data) const
|
||||
data << uint32(pItem->GetEntry());
|
||||
|
||||
// [-ZERO] no other infos about enchantment in 1.12 [?]
|
||||
// for (uint8 i = 0; i < MAX_INSPECTED_ENCHANTMENT_SLOT; ++i)
|
||||
//{
|
||||
data << uint32(pItem->GetEnchantmentId(EnchantmentSlot(PERM_ENCHANTMENT_SLOT)));
|
||||
// data << uint32(pItem->GetEnchantmentDuration(EnchantmentSlot(i)));
|
||||
// data << uint32(pItem->GetEnchantmentCharges(EnchantmentSlot(i)));
|
||||
//}
|
||||
|
||||
data << uint32(pItem->GetItemRandomPropertyId()); // random item property id
|
||||
data << uint32(pItem->GetItemSuffixFactor()); // SuffixFactor
|
||||
|
@ -394,7 +394,7 @@ bool Creature::InitEntry(uint32 Entry, Team team, CreatureData const* data /*=NU
|
||||
bool Creature::UpdateEntry(uint32 Entry, Team team, const CreatureData* data /*=NULL*/, GameEventCreatureData const* eventData /*=NULL*/, bool preserveHPAndPower /*=true*/)
|
||||
{
|
||||
if (!InitEntry(Entry, team, data, eventData))
|
||||
return false;
|
||||
{ return false; }
|
||||
|
||||
// creatures always have melee weapon ready if any
|
||||
SetSheath(SHEATH_STATE_MELEE);
|
||||
@ -410,9 +410,13 @@ bool Creature::UpdateEntry(uint32 Entry, Team team, const CreatureData* data /*=
|
||||
SelectLevel();
|
||||
|
||||
if (team == HORDE)
|
||||
{
|
||||
setFaction(GetCreatureInfo()->FactionHorde);
|
||||
}
|
||||
else
|
||||
{
|
||||
setFaction(GetCreatureInfo()->FactionAlliance);
|
||||
}
|
||||
|
||||
SetUInt32Value(UNIT_NPC_FLAGS, GetCreatureInfo()->NpcFlags);
|
||||
|
||||
@ -426,12 +430,18 @@ bool Creature::UpdateEntry(uint32 Entry, Team team, const CreatureData* data /*=
|
||||
|
||||
// we may need to append or remove additional flags
|
||||
if (HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IN_COMBAT))
|
||||
{
|
||||
unitFlags |= UNIT_FLAG_IN_COMBAT;
|
||||
}
|
||||
|
||||
if (m_movementInfo.HasMovementFlag(MOVEFLAG_SWIMMING) && (GetCreatureInfo()->ExtraFlags & CREATURE_EXTRA_FLAG_HAVE_NO_SWIM_ANIMATION) == 0)
|
||||
{
|
||||
unitFlags |= UNIT_FLAG_UNK_15;
|
||||
}
|
||||
else
|
||||
{
|
||||
unitFlags &= ~UNIT_FLAG_UNK_15;
|
||||
}
|
||||
|
||||
SetUInt32Value(UNIT_FIELD_FLAGS, unitFlags);
|
||||
|
||||
@ -454,23 +464,35 @@ bool Creature::UpdateEntry(uint32 Entry, Team team, const CreatureData* data /*=
|
||||
if (FactionTemplateEntry const* factionTemplate = sFactionTemplateStore.LookupEntry(GetCreatureInfo()->FactionAlliance))
|
||||
{
|
||||
if (factionTemplate->factionFlags & FACTION_TEMPLATE_FLAG_PVP)
|
||||
{
|
||||
SetPvP(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!IsRacialLeader())
|
||||
{
|
||||
SetPvP(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Try difficulty dependend version before falling back to base entry
|
||||
CreatureTemplateSpells const* templateSpells = sCreatureTemplateSpellsStorage.LookupEntry<CreatureTemplateSpells>(GetCreatureInfo()->Entry);
|
||||
if (!templateSpells)
|
||||
{
|
||||
templateSpells = sCreatureTemplateSpellsStorage.LookupEntry<CreatureTemplateSpells>(GetEntry());
|
||||
}
|
||||
if (templateSpells)
|
||||
for (int i = 0; i < CREATURE_MAX_SPELLS; ++i)
|
||||
{
|
||||
m_spells[i] = templateSpells->spells[i];
|
||||
}
|
||||
|
||||
// if eventData set then event active and need apply spell_start
|
||||
if (eventData)
|
||||
{
|
||||
ApplyGameEventSpells(eventData, true);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -479,7 +501,9 @@ uint32 Creature::ChooseDisplayId(const CreatureInfo* cinfo, const CreatureData*
|
||||
{
|
||||
// Use creature event model explicit, override any other static models
|
||||
if (eventData && eventData->modelid)
|
||||
{ return eventData->modelid; }
|
||||
{
|
||||
return eventData->modelid;
|
||||
}
|
||||
|
||||
// Use creature model explicit, override template (creature.modelid)
|
||||
if (data && data->modelid_override)
|
||||
@ -490,13 +514,21 @@ uint32 Creature::ChooseDisplayId(const CreatureInfo* cinfo, const CreatureData*
|
||||
|
||||
// model selected here may be replaced with other_gender using own function
|
||||
if (!cinfo->ModelId[1])
|
||||
{ display_id = cinfo->ModelId[0]; }
|
||||
{
|
||||
display_id = cinfo->ModelId[0];
|
||||
}
|
||||
else if (!cinfo->ModelId[2])
|
||||
{ display_id = cinfo->ModelId[urand(0, 1)]; }
|
||||
{
|
||||
display_id = cinfo->ModelId[urand(0, 1)];
|
||||
}
|
||||
else if (!cinfo->ModelId[3])
|
||||
{ display_id = cinfo->ModelId[urand(0, 2)]; }
|
||||
{
|
||||
display_id = cinfo->ModelId[urand(0, 2)];
|
||||
}
|
||||
else
|
||||
{ display_id = cinfo->ModelId[urand(0, 3)]; }
|
||||
{
|
||||
display_id = cinfo->ModelId[urand(0, 3)];
|
||||
}
|
||||
|
||||
// fail safe, we use creature entry 1 and make error
|
||||
if (!display_id)
|
||||
@ -735,7 +767,9 @@ void Creature::RegeneratePower()
|
||||
{
|
||||
Modifier const* modifier = (*i)->GetModifier();
|
||||
if (modifier->m_miscvalue == int32(powerType))
|
||||
{ addValue += modifier->m_amount; }
|
||||
{
|
||||
addValue += modifier->m_amount;
|
||||
}
|
||||
}
|
||||
|
||||
AuraList const& ModPowerRegenPCTAuras = GetAurasByType(SPELL_AURA_MOD_POWER_REGEN_PERCENT);
|
||||
@ -743,7 +777,9 @@ void Creature::RegeneratePower()
|
||||
{
|
||||
Modifier const* modifier = (*i)->GetModifier();
|
||||
if (modifier->m_miscvalue == int32(powerType))
|
||||
{ addValue *= (modifier->m_amount + 100) / 100.0f; }
|
||||
{
|
||||
addValue *= (modifier->m_amount + 100) / 100.0f;
|
||||
}
|
||||
}
|
||||
|
||||
ModifyPower(powerType, int32(addValue));
|
||||
@ -1014,12 +1050,12 @@ void Creature::PrepareBodyLootState()
|
||||
// if have normal loot then prepare it access
|
||||
if (!lootForBody)
|
||||
{
|
||||
// have normal loot
|
||||
if (GetCreatureInfo()->MaxLootGold > 0 || GetCreatureInfo()->LootId || (GetCreatureType() != CREATURE_TYPE_CRITTER && (GetCreatureInfo()->SkinningLootId && sWorld.getConfig(CONFIG_BOOL_CORPSE_EMPTY_LOOT_SHOW))))
|
||||
{
|
||||
SetFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE);
|
||||
return;
|
||||
}
|
||||
// have normal loot
|
||||
if (GetCreatureInfo()->MaxLootGold > 0 || GetCreatureInfo()->LootId || (GetCreatureType() != CREATURE_TYPE_CRITTER && (GetCreatureInfo()->SkinningLootId && sWorld.getConfig(CONFIG_BOOL_CORPSE_EMPTY_LOOT_SHOW))))
|
||||
{
|
||||
SetFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
lootForBody = true; // pass this loot mode
|
||||
@ -1154,6 +1190,8 @@ void Creature::SaveToDB(uint32 mapid)
|
||||
CreatureInfo const* cinfo = GetCreatureInfo();
|
||||
if (cinfo)
|
||||
{
|
||||
// The following if-else assumes that there are 4 model fields and needs updating if this is changed.
|
||||
|
||||
if (displayId != cinfo->ModelId[0] && displayId != cinfo->ModelId[1] &&
|
||||
displayId != cinfo->ModelId[2] && displayId != cinfo->ModelId[3])
|
||||
{
|
||||
@ -1761,7 +1799,7 @@ bool Creature::IsImmuneToSpell(SpellEntry const* spellInfo, bool castOnSelf)
|
||||
{
|
||||
if (GetCreatureInfo()->MechanicImmuneMask & (1 << (spellInfo->Mechanic - 1)))
|
||||
{ return true; }
|
||||
|
||||
|
||||
if (GetCreatureInfo()->SchoolImmuneMask & (1 << spellInfo->School))
|
||||
{ return true; }
|
||||
}
|
||||
@ -2006,16 +2044,24 @@ bool Creature::CanAssistTo(const Unit* u, const Unit* enemy, bool checkfaction /
|
||||
bool Creature::CanInitiateAttack()
|
||||
{
|
||||
if (hasUnitState(UNIT_STAT_STUNNED | UNIT_STAT_DIED))
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE))
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (isPassiveToHostile())
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (m_aggroDelay != 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -2296,7 +2342,9 @@ bool Creature::HasCategoryCooldown(uint32 spell_id) const
|
||||
{
|
||||
SpellEntry const* spellInfo = sSpellStore.LookupEntry(spell_id);
|
||||
if (!spellInfo)
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
CreatureSpellCooldowns::const_iterator itr = m_CreatureCategoryCooldowns.find(spellInfo->Category);
|
||||
return (itr != m_CreatureCategoryCooldowns.end() && time_t(itr->second + (spellInfo->CategoryRecoveryTime / IN_MILLISECONDS)) > time(NULL));
|
||||
@ -2438,8 +2486,8 @@ VendorItemData const* Creature::GetVendorItems() const
|
||||
|
||||
VendorItemData const* Creature::GetVendorTemplateItems() const
|
||||
{
|
||||
uint32 vendorId = GetCreatureInfo()->VendorTemplateId;
|
||||
return vendorId ? sObjectMgr.GetNpcVendorTemplateItemList(vendorId) : NULL;
|
||||
uint32 VendorTemplateId = GetCreatureInfo()->VendorTemplateId;
|
||||
return VendorTemplateId ? sObjectMgr.GetNpcVendorTemplateItemList(VendorTemplateId) : NULL;
|
||||
}
|
||||
|
||||
uint32 Creature::GetVendorItemCurrentCount(VendorItem const* vItem)
|
||||
@ -2516,8 +2564,8 @@ uint32 Creature::UpdateVendorItemCurrentCount(VendorItem const* vItem, uint32 us
|
||||
|
||||
TrainerSpellData const* Creature::GetTrainerTemplateSpells() const
|
||||
{
|
||||
uint32 trainerId = GetCreatureInfo()->TrainerTemplateId;
|
||||
return trainerId ? sObjectMgr.GetNpcTrainerTemplateSpells(trainerId) : NULL;
|
||||
uint32 TrainerTemplateId = GetCreatureInfo()->TrainerTemplateId;
|
||||
return TrainerTemplateId ? sObjectMgr.GetNpcTrainerTemplateSpells(TrainerTemplateId) : NULL;
|
||||
}
|
||||
|
||||
TrainerSpellData const* Creature::GetTrainerSpells() const
|
||||
@ -2748,14 +2796,6 @@ void Creature::SetSwim(bool enable)
|
||||
void Creature::SetCanFly(bool /*enable*/)
|
||||
{
|
||||
// TODO: check if there is something similar for 1.12.x (dragons and other flying NPCs)
|
||||
// if (enable)
|
||||
// m_movementInfo.AddMovementFlag(MOVEFLAG_CAN_FLY);
|
||||
// else
|
||||
// m_movementInfo.RemoveMovementFlag(MOVEFLAG_CAN_FLY);
|
||||
//
|
||||
// WorldPacket data(enable ? SMSG_SPLINE_MOVE_SET_FLYING : SMSG_SPLINE_MOVE_UNSET_FLYING, 9);
|
||||
// data << GetPackGUID();
|
||||
// SendMessageToSet(&data, true);
|
||||
}
|
||||
|
||||
void Creature::SetFeatherFall(bool enable)
|
||||
@ -2785,9 +2825,9 @@ void Creature::SetHover(bool enable)
|
||||
void Creature::SetRoot(bool enable)
|
||||
{
|
||||
if (enable)
|
||||
m_movementInfo.AddMovementFlag(MOVEFLAG_ROOT);
|
||||
{ m_movementInfo.AddMovementFlag(MOVEFLAG_ROOT); }
|
||||
else
|
||||
m_movementInfo.RemoveMovementFlag(MOVEFLAG_ROOT);
|
||||
{ m_movementInfo.RemoveMovementFlag(MOVEFLAG_ROOT); }
|
||||
|
||||
WorldPacket data(enable ? SMSG_SPLINE_MOVE_ROOT : SMSG_SPLINE_MOVE_UNROOT, 9);
|
||||
data << GetPackGUID();
|
||||
|
@ -265,8 +265,8 @@ struct CreatureModelInfo
|
||||
float bounding_radius;
|
||||
float combat_reach;
|
||||
uint8 gender;
|
||||
uint32 modelid_other_gender; // The oposite gender for this modelid (male/female)
|
||||
uint32 modelid_other_team; // The oposite team. Generally for alliance totem
|
||||
uint32 modelid_other_gender; // The opposite gender for this modelid (male/female)
|
||||
uint32 modelid_other_team; // The opposite team. Generally for alliance totem
|
||||
};
|
||||
|
||||
// GCC have alternative #pragma pack() syntax and old gcc version not support pack(pop), also any gcc version not support it at some platform
|
||||
@ -867,7 +867,7 @@ class Creature : public Unit
|
||||
|
||||
private:
|
||||
GridReference<Creature> m_gridRef;
|
||||
CreatureInfo const* m_creatureInfo;
|
||||
CreatureInfo const* m_creatureInfo; // in difficulty mode > 0 can different from ObjMgr::GetCreatureTemplate(GetEntry())
|
||||
};
|
||||
|
||||
class ForcedDespawnDelayEvent : public BasicEvent
|
||||
|
@ -100,7 +100,9 @@ CreatureEventAI::CreatureEventAI(Creature* c) : CreatureAI(c),
|
||||
// Debug check
|
||||
#ifndef MANGOS_DEBUG
|
||||
if (i->event_flags & EFLAG_DEBUG_ONLY)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
|
||||
++events_count;
|
||||
@ -116,18 +118,21 @@ CreatureEventAI::CreatureEventAI(Creature* c) : CreatureAI(c),
|
||||
// Debug check
|
||||
#ifndef MANGOS_DEBUG
|
||||
if (i->event_flags & EFLAG_DEBUG_ONLY)
|
||||
{ continue; }
|
||||
{ continue; }
|
||||
#endif
|
||||
m_CreatureEventAIList.push_back(CreatureEventAIHolder(*i));
|
||||
// Cache for fast use
|
||||
if (i->event_type == EVENT_T_OOC_LOS)
|
||||
{ m_HasOOCLoSEvent = true; }
|
||||
{
|
||||
m_HasOOCLoSEvent = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{ sLog.outErrorEventAI("EventMap for Creature %u is empty but creature is using CreatureEventAI.", m_creature->GetEntry()); }
|
||||
|
||||
{
|
||||
sLog.outErrorEventAI("EventMap for Creature %u is empty but creature is using CreatureEventAI.", m_creature->GetEntry());
|
||||
}
|
||||
// Handle Spawned Events, also calls Reset()
|
||||
JustRespawned();
|
||||
}
|
||||
@ -376,7 +381,7 @@ bool CreatureEventAI::ProcessEvent(CreatureEventAIHolder& pHolder, Unit* pAction
|
||||
case EVENT_T_AURA:
|
||||
{
|
||||
if (!m_creature->IsInCombat())
|
||||
{ return false; }
|
||||
{ return false; }
|
||||
|
||||
SpellAuraHolder* holder = m_creature->GetSpellAuraHolder(event.buffed.spellId);
|
||||
if (!holder || holder->GetStackAmount() < event.buffed.amount)
|
||||
@ -404,7 +409,7 @@ bool CreatureEventAI::ProcessEvent(CreatureEventAIHolder& pHolder, Unit* pAction
|
||||
case EVENT_T_MISSING_AURA:
|
||||
{
|
||||
if (!m_creature->IsInCombat())
|
||||
{ return false; }
|
||||
{ return false; }
|
||||
|
||||
SpellAuraHolder* holder = m_creature->GetSpellAuraHolder(event.buffed.spellId);
|
||||
if (holder && holder->GetStackAmount() >= event.buffed.amount)
|
||||
@ -530,19 +535,19 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
|
||||
if (action.type == ACTION_T_TEXT)
|
||||
{
|
||||
if (action.text.TextId[1] && action.text.TextId[2])
|
||||
{ textId = action.text.TextId[rnd % 3]; }
|
||||
{ textId = action.text.TextId[rnd % 3]; }
|
||||
else if (action.text.TextId[1] && (rnd % 2))
|
||||
{ textId = action.text.TextId[1]; }
|
||||
{ textId = action.text.TextId[1]; }
|
||||
else
|
||||
{ textId = action.text.TextId[0]; }
|
||||
{ textId = action.text.TextId[0]; }
|
||||
}
|
||||
// ACTION_T_CHANCED_TEXT, chance hits
|
||||
else if ((rnd % 100) < action.chanced_text.chance)
|
||||
{
|
||||
if (action.chanced_text.TextId[0] && action.chanced_text.TextId[1])
|
||||
{ textId = action.chanced_text.TextId[rnd % 2]; }
|
||||
{ textId = action.chanced_text.TextId[rnd % 2]; }
|
||||
else
|
||||
{ textId = action.chanced_text.TextId[0]; }
|
||||
{ textId = action.chanced_text.TextId[0]; }
|
||||
}
|
||||
|
||||
if (textId)
|
||||
@ -730,16 +735,16 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
|
||||
{
|
||||
// ignore no affect case
|
||||
if ((GetCombatMovementFlags() & CM_SCRIPT) == (action.combat_movement.state != 0))
|
||||
return;
|
||||
{ return; }
|
||||
|
||||
SetCombatMovement(action.combat_movement.state != 0, true);
|
||||
|
||||
if (m_creature->IsInCombat() && m_creature->getVictim())
|
||||
{
|
||||
if (IsCombatMovement() && action.combat_movement.melee)
|
||||
m_creature->SendMeleeAttackStart(m_creature->getVictim());
|
||||
{ m_creature->SendMeleeAttackStart(m_creature->getVictim()); }
|
||||
else if (action.combat_movement.melee)
|
||||
m_creature->SendMeleeAttackStop(m_creature->getVictim());
|
||||
{ m_creature->SendMeleeAttackStop(m_creature->getVictim()); }
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -829,9 +834,9 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
|
||||
|
||||
Creature* pCreature;
|
||||
if (i->second.SpawnTimeSecs)
|
||||
{ pCreature = m_creature->SummonCreature(action.summon_id.creatureId, i->second.position_x, i->second.position_y, i->second.position_z, i->second.orientation, TEMPSUMMON_TIMED_OOC_OR_DEAD_DESPAWN, i->second.SpawnTimeSecs); }
|
||||
{ pCreature = m_creature->SummonCreature(action.summon_id.creatureId, i->second.position_x, i->second.position_y, i->second.position_z, i->second.orientation, TEMPSUMMON_TIMED_OOC_OR_DEAD_DESPAWN, i->second.SpawnTimeSecs); }
|
||||
else
|
||||
{ pCreature = m_creature->SummonCreature(action.summon_id.creatureId, i->second.position_x, i->second.position_y, i->second.position_z, i->second.orientation, TEMPSUMMON_TIMED_OOC_DESPAWN, 0); }
|
||||
{ pCreature = m_creature->SummonCreature(action.summon_id.creatureId, i->second.position_x, i->second.position_y, i->second.position_z, i->second.orientation, TEMPSUMMON_TIMED_OOC_DESPAWN, 0); }
|
||||
|
||||
if (!pCreature)
|
||||
{ sLog.outErrorEventAI("failed to spawn creature %u. EventId %d.Creature %d", action.summon_id.creatureId, EventId, m_creature->GetEntry()); }
|
||||
@ -1206,7 +1211,7 @@ void CreatureEventAI::EnterCombat(Unit* enemy)
|
||||
// Reset all in combat timers
|
||||
case EVENT_T_TIMER_IN_COMBAT:
|
||||
if (i->UpdateRepeatTimer(m_creature, event.timer.initialMin, event.timer.initialMax))
|
||||
{ i->Enabled = true; }
|
||||
{ i->Enabled = true; }
|
||||
break;
|
||||
// All normal events need to be re-enabled and their time set to 0
|
||||
default:
|
||||
@ -1256,7 +1261,7 @@ void CreatureEventAI::MoveInLineOfSight(Unit* who)
|
||||
{
|
||||
// if range is ok and we are actually in LOS
|
||||
if (m_creature->IsWithinDistInMap(who, fMaxAllowedRange) && m_creature->IsWithinLOSInMap(who))
|
||||
{ ProcessEvent(*itr, who); }
|
||||
{ ProcessEvent(*itr, who); }
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1474,7 +1479,7 @@ void CreatureEventAI::ReceiveEmote(Player* pPlayer, uint32 text_emote)
|
||||
if (itr->Event.event_type == EVENT_T_RECEIVE_EMOTE)
|
||||
{
|
||||
if (itr->Event.receive_emote.emoteId != text_emote)
|
||||
{ continue; }
|
||||
{ continue; }
|
||||
|
||||
PlayerCondition pcon(0, itr->Event.receive_emote.condition, itr->Event.receive_emote.conditionValue1, itr->Event.receive_emote.conditionValue2);
|
||||
if (pcon.Meets(pPlayer, m_creature->GetMap(), m_creature, CONDITION_FROM_EVENTAI))
|
||||
@ -1569,7 +1574,7 @@ bool CreatureEventAI::SpawnedEventConditionsCheck(CreatureEventAI_Event const& e
|
||||
void CreatureEventAI::OnSpellCastChange(const SpellEntry* pSpell, SpellCastResult reason)
|
||||
{
|
||||
//sLog.outError("Received reason %u for %s, spell %u (curSpell = %u)", reason, m_creature->GetGuidStr().c_str(), pSpell->Id, m_currSpell);
|
||||
|
||||
|
||||
if (!pSpell || pSpell->Id != m_currSpell)
|
||||
return;
|
||||
|
||||
|
@ -103,7 +103,7 @@ enum EventAI_ActionType
|
||||
ACTION_T_INC_PHASE = 23, // Value (may be negative to decrement phase, should not be 0)
|
||||
ACTION_T_EVADE = 24, // No Params
|
||||
ACTION_T_FLEE_FOR_ASSIST = 25, // No Params
|
||||
ACTION_T_QUEST_EVENT_ALL = 26, // QuestID
|
||||
ACTION_T_QUEST_EVENT_ALL = 26, // QuestID, UseThreatList (1 = true, 0 = false)
|
||||
ACTION_T_CAST_EVENT_ALL = 27, // CreatureId, SpellId
|
||||
ACTION_T_REMOVEAURASFROMSPELL = 28, // Target, Spellid
|
||||
ACTION_T_RANGED_MOVEMENT = 29, // Distance, Angle
|
||||
@ -137,19 +137,19 @@ enum Target
|
||||
// Self (m_creature)
|
||||
TARGET_T_SELF = 0, // Self cast
|
||||
|
||||
// Hostile targets
|
||||
// Hostile targets (if pet then returns pet owner)
|
||||
TARGET_T_HOSTILE = 1, // Our current target (ie: highest aggro)
|
||||
TARGET_T_HOSTILE_SECOND_AGGRO = 2, // Second highest aggro (generaly used for cleaves and some special attacks)
|
||||
TARGET_T_HOSTILE_LAST_AGGRO = 3, // Dead last on aggro (no idea what this could be used for)
|
||||
TARGET_T_HOSTILE_RANDOM = 4, // Just any random target on our threat list
|
||||
TARGET_T_HOSTILE_RANDOM_NOT_TOP = 5, // Any random target except top threat
|
||||
|
||||
// Invoker targets
|
||||
// Invoker targets (if pet then returns pet owner)
|
||||
TARGET_T_ACTION_INVOKER = 6, // Unit who caused this Event to occur (only works for EVENT_T_AGGRO, EVENT_T_KILL, EVENT_T_DEATH, EVENT_T_SPELLHIT, EVENT_T_OOC_LOS, EVENT_T_FRIENDLY_HP, EVENT_T_FRIENDLY_IS_CC, EVENT_T_FRIENDLY_MISSING_BUFF, EVENT_T_RECEIVE_EMOTE, EVENT_T_RECEIVE_AI_EVENT)
|
||||
TARGET_T_ACTION_INVOKER_OWNER = 7, // Unit who is responsible for Event to occur (only works for EVENT_T_AGGRO, EVENT_T_KILL, EVENT_T_DEATH, EVENT_T_SPELLHIT, EVENT_T_OOC_LOS, EVENT_T_FRIENDLY_HP, EVENT_T_FRIENDLY_IS_CC, EVENT_T_FRIENDLY_MISSING_BUFF, EVENT_T_RECEIVE_EMOTE, EVENT_T_RECEIVE_AI_EVENT)
|
||||
TARGET_T_EVENT_SENDER = 10, // Unit who sent an AIEvent that was received with EVENT_T_RECEIVE_AI_EVENT
|
||||
|
||||
// Hostile players
|
||||
// Hostile targets (including pets)
|
||||
TARGET_T_HOSTILE_RANDOM_PLAYER = 8, // Just any random player on our threat list
|
||||
TARGET_T_HOSTILE_RANDOM_NOT_TOP_PLAYER = 9, // Any random player from threat list except top threat
|
||||
|
||||
|
@ -842,10 +842,6 @@ bool GameObject::IsVisibleForInState(Player const* u, WorldObject const* viewPoi
|
||||
visibleDistance = GetGOInfo()->trap.radius + INTERACTION_DISTANCE;
|
||||
}
|
||||
}
|
||||
|
||||
// [-ZERO] Smuggled Mana Cell required 10 invisibility type detection/state
|
||||
//if (GetEntry() == 187039 && ((u->m_detectInvisibilityMask | u->m_invisibilityMask) & (1 << 10)) == 0)
|
||||
// { return false; }
|
||||
}
|
||||
|
||||
// check distance
|
||||
@ -2291,7 +2287,7 @@ float GameObject::GetInteractionDistance() const
|
||||
switch (GetGoType())
|
||||
{
|
||||
// TODO: find out how the client calculates the maximal usage distance to spellless working
|
||||
// gameobjects like mailboxes - 10.0 is a just an abitrary choosen number
|
||||
// gameobjects like mailboxes - 10.0 is a just an abitrary chosen number
|
||||
case GAMEOBJECT_TYPE_MAILBOX:
|
||||
maxdist = 10.0f;
|
||||
break;
|
||||
|
@ -127,7 +127,7 @@ struct GameObjectInfo
|
||||
uint32 spellId; // 3
|
||||
uint32 charges; // 4 need respawn (if > 0)
|
||||
uint32 cooldown; // 5 time in secs
|
||||
uint32 autoCloseTime; // 6
|
||||
uint32 autoCloseTime; //6 secs till autoclose = autoCloseTime / IN_MILLISECONDS (previous was 0x10000)
|
||||
uint32 startDelay; // 7
|
||||
uint32 serverOnly; // 8
|
||||
uint32 stealthed; // 9
|
||||
@ -167,7 +167,7 @@ struct GameObjectInfo
|
||||
uint32 lockId; // 0 -> Lock.dbc
|
||||
uint32 questId; // 1
|
||||
uint32 eventId; // 2
|
||||
uint32 autoCloseTime; // 3
|
||||
uint32 autoCloseTime; //3 secs till autoclose = autoCloseTime / IN_MILLISECONDS (previous was 0x10000)
|
||||
uint32 customAnim; // 4
|
||||
uint32 consumable; // 5
|
||||
uint32 cooldown; // 6
|
||||
@ -190,7 +190,7 @@ struct GameObjectInfo
|
||||
{
|
||||
uint32 pause; // 0
|
||||
uint32 startOpen; // 1
|
||||
uint32 autoCloseTime; // 2 secs till autoclose = autoCloseTime / 0x10000
|
||||
uint32 autoCloseTime; //2 secs till autoclose = autoCloseTime / IN_MILLISECONDS (previous was 0x10000)
|
||||
} transport;
|
||||
// 12 GAMEOBJECT_TYPE_AREADAMAGE
|
||||
struct
|
||||
@ -200,7 +200,7 @@ struct GameObjectInfo
|
||||
uint32 damageMin; // 2
|
||||
uint32 damageMax; // 3
|
||||
uint32 damageSchool; // 4
|
||||
uint32 autoCloseTime; // 5 secs till autoclose = autoCloseTime / 0x10000
|
||||
uint32 autoCloseTime; //5 secs till autoclose = autoCloseTime / IN_MILLISECONDS (previous was 0x10000)
|
||||
uint32 openTextID; // 6
|
||||
uint32 closeTextID; // 7
|
||||
} areadamage;
|
||||
@ -480,9 +480,9 @@ struct GameObjectLocale
|
||||
// client side GO show states
|
||||
enum GOState
|
||||
{
|
||||
GO_STATE_ACTIVE = 0, // show in world as used and not reset (closed door open)
|
||||
GO_STATE_READY = 1, // show in world as ready (closed door close)
|
||||
GO_STATE_ACTIVE_ALTERNATIVE = 2 // show in world as used in alt way and not reset (closed door open by cannon fire)
|
||||
GO_STATE_ACTIVE = 0x00, // show in world as used and not reset (closed door open)
|
||||
GO_STATE_READY = 0x01, // show in world as ready (closed door close)
|
||||
GO_STATE_ACTIVE_ALTERNATIVE = 0x02, // show in world as used in alt way and not reset (closed door open by cannon fire)
|
||||
};
|
||||
|
||||
#define MAX_GO_STATE 3
|
||||
@ -740,7 +740,7 @@ class GameObject : public WorldObject
|
||||
|
||||
GuidSet m_SkillupSet; // players that already have skill-up at GO use
|
||||
|
||||
uint32 m_useTimes; // amount uses/charges triggered
|
||||
uint32 m_useTimes; // amount uses/charges triggered - also used for health for DESTRUCTIBLE_BUILDING
|
||||
|
||||
// collected only for GAMEOBJECT_TYPE_SUMMONING_RITUAL
|
||||
ObjectGuid m_firstUser; // first GO user, in most used cases owner, but in some cases no, for example non-summoned multi-use GAMEOBJECT_TYPE_SUMMONING_RITUAL
|
||||
|
@ -63,7 +63,6 @@ enum GuildRankRights
|
||||
GR_RIGHT_EPNOTE = 0x00002040,
|
||||
GR_RIGHT_VIEWOFFNOTE = 0x00004040,
|
||||
GR_RIGHT_EOFFNOTE = 0x00008040,
|
||||
// [-ZERO] tbc enumerations [?]
|
||||
GR_RIGHT_MODIFY_GUILD_INFO = 0x00010040,
|
||||
GR_RIGHT_ALL = 0x000FF1FF
|
||||
};
|
||||
@ -76,7 +75,6 @@ enum Typecommand
|
||||
GUILD_FOUNDER_S = 0x0E,
|
||||
GUILD_UNK19 = 0x13,
|
||||
GUILD_UNK20 = 0x14
|
||||
// [ZERO] in SMSG_GUILD_COMMAND_RESULT: 2,4-13,15-18 no effect for no error
|
||||
};
|
||||
|
||||
enum CommandErrors
|
||||
@ -97,7 +95,6 @@ enum CommandErrors
|
||||
ERR_GUILD_NOT_ALLIED = 0x0C,
|
||||
ERR_GUILD_RANK_TOO_HIGH_S = 0x0D,
|
||||
ERR_GUILD_RANK_TOO_LOW_S = 0x0E,
|
||||
// [ZERO] 0x0F, 0x10 unused
|
||||
ERR_GUILD_RANKS_LOCKED = 0x11,
|
||||
ERR_GUILD_RANK_IN_USE = 0x12,
|
||||
ERR_GUILD_IGNORING_YOU_S = 0x13,
|
||||
|
@ -43,7 +43,6 @@ struct ItemSetEffect
|
||||
SpellEntry const* spells[8];
|
||||
};
|
||||
|
||||
// [-ZERO] Need fix, possible uptodate in mangos-0.6
|
||||
enum InventoryResult
|
||||
{
|
||||
EQUIP_ERR_OK = 0,
|
||||
@ -159,7 +158,7 @@ enum EnchantmentOffset
|
||||
{
|
||||
ENCHANTMENT_ID_OFFSET = 0,
|
||||
ENCHANTMENT_DURATION_OFFSET = 1,
|
||||
ENCHANTMENT_CHARGES_OFFSET = 2
|
||||
ENCHANTMENT_CHARGES_OFFSET = 2 // now here not only charges, but something new in wotlk
|
||||
};
|
||||
|
||||
#define MAX_ENCHANTMENT_OFFSET 3
|
||||
|
@ -81,8 +81,9 @@ void LoadRandomEnchantmentsTable()
|
||||
sLog.outString(">> Loaded %u Item Enchantment definitions", count);
|
||||
}
|
||||
else
|
||||
{
|
||||
sLog.outErrorDb(">> Loaded 0 Item Enchantment definitions. DB table `item_enchantment_template` is empty.");
|
||||
|
||||
}
|
||||
sLog.outString();
|
||||
}
|
||||
|
||||
|
@ -319,7 +319,6 @@ enum ItemSubclassPermanent
|
||||
enum ItemSubclassJunk
|
||||
{
|
||||
ITEM_SUBCLASS_JUNK = 0
|
||||
|
||||
};
|
||||
|
||||
#define MAX_ITEM_SUBCLASS_JUNK 1
|
||||
|
@ -197,7 +197,7 @@ class LootStore
|
||||
|
||||
class LootTemplate
|
||||
{
|
||||
class LootGroup; // A set of loot definitions for items (refs are not allowed inside)
|
||||
class LootGroup; // A set of loot definitions for items (refs are not allowed inside)
|
||||
typedef std::vector<LootGroup> LootGroups;
|
||||
|
||||
public:
|
||||
|
@ -305,9 +305,6 @@ void Object::BuildValuesUpdate(uint8 updatetype, ByteBuffer* data, UpdateMask* u
|
||||
{ return; }
|
||||
|
||||
bool IsActivateToQuest = false;
|
||||
//bool IsPerCasterAuraState = false;
|
||||
|
||||
// this is called for UPDATETYPE_CREATE_OBJECT, UPDATETYPE_CREATE_OBJECT2, UPDATETYPE_VALUES only
|
||||
if (isType(TYPEMASK_GAMEOBJECT) && !((GameObject*)this)->IsTransport())
|
||||
{
|
||||
IsActivateToQuest = ((GameObject*)this)->ActivateToQuest(target) || target->isGameMaster();
|
||||
@ -1205,13 +1202,13 @@ void WorldObject::UpdateGroundPositionZ(float x, float y, float& z) const
|
||||
{
|
||||
float new_z = GetMap()->GetHeight(x, y, z);
|
||||
if (new_z > INVALID_HEIGHT)
|
||||
{ z = new_z + 0.05f; } // just to be sure that we are not a few pixel under the surface
|
||||
{ z = new_z + 0.05f; } // just to be sure that we are not a few pixel under the surface
|
||||
}
|
||||
|
||||
void WorldObject::UpdateAllowedPositionZ(float x, float y, float& z, Map* atMap /*=NULL*/) const
|
||||
{
|
||||
if (!atMap)
|
||||
atMap = GetMap();
|
||||
{ atMap = GetMap(); }
|
||||
|
||||
switch (GetTypeId())
|
||||
{
|
||||
@ -1479,7 +1476,7 @@ Creature* WorldObject::SummonCreature(uint32 id, float x, float y, float z, floa
|
||||
|
||||
pCreature->SetRespawnCoord(pos);
|
||||
|
||||
// Set run/walk mode
|
||||
// Set run or walk before any other movement starts
|
||||
pCreature->SetWalk(!setRun);
|
||||
|
||||
// Active state set before added to map
|
||||
|
@ -456,7 +456,7 @@ class WorldObject : public Object
|
||||
|
||||
// class is used to manipulate with WorldUpdateCounter
|
||||
// it is needed in order to get time diff between two object's Update() calls
|
||||
class UpdateHelper
|
||||
class UpdateHelper
|
||||
{
|
||||
public:
|
||||
explicit UpdateHelper(WorldObject* obj) : m_obj(obj) {}
|
||||
|
@ -14833,11 +14833,11 @@ void Player::_LoadInventory(QueryResult* result, uint32 timediff)
|
||||
// send by mail problematic items
|
||||
while (!problematicItems.empty())
|
||||
{
|
||||
std::string subject = "Item could not be loaded to inventory.";
|
||||
std::string content = GetSession()->GetMangosString(LANG_NOT_EQUIPPED_ITEM);
|
||||
std::string subject = "Item could not be loaded to inventory.";
|
||||
std::string content = GetSession()->GetMangosString(LANG_NOT_EQUIPPED_ITEM);
|
||||
// fill mail
|
||||
MailDraft draft(subject);
|
||||
draft.SetSubjectAndBody(subject,content);
|
||||
draft.SetSubjectAndBody(subject,content);
|
||||
for (int i = 0; !problematicItems.empty() && i < MAX_MAIL_ITEMS; ++i)
|
||||
{
|
||||
Item* item = problematicItems.front();
|
||||
|
@ -4340,7 +4340,7 @@ SpellCastResult Spell::CheckCast(bool strict)
|
||||
else if (m_caster == target)
|
||||
{
|
||||
if (m_caster->GetTypeId() == TYPEID_PLAYER && m_caster->IsInWorld())
|
||||
{
|
||||
{
|
||||
// Additional check for some spells
|
||||
// If 0 spell effect empty - client not send target data (need use selection)
|
||||
// TODO: check it on next client version
|
||||
@ -4349,7 +4349,7 @@ SpellCastResult Spell::CheckCast(bool strict)
|
||||
{
|
||||
target = m_caster->GetMap()->GetUnit(((Player*)m_caster)->GetSelectionGuid());
|
||||
if (!target)
|
||||
{ return SPELL_FAILED_BAD_TARGETS; }
|
||||
{ return SPELL_FAILED_BAD_TARGETS; }
|
||||
|
||||
// Arcane Missile self cast forbidden
|
||||
if (m_spellInfo->SpellFamilyName == SPELLFAMILY_MAGE &&
|
||||
|
@ -100,14 +100,9 @@ namespace Movement
|
||||
if (move_spline.Finalized())
|
||||
return;
|
||||
|
||||
// ToDo: update transport info if required
|
||||
// TransportInfo* transportInfo = unit.GetTransportInfo();
|
||||
|
||||
Location real_position(unit.GetPositionX(), unit.GetPositionY(), unit.GetPositionZ(), unit.GetOrientation());
|
||||
|
||||
// If boarded use current local position
|
||||
// if (transportInfo)
|
||||
// transportInfo->GetLocalPosition(real_position.x, real_position.y, real_position.z, real_position.orientation);
|
||||
|
||||
// there is a big chance that current position is unknown if current state is not finalized, need compute it
|
||||
// this also allows calculate spline position and update map position in much greater intervals
|
||||
@ -130,12 +125,6 @@ namespace Movement
|
||||
WorldPacket data(SMSG_MONSTER_MOVE, 64);
|
||||
data << unit.GetPackGUID();
|
||||
|
||||
// ToDo: update transport info if required
|
||||
/*if (transportInfo)
|
||||
{
|
||||
data.SetOpcode(SMSG_MONSTER_MOVE_TRANSPORT);
|
||||
data << transportInfo->GetTransportGuid().WriteAsPacked();
|
||||
}*/
|
||||
|
||||
data << real_position.x << real_position.y << real_position.z;
|
||||
data << move_spline.GetId();
|
||||
|
@ -213,6 +213,7 @@ namespace Movement
|
||||
* @param z
|
||||
* @param generatePath
|
||||
* @param forceDestination
|
||||
* @param maxPathRange
|
||||
*/
|
||||
inline void MoveSplineInit::MoveTo(float x, float y, float z, bool generatePath, bool forceDestination, float maxPathRange)
|
||||
{
|
||||
@ -226,6 +227,7 @@ namespace Movement
|
||||
* @param dest
|
||||
* @param generatePath
|
||||
* @param forceDestination
|
||||
* @param maxPathRange
|
||||
*/
|
||||
inline void MoveSplineInit::MoveTo(const Vector3& dest, bool generatePath, bool forceDestination, float maxPathRange)
|
||||
{
|
||||
|
@ -42,12 +42,6 @@ namespace Movement
|
||||
{
|
||||
MoveSplineFlag splineflags = move_spline.splineflags;
|
||||
|
||||
/*if (mov.IsBoarded())
|
||||
{
|
||||
data.SetOpcode(SMSG_MONSTER_MOVE_TRANSPORT);
|
||||
data << mov.GetTransport()->Owner.GetPackGUID();
|
||||
}*/
|
||||
|
||||
data << move_spline.spline.getPoint(move_spline.spline.first());
|
||||
data << move_spline.GetId();
|
||||
|
||||
@ -129,35 +123,30 @@ namespace Movement
|
||||
|
||||
void PacketBuilder::WriteCreate(const MoveSpline& move_spline, ByteBuffer& data)
|
||||
{
|
||||
// WriteClientStatus(mov,data);
|
||||
// data.append<float>(&mov.m_float_values[SpeedWalk], SpeedMaxCount);
|
||||
// if (mov.SplineEnabled())
|
||||
MoveSplineFlag splineFlags = move_spline.splineflags;
|
||||
|
||||
data << splineFlags.raw();
|
||||
|
||||
if (splineFlags.final_point)
|
||||
{
|
||||
MoveSplineFlag splineFlags = move_spline.splineflags;
|
||||
|
||||
data << splineFlags.raw();
|
||||
|
||||
if (splineFlags.final_point)
|
||||
{
|
||||
data << move_spline.facing.f.x << move_spline.facing.f.y << move_spline.facing.f.z;
|
||||
}
|
||||
else if (splineFlags.final_target)
|
||||
{
|
||||
data << move_spline.facing.target;
|
||||
}
|
||||
else if (splineFlags.final_angle)
|
||||
{
|
||||
data << move_spline.facing.angle;
|
||||
}
|
||||
|
||||
data << move_spline.timePassed();
|
||||
data << move_spline.Duration();
|
||||
data << move_spline.GetId();
|
||||
|
||||
uint32 nodes = move_spline.getPath().size();
|
||||
data << nodes;
|
||||
data.append<Vector3>(&move_spline.getPath()[0], nodes);
|
||||
data << (move_spline.isCyclic() ? Vector3::zero() : move_spline.FinalDestination());
|
||||
data << move_spline.facing.f.x << move_spline.facing.f.y << move_spline.facing.f.z;
|
||||
}
|
||||
else if (splineFlags.final_target)
|
||||
{
|
||||
data << move_spline.facing.target;
|
||||
}
|
||||
else if (splineFlags.final_angle)
|
||||
{
|
||||
data << move_spline.facing.angle;
|
||||
}
|
||||
|
||||
data << move_spline.timePassed();
|
||||
data << move_spline.Duration();
|
||||
data << move_spline.GetId();
|
||||
|
||||
uint32 nodes = move_spline.getPath().size();
|
||||
data << nodes;
|
||||
data.append<Vector3>(&move_spline.getPath()[0], nodes);
|
||||
data << (move_spline.isCyclic() ? Vector3::zero() : move_spline.FinalDestination());
|
||||
}
|
||||
}
|
||||
|
@ -54,7 +54,7 @@ bool AhBotConfig::Initialize()
|
||||
underPriceProbability = config.GetFloatDefault("AhBot.UnderPriceProbability", 0.05f);
|
||||
LoadSet<set<uint32> >(config.GetStringDefault("AhBot.IgnoreItemIds", "49283,52200,8494,6345,6891,2460,37164,34835"), ignoreItemIds);
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
sLog.outString("AhBot is Disabled in ahbot.conf");
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user