/Anticheat/AC1_GmHelper_ModBy_Chaosua.patch
https://bitbucket.org/TCRC/patches/ · Patch · 700 lines · 676 code · 24 blank · 0 comment · 0 complexity · 26854f7ad79eef63f4a785cb094e4da8 MD5 · raw file
- # HG changeset patch
- # User chaosua
- # Date 1285943655 -10800
- # Branch trunk
- # Node ID 81349e70ea9699268ee27fca939c0508abb8c5a1
- # Parent 2b5e6acda90f67094245335f8fc76e28d70d0c32
- AC1 GM helper mod by ChaosUA
- diff -r 2b5e6acda90f -r 81349e70ea96 sql/AC1/characters_cheaters.sql
- --- /dev/null Thu Jan 01 00:00:00 1970 +0000
- +++ b/sql/AC1/characters_cheaters.sql Fri Oct 01 17:34:15 2010 +0300
- @@ -0,0 +1,19 @@
- +CREATE TABLE `cheaters` (
- + `entry` bigint(20) NOT NULL auto_increment,
- + `player` varchar(30) NOT NULL,
- + `acctid` int(11) NOT NULL,
- + `reason` varchar(255) NOT NULL default 'unknown',
- + `speed` float NOT NULL default '0',
- + `Val1` float NOT NULL default '0',
- + `Val2` int(10) unsigned NOT NULL default '0',
- + `count` int(11) NOT NULL default '0',
- + `Map` smallint(5) NOT NULL default '-1',
- + `Pos` varchar(255) NOT NULL default '0',
- + `Level` mediumint(9) NOT NULL default '0',
- + `first_date` datetime NOT NULL,
- + `last_date` datetime NOT NULL,
- + `Op` varchar(255) NOT NULL default 'unknown',
- + PRIMARY KEY (`entry`),
- + KEY `idx_Count` (`count`),
- + KEY `idx_Player` (`player`)
- +) ENGINE=InnoDB AUTO_INCREMENT=30 DEFAULT CHARSET=utf8;
- \ No newline at end of file
- diff -r 2b5e6acda90f -r 81349e70ea96 sql/AC1/world_trinity_string.sql
- --- /dev/null Thu Jan 01 00:00:00 1970 +0000
- +++ b/sql/AC1/world_trinity_string.sql Fri Oct 01 17:34:15 2010 +0300
- @@ -0,0 +1,1 @@
- +REPLACE INTO `trinity_string` VALUES ('12000', 'Cheater DETECTED> %s ID:( %u ) Reason> %s', null, null, null, null, null, null, null, 'ЧИТЕР обнаружен:> %s ID:( %u) Причина> %s');
- \ No newline at end of file
- diff -r 2b5e6acda90f -r 81349e70ea96 src/server/game/Chat/Commands/Level3.cpp
- --- a/src/server/game/Chat/Commands/Level3.cpp Fri Oct 01 15:13:23 2010 +0300
- +++ b/src/server/game/Chat/Commands/Level3.cpp Fri Oct 01 17:34:15 2010 +0300
- @@ -6301,9 +6301,15 @@
-
- WorldPacket data(12);
- if (strncmp(args, "on", 3) == 0)
- + {
- data.SetOpcode(SMSG_MOVE_SET_CAN_FLY);
- + ((Player*)(target))->SetCanFly(true);
- + }
- else if (strncmp(args, "off", 4) == 0)
- + {
- data.SetOpcode(SMSG_MOVE_UNSET_CAN_FLY);
- + ((Player*)(target))->SetCanFly(false);
- + }
- else
- {
- SendSysMessage(LANG_USE_BOL);
- diff -r 2b5e6acda90f -r 81349e70ea96 src/server/game/Entities/Player/Player.cpp
- --- a/src/server/game/Entities/Player/Player.cpp Fri Oct 01 15:13:23 2010 +0300
- +++ b/src/server/game/Entities/Player/Player.cpp Fri Oct 01 17:34:15 2010 +0300
- @@ -523,6 +523,17 @@
- rest_type=REST_TYPE_NO;
- ////////////////////Rest System/////////////////////
-
- + //movement anticheat
- + m_anti_lastmovetime = 0; //last movement time
- + m_anti_NextLenCheck = 0;
- + m_anti_MovedLen = 0.0f;
- + m_anti_BeginFallZ = INVALID_HEIGHT;
- + m_anti_lastalarmtime = 0; //last time when alarm generated
- + m_anti_alarmcount = 0; //alarm counter
- + m_anti_TeleTime = 0;
- + m_CanFly=false;
- + /////////////////////////////////
- +
- m_mailsLoaded = false;
- m_mailsUpdated = false;
- unReadMails = 0;
- @@ -23100,7 +23111,9 @@
- void Player::HandleFall(MovementInfo const& movementInfo)
- {
- // calculate total z distance of the fall
- - float z_diff = m_lastFallZ - movementInfo.pos.GetPositionZ();
- + float z_diff = (m_lastFallZ >= m_anti_BeginFallZ ? m_lastFallZ : m_anti_BeginFallZ) - movementInfo.pos.GetPositionZ();
- +
- + m_anti_BeginFallZ=INVALID_HEIGHT;
- //sLog.outDebug("zDiff = %f", z_diff);
-
- //Players with low fall distance, Feather Fall or physical immunity (charges used) are ignored
- diff -r 2b5e6acda90f -r 81349e70ea96 src/server/game/Entities/Player/Player.h
- --- a/src/server/game/Entities/Player/Player.h Fri Oct 01 15:13:23 2010 +0300
- +++ b/src/server/game/Entities/Player/Player.h Fri Oct 01 17:34:15 2010 +0300
- @@ -991,6 +991,21 @@
- explicit Player (WorldSession *session);
- ~Player ();
-
- + //movement anticheat
- + uint32 m_anti_lastmovetime; //last movement time
- + float m_anti_MovedLen; //Length of traveled way
- + uint32 m_anti_NextLenCheck;
- + float m_anti_BeginFallZ; //alternative falling begin
- + uint32 m_anti_lastalarmtime; //last time when alarm generated
- + uint32 m_anti_alarmcount; //alarm counter
- + uint32 m_anti_TeleTime;
- + bool m_CanFly;
- + uint32 Anti__GetLastTeleTime() const { return m_anti_TeleTime; }
- + void Anti__SetLastTeleTime(uint32 TeleTime) { m_anti_TeleTime=TeleTime; }
- + //bool CanFly() const { return HasUnitMovementFlag(MOVEMENTFLAG_CAN_FLY); }
- + bool CanFly() const { return m_CanFly; }
- + void SetCanFly(bool CanFly) { m_CanFly=CanFly; }
- +
- void CleanupsBeforeDelete(bool finalCleanup = true);
-
- static UpdateMask updateVisualBits;
- diff -r 2b5e6acda90f -r 81349e70ea96 src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp
- --- a/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp Fri Oct 01 15:13:23 2010 +0300
- +++ b/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp Fri Oct 01 17:34:15 2010 +0300
- @@ -266,6 +266,7 @@
- float y = 0;
- float z = 0;
- i_destinationHolder.GetLocationNow(player.GetBaseMap(), x, y, z);
- + player.Anti__SetLastTeleTime(time(NULL));
- player.SetPosition(x, y, z, player.GetOrientation());
-
- }
- diff -r 2b5e6acda90f -r 81349e70ea96 src/server/game/Server/Protocol/Handlers/MovementHandler.cpp
- --- a/src/server/game/Server/Protocol/Handlers/MovementHandler.cpp Fri Oct 01 15:13:23 2010 +0300
- +++ b/src/server/game/Server/Protocol/Handlers/MovementHandler.cpp Fri Oct 01 17:34:15 2010 +0300
- @@ -26,13 +26,194 @@
- #include "Corpse.h"
- #include "Player.h"
- #include "Vehicle.h"
- -#include "SpellAuras.h"
- #include "MapManager.h"
- #include "Transport.h"
- #include "Battleground.h"
- #include "WaypointMovementGenerator.h"
- #include "InstanceSaveMgr.h"
- #include "ObjectMgr.h"
- +#include "World.h"
- +
- +//#define __ANTI_DEBUG__
- +
- +#ifdef __ANTI_DEBUG__
- +#include "Chat.h"
- +std::string FlagsToStr(const uint32 Flags)
- +{
- + std::string Ret="";
- + if(Flags==0)
- + {
- + Ret="None";
- + return Ret;
- + }
- +
- + if(Flags & MOVEMENTFLAG_FORWARD)
- + { Ret+="FW "; }
- + if(Flags & MOVEMENTFLAG_BACKWARD)
- + { Ret+="BW "; }
- + if(Flags & MOVEMENTFLAG_STRAFE_LEFT)
- + { Ret+="STL "; }
- + if(Flags & MOVEMENTFLAG_STRAFE_RIGHT)
- + { Ret+="STR "; }
- + if(Flags & MOVEMENTFLAG_LEFT)
- + { Ret+="LF "; }
- + if(Flags & MOVEMENTFLAG_RIGHT)
- + { Ret+="RI "; }
- + if(Flags & MOVEMENTFLAG_PITCH_UP)
- + { Ret+="PTUP "; }
- + if(Flags & MOVEMENTFLAG_PITCH_DOWN)
- + { Ret+="PTDW "; }
- + if(Flags & MOVEMENTFLAG_WALK_MODE)
- + { Ret+="WALK "; }
- + if(Flags & MOVEMENTFLAG_ONTRANSPORT)
- + { Ret+="TRANS "; }
- + if(Flags & MOVEMENTFLAG_LEVITATING)
- + { Ret+="LEVI "; }
- + if(Flags & MOVEMENTFLAG_FLY_UNK1)
- + { Ret+="FLYUNK1 "; }
- + if(Flags & MOVEMENTFLAG_JUMPING)
- + { Ret+="JUMP "; }
- + if(Flags & MOVEMENTFLAG_UNK4)
- + { Ret+="UNK4 "; }
- + if(Flags & MOVEMENTFLAG_FALLING)
- + { Ret+="FALL "; }
- + if(Flags & MOVEMENTFLAG_SWIMMING)
- + { Ret+="SWIM "; }
- + if(Flags & MOVEMENTFLAG_FLY_UP)
- + { Ret+="FLYUP "; }
- + if(Flags & MOVEMENTFLAG_CAN_FLY)
- + { Ret+="CFLY "; }
- + if(Flags & MOVEMENTFLAG_FLYING)
- + { Ret+="FLY "; }
- + if(Flags & MOVEMENTFLAG_FLYING2)
- + { Ret+="FLY2 "; }
- + if(Flags & MOVEMENTFLAG_WATERWALKING)
- + { Ret+="WTWALK "; }
- + if(Flags & MOVEMENTFLAG_SAFE_FALL)
- + { Ret+="SAFE "; }
- + if(Flags & MOVEMENTFLAG_UNK3)
- + { Ret+="UNK3 "; }
- + if(Flags & MOVEMENTFLAG_SPLINE)
- + { Ret+="SPLINE "; }
- + if(Flags & MOVEMENTFLAG_SPLINE2)
- + { Ret+="SPLINE2 "; }
- +
- + return Ret;
- +}
- +#endif // __ANTI_DEBUG__
- +
- +bool WorldSession::Anti__ReportCheat(const char* Reason,float Speed,const char* Op,float Val1,uint32 Val2,MovementInfo* MvInfo)
- +{
- + if(!Reason)
- + {
- + sLog.outError("Anti__ReportCheat: Missing Reason parameter!");
- + return false;
- + }
- + const char* Player=GetPlayer()->GetName();
- + uint32 Acc=GetPlayer()->GetSession()->GetAccountId();
- + uint32 Map=GetPlayer()->GetMapId();
- + if(!Player)
- + {
- + sLog.outError("Anti__ReportCheat: Player with no name?!?");
- + return false;
- + }
- +
- + QueryResult Res=CharacterDatabase.PQuery("SELECT speed,Val1 FROM cheaters WHERE player='%s' AND reason LIKE '%s' AND Map='%u' AND last_date >= NOW()-300",Player,Reason,Map);
- + if(Res)
- + {
- + Field* Fields = Res->Fetch();
- +
- + std::stringstream Query;
- + Query << "UPDATE cheaters SET count=count+1,last_date=NOW()";
- + Query.precision(5);
- + if(Speed>0.0f && Speed > Fields[0].GetFloat())
- + {
- + Query << ",speed='";
- + Query << std::fixed << Speed;
- + Query << "'";
- + }
- +
- + if(Val1>0.0f && Val1 > Fields[1].GetFloat())
- + {
- + Query << ",Val1='";
- + Query << std::fixed << Val1;
- + Query << "'";
- + }
- +
- + Query << " WHERE player='" << Player << "' AND reason='" << Reason << "' AND Map='" << Map << "' AND last_date >= NOW()-300 ORDER BY entry DESC LIMIT 1";
- +
- + CharacterDatabase.Execute(Query.str().c_str());
- + sWorld.SendGMText(12000,GetPlayer()->GetName(),GetPlayer()->GetGUIDLow(),Reason);
- + }
- + else
- + {
- + if(!Op)
- + { Op=""; }
- + std::stringstream Pos;
- + Pos << "OldPos: " << GetPlayer()->GetPositionX() << " " << GetPlayer()->GetPositionY() << " "
- + << GetPlayer()->GetPositionZ();
- + if(MvInfo)
- + {
- + Pos << "\nNew: " << MvInfo->pos.GetPositionX() << " " << MvInfo->pos.GetPositionY() << " " << MvInfo->pos.GetPositionZ() << "\n"
- + << "Flags: " << MvInfo->flags << "\n"
- + << "t_guid: " << MvInfo->t_guid << " falltime: " << MvInfo->fallTime;
- + }
- + CharacterDatabase.PExecute("INSERT INTO cheaters (player,acctid,reason,speed,count,first_date,last_date,`Op`,Val1,Val2,Map,Pos,Level) "
- + "VALUES ('%s','%u','%s','%f','1',NOW(),NOW(),'%s','%f','%u','%u','%s','%u')",
- + Player,Acc,Reason,Speed,Op,Val1,Val2,Map,
- + Pos.str().c_str(),GetPlayer()->getLevel());
- + sWorld.SendGMText(12000,GetPlayer()->GetName(),GetPlayer()->GetGUIDLow(),Reason);
- + }
- +
- + if(sWorld.GetMvAnticheatKill() && GetPlayer()->isAlive())
- + {
- + GetPlayer()->DealDamage(GetPlayer(), GetPlayer()->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
- + }
- + if(sWorld.GetMvAnticheatKick())
- + {
- + GetPlayer()->GetSession()->KickPlayer();
- + }
- + if(sWorld.GetMvAnticheatBan() & 1)
- + {
- + sWorld.BanAccount(BAN_CHARACTER,Player,sWorld.GetMvAnticheatBanTime(),"Cheat","Anticheat");
- + }
- + if(sWorld.GetMvAnticheatBan() & 2)
- + {
- + QueryResult result = LoginDatabase.PQuery("SELECT last_ip FROM account WHERE id=%u", Acc);
- + if(result)
- + {
- +
- + Field *fields = result->Fetch();
- + std::string LastIP = fields[0].GetCString();
- + if(!LastIP.empty())
- + {
- + sWorld.BanAccount(BAN_IP,LastIP,sWorld.GetMvAnticheatBanTime(),"Cheat","Anticheat");
- + }
- + }
- + }
- + return true;
- +}
- +
- +bool WorldSession::Anti__CheatOccurred(uint32 CurTime,const char* Reason,float Speed,const char* Op,
- + float Val1,uint32 Val2,MovementInfo* MvInfo)
- +{
- + if(!Reason)
- + {
- + sLog.outError("Anti__CheatOccurred: Missing Reason parameter!");
- + return false;
- + }
- +
- + GetPlayer()->m_anti_lastalarmtime = CurTime;
- + GetPlayer()->m_anti_alarmcount = GetPlayer()->m_anti_alarmcount + 1;
- +
- + if (GetPlayer()->m_anti_alarmcount > sWorld.GetMvAnticheatAlarmCount())
- + {
- + Anti__ReportCheat(Reason,Speed,Op,Val1,Val2,MvInfo);
- + return true;
- + }
- + return false;
- +}
- +
-
- void WorldSession::HandleMoveWorldportAckOpcode(WorldPacket & /*recv_data*/)
- {
- @@ -90,6 +271,8 @@
- GetPlayer()->ResetMap();
- GetPlayer()->SetMap(newMap);
-
- + GetPlayer()->m_anti_TeleTime=time(NULL);
- +
- GetPlayer()->SendInitialPacketsBeforeAddToMap();
- if (!GetPlayer()->GetMap()->Add(GetPlayer()))
- {
- @@ -186,6 +369,8 @@
-
- // resummon pet
- GetPlayer()->ResummonPetTemporaryUnSummonedIfAny();
- + GetPlayer()->Anti__SetLastTeleTime(::time(NULL));
- + GetPlayer()->m_anti_BeginFallZ=INVALID_HEIGHT;
-
- //lets process all delayed operations on successful teleport
- GetPlayer()->ProcessDelayedOperations();
- @@ -238,6 +423,11 @@
-
- // resummon pet
- GetPlayer()->ResummonPetTemporaryUnSummonedIfAny();
- + if(plMover)
- + {
- + plMover->Anti__SetLastTeleTime(::time(NULL));
- + plMover->m_anti_BeginFallZ=INVALID_HEIGHT;
- + }
-
- //lets process all delayed operations on successful teleport
- GetPlayer()->ProcessDelayedOperations();
- @@ -303,6 +493,11 @@
- // if we boarded a transport, add us to it
- if (plMover && !plMover->GetTransport())
- {
- + float trans_rad = movementInfo.t_pos.GetPositionX()*movementInfo.t_pos.GetPositionX() + movementInfo.t_pos.GetPositionY()*movementInfo.t_pos.GetPositionY() + movementInfo.t_pos.GetPositionZ()*movementInfo.t_pos.GetPositionZ();
- + if (trans_rad > 3600.0f) // transport radius = 60 yards //cheater with on_transport_flag
- + {
- + return;
- + }
- // elevators also cause the client to send MOVEMENTFLAG_ONTRANSPORT - just unmount if the guid can be found in the transport list
- for (MapManager::TransportSet::const_iterator iter = sMapMgr.m_Transports.begin(); iter != sMapMgr.m_Transports.end(); ++iter)
- {
- @@ -339,9 +534,145 @@
- {
- // now client not include swimming flag in case jumping under water
- plMover->SetInWater(!plMover->IsInWater() || plMover->GetBaseMap()->IsUnderWater(movementInfo.pos.GetPositionX(), movementInfo.pos.GetPositionY(), movementInfo.pos.GetPositionZ()));
- + if(plMover->GetBaseMap()->IsUnderWater(movementInfo.pos.GetPositionX(), movementInfo.pos.GetPositionY(), movementInfo.pos.GetPositionZ()-7.0f))
- + {
- + plMover->m_anti_BeginFallZ=INVALID_HEIGHT;
- + }
- }
-
- - /*----------------------*/
- + // ---- anti-cheat features -->>>
- + uint32 Anti_TeleTimeDiff=plMover ? time(NULL) - plMover->Anti__GetLastTeleTime() : time(NULL);
- + static const uint32 Anti_TeleTimeIgnoreDiff=sWorld.GetMvAnticheatIgnoreAfterTeleport();
- + if (plMover && (plMover->m_transport == 0) && sWorld.GetMvAnticheatEnable() &&
- + GetPlayer()->GetSession()->GetSecurity() <= sWorld.GetMvAnticheatGmLevel() &&
- + GetPlayer()->GetMotionMaster()->GetCurrentMovementGeneratorType()!=FLIGHT_MOTION_TYPE &&
- + Anti_TeleTimeDiff>Anti_TeleTimeIgnoreDiff)
- + {
- + const uint32 CurTime=getMSTime();
- + if(getMSTimeDiff(GetPlayer()->m_anti_lastalarmtime,CurTime) > sWorld.GetMvAnticheatAlarmPeriod())
- + {
- + GetPlayer()->m_anti_alarmcount = 0;
- + }
- + /* I really don't care about movement-type yet (todo)
- + UnitMoveType move_type;
- +
- + if (movementInfo.flags & MOVEMENTFLAG_FLYING) move_type = MOVE_FLY;
- + else if (movementInfo.flags & MOVEMENTFLAG_SWIMMING) move_type = MOVE_SWIM;
- + else if (movementInfo.flags & MOVEMENTFLAG_WALK_MODE) move_type = MOVE_WALK;
- + else move_type = MOVE_RUN;*/
- +
- + float delta_x = GetPlayer()->GetPositionX() - movementInfo.pos.GetPositionX();
- + float delta_y = GetPlayer()->GetPositionY() - movementInfo.pos.GetPositionY();
- + // float delta_z = GetPlayer()->GetPositionZ() - movementInfo.pos.GetPositionZ();
- + float delta = sqrt(delta_x * delta_x + delta_y * delta_y); // Len of movement-vector via Pythagoras (a^2+b^2=Len^2)
- + // float tg_z = 0.0f; //tangens
- + float delta_t = getMSTimeDiff(GetPlayer()->m_anti_lastmovetime,CurTime);
- +
- + GetPlayer()->m_anti_lastmovetime = CurTime;
- + GetPlayer()->m_anti_MovedLen += delta;
- +
- + if(delta_t > 15000.0f)
- + { delta_t = 15000.0f; }
- +
- + // Tangens of walking angel
- + /*if (!(movementInfo.flags & (MOVEMENTFLAG_FLYING | MOVEMENTFLAG_SWIMMING)))
- + {
- + //Mount hack detection currently disabled
- + tg_z = ((delta !=0.0f) && (delta_z > 0.0f)) ? (atan((delta_z*delta_z) / delta) * 180.0f / M_PI) : 0.0f;
- + }*/
- +
- + //antiOFF fall-damage, MOVEMENTFLAG_FALLING seted by client if player try movement when falling and unset in this case the MOVEMENTFLAG_FALLING flag.
- +
- + if((GetPlayer()->m_anti_BeginFallZ == INVALID_HEIGHT) &&
- + (movementInfo.flags & (MOVEMENTFLAG_FALLING | MOVEMENTFLAG_PENDING_STOP)) != 0)
- + {
- + GetPlayer()->m_anti_BeginFallZ=(float)(movementInfo.pos.GetPositionZ());
- + }
- +
- + if(GetPlayer()->m_anti_NextLenCheck <= CurTime)
- + {
- + // Check every 500ms is a lot more advisable then 1000ms, because normal movment packet arrives every 500ms
- + uint32 OldNextLenCheck=GetPlayer()->m_anti_NextLenCheck;
- + float delta_xyt=GetPlayer()->m_anti_MovedLen/(float)(getMSTimeDiff(OldNextLenCheck-500,CurTime));
- + GetPlayer()->m_anti_NextLenCheck = CurTime+500;
- + GetPlayer()->m_anti_MovedLen = 0.0f;
- + static const float MaxDeltaXYT = sWorld.GetMvAnticheatMaxXYT();
- +
- +#ifdef __ANTI_DEBUG__
- + SendAreaTriggerMessage("XYT: %f ; Flags: %s",delta_xyt,FlagsToStr(movementInfo.flags).c_str());
- +#endif //__ANTI_DEBUG__
- +
- + if(delta_xyt > MaxDeltaXYT && delta<=100.0f && GetPlayer()->GetZoneId() != 2257 && GetPlayer()->GetZoneId() != 3992 && GetPlayer()->GetZoneId() != 2618)
- + {
- + Anti__CheatOccurred(CurTime,"Speed hack",delta_xyt,LookupOpcodeName(opcode),
- + (float)(GetPlayer()->GetMotionMaster()->GetCurrentMovementGeneratorType()),
- + (float)(getMSTimeDiff(OldNextLenCheck-500,CurTime)),&movementInfo);
- + }
- + }
- +
- + if(delta > 100.0f && GetPlayer()->GetZoneId() != 2257 && GetPlayer()->GetZoneId() != 3992 && GetPlayer()->GetZoneId() != 2618)
- + {
- + Anti__ReportCheat("Tele hack",delta,LookupOpcodeName(opcode));
- + }
- +
- + // Check for waterwalking
- + if(((movementInfo.flags & MOVEMENTFLAG_WATERWALKING) != 0) &&
- + ((movementInfo.flags ^ MOVEMENTFLAG_WATERWALKING) != 0) && // Client sometimes set waterwalk where it shouldn't do that...
- + ((movementInfo.flags & MOVEMENTFLAG_JUMPING) == 0) &&
- + GetPlayer()->GetBaseMap()->IsUnderWater(movementInfo.pos.GetPositionX(), movementInfo.pos.GetPositionY(), movementInfo.pos.GetPositionZ()-6.0f) &&
- + !(GetPlayer()->HasAuraType(SPELL_AURA_WATER_WALK) || GetPlayer()->HasAuraType(SPELL_AURA_GHOST)))
- + {
- + Anti__CheatOccurred(CurTime,"Water walking",0.0f,NULL,0.0f,(uint32)(movementInfo.flags));
- + }
- +
- + // Check for walking upwards a mountain while not beeing able to do that
- + /*if ((tg_z > 85.0f))
- + {
- + Anti__CheatOccurred(CurTime,"Mount hack",tg_z,NULL,delta,delta_z);
- + }
- + */
- +
- + static const float DIFF_OVERGROUND = 10.0f;
- + float Anti__GroundZ = GetPlayer()->GetMap()->GetHeight(GetPlayer()->GetPositionX(),GetPlayer()->GetPositionY(),MAX_HEIGHT);
- + float Anti__FloorZ = GetPlayer()->GetMap()->GetHeight(GetPlayer()->GetPositionX(),GetPlayer()->GetPositionY(),GetPlayer()->GetPositionZ());
- + float Anti__MapZ = ((Anti__FloorZ <= (INVALID_HEIGHT+5.0f)) ? Anti__GroundZ : Anti__FloorZ) + DIFF_OVERGROUND;
- +
- + if(!GetPlayer()->CanFly() &&
- + !GetPlayer()->GetBaseMap()->IsUnderWater(movementInfo.pos.GetPositionX(), movementInfo.pos.GetPositionY(), movementInfo.pos.GetPositionZ()-7.0f) &&
- + Anti__MapZ < GetPlayer()->GetPositionZ() && Anti__MapZ > (INVALID_HEIGHT+DIFF_OVERGROUND + 5.0f))
- + {
- + // static const float DIFF_AIRJUMP=25.0f; // 25 is realy high, but to many false positives...
- +
- + // Air-Jump-Detection definitively needs a better way to be detected...
- + if((movementInfo.flags & (MOVEMENTFLAG_CAN_FLY | MOVEMENTFLAG_DESCENDING | MOVEMENTFLAG_FLYING)) != 0) // Fly Hack
- + {
- + Anti__CheatOccurred(CurTime,"Fly hack",
- + ((uint8)(GetPlayer()->HasAuraType(SPELL_AURA_FLY))) +
- + ((uint8)(GetPlayer()->HasAuraType(SPELL_AURA_MOD_INCREASE_FLIGHT_SPEED))*2),
- + NULL,GetPlayer()->GetPositionZ()-Anti__MapZ);
- + }
- +
- + /* Need a better way to do that - currently a lot of fake alarms
- + else if((Anti__MapZ+DIFF_AIRJUMP < GetPlayer()->GetPositionZ() &&
- + (movementInfo.flags & (MOVEMENTFLAG_FALLING | MOVEMENTFLAG_UNK4))==0) ||
- + (Anti__MapZ < GetPlayer()->GetPositionZ() &&
- + opcode==MSG_MOVE_JUMP))
- + {
- + Anti__CheatOccurred(CurTime,"Possible Air Jump Hack",
- + 0.0f,LookupOpcodeName(opcode),0.0f,movementInfo.flags,&movementInfo);
- + }*/
- + }
- +
- + /*
- + if(Anti__FloorZ < -199900.0f && Anti__GroundZ >= -199900.0f &&
- + GetPlayer()->GetPositionZ()+5.0f < Anti__GroundZ)
- + {
- + Anti__CheatOccurred(CurTime,"Teleport2Plane hack",
- + GetPlayer()->GetPositionZ(),NULL,Anti__GroundZ);
- + }*/
- + }
- + // <<---- anti-cheat features
- +
-
- /* process position-change */
- WorldPacket data(opcode, recv_data.size());
- diff -r 2b5e6acda90f -r 81349e70ea96 src/server/game/Server/WorldSession.h
- --- a/src/server/game/Server/WorldSession.h Fri Oct 01 15:13:23 2010 +0300
- +++ b/src/server/game/Server/WorldSession.h Fri Oct 01 17:34:15 2010 +0300
- @@ -143,6 +143,10 @@
- bool PlayerLogout() const { return m_playerLogout; }
- bool PlayerLogoutWithSave() const { return m_playerLogout && m_playerSave; }
-
- + inline bool Anti__CheatOccurred(uint32 CurTime,const char* Reason,float Speed,const char* Op=NULL,
- + float Val1=0.0f,uint32 Val2=0,MovementInfo* MvInfo=NULL);
- + bool Anti__ReportCheat(const char* Reason,float Speed,const char* Op=NULL,float Val1=0.0f,uint32 Val2=0,MovementInfo* MvInfo=NULL);
- +
- void SizeError(WorldPacket const& packet, uint32 size) const;
-
- void ReadAddonsInfo(WorldPacket &data);
- diff -r 2b5e6acda90f -r 81349e70ea96 src/server/game/Spells/Auras/SpellAuraEffects.cpp
- --- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp Fri Oct 01 15:13:23 2010 +0300
- +++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp Fri Oct 01 17:34:15 2010 +0300
- @@ -3702,9 +3702,15 @@
- // allow fly
- WorldPacket data;
- if (apply)
- + {
- + ((Player*)target)->SetCanFly(true);
- data.Initialize(SMSG_MOVE_SET_CAN_FLY, 12);
- + }
- else
- + {
- data.Initialize(SMSG_MOVE_UNSET_CAN_FLY, 12);
- + ((Player*)target)->SetCanFly(false);
- + }
- data.append(target->GetPackGUID());
- data << uint32(0); // unk
- plr->SendDirectMessage(&data);
- @@ -4122,9 +4128,15 @@
- {
- WorldPacket data;
- if (apply)
- + {
- + ((Player*)target)->SetCanFly(true);
- data.Initialize(SMSG_MOVE_SET_CAN_FLY, 12);
- + }
- else
- + {
- data.Initialize(SMSG_MOVE_UNSET_CAN_FLY, 12);
- + ((Player*)target)->SetCanFly(false);
- + }
- data.append(plr->GetPackGUID());
- data << uint32(0); // unknown
- plr->SendDirectMessage(&data);
- diff -r 2b5e6acda90f -r 81349e70ea96 src/server/game/World/World.cpp
- --- a/src/server/game/World/World.cpp Fri Oct 01 15:13:23 2010 +0300
- +++ b/src/server/game/World/World.cpp Fri Oct 01 17:34:15 2010 +0300
- @@ -561,6 +561,18 @@
-
- m_bool_configs[CONFIG_DURABILITY_LOSS_IN_PVP] = sConfig.GetBoolDefault("DurabilityLoss.InPvP", false);
-
- + // movement anticheat
- + m_MvAnticheatEnable = sConfig.GetBoolDefault("Anticheat.Movement.Enable",false);
- + m_MvAnticheatKick = sConfig.GetBoolDefault("Anticheat.Movement.Kick",false);
- + m_MvAnticheatAlarmCount = (uint32)sConfig.GetIntDefault("Anticheat.Movement.AlarmCount", 5);
- + m_MvAnticheatAlarmPeriod = (uint32)sConfig.GetIntDefault("Anticheat.Movement.AlarmTime", 5000);
- + m_MvAntiCheatBan = (unsigned char)sConfig.GetIntDefault("Anticheat.Movement.BanType",0);
- + m_MvAnticheatBanTime = sConfig.GetStringDefault("Anticheat.Movement.BanTime","1m");
- + m_MvAnticheatGmLevel = (unsigned char)sConfig.GetIntDefault("Anticheat.Movement.GmLevel",0);
- + m_MvAnticheatKill = sConfig.GetBoolDefault("Anticheat.Movement.Kill",false);
- + m_MvAnticheatMaxXYT = sConfig.GetFloatDefault("Anticheat.Movement.MaxXYT",0.04f);
- + m_MvAnticheatIgnoreAfterTeleport = (uint16)sConfig.GetIntDefault("Anticheat.Movement.IgnoreSecAfterTeleport",10);
- +
- m_int_configs[CONFIG_COMPRESSION] = sConfig.GetIntDefault("Compression", 1);
- if (m_int_configs[CONFIG_COMPRESSION] < 1 || m_int_configs[CONFIG_COMPRESSION] > 9)
- {
- diff -r 2b5e6acda90f -r 81349e70ea96 src/server/game/World/World.h
- --- a/src/server/game/World/World.h Fri Oct 01 15:13:23 2010 +0300
- +++ b/src/server/game/World/World.h Fri Oct 01 17:34:15 2010 +0300
- @@ -736,6 +736,19 @@
- uint32 m_WintergrapsTimer;
- uint32 m_WintergrapsState;
-
- + //movement anticheat enable flag
- + inline bool GetMvAnticheatEnable() {return m_MvAnticheatEnable;}
- + inline bool GetMvAnticheatKick() {return m_MvAnticheatKick;}
- + inline uint32 GetMvAnticheatAlarmCount() {return m_MvAnticheatAlarmCount;}
- + inline uint32 GetMvAnticheatAlarmPeriod() {return m_MvAnticheatAlarmPeriod;}
- + inline unsigned char GetMvAnticheatBan() {return m_MvAntiCheatBan;}
- + inline std::string GetMvAnticheatBanTime() {return m_MvAnticheatBanTime;}
- + inline unsigned char GetMvAnticheatGmLevel() {return m_MvAnticheatGmLevel;}
- + inline bool GetMvAnticheatKill() {return m_MvAnticheatKill;}
- + inline float GetMvAnticheatMaxXYT() {return m_MvAnticheatMaxXYT;}
- + inline uint16 GetMvAnticheatIgnoreAfterTeleport() {return m_MvAnticheatIgnoreAfterTeleport;}
- +
- +
- void ProcessCliCommands();
- void QueueCliCommand(CliCommandHolder* commandHolder) { cliCmdQueue.add(commandHolder); }
-
- @@ -832,6 +845,19 @@
- static int32 m_visibility_notify_periodInInstances;
- static int32 m_visibility_notify_periodInBGArenas;
-
- + //movement anticheat enable flag
- + bool m_MvAnticheatEnable;
- + bool m_MvAnticheatKick;
- + uint32 m_MvAnticheatAlarmCount;
- + uint32 m_MvAnticheatAlarmPeriod;
- + unsigned char m_MvAntiCheatBan;
- + std::string m_MvAnticheatBanTime;
- + unsigned char m_MvAnticheatGmLevel;
- + bool m_MvAnticheatKill;
- + float m_MvAnticheatMaxXYT;
- + uint16 m_MvAnticheatIgnoreAfterTeleport;
- +
- +
- // CLI command holder to be thread safe
- ACE_Based::LockedQueue<CliCommandHolder*,ACE_Thread_Mutex> cliCmdQueue;
-
- diff -r 2b5e6acda90f -r 81349e70ea96 src/server/worldserver/worldserver.conf.dist
- --- a/src/server/worldserver/worldserver.conf.dist Fri Oct 01 15:13:23 2010 +0300
- +++ b/src/server/worldserver/worldserver.conf.dist Fri Oct 01 17:34:15 2010 +0300
- @@ -1964,6 +1964,69 @@
- CharDelete.KeepDays = 30
-
- ###############################################################################
- +# MOVEMENT ANTICHEAT
- +#
- +# Anticheat.Movement.Enable
- +# Enable Movement Anticheat
- +# Default: 0 - off
- +# 1 - on
- +#
- +# Anticheat.Movement.AlarmCount
- +# Count alarms. After AlarmCount is exceeded, actions are taken against
- +# the player. (default 5)
- +#
- +# Anticheat.Movement.AlarmTime
- +# Reset alarm-count after this milliseconds. (default 5000)
- +#
- +# Anticheat.Movement.Kill
- +# Enable Kill cheater
- +# Default: 0 - off
- +# 1 - on
- +#
- +# Anticheat.Movement.Kick
- +# Enable Kick cheater
- +# Default: 0 - off
- +# 1 - on
- +#
- +# Anticheat.Movement.BanType
- +# Enable Ban cheater
- +# Default: 0 - off
- +# 1 - Ban Account
- +# 2 - Ban IP
- +# 3 - Ban Account + IP
- +#
- +# Anticheat.Movement.BanTime
- +# How long the ban should last.
- +# Default: 1 Minute - 1m
- +#
- +# Anticheat.Movement.MaxXYT
- +# Max units a player is allowed to travel per millisecond.
- +# Default: 0.04 (This is ~400% Speed, 0.007 is walk-speed,
- +# 310% is 0.0287)
- +#
- +# Anticheat.Movement.IgnoreSecAfterTeleport
- +# After being teleported this number of seconds no cheat is reported.
- +# Default: 10 seconds - 10
- +#
- +# Anticheat.Movement.GmLevel
- +# Only accounts that are below this gm-level or exact at the same,
- +# are reported for cheating.
- +# Default: Only normal Players - 0
- +#
- +###############################################################################
- +
- +Anticheat.Movement.Enable = 1
- +Anticheat.Movement.AlarmCount = 4
- +Anticheat.Movement.AlarmTime = 6000
- +Anticheat.Movement.Kill = 0
- +Anticheat.Movement.Kick = 0
- +Anticheat.Movement.BanType = 0
- +Anticheat.Movement.BanTime = "1m"
- +Anticheat.Movement.MaxXYT = 0.0330
- +Anticheat.Movement.IgnoreSecAfterTeleport = 10
- +Anticheat.Movement.GmLevel = 1
- +
- +###############################################################################
- # CUSTOM SERVER OPTIONS
- #
- # PlayerStart.AllReputation