Please note this code is not tested, I have no experience writing quests so I am hoping someone with quest writing experience will test it for me.
This code adds a quest function that will set a character's instance flag. Sending that character to an instance the next time they zone into the zone of your choice.
It requires two bits of information. The character's ID and the zoneID of the zone you want instanced.
If there are any questions please let me know.
Anyhow here is the code.
Zone\perlparser.cpp
Near Line 1759 insert
Code:
XS(XS__setindinstflag);
XS(XS__setindinstflag)
{
dXSARGS;
if (items != 2)
Perl_croak(aTHX_ "Usage: setindinstflag(charID, orginalZoneID)");
int32 charID = (int)SvIV(ST(0));
int32 orgZoneID = (int)SvIV(ST(1));
quest_manager.setindinstflag(charID, orgZoneID);
XSRETURN_EMPTY;
}
Zone\perlparser.cpp
Around Line 1899 insert
Code:
newXS(strcpy(buf, "setindinstflag"), XS__setindinstflag, file);
Zone\questmgr.h
Around line 150 insert
Code:
void setindinstflag(int32 charID, int32 orgZoneID);
Zone\questmgr.cpp
At the end insert
Code:
void QuestManager::setindinstflag(int32 charID, int32 orgZoneID)
{
database.setOneCharInstFlag(charID, orgZoneID);
}
Common\database.cpp
At the end insert
Code:
void Database::setOneCharInstFlag(int32 charID, int32 orgZoneID)
{
char errbuf[MYSQL_ERRMSG_SIZE];
char *query = 0;
MYSQL_RES *result;
MYSQL_ROW row;
int instFlag;
if (RunQuery(query, MakeAnyLenString(&query, "SELECT value FROM variables WHERE varname = 'curInstFlagNum'"), errbuf, &result))
{
safe_delete_array(query);
if (mysql_num_rows(result) == 1) {
row = mysql_fetch_row(result);
instFlag = atoi(row[0]);
mysql_free_result(result);
}
mysql_free_result(result);
}
else {
cerr << "Error in GetCurInstFlagNum query '" << query << "' " << errbuf << endl;
safe_delete_array(query);
}
if (RunQuery(query, MakeAnyLenString(&query, "UPDATE character_ SET instZflagNum=%i, instZOrgID=%i WHERE id=%i", instFlag, orgZoneID, charID), errbuf, &result))
{
safe_delete_array(query);
mysql_free_result(result);
}
else {
cerr << "Error in setCharInstFlagNum query '" << query << "' " << errbuf << endl;
safe_delete_array(query);
}
instFlag++;
if (RunQuery(query, MakeAnyLenString(&query, "UPDATE variables SET value=%i WHERE varname='curInstFlagNum'", instFlag), errbuf, &result))
{
safe_delete_array(query);
mysql_free_result(result);
}
else {
cerr << "Error in incrCurInstFlagNum query '" << query << "' " << errbuf << endl;
safe_delete_array(query);
}
}
Common\database.h
At the end insert
Code:
void setOneCharInstFlag(int32 charID, int32 orgZoneID);