Go Back   EQEmulator Home > EQEmulator Forums > Development > Development::Server Code Submissions

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #4  
Old 09-16-2008, 10:25 AM
Rocker8956
Hill Giant
 
Join Date: Sep 2007
Posts: 117
Default

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);
 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

   

All times are GMT -4. The time now is 10:02 AM.


 

Everquest is a registered trademark of Daybreak Game Company LLC.
EQEmulator is not associated or affiliated in any way with Daybreak Game Company LLC.
Except where otherwise noted, this site is licensed under a Creative Commons License.
       
Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3