Fix for quest enabletask/disabletask api queries

This commit is contained in:
Uleat 2016-07-14 12:47:55 -04:00
parent 7457d832f8
commit 871fcd1fc8

View File

@ -723,8 +723,14 @@ void ClientTaskState::EnableTask(int characterID, int taskCount, int *tasks) {
queryStream << ( i ? ", " : "" ) << StringFormat("(%i, %i)", characterID, tasksEnabled[i]);
std::string query = queryStream.str();
Log.Out(Logs::General, Logs::Tasks, "[UPDATE] Executing query %s", query.c_str());
database.QueryDatabase(query);
if (tasksEnabled.size()) {
Log.Out(Logs::General, Logs::Tasks, "[UPDATE] Executing query %s", query.c_str());
database.QueryDatabase(query);
}
else {
Log.Out(Logs::General, Logs::Tasks, "[UPDATE] EnableTask called for characterID: %u .. but, no tasks exist!", characterID);
}
}
void ClientTaskState::DisableTask(int charID, int taskCount, int *taskList) {
@ -765,12 +771,19 @@ void ClientTaskState::DisableTask(int charID, int taskCount, int *taskList) {
std::stringstream queryStream(StringFormat("DELETE FROM character_enabledtasks WHERE charid = %i AND (", charID));
for(unsigned int i=0; i<tasksDisabled.size(); i++)
queryStream << i ? StringFormat("taskid = %i ", tasksDisabled[i]): StringFormat("OR taskid = %i ", tasksDisabled[i]);
queryStream << (i ? StringFormat("taskid = %i ", tasksDisabled[i]): StringFormat("OR taskid = %i ", tasksDisabled[i]));
queryStream << ")";
std::string query = queryStream.str();
Log.Out(Logs::General, Logs::Tasks, "[UPDATE] Executing query %s", query.c_str());
database.QueryDatabase(query);
if (tasksDisabled.size()) {
Log.Out(Logs::General, Logs::Tasks, "[UPDATE] Executing query %s", query.c_str());
database.QueryDatabase(query);
}
else {
Log.Out(Logs::General, Logs::Tasks, "[UPDATE] DisableTask called for characterID: %u .. but, no tasks exist!", charID);
}
}
bool ClientTaskState::IsTaskEnabled(int TaskID) {