// #### 字库部分 ####
SetRowsNumber(0)
//注意:每次制作完字库后,需要自行把制作的字库文件添加到脚本“附件”中
SetDictEx(0, “Attachment:mq_soft.txt”)
SetDictEx(1, “Attachment:army_mq_soft.txt”)
SetDictEx 2, “Attachment:troopsfont.txt”
SetDictEx(3, “Attachment:attack_font.txt”)
SetDictEx(4, “Attachment:attack_elixir.txt”)
/*
字库0
ocrchar = Ocr(1080, 97, 1206, 120, “FFFFFF-111111|C4CCC8-060606|EFF1F0-111111”, 0.9)
字库1
ocrchar=Ocr(intX,intY,intX2,intY2,“FFFFFF-111111|F2E7DC-010101|F9F4EE-010101”,0.9)
字库2
ocrchar = Ocr(85, 86, 310, 115, “FFFFFF|FEFCFA-010101|FEFDFC-010101|DCDEDE-010101”, 0.9)
字库3
ocrchar1 = Ocr(63, 89, 175, 114, “CCFBFF-111111|91C2BF-111111”, 0.9)
字库4
ocrchar2 = Ocr(63, 125, 175, 150, “FDE8FF-111111|C2C4CF-111111”, 0.9)
*/
// #### 系统检测变量及程序 ####
Dim OriginalS
// 初始时间
OriginalS = Time()
/*
For 10
ShowMessage “##########################################\n######## 呆呆机器人使用注意事项 ########\n##########################################\n#### 1在呆呆运行前,需要您手动将兵 ####\n#### 营清空。 ####\n#### 2请在呆呆运行前将游戏语言设置 ####\n#### 为简体中文,呆呆不懂除简体中 ####\n#### 文外的其他语言哦。 ####\n#### 3呆呆运行时,请不要进行再操作 ####\n#### 游戏,以避免呆呆犯傻。 ####\n#### 4如需要暂停呆呆,请直接点击停 ####\n#### 止按钮。再次运行呆呆前,需要 ####\n#### 您再次手动清空兵营。 ####\n##########################################\n 偷偷告诉你: \n “呆呆的QQ群号码是 200186446”\n##########################################”
Delay 2000
Next
Delay 2000
*/
Call isScreenReady() // 屏幕分辨率和DPI检测
Call isLoginReady() // 游戏检测
// #### 全局变量 ####
Dim zoomScreenTimes = 3
// 缩放屏幕次数
Dim originalGold = -1, originalElixir = -1, originalDark = -1, originalTrophy = -1
// 初始资源
Dim gold = -1, elixir = -1, dark = -1, trophy = -1
// 资源
Dim dGold = 0, dElixir = 0, dDark = 0, dTrophy = 0
Dim dGoldString, dElixirString, dDarkString, dTrophyString
// 资源差值,字符串
Dim runS = 0, runTimeString = “0 秒”
// 已经运行的秒数,已经运行的时间字符串
Dim pGold = 0, pElixir = 0, pDark = 0
Dim pGoldString, pElixirString, pDarkString
// 预计增长值 每日
Dim multiple = 1
// 倍数
Dim armyBarbarianNumber = 0, armyGiantNumber = 0, armyArcherNumber = 0, armyStateString="-", sumHaveArmySpace, armyCampSpace = 0
// armyBarbarianNumber 类:各兵种数量
// armyStateString 军队概况提示文本
// sumHaveArmySpace 兵营已用空间
// armyCamSpace 兵营总空间
Dim backBarbarian = 60, backGiant = 12, backArcher = 80
// 备用兵 待训练各兵数量
Dim backKinds = 3
// 备用兵 待训练兵种数
Dim backBarbarianN = 2, backGiantN = 3, backArcherN = 1
// 备用兵 训练顺序
Dim goalBarbarian = 60, goalGiant = 12, goalArcher = 80
// 目标兵 待训练各兵数量
Dim goalKinds = 3
// 目标兵 待训练兵种数
Dim goalBarbarianN = 2, goalGiantN = 1, goalArcherN = 3
// 目标兵 训练顺序
Dim dGoalBarbarian = 0, dGoalGiant = 0, dGoalArcher = 0
// 目标并与已有兵数量差值
Dim box = 0// 迭代器
Dim trainFlag = 0
// 练兵标志,为 0 说明没有开始练兵,为 1 说明已经开始练兵
Dim 闪黑选项 = 1
Dim 只打死鱼 = 1
Dim 敌人资源总量最低限制 = 300000
Dim 出战前状态信息
Dim 敌人gold = 0, 敌人elixir = 0, 敌人资源总量 = 0
// ####################
// #### 主循环程序 ####
// ####################
While 1
敌人gold = 0
敌人elixir = 0
敌人资源总量 = 0
If CmpColorEx(“711|554|1FBB6C-111111,713|519|75F4D6-111111”,0.9) = 1 Then
TracePrint 1
Tap 633, 537
Else
TracePrint 0
End If
Call isConnect()
// 断线重连系统(已经验证)
If isMainWindow() > 0 Then
If zoomScreenTimes > 2 Then
zoomScreenTimes = 2
Call zoomScreen()
Else
zoomScreenTimes = zoomScreenTimes + 1
End If
End If
// 缩放屏幕,每2轮缩放一次(已经验证)
If isMainWindow() > 0 Then
If originalGold < 0 Then
originalGold = getGold()
originalElixir = getElixir()
originalDark = getDark()
originalTrophy = getTrophy()
If originalGold < 0 Or originalElixir < 0 Or originalDark < 0 Or originalTrophy < 0 Then
ShowMessage “读取奖杯数量或资源数值失败!”
Delay 1000
End If
End If
End If
// 初始资源记录(已经验证)
If isMainWindow() > 0 Then
Call collectResource()
End If
// 采集资源(已经验证)
trainFlag = 0
// 【未注释】
Rem halfProgram
// 【未注释】
If isMainWindow() > 0 Then
gold = getGold()
elixir = getElixir()
dark = getDark()
trophy = getTrophy()
End If
// 记录资源数据(已经验证)
dGold = gold - originalGold
dElixir = elixir - originalElixir
dDark = dark - originalDark
dTrophy = trophy- originalTrophy
// 计算资源量与初始资源的差值(已经验证)
runS = Time() - OriginalS
runS = runS + 600
// 计算目前时间与初始事件的差值,默认+600s(已经验证)
multiple = CDbl(CDbl(86400) / CDBl(runS))
// 计算预测资源需要乘以初始资源的倍数(已经验证)
pGold = multiple * dGold
pElixir = multiple * dElixir
pDark = multiple * dDark
// 计算预计每日资源收益(已经验证)
For 3
ShowMessage “我是呆呆机器人,这是我统计的信息\n#机器人接管后的数据统计\n 奖杯增减:” & CStr(dTrophy) & " 个\n 金币收益:" & bigNTS(dGold) & " 个\n 圣水收益:" & bigNTS(dElixir) & " 滴\n 暗黑重油收益:" & bigNTS(dDark) & " 滴\n#预计每日收益\n 金币预计:" & bigNTS(CLng(pGold)) & " 个/天\n 圣水预计:" & bigNTS(CLng(pElixir)) & " 滴/天\n 暗黑重油预计:" & bigNTS(CLng(pDark)) & " 滴/天\n#注意:务必在使用机器人前将兵营清空\n#呆呆已经运行 " & timeToStr(Time(), OriginalS) & “了\n#想和呆呆聊天请加群哦(群号:20018 6446)”
Delay 1000
Next
ShowMessage “我是呆呆机器人,这是我统计的信息\n#机器人接管后的数据统计\n 奖杯增减:” & CStr(dTrophy) & " 个\n 金币收益:" & bigNTS(dGold) & " 个\n 圣水收益:" & bigNTS(dElixir) & " 滴\n 暗黑重油收益:" & bigNTS(dDark) & " 滴\n#预计每日收益\n 金币预计:" & bigNTS(CLng(pGold)) & " 个/天\n 圣水预计:" & bigNTS(CLng(pElixir)) & " 滴/天\n 暗黑重油预计:" & bigNTS(CLng(pDark)) & " 滴/天\n#注意:务必在使用机器人前将兵营清空\n#呆呆已经运行 " & timeToStr(Time(), OriginalS) & “了\n#想和呆呆聊天请加群哦(群号:20018 6446)”
Delay 3000
// 屏幕显示状态提示,5s(已经验证)
If isMainWindowButtonEnabled() > 0 Then
Tap 53, 526
Delay 500
End If
// 打开军队概况面板(已经验证)
If isArmyWindow() > 0 Then
armyStateString = “军队概况:” // 提示信息恢复默认
armyBarbarianNumber = getArmyBarbarianNumber()
armyGiantNumber = getArmyGiantNumber()
armyArcherNumber = getArmyArcherNumber()
// 读取军队个数
sumHaveArmySpace = armyBarbarianNumber + armyGiantNumber * 5 + armyArcherNumber
armyCampSpace = readArmyCampSpace()
armyStateString = armyStateString & sumHaveArmySpace & " / " & armyCampSpace
ShowMessage armyStateString
Delay 1000
End If
// 读取军队种类数和个数并显示提示信息(已经验证)
If sumHaveArmySpace >= armyCampSpace Then
Call exitTroopsWindow()
Delay 1000
Goto 出战
End If
// 首次检测兵营是否已满,如果已满,切换至出战,未满,继续
If isArmyWindow() > 0 Then
Tap 463, 44
Delay 1000
End If
// 第一次切换至训练面板
If isTrainTroopsWindow() > 0 Then
Call clearMoreTroops()
End If
// 清除多余的军队
If isTrainTroopsWindow() > 0 Then
Tap 194, 44
Delay 500
End If
// 切换至军队概况面板
If isArmyWindow() > 0 Then
armyStateString = “军队概况:” // 提示信息恢复默认
armyBarbarianNumber = getArmyBarbarianNumber()
If armyBarbarianNumber <> Null Then
ShowMessage "Barbarian: " & armyBarbarianNumber
Delay 500
End If
armyGiantNumber = getArmyGiantNumber()
If armyGiantNumber <> Null Then
ShowMessage "Giant: " & armyGiantNumber
Delay 500
End If
armyArcherNumber = getArmyArcherNumber()
If armyArcherNumber <> Null Then
ShowMessage "Archer: " & armyArcherNumber
Delay 500
End If
// 读取军队个数
sumHaveArmySpace = armyBarbarianNumber + armyGiantNumber * 5 + armyArcherNumber
armyCampSpace = readArmyCampSpace()
armyStateString = armyStateString & sumHaveArmySpace & " / " & armyCampSpace
ShowMessage armyStateString
Delay 1000
End If
// 读取军队种类数和个数并显示提示信息(已经验证)
If isArmyWindow() > 0 Then
Tap 463, 44
Delay 500
End If
// 打开训练面板(已经验证)
If isTrainTroopsWindow() > 0 Then
If sumHaveArmySpace < armyCampSpace Then
// 以下为练目标兵
dGoalBarbarian = goalBarbarian - armyBarbarianNumber
dGoalGiant = goalGiant - armyGiantNumber
dGoalArcher = goalArcher - armyArcherNumber
If dGoalBarbarian < 0 Then
dGoalBarbarian = 0
End If