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

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #8  
Old 09-21-2008, 04:04 PM
Rocker8956
Hill Giant
 
Join Date: Sep 2007
Posts: 117
Default

I think I figured out where I messed up the group and raid instance flags. Database::setGroupInstFlagNum and Database::setRaidInstFlagNum will need replaced with the ones below.

Can you post, or send me, the quest script you are using to set these? I suck at quest writing so using yours would help me test them.

I like the idea of holding the zone open for a set amount of time. Also, I agree there needs to be ways to check if someone is already flagged, remove the flag, and inherit the flag of the group/raid leader. I also want to add a way to shutdown the zone after a certain amount of time (like ldons).

The only issue I could see with making the type 2 flag raids or groups is some server admins may want to limit how many people can be in the instance. Though I could make a type 3 that flags both.

It might take me a while to figure out why goto is not working in instances. But I will see.

Code:
void Database::setGroupInstFlagNum(int32 charID, int32 orgZoneID)
{
	char errbuf[MYSQL_ERRMSG_SIZE];
    char *query = 0;
    MYSQL_RES *result;
    MYSQL_ROW row;
	int32 groupid = 0;
	int instFlag = getCurInstFlagNum();
	int numCharsInGroup = 0; // Used to count number of characters in group
	
	// Find out what group the character is in
	if (RunQuery(query, MakeAnyLenString(&query, "SELECT groupid from group_id where charid=%i", charID), errbuf, &result)) {
		if (mysql_num_rows(result) == 1) {
				row = mysql_fetch_row(result);
				groupid=atoi(row[0]);
		}
		else
			printf("Unable to get group id, char not found!\n");
		mysql_free_result(result);
	}
	else
			printf("Unable to get group id: %s\n",errbuf);
	safe_delete_array(query);
	// Find out how many other characters are in the group
	if (RunQuery(query, ("SELECT COUNT(charid) FROM group_id WHERE groupid=%i", groupid), errbuf, &result)) {
		safe_delete_array(query);
		row = mysql_fetch_row(result);
		numCharsInGroup = atoi(row[0]);
		mysql_free_result(result);
	}
	// Select the character IDs of the characters in the group
	if (RunQuery(query, MakeAnyLenString(&query, "SELECT charid from group_id where groupid='%i'", groupid), errbuf, &result))
	{
		row = mysql_fetch_row(result);
		
		int i = 0;
		// Set each group members instflag
		while ((i <= numCharsInGroup)) 
		{
			charID = atoi(row[i]);
			setCharInstFlag(charID, orgZoneID, instFlag);
			i++;
		}
			safe_delete_array(query);
			mysql_free_result(result);
	}
	// Increment the curInstFlagNum
	incrCurInstFlagNum(instFlag);
}
Code:
void Database::setRaidInstFlagNum(int32 charID, int32 orgZoneID)
{
	char errbuf[MYSQL_ERRMSG_SIZE];
    char *query = 0;
    MYSQL_RES *result;
    MYSQL_ROW row;
	int32 raidid = 0;
	int instFlag = getCurInstFlagNum();
	int numCharsInRaid = 0; // Used to count number of characters in raid

	// Find out what raid the character is in
	if (RunQuery(query, MakeAnyLenString(&query, "SELECT raidid from raid_members where charid=%i", charID), errbuf, &result)) {
		safe_delete_array(query);
		if (mysql_num_rows(result) == 1) {
			row = mysql_fetch_row(result);
			raidid=atoi(row[0]);
			mysql_free_result(result);
		}
		else
			printf("Unable to get raidid, char not found!\n");
		mysql_free_result(result);
	}
	else
			printf("Unable to get raid id: %s\n",errbuf);
	safe_delete_array(query);
	// Find out how many other characters are in the raid
	if (RunQuery(query, ("SELECT COUNT(charid) FROM raid_members WHERE raidid=%i", raidid), errbuf, &result)) {
		row = mysql_fetch_row(result);
		numCharsInRaid = atoi(row[0]);
		mysql_free_result(result);
		safe_delete_array(query);
	}
	// Select the character IDs of the characters in the raid
	if (RunQuery(query, MakeAnyLenString(&query, "SELECT charid from raid_members where raidid='%i'", raidid), errbuf, &result))
	{
		int i = 0;
		row = mysql_fetch_row(result);
		// Set each group members instflag
		while ((i <= numCharsInRaid)) 
		{
			charID = atoi(row[i]);
			setCharInstFlag(charID, orgZoneID, instFlag);
			i++;
		}
			safe_delete_array(query);
			mysql_free_result(result);
	}
	// Increment the curInstFlagNum
	incrCurInstFlagNum(instFlag);
}
 


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 04:47 PM.


 

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