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

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #2  
Old 03-28-2008, 05:24 PM
TheLieka
Developer
 
Join Date: Oct 2004
Location: THE ATL (wut wut)
Posts: 325
Default

.\zone\client_packet.cpp

After:

Code:
void Client::Handle_Connect_OP_UpdateAA(const EQApplicationPacket *app) {
	SendAATable();
}
Add:

Code:
bool Client::WarpDetection(bool CTimer, float distance)
{	
	float last_distance;
	if (threshold_timer.GetRemainingTime() < 1 && ((RuleR(Zone, MQWarpThresholdTimer)) != -1)) {   //Null:  If the timer is done, reset threshold, then reset timer //Lieka:  Integrated into Rules System.
		warp_threshold = (RuleR(Zone, MQWarpLagThreshold));  //Lieka:  Integrated warp_threshold value into Rules System.  Original Value was 140.
		threshold_timer.Start((RuleR(Zone, MQWarpThresholdTimer)), false); //Lieka:  Integrated timer duration value into the Rules System.  Original Value was 90000 (90 seconds).
	}
	if ((CTimer))
		return false;
	else
	{
		//Null Edit:  made warp detector fire only when the sum of all the warps in a period of time are greater than a threshold
		//this makes the warp detector more lax on small warps, but still drops the hammer on the big ones.
		if (distance>140.0f) {
			last_distance = (distance-140.0f);
			warp_threshold -= last_distance;
			last_warp_distance = last_distance;
		}
	   return (warp_threshold < 0); //Null:  If the threshold is met, hit them with the hammer
	}
}

void Client::CheatDetected(CheatTypes CheatType)
{ //[Paddy] ToDo: Break warp down for special zones. Some zones have special teleportation pads or bad .map files which can trigger the detector without a legit zone request.
	switch (CheatType)
	{
		case MQWarp://Some zones have serious issues, turning off warp flags for these zones.
			if(!((zone->GetZoneID()==2)/*qeynos2*/ || (zone->GetZoneID()==9)/*freportw*/|| (zone->GetZoneID()==10)/*freporte*/ || (zone->GetZoneID()==34)/*nro*/ || (zone->GetZoneID()==24)/*erudin*/ || (zone->GetZoneID()==75)/*Paineel*/ || (zone->GetZoneID()==62)/*Felwitheb*/) && (RuleB(Zone, EnableMQWarpDetector) && ((status < RuleI(Zone, MQWarpExemptStatus) || (RuleI(Zone, MQWarpExemptStatus)) == -1)))) //Lieka:  Exempt these zones from the MQWarp detector (This may be depricated now, but these zones were problems in the past)
			{
				Message(13, "Your account has been reported for hacking.");
				database.SetMQDetectionFlag(this->account_name,this->name, "/MQWarp", zone->GetShortName());
				SetMana(0);  //Lieka:  Remove all mana from player.
				SetHP(5);  //Lieka:  Set player's hitpoints to 5.
				BuffFadeAll();  //Lieka:  Wipe all of player's buffs.
				SpellFinished((RuleI(Zone, MQWarpDetectionSpellID)), this);  //Lieka:  Integrated into Rules System.  Spell to cast on players Default:  757 (Resurrection Effects).
				worldserver.SendEmoteMessage(0,0,0,13,"<MQWarp Detector>.  %s was just caught warping in %s.  Come get your free kill!",this->GetName(),zone->GetLongName());
				warp_threshold = 1;   //Null:  bringing the detector back up to one to avoid chain detections.
			}
			break;
		case MQZone:
			if(!( (zone->GetZoneID()==31)/*sola*/ || (zone->GetZoneID()==32)/*solb*/ || (zone->GetZoneID()==25)/*nek*/ || (zone->GetZoneID()==27)/*lava*/ ) && (RuleB(Zone, EnableMQZoneDetector))&& ((status < RuleI(Zone, MQZoneExemptStatus) || (RuleI(Zone, MQZoneExemptStatus)) == -1)))) //Lieka:  Exempt these zones from the MQZone detector (This may be depricated now, but were problems in the past)
			{
				Message(13, "Your account has been reported for hacking.");
				database.SetMQDetectionFlag(this->account_name,this->name, "/MQZone", zone->GetShortName());
				SetMana(0);  //Lieka:  Remove all mana from player.
				SetHP(5);  //Lieka:  Set player's hitpoints to 5.
				BuffFadeAll();  //Lieka:  Wipe all of player's buffs.
				AddBuff(this,(RuleI(Zone, MQZoneDetectionSpell)),30);   //Lieka:  Integrated into Rules System.  Add (de)buff on player for 30 ticks.  Default:  757 (Resurrection Effects).
				worldserver.SendEmoteMessage(0,0,0,13,"<MQZone Detector>.  %s as just caught using Macroquest to /Zone to %s.  Come get your free kill!",this->GetName(),zone->GetLongName()); //Lieka:  Broadcast to the server that the MQZone detector has caught a cheater.
			}
			break;
		case MQGate:
			if (RuleB(Zone, EnableMQGateDetector)&& ((status < RuleI(Zone, MQGateExemptStatus) || (RuleI(Zone, MQGateExemptStatus)) == -1))) {
				Message(13, "Your account has been reported for hacking.");
				database.SetMQDetectionFlag(this->account_name,this->name, "/MQGate", zone->GetShortName());
				this->SetZone(this->GetZoneID()); //Lieka:  Prevent the player from zoning, place him back in the zone where he tried to originally /gate.
				SetMana(0);  //Lieka:  Remove all mana from player.
				SetHP(5);  //Lieka:  Set player's hitpoints to 5.
				BuffFadeAll();  //Lieka:  Wipe all of player's buffs.
				AddBuff(this,(RuleI(Zone, MQGateDetectionSpell)),30);   //Lieka:  Integrated into Rules System.  Add (de)buff on player for 30 ticks.  Default:  757 (Resurrection Effects).
				worldserver.SendEmoteMessage(0,0,0,13,"<MQGate Detector>.  %s was just caught using Macroquest to /Gate to %s.  Come get your free kill!",this->GetName(),zone->GetLongName()); //Lieka:  Broadcast to the server that the MQGate Detector has caught a cheater.
			}
			break;
		case MQGhost: //Lieka:  Not currently implemented, but the framework is in place - just needs detection scenarios identified
			if (RuleB(Zone, EnableMQGhostDetector) && ((status < RuleI(Zone, MQGhostExemptStatus) || (RuleI(Zone, MQGhostExemptStatus)) == -1))) {
				Message(13, "Your account has been reported for hacking.");
				database.SetMQDetectionFlag(this->account_name,this->name, "/MQGhost", zone->GetShortName());
				SetMana(0);  //Lieka:  Remove all mana from player.
				SetHP(5);  //Lieka:  Set player's hitpoints to 5.
				BuffFadeAll();  //Lieka:  Wipe all of player's buffs.
				SpellFinished((RuleI(Zone, MQGhostDetectionSpellID)), this);  //Lieka:  Integrated into Rules System.  Spell to cast on players Default:  757 (Resurrection Effects).
				worldserver.SendEmoteMessage(0,0,0,13,"<MQGhost Detector>.  %s was just caught using Macroquest to /Ghost to %s.  Come get your free kill!",this->GetName(),zone->GetLongName()); //Lieka:  Broadcast to the server that the MQGate Detector has caught a cheater.			
			}
			break;
	}
}
Change (Insert Red Lines):

Code:
	dist = sqrt(dist);
	/*[Paddy] Cutting out the Z-Axis check. Not necessary and prevents long falls from triggering */
	//tmp = z_pos - ppu->z_pos;
	//dist += tmp*tmp;
	
	/* Begin Cheat Detection*/
	if ((this->cheat_timer.GetRemainingTime())>1 && (this->cheat_timer.Enabled())) //Lieka:  Check to see if the cheat (exemption) timer is active - this is for debugging
	{
		//Spell timer is currently active
		//worldserver.SendEmoteMessage(0,0,0,13,"Timer is Active.  %d True: %s",this->cheat_timer.GetRemainingTime(), (this->cheat_timer.GetRemainingTime()>1)? "true" : "false"); //Leika Edit:  Enable this to get debug messages.
	}
	else //Timer has elapsed or hasn't started, let's do a Warp Check
	{
		if ((WarpDetection(false, dist)) && (((admin <= RuleI(Zone, MQWarpExemptStatus)) || (RuleI(Zone, MQWarpExemptStatus) == -1))) //Exempt from warp detection if admin level is >  Rule:Zone:MQWarpExemptStatus
		{
			printf("Warping Detected by %S Acct: %s Distance: %f.", GetName(), AccountName(), GetLWDistance());
			CheatDetected(MQWarp); //Lieka:  Execute MQWarp function on offending player
		}
	}
	//Lieka End Edit

Change (Insert Red Lines):

Code:
void Client::Handle_OP_GMSummon(const EQApplicationPacket *app)
{
	if (app->size != sizeof(GMSummon_Struct)) {
		cout << "Wrong size on OP_GMSummon. Got: " << app->size << ", Expected: " << sizeof(GMSummon_Struct) << endl;
		return;
	}
	this->cheat_timer.Start(5000, false); //Lieka:  Exempt in-zone GM Summons from triggering MQWarp detector
	OPGMSummon(app);
	return;
}
After:

Code:
	x_pos		= m_pp.x;
	y_pos		= m_pp.y;
	z_pos		= m_pp.z;
	heading		= m_pp.heading;
	race		= m_pp.race;
	base_race	= m_pp.race;
	gender		= m_pp.gender;
	base_gender	= m_pp.gender;
	deity		= m_pp.deity;//FYI: DEITY_AGNOSTIC = 396; still valid?
	haircolor	= m_pp.haircolor;
	beardcolor	= m_pp.beardcolor;
	eyecolor1	= m_pp.eyecolor1;
	eyecolor2	= m_pp.eyecolor2;
	hairstyle	= m_pp.hairstyle;
	luclinface	= m_pp.face;
// vesuvias - appearence fix
	beard		= m_pp.beard;
Add:

Code:
this->cheat_timer.Start(2500,false); //Lieka:  Prevent tripping the MQWarp detector when logging in after LD - basically gives a grace period for large position changes.
After:

Code:
				case SE_InvisVsUndead: 
					{
					invisible_undead = true;
					break;
					} 
				case SE_InvisVsAnimals: 
					{
					invisible_animals = true;
					break;
					}					
			}
		}
	}
Add:

Code:
this->cheat_timer.Start(2500,false); //Lieka:  Prevent tripping the MQWarp detector when arriving in a new zone.
__________________
Daxum



Former ServerOp - Vallon Zek / Tallon Zek Emu Server - Legit / Guild PvP - (2007 - 2011 RIP)
Reply With Quote
 


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 07:09 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