mirror of
https://github.com/EQEmu/Server.git
synced 2026-06-16 05:38:27 +00:00
RunQuery now uses a string instead of a char* for the error buffer.
This commit is contained in:
+28
-28
@@ -1465,13 +1465,13 @@ void Zone::LoadAAs() {
|
||||
|
||||
bool ZoneDatabase::LoadAAEffects2() {
|
||||
aa_effects.clear(); //start fresh
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
std::string errbuf;
|
||||
MYSQL_RES *result;
|
||||
MYSQL_ROW row;
|
||||
|
||||
std::string query = "SELECT aaid, slot, effectid, base1, base2 FROM aa_effects ORDER BY aaid ASC, slot ASC";
|
||||
|
||||
if (RunQuery(query, errbuf, &result)) {
|
||||
if (RunQuery(query, &errbuf, &result)) {
|
||||
int count = 0;
|
||||
while((row = mysql_fetch_row(result))!= nullptr) {
|
||||
int aaid = atoi(row[0]);
|
||||
@@ -1489,7 +1489,7 @@ bool ZoneDatabase::LoadAAEffects2() {
|
||||
if (count < 1) //no results
|
||||
LogFile->write(EQEMuLog::Error, "Error loading AA Effects, none found in the database.");
|
||||
} else {
|
||||
LogFile->write(EQEMuLog::Error, "Error in ZoneDatabase::LoadAAEffects2 query: '%s': %s", query.c_str(), errbuf);
|
||||
LogFile->write(EQEMuLog::Error, "Error in ZoneDatabase::LoadAAEffects2 query: '%s': %s", query.c_str(), errbuf.c_str());
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@@ -1633,7 +1633,7 @@ void Client::InspectBuffs(Client* Inspector, int Rank)
|
||||
|
||||
//this really need to be renamed to LoadAAActions()
|
||||
bool ZoneDatabase::LoadAAEffects() {
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
std::string errbuf;
|
||||
MYSQL_RES *result;
|
||||
MYSQL_ROW row;
|
||||
|
||||
@@ -1642,7 +1642,7 @@ bool ZoneDatabase::LoadAAEffects() {
|
||||
std::string query = "SELECT aaid,rank,reuse_time,spell_id,target,nonspell_action,nonspell_mana,nonspell_duration,"
|
||||
"redux_aa,redux_rate,redux_aa2,redux_rate2 FROM aa_actions";
|
||||
|
||||
if(RunQuery(query, errbuf, &result)) {
|
||||
if(RunQuery(query, &errbuf, &result)) {
|
||||
int r;
|
||||
while ((row = mysql_fetch_row(result))) {
|
||||
r = 0;
|
||||
@@ -1667,7 +1667,7 @@ bool ZoneDatabase::LoadAAEffects() {
|
||||
mysql_free_result(result);
|
||||
}
|
||||
else {
|
||||
LogFile->write(EQEMuLog::Error, "Error in LoadAAEffects query '%s': %s", query.c_str(), errbuf);
|
||||
LogFile->write(EQEMuLog::Error, "Error in LoadAAEffects query '%s': %s", query.c_str(), errbuf.c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1681,7 +1681,7 @@ bool ZoneDatabase::LoadAAEffects() {
|
||||
|
||||
//AndMetal: this may now be obsolete since we have Zone::GetTotalAALevels()
|
||||
uint8 ZoneDatabase::GetTotalAALevels(uint32 skill_id) {
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
std::string errbuf;
|
||||
std::string query;
|
||||
MYSQL_RES *result;
|
||||
MYSQL_ROW row;
|
||||
@@ -1689,14 +1689,14 @@ uint8 ZoneDatabase::GetTotalAALevels(uint32 skill_id) {
|
||||
|
||||
StringFormat(query,"SELECT count(slot) from aa_effects where aaid=%i", skill_id);
|
||||
|
||||
if (RunQuery(query, errbuf, &result)) {
|
||||
if (RunQuery(query, &errbuf, &result)) {
|
||||
if (mysql_num_rows(result) == 1) {
|
||||
row = mysql_fetch_row(result);
|
||||
total=atoi(row[0]);
|
||||
}
|
||||
mysql_free_result(result);
|
||||
} else {
|
||||
LogFile->write(EQEMuLog::Error, "Error in GetTotalAALevels '%s: %s", query.c_str(), errbuf);
|
||||
LogFile->write(EQEMuLog::Error, "Error in GetTotalAALevels '%s: %s", query.c_str(), errbuf.c_str());
|
||||
}
|
||||
return total;
|
||||
}
|
||||
@@ -1726,7 +1726,7 @@ void ZoneDatabase::FillAAEffects(SendAA_Struct* aa_struct){
|
||||
if(!aa_struct)
|
||||
return;
|
||||
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
std::string errbuf;
|
||||
std::string query;
|
||||
MYSQL_RES *result;
|
||||
MYSQL_ROW row;
|
||||
@@ -1734,7 +1734,7 @@ void ZoneDatabase::FillAAEffects(SendAA_Struct* aa_struct){
|
||||
StringFormat(query,"SELECT effectid, base1, base2, slot from aa_effects "
|
||||
"where aaid=%i order by slot asc", aa_struct->id);
|
||||
|
||||
if (RunQuery(query, errbuf, &result)) {
|
||||
if (RunQuery(query, &errbuf, &result)) {
|
||||
int ndx=0;
|
||||
while((row = mysql_fetch_row(result))!=nullptr) {
|
||||
aa_struct->abilities[ndx].skill_id=atoi(row[0]);
|
||||
@@ -1745,43 +1745,43 @@ void ZoneDatabase::FillAAEffects(SendAA_Struct* aa_struct){
|
||||
}
|
||||
mysql_free_result(result);
|
||||
} else {
|
||||
LogFile->write(EQEMuLog::Error, "Error in Client::FillAAEffects query: '%s': %s", query.c_str(), errbuf);
|
||||
LogFile->write(EQEMuLog::Error, "Error in Client::FillAAEffects query: '%s': %s", query.c_str(), errbuf.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
uint32 ZoneDatabase::CountAAs(){
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
std::string errbuf;
|
||||
MYSQL_RES *result;
|
||||
MYSQL_ROW row;
|
||||
int count=0;
|
||||
|
||||
std::string query = "SELECT count(title_sid) from altadv_vars";
|
||||
|
||||
if (RunQuery(query, errbuf, &result)) {
|
||||
if (RunQuery(query, &errbuf, &result)) {
|
||||
if((row = mysql_fetch_row(result))!=nullptr)
|
||||
count = atoi(row[0]);
|
||||
mysql_free_result(result);
|
||||
} else {
|
||||
LogFile->write(EQEMuLog::Error, "Error in ZoneDatabase::CountAAs query '%s': %s", query.c_str(), errbuf);
|
||||
LogFile->write(EQEMuLog::Error, "Error in ZoneDatabase::CountAAs query '%s': %s", query.c_str(), errbuf.c_str());
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
uint32 ZoneDatabase::CountAAEffects(){
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
std::string errbuf;
|
||||
MYSQL_RES *result;
|
||||
MYSQL_ROW row;
|
||||
int count=0;
|
||||
|
||||
std::string query = "SELECT count(id) from aa_effects";
|
||||
|
||||
if (RunQuery(query, errbuf, &result)) {
|
||||
if (RunQuery(query, &errbuf, &result)) {
|
||||
if((row = mysql_fetch_row(result))!=nullptr){
|
||||
count = atoi(row[0]);
|
||||
}
|
||||
mysql_free_result(result);
|
||||
} else {
|
||||
LogFile->write(EQEMuLog::Error, "Error in ZoneDatabase::CountAALevels query '%s': %s", query.c_str(), errbuf);
|
||||
LogFile->write(EQEMuLog::Error, "Error in ZoneDatabase::CountAALevels query '%s': %s", query.c_str(), errbuf.c_str());
|
||||
}
|
||||
return count;
|
||||
}
|
||||
@@ -1796,13 +1796,13 @@ uint32 ZoneDatabase::GetSizeAA(){
|
||||
void ZoneDatabase::LoadAAs(SendAA_Struct **load){
|
||||
if(!load)
|
||||
return;
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
std::string errbuf;
|
||||
MYSQL_RES *result;
|
||||
MYSQL_ROW row;
|
||||
|
||||
std::string query = "SELECT skill_id from altadv_vars order by skill_id";
|
||||
|
||||
if (RunQuery(query, errbuf, &result)) {
|
||||
if (RunQuery(query, &errbuf, &result)) {
|
||||
int skill=0,ndx=0;
|
||||
while((row = mysql_fetch_row(result))!=nullptr) {
|
||||
skill=atoi(row[0]);
|
||||
@@ -1812,14 +1812,14 @@ void ZoneDatabase::LoadAAs(SendAA_Struct **load){
|
||||
}
|
||||
mysql_free_result(result);
|
||||
} else {
|
||||
LogFile->write(EQEMuLog::Error, "Error in ZoneDatabase::LoadAAs query '%s': %s", query.c_str(), errbuf);
|
||||
LogFile->write(EQEMuLog::Error, "Error in ZoneDatabase::LoadAAs query '%s': %s", query.c_str(), errbuf.c_str());
|
||||
}
|
||||
|
||||
AARequiredLevelAndCost.clear();
|
||||
|
||||
query = "SELECT skill_id, level, cost from aa_required_level_cost order by skill_id";
|
||||
|
||||
if (RunQuery(query, errbuf, &result))
|
||||
if (RunQuery(query, &errbuf, &result))
|
||||
{
|
||||
AALevelCost_Struct aalcs;
|
||||
while((row = mysql_fetch_row(result))!=nullptr)
|
||||
@@ -1831,18 +1831,18 @@ void ZoneDatabase::LoadAAs(SendAA_Struct **load){
|
||||
mysql_free_result(result);
|
||||
}
|
||||
else
|
||||
LogFile->write(EQEMuLog::Error, "Error in ZoneDatabase::LoadAAs query '%s': %s", query.c_str(), errbuf);
|
||||
LogFile->write(EQEMuLog::Error, "Error in ZoneDatabase::LoadAAs query '%s': %s", query.c_str(), errbuf.c_str());
|
||||
}
|
||||
|
||||
SendAA_Struct* ZoneDatabase::GetAASkillVars(uint32 skill_id)
|
||||
{
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
std::string errbuf;
|
||||
SendAA_Struct* sendaa = nullptr;
|
||||
uchar* buffer;
|
||||
|
||||
std::string query = "SET @row = 0";
|
||||
|
||||
if (RunQuery(query, errbuf)) { //initialize "row" variable in database for next query
|
||||
if (RunQuery(query, &errbuf)) { //initialize "row" variable in database for next query
|
||||
MYSQL_RES *result; //we don't really need these unless we get to this point, so why bother?
|
||||
MYSQL_ROW row;
|
||||
|
||||
@@ -1880,7 +1880,7 @@ SendAA_Struct* ZoneDatabase::GetAASkillVars(uint32 skill_id)
|
||||
"a.sof_next_id, a.level_inc "
|
||||
" FROM altadv_vars a WHERE skill_id=%i", skill_id);
|
||||
|
||||
if (RunQuery(query, errbuf, &result)) {
|
||||
if (RunQuery(query, &errbuf, &result)) {
|
||||
if (mysql_num_rows(result) == 1) {
|
||||
int total_abilities = GetTotalAALevels(skill_id); //eventually we'll want to use zone->GetTotalAALevels(skill_id) since it should save queries to the DB
|
||||
int totalsize = total_abilities * sizeof(AA_Ability) + sizeof(SendAA_Struct);
|
||||
@@ -1937,10 +1937,10 @@ SendAA_Struct* ZoneDatabase::GetAASkillVars(uint32 skill_id)
|
||||
}
|
||||
mysql_free_result(result);
|
||||
} else {
|
||||
LogFile->write(EQEMuLog::Error, "Error in GetAASkillVars '%s': %s", query.c_str(), errbuf);
|
||||
LogFile->write(EQEMuLog::Error, "Error in GetAASkillVars '%s': %s", query.c_str(), errbuf.c_str());
|
||||
}
|
||||
} else {
|
||||
LogFile->write(EQEMuLog::Error, "Error in GetAASkillVars '%s': %s", query.c_str(), errbuf);
|
||||
LogFile->write(EQEMuLog::Error, "Error in GetAASkillVars '%s': %s", query.c_str(), errbuf.c_str());
|
||||
}
|
||||
return sendaa;
|
||||
}
|
||||
|
||||
+5
-5
@@ -2329,14 +2329,14 @@ DBnpcspells_Struct* ZoneDatabase::GetNPCSpells(uint32 iDBSpellsID) {
|
||||
}
|
||||
else if (!npc_spells_loadtried[iDBSpellsID]) { // no reason to ask the DB again if we have failed once already
|
||||
npc_spells_loadtried[iDBSpellsID] = true;
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
std::string errbuf;
|
||||
std::string query;
|
||||
MYSQL_RES *result;
|
||||
MYSQL_ROW row;
|
||||
|
||||
StringFormat(query, "SELECT id, parent_list, attack_proc, proc_chance from npc_spells where id=%d", iDBSpellsID);
|
||||
|
||||
if (RunQuery(query, errbuf, &result)) {
|
||||
if (RunQuery(query, &errbuf, &result)) {
|
||||
if (mysql_num_rows(result) == 1) {
|
||||
row = mysql_fetch_row(result);
|
||||
uint32 tmpparent_list = atoi(row[1]);
|
||||
@@ -2349,7 +2349,7 @@ DBnpcspells_Struct* ZoneDatabase::GetNPCSpells(uint32 iDBSpellsID) {
|
||||
"where npc_spells_id=%d ORDER BY minlevel",
|
||||
iDBSpellsID);
|
||||
|
||||
if (RunQuery(query, errbuf, &result)) {
|
||||
if (RunQuery(query, &errbuf, &result)) {
|
||||
uint32 tmpSize = sizeof(DBnpcspells_Struct) + (sizeof(DBnpcspells_entries_Struct) * mysql_num_rows(result));
|
||||
npc_spells_cache[iDBSpellsID] = (DBnpcspells_Struct*) new uchar[tmpSize];
|
||||
memset(npc_spells_cache[iDBSpellsID], 0, tmpSize);
|
||||
@@ -2403,13 +2403,13 @@ DBnpcspells_Struct* ZoneDatabase::GetNPCSpells(uint32 iDBSpellsID) {
|
||||
}
|
||||
|
||||
uint32 ZoneDatabase::GetMaxNPCSpellsID() {
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
std::string errbuf;
|
||||
MYSQL_RES *result;
|
||||
MYSQL_ROW row;
|
||||
|
||||
std::string query = "SELECT max(id) from npc_spells";
|
||||
|
||||
if (RunQuery(query,errbuf, &result)) {
|
||||
if (RunQuery(query, &errbuf, &result)) {
|
||||
if (mysql_num_rows(result) == 1) {
|
||||
row = mysql_fetch_row(result);
|
||||
uint32 ret = 0;
|
||||
|
||||
+11
-11
@@ -558,7 +558,7 @@ bool Object::HandleClick(Client* sender, const ClickObject_Struct* click_object)
|
||||
// Add new Zone Object (theoretically only called for items dropped to ground)
|
||||
uint32 ZoneDatabase::AddObject(uint32 type, uint32 icon, const Object_Struct& object, const ItemInst* inst)
|
||||
{
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
std::string errbuf;
|
||||
std::string query;
|
||||
|
||||
uint32 database_id = 0;
|
||||
@@ -581,8 +581,8 @@ uint32 ZoneDatabase::AddObject(uint32 type, uint32 icon, const Object_Struct& ob
|
||||
item_id, charges, object_name.c_str(), type, icon);
|
||||
|
||||
// Save new record for object
|
||||
if (!RunQuery(query, errbuf, nullptr, nullptr, &database_id)) {
|
||||
LogFile->write(EQEMuLog::Error, "Unable to insert object: %s", errbuf);
|
||||
if (!RunQuery(query, &errbuf, nullptr, nullptr, &database_id)) {
|
||||
LogFile->write(EQEMuLog::Error, "Unable to insert object: %s", errbuf.c_str());
|
||||
}
|
||||
else {
|
||||
// Save container contents, if container
|
||||
@@ -597,7 +597,7 @@ uint32 ZoneDatabase::AddObject(uint32 type, uint32 icon, const Object_Struct& ob
|
||||
// Update information about existing object in database
|
||||
void ZoneDatabase::UpdateObject(uint32 id, uint32 type, uint32 icon, const Object_Struct& object, const ItemInst* inst)
|
||||
{
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
std::string errbuf;
|
||||
std::string query;
|
||||
|
||||
uint32 item_id = 0;
|
||||
@@ -619,8 +619,8 @@ void ZoneDatabase::UpdateObject(uint32 id, uint32 type, uint32 icon, const Objec
|
||||
item_id, charges, object_name.c_str(), type, icon, id);
|
||||
|
||||
// Save new record for object
|
||||
if (!RunQuery(query, errbuf)) {
|
||||
LogFile->write(EQEMuLog::Error, "Unable to update object: %s", errbuf);
|
||||
if (!RunQuery(query, &errbuf)) {
|
||||
LogFile->write(EQEMuLog::Error, "Unable to update object: %s", errbuf.c_str());
|
||||
}
|
||||
else {
|
||||
// Save container contents, if container
|
||||
@@ -631,7 +631,7 @@ void ZoneDatabase::UpdateObject(uint32 id, uint32 type, uint32 icon, const Objec
|
||||
|
||||
}
|
||||
Ground_Spawns* ZoneDatabase::LoadGroundSpawns(uint32 zone_id, int16 version, Ground_Spawns* gs){
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
std::string errbuf;
|
||||
std::string query;
|
||||
MYSQL_RES *result;
|
||||
MYSQL_ROW row;
|
||||
@@ -642,7 +642,7 @@ Ground_Spawns* ZoneDatabase::LoadGroundSpawns(uint32 zone_id, int16 version, Gro
|
||||
"(version=%u OR version=-1) limit 50",
|
||||
zone_id, version);
|
||||
|
||||
if (RunQuery(query, errbuf, &result))
|
||||
if (RunQuery(query, &errbuf, &result))
|
||||
{
|
||||
int i=0;
|
||||
while( (row=mysql_fetch_row(result) ) ) {
|
||||
@@ -667,14 +667,14 @@ Ground_Spawns* ZoneDatabase::LoadGroundSpawns(uint32 zone_id, int16 version, Gro
|
||||
}
|
||||
void ZoneDatabase::DeleteObject(uint32 id)
|
||||
{
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
std::string errbuf;
|
||||
std::string query;
|
||||
|
||||
// Save new record for object
|
||||
StringFormat(query,"delete from object where id=%i", id);
|
||||
|
||||
if (!RunQuery(query, errbuf)) {
|
||||
LogFile->write(EQEMuLog::Error, "Unable to delete object: %s", errbuf);
|
||||
if (!RunQuery(query, &errbuf)) {
|
||||
LogFile->write(EQEMuLog::Error, "Unable to delete object: %s", errbuf.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+48
-48
@@ -1445,14 +1445,14 @@ void Corpse::Spawn() {
|
||||
}
|
||||
|
||||
bool ZoneDatabase::DeleteGraveyard(uint32 zone_id, uint32 graveyard_id) {
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
std::string errbuf;
|
||||
std::string query;
|
||||
uint32 query_length = 0;
|
||||
uint32 affected_rows = 0;
|
||||
|
||||
StringFormat(query, "UPDATE zone SET graveyard_id=0 WHERE zoneidnumber=%u AND version=0", zone_id);
|
||||
|
||||
if (!RunQuery(query, errbuf, 0, &affected_rows)) {
|
||||
if (!RunQuery(query, &errbuf, nullptr, &affected_rows)) {
|
||||
std::cerr << "Error1 in DeleteGraveyard query " << errbuf << std::endl;
|
||||
return false;
|
||||
}
|
||||
@@ -1464,7 +1464,7 @@ bool ZoneDatabase::DeleteGraveyard(uint32 zone_id, uint32 graveyard_id) {
|
||||
|
||||
StringFormat(query,"DELETE FROM graveyard WHERE id=%u", graveyard_id);
|
||||
|
||||
if (!RunQuery(query,errbuf, 0, &affected_rows)) {
|
||||
if (!RunQuery(query, &errbuf, nullptr, &affected_rows)) {
|
||||
std::cerr << "Error3 in DeleteGraveyard query " << errbuf << std::endl;
|
||||
return false;
|
||||
}
|
||||
@@ -1477,7 +1477,7 @@ bool ZoneDatabase::DeleteGraveyard(uint32 zone_id, uint32 graveyard_id) {
|
||||
return true;
|
||||
}
|
||||
uint32 ZoneDatabase::AddGraveyardIDToZone(uint32 zone_id, uint32 graveyard_id) {
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
std::string errbuf;
|
||||
std::string query;
|
||||
uint32 affected_rows = 0;
|
||||
|
||||
@@ -1485,7 +1485,7 @@ uint32 ZoneDatabase::AddGraveyardIDToZone(uint32 zone_id, uint32 graveyard_id) {
|
||||
"WHERE zoneidnumber=%u AND version=0",
|
||||
graveyard_id, zone_id);
|
||||
|
||||
if (!RunQuery(query,errbuf, 0, &affected_rows)) {
|
||||
if (!RunQuery(query, &errbuf, nullptr, &affected_rows)) {
|
||||
std::cerr << "Error1 in AddGraveyardIDToZone query " << errbuf << std::endl;
|
||||
return 0;
|
||||
}
|
||||
@@ -1498,7 +1498,7 @@ uint32 ZoneDatabase::AddGraveyardIDToZone(uint32 zone_id, uint32 graveyard_id) {
|
||||
return zone_id;
|
||||
}
|
||||
uint32 ZoneDatabase::NewGraveyardRecord(uint32 graveyard_zoneid, float graveyard_x, float graveyard_y, float graveyard_z, float graveyard_heading) {
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
std::string errbuf;
|
||||
std::string query;
|
||||
uint32 affected_rows = 0;
|
||||
uint32 new_graveyard_id = 0;
|
||||
@@ -1506,7 +1506,7 @@ uint32 ZoneDatabase::NewGraveyardRecord(uint32 graveyard_zoneid, float graveyard
|
||||
StringFormat(query, "INSERT INTO graveyard SET zone_id=%u, x=%1.1f, y=%1.1f, z=%1.1f, heading=%1.1f",
|
||||
graveyard_zoneid, graveyard_x, graveyard_y, graveyard_z, graveyard_heading);
|
||||
|
||||
if (!RunQuery(query, errbuf, 0, &affected_rows, &new_graveyard_id)) {
|
||||
if (!RunQuery(query, &errbuf, nullptr, &affected_rows, &new_graveyard_id)) {
|
||||
std::cerr << "Error1 in NewGraveyardRecord query " << errbuf << std::endl;
|
||||
return 0;
|
||||
}
|
||||
@@ -1525,7 +1525,7 @@ uint32 ZoneDatabase::NewGraveyardRecord(uint32 graveyard_zoneid, float graveyard
|
||||
}
|
||||
|
||||
uint32 ZoneDatabase::GraveyardPlayerCorpse(uint32 dbid, uint32 zoneid, uint16 instanceid, float x, float y, float z, float heading) {
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
std::string errbuf;
|
||||
std::string query;
|
||||
uint32 affected_rows = 0;
|
||||
|
||||
@@ -1535,7 +1535,7 @@ uint32 ZoneDatabase::GraveyardPlayerCorpse(uint32 dbid, uint32 zoneid, uint16 in
|
||||
"WasAtGraveyard=1 WHERE id=%d",
|
||||
zoneid, x, y, z, heading, dbid);
|
||||
|
||||
if (!RunQuery(query, errbuf, 0, &affected_rows)) {
|
||||
if (!RunQuery(query, &errbuf, nullptr, &affected_rows)) {
|
||||
std::cerr << "Error1 in GraveyardPlayerCorpse query " << errbuf << std::endl;
|
||||
return 0;
|
||||
}
|
||||
@@ -1548,7 +1548,7 @@ uint32 ZoneDatabase::GraveyardPlayerCorpse(uint32 dbid, uint32 zoneid, uint16 in
|
||||
}
|
||||
|
||||
uint32 ZoneDatabase::UpdatePlayerCorpse(uint32 dbid, uint32 charid, const char* charname, uint32 zoneid, uint16 instanceid, uchar* data, uint32 datasize, float x, float y, float z, float heading, bool rezzed) {
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
std::string errbuf;
|
||||
std::string query;
|
||||
std::string dataSection;
|
||||
std::string endOfQuery;
|
||||
@@ -1568,7 +1568,7 @@ uint32 ZoneDatabase::UpdatePlayerCorpse(uint32 dbid, uint32 charid, const char*
|
||||
|
||||
query.append(endOfQuery);
|
||||
|
||||
if (!RunQuery(query, errbuf, 0, &affected_rows)) {
|
||||
if (!RunQuery(query, &errbuf, nullptr, &affected_rows)) {
|
||||
std::cerr << "Error1 in UpdatePlayerCorpse query " << errbuf << std::endl;
|
||||
return 0;
|
||||
}
|
||||
@@ -1581,7 +1581,7 @@ uint32 ZoneDatabase::UpdatePlayerCorpse(uint32 dbid, uint32 charid, const char*
|
||||
|
||||
StringFormat(query,"update player_corpses set rezzed = 1 WHERE id=%d",dbid);
|
||||
|
||||
if (!RunQuery(query, errbuf)) {
|
||||
if (!RunQuery(query, &errbuf)) {
|
||||
std::cerr << "Error in UpdatePlayerCorpse/Rezzed query: " << errbuf << std::endl;
|
||||
}
|
||||
}
|
||||
@@ -1590,19 +1590,19 @@ uint32 ZoneDatabase::UpdatePlayerCorpse(uint32 dbid, uint32 charid, const char*
|
||||
|
||||
void ZoneDatabase::MarkCorpseAsRezzed(uint32 dbid)
|
||||
{
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
std::string errbuf;
|
||||
std::string query;
|
||||
|
||||
StringFormat(query,"UPDATE player_corpses SET rezzed = 1 WHERE id = %i", dbid);
|
||||
|
||||
if(!database.RunQuery(query, errbuf))
|
||||
if(!database.RunQuery(query, &errbuf))
|
||||
{
|
||||
LogFile->write(EQEMuLog::Error, "MarkCorpseAsRezzed failed: %s, %s", query.c_str(), errbuf);
|
||||
LogFile->write(EQEMuLog::Error, "MarkCorpseAsRezzed failed: %s, %s", query.c_str(), errbuf.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
uint32 ZoneDatabase::CreatePlayerCorpse(uint32 charid, const char* charname, uint32 zoneid, uint16 instanceid, uchar* data, uint32 datasize, float x, float y, float z, float heading) {
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
std::string errbuf;
|
||||
std::string dataSection;
|
||||
uint32 affected_rows = 0;
|
||||
uint32 last_insert_id = 0;
|
||||
@@ -1620,7 +1620,7 @@ uint32 ZoneDatabase::CreatePlayerCorpse(uint32 charid, const char* charname, uin
|
||||
charname, zoneid, instanceid, charid, x, y, z, heading);
|
||||
query.append(endOfQuery);
|
||||
|
||||
if (!RunQuery(query, errbuf, 0, &affected_rows, &last_insert_id)) {
|
||||
if (!RunQuery(query, &errbuf, nullptr, &affected_rows, &last_insert_id)) {
|
||||
std::cerr << "Error1 in CreatePlayerCorpse query " << errbuf << std::endl;
|
||||
return 0;
|
||||
}
|
||||
@@ -1639,7 +1639,7 @@ uint32 ZoneDatabase::CreatePlayerCorpse(uint32 charid, const char* charname, uin
|
||||
}
|
||||
|
||||
bool ZoneDatabase::CreatePlayerCorpseBackup(uint32 dbid, uint32 charid, const char* charname, uint32 zoneid, uint16 instanceid, uchar* data, uint32 datasize, float x, float y, float z, float heading) {
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
std::string errbuf;
|
||||
std::string query;
|
||||
std::string dataSection;
|
||||
uint32 affected_rows = 0;
|
||||
@@ -1666,7 +1666,7 @@ bool ZoneDatabase::CreatePlayerCorpseBackup(uint32 dbid, uint32 charid, const ch
|
||||
|
||||
query.append(endOfQuery);
|
||||
|
||||
if (RunQuery(query, errbuf, 0, &affected_rows)) {
|
||||
if (RunQuery(query, &errbuf, nullptr, &affected_rows)) {
|
||||
if (affected_rows == 1)
|
||||
result = true;
|
||||
else
|
||||
@@ -1683,7 +1683,7 @@ bool ZoneDatabase::CreatePlayerCorpseBackup(uint32 dbid, uint32 charid, const ch
|
||||
}
|
||||
|
||||
uint32 ZoneDatabase::GetPlayerBurriedCorpseCount(uint32 char_id) {
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
std::string errbuf;
|
||||
std::string query;
|
||||
MYSQL_RES *result;
|
||||
MYSQL_ROW row;
|
||||
@@ -1692,7 +1692,7 @@ uint32 ZoneDatabase::GetPlayerBurriedCorpseCount(uint32 char_id) {
|
||||
StringFormat(query,"select count(*) from player_corpses "
|
||||
"where charid = '%u' and IsBurried = 1", char_id);
|
||||
|
||||
if (RunQuery(query, errbuf, &result)) {
|
||||
if (RunQuery(query, &errbuf, &result)) {
|
||||
row = mysql_fetch_row(result);
|
||||
CorpseCount = atoi(row[0]);
|
||||
mysql_free_result(result);
|
||||
@@ -1705,7 +1705,7 @@ uint32 ZoneDatabase::GetPlayerBurriedCorpseCount(uint32 char_id) {
|
||||
}
|
||||
|
||||
uint32 ZoneDatabase::GetPlayerCorpseCount(uint32 char_id) {
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
std::string errbuf;
|
||||
std::string query;
|
||||
MYSQL_RES *result;
|
||||
MYSQL_ROW row;
|
||||
@@ -1713,7 +1713,7 @@ uint32 ZoneDatabase::GetPlayerCorpseCount(uint32 char_id) {
|
||||
|
||||
StringFormat(query,"select count(*) from player_corpses where charid = '%u'", char_id);
|
||||
|
||||
if (RunQuery(query, errbuf, &result)) {
|
||||
if (RunQuery(query, &errbuf, &result)) {
|
||||
row = mysql_fetch_row(result);
|
||||
CorpseCount = atoi(row[0]);
|
||||
mysql_free_result(result);
|
||||
@@ -1726,7 +1726,7 @@ uint32 ZoneDatabase::GetPlayerCorpseCount(uint32 char_id) {
|
||||
}
|
||||
|
||||
uint32 ZoneDatabase::GetPlayerCorpseID(uint32 char_id, uint8 corpse) {
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
std::string errbuf;
|
||||
std::string query;
|
||||
MYSQL_RES *result;
|
||||
MYSQL_ROW row;
|
||||
@@ -1734,7 +1734,7 @@ uint32 ZoneDatabase::GetPlayerCorpseID(uint32 char_id, uint8 corpse) {
|
||||
|
||||
StringFormat(query,"select id from player_corpses where charid = '%u'", char_id);
|
||||
|
||||
if (RunQuery(query, errbuf, &result)) {
|
||||
if (RunQuery(query, &errbuf, &result)) {
|
||||
for (int i=0; i<corpse;i++) {
|
||||
row = mysql_fetch_row(result);
|
||||
id = (uint32)atoi(row[0]);
|
||||
@@ -1760,7 +1760,7 @@ uint32 ZoneDatabase::GetPlayerCorpseItemAt(uint32 corpse_id, uint16 slotid) {
|
||||
}
|
||||
|
||||
Corpse* ZoneDatabase::SummonBurriedPlayerCorpse(uint32 char_id, uint32 dest_zoneid, uint16 dest_instanceid, float dest_x, float dest_y, float dest_z, float dest_heading) {
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
std::string errbuf;
|
||||
std::string query;
|
||||
MYSQL_RES *result;
|
||||
MYSQL_ROW row;
|
||||
@@ -1771,7 +1771,7 @@ Corpse* ZoneDatabase::SummonBurriedPlayerCorpse(uint32 char_id, uint32 dest_zone
|
||||
"FROM player_corpses WHERE charid='%u' AND "
|
||||
"IsBurried=1 ORDER BY timeofdeath LIMIT 1", char_id);
|
||||
|
||||
if (RunQuery(query, errbuf, &result)) {
|
||||
if (RunQuery(query, &errbuf, &result)) {
|
||||
row = mysql_fetch_row(result);
|
||||
lengths = mysql_fetch_lengths(result);
|
||||
if(row) {
|
||||
@@ -1799,7 +1799,7 @@ Corpse* ZoneDatabase::SummonBurriedPlayerCorpse(uint32 char_id, uint32 dest_zone
|
||||
bool ZoneDatabase::SummonAllPlayerCorpses(uint32 char_id, uint32 dest_zoneid, uint16 dest_instanceid,
|
||||
float dest_x, float dest_y, float dest_z, float dest_heading)
|
||||
{
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
std::string errbuf;
|
||||
std::string query;
|
||||
MYSQL_RES *result;
|
||||
MYSQL_ROW row;
|
||||
@@ -1811,15 +1811,15 @@ bool ZoneDatabase::SummonAllPlayerCorpses(uint32 char_id, uint32 dest_zoneid, ui
|
||||
"heading = %f, IsBurried = 0, WasAtGraveyard = 0 WHERE charid = %i",
|
||||
dest_zoneid, dest_instanceid, dest_x, dest_y, dest_z, dest_heading, char_id);
|
||||
|
||||
if(!RunQuery(query, errbuf))
|
||||
LogFile->write(EQEMuLog::Error, "Error moving corpses, Query = %s, Error = %s\n", query.c_str(), errbuf);
|
||||
if(!RunQuery(query, &errbuf))
|
||||
LogFile->write(EQEMuLog::Error, "Error moving corpses, Query = %s, Error = %s\n", query.c_str(), errbuf.c_str());
|
||||
|
||||
StringFormat(query,"SELECT id, charname, data, timeofdeath, rezzed "
|
||||
"FROM player_corpses WHERE charid='%u'"
|
||||
"ORDER BY timeofdeath",
|
||||
char_id);
|
||||
|
||||
if (RunQuery(query, errbuf, &result))
|
||||
if (RunQuery(query, &errbuf, &result))
|
||||
{
|
||||
while((row = mysql_fetch_row(result)))
|
||||
{
|
||||
@@ -1839,13 +1839,13 @@ bool ZoneDatabase::SummonAllPlayerCorpses(uint32 char_id, uint32 dest_zoneid, ui
|
||||
mysql_free_result(result);
|
||||
}
|
||||
else
|
||||
LogFile->write(EQEMuLog::Error, "Error in SummonAllPlayerCorpses Query = %s, Error = %s\n", query.c_str(), errbuf);
|
||||
LogFile->write(EQEMuLog::Error, "Error in SummonAllPlayerCorpses Query = %s, Error = %s\n", query.c_str(), errbuf.c_str());
|
||||
|
||||
return (CorpseCount > 0);
|
||||
}
|
||||
|
||||
bool ZoneDatabase::UnburyPlayerCorpse(uint32 dbid, uint32 new_zoneid, uint16 new_instanceid, float new_x, float new_y, float new_z, float new_heading) {
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
std::string errbuf;
|
||||
std::string query;
|
||||
uint32 affected_rows = 0;
|
||||
bool Result = false;
|
||||
@@ -1856,7 +1856,7 @@ bool ZoneDatabase::UnburyPlayerCorpse(uint32 dbid, uint32 new_zoneid, uint16 new
|
||||
new_zoneid, new_instanceid, new_x, new_y, new_z,
|
||||
new_heading, dbid);
|
||||
|
||||
if (RunQuery(query, errbuf, 0, &affected_rows)) {
|
||||
if (RunQuery(query, &errbuf, 0, &affected_rows)) {
|
||||
if (affected_rows == 1)
|
||||
Result = true;
|
||||
else
|
||||
@@ -1869,7 +1869,7 @@ bool ZoneDatabase::UnburyPlayerCorpse(uint32 dbid, uint32 new_zoneid, uint16 new
|
||||
}
|
||||
|
||||
Corpse* ZoneDatabase::LoadPlayerCorpse(uint32 player_corpse_id) {
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
std::string errbuf;
|
||||
std::string query;
|
||||
MYSQL_RES *result;
|
||||
MYSQL_ROW row;
|
||||
@@ -1881,7 +1881,7 @@ Corpse* ZoneDatabase::LoadPlayerCorpse(uint32 player_corpse_id) {
|
||||
"FROM player_corpses WHERE id='%u'",
|
||||
player_corpse_id);
|
||||
|
||||
if (RunQuery(query, errbuf, &result)) {
|
||||
if (RunQuery(query, &errbuf, &result)) {
|
||||
row = mysql_fetch_row(result);
|
||||
lengths = mysql_fetch_lengths(result);
|
||||
if(row && lengths)
|
||||
@@ -1900,7 +1900,7 @@ Corpse* ZoneDatabase::LoadPlayerCorpse(uint32 player_corpse_id) {
|
||||
}
|
||||
|
||||
bool ZoneDatabase::LoadPlayerCorpses(uint32 iZoneID, uint16 iInstanceID) {
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
std::string errbuf;
|
||||
std::string query;
|
||||
MYSQL_RES *result;
|
||||
MYSQL_ROW row;
|
||||
@@ -1924,7 +1924,7 @@ bool ZoneDatabase::LoadPlayerCorpses(uint32 iZoneID, uint16 iInstanceID) {
|
||||
iZoneID, iInstanceID);
|
||||
}
|
||||
|
||||
if (RunQuery(query, errbuf, &result)) {
|
||||
if (RunQuery(query, &errbuf, &result)) {
|
||||
while ((row = mysql_fetch_row(result))) {
|
||||
lengths = mysql_fetch_lengths(result);
|
||||
entity_list.AddCorpse(Corpse::LoadFromDBData(atoi(row[0]), atoi(row[1]), row[2], (uchar*) row[7], lengths[7], atof(row[3]), atoi(row[4]), atoi(row[5]), atoi(row[6]), row[8],atoi(row[9])==1, atoi(row[10])));
|
||||
@@ -1941,7 +1941,7 @@ bool ZoneDatabase::LoadPlayerCorpses(uint32 iZoneID, uint16 iInstanceID) {
|
||||
}
|
||||
|
||||
uint32 ZoneDatabase::GetFirstCorpseID(uint32 char_id) {
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
std::string errbuf;
|
||||
std::string query;
|
||||
MYSQL_RES *result;
|
||||
MYSQL_ROW row;
|
||||
@@ -1951,7 +1951,7 @@ uint32 ZoneDatabase::GetFirstCorpseID(uint32 char_id) {
|
||||
"AND IsBurried=0 ORDER BY timeofdeath LIMIT 1",
|
||||
char_id);
|
||||
|
||||
if (RunQuery(query, errbuf, &result)) {
|
||||
if (RunQuery(query, &errbuf, &result)) {
|
||||
if (mysql_num_rows(result)!= 0) {
|
||||
row = mysql_fetch_row(result);
|
||||
CorpseID = atoi(row[0]);
|
||||
@@ -1966,12 +1966,12 @@ uint32 ZoneDatabase::GetFirstCorpseID(uint32 char_id) {
|
||||
}
|
||||
|
||||
bool ZoneDatabase::BuryPlayerCorpse(uint32 dbid) {
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
std::string errbuf;
|
||||
std::string query;
|
||||
|
||||
StringFormat(query,"UPDATE player_corpses SET IsBurried = 1 WHERE id=%d", dbid);
|
||||
|
||||
if (!RunQuery(query, errbuf)) {
|
||||
if (!RunQuery(query, &errbuf)) {
|
||||
std::cerr << "Error in BuryPlayerCorpse query '" << query << "' " << errbuf << std::endl;
|
||||
return false;
|
||||
}
|
||||
@@ -1980,12 +1980,12 @@ bool ZoneDatabase::BuryPlayerCorpse(uint32 dbid) {
|
||||
}
|
||||
|
||||
bool ZoneDatabase::BuryAllPlayerCorpses(uint32 charid) {
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
std::string errbuf;
|
||||
std::string query;
|
||||
|
||||
StringFormat(query,"UPDATE player_corpses SET IsBurried = 1 WHERE charid=%d", charid);
|
||||
|
||||
if (!RunQuery(query, errbuf)) {
|
||||
if (!RunQuery(query, &errbuf)) {
|
||||
std::cerr << "Error in BuryPlayerCorpse query '" << query << "' " << errbuf << std::endl;
|
||||
return false;
|
||||
}
|
||||
@@ -1994,12 +1994,12 @@ bool ZoneDatabase::BuryAllPlayerCorpses(uint32 charid) {
|
||||
}
|
||||
|
||||
bool ZoneDatabase::DeletePlayerCorpse(uint32 dbid) {
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
std::string errbuf;
|
||||
std::string query;
|
||||
|
||||
StringFormat(query,"Delete from player_corpses where id=%d", dbid);
|
||||
|
||||
if (!RunQuery(query, errbuf)) {
|
||||
if (!RunQuery(query, &errbuf)) {
|
||||
std::cerr << "Error in DeletePlayerCorpse query '" << query << "' " << errbuf << std::endl;
|
||||
return false;
|
||||
}
|
||||
@@ -2057,7 +2057,7 @@ void Corpse::AddLooter(Mob* who)
|
||||
void Corpse::LoadPlayerCorpseDecayTime(uint32 dbid){
|
||||
if(!dbid)
|
||||
return;
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
std::string errbuf;
|
||||
std::string query;
|
||||
MYSQL_RES *result;
|
||||
MYSQL_ROW row;
|
||||
@@ -2066,7 +2066,7 @@ void Corpse::LoadPlayerCorpseDecayTime(uint32 dbid){
|
||||
"FROM player_corpses WHERE id=%d and not timeofdeath=0",
|
||||
dbid);
|
||||
|
||||
if (database.RunQuery(query, errbuf, &result)) {
|
||||
if (database.RunQuery(query, &errbuf, &result)) {
|
||||
while ((row = mysql_fetch_row(result))) {
|
||||
if(atoi(row[0]) > 0 && RuleI(Character, CorpseDecayTimeMS) > (atoi(row[0]) * 1000)) {
|
||||
corpse_decay_timer.SetTimer(RuleI(Character, CorpseDecayTimeMS) - (atoi(row[0]) * 1000));
|
||||
|
||||
+8
-8
@@ -139,7 +139,7 @@ void QGlobalCache::PurgeExpiredGlobals()
|
||||
|
||||
void QGlobalCache::LoadByNPCID(uint32 npcID)
|
||||
{
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
std::string errbuf;
|
||||
std::string query;
|
||||
MYSQL_RES *result;
|
||||
MYSQL_ROW row;
|
||||
@@ -147,7 +147,7 @@ void QGlobalCache::LoadByNPCID(uint32 npcID)
|
||||
StringFormat(query,"select name, charid, npcid, zoneid, value, expdate"
|
||||
" from quest_globals where npcid = %d", npcID);
|
||||
|
||||
if (database.RunQuery(query, errbuf, &result))
|
||||
if (database.RunQuery(query, &errbuf, &result))
|
||||
{
|
||||
while((row = mysql_fetch_row(result)))
|
||||
{
|
||||
@@ -159,7 +159,7 @@ void QGlobalCache::LoadByNPCID(uint32 npcID)
|
||||
|
||||
void QGlobalCache::LoadByCharID(uint32 charID)
|
||||
{
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
std::string errbuf;
|
||||
std::string query;
|
||||
MYSQL_RES *result;
|
||||
MYSQL_ROW row;
|
||||
@@ -168,7 +168,7 @@ void QGlobalCache::LoadByCharID(uint32 charID)
|
||||
"quest_globals where charid = %d && npcid = 0",
|
||||
charID);
|
||||
|
||||
if (database.RunQuery(query, errbuf, &result))
|
||||
if (database.RunQuery(query, &errbuf, &result))
|
||||
{
|
||||
while((row = mysql_fetch_row(result)))
|
||||
{
|
||||
@@ -180,7 +180,7 @@ void QGlobalCache::LoadByCharID(uint32 charID)
|
||||
|
||||
void QGlobalCache::LoadByZoneID(uint32 zoneID)
|
||||
{
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
std::string errbuf;
|
||||
std::string query;
|
||||
MYSQL_RES *result;
|
||||
MYSQL_ROW row;
|
||||
@@ -188,7 +188,7 @@ void QGlobalCache::LoadByZoneID(uint32 zoneID)
|
||||
StringFormat(query,"select name, charid, npcid, zoneid, value, expdate from quest_globals"
|
||||
" where zoneid = %d && npcid = 0 && charid = 0", zoneID);
|
||||
|
||||
if (database.RunQuery(query, errbuf, &result))
|
||||
if (database.RunQuery(query, &errbuf, &result))
|
||||
{
|
||||
while((row = mysql_fetch_row(result)))
|
||||
{
|
||||
@@ -199,7 +199,7 @@ void QGlobalCache::LoadByZoneID(uint32 zoneID)
|
||||
}
|
||||
void QGlobalCache::LoadByGlobalContext()
|
||||
{
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
std::string errbuf;
|
||||
std::string query;
|
||||
MYSQL_RES *result;
|
||||
MYSQL_ROW row;
|
||||
@@ -207,7 +207,7 @@ void QGlobalCache::LoadByGlobalContext()
|
||||
query = "select name, charid, npcid, zoneid, value, expdate from quest_globals"
|
||||
" where zoneid = 0 && npcid = 0 && charid = 0";
|
||||
|
||||
if (database.RunQuery(query, errbuf, &result))
|
||||
if (database.RunQuery(query, &errbuf, &result))
|
||||
{
|
||||
while((row = mysql_fetch_row(result)))
|
||||
{
|
||||
|
||||
+111
-198
@@ -1467,7 +1467,6 @@ void Bot::GenerateAABonuses(StatBonuses* newbon) {
|
||||
void Bot::LoadAAs() {
|
||||
std::string errorMessage;
|
||||
std::string query;
|
||||
char TempErrorMessageBuffer[MYSQL_ERRMSG_SIZE];
|
||||
MYSQL_RES* DatasetResult;
|
||||
MYSQL_ROW DataRow;
|
||||
|
||||
@@ -1479,10 +1478,11 @@ void Bot::LoadAAs() {
|
||||
else
|
||||
StringFormat(query,"SELECT skill_id FROM altadv_vars WHERE ((classes & ( 1 << %i )) >> %i) = 1 AND class_type > 1 AND class_type <= %i AND aa_expansion <= %i ORDER BY skill_id;", GetClass(), GetClass(), GetLevel(), maxAAExpansion);
|
||||
|
||||
if(!database.RunQuery(query, TempErrorMessageBuffer, &DatasetResult)) {
|
||||
errorMessage = std::string(TempErrorMessageBuffer);
|
||||
if(!database.RunQuery(query, &errorMessage, &DatasetResult))
|
||||
{
|
||||
LogFile->write(EQEMuLog::Error, "Error in Bot::LoadAAs(). Error Message: %s",errorMessage.c_str());
|
||||
}
|
||||
else {
|
||||
{
|
||||
int totalAAs = database.CountAAs();
|
||||
|
||||
while(DataRow = mysql_fetch_row(DatasetResult)) {
|
||||
@@ -1537,10 +1537,6 @@ void Bot::LoadAAs() {
|
||||
mysql_free_result(DatasetResult);
|
||||
}
|
||||
|
||||
|
||||
if(!errorMessage.empty()) {
|
||||
LogFile->write(EQEMuLog::Error, "Error in Bot::LoadAAs()");
|
||||
}
|
||||
}
|
||||
|
||||
uint32 Bot::GetAA(uint32 aa_id) {
|
||||
@@ -2349,14 +2345,15 @@ bool Bot::IsBotNameAvailable(std::string* errorMessage) {
|
||||
|
||||
if(this->GetCleanName()) {
|
||||
std::string query;
|
||||
char TempErrorMessageBuffer[MYSQL_ERRMSG_SIZE];
|
||||
std::string errorMessageBuffer;
|
||||
MYSQL_RES* DatasetResult;
|
||||
MYSQL_ROW DataRow;
|
||||
|
||||
StringFormat(query,"SELECT COUNT(id) FROM vwBotCharacterMobs WHERE name LIKE '%s'", this->GetCleanName());
|
||||
|
||||
if(!database.RunQuery(query, TempErrorMessageBuffer, &DatasetResult)) {
|
||||
*errorMessage = std::string(TempErrorMessageBuffer);
|
||||
if(!database.RunQuery(query, &errorMessageBuffer, &DatasetResult)) {
|
||||
// probably was supposed to *do* something with the error message here.
|
||||
// TODO: log error.
|
||||
}
|
||||
else {
|
||||
uint32 ExistingNameCount = 0;
|
||||
@@ -2381,7 +2378,7 @@ bool Bot::Save() {
|
||||
std::string errorMessage;
|
||||
|
||||
std::string query;
|
||||
char TempErrorMessageBuffer[MYSQL_ERRMSG_SIZE];
|
||||
|
||||
uint32 affectedRows = 0;
|
||||
|
||||
if(this->GetBotID() == 0) {
|
||||
@@ -2404,10 +2401,7 @@ bool Bot::Save() {
|
||||
GetCorrup(), GetAC(), GetSTR(), GetSTA(), GetDEX(), GetAGI(), GetINT(), GetWIS(), GetCHA(),
|
||||
GetATK(), _lastZoneId);
|
||||
|
||||
if(!database.RunQuery(query, TempErrorMessageBuffer, nullptr, &affectedRows, &TempNewBotID)) {
|
||||
errorMessage = std::string(TempErrorMessageBuffer);
|
||||
}
|
||||
else {
|
||||
if(database.RunQuery(query, &errorMessage, nullptr, &affectedRows, &TempNewBotID)) {
|
||||
SetBotID(TempNewBotID);
|
||||
Result = true;
|
||||
}
|
||||
@@ -2436,10 +2430,7 @@ bool Bot::Save() {
|
||||
_baseAGI, _baseINT, _baseWIS, _baseCHA, _baseATK, GetTotalPlayTime(),
|
||||
_lastZoneId, GetBotID());
|
||||
|
||||
if(!database.RunQuery(query, TempErrorMessageBuffer, 0, &affectedRows)) {
|
||||
errorMessage = std::string(TempErrorMessageBuffer);
|
||||
}
|
||||
else {
|
||||
if(database.RunQuery(query, &errorMessage, 0, &affectedRows)) {
|
||||
Result = true;
|
||||
time(&_startTotalPlayTime);
|
||||
}
|
||||
@@ -2483,7 +2474,6 @@ uint32 Bot::GetTotalPlayTime() {
|
||||
void Bot::SaveBuffs() {
|
||||
std::string errorMessage;
|
||||
std::string query;
|
||||
char TempErrorMessageBuffer[MYSQL_ERRMSG_SIZE];
|
||||
int BuffCount = 0;
|
||||
int InsertCount = 0;
|
||||
|
||||
@@ -2495,8 +2485,7 @@ void Bot::SaveBuffs() {
|
||||
|
||||
StringFormat(query, "DELETE FROM botbuffs WHERE BotId = %u", GetBotID());
|
||||
|
||||
if(!database.RunQuery(query, TempErrorMessageBuffer)) {
|
||||
errorMessage = std::string(TempErrorMessageBuffer);
|
||||
if(!database.RunQuery(query, &errorMessage)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -2523,8 +2512,7 @@ void Bot::SaveBuffs() {
|
||||
buffs[BuffCount].deathSaveSuccessChance,
|
||||
buffs[BuffCount].deathsaveCasterAARank, IsPersistent);
|
||||
|
||||
if(!database.RunQuery(query, TempErrorMessageBuffer)) {
|
||||
errorMessage = std::string(TempErrorMessageBuffer);
|
||||
if(!database.RunQuery(query, &errorMessage)) {
|
||||
break;
|
||||
}
|
||||
else {
|
||||
@@ -2543,7 +2531,6 @@ void Bot::SaveBuffs() {
|
||||
void Bot::LoadBuffs() {
|
||||
std::string errorMessage;
|
||||
std::string query;
|
||||
char TempErrorMessageBuffer[MYSQL_ERRMSG_SIZE];
|
||||
MYSQL_RES* DatasetResult;
|
||||
MYSQL_ROW DataRow;
|
||||
|
||||
@@ -2554,10 +2541,7 @@ void Bot::LoadBuffs() {
|
||||
"HitCount, MeleeRune, MagicRune, DeathSaveSuccessChance, CasterAARank, "
|
||||
"Persistent FROM botbuffs WHERE BotId = %u", GetBotID());
|
||||
|
||||
if(!database.RunQuery(query, TempErrorMessageBuffer, &DatasetResult)) {
|
||||
errorMessage = std::string(TempErrorMessageBuffer);
|
||||
}
|
||||
else {
|
||||
if(database.RunQuery(query, &errorMessage, &DatasetResult)) {
|
||||
int BuffCount = 0;
|
||||
|
||||
while(DataRow = mysql_fetch_row(DatasetResult)) {
|
||||
@@ -2604,8 +2588,8 @@ void Bot::LoadBuffs() {
|
||||
|
||||
StringFormat(query, "DELETE FROM botbuffs WHERE BotId = %u", GetBotID());
|
||||
|
||||
if(!database.RunQuery(query, TempErrorMessageBuffer)) {
|
||||
errorMessage = std::string(TempErrorMessageBuffer);
|
||||
if(!database.RunQuery(query, &errorMessage)) {
|
||||
// TODO: Record this error message to zone error log
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2618,14 +2602,13 @@ uint32 Bot::GetPetSaveId() {
|
||||
uint32 Result = 0;
|
||||
std::string errorMessage;
|
||||
std::string query;
|
||||
char TempErrorMessageBuffer[MYSQL_ERRMSG_SIZE];
|
||||
MYSQL_RES* DatasetResult;
|
||||
MYSQL_ROW DataRow;
|
||||
|
||||
StringFormat(query, "select BotPetsId from botpets where BotId = %u;", GetBotID());
|
||||
|
||||
if(!database.RunQuery(query, TempErrorMessageBuffer, &DatasetResult)) {
|
||||
errorMessage = std::string(TempErrorMessageBuffer);
|
||||
if(!database.RunQuery(query, &errorMessage, &DatasetResult)) {
|
||||
// TODO: Record this error message to zone error log
|
||||
}
|
||||
else {
|
||||
while(DataRow = mysql_fetch_row(DatasetResult)) {
|
||||
@@ -2636,10 +2619,6 @@ uint32 Bot::GetPetSaveId() {
|
||||
mysql_free_result(DatasetResult);
|
||||
}
|
||||
|
||||
if(!errorMessage.empty()) {
|
||||
// TODO: Record this error message to zone error log
|
||||
}
|
||||
|
||||
return Result;
|
||||
}
|
||||
|
||||
@@ -2678,7 +2657,6 @@ void Bot::LoadPetStats(std::string* petName, uint16* petMana, uint16* petHitPoin
|
||||
if(botPetSaveId > 0) {
|
||||
std::string errorMessage;
|
||||
std::string query;
|
||||
char TempErrorMessageBuffer[MYSQL_ERRMSG_SIZE];
|
||||
MYSQL_RES* DatasetResult;
|
||||
MYSQL_ROW DataRow;
|
||||
|
||||
@@ -2686,8 +2664,8 @@ void Bot::LoadPetStats(std::string* petName, uint16* petMana, uint16* petHitPoin
|
||||
|
||||
StringFormat(query,"select PetId, Name, Mana, HitPoints from botpets where BotPetsId = %u;", botPetSaveId);
|
||||
|
||||
if(!database.RunQuery(query, TempErrorMessageBuffer, &DatasetResult)) {
|
||||
errorMessage = std::string(TempErrorMessageBuffer);
|
||||
if(!database.RunQuery(query, &errorMessage, &DatasetResult)) {
|
||||
// TODO: Record this error message to zone error log
|
||||
}
|
||||
else {
|
||||
while(DataRow = mysql_fetch_row(DatasetResult)) {
|
||||
@@ -2703,10 +2681,6 @@ void Bot::LoadPetStats(std::string* petName, uint16* petMana, uint16* petHitPoin
|
||||
statsLoaded = true;
|
||||
}
|
||||
|
||||
|
||||
if(!errorMessage.empty()) {
|
||||
// TODO: Record this error message to zone error log
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2714,7 +2688,6 @@ void Bot::LoadPetBuffs(SpellBuff_Struct* petBuffs, uint32 botPetSaveId) {
|
||||
if(petBuffs && botPetSaveId > 0) {
|
||||
std::string errorMessage;
|
||||
std::string query;
|
||||
char TempErrorMessageBuffer[MYSQL_ERRMSG_SIZE];
|
||||
MYSQL_RES* DatasetResult;
|
||||
MYSQL_ROW DataRow;
|
||||
|
||||
@@ -2722,8 +2695,8 @@ void Bot::LoadPetBuffs(SpellBuff_Struct* petBuffs, uint32 botPetSaveId) {
|
||||
|
||||
StringFormat(query,"SELECT SpellId, CasterLevel, Duration FROM botpetbuffs WHERE BotPetsId = %u;", botPetSaveId);
|
||||
|
||||
if(!database.RunQuery(query, TempErrorMessageBuffer, &DatasetResult)) {
|
||||
errorMessage = std::string(TempErrorMessageBuffer);
|
||||
if(!database.RunQuery(query, &errorMessage, &DatasetResult)) {
|
||||
// TODO: Record this error message to zone error log
|
||||
}
|
||||
else {
|
||||
int BuffCount = 0;
|
||||
@@ -2748,14 +2721,11 @@ void Bot::LoadPetBuffs(SpellBuff_Struct* petBuffs, uint32 botPetSaveId) {
|
||||
|
||||
StringFormat(query, "DELETE FROM botpetbuffs WHERE BotPetsId = %u;", botPetSaveId);
|
||||
|
||||
if(!database.RunQuery(query,TempErrorMessageBuffer)) {
|
||||
errorMessage = std::string(TempErrorMessageBuffer);
|
||||
if(!database.RunQuery(query,&errorMessage)) {
|
||||
// TODO: Record this error message to zone error log
|
||||
}
|
||||
}
|
||||
|
||||
if(!errorMessage.empty()) {
|
||||
// TODO: Record this error message to zone error log
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2763,7 +2733,6 @@ void Bot::LoadPetItems(uint32* petItems, uint32 botPetSaveId) {
|
||||
if(petItems && botPetSaveId > 0) {
|
||||
std::string errorMessage;
|
||||
std::string query;
|
||||
char TempErrorMessageBuffer[MYSQL_ERRMSG_SIZE];
|
||||
MYSQL_RES* DatasetResult;
|
||||
MYSQL_ROW DataRow;
|
||||
|
||||
@@ -2771,8 +2740,8 @@ void Bot::LoadPetItems(uint32* petItems, uint32 botPetSaveId) {
|
||||
|
||||
StringFormat(query,"SELECT ItemId FROM botpetinventory WHERE BotPetsId = %u;", botPetSaveId);
|
||||
|
||||
if(!database.RunQuery(query, TempErrorMessageBuffer, &DatasetResult)) {
|
||||
errorMessage = std::string(TempErrorMessageBuffer);
|
||||
if(!database.RunQuery(query, &errorMessage, &DatasetResult)) {
|
||||
// TODO: Record this error message to zone error log
|
||||
}
|
||||
else {
|
||||
int ItemCount = 0;
|
||||
@@ -2795,14 +2764,11 @@ void Bot::LoadPetItems(uint32* petItems, uint32 botPetSaveId) {
|
||||
|
||||
StringFormat(query,"DELETE FROM botpetinventory WHERE BotPetsId = %u;", botPetSaveId);
|
||||
|
||||
if(!database.RunQuery(query, TempErrorMessageBuffer)) {
|
||||
errorMessage = std::string(TempErrorMessageBuffer);
|
||||
if(!database.RunQuery(query, &errorMessage)) {
|
||||
// TODO: Record this error message to zone error log
|
||||
}
|
||||
}
|
||||
|
||||
if(!errorMessage.empty()) {
|
||||
// TODO: Record this error message to zone error log
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2847,12 +2813,11 @@ uint32 Bot::SavePetStats(std::string petName, uint16 petMana, uint16 petHitPoint
|
||||
|
||||
std::string errorMessage;
|
||||
std::string query;
|
||||
char TempErrorMessageBuffer[MYSQL_ERRMSG_SIZE];
|
||||
|
||||
StringFormat(query,"REPLACE INTO botpets SET PetId = %u, BotId = %u, Name = '%s', Mana = %u, HitPoints = %u;", botPetId, GetBotID(), petName.c_str(), petMana, petHitPoints);
|
||||
|
||||
if(!database.RunQuery(query,TempErrorMessageBuffer, 0, 0, &Result)) {
|
||||
errorMessage = std::string(TempErrorMessageBuffer);
|
||||
if(!database.RunQuery(query, &errorMessage, nullptr, nullptr, &Result)) {
|
||||
// TODO: Record this error message to zone error log
|
||||
}
|
||||
|
||||
return Result;
|
||||
@@ -2862,7 +2827,6 @@ void Bot::SavePetBuffs(SpellBuff_Struct* petBuffs, uint32 botPetSaveId) {
|
||||
if(petBuffs && botPetSaveId > 0) {
|
||||
std::string errorMessage;
|
||||
std::string query;
|
||||
char TempErrorMessageBuffer[MYSQL_ERRMSG_SIZE];
|
||||
int BuffCount = 0;
|
||||
|
||||
while(BuffCount < BUFF_COUNT) {
|
||||
@@ -2871,8 +2835,8 @@ void Bot::SavePetBuffs(SpellBuff_Struct* petBuffs, uint32 botPetSaveId) {
|
||||
StringFormat(query,"INSERT INTO botpetbuffs (BotPetsId, SpellId, CasterLevel, Duration) VALUES(%u, %u, %u, %u);",
|
||||
botPetSaveId, petBuffs[BuffCount].spellid, petBuffs[BuffCount].level, petBuffs[BuffCount].duration);
|
||||
|
||||
if(!database.RunQuery(query, TempErrorMessageBuffer)) {
|
||||
errorMessage = std::string(TempErrorMessageBuffer);
|
||||
if(!database.RunQuery(query, &errorMessage)) {
|
||||
// TODO: Record this error message to zone error log
|
||||
break;
|
||||
}
|
||||
else {
|
||||
@@ -2883,9 +2847,6 @@ void Bot::SavePetBuffs(SpellBuff_Struct* petBuffs, uint32 botPetSaveId) {
|
||||
BuffCount++;
|
||||
}
|
||||
|
||||
if(!errorMessage.empty()) {
|
||||
// TODO: Record this error message to zone error log
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2893,7 +2854,6 @@ void Bot::SavePetItems(uint32* petItems, uint32 botPetSaveId) {
|
||||
if(petItems && botPetSaveId > 0) {
|
||||
std::string errorMessage;
|
||||
std::string query;
|
||||
char TempErrorMessageBuffer[MYSQL_ERRMSG_SIZE];
|
||||
int ItemCount = 0;
|
||||
|
||||
while(ItemCount < MAX_WORN_INVENTORY) {
|
||||
@@ -2902,8 +2862,8 @@ void Bot::SavePetItems(uint32* petItems, uint32 botPetSaveId) {
|
||||
StringFormat(query,"INSERT INTO botpetinventory (BotPetsId, ItemId) VALUES(%u, %u);",
|
||||
botPetSaveId, petItems[ItemCount]);
|
||||
|
||||
if(!database.RunQuery(query, TempErrorMessageBuffer)) {
|
||||
errorMessage = std::string(TempErrorMessageBuffer);
|
||||
if(!database.RunQuery(query, &errorMessage)) {
|
||||
// TODO: Record this error message to zone error log
|
||||
break;
|
||||
}
|
||||
else {
|
||||
@@ -2914,9 +2874,6 @@ void Bot::SavePetItems(uint32* petItems, uint32 botPetSaveId) {
|
||||
ItemCount++;
|
||||
}
|
||||
|
||||
if(!errorMessage.empty()) {
|
||||
// TODO: Record this error message to zone error log
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2924,12 +2881,11 @@ void Bot::DeletePetBuffs(uint32 botPetSaveId) {
|
||||
if(botPetSaveId > 0) {
|
||||
std::string errorMessage;
|
||||
std::string query;
|
||||
char TempErrorMessageBuffer[MYSQL_ERRMSG_SIZE];
|
||||
|
||||
StringFormat(query,"DELETE FROM botpetbuffs WHERE BotPetsId = %u;", botPetSaveId);
|
||||
|
||||
if(!database.RunQuery(query, TempErrorMessageBuffer)) {
|
||||
errorMessage = std::string(TempErrorMessageBuffer);
|
||||
if(!database.RunQuery(query, &errorMessage)) {
|
||||
// TODO: Record this error message to zone error log
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2938,12 +2894,11 @@ void Bot::DeletePetItems(uint32 botPetSaveId) {
|
||||
if(botPetSaveId > 0) {
|
||||
std::string errorMessage;
|
||||
std::string query;
|
||||
char TempErrorMessageBuffer[MYSQL_ERRMSG_SIZE];
|
||||
|
||||
StringFormat(query,"DELETE FROM botpetinventory WHERE BotPetsId = %u;", botPetSaveId);
|
||||
|
||||
if(!database.RunQuery(query, TempErrorMessageBuffer)) {
|
||||
errorMessage = std::string(TempErrorMessageBuffer);
|
||||
if(!database.RunQuery(query, &errorMessage)) {
|
||||
// TODO: Record this error message to zone error log
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2952,12 +2907,11 @@ void Bot::DeletePetStats(uint32 botPetSaveId) {
|
||||
if(botPetSaveId > 0) {
|
||||
std::string errorMessage;
|
||||
std::string query;
|
||||
char TempErrorMessageBuffer[MYSQL_ERRMSG_SIZE];
|
||||
|
||||
StringFormat(query, "DELETE from botpets where BotPetsId = %u;", botPetSaveId);
|
||||
|
||||
if(!database.RunQuery(query, TempErrorMessageBuffer)) {
|
||||
errorMessage = std::string(TempErrorMessageBuffer);
|
||||
if(!database.RunQuery(query, &errorMessage)) {
|
||||
// TODO: Record this error message to zone error log
|
||||
}
|
||||
|
||||
}
|
||||
@@ -2968,14 +2922,14 @@ void Bot::LoadStance() {
|
||||
bool loaded = false;
|
||||
std::string errorMessage;
|
||||
std::string query;
|
||||
char TempErrorMessageBuffer[MYSQL_ERRMSG_SIZE];
|
||||
MYSQL_RES* DatasetResult;
|
||||
MYSQL_ROW DataRow;
|
||||
|
||||
StringFormat(query,"select StanceID from botstances where BotID = %u;", GetBotID());
|
||||
|
||||
if(!database.RunQuery(query, TempErrorMessageBuffer, &DatasetResult)) {
|
||||
errorMessage = std::string(TempErrorMessageBuffer);
|
||||
if(!database.RunQuery(query, &errorMessage, &DatasetResult)) {
|
||||
LogFile->write(EQEMuLog::Error, "Error in Bot::LoadStance(). Error message: %s", errorMessage.c_str());
|
||||
|
||||
}
|
||||
else {
|
||||
while(DataRow = mysql_fetch_row(DatasetResult)) {
|
||||
@@ -2987,10 +2941,6 @@ void Bot::LoadStance() {
|
||||
mysql_free_result(DatasetResult);
|
||||
}
|
||||
|
||||
if(!errorMessage.empty()) {
|
||||
LogFile->write(EQEMuLog::Error, "Error in Bot::LoadStance()");
|
||||
}
|
||||
|
||||
if(loaded)
|
||||
SetBotStance((BotStanceType)Result);
|
||||
else
|
||||
@@ -3001,24 +2951,19 @@ void Bot::SaveStance() {
|
||||
if(_baseBotStance != _botStance) {
|
||||
std::string errorMessage;
|
||||
std::string query;
|
||||
char TempErrorMessageBuffer[MYSQL_ERRMSG_SIZE];
|
||||
|
||||
StringFormat(query,"REPLACE INTO botstances (BotID, StanceId) VALUES(%u, %u);", GetBotID(), GetBotStance());
|
||||
|
||||
if(!database.RunQuery(query, TempErrorMessageBuffer)) {
|
||||
errorMessage = std::string(TempErrorMessageBuffer);
|
||||
}
|
||||
|
||||
if(!errorMessage.empty()) {
|
||||
if(!database.RunQuery(query, &errorMessage)) {
|
||||
LogFile->write(EQEMuLog::Error, "Error in Bot::SaveStance()");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void Bot::LoadTimers() {
|
||||
std::string errorMessage;
|
||||
std::string query;
|
||||
char TempErrorMessageBuffer[MYSQL_ERRMSG_SIZE];
|
||||
MYSQL_RES* DatasetResult;
|
||||
MYSQL_ROW DataRow;
|
||||
|
||||
@@ -3028,8 +2973,8 @@ void Bot::LoadTimers() {
|
||||
"WHERE TimerID = bt.TimerID AND BotID = bt.BotID ) AND sn.classes%i <= %i;",
|
||||
GetBotID(), DisciplineReuseStart-1, DisciplineReuseStart-1, GetClass(), GetLevel());
|
||||
|
||||
if(!database.RunQuery(query, TempErrorMessageBuffer, &DatasetResult)) {
|
||||
errorMessage = std::string(TempErrorMessageBuffer);
|
||||
if(!database.RunQuery(query, &errorMessage, &DatasetResult)) {
|
||||
LogFile->write(EQEMuLog::Error, "Error in Bot::LoadTimers()");
|
||||
}
|
||||
else {
|
||||
int TimerID = 0;
|
||||
@@ -3049,20 +2994,16 @@ void Bot::LoadTimers() {
|
||||
mysql_free_result(DatasetResult);
|
||||
}
|
||||
|
||||
if(!errorMessage.empty()) {
|
||||
LogFile->write(EQEMuLog::Error, "Error in Bot::LoadTimers()");
|
||||
}
|
||||
}
|
||||
|
||||
void Bot::SaveTimers() {
|
||||
std::string errorMessage;
|
||||
std::string query;
|
||||
char TempErrorMessageBuffer[MYSQL_ERRMSG_SIZE];
|
||||
|
||||
StringFormat(query,"DELETE FROM bottimers WHERE BotID = %u;", GetBotID());
|
||||
|
||||
if(!database.RunQuery(query, TempErrorMessageBuffer)) {
|
||||
errorMessage = std::string(TempErrorMessageBuffer);
|
||||
if(!database.RunQuery(query, &errorMessage)) {
|
||||
LogFile->write(EQEMuLog::Error, "Error in Bot::SaveTimers()");
|
||||
}
|
||||
|
||||
for(int i = 0; i < MaxTimer; i++) {
|
||||
@@ -3071,16 +3012,13 @@ void Bot::SaveTimers() {
|
||||
StringFormat(query,"REPLACE INTO bottimers (BotID, TimerID, Value) VALUES(%u, %u, %u);",
|
||||
GetBotID(), i+1, timers[i]);
|
||||
|
||||
if(!database.RunQuery(query, TempErrorMessageBuffer)) {
|
||||
errorMessage = std::string(TempErrorMessageBuffer);
|
||||
if(!database.RunQuery(query, &errorMessage)) {
|
||||
LogFile->write(EQEMuLog::Error, "Error in Bot::SaveTimers()");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if(!errorMessage.empty()) {
|
||||
LogFile->write(EQEMuLog::Error, "Error in Bot::SaveTimers()");
|
||||
}
|
||||
}
|
||||
|
||||
bool Bot::Process()
|
||||
@@ -4284,43 +4222,31 @@ void Bot::Depop() {
|
||||
bool Bot::DeleteBot(std::string* errorMessage) {
|
||||
bool Result = false;
|
||||
int TempCounter = 0;
|
||||
|
||||
|
||||
if(this->GetBotID() > 0) {
|
||||
std::string query;
|
||||
char TempErrorMessageBuffer[MYSQL_ERRMSG_SIZE];
|
||||
std::string errorMessage;
|
||||
|
||||
// TODO: These queries need to be ran together as a transaction.. ie, if one or more fail then they all will fail to commit to the database.
|
||||
|
||||
// TODO: Cleanup
|
||||
StringFormat(query,"DELETE FROM botinventory WHERE botid = '%u'", this->GetBotID());
|
||||
|
||||
if(!database.RunQuery(query, TempErrorMessageBuffer)) {
|
||||
*errorMessage = std::string(TempErrorMessageBuffer);
|
||||
}
|
||||
else
|
||||
if(database.RunQuery(query, &errorMessage))
|
||||
TempCounter++;
|
||||
|
||||
StringFormat(query, "DELETE FROM botbuffs WHERE botid = '%u'", this->GetBotID());
|
||||
|
||||
if(!database.RunQuery(query, TempErrorMessageBuffer)) {
|
||||
*errorMessage = std::string(TempErrorMessageBuffer);
|
||||
}
|
||||
else
|
||||
if(database.RunQuery(query, &errorMessage))
|
||||
TempCounter++;
|
||||
|
||||
StringFormat(query, "DELETE FROM botstances WHERE BotID = '%u'", this->GetBotID());
|
||||
|
||||
if(!database.RunQuery(query, TempErrorMessageBuffer)) {
|
||||
*errorMessage = std::string(TempErrorMessageBuffer);
|
||||
}
|
||||
else
|
||||
if(database.RunQuery(query, &errorMessage))
|
||||
TempCounter++;
|
||||
|
||||
StringFormat(query,"DELETE FROM bots WHERE BotID = '%u'", this->GetBotID());
|
||||
|
||||
if(!database.RunQuery(query, TempErrorMessageBuffer)) {
|
||||
*errorMessage = std::string(TempErrorMessageBuffer);
|
||||
}
|
||||
else
|
||||
if(database.RunQuery(query, &errorMessage))
|
||||
TempCounter++;
|
||||
|
||||
if(TempCounter == 4)
|
||||
@@ -4381,7 +4307,7 @@ void Bot::Spawn(Client* botCharacterOwner, std::string* errorMessage) {
|
||||
|
||||
// Saves the specified item as an inventory record in the database for this bot.
|
||||
void Bot::SetBotItemInSlot(uint32 slotID, uint32 itemID, const ItemInst* inst, std::string *errorMessage) {
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
std::string errbuf;
|
||||
std::string query;
|
||||
uint32 augslot[5] = { 0, 0, 0, 0, 0 };
|
||||
|
||||
@@ -4403,7 +4329,7 @@ void Bot::SetBotItemInSlot(uint32 slotID, uint32 itemID, const ItemInst* inst, s
|
||||
(unsigned long)inst->GetColor(),(unsigned long)augslot[0],(unsigned long)augslot[1],
|
||||
(unsigned long)augslot[2],(unsigned long)augslot[3],(unsigned long)augslot[4]);
|
||||
|
||||
if(!database.RunQuery(query, errbuf)) {
|
||||
if(!database.RunQuery(query, &errbuf)) {
|
||||
*errorMessage = std::string(errbuf);
|
||||
}
|
||||
}
|
||||
@@ -4411,15 +4337,15 @@ void Bot::SetBotItemInSlot(uint32 slotID, uint32 itemID, const ItemInst* inst, s
|
||||
|
||||
// Deletes the inventory record for the specified item from the database for this bot.
|
||||
void Bot::RemoveBotItemBySlot(uint32 slotID, std::string *errorMessage) {
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
std::string errbuf;
|
||||
std::string query;
|
||||
|
||||
if(this->GetBotID() > 0 && slotID >= 0) {
|
||||
|
||||
StringFormat(query,"DELETE FROM botinventory WHERE botid=%i AND slotid=%i", this->GetBotID(), slotID);
|
||||
|
||||
if(!database.RunQuery(query, errbuf)){
|
||||
*errorMessage = std::string(errbuf);
|
||||
if(!database.RunQuery(query, &errbuf)){
|
||||
// TODO: Log to zone.
|
||||
}
|
||||
m_inv.DeleteItem(slotID);
|
||||
}
|
||||
@@ -4429,7 +4355,7 @@ void Bot::RemoveBotItemBySlot(uint32 slotID, std::string *errorMessage) {
|
||||
void Bot::GetBotItems(std::string* errorMessage, Inventory &inv) {
|
||||
|
||||
if(this->GetBotID() > 0) {
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
std::string errbuf;
|
||||
std::string query;
|
||||
MYSQL_RES* DatasetResult;
|
||||
MYSQL_ROW DataRow;
|
||||
@@ -4438,7 +4364,7 @@ void Bot::GetBotItems(std::string* errorMessage, Inventory &inv) {
|
||||
"augslot3, augslot4, augslot5, instnodrop FROM botinventory "
|
||||
"WHERE botid=%i order by slotid", this->GetBotID());
|
||||
|
||||
if(database.RunQuery(query, errbuf, &DatasetResult)) {
|
||||
if(database.RunQuery(query, &errbuf, &DatasetResult)) {
|
||||
while(DataRow = mysql_fetch_row(DatasetResult)) {
|
||||
int16 slot_id = atoi(DataRow[0]);
|
||||
uint32 item_id = atoi(DataRow[1]);
|
||||
@@ -4523,14 +4449,14 @@ uint32 Bot::GetBotItemsCount(std::string *errorMessage) {
|
||||
uint32 Result = 0;
|
||||
|
||||
if(this->GetBotID() > 0) {
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
std::string errbuf;
|
||||
std::string query;
|
||||
MYSQL_RES* DatasetResult;
|
||||
MYSQL_ROW DataRow;
|
||||
|
||||
StringFormat(query,"SELECT COUNT(*) FROM botinventory WHERE botid=%i", this->GetBotID());
|
||||
|
||||
if(database.RunQuery(query, errbuf, &DatasetResult)) {
|
||||
if(database.RunQuery(query, &errbuf, &DatasetResult)) {
|
||||
if(mysql_num_rows(DatasetResult) == 1) {
|
||||
DataRow = mysql_fetch_row(DatasetResult);
|
||||
if(DataRow)
|
||||
@@ -4738,15 +4664,14 @@ uint32 Bot::GetBotIDByBotName(std::string botName) {
|
||||
|
||||
if(!botName.empty()) {
|
||||
std::string query;
|
||||
char TempErrorMessageBuffer[MYSQL_ERRMSG_SIZE];
|
||||
MYSQL_RES* DatasetResult;
|
||||
MYSQL_ROW DataRow;
|
||||
std::string errorMessage;
|
||||
|
||||
StringFormat(query,"SELECT BotID FROM bots WHERE Name = '%s'", botName.c_str());
|
||||
|
||||
if(!database.RunQuery(query, TempErrorMessageBuffer, &DatasetResult)) {
|
||||
errorMessage = std::string(TempErrorMessageBuffer);
|
||||
if(!database.RunQuery(query, &errorMessage, &DatasetResult)) {
|
||||
// TODO: Log this error to zone error log
|
||||
}
|
||||
else {
|
||||
while(DataRow = mysql_fetch_row(DatasetResult)) {
|
||||
@@ -4758,9 +4683,6 @@ uint32 Bot::GetBotIDByBotName(std::string botName) {
|
||||
}
|
||||
|
||||
|
||||
if(!errorMessage.empty()) {
|
||||
// TODO: Log this error to zone error log
|
||||
}
|
||||
}
|
||||
|
||||
return Result;
|
||||
@@ -4771,7 +4693,6 @@ Bot* Bot::LoadBot(uint32 botID, std::string* errorMessage) {
|
||||
|
||||
if(botID > 0) {
|
||||
std::string query;
|
||||
char TempErrorMessageBuffer[MYSQL_ERRMSG_SIZE];
|
||||
MYSQL_RES* DatasetResult;
|
||||
MYSQL_ROW DataRow;
|
||||
|
||||
@@ -4783,8 +4704,8 @@ Bot* Bot::LoadBot(uint32 botID, std::string* errorMessage) {
|
||||
"BotCreateDate, LastSpawnDate, TotalPlayTime, LastZoneId "
|
||||
"FROM bots WHERE BotID = '%u'", botID);
|
||||
|
||||
if(!database.RunQuery(query, TempErrorMessageBuffer, &DatasetResult)) {
|
||||
*errorMessage = std::string(TempErrorMessageBuffer);
|
||||
if(!database.RunQuery(query, errorMessage, &DatasetResult)) {
|
||||
// TODO: Log this error to zone error log
|
||||
}
|
||||
else {
|
||||
while(DataRow = mysql_fetch_row(DatasetResult)) {
|
||||
@@ -4807,14 +4728,13 @@ std::list<uint32> Bot::GetGroupedBotsByGroupId(uint32 groupId, std::string* erro
|
||||
|
||||
if(groupId > 0) {
|
||||
std::string query;
|
||||
char TempErrorMessageBuffer[MYSQL_ERRMSG_SIZE];
|
||||
MYSQL_RES* DatasetResult;
|
||||
MYSQL_ROW DataRow;
|
||||
|
||||
StringFormat(query,"select g.mobid as BotID from vwGroups as g join bots as b on g.mobid = b.BotId and g.mobtype = 'B' where g.groupid = %u", groupId);
|
||||
|
||||
if(!database.RunQuery(query, TempErrorMessageBuffer, &DatasetResult)) {
|
||||
*errorMessage = std::string(TempErrorMessageBuffer);
|
||||
if(!database.RunQuery(query, errorMessage, &DatasetResult)) {
|
||||
// TODO: log error.
|
||||
}
|
||||
else {
|
||||
while(DataRow = mysql_fetch_row(DatasetResult)) {
|
||||
@@ -4898,14 +4818,13 @@ std::list<BotsAvailableList> Bot::GetBotList(uint32 botOwnerCharacterID, std::st
|
||||
|
||||
if(botOwnerCharacterID > 0) {
|
||||
std::string query;
|
||||
char TempErrorMessageBuffer[MYSQL_ERRMSG_SIZE];
|
||||
MYSQL_RES* DatasetResult;
|
||||
MYSQL_ROW DataRow;
|
||||
|
||||
StringFormat(query,"SELECT BotID, Name, Class, BotLevel, Race FROM bots WHERE BotOwnerCharacterID = '%u'", botOwnerCharacterID);
|
||||
|
||||
if(!database.RunQuery(query, TempErrorMessageBuffer, &DatasetResult)) {
|
||||
*errorMessage = std::string(TempErrorMessageBuffer);
|
||||
if(!database.RunQuery(query, errorMessage, &DatasetResult)) {
|
||||
// TODO: Log Error.
|
||||
}
|
||||
else {
|
||||
while(DataRow = mysql_fetch_row(DatasetResult)) {
|
||||
@@ -4931,7 +4850,7 @@ std::list<BotsAvailableList> Bot::GetBotList(uint32 botOwnerCharacterID, std::st
|
||||
|
||||
std::list<SpawnedBotsList> Bot::ListSpawnedBots(uint32 characterID, std::string* errorMessage) {
|
||||
std::list<SpawnedBotsList> Result;
|
||||
char ErrBuf[MYSQL_ERRMSG_SIZE];
|
||||
std::string errbuf;
|
||||
std::string query;
|
||||
MYSQL_RES* DatasetResult;
|
||||
MYSQL_ROW DataRow;
|
||||
@@ -4939,8 +4858,8 @@ std::list<SpawnedBotsList> Bot::ListSpawnedBots(uint32 characterID, std::string*
|
||||
StringFormat(query,"SELECT bot_name, zone_name FROM botleader WHERE leaderid=%i", characterID);
|
||||
|
||||
if(characterID > 0) {
|
||||
if(!database.RunQuery(query, ErrBuf, &DatasetResult)) {
|
||||
*errorMessage = std::string(ErrBuf);
|
||||
if(!database.RunQuery(query, errorMessage, &DatasetResult)) {
|
||||
// TODO: Log Error
|
||||
}
|
||||
else {
|
||||
uint32 RowCount = mysql_num_rows(DatasetResult);
|
||||
@@ -4967,7 +4886,6 @@ std::list<SpawnedBotsList> Bot::ListSpawnedBots(uint32 characterID, std::string*
|
||||
|
||||
void Bot::SaveBotGroup(Group* botGroup, std::string botGroupName, std::string* errorMessage) {
|
||||
if(botGroup && !botGroupName.empty()) {
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
std::string query;
|
||||
|
||||
Mob* tempGroupLeader = botGroup->GetLeader();
|
||||
@@ -4979,8 +4897,8 @@ void Bot::SaveBotGroup(Group* botGroup, std::string botGroupName, std::string* e
|
||||
|
||||
StringFormat(query,"INSERT into botgroup (BotGroupLeaderBotId, BotGroupName) values (%u, '%s')", botGroupLeaderBotId, botGroupName.c_str());
|
||||
|
||||
if(!database.RunQuery(query, errbuf, 0, 0, &botGroupId)) {
|
||||
*errorMessage = std::string(errbuf);
|
||||
if(!database.RunQuery(query, errorMessage, 0, 0, &botGroupId)) {
|
||||
// TODO: Log error.
|
||||
}
|
||||
else {
|
||||
if(botGroupId > 0) {
|
||||
@@ -4993,8 +4911,8 @@ void Bot::SaveBotGroup(Group* botGroup, std::string botGroupName, std::string* e
|
||||
StringFormat(query, "INSERT into botgroupmembers (BotGroupId, BotId) values (%u, %u)",
|
||||
botGroupId, botGroupMemberBotId);
|
||||
|
||||
if(!database.RunQuery(query, errbuf)) {
|
||||
*errorMessage = std::string(errbuf);
|
||||
if(!database.RunQuery(query, errorMessage)) {
|
||||
// TODO: Log error message
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5006,7 +4924,7 @@ void Bot::SaveBotGroup(Group* botGroup, std::string botGroupName, std::string* e
|
||||
}
|
||||
|
||||
void Bot::DeleteBotGroup(std::string botGroupName, std::string* errorMessage) {
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
std::string errbuf;
|
||||
std::string query;
|
||||
|
||||
if(!botGroupName.empty()) {
|
||||
@@ -5016,14 +4934,14 @@ void Bot::DeleteBotGroup(std::string botGroupName, std::string* errorMessage) {
|
||||
|
||||
StringFormat(query, "DELETE FROM botgroupmembers WHERE BotGroupId = %u", botGroupId);
|
||||
|
||||
if(!database.RunQuery(query, errbuf)) {
|
||||
if(!database.RunQuery(query, &errbuf)) {
|
||||
*errorMessage = std::string(errbuf);
|
||||
}
|
||||
else {
|
||||
|
||||
StringFormat(query, "DELETE FROM botgroup WHERE BotGroupId = %u", botGroupId);
|
||||
|
||||
if(!database.RunQuery(query, errbuf)) {
|
||||
if(!database.RunQuery(query, &errbuf)) {
|
||||
*errorMessage = std::string(errbuf);
|
||||
}
|
||||
}
|
||||
@@ -5033,7 +4951,6 @@ void Bot::DeleteBotGroup(std::string botGroupName, std::string* errorMessage) {
|
||||
|
||||
std::list<BotGroup> Bot::LoadBotGroup(std::string botGroupName, std::string* errorMessage) {
|
||||
std::list<BotGroup> Result;
|
||||
char ErrBuf[MYSQL_ERRMSG_SIZE];
|
||||
std::string query;
|
||||
MYSQL_RES* DatasetResult;
|
||||
MYSQL_ROW DataRow;
|
||||
@@ -5045,8 +4962,8 @@ std::list<BotGroup> Bot::LoadBotGroup(std::string botGroupName, std::string* err
|
||||
|
||||
StringFormat(query,"select BotId from botgroupmembers where BotGroupId = %u", botGroupId);
|
||||
|
||||
if(!database.RunQuery(query, ErrBuf, &DatasetResult)) {
|
||||
*errorMessage = std::string(ErrBuf);
|
||||
if(!database.RunQuery(query, errorMessage, &DatasetResult)) {
|
||||
// TODO: Log error.
|
||||
}
|
||||
else {
|
||||
uint32 RowCount = mysql_num_rows(DatasetResult);
|
||||
@@ -5078,15 +4995,14 @@ std::list<BotGroupList> Bot::GetBotGroupListByBotOwnerCharacterId(uint32 botOwne
|
||||
std::list<BotGroupList> result;
|
||||
|
||||
if(botOwnerCharacterId > 0) {
|
||||
char ErrBuf[MYSQL_ERRMSG_SIZE];
|
||||
std::string query;
|
||||
MYSQL_RES* DatasetResult;
|
||||
MYSQL_ROW DataRow;
|
||||
|
||||
StringFormat(query,"select BotGroupName, BotGroupLeaderName from vwBotGroups where BotOwnerCharacterId = %u", botOwnerCharacterId);
|
||||
|
||||
if(!database.RunQuery(query, ErrBuf, &DatasetResult)) {
|
||||
*errorMessage = std::string(ErrBuf);
|
||||
if(!database.RunQuery(query, errorMessage, &DatasetResult)) {
|
||||
// TODO: Log error.
|
||||
}
|
||||
else {
|
||||
uint32 RowCount = mysql_num_rows(DatasetResult);
|
||||
@@ -5154,15 +5070,14 @@ uint32 Bot::CanLoadBotGroup(uint32 botOwnerCharacterId, std::string botGroupName
|
||||
uint32 result = 0;
|
||||
|
||||
if(botOwnerCharacterId > 0 && !botGroupName.empty()) {
|
||||
char ErrBuf[MYSQL_ERRMSG_SIZE];
|
||||
std::string query;
|
||||
MYSQL_RES* DatasetResult;
|
||||
MYSQL_ROW DataRow;
|
||||
|
||||
StringFormat(query,"select BotGroupId, BotGroupName from vwBotGroups where BotOwnerCharacterId = %u", botOwnerCharacterId);
|
||||
|
||||
if(!database.RunQuery(query, ErrBuf, &DatasetResult)) {
|
||||
*errorMessage = std::string(ErrBuf);
|
||||
if(!database.RunQuery(query, errorMessage, &DatasetResult)) {
|
||||
// TODO: Log error.
|
||||
}
|
||||
else {
|
||||
uint32 RowCount = mysql_num_rows(DatasetResult);
|
||||
@@ -5195,15 +5110,14 @@ uint32 Bot::GetBotGroupIdByBotGroupName(std::string botGroupName, std::string* e
|
||||
uint32 result = 0;
|
||||
|
||||
if(!botGroupName.empty()) {
|
||||
char ErrBuf[MYSQL_ERRMSG_SIZE];
|
||||
std::string query;
|
||||
MYSQL_RES* DatasetResult;
|
||||
MYSQL_ROW DataRow;
|
||||
|
||||
StringFormat(query,"select BotGroupId from vwBotGroups where BotGroupName = '%s'", botGroupName.c_str());
|
||||
|
||||
if(!database.RunQuery(query, ErrBuf, &DatasetResult)) {
|
||||
*errorMessage = std::string(ErrBuf);
|
||||
if(!database.RunQuery(query, errorMessage, &DatasetResult)) {
|
||||
// TODO: log error.
|
||||
}
|
||||
else {
|
||||
uint32 RowCount = mysql_num_rows(DatasetResult);
|
||||
@@ -5263,14 +5177,13 @@ uint32 Bot::AllowedBotSpawns(uint32 botOwnerCharacterID, std::string* errorMessa
|
||||
uint32 Result = 0;
|
||||
|
||||
if(botOwnerCharacterID > 0) {
|
||||
char ErrBuf[MYSQL_ERRMSG_SIZE];
|
||||
std::string query;
|
||||
MYSQL_RES* DatasetResult;
|
||||
MYSQL_ROW DataRow;
|
||||
|
||||
StringFormat(query,"SELECT value FROM quest_globals WHERE name='bot_spawn_limit' and charid=%i", botOwnerCharacterID);
|
||||
|
||||
if(database.RunQuery(query, ErrBuf, &DatasetResult)) {
|
||||
if(database.RunQuery(query, errorMessage, &DatasetResult)) {
|
||||
if(mysql_num_rows(DatasetResult) == 1) {
|
||||
DataRow = mysql_fetch_row(DatasetResult);
|
||||
if(DataRow)
|
||||
@@ -5279,8 +5192,10 @@ uint32 Bot::AllowedBotSpawns(uint32 botOwnerCharacterID, std::string* errorMessa
|
||||
|
||||
mysql_free_result(DatasetResult);
|
||||
}
|
||||
else
|
||||
*errorMessage = std::string(ErrBuf);
|
||||
else {
|
||||
// TODO: Log error.
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -5303,14 +5218,13 @@ uint32 Bot::CreatedBotCount(uint32 botOwnerCharacterID, std::string* errorMessag
|
||||
uint32 Result = 0;
|
||||
|
||||
if(botOwnerCharacterID > 0) {
|
||||
char ErrBuf[MYSQL_ERRMSG_SIZE];
|
||||
std::string query;
|
||||
MYSQL_RES* DatasetResult;
|
||||
MYSQL_ROW DataRow;
|
||||
|
||||
StringFormat(query,"SELECT COUNT(BotID) FROM bots WHERE BotOwnerCharacterID=%i", botOwnerCharacterID);
|
||||
|
||||
if(database.RunQuery(query, ErrBuf, &DatasetResult)) {
|
||||
if(database.RunQuery(query, errorMessage, &DatasetResult)) {
|
||||
if(mysql_num_rows(DatasetResult) == 1) {
|
||||
DataRow = mysql_fetch_row(DatasetResult);
|
||||
if(DataRow)
|
||||
@@ -5320,7 +5234,9 @@ uint32 Bot::CreatedBotCount(uint32 botOwnerCharacterID, std::string* errorMessag
|
||||
mysql_free_result(DatasetResult);
|
||||
}
|
||||
else
|
||||
*errorMessage = std::string(ErrBuf);
|
||||
{
|
||||
// TODO: Log error.
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -5331,14 +5247,13 @@ uint32 Bot::GetBotOwnerCharacterID(uint32 botID, std::string* errorMessage) {
|
||||
uint32 Result = 0;
|
||||
|
||||
if(botID > 0) {
|
||||
char ErrBuf[MYSQL_ERRMSG_SIZE];
|
||||
std::string query;
|
||||
MYSQL_RES* DatasetResult;
|
||||
MYSQL_ROW DataRow;
|
||||
|
||||
StringFormat(query,"SELECT BotOwnerCharacterID FROM bots WHERE BotID = %u", botID);
|
||||
|
||||
if(database.RunQuery(query, ErrBuf, &DatasetResult)) {
|
||||
if(database.RunQuery(query, errorMessage, &DatasetResult)) {
|
||||
if(mysql_num_rows(DatasetResult) == 1) {
|
||||
if(DataRow = mysql_fetch_row(DatasetResult))
|
||||
Result = atoi(DataRow[0]);
|
||||
@@ -5347,7 +5262,9 @@ uint32 Bot::GetBotOwnerCharacterID(uint32 botID, std::string* errorMessage) {
|
||||
mysql_free_result(DatasetResult);
|
||||
}
|
||||
else
|
||||
*errorMessage = std::string(ErrBuf);
|
||||
{
|
||||
//TODO: log error message.
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -9326,14 +9243,14 @@ bool Bot::ProcessGuildRemoval(Client* guildOfficer, std::string botName) {
|
||||
void Bot::SetBotGuildMembership(uint32 botId, uint32 guildid, uint8 rank) {
|
||||
if(botId > 0) {
|
||||
std::string errorMessage;
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
std::string errbuf;
|
||||
std::string query;
|
||||
|
||||
if(guildid > 0) {
|
||||
|
||||
StringFormat(query,"REPLACE INTO botguildmembers SET char_id = %u, guild_id = %u, rank = %u;", botId, guildid, rank);
|
||||
|
||||
if(!database.RunQuery(query, errbuf)) {
|
||||
if(!database.RunQuery(query, &errbuf)) {
|
||||
errorMessage = std::string(errbuf);
|
||||
}
|
||||
}
|
||||
@@ -9341,7 +9258,7 @@ void Bot::SetBotGuildMembership(uint32 botId, uint32 guildid, uint8 rank) {
|
||||
|
||||
StringFormat(query, "DELETE FROM botguildmembers WHERE char_id = %u;",botId);
|
||||
|
||||
if(!database.RunQuery(query, errbuf)) {
|
||||
if(!database.RunQuery(query, &errbuf)) {
|
||||
errorMessage = std::string(errbuf);
|
||||
}
|
||||
}
|
||||
@@ -9356,7 +9273,6 @@ void Bot::LoadGuildMembership(uint32* guildId, uint8* guildRank, std::string* gu
|
||||
if(guildId && guildRank && guildName) {
|
||||
std::string errorMessage;
|
||||
std::string query;
|
||||
char TempErrorMessageBuffer[MYSQL_ERRMSG_SIZE];
|
||||
MYSQL_RES* DatasetResult;
|
||||
MYSQL_ROW DataRow;
|
||||
|
||||
@@ -9364,8 +9280,8 @@ void Bot::LoadGuildMembership(uint32* guildId, uint8* guildRank, std::string* gu
|
||||
"AS gm JOIN guilds AS g ON gm.guild_id = g.id "
|
||||
"WHERE gm.char_id = %u AND gm.mobtype = 'B';", GetBotID());
|
||||
|
||||
if(!database.RunQuery(query, TempErrorMessageBuffer, &DatasetResult)) {
|
||||
errorMessage = std::string(TempErrorMessageBuffer);
|
||||
if(!database.RunQuery(query, &errorMessage, &DatasetResult)) {
|
||||
// TODO: Record this error message to zone error log
|
||||
}
|
||||
else {
|
||||
while(DataRow = mysql_fetch_row(DatasetResult)) {
|
||||
@@ -9379,9 +9295,6 @@ void Bot::LoadGuildMembership(uint32* guildId, uint8* guildRank, std::string* gu
|
||||
}
|
||||
|
||||
|
||||
if(!errorMessage.empty()) {
|
||||
// TODO: Record this error message to zone error log
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+22
-22
@@ -3856,14 +3856,14 @@ void Client::SendWindow(uint32 PopupID, uint32 NegativeID, uint32 Buttons, const
|
||||
|
||||
void Client::KeyRingLoad()
|
||||
{
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
std::string errbuf;
|
||||
MYSQL_RES *result;
|
||||
MYSQL_ROW row;
|
||||
|
||||
std::string query;
|
||||
StringFormat(query, "SELECT item_id FROM keyring WHERE char_id='%i' ORDER BY item_id",character_id);
|
||||
|
||||
if (database.RunQuery(query, errbuf, &result))
|
||||
if (database.RunQuery(query, &errbuf, &result))
|
||||
{
|
||||
while(0 != (row = mysql_fetch_row(result))){
|
||||
keyring.push_back(atoi(row[0]));
|
||||
@@ -3878,7 +3878,7 @@ void Client::KeyRingLoad()
|
||||
void Client::KeyRingAdd(uint32 item_id)
|
||||
{
|
||||
if(0==item_id)return;
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
std::string errbuf;
|
||||
uint32 affected_rows = 0;
|
||||
std::string query;
|
||||
bool bFound = KeyRingCheck(item_id);
|
||||
@@ -3887,7 +3887,7 @@ void Client::KeyRingAdd(uint32 item_id)
|
||||
StringFormat(query, "INSERT INTO keyring(char_id,item_id) VALUES(%i,%i)",
|
||||
character_id, item_id);
|
||||
|
||||
if(database.RunQuery(query, errbuf, 0, &affected_rows))
|
||||
if(database.RunQuery(query, &errbuf, 0, &affected_rows))
|
||||
{
|
||||
Message(4,"Added to keyring.");
|
||||
}
|
||||
@@ -3928,14 +3928,14 @@ void Client::KeyRingList()
|
||||
|
||||
bool Client::IsDiscovered(uint32 itemid) {
|
||||
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
std::string errbuf;
|
||||
std::string query;
|
||||
MYSQL_RES *result;
|
||||
MYSQL_ROW row;
|
||||
|
||||
StringFormat(query,"SELECT count(*) FROM discovered_items WHERE item_id = '%lu'", itemid);
|
||||
|
||||
if (database.RunQuery(query, errbuf, &result))
|
||||
if (database.RunQuery(query, &errbuf, &result))
|
||||
{
|
||||
row = mysql_fetch_row(result);
|
||||
if (atoi(row[0]))
|
||||
@@ -3954,7 +3954,7 @@ bool Client::IsDiscovered(uint32 itemid) {
|
||||
|
||||
void Client::DiscoverItem(uint32 itemid) {
|
||||
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
std::string errbuf;
|
||||
std::string query;
|
||||
MYSQL_RES *result;
|
||||
|
||||
@@ -3963,7 +3963,7 @@ void Client::DiscoverItem(uint32 itemid) {
|
||||
"discovered_date=UNIX_TIMESTAMP(), account_status=%i",
|
||||
itemid, GetName(), Admin());
|
||||
|
||||
if (database.RunQuery(query, errbuf, &result))
|
||||
if (database.RunQuery(query, &errbuf, &result))
|
||||
{
|
||||
mysql_free_result(result);
|
||||
}
|
||||
@@ -5109,7 +5109,7 @@ const bool Client::IsMQExemptedArea(uint32 zoneID, float x, float y, float z) co
|
||||
void Client::SendRewards()
|
||||
{
|
||||
std::vector<ClientReward> rewards;
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
std::string errbuf;
|
||||
std::string query;
|
||||
MYSQL_RES *result;
|
||||
MYSQL_ROW row;
|
||||
@@ -5119,7 +5119,7 @@ void Client::SendRewards()
|
||||
"ORDER by reward_id",
|
||||
AccountID());
|
||||
|
||||
if(database.RunQuery(query,errbuf,&result))
|
||||
if(database.RunQuery(query,&errbuf,&result))
|
||||
{
|
||||
while((row = mysql_fetch_row(result)))
|
||||
{
|
||||
@@ -5132,7 +5132,7 @@ void Client::SendRewards()
|
||||
}
|
||||
else
|
||||
{
|
||||
LogFile->write(EQEMuLog::Error, "Error in Client::SendRewards(): %s (%s)", query.c_str(), errbuf);
|
||||
LogFile->write(EQEMuLog::Error, "Error in Client::SendRewards(): %s (%s)", query.c_str(), errbuf.c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -5199,7 +5199,7 @@ bool Client::TryReward(uint32 claim_id)
|
||||
return false;
|
||||
}
|
||||
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
std::string errbuf;
|
||||
std::string query;
|
||||
MYSQL_RES *result;
|
||||
MYSQL_ROW row;
|
||||
@@ -5211,7 +5211,7 @@ bool Client::TryReward(uint32 claim_id)
|
||||
"account_id=%i AND reward_id=%i",
|
||||
AccountID(), claim_id);
|
||||
|
||||
if(database.RunQuery(query,errbuf,&result))
|
||||
if(database.RunQuery(query,&errbuf,&result))
|
||||
{
|
||||
row = mysql_fetch_row(result);
|
||||
if(row)
|
||||
@@ -5227,7 +5227,7 @@ bool Client::TryReward(uint32 claim_id)
|
||||
}
|
||||
else
|
||||
{
|
||||
LogFile->write(EQEMuLog::Error, "Error in Client::TryReward(): %s (%s)", query.c_str(), errbuf);
|
||||
LogFile->write(EQEMuLog::Error, "Error in Client::TryReward(): %s (%s)", query.c_str(), errbuf.c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -5257,9 +5257,9 @@ bool Client::TryReward(uint32 claim_id)
|
||||
"account_id=%i AND reward_id=%i",
|
||||
AccountID(), claim_id);
|
||||
|
||||
if(!database.RunQuery(query, errbuf))
|
||||
if(!database.RunQuery(query, &errbuf))
|
||||
{
|
||||
LogFile->write(EQEMuLog::Error, "Error in Client::TryReward(): %s (%s)", query.c_str(), errbuf);
|
||||
LogFile->write(EQEMuLog::Error, "Error in Client::TryReward(): %s (%s)", query.c_str(), errbuf.c_str());
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -5268,9 +5268,9 @@ bool Client::TryReward(uint32 claim_id)
|
||||
" WHERE account_id=%i AND reward_id=%i",
|
||||
AccountID(), claim_id);
|
||||
|
||||
if(!database.RunQuery(query,errbuf))
|
||||
if(!database.RunQuery(query,&errbuf))
|
||||
{
|
||||
LogFile->write(EQEMuLog::Error, "Error in Client::TryReward(): %s (%s)", query.c_str(), errbuf);
|
||||
LogFile->write(EQEMuLog::Error, "Error in Client::TryReward(): %s (%s)", query.c_str(), errbuf.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7637,7 +7637,7 @@ some day.
|
||||
|
||||
void Client::LoadAccountFlags()
|
||||
{
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
std::string errbuf;
|
||||
std::string query;
|
||||
MYSQL_RES *result;
|
||||
MYSQL_ROW row;
|
||||
@@ -7648,7 +7648,7 @@ void Client::LoadAccountFlags()
|
||||
"account_flags WHERE p_accid = '%d'",
|
||||
account_id);
|
||||
|
||||
if(database.RunQuery(query, errbuf, &result))
|
||||
if(database.RunQuery(query, &errbuf, &result))
|
||||
{
|
||||
while(row = mysql_fetch_row(result))
|
||||
{
|
||||
@@ -7666,14 +7666,14 @@ void Client::LoadAccountFlags()
|
||||
|
||||
void Client::SetAccountFlag(std::string flag, std::string val)
|
||||
{
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
std::string errbuf;
|
||||
std::string query;
|
||||
|
||||
StringFormat(query, "REPLACE INTO account_flags (p_accid, p_flag, p_value) "
|
||||
"VALUES( '%d', '%s', '%s')",
|
||||
account_id, flag.c_str(), val.c_str());
|
||||
|
||||
if(!database.RunQuery(query, errbuf))
|
||||
if(!database.RunQuery(query, &errbuf))
|
||||
{
|
||||
std::cerr << "Error in SetAccountFlags query '" << query << "' " << errbuf << std::endl;
|
||||
}
|
||||
|
||||
+13
-13
@@ -3240,14 +3240,14 @@ void Client::Handle_OP_ItemLinkClick(const EQApplicationPacket *app)
|
||||
|
||||
if (sayid && sayid > 0)
|
||||
{
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
std::string errbuf;
|
||||
std::string query;
|
||||
MYSQL_RES *result;
|
||||
MYSQL_ROW row;
|
||||
|
||||
StringFormat(query, "SELECT `phrase` FROM saylink WHERE `id` = '%i'", sayid);
|
||||
|
||||
if(database.RunQuery(query,errbuf,&result))
|
||||
if(database.RunQuery(query, &errbuf,&result))
|
||||
{
|
||||
if (mysql_num_rows(result) == 1)
|
||||
{
|
||||
@@ -8733,10 +8733,10 @@ void Client::DBAWComplete(uint8 workpt_b1, DBAsyncWork* dbaw) {
|
||||
break;
|
||||
}
|
||||
case DBA_b1_Entity_Client_Save: {
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
std::string errbuf;
|
||||
uint32 affected_rows = 0;
|
||||
DBAsyncQuery* dbaq = dbaw->PopAnswer();
|
||||
if (dbaq->GetAnswer(errbuf, 0, &affected_rows) && affected_rows == 1) {
|
||||
if (dbaq->GetAnswer(&errbuf, 0, &affected_rows) && affected_rows == 1) {
|
||||
if (dbaq->QPT()) {
|
||||
SaveBackup();
|
||||
}
|
||||
@@ -8745,7 +8745,7 @@ void Client::DBAWComplete(uint8 workpt_b1, DBAsyncWork* dbaw) {
|
||||
std::cout << "Async client save failed. '" << errbuf << "'" << std::endl;
|
||||
Message(13, "Error: Asyncronous save of your character failed.");
|
||||
if (Admin() >= 200)
|
||||
Message(13, "errbuf: %s", errbuf);
|
||||
Message(13, "errbuf: %s", errbuf.c_str());
|
||||
}
|
||||
pQueuedSaveWorkID = 0;
|
||||
break;
|
||||
@@ -8763,7 +8763,7 @@ bool Client::FinishConnState2(DBAsyncWork* dbaw) {
|
||||
EQApplicationPacket* outapp = 0;
|
||||
MYSQL_RES* result = 0;
|
||||
bool loaditems = 0;
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
std::string errbuf;
|
||||
uint32 i;
|
||||
|
||||
for (i=1; i<=3; i++) {
|
||||
@@ -8772,7 +8772,7 @@ bool Client::FinishConnState2(DBAsyncWork* dbaw) {
|
||||
std::cout << "Error in FinishConnState2(): dbaq==0" << std::endl;
|
||||
return false;
|
||||
}
|
||||
if (!dbaq->GetAnswer(errbuf, &result)) {
|
||||
if (!dbaq->GetAnswer(&errbuf, &result)) {
|
||||
std::cout << "Error in FinishConnState2(): !dbaq[" << dbaq->QPT() << "]->GetAnswer(): " << errbuf << std::endl;
|
||||
return false;
|
||||
}
|
||||
@@ -11519,7 +11519,7 @@ void Client::Handle_OP_SetStartCity(const EQApplicationPacket *app)
|
||||
return;
|
||||
}
|
||||
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
std::string errbuf;
|
||||
std::string query;
|
||||
MYSQL_RES *result = nullptr;
|
||||
MYSQL_ROW row = 0;
|
||||
@@ -11533,7 +11533,7 @@ void Client::Handle_OP_SetStartCity(const EQApplicationPacket *app)
|
||||
"WHERE player_class=%i AND player_deity=%i AND player_race=%i",
|
||||
m_pp.class_, m_pp.deity, m_pp.race);
|
||||
|
||||
database.RunQuery(query, errbuf, &result);
|
||||
database.RunQuery(query, &errbuf, &result);
|
||||
|
||||
if(!result) {
|
||||
LogFile->write(EQEMuLog::Error, "No valid start zones found for /setstartcity");
|
||||
@@ -11564,7 +11564,7 @@ void Client::Handle_OP_SetStartCity(const EQApplicationPacket *app)
|
||||
"WHERE player_class=%i AND player_deity=%i AND player_race=%i",
|
||||
m_pp.class_, m_pp.deity, m_pp.race);
|
||||
|
||||
database.RunQuery(query,errbuf,&result);
|
||||
database.RunQuery(query,&errbuf,&result);
|
||||
|
||||
Message(15,"Use \"/startcity #\" to choose a home city from the following list:");
|
||||
char* name;
|
||||
@@ -11698,7 +11698,7 @@ void Client::Handle_OP_GMSearchCorpse(const EQApplicationPacket *app)
|
||||
|
||||
GMSearchCorpse_Struct *gmscs = (GMSearchCorpse_Struct *)app->pBuffer;
|
||||
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
std::string errbuf;
|
||||
std::string query;
|
||||
MYSQL_RES *Result;
|
||||
MYSQL_ROW Row;
|
||||
@@ -11711,7 +11711,7 @@ void Client::Handle_OP_GMSearchCorpse(const EQApplicationPacket *app)
|
||||
"player_corpses where charname like '%%%s%%' order by charname limit %i",
|
||||
escSearchString.c_str(), MaxResults);
|
||||
|
||||
if (database.RunQuery(query, errbuf, &Result))
|
||||
if (database.RunQuery(query, &errbuf, &Result))
|
||||
{
|
||||
|
||||
int NumberOfRows = mysql_num_rows(Result);
|
||||
@@ -11773,7 +11773,7 @@ void Client::Handle_OP_GMSearchCorpse(const EQApplicationPacket *app)
|
||||
SendPopupToClient("Corpses", PopupText.c_str());
|
||||
}
|
||||
else{
|
||||
Message(0, "Query failed: %s.", errbuf);
|
||||
Message(0, "Query failed: %s.", errbuf.c_str());
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
+181
-181
File diff suppressed because it is too large
Load Diff
+8
-8
@@ -569,7 +569,7 @@ void Doors::DumpDoor(){
|
||||
}
|
||||
|
||||
int32 ZoneDatabase::GetDoorsCount(uint32* oMaxID, const char *zone_name, int16 version) {
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
std::string errbuf;
|
||||
MYSQL_RES *result;
|
||||
MYSQL_ROW row;
|
||||
|
||||
@@ -577,7 +577,7 @@ int32 ZoneDatabase::GetDoorsCount(uint32* oMaxID, const char *zone_name, int16 v
|
||||
|
||||
StringFormat(query,"SELECT MAX(id), count(*) FROM doors WHERE zone='%s' AND (version=%u OR version=-1)",zone_name, version);
|
||||
|
||||
if (RunQuery(query, errbuf, &result)) {
|
||||
if (RunQuery(query, &errbuf, &result)) {
|
||||
row = mysql_fetch_row(result);
|
||||
if (row != nullptr && row[1] != 0) {
|
||||
int32 ret = atoi(row[1]);
|
||||
@@ -601,7 +601,7 @@ int32 ZoneDatabase::GetDoorsCount(uint32* oMaxID, const char *zone_name, int16 v
|
||||
}
|
||||
|
||||
int32 ZoneDatabase::GetDoorsCountPlusOne(const char *zone_name, int16 version) {
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
std::string errbuf;
|
||||
std::string query;
|
||||
uint32 oMaxID = 0;
|
||||
|
||||
@@ -611,7 +611,7 @@ int32 ZoneDatabase::GetDoorsCountPlusOne(const char *zone_name, int16 version) {
|
||||
|
||||
StringFormat(query, "SELECT MAX(id) FROM doors WHERE zone='%s' AND version=%u", zone_name, version);
|
||||
|
||||
if (RunQuery(query, errbuf, &result)) {
|
||||
if (RunQuery(query, &errbuf, &result)) {
|
||||
row = mysql_fetch_row(result);
|
||||
if (row != nullptr && row[1] != 0) {
|
||||
if (row[0])
|
||||
@@ -632,7 +632,7 @@ int32 ZoneDatabase::GetDoorsCountPlusOne(const char *zone_name, int16 version) {
|
||||
}
|
||||
|
||||
int32 ZoneDatabase::GetDoorsDBCountPlusOne(const char *zone_name, int16 version) {
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
std::string errbuf;
|
||||
std::string query;
|
||||
uint32 oMaxID = 0;
|
||||
|
||||
@@ -641,7 +641,7 @@ int32 ZoneDatabase::GetDoorsDBCountPlusOne(const char *zone_name, int16 version)
|
||||
|
||||
StringFormat(query, "SELECT MAX(doorid) FROM doors WHERE zone='%s' AND (version=%u OR version=-1)", zone_name, version);
|
||||
|
||||
if (RunQuery(query, errbuf, &result)) {
|
||||
if (RunQuery(query, &errbuf, &result)) {
|
||||
row = mysql_fetch_row(result);
|
||||
if (row != nullptr && row[1] != 0) {
|
||||
if (row[0])
|
||||
@@ -663,7 +663,7 @@ int32 ZoneDatabase::GetDoorsDBCountPlusOne(const char *zone_name, int16 version)
|
||||
|
||||
bool ZoneDatabase::LoadDoors(int32 iDoorCount, Door *into, const char *zone_name, int16 version) {
|
||||
LogFile->write(EQEMuLog::Status, "Loading Doors from database...");
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
std::string errbuf;
|
||||
std::string query;
|
||||
MYSQL_RES *result;
|
||||
MYSQL_ROW row;
|
||||
@@ -677,7 +677,7 @@ bool ZoneDatabase::LoadDoors(int32 iDoorCount, Door *into, const char *zone_name
|
||||
"FROM doors WHERE zone='%s' AND (version=%u OR version=-1) "
|
||||
"ORDER BY doorid asc", zone_name, version);
|
||||
|
||||
if (RunQuery(query, errbuf, &result)) {
|
||||
if (RunQuery(query, &errbuf, &result)) {
|
||||
int32 r;
|
||||
for(r = 0; (row = mysql_fetch_row(result)); r++) {
|
||||
if(r >= iDoorCount) {
|
||||
|
||||
+5
-5
@@ -85,7 +85,7 @@ CREATE TABLE fishing (
|
||||
|
||||
// This allows EqEmu to have zone specific foraging - BoB
|
||||
uint32 ZoneDatabase::GetZoneForage(uint32 ZoneID, uint8 skill) {
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
std::string errbuf;
|
||||
std::string query;
|
||||
MYSQL_RES *result;
|
||||
MYSQL_ROW row;
|
||||
@@ -103,7 +103,7 @@ uint32 ZoneDatabase::GetZoneForage(uint32 ZoneID, uint8 skill) {
|
||||
|
||||
StringFormat(query,"SELECT itemid,chance FROM forage WHERE zoneid= '%i' and level <= '%i' LIMIT %i", ZoneID, skill, FORAGE_ITEM_LIMIT);
|
||||
|
||||
if (RunQuery(query, errbuf, &result))
|
||||
if (RunQuery(query, &errbuf, &result))
|
||||
{
|
||||
while ((row = mysql_fetch_row(result)) && (index < FORAGE_ITEM_LIMIT)) {
|
||||
item[index] = atoi(row[0]);
|
||||
@@ -116,7 +116,7 @@ uint32 ZoneDatabase::GetZoneForage(uint32 ZoneID, uint8 skill) {
|
||||
mysql_free_result(result);
|
||||
}
|
||||
else {
|
||||
LogFile->write(EQEMuLog::Error, "Error in Forage query '%s': %s", query.c_str(), errbuf);
|
||||
LogFile->write(EQEMuLog::Error, "Error in Forage query '%s': %s", query.c_str(), errbuf.c_str());
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -143,7 +143,7 @@ uint32 ZoneDatabase::GetZoneForage(uint32 ZoneID, uint8 skill) {
|
||||
|
||||
uint32 ZoneDatabase::GetZoneFishing(uint32 ZoneID, uint8 skill, uint32 &npc_id, uint8 &npc_chance)
|
||||
{
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
std::string errbuf;
|
||||
std::string query;
|
||||
MYSQL_RES *result;
|
||||
MYSQL_ROW row;
|
||||
@@ -163,7 +163,7 @@ uint32 ZoneDatabase::GetZoneFishing(uint32 ZoneID, uint8 skill, uint32 &npc_id,
|
||||
|
||||
StringFormat(query,"SELECT itemid,chance,npc_id,npc_chance FROM fishing WHERE (zoneid= '%i' || zoneid = 0) and skill_level <= '%i'",ZoneID, skill );
|
||||
|
||||
if (RunQuery(query,errbuf, &result))
|
||||
if (RunQuery(query, &errbuf, &result))
|
||||
{
|
||||
while ((row = mysql_fetch_row(result))&&(index<50)) {
|
||||
item[index] = atoi(row[0]);
|
||||
|
||||
+30
-34
@@ -956,17 +956,17 @@ void Group::TeleportGroup(Mob* sender, uint32 zoneID, uint16 instance_id, float
|
||||
}
|
||||
|
||||
bool Group::LearnMembers() {
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
std::string errbuf;
|
||||
std::string query;
|
||||
MYSQL_RES *result;
|
||||
MYSQL_ROW row;
|
||||
|
||||
StringFormat(query, "SELECT name FROM group_id WHERE groupid=%lu", (unsigned long)GetID());
|
||||
|
||||
if (database.RunQuery(query,errbuf,&result)){
|
||||
if (database.RunQuery(query,&errbuf,&result)){
|
||||
if(mysql_num_rows(result) < 1) { //could prolly be 2
|
||||
mysql_free_result(result);
|
||||
LogFile->write(EQEMuLog::Error, "Error getting group members for group %lu: %s", (unsigned long)GetID(), errbuf);
|
||||
LogFile->write(EQEMuLog::Error, "Error getting group members for group %lu: %s", (unsigned long)GetID(), errbuf.c_str());
|
||||
return false;
|
||||
}
|
||||
int i = 0;
|
||||
@@ -1272,15 +1272,14 @@ void Group::DelegateMainTank(const char *NewMainTankName, uint8 toggle)
|
||||
}
|
||||
|
||||
if(updateDB) {
|
||||
char errbuff[MYSQL_ERRMSG_SIZE];
|
||||
|
||||
std::string errbuff;
|
||||
std::string query;
|
||||
|
||||
StringFormat(query, "UPDATE group_leaders SET maintank='%s' WHERE gid=%i LIMIT 1",
|
||||
MainTankName.c_str(), GetID());
|
||||
|
||||
if (!database.RunQuery(query, errbuff))
|
||||
LogFile->write(EQEMuLog::Error, "Unable to set group main tank: %s\n", errbuff);
|
||||
if (!database.RunQuery(query, &errbuff))
|
||||
LogFile->write(EQEMuLog::Error, "Unable to set group main tank: %s\n", errbuff.c_str());
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1322,15 +1321,14 @@ void Group::DelegateMainAssist(const char *NewMainAssistName, uint8 toggle)
|
||||
}
|
||||
|
||||
if(updateDB) {
|
||||
char errbuff[MYSQL_ERRMSG_SIZE];
|
||||
|
||||
std::string errbuff;
|
||||
std::string query;
|
||||
|
||||
StringFormat(query, "UPDATE group_leaders SET assist='%s' WHERE gid=%i LIMIT 1",
|
||||
MainAssistName.c_str(), GetID());
|
||||
|
||||
if (!database.RunQuery(query, errbuff))
|
||||
LogFile->write(EQEMuLog::Error, "Unable to set group main assist: %s\n", errbuff);
|
||||
if (!database.RunQuery(query, &errbuff))
|
||||
LogFile->write(EQEMuLog::Error, "Unable to set group main assist: %s\n", errbuff.c_str());
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1372,15 +1370,14 @@ void Group::DelegatePuller(const char *NewPullerName, uint8 toggle)
|
||||
}
|
||||
|
||||
if(updateDB) {
|
||||
char errbuff[MYSQL_ERRMSG_SIZE];
|
||||
|
||||
std::string errbuff;
|
||||
std::string query;
|
||||
|
||||
StringFormat(query, "UPDATE group_leaders SET puller='%s' WHERE gid=%i LIMIT 1",
|
||||
PullerName.c_str(), GetID());
|
||||
|
||||
if (!database.RunQuery(query, errbuff))
|
||||
LogFile->write(EQEMuLog::Error, "Unable to set group main puller: %s\n", errbuff);
|
||||
if (!database.RunQuery(query, &errbuff))
|
||||
LogFile->write(EQEMuLog::Error, "Unable to set group main puller: %s\n", errbuff.c_str());
|
||||
|
||||
}
|
||||
|
||||
@@ -1527,15 +1524,15 @@ void Group::UnDelegateMainTank(const char *OldMainTankName, uint8 toggle)
|
||||
// informing them of the change and update the group_leaders table.
|
||||
//
|
||||
if(OldMainTankName == MainTankName) {
|
||||
char errbuff[MYSQL_ERRMSG_SIZE];
|
||||
std::string errbuff;
|
||||
|
||||
std::string query;
|
||||
|
||||
StringFormat(query, "UPDATE group_leaders SET maintank='' WHERE gid=%i LIMIT 1",
|
||||
GetID());
|
||||
|
||||
if (!database.RunQuery(query, errbuff))
|
||||
LogFile->write(EQEMuLog::Error, "Unable to clear group main tank: %s\n", errbuff);
|
||||
if (!database.RunQuery(query, &errbuff))
|
||||
LogFile->write(EQEMuLog::Error, "Unable to clear group main tank: %s\n", errbuff.c_str());
|
||||
|
||||
if(!toggle) {
|
||||
for(uint32 i = 0; i < MAX_GROUP_MEMBERS; ++i) {
|
||||
@@ -1581,15 +1578,14 @@ void Group::UnDelegateMainAssist(const char *OldMainAssistName, uint8 toggle)
|
||||
|
||||
safe_delete(outapp);
|
||||
|
||||
char errbuff[MYSQL_ERRMSG_SIZE];
|
||||
|
||||
std::string errbuff;
|
||||
std::string query;
|
||||
|
||||
StringFormat(query, "UPDATE group_leaders SET assist='' WHERE gid=%i LIMIT 1",
|
||||
GetID());
|
||||
|
||||
if (!database.RunQuery(query, errbuff))
|
||||
LogFile->write(EQEMuLog::Error, "Unable to clear group main assist: %s\n", errbuff);
|
||||
if (!database.RunQuery(query, &errbuff))
|
||||
LogFile->write(EQEMuLog::Error, "Unable to clear group main assist: %s\n", errbuff.c_str());
|
||||
|
||||
|
||||
if(!toggle)
|
||||
@@ -1614,14 +1610,14 @@ void Group::UnDelegatePuller(const char *OldPullerName, uint8 toggle)
|
||||
// informing them of the change and update the group_leaders table.
|
||||
//
|
||||
if(OldPullerName == PullerName) {
|
||||
char errbuff[MYSQL_ERRMSG_SIZE];
|
||||
std::string errbuff;
|
||||
std::string query;
|
||||
|
||||
StringFormat(query, "UPDATE group_leaders SET puller='' WHERE gid=%i LIMIT 1",
|
||||
GetID());
|
||||
|
||||
if (!database.RunQuery(query, errbuff))
|
||||
LogFile->write(EQEMuLog::Error, "Unable to clear group main puller: %s\n", errbuff);
|
||||
if (!database.RunQuery(query, &errbuff))
|
||||
LogFile->write(EQEMuLog::Error, "Unable to clear group main puller: %s\n", errbuff.c_str());
|
||||
|
||||
if(!toggle) {
|
||||
for(uint32 i = 0; i < MAX_GROUP_MEMBERS; ++i) {
|
||||
@@ -1756,15 +1752,15 @@ void Group::DelegateMarkNPC(const char *NewNPCMarkerName)
|
||||
if(members[i] && members[i]->IsClient())
|
||||
NotifyMarkNPC(members[i]->CastToClient());
|
||||
|
||||
char errbuff[MYSQL_ERRMSG_SIZE];
|
||||
std::string errbuff;
|
||||
|
||||
std::string query;
|
||||
|
||||
StringFormat(query, "UPDATE group_leaders SET marknpc='%s' WHERE gid=%i LIMIT 1",
|
||||
NewNPCMarkerName, GetID());
|
||||
|
||||
if (!database.RunQuery(query, errbuff))
|
||||
LogFile->write(EQEMuLog::Error, "Unable to set group mark npc: %s\n", errbuff);
|
||||
if (!database.RunQuery(query, &errbuff))
|
||||
LogFile->write(EQEMuLog::Error, "Unable to set group mark npc: %s\n", errbuff.c_str());
|
||||
|
||||
|
||||
}
|
||||
@@ -1843,15 +1839,15 @@ void Group::UnDelegateMarkNPC(const char *OldNPCMarkerName)
|
||||
|
||||
NPCMarkerName.clear();
|
||||
|
||||
char errbuff[MYSQL_ERRMSG_SIZE];
|
||||
std::string errbuff;
|
||||
|
||||
std::string query;
|
||||
|
||||
StringFormat(query, "UPDATE group_leaders SET marknpc='' WHERE gid=%i LIMIT 1",
|
||||
GetID());
|
||||
|
||||
if (!database.RunQuery(query, errbuff))
|
||||
LogFile->write(EQEMuLog::Error, "Unable to clear group marknpc: %s\n", errbuff);
|
||||
if (!database.RunQuery(query, &errbuff))
|
||||
LogFile->write(EQEMuLog::Error, "Unable to clear group marknpc: %s\n", errbuff.c_str());
|
||||
|
||||
}
|
||||
|
||||
@@ -1874,9 +1870,9 @@ void Group::SaveGroupLeaderAA()
|
||||
|
||||
query.append(endingOfQuery);
|
||||
|
||||
char errbuff[MYSQL_ERRMSG_SIZE];
|
||||
if (!database.RunQuery(query, errbuff))
|
||||
LogFile->write(EQEMuLog::Error, "Unable to store LeadershipAA: %s\n", errbuff);
|
||||
std::string errbuff;
|
||||
if (!database.RunQuery(query, &errbuff))
|
||||
LogFile->write(EQEMuLog::Error, "Unable to store LeadershipAA: %s\n", errbuff.c_str());
|
||||
|
||||
}
|
||||
|
||||
|
||||
+6
-6
@@ -380,15 +380,15 @@ void Client::GuildChangeRank(const char* name, uint32 guild_id, uint32 oldrank,
|
||||
|
||||
bool ZoneDatabase::CheckGuildDoor(uint8 doorid,uint16 guild_id,const char* zone) {
|
||||
MYSQL_ROW row;
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
std::string errbuf;
|
||||
std::string query;
|
||||
MYSQL_RES *result;
|
||||
|
||||
StringFormat(query, "SELECT guild FROM doors where doorid=%i AND zone='%s'",
|
||||
doorid-128, zone);
|
||||
|
||||
if (!RunQuery(query, errbuf, &result)) {
|
||||
LogFile->write(EQEMuLog::Error, "Error in CheckGuildDoor query '%s': %s", query.c_str(), errbuf);
|
||||
if (!RunQuery(query, &errbuf, &result)) {
|
||||
LogFile->write(EQEMuLog::Error, "Error in CheckGuildDoor query '%s': %s", query.c_str(), errbuf.c_str());
|
||||
return false;
|
||||
} else {
|
||||
if (mysql_num_rows(result) == 1) {
|
||||
@@ -413,7 +413,7 @@ bool ZoneDatabase::CheckGuildDoor(uint8 doorid,uint16 guild_id,const char* zone)
|
||||
}
|
||||
|
||||
bool ZoneDatabase::SetGuildDoor(uint8 doorid,uint16 guild_id, const char* zone) {
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
std::string errbuf;
|
||||
std::string query;
|
||||
uint32 affected_rows = 0;
|
||||
if (doorid > 127)
|
||||
@@ -422,8 +422,8 @@ bool ZoneDatabase::SetGuildDoor(uint8 doorid,uint16 guild_id, const char* zone)
|
||||
StringFormat(query, "UPDATE doors SET guild = %i WHERE (doorid=%i) AND (zone='%s')",
|
||||
guild_id, doorid, zone);
|
||||
|
||||
if (!RunQuery(query, errbuf, nullptr,&affected_rows)) {
|
||||
LogFile->write(EQEMuLog::Error, "Error in SetGuildDoor query '%s': %s", query.c_str(), errbuf);
|
||||
if (!RunQuery(query, &errbuf, nullptr, &affected_rows)) {
|
||||
LogFile->write(EQEMuLog::Error, "Error in SetGuildDoor query '%s': %s", query.c_str(), errbuf.c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
+20
-20
@@ -646,7 +646,7 @@ GuildBankManager::~GuildBankManager()
|
||||
|
||||
bool GuildBankManager::Load(uint32 GuildID)
|
||||
{
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
std::string errbuf;
|
||||
std::string query;
|
||||
MYSQL_RES *result;
|
||||
MYSQL_ROW row;
|
||||
@@ -654,7 +654,7 @@ bool GuildBankManager::Load(uint32 GuildID)
|
||||
StringFormat(query, "SELECT `area`, `slot`, `itemid`, `qty`, `donator`, `permissions`, `whofor` "
|
||||
"FROM `guild_bank` WHERE `guildid` = %i", GuildID);
|
||||
|
||||
if(database.RunQuery(query, errbuf, &result))
|
||||
if(database.RunQuery(query, &errbuf, &result))
|
||||
{
|
||||
GuildBank *Bank = new GuildBank;
|
||||
|
||||
@@ -729,7 +729,7 @@ bool GuildBankManager::Load(uint32 GuildID)
|
||||
}
|
||||
else
|
||||
{
|
||||
_log(GUILDS__BANK_ERROR, "Error Loading guild bank: %s, %s", query.c_str(), errbuf);
|
||||
_log(GUILDS__BANK_ERROR, "Error Loading guild bank: %s, %s", query.c_str(), errbuf.c_str());
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -924,7 +924,7 @@ bool GuildBankManager::AddItem(uint32 GuildID, uint8 Area, uint32 ItemID, int32
|
||||
return false;
|
||||
}
|
||||
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
std::string errbuf;
|
||||
|
||||
std::string query;
|
||||
|
||||
@@ -934,9 +934,9 @@ bool GuildBankManager::AddItem(uint32 GuildID, uint8 Area, uint32 ItemID, int32
|
||||
GuildID, Area, Slot, ItemID, QtyOrCharges,
|
||||
Donator, Permissions, WhoFor);
|
||||
|
||||
if(!database.RunQuery(query, errbuf))
|
||||
if(!database.RunQuery(query, &errbuf))
|
||||
{
|
||||
_log(GUILDS__BANK_ERROR, "Insert Error: %s : %s", query.c_str(), errbuf);
|
||||
_log(GUILDS__BANK_ERROR, "Insert Error: %s : %s", query.c_str(), errbuf.c_str());
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -1006,16 +1006,16 @@ int GuildBankManager::Promote(uint32 GuildID, int SlotID)
|
||||
|
||||
strn0cpy((*Iterator)->Items.MainArea[MainSlot].WhoFor, (*Iterator)->Items.DepositArea[SlotID].WhoFor, sizeof((*Iterator)->Items.MainArea[MainSlot].WhoFor));
|
||||
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
std::string errbuf;
|
||||
std::string query;
|
||||
|
||||
StringFormat(query, "UPDATE `guild_bank` SET `area` = 1, `slot` = %i WHERE "
|
||||
"`guildid` = %i AND `area` = 0 AND `slot` = %i LIMIT 1",
|
||||
MainSlot, GuildID, SlotID);
|
||||
|
||||
if(!database.RunQuery(query, errbuf))
|
||||
if(!database.RunQuery(query, &errbuf))
|
||||
{
|
||||
_log(GUILDS__BANK_ERROR, "error promoting item: %s : %s", query.c_str(), errbuf);
|
||||
_log(GUILDS__BANK_ERROR, "error promoting item: %s : %s", query.c_str(), errbuf.c_str());
|
||||
|
||||
return -1;
|
||||
}
|
||||
@@ -1066,13 +1066,13 @@ void GuildBankManager::SetPermissions(uint32 GuildID, uint16 SlotID, uint32 Perm
|
||||
return;
|
||||
}
|
||||
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
std::string errbuf;
|
||||
std::string query;
|
||||
|
||||
StringFormat(query, "UPDATE `guild_bank` SET `permissions` = %i, `whofor` = '%s' WHERE `guildid` = %i AND `area` = 1 AND `slot` = %i LIMIT 1",Permissions, MemberName, GuildID, SlotID);
|
||||
|
||||
if(!database.RunQuery(query, errbuf)) {
|
||||
_log(GUILDS__BANK_ERROR, "error changing permissions: %s : %s", query.c_str(), errbuf);
|
||||
if(!database.RunQuery(query, &errbuf)) {
|
||||
_log(GUILDS__BANK_ERROR, "error changing permissions: %s : %s", query.c_str(), errbuf.c_str());
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -1200,7 +1200,7 @@ bool GuildBankManager::DeleteItem(uint32 GuildID, uint16 Area, uint16 SlotID, ui
|
||||
if(Iterator == Banks.end())
|
||||
return false;
|
||||
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
std::string errbuf;
|
||||
|
||||
std::string query;
|
||||
|
||||
@@ -1232,9 +1232,9 @@ bool GuildBankManager::DeleteItem(uint32 GuildID, uint16 Area, uint16 SlotID, ui
|
||||
"AND `area` = %i AND `slot` = %i LIMIT 1",
|
||||
GuildID, Area, SlotID);
|
||||
|
||||
if(!database.RunQuery(query, errbuf))
|
||||
if(!database.RunQuery(query, &errbuf))
|
||||
{
|
||||
_log(GUILDS__BANK_ERROR, "Delete item failed. %s : %s", query.c_str(), errbuf);
|
||||
_log(GUILDS__BANK_ERROR, "Delete item failed. %s : %s", query.c_str(), errbuf.c_str());
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -1249,9 +1249,9 @@ bool GuildBankManager::DeleteItem(uint32 GuildID, uint16 Area, uint16 SlotID, ui
|
||||
"`guildid` = %i AND `area` = %i AND `slot` = %i LIMIT 1",
|
||||
BankArea[SlotID].Quantity - Quantity, GuildID, Area, SlotID);
|
||||
|
||||
if(!database.RunQuery(query, errbuf))
|
||||
if(!database.RunQuery(query, &errbuf))
|
||||
{
|
||||
_log(GUILDS__BANK_ERROR, "Update item failed. %s : %s", query.c_str(), errbuf);
|
||||
_log(GUILDS__BANK_ERROR, "Update item failed. %s : %s", query.c_str(), errbuf.c_str());
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -1408,16 +1408,16 @@ void GuildBankManager::UpdateItemQuantity(uint32 GuildID, uint16 Area, uint16 Sl
|
||||
{
|
||||
// Helper method for MergeStacks. Assuming all passed parameters are valid.
|
||||
//
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
std::string errbuf;
|
||||
std::string query;
|
||||
|
||||
StringFormat(query, "UPDATE `guild_bank` SET `qty` = %i where "
|
||||
"`guildid` = %i AND `area` = %i AND `slot` = %i LIMIT 1",
|
||||
Quantity, GuildID, Area, SlotID);
|
||||
|
||||
if(!database.RunQuery(query, errbuf))
|
||||
if(!database.RunQuery(query, &errbuf))
|
||||
{
|
||||
_log(GUILDS__BANK_ERROR, "Update item quantity failed. %s : %s", query.c_str(), errbuf);
|
||||
_log(GUILDS__BANK_ERROR, "Update item quantity failed. %s : %s", query.c_str(), errbuf.c_str());
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
+3
-3
@@ -71,14 +71,14 @@ const NPCType *Horse::BuildHorseType(uint16 spell_id) {
|
||||
|
||||
char mount_color = 0;
|
||||
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
std::string errbuf;
|
||||
std::string query;
|
||||
MYSQL_RES *result;
|
||||
MYSQL_ROW row;
|
||||
|
||||
StringFormat(query, "SELECT race,gender,texture,mountspeed FROM horses WHERE filename='%s'", FileName);
|
||||
|
||||
if (database.RunQuery(query,errbuf, &result)) {
|
||||
if (database.RunQuery(query, &errbuf, &result)) {
|
||||
|
||||
if (mysql_num_rows(result) == 1) {
|
||||
|
||||
@@ -125,7 +125,7 @@ const NPCType *Horse::BuildHorseType(uint16 spell_id) {
|
||||
return nullptr;
|
||||
}
|
||||
else {
|
||||
LogFile->write(EQEMuLog::Error, "Error in Mount query '%s': %s", query.c_str(), errbuf);
|
||||
LogFile->write(EQEMuLog::Error, "Error in Mount query '%s': %s", query.c_str(), errbuf.c_str());
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
+4
-13
@@ -5929,7 +5929,6 @@ void Client::SendMercAssignPacket(uint32 entityID, uint32 unk01, uint32 unk02) {
|
||||
void NPC::LoadMercTypes(){
|
||||
std::string errorMessage;
|
||||
std::string query;
|
||||
char TempErrorMessageBuffer[MYSQL_ERRMSG_SIZE];
|
||||
MYSQL_RES* DatasetResult;
|
||||
MYSQL_ROW DataRow;
|
||||
|
||||
@@ -5941,8 +5940,8 @@ void NPC::LoadMercTypes(){
|
||||
"MTem.merc_type_id = MTyp.merc_type_id;",
|
||||
GetNPCTypeID());
|
||||
|
||||
if(!database.RunQuery(query,TempErrorMessageBuffer, &DatasetResult)) {
|
||||
errorMessage = std::string(TempErrorMessageBuffer);
|
||||
if(!database.RunQuery(query, &errorMessage, &DatasetResult)) {
|
||||
LogFile->write(EQEMuLog::Error, "Error in NPC::LoadMercTypes(). Error Message: %s", errorMessage.c_str());
|
||||
}
|
||||
else {
|
||||
while(DataRow = mysql_fetch_row(DatasetResult)) {
|
||||
@@ -5957,16 +5956,12 @@ void NPC::LoadMercTypes(){
|
||||
mysql_free_result(DatasetResult);
|
||||
}
|
||||
|
||||
if(!errorMessage.empty()) {
|
||||
LogFile->write(EQEMuLog::Error, "Error in NPC::LoadMercTypes()");
|
||||
}
|
||||
}
|
||||
|
||||
void NPC::LoadMercs(){
|
||||
|
||||
std::string errorMessage;
|
||||
std::string query;
|
||||
char TempErrorMessageBuffer[MYSQL_ERRMSG_SIZE];
|
||||
MYSQL_RES* DatasetResult;
|
||||
MYSQL_ROW DataRow;
|
||||
|
||||
@@ -5982,8 +5977,8 @@ void NPC::LoadMercs(){
|
||||
"MTem.merc_type_id = MTyp.merc_type_id;",
|
||||
GetNPCTypeID());
|
||||
|
||||
if(!database.RunQuery(query, TempErrorMessageBuffer, &DatasetResult)) {
|
||||
errorMessage = std::string(TempErrorMessageBuffer);
|
||||
if(!database.RunQuery(query, &errorMessage, &DatasetResult)) {
|
||||
LogFile->write(EQEMuLog::Error, "Error in NPC::LoadMercTypes(). Error message: %s", errorMessage.c_str());
|
||||
}
|
||||
else {
|
||||
while(DataRow = mysql_fetch_row(DatasetResult)) {
|
||||
@@ -6002,10 +5997,6 @@ void NPC::LoadMercs(){
|
||||
mysql_free_result(DatasetResult);
|
||||
}
|
||||
|
||||
|
||||
if(!errorMessage.empty()) {
|
||||
LogFile->write(EQEMuLog::Error, "Error in NPC::LoadMercTypes()");
|
||||
}
|
||||
}
|
||||
|
||||
int NPC::GetNumMercTypes(uint32 clientVersion)
|
||||
|
||||
+6
-4
@@ -3728,7 +3728,7 @@ void Mob::TarGlobal(const char *varname, const char *value, const char *duration
|
||||
|
||||
void Mob::DelGlobal(const char *varname) {
|
||||
// delglobal(varname)
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
std::string errbuf;
|
||||
std::string query;
|
||||
int qgZoneid=zone->GetZoneID();
|
||||
int qgCharid=0;
|
||||
@@ -3753,8 +3753,9 @@ void Mob::DelGlobal(const char *varname) {
|
||||
"(charid=0 || charid=%i) && (zoneid=%i || zoneid=0)",
|
||||
varname,qgNpcid,qgCharid,qgZoneid);
|
||||
|
||||
if (!database.RunQuery(query,errbuf)) {
|
||||
if (!database.RunQuery(query, &errbuf)) {
|
||||
//_log(QUESTS, "DelGlobal error deleting %s : %s", varname, errbuf);
|
||||
// TODO: Log error.
|
||||
}
|
||||
|
||||
if(zone)
|
||||
@@ -3779,7 +3780,7 @@ void Mob::DelGlobal(const char *varname) {
|
||||
void Mob::InsertQuestGlobal(int charid, int npcid, int zoneid, const char *varname, const char *varvalue, int duration) {
|
||||
|
||||
std::string query;
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
std::string errbuf;
|
||||
|
||||
// Make duration string either "unix_timestamp(now()) + xxx" or "NULL"
|
||||
std::stringstream duration_ss;
|
||||
@@ -3801,9 +3802,10 @@ void Mob::InsertQuestGlobal(int charid, int npcid, int zoneid, const char *varna
|
||||
"VALUES (%i, %i, %i, '%s', '%s', %s)",
|
||||
charid, npcid, zoneid, varname, varvalue, duration_ss.str().c_str());
|
||||
|
||||
if (!database.RunQuery(query, errbuf))
|
||||
if (!database.RunQuery(query, &errbuf))
|
||||
{
|
||||
//_log(QUESTS, "SelGlobal error inserting %s : %s", varname, errbuf);
|
||||
// TODO: Log error.
|
||||
}
|
||||
|
||||
if(zone)
|
||||
|
||||
+40
-30
@@ -981,7 +981,7 @@ NPC* NPC::SpawnNPC(const char* spawncommand, float in_x, float in_y, float in_z,
|
||||
}
|
||||
|
||||
uint32 ZoneDatabase::NPCSpawnDB(uint8 command, const char* zone, uint32 zone_version, Client *c, NPC* spawn, uint32 extra) {
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
std::string errbuf;
|
||||
std::string query;
|
||||
MYSQL_RES *result;
|
||||
MYSQL_ROW row;
|
||||
@@ -1000,7 +1000,7 @@ uint32 ZoneDatabase::NPCSpawnDB(uint8 command, const char* zone, uint32 zone_ver
|
||||
StringFormat(query, "SELECT MAX(id) FROM npc_types WHERE id >= %i AND id < %i",
|
||||
starting_npc_id, (starting_npc_id + 1000));
|
||||
|
||||
if (RunQuery(query, errbuf, &result)) {
|
||||
if (RunQuery(query, &errbuf, &result)) {
|
||||
row = mysql_fetch_row(result);
|
||||
if(row)
|
||||
{
|
||||
@@ -1040,8 +1040,8 @@ uint32 ZoneDatabase::NPCSpawnDB(uint8 command, const char* zone, uint32 zone_ver
|
||||
spawn->GetLoottableID(), spawn->MerchantType, 0, spawn->GetRunspeed(),
|
||||
28, 28);
|
||||
|
||||
if (!RunQuery(query, errbuf, 0, 0, &npc_type_id)) {
|
||||
LogFile->write(EQEMuLog::Error, "NPCSpawnDB Error: %s %s", query.c_str(), errbuf);
|
||||
if (!RunQuery(query, &errbuf, nullptr, nullptr, &npc_type_id)) {
|
||||
LogFile->write(EQEMuLog::Error, "NPCSpawnDB Error: %s %s", query.c_str(), errbuf.c_str());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -1057,8 +1057,8 @@ uint32 ZoneDatabase::NPCSpawnDB(uint8 command, const char* zone, uint32 zone_ver
|
||||
spawn->GetHelmTexture(), spawn->GetSize(), spawn->GetLoottableID(),
|
||||
spawn->MerchantType, 0, spawn->GetRunspeed(), 28, 28);
|
||||
|
||||
if (!RunQuery(query, errbuf, 0, 0, &npc_type_id)) {
|
||||
LogFile->write(EQEMuLog::Error, "NPCSpawnDB Error: %s %s", query.c_str(), errbuf);
|
||||
if (!RunQuery(query, &errbuf, 0, 0, &npc_type_id)) {
|
||||
LogFile->write(EQEMuLog::Error, "NPCSpawnDB Error: %s %s", query.c_str(), errbuf.c_str());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -1070,8 +1070,8 @@ uint32 ZoneDatabase::NPCSpawnDB(uint8 command, const char* zone, uint32 zone_ver
|
||||
|
||||
StringFormat(query,"INSERT INTO spawngroup (id, name) values(%i, '%s')", tmp, spawnIDAndName.c_str());
|
||||
|
||||
if (!RunQuery(query,errbuf, 0, 0, &spawngroupid)) {
|
||||
LogFile->write(EQEMuLog::Error, "NPCSpawnDB Error: %s %s", query.c_str(), errbuf);
|
||||
if (!RunQuery(query, &errbuf, 0, 0, &spawngroupid)) {
|
||||
LogFile->write(EQEMuLog::Error, "NPCSpawnDB Error: %s %s", query.c_str(), errbuf.c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1084,8 +1084,8 @@ uint32 ZoneDatabase::NPCSpawnDB(uint8 command, const char* zone, uint32 zone_ver
|
||||
zone, zone_version, spawn->GetX(), spawn->GetY(),
|
||||
spawn->GetZ(), 1200, spawn->GetHeading(), spawngroupid);
|
||||
|
||||
if (!RunQuery(query, errbuf, 0, 0, &tmp)) {
|
||||
LogFile->write(EQEMuLog::Error, "NPCSpawnDB Error: %s %s", query.c_str(), errbuf);
|
||||
if (!RunQuery(query, &errbuf, 0, 0, &tmp)) {
|
||||
LogFile->write(EQEMuLog::Error, "NPCSpawnDB Error: %s %s", query.c_str(), errbuf.c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1095,8 +1095,8 @@ uint32 ZoneDatabase::NPCSpawnDB(uint8 command, const char* zone, uint32 zone_ver
|
||||
StringFormat(query, "INSERT INTO spawnentry (spawngroupID, npcID, chance) values(%i, %i, %i)",
|
||||
spawngroupid, npc_type_id, 100);
|
||||
|
||||
if (!RunQuery(query, errbuf, 0)) {
|
||||
LogFile->write(EQEMuLog::Error, "NPCSpawnDB Error: %s %s", query.c_str(), errbuf);
|
||||
if (!RunQuery(query, &errbuf, 0)) {
|
||||
LogFile->write(EQEMuLog::Error, "NPCSpawnDB Error: %s %s", query.c_str(), errbuf.c_str());
|
||||
return false;
|
||||
}
|
||||
if(c)
|
||||
@@ -1112,8 +1112,8 @@ uint32 ZoneDatabase::NPCSpawnDB(uint8 command, const char* zone, uint32 zone_ver
|
||||
|
||||
StringFormat(query, "INSERT INTO spawngroup (name) values('%s')", zoneSpawnNameTime.c_str());
|
||||
|
||||
if (!RunQuery(query, errbuf, 0, 0, &last_insert_id)) {
|
||||
LogFile->write(EQEMuLog::Error, "NPCSpawnDB Error: %s %s", query.c_str(), errbuf);
|
||||
if (!RunQuery(query, &errbuf, 0, 0, &last_insert_id)) {
|
||||
LogFile->write(EQEMuLog::Error, "NPCSpawnDB Error: %s %s", query.c_str(), errbuf.c_str());
|
||||
return false;
|
||||
}
|
||||
if(c)
|
||||
@@ -1135,8 +1135,8 @@ uint32 ZoneDatabase::NPCSpawnDB(uint8 command, const char* zone, uint32 zone_ver
|
||||
zone, zone_version, spawn->GetX(), spawn->GetY(), spawn->GetZ(),
|
||||
respawntime, spawn->GetHeading(), last_insert_id);
|
||||
|
||||
if (!RunQuery(query,errbuf, 0, 0, &spawnid)) {
|
||||
LogFile->write(EQEMuLog::Error, "NPCSpawnDB Error: %s %s", query.c_str(), errbuf);
|
||||
if (!RunQuery(query, &errbuf, 0, 0, &spawnid)) {
|
||||
LogFile->write(EQEMuLog::Error, "NPCSpawnDB Error: %s %s", query.c_str(), errbuf.c_str());
|
||||
return false;
|
||||
}
|
||||
if(c)
|
||||
@@ -1147,8 +1147,8 @@ uint32 ZoneDatabase::NPCSpawnDB(uint8 command, const char* zone, uint32 zone_ver
|
||||
"values(%i, %i, %i)",
|
||||
last_insert_id, tmp2, 100);
|
||||
|
||||
if (!RunQuery(query, errbuf, 0)) {
|
||||
LogFile->write(EQEMuLog::Error, "NPCSpawnDB Error: %s %s", query.c_str(), errbuf);
|
||||
if (!RunQuery(query, &errbuf, 0)) {
|
||||
LogFile->write(EQEMuLog::Error, "NPCSpawnDB Error: %s %s", query.c_str(), errbuf.c_str());
|
||||
return false;
|
||||
}
|
||||
if(c)
|
||||
@@ -1167,7 +1167,7 @@ uint32 ZoneDatabase::NPCSpawnDB(uint8 command, const char* zone, uint32 zone_ver
|
||||
spawn->GetTexture(), spawn->GetHelmTexture(), spawn->GetSize(),
|
||||
spawn->GetLoottableID(), spawn->MerchantType, spawn->GetNPCTypeID());
|
||||
|
||||
if (!RunQuery(query, errbuf, 0)) {
|
||||
if (!RunQuery(query,&errbuf, 0)) {
|
||||
if(c)
|
||||
c->LogSQL(query.c_str());
|
||||
return true;
|
||||
@@ -1182,7 +1182,7 @@ uint32 ZoneDatabase::NPCSpawnDB(uint8 command, const char* zone, uint32 zone_ver
|
||||
"spawngroupID=%i",
|
||||
zone, spawn->GetSp2());
|
||||
|
||||
if (!RunQuery(query, errbuf, &result)) {
|
||||
if (!RunQuery(query, &errbuf, &result)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1193,7 +1193,8 @@ uint32 ZoneDatabase::NPCSpawnDB(uint8 command, const char* zone, uint32 zone_ver
|
||||
|
||||
StringFormat(query, "DELETE FROM spawn2 WHERE id='%i'", tmp);
|
||||
|
||||
if (!RunQuery(query,errbuf,0)) {
|
||||
if (!RunQuery(query, &errbuf)) {
|
||||
// TODO: Log message
|
||||
return false;
|
||||
}
|
||||
if(c)
|
||||
@@ -1201,7 +1202,8 @@ uint32 ZoneDatabase::NPCSpawnDB(uint8 command, const char* zone, uint32 zone_ver
|
||||
|
||||
StringFormat(query, "DELETE FROM spawngroup WHERE id='%i'", tmp2);
|
||||
|
||||
if (!RunQuery(query, errbuf,0)) {
|
||||
if (!RunQuery(query, &errbuf)) {
|
||||
// TODO: Log message
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1210,7 +1212,8 @@ uint32 ZoneDatabase::NPCSpawnDB(uint8 command, const char* zone, uint32 zone_ver
|
||||
|
||||
StringFormat(query, "DELETE FROM spawnentry WHERE spawngroupID='%i'", tmp2);
|
||||
|
||||
if (!RunQuery(query, errbuf,0)) {
|
||||
if (!RunQuery(query, &errbuf)) {
|
||||
// TODO: log message
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1229,7 +1232,8 @@ uint32 ZoneDatabase::NPCSpawnDB(uint8 command, const char* zone, uint32 zone_ver
|
||||
"spawngroupID=%i",
|
||||
zone, zone_version, spawn->GetSp2());
|
||||
|
||||
if (!RunQuery(query, errbuf, &result)) {
|
||||
if (!RunQuery(query, &errbuf, &result)) {
|
||||
// TODO: Log message
|
||||
return(0);
|
||||
}
|
||||
|
||||
@@ -1241,7 +1245,8 @@ uint32 ZoneDatabase::NPCSpawnDB(uint8 command, const char* zone, uint32 zone_ver
|
||||
|
||||
StringFormat(query,"DELETE FROM spawn2 WHERE id='%i'", tmp);
|
||||
|
||||
if (!RunQuery(query,errbuf,0)) {
|
||||
if (!RunQuery(query, &errbuf)) {
|
||||
// TODO: Log message.
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1250,7 +1255,8 @@ uint32 ZoneDatabase::NPCSpawnDB(uint8 command, const char* zone, uint32 zone_ver
|
||||
|
||||
StringFormat(query, "DELETE FROM spawngroup WHERE id='%i'", tmp2);
|
||||
|
||||
if (!RunQuery(query, errbuf,0)) {
|
||||
if (!RunQuery(query, &errbuf)) {
|
||||
// TODO: Log message
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1259,7 +1265,8 @@ uint32 ZoneDatabase::NPCSpawnDB(uint8 command, const char* zone, uint32 zone_ver
|
||||
|
||||
StringFormat(query, "DELETE FROM spawnentry WHERE spawngroupID='%i'", tmp2);
|
||||
|
||||
if (!RunQuery(query, errbuf,0)) {
|
||||
if (!RunQuery(query, &errbuf)) {
|
||||
// TODO: Log message
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1268,7 +1275,8 @@ uint32 ZoneDatabase::NPCSpawnDB(uint8 command, const char* zone, uint32 zone_ver
|
||||
|
||||
StringFormat(query,"DELETE FROM npc_types WHERE id='%i'", spawn->GetNPCTypeID());
|
||||
|
||||
if (!RunQuery(query,errbuf,0)) {
|
||||
if (!RunQuery(query, &errbuf)) {
|
||||
// TODO: Log message
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1286,7 +1294,8 @@ uint32 ZoneDatabase::NPCSpawnDB(uint8 command, const char* zone, uint32 zone_ver
|
||||
zone, zone_version, c->GetX(), c->GetY(), c->GetZ(), 120, c->GetHeading(), extra);
|
||||
|
||||
|
||||
if (!RunQuery(query, errbuf, 0, 0, &tmp)) {
|
||||
if (!RunQuery(query, &errbuf, nullptr, nullptr, &tmp)) {
|
||||
// TODO: Log message
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1315,7 +1324,8 @@ uint32 ZoneDatabase::NPCSpawnDB(uint8 command, const char* zone, uint32 zone_ver
|
||||
|
||||
|
||||
|
||||
if (!RunQuery(query, errbuf, 0, 0, &npc_type_id)) {
|
||||
if (!RunQuery(query, &errbuf, nullptr, nullptr, &npc_type_id)) {
|
||||
// TODO: Log message
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
+3
-3
@@ -315,7 +315,7 @@ void Parser::Event(QuestEventID event, uint32 npcid, const char * data, NPC* npc
|
||||
|
||||
if (npcmob->GetQglobal())
|
||||
{
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
std::string errbuf;
|
||||
std::string query;
|
||||
MYSQL_RES *result;
|
||||
MYSQL_ROW row;
|
||||
@@ -339,9 +339,9 @@ void Parser::Event(QuestEventID event, uint32 npcid, const char * data, NPC* npc
|
||||
"(zoneid=%i || zoneid=0) && expdate >= unix_timestamp(now())",
|
||||
npcmob->GetNPCTypeID(), charid, zone->GetZoneID());
|
||||
|
||||
database.RunQuery(query, errbuf, &result);
|
||||
database.RunQuery(query, &errbuf, &result);
|
||||
printf("%s\n",query.c_str());
|
||||
printf("%s\n",errbuf);
|
||||
printf("%s\n",errbuf.c_str());
|
||||
if (result)
|
||||
{
|
||||
printf("Loading global variables for %s\n",npcmob->GetName());
|
||||
|
||||
+12
-12
@@ -216,7 +216,7 @@ void PetitionList::UpdatePetition(Petition* pet) {
|
||||
}
|
||||
|
||||
void ZoneDatabase::DeletePetitionFromDB(Petition* wpet) {
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
std::string errbuf;
|
||||
std::string query;
|
||||
uint32 affected_rows = 0;
|
||||
uint8 checkedout = 0;
|
||||
@@ -228,15 +228,15 @@ void ZoneDatabase::DeletePetitionFromDB(Petition* wpet) {
|
||||
|
||||
StringFormat(query, "DELETE from petitions where petid = %i", wpet->GetID());
|
||||
|
||||
if (!RunQuery(query, errbuf, 0, &affected_rows)) {
|
||||
LogFile->write(EQEMuLog::Error, "Error in DeletePetitionFromDB query '%s': %s", query.c_str(), errbuf);
|
||||
if (!RunQuery(query, &errbuf, 0, &affected_rows)) {
|
||||
LogFile->write(EQEMuLog::Error, "Error in DeletePetitionFromDB query '%s': %s", query.c_str(), errbuf.c_str());
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void ZoneDatabase::UpdatePetitionToDB(Petition* wpet) {
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
std::string errbuf;
|
||||
std::string query;
|
||||
uint32 affected_rows = 0;
|
||||
uint8 checkedout = 0;
|
||||
@@ -250,8 +250,8 @@ void ZoneDatabase::UpdatePetitionToDB(Petition* wpet) {
|
||||
wpet->GetGMText(), wpet->GetLastGM(), wpet->GetUrgency(),
|
||||
wpet->GetCheckouts(), wpet->GetUnavails(), checkedout, wpet->GetID());
|
||||
|
||||
if (!RunQuery(query, errbuf, 0, &affected_rows)) {
|
||||
LogFile->write(EQEMuLog::Error, "Error in UpdatePetitionToDB query '%s': %s", query.c_str(), errbuf);
|
||||
if (!RunQuery(query, &errbuf, nullptr, &affected_rows)) {
|
||||
LogFile->write(EQEMuLog::Error, "Error in UpdatePetitionToDB query '%s': %s", query.c_str(), errbuf.c_str());
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -260,7 +260,7 @@ void ZoneDatabase::UpdatePetitionToDB(Petition* wpet) {
|
||||
|
||||
void ZoneDatabase::InsertPetitionToDB(Petition* wpet)
|
||||
{
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
std::string errbuf;
|
||||
std::string query;
|
||||
uint32 affected_rows = 0;
|
||||
uint8 checkedout = 0;
|
||||
@@ -282,8 +282,8 @@ void ZoneDatabase::InsertPetitionToDB(Petition* wpet)
|
||||
wpet->GetCharRace(), wpet->GetCharLevel(), wpet->GetCheckouts(),
|
||||
wpet->GetUnavails(), checkedout, wpet->GetSentTime(), wpet->GetGMText());
|
||||
|
||||
if (!RunQuery(query, errbuf, 0, &affected_rows)) {
|
||||
LogFile->write(EQEMuLog::Error, "Error in InsertPetitionToDB query '%s': %s", query.c_str(), errbuf);
|
||||
if (!RunQuery(query, &errbuf, nullptr, &affected_rows)) {
|
||||
LogFile->write(EQEMuLog::Error, "Error in InsertPetitionToDB query '%s': %s", query.c_str(), errbuf.c_str());
|
||||
}
|
||||
|
||||
#if EQDEBUG >= 5
|
||||
@@ -294,7 +294,7 @@ void ZoneDatabase::InsertPetitionToDB(Petition* wpet)
|
||||
|
||||
void ZoneDatabase::RefreshPetitionsFromDB()
|
||||
{
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
std::string errbuf;
|
||||
std::string query;
|
||||
MYSQL_RES *result;
|
||||
MYSQL_ROW row;
|
||||
@@ -305,7 +305,7 @@ void ZoneDatabase::RefreshPetitionsFromDB()
|
||||
"charlevel, checkouts, unavailables, ischeckedout, "
|
||||
"senttime, gmtext from petitions order by petid";
|
||||
|
||||
if (RunQuery(query, errbuf, &result))
|
||||
if (RunQuery(query, &errbuf, &result))
|
||||
{
|
||||
while ((row = mysql_fetch_row(result))) {
|
||||
newpet = new Petition(atoi(row[0]));
|
||||
@@ -334,7 +334,7 @@ void ZoneDatabase::RefreshPetitionsFromDB()
|
||||
mysql_free_result(result);
|
||||
}
|
||||
else {
|
||||
LogFile->write(EQEMuLog::Error, "Error in RefreshPetitionsFromDB query '%s': %s", query.c_str(), errbuf);
|
||||
LogFile->write(EQEMuLog::Error, "Error in RefreshPetitionsFromDB query '%s': %s", query.c_str(), errbuf.c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
+11
-11
@@ -361,7 +361,7 @@ void Mob::MakePoweredPet(uint16 spell_id, const char* pettype, int16 petpower, c
|
||||
|
||||
// handle monster summoning pet appearance
|
||||
if(record.monsterflag) {
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
std::string errbuf;
|
||||
std::string query;
|
||||
MYSQL_RES *result = nullptr;
|
||||
MYSQL_ROW row = nullptr;
|
||||
@@ -378,7 +378,7 @@ void Mob::MakePoweredPet(uint16 spell_id, const char* pettype, int16 petpower, c
|
||||
zone->GetShortName());
|
||||
|
||||
// get a random npc id from the spawngroups assigned to this zone
|
||||
if (database.RunQuery(query, errbuf, &result))
|
||||
if (database.RunQuery(query, &errbuf, &result))
|
||||
{
|
||||
row = mysql_fetch_row(result);
|
||||
if (row)
|
||||
@@ -387,7 +387,7 @@ void Mob::MakePoweredPet(uint16 spell_id, const char* pettype, int16 petpower, c
|
||||
monsterid = 567; // since we don't have any monsters, just make it look like an earth pet for now
|
||||
}
|
||||
else { // if the database query failed
|
||||
LogFile->write(EQEMuLog::Error, "Error querying database for monster summoning pet in zone %s (%s)", zone->GetShortName(), errbuf);
|
||||
LogFile->write(EQEMuLog::Error, "Error querying database for monster summoning pet in zone %s (%s)", zone->GetShortName(), errbuf.c_str());
|
||||
monsterid = 567;
|
||||
}
|
||||
|
||||
@@ -448,7 +448,7 @@ bool ZoneDatabase::GetPetEntry(const char *pet_type, PetRecord *into) {
|
||||
}
|
||||
|
||||
bool ZoneDatabase::GetPoweredPetEntry(const char *pet_type, int16 petpower, PetRecord *into) {
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
std::string errbuf;
|
||||
std::string query;
|
||||
uint32 querylen = 0;
|
||||
MYSQL_RES *result;
|
||||
@@ -470,7 +470,7 @@ bool ZoneDatabase::GetPoweredPetEntry(const char *pet_type, int16 petpower, PetR
|
||||
pet_type, petpower);
|
||||
}
|
||||
|
||||
if (RunQuery(query, errbuf, &result)) {
|
||||
if (RunQuery(query, &errbuf, &result)) {
|
||||
if (mysql_num_rows(result) == 1) {
|
||||
row = mysql_fetch_row(result);
|
||||
|
||||
@@ -488,7 +488,7 @@ bool ZoneDatabase::GetPoweredPetEntry(const char *pet_type, int16 petpower, PetR
|
||||
mysql_free_result(result);
|
||||
}
|
||||
else {
|
||||
LogFile->write(EQEMuLog::Error, "Error in GetPoweredPetEntry query '%s': %s", query.c_str(), errbuf);
|
||||
LogFile->write(EQEMuLog::Error, "Error in GetPoweredPetEntry query '%s': %s", query.c_str(), errbuf.c_str());
|
||||
}
|
||||
return(false);
|
||||
}
|
||||
@@ -659,7 +659,7 @@ bool ZoneDatabase::GetBasePetItems(int32 equipmentset, uint32 *items) {
|
||||
// A slot will only get an item put in it if it is empty. That way
|
||||
// an equipmentset can overload a slot for the set(s) it includes.
|
||||
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
std::string errbuf;
|
||||
std::string query;
|
||||
uint32 querylen = 0;
|
||||
MYSQL_RES *result;
|
||||
@@ -680,7 +680,7 @@ bool ZoneDatabase::GetBasePetItems(int32 equipmentset, uint32 *items) {
|
||||
|
||||
StringFormat(query,"SELECT nested_set FROM pets_equipmentset WHERE set_id='%s'", curset);
|
||||
|
||||
if (RunQuery(query, errbuf, &result))
|
||||
if (RunQuery(query, &errbuf, &result))
|
||||
{
|
||||
if (mysql_num_rows(result) == 1) {
|
||||
row = mysql_fetch_row(result);
|
||||
@@ -689,7 +689,7 @@ bool ZoneDatabase::GetBasePetItems(int32 equipmentset, uint32 *items) {
|
||||
|
||||
StringFormat(query,"SELECT slot, item_id FROM pets_equipmentset_entries WHERE set_id='%s'", curset);
|
||||
|
||||
if (RunQuery(query, errbuf, &result))
|
||||
if (RunQuery(query, &errbuf, &result))
|
||||
{
|
||||
while ((row = mysql_fetch_row(result)))
|
||||
{
|
||||
@@ -703,7 +703,7 @@ bool ZoneDatabase::GetBasePetItems(int32 equipmentset, uint32 *items) {
|
||||
mysql_free_result(result);
|
||||
}
|
||||
else {
|
||||
LogFile->write(EQEMuLog::Error, "Error in GetBasePetItems query '%s': %s", query.c_str(), errbuf);
|
||||
LogFile->write(EQEMuLog::Error, "Error in GetBasePetItems query '%s': %s", query.c_str(), errbuf.c_str());
|
||||
}
|
||||
curset = nextset;
|
||||
depth++;
|
||||
@@ -718,7 +718,7 @@ bool ZoneDatabase::GetBasePetItems(int32 equipmentset, uint32 *items) {
|
||||
}
|
||||
else
|
||||
{
|
||||
LogFile->write(EQEMuLog::Error, "Error in GetBasePetItems query '%s': %s", query.c_str(), errbuf);
|
||||
LogFile->write(EQEMuLog::Error, "Error in GetBasePetItems query '%s': %s", query.c_str(), errbuf.c_str());
|
||||
return false;
|
||||
}
|
||||
} // end while
|
||||
|
||||
+14
-14
@@ -1237,7 +1237,7 @@ void QuestManager::setglobal(const char *varname, const char *newvalue, int opti
|
||||
/* Inserts global variable into quest_globals table */
|
||||
int QuestManager::InsertQuestGlobal(int charid, int npcid, int zoneid,const char *varname, const char *varvalue,int duration)
|
||||
{
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
std::string errbuf;
|
||||
std::string query;
|
||||
|
||||
// Make duration string either "unix_timestamp(now()) + xxx" or "NULL"
|
||||
@@ -1259,7 +1259,7 @@ int QuestManager::InsertQuestGlobal(int charid, int npcid, int zoneid,const char
|
||||
"VALUES (%i, %i, %i, '%s', '%s', %s)",
|
||||
charid, npcid, zoneid, varname, varvalue, duration_ss.str().c_str());
|
||||
|
||||
if (!database.RunQuery(query, errbuf, nullptr, nullptr, &last_id)) {
|
||||
if (!database.RunQuery(query, &errbuf, nullptr, nullptr, &last_id)) {
|
||||
std::cerr << "setglobal error inserting " << varname << " : " << errbuf << std::endl;
|
||||
}
|
||||
|
||||
@@ -1325,7 +1325,7 @@ void QuestManager::targlobal(const char *varname, const char *value, const char
|
||||
|
||||
void QuestManager::delglobal(const char *varname) {
|
||||
// delglobal(varname)
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
std::string errbuf;
|
||||
std::string query;
|
||||
int qgZoneid=zone->GetZoneID();
|
||||
int qgCharid=0;
|
||||
@@ -1346,7 +1346,7 @@ void QuestManager::delglobal(const char *varname) {
|
||||
"&& (zoneid=%i || zoneid=0)",
|
||||
varname,qgNpcid,qgCharid,qgZoneid);
|
||||
|
||||
if (!database.RunQuery(query,errbuf))
|
||||
if (!database.RunQuery(query, &errbuf))
|
||||
{
|
||||
std::cerr << "delglobal error deleting " << varname << " : " << errbuf << std::endl;
|
||||
}
|
||||
@@ -1560,7 +1560,7 @@ void QuestManager::showgrid(int grid) {
|
||||
if(initiator == nullptr)
|
||||
return;
|
||||
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
std::string errbuf;
|
||||
std::string query;
|
||||
MYSQL_RES *result;
|
||||
MYSQL_ROW row;
|
||||
@@ -1579,7 +1579,7 @@ void QuestManager::showgrid(int grid) {
|
||||
"AND `zoneid`=%i ORDER BY `number`",
|
||||
grid,zone->GetZoneID());
|
||||
|
||||
if(database.RunQuery(query,errbuf,&result))
|
||||
if(database.RunQuery(query, &errbuf,&result))
|
||||
{
|
||||
while((row = mysql_fetch_row(result)))
|
||||
{
|
||||
@@ -1594,7 +1594,7 @@ void QuestManager::showgrid(int grid) {
|
||||
}
|
||||
else // DB query error!
|
||||
{
|
||||
LogFile->write(EQEMuLog::Quest, "Error loading grid %d for showgrid(): %s", grid, errbuf);
|
||||
LogFile->write(EQEMuLog::Quest, "Error loading grid %d for showgrid(): %s", grid, errbuf.c_str());
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -2138,14 +2138,14 @@ void QuestManager::clearspawntimers() {
|
||||
iterator.Reset();
|
||||
while (iterator.MoreElements())
|
||||
{
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
std::string errbuf;
|
||||
std::string query;
|
||||
|
||||
StringFormat(query,"DELETE FROM respawn_times WHERE id=%lu AND instance_id=%lu",
|
||||
(unsigned long)iterator.GetData()->GetID(),
|
||||
(unsigned long)zone->GetInstanceID());
|
||||
|
||||
database.RunQuery(query, errbuf);
|
||||
database.RunQuery(query, &errbuf);
|
||||
iterator.Advance();
|
||||
}
|
||||
}
|
||||
@@ -2477,7 +2477,7 @@ void QuestManager::FlagInstanceByRaidLeader(uint32 zone, int16 version)
|
||||
const char* QuestManager::saylink(char* Phrase, bool silent, char* LinkName) {
|
||||
|
||||
const char *ERR_MYSQLERROR = "Error in saylink phrase queries";
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
std::string errbuf;
|
||||
std::string query;
|
||||
MYSQL_RES *result;
|
||||
MYSQL_ROW row;
|
||||
@@ -2490,7 +2490,7 @@ const char* QuestManager::saylink(char* Phrase, bool silent, char* LinkName) {
|
||||
// Query for an existing phrase and id in the saylink table
|
||||
StringFormat(query,"SELECT `id` FROM `saylink` WHERE `phrase` = '%s'", escaped_string.c_str());
|
||||
|
||||
if(database.RunQuery(query,errbuf,&result))
|
||||
if(database.RunQuery(query, &errbuf,&result))
|
||||
{
|
||||
if (mysql_num_rows(result) >= 1)
|
||||
{
|
||||
@@ -2504,11 +2504,11 @@ const char* QuestManager::saylink(char* Phrase, bool silent, char* LinkName) {
|
||||
{
|
||||
StringFormat(query,"INSERT INTO `saylink` (`phrase`) VALUES ('%s')", escaped_string.c_str());
|
||||
|
||||
database.RunQuery(query,errbuf);
|
||||
database.RunQuery(query, &errbuf);
|
||||
|
||||
StringFormat(query,"SELECT `id` FROM saylink WHERE `phrase` = '%s'", escaped_string.c_str());
|
||||
|
||||
if(database.RunQuery(query,errbuf,&result))
|
||||
if(database.RunQuery(query, &errbuf,&result))
|
||||
{
|
||||
if (mysql_num_rows(result) >= 1)
|
||||
{
|
||||
@@ -2521,7 +2521,7 @@ const char* QuestManager::saylink(char* Phrase, bool silent, char* LinkName) {
|
||||
}
|
||||
else
|
||||
{
|
||||
LogFile->write(EQEMuLog::Error, ERR_MYSQLERROR, errbuf);
|
||||
LogFile->write(EQEMuLog::Error, ERR_MYSQLERROR, errbuf.c_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+33
-33
@@ -74,7 +74,7 @@ void Raid::AddMember(Client *c, uint32 group, bool rleader, bool groupleader, bo
|
||||
if(!c)
|
||||
return;
|
||||
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
std::string errbuf;
|
||||
std::string query;
|
||||
MYSQL_RES *result;
|
||||
|
||||
@@ -83,7 +83,7 @@ void Raid::AddMember(Client *c, uint32 group, bool rleader, bool groupleader, bo
|
||||
(unsigned long)GetID(), (unsigned long)c->CharacterID(), (unsigned long)group,
|
||||
c->GetClass(), c->GetLevel(), c->GetName(), groupleader, rleader, looter );
|
||||
|
||||
if (database.RunQuery(query,errbuf,&result)){
|
||||
if (database.RunQuery(query, &errbuf,&result)){
|
||||
mysql_free_result(result);
|
||||
}
|
||||
|
||||
@@ -107,13 +107,13 @@ void Raid::AddMember(Client *c, uint32 group, bool rleader, bool groupleader, bo
|
||||
|
||||
void Raid::RemoveMember(const char *c)
|
||||
{
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
std::string errbuf;
|
||||
std::string query;
|
||||
MYSQL_RES *result;
|
||||
|
||||
StringFormat(query,"DELETE FROM raid_members where name='%s'", c );
|
||||
|
||||
if (database.RunQuery(query,errbuf,&result)){
|
||||
if (database.RunQuery(query, &errbuf,&result)){
|
||||
mysql_free_result(result);
|
||||
}
|
||||
|
||||
@@ -140,13 +140,13 @@ void Raid::RemoveMember(const char *c)
|
||||
|
||||
void Raid::DisbandRaid()
|
||||
{
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
std::string errbuf;
|
||||
std::string query;
|
||||
MYSQL_RES *result;
|
||||
|
||||
StringFormat(query,"DELETE FROM raid_members WHERE raidid=%lu", (unsigned long)GetID());
|
||||
|
||||
if (database.RunQuery(query,errbuf,&result)){
|
||||
if (database.RunQuery(query, &errbuf,&result)){
|
||||
mysql_free_result(result);
|
||||
}
|
||||
|
||||
@@ -168,14 +168,14 @@ void Raid::DisbandRaid()
|
||||
|
||||
void Raid::MoveMember(const char *name, uint32 newGroup)
|
||||
{
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
std::string errbuf;
|
||||
std::string query;
|
||||
MYSQL_RES *result;
|
||||
|
||||
StringFormat(query,"UPDATE raid_members SET groupid=%lu WHERE name='%s'",
|
||||
(unsigned long)newGroup, name);
|
||||
|
||||
if (database.RunQuery(query,errbuf,&result)){
|
||||
if (database.RunQuery(query, &errbuf,&result)){
|
||||
mysql_free_result(result);
|
||||
}
|
||||
|
||||
@@ -195,14 +195,14 @@ void Raid::MoveMember(const char *name, uint32 newGroup)
|
||||
|
||||
void Raid::SetGroupLeader(const char *who, bool glFlag)
|
||||
{
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
std::string errbuf;
|
||||
std::string query;
|
||||
MYSQL_RES *result;
|
||||
|
||||
StringFormat(query,"UPDATE raid_members SET isgroupleader=%lu WHERE name='%s'",
|
||||
(unsigned long)glFlag, who);
|
||||
|
||||
if (database.RunQuery(query,errbuf,&result)){
|
||||
if (database.RunQuery(query, &errbuf,&result)){
|
||||
mysql_free_result(result);
|
||||
}
|
||||
LearnMembers();
|
||||
@@ -224,22 +224,22 @@ void Raid::SetGroupLeader(const char *who, bool glFlag)
|
||||
|
||||
void Raid::SetRaidLeader(const char *wasLead, const char *name)
|
||||
{
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
std::string errbuf;
|
||||
std::string query;
|
||||
MYSQL_RES *result;
|
||||
|
||||
StringFormat(query,"UPDATE raid_members SET israidleader=0 WHERE name='%s'", wasLead);
|
||||
|
||||
if (!database.RunQuery(query,errbuf,&result)){
|
||||
printf("Set Raid Leader error: %s\n", errbuf);
|
||||
if (!database.RunQuery(query, &errbuf,&result)){
|
||||
printf("Set Raid Leader error: %s\n", errbuf.c_str());
|
||||
}
|
||||
else
|
||||
mysql_free_result(result);
|
||||
|
||||
StringFormat(query,"UPDATE raid_members SET israidleader=1 WHERE name='%s'", name);
|
||||
|
||||
if (!database.RunQuery(query,errbuf,&result)){
|
||||
printf("Set Raid Leader error: %s\n", errbuf);
|
||||
if (!database.RunQuery(query, &errbuf,&result)){
|
||||
printf("Set Raid Leader error: %s\n", errbuf.c_str());
|
||||
}
|
||||
else
|
||||
mysql_free_result(result);
|
||||
@@ -278,14 +278,14 @@ bool Raid::IsGroupLeader(const char *who)
|
||||
|
||||
void Raid::UpdateLevel(const char *name, int newLevel)
|
||||
{
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
std::string errbuf;
|
||||
std::string query;
|
||||
MYSQL_RES *result;
|
||||
|
||||
StringFormat(query,"UPDATE raid_members SET level=%lu WHERE name='%s'",
|
||||
(unsigned long)newLevel, name);
|
||||
|
||||
if (database.RunQuery(query,errbuf,&result)){
|
||||
if (database.RunQuery(query, &errbuf,&result)){
|
||||
mysql_free_result(result);
|
||||
}
|
||||
|
||||
@@ -736,14 +736,14 @@ void Raid::TeleportRaid(Mob* sender, uint32 zoneID, uint16 instance_id, float x,
|
||||
|
||||
void Raid::ChangeLootType(uint32 type)
|
||||
{
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
std::string errbuf;
|
||||
std::string query;
|
||||
MYSQL_RES *result;
|
||||
|
||||
StringFormat(query,"UPDATE raid_details SET loottype=%lu WHERE raidid=%lu",
|
||||
(unsigned long)type, (unsigned long)GetID());
|
||||
|
||||
if (database.RunQuery(query,errbuf,&result)){
|
||||
if (database.RunQuery(query, &errbuf,&result)){
|
||||
mysql_free_result(result);
|
||||
}
|
||||
|
||||
@@ -752,13 +752,13 @@ void Raid::ChangeLootType(uint32 type)
|
||||
|
||||
void Raid::AddRaidLooter(const char* looter)
|
||||
{
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
std::string errbuf;
|
||||
std::string query;
|
||||
MYSQL_RES *result;
|
||||
|
||||
StringFormat(query,"UPDATE raid_members SET islooter=1 WHERE name='%s'", looter);
|
||||
|
||||
if (database.RunQuery(query,errbuf,&result)){
|
||||
if (database.RunQuery(query, &errbuf,&result)){
|
||||
mysql_free_result(result);
|
||||
}
|
||||
|
||||
@@ -790,13 +790,13 @@ void Raid::AddRaidLooter(const char* looter)
|
||||
|
||||
void Raid::RemoveRaidLooter(const char* looter)
|
||||
{
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
std::string errbuf;
|
||||
std::string query;
|
||||
MYSQL_RES *result;
|
||||
|
||||
StringFormat(query, "UPDATE raid_members SET islooter=0 WHERE name='%s'", looter);
|
||||
|
||||
if (database.RunQuery(query, errbuf,&result)){
|
||||
if (database.RunQuery(query, &errbuf,&result)){
|
||||
mysql_free_result(result);
|
||||
}
|
||||
|
||||
@@ -1247,14 +1247,14 @@ void Raid::SendRaidGroupRemove(const char *who, uint32 gid)
|
||||
|
||||
void Raid::LockRaid(bool lockFlag)
|
||||
{
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
std::string errbuf;
|
||||
std::string query;
|
||||
MYSQL_RES *result;
|
||||
|
||||
StringFormat(query,"UPDATE raid_details SET locked=%d WHERE raidid=%lu",
|
||||
lockFlag, (unsigned long)GetID());
|
||||
|
||||
if (database.RunQuery(query,errbuf,&result)){
|
||||
if (database.RunQuery(query, &errbuf,&result)){
|
||||
mysql_free_result(result);
|
||||
}
|
||||
|
||||
@@ -1276,14 +1276,14 @@ void Raid::LockRaid(bool lockFlag)
|
||||
|
||||
void Raid::SetRaidDetails()
|
||||
{
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
std::string errbuf;
|
||||
std::string query;
|
||||
MYSQL_RES *result;
|
||||
|
||||
StringFormat(query,"INSERT INTO raid_details SET raidid=%lu, loottype=4, locked=0",
|
||||
(unsigned long)GetID());
|
||||
|
||||
if (database.RunQuery(query, errbuf,&result)){
|
||||
if (database.RunQuery(query, &errbuf, &result)){
|
||||
mysql_free_result(result);
|
||||
}
|
||||
|
||||
@@ -1291,7 +1291,7 @@ void Raid::SetRaidDetails()
|
||||
|
||||
void Raid::GetRaidDetails()
|
||||
{
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
std::string errbuf;
|
||||
std::string query;
|
||||
MYSQL_RES *result;
|
||||
MYSQL_ROW row;
|
||||
@@ -1299,10 +1299,10 @@ void Raid::GetRaidDetails()
|
||||
StringFormat(query,"SELECT locked, loottype FROM raid_details WHERE raidid=%lu",
|
||||
(unsigned long)GetID());
|
||||
|
||||
if (database.RunQuery(query,errbuf,&result)){
|
||||
if (database.RunQuery(query, &errbuf, &result)){
|
||||
if(mysql_num_rows(result) < 1) {
|
||||
mysql_free_result(result);
|
||||
LogFile->write(EQEMuLog::Error, "Error getting raid details for raid %lu: %s", (unsigned long)GetID(), errbuf);
|
||||
LogFile->write(EQEMuLog::Error, "Error getting raid details for raid %lu: %s", (unsigned long)GetID(), errbuf.c_str());
|
||||
return;
|
||||
}
|
||||
row = mysql_fetch_row(result);
|
||||
@@ -1317,7 +1317,7 @@ void Raid::GetRaidDetails()
|
||||
bool Raid::LearnMembers()
|
||||
{
|
||||
memset(members, 0, (sizeof(RaidMember)*MAX_RAID_MEMBERS));
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
std::string errbuf;
|
||||
std::string query;
|
||||
MYSQL_RES *result;
|
||||
MYSQL_ROW row;
|
||||
@@ -1326,10 +1326,10 @@ bool Raid::LearnMembers()
|
||||
"FROM raid_members WHERE raidid=%lu",
|
||||
(unsigned long)GetID());
|
||||
|
||||
if (database.RunQuery(query,errbuf,&result)){
|
||||
if (database.RunQuery(query, &errbuf,&result)){
|
||||
if(mysql_num_rows(result) < 1) {
|
||||
mysql_free_result(result);
|
||||
LogFile->write(EQEMuLog::Error, "Error getting raid members for raid %lu: %s", (unsigned long)GetID(), errbuf);
|
||||
LogFile->write(EQEMuLog::Error, "Error getting raid members for raid %lu: %s", (unsigned long)GetID(), errbuf.c_str());
|
||||
disbandCheck = true;
|
||||
return(false);
|
||||
}
|
||||
|
||||
+27
-27
@@ -354,7 +354,7 @@ void Spawn2::DeathReset(bool realdeath)
|
||||
}
|
||||
|
||||
bool ZoneDatabase::PopulateZoneSpawnList(uint32 zoneid, LinkedList<Spawn2*> &spawn2_list, int16 version, uint32 repopdelay) {
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
std::string errbuf;
|
||||
std::string query;
|
||||
MYSQL_RES *result;
|
||||
MYSQL_ROW row;
|
||||
@@ -366,7 +366,7 @@ bool ZoneDatabase::PopulateZoneSpawnList(uint32 zoneid, LinkedList<Spawn2*> &spa
|
||||
"WHERE zone='%s' AND version=%u",
|
||||
zone_name, version);
|
||||
|
||||
if (RunQuery(query, errbuf, &result))
|
||||
if (RunQuery(query, &errbuf, &result))
|
||||
{
|
||||
while((row = mysql_fetch_row(result)))
|
||||
{
|
||||
@@ -381,7 +381,7 @@ bool ZoneDatabase::PopulateZoneSpawnList(uint32 zoneid, LinkedList<Spawn2*> &spa
|
||||
}
|
||||
else
|
||||
{
|
||||
LogFile->write(EQEMuLog::Error, "Error in PopulateZoneLists query '%s': %s", query.c_str(), errbuf);
|
||||
LogFile->write(EQEMuLog::Error, "Error in PopulateZoneLists query '%s': %s", query.c_str(), errbuf.c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -390,7 +390,7 @@ bool ZoneDatabase::PopulateZoneSpawnList(uint32 zoneid, LinkedList<Spawn2*> &spa
|
||||
|
||||
|
||||
Spawn2* ZoneDatabase::LoadSpawn2(LinkedList<Spawn2*> &spawn2_list, uint32 spawn2id, uint32 timeleft) {
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
std::string errbuf;
|
||||
std::string query;
|
||||
MYSQL_RES *result;
|
||||
MYSQL_ROW row;
|
||||
@@ -399,7 +399,7 @@ Spawn2* ZoneDatabase::LoadSpawn2(LinkedList<Spawn2*> &spawn2_list, uint32 spawn2
|
||||
"variance, pathgrid, _condition, cond_value, enabled, animation "
|
||||
"FROM spawn2 WHERE id=%i", spawn2id);
|
||||
|
||||
if (RunQuery(query, errbuf, &result)) {
|
||||
if (RunQuery(query, &errbuf, &result)) {
|
||||
if (mysql_num_rows(result) == 1)
|
||||
{
|
||||
row = mysql_fetch_row(result);
|
||||
@@ -412,13 +412,13 @@ Spawn2* ZoneDatabase::LoadSpawn2(LinkedList<Spawn2*> &spawn2_list, uint32 spawn2
|
||||
mysql_free_result(result);
|
||||
}
|
||||
|
||||
LogFile->write(EQEMuLog::Error, "Error in LoadSpawn2 query '%s': %s", query.c_str(), errbuf);
|
||||
LogFile->write(EQEMuLog::Error, "Error in LoadSpawn2 query '%s': %s", query.c_str(), errbuf.c_str());
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool ZoneDatabase::CreateSpawn2(Client *c, uint32 spawngroup, const char* zone, float heading, float x, float y, float z, uint32 respawn, uint32 variance, uint16 condition, int16 cond_value)
|
||||
{
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
std::string errbuf;
|
||||
|
||||
std::string query;
|
||||
uint32 affected_rows = 0;
|
||||
@@ -433,7 +433,7 @@ bool ZoneDatabase::CreateSpawn2(Client *c, uint32 spawngroup, const char* zone,
|
||||
"Values (%i, '%s', %f, %f, %f, %f, %i, %i, %u, %i)",
|
||||
spawngroup, zone, x, y, z, heading, respawn, variance, condition, cond_value);
|
||||
|
||||
if (RunQuery(query, errbuf, 0, &affected_rows)) {
|
||||
if (RunQuery(query, &errbuf, 0, &affected_rows)) {
|
||||
if (affected_rows == 1) {
|
||||
if(c) c->LogSQL(query.c_str());
|
||||
return true;
|
||||
@@ -443,7 +443,7 @@ bool ZoneDatabase::CreateSpawn2(Client *c, uint32 spawngroup, const char* zone,
|
||||
}
|
||||
}
|
||||
else {
|
||||
LogFile->write(EQEMuLog::Error, "Error in CreateSpawn2 query '%s': %s", query.c_str(), errbuf);
|
||||
LogFile->write(EQEMuLog::Error, "Error in CreateSpawn2 query '%s': %s", query.c_str(), errbuf.c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -682,7 +682,7 @@ void SpawnConditionManager::ExecEvent(SpawnEvent &event, bool send_update) {
|
||||
}
|
||||
|
||||
void SpawnConditionManager::UpdateDBEvent(SpawnEvent &event) {
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
std::string errbuf;
|
||||
char* query = 0;
|
||||
int len;
|
||||
|
||||
@@ -695,14 +695,14 @@ void SpawnConditionManager::UpdateDBEvent(SpawnEvent &event) {
|
||||
event.next.minute, event.next.hour, event.next.day, event.next.month,
|
||||
event.next.year, event.enabled?1:0, event.id
|
||||
);
|
||||
if(!database.RunQuery(query, errbuf)) {
|
||||
LogFile->write(EQEMuLog::Error, "Unable to update spawn event '%s': %s\n", query, errbuf);
|
||||
if(!database.RunQuery(query, &errbuf)) {
|
||||
LogFile->write(EQEMuLog::Error, "Unable to update spawn event '%s': %s\n", query, &errbuf);
|
||||
}
|
||||
safe_delete_array(query);
|
||||
}
|
||||
|
||||
void SpawnConditionManager::UpdateDBCondition(const char* zone_name, uint32 instance_id, uint16 cond_id, int16 value) {
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
std::string errbuf;
|
||||
std::string query;
|
||||
int len;
|
||||
|
||||
@@ -712,13 +712,13 @@ void SpawnConditionManager::UpdateDBCondition(const char* zone_name, uint32 inst
|
||||
"VALUES(%u, %u, '%s', %u)",
|
||||
cond_id, value, zone_name, instance_id);
|
||||
|
||||
if(!database.RunQuery(query, errbuf)) {
|
||||
LogFile->write(EQEMuLog::Error, "Unable to update spawn condition '%s': %s\n", query.c_str(), errbuf);
|
||||
if(!database.RunQuery(query, &errbuf)) {
|
||||
LogFile->write(EQEMuLog::Error, "Unable to update spawn condition '%s': %s\n", query.c_str(), errbuf.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
bool SpawnConditionManager::LoadDBEvent(uint32 event_id, SpawnEvent &event, std::string &zone_name) {
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
std::string errbuf;
|
||||
std::string query;
|
||||
MYSQL_RES *result;
|
||||
MYSQL_ROW row;
|
||||
@@ -733,7 +733,7 @@ bool SpawnConditionManager::LoadDBEvent(uint32 event_id, SpawnEvent &event, std:
|
||||
"FROM spawn_events WHERE id=%d",
|
||||
event_id);
|
||||
|
||||
if (database.RunQuery(query,errbuf, &result)) {
|
||||
if (database.RunQuery(query, &errbuf, &result)) {
|
||||
if((row = mysql_fetch_row(result))) {
|
||||
event.id = atoi(row[0]);
|
||||
event.condition_id = atoi(row[1]);
|
||||
@@ -759,14 +759,14 @@ bool SpawnConditionManager::LoadDBEvent(uint32 event_id, SpawnEvent &event, std:
|
||||
}
|
||||
mysql_free_result(result);
|
||||
} else {
|
||||
LogFile->write(EQEMuLog::Error, "Error in LoadDBEvent query '%s': %s", query.c_str(), errbuf);
|
||||
LogFile->write(EQEMuLog::Error, "Error in LoadDBEvent query '%s': %s", query.c_str(), errbuf.c_str());
|
||||
}
|
||||
return(ret);
|
||||
}
|
||||
|
||||
bool SpawnConditionManager::LoadSpawnConditions(const char* zone_name, uint32 instance_id)
|
||||
{
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
std::string errbuf;
|
||||
std::string query;
|
||||
MYSQL_RES *result;
|
||||
MYSQL_ROW row;
|
||||
@@ -780,7 +780,7 @@ bool SpawnConditionManager::LoadSpawnConditions(const char* zone_name, uint32 in
|
||||
|
||||
StringFormat(query, "SELECT id, onchange, value FROM spawn_conditions WHERE zone='%s'", zone_name);
|
||||
|
||||
if (database.RunQuery(query, errbuf, &result)) {
|
||||
if (database.RunQuery(query, &errbuf, &result)) {
|
||||
while((row = mysql_fetch_row(result))) {
|
||||
cond.condition_id = atoi(row[0]);
|
||||
cond.value = atoi(row[2]);
|
||||
@@ -791,14 +791,14 @@ bool SpawnConditionManager::LoadSpawnConditions(const char* zone_name, uint32 in
|
||||
}
|
||||
mysql_free_result(result);
|
||||
} else {
|
||||
LogFile->write(EQEMuLog::Error, "Error in LoadSpawnConditions query '%s': %s", query.c_str(), errbuf);
|
||||
LogFile->write(EQEMuLog::Error, "Error in LoadSpawnConditions query '%s': %s", query.c_str(), errbuf.c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
//load values
|
||||
StringFormat(query, "SELECT id, value FROM spawn_condition_values WHERE zone='%s' and instance_id=%u", zone_name, instance_id);
|
||||
|
||||
if (database.RunQuery(query, errbuf, &result)) {
|
||||
if (database.RunQuery(query, &errbuf, &result)) {
|
||||
while((row = mysql_fetch_row(result)))
|
||||
{
|
||||
std::map<uint16, SpawnCondition>::iterator iter = spawn_conditions.find(atoi(row[0]));
|
||||
@@ -811,7 +811,7 @@ bool SpawnConditionManager::LoadSpawnConditions(const char* zone_name, uint32 in
|
||||
}
|
||||
else
|
||||
{
|
||||
LogFile->write(EQEMuLog::Error, "Error in LoadSpawnConditions query '%s': %s", query.c_str(), errbuf);
|
||||
LogFile->write(EQEMuLog::Error, "Error in LoadSpawnConditions query '%s': %s", query.c_str(), errbuf.c_str());
|
||||
spawn_conditions.clear();
|
||||
return false;
|
||||
}
|
||||
@@ -823,7 +823,7 @@ bool SpawnConditionManager::LoadSpawnConditions(const char* zone_name, uint32 in
|
||||
"FROM spawn_events WHERE zone='%s'",
|
||||
zone_name);
|
||||
|
||||
if (database.RunQuery(query,errbuf, &result)) {
|
||||
if (database.RunQuery(query, &errbuf, &result)) {
|
||||
while((row = mysql_fetch_row(result))) {
|
||||
event.id = atoi(row[0]);
|
||||
event.condition_id = atoi(row[1]);
|
||||
@@ -849,7 +849,7 @@ bool SpawnConditionManager::LoadSpawnConditions(const char* zone_name, uint32 in
|
||||
}
|
||||
mysql_free_result(result);
|
||||
} else {
|
||||
LogFile->write(EQEMuLog::Error, "Error in LoadSpawnConditions events query '%s': %s", query.c_str(), errbuf);
|
||||
LogFile->write(EQEMuLog::Error, "Error in LoadSpawnConditions events query '%s': %s", query.c_str(), errbuf.c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1160,7 +1160,7 @@ int16 SpawnConditionManager::GetCondition(const char *zone_short, uint32 instanc
|
||||
return(cond.value);
|
||||
} else {
|
||||
//this is a remote spawn condition, grab it from the DB
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
std::string errbuf;
|
||||
std::string query;
|
||||
MYSQL_RES *result;
|
||||
MYSQL_ROW row;
|
||||
@@ -1174,7 +1174,7 @@ int16 SpawnConditionManager::GetCondition(const char *zone_short, uint32 instanc
|
||||
"WHERE zone='%s' AND instance_id=%u AND id=%d",
|
||||
zone_short, instance_id, condition_id);
|
||||
|
||||
if (database.RunQuery(query, errbuf, &result)) {
|
||||
if (database.RunQuery(query, &errbuf, &result)) {
|
||||
if((row = mysql_fetch_row(result))) {
|
||||
value = atoi(row[0]);
|
||||
} else {
|
||||
|
||||
+6
-6
@@ -143,7 +143,7 @@ bool SpawnGroupList::RemoveSpawnGroup(uint32 in_id) {
|
||||
}
|
||||
|
||||
bool ZoneDatabase::LoadSpawnGroups(const char* zone_name, uint16 version, SpawnGroupList* spawn_group_list) {
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
std::string errbuf;
|
||||
std::string query;
|
||||
MYSQL_RES *result;
|
||||
MYSQL_ROW row;
|
||||
@@ -157,7 +157,7 @@ bool ZoneDatabase::LoadSpawnGroups(const char* zone_name, uint16 version, SpawnG
|
||||
"and spawn2.version=%u and zone='%s'",
|
||||
version, zone_name);
|
||||
|
||||
if (RunQuery(query, errbuf, &result))
|
||||
if (RunQuery(query, &errbuf, &result))
|
||||
{
|
||||
while((row = mysql_fetch_row(result))) {
|
||||
SpawnGroup* newSpawnGroup = new SpawnGroup( atoi(row[0]), row[1], atoi(row[2]), atof(row[3]), atof(row[4]), atof(row[5]), atof(row[6]), atof(row[7]), atoi(row[8]), atoi(row[9]), atoi(row[10]));
|
||||
@@ -179,7 +179,7 @@ bool ZoneDatabase::LoadSpawnGroups(const char* zone_name, uint16 version, SpawnG
|
||||
zone_name);
|
||||
|
||||
|
||||
if (RunQuery(query,errbuf, &result)) {
|
||||
if (RunQuery(query, &errbuf, &result)) {
|
||||
while((row = mysql_fetch_row(result)))
|
||||
{
|
||||
SpawnEntry* newSpawnEntry = new SpawnEntry( atoi(row[1]), atoi(row[2]), row[3]?atoi(row[3]):0);
|
||||
@@ -202,7 +202,7 @@ bool ZoneDatabase::LoadSpawnGroups(const char* zone_name, uint16 version, SpawnG
|
||||
}
|
||||
|
||||
bool ZoneDatabase::LoadSpawnGroupsByID(int spawngroupid, SpawnGroupList* spawn_group_list) {
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
std::string errbuf;
|
||||
std::string query;
|
||||
MYSQL_RES *result;
|
||||
MYSQL_ROW row;
|
||||
@@ -217,7 +217,7 @@ bool ZoneDatabase::LoadSpawnGroupsByID(int spawngroupid, SpawnGroupList* spawn_g
|
||||
"WHERE spawngroup.ID='%i'",
|
||||
spawngroupid);
|
||||
|
||||
if (RunQuery(query, errbuf, &result))
|
||||
if (RunQuery(query, &errbuf, &result))
|
||||
{
|
||||
while((row = mysql_fetch_row(result))) {
|
||||
SpawnGroup* newSpawnGroup = new SpawnGroup( atoi(row[0]), row[1], atoi(row[2]), atof(row[3]), atof(row[4]), atof(row[5]), atof(row[6]), atof(row[7]), atoi(row[8]), atoi(row[9]), atoi(row[10]));
|
||||
@@ -237,7 +237,7 @@ bool ZoneDatabase::LoadSpawnGroupsByID(int spawngroupid, SpawnGroupList* spawn_g
|
||||
"AND spawngroup.spawn_limit='0' ORDER by chance",
|
||||
spawngroupid);
|
||||
|
||||
if (RunQuery(query, errbuf, &result)) {
|
||||
if (RunQuery(query, &errbuf, &result)) {
|
||||
while((row = mysql_fetch_row(result)))
|
||||
{
|
||||
SpawnEntry* newSpawnEntry = new SpawnEntry( atoi(row[1]), atoi(row[2]), row[3]?atoi(row[3]):0);
|
||||
|
||||
+4
-4
@@ -4605,7 +4605,7 @@ bool Client::SpellGlobalCheck(uint16 Spell_ID, uint16 Char_ID) {
|
||||
int Spell_Global_Value;
|
||||
int Global_Value;
|
||||
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
std::string errbuf;
|
||||
std::string query;
|
||||
MYSQL_RES *result;
|
||||
MYSQL_ROW row;
|
||||
@@ -4614,7 +4614,7 @@ bool Client::SpellGlobalCheck(uint16 Spell_ID, uint16 Char_ID) {
|
||||
"spell_globals WHERE spellid=%i",
|
||||
Spell_ID);
|
||||
|
||||
if (database.RunQuery(query,errbuf, &result)) {
|
||||
if (database.RunQuery(query, &errbuf, &result)) {
|
||||
|
||||
if (mysql_num_rows(result) == 1) {
|
||||
row = mysql_fetch_row(result);
|
||||
@@ -4631,7 +4631,7 @@ bool Client::SpellGlobalCheck(uint16 Spell_ID, uint16 Char_ID) {
|
||||
if (Spell_Global_Name.empty()) { // If the entry in the spell_globals table has nothing set for the qglobal name
|
||||
return true;
|
||||
}
|
||||
else if (database.RunQuery(query, errbuf, &result)) {
|
||||
else if (database.RunQuery(query, &errbuf, &result)) {
|
||||
|
||||
if (mysql_num_rows(result) == 1) {
|
||||
row = mysql_fetch_row(result);
|
||||
@@ -4662,7 +4662,7 @@ bool Client::SpellGlobalCheck(uint16 Spell_ID, uint16 Char_ID) {
|
||||
mysql_free_result(result);
|
||||
}
|
||||
else {
|
||||
LogFile->write(EQEMuLog::Error, "Error while querying Spell ID %i spell_globals table query '%s': %s", Spell_ID, query.c_str(), errbuf);
|
||||
LogFile->write(EQEMuLog::Error, "Error while querying Spell ID %i spell_globals table query '%s': %s", Spell_ID, query.c_str(), errbuf.c_str());
|
||||
return false; // Query failed, so prevent spell from scribing just in case
|
||||
}
|
||||
return false; // Default is false
|
||||
|
||||
+48
-48
@@ -61,7 +61,7 @@ TaskManager::~TaskManager() {
|
||||
}
|
||||
|
||||
bool TaskManager::LoadTaskSets() {
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
std::string errbuf;
|
||||
std::string query;
|
||||
MYSQL_RES *result;
|
||||
MYSQL_ROW row;
|
||||
@@ -76,7 +76,7 @@ bool TaskManager::LoadTaskSets() {
|
||||
"AND `taskid` >= 0 AND `taskid` < %i ORDER BY `id`, `taskid` ASC",
|
||||
MAXTASKSETS, MAXTASKS);
|
||||
|
||||
if(database.RunQuery(query,errbuf,&result)) {
|
||||
if(database.RunQuery(query,&errbuf,&result)) {
|
||||
|
||||
while((row = mysql_fetch_row(result))) {
|
||||
int TaskSet = atoi(row[0]);
|
||||
@@ -88,7 +88,7 @@ bool TaskManager::LoadTaskSets() {
|
||||
mysql_free_result(result);
|
||||
}
|
||||
else {
|
||||
LogFile->write(EQEMuLog::Error, "[TASKS]Error in TaskManager::LoadTaskSets: %s", errbuf);
|
||||
LogFile->write(EQEMuLog::Error, "[TASKS]Error in TaskManager::LoadTaskSets: %s", errbuf.c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -158,7 +158,7 @@ bool TaskManager::LoadTasks(int SingleTask) {
|
||||
|
||||
const char *ERR_MYSQLERROR = "[TASKS]Error in TaskManager::LoadTasks: %s";
|
||||
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
std::string errbuf;
|
||||
std::string query;
|
||||
int QueryLength = 0;
|
||||
MYSQL_RES *result;
|
||||
@@ -180,7 +180,7 @@ bool TaskManager::LoadTasks(int SingleTask) {
|
||||
StringFormat(query,SingleTaskQuery,SingleTask);
|
||||
}
|
||||
|
||||
if(database.RunQuery(query,errbuf,&result)) {
|
||||
if(database.RunQuery(query,&errbuf,&result)) {
|
||||
|
||||
while((row = mysql_fetch_row(result))) {
|
||||
int TaskID = atoi(row[0]);
|
||||
@@ -221,7 +221,7 @@ bool TaskManager::LoadTasks(int SingleTask) {
|
||||
|
||||
}
|
||||
else {
|
||||
LogFile->write(EQEMuLog::Error, ERR_MYSQLERROR, errbuf);
|
||||
LogFile->write(EQEMuLog::Error, ERR_MYSQLERROR, errbuf.c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -234,7 +234,7 @@ bool TaskManager::LoadTasks(int SingleTask) {
|
||||
StringFormat(query, SingleTaskActivityQuery, SingleTask, MAXACTIVITIESPERTASK);
|
||||
}
|
||||
|
||||
if(database.RunQuery(query, errbuf, &result)) {
|
||||
if(database.RunQuery(query, &errbuf, &result)) {
|
||||
|
||||
while((row = mysql_fetch_row(result))) {
|
||||
int TaskID = atoi(row[0]);
|
||||
@@ -320,7 +320,7 @@ bool TaskManager::LoadTasks(int SingleTask) {
|
||||
mysql_free_result(result);
|
||||
}
|
||||
else {
|
||||
LogFile->write(EQEMuLog::Error, ERR_MYSQLERROR, errbuf);
|
||||
LogFile->write(EQEMuLog::Error, ERR_MYSQLERROR, errbuf.c_str());
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@@ -351,7 +351,7 @@ bool TaskManager::SaveClientState(Client *c, ClientTaskState *state) {
|
||||
_log(TASKS__CLIENTSAVE,"TaskManager::SaveClientState for character ID %d", CharacterID);
|
||||
|
||||
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
std::string errbuf;
|
||||
std::string query;
|
||||
|
||||
if(state->ActiveTaskCount > 0) {
|
||||
@@ -366,8 +366,8 @@ bool TaskManager::SaveClientState(Client *c, ClientTaskState *state) {
|
||||
StringFormat(query, TaskQuery, CharacterID,
|
||||
TaskID, Task, state->ActiveTasks[Task].AcceptedTime);
|
||||
|
||||
if(!database.RunQuery(query, errbuf)) {
|
||||
LogFile->write(EQEMuLog::Error, ERR_MYSQLERROR, errbuf);
|
||||
if(!database.RunQuery(query, &errbuf)) {
|
||||
LogFile->write(EQEMuLog::Error, ERR_MYSQLERROR, errbuf.c_str());
|
||||
}
|
||||
else
|
||||
state->ActiveTasks[Task].Updated = false;
|
||||
@@ -411,9 +411,9 @@ bool TaskManager::SaveClientState(Client *c, ClientTaskState *state) {
|
||||
|
||||
query = UpdateActivityQuery;
|
||||
|
||||
if(!database.RunQuery(query,errbuf)) {
|
||||
if(!database.RunQuery(query,&errbuf)) {
|
||||
|
||||
LogFile->write(EQEMuLog::Error, ERR_MYSQLERROR, errbuf);
|
||||
LogFile->write(EQEMuLog::Error, ERR_MYSQLERROR, errbuf.c_str());
|
||||
}
|
||||
else {
|
||||
state->ActiveTasks[Task].Updated=false;
|
||||
@@ -444,9 +444,9 @@ bool TaskManager::SaveClientState(Client *c, ClientTaskState *state) {
|
||||
state->CompletedTasks[i].CompletedTime,
|
||||
TaskID, -1);
|
||||
|
||||
if(!database.RunQuery(query,errbuf)) {
|
||||
if(!database.RunQuery(query,&errbuf)) {
|
||||
|
||||
LogFile->write(EQEMuLog::Error, ERR_MYSQLERROR, errbuf);
|
||||
LogFile->write(EQEMuLog::Error, ERR_MYSQLERROR, errbuf.c_str());
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -462,9 +462,9 @@ bool TaskManager::SaveClientState(Client *c, ClientTaskState *state) {
|
||||
CharacterID, state->CompletedTasks[i].CompletedTime,
|
||||
TaskID, j);
|
||||
|
||||
if(!database.RunQuery(query,errbuf)) {
|
||||
if(!database.RunQuery(query,&errbuf)) {
|
||||
|
||||
LogFile->write(EQEMuLog::Error, ERR_MYSQLERROR, errbuf);
|
||||
LogFile->write(EQEMuLog::Error, ERR_MYSQLERROR, errbuf.c_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -515,7 +515,7 @@ bool TaskManager::LoadClientState(Client *c, ClientTaskState *state) {
|
||||
|
||||
const char *ERR_MYSQLERROR1 = "[TASKS]Error in TaskManager::LoadClientState load Tasks: %s";
|
||||
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
std::string errbuf;
|
||||
std::string query;
|
||||
MYSQL_RES *result;
|
||||
MYSQL_ROW row;
|
||||
@@ -530,7 +530,7 @@ bool TaskManager::LoadClientState(Client *c, ClientTaskState *state) {
|
||||
|
||||
StringFormat(query, TaskQuery, CharacterID);
|
||||
|
||||
if(database.RunQuery(query, errbuf, &result)) {
|
||||
if(database.RunQuery(query, &errbuf, &result)) {
|
||||
|
||||
while((row = mysql_fetch_row(result))) {
|
||||
|
||||
@@ -579,7 +579,7 @@ bool TaskManager::LoadClientState(Client *c, ClientTaskState *state) {
|
||||
mysql_free_result(result);
|
||||
}
|
||||
else {
|
||||
LogFile->write(EQEMuLog::Error, ERR_MYSQLERROR1, errbuf);
|
||||
LogFile->write(EQEMuLog::Error, ERR_MYSQLERROR1, errbuf.c_str());
|
||||
safe_delete(state);
|
||||
return false;
|
||||
}
|
||||
@@ -602,7 +602,7 @@ bool TaskManager::LoadClientState(Client *c, ClientTaskState *state) {
|
||||
|
||||
StringFormat(query, ActivityQuery, CharacterID);
|
||||
|
||||
if(database.RunQuery(query, errbuf, &result)) {
|
||||
if(database.RunQuery(query, &errbuf, &result)) {
|
||||
|
||||
while((row = mysql_fetch_row(result))) {
|
||||
int TaskID = atoi(row[0]);
|
||||
@@ -649,7 +649,7 @@ bool TaskManager::LoadClientState(Client *c, ClientTaskState *state) {
|
||||
mysql_free_result(result);
|
||||
}
|
||||
else {
|
||||
LogFile->write(EQEMuLog::Error, ERR_MYSQLERROR2, errbuf);
|
||||
LogFile->write(EQEMuLog::Error, ERR_MYSQLERROR2, errbuf.c_str());
|
||||
safe_delete(state);
|
||||
return false;
|
||||
}
|
||||
@@ -669,7 +669,7 @@ bool TaskManager::LoadClientState(Client *c, ClientTaskState *state) {
|
||||
|
||||
StringFormat(query, CompletedTaskQuery, CharacterID);
|
||||
|
||||
if(database.RunQuery(query, errbuf, &result)) {
|
||||
if(database.RunQuery(query, &errbuf, &result)) {
|
||||
|
||||
CompletedTaskInformation cti;
|
||||
|
||||
@@ -728,7 +728,7 @@ bool TaskManager::LoadClientState(Client *c, ClientTaskState *state) {
|
||||
mysql_free_result(result);
|
||||
}
|
||||
else {
|
||||
LogFile->write(EQEMuLog::Error, ERR_MYSQLERROR3, errbuf);
|
||||
LogFile->write(EQEMuLog::Error, ERR_MYSQLERROR3, errbuf.c_str());
|
||||
safe_delete(state);
|
||||
return false;
|
||||
}
|
||||
@@ -741,7 +741,7 @@ bool TaskManager::LoadClientState(Client *c, ClientTaskState *state) {
|
||||
|
||||
StringFormat(query, EnabledTaskQuery, CharacterID, MAXTASKS);
|
||||
|
||||
if(database.RunQuery(query, errbuf, &result)) {
|
||||
if(database.RunQuery(query, &errbuf, &result)) {
|
||||
|
||||
while((row = mysql_fetch_row(result))) {
|
||||
int TaskID = atoi(row[0]);
|
||||
@@ -751,7 +751,7 @@ bool TaskManager::LoadClientState(Client *c, ClientTaskState *state) {
|
||||
mysql_free_result(result);
|
||||
}
|
||||
else {
|
||||
LogFile->write(EQEMuLog::Error, ERR_MYSQLERROR4, errbuf);
|
||||
LogFile->write(EQEMuLog::Error, ERR_MYSQLERROR4, errbuf.c_str());
|
||||
}
|
||||
|
||||
// Check that there is an entry in the client task state for every activity in each task
|
||||
@@ -838,7 +838,7 @@ void ClientTaskState::EnableTask(int CharID, int TaskCount, int *TaskList) {
|
||||
|
||||
const char *ERR_MYSQLERROR = "[TASKS]Error in ClientTaskState::EnableTask %s %s";
|
||||
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
std::string errbuf;
|
||||
std::string query;
|
||||
|
||||
char *buf = 0;
|
||||
@@ -855,9 +855,9 @@ void ClientTaskState::EnableTask(int CharID, int TaskCount, int *TaskList) {
|
||||
|
||||
_log(TASKS__UPDATE, "Executing query %s", TaskQuery.c_str());
|
||||
query = TaskQuery;
|
||||
if(!database.RunQuery(query, errbuf)) {
|
||||
if(!database.RunQuery(query, &errbuf)) {
|
||||
|
||||
LogFile->write(EQEMuLog::Error, ERR_MYSQLERROR, query.c_str(), errbuf);
|
||||
LogFile->write(EQEMuLog::Error, ERR_MYSQLERROR, query.c_str(), errbuf.c_str());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -897,7 +897,7 @@ void ClientTaskState::DisableTask(int CharID, int TaskCount, int *TaskList) {
|
||||
|
||||
const char *ERR_MYSQLERROR = "[TASKS]Error in ClientTaskState::DisableTask %s %s";
|
||||
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
std::string errbuf;
|
||||
std::string query;
|
||||
|
||||
char *buf = 0;
|
||||
@@ -921,9 +921,9 @@ void ClientTaskState::DisableTask(int CharID, int TaskCount, int *TaskList) {
|
||||
|
||||
query = TaskQuery;
|
||||
|
||||
if(!database.RunQuery(query, errbuf)) {
|
||||
if(!database.RunQuery(query, &errbuf)) {
|
||||
|
||||
LogFile->write(EQEMuLog::Error, ERR_MYSQLERROR, query.c_str(), errbuf);
|
||||
LogFile->write(EQEMuLog::Error, ERR_MYSQLERROR, query.c_str(), errbuf.c_str());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1426,7 +1426,7 @@ int ClientTaskState::GetActiveTaskID(int index) {
|
||||
|
||||
static void DeleteCompletedTaskFromDatabase(int CharID, int TaskID) {
|
||||
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
std::string errbuf;
|
||||
std::string query;
|
||||
|
||||
const char *TaskQuery="DELETE FROM completed_tasks WHERE charid=%i AND taskid = %i";
|
||||
@@ -1436,9 +1436,9 @@ static void DeleteCompletedTaskFromDatabase(int CharID, int TaskID) {
|
||||
|
||||
StringFormat(query, TaskQuery, CharID, TaskID);
|
||||
|
||||
if(!database.RunQuery(query, errbuf)) {
|
||||
if(!database.RunQuery(query, &errbuf)) {
|
||||
|
||||
LogFile->write(EQEMuLog::Error, "[TASKS]Error in CientTaskState::CancelTask %s, %s", query.c_str(), errbuf);
|
||||
LogFile->write(EQEMuLog::Error, "[TASKS]Error in CientTaskState::CancelTask %s, %s", query.c_str(), errbuf.c_str());
|
||||
return;
|
||||
}
|
||||
_log(TASKS__UPDATE, "Delete query %s", query.c_str());
|
||||
@@ -3130,7 +3130,7 @@ void ClientTaskState::RemoveTask(Client *c, int SequenceNumber) {
|
||||
|
||||
int CharacterID = c->CharacterID();
|
||||
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
std::string errbuf;
|
||||
std::string query;
|
||||
|
||||
const char *TaskQuery="DELETE FROM character_tasks WHERE charid=%i AND taskid = %i";
|
||||
@@ -3141,18 +3141,18 @@ void ClientTaskState::RemoveTask(Client *c, int SequenceNumber) {
|
||||
|
||||
StringFormat(query,ActivityQuery, CharacterID, ActiveTasks[SequenceNumber].TaskID);
|
||||
|
||||
if(!database.RunQuery(query,errbuf)) {
|
||||
if(!database.RunQuery(query,&errbuf)) {
|
||||
|
||||
LogFile->write(EQEMuLog::Error, "[TASKS]Error in CientTaskState::CancelTask %s", errbuf);
|
||||
LogFile->write(EQEMuLog::Error, "[TASKS]Error in CientTaskState::CancelTask %s", errbuf.c_str());
|
||||
return;
|
||||
}
|
||||
_log(TASKS__UPDATE, "CancelTask: %s", query.c_str());
|
||||
|
||||
StringFormat(query,TaskQuery, CharacterID, ActiveTasks[SequenceNumber].TaskID);
|
||||
|
||||
if(!database.RunQuery(query, errbuf)) {
|
||||
if(!database.RunQuery(query, &errbuf)) {
|
||||
|
||||
LogFile->write(EQEMuLog::Error, "[TASKS]Error in CientTaskState::CancelTask %s", errbuf);
|
||||
LogFile->write(EQEMuLog::Error, "[TASKS]Error in CientTaskState::CancelTask %s", errbuf.c_str());
|
||||
}
|
||||
|
||||
_log(TASKS__UPDATE, "CancelTask: %s", query.c_str());
|
||||
@@ -3292,7 +3292,7 @@ bool TaskGoalListManager::LoadLists() {
|
||||
|
||||
const char *ERR_MYSQLERROR = "Error in TaskGoalListManager::LoadLists: %s %s";
|
||||
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
std::string errbuf;
|
||||
std::string query;
|
||||
MYSQL_RES *result;
|
||||
MYSQL_ROW row;
|
||||
@@ -3310,7 +3310,7 @@ bool TaskGoalListManager::LoadLists() {
|
||||
|
||||
query = CountQuery;
|
||||
|
||||
if(database.RunQuery(query,errbuf,&result)) {
|
||||
if(database.RunQuery(query,&errbuf,&result)) {
|
||||
|
||||
NumberOfLists = mysql_num_rows(result);
|
||||
_log(TASKS__GLOBALLOAD, "Database returned a count of %i lists", NumberOfLists);
|
||||
@@ -3334,7 +3334,7 @@ bool TaskGoalListManager::LoadLists() {
|
||||
mysql_free_result(result);
|
||||
}
|
||||
else {
|
||||
LogFile->write(EQEMuLog::Error, ERR_MYSQLERROR, query.c_str(), errbuf);
|
||||
LogFile->write(EQEMuLog::Error, ERR_MYSQLERROR, query.c_str(), errbuf.c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -3345,7 +3345,7 @@ bool TaskGoalListManager::LoadLists() {
|
||||
|
||||
StringFormat(query,ListQuery,ListID,Size);
|
||||
|
||||
if(database.RunQuery(query,errbuf,&result)) {
|
||||
if(database.RunQuery(query, &errbuf,&result)) {
|
||||
// This should only happen if a row is deleted in between us retrieving the counts
|
||||
// at the start of this method and getting to here. It should not be possible for
|
||||
// an INSERT to cause a problem, as the SELECT is used with a LIMIT
|
||||
@@ -3371,7 +3371,7 @@ bool TaskGoalListManager::LoadLists() {
|
||||
mysql_free_result(result);
|
||||
}
|
||||
else {
|
||||
LogFile->write(EQEMuLog::Error, ERR_MYSQLERROR, query.c_str(), errbuf);
|
||||
LogFile->write(EQEMuLog::Error, ERR_MYSQLERROR, query.c_str(), errbuf.c_str());
|
||||
TaskGoalLists[ListIndex].Size = 0;
|
||||
}
|
||||
}
|
||||
@@ -3480,7 +3480,7 @@ bool TaskProximityManager::LoadProximities(int ZoneID) {
|
||||
|
||||
const char *ERR_MYSQLERROR = "Error in TaskProximityManager::LoadProximities %s %s";
|
||||
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
std::string errbuf;
|
||||
std::string query;
|
||||
MYSQL_RES *result;
|
||||
MYSQL_ROW row;
|
||||
@@ -3493,7 +3493,7 @@ bool TaskProximityManager::LoadProximities(int ZoneID) {
|
||||
|
||||
StringFormat(query,ProximityQuery, ZoneID);
|
||||
|
||||
if(database.RunQuery(query, errbuf,&result)) {
|
||||
if(database.RunQuery(query, &errbuf,&result)) {
|
||||
|
||||
while((row = mysql_fetch_row(result))) {
|
||||
Proximity.ExploreID = atoi(row[0]);
|
||||
@@ -3510,7 +3510,7 @@ bool TaskProximityManager::LoadProximities(int ZoneID) {
|
||||
mysql_free_result(result);
|
||||
}
|
||||
else {
|
||||
LogFile->write(EQEMuLog::Error, ERR_MYSQLERROR, query.c_str(), errbuf);
|
||||
LogFile->write(EQEMuLog::Error, ERR_MYSQLERROR, query.c_str(), errbuf.c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
+25
-25
@@ -33,7 +33,7 @@ bool TitleManager::LoadTitles()
|
||||
|
||||
TitleEntry Title;
|
||||
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
std::string errbuf;
|
||||
std::string query;
|
||||
MYSQL_RES *result;
|
||||
MYSQL_ROW row;
|
||||
@@ -43,9 +43,9 @@ bool TitleManager::LoadTitles()
|
||||
"`char_id`, `status`, `item_id`, `prefix`, `suffix`, "
|
||||
"`title_set` from titles";
|
||||
|
||||
if (!database.RunQuery(query, errbuf, &result))
|
||||
if (!database.RunQuery(query, &errbuf, &result))
|
||||
{
|
||||
LogFile->write(EQEMuLog::Error, "Unable to load titles: %s : %s", query.c_str(), errbuf);
|
||||
LogFile->write(EQEMuLog::Error, "Unable to load titles: %s : %s", query.c_str(), errbuf.c_str());
|
||||
return(false);
|
||||
}
|
||||
|
||||
@@ -250,7 +250,7 @@ void TitleManager::CreateNewPlayerTitle(Client *c, const char *Title)
|
||||
if(!c || !Title)
|
||||
return;
|
||||
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
std::string errbuf;
|
||||
std::string query;
|
||||
MYSQL_RES *result;
|
||||
|
||||
@@ -262,7 +262,7 @@ void TitleManager::CreateNewPlayerTitle(Client *c, const char *Title)
|
||||
|
||||
StringFormat(query,"SELECT `id` from titles where `prefix` = '%s' and char_id = %i", escTitle.c_str(), c->CharacterID());
|
||||
|
||||
if (database.RunQuery(query, errbuf, &result))
|
||||
if (database.RunQuery(query, &errbuf, &result))
|
||||
{
|
||||
if(mysql_num_rows(result) > 0)
|
||||
{
|
||||
@@ -275,14 +275,14 @@ void TitleManager::CreateNewPlayerTitle(Client *c, const char *Title)
|
||||
StringFormat(query, "INSERT into titles (`char_id`, `prefix`) VALUES(%i, '%s')",
|
||||
c->CharacterID(), escTitle.c_str());
|
||||
|
||||
if(!database.RunQuery(query,errbuf))
|
||||
LogFile->write(EQEMuLog::Error, "Error adding title: %s %s", query.c_str(), errbuf);
|
||||
else
|
||||
{
|
||||
ServerPacket* pack = new ServerPacket(ServerOP_ReloadTitles, 0);
|
||||
worldserver.SendPacket(pack);
|
||||
safe_delete(pack);
|
||||
if(!database.RunQuery(query,& errbuf)) {
|
||||
LogFile->write(EQEMuLog::Error, "Error adding title: %s %s", query.c_str(), errbuf.c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
ServerPacket* pack = new ServerPacket(ServerOP_ReloadTitles, 0);
|
||||
worldserver.SendPacket(pack);
|
||||
safe_delete(pack);
|
||||
}
|
||||
|
||||
void TitleManager::CreateNewPlayerSuffix(Client *c, const char *Suffix)
|
||||
@@ -290,7 +290,7 @@ void TitleManager::CreateNewPlayerSuffix(Client *c, const char *Suffix)
|
||||
if(!c || !Suffix)
|
||||
return;
|
||||
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
std::string errbuf;
|
||||
std::string query;
|
||||
MYSQL_RES *result;
|
||||
|
||||
@@ -303,7 +303,7 @@ void TitleManager::CreateNewPlayerSuffix(Client *c, const char *Suffix)
|
||||
StringFormat(query, "SELECT `id` from titles where `suffix` = '%s' and char_id = %i",
|
||||
escSuffix.c_str(), c->CharacterID());
|
||||
|
||||
if (database.RunQuery(query, errbuf, &result))
|
||||
if (database.RunQuery(query, &errbuf, &result))
|
||||
{
|
||||
if(mysql_num_rows(result) > 0)
|
||||
{
|
||||
@@ -316,8 +316,8 @@ void TitleManager::CreateNewPlayerSuffix(Client *c, const char *Suffix)
|
||||
StringFormat(query, "INSERT into titles (`char_id`, `suffix`) VALUES(%i, '%s')",
|
||||
c->CharacterID(), escSuffix.c_str());
|
||||
|
||||
if(!database.RunQuery(query, errbuf))
|
||||
LogFile->write(EQEMuLog::Error, "Error adding title suffix: %s %s", query.c_str(), errbuf);
|
||||
if(!database.RunQuery(query, &errbuf))
|
||||
LogFile->write(EQEMuLog::Error, "Error adding title suffix: %s %s", query.c_str(), errbuf.c_str());
|
||||
else
|
||||
{
|
||||
ServerPacket* pack = new ServerPacket(ServerOP_ReloadTitles, 0);
|
||||
@@ -369,14 +369,14 @@ void Client::EnableTitle(int titleset) {
|
||||
return;
|
||||
}
|
||||
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
std::string errbuf;
|
||||
std::string query;
|
||||
|
||||
StringFormat(query, "INSERT INTO player_titlesets "
|
||||
"(char_id, title_set) VALUES (%i, %i)",
|
||||
CharacterID(), titleset);
|
||||
|
||||
if(!database.RunQuery(query, errbuf)) {
|
||||
if(!database.RunQuery(query, &errbuf)) {
|
||||
LogFile->write(EQEMuLog::Error, "Error in EnableTitle query for titleset %i and charid %i", titleset, CharacterID());
|
||||
}
|
||||
|
||||
@@ -385,7 +385,7 @@ void Client::EnableTitle(int titleset) {
|
||||
|
||||
bool Client::CheckTitle(int titleset) {
|
||||
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
std::string errbuf;
|
||||
std::string query;
|
||||
MYSQL_RES *result;
|
||||
|
||||
@@ -394,16 +394,16 @@ bool Client::CheckTitle(int titleset) {
|
||||
"`char_id`=%i LIMIT 1",
|
||||
titleset, CharacterID());
|
||||
|
||||
if (database.RunQuery(query, errbuf, &result)) {
|
||||
if (!database.RunQuery(query, &errbuf, &result))
|
||||
{
|
||||
if (mysql_num_rows(result) >= 1) {
|
||||
mysql_free_result(result);
|
||||
return(true);
|
||||
}
|
||||
mysql_free_result(result);
|
||||
}
|
||||
|
||||
else {
|
||||
LogFile->write(EQEMuLog::Error, "Error in CheckTitle query '%s': %s", query.c_str(), errbuf);
|
||||
LogFile->write(EQEMuLog::Error, "Error in CheckTitle query '%s': %s", query.c_str(), errbuf.c_str());
|
||||
}
|
||||
|
||||
return false;
|
||||
@@ -415,15 +415,15 @@ void Client::RemoveTitle(int titleset) {
|
||||
return;
|
||||
}
|
||||
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
std::string errbuf;
|
||||
std::string query;
|
||||
|
||||
StringFormat(query, "DELETE FROM player_titlesets WHERE "
|
||||
"`title_set`=%i AND `char_id`=%i",
|
||||
titleset, CharacterID());
|
||||
|
||||
if (!database.RunQuery(query, errbuf)) {
|
||||
LogFile->write(EQEMuLog::Error, "Error in RemoveTitle query '%s': %s", query.c_str(), errbuf);
|
||||
if (!database.RunQuery(query, &errbuf)) {
|
||||
LogFile->write(EQEMuLog::Error, "Error in RemoveTitle query '%s': %s", query.c_str(), errbuf.c_str());
|
||||
}
|
||||
|
||||
return;
|
||||
|
||||
+33
-34
@@ -390,7 +390,7 @@ void Object::HandleAutoCombine(Client* user, const RecipeAutoCombine_Struct* rac
|
||||
}
|
||||
|
||||
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
std::string errbuf;
|
||||
MYSQL_RES *result;
|
||||
MYSQL_ROW row;
|
||||
std::string query;
|
||||
@@ -404,8 +404,8 @@ void Object::HandleAutoCombine(Client* user, const RecipeAutoCombine_Struct* rac
|
||||
"WHERE tre.componentcount > 0 AND "
|
||||
"tre.recipe_id=%u", rac->recipe_id);
|
||||
|
||||
if (!database.RunQuery(query, errbuf, &result)) {
|
||||
LogFile->write(EQEMuLog::Error, "Error in HandleAutoCombine query '%s': %s", query.c_str(), errbuf);
|
||||
if (!database.RunQuery(query, &errbuf, &result)) {
|
||||
LogFile->write(EQEMuLog::Error, "Error in HandleAutoCombine query '%s': %s", query.c_str(), errbuf.c_str());
|
||||
user->QueuePacket(outapp);
|
||||
safe_delete(outapp);
|
||||
return;
|
||||
@@ -608,12 +608,12 @@ SkillType Object::TypeToSkill(uint32 type) {
|
||||
}
|
||||
|
||||
void Client::TradeskillSearchResults(const std::string query, unsigned long qlen, unsigned long objtype, unsigned long someid) {
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
std::string errbuf;
|
||||
MYSQL_RES *result;
|
||||
MYSQL_ROW row;
|
||||
|
||||
if (!database.RunQuery(query, errbuf, &result)) {
|
||||
LogFile->write(EQEMuLog::Error, "Error in TradeskillSearchResults query '%s': %s", query.c_str(), errbuf);
|
||||
if (!database.RunQuery(query, &errbuf, &result)) {
|
||||
LogFile->write(EQEMuLog::Error, "Error in TradeskillSearchResults query '%s': %s", query.c_str(), errbuf.c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -668,7 +668,7 @@ void Client::TradeskillSearchResults(const std::string query, unsigned long qlen
|
||||
|
||||
void Client::SendTradeskillDetails(uint32 recipe_id) {
|
||||
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
std::string errbuf;
|
||||
MYSQL_RES *result;
|
||||
MYSQL_ROW row;
|
||||
std::string query;
|
||||
@@ -682,8 +682,8 @@ void Client::SendTradeskillDetails(uint32 recipe_id) {
|
||||
"LEFT JOIN items AS i ON tre.item_id = i.id "
|
||||
"WHERE tre.componentcount > 0 AND tre.recipe_id=%u", recipe_id);
|
||||
|
||||
if (!database.RunQuery(query, errbuf, &result)) {
|
||||
LogFile->write(EQEMuLog::Error, "Error in SendTradeskillDetails query '%s': %s", query.c_str(), errbuf);
|
||||
if (!database.RunQuery(query, &errbuf, &result)) {
|
||||
LogFile->write(EQEMuLog::Error, "Error in SendTradeskillDetails query '%s': %s", query.c_str(), errbuf.c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1124,7 +1124,7 @@ void Client::CheckIncreaseTradeskill(int16 bonusstat, int16 stat_modifier, float
|
||||
bool ZoneDatabase::GetTradeRecipe(const ItemInst* container, uint8 c_type, uint32 some_id,
|
||||
uint32 char_id, DBTradeskillRecipe_Struct *spec)
|
||||
{
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
std::string errbuf;
|
||||
MYSQL_RES *result;
|
||||
MYSQL_ROW row;
|
||||
std::string query;
|
||||
@@ -1182,9 +1182,9 @@ bool ZoneDatabase::GetTradeRecipe(const ItemInst* container, uint8 c_type, uint3
|
||||
"AND sum(tre.item_id * tre.componentcount) = %u",
|
||||
buf2, containers, count, sum);
|
||||
|
||||
if (!RunQuery(query, errbuf, &result)) {
|
||||
if (!RunQuery(query, &errbuf, &result)) {
|
||||
LogFile->write(EQEMuLog::Error, "Error in GetTradeRecipe search, query: %s", query.c_str());
|
||||
LogFile->write(EQEMuLog::Error, "Error in GetTradeRecipe search, error: %s", errbuf);
|
||||
LogFile->write(EQEMuLog::Error, "Error in GetTradeRecipe search, error: %s", errbuf.c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1219,9 +1219,9 @@ bool ZoneDatabase::GetTradeRecipe(const ItemInst* container, uint8 c_type, uint3
|
||||
"AND sum(tre.item_id * tre.componentcount) = %u",
|
||||
buf2, count, sum);
|
||||
|
||||
if (!RunQuery(query, errbuf, &result)) {
|
||||
if (!RunQuery(query, &errbuf, &result)) {
|
||||
LogFile->write(EQEMuLog::Error, "Error in GetTradeRecipe, re-query: %s", query.c_str());
|
||||
LogFile->write(EQEMuLog::Error, "Error in GetTradeRecipe, error: %s", errbuf);
|
||||
LogFile->write(EQEMuLog::Error, "Error in GetTradeRecipe, error: %s", errbuf.c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1252,9 +1252,9 @@ bool ZoneDatabase::GetTradeRecipe(const ItemInst* container, uint8 c_type, uint3
|
||||
"AND tre.item_id = %u;",
|
||||
buf2, containerId);
|
||||
|
||||
if (!RunQuery(query, errbuf, &result)) {
|
||||
if (!RunQuery(query, &errbuf, &result)) {
|
||||
LogFile->write(EQEMuLog::Error, "Error in GetTradeRecipe, re-query: %s", query.c_str());
|
||||
LogFile->write(EQEMuLog::Error, "Error in GetTradeRecipe, error: %s", errbuf);
|
||||
LogFile->write(EQEMuLog::Error, "Error in GetTradeRecipe, error: %s", errbuf.c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1277,7 +1277,6 @@ bool ZoneDatabase::GetTradeRecipe(const ItemInst* container, uint8 c_type, uint3
|
||||
//instead of part which is possible with experimentation.
|
||||
//This is here because something's up with the query above.. it needs to be rethought out
|
||||
bool has_components = true;
|
||||
char TSerrbuf[MYSQL_ERRMSG_SIZE];
|
||||
MYSQL_RES *TSresult;
|
||||
MYSQL_ROW TSrow;
|
||||
|
||||
@@ -1286,7 +1285,7 @@ bool ZoneDatabase::GetTradeRecipe(const ItemInst* container, uint8 c_type, uint3
|
||||
"recipe_id=%i AND componentcount > 0",
|
||||
recipe_id);
|
||||
|
||||
if (RunQuery(query, TSerrbuf, &TSresult)) {
|
||||
if (RunQuery(query, &errbuf, &TSresult)) {
|
||||
while((TSrow = mysql_fetch_row(TSresult))!=nullptr) {
|
||||
int ccnt = 0;
|
||||
for(int x = 0; x < 10; x++){
|
||||
@@ -1305,7 +1304,7 @@ bool ZoneDatabase::GetTradeRecipe(const ItemInst* container, uint8 c_type, uint3
|
||||
}
|
||||
mysql_free_result(TSresult);
|
||||
} else {
|
||||
LogFile->write(EQEMuLog::Error, "Error in tradeskill verify query: '%s': %s", query.c_str(), TSerrbuf);
|
||||
LogFile->write(EQEMuLog::Error, "Error in tradeskill verify query: '%s': %s", query.c_str(), errbuf.c_str());
|
||||
}
|
||||
|
||||
if(has_components == false){
|
||||
@@ -1318,7 +1317,7 @@ bool ZoneDatabase::GetTradeRecipe(const ItemInst* container, uint8 c_type, uint3
|
||||
bool ZoneDatabase::GetTradeRecipe(uint32 recipe_id, uint8 c_type, uint32 some_id,
|
||||
uint32 char_id, DBTradeskillRecipe_Struct *spec)
|
||||
{
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
std::string errbuf;
|
||||
MYSQL_RES *result;
|
||||
MYSQL_ROW row;
|
||||
std::string query;
|
||||
@@ -1349,9 +1348,9 @@ bool ZoneDatabase::GetTradeRecipe(uint32 recipe_id, uint8 c_type, uint32 some_id
|
||||
"GROUP BY tr.id",
|
||||
char_id, (unsigned long)recipe_id, containers);
|
||||
|
||||
if (!RunQuery(query, errbuf, &result)) {
|
||||
if (!RunQuery(query, &errbuf, &result)) {
|
||||
LogFile->write(EQEMuLog::Error, "Error in GetTradeRecipe, query: %s", query.c_str());
|
||||
LogFile->write(EQEMuLog::Error, "Error in GetTradeRecipe, error: %s", errbuf);
|
||||
LogFile->write(EQEMuLog::Error, "Error in GetTradeRecipe, error: %s", errbuf.c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1385,8 +1384,8 @@ bool ZoneDatabase::GetTradeRecipe(uint32 recipe_id, uint8 c_type, uint32 some_id
|
||||
"WHERE successcount>0 AND recipe_id=%u",
|
||||
recipe_id);
|
||||
|
||||
if (!RunQuery(query, errbuf, &result)) {
|
||||
LogFile->write(EQEMuLog::Error, "Error in GetTradeRecept success query '%s': %s", query.c_str(), errbuf);
|
||||
if (!RunQuery(query, &errbuf, &result)) {
|
||||
LogFile->write(EQEMuLog::Error, "Error in GetTradeRecept success query '%s': %s", query.c_str(), errbuf.c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1411,7 +1410,7 @@ bool ZoneDatabase::GetTradeRecipe(uint32 recipe_id, uint8 c_type, uint32 some_id
|
||||
recipe_id);
|
||||
|
||||
spec->onfail.clear();
|
||||
if (RunQuery(query, errbuf, &result)) {
|
||||
if (RunQuery(query, &errbuf, &result)) {
|
||||
|
||||
qcount = mysql_num_rows(result);
|
||||
uint8 r;
|
||||
@@ -1432,7 +1431,7 @@ bool ZoneDatabase::GetTradeRecipe(uint32 recipe_id, uint8 c_type, uint32 some_id
|
||||
|
||||
spec->salvage.clear();
|
||||
// Don't bother with the query if TS is nofail
|
||||
if (!spec->nofail && RunQuery(query, errbuf, &result)) {
|
||||
if (!spec->nofail && RunQuery(query, &errbuf, &result)) {
|
||||
qcount = mysql_num_rows(result);
|
||||
uint8 r;
|
||||
for(r = 0; r < qcount; r++) {
|
||||
@@ -1452,15 +1451,15 @@ void ZoneDatabase::UpdateRecipeMadecount(uint32 recipe_id, uint32 char_id, uint3
|
||||
{
|
||||
std::string query;
|
||||
uint32 qlen;
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
std::string errbuf;
|
||||
|
||||
StringFormat(query, "INSERT INTO char_recipe_list "
|
||||
"SET recipe_id = %u, char_id = %u, madecount = %u "
|
||||
"ON DUPLICATE KEY UPDATE madecount = %u;",
|
||||
recipe_id, char_id, madecount, madecount);
|
||||
|
||||
if (!RunQuery(query, errbuf)) {
|
||||
LogFile->write(EQEMuLog::Error, "Error in UpdateRecipeMadecount query '%s': %s", query.c_str(), errbuf);
|
||||
if (!RunQuery(query, &errbuf)) {
|
||||
LogFile->write(EQEMuLog::Error, "Error in UpdateRecipeMadecount query '%s': %s", query.c_str(), errbuf.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1469,7 +1468,7 @@ void Client::LearnRecipe(uint32 recipeID)
|
||||
std::string query;
|
||||
uint32 qlen;
|
||||
uint32 qcount = 0;
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
std::string errbuf;
|
||||
MYSQL_RES *result;
|
||||
MYSQL_ROW row;
|
||||
|
||||
@@ -1481,8 +1480,8 @@ void Client::LearnRecipe(uint32 recipeID)
|
||||
"WHERE tr.id = %u ;",
|
||||
CharacterID(), recipeID);
|
||||
|
||||
if (!database.RunQuery(query, errbuf, &result)) {
|
||||
LogFile->write(EQEMuLog::Error, "Error in Client::LearnRecipe query '%s': %s", query.c_str(), errbuf);
|
||||
if (!database.RunQuery(query, &errbuf, &result)) {
|
||||
LogFile->write(EQEMuLog::Error, "Error in Client::LearnRecipe query '%s': %s", query.c_str(), errbuf.c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1505,8 +1504,8 @@ void Client::LearnRecipe(uint32 recipeID)
|
||||
"ON DUPLICATE KEY UPDATE madecount = madecount;",
|
||||
recipeID, CharacterID());
|
||||
|
||||
if (!database.RunQuery(query, errbuf)) {
|
||||
LogFile->write(EQEMuLog::Error, "Error in LearnRecipe query '%s': %s", query.c_str(), errbuf);
|
||||
if (!database.RunQuery(query, &errbuf)) {
|
||||
LogFile->write(EQEMuLog::Error, "Error in LearnRecipe query '%s': %s", query.c_str(), errbuf.c_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+14
-14
@@ -1187,13 +1187,13 @@ static void BazaarAuditTrail(const char *Seller, const char *Buyer, const char *
|
||||
const char *AuditQuery="INSERT INTO `trader_audit` (`time`, `seller`, `buyer`, `itemname`, `quantity`, `totalcost`, `trantype`) "
|
||||
"VALUES (NOW(), '%s', '%s', '%s', %i, %i, %i)";
|
||||
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
std::string errbuf;
|
||||
std::string query;
|
||||
|
||||
StringFormat(query, AuditQuery, Seller, Buyer, ItemName, Quantity, TotalCost, TranType);
|
||||
|
||||
if(!database.RunQuery(query, errbuf))
|
||||
_log(TRADING__CLIENT, "Audit write error: %s : %s", query.c_str(), errbuf);
|
||||
if(!database.RunQuery(query, &errbuf))
|
||||
_log(TRADING__CLIENT, "Audit write error: %s : %s", query.c_str(), errbuf.c_str());
|
||||
|
||||
}
|
||||
|
||||
@@ -1335,13 +1335,13 @@ void Client::BuyTraderItem(TraderBuy_Struct* tbs,Client* Trader,const EQApplicat
|
||||
|
||||
void Client::SendBazaarWelcome(){
|
||||
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
std::string errbuf;
|
||||
MYSQL_RES *result;
|
||||
MYSQL_ROW row;
|
||||
|
||||
std::string query = "select count(distinct char_id),count(char_id) from trader";
|
||||
|
||||
if (database.RunQuery(query,errbuf,&result)){
|
||||
if (database.RunQuery(query,&errbuf,&result)){
|
||||
if(mysql_num_rows(result)==1){
|
||||
|
||||
row = mysql_fetch_row(result);
|
||||
@@ -1367,7 +1367,7 @@ void Client::SendBazaarWelcome(){
|
||||
|
||||
query = "select count(distinct charid) from buyer";
|
||||
|
||||
if (database.RunQuery(query,errbuf,&result)){
|
||||
if (database.RunQuery(query,&errbuf,&result)){
|
||||
if(mysql_num_rows(result)==1) {
|
||||
|
||||
row = mysql_fetch_row(result);
|
||||
@@ -1382,7 +1382,7 @@ void Client::SendBazaarWelcome(){
|
||||
void Client::SendBazaarResults(uint32 TraderID, uint32 Class_, uint32 Race, uint32 ItemStat, uint32 Slot, uint32 Type,
|
||||
char Name[64], uint32 MinPrice, uint32 MaxPrice) {
|
||||
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
std::string errbuf;
|
||||
std::string query;
|
||||
std::string Search, Values;
|
||||
MYSQL_RES *Result;
|
||||
@@ -1577,7 +1577,7 @@ void Client::SendBazaarResults(uint32 TraderID, uint32 Class_, uint32 Race, uint
|
||||
"items.id,charges,char_id limit %i",
|
||||
Values.c_str(),Search.c_str(), RuleI(Bazaar, MaxSearchResults));
|
||||
|
||||
if (database.RunQuery(query,errbuf,&Result)){
|
||||
if (database.RunQuery(query,&errbuf,&Result)){
|
||||
|
||||
_log(TRADING__CLIENT, "SRCH: %s", query.c_str());
|
||||
|
||||
@@ -1688,7 +1688,7 @@ void Client::SendBazaarResults(uint32 TraderID, uint32 Class_, uint32 Race, uint
|
||||
|
||||
}
|
||||
else{
|
||||
_log(TRADING__CLIENT, "Failed to retrieve Bazaar Search!! %s %s\n", query.c_str(), errbuf);
|
||||
_log(TRADING__CLIENT, "Failed to retrieve Bazaar Search!! %s %s\n", query.c_str(), errbuf.c_str());
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -2018,7 +2018,7 @@ void Client::SendBuyerResults(char* SearchString, uint32 SearchID) {
|
||||
//
|
||||
_log(TRADING__BARTER, "Client::SendBuyerResults %s\n", SearchString);
|
||||
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
std::string errbuf;
|
||||
std::string query;
|
||||
char ItemName[64];
|
||||
std::string Search, Values;
|
||||
@@ -2031,7 +2031,7 @@ void Client::SendBuyerResults(char* SearchString, uint32 SearchID) {
|
||||
StringFormat(query, "select * from buyer where itemname like '%%%s%%' order by charid limit %i",
|
||||
escSearchString.c_str(), RuleI(Bazaar, MaxBarterSearchResults));
|
||||
|
||||
if (database.RunQuery(query,errbuf, &Result)) {
|
||||
if (database.RunQuery(query,&errbuf, &Result)) {
|
||||
|
||||
int NumberOfRows = mysql_num_rows(Result);
|
||||
|
||||
@@ -2106,7 +2106,7 @@ void Client::SendBuyerResults(char* SearchString, uint32 SearchID) {
|
||||
mysql_free_result(Result);
|
||||
}
|
||||
else{
|
||||
_log(TRADING__CLIENT, "Failed to retrieve Barter Search!! %s %s\n", query.c_str(), errbuf);
|
||||
_log(TRADING__CLIENT, "Failed to retrieve Barter Search!! %s %s\n", query.c_str(), errbuf.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2150,7 +2150,7 @@ void Client::ShowBuyLines(const EQApplicationPacket *app) {
|
||||
|
||||
safe_delete(outapp);
|
||||
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
std::string errbuf;
|
||||
std::string query;
|
||||
char ItemName[64];
|
||||
std::string Search, Values;
|
||||
@@ -2160,7 +2160,7 @@ void Client::ShowBuyLines(const EQApplicationPacket *app) {
|
||||
StringFormat(query, "select * from buyer where charid = %i",
|
||||
Buyer->CharacterID());
|
||||
|
||||
if (database.RunQuery(query,errbuf,&Result)){
|
||||
if (database.RunQuery(query,&errbuf,&Result)){
|
||||
|
||||
if(mysql_num_rows(Result) == 0) {
|
||||
mysql_free_result(Result);
|
||||
|
||||
+3
-3
@@ -266,7 +266,7 @@ Mob* EntityList::GetTrapTrigger(Trap* trap) {
|
||||
|
||||
//todo: rewrite this to not need direct access to trap members.
|
||||
bool ZoneDatabase::LoadTraps(const char* zonename, int16 version) {
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
std::string errbuf;
|
||||
std::string query;
|
||||
MYSQL_RES *result;
|
||||
MYSQL_ROW row;
|
||||
@@ -280,7 +280,7 @@ bool ZoneDatabase::LoadTraps(const char* zonename, int16 version) {
|
||||
"AND version=%u",
|
||||
zonename, version);
|
||||
|
||||
if (RunQuery(query, errbuf, &result)) {
|
||||
if (RunQuery(query, &errbuf, &result)) {
|
||||
while ((row = mysql_fetch_row(result)))
|
||||
{
|
||||
lengths = mysql_fetch_lengths(result);
|
||||
@@ -306,7 +306,7 @@ bool ZoneDatabase::LoadTraps(const char* zonename, int16 version) {
|
||||
mysql_free_result(result);
|
||||
}
|
||||
else {
|
||||
LogFile->write(EQEMuLog::Error, "Error in LoadTraps query '%s': %s", query.c_str(), errbuf);
|
||||
LogFile->write(EQEMuLog::Error, "Error in LoadTraps query '%s': %s", query.c_str(), errbuf.c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
+5
-5
@@ -378,7 +378,7 @@ void Client::SendGuildTributes() {
|
||||
}
|
||||
|
||||
bool ZoneDatabase::LoadTributes() {
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
std::string errbuf;
|
||||
MYSQL_RES *result;
|
||||
MYSQL_ROW row;
|
||||
|
||||
@@ -390,7 +390,7 @@ bool ZoneDatabase::LoadTributes() {
|
||||
|
||||
std::string query = "SELECT id,name,descr,unknown,isguild FROM tributes";
|
||||
|
||||
if (RunQuery(query, errbuf, &result)) {
|
||||
if (RunQuery(query, &errbuf, &result)) {
|
||||
int r;
|
||||
while ((row = mysql_fetch_row(result))) {
|
||||
r = 0;
|
||||
@@ -404,14 +404,14 @@ bool ZoneDatabase::LoadTributes() {
|
||||
}
|
||||
mysql_free_result(result);
|
||||
} else {
|
||||
LogFile->write(EQEMuLog::Error, "Error in LoadTributes first query '%s': %s", query.c_str(), errbuf);
|
||||
LogFile->write(EQEMuLog::Error, "Error in LoadTributes first query '%s': %s", query.c_str(), errbuf.c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
std::string query2 = "SELECT tribute_id,level,cost,item_id FROM tribute_levels ORDER BY tribute_id,level";
|
||||
|
||||
if (RunQuery(query2, errbuf, &result)) {
|
||||
if (RunQuery(query2, &errbuf, &result)) {
|
||||
int r;
|
||||
while ((row = mysql_fetch_row(result))) {
|
||||
r = 0;
|
||||
@@ -438,7 +438,7 @@ bool ZoneDatabase::LoadTributes() {
|
||||
}
|
||||
mysql_free_result(result);
|
||||
} else {
|
||||
LogFile->write(EQEMuLog::Error, "Error in LoadTributes level query '%s': %s", query.c_str(), errbuf);
|
||||
LogFile->write(EQEMuLog::Error, "Error in LoadTributes level query '%s': %s", query.c_str(), errbuf.c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
+51
-51
@@ -838,7 +838,7 @@ void NPC::AssignWaypoints(int32 grid) {
|
||||
return;
|
||||
}
|
||||
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
std::string errbuf;
|
||||
std::string query;
|
||||
MYSQL_RES *result;
|
||||
MYSQL_ROW row;
|
||||
@@ -851,7 +851,7 @@ void NPC::AssignWaypoints(int32 grid) {
|
||||
"WHERE `id`=%i AND `zoneid`=%i",
|
||||
grid, zone->GetZoneID());
|
||||
|
||||
if(database.RunQuery(query, errbuf, &result))
|
||||
if(database.RunQuery(query, &errbuf, &result))
|
||||
{
|
||||
if((row = mysql_fetch_row(result)))
|
||||
{
|
||||
@@ -871,7 +871,7 @@ void NPC::AssignWaypoints(int32 grid) {
|
||||
else // DB query error!
|
||||
{
|
||||
GridErr = true;
|
||||
LogFile->write(EQEMuLog::Error, "MySQL Error while trying to assign grid %u to mob %s: %s", grid, name, errbuf);
|
||||
LogFile->write(EQEMuLog::Error, "MySQL Error while trying to assign grid %u to mob %s: %s", grid, name, errbuf.c_str());
|
||||
}
|
||||
|
||||
if(!GridErr)
|
||||
@@ -885,7 +885,7 @@ void NPC::AssignWaypoints(int32 grid) {
|
||||
"`zoneid`=%i ORDER BY `number`",
|
||||
grid,zone->GetZoneID());
|
||||
|
||||
if(database.RunQuery(query,errbuf,&result))
|
||||
if(database.RunQuery(query,&errbuf,&result))
|
||||
{
|
||||
roamer = true;
|
||||
max_wp = -1; // Initialize it; will increment it for each waypoint successfully added to the list
|
||||
@@ -925,7 +925,7 @@ void NPC::AssignWaypoints(int32 grid) {
|
||||
else // DB query error!
|
||||
{
|
||||
WPErr = true;
|
||||
LogFile->write(EQEMuLog::Error, "MySQL Error while trying to assign waypoints from grid %u to mob %s: %s", grid, name, errbuf);
|
||||
LogFile->write(EQEMuLog::Error, "MySQL Error while trying to assign waypoints from grid %u to mob %s: %s", grid, name, errbuf.c_str());
|
||||
}
|
||||
} // end if (!GridErr)
|
||||
if(Waypoints.size() < 2) {
|
||||
@@ -997,7 +997,7 @@ void Mob::SendToFixZ(float new_x, float new_y, float new_z) {
|
||||
|
||||
int ZoneDatabase::GetHighestGrid(uint32 zoneid) {
|
||||
std::string query;
|
||||
char errbuff[MYSQL_ERRMSG_SIZE];
|
||||
std::string errbuff;
|
||||
MYSQL_RES *result;
|
||||
MYSQL_ROW row;
|
||||
int res = 0;
|
||||
@@ -1005,14 +1005,14 @@ int ZoneDatabase::GetHighestGrid(uint32 zoneid) {
|
||||
StringFormat(query, "SELECT COALESCE(MAX(id), 0) FROM grid WHERE zoneid = %i",
|
||||
zoneid);
|
||||
|
||||
if (RunQuery(query, errbuff,&result)) {
|
||||
if (RunQuery(query, &errbuff,&result)) {
|
||||
if (mysql_num_rows(result) == 1) {
|
||||
row = mysql_fetch_row(result);
|
||||
res = atoi( row[0] );
|
||||
}
|
||||
mysql_free_result(result);
|
||||
} else {
|
||||
LogFile->write(EQEMuLog::Error, "Error in GetHighestGrid query '%s': %s", query.c_str(), errbuff);
|
||||
LogFile->write(EQEMuLog::Error, "Error in GetHighestGrid query '%s': %s", query.c_str(), errbuff.c_str());
|
||||
}
|
||||
|
||||
return(res);
|
||||
@@ -1020,7 +1020,7 @@ int ZoneDatabase::GetHighestGrid(uint32 zoneid) {
|
||||
|
||||
uint8 ZoneDatabase::GetGridType2(uint32 grid, uint16 zoneid) {
|
||||
std::string query;
|
||||
char errbuff[MYSQL_ERRMSG_SIZE];
|
||||
std::string errbuff;
|
||||
MYSQL_RES *result;
|
||||
MYSQL_ROW row;
|
||||
int type2 = 0;
|
||||
@@ -1028,14 +1028,14 @@ uint8 ZoneDatabase::GetGridType2(uint32 grid, uint16 zoneid) {
|
||||
StringFormat(query, "SELECT type2 from grid where id = %i and zoneid = %i",
|
||||
grid,zoneid);
|
||||
|
||||
if (RunQuery(query, errbuff,&result)) {
|
||||
if (RunQuery(query, &errbuff,&result)) {
|
||||
if (mysql_num_rows(result) == 1) {
|
||||
row = mysql_fetch_row(result);
|
||||
type2 = atoi( row[0] );
|
||||
}
|
||||
mysql_free_result(result);
|
||||
} else {
|
||||
LogFile->write(EQEMuLog::Error, "Error in GetGridType2 query '%s': %s", query.c_str(), errbuff);
|
||||
LogFile->write(EQEMuLog::Error, "Error in GetGridType2 query '%s': %s", query.c_str(), errbuff.c_str());
|
||||
}
|
||||
|
||||
return(type2);
|
||||
@@ -1044,7 +1044,7 @@ uint8 ZoneDatabase::GetGridType2(uint32 grid, uint16 zoneid) {
|
||||
bool ZoneDatabase::GetWaypoints(uint32 grid, uint16 zoneid, uint32 num, wplist* wp) {
|
||||
_CP(Database_GetWaypoints);
|
||||
std::string query;
|
||||
char errbuff[MYSQL_ERRMSG_SIZE];
|
||||
std::string errbuff;
|
||||
MYSQL_RES *result;
|
||||
MYSQL_ROW row;
|
||||
|
||||
@@ -1052,7 +1052,7 @@ bool ZoneDatabase::GetWaypoints(uint32 grid, uint16 zoneid, uint32 num, wplist*
|
||||
"gridid = %i and number = %i and zoneid = %i",
|
||||
grid,num,zoneid);
|
||||
|
||||
if (RunQuery(query, errbuff,&result)) {
|
||||
if (RunQuery(query, &errbuff,&result)) {
|
||||
if (mysql_num_rows(result) == 1) {
|
||||
row = mysql_fetch_row(result);
|
||||
if ( wp ) {
|
||||
@@ -1068,7 +1068,7 @@ bool ZoneDatabase::GetWaypoints(uint32 grid, uint16 zoneid, uint32 num, wplist*
|
||||
mysql_free_result(result);
|
||||
}
|
||||
else {
|
||||
LogFile->write(EQEMuLog::Error, "Error in GetWaypoints query '%s': %s", query.c_str(), errbuff);
|
||||
LogFile->write(EQEMuLog::Error, "Error in GetWaypoints query '%s': %s", query.c_str(), errbuff.c_str());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -1076,7 +1076,7 @@ bool ZoneDatabase::GetWaypoints(uint32 grid, uint16 zoneid, uint32 num, wplist*
|
||||
void ZoneDatabase::AssignGrid(Client *client, float x, float y, uint32 grid)
|
||||
{
|
||||
std::string query;
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
std::string errbuf;
|
||||
MYSQL_RES *result;
|
||||
MYSQL_ROW row;
|
||||
int matches = 0, fuzzy = 0, spawn2id = 0;
|
||||
@@ -1089,8 +1089,8 @@ void ZoneDatabase::AssignGrid(Client *client, float x, float y, uint32 grid)
|
||||
StringFormat(query, "SELECT id,x,y FROM spawn2 WHERE zone='%s' AND x=%i AND y=%i",
|
||||
zone->GetShortName(), (int)x, (int)y);
|
||||
|
||||
if(!RunQuery(query,errbuf,&result)) {
|
||||
LogFile->write(EQEMuLog::Error, "Error querying spawn2 '%s': '%s'", query.c_str(), errbuf);
|
||||
if(!RunQuery(query, &errbuf,&result)) {
|
||||
LogFile->write(EQEMuLog::Error, "Error querying spawn2 '%s': '%s'", query.c_str(), errbuf.c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1106,8 +1106,8 @@ void ZoneDatabase::AssignGrid(Client *client, float x, float y, uint32 grid)
|
||||
zone->GetShortName(), x, _GASSIGN_TOLERANCE,
|
||||
y, _GASSIGN_TOLERANCE);
|
||||
|
||||
if(!RunQuery(query,errbuf,&result)) {
|
||||
LogFile->write(EQEMuLog::Error, "Error querying fuzzy spawn2 '%s': '%s'", query.c_str(), errbuf);
|
||||
if(!RunQuery(query,&errbuf,&result)) {
|
||||
LogFile->write(EQEMuLog::Error, "Error querying fuzzy spawn2 '%s': '%s'", query.c_str(), errbuf.c_str());
|
||||
return;
|
||||
}
|
||||
fuzzy = 1;
|
||||
@@ -1130,8 +1130,8 @@ void ZoneDatabase::AssignGrid(Client *client, float x, float y, uint32 grid)
|
||||
|
||||
StringFormat(query, "UPDATE spawn2 SET pathgrid = %d WHERE id = %d", grid, spawn2id);
|
||||
|
||||
if(!RunQuery(query,errbuf,&result, &affected_rows)) {
|
||||
LogFile->write(EQEMuLog::Error, "Error updating spawn2 '%s': '%s'", query.c_str(), errbuf);
|
||||
if(!RunQuery(query, &errbuf, &result, &affected_rows)) {
|
||||
LogFile->write(EQEMuLog::Error, "Error updating spawn2 '%s': '%s'", query.c_str(), errbuf.c_str());
|
||||
return;
|
||||
}
|
||||
if(affected_rows == 1)
|
||||
@@ -1171,7 +1171,7 @@ void ZoneDatabase::AssignGrid(Client *client, float x, float y, uint32 grid)
|
||||
|
||||
void ZoneDatabase::ModifyGrid(Client *c, bool remove, uint32 id, uint8 type, uint8 type2, uint16 zoneid) {
|
||||
std::string query;
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
std::string errbuf;
|
||||
if (!remove)
|
||||
{
|
||||
|
||||
@@ -1179,8 +1179,8 @@ void ZoneDatabase::ModifyGrid(Client *c, bool remove, uint32 id, uint8 type, uin
|
||||
"VALUES(%i,%i,%i,%i)",
|
||||
id,zoneid,type,type2);
|
||||
|
||||
if(!RunQuery(query, errbuf)) {
|
||||
LogFile->write(EQEMuLog::Error, "Error creating grid entry '%s': '%s'", query.c_str(), errbuf);
|
||||
if(!RunQuery(query, &errbuf)) {
|
||||
LogFile->write(EQEMuLog::Error, "Error creating grid entry '%s': '%s'", query.c_str(), errbuf.c_str());
|
||||
}
|
||||
else {
|
||||
if(c)
|
||||
@@ -1192,8 +1192,8 @@ void ZoneDatabase::ModifyGrid(Client *c, bool remove, uint32 id, uint8 type, uin
|
||||
|
||||
StringFormat(query, "DELETE FROM grid where id=%i",id);
|
||||
|
||||
if(!RunQuery(query, errbuf)) {
|
||||
LogFile->write(EQEMuLog::Error, "Error deleting grid '%s': '%s'", query.c_str(), errbuf);
|
||||
if(!RunQuery(query, &errbuf)) {
|
||||
LogFile->write(EQEMuLog::Error, "Error deleting grid '%s': '%s'", query.c_str(), errbuf.c_str());
|
||||
} else {
|
||||
if(c)
|
||||
c->LogSQL(query.c_str());
|
||||
@@ -1201,8 +1201,8 @@ void ZoneDatabase::ModifyGrid(Client *c, bool remove, uint32 id, uint8 type, uin
|
||||
|
||||
StringFormat(query, "DELETE FROM grid_entries WHERE zoneid=%i AND gridid=%i", zoneid, id);
|
||||
|
||||
if(!RunQuery(query, errbuf)) {
|
||||
LogFile->write(EQEMuLog::Error, "Error deleting grid entries '%s': '%s'", query.c_str(), errbuf);
|
||||
if(!RunQuery(query, &errbuf)) {
|
||||
LogFile->write(EQEMuLog::Error, "Error deleting grid entries '%s': '%s'", query.c_str(), errbuf.c_str());
|
||||
} else {
|
||||
if(c)
|
||||
c->LogSQL(query.c_str());
|
||||
@@ -1217,14 +1217,14 @@ void ZoneDatabase::ModifyGrid(Client *c, bool remove, uint32 id, uint8 type, uin
|
||||
void ZoneDatabase::AddWP(Client *c, uint32 gridid, uint32 wpnum, float xpos, float ypos, float zpos, uint32 pause, uint16 zoneid, float heading)
|
||||
{
|
||||
std::string query;
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
std::string errbuf;
|
||||
|
||||
StringFormat(query, "INSERT INTO grid_entries (gridid,zoneid,`number`,x,y,z,pause,heading) "
|
||||
"values (%i, %i, %i, %f, %f, %f, %i, %f)",
|
||||
gridid, zoneid, wpnum, xpos, ypos, zpos, pause, heading);
|
||||
|
||||
if(!RunQuery(query,errbuf)) {
|
||||
LogFile->write(EQEMuLog::Error, "Error adding waypoint '%s': '%s'", query.c_str(), errbuf);
|
||||
if(!RunQuery(query, &errbuf)) {
|
||||
LogFile->write(EQEMuLog::Error, "Error adding waypoint '%s': '%s'", query.c_str(), errbuf.c_str());
|
||||
} else {
|
||||
if(c)
|
||||
c->LogSQL(query.c_str());
|
||||
@@ -1246,14 +1246,14 @@ void ZoneDatabase::AddWP(Client *c, uint32 gridid, uint32 wpnum, float xpos, flo
|
||||
void ZoneDatabase::DeleteWaypoint(Client *c, uint32 grid_num, uint32 wp_num, uint16 zoneid)
|
||||
{
|
||||
std::string query;
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
std::string errbuf;
|
||||
|
||||
StringFormat(query, "DELETE FROM grid_entries where "
|
||||
"gridid=%i and zoneid=%i and `number`=%i",
|
||||
grid_num,zoneid,wp_num);
|
||||
|
||||
if(!RunQuery(query, errbuf)) {
|
||||
LogFile->write(EQEMuLog::Error, "Error deleting waypoint '%s': '%s'", query.c_str(), errbuf);
|
||||
if(!RunQuery(query, &errbuf)) {
|
||||
LogFile->write(EQEMuLog::Error, "Error deleting waypoint '%s': '%s'", query.c_str(), errbuf.c_str());
|
||||
}
|
||||
else {
|
||||
if(c)
|
||||
@@ -1278,12 +1278,12 @@ uint32 ZoneDatabase::AddWPForSpawn(Client *c, uint32 spawn2id, float xpos, float
|
||||
bool CreatedNewGrid; // Did we create a new grid in this function?
|
||||
MYSQL_RES *result;
|
||||
MYSQL_ROW row;
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
std::string errbuf;
|
||||
|
||||
// See what grid number our spawn is assigned
|
||||
StringFormat(query, "SELECT pathgrid FROM spawn2 WHERE id=%i",spawn2id);
|
||||
|
||||
if(RunQuery(query, errbuf,&result))
|
||||
if(RunQuery(query, &errbuf, &result))
|
||||
{
|
||||
if(mysql_num_rows(result) > 0)
|
||||
{
|
||||
@@ -1296,7 +1296,7 @@ uint32 ZoneDatabase::AddWPForSpawn(Client *c, uint32 spawn2id, float xpos, float
|
||||
mysql_free_result(result);
|
||||
}
|
||||
else { // Query error
|
||||
LogFile->write(EQEMuLog::Error, "Error setting pathgrid '%s': '%s'", query.c_str(), errbuf);
|
||||
LogFile->write(EQEMuLog::Error, "Error setting pathgrid '%s': '%s'", query.c_str(), errbuf.c_str());
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1309,8 +1309,8 @@ uint32 ZoneDatabase::AddWPForSpawn(Client *c, uint32 spawn2id, float xpos, float
|
||||
StringFormat(query,"insert into grid set id='%i',zoneid= %i, type='%i', type2='%i'",
|
||||
grid_num,zoneid,type1,type2);
|
||||
|
||||
if(!RunQuery(query, errbuf)) {
|
||||
LogFile->write(EQEMuLog::Error, "Error adding grid '%s': '%s'", query.c_str(), errbuf);
|
||||
if(!RunQuery(query, &errbuf)) {
|
||||
LogFile->write(EQEMuLog::Error, "Error adding grid '%s': '%s'", query.c_str(), errbuf.c_str());
|
||||
} else {
|
||||
if(c)
|
||||
c->LogSQL(query.c_str());
|
||||
@@ -1319,8 +1319,8 @@ uint32 ZoneDatabase::AddWPForSpawn(Client *c, uint32 spawn2id, float xpos, float
|
||||
StringFormat(query, "update spawn2 set pathgrid='%i' where id='%i'",
|
||||
grid_num, spawn2id);
|
||||
|
||||
if(!RunQuery(query, errbuf)) {
|
||||
LogFile->write(EQEMuLog::Error, "Error updating spawn2 pathing '%s': '%s'", query.c_str(), errbuf);
|
||||
if(!RunQuery(query, &errbuf)) {
|
||||
LogFile->write(EQEMuLog::Error, "Error updating spawn2 pathing '%s': '%s'", query.c_str(), errbuf.c_str());
|
||||
} else {
|
||||
if(c)
|
||||
c->LogSQL(query.c_str());
|
||||
@@ -1336,7 +1336,7 @@ uint32 ZoneDatabase::AddWPForSpawn(Client *c, uint32 spawn2id, float xpos, float
|
||||
"AND gridid='%i'",
|
||||
zoneid, grid_num);
|
||||
|
||||
if(RunQuery(query,errbuf,&result))
|
||||
if(RunQuery(query,&errbuf,&result))
|
||||
{
|
||||
row = mysql_fetch_row(result);
|
||||
if(row[0] != 0)
|
||||
@@ -1347,7 +1347,7 @@ uint32 ZoneDatabase::AddWPForSpawn(Client *c, uint32 spawn2id, float xpos, float
|
||||
mysql_free_result(result);
|
||||
}
|
||||
else { // Query error
|
||||
LogFile->write(EQEMuLog::Error, "Error getting next waypoint id '%s': '%s'", query.c_str(), errbuf);
|
||||
LogFile->write(EQEMuLog::Error, "Error getting next waypoint id '%s': '%s'", query.c_str(), errbuf.c_str());
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1355,8 +1355,8 @@ uint32 ZoneDatabase::AddWPForSpawn(Client *c, uint32 spawn2id, float xpos, float
|
||||
"VALUES (%i,%i,%i,%f,%f,%f,%i,%f)",
|
||||
grid_num, zoneid, next_wp_num, xpos, ypos, zpos, pause, heading);
|
||||
|
||||
if(!RunQuery(query, errbuf)) {
|
||||
LogFile->write(EQEMuLog::Error, "Error adding grid entry '%s': '%s'", query.c_str(), errbuf);
|
||||
if(!RunQuery(query, &errbuf)) {
|
||||
LogFile->write(EQEMuLog::Error, "Error adding grid entry '%s': '%s'", query.c_str(), errbuf.c_str());
|
||||
} else {
|
||||
if(c)
|
||||
c->LogSQL(query.c_str());
|
||||
@@ -1371,13 +1371,13 @@ uint32 ZoneDatabase::AddWPForSpawn(Client *c, uint32 spawn2id, float xpos, float
|
||||
|
||||
uint32 ZoneDatabase::GetFreeGrid(uint16 zoneid) {
|
||||
std::string query;
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
std::string errbuf;
|
||||
MYSQL_RES *result;
|
||||
MYSQL_ROW row;
|
||||
|
||||
StringFormat(query, "SELECT max(id) from grid where zoneid = %i",zoneid);
|
||||
|
||||
if (RunQuery(query, errbuf,&result)) {
|
||||
if (RunQuery(query, &errbuf,&result)) {
|
||||
if (mysql_num_rows(result) == 1) {
|
||||
row = mysql_fetch_row(result);
|
||||
uint32 tmp=0;
|
||||
@@ -1390,14 +1390,14 @@ uint32 ZoneDatabase::GetFreeGrid(uint16 zoneid) {
|
||||
mysql_free_result(result);
|
||||
}
|
||||
else {
|
||||
LogFile->write(EQEMuLog::Error, "Error in GetFreeGrid query '%s': %s", query.c_str(), errbuf);
|
||||
LogFile->write(EQEMuLog::Error, "Error in GetFreeGrid query '%s': %s", query.c_str(), errbuf.c_str());
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int ZoneDatabase::GetHighestWaypoint(uint32 zoneid, uint32 gridid) {
|
||||
std::string query;
|
||||
char errbuff[MYSQL_ERRMSG_SIZE];
|
||||
std::string errbuff;
|
||||
MYSQL_RES *result;
|
||||
MYSQL_ROW row;
|
||||
int res = 0;
|
||||
@@ -1406,14 +1406,14 @@ int ZoneDatabase::GetHighestWaypoint(uint32 zoneid, uint32 gridid) {
|
||||
"grid_entries WHERE zoneid = %i AND gridid = %i",
|
||||
zoneid, gridid);
|
||||
|
||||
if (RunQuery(query,errbuff,&result)) {
|
||||
if (RunQuery(query, &errbuff, &result)) {
|
||||
if (mysql_num_rows(result) == 1) {
|
||||
row = mysql_fetch_row(result);
|
||||
res = atoi( row[0] );
|
||||
}
|
||||
mysql_free_result(result);
|
||||
} else {
|
||||
LogFile->write(EQEMuLog::Error, "Error in GetHighestWaypoint query '%s': %s", query.c_str(), errbuff);
|
||||
LogFile->write(EQEMuLog::Error, "Error in GetHighestWaypoint query '%s': %s", query.c_str(), errbuff.c_str());
|
||||
}
|
||||
|
||||
return(res);
|
||||
|
||||
+50
-59
@@ -177,7 +177,7 @@ bool Zone::Bootup(uint32 iZoneID, uint32 iInstanceID, bool iStaticZone) {
|
||||
|
||||
//this really loads the objects into entity_list
|
||||
bool Zone::LoadZoneObjects() {
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
std::string errbuf;
|
||||
std::string query;
|
||||
MYSQL_RES *result;
|
||||
MYSQL_ROW row;
|
||||
@@ -188,7 +188,7 @@ bool Zone::LoadZoneObjects() {
|
||||
"from object where zoneid=%i and (version=%u or version=-1)",
|
||||
zoneid, instanceversion);
|
||||
|
||||
if (database.RunQuery(query, errbuf, &result)) {
|
||||
if (database.RunQuery(query, &errbuf, &result)) {
|
||||
LogFile->write(EQEMuLog::Status, "Loading Objects from DB...");
|
||||
while ((row = mysql_fetch_row(result))) {
|
||||
if (atoi(row[9]) == 0)
|
||||
@@ -306,7 +306,7 @@ bool Zone::LoadZoneObjects() {
|
||||
mysql_free_result(result);
|
||||
}
|
||||
else {
|
||||
LogFile->write(EQEMuLog::Error, "Error Loading Objects from DB: %s",errbuf);
|
||||
LogFile->write(EQEMuLog::Error, "Error Loading Objects from DB: %s", errbuf.c_str());
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@@ -487,7 +487,7 @@ void Zone::LoadTempMerchantData_result(MYSQL_RES* result) {
|
||||
|
||||
//there should prolly be a temp counterpart of this...
|
||||
void Zone::LoadNewMerchantData(uint32 merchantid){
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
std::string errbuf;
|
||||
std::string query;
|
||||
MYSQL_RES *result;
|
||||
MYSQL_ROW row;
|
||||
@@ -498,7 +498,7 @@ void Zone::LoadNewMerchantData(uint32 merchantid){
|
||||
"FROM merchantlist WHERE merchantid=%d",
|
||||
merchantid);
|
||||
|
||||
if (database.RunQuery(query, errbuf, &result)) {
|
||||
if (database.RunQuery(query, &errbuf, &result)) {
|
||||
while((row = mysql_fetch_row(result))) {
|
||||
MerchantList ml;
|
||||
ml.id = merchantid;
|
||||
@@ -513,7 +513,7 @@ void Zone::LoadNewMerchantData(uint32 merchantid){
|
||||
mysql_free_result(result);
|
||||
}
|
||||
else
|
||||
LogFile->write(EQEMuLog::Error, "Error in LoadNewMerchantData query '%s' %s", query.c_str(), errbuf);
|
||||
LogFile->write(EQEMuLog::Error, "Error in LoadNewMerchantData query '%s' %s", query.c_str(), errbuf.c_str());
|
||||
}
|
||||
|
||||
void Zone::LoadMerchantData_result(MYSQL_RES* result) {
|
||||
@@ -587,7 +587,6 @@ void Zone::GetMerchantDataForZoneLoad(){
|
||||
|
||||
void Zone::LoadMercTemplates(){
|
||||
std::string errorMessage;
|
||||
char TempErrorMessageBuffer[MYSQL_ERRMSG_SIZE];
|
||||
MYSQL_RES* DatasetResult;
|
||||
MYSQL_ROW DataRow;
|
||||
std::list<MercStanceInfo> merc_stances;
|
||||
@@ -596,8 +595,8 @@ void Zone::LoadMercTemplates(){
|
||||
std::string query = "SELECT `class_id`, `proficiency_id`, `stance_id`, `isdefault` "
|
||||
"FROM `merc_stance_entries` order by `class_id`, `proficiency_id`, `stance_id`";
|
||||
|
||||
if(!database.RunQuery(query, TempErrorMessageBuffer, &DatasetResult)) {
|
||||
errorMessage = std::string(TempErrorMessageBuffer);
|
||||
if(!database.RunQuery(query, &errorMessage, &DatasetResult)) {
|
||||
// TODO: log this query individually here.
|
||||
}
|
||||
else {
|
||||
while(DataRow = mysql_fetch_row(DatasetResult)) {
|
||||
@@ -621,8 +620,8 @@ void Zone::LoadMercTemplates(){
|
||||
"MTem.merc_type_id = MTyp.merc_type_id AND MTem.merc_subtype_id = MS.merc_subtype_id "
|
||||
"ORDER BY MTyp.race_id, MS.class_id, MTyp.proficiency_id;";
|
||||
|
||||
if(!database.RunQuery(query, TempErrorMessageBuffer, &DatasetResult)) {
|
||||
errorMessage = std::string(TempErrorMessageBuffer);
|
||||
if(!database.RunQuery(query, &errorMessage, &DatasetResult)) {
|
||||
// TODO: log this query individually here.
|
||||
}
|
||||
else {
|
||||
while(DataRow = mysql_fetch_row(DatasetResult)) {
|
||||
@@ -666,15 +665,14 @@ void Zone::LoadMercTemplates(){
|
||||
|
||||
void Zone::LoadLevelEXPMods(){
|
||||
std::string errorMessage;
|
||||
char TempErrorMessageBuffer[MYSQL_ERRMSG_SIZE];
|
||||
MYSQL_RES* DatasetResult;
|
||||
MYSQL_ROW DataRow;
|
||||
level_exp_mod.clear();
|
||||
|
||||
std::string query = "SELECT level, exp_mod, aa_exp_mod FROM level_exp_mods";
|
||||
|
||||
if(!database.RunQuery(query, TempErrorMessageBuffer, &DatasetResult)) {
|
||||
errorMessage = std::string(TempErrorMessageBuffer);
|
||||
if(!database.RunQuery(query, &errorMessage, &DatasetResult)) {
|
||||
LogFile->write(EQEMuLog::Error, "Error in ZoneDatabase::LoadEXPLevelMods()");
|
||||
}
|
||||
else {
|
||||
while(DataRow = mysql_fetch_row(DatasetResult)) {
|
||||
@@ -687,22 +685,18 @@ void Zone::LoadLevelEXPMods(){
|
||||
mysql_free_result(DatasetResult);
|
||||
}
|
||||
|
||||
if(!errorMessage.empty()) {
|
||||
LogFile->write(EQEMuLog::Error, "Error in ZoneDatabase::LoadEXPLevelMods()");
|
||||
}
|
||||
}
|
||||
void Zone::LoadMercSpells(){
|
||||
|
||||
std::string errorMessage;
|
||||
char TempErrorMessageBuffer[MYSQL_ERRMSG_SIZE];
|
||||
MYSQL_RES* DatasetResult;
|
||||
MYSQL_ROW DataRow;
|
||||
merc_spells_list.clear();
|
||||
|
||||
std::string query = "SELECT msl.class_id, msl.proficiency_id, msle.spell_id, msle.spell_type, msle.stance_id, msle.minlevel, msle.maxlevel, msle.slot, msle.procChance FROM merc_spell_lists msl, merc_spell_list_entries msle WHERE msle.merc_spell_list_id = msl.merc_spell_list_id ORDER BY msl.class_id, msl.proficiency_id, msle.spell_type, msle.minlevel, msle.slot;";
|
||||
|
||||
if(!database.RunQuery(query, TempErrorMessageBuffer, &DatasetResult)) {
|
||||
errorMessage = std::string(TempErrorMessageBuffer);
|
||||
if(!database.RunQuery(query, &errorMessage, &DatasetResult)) {
|
||||
LogFile->write(EQEMuLog::Error, "Error in Zone::LoadMercSpells()");
|
||||
}
|
||||
else {
|
||||
while(DataRow = mysql_fetch_row(DatasetResult)) {
|
||||
@@ -728,23 +722,20 @@ void Zone::LoadMercSpells(){
|
||||
LogFile->write(EQEMuLog::Debug, "Mercenary Debug: Loaded %i merc spells.", merc_spells_list[1].size() + merc_spells_list[2].size() + merc_spells_list[9].size() + merc_spells_list[12].size());
|
||||
}
|
||||
|
||||
if(!errorMessage.empty()) {
|
||||
LogFile->write(EQEMuLog::Error, "Error in Zone::LoadMercSpells()");
|
||||
}
|
||||
}
|
||||
|
||||
void Zone::DBAWComplete(uint8 workpt_b1, DBAsyncWork* dbaw) {
|
||||
// LogFile->write(EQEMuLog::Debug, "Zone work complete...");
|
||||
switch (workpt_b1) {
|
||||
case DBA_b1_Zone_MerchantLists: {
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
std::string errbuf;
|
||||
MYSQL_RES* result = 0;
|
||||
DBAsyncQuery* dbaq = dbaw->PopAnswer();
|
||||
if(dbaq == nullptr) {
|
||||
LogFile->write(EQEMuLog::Error, "nullptr answer provided for async merchant list load.");
|
||||
break;
|
||||
}
|
||||
if(!dbaq->GetAnswer(errbuf, &result)) {
|
||||
if(!dbaq->GetAnswer(&errbuf, &result)) {
|
||||
LogFile->write(EQEMuLog::Error, "Zone::DBAWComplete(): Unable to get results for merchant lists");
|
||||
break;
|
||||
}
|
||||
@@ -759,14 +750,14 @@ void Zone::DBAWComplete(uint8 workpt_b1, DBAsyncWork* dbaw) {
|
||||
break;
|
||||
}
|
||||
case DBA_b1_Zone_MerchantListsTemp: {
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
std::string errbuf;
|
||||
MYSQL_RES* result = 0;
|
||||
DBAsyncQuery* dbaq = dbaw->PopAnswer();
|
||||
if(dbaq == nullptr) {
|
||||
LogFile->write(EQEMuLog::Error, "nullptr answer provided for async temp merchant list load.");
|
||||
break;
|
||||
}
|
||||
if(!dbaq->GetAnswer(errbuf, &result)) {
|
||||
if(!dbaq->GetAnswer(&errbuf, &result)) {
|
||||
LogFile->write(EQEMuLog::Error, "Zone::DBAWComplete(): Unable to get results for temp merchant lists");
|
||||
break;
|
||||
}
|
||||
@@ -1638,7 +1629,7 @@ ZonePoint* Zone::GetClosestZonePointWithoutZone(float x, float y, float z, Clien
|
||||
|
||||
bool ZoneDatabase::LoadStaticZonePoints(LinkedList<ZonePoint*>* zone_point_list, const char* zonename, uint32 version)
|
||||
{
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
std::string errbuf;
|
||||
std::string query;
|
||||
MYSQL_RES *result;
|
||||
MYSQL_ROW row;
|
||||
@@ -1651,7 +1642,7 @@ bool ZoneDatabase::LoadStaticZonePoints(LinkedList<ZonePoint*>* zone_point_list,
|
||||
"WHERE zone='%s' AND (version=%i OR version=-1) order by number",
|
||||
zonename, version);
|
||||
|
||||
if (RunQuery(query, errbuf, &result))
|
||||
if (RunQuery(query, &errbuf, &result))
|
||||
{
|
||||
while((row = mysql_fetch_row(result)))
|
||||
{
|
||||
@@ -1682,12 +1673,12 @@ bool ZoneDatabase::LoadStaticZonePoints(LinkedList<ZonePoint*>* zone_point_list,
|
||||
}
|
||||
|
||||
bool ZoneDatabase::DumpZoneState() {
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
std::string errbuf;
|
||||
std::string query;
|
||||
|
||||
StringFormat(query, "DELETE FROM zone_state_dump WHERE zonename='%s'", zone->GetShortName());
|
||||
|
||||
if (!RunQuery(query, errbuf)) {
|
||||
if (!RunQuery(query, &errbuf)) {
|
||||
std::cerr << "Error in DumpZoneState query '" << query << "' " << errbuf << std::endl;
|
||||
return false;
|
||||
}
|
||||
@@ -1779,7 +1770,7 @@ bool ZoneDatabase::DumpZoneState() {
|
||||
query.append("\')");
|
||||
|
||||
uint32 affected_rows = 0;
|
||||
if (!RunQuery(query, errbuf, 0, &affected_rows)) {
|
||||
if (!RunQuery(query, &errbuf, 0, &affected_rows)) {
|
||||
std::cerr << "Error in ZoneDump query " << errbuf << std::endl;
|
||||
return false;
|
||||
}
|
||||
@@ -1792,7 +1783,7 @@ bool ZoneDatabase::DumpZoneState() {
|
||||
}
|
||||
|
||||
int8 ZoneDatabase::LoadZoneState(const char* zonename, LinkedList<Spawn2*>& spawn2_list) {
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
std::string errbuf;
|
||||
std::string query;
|
||||
MYSQL_RES *result;
|
||||
MYSQL_ROW row;
|
||||
@@ -1815,7 +1806,7 @@ int8 ZoneDatabase::LoadZoneState(const char* zonename, LinkedList<Spawn2*>& spaw
|
||||
"npcs, npc_loot, gmspawntype, (UNIX_TIMESTAMP()-UNIX_TIMESTAMP(time)) "
|
||||
"as elapsedtime FROM zone_state_dump WHERE zonename='%s'", zonename);
|
||||
|
||||
if (RunQuery(query, errbuf, &result)) {
|
||||
if (RunQuery(query, &errbuf, &result)) {
|
||||
if (mysql_num_rows(result) == 1) {
|
||||
row = mysql_fetch_row(result);
|
||||
std::cout << "Elapsed time: " << row[8] << std::endl;
|
||||
@@ -2113,14 +2104,14 @@ bool Zone::RemoveSpawnGroup(uint32 in_id) {
|
||||
|
||||
// Added By Hogie
|
||||
bool ZoneDatabase::GetDecayTimes(npcDecayTimes_Struct* npcCorpseDecayTimes) {
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
std::string errbuf;
|
||||
int i = 0;
|
||||
MYSQL_RES *result;
|
||||
MYSQL_ROW row;
|
||||
|
||||
std::string query = "SELECT varname, value FROM variables WHERE varname like 'decaytime%%' ORDER BY varname";
|
||||
|
||||
if (RunQuery(query, errbuf, &result)) {
|
||||
if (RunQuery(query, &errbuf, &result)) {
|
||||
while((row = mysql_fetch_row(result))) {
|
||||
Seperator sep(row[0]);
|
||||
npcCorpseDecayTimes[i].minlvl = atoi(sep.arg[1]);
|
||||
@@ -2323,14 +2314,14 @@ void Zone::SetInstanceTimer(uint32 new_duration)
|
||||
|
||||
void Zone::LoadLDoNTraps()
|
||||
{
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
std::string errbuf;
|
||||
MYSQL_RES *result;
|
||||
MYSQL_ROW row;
|
||||
|
||||
std::string query = "SELECT id, type, spell_id, "
|
||||
"skill, locked FROM ldon_trap_templates";
|
||||
|
||||
if(database.RunQuery(query, errbuf, &result))
|
||||
if(database.RunQuery(query, &errbuf, &result))
|
||||
{
|
||||
while((row = mysql_fetch_row(result)))
|
||||
{
|
||||
@@ -2347,20 +2338,20 @@ void Zone::LoadLDoNTraps()
|
||||
}
|
||||
else
|
||||
{
|
||||
LogFile->write(EQEMuLog::Error, "Error in Zone::LoadLDoNTraps: %s (%s)", query.c_str(), errbuf);
|
||||
LogFile->write(EQEMuLog::Error, "Error in Zone::LoadLDoNTraps: %s (%s)", query.c_str(), errbuf.c_str());
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void Zone::LoadLDoNTrapEntries()
|
||||
{
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
std::string errbuf;
|
||||
MYSQL_RES *result;
|
||||
MYSQL_ROW row;
|
||||
|
||||
std::string query = "SELECT id, trap_id FROM ldon_trap_entries";
|
||||
|
||||
if(database.RunQuery(query,errbuf,&result)) {
|
||||
if(database.RunQuery(query, &errbuf, &result)) {
|
||||
while((row = mysql_fetch_row(result)))
|
||||
{
|
||||
uint32 id = atoi(row[0]);
|
||||
@@ -2398,7 +2389,7 @@ void Zone::LoadLDoNTrapEntries()
|
||||
}
|
||||
else
|
||||
{
|
||||
LogFile->write(EQEMuLog::Error, "Error in Zone::LoadLDoNTrapEntries: %s (%s)", query.c_str(), errbuf);
|
||||
LogFile->write(EQEMuLog::Error, "Error in Zone::LoadLDoNTrapEntries: %s (%s)", query.c_str(), errbuf.c_str());
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -2406,7 +2397,7 @@ void Zone::LoadLDoNTrapEntries()
|
||||
void Zone::LoadVeteranRewards()
|
||||
{
|
||||
VeteranRewards.clear();
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
std::string errbuf;
|
||||
MYSQL_RES *result;
|
||||
MYSQL_ROW row;
|
||||
InternalVeteranReward current_reward;
|
||||
@@ -2418,7 +2409,7 @@ void Zone::LoadVeteranRewards()
|
||||
"veteran_reward_templates WHERE reward_slot < 8 "
|
||||
"and claim_id > 0 ORDER by claim_id, reward_slot";
|
||||
|
||||
if(database.RunQuery(query,errbuf,&result))
|
||||
if(database.RunQuery(query, &errbuf,&result))
|
||||
{
|
||||
while((row = mysql_fetch_row(result)))
|
||||
{
|
||||
@@ -2452,21 +2443,21 @@ void Zone::LoadVeteranRewards()
|
||||
}
|
||||
else
|
||||
{
|
||||
LogFile->write(EQEMuLog::Error, "Error in Zone::LoadVeteranRewards: %s (%s)", query.c_str(), errbuf);
|
||||
LogFile->write(EQEMuLog::Error, "Error in Zone::LoadVeteranRewards: %s (%s)", query.c_str(), errbuf.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
void Zone::LoadAlternateCurrencies()
|
||||
{
|
||||
AlternateCurrencies.clear();
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
std::string errbuf;
|
||||
MYSQL_RES *result;
|
||||
MYSQL_ROW row;
|
||||
AltCurrencyDefinition_Struct current_currency;
|
||||
|
||||
std::string query = "SELECT id, item_id from alternate_currency";
|
||||
|
||||
if(database.RunQuery(query,errbuf,&result))
|
||||
if(database.RunQuery(query, &errbuf, &result))
|
||||
{
|
||||
while((row = mysql_fetch_row(result)))
|
||||
{
|
||||
@@ -2479,7 +2470,7 @@ void Zone::LoadAlternateCurrencies()
|
||||
}
|
||||
else
|
||||
{
|
||||
LogFile->write(EQEMuLog::Error, "Error in Zone::LoadAlternateCurrencies: %s (%s)", query.c_str(), errbuf);
|
||||
LogFile->write(EQEMuLog::Error, "Error in Zone::LoadAlternateCurrencies: %s (%s)", query.c_str(), errbuf.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2515,13 +2506,13 @@ void Zone::DeleteQGlobal(std::string name, uint32 npcID, uint32 charID, uint32 z
|
||||
|
||||
void Zone::LoadAdventureFlavor()
|
||||
{
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
std::string errbuf;
|
||||
MYSQL_RES *result;
|
||||
MYSQL_ROW row;
|
||||
|
||||
std::string query = "SELECT id, text FROM adventure_template_entry_flavor";
|
||||
|
||||
if(database.RunQuery(query,errbuf, &result))
|
||||
if(database.RunQuery(query, &errbuf, &result))
|
||||
{
|
||||
while((row = mysql_fetch_row(result)))
|
||||
{
|
||||
@@ -2533,7 +2524,7 @@ void Zone::LoadAdventureFlavor()
|
||||
}
|
||||
else
|
||||
{
|
||||
LogFile->write(EQEMuLog::Error, "Error in Zone::LoadAdventureFlavor: %s (%s)", query.c_str(), errbuf);
|
||||
LogFile->write(EQEMuLog::Error, "Error in Zone::LoadAdventureFlavor: %s (%s)", query.c_str(), errbuf.c_str());
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -2597,14 +2588,14 @@ void Zone::DoAdventureActions()
|
||||
|
||||
void Zone::LoadNPCEmotes(LinkedList<NPC_Emote_Struct*>* NPCEmoteList)
|
||||
{
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
std::string errbuf;
|
||||
MYSQL_RES *result;
|
||||
MYSQL_ROW row;
|
||||
NPCEmoteList->Clear();
|
||||
|
||||
std::string query = "SELECT emoteid, event_, type, text FROM npc_emotes";
|
||||
|
||||
if(database.RunQuery(query, errbuf, &result))
|
||||
if(database.RunQuery(query, &errbuf, &result))
|
||||
{
|
||||
while((row = mysql_fetch_row(result)))
|
||||
{
|
||||
@@ -2619,7 +2610,7 @@ void Zone::LoadNPCEmotes(LinkedList<NPC_Emote_Struct*>* NPCEmoteList)
|
||||
}
|
||||
else
|
||||
{
|
||||
LogFile->write(EQEMuLog::Error, "Error in Zone::LoadNPCEmotes: %s (%s)", query.c_str(), errbuf);
|
||||
LogFile->write(EQEMuLog::Error, "Error in Zone::LoadNPCEmotes: %s (%s)", query.c_str(), errbuf.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2632,7 +2623,7 @@ void Zone::ReloadWorld(uint32 Option){
|
||||
|
||||
void Zone::LoadTickItems()
|
||||
{
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
std::string errbuf;
|
||||
std::string query;
|
||||
MYSQL_RES *result;
|
||||
MYSQL_ROW row;
|
||||
@@ -2640,7 +2631,7 @@ void Zone::LoadTickItems()
|
||||
|
||||
query = "SELECT it_itemid, it_chance, it_level, it_qglobal, it_bagslot FROM item_tick";
|
||||
|
||||
if(database.RunQuery(query, errbuf, &result))
|
||||
if(database.RunQuery(query, &errbuf, &result))
|
||||
{
|
||||
while((row = mysql_fetch_row(result)))
|
||||
{
|
||||
@@ -2659,7 +2650,7 @@ void Zone::LoadTickItems()
|
||||
}
|
||||
else
|
||||
{
|
||||
LogFile->write(EQEMuLog::Error, "Error in Zone::LoadTickItems: %s (%s)", query.c_str(), errbuf);
|
||||
LogFile->write(EQEMuLog::Error, "Error in Zone::LoadTickItems: %s (%s)", query.c_str(), errbuf.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2680,7 +2671,7 @@ uint32 Zone::GetSpawnKillCount(uint32 in_spawnid) {
|
||||
|
||||
void Zone::UpdateHotzone()
|
||||
{
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
std::string errbuf;
|
||||
std::string query;
|
||||
MYSQL_RES *result;
|
||||
MYSQL_ROW row;
|
||||
@@ -2688,7 +2679,7 @@ void Zone::UpdateHotzone()
|
||||
|
||||
StringFormat(query, "SELECT hotzone FROM zone WHERE short_name = '%s'",GetShortName());
|
||||
|
||||
if(database.RunQuery(query, errbuf, &result) )
|
||||
if(database.RunQuery(query, &errbuf, &result) )
|
||||
{
|
||||
if( (row = mysql_fetch_row(result)) )
|
||||
{
|
||||
|
||||
+201
-221
File diff suppressed because it is too large
Load Diff
@@ -15,7 +15,7 @@ void DispatchFinishedDBAsync(DBAsyncWork* dbaw) {
|
||||
/* case DBA_b4_Main: {
|
||||
switch (workpt.i24_1()) {
|
||||
case DBA_i24_1_Main_LoadVariables: {
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
std::string errbuf;
|
||||
MYSQL_RES* result;
|
||||
DBAsyncQuery* dbaq = dbaw->PopAnswer();
|
||||
if (dbaq->GetAnswer(errbuf, result))
|
||||
@@ -54,7 +54,7 @@ void DispatchFinishedDBAsync(DBAsyncWork* dbaw) {
|
||||
#define MAX_TO_DELETE 10
|
||||
#define MAX_BACKUPS 5
|
||||
bool DBAsyncCB_CharacterBackup(DBAsyncWork* iWork) { // return true means delete data
|
||||
char errbuf[MYSQL_ERRMSG_SIZE] = "dbaq == 0";
|
||||
std::string errbuf = "dbaq == 0";
|
||||
MYSQL_RES* result = 0;
|
||||
MYSQL_ROW row;
|
||||
std::string query;
|
||||
@@ -73,7 +73,7 @@ bool DBAsyncCB_CharacterBackup(DBAsyncWork* iWork) { // return true means delete
|
||||
BackupAges[1] = 3600;
|
||||
|
||||
DBAsyncQuery* dbaq = iWork->PopAnswer();
|
||||
if (dbaq && dbaq->GetAnswer(errbuf, &result)) {
|
||||
if (dbaq && dbaq->GetAnswer(&errbuf, &result)) {
|
||||
while ((row = mysql_fetch_row(result))) {
|
||||
for (i=0; i<MAX_BACKUPS; i++) {
|
||||
if (BackupAges[i] == 0 || (uint32)atoi(row[1]) > BackupAges[i])
|
||||
@@ -102,8 +102,8 @@ bool DBAsyncCB_CharacterBackup(DBAsyncWork* iWork) { // return true means delete
|
||||
query.append(toAppend);
|
||||
|
||||
}
|
||||
if (!database.RunQuery(query, errbuf)) {
|
||||
LogFile->write(EQEMuLog::Error, "Error in DBAsyncCB_CharacterBackup query2 '%s' %s", query.c_str(), errbuf);
|
||||
if (!database.RunQuery(query, &errbuf)) {
|
||||
LogFile->write(EQEMuLog::Error, "Error in DBAsyncCB_CharacterBackup query2 '%s' %s", query.c_str(), errbuf.c_str());
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -119,7 +119,7 @@ bool DBAsyncCB_CharacterBackup(DBAsyncWork* iWork) { // return true means delete
|
||||
"select id, account_id, name, profile, level, class, x, y, z, zoneid "
|
||||
"from character_ where id=%u", iWork->WPT());
|
||||
|
||||
if (!database.RunQuery(query, errbuf)) {
|
||||
if (!database.RunQuery(query, &errbuf)) {
|
||||
std::cout << "Error in DBAsyncCB_CharacterBackup query3 '" << query << "' " << errbuf << std::endl;
|
||||
return true;
|
||||
}
|
||||
|
||||
+9
-9
@@ -730,7 +730,7 @@ void Client::SetZoneFlag(uint32 zone_id) {
|
||||
zone_flags.insert(zone_id);
|
||||
|
||||
//update the DB
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
std::string errbuf;
|
||||
std::string query;
|
||||
|
||||
// Retrieve all waypoints for this grid
|
||||
@@ -738,8 +738,8 @@ void Client::SetZoneFlag(uint32 zone_id) {
|
||||
StringFormat(query, "INSERT INTO zone_flags (charID,zoneID) VALUES(%d,%d)",
|
||||
CharacterID(),zone_id);
|
||||
|
||||
if(!database.RunQuery(query, errbuf)) {
|
||||
LogFile->write(EQEMuLog::Error, "MySQL Error while trying to set zone flag for %s: %s", GetName(), errbuf);
|
||||
if(!database.RunQuery(query, &errbuf)) {
|
||||
LogFile->write(EQEMuLog::Error, "MySQL Error while trying to set zone flag for %s: %s", GetName(), errbuf.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -750,7 +750,7 @@ void Client::ClearZoneFlag(uint32 zone_id) {
|
||||
zone_flags.erase(zone_id);
|
||||
|
||||
//update the DB
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
std::string errbuf;
|
||||
std::string query;
|
||||
|
||||
// Retrieve all waypoints for this grid
|
||||
@@ -758,13 +758,13 @@ void Client::ClearZoneFlag(uint32 zone_id) {
|
||||
StringFormat(query, "DELETE FROM zone_flags WHERE charID=%d AND zoneID=%d",
|
||||
CharacterID(),zone_id);
|
||||
|
||||
if(!database.RunQuery(query,errbuf)) {
|
||||
LogFile->write(EQEMuLog::Error, "MySQL Error while trying to clear zone flag for %s: %s", GetName(), errbuf);
|
||||
if(!database.RunQuery(query, &errbuf)) {
|
||||
LogFile->write(EQEMuLog::Error, "MySQL Error while trying to clear zone flag for %s: %s", GetName(), errbuf.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
void Client::LoadZoneFlags() {
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
std::string errbuf;
|
||||
std::string query;
|
||||
MYSQL_RES *result;
|
||||
MYSQL_ROW row;
|
||||
@@ -774,7 +774,7 @@ void Client::LoadZoneFlags() {
|
||||
StringFormat(query,"SELECT zoneID from zone_flags WHERE charID=%d",
|
||||
CharacterID());
|
||||
|
||||
if(database.RunQuery(query,errbuf,&result))
|
||||
if(database.RunQuery(query, &errbuf, &result))
|
||||
{
|
||||
while((row = mysql_fetch_row(result))) {
|
||||
zone_flags.insert(atoi(row[0]));
|
||||
@@ -783,7 +783,7 @@ void Client::LoadZoneFlags() {
|
||||
}
|
||||
else // DB query error!
|
||||
{
|
||||
LogFile->write(EQEMuLog::Error, "MySQL Error while trying to load zone flags for %s: %s", GetName(), errbuf);
|
||||
LogFile->write(EQEMuLog::Error, "MySQL Error while trying to load zone flags for %s: %s", GetName(), errbuf.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user