Scroll Test

--[[

+---------------------+

| Made by DonzBox.com |

| operate for iPhone 6+

| ver 2017.08.30      |       

+---------------------+

]]--


CREATETIME="2017-08-30 19:38:51";

adaptResolution(1242, 2208);

adaptOrientation(ORIENTATION_TYPE.PORTRAIT);



--[[ Environment Set ]]---------------------------


-- 터치유휴시간

local ms = 15000.00;


-- End Stage Set

local endStage = 4000;


-- ScreenShot (script no."01"~"05", shot on/off)

local scrShotSet = {"01", true};




--[[ Common Function ]]---------------------------


-- Screenshot

function scrShot(dirName, indicator)

    if scrShotSet[2] then

        if indicator ~= nil and indicator ~= "" then

            indicator = "_"..indicator;

        else

            indicator = "";

        end

        local today = os.date("%m월%d일_%X");

        screenshot("images/"..dirName.."/"..today..indicator..".bmp", nil);

    end

end


function multiTouch1(id1,x1,y1)

    touchDown(id1, x1, y1);

    usleep(ms);

    touchUp(id1, x1, y1);

    usleep(ms);

end

function multiTouch2(id1,x1,y1, id2,x2,y2)

    --[[

    if getColor(x1, y1) == adOkColor or

       getColor(x2, y2) == adOkColor then

        adNoSelect();

    else ]]--

        touchDown(id1, x1, y1);

        touchDown(id2, x2, y2);

        usleep(ms);

        touchUp(id1, x1, y1);

        touchUp(id2, x2, y2);

        usleep(ms);

 -- end

end

function multiTouch3(id1,x1,y1, id2,x2,y2, id3,x3,y3)

    --[[

    if getColor(x1, y1) == adOkColor or

       getColor(x2, y2) == adOkColor or

       getColor(x3, y3) == adOkColor then

        adNoSelect();

    else ]]--

        touchDown(id1, x1, y1);

        touchDown(id2, x2, y2);

        touchDown(id3, x3, y3);

        usleep(ms);

        touchUp(id1, x1, y1);

        touchUp(id2, x2, y2);

        touchUp(id3, x3, y3);

        usleep(ms);

 -- end

end

function multiTouch4(id1,x1,y1, id2,x2,y2, id3,x3,y3, id4,x4,y4)

    --[[

    if getColor(x1, y1) == adOkColor or

       getColor(x2, y2) == adOkColor or

       getColor(x3, y3) == adOkColor or

       getColor(x4, y4) == adOkColor then

        adNoSelect();

    else ]]--

        touchDown(id1, x1, y1);

        touchDown(id2, x2, y2);

        touchDown(id3, x3, y3);

        touchDown(id4, x4, y4);

        usleep(ms);

        touchUp(id1, x1, y1);

        touchUp(id2, x2, y2);

        touchUp(id3, x3, y3);

        touchUp(id4, x4, y4);

        usleep(ms);

 -- end

end


-- Tapping of Monster

function attackOfPet()

    multiTouch3(1, 628.22, 572.90, 2, 628.22, 582.90, 3, 628.22, 592.90);

    multiTouch4(1, 50.00, 626.36, 2, 50.00, 770.22, 3, 785.76, 1155.51, 4, 921.08, 1155.51);

end


function attackOfPetFull()

multiTouch4(1, 608.89, 480.50, 2, 926.88, 767.32, 3, 601.16, 486.34, 4, 179.75, 549.10)

multiTouch4(5, 830.22, 551.02, 6, 287.04, 867.76, 7, 309.27, 582.90, 8, 924.94, 640.84);

multiTouch4(1, 1051.56, 520.13, 2, 245.48, 524.00, 3, 825.39, 1058.95, 4, 897.88, 511.44);

multiTouch4(5, 426.22, 518.21, 6, 230.01, 616.69, 7, 389.49, 631.17, 8, 599.22, 530.74);

multiTouch4(1, 857.29, 649.54, 2, 1079.59, 635.99, 3, 213.58, 493.11, 4, 323.77, 572.28);

multiTouch4(5, 218.42, 750.10, 6, 363.39, 750.30, 7, 219.38, 823.35, 8, 389.49, 807.89);

multiTouch4(1, 591.49, 1006.80, 2, 714.24, 1065.69, 3, 920.11, 1098.54, 4, 1080.55, 1093.72);

multiTouch4(5, 884.35, 970.11, 6, 1034.16, 962.40, 7, 854.39, 886.08, 8, 1027.39, 862.94);

multiTouch4(1, 207.78, 967.21, 2, 376.92, 956.60, 3, 213.58, 1074.39, 4, 352.76, 1071.49);

multiTouch4(5, 857.29, 766.38, 6, 1044.79, 749.94, 7, 1023.53, 1006.80, 8, 203.92, 1051.21);

multiTouch4(1, 60.87, 623.46, 2, 84.07, 914.12, 3, 72.47, 757.69, 4, 106.30, 609.95);

end


-- Tapping of Friends

function attackOfFriends()

multiTouch4(1, 56.04, 520.13, 2, 36.71, 646.64, 3, 103.40, 666.92, 4, 203.92, 647.58);

multiTouch4(5, 31.88, 855.19, 6, 82.14, 862.94, 7, 189.42, 857.14, 8, 196.19, 849.39);

multiTouch4(1, 57.97, 1135.23, 2, 172.99, 1145.84, 3, 265.77, 1141.03, 4, 322.80, 1123.64);

multiTouch4(5, 899.81, 1145.84, 6, 962.64, 1122.67, 7, 1017.73, 1156.46, 8, 1120.18, 1128.46);

multiTouch4(1, 1211.03, 1108.12, 2, 948.14, 895.75, 3, 1018.70, 886.08, 4, 1092.15, 897.67);

multiTouch4(5, 1190.74, 888.98, 6, 1028.36, 648.56, 7, 1135.64, 653.38, 8, 1219.73, 665.94);

multiTouch4(1, 262.88, 1082.13, 2, 1132.75, 527.84, 3, 1058.32, 527.84, 4, 931.71, 550.08);

multiTouch4(5, 250.31, 576.12, 6, 1167.54, 505.64, 7, 1162.71, 602.20, 8, 1192.67, 788.58);

multiTouch4(1, 27.04, 802.09, 2, 1016.76, 855.19, 3, 147.86, 1037.70, 4, 126.60, 790.50);

multiTouch4(5, 1220.70, 625.38, 6, 150.76, 642.76, 7, 989.70, 520.13, 8, 105.33, 516.25);

multiTouch4(1, 1199.44, 383.00, 2, 981.00, 407.16, 3, 205.85, 422.59, 4, 1200.40, 477.64);

multiTouch2(1, 1096.98, 358.88, 2, 312.17, 448.67);

end




--[[ User Function ]]-----------------------------


-- 광고버튼 설정하기

local adNoButton = 16417035; -- (150.00, 1700.00)

local adYesButton = 2728910; -- (1000.00, 1700.00)

function adPopupCancel()

    if getColor(150.00, 1700.00) == adNoButton then

        multiTouch1(9, 150.00, 1700.00);

    end

end

function adPopupAccept()

    if getColor(1000.00, 1700.00) == adYesButton then

        multiTouch1(9, 1000.00, 1700.00);

    end

end


-- 주인공렙업만하기(보이는 리스트 상에서 상→하)↓

--[[ 렙업시 피해야할 색

3158064 2105385 8222838 7170664 7959666 2565679 6249565 ]]--

function friendsLvUpU2D()

    for variable = 1340, 2080, 50 do

        adPopupAccept();

        if getColor(1217.00, variable) ~= 3158064 and getColor(1217.00, variable) ~= 2105385 and getColor(1217.00, variable) ~= 8222838 and getColor(1217.00, variable) ~= 7170664 and getColor(1217.00, variable) ~= 7959666 and getColor(1217.00, variable) ~= 2565679 and getColor(1217.00, variable) ~= 6249565 then

            for push = 1, 4, 1 do

                multiTouch1(1, 1217.00, variable);

            end

        end

    end

    -- 유휴시간

    usleep(ms*10);

end


-- 친구들렙업하기(보이는 리스트 상에서 하→상)

function friendsLvUpD2U()

    local delay = 5;

    for variable = 2080, 1340, -100 do

        -- 친구들랩업 스크롤 중 구매최대 버튼까지 도달시

        if getColor(1217.00, variable) == 5928316 then

            friendsTabScrollLast(2);

            return "scrollLast";

        end

        -- 보스어택활성화

        enableBossAttack();

        -- 광고버튼 설정하기

        adPopupAccept();

        for push = 1, 4, 1 do

            multiTouch1(1, 1217.00, variable);

            -- 유휴시간

            usleep(ms*10*delay);

            attackOfPet();

        end

    end

    -- 유휴시간

    usleep(ms*10);

    return "scrollMiddle";

end


-- 스크롤 1Step하단으로 내리기↓

function friendsTabScrollDn1()

    touchDown(1, 1340, 2040);usleep(ms);

    for variable = 2020, 1960, -7 do

        touchMove(1, 1340, variable);usleep(ms);

    end

    touchUp(1, 1340, 1940);usleep(ms*50);

end

-- 스크롤 1Step상단으로 올리기↑

function friendsTabScrollUp1()

    touchDown(1, 1340, 1940);usleep(ms);

    for variable = 1960, 2020, 26 do

        touchMove(1, 1340, variable);usleep(ms);

    end

    touchUp(1, 1340, 2040);usleep(ms*50);

end

-- 스크롤 4Step 하단으로 내리기↓

function friendsTabScrollDn()

    touchDown(1, 1340, 2060);usleep(ms);

    for variable = 2000, 1500, -16 do

        touchMove(1, 1340, variable);usleep(ms);

    end

    touchUp(1, 1340, 1440);usleep(ms*20);

end

-- 스크롤 4Step 상단으로 올리기↑

function friendsTabScrollUp()

    touchDown(1, 1340, 1440);usleep(ms);

    for variable = 1500, 2000, 16 do

        touchMove(1, 1340, variable);usleep(ms);

    end

    touchUp(1, 1340, 2060);usleep(ms*20);

end

-- 스크롤 최하단으로 내리기↓

function friendsTabScrollLast(cnt)

    for variable = 1, cnt, 1 do

        touchDown(1, 620.49, 1936.68);usleep(ms);

        touchMove(1, 616.62, 1813.10);usleep(ms);

        touchMove(1, 657.22, 1504.09);usleep(ms);

        touchMove(1, 754.83, 1001.01);usleep(ms);

        touchMove(1, 933.64,  371.41);usleep(ms);

        touchUp(1, 1055.42, 60.51);usleep(ms*80);

    end

end

-- 스크롤 최상단으로 올리기↑

function friendsTabScrollFirst(cnt)

    for variable = 1, cnt, 1 do

        touchDown(1, 700, 1400);usleep(ms);

        touchMove(1, 700, 1450);usleep(ms);

        touchMove(1, 700, 1600);usleep(ms);

        touchMove(1, 700, 1800);usleep(ms);

        touchMove(1, 700, 2000);usleep(ms);

        touchMove(1, 700, 2150);usleep(ms);

        touchUp(1, 700, 2200);usleep(ms*80);

    end

end


-- 보스전 상태에서 보스전 비활성화때 보스전으로 들어가기

function enableBossAttack()

    -- 과거 빨강색 : 15691794

    if (getColor(960.00, 60.00) == rgbToInt(70, 85, 88) or getColor(960.00, 60.00) == 15691794)

    and

       getColor(1107.00, 93.00) ~= 16777215 then

        multiTouch1(1, 960.00, 60.00);

    end

end


-- n번 어택 후 보스전 활성화

local bossAttackActive = 0;

local bossAttackActiveCnt = 10;

