//use wind or just acceleration
//to do list: portal travel for UA, advanced chest hunt without AD and using guard, BL3 run
boolean usewind = false;
//point between left and right panes - allows to interact with game
//while script running
int firex = 1350;
boolean debugBS = true;
boolean checkSilverBox = true;
int firey = 329;
//1 fire sequence = iter. main cycle count iters
int upgrtimer = 10;//every interval upgrade
int highafter = 0;//high jump after iter
int miniok = 1;//check minions - set to 0 if there no minions
int kopimstart = 200;//if we need to save money from iter
int kopimstop = 450;//to iter. after this iter it will spend money
//again. for expensive purchuases
int enabledP = 0;//enabled portals or not. on early game it is usefull
//to travel throw portals to complete quests
//iters count after that it would ascend
int ascint = 1500;
//just jump if false
boolean bowsequence = true;
//counters for logging
int pcount = 0;
int minicount = 0;
int asctimes = 0;
int pandora = 0;
int x = 360;
int silverCount = 0;
int y = 425;
//old stuff. idk
int frameColor = 2133722;
int d = 0;
int color;
int sunduk = 0;
//main cycle counter
int iter = 0;
int evcount = 0;
int upall = 0;
//for early game - it will upgrade all equip for this iter count.
int upgrhigh = 90;//after that every 200
int finishedevents = 0;
int abs ( int ind){
return ind > 0 ? ind : -ind;
}
boolean checkbljump () {
boolean res = false;
for (int i = 0; i < 50; i++) {
if (
abs(getColor(828 + i, 599) - 15396517) < 3000
||
abs(getColor(828 + i, 560) - 15988428) < 3000
) {
res = true;
break;
}
}
return res;
}
void checkSilver () {
if (checkSilverBox) {
if ((abs(getColor(1336, 32) - 4539718) < 200000 && abs(getColor(1328, 26) - 5057800) < 200000)) {
click(1336, 32);
silverCount++;
}
if (abs(getColor(1548, 32) - 4539718) < 200000 && abs(getColor(1540, 23) - 5057800) < 200000) {
click(1548, 32);
silverCount++;
}
}
}
void logStatusStr () {
log("q=" + quested + " asc=" + asctimes + " port=" + pcount + " mini=" +
minicount + " upall=" + upall + " silver=" + silverCount + " BL=" +
finishedevents + "(" + evcount + ")" + " i=" + iter + "(" + ascint + ")");
}
void showStatusStr () {
showNotification("q=" + quested + " asc=" + asctimes + " port=" + pcount + " mini=" +
minicount + "_______________silver=" + silverCount + " BL=" +
finishedevents + "(" + evcount + ")" + " i=" + iter + "(" + ascint + ")");
}
//BL unlock
void slider () {
int delt = 0;
int blackcolor = getColor(1555, 285);
//checking bonus stage
if (
getColor(415, 248) > 14261354 &&
(71883 == getColor(1205, 283) || 6345 == getColor(1205, 283)) &&
blackcolor != getColor(2000, 285) && blackcolor != getColor(415, 248)
) {
showNotification("bonus");
evcount++;
while (
blackcolor == getColor(1495, 285) && blackcolor != getColor(1940, 285)
&& blackcolor != getColor(355, 248) && delt < 200
) {
swipe(1500, 750 + delt, 798, 750 + delt, 200);
sleep(300);
swipe(858, 750 + delt, 1560, 750 + delt, 200);
sleep(300);
delt = delt + 30;
}
}
}
boolean PixelSearch ( int x1, int y1, int x2, int y2, int col){
return getColor(x1, y1) == col || getColor(x2, y2) == col;
}
void FindPixelUntilFound ( int x1, int y1, int x2, int y2, int col, int
deltasearch){
int dummy = 0;
;
while (abs(getColor(x1, y1) - col) > deltasearch && abs(getColor(x2,
y2) - col) > deltasearch) {
sleep(25);
if (dummy++ > 3000) {
log("fail found pixel");
break;
}
}
//log(" search for "+col+" found "+getColor(x1, y1));
}
boolean BonusStageFail ( int stage){
//old function) works. so
if (getColor(1176, 319) == 6345 && getColor(816, 175) == 9160903
|| 15000000 < getColor(934, 281) &&
334265 == getColor(1180, 317) &&
getColor(1192, 316) == 1 ||
4979736 < getColor(1458, 858) &&
4991735 > getColor(1458, 858) ||
4979736 < getColor(1458, 830) &&
4991735 > getColor(1458, 830) ||
4979736 < getColor(1458, 818) &&
4991735 > getColor(1458, 818)
) {
log("fail bl " + stage);
sleep(1000);
//trying to close anything
for (int dummy = 0; dummy < 5; dummy++) {
click(1458, 640 + dummy * 50);
sleep(200);
return true;
}
}
return false;
}
void BonusStage () {
showNotification("bl 2");
sleep(200);
slider();
//dummy compare - need to fix with SP. didnt check it
boolean SP = false;
int dummy = 0;
while (dummy++ < 400) {
sleep(10);
if (abs(getColor(1095, 101) - 65364) < 1000) {
SP = true;
log("sp found");
break;
}
}
if (SP) {
finishedevents += BonusStageSP();
} else {
finishedevents += BonusStageNSP();
}
logStatusStr();
}
void cSend ( int iPressDelay, int iPostPressDelay){
press(firex, firey, iPressDelay);//
sleep(iPostPressDelay);//
}
int BonusStageNSP () {
// Section 1 sync
FindPixelUntilFound(823, 636, 825, 636, 6253682, 10000);
sleep(320);
//Section 1 start
cSend(110, 1640); //1
cSend(32, 1218); //2
cSend(94, 600);//3
cSend(109, 1828); //4
cSend(63, 640);//5
cSend(47, 688);//6
cSend(78, 1906); //7
cSend(141, 1625); //8
cSend(47, 3187); //9
cSend(47, 734);//10
cSend(47, 750);//11
cSend(78, 1203); //12
cSend(110, 1000); //13
if (BonusStageFail(1)) {
return 0;
}
// Section 1 Collection
cSend(40, 500);
cSend(40, 500);
cSend(40, 500);
cSend(40, 500);
cSend(40, 500);
cSend(40, 500);
if (BonusStageFail(1)) {
return 0;
}
// Section 2 sync
sleep(3000);//collect
cSend(110, 500);
sleep(6500);
int dummy = 0;
while ((getColor(519, 1009) < 15720000 ||
getColor(522, 1008) < 15720000)
&&
dummy++ < 2000) {
sleep(20);
}
sleep(80);
// Section 2 start
cSend(63, 640);//5
cSend(47, 688);//6
cSend(380, 1390); //3
cSend(485, 344); //4
cSend(406, 859); //5
cSend(78, 600); //6
cSend(94, 920); //7
cSend(109, 954); //8
cSend(31, 672); //9
cSend(585, 1390); //10
cSend(484, 297); //11
cSend(406, 859); //12
cSend(78, 600); //13
cSend(94, 920);//14
cSend(109, 954); //15
cSend(31, 672); //16
cSend(585, 1390); //17
cSend(469, 219); //18
cSend(297, 1000); //19
cSend(156, 500); //20
cSend(110, 3000); //21
cSend(360, 2984); //22
cSend(531, 2313); //23
if (BonusStageFail(2)) {
return 0;
}
// Section 2 Collection
cSend(350, 1000);
for (int iX = 1; iX <= 20; iX++) {
click(firex, firey);
sleep(500);
}
if (BonusStageFail(2)) {
return 0;
}
//Stage 3 sync
FindPixelUntilFound(823, 636, 220, 465, 6253682, 12000);
// Section 3 Start
cSend(109, 1203); //1
cSend(31, 641);//2
cSend(47, 1578); //3
cSend(47, 2437); //4
//repeat
cSend(109, 1203); //5
cSend(31, 641);//6
cSend(47, 1578); //7
cSend(47, 2437);//8
//repeat
cSend(109, 1203); //9
cSend(31, 641);//10
cSend(47, 1578); //11
cSend(47, 2437); //12
//repeat
cSend(109, 1203); //13
cSend(31, 641);//14
cSend(47, 5125); //15
if (BonusStageFail(3)) {
return 0;
}
//Section 3 Collection
cSend(900, 200);
for (int iX = 1; iX <= 20; iX++) {
click(firex, firey);
sleep(500);
}
if (BonusStageFail(3)) {
return 0;
}
//Section 4 sync
//wait for spehere
//FindPixelUntilFound(250, 472, 100, 250, 15851726);
int dummy = 0;
while (getColor(592, 587) > 65000 && getColor(592, 600) > 65000 && dummy++ < 12000) {
sleep(10);
}
sleep(150);
//Section 4 Start
/*
cSend(32, 2500); //1
cSend(231, 609);//2
cSend(41, 1375); //3
cSend(41, 1374); //4
cSend(641, 690); //5
cSend(41, 1373); //6
cSend(41, 2500); //7
cSend(31, 809);//8
*/
cSend(41, 1674);//10
cSend(641, 690); //11
cSend(41, 1373); //12
cSend(41, 1374);//10
cSend(641, 690); //11
cSend(41, 1373); //12
cSend(41, 1375); //9
cSend(641, 690); //11
cSend(41, 1373); //12
cSend(41, 1372); //13
cSend(641, 690); //14
cSend(41, 1371); //15
cSend(41, 1372); //13
cSend(641, 690); //14
cSend(41, 1371); //15
// extra jump just in case
cSend(41, 10); //16
//Section 4 Collection
for (int iX = 1; iX <= 23; iX++) {
click(firex, firey);
sleep(500);
}
if (BonusStageFail(4)) {
return 0;
}
return 1;
}
int BonusStageSP () {
//
//Section 1 sync
FindPixelUntilFound(823, 636, 825, 636, 6253682, 10000);
sleep(320);//
//Section 1 start
cSend(94, 1640); //1
cSend(47, 2072); //2
cSend(187, 688); //3
cSend(31, 672); //4
cSend(31, 1700); //5
cSend(94, 1640); //1
cSend(47, 2072); //2
cSend(187, 688); //3
cSend(31, 672);//4
cSend(31, 1700); //5
cSend(94, 5000); //1
if (BonusStageFail(1)) {
return 0;
}
// Section 1 Collection
cSend(40, 2500);
for (int iX = 1; iX <= 19; iX++) {
click(firex, firey);
;
sleep(500);
}
if (BonusStageFail(1)) {
return 0;
}
// Section 2 sync
int dummy = 0;
while ((getColor(519, 1008) < 15720000 ||
getColor(522, 1008) < 15720000)
&&
dummy++ < 2000) {
sleep(20);
}
sleep(120);
// Section 2 start
cSend(156, 719); //1
cSend(47, 687); //2
cSend(360, 1390); //3
cSend(485, 344); //4
cSend(406, 859); //5
cSend(78, 600); //6
cSend(94, 900); //7
cSend(109, 954); //8
cSend(31, 672);//9
cSend(515, 1344); //10
cSend(484, 297);//11
cSend(406, 859);//12
cSend(78, 600);//13
cSend(94, 900);//14
cSend(109, 954); //15
cSend(31, 672);//16
cSend(515, 1344); //17
cSend(469, 219);//18
cSend(297, 1000); //19
cSend(156, 500);//20
cSend(110, 3000); //21
cSend(360, 2984);//22
cSend(531, 2313);//23
if (BonusStageFail(2)) {
return 0;
}
// Section 2 Collection
cSend(350, 1000);
for (int iX = 1; iX <= 20; iX++) {
click(firex, firey);
sleep(500);
}
if (BonusStageFail(2)) {
return 0;
}
//Stage 3 sync
FindPixelUntilFound(823, 636, 220, 465, 6253682, 10000);
// Section 3 Start
cSend(109, 1203); //1
cSend(31, 641);//2
cSend(47, 1200); //3
cSend(10, 3091);//4
//repeat
cSend(109, 1203); //5
cSend(31, 641);//6
cSend(47, 1200); //7
cSend(10, 3091);//8
//repeat
cSend(109, 1203); //9
cSend(31, 641);//10
cSend(47, 1200); //11
cSend(10, 3091);//12
//repeat
cSend(109, 1203); //13
cSend(31, 641);//14
cSend(47, 5125); //15
if (BonusStageFail(3)) {
return 0;
}
//Section 3 Collection
cSend(900, 200);
for (int iX = 1; iX <= 20; iX++) {
click(firex, firey);
sleep(500);
}
if (BonusStageFail(3)) {
return 0;
}
//Section 4 sync
//wait for spehere
//FindPixelUntilFound(250, 472, 100, 250, 15851726);
int dummy = 0;
while (getColor(592, 603) > 65000 && dummy++ < 12000) {
sleep(50);
}
sleep(150);
//Section 4 Start
cSend(32, 2800); //1
cSend(31, 809); //2
cSend(41, 1200); //3
cSend(100, 900); //4
cSend(641, 500); //5
cSend(31, 850);//6
cSend(41, 770);//7
cSend(641, 400); //8
cSend(31, 850);//9
cSend(41, 870);//10
cSend(641, 300); //11
cSend(31, 850);//12
cSend(41, 790);//13
cSend(641, 400); //14
cSend(31, 850);//15
cSend(41, 840);//16
cSend(641, 300); //17
cSend(31, 850); //18
cSend(41, 840); //19
cSend(641, 300); //20
//Section 4 Collection
for (int iX = 1; iX <= 23; iX++) {
click(firex, firey);
sleep(500);
}
if (BonusStageFail(4)) {
return 0;
}
return 1;
}
void fire () {
//speed
if (!usewind && abs(getColor(314, 858) - 16147610) < 1000) {
press(312, 910, 900);
}
click(312, 910);
sleep(20);
//check for popups.
if ((
getColor(1176, 319) == 6345 && getColor(816, 175) == 9160903
|| 15000000 < getColor(934, 281) &&
334265 == getColor(1180, 317) &&
getColor(1192, 316) == 1 ||
4979736 < getColor(1458, 858) &&
4991735 > getColor(1458, 858) ||
4979736 < getColor(1458, 830) &&
4991735 > getColor(1458, 830) ||
4979736 < getColor(1458, 818) &&
4991735 > getColor(1458, 818)
)
) {
sleep(1000);
for (int dummy = 0; dummy < 5; dummy++) {
click(1458, 640 + dummy * 50);
showNotification(" " + dummy);
sleep(200);
}
}
sleep(200);
//
if (bowsequence) {
if (iter > highafter && !checkbljump()) {
sleep(250);
press(firex, firey, 200);
}
sleep(340);
press(firex, firey, 25);
sleep(130);
click(firex, firey);
sleep(100);
click(firex, firey);
sleep(200);
press(firex, firey, 25);
sleep(80);
click(firex, firey);
sleep(200);
for (int ijf = 0; ijf < 6; ijf++) {
click(firex, firey);
sleep(120);
click(firex, firey);
sleep(80);
}
} else {
// else jump
click(firex, firey);
}
}
int quested = 0;
void checkquest () {
click(2200, 863);
sleep(200);
if (getColor(1940, 1013) != 7850972) {
click(1879, 998);
sleep(100);
for (int swipi = 0; swipi < 4; swipi++) {
swipe(1993, 840, 1965, 240, 300);
sleep(200);
}
for (int swipi = 0; swipi < 4; swipi++) {
for (int iupgrader = 0; iupgrader < 4; iupgrader++) {
if (getColor(2323, 840 - 140 * iupgrader)
== 15619549) {
press(2200, 840 - 140 * iupgrader, 100);
sleep(1400);
quested++;
}
}
swipe(1993, 370, 1965, 840, 700);
sleep(400);
}
}
}
startScreenCapture(2);
sleep(100);
color = getColor(554, 41);
long tt = Time.getMillis();
//main cycle - while horizontally! attention! works only in one
//horizontal direction. try rotate phone. home button on right
while (1 == getRotation()) {
if (iter % 100 == 0) {
checkquest();
}
fire();
if ((iter % 10) == 0) {
click(2109, 143);
showStatusStr();
checkSilver();
}
//feature. if scripts vertical floating panel is in the left bottom
//corner - it will shopping automatically. if it is in the left top
//corner - not
if (getColor(192, 889) == 16623955 ||
getColor(192, 889) == 16623954) {
if (iter < kopimstart || iter > kopimstop) {
if ((iter % upgrtimer) == 0) {
click(1630, 979);
sleep(200);
//menu
click(2200, 863);
sleep(200);
//upgr first
click(1772, 999);
sleep(100);
click(1747, 880);
sleep(100);
click(1853, 990);
sleep(200);
click(1630, 979);
sleep(200);
click(1630, 979);
sleep(200);
for (int swipi = 0; swipi < 3; swipi++) {
swipe(1993, 840, 1965, 240, 300);
sleep(200);
}
//first 4 times it will shopping anyway
if (iter < 40 && iter % 10 == 0 ||
getColor(192, 889) != 16623955 && iter % upgrtimer == 0 &&
getColor(192, 889) != 16623954 && iter < 150) {
for (int iupgrader = 0; iupgrader < 4; iupgrader++) {
click(2300, 747 - 140 * iupgrader);
sleep(100);
}
}
click(2233, 747);
sleep(100);
click(1772, 999);
sleep(100);
click(1747, 880);
sleep(100);
click(1747, 880);
sleep(100);
}
if ((iter % 200) == 0 || iter % upgrtimer == 0
&& iter < upgrhigh) {
upall++;
click(1630, 979);
sleep(200);
//menu
click(2200, 863);
sleep(200);
click(1853, 990);
sleep(200);
click(1630, 979);
sleep(200);
click(1630, 979);
sleep(200);
for (int swipi = 0; swipi < 3; swipi++) {
swipe(1993, 840, 1965, 240, 300);
sleep(200);
}
if (1 == 1) {
for (int swipi = 0; swipi < 4; swipi++) {
for (int iupgrader = 0; iupgrader < 4; iupgrader++) {
click(2233, 747 - 140 * iupgrader);
sleep(100);
}
swipe(1993, 340, 1965, 840, 800);
sleep(300);
}
}
click(2233, 747);
sleep(100);
click(1772, 999);
sleep(100);
click(1747, 880);
sleep(100);
click(1747, 880);
sleep(100);
}
}
}
//time to asc
if (iter > ascint) {
iter = 0;
asctimes++;
logStatusStr();
click(274, 90);
sleep(200);
click(262, 998);
sleep(200);
click(260, 840);
sleep(300);
click(1054, 817);
sleep(200);
}
int colorflag = 0;
//enabled portal
if ((iter % 10) == 0 && enabledP == 1) {
if (getColor(2225, 129) == 8191079) {
click(2225, 135);
sleep(300);
click(1110, 846);
sleep(9000);
pcount++;
}
}
//checking minions - works with send all or without it
if (getColor(266, 104) != 1 && getColor(266, 104) < 100) {
//menu
click(266, 107);
sleep(500);
click(249, 994);
sleep(200);
click(465, 994);
sleep(200);
click(249, 994);
sleep(200);
//minions
if (miniok == 1) {
click(676, 1006);
sleep(300);
swipe(1000, 890, 1000, 300, 300);
sleep(200);
//top one
for (int yyy = 0; yyy < 11; yyy++) {
click(1033, 341 + yyy * 50);
sleep(100);
click(1033, 341 + yyy * 50);
sleep(100);
}
swipe(1000, 340, 1000, 890, 300);
sleep(200);
for (int yyy = 0; yyy < 11; yyy++) {
click(1033, 341 + yyy * 50);
sleep(100);
click(1033, 341 + yyy * 50);
sleep(100);
}
}
minicount++;
click(1119, 958);
}
iter++;
color = getColor(x, y);
//BL start
int blackcolor = getColor(1555, 285);
if (
getColor(415, 248) > 14261354 &&
(71883 == getColor(1205, 283) || 6345 == getColor(1205, 283)) &&
blackcolor != getColor(2000, 285) && blackcolor != getColor(415, 248)
) {
showNotification("black");
if (!debugBS) {
BonusStage();
}else{
vibrateCyclically(10);
}
}
//BL END
//chest start
color = getColor(554, 70);
if (color == 14541807 ||
color == 14476015 ||
(4980736 == getColor(1470, 809) && 42621 == getColor(1202, 344))) {
if (4980736 == getColor(1470, 809) && 42621 == getColor(1202, 344)) {
click(1470, 809);
sleep(300);
}
sunduk = 1;
int sunk = 0;
while (sunk < 3) {
sunk++;
for (int j = 0; j < 3; j++) {
if (sunduk == 0) {
break;
}
for (int i = 0; i < 12; i++) {
if (sunduk == 0) {
break;
}
click(452 + 150 * i, 414 + j * 150);
sleep(3000);
color = getColor(1600, 978);
if (color == 4980735 || color == 4980736) {
sunduk = 0;
}
}
sleep(1000);
click(1600, 978);
sleep(1000);
}
}
}
//chest end
}