모바게님의 sendclick과 imagesearcher함수를 조금 수정해서 사용한 조잡스런 쫄교체입니다.
해상도는 600x400 기준이고
방식은 영웅을 누르면 나오는 큰 레벨 숫자를 체크해서
30인지 확인하고 빼는 방식입니다.
어떤 영웅이든 교체 가능하지만
중복 영웅이 많을시에 굉장한 시간을 잡아먹습니다.
ex) 해피x100
없는 주석처리 할려니 지쳐서 쓰다가 맙니다 ㅜㅜ
Hero_Change:
mttime:=0
num2:=0
num3:=0
num4:=0
;;; 오름순 정렬 & 위로 드래그
SendClick(508,104)
sleep 500
if imgSch2(x,y,480,135,545,160, "hero\up.png")
{
SendClick(x,y)
sleep DelayTime
}
SendDragy(395,260,-150)
sleep 1000
;;; 진형에 따른 팀에 X좌표값
if FORM = 보호진형
{
formX := 130
}
else if FORM = 공격진형
{
formX := 65
}
;; PRIV 는 쫄 수 설정값
if PRIV = 3
{
SendClick(formX,215)
sleep DelayTime
if imgSch2(x,y,415,85,460,115,"hero\30lv.png")
{
if imgSch2(x,y,525,360,570,400,"hero\outteam.png")
{
Lvcount:=Lvcount+1
num2:=0
SendClick(x,y)
sleep DelayTime
}
}
else
{
if imgSch2(x,y,560,25,600,65,"hero\x.png")
{
num2:=1
mttime:=mttime+1
SendClick(x,y)
sleep DelayTime
}
else
{
num2:=0
}
}
}
if PRIV >= 2
{
if PRIV = 2
{
num2:= 1
mttime:=mttime+1
}
SendClick(formX,275)
sleep DelayTime
if imgSch2(x,y,415,85,460,115,"hero\30lv.png")
{
if imgSch2(x,y,525,360,570,400,"hero\outteam.png")
{
Lvcount:=Lvcount+1
num3:=0
SendClick(x,y)
sleep DelayTime
}
}
else
{
if imgSch2(x,y,560,25,600,65,"hero\x.png")
{
num3:=1
mttime:=mttime+1
SendClick(x,y)
sleep DelayTime
}
else
{
num3:=0
}
}
}
if PRIV >= 1
{
if PRIV = 1
{
num2:= 1
num3:= 1
mttime:=mttime+2
}
SendClick(formX,340)
sleep DelayTime
if imgSch2(x,y,415,85,460,115,"hero\30lv.png")
{
if imgSch2(x,y,525,360,570,400,"hero\outteam.png")
{
Lvcount:=Lvcount+1
num4:=0
SendClick(x,y)
sleep DelayTime
}
}
else
{
if imgSch2(x,y,560,25,600,65,"hero\x.png")
{
num4:=1
mttime:=mttime+1
SendClick(x,y)
sleep DelayTime
}
else
{
num4:=0
}
}
}
;;임시배치됬던 영웅이 있다면 30달성 수에서 제외
if temphero != 0
{
Lvcount:=Lvcount-temphero
temphero:= 0
}
if mttime<3
{
gosub,Hero_Mount
}
return
Hero_Mount:
xtime=0
ytime=0
herr=0
tempH=0
if imgSch(x,y,"hero\normhero.png")
{
SendClick(x+5,y+5)
sleep DelayTime
SendDragY(395,260,-150)
sleep 1000
}
loop
{
if xtime=4
{
ytime:=ytime+1
xtime:=0
if ytime=2
{
;;; 한페이지 드래그
SendDragY(395,390,204)
sleep 1000
ytime:=0
}
}
if mttime=3
{
break
}
SendClick(245+(xtime*100),190+(ytime*140))
sleep DelayTime
if imgSch(x,y,"hero\teamcheck.png")
{
if imgSch(x,y,"hero\x.png")
{
SendClick(x,y)
sleep DelayTime
}
xtime+=1
}
else
{
if imgSch2(x,y,415,85,460,115,"hero\30lv.png")
{
tempH := 1
}
if imgSch2(x,y,525,360,570,400,"hero\inteam.png")
{
SendClick(x,y)
sleep DelayTime
if num2=0
{
SendClick(formX,215)
num2:=1
mttime:=mttime+1
gosub,Fail_Check
if herr=1
{
num2:=0
herr:=0
}
else if tempH = 1
{
temphero := temphero+1
}
xtime:=xtime+1
sleep DelayTime
}
else
{
if num3=0
{
SendClick(formX,275)
num3:=1
mttime:=mttime+1
gosub,Fail_Check
if herr=1
{
num3:=0
herr:=0
}
else if tempH = 1
{
temphero := temphero+1
}
xtime:=xtime+1
sleep DelayTime
}
else
{
if num4=0
{
SendClick(formX,340)
num4:=1
mttime:=mttime+1
gosub,Fail_Check
if herr=1
{
num4:=0
herr:=0
}
else if tempH = 1
{
temphero := temphero+1
}
xtime:=xtime+1
sleep DelayTime
}
}?
}
}
}
}
return
Fail_Check:
;;;영웅을 배치했을때 같은속성 실패이미지 체크
sleep 1000
loop?
{
if imgSch2(x,y,35,25,90,60,"hero\fail.png")
{
mttime:=mttime-1
herr:=1
SendClick(x+20,y+20)
sleep DelayTime
break
}
if imgSch(x,y,"hero\heromenu.png")
{
break
}
}
return
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
드래그함수와 이미지서치 함수부분 추가합니다 흐헣
imgSch( ByRef imgX, ByRef imgY, img)
{
WinGetPos, winX, winY, winW, winH, BlueStacks App Player
ImageSearch, oX, oY, winX, winY, winX+winW, winY+winH, *50 %A_ScriptDir%\%img%
If ( ErrorLevel = 0)
{
imgX := oX-winX
imgY := oY-winY
return 1
}
else If ( ErrorLevel = 1){
return 0
}
}
imgSch2( ByRef imgX, ByRef imgY,aX,aY,bX,bY,img)
{
WinGetPos, winX, winY, winW, winH, BlueStacks App Player
ImageSearch, oX, oY, winX+aX, winY+aY, winX+bX, winY+bY, *50 %A_ScriptDir%\%img%
If ( ErrorLevel = 0)
{
imgX := oX-winX
imgY := oY-winY
return 1
}
else If ( ErrorLevel = 1){
return 0
}
}
SendDragY(x,y,dp)
{
SysGet, capH, 4
SysGet, bordW, 32
SysGet, bordH, 33
px:=x-bordW/2
py:=y-bordH/2-capH
p := px|py<<16
PostMessage, 0x201, 0, %p%, , BlueStacks App Player
py:=y-bordH/2-capH-dp
p := px|py<<16
PostMessage, 0x200, 0, %p%, , BlueStacks App Player
PostMessage, 0x202, 0, %p%, , BlueStacks App Player
sleep 300
return
}
개선점 댓글로 달아주시면 감사하겠습니다!!
고생하셨어요