burningcl/wechat_jump_hack

坐标矫正

Closed this issue · 0 comments

`/**
* 纠正坐标
*
* @param ret
*/
private void calibration(int[] ret) {

    int topX = ret[0];
    int topY = ret[1];

    int leftX = ret[2];
    int leftY = ret[3];

    int rightX = ret[4];
    int rightY = ret[5];


    int min = 40;
    int max = 100;

    if (leftY - topY >= min && leftY - topY <= max) {
        ret[3] = leftY;
        ret[5] = leftY;
    } else if (rightY - topY >= min && rightY - topY <= max) {
        ret[3] = rightY;
        ret[5] = rightY;
    } else {
        ret[3] = (leftY + rightY) / 2;
        ret[5] = (leftY + rightY) / 2;
    }

    min = 50;
    max = 160;
    if ((topX - leftX >= min && topX - leftX <= max) && (rightX - topX >= min && rightX - topX <= max)) {
        //都符合就不修正了
    } else if (topX - leftX >= min && topX - leftX <= max) {
        ret[2] = topX - (topX - leftX);
        ret[4] = topX + (topX - leftX);
    } else if (rightX - topX >= min && rightX - topX <= max) {
        ret[2] = topX - (rightX - topX);
        ret[4] = topX + (rightX - topX);
    } else {
        ret[2] = topX - (Math.abs(topX - leftX) + Math.abs(topX - rightX)) / 2;
        ret[4] = topX + (Math.abs(topX - leftX) + Math.abs(topX - rightX)) / 2;
    }
}`