Oh oops I forgot to add another change I made. Change the following in database.h:
Code:
protected:
void AddLootDropToNPC(int32 lootdrop_id, ItemList* itemlist);
bool RunQuery(const char* query, int32 querylen, char* errbuf = 0, MYSQL_RES** result = 0, int32* affected_rows = 0, int32* errnum = 0, bool retry = true);
move
Code:
bool RunQuery(const char* query, int32 querylen, char* errbuf = 0, MYSQL_RES** result = 0, int32* affected_rows = 0, int32* errnum = 0, bool retry = true);
from protected to public. If you dont want to do that then just go into Client.cpp and delete the following:
Code:
else if ((strcasecmp(sep.arg[0], "#listpetition") == 0) && CheckAccess(cmdlevel, 100)) {
char errbuf[MYSQL_ERRMSG_SIZE];
char *query = 0;
MYSQL_RES *result;
MYSQL_ROW row;
int blahloopcount=0;
if (database.RunQuery(query, MakeAnyLenString(&query, "SELECT dib, charname, accountname from petitions order by dib"), errbuf, &result))
{
delete[] query;
cout << this->GetName() << " looking at petitionlist" << endl;
while ((row = mysql_fetch_row(result))) {
if (blahloopcount==0) {
blahloopcount=1;
Message(13," ID : Character Name , Account Name");
}
else
Message(15, " %s: %s , %s ",row[0],row[1],row[2]);
}
mysql_free_result(result);
}
}
else if ((strcasecmp(sep.arg[0], "#viewpetition") == 0) && CheckAccess(cmdlevel, 100)) {
if (sep.arg[1][0] == 0) {
Message(0, "Usage: #viewpetition (petition number) Type #listpetition for a list");
} else {
char errbuf[MYSQL_ERRMSG_SIZE];
char *query = 0;
int queryfound = 0;
MYSQL_RES *result;
MYSQL_ROW row;
Petition* newpet;
Message(13," ID : Character Name , Petition Text");
if (database.RunQuery(query, MakeAnyLenString(&query, "SELECT dib, charname, petitiontext from petitions order by dib"), errbuf, &result))
{
delete[] query;
while ((row = mysql_fetch_row(result))) {
if (strcasecmp(row[0],sep.argplus[1])== 0) {
queryfound=1;
Message(15, " %s: %s , %s ",row[0],row[1],row[2]);
}
}
cout << this->GetName() << " looking at petition Number " << sep.argplus[1] << endl;
if (queryfound==0)
Message(13,"There was an error in your request: ID not found! Please check the Id and try again.");
mysql_free_result(result);
}
}
}
else if ((strcasecmp(sep.arg[0], "#petitioninfo") == 0) && CheckAccess(cmdlevel, 100)) {
if (sep.arg[1][0] == 0) {
Message(0, "Usage: #petitioninfo (petition number) Type #listpetition for a list");
} else {
char errbuf[MYSQL_ERRMSG_SIZE];
char *query = 0;
int queryfound = 0;
MYSQL_RES *result;
MYSQL_ROW row;
Petition* newpet;
if (database.RunQuery(query, MakeAnyLenString(&query, "SELECT dib, charname, accountname, zone, charclass, charrace, charlevel from petitions order by dib"), errbuf, &result))
{
delete[] query;
while ((row = mysql_fetch_row(result))) {
if (strcasecmp(row[0],sep.argplus[1])== 0) {
queryfound=1;
Message(13," ID : %s Character Name: %s Account Name: %s Zone: %s Character Class: %s Character Race: %s Character Level: %s",row[0],row[1],row[2],row[3],row[4],row[5],row[6]);
}
}
cout << this->GetName() << " looking at petition information Number " << sep.argplus[1] << endl;
if (queryfound==0)
Message(13,"There was an error in your request: ID not found! Please check the Id and try again.");
mysql_free_result(result);
}
}
}
else if ((strcasecmp(sep.arg[0], "#delpetition") == 0) && CheckAccess(cmdlevel, 100)) {
if (sep.arg[1][0] == 0 || strcasecmp(sep.arg[1],"*")==0)
Message(0, "Usage: #delpetition (petition number) Type #listpetition for a list");
else {
char errbuf[MYSQL_ERRMSG_SIZE];
char *query = 0;
int queryfound = 0;
MYSQL_RES *result;
MYSQL_ROW row;
Petition* newpet;
//char* blah32;
//strcpy(blah32,sep.argplus[1]);
//char* querystring;
//querystring=strcat("DELETE from petitions where dib=",blah32);
Message(13,"Attempting to delete petition number: %i",atoi(sep.argplus[1]));
if (database.RunQuery(query, MakeAnyLenString(&query, "DELETE from petitions where dib=%i",atoi(sep.argplus[1])), errbuf, &result)) {
delete[] query;
cout << this->GetName() << " deleting petition Number " << sep.argplus[1] << endl;
}
//mysql_free_result(result); // If uncommented crashes zone. :/
}
}
Just do one or the other though. I recommend keeping the petition commands so you can handle petitions :P
|