/*
####HEADER AND LIBRARY####
*/
#include ../lib/sojolib.ahk
#include ../lib/Gdip_ImageSearch.ahk
#include ../lib/Gdip.ahk
/*
=====Init=====
*/
SetBatchLines, -1
log_dir = log\battlelog_%A_Year%%A_Mon%%A_Mday%.txt
FileCreateDir, log
/*
간단 세팅
*/
total_num := 20
stop_num := 20
gunsu_num := 6
filed_num := 4
detail_num := 3
Emerge_num := 2
fairy_on := 1
rare_protect := 1
/*
세부 변수 설정
*/
global chk_loop := 0
global robot_rare_preserve := true ;4성, 3성 인형 안감
global minloop := 0
global gunsuloop := 0
global check_reg := 0
global now_num := 0
global loop_num := 7
global first_start := true
global fairy_use := false
global battle_loop := loop_num ;0이 되면 탱커 수복을 시행
global gunsu_loop := 5 ; n회당 군수를 체크
global sell_robot := false ;인형 판매를 결정함
global total_loop := 0
RecordLog(str){
global log_dir
formattime , nowtime,,HH:mm:ss
FileAppend, [%A_Mon%/%A_Mday% %A_Hour%:%A_Min%:%A_Sec%][%str%]`n, %log_dir%
ControlGet, List, List, ,ListBox1, Battle_540x960
loop, parse, list, `n, `r
LBCount:=a_index
if (LBCount > 640)
{
GuiControl,, Logbox, |[%nowtime%]%str%
return
}
;GuiControlGet, LogboxText, , Logbox
;GuiControl,, Logbox, [%nowtime%]`n%str%`n%LogboxText%
GuiControl,, Logbox, [%nowtime%]%str%
controlsend,listbox1,{end}, Battle_540x960
return
}
;debug
/*
//////////GUI///////////
*/
#NoEnv
#SingleInstance Force
SetWorkingDir %A_ScriptDir%
Gui Add, Button, x16 y75 w80 h23 gbtn_stop, 정지(F4)
Gui Add, Button, x16 y104 w80 h23 gbtn_reload, 재시작(F3)
Gui Add, Button, x16 y48 w80 h23 gbtn_start, 시작(F6)
Gui Add, Radio, x16 y128 w100 h18 checked vRS1, 인형 판매 ON
Gui Add, Radio, x16 y148 w100 h18 vRS2, 인형 판매 OFF
if rare_protect = 1
{
Gui Add, Checkbox, x100 y66 w84 h16 checked vrare_box, 고레어 보호
}
else
{
Gui Add, Checkbox, x100 y66 w84 h16 vrare_box, 고레어 보호
}
if fairy_on = 1
{
Gui Add, Checkbox, x100 y48 w68 h16 checked vfairy_box, 증원 요정
}
else
{
Gui Add, Checkbox, x100 y48 w68 h16 vfairy_box, 증원 요정
}
Gui Add, Edit, x16 y21 w24 h23 vDCbox, %total_num% ; Battle_loop_num
Gui Add, Edit, x42 y21 w24 h23 vECbox, %stop_num% ; 돌 횟수
Gui Add, Edit, x68 y21 w24 h23 vFCbox, %gunsu_num% ; 군수 루프값
Gui Add, Text, x16 y0 w84 h21 +0x200, 총수 정지 군수
Gui Add, Text, x100 y0 w84 h21 +0x200, 전역 세부 긴급
Gui Add, Edit, x100 y21 w24 h23 vFiebox, %filed_num%
Gui Add, Edit, x126 y21 w24 h23 vDetbox, %detail_num%
Gui Add, Edit, x152 y21 w24 h23 vEmerbox, %emerge_num%
Gui Add, StatusBar, vg_statbar, 시작 대기
Gui Add, ListBox, x186 y0 w192 h166 vLogbox HWNDhLB
Gui Show, w382 h195, Battle_540x960
Return
GuiEscape:
GuiClose:
ExitApp
/*
====func====
*/
; inbattle을 추가할 땐 stat=0이 붙은 함수들을 모조리 추가해줘야한다.
inbattle(stat=0, tankernum=4){
ib := new in_battle
cs := new check_status
if (stat=432)
{
scrn := 10
}
else if (stat=021)
{
scrn := 6
}
RecordLog("헬리 포트 체크") ;지휘부를 인식 못할때가 있음
ib.click_hport(stat)
loopn := 0
Loop
{
chk_screen()
if (stat_scr = "sel_army")
{
break
}
else ;헬리포트를 못찾을시 화면 축소
{
if(loopn >= 1)
{
screnlarge(scrn)
loopn := 0
}
ib.click_hport(stat)
rsleep(600,900)
}
loopn += 1
}
RecordLog("거지런 딜러 변경") ;가끔 1제대 딜러가 안골라짐
select_army_beggar(tankernum,1)
Loop
{
chk_screen()
if (stat_scr = "inbattle")
{
break
}
}
RecordLog("헬리포트 클릭 체크")
ib.click_hport(stat)
rsleep(600,800)
Loop
{
if(IsImageCheck(ix,iy,"img/scr/scr_armysel.png",50,0))
{
break
}
else
{
ib.click_hport(stat)
}
rsleep(500,600)
}
RecordLog("1제대 체크")
ib.place_army()
Loop
{
chk_screen()
if (stat_scr = "inbattle")
{
break
}
}
RecordLog("지휘부 클릭 체크")
ib.click_hq(stat)
rsleep(600,800)
Loop
{
if(IsImageCheck(ix,iy,"img/scr/scr_armysel.png",50,0))
{
break
}
else
{
ib.click_hq(stat)
}
rsleep(500,600)
}
RecordLog("2제대 체크")
ib.place_army()
Loop
{
chk_screen()
if (stat_scr = "inbattle")
{
break
}
}
RecordLog("작전 시작")
ib.click_operation() ;전투 시작 버튼 클릭
rsleep(3000,3400)
RecordLog("2제대 보급")
ib.click_hq(stat) ;2제대 보급해주기
rsleep(200,400)
RecordLog("지휘부 클릭")
ib.click_hq(stat)
rsleep(400,700)
RecordLog("보급 선택")
ib.click_charge(stat)
rsleep(250,500)
RecordLog("계획 모드 진입")
ib.click_planmode() ;계획 모드 버튼 클릭
rsleep(800,1300)
RecordLog("지휘부까지 선택")
ib.click_planorder(stat) ;지휘부까지 차례로 클릭
RecordLog("턴 종료 체크 시작")
cs.check_turn_end(stat) ;최종 턴 종료 체크
Loop
{
if(IsImageCheck(ix,iy,"img/inbattle/turn_end.png",58,0))
{
rclick(840,510,920,550)
rsleep(250,275)
}
else if (not(IsImageCheck(ix,iy,"img/inbattle/loading.png",58,0)))
{
Loop, 4
{
if (not(IsImageCheck(ix,iy,"img/scr/scr_combat.png",50,0)))
{
rclick(4,400,121,501)
rsleep(100,350)
}
else
{
break
}
}
}
else
{
rsleep(250,275)
}
if(IsImageCheck(ix,iy,"img/scr/scr_combat.png",58,0))
{
break
}
}
}
scrollright(){
rscroll(758,282,827,344,263,151,280,148)
}
scrollleft(){
rscroll(263,151,280,148,758,282,827,344)
}
init_guibox(){
}
/*
=====main=====
*/
F6::
btn_start:
RecordLog("가동 시작")
GuiControl,, g_statbar, 전투 테스트
GuiControlGet,now_num,,ECBox
GuiControlGet,loop_num,,DCBox
GuiControlGet,gunsu_loop,,FCBox
GuiControlGet,fieldn,,Fiebox
GuiControlGet,detailn,,Detbox
GuiControlGet,emergen,,Emerbox
stat := fieldn . detailn . emergen
if(not (stat = 432 or stat = 021))
{
RecordLog("입력되지 않는 주회 전역")
pause
}
str := stat . " 선택"
RecordLog(str)
battle_loop := now_num
/*
*/
GuiControlGet,RS1,,RS1
GuiControlGet,RS2,,RS2
GuiControlGet,fairy_box,,fairy_box
GuiControlGet,rare_box,,rare_box
if (rare_box = 1)
{
RecordLog("3성 이상 인형 보호")
robot_rare_preserve := true
}
else if (rare_box = 0)
{
robot_rare_preserve := false
}
if (fairy_box = 1)
{
RecordLog("증원 요정 가동")
fairy_use := true
}
if (RS1=1)
{
RecordLog("인형 판매 가동")
sell_robot := true
}
else if (RS2=1)
{
RecordLog("인형 비판매")
sell_robot := false
}
/*
*/
Loop
{
GuiControl,, g_statbar, 회복까지: %battle_loop% 군수까지: %gunsu_loop% 총 주회: %total_loop%
;
;전역 입장
if (stat_scr != "sel_combat")
{
Loop
{
chk_screen()
if (stat_scr = "sel_combat")
{
break
}
}
}
chk_enter := enter_battle(fieldn,detailn,emergen)
if (chk_enter = true)
{
;전투 시작
Loop
{
chk_screen()
if (stat_scr = "inbattle")
{
break
}
}
inbattle(stat)
;루프 횟수마다 군수 확인
battle_loop := battle_loop - 1
gunsu_loop := gunsu_loop - 1
total_loop := total_loop + 1
}
GuiControl,, g_statbar, 회복까지: %battle_loop% 군수까지: %gunsu_loop% 총 주회: %total_loop%
if (gunsu_loop = 0)
{
click_return_base()
check_gunsu()
GuiControlGet,gunsu_loop,,FCBox
GuiControlGet,fairy_loop,,fairy_loopbox
}
}
/*
버튼 클릭
*/
btn_anticapt:
return
F3::
btn_reload:
Reload
btn_stop:
F4::
pause
몇시간동안 했는데 아직도 해결 못해서 이렇게 찾아왔습니다.
음.. 너무어렵네여 ㅋㅋㅋㅋㅋㅋㅋㅋ