加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
AntiCheat_walljump.cpp 1.50 KB
一键复制 编辑 原始数据 按行查看 历史
#include "AntiCheat_walljump.h"
#include "CPlayer.h"
#include <algorithm>
AntiCheat_walljump::AntiCheat_walljump(CPlayer* player) : AntiCheat(player, AntiCheatType_walljump)
{
}
bool AntiCheat_walljump::HandleMovement(MovementInfo& MoveInfo, Opcodes opcode, bool cheat)
{
AntiCheat::HandleMovement(MoveInfo, opcode, cheat);
if (!Initialized())
{
AboveAngleCount = 0;
return false;
}
float angle = std::atan2(GetDistanceZ(), GetDistance2D()) * 180.f / M_PI_F;
if (opcode == MSG_MOVE_FALL_LAND)
{
if (angle > 50.f)
{
if (!cheat && !isFlying() && !isSwimming() && AboveAngleCount && !isTransport())
{
const Position* pos = storedMoveInfo.GetPos();
m_Player->TeleportTo(storedMapID, pos->x, pos->y, pos->z, pos->o, TELE_TO_NOT_LEAVE_COMBAT);
if (m_Player->GetSession()->GetSecurity() > SEC_PLAYER)
m_Player->BoxChat << "Jumpclimbing angle: " << angle << "\n";
cheat = true;
}
++AboveAngleCount;
}
else
{
--AboveAngleCount;
SetStoredMoveInfo(false);
}
}
AboveAngleCount = std::max(AboveAngleCount, int8(0));
if (opcode == MSG_MOVE_JUMP)
{
if (!AboveAngleCount)
SetStoredMoveInfo(false);
return SetOldMoveInfo(cheat);
}
if (storedMoveInfo.GetPos()->z > newMoveInfo.GetPos()->z)
AboveAngleCount = 0;
return cheat;
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化