Advertisement
Guest User

Untitled

a guest
Aug 6th, 2013
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 33.87 KB | None | 0 0
  1. -- code generated by Win32Lib IDE v0.21.1 Build Sept-29-2006
  2.  
  3. constant TheProgramType="exw"
  4.  
  5. include Win32Lib.ew
  6. without warning
  7.  
  8. --------------------------------------------------------------------------------
  9. -- Window Window1
  10. constant Window1 = createEx( Window, "Rotmg autobot", 0, Default, Default, 374, 485, 0, 0 )
  11. constant TabControl13 = createEx( TabControl, "TabControl13", Window1, 180, 20, 150, 210, 0, 0 )
  12. constant TabItem14 = createEx( TabItem, "Rings:", TabControl13, 0, 0, 0, 0, 0, 0 )
  13. constant TabItem19 = createEx( TabItem, "levels", TabControl13, 0, 0, 0, 0, 0, 0 )
  14. constant label_fps = createEx( LText, "", Window1, 20, 20, 130, 20, 0, 0 )
  15. constant label_detected = createEx( LText, "", Window1, 20, 50, 130, 20, 0, 0 )
  16. constant checkbox_ring1 = createEx( CheckBox, "1", TabItem14, 10, 30, 40, 20, 0, 0 )
  17. constant checkbox_level1 = createEx( CheckBox, "1", TabItem19, 10, 30, 40, 20, 0, 0 )
  18. constant checkbox_level9 = createEx( CheckBox, "9", TabItem19, 70, 30, 40, 20, 0, 0 )
  19. constant checkbox_ring2 = createEx( CheckBox, "2", TabItem14, 10, 50, 40, 20, 0, 0 )
  20. constant checkbox_level2 = createEx( CheckBox, "2", TabItem19, 10, 50, 40, 20, 0, 0 )
  21. constant checkbox_level10 = createEx( CheckBox, "10", TabItem19, 70, 50, 40, 20, 0, 0 )
  22. constant label_x = createEx( LText, "", Window1, 20, 80, 130, 20, 0, 0 )
  23. constant checkbox_ring3 = createEx( CheckBox, "3", TabItem14, 10, 70, 40, 20, 0, 0 )
  24. constant checkbox_level3 = createEx( CheckBox, "3", TabItem19, 10, 70, 40, 20, 0, 0 )
  25. constant label_y = createEx( LText, "", Window1, 20, 110, 130, 20, 0, 0 )
  26. constant checkbox_ring4 = createEx( CheckBox, "4", TabItem14, 10, 90, 40, 20, 0, 0 )
  27. constant checkbox_level4 = createEx( CheckBox, "4", TabItem19, 10, 90, 40, 20, 0, 0 )
  28. constant checkbox_level5 = createEx( CheckBox, "5", TabItem19, 10, 110, 40, 20, 0, 0 )
  29. constant label_nexus = createEx( LText, "", Window1, 20, 150, 130, 20, 0, 0 )
  30. constant checkbox_level6 = createEx( CheckBox, "6", TabItem19, 10, 130, 40, 20, 0, 0 )
  31. constant checkbox_level7 = createEx( CheckBox, "7", TabItem19, 10, 150, 40, 20, 0, 0 )
  32. constant label_health = createEx( LText, "", Window1, 20, 180, 130, 20, 0, 0 )
  33. constant checkbox_level8 = createEx( CheckBox, "8", TabItem19, 10, 170, 40, 20, 0, 0 )
  34. constant textbox_health = createEx( EditText, "50", Window1, 20, 220, 130, 20, w32or_all({#2000}), 0 )
  35. constant LText9 = createEx( LText, "Hotkey =\n writen by Botmaker\n copyright 2012", Window1, 20, 250, 120, 40, 0, 0 )
  36. constant label_invslots = createEx( LText, "", Window1, 20, 300, 150, 20, 0, 0 )
  37. constant label_loot = createEx( LText, "", Window1, 20, 330, 150, 20, 0, 0 )
  38. constant checkbox_autohealth = createEx( CheckBox, "auto use health", Window1, 20, 360, 150, 20, 0, 0 )
  39. constant textbox_autohealth = createEx( EditText, "100", Window1, 180, 360, 60, 20, w32or_all({#2000}), 0 )
  40. constant checkbox_autoloot_health = createEx( CheckBox, "autoloot health", Window1, 20, 390, 150, 20, 0, 0 )
  41. constant checkbox_autoloot_magic = createEx( CheckBox, "autoloot magic", Window1, 20, 410, 150, 20, 0, 0 )
  42. ---------------------------------------------------------
  43. --------------------------------------------------------------------------------
  44. include w32dcore.ew -- only the core library is necessary
  45. include sendkeys.ew
  46.  
  47. integer globalhealth
  48. globalhealth=0
  49.  
  50. sequence maindib_list
  51. maindib_list={}
  52. sequence imagedata_list
  53. imagedata_list={}
  54.  
  55. function rgbs(atom rgb) --convert a win32lib color to a dib color
  56. return ( {and_bits(#00FF0000, rgb) / #10000,
  57. and_bits(#0000FF00, rgb) / #100,
  58. and_bits(#000000FF, rgb) } )
  59. end function
  60.  
  61. function rgbs2(sequence col) --convert a dib color to a win32lib color
  62. return rgb(col[3],col[2],col[1])
  63. end function
  64.  
  65. integer image_x,image_y
  66. image_x=0
  67. image_y=0
  68.  
  69. sequence globalcolor
  70. globalcolor={}
  71.  
  72. function getpixel(sequence image)
  73. atom address1
  74. integer bytesline,width,height
  75. sequence col
  76.  
  77. address1 = image[DibMemory]
  78. bytesline= image[DibBytesPerLine]
  79. width=image[DibWidth]
  80. height=image[DibHeight]
  81.  
  82.  
  83. col= peek({address1 + 3 * image_x + image_y * bytesline, 3})
  84.  
  85. image_x+=1
  86.  
  87. if image_x=width then
  88.  
  89. image_x=0
  90. if image_y=height-1 then --end of image
  91. globalcolor=col
  92. return -1
  93. end if
  94. image_y+=1
  95. end if
  96.  
  97. return col
  98. end function
  99.  
  100. procedure image_init()
  101. image_x=0
  102. image_y=0
  103. end procedure
  104.  
  105.  
  106. procedure make_items()
  107. sequence dib
  108. integer ret,pos
  109. dib=loadDib("test.bmp")
  110.  
  111. pos=0
  112. for yy=0 to 1280 by 40 do
  113. for xx=0 to 1000 by 40 do
  114. ret=saveDib(dib, "items\\item"&sprint(pos)&".bmp", xx, yy, xx+39, yy+39)
  115. pos+=1
  116. end for
  117. end for
  118. ?pos
  119.  
  120. end procedure
  121. --make_items()
  122.  
  123. constant item_size=34
  124. sequence item_dib
  125. item_dib = newDib(item_size, item_size) -- create the bitmap
  126. if atom(item_dib) then
  127. abortErr( "Couldn't item dib line 127 create a bitmap." )
  128. end if
  129.  
  130. function insert_image(sequence image)
  131. sequence color_list
  132. object color
  133.  
  134. color_list={}
  135. image_init()
  136.  
  137. while 1 do
  138. color=getpixel(image)
  139. if integer(color) then
  140. color_list&=rgbs2(globalcolor)
  141. exit
  142. end if
  143. color_list&=rgbs2(color)
  144. end while
  145.  
  146. return color_list
  147.  
  148. end function
  149.  
  150. integer imagedata_id
  151. imagedata_id=0
  152.  
  153. constant imagedata_empty=1
  154. constant imagedata_unknow=2
  155. constant imagedata_ring1=3
  156. constant imagedata_ring2=4
  157. constant imagedata_ring3=5
  158. constant imagedata_ring4=6
  159.  
  160. constant imagedata_level1=7
  161. constant imagedata_level2=8
  162. constant imagedata_level3=9
  163. constant imagedata_level4=10
  164. constant imagedata_level5=11
  165. constant imagedata_level6=12
  166. constant imagedata_level7=13
  167. constant imagedata_level8=14
  168. constant imagedata_level9=15
  169.  
  170. constant imagedata_health=16
  171. constant imagedata_magic=17
  172.  
  173. imagedata_list={
  174. {},
  175. {},
  176.  
  177. {}, --rings
  178. {},
  179. {},
  180. {},
  181.  
  182. {},--levels
  183. {},
  184. {},
  185. {},
  186. {},
  187. {},
  188. {},
  189. {},
  190. {},
  191.  
  192. {}, --health
  193.  
  194. {} --magic
  195.  
  196. }
  197.  
  198. procedure load_all_images()
  199. sequence filelist,pixeldata
  200. integer fn
  201.  
  202. --dir return the names sort in order 1,2,3,4,5
  203. --this procedure use that function
  204. filelist = dir("images\\empty")
  205.  
  206. for i=3 to length(filelist) do
  207. maindib_list=append(maindib_list,loadDib("images\\empty\\"&filelist[i][D_NAME]))
  208. pixeldata=insert_image(maindib_list[length(maindib_list)])
  209. imagedata_list[imagedata_empty]=append(imagedata_list[imagedata_empty],{imagedata_id,length(maindib_list),pixeldata})
  210. imagedata_id+=1
  211. end for
  212.  
  213.  
  214. filelist = dir("images\\unknow")
  215.  
  216. for i=3 to length(filelist) do
  217. maindib_list=append(maindib_list,loadDib("images\\unknow\\"&filelist[i][D_NAME]))
  218. pixeldata=insert_image(maindib_list[length(maindib_list)])
  219. imagedata_list[imagedata_unknow]=append(imagedata_list[imagedata_unknow],{imagedata_id,length(maindib_list),pixeldata})
  220. imagedata_id+=1
  221. end for
  222.  
  223. filelist = dir("images\\rings\\level1")
  224.  
  225. for i=3 to length(filelist) do
  226. maindib_list=append(maindib_list,loadDib("images\\rings\\level1\\"&filelist[i][D_NAME]))
  227. pixeldata=insert_image(maindib_list[length(maindib_list)])
  228. imagedata_list[imagedata_ring1]=append(imagedata_list[imagedata_ring1],{imagedata_id,length(maindib_list),pixeldata})
  229. imagedata_id+=1
  230. end for
  231.  
  232. filelist = dir("images\\rings\\level2")
  233.  
  234. for i=3 to length(filelist) do
  235. maindib_list=append(maindib_list,loadDib("images\\rings\\level2\\"&filelist[i][D_NAME]))
  236. pixeldata=insert_image(maindib_list[length(maindib_list)])
  237. imagedata_list[imagedata_ring2]=append(imagedata_list[imagedata_ring2],{imagedata_id,length(maindib_list),pixeldata})
  238. imagedata_id+=1
  239. end for
  240.  
  241. filelist = dir("images\\rings\\level3")
  242.  
  243. for i=3 to length(filelist) do
  244. maindib_list=append(maindib_list,loadDib("images\\rings\\level3\\"&filelist[i][D_NAME]))
  245. pixeldata=insert_image(maindib_list[length(maindib_list)])
  246. imagedata_list[imagedata_ring3]=append(imagedata_list[imagedata_ring3],{imagedata_id,length(maindib_list),pixeldata})
  247. imagedata_id+=1
  248. end for
  249.  
  250. filelist = dir("images\\rings\\level4")
  251.  
  252. for i=3 to length(filelist) do
  253. maindib_list=append(maindib_list,loadDib("images\\rings\\level4\\"&filelist[i][D_NAME]))
  254. pixeldata=insert_image(maindib_list[length(maindib_list)])
  255. imagedata_list[imagedata_ring4]=append(imagedata_list[imagedata_ring4],{imagedata_id,length(maindib_list),pixeldata})
  256. imagedata_id+=1
  257. end for
  258.  
  259. filelist = dir("images\\level1")
  260.  
  261. for i=3 to length(filelist) do
  262. maindib_list=append(maindib_list,loadDib("images\\level1\\"&filelist[i][D_NAME]))
  263. pixeldata=insert_image(maindib_list[length(maindib_list)])
  264. imagedata_list[imagedata_level1]=append(imagedata_list[imagedata_level1],{imagedata_id,length(maindib_list),pixeldata})
  265. imagedata_id+=1
  266. end for
  267.  
  268. filelist = dir("images\\level2")
  269.  
  270. for i=3 to length(filelist) do
  271. maindib_list=append(maindib_list,loadDib("images\\level2\\"&filelist[i][D_NAME]))
  272. pixeldata=insert_image(maindib_list[length(maindib_list)])
  273. imagedata_list[imagedata_level2]=append(imagedata_list[imagedata_level2],{imagedata_id,length(maindib_list),pixeldata})
  274. imagedata_id+=1
  275. end for
  276.  
  277. filelist = dir("images\\level3")
  278.  
  279. for i=3 to length(filelist) do
  280. maindib_list=append(maindib_list,loadDib("images\\level3\\"&filelist[i][D_NAME]))
  281. pixeldata=insert_image(maindib_list[length(maindib_list)])
  282. imagedata_list[imagedata_level3]=append(imagedata_list[imagedata_level3],{imagedata_id,length(maindib_list),pixeldata})
  283. imagedata_id+=1
  284. end for
  285.  
  286. filelist = dir("images\\level4")
  287.  
  288. for i=3 to length(filelist) do
  289. maindib_list=append(maindib_list,loadDib("images\\level4\\"&filelist[i][D_NAME]))
  290. pixeldata=insert_image(maindib_list[length(maindib_list)])
  291. imagedata_list[imagedata_level4]=append(imagedata_list[imagedata_level4],{imagedata_id,length(maindib_list),pixeldata})
  292. imagedata_id+=1
  293. end for
  294.  
  295. filelist = dir("images\\level5")
  296.  
  297. for i=3 to length(filelist) do
  298. maindib_list=append(maindib_list,loadDib("images\\level5\\"&filelist[i][D_NAME]))
  299. pixeldata=insert_image(maindib_list[length(maindib_list)])
  300. imagedata_list[imagedata_level5]=append(imagedata_list[imagedata_level5],{imagedata_id,length(maindib_list),pixeldata})
  301. imagedata_id+=1
  302. end for
  303.  
  304. filelist = dir("images\\level6")
  305.  
  306. for i=3 to length(filelist) do
  307. maindib_list=append(maindib_list,loadDib("images\\level6\\"&filelist[i][D_NAME]))
  308. pixeldata=insert_image(maindib_list[length(maindib_list)])
  309. imagedata_list[imagedata_level6]=append(imagedata_list[imagedata_level6],{imagedata_id,length(maindib_list),pixeldata})
  310. imagedata_id+=1
  311. end for
  312.  
  313. filelist = dir("images\\level7")
  314.  
  315. for i=3 to length(filelist) do
  316. maindib_list=append(maindib_list,loadDib("images\\level7\\"&filelist[i][D_NAME]))
  317. pixeldata=insert_image(maindib_list[length(maindib_list)])
  318. imagedata_list[imagedata_level7]=append(imagedata_list[imagedata_level7],{imagedata_id,length(maindib_list),pixeldata})
  319. imagedata_id+=1
  320. end for
  321.  
  322. filelist = dir("images\\level8")
  323.  
  324. for i=3 to length(filelist) do
  325. maindib_list=append(maindib_list,loadDib("images\\level8\\"&filelist[i][D_NAME]))
  326. pixeldata=insert_image(maindib_list[length(maindib_list)])
  327. imagedata_list[imagedata_level8]=append(imagedata_list[imagedata_level8],{imagedata_id,length(maindib_list),pixeldata})
  328. imagedata_id+=1
  329. end for
  330.  
  331. filelist = dir("images\\level9")
  332.  
  333. for i=3 to length(filelist) do
  334. maindib_list=append(maindib_list,loadDib("images\\level9\\"&filelist[i][D_NAME]))
  335. pixeldata=insert_image(maindib_list[length(maindib_list)])
  336. imagedata_list[imagedata_level9]=append(imagedata_list[imagedata_level9],{imagedata_id,length(maindib_list),pixeldata})
  337. imagedata_id+=1
  338. end for
  339.  
  340. filelist = dir("images\\health")
  341.  
  342. for i=3 to length(filelist) do
  343. maindib_list=append(maindib_list,loadDib("images\\health\\"&filelist[i][D_NAME]))
  344. pixeldata=insert_image(maindib_list[length(maindib_list)])
  345. imagedata_list[imagedata_health]=append(imagedata_list[imagedata_health],{imagedata_id,length(maindib_list),pixeldata})
  346. imagedata_id+=1
  347. end for
  348.  
  349. filelist = dir("images\\magic")
  350.  
  351. for i=3 to length(filelist) do
  352. maindib_list=append(maindib_list,loadDib("images\\magic\\"&filelist[i][D_NAME]))
  353. pixeldata=insert_image(maindib_list[length(maindib_list)])
  354. imagedata_list[imagedata_magic]=append(imagedata_list[imagedata_magic],{imagedata_id,length(maindib_list),pixeldata})
  355. imagedata_id+=1
  356. end for
  357.  
  358.  
  359. end procedure
  360. load_all_images()
  361.  
  362. function find_in_list(sequence list, atom val)
  363. for i=1 to length(list) do
  364. if list[i]=val then
  365. return 1
  366. end if
  367. end for
  368. return 0
  369. end function
  370.  
  371. procedure something()
  372. sequence colors,counts
  373.  
  374. colors=repeat({},1156)
  375. counts=repeat(0,1156)
  376.  
  377. for k=1 to 1156 do
  378. for i=1 to length(imagedata_list) do
  379. for j=1 to length(imagedata_list[i]) do
  380. if find_in_list(colors[k],imagedata_list[i][j][3][k])=0 then
  381. colors[k]&=imagedata_list[i][j][3][k]
  382. counts[k]+=1
  383. else
  384. counts[k]+=1
  385. end if
  386. end for
  387. end for
  388.  
  389.  
  390. end for
  391.  
  392.  
  393. end procedure
  394. --something()
  395.  
  396. sequence empty_inv_dib
  397. empty_inv_dib={}
  398.  
  399. constant MOUSEEVENTF_ABSOLUTE=#8000
  400. constant MOUSEEVENTF_MOVE=#0001
  401.  
  402. function real(sequence string)
  403. sequence temp
  404. temp=value(string)
  405. return temp[2]
  406. end function
  407.  
  408. sequence dib, size
  409.  
  410. integer frame,fps
  411. frame=0
  412. fps=0
  413.  
  414. integer flag_detected
  415. flag_detected=0
  416. integer flag_nexus
  417. flag_nexus=0
  418.  
  419.  
  420.  
  421. integer search_x,search_y
  422.  
  423. search_x=0
  424. search_y=0
  425.  
  426. size = getCtlSize(Screen) -- get the size of the screen
  427. dib = newDib(size[1], size[2]) -- create the bitmap
  428. if atom(dib) then
  429. abortErr( "Couldn't create a bitmap." )
  430. end if
  431.  
  432. setTimer(Window1,1000,50)
  433. setTimer(Window1,1001,1000)-- 1 second
  434.  
  435. constant hp_color={52,52,224}
  436. constant mp_color={224,132,96}
  437. constant board_color={54,54,54}
  438.  
  439. constant nexus_location={157,46}
  440. constant nexus_color={9,9,9}
  441.  
  442.  
  443. constant inv_startx=0 --relative to search x
  444. constant inv_starty=108 --relative to search x
  445. constant inv_pading=6
  446. constant icon_pading=3
  447. constant loot_v_offset=12
  448. constant loot_board_color={84,84,84}
  449.  
  450. constant icon_size=40
  451. constant icon_offset=44
  452. --hacking mess love it
  453.  
  454. for i=1 to 9 do
  455. empty_inv_dib =append(empty_inv_dib, loadDib("images\\empty\\"&sprint(i)&".bmp")) -- loads the bitmap
  456. if integer(empty_inv_dib[length(empty_inv_dib)]) then
  457. -- couldn't load the bitmap
  458. abort(0)
  459. end if
  460.  
  461. end for
  462.  
  463. sequence inv_slots
  464. inv_slots=repeat(0,8)
  465.  
  466. integer flag_loot
  467. flag_loot=0
  468.  
  469. function image_compare( sequence dib, sequence image)
  470. atom address1,address2
  471. integer bytesline,width,height
  472.  
  473.  
  474. address1 = dib[DibMemory]
  475. address2 = image[DibMemory]
  476. bytesline= dib[DibBytesPerLine]
  477.  
  478. width=dib[DibWidth]
  479. height=dib[DibHeight]
  480.  
  481. if width!=image[DibWidth] or height!=image[DibHeight] then
  482. ?width
  483. ?image[DibWidth]
  484. puts(1,"debug\n")
  485. return 0
  486. end if
  487.  
  488. for y=0 to width do
  489. for x=0 to height do
  490. if equal(peek({address1 + 3 * x + y * bytesline, 3}),peek({address2 + 3 * x + y * bytesline, 3}))=0 then
  491. return 0
  492. end if
  493. end for
  494. end for
  495.  
  496. return 1
  497. end function
  498.  
  499.  
  500. --puts(1,"comparing images "&sprint(image_compare(loadDib("images\\49.bmp"),loadDib("images\\gaz.bmp")) )&"\n" )
  501.  
  502.  
  503.  
  504.  
  505. function image_is_know(sequence image)
  506. --{imagedata_id,length(maindib_list),pixeldata}
  507.  
  508. for i=1 to length(imagedata_list) do
  509. for j=1 to length(imagedata_list[i]) do
  510. if image_compare(maindib_list[ imagedata_list[i][j][2] ], image)=1 then
  511. return {i,j,imagedata_list[i][j][1]}
  512. end if
  513. end for
  514. end for
  515. return {}
  516. end function
  517.  
  518.  
  519. procedure loot_settings_save()
  520. integer fn
  521. fn=open("settings.txt","w")
  522. puts(fn,sprint(isChecked(checkbox_ring1))&"\n")
  523. puts(fn,sprint(isChecked(checkbox_ring2))&"\n")
  524. puts(fn,sprint(isChecked(checkbox_ring3))&"\n")
  525. puts(fn,sprint(isChecked(checkbox_ring4))&"\n")
  526. puts(fn,sprint(isChecked(checkbox_level1))&"\n")
  527. puts(fn,sprint(isChecked(checkbox_level2))&"\n")
  528. puts(fn,sprint(isChecked(checkbox_level3))&"\n")
  529. puts(fn,sprint(isChecked(checkbox_level4))&"\n")
  530. puts(fn,sprint(isChecked(checkbox_level5))&"\n")
  531. puts(fn,sprint(isChecked(checkbox_level6))&"\n")
  532. puts(fn,sprint(isChecked(checkbox_level7))&"\n")
  533. puts(fn,sprint(isChecked(checkbox_level8))&"\n")
  534. puts(fn,sprint(isChecked(checkbox_level9))&"\n")
  535.  
  536. close(fn)
  537. end procedure
  538.  
  539. procedure loot_settings_load()
  540. integer fn
  541. fn=open("settings.txt","r")
  542. if fn!=-1 then
  543. setCheck(checkbox_ring1,real(gets(fn)))
  544. setCheck(checkbox_ring2,real(gets(fn)))
  545. setCheck(checkbox_ring3,real(gets(fn)))
  546. setCheck(checkbox_ring4,real(gets(fn)))
  547.  
  548. setCheck(checkbox_level1,real(gets(fn)))
  549. setCheck(checkbox_level2,real(gets(fn)))
  550. setCheck(checkbox_level3,real(gets(fn)))
  551. setCheck(checkbox_level4,real(gets(fn)))
  552. setCheck(checkbox_level5,real(gets(fn)))
  553. setCheck(checkbox_level6,real(gets(fn)))
  554. setCheck(checkbox_level7,real(gets(fn)))
  555. setCheck(checkbox_level8,real(gets(fn)))
  556. setCheck(checkbox_level9,real(gets(fn)))
  557. close(fn)
  558. end if
  559.  
  560.  
  561. end procedure
  562. loot_settings_load()
  563.  
  564. integer autoloot
  565. autoloot=0
  566.  
  567. --selected the ones you don't want
  568. --constant imagedata_ring1=3
  569. --constant imagedata_ring2=4
  570. --constant imagedata_ring3=5
  571. --constant imagedata_ring4=6
  572. function canloot(integer loottype)
  573. if not(isChecked(checkbox_ring1))=0 and loottype=imagedata_ring1 then
  574. return 1
  575. end if
  576. if not(isChecked(checkbox_ring2))=0 and loottype=imagedata_ring2 then
  577. return 1
  578. end if
  579. if not(isChecked(checkbox_ring3))=0 and loottype=imagedata_ring3 then
  580. return 1
  581. end if
  582. if not(isChecked(checkbox_ring4))=0 and loottype=imagedata_ring4 then
  583. return 1
  584. end if
  585.  
  586. if not(isChecked(checkbox_level1))=0 and loottype=imagedata_level1 then
  587. return 1
  588. end if
  589. if not(isChecked(checkbox_level2))=0 and loottype=imagedata_level2 then
  590. return 1
  591. end if
  592. if not(isChecked(checkbox_level3))=0 and loottype=imagedata_level3 then
  593. return 1
  594. end if
  595. if not(isChecked(checkbox_level4))=0 and loottype=imagedata_level4 then
  596. return 1
  597. end if
  598. if not(isChecked(checkbox_level5))=0 and loottype=imagedata_level5 then
  599. return 1
  600. end if
  601. if not(isChecked(checkbox_level6))=0 and loottype=imagedata_level6 then
  602. return 1
  603. end if
  604. if not(isChecked(checkbox_level7))=0 and loottype=imagedata_level7 then
  605. return 1
  606. end if
  607. if not(isChecked(checkbox_level8))=0 and loottype=imagedata_level8 then
  608. return 1
  609. end if
  610. if not(isChecked(checkbox_level9))=0 and loottype=imagedata_level9 then
  611. return 1
  612. end if
  613.  
  614. if not(isChecked(checkbox_autoloot_health))=0 and loottype=imagedata_health then
  615. return 1
  616. end if
  617.  
  618. if not(isChecked(checkbox_autoloot_magic))=0 and loottype=imagedata_magic then
  619. return 1
  620. end if
  621.  
  622.  
  623. return 0
  624. end function
  625.  
  626. integer health_downtimer
  627. health_downtimer=0
  628.  
  629. procedure auto_loot()
  630. integer result, sx,sy,j,row
  631. atom address1
  632. integer bytesline
  633. sequence ret, item_list, item_postions,dest
  634. sequence source
  635.  
  636. item_list={}
  637. item_postions={}
  638. dest={}
  639. source={}
  640.  
  641. address1 = dib[DibMemory]
  642. bytesline= dib[DibBytesPerLine]
  643.  
  644. sx=search_x+inv_startx
  645. sy=search_y+inv_starty
  646.  
  647.  
  648. --equipable items
  649. j=1
  650. row=0
  651. for xx=icon_pading to 44*4 by 44 do
  652. drawDibToDib(item_dib, dib, 0, 0, sx+xx, sy+icon_pading+(icon_offset*row), (sx+xx+item_size)-1, (sy+icon_pading+item_size+(icon_offset*row))-1, {}, 255)
  653. --result = saveDib(dib, "bitmap"&sprint(j)&".bmp", sx+xx, sy+icon_pading+(icon_offset*row), (sx+xx+item_size)-1, (sy+icon_pading+item_size+(icon_offset*row))-1)
  654. item_postions=append(item_postions,{sx+xx, sy+icon_pading+(icon_offset*row)})
  655. j+=1
  656. end for
  657.  
  658. j=5
  659. row=1
  660. for xx=icon_pading to 44*4 by 44 do
  661. drawDibToDib(item_dib, dib, 0, 0, sx+xx, sy+icon_pading+(icon_offset*row), (sx+xx+item_size)-1, (sy+icon_pading+item_size+(icon_offset*row))-1 ,{}, 255)
  662. item_postions=append(item_postions,{sx+xx, sy+icon_pading+(icon_offset*row)})
  663.  
  664. if image_compare(empty_inv_dib[j-4], item_dib)=1 then
  665. inv_slots[j-4]=0
  666. else
  667. inv_slots[j-4]=1
  668. end if
  669.  
  670. ret=image_is_know(item_dib)
  671. --?ret
  672. if length(ret)=0 then
  673. --need to save the image into the unknow folder
  674. --use the imagedata_id for fname
  675. --add it to the correct imagedata_list
  676. --result = saveDib(item_dib, "images\\unknow\\"&sprint(imagedata_id)&".bmp", 0, 0, 34-1, 34-1)
  677. maindib_list=append(maindib_list,copyDib(item_dib) )
  678. imagedata_list[imagedata_unknow]=append(imagedata_list[imagedata_unknow],{imagedata_id,length(maindib_list),{}})
  679. imagedata_id+=1
  680. else
  681. item_list=append(item_list,ret&{row,j})
  682. end if
  683.  
  684.  
  685. j+=1
  686. end for
  687.  
  688. j=9
  689. row=2
  690. for xx=icon_pading to 44*4 by 44 do
  691. drawDibToDib(item_dib, dib, 0, 0, sx+xx, sy+icon_pading+(icon_offset*row), (sx+xx+item_size)-1, (sy+icon_pading+item_size+(icon_offset*row))-1 ,{}, 255)
  692. item_postions=append(item_postions,{sx+xx, sy+icon_pading+(icon_offset*row)})
  693. --result = saveDib(dib, "bitmap"&sprint(j)&".bmp", sx+xx, sy+icon_pading+(icon_offset*row), (sx+xx+item_size)-1, (sy+icon_pading+item_size+(icon_offset*row))-1)
  694. if image_compare(empty_inv_dib[j-4], item_dib)=1 then
  695. inv_slots[j-4]=0
  696. else
  697. inv_slots[j-4]=1
  698. end if
  699.  
  700. ret=image_is_know(item_dib)
  701. --?ret
  702. if length(ret)=0 then
  703. --need to save the image into the unknow folder
  704. --use the imagedata_id for fname
  705. --add it to the correct imagedata_list
  706. --result = saveDib(item_dib, "images\\unknow\\"&sprint(imagedata_id)&".bmp", 0, 0, 34-1, 34-1)
  707. maindib_list=append(maindib_list,copyDib(item_dib) )
  708. imagedata_list[imagedata_unknow]=append(imagedata_list[imagedata_unknow],{imagedata_id,length(maindib_list),{}})
  709. imagedata_id+=1
  710. else
  711. item_list=append(item_list,ret&{row,j})
  712. end if
  713.  
  714. --if image_compare(maindib_list[ imagedata_list[imagedata_empty][5][2] ], item_dib)=1 then
  715.  
  716. --end if
  717. j+=1
  718. end for
  719.  
  720. setText(label_invslots,"inventory slots"&sprint( inv_slots))
  721.  
  722. if isChecked(checkbox_autohealth)=1 then
  723. health_downtimer-=1
  724. if globalhealth!=0 and globalhealth<real(getText(textbox_autohealth)) and health_downtimer<=0 then
  725. health_downtimer=10
  726. for i=1 to length(item_list) do
  727. if item_list[i][1]=imagedata_health then
  728. SendKeys(sprint(item_list[i][5]-4))
  729. --?item_list[i][5]-4
  730. exit
  731. end if
  732. end for
  733. end if
  734. else
  735. health_downtimer=0
  736. end if
  737.  
  738.  
  739.  
  740.  
  741.  
  742. flag_loot=0
  743.  
  744. --loot checking to see if there is loot
  745. j=1
  746. row=3
  747. for xx=icon_pading to 44*4 by 44 do
  748. drawDibToDib(item_dib, dib, 0, 0, sx+xx, sy+icon_pading+(icon_offset*row)+loot_v_offset, (sx+xx+item_size)-1, (sy+icon_pading+item_size+(icon_offset*row)+loot_v_offset)-1 ,{}, 255)
  749. if equal(peek({address1 + 3 * (sx+xx)+ (sy+icon_pading+(icon_offset*row)+loot_v_offset) * bytesline, 3}),loot_board_color)=1 then
  750. flag_loot=1
  751. end if
  752. j+=1
  753. end for
  754.  
  755. if flag_loot=1 then
  756.  
  757. flag_loot=0
  758.  
  759. j=5
  760. row=4
  761. for xx=icon_pading to 44*4 by 44 do
  762. drawDibToDib(item_dib, dib, 0, 0, sx+xx, sy+icon_pading+(icon_offset*row)+loot_v_offset, (sx+xx+item_size)-1, (sy+icon_pading+item_size+(icon_offset*row)+loot_v_offset)-1 ,{}, 255)
  763. if equal(peek({address1 + 3 * (sx+xx)+ (sy+icon_pading+(icon_offset*row)+loot_v_offset) * bytesline, 3}),loot_board_color)=1 then
  764. flag_loot=1
  765. end if
  766. j+=1
  767. end for
  768.  
  769. end if
  770.  
  771.  
  772. if flag_loot=1 then
  773. --loot
  774. j=1
  775. row=3
  776. for xx=icon_pading to 44*4 by 44 do
  777. drawDibToDib(item_dib, dib, 0, 0, sx+xx, sy+icon_pading+(icon_offset*row)+loot_v_offset, (sx+xx+item_size)-1, (sy+icon_pading+item_size+(icon_offset*row)+loot_v_offset)-1 ,{}, 255)
  778. item_postions=append(item_postions,{sx+xx, sy+icon_pading+(icon_offset*row)+loot_v_offset})
  779. --result = saveDib(dib, "loot"&sprint(j)&".bmp", sx+xx, sy+icon_pading+(icon_offset*row)+loot_v_offset, (sx+xx+item_size)-1, (sy+icon_pading+item_size+(icon_offset*row)+loot_v_offset)-1)
  780.  
  781. ret=image_is_know(item_dib)
  782. --?ret
  783. if length(ret)=0 then
  784. --need to save the image into the unknow folder
  785. --use the imagedata_id for fname
  786. --add it to the correct imagedata_list
  787. --result = saveDib(item_dib, "images\\unknow\\"&sprint(imagedata_id)&".bmp", 0, 0, 34-1, 34-1)
  788. maindib_list=append(maindib_list,copyDib(item_dib) )
  789. imagedata_list[imagedata_unknow]=append(imagedata_list[imagedata_unknow],{imagedata_id,length(maindib_list),{}})
  790. imagedata_id+=1
  791. else
  792. item_list=append(item_list,ret&{row,j})
  793. end if
  794.  
  795. j+=1
  796.  
  797. end for
  798.  
  799. j=5
  800. row=4
  801. for xx=icon_pading to 44*4 by 44 do
  802. drawDibToDib(item_dib, dib, 0, 0, sx+xx, sy+icon_pading+(icon_offset*row)+loot_v_offset, (sx+xx+item_size)-1, (sy+icon_pading+item_size+(icon_offset*row)+loot_v_offset)-1 ,{}, 255)
  803. --result = saveDib(dib, "loot"&sprint(j)&".bmp", sx+xx, sy+icon_pading+(icon_offset*row)+loot_v_offset, (sx+xx+item_size)-1, (sy+icon_pading+item_size+(icon_offset*row)+loot_v_offset)-1)
  804. item_postions=append(item_postions,{sx+xx, sy+icon_pading+(icon_offset*row)+loot_v_offset})
  805. ret=image_is_know(item_dib)
  806. --?ret
  807. if length(ret)=0 then
  808. --need to save the image into the unknow folder
  809. --use the imagedata_id for fname
  810. --add it to the correct imagedata_list
  811. --result = saveDib(item_dib, "images\\unknow\\"&sprint(imagedata_id)&".bmp", 0, 0, 34-1, 34-1)
  812. maindib_list=append(maindib_list,copyDib(item_dib) )
  813. imagedata_list[imagedata_unknow]=append(imagedata_list[imagedata_unknow],{imagedata_id,length(maindib_list),{}})
  814. imagedata_id+=1
  815. else
  816. item_list=append(item_list,ret&{row,j})
  817. end if
  818.  
  819.  
  820. j+=1
  821. end for
  822.  
  823.  
  824. if autoloot=0 then
  825.  
  826. --loot detected
  827. if equal(inv_slots,{1,1,1,1, 1,1,1,1})=0 then --there at least one empty slot
  828.  
  829. for i=1 to length(item_list) do
  830. if item_list[i][1]=2 or canloot(item_list[i][1])=1 then
  831. if item_list[i][4]=3 then
  832.  
  833. autoloot=1
  834. elsif item_list[i][4]=4 then
  835. autoloot=1
  836. end if
  837.  
  838. if autoloot=1 then
  839. if item_list[i][5]<=4 then
  840. source=item_postions[((4*3))+item_list[i][5]]
  841. else
  842. source=item_postions[((4*3))+item_list[i][5]]
  843. end if
  844. exit
  845. end if
  846. end if
  847.  
  848. end for
  849.  
  850. if autoloot=1 then
  851. for i=1 to length(inv_slots) do
  852. if inv_slots[i]=0 then
  853. if i<=4 then --row 1
  854. dest=item_postions[((4*1))+i]
  855. else -- row 2
  856. dest=item_postions[((4*1))+i]
  857. end if
  858. end if
  859. end for
  860.  
  861. dest+=15
  862. source+=15
  863. setPointerPos(source)
  864. dragPointerTo(dest)
  865. --?source
  866. --?dest
  867. setTimer(Window1,1002,200)
  868. end if
  869.  
  870. end if
  871.  
  872. end if
  873.  
  874. end if
  875.  
  876. end procedure
  877.  
  878. constant minmap1={171,231}
  879. constant minmap2={171,240}
  880.  
  881.  
  882. procedure rotmg_detected()
  883. atom address1
  884. integer bytesline
  885.  
  886. integer found_hp,found_mp,search_exit,count
  887.  
  888. count=0
  889.  
  890. found_hp=0
  891. found_mp=0
  892.  
  893.  
  894. address1 = dib[DibMemory]
  895. bytesline= dib[DibBytesPerLine]
  896. flag_detected=0
  897.  
  898. for yy=0 to size[2]-50 by 10 do
  899. for xx=0 to size[1]-50 by 50 do
  900.  
  901. found_hp=1
  902. found_mp=1
  903. search_exit=0
  904.  
  905. for y=yy to yy+4 do
  906.  
  907. for x=xx to xx+4 do
  908. if equal(peek({address1 + 3 * x + y * bytesline, 3}),hp_color)=0 then
  909. found_hp=0
  910. search_exit=1
  911. exit
  912. end if
  913. end for
  914. if search_exit=1 then
  915. exit
  916. end if
  917. end for
  918.  
  919. search_exit=0
  920.  
  921. for y=yy+22 to yy+26 do
  922. for x=xx to xx+4 do
  923. if equal(peek({address1 + 3 * x + y * bytesline, 3}),mp_color)=0 then
  924. found_mp=0
  925. search_exit=1
  926. exit
  927. end if
  928. end for
  929. if search_exit=1 then
  930. exit
  931. end if
  932. end for
  933.  
  934. search_exit=0--very important here
  935.  
  936. if found_hp=1 and found_mp=1 then
  937. search_x=xx
  938. search_y=yy
  939. flag_detected=1
  940. search_exit=1
  941. exit
  942. end if
  943.  
  944. end for
  945. if search_exit=1 then
  946. exit
  947. end if
  948. end for
  949.  
  950.  
  951.  
  952. if flag_detected=1 then
  953.  
  954. flag_detected=0
  955.  
  956. for x=search_x to search_x-200 by -1 do
  957. if equal(peek({address1 + 3 * x + search_y * bytesline, 3}),board_color)=1 then
  958. search_x=x+3--53,53,139
  959. --?peek({address1 + 3 * search_x + search_y * bytesline, 3})
  960. flag_detected=1
  961. exit
  962. end if
  963. end for
  964.  
  965. if flag_detected=1 then
  966. flag_detected=0
  967. for y=search_y to search_y-30 by -1 do
  968. if equal(peek({address1 + 3 * search_x + y * bytesline, 3}),board_color)=1 then
  969. search_y=y+1--53,53,139
  970. --?peek({address1 + 3 * search_x + search_y * bytesline, 3})
  971. --================new code state machine
  972. flag_detected=1-- new state machine for detection of the game 2 used to be 1 it affects the below code
  973. exit
  974. end if
  975. end for
  976.  
  977. end if
  978.  
  979. --new ---============================
  980. flag_detected=0
  981.  
  982. if equal(peek({address1 + 3 * (search_x+minmap1[1]) + (search_y-minmap1[2]) * bytesline, 3}),{255,255,255})=1 or equal(peek({address1 + 3 * (search_x+minmap1[1]) + (search_y-minmap1[2]) * bytesline, 3}),{127,127,127})=1 then
  983. if equal(peek({address1 + 3 * (search_x+minmap2[1]) + (search_y-minmap2[2]) * bytesline, 3}),{255,255,255})=1 or equal(peek({address1 + 3 * (search_x+minmap2[1]) + (search_y-minmap2[2]) * bytesline, 3}),{127,127,127})=1 then
  984. flag_detected=1
  985. end if
  986. end if
  987.  
  988.  
  989. end if
  990.  
  991. --leave this function with flag_detected 0 or 1
  992.  
  993. setText(label_fps,"fps: "&sprint(fps))
  994. setText(label_detected,"Rotmg Detected: "&sprint(flag_detected))
  995. setText(label_x,"wx: "&sprint(search_x))
  996. setText(label_y,"wy: "&sprint(search_y))
  997. setText(label_nexus,"In nexus: "&sprint(flag_nexus))
  998. setText(label_health,"Health: "&sprint(count))
  999.  
  1000. end procedure
  1001.  
  1002.  
  1003. integer popup_timer
  1004. popup_timer=0
  1005.  
  1006. procedure rotmg_detected2()
  1007. atom address1
  1008. integer bytesline
  1009. integer count
  1010. sequence pos
  1011. count=0
  1012.  
  1013.  
  1014.  
  1015. address1 = dib[DibMemory]
  1016. bytesline= dib[DibBytesPerLine]
  1017.  
  1018. flag_detected=0
  1019.  
  1020. if equal(peek({address1 + 3 * (search_x+minmap1[1]) + (search_y-minmap1[2]) * bytesline, 3}),{255,255,255})=1 or equal(peek({address1 + 3 * (search_x+minmap1[1]) + (search_y-minmap1[2]) * bytesline, 3}),{127,127,127})=1 then
  1021. if equal(peek({address1 + 3 * (search_x+minmap2[1]) + (search_y-minmap2[2]) * bytesline, 3}),{255,255,255})=1 or equal(peek({address1 + 3 * (search_x+minmap2[1]) + (search_y-minmap2[2]) * bytesline, 3}),{127,127,127})=1 then
  1022. flag_detected=1
  1023. end if
  1024. end if
  1025.  
  1026. if flag_detected=1 then
  1027.  
  1028. --crap
  1029. for y=0 to 8 do
  1030. for x=0 to 8 do
  1031.  
  1032. --if equal(peek({address1 + 3 * (search_x+nexus_location[1]+x) + ((search_y-nexus_location[2])+y) * bytesline, 3}),nexus_color) then
  1033. --?peek({address1 + 3 * (search_x+nexus_location[1]+x) + (search_y-nexus_location[2]+y) * bytesline, 3})
  1034. --?nexus_location[1]+x
  1035. --?y
  1036. --end if
  1037.  
  1038. end for
  1039. end for
  1040. --crap
  1041.  
  1042. flag_nexus=0
  1043. if equal(peek({address1 + 3 * (search_x+nexus_location[1]) + (search_y-nexus_location[2]) * bytesline, 3}),nexus_color)=1 then
  1044. flag_nexus=1
  1045. end if
  1046. end if
  1047.  
  1048. if flag_detected=1 then--health check
  1049.  
  1050.  
  1051. for x=search_x+24 to search_x+170 do
  1052. if equal(peek({address1 + 3 * x + (search_y+4) * bytesline, 3}),hp_color)=1 then
  1053. count+=1
  1054. else
  1055. if equal(peek({address1 + 3 * x + (search_y+4) * bytesline, 3}),{84,84,84})=0 and equal(peek({address1 + 3 * (x+1) + (search_y+4) * bytesline, 3}),{84,84,84})=0 then
  1056. count=0
  1057. end if
  1058. exit
  1059. end if
  1060. end for
  1061.  
  1062. globalhealth=count
  1063.  
  1064. if count!=0 and count<real(getText(textbox_health)) and flag_nexus=0 then
  1065. --go nexus
  1066. SendKeys("=")
  1067. end if
  1068.  
  1069. end if
  1070.  
  1071. if flag_detected=1 then
  1072. pos = getPointerPos()
  1073.  
  1074. if pos[1]<(search_x-30) or pos[1]>(search_x-30)+210 then
  1075. popup_timer-=1
  1076. if popup_timer<0 then
  1077. popup_timer=0
  1078. end if
  1079. if popup_timer=0 then
  1080. auto_loot()
  1081. end if
  1082. else
  1083. popup_timer=10
  1084. end if
  1085.  
  1086. end if
  1087.  
  1088. setText(label_fps,"fps: "&sprint(fps))
  1089. setText(label_detected,"Rotmg Detected: "&sprint(flag_detected))
  1090. setText(label_x,"wx: "&sprint(search_x))
  1091. setText(label_y,"wy: "&sprint(search_y))
  1092. setText(label_nexus,"In nexus: "&sprint(flag_nexus))
  1093. setText(label_health,"Health: "&sprint(count))
  1094. end procedure
  1095.  
  1096.  
  1097. --------------------------------------------------------------------------------
  1098. procedure Window1_onClose (integer self, integer event, sequence params)--params is ()
  1099. loot_settings_save()
  1100. end procedure
  1101. setHandler( Window1, w32HClose, routine_id("Window1_onClose"))
  1102. --------------------------------------------------------------------------------
  1103. procedure Window1_onTimer (integer self, integer event, sequence params)--params is ( int timerId)
  1104. if params[1]=1000 then
  1105.  
  1106. frame+=1
  1107. copyToDib(dib, Screen, 0, 0, 0, 0, size[1] - 1, size[2] - 1) -- copy the screen to the bitmap
  1108. if flag_detected=0 then
  1109. --puts(1,sprint(time())&"\n")
  1110. rotmg_detected()
  1111. elsif flag_detected=1 then
  1112. rotmg_detected2()
  1113. end if
  1114. elsif params[1]=1001 then
  1115. fps=frame
  1116. frame=0
  1117. --?fps
  1118.  
  1119. --?flag_detected
  1120. elsif params[1]=1002 then
  1121. autoloot=0
  1122. killTimer(Window1,1002)
  1123. setPointerPos({search_x-340,search_y-100})
  1124. end if
  1125. end procedure
  1126. setHandler( Window1, w32HTimer, routine_id("Window1_onTimer"))
  1127.  
  1128.  
  1129. WinMain( Window1,Normal )
  1130. --this program has 1129 lines without including this line. If there is a discrepancy please send this file zipped to Judith.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement