mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-12 13:41:31 +00:00
Corpse Class Private scope variables renamed for understandability across the source
Removed ThrowDBError from the source Implemented MySQL query error log at the root of the MySQL API Readability changes
This commit is contained in:
parent
6b67c3736b
commit
ce248d83d6
@ -323,20 +323,6 @@ bool Database::ReserveName(uint32 account_id, char* name) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Database::ThrowDBError(std::string ErrorMessage, std::string query_title, std::string query){
|
|
||||||
if (ErrorMessage != ""){
|
|
||||||
std::cout << "\nERROR " << query_title << ": " << ErrorMessage << "\n\n" << query << "\n" << std::endl;
|
|
||||||
|
|
||||||
/* Write to log file */
|
|
||||||
std::ofstream log("eqemu_query_error_log.txt", std::ios_base::app | std::ios_base::out);
|
|
||||||
log << "ERROR " << query_title << ": " << ErrorMessage << "\n" << query << "\n";
|
|
||||||
log.close();
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Delete the character with the name "name"
|
Delete the character with the name "name"
|
||||||
returns false on failure, true otherwise
|
returns false on failure, true otherwise
|
||||||
@ -355,39 +341,39 @@ bool Database::DeleteCharacter(char *name) {
|
|||||||
for (auto row = results.begin(); row != results.end(); ++row) { charid = atoi(row[0]); }
|
for (auto row = results.begin(); row != results.end(); ++row) { charid = atoi(row[0]); }
|
||||||
if (charid <= 0){ std::cerr << "Database::DeleteCharacter :: Character not found, stopping delete...\n"; return false; }
|
if (charid <= 0){ std::cerr << "Database::DeleteCharacter :: Character not found, stopping delete...\n"; return false; }
|
||||||
|
|
||||||
query = StringFormat("DELETE FROM `quest_globals` WHERE `charid` = '%d'", charid); results = QueryDatabase(query); ThrowDBError(results.ErrorMessage(), "Database::DeleteCharacter", query);
|
query = StringFormat("DELETE FROM `quest_globals` WHERE `charid` = '%d'", charid); results = QueryDatabase(query);
|
||||||
query = StringFormat("DELETE FROM `character_activities` WHERE `charid` = '%d'", charid); results = QueryDatabase(query); ThrowDBError(results.ErrorMessage(), "Database::DeleteCharacter", query);
|
query = StringFormat("DELETE FROM `character_activities` WHERE `charid` = '%d'", charid); results = QueryDatabase(query);
|
||||||
query = StringFormat("DELETE FROM `character_enabledtasks` WHERE `charid` = '%d'", charid); results = QueryDatabase(query); ThrowDBError(results.ErrorMessage(), "Database::DeleteCharacter", query);
|
query = StringFormat("DELETE FROM `character_enabledtasks` WHERE `charid` = '%d'", charid); results = QueryDatabase(query);
|
||||||
query = StringFormat("DELETE FROM `completed_tasks` WHERE `charid` = '%d'", charid); results = QueryDatabase(query); ThrowDBError(results.ErrorMessage(), "Database::DeleteCharacter", query);
|
query = StringFormat("DELETE FROM `completed_tasks` WHERE `charid` = '%d'", charid); results = QueryDatabase(query);
|
||||||
query = StringFormat("DELETE FROM `friends` WHERE `charid` = '%d'", charid); results = QueryDatabase(query); ThrowDBError(results.ErrorMessage(), "Database::DeleteCharacter", query);
|
query = StringFormat("DELETE FROM `friends` WHERE `charid` = '%d'", charid); results = QueryDatabase(query);
|
||||||
query = StringFormat("DELETE FROM `mail` WHERE `charid` = '%d'", charid); results = QueryDatabase(query); ThrowDBError(results.ErrorMessage(), "Database::DeleteCharacter", query);
|
query = StringFormat("DELETE FROM `mail` WHERE `charid` = '%d'", charid); results = QueryDatabase(query);
|
||||||
query = StringFormat("DELETE FROM `timers` WHERE `char_id` = '%d'", charid); results = QueryDatabase(query); ThrowDBError(results.ErrorMessage(), "Database::DeleteCharacter", query);
|
query = StringFormat("DELETE FROM `timers` WHERE `char_id` = '%d'", charid); results = QueryDatabase(query);
|
||||||
query = StringFormat("DELETE FROM `inventory` WHERE `charid` = '%d'", charid); results = QueryDatabase(query); ThrowDBError(results.ErrorMessage(), "Database::DeleteCharacter", query);
|
query = StringFormat("DELETE FROM `inventory` WHERE `charid` = '%d'", charid); results = QueryDatabase(query);
|
||||||
query = StringFormat("DELETE FROM `char_recipe_list` WHERE `char_id` = '%d'", charid); results = QueryDatabase(query); ThrowDBError(results.ErrorMessage(), "Database::DeleteCharacter", query);
|
query = StringFormat("DELETE FROM `char_recipe_list` WHERE `char_id` = '%d'", charid); results = QueryDatabase(query);
|
||||||
query = StringFormat("DELETE FROM `adventure_stats` WHERE `player_id` ='%d'", charid); results = QueryDatabase(query); ThrowDBError(results.ErrorMessage(), "Database::DeleteCharacter", query);
|
query = StringFormat("DELETE FROM `adventure_stats` WHERE `player_id` ='%d'", charid); results = QueryDatabase(query);
|
||||||
query = StringFormat("DELETE FROM `zone_flags` WHERE `charID` = '%d'", charid); results = QueryDatabase(query); ThrowDBError(results.ErrorMessage(), "Database::DeleteCharacter", query);
|
query = StringFormat("DELETE FROM `zone_flags` WHERE `charID` = '%d'", charid); results = QueryDatabase(query);
|
||||||
query = StringFormat("DELETE FROM `titles` WHERE `char_id` = '%d'", charid); results = QueryDatabase(query); ThrowDBError(results.ErrorMessage(), "Database::DeleteCharacter", query);
|
query = StringFormat("DELETE FROM `titles` WHERE `char_id` = '%d'", charid); results = QueryDatabase(query);
|
||||||
query = StringFormat("DELETE FROM `player_titlesets` WHERE `char_id` = '%d'", charid); results = QueryDatabase(query); ThrowDBError(results.ErrorMessage(), "Database::DeleteCharacter", query);
|
query = StringFormat("DELETE FROM `player_titlesets` WHERE `char_id` = '%d'", charid); results = QueryDatabase(query);
|
||||||
query = StringFormat("DELETE FROM `keyring` WHERE `char_id` = '%d'", charid); results = QueryDatabase(query); ThrowDBError(results.ErrorMessage(), "Database::DeleteCharacter", query);
|
query = StringFormat("DELETE FROM `keyring` WHERE `char_id` = '%d'", charid); results = QueryDatabase(query);
|
||||||
query = StringFormat("DELETE FROM `faction_values` WHERE `char_id` = '%d'", charid); results = QueryDatabase(query); ThrowDBError(results.ErrorMessage(), "Database::DeleteCharacter", query);
|
query = StringFormat("DELETE FROM `faction_values` WHERE `char_id` = '%d'", charid); results = QueryDatabase(query);
|
||||||
query = StringFormat("DELETE FROM `instance_list_player` WHERE `charid` = '%d'", charid); results = QueryDatabase(query); ThrowDBError(results.ErrorMessage(), "Database::DeleteCharacter", query);
|
query = StringFormat("DELETE FROM `instance_list_player` WHERE `charid` = '%d'", charid); results = QueryDatabase(query);
|
||||||
query = StringFormat("DELETE FROM `character_data` WHERE `id` = '%d'", charid); results = QueryDatabase(query); ThrowDBError(results.ErrorMessage(), "Database::DeleteCharacter", query);
|
query = StringFormat("DELETE FROM `character_data` WHERE `id` = '%d'", charid); results = QueryDatabase(query);
|
||||||
query = StringFormat("DELETE FROM `character_skills` WHERE `id` = %u", charid); results = QueryDatabase(query); ThrowDBError(results.ErrorMessage(), "Database::DeleteCharacter", query);
|
query = StringFormat("DELETE FROM `character_skills` WHERE `id` = %u", charid); results = QueryDatabase(query);
|
||||||
query = StringFormat("DELETE FROM `character_languages` WHERE `id` = %u", charid); results = QueryDatabase(query); ThrowDBError(results.ErrorMessage(), "Database::DeleteCharacter", query);
|
query = StringFormat("DELETE FROM `character_languages` WHERE `id` = %u", charid); results = QueryDatabase(query);
|
||||||
query = StringFormat("DELETE FROM `character_bind` WHERE `id` = %u", charid); results = QueryDatabase(query); ThrowDBError(results.ErrorMessage(), "Database::DeleteCharacter", query);
|
query = StringFormat("DELETE FROM `character_bind` WHERE `id` = %u", charid); results = QueryDatabase(query);
|
||||||
query = StringFormat("DELETE FROM `character_alternate_abilities` WHERE `id` = %u", charid); results = QueryDatabase(query); ThrowDBError(results.ErrorMessage(), "Database::DeleteCharacter", query);
|
query = StringFormat("DELETE FROM `character_alternate_abilities` WHERE `id` = %u", charid); results = QueryDatabase(query);
|
||||||
query = StringFormat("DELETE FROM `character_currency` WHERE `id` = %u", charid); results = QueryDatabase(query); ThrowDBError(results.ErrorMessage(), "Database::DeleteCharacter", query);
|
query = StringFormat("DELETE FROM `character_currency` WHERE `id` = %u", charid); results = QueryDatabase(query);
|
||||||
query = StringFormat("DELETE FROM `character_data` WHERE `id` = %u", charid); results = QueryDatabase(query); ThrowDBError(results.ErrorMessage(), "Database::DeleteCharacter", query);
|
query = StringFormat("DELETE FROM `character_data` WHERE `id` = %u", charid); results = QueryDatabase(query);
|
||||||
query = StringFormat("DELETE FROM `character_spells` WHERE `id` = %u", charid); results = QueryDatabase(query); ThrowDBError(results.ErrorMessage(), "Database::DeleteCharacter", query);
|
query = StringFormat("DELETE FROM `character_spells` WHERE `id` = %u", charid); results = QueryDatabase(query);
|
||||||
query = StringFormat("DELETE FROM `character_memmed_spells` WHERE `id` = %u", charid); results = QueryDatabase(query); ThrowDBError(results.ErrorMessage(), "Database::DeleteCharacter", query);
|
query = StringFormat("DELETE FROM `character_memmed_spells` WHERE `id` = %u", charid); results = QueryDatabase(query);
|
||||||
query = StringFormat("DELETE FROM `character_disciplines` WHERE `id` = %u", charid); results = QueryDatabase(query); ThrowDBError(results.ErrorMessage(), "Database::DeleteCharacter", query);
|
query = StringFormat("DELETE FROM `character_disciplines` WHERE `id` = %u", charid); results = QueryDatabase(query);
|
||||||
query = StringFormat("DELETE FROM `character_material` WHERE `id` = %u", charid); results = QueryDatabase(query); ThrowDBError(results.ErrorMessage(), "Database::DeleteCharacter", query);
|
query = StringFormat("DELETE FROM `character_material` WHERE `id` = %u", charid); results = QueryDatabase(query);
|
||||||
query = StringFormat("DELETE FROM `character_tribute` WHERE `id` = %u", charid); results = QueryDatabase(query); ThrowDBError(results.ErrorMessage(), "Database::DeleteCharacter", query);
|
query = StringFormat("DELETE FROM `character_tribute` WHERE `id` = %u", charid); results = QueryDatabase(query);
|
||||||
query = StringFormat("DELETE FROM `character_bandolier` WHERE `id` = %u", charid); results = QueryDatabase(query); ThrowDBError(results.ErrorMessage(), "Database::DeleteCharacter", query);
|
query = StringFormat("DELETE FROM `character_bandolier` WHERE `id` = %u", charid); results = QueryDatabase(query);
|
||||||
query = StringFormat("DELETE FROM `character_potionbelt` WHERE `id` = %u", charid); results = QueryDatabase(query); ThrowDBError(results.ErrorMessage(), "Database::DeleteCharacter", query);
|
query = StringFormat("DELETE FROM `character_potionbelt` WHERE `id` = %u", charid); results = QueryDatabase(query);
|
||||||
query = StringFormat("DELETE FROM `character_inspect_messages` WHERE `id` = %u", charid); results = QueryDatabase(query); ThrowDBError(results.ErrorMessage(), "Database::DeleteCharacter", query);
|
query = StringFormat("DELETE FROM `character_inspect_messages` WHERE `id` = %u", charid); results = QueryDatabase(query);
|
||||||
query = StringFormat("DELETE FROM `character_leadership_abilities` WHERE `id` = %u", charid); results = QueryDatabase(query); ThrowDBError(results.ErrorMessage(), "Database::DeleteCharacter", query);
|
query = StringFormat("DELETE FROM `character_leadership_abilities` WHERE `id` = %u", charid); results = QueryDatabase(query);
|
||||||
query = StringFormat("DELETE FROM `character_alt_currency` WHERE `char_id` = '%d'", charid); results = QueryDatabase(query); ThrowDBError(results.ErrorMessage(), "Database::DeleteCharacter", query);
|
query = StringFormat("DELETE FROM `character_alt_currency` WHERE `char_id` = '%d'", charid); results = QueryDatabase(query);
|
||||||
#ifdef BOTS
|
#ifdef BOTS
|
||||||
query = StringFormat("DELETE FROM `guild_members` WHERE `char_id` = '%d' AND GetMobTypeById(%i) = 'C'", charid);
|
query = StringFormat("DELETE FROM `guild_members` WHERE `char_id` = '%d' AND GetMobTypeById(%i) = 'C'", charid);
|
||||||
#else
|
#else
|
||||||
@ -675,14 +661,13 @@ bool Database::SaveCharacterCreate(uint32 character_id, uint32 account_id, Playe
|
|||||||
pp->RestTimer // " RestTimer) "
|
pp->RestTimer // " RestTimer) "
|
||||||
);
|
);
|
||||||
auto results = QueryDatabase(query);
|
auto results = QueryDatabase(query);
|
||||||
ThrowDBError(results.ErrorMessage(), "Database::SaveCharacterCreate Character Data", query);
|
|
||||||
/* Save Bind Points */
|
/* Save Bind Points */
|
||||||
query = StringFormat("REPLACE INTO `character_bind` (id, zone_id, instance_id, x, y, z, heading, is_home)"
|
query = StringFormat("REPLACE INTO `character_bind` (id, zone_id, instance_id, x, y, z, heading, is_home)"
|
||||||
" VALUES (%u, %u, %u, %f, %f, %f, %f, %i), "
|
" VALUES (%u, %u, %u, %f, %f, %f, %f, %i), "
|
||||||
"(%u, %u, %u, %f, %f, %f, %f, %i)",
|
"(%u, %u, %u, %f, %f, %f, %f, %i)",
|
||||||
character_id, pp->binds[0].zoneId, 0, pp->binds[0].x, pp->binds[0].y, pp->binds[0].z, pp->binds[0].heading, 0,
|
character_id, pp->binds[0].zoneId, 0, pp->binds[0].x, pp->binds[0].y, pp->binds[0].z, pp->binds[0].heading, 0,
|
||||||
character_id, pp->binds[4].zoneId, 0, pp->binds[4].x, pp->binds[4].y, pp->binds[4].z, pp->binds[4].heading, 1
|
character_id, pp->binds[4].zoneId, 0, pp->binds[4].x, pp->binds[4].y, pp->binds[4].z, pp->binds[4].heading, 1
|
||||||
); results = QueryDatabase(query); ThrowDBError(results.ErrorMessage(), "Database::SaveCharacterCreate Bind Point", query);
|
); results = QueryDatabase(query);
|
||||||
|
|
||||||
/* Save Skills */
|
/* Save Skills */
|
||||||
int firstquery = 0;
|
int firstquery = 0;
|
||||||
@ -697,7 +682,7 @@ bool Database::SaveCharacterCreate(uint32 character_id, uint32 account_id, Playe
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
results = QueryDatabase(query); ThrowDBError(results.ErrorMessage(), "Database::SaveCharacterCreate Starting Skills", query);
|
results = QueryDatabase(query);
|
||||||
|
|
||||||
/* Save Language */
|
/* Save Language */
|
||||||
firstquery = 0;
|
firstquery = 0;
|
||||||
@ -712,7 +697,7 @@ bool Database::SaveCharacterCreate(uint32 character_id, uint32 account_id, Playe
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
results = QueryDatabase(query); ThrowDBError(results.ErrorMessage(), "Database::SaveCharacterCreate Starting Languages", query);
|
results = QueryDatabase(query);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -1064,7 +1049,6 @@ bool Database::CheckDatabaseConversions() {
|
|||||||
") ENGINE = InnoDB AUTO_INCREMENT = 1 DEFAULT CHARSET = latin1; "
|
") ENGINE = InnoDB AUTO_INCREMENT = 1 DEFAULT CHARSET = latin1; "
|
||||||
);
|
);
|
||||||
auto results = QueryDatabase(rquery);
|
auto results = QueryDatabase(rquery);
|
||||||
ThrowDBError(results.ErrorMessage(), "Table create", rquery);
|
|
||||||
printf(" done...\n");
|
printf(" done...\n");
|
||||||
}
|
}
|
||||||
/* Check for table `character_currency` */
|
/* Check for table `character_currency` */
|
||||||
@ -1096,7 +1080,6 @@ bool Database::CheckDatabaseConversions() {
|
|||||||
" ) ENGINE=InnoDB DEFAULT CHARSET=latin1; "
|
" ) ENGINE=InnoDB DEFAULT CHARSET=latin1; "
|
||||||
);
|
);
|
||||||
auto results = QueryDatabase(rquery);
|
auto results = QueryDatabase(rquery);
|
||||||
ThrowDBError(results.ErrorMessage(), "Table create", rquery);
|
|
||||||
printf(" done...\n");
|
printf(" done...\n");
|
||||||
}
|
}
|
||||||
/* Check for table `character_alternate_abilities` */
|
/* Check for table `character_alternate_abilities` */
|
||||||
@ -1115,7 +1098,6 @@ bool Database::CheckDatabaseConversions() {
|
|||||||
" ) ENGINE = InnoDB DEFAULT CHARSET = latin1; "
|
" ) ENGINE = InnoDB DEFAULT CHARSET = latin1; "
|
||||||
);
|
);
|
||||||
auto results = QueryDatabase(rquery);
|
auto results = QueryDatabase(rquery);
|
||||||
ThrowDBError(results.ErrorMessage(), "Table create", rquery);
|
|
||||||
printf(" done...\n");
|
printf(" done...\n");
|
||||||
}
|
}
|
||||||
/* Check for table `character_bind` */
|
/* Check for table `character_bind` */
|
||||||
@ -1138,7 +1120,6 @@ bool Database::CheckDatabaseConversions() {
|
|||||||
") ENGINE = InnoDB DEFAULT CHARSET = latin1;"
|
") ENGINE = InnoDB DEFAULT CHARSET = latin1;"
|
||||||
);
|
);
|
||||||
auto results = QueryDatabase(rquery);
|
auto results = QueryDatabase(rquery);
|
||||||
ThrowDBError(results.ErrorMessage(), "Table create", rquery);
|
|
||||||
printf(" done...\n");
|
printf(" done...\n");
|
||||||
}
|
}
|
||||||
/* Check for table `character_languages` */
|
/* Check for table `character_languages` */
|
||||||
@ -1156,7 +1137,6 @@ bool Database::CheckDatabaseConversions() {
|
|||||||
") ENGINE = InnoDB DEFAULT CHARSET = latin1;"
|
") ENGINE = InnoDB DEFAULT CHARSET = latin1;"
|
||||||
);
|
);
|
||||||
auto results = QueryDatabase(rquery);
|
auto results = QueryDatabase(rquery);
|
||||||
ThrowDBError(results.ErrorMessage(), "Table create", rquery);
|
|
||||||
printf(" done...\n");
|
printf(" done...\n");
|
||||||
}
|
}
|
||||||
/* Check for table `character_skills` */
|
/* Check for table `character_skills` */
|
||||||
@ -1174,7 +1154,6 @@ bool Database::CheckDatabaseConversions() {
|
|||||||
") ENGINE = InnoDB DEFAULT CHARSET = latin1;"
|
") ENGINE = InnoDB DEFAULT CHARSET = latin1;"
|
||||||
);
|
);
|
||||||
auto results = QueryDatabase(rquery);
|
auto results = QueryDatabase(rquery);
|
||||||
ThrowDBError(results.ErrorMessage(), "Table create", rquery);
|
|
||||||
printf(" done...\n");
|
printf(" done...\n");
|
||||||
}
|
}
|
||||||
/* Check for table `character_spells` */
|
/* Check for table `character_spells` */
|
||||||
@ -1192,7 +1171,6 @@ bool Database::CheckDatabaseConversions() {
|
|||||||
") ENGINE = InnoDB DEFAULT CHARSET = latin1;"
|
") ENGINE = InnoDB DEFAULT CHARSET = latin1;"
|
||||||
);
|
);
|
||||||
auto results = QueryDatabase(rquery);
|
auto results = QueryDatabase(rquery);
|
||||||
ThrowDBError(results.ErrorMessage(), "Table create", rquery);
|
|
||||||
printf(" done...\n");
|
printf(" done...\n");
|
||||||
}
|
}
|
||||||
/* Check for table `character_memmed_spells` */
|
/* Check for table `character_memmed_spells` */
|
||||||
@ -1210,7 +1188,6 @@ bool Database::CheckDatabaseConversions() {
|
|||||||
") ENGINE = InnoDB DEFAULT CHARSET = latin1;"
|
") ENGINE = InnoDB DEFAULT CHARSET = latin1;"
|
||||||
);
|
);
|
||||||
auto results = QueryDatabase(rquery);
|
auto results = QueryDatabase(rquery);
|
||||||
ThrowDBError(results.ErrorMessage(), "Table create", rquery);
|
|
||||||
printf(" done...\n");
|
printf(" done...\n");
|
||||||
}
|
}
|
||||||
/* Check for table `character_disciplines` */
|
/* Check for table `character_disciplines` */
|
||||||
@ -1228,7 +1205,6 @@ bool Database::CheckDatabaseConversions() {
|
|||||||
" ) ENGINE = InnoDB DEFAULT CHARSET = latin1; "
|
" ) ENGINE = InnoDB DEFAULT CHARSET = latin1; "
|
||||||
);
|
);
|
||||||
auto results = QueryDatabase(rquery);
|
auto results = QueryDatabase(rquery);
|
||||||
ThrowDBError(results.ErrorMessage(), "Table create", rquery);
|
|
||||||
printf(" done...\n");
|
printf(" done...\n");
|
||||||
}
|
}
|
||||||
/* Check for table `character_material` */
|
/* Check for table `character_material` */
|
||||||
@ -1250,7 +1226,6 @@ bool Database::CheckDatabaseConversions() {
|
|||||||
") ENGINE = InnoDB AUTO_INCREMENT = 1 DEFAULT CHARSET = latin1;"
|
") ENGINE = InnoDB AUTO_INCREMENT = 1 DEFAULT CHARSET = latin1;"
|
||||||
);
|
);
|
||||||
auto results = QueryDatabase(rquery);
|
auto results = QueryDatabase(rquery);
|
||||||
ThrowDBError(results.ErrorMessage(), "Table create", rquery);
|
|
||||||
printf(" done...\n");
|
printf(" done...\n");
|
||||||
}
|
}
|
||||||
/* Check for table `character_tribute` */
|
/* Check for table `character_tribute` */
|
||||||
@ -1267,7 +1242,6 @@ bool Database::CheckDatabaseConversions() {
|
|||||||
") ENGINE = InnoDB DEFAULT CHARSET = latin1;"
|
") ENGINE = InnoDB DEFAULT CHARSET = latin1;"
|
||||||
);
|
);
|
||||||
auto results = QueryDatabase(rquery);
|
auto results = QueryDatabase(rquery);
|
||||||
ThrowDBError(results.ErrorMessage(), "Table create", rquery);
|
|
||||||
printf(" done...\n");
|
printf(" done...\n");
|
||||||
}
|
}
|
||||||
/* Check for table `character_bandolier` */
|
/* Check for table `character_bandolier` */
|
||||||
@ -1288,7 +1262,6 @@ bool Database::CheckDatabaseConversions() {
|
|||||||
") ENGINE = InnoDB DEFAULT CHARSET = latin1; "
|
") ENGINE = InnoDB DEFAULT CHARSET = latin1; "
|
||||||
);
|
);
|
||||||
auto results = QueryDatabase(rquery);
|
auto results = QueryDatabase(rquery);
|
||||||
ThrowDBError(results.ErrorMessage(), "Table create", rquery);
|
|
||||||
printf(" done...\n");
|
printf(" done...\n");
|
||||||
}
|
}
|
||||||
/* Check for table `character_potionbelt` */
|
/* Check for table `character_potionbelt` */
|
||||||
@ -1307,7 +1280,6 @@ bool Database::CheckDatabaseConversions() {
|
|||||||
") ENGINE = InnoDB DEFAULT CHARSET = latin1;"
|
") ENGINE = InnoDB DEFAULT CHARSET = latin1;"
|
||||||
);
|
);
|
||||||
auto results = QueryDatabase(rquery);
|
auto results = QueryDatabase(rquery);
|
||||||
ThrowDBError(results.ErrorMessage(), "Table create", rquery);
|
|
||||||
printf(" done...\n");
|
printf(" done...\n");
|
||||||
}
|
}
|
||||||
/* Check for table `character_potionbelt` */
|
/* Check for table `character_potionbelt` */
|
||||||
@ -1324,7 +1296,6 @@ bool Database::CheckDatabaseConversions() {
|
|||||||
") ENGINE = InnoDB DEFAULT CHARSET = latin1;"
|
") ENGINE = InnoDB DEFAULT CHARSET = latin1;"
|
||||||
);
|
);
|
||||||
auto results = QueryDatabase(rquery);
|
auto results = QueryDatabase(rquery);
|
||||||
ThrowDBError(results.ErrorMessage(), "Table create", rquery);
|
|
||||||
printf(" done...\n");
|
printf(" done...\n");
|
||||||
}
|
}
|
||||||
/* Check for table `character_leadership_abilities` */
|
/* Check for table `character_leadership_abilities` */
|
||||||
@ -1342,7 +1313,6 @@ bool Database::CheckDatabaseConversions() {
|
|||||||
") ENGINE = InnoDB DEFAULT CHARSET = latin1; "
|
") ENGINE = InnoDB DEFAULT CHARSET = latin1; "
|
||||||
);
|
);
|
||||||
auto results = QueryDatabase(rquery);
|
auto results = QueryDatabase(rquery);
|
||||||
ThrowDBError(results.ErrorMessage(), "Table create", rquery);
|
|
||||||
printf(" done...\n");
|
printf(" done...\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1409,7 +1379,6 @@ bool Database::CheckDatabaseConversions() {
|
|||||||
EscapeString(inspectmessage).c_str()
|
EscapeString(inspectmessage).c_str()
|
||||||
);
|
);
|
||||||
auto results = QueryDatabase(rquery);
|
auto results = QueryDatabase(rquery);
|
||||||
ThrowDBError(results.ErrorMessage(), "Character Inspect Message Convert", rquery);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Run Currency Convert */
|
/* Run Currency Convert */
|
||||||
@ -1437,7 +1406,6 @@ bool Database::CheckDatabaseConversions() {
|
|||||||
pp->careerEbonCrystals
|
pp->careerEbonCrystals
|
||||||
);
|
);
|
||||||
auto results = QueryDatabase(rquery);
|
auto results = QueryDatabase(rquery);
|
||||||
ThrowDBError(results.ErrorMessage(), "Character Currency Convert", rquery);
|
|
||||||
|
|
||||||
if (pp->tribute_time_remaining < 0 || pp->tribute_time_remaining == 4294967295){ pp->tribute_time_remaining = 0; }
|
if (pp->tribute_time_remaining < 0 || pp->tribute_time_remaining == 4294967295){ pp->tribute_time_remaining = 0; }
|
||||||
|
|
||||||
@ -1743,7 +1711,6 @@ bool Database::CheckDatabaseConversions() {
|
|||||||
e_pp->expended_aa
|
e_pp->expended_aa
|
||||||
);
|
);
|
||||||
results = QueryDatabase(rquery);
|
results = QueryDatabase(rquery);
|
||||||
ThrowDBError(results.ErrorMessage(), "Character Data Convert", rquery);
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -1764,14 +1731,14 @@ bool Database::CheckDatabaseConversions() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (rquery != ""){ results = QueryDatabase(rquery); ThrowDBError(results.ErrorMessage(), "AA Convert", rquery); }
|
if (rquery != ""){ results = QueryDatabase(rquery); }
|
||||||
|
|
||||||
/* Run Bind Home Convert */
|
/* Run Bind Home Convert */
|
||||||
if(pp->binds[4].zoneId < 999 && !_ISNAN_(pp->binds[4].x) && !_ISNAN_(pp->binds[4].y) && !_ISNAN_(pp->binds[4].z) && !_ISNAN_(pp->binds[4].heading)) {
|
if(pp->binds[4].zoneId < 999 && !_ISNAN_(pp->binds[4].x) && !_ISNAN_(pp->binds[4].y) && !_ISNAN_(pp->binds[4].z) && !_ISNAN_(pp->binds[4].heading)) {
|
||||||
rquery = StringFormat("REPLACE INTO `character_bind` (id, zone_id, instance_id, x, y, z, heading, is_home)"
|
rquery = StringFormat("REPLACE INTO `character_bind` (id, zone_id, instance_id, x, y, z, heading, is_home)"
|
||||||
" VALUES (%u, %u, %u, %f, %f, %f, %f, 1)",
|
" VALUES (%u, %u, %u, %f, %f, %f, %f, 1)",
|
||||||
character_id, pp->binds[4].zoneId, 0, pp->binds[4].x, pp->binds[4].y, pp->binds[4].z, pp->binds[4].heading);
|
character_id, pp->binds[4].zoneId, 0, pp->binds[4].x, pp->binds[4].y, pp->binds[4].z, pp->binds[4].heading);
|
||||||
if (rquery != ""){ results = QueryDatabase(rquery); ThrowDBError(results.ErrorMessage(), "Bind Home Convert", rquery); }
|
if (rquery != ""){ results = QueryDatabase(rquery); }
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Run Bind Convert */
|
/* Run Bind Convert */
|
||||||
@ -1779,7 +1746,7 @@ bool Database::CheckDatabaseConversions() {
|
|||||||
rquery = StringFormat("REPLACE INTO `character_bind` (id, zone_id, instance_id, x, y, z, heading, is_home)"
|
rquery = StringFormat("REPLACE INTO `character_bind` (id, zone_id, instance_id, x, y, z, heading, is_home)"
|
||||||
" VALUES (%u, %u, %u, %f, %f, %f, %f, 0)",
|
" VALUES (%u, %u, %u, %f, %f, %f, %f, 0)",
|
||||||
character_id, pp->binds[0].zoneId, 0, pp->binds[0].x, pp->binds[0].y, pp->binds[0].z, pp->binds[0].heading);
|
character_id, pp->binds[0].zoneId, 0, pp->binds[0].x, pp->binds[0].y, pp->binds[0].z, pp->binds[0].heading);
|
||||||
if (rquery != ""){ results = QueryDatabase(rquery); ThrowDBError(results.ErrorMessage(), "Character Bind Convert", rquery); }
|
if (rquery != ""){ results = QueryDatabase(rquery); }
|
||||||
}
|
}
|
||||||
/* Run Language Convert */
|
/* Run Language Convert */
|
||||||
first_entry = 0; rquery = "";
|
first_entry = 0; rquery = "";
|
||||||
@ -1792,7 +1759,7 @@ bool Database::CheckDatabaseConversions() {
|
|||||||
rquery = rquery + StringFormat(", (%u, %u, %u)", character_id, i, pp->languages[i]);
|
rquery = rquery + StringFormat(", (%u, %u, %u)", character_id, i, pp->languages[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (rquery != ""){ results = QueryDatabase(rquery); ThrowDBError(results.ErrorMessage(), "Character Language Convert", rquery); }
|
if (rquery != ""){ results = QueryDatabase(rquery); }
|
||||||
/* Run Skill Convert */
|
/* Run Skill Convert */
|
||||||
first_entry = 0; rquery = "";
|
first_entry = 0; rquery = "";
|
||||||
for (i = 0; i < MAX_PP_SKILL; i++){
|
for (i = 0; i < MAX_PP_SKILL; i++){
|
||||||
@ -1804,7 +1771,7 @@ bool Database::CheckDatabaseConversions() {
|
|||||||
rquery = rquery + StringFormat(", (%u, %u, %u)", character_id, i, pp->skills[i]);
|
rquery = rquery + StringFormat(", (%u, %u, %u)", character_id, i, pp->skills[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (rquery != ""){ results = QueryDatabase(rquery); ThrowDBError(results.ErrorMessage(), "Character Skills Convert Convert", rquery); }
|
if (rquery != ""){ results = QueryDatabase(rquery); }
|
||||||
/* Run Spell Convert */
|
/* Run Spell Convert */
|
||||||
first_entry = 0; rquery = "";
|
first_entry = 0; rquery = "";
|
||||||
for (i = 0; i < MAX_PP_REF_SPELLBOOK; i++){
|
for (i = 0; i < MAX_PP_REF_SPELLBOOK; i++){
|
||||||
@ -1817,7 +1784,7 @@ bool Database::CheckDatabaseConversions() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// std::cout << rquery << "\n";
|
// std::cout << rquery << "\n";
|
||||||
if (rquery != ""){ results = QueryDatabase(rquery); ThrowDBError(results.ErrorMessage(), "Character Spell Convert", rquery); }
|
if (rquery != ""){ results = QueryDatabase(rquery); }
|
||||||
/* Run Max Memmed Spell Convert */
|
/* Run Max Memmed Spell Convert */
|
||||||
first_entry = 0; rquery = "";
|
first_entry = 0; rquery = "";
|
||||||
for (i = 0; i < MAX_PP_REF_MEMSPELL; i++){
|
for (i = 0; i < MAX_PP_REF_MEMSPELL; i++){
|
||||||
@ -1829,7 +1796,7 @@ bool Database::CheckDatabaseConversions() {
|
|||||||
rquery = rquery + StringFormat(", (%u, %u, %u)", character_id, i, pp->mem_spells[i]);
|
rquery = rquery + StringFormat(", (%u, %u, %u)", character_id, i, pp->mem_spells[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (rquery != ""){ results = QueryDatabase(rquery); ThrowDBError(results.ErrorMessage(), "Character Memmed Spells Convert", rquery); }
|
if (rquery != ""){ results = QueryDatabase(rquery); }
|
||||||
/* Run Discipline Convert */
|
/* Run Discipline Convert */
|
||||||
first_entry = 0; rquery = "";
|
first_entry = 0; rquery = "";
|
||||||
for (i = 0; i < MAX_PP_DISCIPLINES; i++){
|
for (i = 0; i < MAX_PP_DISCIPLINES; i++){
|
||||||
@ -1841,7 +1808,7 @@ bool Database::CheckDatabaseConversions() {
|
|||||||
rquery = rquery + StringFormat(", (%u, %u, %u)", character_id, i, pp->disciplines.values[i]);
|
rquery = rquery + StringFormat(", (%u, %u, %u)", character_id, i, pp->disciplines.values[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (rquery != ""){ results = QueryDatabase(rquery); ThrowDBError(results.ErrorMessage(), "Character Discipline Convert", rquery); }
|
if (rquery != ""){ results = QueryDatabase(rquery); }
|
||||||
/* Run Material Color Convert */
|
/* Run Material Color Convert */
|
||||||
first_entry = 0; rquery = "";
|
first_entry = 0; rquery = "";
|
||||||
for (i = 0; i < _MaterialCount; i++){
|
for (i = 0; i < _MaterialCount; i++){
|
||||||
@ -1853,7 +1820,7 @@ bool Database::CheckDatabaseConversions() {
|
|||||||
rquery = rquery + StringFormat(", (%u, %u, %u, %u, %u, %u, %u)", character_id, i, pp->item_tint[i].rgb.blue, pp->item_tint[i].rgb.green, pp->item_tint[i].rgb.red, pp->item_tint[i].rgb.use_tint, pp->item_tint[i].color);
|
rquery = rquery + StringFormat(", (%u, %u, %u, %u, %u, %u, %u)", character_id, i, pp->item_tint[i].rgb.blue, pp->item_tint[i].rgb.green, pp->item_tint[i].rgb.red, pp->item_tint[i].rgb.use_tint, pp->item_tint[i].color);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (rquery != ""){ results = QueryDatabase(rquery); ThrowDBError(results.ErrorMessage(), "Character Material Convert", rquery); }
|
if (rquery != ""){ results = QueryDatabase(rquery); }
|
||||||
/* Run Tribute Convert */
|
/* Run Tribute Convert */
|
||||||
first_entry = 0; rquery = "";
|
first_entry = 0; rquery = "";
|
||||||
for (i = 0; i < EmuConstants::TRIBUTE_SIZE; i++){
|
for (i = 0; i < EmuConstants::TRIBUTE_SIZE; i++){
|
||||||
@ -1865,7 +1832,7 @@ bool Database::CheckDatabaseConversions() {
|
|||||||
rquery = rquery + StringFormat(", (%u, %u, %u)", character_id, pp->tributes[i].tier, pp->tributes[i].tribute);
|
rquery = rquery + StringFormat(", (%u, %u, %u)", character_id, pp->tributes[i].tier, pp->tributes[i].tribute);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (rquery != ""){ results = QueryDatabase(rquery); ThrowDBError(results.ErrorMessage(), "Character Tribute Convert", rquery); }
|
if (rquery != ""){ results = QueryDatabase(rquery); }
|
||||||
/* Run Bandolier Convert */
|
/* Run Bandolier Convert */
|
||||||
first_entry = 0; rquery = "";
|
first_entry = 0; rquery = "";
|
||||||
for (i = 0; i < EmuConstants::BANDOLIERS_COUNT; i++){
|
for (i = 0; i < EmuConstants::BANDOLIERS_COUNT; i++){
|
||||||
@ -1881,7 +1848,7 @@ bool Database::CheckDatabaseConversions() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (rquery != ""){ results = QueryDatabase(rquery); ThrowDBError(results.ErrorMessage(), "Character Bandolier Convert", rquery); }
|
if (rquery != ""){ results = QueryDatabase(rquery); }
|
||||||
/* Run Potion Belt Convert */
|
/* Run Potion Belt Convert */
|
||||||
first_entry = 0; rquery = "";
|
first_entry = 0; rquery = "";
|
||||||
for (i = 0; i < EmuConstants::POTION_BELT_SIZE; i++){
|
for (i = 0; i < EmuConstants::POTION_BELT_SIZE; i++){
|
||||||
@ -1894,7 +1861,7 @@ bool Database::CheckDatabaseConversions() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (rquery != ""){ results = QueryDatabase(rquery); ThrowDBError(results.ErrorMessage(), "Character Potion Belt Convert", rquery); }
|
if (rquery != ""){ results = QueryDatabase(rquery); }
|
||||||
/* Run Leadership AA Convert */
|
/* Run Leadership AA Convert */
|
||||||
first_entry = 0; rquery = "";
|
first_entry = 0; rquery = "";
|
||||||
for (i = 0; i < MAX_LEADERSHIP_AA_ARRAY; i++){
|
for (i = 0; i < MAX_LEADERSHIP_AA_ARRAY; i++){
|
||||||
@ -1906,7 +1873,7 @@ bool Database::CheckDatabaseConversions() {
|
|||||||
rquery = rquery + StringFormat(", (%i, %u, %u)", character_id, i, pp->leader_abilities.ranks[i]);
|
rquery = rquery + StringFormat(", (%i, %u, %u)", character_id, i, pp->leader_abilities.ranks[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (rquery != ""){ results = QueryDatabase(rquery); ThrowDBError(results.ErrorMessage(), "Character Leadership AA Convert", rquery); }
|
if (rquery != ""){ results = QueryDatabase(rquery); }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (runconvert == 1){
|
if (runconvert == 1){
|
||||||
@ -1940,9 +1907,6 @@ bool Database::CheckDatabaseConversions() {
|
|||||||
std::cin.ignore(1);
|
std::cin.ignore(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else{
|
|
||||||
ThrowDBError(results.ErrorMessage(), "Bot View Discovery", rquery);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (runbotsconvert == 1){
|
if (runbotsconvert == 1){
|
||||||
printf("Running bot views/function database conversion... \n");
|
printf("Running bot views/function database conversion... \n");
|
||||||
@ -1950,7 +1914,6 @@ bool Database::CheckDatabaseConversions() {
|
|||||||
/* Update view `vwbotcharactermobs` */
|
/* Update view `vwbotcharactermobs` */
|
||||||
rquery = StringFormat("DROP VIEW `vwBotCharacterMobs`;");
|
rquery = StringFormat("DROP VIEW `vwBotCharacterMobs`;");
|
||||||
results = QueryDatabase(rquery);
|
results = QueryDatabase(rquery);
|
||||||
ThrowDBError(results.ErrorMessage(), "Drop View `vwBotCharacterMobs`", rquery);
|
|
||||||
|
|
||||||
rquery = StringFormat(
|
rquery = StringFormat(
|
||||||
"CREATE VIEW `vwBotCharacterMobs` AS\n"
|
"CREATE VIEW `vwBotCharacterMobs` AS\n"
|
||||||
@ -1973,13 +1936,11 @@ bool Database::CheckDatabaseConversions() {
|
|||||||
"FROM bots AS b;"
|
"FROM bots AS b;"
|
||||||
);
|
);
|
||||||
results = QueryDatabase(rquery);
|
results = QueryDatabase(rquery);
|
||||||
ThrowDBError(results.ErrorMessage(), "Create View `vwBotCharacterMobs`", rquery);
|
|
||||||
|
|
||||||
|
|
||||||
/* Update function `GetMobType` */
|
/* Update function `GetMobType` */
|
||||||
rquery = StringFormat("DROP FUNCTION IF EXISTS `GetMobType`;");
|
rquery = StringFormat("DROP FUNCTION IF EXISTS `GetMobType`;");
|
||||||
results = QueryDatabase(rquery);
|
results = QueryDatabase(rquery);
|
||||||
ThrowDBError(results.ErrorMessage(), "Drop Function `GetMobType`", rquery);
|
|
||||||
|
|
||||||
rquery = StringFormat(
|
rquery = StringFormat(
|
||||||
"CREATE FUNCTION `GetMobType` (mobname VARCHAR(64)) RETURNS CHAR(1)\n"
|
"CREATE FUNCTION `GetMobType` (mobname VARCHAR(64)) RETURNS CHAR(1)\n"
|
||||||
@ -1998,13 +1959,11 @@ bool Database::CheckDatabaseConversions() {
|
|||||||
"END"
|
"END"
|
||||||
);
|
);
|
||||||
results = QueryDatabase(rquery);
|
results = QueryDatabase(rquery);
|
||||||
ThrowDBError(results.ErrorMessage(), "Create Function `GetMobType`", rquery);
|
|
||||||
|
|
||||||
|
|
||||||
/* Update view `vwgroups` */
|
/* Update view `vwgroups` */
|
||||||
rquery = StringFormat("DROP VIEW IF EXISTS `vwGroups`;");
|
rquery = StringFormat("DROP VIEW IF EXISTS `vwGroups`;");
|
||||||
results = QueryDatabase(rquery);
|
results = QueryDatabase(rquery);
|
||||||
ThrowDBError(results.ErrorMessage(), "Drop View `vwGroups`", rquery);
|
|
||||||
|
|
||||||
rquery = StringFormat(
|
rquery = StringFormat(
|
||||||
"CREATE VIEW `vwGroups` AS\n"
|
"CREATE VIEW `vwGroups` AS\n"
|
||||||
@ -2018,13 +1977,11 @@ bool Database::CheckDatabaseConversions() {
|
|||||||
"LEFT JOIN `bots` AS b ON g.`name` = b.`Name`;"
|
"LEFT JOIN `bots` AS b ON g.`name` = b.`Name`;"
|
||||||
);
|
);
|
||||||
results = QueryDatabase(rquery);
|
results = QueryDatabase(rquery);
|
||||||
ThrowDBError(results.ErrorMessage(), "Create View `vwGroups`", rquery);
|
|
||||||
|
|
||||||
|
|
||||||
/* Update view `vwbotgroups` */
|
/* Update view `vwbotgroups` */
|
||||||
rquery = StringFormat("DROP VIEW IF EXISTS `vwBotGroups`;");
|
rquery = StringFormat("DROP VIEW IF EXISTS `vwBotGroups`;");
|
||||||
results = QueryDatabase(rquery);
|
results = QueryDatabase(rquery);
|
||||||
ThrowDBError(results.ErrorMessage(), "Drop View `vwBotGroups`", rquery);
|
|
||||||
|
|
||||||
rquery = StringFormat(
|
rquery = StringFormat(
|
||||||
"CREATE VIEW `vwBotGroups` AS\n"
|
"CREATE VIEW `vwBotGroups` AS\n"
|
||||||
@ -2040,13 +1997,11 @@ bool Database::CheckDatabaseConversions() {
|
|||||||
"ORDER BY b.`BotOwnerCharacterId`, g.`BotGroupName`;"
|
"ORDER BY b.`BotOwnerCharacterId`, g.`BotGroupName`;"
|
||||||
);
|
);
|
||||||
results = QueryDatabase(rquery);
|
results = QueryDatabase(rquery);
|
||||||
ThrowDBError(results.ErrorMessage(), "Create View `vwBotGroups`", rquery);
|
|
||||||
|
|
||||||
|
|
||||||
/* Update view `vwguildmembers` */
|
/* Update view `vwguildmembers` */
|
||||||
rquery = StringFormat("DROP VIEW IF EXISTS `vwGuildMembers`;");
|
rquery = StringFormat("DROP VIEW IF EXISTS `vwGuildMembers`;");
|
||||||
results = QueryDatabase(rquery);
|
results = QueryDatabase(rquery);
|
||||||
ThrowDBError(results.ErrorMessage(), "Drop View `vwGuildMembers`", rquery);
|
|
||||||
|
|
||||||
rquery = StringFormat(
|
rquery = StringFormat(
|
||||||
"CREATE VIEW `vwGuildMembers` AS\n"
|
"CREATE VIEW `vwGuildMembers` AS\n"
|
||||||
@ -2075,7 +2030,6 @@ bool Database::CheckDatabaseConversions() {
|
|||||||
"FROM `botguildmembers` AS bm;"
|
"FROM `botguildmembers` AS bm;"
|
||||||
);
|
);
|
||||||
results = QueryDatabase(rquery);
|
results = QueryDatabase(rquery);
|
||||||
ThrowDBError(results.ErrorMessage(), "Create View `vwGuildMembers`", rquery);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (runbotsconvert == 1){
|
if (runbotsconvert == 1){
|
||||||
@ -2204,7 +2158,7 @@ bool Database::CheckDatabaseConversions() {
|
|||||||
dbpc->item_tint[8].color,
|
dbpc->item_tint[8].color,
|
||||||
atoi(row2[0])
|
atoi(row2[0])
|
||||||
);
|
);
|
||||||
if (scquery != ""){ auto sc_results = QueryDatabase(scquery); ThrowDBError(sc_results.ErrorMessage(), "Corpse Convert: Base Data", scquery); }
|
if (scquery != ""){ auto sc_results = QueryDatabase(scquery); }
|
||||||
|
|
||||||
first_entry = 0;
|
first_entry = 0;
|
||||||
scquery = "";
|
scquery = "";
|
||||||
@ -2240,7 +2194,7 @@ bool Database::CheckDatabaseConversions() {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (scquery != ""){ auto sc_results = QueryDatabase(scquery); ThrowDBError(sc_results.ErrorMessage(), "Corpse Convert: SOF: Items", scquery); }
|
if (scquery != ""){ auto sc_results = QueryDatabase(scquery); }
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
/* Classic Converter */
|
/* Classic Converter */
|
||||||
@ -2308,7 +2262,7 @@ bool Database::CheckDatabaseConversions() {
|
|||||||
dbpc_c->item_tint[8].color,
|
dbpc_c->item_tint[8].color,
|
||||||
atoi(row2[0])
|
atoi(row2[0])
|
||||||
);
|
);
|
||||||
if (scquery != ""){ auto sc_results = QueryDatabase(scquery); ThrowDBError(sc_results.ErrorMessage(), "Corpse Convert: Legacy :: Base Data", scquery); }
|
if (scquery != ""){ auto sc_results = QueryDatabase(scquery); }
|
||||||
|
|
||||||
first_entry = 0;
|
first_entry = 0;
|
||||||
scquery = "";
|
scquery = "";
|
||||||
@ -2345,7 +2299,7 @@ bool Database::CheckDatabaseConversions() {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (scquery != ""){ auto sc_results = QueryDatabase(scquery); ThrowDBError(sc_results.ErrorMessage(), "Corpse Convert: Legacy : Items", scquery); }
|
if (scquery != ""){ auto sc_results = QueryDatabase(scquery); }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -180,7 +180,6 @@ public:
|
|||||||
Database(const char* host, const char* user, const char* passwd, const char* database,uint32 port);
|
Database(const char* host, const char* user, const char* passwd, const char* database,uint32 port);
|
||||||
bool Connect(const char* host, const char* user, const char* passwd, const char* database,uint32 port);
|
bool Connect(const char* host, const char* user, const char* passwd, const char* database,uint32 port);
|
||||||
~Database();
|
~Database();
|
||||||
bool ThrowDBError(std::string ErrorMessage, std::string query_title, std::string query);
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@ -105,15 +105,6 @@ MySQLRequestResult DBcore::QueryDatabase(const char* query, uint32 querylen, boo
|
|||||||
|
|
||||||
std::cout << "DB Query Error #" << mysql_errno(&mysql) << ": " << mysql_error(&mysql) << std::endl;
|
std::cout << "DB Query Error #" << mysql_errno(&mysql) << ": " << mysql_error(&mysql) << std::endl;
|
||||||
|
|
||||||
/* Implement Logging at the Root*/
|
|
||||||
|
|
||||||
std::cout << "\n[MYSQL ERR] " << mysql_errno(&mysql) << ": " << mysql_error(&mysql) << "\n\n" << query << "\n" << std::endl;
|
|
||||||
/* Write to log file */
|
|
||||||
std::ofstream log("eqemu_query_error_log.txt", std::ios_base::app | std::ios_base::out);
|
|
||||||
log << "[MYSQL ERR] " << mysql_error(&mysql) << "\n" << query << "\n";
|
|
||||||
log.close();
|
|
||||||
|
|
||||||
|
|
||||||
return MySQLRequestResult(nullptr, 0, 0, 0, 0, (uint32)mysql_errno(&mysql), errorBuffer);
|
return MySQLRequestResult(nullptr, 0, 0, 0, 0, (uint32)mysql_errno(&mysql), errorBuffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -123,6 +114,16 @@ MySQLRequestResult DBcore::QueryDatabase(const char* query, uint32 querylen, boo
|
|||||||
#ifdef _EQDEBUG
|
#ifdef _EQDEBUG
|
||||||
std::cout << "DB Query Error #" << mysql_errno(&mysql) << ": " << mysql_error(&mysql) << std::endl;
|
std::cout << "DB Query Error #" << mysql_errno(&mysql) << ": " << mysql_error(&mysql) << std::endl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* Implement Logging at the Root */
|
||||||
|
if (mysql_errno(&mysql) > 0 && strlen(query) > 0){
|
||||||
|
std::cout << "\n[MYSQL ERR] " << mysql_errno(&mysql) << ": " << mysql_error(&mysql) << " [Query]: \n" << query << "\n" << std::endl;
|
||||||
|
/* Write to log file */
|
||||||
|
std::ofstream log("eqemu_query_error_log.txt", std::ios_base::app | std::ios_base::out);
|
||||||
|
log << "[MYSQL ERR] " << mysql_error(&mysql) << "\n" << query << "\n";
|
||||||
|
log.close();
|
||||||
|
}
|
||||||
|
|
||||||
return MySQLRequestResult(nullptr, 0, 0, 0, 0, mysql_errno(&mysql),errorBuffer);
|
return MySQLRequestResult(nullptr, 0, 0, 0, 0, mysql_errno(&mysql),errorBuffer);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1915,7 +1915,7 @@ const LootDrop_Struct* SharedDatabase::GetLootDrop(uint32 lootdrop_id) {
|
|||||||
|
|
||||||
void SharedDatabase::LoadCharacterInspectMessage(uint32 character_id, InspectMessage_Struct* message) {
|
void SharedDatabase::LoadCharacterInspectMessage(uint32 character_id, InspectMessage_Struct* message) {
|
||||||
std::string query = StringFormat("SELECT `inspect_message` FROM `character_inspect_messages` WHERE `id` = %u LIMIT 1", character_id);
|
std::string query = StringFormat("SELECT `inspect_message` FROM `character_inspect_messages` WHERE `id` = %u LIMIT 1", character_id);
|
||||||
auto results = QueryDatabase(query); ThrowDBError(results.ErrorMessage(), "SharedDatabase::LoadCharacterInspectMessage", query);
|
auto results = QueryDatabase(query);
|
||||||
auto row = results.begin();
|
auto row = results.begin();
|
||||||
memcpy(message, "", sizeof(InspectMessage_Struct));
|
memcpy(message, "", sizeof(InspectMessage_Struct));
|
||||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||||
@ -1925,7 +1925,7 @@ void SharedDatabase::LoadCharacterInspectMessage(uint32 character_id, InspectMes
|
|||||||
|
|
||||||
void SharedDatabase::SaveCharacterInspectMessage(uint32 character_id, const InspectMessage_Struct* message) {
|
void SharedDatabase::SaveCharacterInspectMessage(uint32 character_id, const InspectMessage_Struct* message) {
|
||||||
std::string query = StringFormat("REPLACE INTO `character_inspect_messages` (id, inspect_message) VALUES (%u, '%s')", character_id, EscapeString(message->text).c_str());
|
std::string query = StringFormat("REPLACE INTO `character_inspect_messages` (id, inspect_message) VALUES (%u, '%s')", character_id, EscapeString(message->text).c_str());
|
||||||
auto results = QueryDatabase(query); ThrowDBError(results.ErrorMessage(), "SharedDatabase::SaveCharacterInspectMessage", query);
|
auto results = QueryDatabase(query);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SharedDatabase::GetBotInspectMessage(uint32 botid, InspectMessage_Struct* message) {
|
void SharedDatabase::GetBotInspectMessage(uint32 botid, InspectMessage_Struct* message) {
|
||||||
|
|||||||
@ -142,14 +142,14 @@ void WorldDatabase::GetCharSelectInfo(uint32 account_id, CharacterSelect_Struct*
|
|||||||
std::string query = StringFormat("REPLACE INTO `character_bind` (id, zone_id, instance_id, x, y, z, heading, is_home)"
|
std::string query = StringFormat("REPLACE INTO `character_bind` (id, zone_id, instance_id, x, y, z, heading, is_home)"
|
||||||
" VALUES (%u, %u, %u, %f, %f, %f, %f, %i)",
|
" VALUES (%u, %u, %u, %f, %f, %f, %f, %i)",
|
||||||
character_id, pp.binds[4].zoneId, 0, pp.binds[4].x, pp.binds[4].y, pp.binds[4].z, pp.binds[4].heading, 1);
|
character_id, pp.binds[4].zoneId, 0, pp.binds[4].x, pp.binds[4].y, pp.binds[4].z, pp.binds[4].heading, 1);
|
||||||
auto results_bset = QueryDatabase(query); ThrowDBError(results_bset.ErrorMessage(), "WorldDatabase::GetCharSelectInfo Set Home Point", query);
|
auto results_bset = QueryDatabase(query);
|
||||||
}
|
}
|
||||||
/* If no regular bind set, set it */
|
/* If no regular bind set, set it */
|
||||||
if (has_bind == 0){
|
if (has_bind == 0){
|
||||||
std::string query = StringFormat("REPLACE INTO `character_bind` (id, zone_id, instance_id, x, y, z, heading, is_home)"
|
std::string query = StringFormat("REPLACE INTO `character_bind` (id, zone_id, instance_id, x, y, z, heading, is_home)"
|
||||||
" VALUES (%u, %u, %u, %f, %f, %f, %f, %i)",
|
" VALUES (%u, %u, %u, %f, %f, %f, %f, %i)",
|
||||||
character_id, pp.binds[0].zoneId, 0, pp.binds[0].x, pp.binds[0].y, pp.binds[0].z, pp.binds[0].heading, 0);
|
character_id, pp.binds[0].zoneId, 0, pp.binds[0].x, pp.binds[0].y, pp.binds[0].z, pp.binds[0].heading, 0);
|
||||||
auto results_bset = QueryDatabase(query); ThrowDBError(results_bset.ErrorMessage(), "WorldDatabase::GetCharSelectInfo Set Bind Point", query);
|
auto results_bset = QueryDatabase(query);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* Bind End */
|
/* Bind End */
|
||||||
|
|||||||
231
zone/corpse.cpp
231
zone/corpse.cpp
@ -158,10 +158,10 @@ Corpse::Corpse(NPC* in_npc, ItemList* in_itemlist, uint32 in_npctypeid, const NP
|
|||||||
{
|
{
|
||||||
corpse_graveyard_timer.Disable();
|
corpse_graveyard_timer.Disable();
|
||||||
memset(item_tint, 0, sizeof(item_tint));
|
memset(item_tint, 0, sizeof(item_tint));
|
||||||
pIsChanged = false;
|
is_corpse_changed = false;
|
||||||
p_PlayerCorpse = false;
|
is_player_corpse = false;
|
||||||
pLocked = false;
|
is_locked = false;
|
||||||
BeingLootedBy = 0xFFFFFFFF;
|
being_looted_by = 0xFFFFFFFF;
|
||||||
if (in_itemlist) {
|
if (in_itemlist) {
|
||||||
itemlist = *in_itemlist;
|
itemlist = *in_itemlist;
|
||||||
in_itemlist->clear();
|
in_itemlist->clear();
|
||||||
@ -171,9 +171,9 @@ Corpse::Corpse(NPC* in_npc, ItemList* in_itemlist, uint32 in_npctypeid, const NP
|
|||||||
|
|
||||||
npctype_id = in_npctypeid;
|
npctype_id = in_npctypeid;
|
||||||
SetPKItem(0);
|
SetPKItem(0);
|
||||||
charid = 0;
|
char_id = 0;
|
||||||
corpse_db_id = 0;
|
corpse_db_id = 0;
|
||||||
p_depop = false;
|
player_corpse_depop = false;
|
||||||
strcpy(orgname, in_npc->GetName());
|
strcpy(orgname, in_npc->GetName());
|
||||||
strcpy(name, in_npc->GetName());
|
strcpy(name, in_npc->GetName());
|
||||||
// Added By Hogie
|
// Added By Hogie
|
||||||
@ -270,15 +270,15 @@ Corpse::Corpse(Client* client, int32 in_rezexp) : Mob (
|
|||||||
for (i=0; i < MAX_LOOTERS; i++)
|
for (i=0; i < MAX_LOOTERS; i++)
|
||||||
looters[i] = 0;
|
looters[i] = 0;
|
||||||
|
|
||||||
pIsChanged = true;
|
is_corpse_changed = true;
|
||||||
rezzexp = in_rezexp;
|
rezzexp = in_rezexp;
|
||||||
can_rez = true;
|
can_rez = true;
|
||||||
p_PlayerCorpse = true;
|
is_player_corpse = true;
|
||||||
pLocked = false;
|
is_locked = false;
|
||||||
BeingLootedBy = 0xFFFFFFFF;
|
being_looted_by = 0xFFFFFFFF;
|
||||||
charid = client->CharacterID();
|
char_id = client->CharacterID();
|
||||||
corpse_db_id = 0;
|
corpse_db_id = 0;
|
||||||
p_depop = false;
|
player_corpse_depop = false;
|
||||||
copper = 0;
|
copper = 0;
|
||||||
silver = 0;
|
silver = 0;
|
||||||
gold = 0;
|
gold = 0;
|
||||||
@ -428,10 +428,56 @@ std::list<uint32> Corpse::MoveItemToCorpse(Client *client, ItemInst *item, int16
|
|||||||
// To be called from LoadFromDBData
|
// To be called from LoadFromDBData
|
||||||
// Mongrel: added see_invis and see_invis_undead
|
// Mongrel: added see_invis and see_invis_undead
|
||||||
Corpse::Corpse(uint32 in_dbid, uint32 in_charid, const char* in_charname, ItemList* in_itemlist, uint32 in_copper, uint32 in_silver, uint32 in_gold, uint32 in_plat, float in_x, float in_y, float in_z, float in_heading, float in_size, uint8 in_gender, uint16 in_race, uint8 in_class, uint8 in_deity, uint8 in_level, uint8 in_texture, uint8 in_helmtexture,uint32 in_rezexp, bool wasAtGraveyard)
|
Corpse::Corpse(uint32 in_dbid, uint32 in_charid, const char* in_charname, ItemList* in_itemlist, uint32 in_copper, uint32 in_silver, uint32 in_gold, uint32 in_plat, float in_x, float in_y, float in_z, float in_heading, float in_size, uint8 in_gender, uint16 in_race, uint8 in_class, uint8 in_deity, uint8 in_level, uint8 in_texture, uint8 in_helmtexture,uint32 in_rezexp, bool wasAtGraveyard)
|
||||||
: Mob("Unnamed_Corpse","",0,0,in_gender, in_race, in_class, BT_Humanoid, in_deity, in_level,0, in_size, 0, in_heading, in_x, in_y, in_z,0,in_texture,in_helmtexture,
|
: Mob("Unnamed_Corpse",
|
||||||
0,0,0,0,0,0,0,0,0,
|
"",
|
||||||
0,0,0,0,0,0,0,0,0,0,0,0xff,
|
0,
|
||||||
0,0,0,0,0,0,0,0,0),
|
0,
|
||||||
|
in_gender,
|
||||||
|
in_race,
|
||||||
|
in_class,
|
||||||
|
BT_Humanoid,
|
||||||
|
in_deity,
|
||||||
|
in_level,
|
||||||
|
0,
|
||||||
|
in_size,
|
||||||
|
0,
|
||||||
|
in_heading,
|
||||||
|
in_x,
|
||||||
|
in_y,
|
||||||
|
in_z,
|
||||||
|
0,
|
||||||
|
in_texture,
|
||||||
|
in_helmtexture,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0xff,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0),
|
||||||
corpse_decay_timer(RuleI(Character, CorpseDecayTimeMS)),
|
corpse_decay_timer(RuleI(Character, CorpseDecayTimeMS)),
|
||||||
corpse_res_timer(RuleI(Character, CorpseResTimeMS)),
|
corpse_res_timer(RuleI(Character, CorpseResTimeMS)),
|
||||||
corpse_delay_timer(RuleI(NPC, CorpseUnlockTimer)),
|
corpse_delay_timer(RuleI(NPC, CorpseUnlockTimer)),
|
||||||
@ -446,13 +492,13 @@ Corpse::Corpse(uint32 in_dbid, uint32 in_charid, const char* in_charname, ItemLi
|
|||||||
corpse_graveyard_timer.Disable();
|
corpse_graveyard_timer.Disable();
|
||||||
|
|
||||||
memset(item_tint, 0, sizeof(item_tint));
|
memset(item_tint, 0, sizeof(item_tint));
|
||||||
pIsChanged = false;
|
is_corpse_changed = false;
|
||||||
p_PlayerCorpse = true;
|
is_player_corpse = true;
|
||||||
pLocked = false;
|
is_locked = false;
|
||||||
BeingLootedBy = 0xFFFFFFFF;
|
being_looted_by = 0xFFFFFFFF;
|
||||||
corpse_db_id = in_dbid;
|
corpse_db_id = in_dbid;
|
||||||
p_depop = false;
|
player_corpse_depop = false;
|
||||||
charid = in_charid;
|
char_id = in_charid;
|
||||||
itemlist = *in_itemlist;
|
itemlist = *in_itemlist;
|
||||||
in_itemlist->clear();
|
in_itemlist->clear();
|
||||||
|
|
||||||
@ -469,7 +515,7 @@ Corpse::Corpse(uint32 in_dbid, uint32 in_charid, const char* in_charname, ItemLi
|
|||||||
}
|
}
|
||||||
|
|
||||||
Corpse::~Corpse() {
|
Corpse::~Corpse() {
|
||||||
if (p_PlayerCorpse && !(p_depop && corpse_db_id == 0)) {
|
if (is_player_corpse && !(player_corpse_depop && corpse_db_id == 0)) {
|
||||||
Save();
|
Save();
|
||||||
}
|
}
|
||||||
ItemList::iterator cur,end;
|
ItemList::iterator cur,end;
|
||||||
@ -489,7 +535,7 @@ the client does this too, so it's unchangable
|
|||||||
void Corpse::CalcCorpseName() {
|
void Corpse::CalcCorpseName() {
|
||||||
EntityList::RemoveNumbers(name);
|
EntityList::RemoveNumbers(name);
|
||||||
char tmp[64];
|
char tmp[64];
|
||||||
if (p_PlayerCorpse)
|
if (is_player_corpse)
|
||||||
snprintf(tmp, sizeof(tmp), "'s corpse%d", GetID());
|
snprintf(tmp, sizeof(tmp), "'s corpse%d", GetID());
|
||||||
else
|
else
|
||||||
snprintf(tmp, sizeof(tmp), "`s_corpse%d", GetID());
|
snprintf(tmp, sizeof(tmp), "`s_corpse%d", GetID());
|
||||||
@ -498,9 +544,9 @@ void Corpse::CalcCorpseName() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool Corpse::Save() {
|
bool Corpse::Save() {
|
||||||
if (!p_PlayerCorpse)
|
if (!is_player_corpse)
|
||||||
return true;
|
return true;
|
||||||
if (!pIsChanged)
|
if (!is_corpse_changed)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
uint32 tmp = this->CountItems();
|
uint32 tmp = this->CountItems();
|
||||||
@ -513,7 +559,7 @@ bool Corpse::Save() {
|
|||||||
memset(dbpc, 0, tmpsize);
|
memset(dbpc, 0, tmpsize);
|
||||||
dbpc->itemcount = tmp;
|
dbpc->itemcount = tmp;
|
||||||
dbpc->size = this->size;
|
dbpc->size = this->size;
|
||||||
dbpc->locked = pLocked;
|
dbpc->locked = is_locked;
|
||||||
dbpc->copper = this->copper;
|
dbpc->copper = this->copper;
|
||||||
dbpc->silver = this->silver;
|
dbpc->silver = this->silver;
|
||||||
dbpc->gold = this->gold;
|
dbpc->gold = this->gold;
|
||||||
@ -549,10 +595,10 @@ bool Corpse::Save() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (corpse_db_id == 0) {
|
if (corpse_db_id == 0) {
|
||||||
corpse_db_id = database.SaveCharacterCorpse(charid, orgname, zone->GetZoneID(), zone->GetInstanceID(), dbpc, x_pos, y_pos, z_pos, heading);
|
corpse_db_id = database.SaveCharacterCorpse(char_id, orgname, zone->GetZoneID(), zone->GetInstanceID(), dbpc, x_pos, y_pos, z_pos, heading);
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
corpse_db_id = database.UpdateCharacterCorpse(corpse_db_id, charid, orgname, zone->GetZoneID(), zone->GetInstanceID(), dbpc, x_pos, y_pos, z_pos, heading, IsRezzed());
|
corpse_db_id = database.UpdateCharacterCorpse(corpse_db_id, char_id, orgname, zone->GetZoneID(), zone->GetInstanceID(), dbpc, x_pos, y_pos, z_pos, heading, IsRezzed());
|
||||||
}
|
}
|
||||||
|
|
||||||
safe_delete_array(dbpc);
|
safe_delete_array(dbpc);
|
||||||
@ -565,7 +611,7 @@ void Corpse::Delete() {
|
|||||||
database.DeleteCharacterCorpse(corpse_db_id);
|
database.DeleteCharacterCorpse(corpse_db_id);
|
||||||
|
|
||||||
corpse_db_id = 0;
|
corpse_db_id = 0;
|
||||||
p_depop = true;
|
player_corpse_depop = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Corpse::Bury() {
|
void Corpse::Bury() {
|
||||||
@ -573,16 +619,16 @@ void Corpse::Bury() {
|
|||||||
database.BuryCharacterCorpse(corpse_db_id);
|
database.BuryCharacterCorpse(corpse_db_id);
|
||||||
corpse_db_id = 0;
|
corpse_db_id = 0;
|
||||||
|
|
||||||
p_depop = true;
|
player_corpse_depop = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Corpse::Depop() {
|
void Corpse::Depop() {
|
||||||
if (IsNPCCorpse())
|
if (IsNPCCorpse())
|
||||||
p_depop = true;
|
player_corpse_depop = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Corpse::DepopCorpse() {
|
void Corpse::DepopCorpse() {
|
||||||
p_depop = true;
|
player_corpse_depop = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32 Corpse::CountItems() {
|
uint32 Corpse::CountItems() {
|
||||||
@ -592,7 +638,8 @@ uint32 Corpse::CountItems() {
|
|||||||
void Corpse::AddItem(uint32 itemnum, uint16 charges, int16 slot, uint32 aug1, uint32 aug2, uint32 aug3, uint32 aug4, uint32 aug5) {
|
void Corpse::AddItem(uint32 itemnum, uint16 charges, int16 slot, uint32 aug1, uint32 aug2, uint32 aug3, uint32 aug4, uint32 aug5) {
|
||||||
if (!database.GetItem(itemnum))
|
if (!database.GetItem(itemnum))
|
||||||
return;
|
return;
|
||||||
pIsChanged = true;
|
|
||||||
|
is_corpse_changed = true;
|
||||||
ServerLootItem_Struct* item = new ServerLootItem_Struct;
|
ServerLootItem_Struct* item = new ServerLootItem_Struct;
|
||||||
memset(item, 0, sizeof(ServerLootItem_Struct));
|
memset(item, 0, sizeof(ServerLootItem_Struct));
|
||||||
item->item_id = itemnum;
|
item->item_id = itemnum;
|
||||||
@ -680,7 +727,7 @@ void Corpse::RemoveItem(ServerLootItem_Struct* item_data){
|
|||||||
ServerLootItem_Struct* sitem = *cur;
|
ServerLootItem_Struct* sitem = *cur;
|
||||||
if (sitem == item_data)
|
if (sitem == item_data)
|
||||||
{
|
{
|
||||||
pIsChanged = true;
|
is_corpse_changed = true;
|
||||||
itemlist.erase(cur);
|
itemlist.erase(cur);
|
||||||
|
|
||||||
material = Inventory::CalcMaterialFromSlot(sitem->equip_slot);
|
material = Inventory::CalcMaterialFromSlot(sitem->equip_slot);
|
||||||
@ -699,7 +746,7 @@ void Corpse::SetCash(uint32 in_copper, uint32 in_silver, uint32 in_gold, uint32
|
|||||||
this->silver = in_silver;
|
this->silver = in_silver;
|
||||||
this->gold = in_gold;
|
this->gold = in_gold;
|
||||||
this->platinum = in_platinum;
|
this->platinum = in_platinum;
|
||||||
pIsChanged = true;
|
is_corpse_changed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Corpse::RemoveCash() {
|
void Corpse::RemoveCash() {
|
||||||
@ -707,7 +754,7 @@ void Corpse::RemoveCash() {
|
|||||||
this->silver = 0;
|
this->silver = 0;
|
||||||
this->gold = 0;
|
this->gold = 0;
|
||||||
this->platinum = 0;
|
this->platinum = 0;
|
||||||
pIsChanged = true;
|
is_corpse_changed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Corpse::IsEmpty() const {
|
bool Corpse::IsEmpty() const {
|
||||||
@ -717,11 +764,10 @@ bool Corpse::IsEmpty() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool Corpse::Process() {
|
bool Corpse::Process() {
|
||||||
if (p_depop)
|
if (player_corpse_depop)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if(corpse_delay_timer.Check())
|
if(corpse_delay_timer.Check()) {
|
||||||
{
|
|
||||||
for (int i=0; i<MAX_LOOTERS; i++)
|
for (int i=0; i<MAX_LOOTERS; i++)
|
||||||
looters[i] = 0;
|
looters[i] = 0;
|
||||||
corpse_delay_timer.Disable();
|
corpse_delay_timer.Disable();
|
||||||
@ -731,7 +777,7 @@ bool Corpse::Process() {
|
|||||||
if(corpse_graveyard_timer.Check()) {
|
if(corpse_graveyard_timer.Check()) {
|
||||||
if(zone->HasGraveyard()) {
|
if(zone->HasGraveyard()) {
|
||||||
Save();
|
Save();
|
||||||
p_depop = true;
|
player_corpse_depop = true;
|
||||||
database.SendCharacterCorpseToGraveyard(corpse_db_id, zone->graveyard_zoneid(),
|
database.SendCharacterCorpseToGraveyard(corpse_db_id, zone->graveyard_zoneid(),
|
||||||
(zone->GetZoneID() == zone->graveyard_zoneid()) ? zone->GetInstanceID() : 0, zone->graveyard_x(),
|
(zone->GetZoneID() == zone->graveyard_zoneid()) ? zone->GetInstanceID() : 0, zone->graveyard_x(),
|
||||||
zone->graveyard_y(), zone->graveyard_z(), zone->graveyard_heading());
|
zone->graveyard_y(), zone->graveyard_z(), zone->graveyard_heading());
|
||||||
@ -761,7 +807,7 @@ bool Corpse::Process() {
|
|||||||
else {
|
else {
|
||||||
if(database.BuryCharacterCorpse(corpse_db_id)) {
|
if(database.BuryCharacterCorpse(corpse_db_id)) {
|
||||||
Save();
|
Save();
|
||||||
p_depop = true;
|
player_corpse_depop = true;
|
||||||
corpse_db_id = 0;
|
corpse_db_id = 0;
|
||||||
LogFile->write(EQEMuLog::Debug, "Tagged %s player corpse has burried.", this->GetName());
|
LogFile->write(EQEMuLog::Debug, "Tagged %s player corpse has burried.", this->GetName());
|
||||||
}
|
}
|
||||||
@ -800,8 +846,7 @@ bool Corpse::CanMobLoot(int charid) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Corpse::AllowMobLoot(Mob *them, uint8 slot)
|
void Corpse::AllowMobLoot(Mob *them, uint8 slot) {
|
||||||
{
|
|
||||||
if(slot >= MAX_LOOTERS)
|
if(slot >= MAX_LOOTERS)
|
||||||
return;
|
return;
|
||||||
if(them == nullptr || !them->IsClient())
|
if(them == nullptr || !them->IsClient())
|
||||||
@ -814,7 +859,7 @@ void Corpse::AllowMobLoot(Mob *them, uint8 slot)
|
|||||||
void Corpse::MakeLootRequestPackets(Client* client, const EQApplicationPacket* app) {
|
void Corpse::MakeLootRequestPackets(Client* client, const EQApplicationPacket* app) {
|
||||||
// Added 12/08. Started compressing loot struct on live.
|
// Added 12/08. Started compressing loot struct on live.
|
||||||
char tmp[10];
|
char tmp[10];
|
||||||
if(p_depop) {
|
if(player_corpse_depop) {
|
||||||
SendLootReqErrorPacket(client, 0);
|
SendLootReqErrorPacket(client, 0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -826,29 +871,29 @@ void Corpse::MakeLootRequestPackets(Client* client, const EQApplicationPacket* a
|
|||||||
// return;
|
// return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(pLocked && client->Admin() < 100) {
|
if(is_locked && client->Admin() < 100) {
|
||||||
SendLootReqErrorPacket(client, 0);
|
SendLootReqErrorPacket(client, 0);
|
||||||
client->Message(13, "Error: Corpse locked by GM.");
|
client->Message(13, "Error: Corpse locked by GM.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(BeingLootedBy == 0) { BeingLootedBy = 0xFFFFFFFF; }
|
if(being_looted_by == 0) { being_looted_by = 0xFFFFFFFF; }
|
||||||
|
|
||||||
if(this->BeingLootedBy != 0xFFFFFFFF) {
|
if(this->being_looted_by != 0xFFFFFFFF) {
|
||||||
// lets double check....
|
// lets double check....
|
||||||
Entity* looter = entity_list.GetID(this->BeingLootedBy);
|
Entity* looter = entity_list.GetID(this->being_looted_by);
|
||||||
if(looter == 0) { this->BeingLootedBy = 0xFFFFFFFF; }
|
if(looter == 0) { this->being_looted_by = 0xFFFFFFFF; }
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8 tCanLoot = 1;
|
uint8 tCanLoot = 1;
|
||||||
bool lootcoin = false;
|
bool lootcoin = false;
|
||||||
if(database.GetVariable("LootCoin", tmp, 9)) { lootcoin = (atoi(tmp) == 1); }
|
if(database.GetVariable("LootCoin", tmp, 9)) { lootcoin = (atoi(tmp) == 1); }
|
||||||
|
|
||||||
if(this->BeingLootedBy != 0xFFFFFFFF && this->BeingLootedBy != client->GetID()) {
|
if(this->being_looted_by != 0xFFFFFFFF && this->being_looted_by != client->GetID()) {
|
||||||
SendLootReqErrorPacket(client, 0);
|
SendLootReqErrorPacket(client, 0);
|
||||||
tCanLoot = 0;
|
tCanLoot = 0;
|
||||||
}
|
}
|
||||||
else if(IsPlayerCorpse() && charid == client->CharacterID()) { tCanLoot = 2; }
|
else if(IsPlayerCorpse() && char_id == client->CharacterID()) { tCanLoot = 2; }
|
||||||
else if((IsNPCCorpse() || become_npc) && CanMobLoot(client->CharacterID())) { tCanLoot = 2; }
|
else if((IsNPCCorpse() || become_npc) && CanMobLoot(client->CharacterID())) { tCanLoot = 2; }
|
||||||
else if(GetPKItem() == -1 && CanMobLoot(client->CharacterID())) { tCanLoot = 3; } //pvp loot all items, variable cash
|
else if(GetPKItem() == -1 && CanMobLoot(client->CharacterID())) { tCanLoot = 3; } //pvp loot all items, variable cash
|
||||||
else if(GetPKItem() == 1 && CanMobLoot(client->CharacterID())) { tCanLoot = 4; } //pvp loot 1 item, variable cash
|
else if(GetPKItem() == 1 && CanMobLoot(client->CharacterID())) { tCanLoot = 4; } //pvp loot 1 item, variable cash
|
||||||
@ -857,7 +902,7 @@ void Corpse::MakeLootRequestPackets(Client* client, const EQApplicationPacket* a
|
|||||||
if(tCanLoot == 1) { if(client->Admin() < 100 || !client->GetGM()) { SendLootReqErrorPacket(client, 2); } }
|
if(tCanLoot == 1) { if(client->Admin() < 100 || !client->GetGM()) { SendLootReqErrorPacket(client, 2); } }
|
||||||
|
|
||||||
if(tCanLoot >= 2 || (tCanLoot == 1 && client->Admin() >= 100 && client->GetGM())) {
|
if(tCanLoot >= 2 || (tCanLoot == 1 && client->Admin() >= 100 && client->GetGM())) {
|
||||||
this->BeingLootedBy = client->GetID();
|
this->being_looted_by = client->GetID();
|
||||||
EQApplicationPacket* outapp = new EQApplicationPacket(OP_MoneyOnCorpse, sizeof(moneyOnCorpseStruct));
|
EQApplicationPacket* outapp = new EQApplicationPacket(OP_MoneyOnCorpse, sizeof(moneyOnCorpseStruct));
|
||||||
moneyOnCorpseStruct* d = (moneyOnCorpseStruct*) outapp->pBuffer;
|
moneyOnCorpseStruct* d = (moneyOnCorpseStruct*) outapp->pBuffer;
|
||||||
|
|
||||||
@ -940,7 +985,7 @@ void Corpse::MakeLootRequestPackets(Client* client, const EQApplicationPacket* a
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(IsPlayerCorpse() && (charid == client->CharacterID() || client->GetGM())) {
|
if(IsPlayerCorpse() && (char_id == client->CharacterID() || client->GetGM())) {
|
||||||
if(i > corpselootlimit) {
|
if(i > corpselootlimit) {
|
||||||
client->Message(15, "*** This corpse contains more items than can be displayed! ***");
|
client->Message(15, "*** This corpse contains more items than can be displayed! ***");
|
||||||
client->Message(0, "Remove items and re-loot corpse to access remaining inventory.");
|
client->Message(0, "Remove items and re-loot corpse to access remaining inventory.");
|
||||||
@ -979,8 +1024,8 @@ void Corpse::LootItem(Client* client, const EQApplicationPacket* app) {
|
|||||||
if (!loot_cooldown_timer.Check()) {
|
if (!loot_cooldown_timer.Check()) {
|
||||||
SendEndLootErrorPacket(client);
|
SendEndLootErrorPacket(client);
|
||||||
//unlock corpse for others
|
//unlock corpse for others
|
||||||
if (this->BeingLootedBy = client->GetID()) {
|
if (this->being_looted_by = client->GetID()) {
|
||||||
BeingLootedBy = 0xFFFFFFFF;
|
being_looted_by = 0xFFFFFFFF;
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -990,33 +1035,33 @@ void Corpse::LootItem(Client* client, const EQApplicationPacket* app) {
|
|||||||
client->Message(13, "You may not loot an item while you have an item on your cursor.");
|
client->Message(13, "You may not loot an item while you have an item on your cursor.");
|
||||||
SendEndLootErrorPacket(client);
|
SendEndLootErrorPacket(client);
|
||||||
/* Unlock corpse for others */
|
/* Unlock corpse for others */
|
||||||
if (this->BeingLootedBy = client->GetID()) {
|
if (this->being_looted_by = client->GetID()) {
|
||||||
BeingLootedBy = 0xFFFFFFFF;
|
being_looted_by = 0xFFFFFFFF;
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
LootingItem_Struct* lootitem = (LootingItem_Struct*)app->pBuffer;
|
LootingItem_Struct* lootitem = (LootingItem_Struct*)app->pBuffer;
|
||||||
|
|
||||||
if (this->BeingLootedBy != client->GetID()) {
|
if (this->being_looted_by != client->GetID()) {
|
||||||
client->Message(13, "Error: Corpse::LootItem: BeingLootedBy != client");
|
client->Message(13, "Error: Corpse::LootItem: BeingLootedBy != client");
|
||||||
SendEndLootErrorPacket(client);
|
SendEndLootErrorPacket(client);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (IsPlayerCorpse() && !CanMobLoot(client->CharacterID()) && !become_npc && (charid != client->CharacterID() && client->Admin() < 150)) {
|
if (IsPlayerCorpse() && !CanMobLoot(client->CharacterID()) && !become_npc && (char_id != client->CharacterID() && client->Admin() < 150)) {
|
||||||
client->Message(13, "Error: This is a player corpse and you dont own it.");
|
client->Message(13, "Error: This is a player corpse and you dont own it.");
|
||||||
SendEndLootErrorPacket(client);
|
SendEndLootErrorPacket(client);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (pLocked && client->Admin() < 100) {
|
if (is_locked && client->Admin() < 100) {
|
||||||
SendLootReqErrorPacket(client, 0);
|
SendLootReqErrorPacket(client, 0);
|
||||||
client->Message(13, "Error: Corpse locked by GM.");
|
client->Message(13, "Error: Corpse locked by GM.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (IsPlayerCorpse() && (charid != client->CharacterID()) && CanMobLoot(client->CharacterID()) && GetPKItem() == 0){
|
if (IsPlayerCorpse() && (char_id != client->CharacterID()) && CanMobLoot(client->CharacterID()) && GetPKItem() == 0){
|
||||||
client->Message(13, "Error: You cannot loot any more items from this corpse.");
|
client->Message(13, "Error: You cannot loot any more items from this corpse.");
|
||||||
SendEndLootErrorPacket(client);
|
SendEndLootErrorPacket(client);
|
||||||
BeingLootedBy = 0xFFFFFFFF;
|
being_looted_by = 0xFFFFFFFF;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const Item_Struct* item = 0;
|
const Item_Struct* item = 0;
|
||||||
@ -1051,7 +1096,7 @@ void Corpse::LootItem(Client* client, const EQApplicationPacket* app) {
|
|||||||
if (client->CheckLoreConflict(item)) {
|
if (client->CheckLoreConflict(item)) {
|
||||||
client->Message_StringID(0, LOOT_LORE_ERROR);
|
client->Message_StringID(0, LOOT_LORE_ERROR);
|
||||||
SendEndLootErrorPacket(client);
|
SendEndLootErrorPacket(client);
|
||||||
BeingLootedBy = 0;
|
being_looted_by = 0;
|
||||||
delete inst;
|
delete inst;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1063,7 +1108,7 @@ void Corpse::LootItem(Client* client, const EQApplicationPacket* app) {
|
|||||||
if (client->CheckLoreConflict(itm->GetItem())) {
|
if (client->CheckLoreConflict(itm->GetItem())) {
|
||||||
client->Message_StringID(0, LOOT_LORE_ERROR);
|
client->Message_StringID(0, LOOT_LORE_ERROR);
|
||||||
SendEndLootErrorPacket(client);
|
SendEndLootErrorPacket(client);
|
||||||
BeingLootedBy = 0;
|
being_looted_by = 0;
|
||||||
delete inst;
|
delete inst;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1181,15 +1226,14 @@ void Corpse::EndLoot(Client* client, const EQApplicationPacket* app) {
|
|||||||
safe_delete(outapp);
|
safe_delete(outapp);
|
||||||
|
|
||||||
//client->Save(); //inventory operations auto-commit
|
//client->Save(); //inventory operations auto-commit
|
||||||
this->BeingLootedBy = 0xFFFFFFFF;
|
this->being_looted_by = 0xFFFFFFFF;
|
||||||
if (this->IsEmpty())
|
if (this->IsEmpty())
|
||||||
Delete();
|
Delete();
|
||||||
else
|
else
|
||||||
Save();
|
Save();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Corpse::FillSpawnStruct(NewSpawn_Struct* ns, Mob* ForWho)
|
void Corpse::FillSpawnStruct(NewSpawn_Struct* ns, Mob* ForWho) {
|
||||||
{
|
|
||||||
Mob::FillSpawnStruct(ns, ForWho);
|
Mob::FillSpawnStruct(ns, ForWho);
|
||||||
|
|
||||||
ns->spawn.max_hp = 120;
|
ns->spawn.max_hp = 120;
|
||||||
@ -1201,7 +1245,6 @@ void Corpse::FillSpawnStruct(NewSpawn_Struct* ns, Mob* ForWho)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Corpse::QueryLoot(Client* to) {
|
void Corpse::QueryLoot(Client* to) {
|
||||||
|
|
||||||
int x = 0, y = 0; // x = visible items, y = total items
|
int x = 0, y = 0; // x = visible items, y = total items
|
||||||
to->Message(0, "Coin: %ip, %ig, %is, %ic", platinum, gold, silver, copper);
|
to->Message(0, "Coin: %ip, %ig, %is, %ic", platinum, gold, silver, copper);
|
||||||
|
|
||||||
@ -1253,8 +1296,7 @@ void Corpse::QueryLoot(Client* to) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Corpse::Summon(Client* client, bool spell, bool CheckDistance)
|
bool Corpse::Summon(Client* client, bool spell, bool CheckDistance) {
|
||||||
{
|
|
||||||
uint32 dist2 = 10000; // pow(100, 2);
|
uint32 dist2 = 10000; // pow(100, 2);
|
||||||
if (!spell) {
|
if (!spell) {
|
||||||
if (this->GetCharID() == client->CharacterID()) {
|
if (this->GetCharID() == client->CharacterID()) {
|
||||||
@ -1262,13 +1304,11 @@ bool Corpse::Summon(Client* client, bool spell, bool CheckDistance)
|
|||||||
client->Message(13, "That corpse is locked by a GM.");
|
client->Message(13, "That corpse is locked by a GM.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!CheckDistance || (DistNoRootNoZ(*client) <= dist2))
|
if (!CheckDistance || (DistNoRootNoZ(*client) <= dist2)) {
|
||||||
{
|
|
||||||
GMMove(client->GetX(), client->GetY(), client->GetZ());
|
GMMove(client->GetX(), client->GetY(), client->GetZ());
|
||||||
pIsChanged = true;
|
is_corpse_changed = true;
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
client->Message(0, "Corpse is too far away.");
|
client->Message(0, "Corpse is too far away.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -1277,25 +1317,20 @@ bool Corpse::Summon(Client* client, bool spell, bool CheckDistance)
|
|||||||
{
|
{
|
||||||
bool consented = false;
|
bool consented = false;
|
||||||
std::list<std::string>::iterator itr;
|
std::list<std::string>::iterator itr;
|
||||||
for(itr = client->consent_list.begin(); itr != client->consent_list.end(); ++itr)
|
for(itr = client->consent_list.begin(); itr != client->consent_list.end(); ++itr) {
|
||||||
{
|
if(strcmp(this->GetOwnerName(), itr->c_str()) == 0) {
|
||||||
if(strcmp(this->GetOwnerName(), itr->c_str()) == 0)
|
if (!CheckDistance || (DistNoRootNoZ(*client) <= dist2)) {
|
||||||
{
|
|
||||||
if (!CheckDistance || (DistNoRootNoZ(*client) <= dist2))
|
|
||||||
{
|
|
||||||
GMMove(client->GetX(), client->GetY(), client->GetZ());
|
GMMove(client->GetX(), client->GetY(), client->GetZ());
|
||||||
pIsChanged = true;
|
is_corpse_changed = true;
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
client->Message(0, "Corpse is too far away.");
|
client->Message(0, "Corpse is too far away.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
consented = true;
|
consented = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(!consented)
|
if(!consented) {
|
||||||
{
|
|
||||||
client->Message(0, "You do not have permission to move this corpse.");
|
client->Message(0, "You do not have permission to move this corpse.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -1303,7 +1338,7 @@ bool Corpse::Summon(Client* client, bool spell, bool CheckDistance)
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
GMMove(client->GetX(), client->GetY(), client->GetZ());
|
GMMove(client->GetX(), client->GetY(), client->GetZ());
|
||||||
pIsChanged = true;
|
is_corpse_changed = true;
|
||||||
}
|
}
|
||||||
Save();
|
Save();
|
||||||
return true;
|
return true;
|
||||||
@ -1311,7 +1346,7 @@ bool Corpse::Summon(Client* client, bool spell, bool CheckDistance)
|
|||||||
|
|
||||||
void Corpse::CompleteRezz(){
|
void Corpse::CompleteRezz(){
|
||||||
rezzexp = 0;
|
rezzexp = 0;
|
||||||
pIsChanged = true;
|
is_corpse_changed = true;
|
||||||
this->Save();
|
this->Save();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1325,8 +1360,7 @@ void Corpse::Spawn() {
|
|||||||
uint32 Corpse::GetEquipment(uint8 material_slot) const {
|
uint32 Corpse::GetEquipment(uint8 material_slot) const {
|
||||||
int invslot;
|
int invslot;
|
||||||
|
|
||||||
if(material_slot > EmuConstants::MATERIAL_END)
|
if(material_slot > EmuConstants::MATERIAL_END) {
|
||||||
{
|
|
||||||
return NO_ITEM;
|
return NO_ITEM;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1340,14 +1374,12 @@ uint32 Corpse::GetEquipment(uint8 material_slot) const {
|
|||||||
uint32 Corpse::GetEquipmentColor(uint8 material_slot) const {
|
uint32 Corpse::GetEquipmentColor(uint8 material_slot) const {
|
||||||
const Item_Struct *item;
|
const Item_Struct *item;
|
||||||
|
|
||||||
if(material_slot > EmuConstants::MATERIAL_END)
|
if(material_slot > EmuConstants::MATERIAL_END) {
|
||||||
{
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
item = database.GetItem(GetEquipment(material_slot));
|
item = database.GetItem(GetEquipment(material_slot));
|
||||||
if(item != NO_ITEM)
|
if(item != NO_ITEM) {
|
||||||
{
|
|
||||||
return item_tint[material_slot].rgb.use_tint ?
|
return item_tint[material_slot].rgb.use_tint ?
|
||||||
item_tint[material_slot].color :
|
item_tint[material_slot].color :
|
||||||
item->Color;
|
item->Color;
|
||||||
@ -1356,12 +1388,9 @@ uint32 Corpse::GetEquipmentColor(uint8 material_slot) const {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Corpse::AddLooter(Mob* who)
|
void Corpse::AddLooter(Mob* who) {
|
||||||
{
|
for (int i=0; i<MAX_LOOTERS; i++) {
|
||||||
for (int i=0; i<MAX_LOOTERS; i++)
|
if (looters[i] == 0) {
|
||||||
{
|
|
||||||
if (looters[i] == 0)
|
|
||||||
{
|
|
||||||
looters[i] = who->CastToClient()->CharacterID();
|
looters[i] = who->CastToClient()->CharacterID();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -52,21 +52,21 @@ public:
|
|||||||
void LoadPlayerCorpseDecayTime(uint32 dbid);
|
void LoadPlayerCorpseDecayTime(uint32 dbid);
|
||||||
|
|
||||||
bool IsCorpse() const { return true; }
|
bool IsCorpse() const { return true; }
|
||||||
bool IsPlayerCorpse() const { return p_PlayerCorpse; }
|
bool IsPlayerCorpse() const { return is_player_corpse; }
|
||||||
bool IsNPCCorpse() const { return !p_PlayerCorpse; }
|
bool IsNPCCorpse() const { return !is_player_corpse; }
|
||||||
bool IsBecomeNPCCorpse() const { return become_npc; }
|
bool IsBecomeNPCCorpse() const { return become_npc; }
|
||||||
bool Process();
|
bool Process();
|
||||||
bool Save();
|
bool Save();
|
||||||
uint32 GetCharID() { return charid; }
|
uint32 GetCharID() { return char_id; }
|
||||||
uint32 SetCharID(uint32 iCharID) { if (IsPlayerCorpse()) { return (charid = iCharID); } return 0xFFFFFFFF; };
|
uint32 SetCharID(uint32 iCharID) { if (IsPlayerCorpse()) { return (char_id = iCharID); } return 0xFFFFFFFF; };
|
||||||
uint32 GetDecayTime() { if (!corpse_decay_timer.Enabled()) return 0xFFFFFFFF; else return corpse_decay_timer.GetRemainingTime(); }
|
uint32 GetDecayTime() { if (!corpse_decay_timer.Enabled()) return 0xFFFFFFFF; else return corpse_decay_timer.GetRemainingTime(); }
|
||||||
uint32 GetResTime() { if (!corpse_res_timer.Enabled()) return 0; else return corpse_res_timer.GetRemainingTime(); }
|
uint32 GetResTime() { if (!corpse_res_timer.Enabled()) return 0; else return corpse_res_timer.GetRemainingTime(); }
|
||||||
void CalcCorpseName();
|
void CalcCorpseName();
|
||||||
inline void Lock() { pLocked = true; }
|
inline void Lock() { is_locked = true; }
|
||||||
inline void UnLock() { pLocked = false; }
|
inline void UnLock() { is_locked = false; }
|
||||||
inline bool IsLocked() { return pLocked; }
|
inline bool IsLocked() { return is_locked; }
|
||||||
inline void ResetLooter() { BeingLootedBy = 0xFFFFFFFF; }
|
inline void ResetLooter() { being_looted_by = 0xFFFFFFFF; }
|
||||||
inline bool IsBeingLooted() { return (BeingLootedBy != 0xFFFFFFFF); }
|
inline bool IsBeingLooted() { return (being_looted_by != 0xFFFFFFFF); }
|
||||||
inline uint32 GetDBID() { return corpse_db_id; }
|
inline uint32 GetDBID() { return corpse_db_id; }
|
||||||
inline char* GetOwnerName() { return orgname;}
|
inline char* GetOwnerName() { return orgname;}
|
||||||
|
|
||||||
@ -98,8 +98,8 @@ public:
|
|||||||
bool Summon(Client* client, bool spell, bool CheckDistance);
|
bool Summon(Client* client, bool spell, bool CheckDistance);
|
||||||
void CastRezz(uint16 spellid, Mob* Caster);
|
void CastRezz(uint16 spellid, Mob* Caster);
|
||||||
void CompleteRezz();
|
void CompleteRezz();
|
||||||
void SetPKItem(int32 id) { pkitem = id; }
|
void SetPKItem(int32 id) { player_kill_item = id; }
|
||||||
int32 GetPKItem() { return pkitem; }
|
int32 GetPKItem() { return player_kill_item; }
|
||||||
bool CanMobLoot(int charid);
|
bool CanMobLoot(int charid);
|
||||||
void AllowMobLoot(Mob *them, uint8 slot);
|
void AllowMobLoot(Mob *them, uint8 slot);
|
||||||
void AddLooter(Mob *who);
|
void AddLooter(Mob *who);
|
||||||
@ -120,18 +120,19 @@ protected:
|
|||||||
std::list<uint32> MoveItemToCorpse(Client *client, ItemInst *item, int16 equipslot);
|
std::list<uint32> MoveItemToCorpse(Client *client, ItemInst *item, int16 equipslot);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool p_PlayerCorpse; bool pIsChanged;
|
bool is_player_corpse;
|
||||||
bool pLocked;
|
bool is_corpse_changed;
|
||||||
int32 pkitem;
|
bool is_locked;
|
||||||
|
int32 player_kill_item;
|
||||||
uint32 corpse_db_id;
|
uint32 corpse_db_id;
|
||||||
uint32 charid;
|
uint32 char_id;
|
||||||
ItemList itemlist;
|
ItemList itemlist;
|
||||||
uint32 copper;
|
uint32 copper;
|
||||||
uint32 silver;
|
uint32 silver;
|
||||||
uint32 gold;
|
uint32 gold;
|
||||||
uint32 platinum;
|
uint32 platinum;
|
||||||
bool p_depop;
|
bool player_corpse_depop;
|
||||||
uint32 BeingLootedBy;
|
uint32 being_looted_by;
|
||||||
uint32 rezzexp;
|
uint32 rezzexp;
|
||||||
bool rez;
|
bool rez;
|
||||||
bool can_rez;
|
bool can_rez;
|
||||||
|
|||||||
@ -736,8 +736,6 @@ bool SpawnConditionManager::LoadSpawnConditions(const char* zone_name, uint32 in
|
|||||||
//clear out old stuff..
|
//clear out old stuff..
|
||||||
spawn_conditions.clear();
|
spawn_conditions.clear();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
std::string query = StringFormat("SELECT id, onchange, value "
|
std::string query = StringFormat("SELECT id, onchange, value "
|
||||||
"FROM spawn_conditions "
|
"FROM spawn_conditions "
|
||||||
"WHERE zone = '%s'", zone_name);
|
"WHERE zone = '%s'", zone_name);
|
||||||
|
|||||||
@ -1237,7 +1237,6 @@ bool ZoneDatabase::SaveCharacterBindPoint(uint32 character_id, uint32 zone_id, u
|
|||||||
if (!results.RowsAffected()) {
|
if (!results.RowsAffected()) {
|
||||||
LogFile->write(EQEMuLog::Debug, "ERROR Bind Home Save: %s. %s", results.ErrorMessage().c_str(), query.c_str());
|
LogFile->write(EQEMuLog::Debug, "ERROR Bind Home Save: %s. %s", results.ErrorMessage().c_str(), query.c_str());
|
||||||
}
|
}
|
||||||
ThrowDBError(results.ErrorMessage(), "ZoneDatabase::SaveCharacterBindPoint", query);
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1248,14 +1247,12 @@ bool ZoneDatabase::SaveCharacterMaterialColor(uint32 character_id, uint32 slot_i
|
|||||||
|
|
||||||
std::string query = StringFormat("REPLACE INTO `character_material` (id, slot, red, green, blue, color, use_tint) VALUES (%u, %u, %u, %u, %u, %u, 255)", character_id, slot_id, red, green, blue, color); auto results = QueryDatabase(query);
|
std::string query = StringFormat("REPLACE INTO `character_material` (id, slot, red, green, blue, color, use_tint) VALUES (%u, %u, %u, %u, %u, %u, 255)", character_id, slot_id, red, green, blue, color); auto results = QueryDatabase(query);
|
||||||
LogFile->write(EQEMuLog::Debug, "ZoneDatabase::SaveCharacterMaterialColor for character ID: %i, slot_id: %u color: %u done", character_id, slot_id, color);
|
LogFile->write(EQEMuLog::Debug, "ZoneDatabase::SaveCharacterMaterialColor for character ID: %i, slot_id: %u color: %u done", character_id, slot_id, color);
|
||||||
ThrowDBError(results.ErrorMessage(), "ZoneDatabase::SaveCharacterMaterialColor", query);
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ZoneDatabase::SaveCharacterSkill(uint32 character_id, uint32 skill_id, uint32 value){
|
bool ZoneDatabase::SaveCharacterSkill(uint32 character_id, uint32 skill_id, uint32 value){
|
||||||
std::string query = StringFormat("REPLACE INTO `character_skills` (id, skill_id, value) VALUES (%u, %u, %u)", character_id, skill_id, value); auto results = QueryDatabase(query);
|
std::string query = StringFormat("REPLACE INTO `character_skills` (id, skill_id, value) VALUES (%u, %u, %u)", character_id, skill_id, value); auto results = QueryDatabase(query);
|
||||||
LogFile->write(EQEMuLog::Debug, "ZoneDatabase::SaveCharacterSkill for character ID: %i, skill_id:%u value:%u done", character_id, skill_id, value);
|
LogFile->write(EQEMuLog::Debug, "ZoneDatabase::SaveCharacterSkill for character ID: %i, skill_id:%u value:%u done", character_id, skill_id, value);
|
||||||
ThrowDBError(results.ErrorMessage(), "ZoneDatabase::SaveCharacterSkill", query);
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1263,7 +1260,6 @@ bool ZoneDatabase::SaveCharacterDisc(uint32 character_id, uint32 slot_id, uint32
|
|||||||
std::string query = StringFormat("REPLACE INTO `character_disciplines` (id, slot_id, disc_id) VALUES (%u, %u, %u)", character_id, slot_id, disc_id);
|
std::string query = StringFormat("REPLACE INTO `character_disciplines` (id, slot_id, disc_id) VALUES (%u, %u, %u)", character_id, slot_id, disc_id);
|
||||||
auto results = QueryDatabase(query);
|
auto results = QueryDatabase(query);
|
||||||
LogFile->write(EQEMuLog::Debug, "ZoneDatabase::SaveCharacterDisc for character ID: %i, slot:%u disc_id:%u done", character_id, slot_id, disc_id);
|
LogFile->write(EQEMuLog::Debug, "ZoneDatabase::SaveCharacterDisc for character ID: %i, slot:%u disc_id:%u done", character_id, slot_id, disc_id);
|
||||||
ThrowDBError(results.ErrorMessage(), "ZoneDatabase::SaveCharacterDisc", query);
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1286,7 +1282,6 @@ bool ZoneDatabase::SaveCharacterBandolier(uint32 character_id, uint8 bandolier_i
|
|||||||
DoEscapeString(bandolier_name_esc, bandolier_name, strlen(bandolier_name));
|
DoEscapeString(bandolier_name_esc, bandolier_name, strlen(bandolier_name));
|
||||||
std::string query = StringFormat("REPLACE INTO `character_bandolier` (id, bandolier_id, bandolier_slot, item_id, icon, bandolier_name) VALUES (%u, %u, %u, %u, %u,'%s')", character_id, bandolier_id, bandolier_slot, item_id, icon, bandolier_name_esc);
|
std::string query = StringFormat("REPLACE INTO `character_bandolier` (id, bandolier_id, bandolier_slot, item_id, icon, bandolier_name) VALUES (%u, %u, %u, %u, %u,'%s')", character_id, bandolier_id, bandolier_slot, item_id, icon, bandolier_name_esc);
|
||||||
auto results = QueryDatabase(query);
|
auto results = QueryDatabase(query);
|
||||||
ThrowDBError(results.ErrorMessage(), "ZoneDatabase::SaveCharacterBandolier", query);
|
|
||||||
LogFile->write(EQEMuLog::Debug, "ZoneDatabase::SaveCharacterBandolier for character ID: %i, bandolier_id: %u, bandolier_slot: %u item_id: %u, icon:%u band_name:%s done", character_id, bandolier_id, bandolier_slot, item_id, icon, bandolier_name);
|
LogFile->write(EQEMuLog::Debug, "ZoneDatabase::SaveCharacterBandolier for character ID: %i, bandolier_id: %u, bandolier_slot: %u item_id: %u, icon:%u band_name:%s done", character_id, bandolier_id, bandolier_slot, item_id, icon, bandolier_name);
|
||||||
if (!results.RowsAffected()){ std::cout << "ERROR Bandolier Save: " << results.ErrorMessage() << "\n\n" << query << "\n" << std::endl; }
|
if (!results.RowsAffected()){ std::cout << "ERROR Bandolier Save: " << results.ErrorMessage() << "\n\n" << query << "\n" << std::endl; }
|
||||||
return true;
|
return true;
|
||||||
@ -1295,7 +1290,6 @@ bool ZoneDatabase::SaveCharacterBandolier(uint32 character_id, uint8 bandolier_i
|
|||||||
bool ZoneDatabase::SaveCharacterPotionBelt(uint32 character_id, uint8 potion_id, uint32 item_id, uint32 icon) {
|
bool ZoneDatabase::SaveCharacterPotionBelt(uint32 character_id, uint8 potion_id, uint32 item_id, uint32 icon) {
|
||||||
std::string query = StringFormat("REPLACE INTO `character_potionbelt` (id, potion_id, item_id, icon) VALUES (%u, %u, %u, %u)", character_id, potion_id, item_id, icon);
|
std::string query = StringFormat("REPLACE INTO `character_potionbelt` (id, potion_id, item_id, icon) VALUES (%u, %u, %u, %u)", character_id, potion_id, item_id, icon);
|
||||||
auto results = QueryDatabase(query);
|
auto results = QueryDatabase(query);
|
||||||
ThrowDBError(results.ErrorMessage(), "ZoneDatabase::SaveCharacterPotionBelt", query);
|
|
||||||
if (!results.RowsAffected()){ std::cout << "ERROR Potionbelt Save: " << results.ErrorMessage() << "\n\n" << query << "\n" << std::endl; }
|
if (!results.RowsAffected()){ std::cout << "ERROR Potionbelt Save: " << results.ErrorMessage() << "\n\n" << query << "\n" << std::endl; }
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -1312,7 +1306,6 @@ bool ZoneDatabase::SaveCharacterLeadershipAA(uint32 character_id, PlayerProfile_
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
auto results = QueryDatabase(query);
|
auto results = QueryDatabase(query);
|
||||||
ThrowDBError(results.ErrorMessage(), "ZoneDatabase::SaveCharacterLeadershipAA", query);
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1604,7 +1597,6 @@ bool ZoneDatabase::SaveCharacterData(uint32 character_id, uint32 account_id, Pla
|
|||||||
m_epp->expended_aa
|
m_epp->expended_aa
|
||||||
);
|
);
|
||||||
auto results = database.QueryDatabase(query);
|
auto results = database.QueryDatabase(query);
|
||||||
ThrowDBError(results.ErrorMessage(), "ZoneDatabase:SaveCharacterData", query);
|
|
||||||
LogFile->write(EQEMuLog::Debug, "ZoneDatabase::SaveCharacterData %i, done... Took %f seconds", character_id, ((float)(std::clock() - t)) / CLOCKS_PER_SEC);
|
LogFile->write(EQEMuLog::Debug, "ZoneDatabase::SaveCharacterData %i, done... Took %f seconds", character_id, ((float)(std::clock() - t)) / CLOCKS_PER_SEC);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -1646,7 +1638,6 @@ bool ZoneDatabase::SaveCharacterCurrency(uint32 character_id, PlayerProfile_Stru
|
|||||||
pp->currentEbonCrystals,
|
pp->currentEbonCrystals,
|
||||||
pp->careerEbonCrystals);
|
pp->careerEbonCrystals);
|
||||||
auto results = database.QueryDatabase(query);
|
auto results = database.QueryDatabase(query);
|
||||||
ThrowDBError(results.ErrorMessage(), "ZoneDatabase::SaveCharacterCurrency", query);
|
|
||||||
LogFile->write(EQEMuLog::Debug, "Saving Currency for character ID: %i, done", character_id);
|
LogFile->write(EQEMuLog::Debug, "Saving Currency for character ID: %i, done", character_id);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -1656,7 +1647,6 @@ bool ZoneDatabase::SaveCharacterAA(uint32 character_id, uint32 aa_id, uint32 cur
|
|||||||
" VALUES (%u, %u, %u)",
|
" VALUES (%u, %u, %u)",
|
||||||
character_id, aa_id, current_level);
|
character_id, aa_id, current_level);
|
||||||
auto results = QueryDatabase(rquery);
|
auto results = QueryDatabase(rquery);
|
||||||
ThrowDBError(results.ErrorMessage(), "ZoneDatabase::SaveCharacterAA", rquery);
|
|
||||||
LogFile->write(EQEMuLog::Debug, "Saving AA for character ID: %u, aa_id: %u current_level: %u", character_id, aa_id, current_level);
|
LogFile->write(EQEMuLog::Debug, "Saving AA for character ID: %u, aa_id: %u current_level: %u", character_id, aa_id, current_level);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -3441,6 +3431,7 @@ uint32 ZoneDatabase::SendCharacterCorpseToGraveyard(uint32 dbid, uint32 zone_id,
|
|||||||
}
|
}
|
||||||
return dbid;
|
return dbid;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32 ZoneDatabase::UpdateCharacterCorpse(uint32 db_id, uint32 char_id, const char* char_name, uint32 zone_id, uint16 instance_id, PlayerCorpse_Struct* dbpc, float x, float y, float z, float heading, bool is_rezzed) {
|
uint32 ZoneDatabase::UpdateCharacterCorpse(uint32 db_id, uint32 char_id, const char* char_name, uint32 zone_id, uint16 instance_id, PlayerCorpse_Struct* dbpc, float x, float y, float z, float heading, bool is_rezzed) {
|
||||||
std::string query = StringFormat("UPDATE `character_corpses` SET \n"
|
std::string query = StringFormat("UPDATE `character_corpses` SET \n"
|
||||||
"`charname` = '%s',\n"
|
"`charname` = '%s',\n"
|
||||||
@ -3692,7 +3683,7 @@ uint32 ZoneDatabase::GetCharacterCorpseID(uint32 char_id, uint8 corpse) {
|
|||||||
|
|
||||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||||
for (int i = 0; i < corpse; i++) {
|
for (int i = 0; i < corpse; i++) {
|
||||||
return atoi(row[0]);
|
return atoll(row[0]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@ -3826,7 +3817,7 @@ bool ZoneDatabase::LoadCharacterCorpseData(uint32 corpse_id, PlayerCorpse_Struct
|
|||||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||||
memset(&pcs->items[i], 0, sizeof (player_lootitem::ServerLootItem_Struct));
|
memset(&pcs->items[i], 0, sizeof (player_lootitem::ServerLootItem_Struct));
|
||||||
pcs->items[i].equip_slot = atoi(row[r++]); // equip_slot,
|
pcs->items[i].equip_slot = atoi(row[r++]); // equip_slot,
|
||||||
pcs->items[i].item_id = atoi(row[r++]); // item_id,
|
pcs->items[i].item_id = atoll(row[r++]); // item_id,
|
||||||
pcs->items[i].charges = atoi(row[r++]); // charges,
|
pcs->items[i].charges = atoi(row[r++]); // charges,
|
||||||
pcs->items[i].aug_1 = atoi(row[r++]); // aug_1,
|
pcs->items[i].aug_1 = atoi(row[r++]); // aug_1,
|
||||||
pcs->items[i].aug_2 = atoi(row[r++]); // aug_2,
|
pcs->items[i].aug_2 = atoi(row[r++]); // aug_2,
|
||||||
@ -3836,6 +3827,7 @@ bool ZoneDatabase::LoadCharacterCorpseData(uint32 corpse_id, PlayerCorpse_Struct
|
|||||||
r = 0;
|
r = 0;
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3849,7 +3841,7 @@ Corpse* ZoneDatabase::SummonBuriedCharacterCorpses(uint32 char_id, uint32 dest_z
|
|||||||
|
|
||||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||||
NewCorpse = Corpse::LoadFromDBData(
|
NewCorpse = Corpse::LoadFromDBData(
|
||||||
atoi(row[0]), // uint32 in_dbid
|
atoll(row[0]), // uint32 in_dbid
|
||||||
char_id, // uint32 in_charid
|
char_id, // uint32 in_charid
|
||||||
row[1], // char* in_charname
|
row[1], // char* in_charname
|
||||||
dest_x, // float in_x
|
dest_x, // float in_x
|
||||||
@ -3891,7 +3883,7 @@ bool ZoneDatabase::SummonAllCharacterCorpses(uint32 char_id, uint32 dest_zone_id
|
|||||||
|
|
||||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||||
NewCorpse = Corpse::LoadFromDBData(
|
NewCorpse = Corpse::LoadFromDBData(
|
||||||
atoi(row[0]),
|
atoll(row[0]),
|
||||||
char_id,
|
char_id,
|
||||||
row[1],
|
row[1],
|
||||||
dest_x,
|
dest_x,
|
||||||
@ -3936,8 +3928,8 @@ Corpse* ZoneDatabase::LoadCharacterCorpse(uint32 player_corpse_id) {
|
|||||||
auto results = QueryDatabase(query);
|
auto results = QueryDatabase(query);
|
||||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||||
NewCorpse = Corpse::LoadFromDBData(
|
NewCorpse = Corpse::LoadFromDBData(
|
||||||
atoi(row[0]), // id uint32 in_dbid
|
atoll(row[0]), // id uint32 in_dbid
|
||||||
atoi(row[1]), // charid uint32 in_charid
|
atoll(row[1]), // charid uint32 in_charid
|
||||||
row[2], // char_name
|
row[2], // char_name
|
||||||
atof(row[3]), // x float in_x
|
atof(row[3]), // x float in_x
|
||||||
atof(row[4]), // y float in_y
|
atof(row[4]), // y float in_y
|
||||||
@ -3954,28 +3946,30 @@ Corpse* ZoneDatabase::LoadCharacterCorpse(uint32 player_corpse_id) {
|
|||||||
|
|
||||||
bool ZoneDatabase::LoadCharacterCorpses(uint32 zone_id, uint16 instance_id) {
|
bool ZoneDatabase::LoadCharacterCorpses(uint32 zone_id, uint16 instance_id) {
|
||||||
std::string query;
|
std::string query;
|
||||||
if (!RuleB(Zone, EnableShadowrest))
|
if (!RuleB(Zone, EnableShadowrest)){
|
||||||
query = StringFormat("SELECT id, charid, charname, x, y, z, heading, time_of_death, is_rezzed, was_at_graveyard FROM character_corpses WHERE zone_id='%u' AND instance_id='%u'", zone_id, instance_id);
|
query = StringFormat("SELECT id, charid, charname, x, y, z, heading, time_of_death, is_rezzed, was_at_graveyard FROM character_corpses WHERE zone_id='%u' AND instance_id='%u'", zone_id, instance_id);
|
||||||
else
|
}
|
||||||
|
else{
|
||||||
query = StringFormat("SELECT id, charid, charname, x, y, z, heading, time_of_death, is_rezzed, 0 as was_at_graveyard FROM character_corpses WHERE zone_id='%u' AND instance_id='%u' AND is_buried=0", zone_id, instance_id);
|
query = StringFormat("SELECT id, charid, charname, x, y, z, heading, time_of_death, is_rezzed, 0 as was_at_graveyard FROM character_corpses WHERE zone_id='%u' AND instance_id='%u' AND is_buried=0", zone_id, instance_id);
|
||||||
|
}
|
||||||
|
|
||||||
auto results = QueryDatabase(query);
|
auto results = QueryDatabase(query);
|
||||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||||
std::cout << row[0] << std::endl;
|
// std::cout << row[0] << std::endl;
|
||||||
std::cout << row[1] << std::endl;
|
// std::cout << row[1] << std::endl;
|
||||||
std::cout << row[2] << std::endl;
|
// std::cout << row[2] << std::endl;
|
||||||
std::cout << row[3] << std::endl;
|
// std::cout << row[3] << std::endl;
|
||||||
std::cout << row[4] << std::endl;
|
// std::cout << row[4] << std::endl;
|
||||||
std::cout << row[5] << std::endl;
|
// std::cout << row[5] << std::endl;
|
||||||
std::cout << row[6] << std::endl;
|
// std::cout << row[6] << std::endl;
|
||||||
std::cout << row[7] << std::endl;
|
// std::cout << row[7] << std::endl;
|
||||||
std::cout << row[8] << std::endl;
|
// std::cout << row[8] << std::endl;
|
||||||
std::cout << row[9] << std::endl;
|
// std::cout << row[9] << std::endl;
|
||||||
|
|
||||||
entity_list.AddCorpse(
|
entity_list.AddCorpse(
|
||||||
Corpse::LoadFromDBData(
|
Corpse::LoadFromDBData(
|
||||||
atoi(row[0]), // id uint32 in_dbid
|
atoll(row[0]), // id uint32 in_dbid
|
||||||
atoi(row[1]), // charid uint32 in_charid
|
atoll(row[1]), // charid uint32 in_charid
|
||||||
row[2], // char_name
|
row[2], // char_name
|
||||||
atof(row[3]), // x float in_x
|
atof(row[3]), // x float in_x
|
||||||
atof(row[4]), // y float in_y
|
atof(row[4]), // y float in_y
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user