- UID
- 157753
- 帖子
- 510
- 主題
- 510
- 精華
- 0
- 積分
- 506
- 楓幣
- 4987
- 威望
- 505
- 存款
- 0
- 贊助金額
- 0
- 推廣
- 0
- GP
- 523
- 閱讀權限
- 50
- 性別
- 保密
- 在線時間
- 14 小時
- 註冊時間
- 2016-9-14
- 最後登入
- 2016-10-23
|
程式
密碼:
102030405060708090Haha
原始碼- #NoTrayIcon
- #SingleInstance, Force
- #NoEnv
- #Include, gdip.ahk
- global layout, tooltipArray, pToken, Scan0, Stride, ts
- SetBatchLines,-1
- SetMouseDelay,-1
- coordmode,mouse,screen
- coordmode,tooltip,screen
- LoadLayout()
- Tooltip()
- ts := new TempSettings()
- ts.Refresh()
- altMouse := 1
- return
- ~F12::
- ~home::
- ~delete::
- Tooltip()
- return
- ~up::Tooltip(,-1)
- ~down::Tooltip(,1)
- ~right::Tooltip(1)
- ~left::Tooltip(-1)
- aim:
- if (!active) {
- active := true
- while (GetKeyState(strreplace(a_thishotkey,"~"),"P")) {
- match := false
- QPX(True)
-
- movepoint := new point(0,0)
- movepoint2 := new point(0,-1)
-
- if (ts.alternative == 1) {
- pbmp := Gdip_BitmapFromScreen(ts.search_offset.x "|" ts.search_offset.y "|" ts.dimensions.x "|" ts.dimensions.y)
- E1 := Gdip_LockBits(pbmp, 0, 0, ts.dimensions.x, ts.dimensions.y, Stride, Scan0, BitmapData,1)
- }
- else if (ts.alternative == 2) {
-
- }
- else {
- pbmp := BitmapFromScreen2(ts.search_offset.x, ts.search_offset.y, ts.dimensions.x, ts.dimensions.y,ts.dc)
- E1 := Gdip_LockBits(pbmp, 0, 0, ts.dimensions.x, ts.dimensions.y, Stride, Scan0, BitmapData,1,0x21808)
- }
- loop % (ts.dimensions.max()/ts.spread)**2 {
- if ((-ts.dimensions.x/2 < movepoint.x) <= ts.dimensions.x/2) && ((-ts.dimensions.y/2 < movepoint.y) <= ts.dimensions.y/2) {
- search_point := new point((movepoint.x*ts.spread) + (ts.dimensions.x/2), (movepoint.y*ts.spread) + (ts.dimensions.y/2))
- if (search_point.x >= 0 && search_point.x < ts.dimensions.x) && (search_point.y >= 0 && search_point.y < ts.dimensions.y) {
-
- ;~ GetRGB(search_point,"dwm|" handle,r,g,b)
- GetRGB(search_point,"",r,g,b)
-
- if (r > 240 && g < 20 && b < 20) && (b > 0) && (g == 0) {
-
- match := true
-
- found_point := new point(search_point.x-3,search_point.y)
- FindLeftEdge(found_point)
-
- mouse_point := new point((ts.search_offset.x+found_point.x)-ts.window_center.x, (ts.search_offset.y+found_point.y-ts.offset_y)-ts.window_center.y)
-
- DllCall("mouse_event", "UInt", 0x01, "UInt", (mouse_point.x+ts.mouse_offset.x)/ts.ingame_sens, "UInt", (mouse_point.y+ts.mouse_offset.y)/(ts.ingame_sens*2.41))
-
- ;~ if (!altMouse)
- ;~ match_search_offset := new point(ts.window_center.x+(mouse_point.x*0.5)-ts.match_dimensions.x/1.5 , ts.window_center.y+(mouse_point.y*0.5)-ts.match_dimensions.y/2+ts.offset_y)
- ;~ else
- match_search_offset := new point(ts.window_center.x+(mouse_point.x)-ts.match_dimensions.x+ts.mouse_offset.x, ts.window_center.y+(mouse_point.y)-ts.match_dimensions.y+ts.mouse_offset.y+ts.offset_y)
- }
- }
- }
- if (!match) {
- if (movepoint.x == movepoint.y || (movepoint.x < 0 && movepoint.x == -movepoint.y) || (movepoint.x > 0 && movepoint.x == 1-movepoint.y)) {
- movepoint2.swap()
- }
- movepoint.add(movepoint2.x,movepoint2.y)
- }
- } until (match)
-
-
- if (match) {
- ts.dimensions := new point(ts.match_dimensions.x,ts.match_dimensions.y)
- ts.search_offset := match_search_offset
- if (ts.overlayShow)
- overlay(ts.search_offset.x, ts.search_offset.y, ts.dimensions.x, ts.dimensions.y,,1)
- dur := QPX(false)
- if (dur < 0.008) {
- delay(0.008-dur)
- }
- }
- else {
- if (ts.dimensions.max() < ts.start_dimensions.min()) {
- ts.dimensions.x += 200
- ts.dimensions.y += 100
- ts.search_offset.sub(100,50)
- if (ts.overlayShow)
- overlay(ts.search_offset.x, ts.search_offset.y, ts.dimensions.x, ts.dimensions.y,,1)
- }
- else {
- ts.dimensions := ts.start_dimensions
- ts.search_offset := ts.start_search_offset
- if (ts.overlayShow)
- overlay(ts.search_offset.x, ts.search_offset.y, ts.dimensions.x, ts.dimensions.y)
- }
- dur := QPX(false)
- if (dur < 0.008) {
- delay(0.008-dur)
- }
-
- }
-
- Gdip_UnlockBits(pbmp, BitmapData)
- Gdip_DisposeImage(pbmp)
-
- }
- active := false
- }
- ts.dimensions := ts.start_dimensions
- ts.search_offset := ts.start_search_offset
- overlay(ts.search_offset.x, ts.search_offset.y, ts.dimensions.x, ts.dimensions.y)
- return
- FindHPBar() {
-
- }
- GetRGB(point,mode,byref r, byref g, byref b) {
- mode := strsplit(mode,"|")
- if (mode[1] == "dwm") {
- Gdip_FromRGB(DllCall("gdi32.dll\GetPixel", "UInt", ts.dc, "Int", point.x, "Int", point.y, "UInt"),b,g,r)
-
- }
- else
- Gdip_FromRGB(NumGet(Scan0+0, (point.x*3)+(point.y*Stride)),r,g,b)
- }
- FindLeftEdge(byref found_point) {
- mismatch := 0
- loop 100{
- if (found_point.x < 0 || found_point.x > dimensions.x)
- mismatch := 9
- GetRGB(search_point,"",r,g,b)
- if !((r > 200 && g < 100 && b < 100))
- mismatch++
- else
- mismatch := 0
- found_point.x-=2
- } until % mismatch > 8
- }
- BitmapFromScreen2(s_x,s_y,s_w,s_h,dc) {
- chdc := CreateCompatibleDC(dc), hbm := CreateDIBSection(s_w, s_h, chdc), obm := SelectObject(chdc, hbm)
- BitBlt(chdc, 0, 0, s_w, s_h, dc, s_x, s_y)
-
- pbmp := Gdip_CreateBitmapFromHBITMAP(hbm)
- SelectObject(chdc, obm), DeleteObject(hbm), DeleteDC(chdc)
- return pbmp
- }
- Gdip_FromRGB(RGB, ByRef R, ByRef G, ByRef B)
- {
- R := (0x00ff0000 & RGB) >> 16
- G := (0x0000ff00 & RGB) >> 8
- B := 0x000000ff & RGB
- }
- Delay( D=0.001 ) {
- Static F
- Critical
- F ? F : DllCall( "QueryPerformanceFrequency", Int64P,F )
- DllCall( "QueryPerformanceCounter", Int64P,pTick ), cTick := pTick
- While( ( (Tick:=(pTick-cTick)/F)) <D ) {
- DllCall( "QueryPerformanceCounter", Int64P,pTick )
- Sleep -1
- }
- Return Round( Tick,3 )
- }
- QPX( N=0 ) {
- Static F,A,Q,P,X
- If ( N && !P )
- Return DllCall("QueryPerformanceFrequency",Int64P,F) + (X:=A:=0) + DllCall("QueryPerformanceCounter",Int64P,P)
- DllCall("QueryPerformanceCounter",Int64P,Q), A:=A+Q-P, P:=Q, X:=X+1
- Return ( N && X=N ) ? (X:=X-1)<<64 : ( N=0 && (R:=A/X/F) ) ? ( R + (A:=P:=X:=0) ) : 1
- }
- overlay(x ,y ,w ,h, create=0,c=0) {
- static overlay_ID
- if (!overlay_ID) {
- Gui, 2: +E0x20 -Caption +E0x80000 +LastFound +AlwaysOnTop +ToolWindow +OwnDialogs
- Gui, 2: Show,,Window
- overlay_ID := WinExist()
- }
- overlay_dib := CreateDIBSection(w, h)
- overlay_dc := CreateCompatibleDC()
- overlay_obm := SelectObject(overlay_dc, overlay_dib)
- G := Gdip_GraphicsFromHDC(overlay_dc)
- if (!c)
- overlay_pen := Gdip_CreatePen(Gdip_ToARGB(255,255,0,0), 2)
- else
- overlay_pen := Gdip_CreatePen(Gdip_ToARGB(255,0,255,0), 2)
- Gdip_DrawRectangle(G, overlay_pen, 0, 0, w, h)
- Gdip_DeletePen(overlay_pen)
- UpdateLayeredWindow(overlay_ID, overlay_dc, x, y, w, h)
- SelectObject(overlay_dc, overlay_obm)
- DeleteObject(overlay_dib)
- DeleteDC(overlay_dc)
- Gdip_DeleteGraphics(G)
- }
- class point {
- __new(x,y) {
- this.x := x
- this.y := y
- }
- swap() {
- ty := -this.y
- this.y := this.x
- this.x := ty
- }
- max() {
- if (this.x > this.y)
- return % this.x
- else
- return % this.y
- }
- min() {
- if (this.x < this.y)
- return % this.x
- else
- return % this.y
- }
- add(x,y) {
- this.x += x
- this.y += y
- }
- sub(x,y) {
- this.x -= x
- this.y -= y
- }
- }
- pickItem(subs,val=0) {
- temp := strsplit(layout[subs],"|")
- if (instr(temp[1],"num")) {
- temp2 := strsplit(temp[1],":")
- newVal := temp[2]+(temp2[2]*val)
- if (newVal >= 0) {
- if (temp2[2] < 1)
- temp[2] := round(newVal,2)
- else
- temp[2] := round(newVal,0)
- }
- layout[subs] := temp[1] "|" temp[2]
- return % temp[2]
- }
- else if (instr(temp[1],"bool")) {
- temp2 := strsplit(temp[1],":")
- temp[1] := temp2[1] ":" !temp2[2]
- temp[2] := (temp2[2]) ? "Enabled" : "Disabled"
- layout[subs] := temp[1] "|" temp[2]
- return % temp[2]
- }
- ;~ else if (instr(temp[1],"btn")) {
- ;~ if (val)
- ;~ MsgBox sup
- ;~ }
- else {
- temp[1] += val
- retStr := strsplit(temp[2],";")[temp[1]]
- if (!retStr)
- temp[1] -= val
- else if (subs == "1a. Mode" && val) {
- LoadLayout(temp[1],temp[1]-val)
- }
- layout[subs] := temp[1] "|" temp[2]
- return % strsplit(temp[2],";")[temp[1]]
- }
- }
- Tooltip(newTab=0,newItem=0) {
- static activeTab, activeItem, toggle, x, y
- if (toggle == "")
- toggle := 1
-
- if (!newTab && !newItem) {
- toggle := ! toggle
- mousegetpos,x,y
- }
-
-
- if (toggle) {
- activeItem := (!newItem && !activeItem) ? 1 : activeItem+newItem ;() ? activeItem+newItem : activeItem
- if (activeItem == 1)
- activeTab := (!newTab && !activeTab) ? 1 : (activeTab+newTab > 0 && activeTab+newTab <= tooltipArray["tabCount"]) ? activeTab+newTab : activeTab
- else
- addItem := newTab
- for tabName in tooltipArray {
- if (a_index == activeTab) {
-
- for t in tooltipArray[tabName]
- itemCount := a_index
- if (activeItem < 1 || activeItem > itemCount+1)
- activeItem := activeItem-newItem
-
- if (activeItem == 1)
- nText .= "|[" strsplit(tabName,".")[2] "]|`n"
- else
- nText .= strsplit(tabName,".")[2] "`n"
-
- for subs in tooltipArray[tabName] {
-
- if (a_index+1 == activeItem) {
- if (addItem) {
- tooltipArray[tabName,subs] := pickItem(subs,addItem)
- }
- if (!tooltipArray[tabName,subs])
- nText .= "|[" strsplit(subs,".")[2] "]|"
- else
- nText .= strsplit(subs,".")[2] ": " "|[" tooltipArray[tabName,subs] "]|`n"
- }
- else {
- if (!tooltipArray[tabName,subs])
- nText .= strsplit(subs,".")[2]
- else
- nText .= strsplit(subs,".")[2] ": " tooltipArray[tabName,subs] "`n"
-
- }
- }
- }
- }
- tooltip, % rTrim(nText,"`n"), % x, % y
- }
- else
- tooltip,
-
- if (ts.overwatch) {
- ts.Refresh()
- }
- }
- LoadLayout(num=1,pnum=0) {
- if (pnum) {
- SaveLayout(pnum)
- }
- layout := array(), tooltipArray := array()
-
- if (!fileexist("layout.dat")) {
- loop 23 {
- fileappend, % a_index ";1;15.00;70;30;8;400;300;200;100;1;0`r`n",layout.dat
- }
- }
- fileread,strIn,layout.dat
- loop,parse,strIn,`r`n
- {
- if (a_loopfield) {
- temp := strsplit(a_loopfield,";")
- if (temp[1] == num) {
- layout["1a. Mode"] := num "|Default;Ana;Bastion;D.V.A;Genji;Hanzo;Junkrat;Lúcio;McCree;Mei;Mercy;Pharah;Reaper;Reinhardt;Roadhog;Soldier: 76;Symmetra;Tracer;Torbjörn;Widowmaker;Winston;Zarya;Zenyatta"
- layout["1b. Hotkeys"] := temp[2] "|LButton;RButton;LAlt;LButton, RButton;LButton, RButton, LAlt"
- layout["2a. Ingame sensitivity"] := "num:0.05|" temp[3]
- layout["2b. Mouse offset X"] := "num:1|" temp[4]
- layout["2c. Mouse offset Y"] := "num:1|" temp[5]
- layout["3a. Search spread"] := "num:1|" temp[6]
- layout["3b. Start width"] := "num:20|" temp[7]
- layout["3c. Start height"] := "num:20|" temp[8]
- layout["3d. Match width"] := "num:20|" temp[9]
- layout["3f. Match height"] := "num:20|" temp[10]
- layout["4a. Display overlay"] := "bool:" temp[11] "|Disabled"
- layout["4b. Alternative search"] := "bool:" temp[12] "|Disabled"
-
- }
- }
- }
- menuLayout := "1.Profile|1a. Mode,1b. Hotkeys;"
- . "2.Mouse Settings|2a. Ingame sensitivity,2b. Mouse offset X,2c. Mouse offset Y;"
- . "3.Search Settings|3a. Search spread,3b. Start width,3c. Start height,3d. Match width,3f. Match height;"
- . "4.General Settings|4a. Display overlay,4b. Alternative search"
-
- loop,parse,menuLayout,`;
- {
- tabName := strsplit(a_loopfield,"|")
- subs := strsplit(tabName[2],",")
- loop % subs.length(){
- tooltipArray[tabName[1],subs[a_index]] := pickItem(subs[a_index])
- }
- len := a_index
- }
- tooltipArray["tabCount"] := len
- }
- class TempSettings {
- Refresh() {
- static hotkeys
-
- if (winexist("ahk_class TankWindowClass") && !ts.overwatch) {
- this.overwatch := true
- ;~ goto runr
- }
- else {
- while !(winexist("ahk_class TankWindowClass")) {
- tooltip, Run overwatch
- sleep, 50
- }
-
- }
- if (!ptoken)
- pToken := Gdip_Startup()
- ;~ winactivate, % "ahk_id " this.handle
- this.handle := winexist("ahk_class TankWindowClass")
- this.dc := GetDC(this.handle)
- pbmp := Gdip_BitmapFromHWND(this.handle) ;
- Gdip_GetDimensions(pbmp, w, h) ;
- Gdip_DisposeImage(pbmp) ;
- ts.window_center := new point(w/2,h/2)
- this.active := strsplit(layout["1a. Mode"],"|")[1]
- ingame_sens := strsplit(layout["2a. Ingame sensitivity"],"|")[2]
- this.mouse_offset := new point(strsplit(layout["2b. Mouse offset X"],"|")[2], strsplit(layout["2c. Mouse offset Y"],"|")[2])
- this.spread := strsplit(layout["3a. Search spread"],"|")[2]
- this.start_dimensions := new point(strsplit(layout["3b. Start width"],"|")[2], strsplit(layout["3c. Start height"],"|")[2])
- this.dimensions := this.start_dimensions
- this.match_dimensions := new point(strsplit(layout["3d. Match width"],"|")[2], strsplit(layout["3f. Match height"],"|")[2])
- this.overlayShow := !(strsplit(strsplit(layout["4a. Display overlay"],":")[2],"|")[1])
- this.alternative := !(strsplit(strsplit(layout["4b. Alternative search"],":")[2],"|")[1])
- this.offset_y := -this.dimensions.max()*0.125
- this.start_search_offset := new point(this.window_center.x-(this.dimensions.x/2),(this.window_center.y-(this.dimensions.y/2))+this.offset_y)
- this.search_offset := this.start_search_offset
- cappedFPS := 5
- this.ingame_sens := 0.116*(ingame_sens*(16/cappedFPS))
-
- if (hotkeys)
- loop,parse,hotkeys,`,
- hotkey, % strreplace("~" a_loopfield,a_space,""), aim, off
-
- temp := strsplit(layout["1b. Hotkeys"],"|")
- hotkeys := strsplit(temp[2],";")[temp[1]]
-
- loop,parse,hotkeys,`,
- hotkey, % strreplace("~" a_loopfield,a_space,""), aim, on
-
- if (this.overlayShow)
- overlay(this.search_offset.x, this.search_offset.y, this.start_dimensions.x, this.start_dimensions.y,1)
-
- }
- }
- SaveLayout(num) {
- for k, v in layout {
- if (a_index <= 2)
- out .= strsplit(v,"|")[1] ";"
- else if (a_index <= 10)
- out .= strsplit(v,"|")[2] ";"
- else
- out .= !strsplit(strsplit(v,":")[2],"|")[1] ";"
- }
- out := rTrim(out,";")
- fileread,strIn,layout.dat
- filedelete,layout.dat
- loop, parse, strIn, `r`n
- {
- if (a_loopfield) {
- temp := strsplit(a_loopfield,";")
- if (temp[1] == num)
- strOut .= out "`r`n"
- else
- strOut .= a_loopfield "`r`n"
- }
- }
- fileappend, % strOut, layout.dat
- }
- rshift::
- GuiClose:
- SaveLayout(ts.active)
- Gdip_DisposeImage(pbmp)
- Gdip_Shutdown(pToken)
- ExitApp
複製代碼 |
[發帖際遇]: Windows 因為參加「太陽花學運」被黨看見,而成功加入DDP側翼網軍,領取網軍獎勵 1 楓幣 |
幸運榜 / 衰神榜 |
|