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

Reply
 
Thread Tools Display Modes
  #1  
Old 10-02-2007, 08:34 AM
gernblan
Discordant
 
Join Date: Aug 2006
Posts: 394
Default Disable levitate effects in certain zones?

Zones like the hole (where on live levitation effects are disabled), or other zones where players can currently levitate their way to success by climbing some wall then floating over to the top floor of some building or whatnot is a pain... I am wondering if anyone knows of a way or can think of a doable way to force levitate effects off in a zone?

We have some zones that are pretty much an open book if players can levitate to laces they shouldn't be able to get to. I'd love to be able to turn levitation off in those zones.

Just wondering if anyone can offer some guidance on how this may be accomplished.

Thank you.
__________________
--
Keelyeh
Owner, ServerOp and Developer
Jest 4 Server
Linux (Jest3 runs on Fedora, our Dev servers usually run on Ubuntu and/or Gentoo), OC-12 Connection = Hella Fast
Reply With Quote
  #2  
Old 10-06-2007, 01:27 PM
gernblan
Discordant
 
Join Date: Aug 2006
Posts: 394
Default

What about if someone smarter than I can modify the #nukebuffs command so that it can also nuke single spells? Maybe a #nukebuff command can be added that works like:

#nukebuff <spellid> and it nukes that buff from the player
whereas #nukebuffs will still nuke them all?

Can make it a quest object too and in scripts we can put an invisible mob in the game with a proximity check that will $client->nukebuff(spellnum) the spells we want nuked.

A fancy way to do it might be to give it an array as input, so we can list the spells to nuke... like:

$client->nukebuff(spell1,spell2,spell3,spell4,spell5)

And

#nukebuff spell1 spell2 spell3 spell4

Like that.

This alone would give us the ability to emulate zones like Siren's grotto properly (nuking the speed/lev buffs at the zone in) OR even set an npc in the middle of the zone with a zone-wide proximity trigger and a timer that keeps them nuked in a zone.

I'm sure there's a cleaner way to approach this... such as setting zone flags in the database to allow or disallow and having something global simply turning those spells off in those zones or whatnot.... but heck, I dunno.

I just think this is badly needed, especially since it IS available on live and should be emulated if at all possible, you know?

Oh, also, it will definitely help against certain exploits where people can levitate, climb stuff then float to parts of the zone they should be so easily able to reach without fighting their way to them.
__________________
--
Keelyeh
Owner, ServerOp and Developer
Jest 4 Server
Linux (Jest3 runs on Fedora, our Dev servers usually run on Ubuntu and/or Gentoo), OC-12 Connection = Hella Fast
Reply With Quote
  #3  
Old 10-06-2007, 01:34 PM
KLS
Administrator
 
Join Date: Sep 2006
Posts: 1,348
Default

I think we should really just make certain zones lev restricted, I noticed it a while back too but haven't gotten around to implementing it yet.
Reply With Quote
  #4  
Old 10-06-2007, 02:14 PM
gernblan
Discordant
 
Join Date: Aug 2006
Posts: 394
Default

Yes that WOULD be the best solution for certain.

Would there be any way to choose which zones are level restricted too (I mean, they wouldn't be hardcoded would they?)

I ask because for example, we're working on a custom zone (an OZ zone that we made) and it has lots of towers in it and multi level stuff. We'd definitely want lev off in that zone.
__________________
--
Keelyeh
Owner, ServerOp and Developer
Jest 4 Server
Linux (Jest3 runs on Fedora, our Dev servers usually run on Ubuntu and/or Gentoo), OC-12 Connection = Hella Fast
Reply With Quote
  #5  
Old 10-06-2007, 02:15 PM
gernblan
Discordant
 
Join Date: Aug 2006
Posts: 394
Default

l would be nice to be able to nukebuff just one buff from a player though... so that if a GM only wants to remove one effect from a player, they can, without having to nuke them all just to get rid of the one.
__________________
--
Keelyeh
Owner, ServerOp and Developer
Jest 4 Server
Linux (Jest3 runs on Fedora, our Dev servers usually run on Ubuntu and/or Gentoo), OC-12 Connection = Hella Fast
Reply With Quote
  #6  
Old 11-01-2007, 11:00 AM
Magoth78
Discordant
 
Join Date: Jun 2003
Posts: 345
Default

As requested, zone can be levitate restricted.


Code changes:

1/ In zone.h,
after
Code:
 bool	CanDoCombat() const { return(can_combat); }
add
Code:
bool    CanLevitate() const {return(can_levitate); }
after
Code:
bool	can_combat;
add
Code:
bool    can_levitate;
In the file: zonedb.h,
replace
Code:
bool GetZoneCFG(int32 zoneid, NewZone_Struct *data, bool &can_bind, bool &can_combat);
by
Code:
bool GetZoneCFG(int32 zoneid, NewZone_Struct *data, bool &can_bind, bool &can_combat, bool &can_levitate);
In the file zone.cpp and in the function Zone::LoadZoneCFG,
replace
Code:
if(!database.GetZoneCFG(database.GetZoneID(filename), &newzone_data, can_bind, can_combat)) {
by
Code:
if(!database.GetZoneCFG(database.GetZoneID(filename), &newzone_data, can_bind, can_combat, can_levitate)) {
In the file zonedb.cpp,
replace
Code:
bool ZoneDatabase::GetZoneCFG(int32 zoneid, NewZone_Struct *zone_data, bool &can_bind, bool &can_combat) {
	char errbuf[MYSQL_ERRMSG_SIZE];
	char *query = 0;
	MYSQL_RES *result;
	MYSQL_ROW row;
	int i=0;
	bool good = false;
	if (RunQuery(query, MakeAnyLenString(&query, "SELECT ztype,"
		"fog_red,fog_green,fog_blue,fog_minclip,fog_maxclip,"
		"fog_red2,fog_green2,fog_blue2,fog_minclip2,fog_maxclip2,"
		"fog_red3,fog_green3,fog_blue3,fog_minclip3,fog_maxclip3,"
		"fog_red4,fog_green4,fog_blue4,fog_minclip4,fog_maxclip4,"
		"sky,zone_exp_multiplier,safe_x,safe_y,safe_z,underworld,"
		"minclip,maxclip,time_type,canbind,cancombat"
		" from zone where zoneidnumber=%i",zoneid), errbuf, &result)) {
		safe_delete_array(query);
		while((row = mysql_fetch_row(result))) {
			int r = 0;
			memset(zone_data,0,sizeof(NewZone_Struct));
			zone_data->ztype=atoi(row[r++]);
			
			for(i=0;i<4;i++){
				zone_data->fog_red[i]=atoi(row[r++]);
				zone_data->fog_green[i]=atoi(row[r++]);
				zone_data->fog_blue[i]=atoi(row[r++]);
				zone_data->fog_minclip[i]=atof(row[r++]);
				zone_data->fog_maxclip[i]=atof(row[r++]);
			}
			
			zone_data->sky=atoi(row[r++]);
			zone_data->zone_exp_multiplier=atof(row[r++]);
			zone_data->safe_x=atof(row[r++]);
			zone_data->safe_y=atof(row[r++]);
			zone_data->safe_z=atof(row[r++]);
			zone_data->underworld=atof(row[r++]);
			zone_data->minclip=atof(row[r++]);
			zone_data->maxclip=atof(row[r++]);
			
			zone_data->time_type=atoi(row[r++]);
//not in the DB yet:
			zone_data->gravity = 0.4;
			
			can_bind = atoi(row[r++])==0?false:true;
			can_combat = atoi(row[r++])==0?false:true;
			
			good = true;
		}
		mysql_free_result(result);
	}
	else
		LogFile->write(EQEMuLog::Error, "Error in GetZoneCFG query %s: %s", query, errbuf);
	safe_delete_array(query);
	
	zone_data->zone_id = zoneid;
	
	return(good);
}
by
Code:
bool ZoneDatabase::GetZoneCFG(int32 zoneid, NewZone_Struct *zone_data, bool &can_bind, bool &can_combat, bool &can_levitate) {
	char errbuf[MYSQL_ERRMSG_SIZE];
	char *query = 0;
	MYSQL_RES *result;
	MYSQL_ROW row;
	int i=0;
	bool good = false;
	if (RunQuery(query, MakeAnyLenString(&query, "SELECT ztype,"
		"fog_red,fog_green,fog_blue,fog_minclip,fog_maxclip,"
		"fog_red2,fog_green2,fog_blue2,fog_minclip2,fog_maxclip2,"
		"fog_red3,fog_green3,fog_blue3,fog_minclip3,fog_maxclip3,"
		"fog_red4,fog_green4,fog_blue4,fog_minclip4,fog_maxclip4,"
		"sky,zone_exp_multiplier,safe_x,safe_y,safe_z,underworld,"
		"minclip,maxclip,time_type,canbind,cancombat,canlevitate"
		" from zone where zoneidnumber=%i",zoneid), errbuf, &result)) {
		safe_delete_array(query);
		while((row = mysql_fetch_row(result))) {
			int r = 0;
			memset(zone_data,0,sizeof(NewZone_Struct));
			zone_data->ztype=atoi(row[r++]);
			
			for(i=0;i<4;i++){
				zone_data->fog_red[i]=atoi(row[r++]);
				zone_data->fog_green[i]=atoi(row[r++]);
				zone_data->fog_blue[i]=atoi(row[r++]);
				zone_data->fog_minclip[i]=atof(row[r++]);
				zone_data->fog_maxclip[i]=atof(row[r++]);
			}
			
			zone_data->sky=atoi(row[r++]);
			zone_data->zone_exp_multiplier=atof(row[r++]);
			zone_data->safe_x=atof(row[r++]);
			zone_data->safe_y=atof(row[r++]);
			zone_data->safe_z=atof(row[r++]);
			zone_data->underworld=atof(row[r++]);
			zone_data->minclip=atof(row[r++]);
			zone_data->maxclip=atof(row[r++]);
			
			zone_data->time_type=atoi(row[r++]);
//not in the DB yet:
			zone_data->gravity = 0.4;
			
			can_bind = atoi(row[r++])==0?false:true;
			can_combat = atoi(row[r++])==0?false:true;
            can_levitate = atoi(row[r++])==0?false:true;
			
			good = true;
		}
		mysql_free_result(result);
	}
	else
		LogFile->write(EQEMuLog::Error, "Error in GetZoneCFG query %s: %s", query, errbuf);
	safe_delete_array(query);
	
	zone_data->zone_id = zoneid;
	
	return(good);
}
In the file spells.cpp, in the function Mob::SpellFinished(int16 spell_id, Mob *spell_target, int16 slot, int16 mana_used),
find
Code:
if(!IsValidSpell(spell_id))
		return false;
and, add after
Code:
if( IsEffectInSpell(spell_id, SE_Levitate) && !zone->CanLevitate() )
    {
        if( IsClient() )
        {
            if(!CastToClient()->GetGM())
            {
                Message(13, "You can't levitate in this zone.");
			    return false;
            }
        }
    }
In the file client_packet.cpp, function Complete_Connect(),
replace
Code:
case SE_Levitate:
	{
                          SendAppearancePacket(AT_Levitate, 2);
                          break;
        }
by
Code:
case SE_Levitate:
	{
                        if( !zone->CanLevitate() )
                        {
                            if(!GetGM())
                            {
                                SendAppearancePacket(AT_Levitate, 0);
                                BuffFadeByEffect(SE_Levitate);
                                Message(13, "You can't levitate in this zone.");
                            }
                        }else{
                            SendAppearancePacket(AT_Levitate, 2);
                        }
			break;
	}
SQL changes:
Code:
alter table `zone` add column `canlevitate` tinyint (4) DEFAULT '1' NOT NULL  after `cancombat`
I've tested it with the zone: The Hole.
It seems to work correctly.

Mag.
__________________
User's projects:
-- Original EMPIRE I/II and Factions! servers
-- Web GM Portal
-- EQoffline/bots

Last edited by Magoth78; 11-01-2007 at 07:04 PM..
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 06:16 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 - 2024, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3