Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #pragma region Ataque Fisico e Magico
- if (packet->PacketId == 0x39D || packet->PacketId == 0x367 || packet->PacketId == 0x39E)
- {
- PlayerGame[client].Last_Packet_ID = packet->PacketId; //Salva o ultimo pacote
- if (true/*PlayerGame[client].TimeStamp_Last_Packet == 0 || abs((int)PlayerGame[client].TimeStamp_Last_Packet - (int)packet->TimeStamp) > 10*/)
- {
- if (packet->PacketId == 0x39E)
- {
- if (packet->Size != 56)
- {
- ZeroMemory(packet, packet->Size);
- return false;
- }
- }
- if (packet->Size != 52 && packet->Size != 100 && packet->PacketId != 0x39E) //Se for diferente dos 2 pacotes
- {
- ZeroMemory(packet, packet->Size);
- return false;
- }
- else if (client < NULL || client > MAX_USER)
- {
- ZeroMemory(packet, packet->Size);
- return false;
- }
- else
- {
- /*
- FF 00 == Ataque Magico
- 08 00 == Unk
- 5C 08 65 08 == Posição do atacante
- 5C 08 65 08 == Posição do Atacado
- 00 00 == Client ID
- 00 00 == Unk
- */
- if (Player->Mob.CurrentStatus.Level > 999)
- {
- Functions::SendClientChat(client, Functions::stringFormat("> %d", Player->WeaponDamage), 0xFFFFDEAD);
- }
- p39D *p = (p39D*)packet;
- //Functions::SendClientChat(client, Functions::stringFormat("Index: %d, Damage: %d", p->Target.Index, p->Target.Damage), 0xFFDEADD);
- if (*(short*)&packet[48] == 7 && *(short*)&packet[73] == 0xBBB)
- {
- ZeroMemory(packet, packet->Size);
- return false;
- }
- else if (*(short*)&packet[26] == 7 && *(short*)&packet[100] == 0xBBB)
- {
- ZeroMemory(packet, packet->Size);
- return false;
- }
- else if (p->Target.Index < NULL || p->Target.Index > 30000)
- {
- ZeroMemory(packet, packet->Size);
- return false;
- }
- auto Atacante = NativeFunctions::getMobFromIndex(client);
- auto Atacado = NativeFunctions::getMobFromIndex(p->Target.Index);
- //Anti Range Hack
- //checa a distancia real do Player para o Mob
- //se for superior a 6 o ataque sera anulado
- // -9 ou 9 = 9
- if (abs(Atacante->PosX - Atacado->PosX) >= 9 || abs(Atacante->PosY - Atacado->PosY) >= 9)
- {
- //Functions::SendClientChat(client, "Não deveria entrar aqui", 0xFFDEADFF);
- PlayerGame[client].Range_Count++;
- if (PlayerGame[client].Range_Count > 5)
- {
- NativeFunctions::sendClientMessage(client, "[Tentativa de uso de Range Hack] Report enviado a Equipe. ");
- Functions::NewLog("Hackers/Range", "RANGE", "Conta [%s] - Personagem [%s] > Atacando muito Longe", User->AccountName, Player->Mob.Name);
- PlayerGame[client].Range_Count = 0;
- ZeroMemory(packet, packet->Size);
- return false;
- }
- }
- else
- {
- PlayerGame[client].Range_Count = 0;
- }
- //Anti Speed Hack
- //Logica de Ataque, Padrão: Cada intervalo de ataque é em media 600, abaixo disso ja é algo suspeito.
- //Logica de Defesa contra speed, analisar cada pacote baseado no timer stamp do jogo e do server
- //Caso esteja atacando com intervalo inferior a 500 ele anula o pacote
- if (abs((int)PlayerGame[client].TimeStamp_Last_Attack_Server - (int)TimerServer) <= 300 ||
- abs((int)PlayerGame[client].TimeStamp_Last_Attack - (int)packet->TimeStamp) <= 300)
- {
- Functions::SendAllClientChatGM("Pacote Anulado Mode 1", 0xFFFFDEAD);
- PlayerGame[client].TimeStamp_Last_Attack = packet->TimeStamp;
- PlayerGame[client].TimeStamp_Last_Attack_Server = TimerServer;
- PlayerGame[client].Attack_Count++;
- if (PlayerGame[client].Attack_Count >= 5)
- {
- NativeFunctions::sendClientMessage(client, "[Tentativa de uso de Speed Hack] Report enviado a Equipe. ");
- Functions::NewLog("Hackers/Speed", "SPEED", "Conta [%s] - Personagem [%s] > Atacando muito rapido", User->AccountName, Player->Mob.Name);
- PlayerGame[client].Attack_Count = 0;
- }
- NativeFunctions::sendClientSignalParm(client, 0x7530, 0x3A7, 0); //Envia um parametro para atualizar o char
- NativeFunctions::sendScore(client);
- NativeFunctions::sendEtc(client);
- ZeroMemory(packet, packet->Size); //anula o pacote
- return false;
- }
- else
- {
- PlayerGame[client].Attack_Count = 0;
- }
- auto inf = p->SkillID;
- if (inf == 110)
- {
- NativeFunctions::sendClientMessage(client, "[Tentativa de uso de Skill Hack] Report enviado a Equipe. ");
- Functions::NewLog("Hackers/Buff", "BUFF", "Conta [%s] - Personagem [%s] > Tentando buffar skill Invalido [%d]", User->AccountName, Player->Mob.Name, inf);
- memset(packet, 0, packet->Size);
- return false;
- }
- if (inf == 98)
- {
- if (Player->Mob.Learn & (1 << (26)))
- {
- return true;
- }
- else
- {
- NativeFunctions::sendClientMessage(client, "[Tentativa de uso de Skill Hack] Report enviado a Equipe. ");
- Functions::NewLog("Hackers/Buff", "BUFF", "Conta [%s] - Personagem [%s] > Tentando buffar skill Invalido [%d]", User->AccountName, Player->Mob.Name, inf);
- memset(packet, 0, packet->Size);
- return false;
- }
- }
- if (inf == 103)
- {
- if (Player->Mob.Learn & (1 << (31)))
- {
- return true;
- }
- else
- {
- NativeFunctions::sendClientMessage(client, "[Tentativa de uso de Skill Hack] Report enviado a Equipe. ");
- Functions::NewLog("Hackers/Buff", "BUFF", "Conta [%s] - Personagem [%s] > Tentando buffar skill Invalido [%d]", User->AccountName, Player->Mob.Name, inf);
- memset(packet, 0, packet->Size);
- return false;
- }
- }
- if (inf == 102)
- {
- if (Player->Mob.Learn & (1 << (30)))
- {
- return true;
- }
- else
- {
- NativeFunctions::sendClientMessage(client, "[Tentativa de uso de Skill Hack] Report enviado a Equipe. ");
- Functions::NewLog("Hackers/Buff", "BUFF", "Conta [%s] - Personagem [%s] > Tentando buffar skill Invalido [%d]", User->AccountName, Player->Mob.Name, inf);
- memset(packet, 0, packet->Size);
- return false;
- }
- }
- if (inf == 101)
- {
- if (Player->Mob.Learn & (1 << (29)))
- {
- return true;
- }
- else
- {
- NativeFunctions::sendClientMessage(client, "[Tentativa de uso de Skill Hack] Report enviado a Equipe. ");
- Functions::NewLog("Hackers/Buff", "BUFF", "Conta [%s] - Personagem [%s] > Tentando buffar skill Invalido [%d]", User->AccountName, Player->Mob.Name, inf);
- memset(packet, 0, packet->Size);
- return false;
- }
- }
- if (inf == 100)
- {
- if (Player->Mob.Learn & (1 << (28)))
- {
- return true;
- }
- else
- {
- NativeFunctions::sendClientMessage(client, "[Tentativa de uso de Skill Hack] Report enviado a Equipe. ");
- Functions::NewLog("Hackers/Buff", "BUFF", "Conta [%s] - Personagem [%s] > Tentando buffar skill Invalido [%d]", User->AccountName, Player->Mob.Name, inf);
- memset(packet, 0, packet->Size);
- return false;
- }
- }
- if (inf == 99)
- {
- if (Player->Mob.Learn & (1 << (27)))
- {
- return true;
- }
- else
- {
- NativeFunctions::sendClientMessage(client, "[Tentativa de uso de Skill Hack] Report enviado a Equipe. ");
- Functions::NewLog("Hackers/Buff", "BUFF", "Conta [%s] - Personagem [%s] > Tentando buffar skill Invalido [%d]", User->AccountName, Player->Mob.Name, inf);
- memset(packet, 0, packet->Size);
- return false;
- }
- }
- if (p->Target.Index < 1000)
- {
- int buffTK[] = { 3, 5, 11, 13 };
- int buffFM[] = { 43, 44, 45, 46 };
- int buffBM[] = { 53, 56, 57, 58, 59, 60, 61, 62, 63, 64, 66, 68, 70, 71 };
- int buffHT[] = { 75, 76, 77, 81, 83, 84, 86, 87, 95, 89, 92 };
- auto inf = p->SkillID;
- for (auto i = 0; i < 14; i++)
- {
- if (inf == buffTK[i])
- {
- auto usedSkill = p->SkillID;
- if (inf == 13)
- {
- if (Player->Mob.ClassInfo == Transknight && Player->Mob.Learn & (1 << usedSkill))
- {
- return true;
- }
- }
- else if (Player->Mob.ClassInfo == Transknight && Player->Mob.Learn & (1 << usedSkill) && p->Target.Index == client)
- return true;
- else
- {
- NativeFunctions::sendClientMessage(client, "[Tentativa de uso de Skill Hack] Report enviado a Equipe. ");
- Functions::NewLog("Hackers/Buff", "BUFF", "Conta [%s] - Personagem [%s] > Tentando buffar skill Invalido [%d]", User->AccountName, Player->Mob.Name, inf);
- memset(packet, 0, packet->Size);
- return false;
- }
- }
- if (inf == buffFM[i])
- {
- auto usedSkill = p->SkillID - 24;
- if (inf == 45 || inf == 41 || inf == 43 || inf == 44)
- {
- if (Player->Mob.ClassInfo == Foema && Player->Mob.Learn & (1 << usedSkill))
- {
- return true;
- }
- }
- else if (Player->Mob.ClassInfo == Foema && Player->Mob.Learn & (1 << usedSkill) && p->Target.Index == client)
- return true;
- else
- {
- NativeFunctions::sendClientMessage(client, "[Tentativa de uso de Skill Hack] Report enviado a Equipe. ");
- Functions::NewLog("Hackers/Buff", "BUFF", "Conta [%s] - Personagem [%s] > Tentando buffar skill Invalido [%d]", User->AccountName, Player->Mob.Name, inf);
- memset(packet, 0, packet->Size);
- return false;
- }
- }
- if (inf == buffBM[i])
- {
- auto usedSkill = p->SkillID - 48;
- if (Player->Mob.ClassInfo == BeastMaster && Player->Mob.Learn & (1 << usedSkill) && p->Target.Index == client)
- return true;
- else
- {
- NativeFunctions::sendClientMessage(client, "[Tentativa de uso de Skill Hack] Report enviado a Equipe. ");
- Functions::NewLog("Hackers/Buff", "BUFF", "Conta [%s] - Personagem [%s] > Tentando buffar skill Invalido [%d]", User->AccountName, Player->Mob.Name, inf);
- memset(packet, 0, packet->Size);
- return false;
- }
- }
- if (inf == buffHT[i])
- {
- auto usedSkill = p->SkillID - 72;
- if (Player->Mob.ClassInfo == Huntress && Player->Mob.Learn & (1 << usedSkill) && p->Target.Index == client)
- return true;
- else
- {
- NativeFunctions::sendClientMessage(client, "[Tentativa de uso de Skill Hack] Report enviado a Equipe. ");
- Functions::NewLog("Hackers/Buff", "BUFF", "Conta [%s] - Personagem [%s] > Tentando buffar skill Invalido [%d]", User->AccountName, Player->Mob.Name, inf);
- memset(packet, 0, packet->Size);
- return false;
- }
- }
- }
- }
- PlayerGame[client].TimeStamp_Last_Packet = packet->TimeStamp; //salva o Timer
- return true; //faz a TMsrv processar o Ataque.
- }
- }
- else //Ignora o pacote
- {
- ZeroMemory(packet, packet->Size);
- return false;
- }
- }
- #pragma endregion
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement