perf: 日志整合、初始化重写
This commit is contained in:
parent
e6a68e47bf
commit
7fb2fc146d
203
DoroHelper.ahk
203
DoroHelper.ahk
|
@ -14,11 +14,32 @@ colorTolerance := 15
|
||||||
currentVersion := "v1.0.0-beta.2"
|
currentVersion := "v1.0.0-beta.2"
|
||||||
usr := "kyokakawaii"
|
usr := "kyokakawaii"
|
||||||
repo := "DoroHelper"
|
repo := "DoroHelper"
|
||||||
|
MsgBox "目前可能只支持2k分辨率 100%缩放"
|
||||||
;初始化
|
;初始化
|
||||||
title := "ahk_exe nikke.exe"
|
Initialization() {
|
||||||
nikkeID := WinGetIDLast(title)
|
global scrRatio, nikkeID, NikkeX, NikkeY, NikkeW, NikkeH, NikkeWP, NikkeHP
|
||||||
WinGetClientPos &NikkeX, &NikkeY, &NikkeW, &NikkeH, nikkeID
|
; 定义可能的关键词列表(考虑多语言或地区差异)
|
||||||
scrRatio := NikkeW / stdScreenW
|
keywords := ["nikke.exe", "勝利女神:妮姬"]
|
||||||
|
; 遍历所有窗口,匹配关键词
|
||||||
|
for hwnd in WinGetList() {
|
||||||
|
title := WinGetTitle(hwnd)
|
||||||
|
for keyword in keywords {
|
||||||
|
if InStr(title, keyword) {
|
||||||
|
nikkeID := WinGetIDLast(title)
|
||||||
|
WinActivate nikkeID
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
WinGetClientPos &NikkeX, &NikkeY, &NikkeW, &NikkeH, nikkeID
|
||||||
|
WinGetPos &NikkeXP, &NikkeYP, &NikkeWP, &NikkeHP, nikkeID
|
||||||
|
scrRatio := NikkeW / stdScreenW
|
||||||
|
} catch Error {
|
||||||
|
MsgBox "未检测到NIKKE主程序"
|
||||||
|
Pause
|
||||||
|
}
|
||||||
|
}
|
||||||
;颜色判断
|
;颜色判断
|
||||||
IsSimilarColor(targetColor, color) {
|
IsSimilarColor(targetColor, color) {
|
||||||
tr := Format("{:d}", "0x" . substr(targetColor, 3, 2))
|
tr := Format("{:d}", "0x" . substr(targetColor, 3, 2))
|
||||||
|
@ -2204,83 +2225,66 @@ ClickOnHelp(*) {
|
||||||
}
|
}
|
||||||
ClickOnDoro(*) {
|
ClickOnDoro(*) {
|
||||||
WriteSettings()
|
WriteSettings()
|
||||||
title := "勝利女神:妮姬"
|
Initialization()
|
||||||
try {
|
Login() ;登陆到主界面
|
||||||
WinGetClientPos &NikkeX, &NikkeY, &NikkeW, &NikkeH, "勝利女神:妮姬"
|
if g_settings["Shop"] {
|
||||||
} catch as err {
|
if g_settings["CashShop"]
|
||||||
title := "ahk_exe nikke.exe"
|
CashShop()
|
||||||
|
if g_settings["NormalShop"]
|
||||||
|
NormalShop()
|
||||||
|
if g_settings["ArenaShop"]
|
||||||
|
ArenaShop()
|
||||||
|
if g_settings["ScrapShop"]
|
||||||
|
ScrapShop()
|
||||||
|
BackToHall
|
||||||
}
|
}
|
||||||
numNikke := WinGetCount(title) ;多开检测
|
if g_settings["SimulationRoom"] {
|
||||||
if numNikke = 0 {
|
SimulationRoom()
|
||||||
MsgBox "未检测到NIKKE主程序"
|
if g_settings["SimulationOverClock"] ;模拟室超频
|
||||||
Pause
|
SimulationOverClock()
|
||||||
|
BackToHall
|
||||||
}
|
}
|
||||||
loop numNikke {
|
if g_settings["Arena"] {
|
||||||
nikkeID := WinGetIDLast(title)
|
Arena()
|
||||||
WinGetClientPos &NikkeX, &NikkeY, &NikkeW, &NikkeH, nikkeID
|
if g_settings["RookieArena"] ;新人竞技场
|
||||||
global scrRatio
|
RookieArena()
|
||||||
scrRatio := NikkeW / stdScreenW
|
if g_settings["SpecialArena"] ;特殊竞技场
|
||||||
WinActivate nikkeID
|
SpecialArena()
|
||||||
Login() ;登陆到主界面
|
if g_settings["ChampionArena"] ;冠军竞技场
|
||||||
if g_settings["Shop"] {
|
ChampionArena()
|
||||||
if g_settings["CashShop"]
|
BackToHall
|
||||||
CashShop()
|
}
|
||||||
if g_settings["NormalShop"]
|
if g_settings["LoveTalking"]
|
||||||
NormalShop()
|
LoveTalking(g_numeric_settings["NumOfLoveTalking"])
|
||||||
if g_settings["ArenaShop"]
|
if g_settings["Tower"] {
|
||||||
ArenaShop()
|
if g_settings["CompanyTower"]
|
||||||
if g_settings["ScrapShop"]
|
CompanyTower()
|
||||||
ScrapShop()
|
if g_settings["UniversalTower"]
|
||||||
BackToHall
|
UniversalTower()
|
||||||
}
|
BackToHall
|
||||||
if g_settings["SimulationRoom"] {
|
}
|
||||||
SimulationRoom()
|
if g_settings["Interception"]
|
||||||
if g_settings["SimulationOverClock"] ;模拟室超频
|
Interception()
|
||||||
SimulationOverClock()
|
if g_settings["Award"] {
|
||||||
BackToHall
|
if g_settings["OutpostDefence"] ; 使用键名检查 Map
|
||||||
}
|
OutpostDefence()
|
||||||
if g_settings["Arena"] {
|
if g_settings["RankingReward"] ;方舟排名奖励
|
||||||
Arena()
|
RankingReward()
|
||||||
if g_settings["RookieArena"] ;新人竞技场
|
if g_settings["FriendPoint"]
|
||||||
RookieArena()
|
FriendPoint()
|
||||||
if g_settings["SpecialArena"] ;特殊竞技场
|
if g_settings["Mail"]
|
||||||
SpecialArena()
|
Mail()
|
||||||
if g_settings["ChampionArena"] ;冠军竞技场
|
if g_settings["Mission"]
|
||||||
ChampionArena()
|
Mission()
|
||||||
BackToHall
|
if g_settings["Pass"]
|
||||||
}
|
Pass()
|
||||||
if g_settings["LoveTalking"]
|
if g_settings["FreeRecruit"]
|
||||||
LoveTalking(g_numeric_settings["NumOfLoveTalking"])
|
FreeRecruit()
|
||||||
if g_settings["Tower"] {
|
if g_settings["RoadToVillain"]
|
||||||
if g_settings["CompanyTower"]
|
RoadToVillain()
|
||||||
CompanyTower()
|
if g_settings["Cooperate"]
|
||||||
if g_settings["UniversalTower"]
|
Cooperate()
|
||||||
UniversalTower()
|
BackToHall
|
||||||
BackToHall
|
|
||||||
}
|
|
||||||
if g_settings["Interception"]
|
|
||||||
Interception()
|
|
||||||
if g_settings["Award"] {
|
|
||||||
if g_settings["OutpostDefence"] ; 使用键名检查 Map
|
|
||||||
OutpostDefence()
|
|
||||||
if g_settings["RankingReward"] ;方舟排名奖励
|
|
||||||
RankingReward()
|
|
||||||
if g_settings["FriendPoint"]
|
|
||||||
FriendPoint()
|
|
||||||
if g_settings["Mail"]
|
|
||||||
Mail()
|
|
||||||
if g_settings["Mission"]
|
|
||||||
Mission()
|
|
||||||
if g_settings["Pass"]
|
|
||||||
Pass()
|
|
||||||
if g_settings["FreeRecruit"]
|
|
||||||
FreeRecruit()
|
|
||||||
if g_settings["RoadToVillain"]
|
|
||||||
RoadToVillain()
|
|
||||||
if g_settings["Cooperate"]
|
|
||||||
Cooperate()
|
|
||||||
BackToHall
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
MsgBox "Doro完成任务!"
|
MsgBox "Doro完成任务!"
|
||||||
CalculateAndShowSpan()
|
CalculateAndShowSpan()
|
||||||
|
@ -2351,7 +2355,6 @@ SaveSettings(*) {
|
||||||
}
|
}
|
||||||
; 全局设置 Map 对象
|
; 全局设置 Map 对象
|
||||||
global g_settings := Map(
|
global g_settings := Map(
|
||||||
"Debug", 1, ; Debug模式开关
|
|
||||||
"Award", 1, ; 奖励领取总开关
|
"Award", 1, ; 奖励领取总开关
|
||||||
"OutpostDefence", 1, ; 前哨基地收菜
|
"OutpostDefence", 1, ; 前哨基地收菜
|
||||||
"CashShop", 1, ; 付费商店
|
"CashShop", 1, ; 付费商店
|
||||||
|
@ -2450,19 +2453,17 @@ doroGui.SetFont("cred s12 ")
|
||||||
doroGui.Add("Text", "R1", "紧急停止按ctrl + 1 暂停按ctrl + 2")
|
doroGui.Add("Text", "R1", "紧急停止按ctrl + 1 暂停按ctrl + 2")
|
||||||
doroGui.Add("Link", " R1", '<a href="https://github.com/kyokakawaii/DoroHelper">项目地址</a>')
|
doroGui.Add("Link", " R1", '<a href="https://github.com/kyokakawaii/DoroHelper">项目地址</a>')
|
||||||
doroGui.SetFont()
|
doroGui.SetFont()
|
||||||
doroGui.Add("Button", "R1 x+10", "帮助")
|
doroGui.Add("Button", "R1 x+10", "帮助").OnEvent("Click", ClickOnHelp)
|
||||||
.OnEvent("Click", ClickOnHelp)
|
doroGui.Add("Button", "R1 x+10", "检查更新").OnEvent("Click", ClickOnCheckForUpdate)
|
||||||
doroGui.Add("Button", "R1 x+10", "检查更新")
|
BtnClear := doroGui.Add("Button", "R1 x+10", "清空日志").OnEvent("Click", (*) => LogBox.Value := "")
|
||||||
.OnEvent("Click", ClickOnCheckForUpdate)
|
|
||||||
Tab := doroGui.Add("Tab3", "xm") ;由于autohotkey有bug只能这样写
|
Tab := doroGui.Add("Tab3", "xm") ;由于autohotkey有bug只能这样写
|
||||||
Tab.Add(["设置", "任务", "商店", "战斗", "奖励"])
|
Tab.Add(["设置", "任务", "商店", "战斗", "奖励", "日志"])
|
||||||
Tab.UseTab("设置")
|
Tab.UseTab("设置")
|
||||||
doroGui.SetFont("cred s10 Bold")
|
doroGui.SetFont("cred s10 Bold")
|
||||||
doroGui.Add("Text", , "除非你知道自己在做什么,否则不要修改")
|
doroGui.Add("Text", , "除非你知道自己在做什么,否则不要修改")
|
||||||
doroGui.SetFont()
|
doroGui.SetFont()
|
||||||
AddCheckboxSetting(doroGui, "AutoCheckUpdate", "自动检查更新(确保能连上github)", "R1.2")
|
AddCheckboxSetting(doroGui, "AutoCheckUpdate", "自动检查更新(确保能连上github)", "R1.2")
|
||||||
AddCheckboxSetting(doroGui, "SelfClosing", "任务完成后自动关闭程序", "R1.2")
|
AddCheckboxSetting(doroGui, "SelfClosing", "任务完成后自动关闭程序", "R1.2")
|
||||||
AddCheckboxSetting(doroGui, "Debug", "是否显示程序日志", "R1.2")
|
|
||||||
doroGui.Add("Text", , "点击间隔(毫秒)")
|
doroGui.Add("Text", , "点击间隔(毫秒)")
|
||||||
doroGui.Add("DropDownList", "Choose" SleepTimeToLabel(sleepTime), [750, 1000, 1250, 1500, 1750, 2000]).OnEvent("Change", ChangeOnSleepTime)
|
doroGui.Add("DropDownList", "Choose" SleepTimeToLabel(sleepTime), [750, 1000, 1250, 1500, 1750, 2000]).OnEvent("Change", ChangeOnSleepTime)
|
||||||
doroGui.Add("Text", , "色差容忍度")
|
doroGui.Add("Text", , "色差容忍度")
|
||||||
|
@ -2518,23 +2519,13 @@ AddCheckboxSetting(doroGui, "Pass", "通行证收取", "R1.2")
|
||||||
AddCheckboxSetting(doroGui, "FreeRecruit", "活动期间每日免费招募", "R1.2")
|
AddCheckboxSetting(doroGui, "FreeRecruit", "活动期间每日免费招募", "R1.2")
|
||||||
AddCheckboxSetting(doroGui, "RoadToVillain", "德雷克·反派之路", "R1.2")
|
AddCheckboxSetting(doroGui, "RoadToVillain", "德雷克·反派之路", "R1.2")
|
||||||
AddCheckboxSetting(doroGui, "Cooperate", "协同作战摆烂", "R1.2")
|
AddCheckboxSetting(doroGui, "Cooperate", "协同作战摆烂", "R1.2")
|
||||||
Tab.UseTab()
|
Tab.UseTab("日志")
|
||||||
doroGui.Add("Button", "Default w80 xm+100", "DORO!")
|
LogBox := doroGui.Add("Edit", "r20 w250 ReadOnly")
|
||||||
.OnEvent("Click", ClickOnDoro)
|
|
||||||
doroGui.Show()
|
|
||||||
; 添加日志
|
|
||||||
DebugGui := Gui()
|
|
||||||
DebugGui.Title := "程序日志"
|
|
||||||
DebugGui.Opt("+Resize") ; 允许窗口调整大小
|
|
||||||
; 添加多行文本框(带垂直滚动条)
|
|
||||||
LogBox := DebugGui.Add("Edit", "r20 w400 ReadOnly -Wrap +HScroll +VScroll")
|
|
||||||
LogBox.Value := "日志开始...`r`n" ; 初始内容
|
LogBox.Value := "日志开始...`r`n" ; 初始内容
|
||||||
; 添加清空按钮
|
Tab.UseTab()
|
||||||
BtnClear := DebugGui.Add("Button", "x+10", "清空日志")
|
doroGui.Add("Button", "Default w80 xm+100", "DORO!").OnEvent("Click", ClickOnDoro)
|
||||||
BtnClear.OnEvent("Click", (*) => LogBox.Value := "")
|
doroGui.Show()
|
||||||
if g_settings["Debug"] {
|
;添加日志
|
||||||
DebugGui.Show()
|
|
||||||
}
|
|
||||||
AddLog(text, forceOutput := false) { ; 默认参数设为false
|
AddLog(text, forceOutput := false) { ; 默认参数设为false
|
||||||
if (!IsObject(LogBox) || !LogBox.Hwnd) {
|
if (!IsObject(LogBox) || !LogBox.Hwnd) {
|
||||||
return
|
return
|
||||||
|
@ -2549,6 +2540,7 @@ AddLog(text, forceOutput := false) { ; 默认参数设为false
|
||||||
LogBox.Value .= timestamp " - " text "`r`n"
|
LogBox.Value .= timestamp " - " text "`r`n"
|
||||||
SendMessage(0x0115, 7, 0, LogBox) ; 自动滚动到底部
|
SendMessage(0x0115, 7, 0, LogBox) ; 自动滚动到底部
|
||||||
}
|
}
|
||||||
|
;日志的时间戳转换
|
||||||
TimeToSeconds(timeStr) {
|
TimeToSeconds(timeStr) {
|
||||||
; 期望 "HH:mm:ss" 格式
|
; 期望 "HH:mm:ss" 格式
|
||||||
parts := StrSplit(timeStr, ":")
|
parts := StrSplit(timeStr, ":")
|
||||||
|
@ -2618,12 +2610,7 @@ CalculateAndShowSpan(ExitReason := "", ExitCode := "") {
|
||||||
;调试指定函数
|
;调试指定函数
|
||||||
^0:: {
|
^0:: {
|
||||||
;添加基本的依赖
|
;添加基本的依赖
|
||||||
title := "ahk_exe nikke.exe"
|
Initialization()
|
||||||
nikkeID := WinGetIDLast(title)
|
|
||||||
WinGetClientPos &NikkeX, &NikkeY, &NikkeW, &NikkeH, nikkeID
|
|
||||||
WinGetPos &NikkeXP, &NikkeYP, &NikkeWP, &NikkeHP, nikkeID
|
|
||||||
WinMove (A_ScreenWidth / 2) - (NikkeWP / 2), (A_ScreenHeight / 2) - (NikkeHP / 2), 2347 * currentScale, 1350 * currentScale, nikkeID
|
WinMove (A_ScreenWidth / 2) - (NikkeWP / 2), (A_ScreenHeight / 2) - (NikkeHP / 2), 2347 * currentScale, 1350 * currentScale, nikkeID
|
||||||
global scrRatio
|
|
||||||
scrRatio := NikkeW / stdScreenW
|
|
||||||
;下面写要调试的函数
|
;下面写要调试的函数
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue