最近玩了玩天龙八部,玩这个游戏简直就是遭罪,升级非常慢,而且杀怪也很累,纯手工,我都不知道为什么还有那么多人玩。玩到40多级了,实在是受不了,游戏的颜色搭配也是非常的伤眼睛,于是我就想写一个自动打怪的辅助工具得了。

接下来我就花了1天多的时间写了程序。有自动寻怪、自动加血、自动加蓝、自动释放技能、防外挂答题报警(利用Fetion发送短信到手机)。有了这个工具后我就可以挂上,关掉电脑,需要答题的时候就来答一下题。

附上主要代码(有需要代码邮件和我联系吧:pim@263.net):

  1. unit BackMainFrm;
  2. interface
  3. uses
  4. Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  5. Dialogs, ExtCtrls, Menus, GlobalDefs, StdCtrls;
  6. type
  7. TNumItem = record
  8. StartCol: Byte;
  9. EndCol: Byte;
  10. end;
  11. TNumItemAry = array of TNumItem;
  12. TBackMainForm = class(TForm)
  13. MainTray: TTrayIcon;
  14. TrayMenu: TPopupMenu;
  15. SysSetMenuItem: TMenuItem;
  16. ExitSysMenuItem: TMenuItem;
  17. N4: TMenuItem;
  18. TimerFinder: TTimer;
  19. procedure ExitSysMenuItemClick(Sender: TObject);
  20. procedure SysSetMenuItemClick(Sender: TObject);
  21. procedure FormCreate(Sender: TObject);
  22. procedure TimerFinderTimer(Sender: TObject);
  23. procedure FormDestroy(Sender: TObject);
  24. procedure MainTrayClick(Sender: TObject);
  25. private
  26. FSCBitMap: TBitmap;
  27. FNumBitMapAry: array[0..9] of TBitmap;
  28. FCurGamePos: TPoint;
  29. FFightUnixTick: Cardinal;
  30. FIsFighting: Boolean;
  31. FIsNeedAnswerQT: Boolean;
  32. FLastCalcAnswerUnixTick: Cardinal;
  33. FLifeCurrent: Integer;
  34. FMagicCurrent: Integer;
  35. FBBLifeCurrent: Integer;
  36. FPressF1UnixTick: Cardinal;
  37. FPressF2UnixTick: Cardinal;
  38. FPressF3UnixTick: Cardinal;
  39. FPressF4UnixTick: Cardinal;
  40. procedure CreateNumBitmapAry;
  41. procedure LoadNumBitmapAry(const DirPath: string);
  42. procedure DestroyNumBitmapAry;
  43. private
  44. procedure WMHotKey(var Message: TMessage); message WM_HOTKEY;
  45. procedure RegisterHotKeys;
  46. procedure InitializeLifeAndMagicColor;
  47. procedure CalcCurrentPos;
  48. procedure CalcFightState;
  49. procedure CalcLifeAndMagic;
  50. procedure CalcQuestionState;
  51. procedure AutoPressMagicKeys;
  52. function TranslateWinHotKeyToLocal(HotKeyValue: Cardinal): Word;
  53. procedure AnalyseNum(ABitmap: TBitmap; NumAry: TNumItemAry; List: TStringList);
  54. procedure GetNumList(BitMap: TBitmap; var NumAry: TNumItemAry);
  55. public
  56. end;
  57. TBeepThread = class(TThread)
  58. private
  59. FBeepSecs: Integer;
  60. procedure SyncSendFetionMsg;
  61. protected
  62. procedure Execute; override;
  63. public
  64. constructor Create(BeepSecs: Integer);
  65. end;
  66. procedure SendFetionMsg(const Msg: string);
  67. var
  68. BackMainForm: TBackMainForm;
  69. implementation
  70. uses SystemSetFrm, BcConfigMgr, PisConfig, VirtualKeys, FetchWindow, Math,
  71. DateUtils;
  72. {$R *.dfm}
  73. var
  74. BeepThread: TBeepThread = nil;
  75. procedure SendFetionMsg(const Msg: string);
  76. begin
  77. if FetionWindowHandle <> 0 then
  78. begin
  79. ShowWindow(FetionWindowHandle, SW_NORMAL);
  80. SetForegroundWindow(FetionWindowHandle);
  81. SendMessage(FetionInputHandle, WM_SETTEXT, 0, Integer(PChar(Msg)));
  82. Sleep(20);
  83. SendMessage(FetionSendBtnHandle, WM_LBUTTONDOWN, MK_LBUTTON, 0);
  84. Sleep(10);
  85. SendMessage(FetionSendBtnHandle, WM_LBUTTONUP, 0, 0);
  86. ShowWindow(FetionWindowHandle, SW_HIDE);
  87. end;
  88. end;
  89. procedure TBackMainForm.GetNumList(BitMap: TBitmap; var NumAry: TNumItemAry);
  90. procedure FetchStartCol(var LoopVar: Integer; BackColor: Integer);
  91. var
  92. J: Integer;
  93. begin
  94. while (LoopVar < BitMap.Width) do
  95. begin
  96. for J := 0 to BitMap.Height - 1 do
  97. begin
  98. //如果不是背景
  99. if (BitMap.Canvas.Pixels[LoopVar, J] xor BackColor) <> 0 then
  100. begin
  101. Break;
  102. end;
  103. end;
  104. //如果不是背景,则找到字符
  105. if J < BitMap.Height then
  106. Break;
  107. Inc(LoopVar);
  108. end;
  109. end;
  110. procedure FetchEndCol(var LoopVar: Integer; BackColor: Integer);
  111. var
  112. J: Integer;
  113. begin
  114. while (LoopVar < BitMap.Width) do
  115. begin
  116. for J := 0 to BitMap.Height - 1 do
  117. begin
  118. //如果是字符
  119. if (BitMap.Canvas.Pixels[LoopVar, J] xor BackColor) <> 0 then
  120. begin
  121. Break;
  122. end;
  123. end;
  124. //如果不是字符,则找到背景
  125. if J >= BitMap.Height then
  126. Break;
  127. Inc(LoopVar);
  128. end;
  129. end;
  130. var
  131. I: Integer;
  132. BackColor: Integer;
  133. StartCol, EndCol: Byte;
  134. begin
  135. BackColor := BitMap.Canvas.Pixels[0, 0];
  136. I := 0;
  137. while I < BitMap.Width do
  138. begin
  139. FetchStartCol(I, BackColor);
  140. if I >= BitMap.Width then
  141. Break;
  142. StartCol := I;
  143. FetchEndCol(I, BackColor);
  144. if I >= BitMap.Width then
  145. Break;
  146. EndCol := I - 1;
  147. SetLength(NumAry, Length(NumAry) + 1);
  148. NumAry[High(NumAry)].StartCol := StartCol;
  149. NumAry[High(NumAry)].EndCol := EndCol;
  150. end;
  151. end;
  152. procedure TBackMainForm.InitializeLifeAndMagicColor;
  153. begin
  154. if LifeColor = 0 then
  155. LifeColor := FSCBitMap.Canvas.Pixels[LifeX, LifeY];
  156. if MagicColor = 0 then
  157. MagicColor := FSCBitMap.Canvas.Pixels[MagicX, MagicY];
  158. BBLifeColor := LifeColor;
  159. MonsterLifeColor := LifeColor;
  160. end;
  161. procedure TBackMainForm.AnalyseNum(ABitmap: TBitmap; NumAry: TNumItemAry;
  162. List: TStringList);
  163. function SameNum(const NumItem: TNumItem; Num: Integer): Boolean;
  164. var
  165. J, K: Integer;
  166. RealWidth: Integer;
  167. RefIsBgColor, IsBgColor: Boolean;
  168. LRefBgColor, LBgColor: Integer;
  169. begin
  170. Result := True;
  171. RealWidth := NumItem.EndCol - NumItem.StartCol + 1;
  172. if RealWidth > FNumBitMapAry[Num].Width then
  173. RealWidth := FNumBitMapAry[Num].Width;
  174. LRefBgColor := FNumBitMapAry[0].Canvas.Pixels[0, 0];
  175. LBgColor := ABitmap.Canvas.Pixels[0,0];
  176. for J := 0 to RealWidth - 1 do
  177. begin
  178. for K := 0 to 7 do
  179. begin
  180. RefIsBgColor := FNumBitMapAry[Num].Canvas.Pixels[J, K] = LRefBgColor;
  181. IsBgColor := ABitmap.Canvas.Pixels[J + NumItem.StartCol, K] = LBgColor;
  182. // 不相同退出
  183. if RefIsBgColor xor IsBgColor = True then
  184. begin
  185. Result := False;
  186. Exit;
  187. end;
  188. end;
  189. end;
  190. end;
  191. function GetStringNum(const NumItem: TNumItem): string;
  192. var
  193. I: Integer;
  194. begin
  195. Result := '';
  196. for I := 0 to 9 do
  197. begin
  198. if SameNum(NumItem, I) then
  199. begin
  200. Result := IntToStr(I);
  201. Break;
  202. end;
  203. end;
  204. end;
  205. var
  206. I: Integer;
  207. LNumStr, TmpStr: string;
  208. begin
  209. LNumStr := '';
  210. for I := 0 to High(NumAry) do
  211. begin
  212. TmpStr := GetStringNum(NumAry[I]);
  213. if TmpStr <> '' then
  214. begin
  215. LNumStr := LNumStr + TmpStr;
  216. end;
  217. if I < High(NumAry) then
  218. begin
  219. if (NumAry[I+1].StartCol - NumAry[I].EndCol) > 8 then
  220. begin
  221. List.Add(LNumStr);
  222. LNumStr := '';
  223. end;
  224. end;
  225. end;
  226. List.Add(LNumStr);
  227. end;
  228. procedure TBackMainForm.AutoPressMagicKeys;
  229. begin
  230. if PressKeyF1Secs <> 0 then
  231. begin
  232. if (DateTimeToUnix(Now) - FPressF1UnixTick) > PressKeyF1Secs then
  233. begin
  234. MonitorKeyPress([], VK_F1);
  235. FPressF1UnixTick := DateTimeToUnix(Now);
  236. Sleep(10);
  237. end;
  238. end;
  239. if PressKeyF2Secs <> 0 then
  240. begin
  241. if (DateTimeToUnix(Now) - FPressF2UnixTick) > PressKeyF2Secs then
  242. begin
  243. MonitorKeyPress([], VK_F2);
  244. FPressF2UnixTick := DateTimeToUnix(Now);
  245. Sleep(10);
  246. end;
  247. end;
  248. if PressKeyF3Secs <> 0 then
  249. begin
  250. if (DateTimeToUnix(Now) - FPressF3UnixTick) > PressKeyF3Secs then
  251. begin
  252. MonitorKeyPress([], VK_F3);
  253. FPressF3UnixTick := DateTimeToUnix(Now);
  254. Sleep(10);
  255. end;
  256. end;
  257. if PressKeyF4Secs <> 0 then
  258. begin
  259. if (DateTimeToUnix(Now) - FPressF4UnixTick) > PressKeyF4Secs then
  260. begin
  261. MonitorKeyPress([], VK_F4);
  262. FPressF4UnixTick := DateTimeToUnix(Now);
  263. Sleep(10);
  264. end;
  265. end;
  266. end;
  267. procedure TBackMainForm.CalcCurrentPos;
  268. var
  269. LBitMap: TBitmap;
  270. NumAry: TNumItemAry;
  271. StrList: TStringList;
  272. begin
  273. LBitMap := TBitmap.Create;
  274. StrList := TStringList.Create;
  275. try
  276. LBitMap.PixelFormat := pf24bit;
  277. LBitMap.Width := 80;
  278. LBitMap.Height := 8;
  279. LBitMap.Canvas.CopyRect(Rect(0, 0, 80, 8), FSCBitMap.Canvas,
  280. Rect(FSCBitMap.Width-110, 29, FSCBitMap.Width-30, 37));
  281. GetNumList(LBitMap, NumAry);
  282. if Length(NumAry) <= 0 then
  283. Exit;
  284. AnalyseNum(LBitMap, NumAry, StrList);
  285. FCurGamePos.X := StrToInt(StrList[0]);
  286. FCurGamePos.Y := StrToInt(StrList[1]);
  287. finally
  288. StrList.Free;
  289. LBitMap.Free;
  290. end;
  291. end;
  292. procedure TBackMainForm.CalcFightState;
  293. begin
  294. FIsFighting :=
  295. FSCBitMap.Canvas.Pixels[MonsterLifeX, MonsterLifeY] = MonsterLifeColor;
  296. end;
  297. procedure TBackMainForm.CalcLifeAndMagic;
  298. var
  299. I: Integer;
  300. begin
  301. // 初始化数据
  302. InitializeLifeAndMagicColor;
  303. // 计算生命
  304. I := 0;
  305. FLifeCurrent := 0;
  306. while True do
  307. begin
  308. if GetRValue(FSCBitMap.Canvas.Pixels[LifeX+I, LifeY]) <> GetRValue(LifeColor) then
  309. Break;
  310. Inc(I);
  311. Inc(FLifeCurrent);
  312. end;
  313. // 计算魔法
  314. I := 0;
  315. FMagicCurrent := 0;
  316. while True do
  317. begin
  318. if GetBValue(FSCBitMap.Canvas.Pixels[MagicX+I, MagicY]) <> GetBValue(MagicColor) then
  319. Break;
  320. Inc(I);
  321. Inc(FMagicCurrent);
  322. end;
  323. // 计算宝宝生命
  324. I := 0;
  325. FBBLifeCurrent := 0;
  326. while True do
  327. begin
  328. if GetRValue(FSCBitMap.Canvas.Pixels[BBLifeX+I, BBLifeY]) <> GetRValue(BBLifeColor) then
  329. Break;
  330. Inc(I);
  331. Inc(FBBLifeCurrent);
  332. end;
  333. end;
  334. procedure TBackMainForm.CalcQuestionState;
  335. // 判断颜色是否有效
  336. function IsValidPoint(X, Y: Integer): Boolean;
  337. var
  338. AColor: TColor;
  339. begin
  340. AColor := FSCBitMap.Canvas.Pixels[X, Y];
  341. Result := True;
  342. Result := Result and (GetRValue(AColor) >= GetRValue(QT_MIN_COLOR));
  343. Result := Result and (GetGValue(AColor) >= GetGValue(QT_MIN_COLOR));
  344. Result := Result and (GetBValue(AColor) >= GetBValue(QT_MIN_COLOR));
  345. end;
  346. // 判断是否是问题窗口
  347. function IsValidQuestion(X, Y: Integer): Boolean;
  348. begin
  349. Result := True;
  350. Result := Result and IsValidPoint(X+QT_WIDTH, Y);
  351. Result := Result and IsValidPoint(X, Y+QT_HEIGHT);
  352. Result := Result and IsValidPoint(X+QT_WIDTH, Y+QT_HEIGHT);
  353. end;
  354. var
  355. I, J: Integer;
  356. begin
  357. if (DateTimeToUnix(Now) - FLastCalcAnswerUnixTick) < 5 then
  358. Exit;
  359. // 记录最后计算时间
  360. FLastCalcAnswerUnixTick := DateTimeToUnix(Now);
  361. FIsNeedAnswerQT := False;
  362. for I := 0 to (FSCBitMap.Width div 2) - 1 do
  363. begin
  364. for J := 0 to (FSCBitMap.Height div 2) - 1 do
  365. begin
  366. if IsValidPoint(I, J) then
  367. begin
  368. if IsValidQuestion(I, J) then
  369. begin
  370. FIsNeedAnswerQT := True;
  371. Exit;
  372. end;
  373. end;
  374. end;
  375. end;
  376. end;
  377. procedure TBackMainForm.CreateNumBitmapAry;
  378. var
  379. I: Integer;
  380. begin
  381. for I := 0 to 9 do
  382. begin
  383. FNumBitMapAry[I] := TBitmap.Create;
  384. FNumBitMapAry[I].PixelFormat := pf24bit;
  385. end;
  386. end;
  387. procedure TBackMainForm.DestroyNumBitmapAry;
  388. var
  389. I: Integer;
  390. begin
  391. for I := 0 to 9 do
  392. begin
  393. FNumBitMapAry[I].Free;
  394. end;
  395. end;
  396. procedure TBackMainForm.ExitSysMenuItemClick(Sender: TObject);
  397. begin
  398. if Application.MessageBox('确实要退出?', '提示信息',
  399. MB_YESNO + MB_ICONQUESTION) = mrYes  then
  400. begin
  401. Application.Terminate;
  402. end;
  403. end;
  404. procedure TBackMainForm.FormCreate(Sender: TObject);
  405. procedure LoadConfig;
  406. begin
  407. FetionWindowIncText := ConfigMgr.FetionWindowText;
  408. FetionWindowHandle := ConfigMgr.FetionWindowHandle;
  409. FetionInputHandle := ConfigMgr.FetionInputWindowHandle;
  410. FetionSendBtnHandle := ConfigMgr.FetionSendBtnWindowHandle;
  411. end;
  412. begin
  413. FSCBitMap := TBitmap.Create;
  414. FFightUnixTick := 0;
  415. Randomize;
  416. MainTray.Hint := '天龙八部自助打怪 1.0';
  417. LoadConfig;
  418. CreateNumBitmapAry;
  419. LoadNumBitmapAry('./DigitalImages/');
  420. RegisterHotKeys;
  421. FCurGamePos.X := 0;
  422. FCurGamePos.Y := 0;
  423. TimerFinder.Interval := FinderTimerMSec;
  424. end;
  425. procedure TBackMainForm.FormDestroy(Sender: TObject);
  426. begin
  427. FSCBitMap.Free;
  428. DestroyNumBitmapAry;
  429. end;
  430. procedure TBackMainForm.LoadNumBitmapAry(const DirPath: string);
  431. var
  432. I: Integer;
  433. begin
  434. for I := 0 to 9 do
  435. begin
  436. FNumBitMapAry[I].LoadFromFile(Format('%s%d.bmp', [DirPath, I]));
  437. end;
  438. end;
  439. procedure TBackMainForm.MainTrayClick(Sender: TObject);
  440. begin
  441. BackMainForm.Show;
  442. end;
  443. procedure TBackMainForm.RegisterHotKeys;
  444. var
  445. GlobalId: Word;
  446. AModifiers: Cardinal;
  447. begin
  448. AModifiers := MOD_CONTROL + MOD_ALT;;
  449. // 开关 CTRL + ALT + F10
  450. GlobalId := GlobalAddAtom(PChar('HotKey_TLBBHelperF10'));
  451. RegisterHotKey(Self.Handle, GlobalId, AModifiers, VK_F10);
  452. // 设定原点 CTRL + ALT + F11
  453. GlobalId := GlobalAddAtom(PChar('HotKey_TLBBHelperF11'));
  454. RegisterHotKey(Self.Handle, GlobalId, AModifiers, VK_F11);
  455. // 调出设定对话框 CTRL + ALT + F12
  456. GlobalId := GlobalAddAtom(PChar('HotKey_TLBBHelperF12'));
  457. RegisterHotKey(Self.Handle, GlobalId, AModifiers, VK_F12);
  458. // 终止发送报警消息线程 CTRL + ALT + F1
  459. GlobalId := GlobalAddAtom(PChar('HotKey_TLBBHelperF1'));
  460. RegisterHotKey(Self.Handle, GlobalId, AModifiers, VK_F1);
  461. // 发送Fetion测试包 CTRL + ALT + F1
  462. GlobalId := GlobalAddAtom(PChar('HotKey_TLBBHelperF2'));
  463. RegisterHotKey(Self.Handle, GlobalId, AModifiers, VK_F2);
  464. end;
  465. procedure TBackMainForm.SysSetMenuItemClick(Sender: TObject);
  466. var
  467. OldState: Boolean;
  468. begin
  469. if TSystemSetForm.IsExist then Exit;
  470. OldState := TimerFinder.Enabled;
  471. TimerFinder.Enabled := False;
  472. with TSystemSetForm.Create(Self) do
  473. try
  474. if ShowModal = mrOk then
  475. begin
  476. TimerFinder.Interval := FinderTimerMSec;
  477. end;
  478. finally
  479. Free;
  480. end;
  481. TimerFinder.Enabled := OldState;
  482. end;
  483. procedure TBackMainForm.TimerFinderTimer(Sender: TObject);
  484. procedure RandomFinderMonster;
  485. var
  486. X, Y: Integer;
  487. begin
  488. if FCurGamePos.X < CenterPosX then
  489. X := RandomRange(FinderMinX, FinderMaxX)
  490. else
  491. X := RandomRange(-FinderMaxX, -FinderMinX);
  492. if FCurGamePos.Y < CenterPosY then
  493. Y := RandomRange(FinderMinY, FinderMaxY)
  494. else
  495. Y := RandomRange(-FinderMaxY, -FinderMinY);
  496. X := Screen.Width div 2 + X;
  497. Y := Screen.Height div 2 + Y;
  498. MonitorMouseMove(X, Y);
  499. Sleep(10);
  500. end;
  501. procedure FindMonster;
  502. begin
  503. // 寻找怪物
  504. if not FIsFighting then
  505. begin
  506. FFightUnixTick := 0;
  507. RandomFinderMonster;
  508. MonitorMouseClick(1);
  509. end else
  510. begin
  511. if FFightUnixTick  = 0 then
  512. FFightUnixTick := DateTimeToUnix(Now)
  513. else
  514. begin
  515. // 如果找怪超时,则重新寻找
  516. if DateTimeToUnix(Now) - FFightUnixTick > 15 then
  517. begin
  518. // 随机移动位置(必须执行此操作,否则会死锁)
  519. MonitorMouseMove(RandomRange(0, Screen.Width div 2),
  520. RandomRange(0, Screen.Height div 2));
  521. Sleep(10);
  522. MonitorMouseClick(2);
  523. end else
  524. begin
  525. // 释放魔法
  526. AutoPressMagicKeys;
  527. end;
  528. end;
  529. end;
  530. end;
  531. procedure FillLifeAndMagic;
  532. begin
  533. // 补人物血
  534. if ((FLifeCurrent*100) div LIFE_MAX) <= LifeMin then
  535. begin
  536. MonitorKeyPress([], KeyLifeAdd);
  537. end;
  538. Sleep(20);
  539. // 补宝宝血
  540. if ((FBBLifeCurrent*100) div BB_LIFE_MAX) <= BBLifeMin then
  541. begin
  542. MonitorKeyPress([], KeyBBLifeAdd);
  543. end;
  544. Sleep(20);
  545. // 补任务魔法
  546. if ((FMagicCurrent*100) div MAGIC_MAX) <= MagicMin then
  547. begin
  548. MonitorKeyPress([], KeyMagicAdd);
  549. end;
  550. end;
  551. procedure PickGoods;
  552. begin
  553. // 一定要在没有打怪状态
  554. if not FIsFighting then
  555. begin
  556. RandomFinderMonster;
  557. MonitorMouseClick(2);
  558. Sleep(10);
  559. end;
  560. end;
  561. begin
  562. try
  563. FetchWindowImage(FSCBitMap);
  564. CalcFightState;
  565. CalcCurrentPos;
  566. CalcQuestionState;
  567. CalcLifeAndMagic;
  568. //PickGoods;(暂时不开启,有问题)
  569. FindMonster;
  570. Sleep(20);
  571. FillLifeAndMagic;
  572. // 启动报警程序
  573. if FIsNeedAnswerQT and (BeepThread = nil) then
  574. TBeepThread.Create(50).Resume;
  575. except
  576. end;
  577. end;
  578. function TBackMainForm.TranslateWinHotKeyToLocal(
  579. HotKeyValue: Cardinal): Word;
  580. var
  581. ALWord, AHWord: Word;
  582. begin
  583. Result := 0;
  584. AHWord := HiWord(HotKeyValue);
  585. ALWord := HotKeyValue and $FFFF;
  586. if ALWord and MOD_SHIFT <> 0 then
  587. Result := Result + scShift;
  588. if ALWord and MOD_ALT <> 0 then
  589. Result := Result + scAlt;
  590. if ALWord and MOD_CONTROL <> 0 then
  591. Result := Result + scCtrl;
  592. Result := Result + AHWord;
  593. end;
  594. procedure TBackMainForm.WMHotKey(var Message: TMessage);
  595. var
  596. LocalKey: Word;
  597. begin
  598. LocalKey := TranslateWinHotKeyToLocal(Message.LParam);
  599. if LocalKey = scCtrl + scAlt + VK_F10 then
  600. begin
  601. // 系统开关
  602. TimerFinder.Enabled := not TimerFinder.Enabled;
  603. Windows.Beep(3000, 100);
  604. end else if LocalKey = scCtrl + scAlt + VK_F11 then
  605. begin
  606. // 设置原点
  607. FetchWindowImage(FSCBitMap);
  608. CalcCurrentPos;
  609. CenterPosX := FCurGamePos.X;
  610. CenterPosY := FCurGamePos.Y;
  611. Windows.Beep(2000, 100);
  612. Windows.Beep(2500, 100);
  613. end else if LocalKey = scCtrl + scAlt + VK_F12 then
  614. begin
  615. // 调出设置框
  616. SysSetMenuItemClick(nil);
  617. end else if LocalKey = scCtrl + scAlt + VK_F1 then
  618. begin
  619. // 关闭线程
  620. try
  621. if Assigned(BeepThread) then
  622. begin
  623. BeepThread.Terminate;
  624. end;
  625. except
  626. end;
  627. end else if LocalKey = scCtrl + scAlt + VK_F2 then
  628. begin
  629. SendFetionMsg('天龙八部助手测试!');
  630. end;
  631. end;
  632. { TBeepThread }
  633. constructor TBeepThread.Create(BeepSecs: Integer);
  634. begin
  635. inherited Create(True);
  636. FreeOnTerminate := True;
  637. FBeepSecs := BeepSecs;
  638. // 记录自己
  639. BeepThread := Self;
  640. end;
  641. procedure TBeepThread.Execute;
  642. var
  643. StartUnixTick: Cardinal;
  644. begin
  645. StartUnixTick := DateTimeToUnix(Now);
  646. SyncSendFetionMsg;
  647. while not Terminated do
  648. begin
  649. if DateTimeToUnix(now) - StartUnixTick > FBeepSecs then
  650. Break;
  651. Windows.Beep(4000, 300);
  652. Sleep(700);
  653. end;
  654. BeepThread := nil;
  655. end;
  656. procedure TBeepThread.SyncSendFetionMsg;
  657. begin
  658. SendFetionMsg('TLBBHelper: 需要输入验证码!');
  659. end;
  660. end.
  1. unit GlobalDefs;
  2. interface
  3. uses
  4. Windows;
  5. { 相关配置参数 }
  6. const
  7. LIFE_MAX        = 124;
  8. MAGIC_MAX       = 124;
  9. BB_LIFE_MAX     = 96;
  10. QT_MIN_COLOR = $FAFAFA;
  11. QT_WIDTH = 237;
  12. QT_HEIGHT = 298;
  13. var
  14. FinderTimerMSec: Integer = 200;     // 系统Timer执行时间
  15. LifeX: Integer = 64;                // 人物生命值X坐标
  16. LifeY: Integer = 32;                // 人物生命值Y坐标
  17. LifeColor: Integer = 0;             // 人物生命值取样颜色(加载时初始化)
  18. LifeMin: Integer = 50;              // 人物生命最小百分比
  19. MagicX: Integer = 64;               // 人物魔法值X坐标
  20. MagicY: Integer = 38;               // 人物魔法值Y坐标
  21. MagicColor: Integer = 0;            // 人物魔法值取样颜色(加载时初始化)
  22. MagicMin: Integer = 50;             // 人物魔法最小百分比
  23. BBLifeX: Integer = 91;              // 宝宝生命值X坐标
  24. BBLifeY: Integer = 71;              // 宝宝生命值Y坐标
  25. BBLifeColor: Integer = 0;           // 宝宝生命值取样颜色(加载时初始化)
  26. BBLifeMin: Integer = 30;            // 宝宝生命最小百分比
  27. MonsterLifeX: Integer = 247;        // 怪物生命值X坐标
  28. MonsterLifeY: Integer = 32;         // 怪物生命值Y坐标
  29. MonsterLifeColor: Integer = 0;      // 怪物生命值取样颜色(加载时初始化)
  30. CenterPosX: Integer = 185;          // 自动打怪中心位置X坐标
  31. CenterPosY: Integer = 215;          // 自动打怪中心位置Y坐标
  32. FinderMaxX: Integer = 100;          // 自动打怪寻怪X轴距离最大值
  33. FinderMinX: Integer = 30;           // 自动打怪寻怪X轴距离最小值
  34. FinderMaxY: Integer = 100;          // 自动打怪寻怪Y轴距离最大值
  35. FinderMinY: Integer = 30;           // 自动打怪寻怪Y轴距离最小值
  36. AvgKillMonsterSecs: Integer = 15;   // 平均每个怪的打怪时间(校正用)
  37. KeyLifeAdd: Word = VK_F8;           // 人物加血键
  38. KeyMagicAdd: Word = VK_F9;          // 人物加魔法键
  39. KeyBBLifeAdd: Word = VK_F10;        // 宝宝加血键
  40. PressKeyF1Secs: Integer = 10;       // 自动按F1键时间间隔
  41. PressKeyF2Secs: Integer = 15;       // 自动按F2键时间间隔
  42. PressKeyF3Secs: Integer = 40;       // 自动按F3键时间间隔
  43. PressKeyF4Secs: Integer = 0;        // 自动按F4键时间间隔
  44. FetionWindowHandle: Integer = 0;
  45. FetionWindowIncText: string = '--';
  46. FetionInputHandle: Integer = 0;
  47. FetionSendBtnHandle: Integer = 0;
  48. implementation
  49. end.

研究天龙八部(网游), 写了个辅助自动打怪、答题提示的辅助工具相关推荐

  1. 给网游写一个挂吧(四) – 调用游戏函数

    前面的文章给网游写一个挂吧 – 启动外挂上或给网游写一个挂吧 – 启动外挂下将外挂启动后,那就可以进行读写游戏内存和调用游戏的一些操作了. 读写内存很简单,如果是内挂的话,因为是运行在进程内,甚至都可 ...

  2. 给网游写一个挂吧(三) – 启动外挂下

    前面的文章给网游写一个挂吧 – 启动外挂上介绍了输入法注入的方法,本文解释第二种方法. 有的游戏限制比较多,可能会将输入法注入也禁用掉--这个时候就需要另想方法了.其实我们的目的很简单,就是要让不知道 ...

  3. 给网游写一个挂吧(二) – 启动外挂上

    前面的文章给网游写一个挂吧– 反反外挂驱动的驱动,我们已经可以访问游戏的内存之后,接下来需要: 1.         找到游戏里关键元素的偏移量,比如生命值的内存的位置.一般来说,大部分大型3D游戏都 ...

  4. 天龙单机服务器维护,天龙八部网游单机服务器修改资料(Dragon eight online games, single server, modify information).doc...

    天龙八部网游单机服务器修改资料(Dragon eight online games, single server, modify information) 天龙八部网游单机服务器修改资料(Dragon ...

  5. 天龙八部网单服务器修改爆率,天龙八部网游单服务器修改资料.doc

    天龙八部网游单服务器修改资料 天龙八部网游单机服务器修改资料 天龙八部服务端修改之一 本帖最后由 香香 于 2010-2-9 19:16 编辑 1.修改全局经验倍数 角色的移动速度 \home\tlb ...

  6. 天龙八部服务器修改密码,天龙八部网游单机服务器修改资料.doc

    文档介绍: 天龙八部网游单机服务器修改资料天龙八部服务端修改之一本帖最后由香香于 2010-2-9 19:16 编辑 1 .修改全局经验倍数角色的移动速度\home\tlbb\Public\Confi ...

  7. 给网游写一个挂吧(一) – 反反外挂驱动的驱动

    去年做了一些研究,研究做外挂的一些相关技术,打算放出来跟大家分享,分享一下我们做挂的一些思路,挂的原理,希望抛砖引玉. 外挂说白了就是用程序代替人去操纵游戏,模拟人向游戏程序发送键盘.鼠标消息.一般的 ...

  8. 写了一个新浪微博自动加粉的挂机小工具

    写这个东西其实是为了自己方便,运行最小化到托盘就行. 内核是新浪微博的互粉大厅.原理是因为互粉大厅只要在线就会进行自动互粉,无需手工操作. 编程:VB编程. 软件大小:100K左右 其实,如果把浏览器 ...

  9. 巨盾网游安全盾 2013

    巨盾网游安全盾是一款针对木马查杀.在线娱乐安全设计的产品,最受网游用户和上网冲浪用户的欢迎.永久免费,使用方便,查杀迅速,小巧轻便.巨盾拥有木马查杀.电脑体检.网游保护.文件清理.系统管理.密保卡保护 ...

最新文章

  1. 「它将改变一切」,DeepMind AI解决生物学50年来重大挑战,破解蛋白质分子折叠问题...
  2. 配置redis禁用几个危险命令
  3. uboot阅读笔记之cpu工作模式(SVC32)
  4. ASCII编码/Unicode编码
  5. Element表格嵌入复选框以及单选框
  6. 联想微型计算机电脑黑屏怎么做系统,联想电脑黑屏怎么办,5种方法轻松排除黑屏故障...
  7. 在运行SSIS包时,如何动态更新变量值
  8. Jackson的JSON——JsonUtils工具类
  9. 大数据资源共享网盘下载
  10. 清华大学计算机学院教授简介,清华大学计算机科学与技术系导师教师师资介绍简介-王继龙...
  11. 怎樣制作线段动画_20技巧教你如何简单制作动画
  12. STM32 freertos堆栈溢出检查方法
  13. MT4 获取当前订单的开单价格
  14. 在真正的短信网络钓鱼攻击内部
  15. 解决:input框当type为number时maxlength失效
  16. B模式超声成像仿真(MATLAB k-Wave仿真)
  17. 简述:静态工作点(Q点),直流负载线,交流负载线
  18. win10彻底永久关闭自动更新的方法【已验证有效】
  19. 【VRP系统你了解多少呢?】
  20. Latex/WinEdt中文编辑

热门文章

  1. Android逐帧动画和补间动画
  2. 网件r6800,r6900v2,r7250刷老毛子(pandvan)教程
  3. 使用VBA创建数字金字塔
  4. 一缕烟香起 静中闻鸿蒙,三款新品香烟大爆料 到底是口粮烟还是外观党?
  5. 成为专业程序猿的配置(设置分屏、拓展分屏显示)
  6. pdm转excel(基于PowerDesigner软件)
  7. Index hint 和 Index 的区别
  8. 计算机cct 考试试题,《计算机文化基础CCT考试真题解析》【价格 目录 书评 正版】_中图网...
  9. java编程计算器程序代码_即将步入大学的同学们注意了,初学编程,这些你需要认真铭记...
  10. java代码编写的30条规范