function enableBossCountAttack()

    -- 보스어택활성화

    if bossAttackActive == 0 then

        enableBossAttack();

        bossAttackActive = bossAttackActiveCnt;

    else bossAttackActive = bossAttackActive -1;

    end

end


-- 친구들리스트탭활성화 (비활성:6422304, 활성:10616662)

function enableFriendsTab()

    for loop = 0, 2, 1 do

        if getColor(312.17, 2181.01) == 6422304 then

            multiTouch1(1, 312.17, 2181.01);

        end

        -- 유휴시간

        usleep(ms*50);

    end

    -- 스크롤 최하단으로 내리기

    friendsTabScrollLast(2);

end


-- 주인공탭활성화 (비활성:12275501, 활성:11653343)

function enableHeroTab()

    for loop = 0, 2, 1 do

        if getColor(94.00, 2157.00) == 12275501 then

            multiTouch1(1, 94.00, 2157.00);

        end

        -- 시작전 유휴시간

        usleep(ms*50);

    end

end



-- 주인공스킬랩업 후 친구들리스트 마지막으로

function heroLvUp(cnt)

    -- 보스어택활성화

    enableBossAttack();

    for loop = 1, cnt, 1 do

        enableHeroTab();

        friendsTabScrollFirst(1);

        friendsTabScrollDn1();

        friendsLvUpU2D();

        -- 스크린샷

        scrShot(scrShotSet[1], "HeroLvUp");

        friendsTabScrollLast(1);

        friendsTabScrollUp1();

        friendsLvUpU2D();

        -- 스크린샷

        scrShot(scrShotSet[1], "HeroLvUp");

    end

    -- 친구들리스트활성화

    enableFriendsTab();

end


-- 클랜전 종료시 빠져나오기

function clanWarClose()

    if getColor(1106.00, 127.00) == 4405296 then

        multiTouch1(1, 1106.00, 127.00);

        -- 클랜전 빠져나오기

        return;

    end

end


-- 환생

function prestige()

    usleep(ms*123); --(ms=15000) about=2000000

    adPopupCancel();

    enableHeroTab();

    friendsTabScrollLast(1);

    -- 확인버튼1 (스크롤 하단버튼)

    multiTouch1(1, 1021.60, 2023.61);

    usleep(ms*123);

    -- 확인버튼2 (확인팝업)

    multiTouch1(1, 583.76, 1673.08);

    usleep(ms*123);

    -- 확인버튼3 (컨펌팝업)

    multiTouch1(1, 864.05, 1457.76);

    usleep(ms*123);

end


-- Dialog Box

function inputDialog()

    local label = {type=CONTROLLER_TYPE.LABEL, text="게임 화면의 Stage를 입력해 주세요."};

    local stageInput = {type=CONTROLLER_TYPE.INPUT, title="Stage:", key="Stage", value="1770"}

    local swordMasterLvUpSwitch = {type=CONTROLLER_TYPE.SWITCH, title="주인공 렙업 부터 하고 시작합니다. 선택하지 않더라도 주인공 레벨이 낮으면 강제렙업이 실행 됩니다.", key="swordMasterLvUp", value=0};

    local prestigeSwitch = {type=CONTROLLER_TYPE.SWITCH, title="마지막 Stage에서 환생 합니다.", key="Prestige", value=1};

    local controls = {label, stageInput, swordMasterLvUpSwitch, prestigeSwitch};

    local enableRemember = false;

dialog(controls, enableRemember);

    -- alert(string.format("Stage:%s, SwordMaster LvUp:%d, Prestige:%d", stageInput.value, swordMasterLvUpSwitch.value, prestigeSwitch.value));


    local returnValue = {s = stageInput.value, m = swordMasterLvUpSwitch.value, p = prestigeSwitch.value};

    return returnValue;

end


function remainLoop(currentStage)

    if currentStage > 4000 then

        currentStage = endStage;

    end

    local remainStage = endStage - currentStage;

    -- friendsLvUpSet(1, 1) 당 19~20stage 진행

    local remainLoopCnt = math.ceil(remainStage/19);

    return remainLoopCnt;

end


-- 친구들 렙업(모든친구=37명, friendsLvUpD2U()=4명_렙업)

function friendsLvUpCtrl(cnt)

    -- 보스어택활성화

    enableBossAttack();

    -- 친구들리스트활성화

    enableFriendsTab();

    -- 스크롤 최하단으로 내리기

    friendsTabScrollLast(2);

    for loop = 0, cnt-1, 1 do

        -- n번 어택 후 보스전 활성화

        enableBossCountAttack();

        -- 친구들리스트탭 활성화

        enableFriendsTab();

        friendsLvUpD2U();

        friendsTabScrollUp();

    end

end

function friendsLvUpSet(scrollCnt, loopCnt)

    for loop = 0, loopCnt, 1 do

        if scrollCnt == 0 then

            -- "모두" 렙업

            friendsLvUpCtrl(10);

        else

            -- "부분" 렙업

            friendsLvUpCtrl(scrollCnt);

        end

    end

end

-- n:4스크롤횟수, x:n의반복횟수, b:다음if실행여부,

-- p:현재Stage로부터 마지막까지 가기위한 대략적 남은 스크롤 횟수

-- r:현재Stage로부터 마지막까지 가기위한 정확한 남은 스크롤 횟수

-- t:스크롤구간 설정으로 인해 부정확해진 남은 스크롤 수의 보정값

function friendsLvUpVal(n, x, b, p, r)

    local t = 0;

    -- 최초1회만 실행됨

    if b == true and n > 0 then t = p - r; end

    friendsLvUpSet(n - t, x);

    return false;

end




--[[ main ]----------------------------------------

01. Scroll => 1 Scroll에는 4명의 친구들이 있음.

02. 4000 Stage에서 환생하면 1762 Stage 부터 시작됨.

   

03. 1 Scroll에 있는 친구들 렙업이 진행될때 19 Stage가 진행.

04. 1762 Stage 시작시 존재하는 34명의 친구들을 활성화 하려면

    9 Scroll이 필요함.

   

05. 1762 Stage 부터 37명 모든 친구들이 활성화 되려면

06. 27 Scroll을 해야하고, 이때의 Stage는 2280.

07. 2280 Stage 부터 94 Scroll 하면  4000 Stage도달함.

   

08. 1762~4000 Stage까지 도달하려면 총 121 Scroll이 필요.

-----------------------------------------------]]--




--[[ 마지막 Stage까지 남은 스크롤 계산

local startStage = inputDialog();

-- 현재 Stage 추출

local m = startStage.m;

local r = remainLoop(tonumber(startStage.s));

alert("현재 Stage가 "..m.."이면 "..endStage.."까지, "..r.." Scroll이 필요합니다.");

]]--




-- 주인공스킬랩업 후 친구들리스트 마지막으로

heroLvUp(1);


-- loop Counter

local friendsLvUpD2ULastCnt = 1;

-- Scroll Counter

local friendsLvUpD2UCnt = 1;


-- 스크린샷

scrShot(scrShotSet[1], "Start");

while true do

    -- 주인공스킬랩업 후 친구들리스트 마지막으로

    if friendsLvUpD2ULastCnt == 6 then

        heroLvUp(1);

    end

    -- Scroll Counter

    friendsLvUpD2UCnt = 1;

    while true do

        if "scrollLast" == friendsLvUpD2U() then

            break;

        end

        -- 스크린샷

        scrShot(scrShotSet[1], friendsLvUpD2ULastCnt.."_"..friendsLvUpD2UCnt);

        friendsLvUpD2UCnt = friendsLvUpD2UCnt + 1;

        friendsTabScrollUp();

    end

    -- 스크린샷

    scrShot(scrShotSet[1], friendsLvUpD2ULastCnt.."_"..friendsLvUpD2UCnt);

    friendsLvUpD2ULastCnt = friendsLvUpD2ULastCnt + 1;

    if friendsLvUpD2ULastCnt == 18 then

        break;

    end

end

 



+ Recent posts