diff --git a/src/server/game/Anticheat/AnticheatMgr.cpp b/src/server/game/Anticheat/AnticheatMgr.cpp index 49236175dd..81e5c4edcb 100644 --- a/src/server/game/Anticheat/AnticheatMgr.cpp +++ b/src/server/game/Anticheat/AnticheatMgr.cpp @@ -38,7 +38,7 @@ void AnticheatMgr::JumpHackDetection(Player* player, MovementInfo /* movementInf if (m_Players[key].GetLastOpcode() == MSG_MOVE_JUMP && opcode == MSG_MOVE_JUMP) { BuildReport(player,JUMP_HACK_REPORT); - TC_LOG_DEBUG("entities.player.character", "AnticheatMgr:: Jump-Hack detected player GUID (low) %u",player->GetGUIDLow()); + sLog->outError("AnticheatMgr:: Jump-Hack detected player GUID (low) %u",player->GetGUIDLow()); } } @@ -60,7 +60,7 @@ void AnticheatMgr::WalkOnWaterHackDetection(Player* player, MovementInfo /* move player->HasAuraType(SPELL_AURA_WATER_WALK)) return; - TC_LOG_DEBUG("entities.player.character", "AnticheatMgr:: Walk on Water - Hack detected player GUID (low) %u",player->GetGUIDLow()); + sLog->outError("AnticheatMgr:: Walk on Water - Hack detected player GUID (low) %u",player->GetGUIDLow()); BuildReport(player,WALK_WATER_HACK_REPORT); } @@ -79,7 +79,7 @@ void AnticheatMgr::FlyHackDetection(Player* player, MovementInfo /* movementInfo player->HasAuraType(SPELL_AURA_MOD_INCREASE_FLIGHT_SPEED)) return; - TC_LOG_DEBUG("entities.player.character", "AnticheatMgr:: Fly-Hack detected player GUID (low) %u",player->GetGUIDLow()); + sLog->outError("AnticheatMgr:: Fly-Hack detected player GUID (low) %u",player->GetGUIDLow()); BuildReport(player,FLY_HACK_REPORT); } @@ -108,7 +108,7 @@ void AnticheatMgr::TeleportPlaneHackDetection(Player* player, MovementInfo movem // we are not really walking there if (z_diff > 1.0f) { - TC_LOG_DEBUG("entities.player.character", "AnticheatMgr:: Teleport To Plane - Hack detected player GUID (low) %u",player->GetGUIDLow()); + sLog->outError("AnticheatMgr:: Teleport To Plane - Hack detected player GUID (low) %u",player->GetGUIDLow()); BuildReport(player,TELEPORT_PLANE_HACK_REPORT); } } @@ -160,7 +160,8 @@ void AnticheatMgr::ClimbHackDetection(Player *player, MovementInfo movementInfo, return; Position playerPos; - Position pos = player->GetPosition(); + Position pos; + player->GetPosition(&pos); float deltaZ = fabs(playerPos.GetPositionZ() - movementInfo.pos.GetPositionZ()); float deltaXY = movementInfo.pos.GetExactDist2d(&playerPos); @@ -169,7 +170,7 @@ void AnticheatMgr::ClimbHackDetection(Player *player, MovementInfo movementInfo, if (angle > CLIMB_ANGLE) { - TC_LOG_DEBUG("entities.player.character", "AnticheatMgr:: Climb-Hack detected player GUID (low) %u", player->GetGUIDLow()); + sLog->outError("AnticheatMgr:: Climb-Hack detected player GUID (low) %u", player->GetGUIDLow()); BuildReport(player,CLIMB_HACK_REPORT); } } @@ -217,7 +218,7 @@ void AnticheatMgr::SpeedHackDetection(Player* player,MovementInfo movementInfo) if (clientSpeedRate > speedRate) { BuildReport(player,SPEED_HACK_REPORT); - TC_LOG_DEBUG("entities.player.character", "AnticheatMgr:: Speed-Hack detected player GUID (low) %u",player->GetGUIDLow()); + sLog->outError("AnticheatMgr:: Speed-Hack detected player GUID (low) %u",player->GetGUIDLow()); } } diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp index e0a5e0944d..9b548aaeff 100644 --- a/src/server/game/Globals/ObjectMgr.cpp +++ b/src/server/game/Globals/ObjectMgr.cpp @@ -9080,6 +9080,14 @@ GameObjectTemplate const* ObjectMgr::GetGameObjectTemplate(uint32 entry) return NULL; } +//[AZTH] +Player* ObjectMgr::GetPlayerByLowGUID(uint32 lowguid) const +{ + uint64 guid = MAKE_NEW_GUID(lowguid, 0, HIGHGUID_PLAYER); + return ObjectAccessor::FindPlayer(guid); +} +//[AZTH] + bool ObjectMgr::IsGameObjectStaticTransport(uint32 entry) { GameObjectTemplate const* goinfo = GetGameObjectTemplate(entry); diff --git a/src/server/game/Globals/ObjectMgr.h b/src/server/game/Globals/ObjectMgr.h index bf7d3a3915..b036c1d8b8 100644 --- a/src/server/game/Globals/ObjectMgr.h +++ b/src/server/game/Globals/ObjectMgr.h @@ -666,6 +666,8 @@ class ObjectMgr typedef std::map CharacterConversionMap; + Player* GetPlayerByLowGUID(uint32 lowguid) const; //[AZTH] + GameObjectTemplate const* GetGameObjectTemplate(uint32 entry); bool IsGameObjectStaticTransport(uint32 entry); GameObjectTemplateContainer const* GetGameObjectTemplates() const { return &_gameObjectTemplateStore; } diff --git a/src/server/game/Handlers/MovementHandler.cpp b/src/server/game/Handlers/MovementHandler.cpp index aff9539c7d..41e313961f 100644 --- a/src/server/game/Handlers/MovementHandler.cpp +++ b/src/server/game/Handlers/MovementHandler.cpp @@ -35,6 +35,7 @@ #include "ArenaSpectator.h" #include "Chat.h" #include "BattlegroundMgr.h" +#include "AnticheatMgr.h" #define MOVEMENT_PACKET_TIME_DELAY 0 @@ -407,6 +408,11 @@ void WorldSession::HandleMovementOpcodes(WorldPacket & recvData) // Dont allow to turn on walking if charming other player if (mover->GetGUID() != _player->GetGUID()) movementInfo.flags &= ~MOVEMENTFLAG_WALKING; + + // [AZTH] Anticheat + if (plrMover) + sAnticheatMgr->StartHackDetection(plrMover, movementInfo, opcode); + // [/AZTH] uint32 mstime = World::GetGameTimeMS(); /*----------------------*/ diff --git a/src/server/game/Scripting/ScriptLoader.cpp b/src/server/game/Scripting/ScriptLoader.cpp index 57562ecb31..b1eed72c55 100644 --- a/src/server/game/Scripting/ScriptLoader.cpp +++ b/src/server/game/Scripting/ScriptLoader.cpp @@ -17,6 +17,7 @@ #include "ScriptLoader.h" #include "ScriptMgr.h" +#include "AnticheatMgr.h" //examples void AddSC_example_creature(); @@ -595,6 +596,7 @@ void AddScripts() AddSpellScripts(); AddSC_SmartSCripts(); AddCommandScripts(); + sAnticheatMgr->StartScripts(); //[AZTH] Anticheat #ifdef SCRIPTS AddWorldScripts(); AddEventScripts(); diff --git a/src/server/game/World/World.cpp b/src/server/game/World/World.cpp index d9f391fb8e..350ecf6132 100644 --- a/src/server/game/World/World.cpp +++ b/src/server/game/World/World.cpp @@ -87,6 +87,7 @@ #include "WhoListCache.h" #include "AsyncAuctionListing.h" #include "SavingSystem.h" +#include "AnticheatMgr.h" ACE_Atomic_Op World::m_stopEvent = false; uint8 World::m_ExitCode = SHUTDOWN_EXIT_CODE; @@ -1197,6 +1198,13 @@ void World::LoadConfigSettings(bool reload) // Dungeon finder m_int_configs[CONFIG_LFG_OPTIONSMASK] = sConfigMgr->GetIntDefault("DungeonFinder.OptionsMask", 3); + //[AZTH] ANTICHEAT + m_bool_configs[CONFIG_ANTICHEAT_ENABLE] = sConfigMgr->GetBoolDefault("Anticheat.Enable", true); + m_int_configs[CONFIG_ANTICHEAT_REPORTS_INGAME_NOTIFICATION] = sConfigMgr->GetIntDefault("Anticheat.ReportsForIngameWarnings", 70); + m_int_configs[CONFIG_ANTICHEAT_DETECTIONS_ENABLED] = sConfigMgr->GetIntDefault("Anticheat.DetectionsEnabled", 31); + m_int_configs[CONFIG_ANTICHEAT_MAX_REPORTS_FOR_DAILY_REPORT] = sConfigMgr->GetIntDefault("Anticheat.MaxReportsForDailyReport", 70); + //[AZTH] + // DBC_ItemAttributes m_bool_configs[CONFIG_DBC_ENFORCE_ITEM_ATTRIBUTES] = sConfigMgr->GetBoolDefault("DBC.EnforceItemAttributes", true); diff --git a/src/server/game/World/World.h b/src/server/game/World/World.h index 378bdfce09..06064dae3a 100644 --- a/src/server/game/World/World.h +++ b/src/server/game/World/World.h @@ -156,6 +156,7 @@ enum WorldBoolConfigs CONFIG_QUEST_IGNORE_AUTO_ACCEPT, CONFIG_QUEST_IGNORE_AUTO_COMPLETE, CONFIG_WARDEN_ENABLED, + CONFIG_ANTICHEAT_ENABLE, BOOL_CONFIG_VALUE_COUNT }; @@ -317,6 +318,9 @@ enum WorldIntConfigs CONFIG_WARDEN_NUM_MEM_CHECKS, CONFIG_WARDEN_NUM_OTHER_CHECKS, CONFIG_BIRTHDAY_TIME, + CONFIG_ANTICHEAT_REPORTS_INGAME_NOTIFICATION, + CONFIG_ANTICHEAT_MAX_REPORTS_FOR_DAILY_REPORT, + CONFIG_ANTICHEAT_DETECTIONS_ENABLED, INT_CONFIG_VALUE_COUNT };