Skip to content
This repository has been archived by the owner on Mar 18, 2020. It is now read-only.

Commit

Permalink
Add custom daily race support.
Browse files Browse the repository at this point in the history
  • Loading branch information
CodeInDreams committed May 19, 2019
1 parent 1857060 commit 8255267
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 9 deletions.
14 changes: 7 additions & 7 deletions Config.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -12,24 +12,24 @@ CAREER_CARS := [5, 6, 4, 7, 10, 12, 13]
; 脚本在哪些时间范围运行,多个时间段用英文逗号分隔,如 00:00-08:00, 09:00-12:15, 13:55-18:30,注意小于10的加0
RUN_TIME_SCOPE = 00:00-23:59
; true/false,默认开启/关闭每日赛事
ENABLE_DAILY_RACE := true
ENABLE_DAILY_RACE := false
; true/false,默认开启/关闭多人赛事
ENABLE_MULTI_PLAYER_RACE := true
; true/false,默认开启/关闭生涯赛事
ENABLE_CAREER_RACE := false

; true/false,默认开启/关闭自定义赛事
ENABLE_CUSTOM_RACE := false
ENABLE_CUSTOM_RACE := true
; special/daily,自定义赛事类型,特殊赛事/每日赛事
CUSTOM_TYPE = special
CUSTOM_TYPE = daily
; 自定义赛事次序,该字段暂不生效
CUSTOM_INDEX = 6
CUSTOM_INDEX = 9
; 自定义赛事票数消耗
CUSTOM_TICKET = 2
; 自定义赛事用车顺序
CUSTOM_CARS := [16, 20]
CUSTOM_CARS := [11, 14]

; 脚本跑第几个多人赛事
MP_RACE_INDEX = 1
MP_RACE_INDEX = 2
; 允许脚本使用每个段位的前几辆车来跑多人
MP_MAX_CARS_PER_LEVEL = 1
MP_MAX_CARS_PER_LEVEL = 2
17 changes: 15 additions & 2 deletions source/A9.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -463,6 +463,14 @@ RunCustomRace() {
}
if (!found)
return
} else {
local customIndex := CUSTOM_INDEX
while (customIndex > 7) {
Swipe(DAILY_CAR_GAP_W * 5 + DAILY_CAR_FEATURE_1_X, DAILY_CAR_FEATURE_1_Y, DAILY_CAR_FEATURE_1_X, DAILY_CAR_FEATURE_1_Y)
customIndex -= 5
}
RandomClick((customIndex - 1) * DAILY_CAR_GAP_W + DAILY_CAR_FEATURE_1_X, DAILY_CAR_FEATURE_1_Y, , DELAY_MIDDLE)
RandomClick((customIndex - 1) * DAILY_CAR_GAP_W + DAILY_CAR_FEATURE_1_X, DAILY_CAR_FEATURE_1_Y, , DELAY_MIDDLE)
}
local carArraySize := CUSTOM_CARS.MaxIndex()
while (tickets >= TICKET_LIMIT && ENABLE_CUSTOM_RACE) {
Expand Down Expand Up @@ -557,6 +565,7 @@ RunDailyRace() ; 每日车辆战利品赛事。只要票>=9,就开始比赛
RunMultiPlayerRace() ; 从A9首页打开并开始多人赛事
{
global
return
flag := true
GoHome()
CheckTime()
Expand Down Expand Up @@ -607,15 +616,19 @@ RunMultiPlayerRace() ; 从A9首页打开并开始多人赛事
maxLevel := 4
Loop %maxLevel%
{
local special := maxLevel = 4 && A_Index = 1
local levelX := MP_LEVEL_X + MP_LEVEL_GAP * (maxLevel - A_Index)
RandomClick(levelX, MP_LEVEL_Y, , DELAY_MIDDLE)
while (A_Index < 3 && !(CheckPixel(MP_CAR_HEAD_1_X, MP_CAR_HEAD_1_Y, MP_CAR_HEAD_1_COLOR) && CheckPixel(MP_CAR_HEAD_2_X, MP_CAR_HEAD_2_Y, MP_CAR_HEAD_2_COLOR)))
RandomClick(levelX, MP_LEVEL_Y, , DELAY_LONG)
while (!special && A_Index < 3 && !(CheckPixel(MP_CAR_HEAD_1_X, MP_CAR_HEAD_1_Y, MP_CAR_HEAD_1_COLOR) && CheckPixel(MP_CAR_HEAD_2_X, MP_CAR_HEAD_2_Y, MP_CAR_HEAD_2_COLOR)))
Sleep DELAY_SHORT
;Swipe(1837, 520, 320, 520)
Loop %MP_MAX_CARS_PER_LEVEL%
{
local relativePos := A_Index
ToolTip 正在检查第%relativePos%辆车
local carX := (relativePos - 1) // 2 * (MP_CAR_GAP_W) + MP_CAR_FIRST_OIL_X
if (special)
carX += 513
local carY := relativePos & 1 = 0 ? MP_CAR_LOWER_OIL_Y : MP_CAR_UPPER_OIL_Y
local oilColor := GetPixel(carX, carY)
local oilR := oilColor & 0xFF
Expand Down

0 comments on commit 8255267

Please sign in to comment.