コード例 #1
0
ファイル: AntiCheat.cpp プロジェクト: Seehub/mangos
// Movement checks
bool AntiCheat::CheckMovement()
{
    if (!GetPlayer()->IsSelfMover() && isActiveMover())
    {
        SetActiveMover(false);
        m_currentMover  = GetPlayer()->GetMover();
        m_MovedLen = 0.0f;
        SetImmune(ANTICHEAT_DEFAULT_DELTA);
    }
    else if (GetPlayer()->IsSelfMover() && !isActiveMover())
    {
        SetActiveMover(true);
        m_currentMover  = ((Unit*)GetPlayer());
        m_MovedLen = 0.0f;
        SetImmune(ANTICHEAT_DEFAULT_DELTA);
    }

    if (GetPlayer()->IsBeingTeleported())
        SetImmune(ANTICHEAT_DEFAULT_DELTA);

    SetLastLiveState(GetPlayer()->getDeathState());

    float delta_x   = GetMover()->GetPositionX() - m_currentmovementInfo->GetPos()->x;
    float delta_y   = GetMover()->GetPositionY() - m_currentmovementInfo->GetPos()->y;
    m_currentDeltaZ = GetMover()->GetPositionZ() - m_currentmovementInfo->GetPos()->z;

    m_currentDelta = sqrt(delta_x * delta_x + delta_y * delta_y);

    m_MovedLen += m_currentDelta;

    return true;
}
コード例 #2
0
ファイル: AntiCheat.cpp プロジェクト: Seehub/mangos
bool AntiCheat::CheckNeeded(AntiCheatCheck checktype)
{
    if (!sWorld.getConfig(CONFIG_BOOL_ANTICHEAT_ENABLE)
            || !GetPlayer()->IsInWorld()
            || GetPlayer()->IsBeingTeleported()
            || GetPlayer()->GetPlayerbotAI()
            || GetPlayer()->GetSession()->GetSecurity() > int32(sWorld.getConfig(CONFIG_UINT32_ANTICHEAT_GMLEVEL)))
        return false;

    if (GetMover()->HasAuraType(SPELL_AURA_MOD_CONFUSE))
        return false;

    AntiCheatCheck checkMainType =  (checktype >= 100) ? AntiCheatCheck(checktype / 100) : checktype;

    switch( checkMainType)
    {
    case CHECK_NULL:
        return false;
        break;
    case CHECK_MOVEMENT:
        if (   GetPlayer()->GetTransport()
                || GetPlayer()->HasMovementFlag(MOVEFLAG_ONTRANSPORT)
                || GetMover()->GetMotionMaster()->GetCurrentMovementGeneratorType() == FLIGHT_MOTION_TYPE
                || GetPlayer()->IsTaxiFlying())
            return false;
        break;
    case CHECK_SPELL:
        break;
    case CHECK_QUEST:
        return false;
        break;
    case CHECK_TRANSPORT:
        if (!isActiveMover())
            return false;
        break;
    case CHECK_DAMAGE:
    case CHECK_ITEM:
    case CHECK_WARDEN:
        break;
    default:
        return false;
    }

    if (checktype < 100 )
        return true;

    switch( checktype)
    {
    case CHECK_MOVEMENT_SPEED:
        if  (GetMover()->HasAura(56266))
            return false;
        break;
    case CHECK_MOVEMENT_FLY:
    case CHECK_MOVEMENT_ZAXIS:
        if (isCanFly() || !GetMover())
            return false;
        break;
    case CHECK_MOVEMENT_WATERWALKING:
        if (!m_currentmovementInfo->HasMovementFlag(MOVEFLAG_WATERWALKING))
            return false;
        break;
    case CHECK_MOVEMENT_TP2PLANE:
        if (GetMover()->GetTransport())
            return false;
        if (m_currentmovementInfo->HasMovementFlag(MovementFlags(MOVEFLAG_SWIMMING | MOVEFLAG_CAN_FLY | MOVEFLAG_FLYING)))
            return false;
        if (GetMover()->HasAura(60068) && GetMover()->GetTerrain()->IsUnderWater(m_currentmovementInfo->GetPos()->x, m_currentmovementInfo->GetPos()->y, m_currentmovementInfo->GetPos()->z-5.0f))
            return false;
        break;
    case CHECK_MOVEMENT_AIRJUMP:
        if (isCanFly() ||
                !isActiveMover() ||
                GetMover()->HasAuraType(SPELL_AURA_FEATHER_FALL) ||
                GetMover()->GetTerrain()->IsUnderWater(m_currentmovementInfo->GetPos()->x, m_currentmovementInfo->GetPos()->y, m_currentmovementInfo->GetPos()->z-5.0f))
            return false;
        break;
    case CHECK_MOVEMENT_TELEPORT:
        if (!isActiveMover() || GetPlayer()->IsBeingTeleported())
            return false;
        break;
    case CHECK_MOVEMENT_FALL:
        if (isCanFly() || !isActiveMover())
            return false;
        break;
    case CHECK_MOVEMENT_MOUNTAIN:
        if (isCanFly() || !isActiveMover())
            return false;
        break;
    default:
        break;
    }

    return true;

}
コード例 #3
0
ファイル: AntiCheat.cpp プロジェクト: sergeev/mangos4
bool AntiCheat::CheckNeeded(AntiCheatCheck checktype)
{
    if (!sWorld.getConfig(CONFIG_BOOL_ANTICHEAT_ENABLE)
            || !GetPlayer()->IsInWorld()
            || !GetPlayer()->GetMap()
            || GetPlayer()->IsBeingTeleported()
            || GetPlayer()->GetPlayerbotAI()
            || GetPlayer()->GetSession()->GetSecurity() > int32(sWorld.getConfig(CONFIG_UINT32_ANTICHEAT_GMLEVEL)))
        return false;

    if (!m_currentConfig->disabledZones.empty())
    {
        uint32 zone, area;
        GetPlayer()->GetZoneAndAreaId(zone,area);
        if (m_currentConfig->disabledZones.find(zone) != m_currentConfig->disabledZones.end())
            return false;
    }

    AntiCheatCheck checkMainType =  (checktype >= 100) ? AntiCheatCheck(checktype / 100) : checktype;

    switch( checkMainType)
    {
    case CHECK_NULL:
        return false;
        break;
    case CHECK_MOVEMENT:
        if (   GetPlayer()->IsOnTransport()
//                || GetPlayer()->HasMovementFlag(MOVEFLAG_ONTRANSPORT)
                || GetPlayer()->IsInUnitState(UNIT_ACTION_CONFUSED)
                || GetPlayer()->IsTaxiFlying())
            return false;
        break;
    case CHECK_SPELL:
        break;
    case CHECK_QUEST:
        return false;
        break;
    case CHECK_TRANSPORT:
        if (!isActiveMover())
            return false;
        break;
    case CHECK_WARDEN:
        if (!sWorld.getConfig(CONFIG_BOOL_ANTICHEAT_WARDEN))
            return false;
        break;
    case CHECK_DAMAGE:
    case CHECK_ITEM:
        break;
    default:
        return false;
    }

    if (checktype < 100 )
        return true;

    switch( checktype)
    {
    case CHECK_MOVEMENT_SPEED:
        if  (GetMover()->HasAura(56266))
            return false;
        break;
    case CHECK_MOVEMENT_FLY:
    case CHECK_MOVEMENT_ZAXIS:
        if (isCanFly() || !GetMover())
            return false;
        break;
    case CHECK_MOVEMENT_WATERWALKING:
        if (!m_currentmovementInfo->HasMovementFlag(MOVEFLAG_WATERWALKING))
            return false;
        break;
    case CHECK_MOVEMENT_TP2PLANE:
        if (GetMover()->IsOnTransport())
            return false;
        if (m_currentmovementInfo->HasMovementFlag(MovementFlags(MOVEFLAG_SWIMMING | MOVEFLAG_CAN_FLY | MOVEFLAG_FLYING)))
            return false;
        if (GetMover()->HasAura(60068) && GetMover()->GetTerrain()->IsUnderWater(m_currentmovementInfo->GetPos()->x, m_currentmovementInfo->GetPos()->y, m_currentmovementInfo->GetPos()->z-5.0f))
            return false;
        break;
    case CHECK_MOVEMENT_AIRJUMP:
        if (isCanFly() ||
                !isActiveMover() ||
                GetMover()->GetTerrain()->IsUnderWater(m_currentmovementInfo->GetPos()->x, m_currentmovementInfo->GetPos()->y, m_currentmovementInfo->GetPos()->z-5.0f))
            return false;
        break;
    case CHECK_MOVEMENT_TELEPORT:
        if (!isActiveMover() || GetPlayer()->IsBeingTeleported())
            return false;
        break;
    case CHECK_MOVEMENT_FALL:
        if (isCanFly() || !isActiveMover())
            return false;
        break;
    case CHECK_MOVEMENT_MOUNTAIN:
        if (isCanFly() || !isActiveMover())
            return false;
        break;
    default:
        break;
    }

    return true;

}