Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- code generated by Win32Lib IDE v0.21.1 Build Sept-29-2006
- constant TheProgramType="exw"
- include Win32Lib.ew
- without warning
- --------------------------------------------------------------------------------
- -- Window Window1
- constant Window1 = createEx( Window, "Rotmg autobot", 0, Default, Default, 374, 485, 0, 0 )
- constant TabControl13 = createEx( TabControl, "TabControl13", Window1, 180, 20, 150, 210, 0, 0 )
- constant TabItem14 = createEx( TabItem, "Rings:", TabControl13, 0, 0, 0, 0, 0, 0 )
- constant TabItem19 = createEx( TabItem, "levels", TabControl13, 0, 0, 0, 0, 0, 0 )
- constant label_fps = createEx( LText, "", Window1, 20, 20, 130, 20, 0, 0 )
- constant label_detected = createEx( LText, "", Window1, 20, 50, 130, 20, 0, 0 )
- constant checkbox_ring1 = createEx( CheckBox, "1", TabItem14, 10, 30, 40, 20, 0, 0 )
- constant checkbox_level1 = createEx( CheckBox, "1", TabItem19, 10, 30, 40, 20, 0, 0 )
- constant checkbox_level9 = createEx( CheckBox, "9", TabItem19, 70, 30, 40, 20, 0, 0 )
- constant checkbox_ring2 = createEx( CheckBox, "2", TabItem14, 10, 50, 40, 20, 0, 0 )
- constant checkbox_level2 = createEx( CheckBox, "2", TabItem19, 10, 50, 40, 20, 0, 0 )
- constant checkbox_level10 = createEx( CheckBox, "10", TabItem19, 70, 50, 40, 20, 0, 0 )
- constant label_x = createEx( LText, "", Window1, 20, 80, 130, 20, 0, 0 )
- constant checkbox_ring3 = createEx( CheckBox, "3", TabItem14, 10, 70, 40, 20, 0, 0 )
- constant checkbox_level3 = createEx( CheckBox, "3", TabItem19, 10, 70, 40, 20, 0, 0 )
- constant label_y = createEx( LText, "", Window1, 20, 110, 130, 20, 0, 0 )
- constant checkbox_ring4 = createEx( CheckBox, "4", TabItem14, 10, 90, 40, 20, 0, 0 )
- constant checkbox_level4 = createEx( CheckBox, "4", TabItem19, 10, 90, 40, 20, 0, 0 )
- constant checkbox_level5 = createEx( CheckBox, "5", TabItem19, 10, 110, 40, 20, 0, 0 )
- constant label_nexus = createEx( LText, "", Window1, 20, 150, 130, 20, 0, 0 )
- constant checkbox_level6 = createEx( CheckBox, "6", TabItem19, 10, 130, 40, 20, 0, 0 )
- constant checkbox_level7 = createEx( CheckBox, "7", TabItem19, 10, 150, 40, 20, 0, 0 )
- constant label_health = createEx( LText, "", Window1, 20, 180, 130, 20, 0, 0 )
- constant checkbox_level8 = createEx( CheckBox, "8", TabItem19, 10, 170, 40, 20, 0, 0 )
- constant textbox_health = createEx( EditText, "50", Window1, 20, 220, 130, 20, w32or_all({#2000}), 0 )
- constant LText9 = createEx( LText, "Hotkey =\n writen by Botmaker\n copyright 2012", Window1, 20, 250, 120, 40, 0, 0 )
- constant label_invslots = createEx( LText, "", Window1, 20, 300, 150, 20, 0, 0 )
- constant label_loot = createEx( LText, "", Window1, 20, 330, 150, 20, 0, 0 )
- constant checkbox_autohealth = createEx( CheckBox, "auto use health", Window1, 20, 360, 150, 20, 0, 0 )
- constant textbox_autohealth = createEx( EditText, "100", Window1, 180, 360, 60, 20, w32or_all({#2000}), 0 )
- constant checkbox_autoloot_health = createEx( CheckBox, "autoloot health", Window1, 20, 390, 150, 20, 0, 0 )
- constant checkbox_autoloot_magic = createEx( CheckBox, "autoloot magic", Window1, 20, 410, 150, 20, 0, 0 )
- ---------------------------------------------------------
- --------------------------------------------------------------------------------
- include w32dcore.ew -- only the core library is necessary
- include sendkeys.ew
- integer globalhealth
- globalhealth=0
- sequence maindib_list
- maindib_list={}
- sequence imagedata_list
- imagedata_list={}
- function rgbs(atom rgb) --convert a win32lib color to a dib color
- return ( {and_bits(#00FF0000, rgb) / #10000,
- and_bits(#0000FF00, rgb) / #100,
- and_bits(#000000FF, rgb) } )
- end function
- function rgbs2(sequence col) --convert a dib color to a win32lib color
- return rgb(col[3],col[2],col[1])
- end function
- integer image_x,image_y
- image_x=0
- image_y=0
- sequence globalcolor
- globalcolor={}
- function getpixel(sequence image)
- atom address1
- integer bytesline,width,height
- sequence col
- address1 = image[DibMemory]
- bytesline= image[DibBytesPerLine]
- width=image[DibWidth]
- height=image[DibHeight]
- col= peek({address1 + 3 * image_x + image_y * bytesline, 3})
- image_x+=1
- if image_x=width then
- image_x=0
- if image_y=height-1 then --end of image
- globalcolor=col
- return -1
- end if
- image_y+=1
- end if
- return col
- end function
- procedure image_init()
- image_x=0
- image_y=0
- end procedure
- procedure make_items()
- sequence dib
- integer ret,pos
- dib=loadDib("test.bmp")
- pos=0
- for yy=0 to 1280 by 40 do
- for xx=0 to 1000 by 40 do
- ret=saveDib(dib, "items\\item"&sprint(pos)&".bmp", xx, yy, xx+39, yy+39)
- pos+=1
- end for
- end for
- ?pos
- end procedure
- --make_items()
- constant item_size=34
- sequence item_dib
- item_dib = newDib(item_size, item_size) -- create the bitmap
- if atom(item_dib) then
- abortErr( "Couldn't item dib line 127 create a bitmap." )
- end if
- function insert_image(sequence image)
- sequence color_list
- object color
- color_list={}
- image_init()
- while 1 do
- color=getpixel(image)
- if integer(color) then
- color_list&=rgbs2(globalcolor)
- exit
- end if
- color_list&=rgbs2(color)
- end while
- return color_list
- end function
- integer imagedata_id
- imagedata_id=0
- constant imagedata_empty=1
- constant imagedata_unknow=2
- constant imagedata_ring1=3
- constant imagedata_ring2=4
- constant imagedata_ring3=5
- constant imagedata_ring4=6
- constant imagedata_level1=7
- constant imagedata_level2=8
- constant imagedata_level3=9
- constant imagedata_level4=10
- constant imagedata_level5=11
- constant imagedata_level6=12
- constant imagedata_level7=13
- constant imagedata_level8=14
- constant imagedata_level9=15
- constant imagedata_health=16
- constant imagedata_magic=17
- imagedata_list={
- {},
- {},
- {}, --rings
- {},
- {},
- {},
- {},--levels
- {},
- {},
- {},
- {},
- {},
- {},
- {},
- {},
- {}, --health
- {} --magic
- }
- procedure load_all_images()
- sequence filelist,pixeldata
- integer fn
- --dir return the names sort in order 1,2,3,4,5
- --this procedure use that function
- filelist = dir("images\\empty")
- for i=3 to length(filelist) do
- maindib_list=append(maindib_list,loadDib("images\\empty\\"&filelist[i][D_NAME]))
- pixeldata=insert_image(maindib_list[length(maindib_list)])
- imagedata_list[imagedata_empty]=append(imagedata_list[imagedata_empty],{imagedata_id,length(maindib_list),pixeldata})
- imagedata_id+=1
- end for
- filelist = dir("images\\unknow")
- for i=3 to length(filelist) do
- maindib_list=append(maindib_list,loadDib("images\\unknow\\"&filelist[i][D_NAME]))
- pixeldata=insert_image(maindib_list[length(maindib_list)])
- imagedata_list[imagedata_unknow]=append(imagedata_list[imagedata_unknow],{imagedata_id,length(maindib_list),pixeldata})
- imagedata_id+=1
- end for
- filelist = dir("images\\rings\\level1")
- for i=3 to length(filelist) do
- maindib_list=append(maindib_list,loadDib("images\\rings\\level1\\"&filelist[i][D_NAME]))
- pixeldata=insert_image(maindib_list[length(maindib_list)])
- imagedata_list[imagedata_ring1]=append(imagedata_list[imagedata_ring1],{imagedata_id,length(maindib_list),pixeldata})
- imagedata_id+=1
- end for
- filelist = dir("images\\rings\\level2")
- for i=3 to length(filelist) do
- maindib_list=append(maindib_list,loadDib("images\\rings\\level2\\"&filelist[i][D_NAME]))
- pixeldata=insert_image(maindib_list[length(maindib_list)])
- imagedata_list[imagedata_ring2]=append(imagedata_list[imagedata_ring2],{imagedata_id,length(maindib_list),pixeldata})
- imagedata_id+=1
- end for
- filelist = dir("images\\rings\\level3")
- for i=3 to length(filelist) do
- maindib_list=append(maindib_list,loadDib("images\\rings\\level3\\"&filelist[i][D_NAME]))
- pixeldata=insert_image(maindib_list[length(maindib_list)])
- imagedata_list[imagedata_ring3]=append(imagedata_list[imagedata_ring3],{imagedata_id,length(maindib_list),pixeldata})
- imagedata_id+=1
- end for
- filelist = dir("images\\rings\\level4")
- for i=3 to length(filelist) do
- maindib_list=append(maindib_list,loadDib("images\\rings\\level4\\"&filelist[i][D_NAME]))
- pixeldata=insert_image(maindib_list[length(maindib_list)])
- imagedata_list[imagedata_ring4]=append(imagedata_list[imagedata_ring4],{imagedata_id,length(maindib_list),pixeldata})
- imagedata_id+=1
- end for
- filelist = dir("images\\level1")
- for i=3 to length(filelist) do
- maindib_list=append(maindib_list,loadDib("images\\level1\\"&filelist[i][D_NAME]))
- pixeldata=insert_image(maindib_list[length(maindib_list)])
- imagedata_list[imagedata_level1]=append(imagedata_list[imagedata_level1],{imagedata_id,length(maindib_list),pixeldata})
- imagedata_id+=1
- end for
- filelist = dir("images\\level2")
- for i=3 to length(filelist) do
- maindib_list=append(maindib_list,loadDib("images\\level2\\"&filelist[i][D_NAME]))
- pixeldata=insert_image(maindib_list[length(maindib_list)])
- imagedata_list[imagedata_level2]=append(imagedata_list[imagedata_level2],{imagedata_id,length(maindib_list),pixeldata})
- imagedata_id+=1
- end for
- filelist = dir("images\\level3")
- for i=3 to length(filelist) do
- maindib_list=append(maindib_list,loadDib("images\\level3\\"&filelist[i][D_NAME]))
- pixeldata=insert_image(maindib_list[length(maindib_list)])
- imagedata_list[imagedata_level3]=append(imagedata_list[imagedata_level3],{imagedata_id,length(maindib_list),pixeldata})
- imagedata_id+=1
- end for
- filelist = dir("images\\level4")
- for i=3 to length(filelist) do
- maindib_list=append(maindib_list,loadDib("images\\level4\\"&filelist[i][D_NAME]))
- pixeldata=insert_image(maindib_list[length(maindib_list)])
- imagedata_list[imagedata_level4]=append(imagedata_list[imagedata_level4],{imagedata_id,length(maindib_list),pixeldata})
- imagedata_id+=1
- end for
- filelist = dir("images\\level5")
- for i=3 to length(filelist) do
- maindib_list=append(maindib_list,loadDib("images\\level5\\"&filelist[i][D_NAME]))
- pixeldata=insert_image(maindib_list[length(maindib_list)])
- imagedata_list[imagedata_level5]=append(imagedata_list[imagedata_level5],{imagedata_id,length(maindib_list),pixeldata})
- imagedata_id+=1
- end for
- filelist = dir("images\\level6")
- for i=3 to length(filelist) do
- maindib_list=append(maindib_list,loadDib("images\\level6\\"&filelist[i][D_NAME]))
- pixeldata=insert_image(maindib_list[length(maindib_list)])
- imagedata_list[imagedata_level6]=append(imagedata_list[imagedata_level6],{imagedata_id,length(maindib_list),pixeldata})
- imagedata_id+=1
- end for
- filelist = dir("images\\level7")
- for i=3 to length(filelist) do
- maindib_list=append(maindib_list,loadDib("images\\level7\\"&filelist[i][D_NAME]))
- pixeldata=insert_image(maindib_list[length(maindib_list)])
- imagedata_list[imagedata_level7]=append(imagedata_list[imagedata_level7],{imagedata_id,length(maindib_list),pixeldata})
- imagedata_id+=1
- end for
- filelist = dir("images\\level8")
- for i=3 to length(filelist) do
- maindib_list=append(maindib_list,loadDib("images\\level8\\"&filelist[i][D_NAME]))
- pixeldata=insert_image(maindib_list[length(maindib_list)])
- imagedata_list[imagedata_level8]=append(imagedata_list[imagedata_level8],{imagedata_id,length(maindib_list),pixeldata})
- imagedata_id+=1
- end for
- filelist = dir("images\\level9")
- for i=3 to length(filelist) do
- maindib_list=append(maindib_list,loadDib("images\\level9\\"&filelist[i][D_NAME]))
- pixeldata=insert_image(maindib_list[length(maindib_list)])
- imagedata_list[imagedata_level9]=append(imagedata_list[imagedata_level9],{imagedata_id,length(maindib_list),pixeldata})
- imagedata_id+=1
- end for
- filelist = dir("images\\health")
- for i=3 to length(filelist) do
- maindib_list=append(maindib_list,loadDib("images\\health\\"&filelist[i][D_NAME]))
- pixeldata=insert_image(maindib_list[length(maindib_list)])
- imagedata_list[imagedata_health]=append(imagedata_list[imagedata_health],{imagedata_id,length(maindib_list),pixeldata})
- imagedata_id+=1
- end for
- filelist = dir("images\\magic")
- for i=3 to length(filelist) do
- maindib_list=append(maindib_list,loadDib("images\\magic\\"&filelist[i][D_NAME]))
- pixeldata=insert_image(maindib_list[length(maindib_list)])
- imagedata_list[imagedata_magic]=append(imagedata_list[imagedata_magic],{imagedata_id,length(maindib_list),pixeldata})
- imagedata_id+=1
- end for
- end procedure
- load_all_images()
- function find_in_list(sequence list, atom val)
- for i=1 to length(list) do
- if list[i]=val then
- return 1
- end if
- end for
- return 0
- end function
- procedure something()
- sequence colors,counts
- colors=repeat({},1156)
- counts=repeat(0,1156)
- for k=1 to 1156 do
- for i=1 to length(imagedata_list) do
- for j=1 to length(imagedata_list[i]) do
- if find_in_list(colors[k],imagedata_list[i][j][3][k])=0 then
- colors[k]&=imagedata_list[i][j][3][k]
- counts[k]+=1
- else
- counts[k]+=1
- end if
- end for
- end for
- end for
- end procedure
- --something()
- sequence empty_inv_dib
- empty_inv_dib={}
- constant MOUSEEVENTF_ABSOLUTE=#8000
- constant MOUSEEVENTF_MOVE=#0001
- function real(sequence string)
- sequence temp
- temp=value(string)
- return temp[2]
- end function
- sequence dib, size
- integer frame,fps
- frame=0
- fps=0
- integer flag_detected
- flag_detected=0
- integer flag_nexus
- flag_nexus=0
- integer search_x,search_y
- search_x=0
- search_y=0
- size = getCtlSize(Screen) -- get the size of the screen
- dib = newDib(size[1], size[2]) -- create the bitmap
- if atom(dib) then
- abortErr( "Couldn't create a bitmap." )
- end if
- setTimer(Window1,1000,50)
- setTimer(Window1,1001,1000)-- 1 second
- constant hp_color={52,52,224}
- constant mp_color={224,132,96}
- constant board_color={54,54,54}
- constant nexus_location={157,46}
- constant nexus_color={9,9,9}
- constant inv_startx=0 --relative to search x
- constant inv_starty=108 --relative to search x
- constant inv_pading=6
- constant icon_pading=3
- constant loot_v_offset=12
- constant loot_board_color={84,84,84}
- constant icon_size=40
- constant icon_offset=44
- --hacking mess love it
- for i=1 to 9 do
- empty_inv_dib =append(empty_inv_dib, loadDib("images\\empty\\"&sprint(i)&".bmp")) -- loads the bitmap
- if integer(empty_inv_dib[length(empty_inv_dib)]) then
- -- couldn't load the bitmap
- abort(0)
- end if
- end for
- sequence inv_slots
- inv_slots=repeat(0,8)
- integer flag_loot
- flag_loot=0
- function image_compare( sequence dib, sequence image)
- atom address1,address2
- integer bytesline,width,height
- address1 = dib[DibMemory]
- address2 = image[DibMemory]
- bytesline= dib[DibBytesPerLine]
- width=dib[DibWidth]
- height=dib[DibHeight]
- if width!=image[DibWidth] or height!=image[DibHeight] then
- ?width
- ?image[DibWidth]
- puts(1,"debug\n")
- return 0
- end if
- for y=0 to width do
- for x=0 to height do
- if equal(peek({address1 + 3 * x + y * bytesline, 3}),peek({address2 + 3 * x + y * bytesline, 3}))=0 then
- return 0
- end if
- end for
- end for
- return 1
- end function
- --puts(1,"comparing images "&sprint(image_compare(loadDib("images\\49.bmp"),loadDib("images\\gaz.bmp")) )&"\n" )
- function image_is_know(sequence image)
- --{imagedata_id,length(maindib_list),pixeldata}
- for i=1 to length(imagedata_list) do
- for j=1 to length(imagedata_list[i]) do
- if image_compare(maindib_list[ imagedata_list[i][j][2] ], image)=1 then
- return {i,j,imagedata_list[i][j][1]}
- end if
- end for
- end for
- return {}
- end function
- procedure loot_settings_save()
- integer fn
- fn=open("settings.txt","w")
- puts(fn,sprint(isChecked(checkbox_ring1))&"\n")
- puts(fn,sprint(isChecked(checkbox_ring2))&"\n")
- puts(fn,sprint(isChecked(checkbox_ring3))&"\n")
- puts(fn,sprint(isChecked(checkbox_ring4))&"\n")
- puts(fn,sprint(isChecked(checkbox_level1))&"\n")
- puts(fn,sprint(isChecked(checkbox_level2))&"\n")
- puts(fn,sprint(isChecked(checkbox_level3))&"\n")
- puts(fn,sprint(isChecked(checkbox_level4))&"\n")
- puts(fn,sprint(isChecked(checkbox_level5))&"\n")
- puts(fn,sprint(isChecked(checkbox_level6))&"\n")
- puts(fn,sprint(isChecked(checkbox_level7))&"\n")
- puts(fn,sprint(isChecked(checkbox_level8))&"\n")
- puts(fn,sprint(isChecked(checkbox_level9))&"\n")
- close(fn)
- end procedure
- procedure loot_settings_load()
- integer fn
- fn=open("settings.txt","r")
- if fn!=-1 then
- setCheck(checkbox_ring1,real(gets(fn)))
- setCheck(checkbox_ring2,real(gets(fn)))
- setCheck(checkbox_ring3,real(gets(fn)))
- setCheck(checkbox_ring4,real(gets(fn)))
- setCheck(checkbox_level1,real(gets(fn)))
- setCheck(checkbox_level2,real(gets(fn)))
- setCheck(checkbox_level3,real(gets(fn)))
- setCheck(checkbox_level4,real(gets(fn)))
- setCheck(checkbox_level5,real(gets(fn)))
- setCheck(checkbox_level6,real(gets(fn)))
- setCheck(checkbox_level7,real(gets(fn)))
- setCheck(checkbox_level8,real(gets(fn)))
- setCheck(checkbox_level9,real(gets(fn)))
- close(fn)
- end if
- end procedure
- loot_settings_load()
- integer autoloot
- autoloot=0
- --selected the ones you don't want
- --constant imagedata_ring1=3
- --constant imagedata_ring2=4
- --constant imagedata_ring3=5
- --constant imagedata_ring4=6
- function canloot(integer loottype)
- if not(isChecked(checkbox_ring1))=0 and loottype=imagedata_ring1 then
- return 1
- end if
- if not(isChecked(checkbox_ring2))=0 and loottype=imagedata_ring2 then
- return 1
- end if
- if not(isChecked(checkbox_ring3))=0 and loottype=imagedata_ring3 then
- return 1
- end if
- if not(isChecked(checkbox_ring4))=0 and loottype=imagedata_ring4 then
- return 1
- end if
- if not(isChecked(checkbox_level1))=0 and loottype=imagedata_level1 then
- return 1
- end if
- if not(isChecked(checkbox_level2))=0 and loottype=imagedata_level2 then
- return 1
- end if
- if not(isChecked(checkbox_level3))=0 and loottype=imagedata_level3 then
- return 1
- end if
- if not(isChecked(checkbox_level4))=0 and loottype=imagedata_level4 then
- return 1
- end if
- if not(isChecked(checkbox_level5))=0 and loottype=imagedata_level5 then
- return 1
- end if
- if not(isChecked(checkbox_level6))=0 and loottype=imagedata_level6 then
- return 1
- end if
- if not(isChecked(checkbox_level7))=0 and loottype=imagedata_level7 then
- return 1
- end if
- if not(isChecked(checkbox_level8))=0 and loottype=imagedata_level8 then
- return 1
- end if
- if not(isChecked(checkbox_level9))=0 and loottype=imagedata_level9 then
- return 1
- end if
- if not(isChecked(checkbox_autoloot_health))=0 and loottype=imagedata_health then
- return 1
- end if
- if not(isChecked(checkbox_autoloot_magic))=0 and loottype=imagedata_magic then
- return 1
- end if
- return 0
- end function
- integer health_downtimer
- health_downtimer=0
- procedure auto_loot()
- integer result, sx,sy,j,row
- atom address1
- integer bytesline
- sequence ret, item_list, item_postions,dest
- sequence source
- item_list={}
- item_postions={}
- dest={}
- source={}
- address1 = dib[DibMemory]
- bytesline= dib[DibBytesPerLine]
- sx=search_x+inv_startx
- sy=search_y+inv_starty
- --equipable items
- j=1
- row=0
- for xx=icon_pading to 44*4 by 44 do
- 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)
- --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)
- item_postions=append(item_postions,{sx+xx, sy+icon_pading+(icon_offset*row)})
- j+=1
- end for
- j=5
- row=1
- for xx=icon_pading to 44*4 by 44 do
- 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)
- item_postions=append(item_postions,{sx+xx, sy+icon_pading+(icon_offset*row)})
- if image_compare(empty_inv_dib[j-4], item_dib)=1 then
- inv_slots[j-4]=0
- else
- inv_slots[j-4]=1
- end if
- ret=image_is_know(item_dib)
- --?ret
- if length(ret)=0 then
- --need to save the image into the unknow folder
- --use the imagedata_id for fname
- --add it to the correct imagedata_list
- --result = saveDib(item_dib, "images\\unknow\\"&sprint(imagedata_id)&".bmp", 0, 0, 34-1, 34-1)
- maindib_list=append(maindib_list,copyDib(item_dib) )
- imagedata_list[imagedata_unknow]=append(imagedata_list[imagedata_unknow],{imagedata_id,length(maindib_list),{}})
- imagedata_id+=1
- else
- item_list=append(item_list,ret&{row,j})
- end if
- j+=1
- end for
- j=9
- row=2
- for xx=icon_pading to 44*4 by 44 do
- 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)
- item_postions=append(item_postions,{sx+xx, sy+icon_pading+(icon_offset*row)})
- --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)
- if image_compare(empty_inv_dib[j-4], item_dib)=1 then
- inv_slots[j-4]=0
- else
- inv_slots[j-4]=1
- end if
- ret=image_is_know(item_dib)
- --?ret
- if length(ret)=0 then
- --need to save the image into the unknow folder
- --use the imagedata_id for fname
- --add it to the correct imagedata_list
- --result = saveDib(item_dib, "images\\unknow\\"&sprint(imagedata_id)&".bmp", 0, 0, 34-1, 34-1)
- maindib_list=append(maindib_list,copyDib(item_dib) )
- imagedata_list[imagedata_unknow]=append(imagedata_list[imagedata_unknow],{imagedata_id,length(maindib_list),{}})
- imagedata_id+=1
- else
- item_list=append(item_list,ret&{row,j})
- end if
- --if image_compare(maindib_list[ imagedata_list[imagedata_empty][5][2] ], item_dib)=1 then
- --end if
- j+=1
- end for
- setText(label_invslots,"inventory slots"&sprint( inv_slots))
- if isChecked(checkbox_autohealth)=1 then
- health_downtimer-=1
- if globalhealth!=0 and globalhealth<real(getText(textbox_autohealth)) and health_downtimer<=0 then
- health_downtimer=10
- for i=1 to length(item_list) do
- if item_list[i][1]=imagedata_health then
- SendKeys(sprint(item_list[i][5]-4))
- --?item_list[i][5]-4
- exit
- end if
- end for
- end if
- else
- health_downtimer=0
- end if
- flag_loot=0
- --loot checking to see if there is loot
- j=1
- row=3
- for xx=icon_pading to 44*4 by 44 do
- 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)
- if equal(peek({address1 + 3 * (sx+xx)+ (sy+icon_pading+(icon_offset*row)+loot_v_offset) * bytesline, 3}),loot_board_color)=1 then
- flag_loot=1
- end if
- j+=1
- end for
- if flag_loot=1 then
- flag_loot=0
- j=5
- row=4
- for xx=icon_pading to 44*4 by 44 do
- 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)
- if equal(peek({address1 + 3 * (sx+xx)+ (sy+icon_pading+(icon_offset*row)+loot_v_offset) * bytesline, 3}),loot_board_color)=1 then
- flag_loot=1
- end if
- j+=1
- end for
- end if
- if flag_loot=1 then
- --loot
- j=1
- row=3
- for xx=icon_pading to 44*4 by 44 do
- 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)
- item_postions=append(item_postions,{sx+xx, sy+icon_pading+(icon_offset*row)+loot_v_offset})
- --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)
- ret=image_is_know(item_dib)
- --?ret
- if length(ret)=0 then
- --need to save the image into the unknow folder
- --use the imagedata_id for fname
- --add it to the correct imagedata_list
- --result = saveDib(item_dib, "images\\unknow\\"&sprint(imagedata_id)&".bmp", 0, 0, 34-1, 34-1)
- maindib_list=append(maindib_list,copyDib(item_dib) )
- imagedata_list[imagedata_unknow]=append(imagedata_list[imagedata_unknow],{imagedata_id,length(maindib_list),{}})
- imagedata_id+=1
- else
- item_list=append(item_list,ret&{row,j})
- end if
- j+=1
- end for
- j=5
- row=4
- for xx=icon_pading to 44*4 by 44 do
- 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)
- --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)
- item_postions=append(item_postions,{sx+xx, sy+icon_pading+(icon_offset*row)+loot_v_offset})
- ret=image_is_know(item_dib)
- --?ret
- if length(ret)=0 then
- --need to save the image into the unknow folder
- --use the imagedata_id for fname
- --add it to the correct imagedata_list
- --result = saveDib(item_dib, "images\\unknow\\"&sprint(imagedata_id)&".bmp", 0, 0, 34-1, 34-1)
- maindib_list=append(maindib_list,copyDib(item_dib) )
- imagedata_list[imagedata_unknow]=append(imagedata_list[imagedata_unknow],{imagedata_id,length(maindib_list),{}})
- imagedata_id+=1
- else
- item_list=append(item_list,ret&{row,j})
- end if
- j+=1
- end for
- if autoloot=0 then
- --loot detected
- if equal(inv_slots,{1,1,1,1, 1,1,1,1})=0 then --there at least one empty slot
- for i=1 to length(item_list) do
- if item_list[i][1]=2 or canloot(item_list[i][1])=1 then
- if item_list[i][4]=3 then
- autoloot=1
- elsif item_list[i][4]=4 then
- autoloot=1
- end if
- if autoloot=1 then
- if item_list[i][5]<=4 then
- source=item_postions[((4*3))+item_list[i][5]]
- else
- source=item_postions[((4*3))+item_list[i][5]]
- end if
- exit
- end if
- end if
- end for
- if autoloot=1 then
- for i=1 to length(inv_slots) do
- if inv_slots[i]=0 then
- if i<=4 then --row 1
- dest=item_postions[((4*1))+i]
- else -- row 2
- dest=item_postions[((4*1))+i]
- end if
- end if
- end for
- dest+=15
- source+=15
- setPointerPos(source)
- dragPointerTo(dest)
- --?source
- --?dest
- setTimer(Window1,1002,200)
- end if
- end if
- end if
- end if
- end procedure
- constant minmap1={171,231}
- constant minmap2={171,240}
- procedure rotmg_detected()
- atom address1
- integer bytesline
- integer found_hp,found_mp,search_exit,count
- count=0
- found_hp=0
- found_mp=0
- address1 = dib[DibMemory]
- bytesline= dib[DibBytesPerLine]
- flag_detected=0
- for yy=0 to size[2]-50 by 10 do
- for xx=0 to size[1]-50 by 50 do
- found_hp=1
- found_mp=1
- search_exit=0
- for y=yy to yy+4 do
- for x=xx to xx+4 do
- if equal(peek({address1 + 3 * x + y * bytesline, 3}),hp_color)=0 then
- found_hp=0
- search_exit=1
- exit
- end if
- end for
- if search_exit=1 then
- exit
- end if
- end for
- search_exit=0
- for y=yy+22 to yy+26 do
- for x=xx to xx+4 do
- if equal(peek({address1 + 3 * x + y * bytesline, 3}),mp_color)=0 then
- found_mp=0
- search_exit=1
- exit
- end if
- end for
- if search_exit=1 then
- exit
- end if
- end for
- search_exit=0--very important here
- if found_hp=1 and found_mp=1 then
- search_x=xx
- search_y=yy
- flag_detected=1
- search_exit=1
- exit
- end if
- end for
- if search_exit=1 then
- exit
- end if
- end for
- if flag_detected=1 then
- flag_detected=0
- for x=search_x to search_x-200 by -1 do
- if equal(peek({address1 + 3 * x + search_y * bytesline, 3}),board_color)=1 then
- search_x=x+3--53,53,139
- --?peek({address1 + 3 * search_x + search_y * bytesline, 3})
- flag_detected=1
- exit
- end if
- end for
- if flag_detected=1 then
- flag_detected=0
- for y=search_y to search_y-30 by -1 do
- if equal(peek({address1 + 3 * search_x + y * bytesline, 3}),board_color)=1 then
- search_y=y+1--53,53,139
- --?peek({address1 + 3 * search_x + search_y * bytesline, 3})
- --================new code state machine
- flag_detected=1-- new state machine for detection of the game 2 used to be 1 it affects the below code
- exit
- end if
- end for
- end if
- --new ---============================
- flag_detected=0
- 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
- 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
- flag_detected=1
- end if
- end if
- end if
- --leave this function with flag_detected 0 or 1
- setText(label_fps,"fps: "&sprint(fps))
- setText(label_detected,"Rotmg Detected: "&sprint(flag_detected))
- setText(label_x,"wx: "&sprint(search_x))
- setText(label_y,"wy: "&sprint(search_y))
- setText(label_nexus,"In nexus: "&sprint(flag_nexus))
- setText(label_health,"Health: "&sprint(count))
- end procedure
- integer popup_timer
- popup_timer=0
- procedure rotmg_detected2()
- atom address1
- integer bytesline
- integer count
- sequence pos
- count=0
- address1 = dib[DibMemory]
- bytesline= dib[DibBytesPerLine]
- flag_detected=0
- 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
- 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
- flag_detected=1
- end if
- end if
- if flag_detected=1 then
- --crap
- for y=0 to 8 do
- for x=0 to 8 do
- --if equal(peek({address1 + 3 * (search_x+nexus_location[1]+x) + ((search_y-nexus_location[2])+y) * bytesline, 3}),nexus_color) then
- --?peek({address1 + 3 * (search_x+nexus_location[1]+x) + (search_y-nexus_location[2]+y) * bytesline, 3})
- --?nexus_location[1]+x
- --?y
- --end if
- end for
- end for
- --crap
- flag_nexus=0
- if equal(peek({address1 + 3 * (search_x+nexus_location[1]) + (search_y-nexus_location[2]) * bytesline, 3}),nexus_color)=1 then
- flag_nexus=1
- end if
- end if
- if flag_detected=1 then--health check
- for x=search_x+24 to search_x+170 do
- if equal(peek({address1 + 3 * x + (search_y+4) * bytesline, 3}),hp_color)=1 then
- count+=1
- else
- 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
- count=0
- end if
- exit
- end if
- end for
- globalhealth=count
- if count!=0 and count<real(getText(textbox_health)) and flag_nexus=0 then
- --go nexus
- SendKeys("=")
- end if
- end if
- if flag_detected=1 then
- pos = getPointerPos()
- if pos[1]<(search_x-30) or pos[1]>(search_x-30)+210 then
- popup_timer-=1
- if popup_timer<0 then
- popup_timer=0
- end if
- if popup_timer=0 then
- auto_loot()
- end if
- else
- popup_timer=10
- end if
- end if
- setText(label_fps,"fps: "&sprint(fps))
- setText(label_detected,"Rotmg Detected: "&sprint(flag_detected))
- setText(label_x,"wx: "&sprint(search_x))
- setText(label_y,"wy: "&sprint(search_y))
- setText(label_nexus,"In nexus: "&sprint(flag_nexus))
- setText(label_health,"Health: "&sprint(count))
- end procedure
- --------------------------------------------------------------------------------
- procedure Window1_onClose (integer self, integer event, sequence params)--params is ()
- loot_settings_save()
- end procedure
- setHandler( Window1, w32HClose, routine_id("Window1_onClose"))
- --------------------------------------------------------------------------------
- procedure Window1_onTimer (integer self, integer event, sequence params)--params is ( int timerId)
- if params[1]=1000 then
- frame+=1
- copyToDib(dib, Screen, 0, 0, 0, 0, size[1] - 1, size[2] - 1) -- copy the screen to the bitmap
- if flag_detected=0 then
- --puts(1,sprint(time())&"\n")
- rotmg_detected()
- elsif flag_detected=1 then
- rotmg_detected2()
- end if
- elsif params[1]=1001 then
- fps=frame
- frame=0
- --?fps
- --?flag_detected
- elsif params[1]=1002 then
- autoloot=0
- killTimer(Window1,1002)
- setPointerPos({search_x-340,search_y-100})
- end if
- end procedure
- setHandler( Window1, w32HTimer, routine_id("Window1_onTimer"))
- WinMain( Window1,Normal )
- --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