View Single Post
  #17  
Old 03-29-2008, 09:39 AM
TheLieka
Developer
 
Join Date: Oct 2004
Location: THE ATL (wut wut)
Posts: 325
Default

Ok, sorry for the false start. Yeah there were a few typos, etc with the previous code, I went through it again, and got a diff from it and 0.7.0-1102

Code:
Index: common/database.cpp

===================================================================

--- common/database.cpp	(revision 110)

+++ common/database.cpp	(working copy)

@@ -1458,6 +1458,24 @@

 	return true;
 }
 
+bool Database::SetMQDetectionFlag(const char* accountname, const char* charactername, const char* hacked, const char* zone) { //Lieka:  Utilize the "hacker" table, but also give zone information.

+	char errbuf[MYSQL_ERRMSG_SIZE];

+	char *query = 0;

+	int32	affected_rows = 0;

+	if (!RunQuery(query, MakeAnyLenString(&query, "INSERT INTO hackers(account,name,hacked,zone) values('%s','%s','%s','%s')", accountname, charactername, hacked, zone), errbuf, 0,&affected_rows)) {

+		cerr << "Error in SetMQDetectionFlag query '" << query << "' " << errbuf << endl;

+		return false;

+	}

+	safe_delete_array(query);

+	

+	if (affected_rows == 0)

+	{

+		return false;

+	}

+	

+	return true;

+}
+
 int8 Database::GetRaceSkill(int8 skillid, int8 in_race)
 {
 	int16 race_cap = 0;
Index: common/database.h

===================================================================

--- common/database.h	(revision 110)

+++ common/database.h	(working copy)

@@ -118,6 +118,7 @@

 	bool	MoveCharacterToZone(int32 iCharID, const char* iZonename);
 	bool	UpdateName(const char* oldname, const char* newname);
 	bool	SetHackerFlag(const char* accountname, const char* charactername, const char* hacked);
+	bool	SetMQDetectionFlag(const char* accountname, const char* charactername, const char* hacked, const char* zone);
 	bool	AddToNameFilter(const char* name);
 	bool	ReserveName(int32 account_id, char* name);
 	bool	CreateCharacter(uint32 account_id, char* name, int16 gender, int16 race, int16 class_, int8 str, int8 sta, int8 cha, int8 dex, int8 int_, int8 agi, int8 wis, int8 face);
Index: common/ruletypes.h

===================================================================

--- common/ruletypes.h	(revision 110)

+++ common/ruletypes.h	(working copy)

@@ -65,6 +65,21 @@

 RULE_INT ( Zone,  ClientLinkdeadMS, 180000) //the time a client remains link dead on the server after a sudden disconnection
 RULE_INT ( Zone,  GraveyardTimeMS, 1200000) //ms time until a player corpse is moved to a zone's graveyard, if one is specified for the zone
 RULE_BOOL ( Zone, EnableShadowrest, 0 ) // enables or disables the shadowrest zone feature for player corpses. Default is turned off.
+RULE_INT ( Zone, MQWarpExemptStatus, 50 ) //Lieka:  Required status level to exempt the MQWarpDetector.  Set to -1 to disable this feature.

+RULE_INT ( Zone, MQZoneExemptStatus, 50 ) //Lieka:  Required status level to exempt the MQWarpDetector.  Set to -1 to disable this feature.

+RULE_INT ( Zone, MQGateExemptStatus, 50 ) //Lieka:  Required status level to exempt the MQWarpDetector.  Set to -1 to disable this feature.

+RULE_INT ( Zone, MQGhostExemptStatus, 50 ) //Lieka:  Required status level to exempt the MQWarpDetector.  Set to -1 to disable this feature.

+RULE_BOOL ( Zone, EnableMQWarpDetector, false ) //Lieka:  Enable the MQWarp Detector.  Set to False to disable this feature.

+RULE_BOOL ( Zone, EnableMQZoneDetector, false ) //Lieka:  Enable the MQZone Detector.  Set to False to disable this feature.

+RULE_BOOL ( Zone, EnableMQGateDetector, false ) //Lieka:  Enable the MQGate Detector.  Set to False to disable this feature.

+RULE_BOOL ( Zone, EnableMQGhostDetector, false ) //Lieka:  Enable the MQGhost Detector.  Set to False to disable this feature.

+RULE_REAL ( Zone, MQWarpDetectorDistance, 30 ) //Lieka:  Distance a player must travel between client to server location updates before a warp is registered.  30 allows for beyond GM speed without lag.

+RULE_REAL ( Zone, MQWarpLagThreshold, 140 ) //Lieka:  Distance beyond the Zone:MQWarpDetectorDistance that a player must travel within the MQWarpThresholdTimer amount of time before tripping the MQWarp detector.  Set to 0 to disable this feature.

+RULE_REAL ( Zone, MQWarpThresholdTimer, 90000 ) //Lieka:  Amount of time before the warp_threshold resets to the Zone:MQWarpLagThreshold value.  Default: 90000 (900 seconds/15 minutes).  Set to -1 to disable this feature.

+RULE_INT ( Zone, MQWarpDetectionSpellID, 757 ) //Lieka:  Which spell ID will be cast on players that incur the hammer of the MQ Detector.  This spell will be actually cast, don't pick a resistible spell.  Default: 757 (Resurrection Effects)

+RULE_INT ( Zone, MQGateDetectionSpellID, 757 ) //Lieka:  Which spell ID debuff will be cast on players that incur the hammer of the MQGateDetector.  This spell will be added as a debuff while zoning.  Default: 757 (Resurrection Effects)

+RULE_INT ( Zone, MQZoneDetectionSpellID, 757 ) //Lieka:  Which spell ID debuff will be cast on players that incur the hammer of the MQGateDetector.  This spell will be added as a debuff while zoning.  Default: 757 (Resurrection Effects)

+RULE_INT ( Zone, MQGhostDetectionSpellID, 757 ) //Lieka:  Which spell ID will be cast on players that incur the hammer of the MQGhostDetector.  This spell will be actually cast, don't pick a resistable spell.  Default: 757 (Resurrection Effects)
 RULE_CATEGORY_END()
 
 RULE_CATEGORY( Map )


Index: zone/client.cpp

===================================================================

--- zone/client.cpp	(revision 110)

+++ zone/client.cpp	(working copy)

@@ -2304,7 +2304,7 @@

 	float dx=cheat_x-x_pos;
 	float dy=cheat_y-y_pos;
 	float result=sqrtf((dx*dx)+(dy*dy));
-	return result>70;
+	return result>(RuleR(Zone, MQWarpDetectorDistance)); //Lieka:  Integrated into Rules System; default value is 30, this allows for beyond GM speed without lag.
 }
 
 void Client::SetHideMe(bool flag)
Index: zone/client.h

===================================================================

--- zone/client.h	(revision 110)

+++ zone/client.h	(working copy)

@@ -152,6 +152,13 @@

 	EvacToSafeCoords
 } ZoneMode;
 
+typedef enum {

+	MQWarp,

+	MQZone,

+	MQGate,

+	MQGhost

+} CheatTypes;
+
 class ClientFactory {
 public:
 	Client *MakeClient(EQStream* ieqs);
@@ -175,6 +182,8 @@

 	void	Trader_StartTrader();
 	int8	WithCustomer();
 	bool	CheckCheat();
+	void	CheatDetected(CheatTypes Cheat);

+	bool	WarpDetection(bool CTimer, float Distance);
 	virtual bool IsClient() const { return true; }
 	virtual void DBAWComplete(int8 workpt_b1, DBAsyncWork* dbaw);
 	bool	FinishConnState2(DBAsyncWork* dbaw);

Index: zone/client_process.cpp

===================================================================

--- zone/client_process.cpp	(revision 110)

+++ zone/client_process.cpp	(working copy)

@@ -921,6 +921,7 @@

 		return;
 	const Resurrect_Struct* ra = (const Resurrect_Struct*) app->pBuffer;
 	if (ra->action == 1) {
+		this->cheat_timer.Start(3500, false); //[Paddy] Allow getting rezzed without triggering 

 		cout << "Player " << this->name << " got a " << (int16)spells[ra->spellid].base[0] << "% Rezz" << endl;
 		this->BuffFadeAll();
 		SetMana(0);
@@ -1481,6 +1482,7 @@

 		}
 		if(st)
 		{
+			this->cheat_timer.Start(3500, false);//[Paddy] Allow PC's to be summoned without triggering Warp Detection

 			Message(0, "Local: Summoning %s to %i, %i, %i", gms->charname, gms->x, gms->y, gms->z);
 			if (st->IsClient() && (st->CastToClient()->GetAnon() != 1 || this->Admin() >= st->CastToClient()->Admin()))
 				st->CastToClient()->MovePC((float)gms->x, (float)gms->y, (float)gms->z, this->GetHeading(), 2, true);
@@ -1512,6 +1514,7 @@

 			else {
 				//all options have been exhausted
 				//summon our target...
+				this->cheat_timer.Start(3500, false); //Lieka:  Don't want to trip the MQWarp detector here either.

 				if(GetTarget() && GetTarget()->IsCorpse()){
 					GetTarget()->CastToCorpse()->Summon(this, false);
 				}


Index: zone/command.cpp

===================================================================

--- zone/command.cpp	(revision 110)

+++ zone/command.cpp	(working copy)

@@ -1364,6 +1364,7 @@

 			c->Message(0, "You may not summon a player.");
 			return;
 		}
+		t->CastToClient()->cheat_timer.Start(3500,false); //Lieka:  Prevent Zone-to-Zone GM Summons from triggering the MQZone and MQWarp detectors.

 		c->Message(0, "Summoning player %s to %1.1f, %1.1f, %1.1f", t->GetName(), c->GetX(), c->GetY(), c->GetZ());
 		t->CastToClient()->MovePC(zone->GetZoneID(), c->GetX(), c->GetY(), c->GetZ(), c->GetHeading(), 2, GMSummon);
 	}
@@ -1409,9 +1410,11 @@

 		}
 	}
 		
-	if (sep->IsNumber(2) || sep->IsNumber(3) || sep->IsNumber(4))
+	if (sep->IsNumber(2) || sep->IsNumber(3) || sep->IsNumber(4)) {
 		//zone to specific coords
+		c->CastToClient()->cheat_timer.Start(3500,false);  //Lieka:  Not sure why we put this here... should be an admin if you are zoning to special coordinates by this point.

 		c->MovePC(zoneid, atof(sep->arg[2]), atof(sep->arg[3]), atof(sep->arg[4]), 0.0f, 0);
+	}
 	else
 		//zone to safe coords
 		c->MovePC(zoneid, 0.0f, 0.0f, 0.0f, 0.0f, 0, ZoneToSafeCoords);
__________________
Daxum



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