mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-12 17:51:28 +00:00
Revert "Revert "Merge pull request #77 from j883376/cleanups""
This reverts commit d25205d9d381dc83d610fa1084019b90cfe83e1c.
This commit is contained in:
parent
d25205d9d3
commit
0578f45490
@ -318,4 +318,4 @@ IF(UNIX)
|
|||||||
SET_SOURCE_FILES_PROPERTIES("patches/SoD.cpp" "patches/SoF.cpp" "patches/RoF.cpp" "patches/Underfoot.cpp" PROPERTIES COMPILE_FLAGS -O0)
|
SET_SOURCE_FILES_PROPERTIES("patches/SoD.cpp" "patches/SoF.cpp" "patches/RoF.cpp" "patches/Underfoot.cpp" PROPERTIES COMPILE_FLAGS -O0)
|
||||||
ENDIF(UNIX)
|
ENDIF(UNIX)
|
||||||
|
|
||||||
SET(LIBRARY_OUTPUT_PATH ../Bin)
|
SET(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/Bin)
|
||||||
|
|||||||
@ -95,8 +95,6 @@ bool Database::Connect(const char* host, const char* user, const char* passwd, c
|
|||||||
|
|
||||||
void Database::DBInitVars() {
|
void Database::DBInitVars() {
|
||||||
|
|
||||||
max_zonename = 0;
|
|
||||||
zonename_array = 0;
|
|
||||||
varcache_array = 0;
|
varcache_array = 0;
|
||||||
varcache_max = 0;
|
varcache_max = 0;
|
||||||
varcache_lastupdate = 0;
|
varcache_lastupdate = 0;
|
||||||
@ -135,13 +133,6 @@ Close the connection to the database
|
|||||||
Database::~Database()
|
Database::~Database()
|
||||||
{
|
{
|
||||||
unsigned int x;
|
unsigned int x;
|
||||||
if (zonename_array) {
|
|
||||||
for (x=0; x<=max_zonename; x++) {
|
|
||||||
if (zonename_array[x])
|
|
||||||
safe_delete_array(zonename_array[x]);
|
|
||||||
}
|
|
||||||
safe_delete_array(zonename_array);
|
|
||||||
}
|
|
||||||
if (varcache_array) {
|
if (varcache_array) {
|
||||||
for (x=0; x<varcache_max; x++) {
|
for (x=0; x<varcache_max; x++) {
|
||||||
safe_delete_array(varcache_array[x]);
|
safe_delete_array(varcache_array[x]);
|
||||||
@ -1316,39 +1307,13 @@ bool Database::LoadZoneNames() {
|
|||||||
char *query = 0;
|
char *query = 0;
|
||||||
MYSQL_RES *result;
|
MYSQL_RES *result;
|
||||||
MYSQL_ROW row;
|
MYSQL_ROW row;
|
||||||
query = new char[256];
|
|
||||||
strcpy(query, "SELECT MAX(zoneidnumber) FROM zone");
|
|
||||||
|
|
||||||
if (RunQuery(query, strlen(query), errbuf, &result)) {
|
if (RunQuery(query, MakeAnyLenString(&query, "SELECT zoneidnumber, short_name FROM zone"), errbuf, &result)) {
|
||||||
safe_delete_array(query);
|
safe_delete_array(query);
|
||||||
row = mysql_fetch_row(result);
|
while ((row = mysql_fetch_row(result))) {
|
||||||
if (row && row[0])
|
uint32 zoneid = atoi(row[0]);
|
||||||
{
|
std::string zonename = row[1];
|
||||||
max_zonename = atoi(row[0]);
|
zonename_array.insert(std::pair<uint32,std::string>(zoneid,zonename));
|
||||||
zonename_array = new char*[max_zonename+1];
|
|
||||||
for(unsigned int i=0; i<max_zonename; i++) {
|
|
||||||
zonename_array[i] = 0;
|
|
||||||
}
|
|
||||||
mysql_free_result(result);
|
|
||||||
|
|
||||||
MakeAnyLenString(&query, "SELECT zoneidnumber, short_name FROM zone");
|
|
||||||
if (RunQuery(query, strlen(query), errbuf, &result)) {
|
|
||||||
safe_delete_array(query);
|
|
||||||
while((row = mysql_fetch_row(result))) {
|
|
||||||
zonename_array[atoi(row[0])] = new char[strlen(row[1]) + 1];
|
|
||||||
strcpy(zonename_array[atoi(row[0])], row[1]);
|
|
||||||
Sleep(0);
|
|
||||||
}
|
|
||||||
mysql_free_result(result);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
std::cerr << "Error in LoadZoneNames query '" << query << "' " << errbuf << std::endl;
|
|
||||||
safe_delete_array(query);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
mysql_free_result(result);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -1356,39 +1321,27 @@ bool Database::LoadZoneNames() {
|
|||||||
safe_delete_array(query);
|
safe_delete_array(query);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
mysql_free_result(result);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32 Database::GetZoneID(const char* zonename) {
|
uint32 Database::GetZoneID(const char* zonename) {
|
||||||
if (zonename_array == 0)
|
|
||||||
return 0;
|
|
||||||
if (zonename == 0)
|
if (zonename == 0)
|
||||||
return 0;
|
return 0;
|
||||||
for (unsigned int i=0; i<=max_zonename; i++) {
|
for (auto iter = zonename_array.begin(); iter != zonename_array.end(); ++iter) {
|
||||||
if (zonename_array[i] != 0 && strcasecmp(zonename_array[i], zonename) == 0) {
|
if (iter->second.compare(zonename) == 0) {
|
||||||
return i;
|
return iter->first;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* Database::GetZoneName(uint32 zoneID, bool ErrorUnknown) {
|
const char* Database::GetZoneName(uint32 zoneID, bool ErrorUnknown) {
|
||||||
if (zonename_array == 0) {
|
auto iter = zonename_array.find(zoneID);
|
||||||
if (ErrorUnknown)
|
|
||||||
return "UNKNOWN";
|
|
||||||
else
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (zoneID <= max_zonename) {
|
if (iter != zonename_array.end()) {
|
||||||
if (zonename_array[zoneID])
|
return iter->second.c_str();
|
||||||
return zonename_array[zoneID];
|
|
||||||
else {
|
|
||||||
if (ErrorUnknown)
|
|
||||||
return "UNKNOWN";
|
|
||||||
else
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (ErrorUnknown)
|
if (ErrorUnknown)
|
||||||
|
|||||||
@ -255,8 +255,7 @@ protected:
|
|||||||
private:
|
private:
|
||||||
void DBInitVars();
|
void DBInitVars();
|
||||||
|
|
||||||
uint32 max_zonename;
|
std::map<uint32,std::string> zonename_array;
|
||||||
char** zonename_array;
|
|
||||||
|
|
||||||
Mutex Mvarcache;
|
Mutex Mvarcache;
|
||||||
uint32 varcache_max;
|
uint32 varcache_max;
|
||||||
|
|||||||
@ -2415,7 +2415,8 @@ struct BookRequest_Struct {
|
|||||||
*/
|
*/
|
||||||
struct Object_Struct {
|
struct Object_Struct {
|
||||||
/*00*/ uint32 linked_list_addr[2];// <Zaphod> They are, get this, prev and next, ala linked list
|
/*00*/ uint32 linked_list_addr[2];// <Zaphod> They are, get this, prev and next, ala linked list
|
||||||
/*08*/ uint16 unknown008[2]; //
|
/*08*/ uint16 unknown008; //
|
||||||
|
/*10*/ uint16 unknown010; //
|
||||||
/*12*/ uint32 drop_id; // Unique object id for zone
|
/*12*/ uint32 drop_id; // Unique object id for zone
|
||||||
/*16*/ uint16 zone_id; // Redudant, but: Zone the object appears in
|
/*16*/ uint16 zone_id; // Redudant, but: Zone the object appears in
|
||||||
/*18*/ uint16 zone_instance; //
|
/*18*/ uint16 zone_instance; //
|
||||||
|
|||||||
@ -3037,7 +3037,6 @@ ENCODE(OP_ZonePlayerToBind)
|
|||||||
ZonePlayerToBind_Struct *zps = (ZonePlayerToBind_Struct*)(*p)->pBuffer;
|
ZonePlayerToBind_Struct *zps = (ZonePlayerToBind_Struct*)(*p)->pBuffer;
|
||||||
|
|
||||||
std::stringstream ss(std::stringstream::in | std::stringstream::out | std::stringstream::binary);
|
std::stringstream ss(std::stringstream::in | std::stringstream::out | std::stringstream::binary);
|
||||||
ss.clear();
|
|
||||||
|
|
||||||
unsigned char *buffer1 = new unsigned char[sizeof(structs::ZonePlayerToBindHeader_Struct) + strlen(zps->zone_name)];
|
unsigned char *buffer1 = new unsigned char[sizeof(structs::ZonePlayerToBindHeader_Struct) + strlen(zps->zone_name)];
|
||||||
structs::ZonePlayerToBindHeader_Struct *zph = (structs::ZonePlayerToBindHeader_Struct*)buffer1;
|
structs::ZonePlayerToBindHeader_Struct *zph = (structs::ZonePlayerToBindHeader_Struct*)buffer1;
|
||||||
@ -4839,7 +4838,6 @@ char* SerializeItem(const ItemInst *inst, int16 slot_id_in, uint32 *length, uint
|
|||||||
charges = 0xFFFFFFFF;
|
charges = 0xFFFFFFFF;
|
||||||
|
|
||||||
std::stringstream ss(std::stringstream::in | std::stringstream::out | std::stringstream::binary);
|
std::stringstream ss(std::stringstream::in | std::stringstream::out | std::stringstream::binary);
|
||||||
ss.clear();
|
|
||||||
|
|
||||||
const Item_Struct *item = inst->GetItem();
|
const Item_Struct *item = inst->GetItem();
|
||||||
//_log(NET__ERROR, "Serialize called for: %s", item->Name);
|
//_log(NET__ERROR, "Serialize called for: %s", item->Name);
|
||||||
|
|||||||
@ -1984,7 +1984,6 @@ ENCODE(OP_ZonePlayerToBind)
|
|||||||
ZonePlayerToBind_Struct *zps = (ZonePlayerToBind_Struct*)(*p)->pBuffer;
|
ZonePlayerToBind_Struct *zps = (ZonePlayerToBind_Struct*)(*p)->pBuffer;
|
||||||
|
|
||||||
std::stringstream ss(std::stringstream::in | std::stringstream::out | std::stringstream::binary);
|
std::stringstream ss(std::stringstream::in | std::stringstream::out | std::stringstream::binary);
|
||||||
ss.clear();
|
|
||||||
|
|
||||||
unsigned char *buffer1 = new unsigned char[sizeof(structs::ZonePlayerToBindHeader_Struct) + strlen(zps->zone_name)];
|
unsigned char *buffer1 = new unsigned char[sizeof(structs::ZonePlayerToBindHeader_Struct) + strlen(zps->zone_name)];
|
||||||
structs::ZonePlayerToBindHeader_Struct *zph = (structs::ZonePlayerToBindHeader_Struct*)buffer1;
|
structs::ZonePlayerToBindHeader_Struct *zph = (structs::ZonePlayerToBindHeader_Struct*)buffer1;
|
||||||
@ -3057,7 +3056,6 @@ char* SerializeItem(const ItemInst *inst, int16 slot_id_in, uint32 *length, uint
|
|||||||
charges = 0xFFFFFFFF;
|
charges = 0xFFFFFFFF;
|
||||||
|
|
||||||
std::stringstream ss(std::stringstream::in | std::stringstream::out | std::stringstream::binary);
|
std::stringstream ss(std::stringstream::in | std::stringstream::out | std::stringstream::binary);
|
||||||
ss.clear();
|
|
||||||
|
|
||||||
const Item_Struct *item = inst->GetItem();
|
const Item_Struct *item = inst->GetItem();
|
||||||
//_log(NET__ERROR, "Serialize called for: %s", item->Name);
|
//_log(NET__ERROR, "Serialize called for: %s", item->Name);
|
||||||
|
|||||||
@ -1621,7 +1621,6 @@ ENCODE(OP_ZonePlayerToBind)
|
|||||||
ZonePlayerToBind_Struct *zps = (ZonePlayerToBind_Struct*)(*p)->pBuffer;
|
ZonePlayerToBind_Struct *zps = (ZonePlayerToBind_Struct*)(*p)->pBuffer;
|
||||||
|
|
||||||
std::stringstream ss(std::stringstream::in | std::stringstream::out | std::stringstream::binary);
|
std::stringstream ss(std::stringstream::in | std::stringstream::out | std::stringstream::binary);
|
||||||
ss.clear();
|
|
||||||
|
|
||||||
unsigned char *buffer1 = new unsigned char[sizeof(structs::ZonePlayerToBindHeader_Struct) + strlen(zps->zone_name)];
|
unsigned char *buffer1 = new unsigned char[sizeof(structs::ZonePlayerToBindHeader_Struct) + strlen(zps->zone_name)];
|
||||||
structs::ZonePlayerToBindHeader_Struct *zph = (structs::ZonePlayerToBindHeader_Struct*)buffer1;
|
structs::ZonePlayerToBindHeader_Struct *zph = (structs::ZonePlayerToBindHeader_Struct*)buffer1;
|
||||||
@ -2376,7 +2375,6 @@ char* SerializeItem(const ItemInst *inst, int16 slot_id_in, uint32 *length, uint
|
|||||||
charges = 0xFFFFFFFF;
|
charges = 0xFFFFFFFF;
|
||||||
|
|
||||||
std::stringstream ss(std::stringstream::in | std::stringstream::out | std::stringstream::binary);
|
std::stringstream ss(std::stringstream::in | std::stringstream::out | std::stringstream::binary);
|
||||||
ss.clear();
|
|
||||||
|
|
||||||
const Item_Struct *item = inst->GetItem();
|
const Item_Struct *item = inst->GetItem();
|
||||||
//_log(NET__ERROR, "Serialize called for: %s", item->Name);
|
//_log(NET__ERROR, "Serialize called for: %s", item->Name);
|
||||||
|
|||||||
@ -2044,7 +2044,6 @@ ENCODE(OP_ZonePlayerToBind)
|
|||||||
ZonePlayerToBind_Struct *zps = (ZonePlayerToBind_Struct*)(*p)->pBuffer;
|
ZonePlayerToBind_Struct *zps = (ZonePlayerToBind_Struct*)(*p)->pBuffer;
|
||||||
|
|
||||||
std::stringstream ss(std::stringstream::in | std::stringstream::out | std::stringstream::binary);
|
std::stringstream ss(std::stringstream::in | std::stringstream::out | std::stringstream::binary);
|
||||||
ss.clear();
|
|
||||||
|
|
||||||
unsigned char *buffer1 = new unsigned char[sizeof(structs::ZonePlayerToBindHeader_Struct) + strlen(zps->zone_name)];
|
unsigned char *buffer1 = new unsigned char[sizeof(structs::ZonePlayerToBindHeader_Struct) + strlen(zps->zone_name)];
|
||||||
structs::ZonePlayerToBindHeader_Struct *zph = (structs::ZonePlayerToBindHeader_Struct*)buffer1;
|
structs::ZonePlayerToBindHeader_Struct *zph = (structs::ZonePlayerToBindHeader_Struct*)buffer1;
|
||||||
@ -3462,7 +3461,6 @@ char* SerializeItem(const ItemInst *inst, int16 slot_id_in, uint32 *length, uint
|
|||||||
charges = 0xFFFFFFFF;
|
charges = 0xFFFFFFFF;
|
||||||
|
|
||||||
std::stringstream ss(std::stringstream::in | std::stringstream::out | std::stringstream::binary);
|
std::stringstream ss(std::stringstream::in | std::stringstream::out | std::stringstream::binary);
|
||||||
ss.clear();
|
|
||||||
|
|
||||||
const Item_Struct *item = inst->GetItem();
|
const Item_Struct *item = inst->GetItem();
|
||||||
//_log(NET__ERROR, "Serialize called for: %s", item->Name);
|
//_log(NET__ERROR, "Serialize called for: %s", item->Name);
|
||||||
|
|||||||
@ -37,4 +37,4 @@ IF(UNIX)
|
|||||||
ADD_DEFINITIONS(-fPIC)
|
ADD_DEFINITIONS(-fPIC)
|
||||||
ENDIF(UNIX)
|
ENDIF(UNIX)
|
||||||
|
|
||||||
SET(EXECUTABLE_OUTPUT_PATH ../Bin)
|
SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/Bin)
|
||||||
|
|||||||
@ -44,13 +44,13 @@ int main(int argc, char *argv[]) {
|
|||||||
}
|
}
|
||||||
if(launcher_name.length() < 1) {
|
if(launcher_name.length() < 1) {
|
||||||
_log(LAUNCHER__ERROR, "You must specfify a launcher name as the first argument to this program.");
|
_log(LAUNCHER__ERROR, "You must specfify a launcher name as the first argument to this program.");
|
||||||
return(1);
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
_log(LAUNCHER__INIT, "Loading server configuration..");
|
_log(LAUNCHER__INIT, "Loading server configuration..");
|
||||||
if (!EQEmuConfig::LoadConfig()) {
|
if (!EQEmuConfig::LoadConfig()) {
|
||||||
_log(LAUNCHER__ERROR, "Loading server configuration failed.");
|
_log(LAUNCHER__ERROR, "Loading server configuration failed.");
|
||||||
return(1);
|
return 1;
|
||||||
}
|
}
|
||||||
const EQEmuConfig *Config = EQEmuConfig::get();
|
const EQEmuConfig *Config = EQEmuConfig::get();
|
||||||
|
|
||||||
@ -173,7 +173,7 @@ int main(int argc, char *argv[]) {
|
|||||||
delete zone->second;
|
delete zone->second;
|
||||||
}
|
}
|
||||||
|
|
||||||
return(0);
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -67,4 +67,4 @@ IF(UNIX)
|
|||||||
ADD_DEFINITIONS(-fPIC)
|
ADD_DEFINITIONS(-fPIC)
|
||||||
ENDIF(UNIX)
|
ENDIF(UNIX)
|
||||||
|
|
||||||
SET(EXECUTABLE_OUTPUT_PATH ../Bin)
|
SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/Bin)
|
||||||
|
|||||||
@ -43,4 +43,4 @@ IF(UNIX)
|
|||||||
ADD_DEFINITIONS(-fPIC)
|
ADD_DEFINITIONS(-fPIC)
|
||||||
ENDIF(UNIX)
|
ENDIF(UNIX)
|
||||||
|
|
||||||
SET(EXECUTABLE_OUTPUT_PATH ../Bin)
|
SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/Bin)
|
||||||
|
|||||||
@ -69,7 +69,7 @@ int main() {
|
|||||||
|
|
||||||
_log(QUERYSERV__INIT, "Loading server configuration failed.");
|
_log(QUERYSERV__INIT, "Loading server configuration failed.");
|
||||||
|
|
||||||
return(1);
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
Config = queryservconfig::get();
|
Config = queryservconfig::get();
|
||||||
@ -90,16 +90,16 @@ int main() {
|
|||||||
Config->QSDatabaseDB.c_str(),
|
Config->QSDatabaseDB.c_str(),
|
||||||
Config->QSDatabasePort)) {
|
Config->QSDatabasePort)) {
|
||||||
_log(WORLD__INIT_ERR, "Cannot continue without a database connection.");
|
_log(WORLD__INIT_ERR, "Cannot continue without a database connection.");
|
||||||
return(1);
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (signal(SIGINT, CatchSignal) == SIG_ERR) {
|
if (signal(SIGINT, CatchSignal) == SIG_ERR) {
|
||||||
_log(QUERYSERV__ERROR, "Could not set signal handler");
|
_log(QUERYSERV__ERROR, "Could not set signal handler");
|
||||||
return 0;
|
return 1;
|
||||||
}
|
}
|
||||||
if (signal(SIGTERM, CatchSignal) == SIG_ERR) {
|
if (signal(SIGTERM, CatchSignal) == SIG_ERR) {
|
||||||
_log(QUERYSERV__ERROR, "Could not set signal handler");
|
_log(QUERYSERV__ERROR, "Could not set signal handler");
|
||||||
return 0;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
worldserver = new WorldServer;
|
worldserver = new WorldServer;
|
||||||
|
|||||||
@ -43,4 +43,4 @@ IF(UNIX)
|
|||||||
ADD_DEFINITIONS(-fPIC)
|
ADD_DEFINITIONS(-fPIC)
|
||||||
ENDIF(UNIX)
|
ENDIF(UNIX)
|
||||||
|
|
||||||
SET(EXECUTABLE_OUTPUT_PATH ../Bin)
|
SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/Bin)
|
||||||
|
|||||||
@ -37,7 +37,7 @@ int main(int argc, char **argv) {
|
|||||||
LogFile->write(EQEMuLog::Status, "Shared Memory Loader Program");
|
LogFile->write(EQEMuLog::Status, "Shared Memory Loader Program");
|
||||||
if(!EQEmuConfig::LoadConfig()) {
|
if(!EQEmuConfig::LoadConfig()) {
|
||||||
LogFile->write(EQEMuLog::Error, "Unable to load configuration file.");
|
LogFile->write(EQEMuLog::Error, "Unable to load configuration file.");
|
||||||
return 0;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
const EQEmuConfig *config = EQEmuConfig::get();
|
const EQEmuConfig *config = EQEmuConfig::get();
|
||||||
@ -51,7 +51,7 @@ int main(int argc, char **argv) {
|
|||||||
config->DatabasePassword.c_str(), config->DatabaseDB.c_str(), config->DatabasePort)) {
|
config->DatabasePassword.c_str(), config->DatabaseDB.c_str(), config->DatabasePort)) {
|
||||||
LogFile->write(EQEMuLog::Error, "Unable to connect to the database, cannot continue without a "
|
LogFile->write(EQEMuLog::Error, "Unable to connect to the database, cannot continue without a "
|
||||||
"database connection");
|
"database connection");
|
||||||
return 0;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool load_all = true;
|
bool load_all = true;
|
||||||
@ -111,7 +111,7 @@ int main(int argc, char **argv) {
|
|||||||
LoadItems(&database);
|
LoadItems(&database);
|
||||||
} catch(std::exception &ex) {
|
} catch(std::exception &ex) {
|
||||||
LogFile->write(EQEMuLog::Error, "%s", ex.what());
|
LogFile->write(EQEMuLog::Error, "%s", ex.what());
|
||||||
return 0;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -121,7 +121,7 @@ int main(int argc, char **argv) {
|
|||||||
LoadFactions(&database);
|
LoadFactions(&database);
|
||||||
} catch(std::exception &ex) {
|
} catch(std::exception &ex) {
|
||||||
LogFile->write(EQEMuLog::Error, "%s", ex.what());
|
LogFile->write(EQEMuLog::Error, "%s", ex.what());
|
||||||
return 0;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -131,7 +131,7 @@ int main(int argc, char **argv) {
|
|||||||
LoadLoot(&database);
|
LoadLoot(&database);
|
||||||
} catch(std::exception &ex) {
|
} catch(std::exception &ex) {
|
||||||
LogFile->write(EQEMuLog::Error, "%s", ex.what());
|
LogFile->write(EQEMuLog::Error, "%s", ex.what());
|
||||||
return 0;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -141,7 +141,7 @@ int main(int argc, char **argv) {
|
|||||||
LoadSkillCaps(&database);
|
LoadSkillCaps(&database);
|
||||||
} catch(std::exception &ex) {
|
} catch(std::exception &ex) {
|
||||||
LogFile->write(EQEMuLog::Error, "%s", ex.what());
|
LogFile->write(EQEMuLog::Error, "%s", ex.what());
|
||||||
return 0;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -151,7 +151,7 @@ int main(int argc, char **argv) {
|
|||||||
LoadSpells(&database);
|
LoadSpells(&database);
|
||||||
} catch(std::exception &ex) {
|
} catch(std::exception &ex) {
|
||||||
LogFile->write(EQEMuLog::Error, "%s", ex.what());
|
LogFile->write(EQEMuLog::Error, "%s", ex.what());
|
||||||
return 0;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -46,4 +46,4 @@ IF(UNIX)
|
|||||||
ADD_DEFINITIONS(-fPIC)
|
ADD_DEFINITIONS(-fPIC)
|
||||||
ENDIF(UNIX)
|
ENDIF(UNIX)
|
||||||
|
|
||||||
SET(EXECUTABLE_OUTPUT_PATH ../Bin)
|
SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/Bin)
|
||||||
|
|||||||
@ -402,7 +402,7 @@ void Database::SendHeaders(Client *c) {
|
|||||||
|
|
||||||
char Buf[100];
|
char Buf[100];
|
||||||
|
|
||||||
my_ulonglong NumRows = mysql_num_rows(result);
|
uint32 NumRows = mysql_num_rows(result);
|
||||||
|
|
||||||
int HeaderCountPacketLength = 0;
|
int HeaderCountPacketLength = 0;
|
||||||
|
|
||||||
|
|||||||
@ -82,7 +82,7 @@ int main() {
|
|||||||
|
|
||||||
_log(UCS__INIT, "Loading server configuration failed.");
|
_log(UCS__INIT, "Loading server configuration failed.");
|
||||||
|
|
||||||
return(1);
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
Config = ucsconfig::get();
|
Config = ucsconfig::get();
|
||||||
@ -103,7 +103,7 @@ int main() {
|
|||||||
Config->DatabaseDB.c_str(),
|
Config->DatabaseDB.c_str(),
|
||||||
Config->DatabasePort)) {
|
Config->DatabasePort)) {
|
||||||
_log(WORLD__INIT_ERR, "Cannot continue without a database connection.");
|
_log(WORLD__INIT_ERR, "Cannot continue without a database connection.");
|
||||||
return(1);
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
char tmp[64];
|
char tmp[64];
|
||||||
@ -137,11 +137,11 @@ int main() {
|
|||||||
|
|
||||||
if (signal(SIGINT, CatchSignal) == SIG_ERR) {
|
if (signal(SIGINT, CatchSignal) == SIG_ERR) {
|
||||||
_log(UCS__ERROR, "Could not set signal handler");
|
_log(UCS__ERROR, "Could not set signal handler");
|
||||||
return 0;
|
return 1;
|
||||||
}
|
}
|
||||||
if (signal(SIGTERM, CatchSignal) == SIG_ERR) {
|
if (signal(SIGTERM, CatchSignal) == SIG_ERR) {
|
||||||
_log(UCS__ERROR, "Could not set signal handler");
|
_log(UCS__ERROR, "Could not set signal handler");
|
||||||
return 0;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
worldserver = new WorldServer;
|
worldserver = new WorldServer;
|
||||||
|
|||||||
0
utils/defaults/shared/.keep
Normal file
0
utils/defaults/shared/.keep
Normal file
@ -27,6 +27,10 @@ AdventureManager::~AdventureManager()
|
|||||||
safe_delete(process_timer);
|
safe_delete(process_timer);
|
||||||
safe_delete(save_timer);
|
safe_delete(save_timer);
|
||||||
safe_delete(leaderboard_info_timer);
|
safe_delete(leaderboard_info_timer);
|
||||||
|
|
||||||
|
for (auto iter = adventure_templates.begin(); iter != adventure_templates.end(); ++iter) {
|
||||||
|
delete iter->second;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void AdventureManager::Process()
|
void AdventureManager::Process()
|
||||||
|
|||||||
@ -92,4 +92,4 @@ IF(UNIX)
|
|||||||
ADD_DEFINITIONS(-fPIC)
|
ADD_DEFINITIONS(-fPIC)
|
||||||
ENDIF(UNIX)
|
ENDIF(UNIX)
|
||||||
|
|
||||||
SET(EXECUTABLE_OUTPUT_PATH ../Bin)
|
SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/Bin)
|
||||||
|
|||||||
@ -126,7 +126,7 @@ int main(int argc, char** argv) {
|
|||||||
_log(WORLD__INIT, "Loading server configuration..");
|
_log(WORLD__INIT, "Loading server configuration..");
|
||||||
if (!WorldConfig::LoadConfig()) {
|
if (!WorldConfig::LoadConfig()) {
|
||||||
_log(WORLD__INIT_ERR, "Loading server configuration failed.");
|
_log(WORLD__INIT_ERR, "Loading server configuration failed.");
|
||||||
return(1);
|
return 1;
|
||||||
}
|
}
|
||||||
const WorldConfig *Config=WorldConfig::get();
|
const WorldConfig *Config=WorldConfig::get();
|
||||||
|
|
||||||
@ -144,16 +144,16 @@ int main(int argc, char** argv) {
|
|||||||
|
|
||||||
if (signal(SIGINT, CatchSignal) == SIG_ERR) {
|
if (signal(SIGINT, CatchSignal) == SIG_ERR) {
|
||||||
_log(WORLD__INIT_ERR, "Could not set signal handler");
|
_log(WORLD__INIT_ERR, "Could not set signal handler");
|
||||||
return 0;
|
return 1;
|
||||||
}
|
}
|
||||||
if (signal(SIGTERM, CatchSignal) == SIG_ERR) {
|
if (signal(SIGTERM, CatchSignal) == SIG_ERR) {
|
||||||
_log(WORLD__INIT_ERR, "Could not set signal handler");
|
_log(WORLD__INIT_ERR, "Could not set signal handler");
|
||||||
return 0;
|
return 1;
|
||||||
}
|
}
|
||||||
#ifndef WIN32
|
#ifndef WIN32
|
||||||
if (signal(SIGPIPE, SIG_IGN) == SIG_ERR) {
|
if (signal(SIGPIPE, SIG_IGN) == SIG_ERR) {
|
||||||
_log(WORLD__INIT_ERR, "Could not set signal handler");
|
_log(WORLD__INIT_ERR, "Could not set signal handler");
|
||||||
return 0;
|
return 1;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -182,7 +182,7 @@ int main(int argc, char** argv) {
|
|||||||
Config->DatabaseDB.c_str(),
|
Config->DatabaseDB.c_str(),
|
||||||
Config->DatabasePort)) {
|
Config->DatabasePort)) {
|
||||||
_log(WORLD__INIT_ERR, "Cannot continue without a database connection.");
|
_log(WORLD__INIT_ERR, "Cannot continue without a database connection.");
|
||||||
return(1);
|
return 1;
|
||||||
}
|
}
|
||||||
dbasync = new DBAsync(&database);
|
dbasync = new DBAsync(&database);
|
||||||
guild_mgr.SetDatabase(&database);
|
guild_mgr.SetDatabase(&database);
|
||||||
@ -204,8 +204,8 @@ int main(int argc, char** argv) {
|
|||||||
else if (database.GetVariable("disablecommandline", tmp, 2)) {
|
else if (database.GetVariable("disablecommandline", tmp, 2)) {
|
||||||
if (strlen(tmp) == 1) {
|
if (strlen(tmp) == 1) {
|
||||||
if (tmp[0] == '1') {
|
if (tmp[0] == '1') {
|
||||||
std::cout << "Command line disabled in database... exiting" << std::endl;
|
std::cerr << "Command line disabled in database... exiting" << std::endl;
|
||||||
return 0;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -213,14 +213,17 @@ int main(int argc, char** argv) {
|
|||||||
if (argc == 5) {
|
if (argc == 5) {
|
||||||
if (Seperator::IsNumber(argv[4])) {
|
if (Seperator::IsNumber(argv[4])) {
|
||||||
if (atoi(argv[4]) >= 0 && atoi(argv[4]) <= 255) {
|
if (atoi(argv[4]) >= 0 && atoi(argv[4]) <= 255) {
|
||||||
if (database.CreateAccount(argv[2], argv[3], atoi(argv[4])) == 0)
|
if (database.CreateAccount(argv[2], argv[3], atoi(argv[4])) == 0) {
|
||||||
std::cout << "database.CreateAccount failed." << std::endl;
|
std::cerr << "database.CreateAccount failed." << std::endl;
|
||||||
else
|
return 1;
|
||||||
|
}
|
||||||
|
else {
|
||||||
std::cout << "Account created: Username='" << argv[2] << "', Password='" << argv[3] << "', status=" << argv[4] << std::endl;
|
std::cout << "Account created: Username='" << argv[2] << "', Password='" << argv[3] << "', status=" << argv[4] << std::endl;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
std::cout << "Usage: world adduser username password flag" << std::endl;
|
std::cout << "Usage: world adduser username password flag" << std::endl;
|
||||||
std::cout << "flag = 0, 1 or 2" << std::endl;
|
std::cout << "flag = 0, 1 or 2" << std::endl;
|
||||||
return 0;
|
return 0;
|
||||||
@ -230,12 +233,15 @@ int main(int argc, char** argv) {
|
|||||||
if (Seperator::IsNumber(argv[3])) {
|
if (Seperator::IsNumber(argv[3])) {
|
||||||
|
|
||||||
if (atoi(argv[3]) >= 0 && atoi(argv[3]) <= 255) {
|
if (atoi(argv[3]) >= 0 && atoi(argv[3]) <= 255) {
|
||||||
if (database.SetAccountStatus(argv[2], atoi(argv[3])))
|
if (database.SetAccountStatus(argv[2], atoi(argv[3]))) {
|
||||||
std::cout << "Account flagged: Username='" << argv[2] << "', status=" << argv[3] << std::endl;
|
std::cout << "Account flagged: Username='" << argv[2] << "', status=" << argv[3] << std::endl;
|
||||||
else
|
|
||||||
std::cout << "database.SetAccountStatus failed." << std::endl;
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
std::cerr << "database.SetAccountStatus failed." << std::endl;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
std::cout << "Usage: world flag username flag" << std::endl;
|
std::cout << "Usage: world flag username flag" << std::endl;
|
||||||
@ -245,25 +251,30 @@ int main(int argc, char** argv) {
|
|||||||
else if (strcasecmp(argv[1], "startzone") == 0) {
|
else if (strcasecmp(argv[1], "startzone") == 0) {
|
||||||
if (argc == 3) {
|
if (argc == 3) {
|
||||||
if (strlen(argv[2]) < 3) {
|
if (strlen(argv[2]) < 3) {
|
||||||
std::cout << "Error: zone name too short" << std::endl;
|
std::cerr << "Error: zone name too short" << std::endl;
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
else if (strlen(argv[2]) > 15) {
|
else if (strlen(argv[2]) > 15) {
|
||||||
std::cout << "Error: zone name too long" << std::endl;
|
std::cerr << "Error: zone name too long" << std::endl;
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (database.SetVariable("startzone", argv[2]))
|
if (database.SetVariable("startzone", argv[2])) {
|
||||||
std::cout << "Starting zone changed: '" << argv[2] << "'" << std::endl;
|
std::cout << "Starting zone changed: '" << argv[2] << "'" << std::endl;
|
||||||
else
|
|
||||||
std::cout << "database.SetVariable failed." << std::endl;
|
|
||||||
}
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
std::cerr << "database.SetVariable failed." << std::endl;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
std::cout << "Usage: world startzone zoneshortname" << std::endl;
|
std::cout << "Usage: world startzone zoneshortname" << std::endl;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
std::cout << "Error, unknown command line option" << std::endl;
|
std::cerr << "Error, unknown command line option" << std::endl;
|
||||||
return 0;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -180,4 +180,6 @@ IF(UNIX)
|
|||||||
ADD_DEFINITIONS(-fPIC)
|
ADD_DEFINITIONS(-fPIC)
|
||||||
ENDIF(UNIX)
|
ENDIF(UNIX)
|
||||||
|
|
||||||
SET(EXECUTABLE_OUTPUT_PATH ../Bin)
|
INCLUDE_DIRECTORIES(${VLD_INCLUDE_DIR})
|
||||||
|
|
||||||
|
SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/Bin)
|
||||||
|
|||||||
@ -3899,7 +3899,7 @@ void Client::Handle_OP_LDoNInspect(const EQApplicationPacket *app)
|
|||||||
void Client::Handle_OP_Dye(const EQApplicationPacket *app)
|
void Client::Handle_OP_Dye(const EQApplicationPacket *app)
|
||||||
{
|
{
|
||||||
if(app->size!=sizeof(DyeStruct))
|
if(app->size!=sizeof(DyeStruct))
|
||||||
printf("Wrong size of DyeStruct, Got: %i, Expected: %i\n",app->size,sizeof(DyeStruct));
|
printf("Wrong size of DyeStruct, Got: %i, Expected: %zu\n",app->size,sizeof(DyeStruct));
|
||||||
else{
|
else{
|
||||||
DyeStruct* dye = (DyeStruct*)app->pBuffer;
|
DyeStruct* dye = (DyeStruct*)app->pBuffer;
|
||||||
DyeArmor(dye);
|
DyeArmor(dye);
|
||||||
@ -3970,7 +3970,7 @@ void Client::Handle_OP_GuildPublicNote(const EQApplicationPacket *app)
|
|||||||
|
|
||||||
if (app->size < sizeof(GuildUpdate_PublicNote)) {
|
if (app->size < sizeof(GuildUpdate_PublicNote)) {
|
||||||
// client calls for a motd on login even if they arent in a guild
|
// client calls for a motd on login even if they arent in a guild
|
||||||
printf("Error: app size of %i < size of OP_GuildPublicNote of %i\n",app->size,sizeof(GuildUpdate_PublicNote));
|
printf("Error: app size of %i < size of OP_GuildPublicNote of %zu\n",app->size,sizeof(GuildUpdate_PublicNote));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
GuildUpdate_PublicNote* gpn=(GuildUpdate_PublicNote*)app->pBuffer;
|
GuildUpdate_PublicNote* gpn=(GuildUpdate_PublicNote*)app->pBuffer;
|
||||||
@ -4028,7 +4028,7 @@ void Client::Handle_OP_SetGuildMOTD(const EQApplicationPacket *app)
|
|||||||
|
|
||||||
if (app->size != sizeof(GuildMOTD_Struct)) {
|
if (app->size != sizeof(GuildMOTD_Struct)) {
|
||||||
// client calls for a motd on login even if they arent in a guild
|
// client calls for a motd on login even if they arent in a guild
|
||||||
printf("Error: app size of %i != size of GuildMOTD_Struct of %i\n",app->size,sizeof(GuildMOTD_Struct));
|
printf("Error: app size of %i != size of GuildMOTD_Struct of %zu\n",app->size,sizeof(GuildMOTD_Struct));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(!IsInAGuild()) {
|
if(!IsInAGuild()) {
|
||||||
@ -6913,7 +6913,7 @@ void Client::Handle_OP_DeleteSpell(const EQApplicationPacket *app)
|
|||||||
void Client::Handle_OP_LoadSpellSet(const EQApplicationPacket *app)
|
void Client::Handle_OP_LoadSpellSet(const EQApplicationPacket *app)
|
||||||
{
|
{
|
||||||
if(app->size!=sizeof(LoadSpellSet_Struct)) {
|
if(app->size!=sizeof(LoadSpellSet_Struct)) {
|
||||||
printf("Wrong size of LoadSpellSet_Struct! Expected: %i, Got: %i\n",sizeof(LoadSpellSet_Struct),app->size);
|
printf("Wrong size of LoadSpellSet_Struct! Expected: %zu, Got: %i\n",sizeof(LoadSpellSet_Struct),app->size);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
int i;
|
int i;
|
||||||
@ -6928,7 +6928,7 @@ void Client::Handle_OP_LoadSpellSet(const EQApplicationPacket *app)
|
|||||||
void Client::Handle_OP_PetitionBug(const EQApplicationPacket *app)
|
void Client::Handle_OP_PetitionBug(const EQApplicationPacket *app)
|
||||||
{
|
{
|
||||||
if(app->size!=sizeof(PetitionBug_Struct))
|
if(app->size!=sizeof(PetitionBug_Struct))
|
||||||
printf("Wrong size of BugStruct! Expected: %i, Got: %i\n",sizeof(PetitionBug_Struct),app->size);
|
printf("Wrong size of BugStruct! Expected: %zu, Got: %i\n",sizeof(PetitionBug_Struct),app->size);
|
||||||
else{
|
else{
|
||||||
Message(0, "Petition Bugs are not supported, please use /bug.");
|
Message(0, "Petition Bugs are not supported, please use /bug.");
|
||||||
}
|
}
|
||||||
@ -6938,7 +6938,7 @@ void Client::Handle_OP_PetitionBug(const EQApplicationPacket *app)
|
|||||||
void Client::Handle_OP_Bug(const EQApplicationPacket *app)
|
void Client::Handle_OP_Bug(const EQApplicationPacket *app)
|
||||||
{
|
{
|
||||||
if(app->size!=sizeof(BugStruct))
|
if(app->size!=sizeof(BugStruct))
|
||||||
printf("Wrong size of BugStruct got %d expected %i!\n", app->size, sizeof(BugStruct));
|
printf("Wrong size of BugStruct got %d expected %zu!\n", app->size, sizeof(BugStruct));
|
||||||
else{
|
else{
|
||||||
BugStruct* bug=(BugStruct*)app->pBuffer;
|
BugStruct* bug=(BugStruct*)app->pBuffer;
|
||||||
database.UpdateBug(bug);
|
database.UpdateBug(bug);
|
||||||
@ -8334,7 +8334,7 @@ void Client::Handle_OP_OpenTributeMaster(const EQApplicationPacket *app)
|
|||||||
_pkt(TRIBUTE__IN, app);
|
_pkt(TRIBUTE__IN, app);
|
||||||
|
|
||||||
if(app->size != sizeof(StartTribute_Struct))
|
if(app->size != sizeof(StartTribute_Struct))
|
||||||
printf("Error in OP_OpenTributeMaster. Expected size of: %i, but got: %i\n",sizeof(StartTribute_Struct),app->size);
|
printf("Error in OP_OpenTributeMaster. Expected size of: %zu, but got: %i\n",sizeof(StartTribute_Struct),app->size);
|
||||||
else {
|
else {
|
||||||
//Opens the tribute master window
|
//Opens the tribute master window
|
||||||
StartTribute_Struct* st = (StartTribute_Struct*)app->pBuffer;
|
StartTribute_Struct* st = (StartTribute_Struct*)app->pBuffer;
|
||||||
@ -8359,7 +8359,7 @@ void Client::Handle_OP_OpenGuildTributeMaster(const EQApplicationPacket *app)
|
|||||||
_pkt(TRIBUTE__IN, app);
|
_pkt(TRIBUTE__IN, app);
|
||||||
|
|
||||||
if(app->size != sizeof(StartTribute_Struct))
|
if(app->size != sizeof(StartTribute_Struct))
|
||||||
printf("Error in OP_OpenGuildTributeMaster. Expected size of: %i, but got: %i\n",sizeof(StartTribute_Struct),app->size);
|
printf("Error in OP_OpenGuildTributeMaster. Expected size of: %zu, but got: %i\n",sizeof(StartTribute_Struct),app->size);
|
||||||
else {
|
else {
|
||||||
//Opens the guild tribute master window
|
//Opens the guild tribute master window
|
||||||
StartTribute_Struct* st = (StartTribute_Struct*)app->pBuffer;
|
StartTribute_Struct* st = (StartTribute_Struct*)app->pBuffer;
|
||||||
@ -8385,7 +8385,7 @@ void Client::Handle_OP_TributeItem(const EQApplicationPacket *app)
|
|||||||
|
|
||||||
//player donates an item...
|
//player donates an item...
|
||||||
if(app->size != sizeof(TributeItem_Struct))
|
if(app->size != sizeof(TributeItem_Struct))
|
||||||
printf("Error in OP_TributeItem. Expected size of: %i, but got: %i\n",sizeof(StartTribute_Struct),app->size);
|
printf("Error in OP_TributeItem. Expected size of: %zu, but got: %i\n",sizeof(StartTribute_Struct),app->size);
|
||||||
else {
|
else {
|
||||||
TributeItem_Struct* t = (TributeItem_Struct*)app->pBuffer;
|
TributeItem_Struct* t = (TributeItem_Struct*)app->pBuffer;
|
||||||
|
|
||||||
@ -8414,7 +8414,7 @@ void Client::Handle_OP_TributeMoney(const EQApplicationPacket *app)
|
|||||||
|
|
||||||
//player donates money
|
//player donates money
|
||||||
if(app->size != sizeof(TributeMoney_Struct))
|
if(app->size != sizeof(TributeMoney_Struct))
|
||||||
printf("Error in OP_TributeMoney. Expected size of: %i, but got: %i\n",sizeof(StartTribute_Struct),app->size);
|
printf("Error in OP_TributeMoney. Expected size of: %zu, but got: %i\n",sizeof(StartTribute_Struct),app->size);
|
||||||
else {
|
else {
|
||||||
TributeMoney_Struct* t = (TributeMoney_Struct*)app->pBuffer;
|
TributeMoney_Struct* t = (TributeMoney_Struct*)app->pBuffer;
|
||||||
|
|
||||||
@ -8562,7 +8562,7 @@ void Client::Handle_OP_Ignore(const EQApplicationPacket *app)
|
|||||||
void Client::Handle_OP_FindPersonRequest(const EQApplicationPacket *app)
|
void Client::Handle_OP_FindPersonRequest(const EQApplicationPacket *app)
|
||||||
{
|
{
|
||||||
if(app->size != sizeof(FindPersonRequest_Struct))
|
if(app->size != sizeof(FindPersonRequest_Struct))
|
||||||
printf("Error in FindPersonRequest_Struct. Expected size of: %i, but got: %i\n",sizeof(FindPersonRequest_Struct),app->size);
|
printf("Error in FindPersonRequest_Struct. Expected size of: %zu, but got: %i\n",sizeof(FindPersonRequest_Struct),app->size);
|
||||||
else {
|
else {
|
||||||
FindPersonRequest_Struct* t = (FindPersonRequest_Struct*)app->pBuffer;
|
FindPersonRequest_Struct* t = (FindPersonRequest_Struct*)app->pBuffer;
|
||||||
|
|
||||||
|
|||||||
@ -9696,22 +9696,22 @@ void command_object(Client *c, const Seperator *sep)
|
|||||||
|
|
||||||
od.object_type = atoi(row[col++]);
|
od.object_type = atoi(row[col++]);
|
||||||
icon = atoi(row[col++]);
|
icon = atoi(row[col++]);
|
||||||
od.unknown008[0] = atoi(row[col++]);
|
od.unknown008 = atoi(row[col++]);
|
||||||
od.unknown008[1] = atoi(row[col++]);
|
od.unknown010 = atoi(row[col++]);
|
||||||
od.unknown020 = atoi(row[col++]);
|
od.unknown020 = atoi(row[col++]);
|
||||||
|
|
||||||
switch (od.object_type)
|
switch (od.object_type)
|
||||||
{
|
{
|
||||||
case 0: // Static Object
|
case 0: // Static Object
|
||||||
case TempStaticType: // Static Object unlocked for changes
|
case TempStaticType: // Static Object unlocked for changes
|
||||||
if (od.unknown008[0] == 0) // Unknown08 field is optional Size parameter for static objects
|
if (od.unknown008 == 0) // Unknown08 field is optional Size parameter for static objects
|
||||||
{
|
{
|
||||||
od.unknown008[0] = 100; // Static object default Size is 100%
|
od.unknown008 = 100; // Static object default Size is 100%
|
||||||
}
|
}
|
||||||
|
|
||||||
c->Message(0,
|
c->Message(0,
|
||||||
"- STATIC Object (%s): id %u, x %.1f, y %.1f, z %.1f, h %.1f, model %s, size %u, solidtype %u, incline %u",
|
"- STATIC Object (%s): id %u, x %.1f, y %.1f, z %.1f, h %.1f, model %s, size %u, solidtype %u, incline %u",
|
||||||
(od.object_type == 0) ? "locked" : "unlocked", id, od.x, od.y, od.z, od.heading, od.object_name, od.unknown008[0], od.unknown008[1], od.unknown020);
|
(od.object_type == 0) ? "locked" : "unlocked", id, od.x, od.y, od.z, od.heading, od.object_name, od.unknown008, od.unknown010, od.unknown020);
|
||||||
break;
|
break;
|
||||||
case OT_DROPPEDITEM: // Ground Spawn
|
case OT_DROPPEDITEM: // Ground Spawn
|
||||||
c->Message(0,
|
c->Message(0,
|
||||||
@ -9777,11 +9777,11 @@ void command_object(Client *c, const Seperator *sep)
|
|||||||
case 0: // Static Object
|
case 0: // Static Object
|
||||||
if ((sep->argnum - col) > 3)
|
if ((sep->argnum - col) > 3)
|
||||||
{
|
{
|
||||||
od.unknown008[0] = atoi(sep->arg[4 + col]); // Size specified
|
od.unknown008 = atoi(sep->arg[4 + col]); // Size specified
|
||||||
|
|
||||||
if ((sep->argnum - col) > 4)
|
if ((sep->argnum - col) > 4)
|
||||||
{
|
{
|
||||||
od.unknown008[1] = atoi(sep->arg[5 + col]); // SolidType specified
|
od.unknown010 = atoi(sep->arg[5 + col]); // SolidType specified
|
||||||
|
|
||||||
if ((sep->argnum - col) > 5)
|
if ((sep->argnum - col) > 5)
|
||||||
{
|
{
|
||||||
@ -10168,15 +10168,15 @@ void command_object(Client *c, const Seperator *sep)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
od.unknown008[0] = atoi(sep->arg[4]);
|
od.unknown008 = atoi(sep->arg[4]);
|
||||||
o->SetObjectData(&od);
|
o->SetObjectData(&od);
|
||||||
|
|
||||||
if (od.unknown008[0] == 0) // 0 == unspecified == 100%
|
if (od.unknown008 == 0) // 0 == unspecified == 100%
|
||||||
{
|
{
|
||||||
od.unknown008[0] = 100;
|
od.unknown008 = 100;
|
||||||
}
|
}
|
||||||
|
|
||||||
c->Message(0, "Static Object %u set to %u%% size. Size will take effect when you commit to the database with '#object Save', after which the object will be unchangeable until you unlock it again with '#object Edit' and zone out and back in.", id, od.unknown008[0]);
|
c->Message(0, "Static Object %u set to %u%% size. Size will take effect when you commit to the database with '#object Save', after which the object will be unchangeable until you unlock it again with '#object Edit' and zone out and back in.", id, od.unknown008);
|
||||||
}
|
}
|
||||||
else if (strcmp(sep->arg[3], "solidtype") == 0)
|
else if (strcmp(sep->arg[3], "solidtype") == 0)
|
||||||
{
|
{
|
||||||
@ -10194,10 +10194,10 @@ void command_object(Client *c, const Seperator *sep)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
od.unknown008[1] = atoi(sep->arg[4]);
|
od.unknown010 = atoi(sep->arg[4]);
|
||||||
o->SetObjectData(&od);
|
o->SetObjectData(&od);
|
||||||
|
|
||||||
c->Message(0, "Static Object %u set to SolidType %u. Change will take effect when you commit to the database with '#object Save'. Support for this property is on a per-model basis, mostly seen in smaller objects such as chests and tables.", id, od.unknown008[1]);
|
c->Message(0, "Static Object %u set to SolidType %u. Change will take effect when you commit to the database with '#object Save'. Support for this property is on a per-model basis, mostly seen in smaller objects such as chests and tables.", id, od.unknown010);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -10548,7 +10548,7 @@ void command_object(Client *c, const Seperator *sep)
|
|||||||
zone->GetZoneID(), zone->GetInstanceVersion(),
|
zone->GetZoneID(), zone->GetInstanceVersion(),
|
||||||
od.x, od.y, od.z, od.heading,
|
od.x, od.y, od.z, od.heading,
|
||||||
od.object_name, od.object_type, icon,
|
od.object_name, od.object_type, icon,
|
||||||
od.unknown008[0], od.unknown008[1], od.unknown020);
|
od.unknown008, od.unknown010, od.unknown020);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -10558,7 +10558,7 @@ void command_object(Client *c, const Seperator *sep)
|
|||||||
id, zone->GetZoneID(), zone->GetInstanceVersion(),
|
id, zone->GetZoneID(), zone->GetInstanceVersion(),
|
||||||
od.x, od.y, od.z, od.heading,
|
od.x, od.y, od.z, od.heading,
|
||||||
od.object_name, od.object_type, icon,
|
od.object_name, od.object_type, icon,
|
||||||
od.unknown008[0], od.unknown008[1], od.unknown020);
|
od.unknown008, od.unknown010, od.unknown020);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -10573,7 +10573,7 @@ void command_object(Client *c, const Seperator *sep)
|
|||||||
zone->GetZoneID(), zone->GetInstanceVersion(),
|
zone->GetZoneID(), zone->GetInstanceVersion(),
|
||||||
od.x, od.y, od.z, od.heading,
|
od.x, od.y, od.z, od.heading,
|
||||||
od.object_name, od.object_type, icon,
|
od.object_name, od.object_type, icon,
|
||||||
od.unknown008[0], od.unknown008[1], od.unknown020,
|
od.unknown008, od.unknown010, od.unknown020,
|
||||||
id);
|
id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -10651,12 +10651,12 @@ void command_object(Client *c, const Seperator *sep)
|
|||||||
|
|
||||||
memcpy(door.dest_zone, "NONE", 5);
|
memcpy(door.dest_zone, "NONE", 5);
|
||||||
|
|
||||||
if ((door.size = od.unknown008[0]) == 0) // unknown08 = optional size percentage
|
if ((door.size = od.unknown008) == 0) // unknown08 = optional size percentage
|
||||||
{
|
{
|
||||||
door.size = 100;
|
door.size = 100;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (door.opentype = od.unknown008[1]) // unknown10 = optional request_nonsolid (0 or 1 or experimental number)
|
switch (door.opentype = od.unknown010) // unknown10 = optional request_nonsolid (0 or 1 or experimental number)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
door.opentype = 31;
|
door.opentype = 31;
|
||||||
@ -10943,8 +10943,8 @@ void command_object(Client *c, const Seperator *sep)
|
|||||||
strn0cpy(od.object_name, row[col++], sizeof(od.object_name));
|
strn0cpy(od.object_name, row[col++], sizeof(od.object_name));
|
||||||
od.object_type = atoi(row[col++]);
|
od.object_type = atoi(row[col++]);
|
||||||
icon = atoi(row[col++]);
|
icon = atoi(row[col++]);
|
||||||
od.unknown008[0] = atoi(row[col++]);
|
od.unknown008 = atoi(row[col++]);
|
||||||
od.unknown008[1] = atoi(row[col++]);
|
od.unknown010 = atoi(row[col++]);
|
||||||
od.unknown020 = atoi(row[col++]);
|
od.unknown020 = atoi(row[col++]);
|
||||||
|
|
||||||
if (od.object_type == 0)
|
if (od.object_type == 0)
|
||||||
|
|||||||
@ -5786,7 +5786,7 @@ bool Merc::AddMercToGroup(Merc* merc, Group* group) {
|
|||||||
|
|
||||||
void Client::InitializeMercInfo() {
|
void Client::InitializeMercInfo() {
|
||||||
for(int i=0; i<MAXMERCS; i++) {
|
for(int i=0; i<MAXMERCS; i++) {
|
||||||
m_mercinfo[i].mercid = 0;
|
m_mercinfo[i] = {};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -226,7 +226,8 @@ Mob::Mob(const char* in_name,
|
|||||||
PermaProcs[j].chance = 0;
|
PermaProcs[j].chance = 0;
|
||||||
PermaProcs[j].base_spellID = SPELL_UNKNOWN;
|
PermaProcs[j].base_spellID = SPELL_UNKNOWN;
|
||||||
SpellProcs[j].spellID = SPELL_UNKNOWN;
|
SpellProcs[j].spellID = SPELL_UNKNOWN;
|
||||||
|
SpellProcs[j].chance = 0;
|
||||||
|
SpellProcs[j].base_spellID = SPELL_UNKNOWN;
|
||||||
DefensiveProcs[j].spellID = SPELL_UNKNOWN;
|
DefensiveProcs[j].spellID = SPELL_UNKNOWN;
|
||||||
DefensiveProcs[j].chance = 0;
|
DefensiveProcs[j].chance = 0;
|
||||||
DefensiveProcs[j].base_spellID = SPELL_UNKNOWN;
|
DefensiveProcs[j].base_spellID = SPELL_UNKNOWN;
|
||||||
@ -271,6 +272,7 @@ Mob::Mob(const char* in_name,
|
|||||||
casting_spell_timer = 0;
|
casting_spell_timer = 0;
|
||||||
casting_spell_timer_duration = 0;
|
casting_spell_timer_duration = 0;
|
||||||
casting_spell_type = 0;
|
casting_spell_type = 0;
|
||||||
|
casting_spell_inventory_slot = 0;
|
||||||
target = 0;
|
target = 0;
|
||||||
|
|
||||||
memset(&itembonuses, 0, sizeof(StatBonuses));
|
memset(&itembonuses, 0, sizeof(StatBonuses));
|
||||||
|
|||||||
17
zone/net.cpp
17
zone/net.cpp
@ -144,7 +144,7 @@ int main(int argc, char** argv) {
|
|||||||
_log(ZONE__INIT, "Loading server configuration..");
|
_log(ZONE__INIT, "Loading server configuration..");
|
||||||
if (!ZoneConfig::LoadConfig()) {
|
if (!ZoneConfig::LoadConfig()) {
|
||||||
_log(ZONE__INIT_ERR, "Loading server configuration failed.");
|
_log(ZONE__INIT_ERR, "Loading server configuration failed.");
|
||||||
return(1);
|
return 1;
|
||||||
}
|
}
|
||||||
const ZoneConfig *Config=ZoneConfig::get();
|
const ZoneConfig *Config=ZoneConfig::get();
|
||||||
|
|
||||||
@ -163,7 +163,7 @@ int main(int argc, char** argv) {
|
|||||||
Config->DatabaseDB.c_str(),
|
Config->DatabaseDB.c_str(),
|
||||||
Config->DatabasePort)) {
|
Config->DatabasePort)) {
|
||||||
_log(ZONE__INIT_ERR, "Cannot continue without a database connection.");
|
_log(ZONE__INIT_ERR, "Cannot continue without a database connection.");
|
||||||
return(1);
|
return 1;
|
||||||
}
|
}
|
||||||
dbasync = new DBAsync(&database);
|
dbasync = new DBAsync(&database);
|
||||||
dbasync->AddFQ(&MTdbafq);
|
dbasync->AddFQ(&MTdbafq);
|
||||||
@ -182,16 +182,16 @@ int main(int argc, char** argv) {
|
|||||||
*/
|
*/
|
||||||
if (signal(SIGINT, CatchSignal) == SIG_ERR) {
|
if (signal(SIGINT, CatchSignal) == SIG_ERR) {
|
||||||
_log(ZONE__INIT_ERR, "Could not set signal handler");
|
_log(ZONE__INIT_ERR, "Could not set signal handler");
|
||||||
return 0;
|
return 1;
|
||||||
}
|
}
|
||||||
if (signal(SIGTERM, CatchSignal) == SIG_ERR) {
|
if (signal(SIGTERM, CatchSignal) == SIG_ERR) {
|
||||||
_log(ZONE__INIT_ERR, "Could not set signal handler");
|
_log(ZONE__INIT_ERR, "Could not set signal handler");
|
||||||
return 0;
|
return 1;
|
||||||
}
|
}
|
||||||
#ifndef WIN32
|
#ifndef WIN32
|
||||||
if (signal(SIGPIPE, SIG_IGN) == SIG_ERR) {
|
if (signal(SIGPIPE, SIG_IGN) == SIG_ERR) {
|
||||||
_log(ZONE__INIT_ERR, "Could not set signal handler");
|
_log(ZONE__INIT_ERR, "Could not set signal handler");
|
||||||
return 0;
|
return 1;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -217,19 +217,19 @@ int main(int argc, char** argv) {
|
|||||||
if (!database.LoadNPCFactionLists()) {
|
if (!database.LoadNPCFactionLists()) {
|
||||||
_log(ZONE__INIT_ERR, "Loading npcs faction lists FAILED!");
|
_log(ZONE__INIT_ERR, "Loading npcs faction lists FAILED!");
|
||||||
CheckEQEMuErrorAndPause();
|
CheckEQEMuErrorAndPause();
|
||||||
return 0;
|
return 1;
|
||||||
}
|
}
|
||||||
_log(ZONE__INIT, "Loading loot tables");
|
_log(ZONE__INIT, "Loading loot tables");
|
||||||
if (!database.LoadLoot()) {
|
if (!database.LoadLoot()) {
|
||||||
_log(ZONE__INIT_ERR, "Loading loot FAILED!");
|
_log(ZONE__INIT_ERR, "Loading loot FAILED!");
|
||||||
CheckEQEMuErrorAndPause();
|
CheckEQEMuErrorAndPause();
|
||||||
return 0;
|
return 1;
|
||||||
}
|
}
|
||||||
_log(ZONE__INIT, "Loading skill caps");
|
_log(ZONE__INIT, "Loading skill caps");
|
||||||
if (!database.LoadSkillCaps()) {
|
if (!database.LoadSkillCaps()) {
|
||||||
_log(ZONE__INIT_ERR, "Loading skill caps FAILED!");
|
_log(ZONE__INIT_ERR, "Loading skill caps FAILED!");
|
||||||
CheckEQEMuErrorAndPause();
|
CheckEQEMuErrorAndPause();
|
||||||
return 0;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
_log(ZONE__INIT, "Loading spells");
|
_log(ZONE__INIT, "Loading spells");
|
||||||
@ -475,6 +475,7 @@ int main(int argc, char** argv) {
|
|||||||
#endif
|
#endif
|
||||||
safe_delete(ps);
|
safe_delete(ps);
|
||||||
safe_delete(mmf);
|
safe_delete(mmf);
|
||||||
|
safe_delete(Config);
|
||||||
|
|
||||||
if (zone != 0)
|
if (zone != 0)
|
||||||
Zone::Shutdown(true);
|
Zone::Shutdown(true);
|
||||||
|
|||||||
@ -251,25 +251,25 @@ bool Zone::LoadZoneObjects() {
|
|||||||
uint32 idx = 0;
|
uint32 idx = 0;
|
||||||
int16 charges = 0;
|
int16 charges = 0;
|
||||||
|
|
||||||
id = (uint32)atoi(row[idx++]);
|
id = (uint32)atoi(row[0]);
|
||||||
data.zone_id = atoi(row[idx++]);
|
data.zone_id = atoi(row[1]);
|
||||||
data.x = atof(row[idx++]);
|
data.x = atof(row[2]);
|
||||||
data.y = atof(row[idx++]);
|
data.y = atof(row[3]);
|
||||||
data.z = atof(row[idx++]);
|
data.z = atof(row[4]);
|
||||||
data.heading = atof(row[idx++]);
|
data.heading = atof(row[5]);
|
||||||
itemid = (uint32)atoi(row[idx++]);
|
itemid = (uint32)atoi(row[6]);
|
||||||
charges = (int16)atoi(row[idx++]);
|
charges = (int16)atoi(row[7]);
|
||||||
strcpy(data.object_name, row[idx++]);
|
strcpy(data.object_name, row[8]);
|
||||||
type = (uint8)atoi(row[idx++]);
|
type = (uint8)atoi(row[9]);
|
||||||
icon = (uint32)atoi(row[idx++]);
|
icon = (uint32)atoi(row[10]);
|
||||||
data.object_type = (uint32)atoi(row[idx++]);
|
data.object_type = type;
|
||||||
data.linked_list_addr[0] = 0;
|
data.linked_list_addr[0] = 0;
|
||||||
data.linked_list_addr[1] = 0;
|
data.linked_list_addr[1] = 0;
|
||||||
data.unknown008[0] = (uint32)atoi(row[idx++]);
|
data.unknown008 = (uint32)atoi(row[11]);
|
||||||
data.unknown008[1] = (uint32)atoi(row[idx++]);
|
data.unknown010 = (uint32)atoi(row[12]);
|
||||||
data.unknown020 = (uint32)atoi(row[idx++]);
|
data.unknown020 = (uint32)atoi(row[13]);
|
||||||
data.unknown024 = (uint32)atoi(row[idx++]);
|
data.unknown024 = (uint32)atoi(row[14]);
|
||||||
data.unknown076 = (uint32)atoi(row[idx++]);
|
data.unknown076 = (uint32)atoi(row[15]);
|
||||||
data.unknown084 = 0;
|
data.unknown084 = 0;
|
||||||
|
|
||||||
ItemInst* inst = nullptr;
|
ItemInst* inst = nullptr;
|
||||||
@ -727,7 +727,7 @@ void Zone::LoadLevelEXPMods(){
|
|||||||
mysql_free_result(DatasetResult);
|
mysql_free_result(DatasetResult);
|
||||||
}
|
}
|
||||||
|
|
||||||
safe_delete(Query);
|
safe_delete_array(Query);
|
||||||
Query = 0;
|
Query = 0;
|
||||||
|
|
||||||
if(!errorMessage.empty()) {
|
if(!errorMessage.empty()) {
|
||||||
@ -928,6 +928,11 @@ Zone::Zone(uint32 in_zoneid, uint32 in_instanceid, const char* in_short_name)
|
|||||||
qGlobals = nullptr;
|
qGlobals = nullptr;
|
||||||
default_ruleset = 0;
|
default_ruleset = 0;
|
||||||
|
|
||||||
|
loglevelvar = 0;
|
||||||
|
merchantvar = 0;
|
||||||
|
tradevar = 0;
|
||||||
|
lootvar = 0;
|
||||||
|
|
||||||
if(RuleB(TaskSystem, EnableTaskSystem)) {
|
if(RuleB(TaskSystem, EnableTaskSystem)) {
|
||||||
taskmanager->LoadProximities(zoneid);
|
taskmanager->LoadProximities(zoneid);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user