Go Back   EQEmulator Home > EQEmulator Forums > Archives > Archive::Development > Archive::Development

Archive::Development Archive area for Development's posts that were moved here after an inactivity period of 90 days.

Reply
 
Thread Tools Display Modes
  #1  
Old 06-22-2003, 06:23 PM
froglok20
Sarnak
 
Join Date: Jan 2003
Posts: 30
Default Non Combat Zones Souce Code

Yes thats right iv finished off the non combat zones code, however it doesnt support /duel and /pvp yet. that im still working on when i get the time.

here it is, enjoy =)

zone.cpp
Code:
bool Database::LoadAllowCombat(int8 zoneid)
{
	bool allowed = TRUE;

	char errbuf[MYSQL_ERRMSG_SIZE];
	char *query = 0;
    MYSQL_RES *result;
    MYSQL_ROW row;
	
	if (database.RunQuery(query, MakeAnyLenString(&query, "SELECT can_attack from zone where zoneidnumber=%i", zoneid), errbuf, &result)) 
	{
		delete[] query;

		int32 numrows = mysql_num_rows(result);

		if(numrows != 1)
		{
			cerr << "Error in AllowAttackingInZone() More than 1 Zone Returned for zoneid" << endl;
			mysql_free_result(result);
			return true; // DEFAULT to allow attacking the the case there are more than 1 zone with the same ID
		}

		while ((row = mysql_fetch_row(result))) {		
			allowed = atoi(row[0]);
		}
	}
	return allowed;
}
zone.cpp
in function Bootup()
approx line:318
Code:
	zone->zone_combat = database.LoadAllowCombat(iZoneID);
	if(zone->zone_combat = 0)
		LogFile->write(EQEMuLog::Status, "Setting Zone to Non-Combat / Agression");
	else
		LogFile->write(EQEMuLog::Status, "Setting Zone to Normal Combat / Agression");
spells.cpp in function SpellOnTarget() line: 2986 approx
Code:
	if(!zone->zone_combat)
	{
		if (this->IsClient() && !this->CastToClient()->GetGM())
		{
			if(IsDetrimental(spell_id))
			{
				Message(10,  "This Zone does not support combat.");
				return;

			}
		} else {
			Message(10,  "This Zone does not support combat, but we will let you!");
		}
	}
client_process.cpp in function HandlePacket()
under case PET_ATTACK: at approx line 10672

Code:
							if(!zone->zone_combat)
							{
								if (this->IsClient() && !this->CastToClient()->GetGM())
								{
									Message(10,"%s tells you, 'Sorry Master, but i am unable to attack here.'", mypet->GetName());
									break;
								} else {
									Message(10,"%s tells you, 'Attacking %s, Master. But Im not ment to!'", mypet->GetName(), this->target->GetName());
								}
							}
attack.cpp in function Attack()
at line approx 844
Code:
	if(!zone->zone_combat)
	{
		if (this->IsClient() && !this->CastToClient()->GetGM()) 
		{
			Message(10,  "This Zone does not support combat.");
			return false;
		} else {
			Message(10,  "This Zone does not support combat, but we will let you!");
		}
	}
database.h
inside class Database : public DBcore struct
approx line: 239
Code:
bool	LoadAllowCombat(int8 zoneid);
This code will allow GM's to attack and cast detramental spells in the non combat zones, after all they are a GM...

Here is the SQL to update your database

Code:
ALTER TABLE zone ADD can_attack BOOL default "1";
UPDATE zone SET can_attack='0' where zoneidnumber='152';
UPDATE zone SET can_attack='0' where zoneidnumber='202';
UPDATE zone SET can_attack='0' where zoneidnumber='203';
this will update the nexus, pok and potranquil and set them to non combat zones

Enjoy

Froglok
__________________
Froglokkkkkkkkkkkkkkk
Reply With Quote
  #2  
Old 06-23-2003, 02:49 AM
Edgar1898
Senior Member
Former EQEmu Developer
Current EQ2Emu Lead Developer
 
Join Date: Dec 2002
Posts: 1,065
Default

You could have just added those to IsAttackAllowed in mob.cpp :P Everything except spells calls that function when you try to attack.
__________________
Lethal Encounter
Reply With Quote
  #3  
Old 06-23-2003, 05:56 PM
froglok20
Sarnak
 
Join Date: Jan 2003
Posts: 30
Default

oh.. hehe never thought of that
__________________
Froglokkkkkkkkkkkkkkk
Reply With Quote
Reply


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 03:23 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