-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path맵 리세마라 매크로.ahk
799 lines (719 loc) · 20.4 KB
/
맵 리세마라 매크로.ahk
1
#SingleInstance force; 스크린샷 관련#Include Gdip_all.ahk; https://github.com/cocobelgica/AutoHotkey-JSON; 자동 업데이트를 위한 스크립트; 전체 사이클에 27분 예상#Include JSON.ahk#Include Jxon.ahkSetWorkingDir %A_ScriptDir%;게임과 상호작용하기 위한 관리자 권한 요청 스크립트full_command_line := DllCall("GetCommandLine", "str")if not (A_IsAdmin or RegExMatch(full_command_line, " /restart(?!\S)")){ try { if A_IsCompiled Run *RunAs "%A_ScriptFullPath%" /restart else Run *RunAs "%A_AhkPath%" /restart "%A_ScriptFullPath%" } ExitApp}GitVersion(User, Repo) { url := "https://api.github.com/repos/" User "/" Repo "/releases/latest" whr := ComObjCreate("WinHttp.WinHttpRequest.5.1") whr.Open("GET", url, false), whr.Send() RegExMatch(whr.ResponseText, "_name\W+\K[^""]+", tag) return tag}GitName(User, Repo) { url := "https://api.github.com/repos/" User "/" Repo "/releases/latest" whr := ComObjCreate("WinHttp.WinHttpRequest.5.1") whr.Open("GET", url, false), whr.Send() RegExMatch(whr.ResponseText, "[""]name[""]:\W+.*draft", Name) return Name}; 상남자특) 하드코딩함Name:= % GitName("deadpixel134", "ugh-they-got-me")Namefilter := SubStr(Name,9,200)Namefilter := SubStr(Namefilter,1,-8)Version := % GitVersion("deadpixel134", "ugh-they-got-me"); !!!!!!!!!!!!!!!!제발 Version은 최신 릴리즈 태그 + 1이야. 업뎃할때 좀 잊어버리지 좀 마라!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!if Version >= 24{ ; UrlDownloadToFile, https://github.com/deadpixel134/ugh-they-got-me/releases/latest/download/package.zip, %A_WorkingDir%\package.zip Msgbox,4, 업데이트가 존재합니다!, 업데이트가 발견되었습니다. 깃허브 페이지를 열고 업데이트를 확인하시겠어요?`n`n간단 업데이트 내용:`n`n%Namefilter% ifMsgBox, Yes { Run https://github.com/deadpixel134/ugh-they-got-me/releases/ exitapp }};GUI 설정gui_title := "DDOL-TAB Assistant"FileCreateDir, logFileCreateDir, screenshotFormatTime date,, yyyy-MM-ddFormatTime time,, HH:mm:ssGui Show, w810 h320, %gui_title%Gui Color, White, WhiteGui Add, Text, w360 h15 +Center, %date% %time%에 실행됨Gui Add, Text, w360 h18 +Center vA, 준비Gui Add, Text, w360 h18 +Center vB, 0 회Gui Add, Text, x20 y140 w100 h18 +Center, 시작 번호Gui Add, Edit, x110 y138 w50 h18 vstart Number, 0Gui Add, Text, x220 y140 w100 h40 +Center, 끝 번호Gui Add, Edit, x310 y138 w50 h18 voffset Number, 50Gui Add, Button, x130 y245 w120 h30, 종료Gui Add, GroupBox, x10 y170 w220 h68, 자동 종료 트리거 설정Gui Add, CheckBox, x20 y210 vError_Shutdown, 진행 중 에러 발생시 트리거`nGui Add, CheckBox, x20 y190 vFinish_Shutdown, 지정된 만큼 진행이 끝나면 트리거`nGui Add, GroupBox, x250 y170 w100 h68, 자동 종료 레벨 설정Gui Add, CheckBox, x260 y190 vGame_Shutdown, 게임 종료`nGui Add, CheckBox, x260 y210 vSystem_shutdown, 시스템 종료`nGui Add, CheckBox, x90 y100 w240 h20 vSound, 시작 완료 효과음 ON/OFF (F1 Only)Gui Add, GroupBox, x380 y20 w160 h180, 단축키 ON/OFFGui Add, CheckBox, x390 y40 vkey_F1, F1`n(새로운 게임 시작)Gui Add, CheckBox, x390 y80 vKey_F2, F2`n(게임 저장 후 나가기)Gui Add, CheckBox, x390 y120 vKey_Ctrl_F1, Ctrl+F1`n(세이브 대량 생성)Gui Add, CheckBox, x390 y160 vKey_Ctrl_F2, Ctrl+F2`n(매크로 재시작)Gui, Add, Link, x360 y220 , <a href="https://github.com/deadpixel134/ugh-they-got-me/releases/">깃허브 링크</a>Gui, Add, Link, x360 y240 , <a href="%A_ScriptDir%\screenshot">클릭시 스크린샷 폴더로 이동</a>Gui, Add, Link, x360 y260 , <a href="%userprofile%\Documents\My Games\They Are Billions\Saves">클릭시 데아빌 세이브 폴더로 이동</a>Gui Add, GroupBox, x560 y20 w120 h110, 세이브 파일 불러오기Gui Add, Text, x560 y50 w120 h70 +Center, 로드할 번호를 입력`n(Ctrl+F3)`n(4자리수 형식)Gui Add, Text, x600 y240 w120 h70 +Center, 데아빌 실행 버튼Gui Add, Button, x560 y260 w200 h40, 실행Gui Add, Edit, x580 y100 w50 h18 vLoad Number, 0050Gui Add, CheckBox, x560 y150 h18 vrelaunch, 매크로 동작 중 데아빌이 꺼지면 재실행Gui Add, CheckBox, x560 y180 h18 vrelaunch2, 200번에 한번씩 데아빌 껐다가 다시켜기guicontrol, , key_F1, 1guicontrol, , key_F2, 1guicontrol, , Key_Ctrl_F1, 1guicontrol, , Key_Ctrl_F2, 1guicontrol, , relaunch, 1guicontrol, , relaunch2, 0FormatTime, CurrentDateTime,, yyyy-MM-dd HH-mmlog_dir = log\%CurrentDateTime% log.txtguicontrol, , Sound, 1current:=0playtime:=0ReturnF1::{GuiControlGet,keyF1,,key_F1,if keyF1=1{ Gui,Submit,nohide ;GUI의 값을 받아옵니다. GuiControl,,A,시작 Send {n} MouseClick, Left, 1637, 538,1 Send {Enter} Send {Enter} sleep 330 Send {Enter} sleep,10000 SetNumLockState , Off load=0 GuiControl,,A,로딩 대기 while load<1 { ;게임 시작 후 우하단 솔져 초상화 찾기 PixelSearch, ,, 1856, 810, 1878, 830, 0xE46C49, 10, Fast RGB ;픽셀 서치를 시작할 지점 X Y 좌표 - 끝 지점 X Y 좌표, RGB값, 오차값, Fast(빠른) RGB(형식) if((ErrorLevel = 0)) { ;게임 시작 후 우하단 솔져 초상화 우측의 숫자 찾기 PixelSearch, ,, 1888, 810, 1902, 830, 0xE3D572, 10, Fast RGB ;픽셀 서치를 시작할 지점 X Y 좌표 - 끝 지점 X Y 좌표, RGB값, 오차값, Fast(빠른) RGB(형식) if((ErrorLevel = 0)) { load++ Send {Pgdn Down} ;축소용 페이지 다운 누르기 sleep,200 send {F4} ;격자맵 sleep,100 Send {Space} ;일시정지 sleep,100 Send {NumLock Down} ;넘락 누르기 sleep,50 Send {numpad7 Down} ;넘패드 7번 누르기 sleep,50 WinActivate They Are Billions Send {numpad1 Down} ;넘패드 1번 누르기 sleep,50 Send {NumLock Up} ;넘락 떼기 sleep,450 Send {Pgdn Up} ;페이지 다운 떼기 GuiControl,,A,시작 완료 } else { sleep, 500 }} } if (Sound=1) { Random,select,1,37 SoundPlay, %select%.mp3 } GuiControl,,A,소리 재생 완료 sleep,100}}return F2::{GuiControlGet,keyF2,,Key_F2,if keyF2=1{ { GuiControl,,A,게임 나가기 send {Esc} sleep,200 MouseClick, Left, 1598, 610,1 playtime := playtime + 1 GuiControl, , B, %playtime% 회 } GuiControl,,A,게임 나가기 완료 }}return^F1::{GuiControlGet,keyCtrlF1,,Key_Ctrl_F1,if keyCtrlF1=1{GuiControlGet,current,,start,GuiControlGet,tries,,offset,GuiControlGet,Game_Shutdown,,Game_Shutdown,GuiControlGet,System_shutdown,,System_shutdown,GuiControlGet,Error_Shutdown,,Error_Shutdown,GuiControlGet,Finish_Shutdown,,Finish_Shutdown,GuiControlGet,relaunch,,relaunch,GuiControlGet,relaunch2,,relaunch2,tries:=tries+1start2:=current;메인화면 검출 시작while current<tries{ WinActivate They Are Billions GuiControl,,A,CTRL+F1 입력됨 load=0 i=0 while load<1 { WinActivate They Are Billions PixelSearch, ,, 1620, 200, 1650, 240, 0xD5AB60, 10, Fast RGB ;픽셀 서치를 시작할 지점 X Y 좌표 - 끝 지점 X Y 좌표, RGB값, 오차값, Fast(빠른) RGB(형식) if((ErrorLevel = 0)) { load=1 timeRecord("","Main menu search success") } else { sleep,500 i++ if(relaunch=1) { if(i=40) {;검출 이슈로 데아빌을 끄고 스팀에서 데아빌 재실행WinClose, They Are Billions sleep, 20000 Run, steam://rungameid/644930 sleep, 40000 } } if(i>50) { Error_Screenshot("Mainscreen search error") timeRecord("","Failed to search the main menu. Press F3 to exit macro or CTRL+F2 to restart macro.") if Error_Shutdown=1 { if Game_Shutdown=1 { WinActivate They Are Billions Game_shutdown() temp2:=current-1 timeRecord(temp2," save file creation failure. Failed to search the main menu. As set by user, closing the game.") } if System_shutdown=1 { System_shutdown() temp2:=current-1 timeRecord(temp2," save file creation failure. Failed to search the main menu. As set by user, shutting down Windows OS.") } } msgbox,메인메뉴 발견 오류. F3을 눌러 매크로를 끄고 재시작해주세요. } } } ;메인 메뉴 검출 후 게임 생성WinActivate They Are Billions GuiControl,,A,시작 Gui,Submit,nohide ;GUI의 값을 받아옵니다. timeRecord(current," Start to creating save file. Keyboard input started.") WinActivate They Are Billions Send {n} WinActivate They Are Billions MouseClick, Left, 1637, 538,1 sleep,300 WinActivate They Are Billions Send {Backspace} WinActivate They Are Billions Send {Backspace} WinActivate They Are Billions Send {Backspace} WinActivate They Are Billions Send {Backspace} firstnumber:=current//1000 temp:=Mod(current,1000) secondnumber:=temp//100 temp:=Mod(current,100) thirdnumber:=temp//10 fourthnumber:=Mod(current,10) WinActivate They Are Billions Send {%firstnumber%} WinActivate They Are Billions Send {%secondnumber%} WinActivate They Are Billions Send {%thirdnumber%} WinActivate They Are Billions Send {%fourthnumber%} WinActivate They Are Billions Send {Enter} WinActivate They Are Billions Send {Enter} WinActivate They Are Billions Send {Enter} WinActivate They Are Billions Send {Enter} sleep 400 WinActivate They Are Billions Send {Enter} WinActivate They Are Billions Send {Enter} sleep,9500 SetNumLockState , Off load=0 i=0 GuiControl,,A,로딩 대기 while load<1 { WinActivate They Are Billions ;게임 시작 후 우하단 솔져 초상화 찾기 PixelSearch, ,, 1856, 810, 1878, 830, 0xE46C49, 10, Fast RGB ;픽셀 서치를 시작할 지점 X Y 좌표 - 끝 지점 X Y 좌표, RGB값, 오차값, Fast(빠른) RGB(형식) if((ErrorLevel = 0)) { ;게임 시작 후 우하단 솔져 초상화 우측의 숫자 찾기 PixelSearch, ,, 1888, 810, 1902, 830, 0xE3D572, 10, Fast RGB ;픽셀 서치를 시작할 지점 X Y 좌표 - 끝 지점 X Y 좌표, RGB값, 오차값, Fast(빠른) RGB(형식) if((ErrorLevel = 0)) { load++ WinActivate They Are Billions Send {Pgdn Down} ;축소용 페이지 다운 누르기 sleep,110 WinActivate They Are Billions send {F4} ;격자맵 WinActivate They Are Billions Send {Space} ;일시정지 WinActivate They Are Billions Send {NumLock Down} ;넘락 누르기 WinActivate They Are Billions Send {numpad7 Down} ;넘패드 7번 누르기 WinActivate They Are Billions Send {numpad1 Down} ;넘패드 1번 누르기 WinActivate They Are Billions Send {NumLock Up} ;넘락 떼기 WinActivate They Are Billions sleep,250 Send {Pgdn Up} ;페이지 다운 떼기 GuiControl,,A,시작 완료 timeRecord(current," save file's first enviorment setup completed.") } } else { sleep, 300 i++ if(relaunch=1) { if(i=50) {timeRecord("","Failed to find In-game UI. closing the game and relaunching.") WinClose, They Are Billions sleep, 20000 Run, steam://rungameid/644930 sleep, 40000OnetimeStart(current) } } if(i>60) { Error_Screenshot("In-game mainscreen search error") timeRecord(""," Failed to find In-game UI. Press F3 to exit macro or CTRL+F2 to restart macro.") if Error_Shutdown=1 { if Game_Shutdown=1 { WinActivate They Are Billions Game_shutdown() temp2:=current-1 timeRecord(temp2," Failed to find In-game UI. As set by user, closing the game.") } if System_shutdown=1 { System_shutdown() temp2:=current-1 timeRecord(temp2," Failed to find In-game UI. As set by user, shutting down Windows OS.") } } msgbox,게임 진입 후 솔져 초상화 발견 오류. F3을 눌러 매크로를 끄고 재시작해주세요. } } } sleep,300 test:=current WinActivate They Are Billions Screenshot(test) timeRecord(current," save file's screenshot creation success") sleep,1500 GuiControl,,A,게임 나가기 Loop, 3 { WinActivate They Are Billions send {Esc} sleep,200 WinActivate They Are Billions MouseClick, Left, 1598, 610,1 sleep,200 WinActivate They Are Billions MouseClick, Left, 1598, 610,1 sleep,100 } timeRecord(current," save file creation success.") current:=current+1 playtime := playtime + 1 GuiControl, , B, %playtime% 회 GuiControl,,A,게임 나가기 완료 sleep,9000if Finish_Shutdown=1{ if Game_Shutdown=1 { WinActivate They Are Billions Game_shutdown() temp2:=current-1 timeRecord(temp2," save file creation completed. As set by user, closing the game.") } if System_shutdown=1 { System_shutdown() temp2:=current-1 timeRecord(temp2," save file creation completed. As set by user, shutting down Windows OS.") }}t_start:=current-start2t_start2:=Mod(t_start,200)if(relaunch2=1){if(t_start2=0){;200번에 한번씩 데아빌을 끄고 스팀에서 데아빌 재실행WinClose, They Are Billions sleep, 20000 Run, steam://rungameid/644930 sleep, 40000}}}}}return ^F2::{GuiControlGet,keyCtrlF2,,Key_Ctrl_F2,if keyCtrlF2=1 { timeRecord("","User pressed F2. Restarting macro.") Reload }}returnF3:: { timeRecord("","User pressed F3. Closing macro.") 매크로시작 := false ExitApp }return^F3::{GuiControlGet,Load,,Load,savelocation=%userprofile%\Documents\My Games\They Are Billions\Saves\sav1=.zxsavsav2=.zxcheckif FileExist(savelocation Load sav1){FileGetTime, OutputVar, %savelocation%%Load%%sav1%,OutputVar=% A_Now-OutputVarif OutputVar<10000{ Msgbox,4, 아까 했던거 아님?, 입력하신 %Load%.zxsav는 1시간 이전에 수정된 파일입니다. 정말로 로드하시겠어요? ifMsgBox, Yes { continue=1 } else { continue=0 }}if continue=1{FileSetTime, %A_Now%, %savelocation%%Load%%sav1%,,,FileSetTime, %A_Now%, %savelocation%%Load%%sav2%,,, WinActivate They Are Billionssleep, 1000load=0 while load<1 { PixelSearch, ,, 1620, 200, 1650, 240, 0xD5AB60, 10, Fast RGB ;픽셀 서치를 시작할 지점 X Y 좌표 - 끝 지점 X Y 좌표, RGB값, 오차값, Fast(빠른) RGB(형식) if((ErrorLevel = 0)) { load=1 timeRecord("","메인 메뉴 검출 성공") } else { sleep,500 i++if(i>40){ Error_Screenshot("Mainscreen search error")timeRecord("","메인메뉴 발견 오류. F3을 눌러 매크로를 끄고 재시작해주세요.") }}}Send {c}sleep, 2000Send {Enter}Send {Enter}Send {Enter}sleep, 8000 SetNumLockState , Off load=0 i=0 GuiControl,,A,로딩 대기 while load<1 { ;게임 시작 후 우하단 솔져 초상화 찾기 PixelSearch, ,, 1856, 810, 1878, 830, 0xE46C49, 10, Fast RGB ;픽셀 서치를 시작할 지점 X Y 좌표 - 끝 지점 X Y 좌표, RGB값, 오차값, Fast(빠른) RGB(형식) if((ErrorLevel = 0)) { ;게임 시작 후 우하단 솔져 초상화 우측의 숫자 찾기 PixelSearch, ,, 1888, 810, 1902, 830, 0xE3D572, 10, Fast RGB ;픽셀 서치를 시작할 지점 X Y 좌표 - 끝 지점 X Y 좌표, RGB값, 오차값, Fast(빠른) RGB(형식) if((ErrorLevel = 0)) { load++ send {F4} ;격자맵 Send {NumLock Down} ;넘락 누르기 Send {numpad7 Down} ;넘패드 7번 누르기 Send {numpad1 Down} ;넘패드 7번 누르기 Send {NumLock Up} ;넘락 떼기 GuiControl,,A,시작 완료 } else { sleep, 500 i++ if(i>50) { Error_Screenshot("In-game mainscreen search error") timeRecord("","게임 진입 후 솔져 초상화 발견 오류. F3을 눌러 매크로를 끄고 재시작해주세요.") if Error_Shutdown=1 { if Game_Shutdown=1 { Game_shutdown() temp2:=current-1 timeRecord(temp2,"게임 진입 후 솔져 초상화 발견 오류. 설정값에 따라 게임을 종료합니다.") } if System_shutdown=1 { System_shutdown() temp2:=current-1 timeRecord(temp2,"게임 진입 후 솔져 초상화 발견 오류. 설정값에 따라 PC를 종료합니다.") } } msgbox,게임 진입 후 솔져 초상화 발견 오류. F3을 눌러 매크로를 끄고 재시작해주세요. } }}}}}else{Msgbox, 세이브 파일을 찾을 수 없습니다!}}return!F1:: { Send {NumLock Down} ;넘락 누르기 Send {numpad7 Down} ;넘패드 7번 누르기 Send {numpad1 Down} Send {NumLock Up} ;넘락 떼기 timeRecord("","ALT+F1 입력으로 체력바와 전력 현황을 고정시켰습니다.") }return Button종료:{ timeRecord("","버튼 클릭으로 매크로를 종료했습니다.") 매크로시작 := false ExitApp}returnButton실행:{ timeRecord("","버튼 클릭으로 데아빌을 실행했습니다.") Run, steam://rungameid/644930}returnScreenshot(OutFile){ pToken := Gdip_Startup() screen=0|0|%A_ScreenWidth%|%A_ScreenHeight% pBitmap := Gdip_BitmapFromScreen(screen) firstnumber:=OutFile//1000 temp:=Mod(OutFile,1000) secondnumber:=temp//100 temp:=Mod(OutFile,100) thirdnumber:=temp//10 fourthnumber:=Mod(OutFile,10) location = %A_ScriptDir%\screenshot\%firstnumber%%secondnumber%%thirdnumber%%fourthnumber%.jpg Gdip_SaveBitmapToFile(pBitmap, location, 95) Gdip_DisposeImage(pBitmap) Gdip_Shutdown(pToken)}Error_Screenshot(OutFile){ FormatTime, CurrentDateTime,, yyyy-MM-dd HH-mm-ss pToken := Gdip_Startup() screen=0|0|%A_ScreenWidth%|%A_ScreenHeight% pBitmap := Gdip_BitmapFromScreen(screen) location = %A_ScriptDir%\screenshot\%CurrentDateTime% %OutFile% screenshot.jpg Gdip_SaveBitmapToFile(pBitmap, location, 100) Gdip_DisposeImage(pBitmap) Gdip_Shutdown(pToken)};디버그용 F4::;{;}Game_shutdown(){ sleep,1000WinClose, They Are Billions}System_shutdown(){ sleep,1000 shutdown, 12} timeRecord(number,sentence){ global log_dir FileAppend, [%A_Mon%/%A_Mday% %A_Hour%:%A_Min%:%A_Sec%] %number%%sentence%`n, %log_dir% ;메모장 log.txt에 월, 일, 시, 분, 초, 지정 문장 순으로 추가작성됨.}OnetimeStart(current){ WinActivate They Are Billions GuiControl,,A,CTRL+F1 입력됨 load=0 i=0 while load<1 { WinActivate They Are Billions PixelSearch, ,, 1620, 200, 1650, 240, 0xD5AB60, 10, Fast RGB ;픽셀 서치를 시작할 지점 X Y 좌표 - 끝 지점 X Y 좌표, RGB값, 오차값, Fast(빠른) RGB(형식) if((ErrorLevel = 0)) { load=1 timeRecord("","메인 메뉴 검출 성공") } else { sleep,500 i++ if(relaunch=1) { if(i=40) {;검출 이슈로 데아빌을 끄고 스팀에서 데아빌 재실행WinClose, They Are Billions sleep, 15000 Run, steam://rungameid/644930 sleep, 35000 } } if(i>50) { Error_Screenshot("Mainscreen search error") timeRecord("","메인메뉴 발견 오류. F3을 눌러 매크로를 끄고 재시작해주세요.") if Error_Shutdown=1 { if Game_Shutdown=1 { WinActivate They Are Billions Game_shutdown() temp2:=current-1 timeRecord(temp2,"번 세이브 파일을 생성 시도하는 과정에서 메인 메뉴를 발견하지 못하여 설정값에 따라 게임을 종료합니다.") } if System_shutdown=1 { System_shutdown() temp2:=current-1 timeRecord(temp2,"번 세이브 파일을 생성 시도하는 과정에서 메인 메뉴를 발견하지 못하여 설정값에 따라 PC를 종료합니다.") } } msgbox,메인메뉴 발견 오류. F3을 눌러 매크로를 끄고 재시작해주세요. } } } ;메인 메뉴 검출 후 게임 생성WinActivate They Are Billions GuiControl,,A,시작 Gui,Submit,nohide ;GUI의 값을 받아옵니다. timeRecord(current,"번 세이브 파일을 생성합니다.") WinActivate They Are Billions Send {n} WinActivate They Are Billions MouseClick, Left, 1637, 538,1 sleep,300 WinActivate They Are Billions Send {Backspace} WinActivate They Are Billions Send {Backspace} WinActivate They Are Billions Send {Backspace} WinActivate They Are Billions Send {Backspace} firstnumber:=current//1000 temp:=Mod(current,1000) secondnumber:=temp//100 temp:=Mod(current,100) thirdnumber:=temp//10 fourthnumber:=Mod(current,10) WinActivate They Are Billions Send {%firstnumber%} WinActivate They Are Billions Send {%secondnumber%} WinActivate They Are Billions Send {%thirdnumber%} WinActivate They Are Billions Send {%fourthnumber%} WinActivate They Are Billions Send {Enter} WinActivate They Are Billions Send {Enter} sleep 400 WinActivate They Are Billions Send {Enter} sleep,9500 SetNumLockState , Off}