Advertisement
Guest User

Untitled

a guest
Jan 17th, 2018
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 10.75 KB | None | 0 0
  1. #pragma region Ataque Fisico e Magico
  2.     if (packet->PacketId == 0x39D || packet->PacketId == 0x367 || packet->PacketId == 0x39E)
  3.     {
  4.         PlayerGame[client].Last_Packet_ID = packet->PacketId; //Salva o ultimo pacote
  5.  
  6.         if (true/*PlayerGame[client].TimeStamp_Last_Packet == 0 || abs((int)PlayerGame[client].TimeStamp_Last_Packet - (int)packet->TimeStamp) > 10*/)
  7.         {
  8.             if (packet->PacketId == 0x39E)
  9.             {
  10.                 if (packet->Size != 56)
  11.                 {
  12.                     ZeroMemory(packet, packet->Size);
  13.                     return false;
  14.                 }
  15.             }
  16.  
  17.             if (packet->Size != 52 && packet->Size != 100 && packet->PacketId != 0x39E) //Se for diferente dos 2 pacotes
  18.             {
  19.                 ZeroMemory(packet, packet->Size);
  20.                 return false;
  21.             }
  22.  
  23.             else if (client < NULL || client > MAX_USER)
  24.             {
  25.                 ZeroMemory(packet, packet->Size);
  26.                 return false;
  27.             }
  28.             else
  29.             {
  30.  
  31.                 /*
  32.                 FF 00 == Ataque Magico
  33.                 08 00 == Unk
  34.                 5C 08 65 08 == Posição do atacante
  35.                 5C 08 65 08 == Posição do Atacado
  36.                 00 00 == Client ID
  37.                 00 00 == Unk
  38.                
  39.                 */
  40.                 if (Player->Mob.CurrentStatus.Level > 999)
  41.                 {
  42.                     Functions::SendClientChat(client, Functions::stringFormat("> %d", Player->WeaponDamage), 0xFFFFDEAD);
  43.                 }
  44.  
  45.                 p39D *p = (p39D*)packet;
  46.  
  47.                 //Functions::SendClientChat(client, Functions::stringFormat("Index: %d, Damage: %d", p->Target.Index, p->Target.Damage), 0xFFDEADD);
  48.                 if (*(short*)&packet[48] == 7 && *(short*)&packet[73] == 0xBBB)
  49.                 {
  50.                     ZeroMemory(packet, packet->Size);
  51.                     return false;
  52.                 }
  53.                 else if (*(short*)&packet[26] == 7 && *(short*)&packet[100] == 0xBBB)
  54.                 {
  55.                     ZeroMemory(packet, packet->Size);
  56.                     return false;
  57.                 }
  58.                 else if (p->Target.Index < NULL || p->Target.Index > 30000)
  59.                 {
  60.                     ZeroMemory(packet, packet->Size);
  61.                     return false;
  62.                 }
  63.  
  64.                 auto Atacante = NativeFunctions::getMobFromIndex(client);
  65.                 auto Atacado = NativeFunctions::getMobFromIndex(p->Target.Index);
  66.  
  67.  
  68.                 //Anti Range Hack
  69.                 //checa a distancia real do Player para o Mob
  70.                 //se for superior a 6 o ataque sera anulado
  71.  
  72.                 // -9 ou 9  = 9
  73.                 if (abs(Atacante->PosX - Atacado->PosX) >= 9 || abs(Atacante->PosY - Atacado->PosY) >= 9)
  74.                 {
  75.                     //Functions::SendClientChat(client, "Não deveria entrar aqui", 0xFFDEADFF);
  76.                     PlayerGame[client].Range_Count++;
  77.                     if (PlayerGame[client].Range_Count > 5)
  78.                     {
  79.                         NativeFunctions::sendClientMessage(client, "[Tentativa de uso de Range Hack] Report enviado a Equipe. ");
  80.                         Functions::NewLog("Hackers/Range", "RANGE", "Conta [%s] - Personagem [%s] > Atacando muito Longe", User->AccountName, Player->Mob.Name);
  81.                         PlayerGame[client].Range_Count = 0;
  82.                         ZeroMemory(packet, packet->Size);
  83.                         return false;
  84.                     }
  85.                 }
  86.                 else
  87.                 {
  88.                     PlayerGame[client].Range_Count = 0;
  89.                 }
  90.  
  91.                 //Anti Speed Hack
  92.                 //Logica de Ataque, Padrão: Cada intervalo de ataque é em media 600, abaixo disso ja é algo suspeito.
  93.                 //Logica de Defesa contra speed, analisar cada pacote baseado no timer stamp do jogo e do server
  94.  
  95.                 //Caso esteja atacando com intervalo inferior a  500 ele anula o pacote
  96.                 if (abs((int)PlayerGame[client].TimeStamp_Last_Attack_Server - (int)TimerServer) <= 300 ||
  97.                     abs((int)PlayerGame[client].TimeStamp_Last_Attack - (int)packet->TimeStamp) <= 300)
  98.                 {
  99.                     Functions::SendAllClientChatGM("Pacote Anulado Mode 1", 0xFFFFDEAD);
  100.                     PlayerGame[client].TimeStamp_Last_Attack = packet->TimeStamp;
  101.                     PlayerGame[client].TimeStamp_Last_Attack_Server = TimerServer;
  102.                     PlayerGame[client].Attack_Count++;
  103.                     if (PlayerGame[client].Attack_Count >= 5)
  104.                     {
  105.                         NativeFunctions::sendClientMessage(client, "[Tentativa de uso de Speed Hack] Report enviado a Equipe. ");
  106.                         Functions::NewLog("Hackers/Speed", "SPEED", "Conta [%s] - Personagem [%s] > Atacando muito rapido", User->AccountName, Player->Mob.Name);
  107.                         PlayerGame[client].Attack_Count = 0;
  108.                     }
  109.  
  110.                     NativeFunctions::sendClientSignalParm(client, 0x7530, 0x3A7, 0); //Envia um parametro para atualizar o char
  111.                     NativeFunctions::sendScore(client);
  112.                     NativeFunctions::sendEtc(client);
  113.                     ZeroMemory(packet, packet->Size); //anula o pacote
  114.                     return false;
  115.                 }
  116.                 else
  117.                 {
  118.                     PlayerGame[client].Attack_Count = 0;
  119.                 }
  120.  
  121.                 auto inf = p->SkillID;
  122.                 if (inf == 110)
  123.                 {
  124.                     NativeFunctions::sendClientMessage(client, "[Tentativa de uso de Skill Hack] Report enviado a Equipe. ");
  125.                     Functions::NewLog("Hackers/Buff", "BUFF", "Conta [%s] - Personagem [%s] > Tentando buffar skill Invalido [%d]", User->AccountName, Player->Mob.Name, inf);
  126.                     memset(packet, 0, packet->Size);
  127.                     return false;
  128.                 }
  129.                 if (inf == 98)
  130.                 {
  131.                     if (Player->Mob.Learn & (1 << (26)))
  132.                     {
  133.                         return true;
  134.                     }
  135.                     else
  136.                     {
  137.                         NativeFunctions::sendClientMessage(client, "[Tentativa de uso de Skill Hack] Report enviado a Equipe. ");
  138.                         Functions::NewLog("Hackers/Buff", "BUFF", "Conta [%s] - Personagem [%s] > Tentando buffar skill Invalido [%d]", User->AccountName, Player->Mob.Name, inf);
  139.                         memset(packet, 0, packet->Size);
  140.                         return false;
  141.                     }
  142.                 }
  143.  
  144.                 if (inf == 103)
  145.                 {
  146.                     if (Player->Mob.Learn & (1 << (31)))
  147.                     {
  148.                         return true;
  149.                     }
  150.                     else
  151.                     {
  152.                         NativeFunctions::sendClientMessage(client, "[Tentativa de uso de Skill Hack] Report enviado a Equipe. ");
  153.                         Functions::NewLog("Hackers/Buff", "BUFF", "Conta [%s] - Personagem [%s] > Tentando buffar skill Invalido [%d]", User->AccountName, Player->Mob.Name, inf);
  154.                         memset(packet, 0, packet->Size);
  155.                         return false;
  156.                     }
  157.                 }
  158.  
  159.                 if (inf == 102)
  160.                 {
  161.                     if (Player->Mob.Learn & (1 << (30)))
  162.                     {
  163.                         return true;
  164.                     }
  165.                     else
  166.                     {
  167.                         NativeFunctions::sendClientMessage(client, "[Tentativa de uso de Skill Hack] Report enviado a Equipe. ");
  168.                         Functions::NewLog("Hackers/Buff", "BUFF", "Conta [%s] - Personagem [%s] > Tentando buffar skill Invalido [%d]", User->AccountName, Player->Mob.Name, inf);
  169.                         memset(packet, 0, packet->Size);
  170.                         return false;
  171.                     }
  172.                 }
  173.  
  174.                 if (inf == 101)
  175.                 {
  176.                     if (Player->Mob.Learn & (1 << (29)))
  177.                     {
  178.                         return true;
  179.                     }
  180.                     else
  181.                     {
  182.                         NativeFunctions::sendClientMessage(client, "[Tentativa de uso de Skill Hack] Report enviado a Equipe. ");
  183.                         Functions::NewLog("Hackers/Buff", "BUFF", "Conta [%s] - Personagem [%s] > Tentando buffar skill Invalido [%d]", User->AccountName, Player->Mob.Name, inf);
  184.                         memset(packet, 0, packet->Size);
  185.                         return false;
  186.                     }
  187.                 }
  188.  
  189.                 if (inf == 100)
  190.                 {
  191.                     if (Player->Mob.Learn & (1 << (28)))
  192.                     {
  193.                         return true;
  194.                     }
  195.                     else
  196.                     {
  197.                         NativeFunctions::sendClientMessage(client, "[Tentativa de uso de Skill Hack] Report enviado a Equipe. ");
  198.                         Functions::NewLog("Hackers/Buff", "BUFF", "Conta [%s] - Personagem [%s] > Tentando buffar skill Invalido [%d]", User->AccountName, Player->Mob.Name, inf);
  199.                         memset(packet, 0, packet->Size);
  200.                         return false;
  201.                     }
  202.                 }
  203.                 if (inf == 99)
  204.                 {
  205.                     if (Player->Mob.Learn & (1 << (27)))
  206.                     {
  207.                         return true;
  208.                     }
  209.                     else
  210.                     {
  211.                         NativeFunctions::sendClientMessage(client, "[Tentativa de uso de Skill Hack] Report enviado a Equipe. ");
  212.                         Functions::NewLog("Hackers/Buff", "BUFF", "Conta [%s] - Personagem [%s] > Tentando buffar skill Invalido [%d]", User->AccountName, Player->Mob.Name, inf);
  213.                         memset(packet, 0, packet->Size);
  214.                         return false;
  215.                     }
  216.                 }
  217.  
  218.                 if (p->Target.Index < 1000)
  219.                 {
  220.                     int buffTK[] = { 3, 5, 11, 13 };
  221.                     int buffFM[] = { 43, 44, 45, 46 };
  222.                     int buffBM[] = { 53, 56, 57, 58, 59, 60, 61, 62, 63, 64, 66, 68, 70, 71 };
  223.                     int buffHT[] = { 75, 76, 77, 81, 83, 84, 86, 87, 95, 89, 92 };
  224.  
  225.                     auto inf = p->SkillID;
  226.  
  227.                     for (auto i = 0; i < 14; i++)
  228.                     {
  229.                         if (inf == buffTK[i])
  230.                         {
  231.                             auto usedSkill = p->SkillID;
  232.  
  233.                             if (inf == 13)
  234.                             {
  235.                                 if (Player->Mob.ClassInfo == Transknight && Player->Mob.Learn & (1 << usedSkill))
  236.                                 {
  237.                                     return true;
  238.                                 }
  239.                             }
  240.                             else if (Player->Mob.ClassInfo == Transknight && Player->Mob.Learn & (1 << usedSkill) && p->Target.Index == client)
  241.                                 return true;
  242.                             else
  243.                             {
  244.                                 NativeFunctions::sendClientMessage(client, "[Tentativa de uso de Skill Hack] Report enviado a Equipe. ");
  245.                                 Functions::NewLog("Hackers/Buff", "BUFF", "Conta [%s] - Personagem [%s] > Tentando buffar skill Invalido [%d]", User->AccountName, Player->Mob.Name, inf);
  246.                                 memset(packet, 0, packet->Size);
  247.                                 return false;
  248.                             }
  249.                         }
  250.                         if (inf == buffFM[i])
  251.                         {
  252.                             auto usedSkill = p->SkillID - 24;
  253.  
  254.                             if (inf == 45 || inf == 41 || inf == 43 || inf == 44)
  255.                             {
  256.                                 if (Player->Mob.ClassInfo == Foema && Player->Mob.Learn & (1 << usedSkill))
  257.                                 {
  258.                                     return true;
  259.                                 }
  260.                             }
  261.                             else if (Player->Mob.ClassInfo == Foema && Player->Mob.Learn & (1 << usedSkill) && p->Target.Index == client)
  262.                                 return true;
  263.                             else
  264.                             {
  265.                                 NativeFunctions::sendClientMessage(client, "[Tentativa de uso de Skill Hack] Report enviado a Equipe. ");
  266.                                 Functions::NewLog("Hackers/Buff", "BUFF", "Conta [%s] - Personagem [%s] > Tentando buffar skill Invalido [%d]", User->AccountName, Player->Mob.Name, inf);
  267.                                 memset(packet, 0, packet->Size);
  268.                                 return false;
  269.                             }
  270.                         }
  271.                         if (inf == buffBM[i])
  272.                         {
  273.                             auto usedSkill = p->SkillID - 48;
  274.  
  275.                             if (Player->Mob.ClassInfo == BeastMaster && Player->Mob.Learn & (1 << usedSkill) && p->Target.Index == client)
  276.                                 return true;
  277.                             else
  278.                             {
  279.                                 NativeFunctions::sendClientMessage(client, "[Tentativa de uso de Skill Hack] Report enviado a Equipe. ");
  280.                                 Functions::NewLog("Hackers/Buff", "BUFF", "Conta [%s] - Personagem [%s] > Tentando buffar skill Invalido [%d]", User->AccountName, Player->Mob.Name, inf);
  281.                                 memset(packet, 0, packet->Size);
  282.                                 return false;
  283.                             }
  284.                         }
  285.                         if (inf == buffHT[i])
  286.                         {
  287.                             auto usedSkill = p->SkillID - 72;
  288.  
  289.                             if (Player->Mob.ClassInfo == Huntress && Player->Mob.Learn & (1 << usedSkill) && p->Target.Index == client)
  290.                                 return true;
  291.                             else
  292.                             {
  293.                                 NativeFunctions::sendClientMessage(client, "[Tentativa de uso de Skill Hack] Report enviado a Equipe. ");
  294.                                 Functions::NewLog("Hackers/Buff", "BUFF", "Conta [%s] - Personagem [%s] > Tentando buffar skill Invalido [%d]", User->AccountName, Player->Mob.Name, inf);
  295.                                 memset(packet, 0, packet->Size);
  296.                                 return false;
  297.                             }
  298.                         }
  299.                     }
  300.                 }
  301.  
  302.                 PlayerGame[client].TimeStamp_Last_Packet = packet->TimeStamp; //salva o Timer
  303.  
  304.                 return true; //faz a TMsrv processar o Ataque.
  305.             }
  306.  
  307.         }
  308.         else //Ignora o pacote
  309.         {
  310.             ZeroMemory(packet, packet->Size);
  311.             return false;
  312.         }
  313.     }
  314.  
  315. #pragma endregion
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement