Skip to content
This repository has been archived by the owner on Feb 29, 2024. It is now read-only.

Commit

Permalink
update (anticheat): Replace case swith a better if
Browse files Browse the repository at this point in the history
  • Loading branch information
acidmanifesto committed Feb 19, 2024
1 parent cc99ea7 commit 83e023d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 63 deletions.
75 changes: 13 additions & 62 deletions src/server/game/Anticheat/AnticheatMgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -164,68 +164,19 @@ void AnticheatMgr::StartHackDetection(Player* player, MovementInfo& movementInfo
data->lastOpcode = opcode;
}

void AnticheatMgr::MapSpeedTeleExemption(Player* player)
void AnticheatMgr::MapSpeedTeleExemption(Player* player, MovementInfo& movementInfo)
{
// We exempt all transports found in 548 to prevent false tele hack hits
if (player->GetMapId())
// The anticheat is disabled on transports, so we need to be sure that the player is indeed on a transport.
Unit* mover = player->m_mover;
GameObject* transportGobj = mover->GetMap()->GetGameObject(movementInfo.transport.guid);
float maxDist2d = 70.0f; // Transports usually dont go far away.
if (player->GetMapId() == 369) // Deeprun tram
{
switch (player->GetMapId())
{
case 369: //Transport: Deeprun Tram
case 607: //Transport: Strands of the Ancients
case 582: //Transport: Rut'theran to Auberdine
case 584: //Transport: Menethil to Theramore
case 586: //Transport: Exodar to Auberdine
case 587: //Transport: Feathermoon Ferry
case 588: //Transport: Menethil to Auberdine
case 589: //Transport: Orgrimmar to Grom'Gol
case 590: //Transport: Grom'Gol to Undercity
case 591: //Transport: Undercity to Orgrimmar
case 592: //Transport: Borean Tundra Test
case 593: //Transport: Booty Bay to Ratchet
case 594: //Transport: Howling Fjord Sister Mercy (Quest)
case 596: //Transport: Naglfar
case 610: //Transport: Tirisfal to Vengeance Landing
case 612: //Transport: Menethil to Valgarde
case 613: //Transport: Orgrimmar to Warsong Hold
case 614: //Transport: Stormwind to Valiance Keep
case 620: //Transport: Moa'ki to Unu'pe
case 621: //Transport: Moa'ki to Kamagua
case 622: //Transport: Orgrim's Hammer
case 623: //Transport: The Skybreaker
case 641: //Transport: Alliance Airship BG
case 642: //Transport: Horde Airship BG
case 647: //Transport: Orgrimmar to Thunder Bluff
case 672: //Transport: The Skybreaker (Icecrown Citadel Raid)
case 673: //Transport: Orgrim's Hammer (Icecrown Citadel Raid)
case 712: //Transport: The Skybreaker (IC Dungeon)
case 713: //Transport: Orgrim's Hammer (IC Dungeon)
case 718: //Transport: The Mighty Wind (Icecrown Citadel Raid)
case 766: // Transport 2033864
case 767: // Transport 2033865
case 747: // Transport 203732
case 762: // Transport 203861
case 763: // Transport 203862
case 1172: // Transport_Siege_of_Orgrimmar_Alliance
case 1173: // Transport_Siege_of_Orgrimmar_Horde
case 662: // Transport197195
case 674: // Transport197349-2
case 738: // Transport200100
case 739: // Transport200101
case 740: // Transport200102
case 741: // Transport200103
case 742: // Transport203729
case 743: // Transport203730
case 748: // Transport203858
case 749: // Transport203859
case 750: // Transport203860
case 765: // Transport203863
case 1132: // Transport218599
case 1133: // Transport218600
return;
default:
break;
}
maxDist2d = 3000.0f;
}
if (transportGobj && (transportGobj->IsTransport() || transportGobj->IsWithinDist(player, maxDist2d, false)))
{
return;
}
}

Expand All @@ -245,7 +196,7 @@ void AnticheatMgr::SpeedHackDetection(Player* player, MovementInfo& movementInfo

if (player)
{
MapSpeedTeleExemption(player);
MapSpeedTeleExemption(player, movementInfo);
}

if (player->HasAura(1850) /*Dash*/ || player->HasAuraType(SPELL_AURA_FEATHER_FALL) || player->HasAuraType(SPELL_AURA_SAFE_FALL))
Expand Down Expand Up @@ -388,7 +339,7 @@ void AnticheatMgr::TeleportHackDetection(Player* player, MovementInfo movementIn

if (player)
{
MapSpeedTeleExemption(player);
MapSpeedTeleExemption(player, movementInfo);
}

/* Please work */
Expand Down
2 changes: 1 addition & 1 deletion src/server/game/Anticheat/AnticheatMgr.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ class AnticheatMgr
void ResetDailyReportStates();

private:
void MapSpeedTeleExemption(Player* player);
void MapSpeedTeleExemption(Player* player, MovementInfo& movementInfo);
void BGLogger(Player* player, AnticheatData& data);
void SpeedHackDetection(Player* player, MovementInfo &movementInfo, AnticheatData& data);
void FlyHackDetection(Player* player, MovementInfo &movementInfo, AnticheatData& data);
Expand Down

0 comments on commit 83e023d

Please sign in to comment.