Advertisement
Guest User

Untitled

a guest
Aug 23rd, 2019
191
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 49.37 KB | None | 0 0
  1. #SingleInstance, Force
  2. #NoEnv
  3. #MaxHotkeysPerInterval 99000000
  4. #HotkeyInterval 99000000
  5. #KeyHistory 0
  6. #Persistent ; Stay open in background
  7. #Include %A_ScriptDir%\Resources\Gdip_All.ahk
  8. #Include %A_ScriptDir%\Resources\Gdip_Ext.ahk
  9.  
  10. ;ListLines Off
  11. Process, Priority, , A
  12. SetBatchLines, -1
  13. SetKeyDelay, -1, -1
  14. SetMouseDelay, -1
  15. SetDefaultMouseSpeed, 0
  16. SetWinDelay, -1
  17. SetControlDelay, -1
  18. SendMode Input
  19. SetTitleMatchMode,2
  20. DetectHiddenWindows, On
  21. SetWorkingDir %A_ScriptDir%
  22. CoordMode, Mouse, Screen
  23. Menu, Tray, Icon, %A_ScriptDir%\Resources\Lookup.ico
  24.  
  25. ; --- Global Variables
  26. global chatlogkey, start, searchkey, exit, configkey, config, title, targetwindowx, targetwindowy, prog, Version_Number, changeLog, Update_URL
  27.  
  28. toggle:=1
  29. config:="config.ini"
  30. PH:="<h1>Phoenix Herald</h1>"
  31. file2=\Electronic Arts\Dark Age of Camelot\
  32. file=chat.log
  33. iniFile=%A_ScriptDir%\config.ini
  34.  
  35. Version_Number := 1.1 ;The script's version number
  36. Update_URL := "https://dcscout.000webhostapp.com/DAoCScout/Version.ini"
  37. changeLog := get("https://dcscout.000webhostapp.com/DAoCScout/changelog.txt")
  38.  
  39. ;--- Tray
  40. Menu, Tray, Icon, %A_ScriptDir%\Resources\Lookup.ico
  41. ;Menu, Tray, NoStandard
  42. Menu, Tray, Tip, DAoC Scout
  43. Menu, Tray, Add, Run, start
  44. Menu, Tray, Add, Config, config
  45. Menu, Tray, Add ; Separator
  46. Menu, Tray, Add, About, About
  47. Menu, Tray, Add, Donate, OpenPayPal
  48. Menu, Tray, Add, Check for Update, Update
  49. Menu, Tray, Add ; Separator
  50. Menu, Tray, Add, Quit,Quit
  51. Menu, Tray, Icon, Run, %A_ScriptDir%\Resources\Lookup.ico
  52. Menu, Tray, Icon, Config, %A_ScriptDir%\Resources\Config.ico
  53.  
  54. ;--- Check for configini and creates if not one
  55. IfNotExist,%config%
  56. {
  57. MsgBox Could not find config.ini. Generating new one.
  58. IniWrite, F2, %config% ,KEYS, start
  59. IniWrite,Escape, %config% ,KEYS, exit
  60. IniWrite, F3, %config% ,KEYS, configkey
  61. IniWrite, F4, %config% ,KEYS, chatlogkey
  62. IniWrite, x0 y0,%config%,WINDOW POSITION,main
  63. IniWrite, x0 y0,%config%,WINDOW POSITION,search
  64. IniWrite, 1,%config%,WINDOW POSITION,targetwindowx
  65. IniWrite, 1,%config%,WINDOW POSITION,targetwindowy
  66. IniWrite, %A_MyDocuments%%file2%%file%,%config%, CHATLOG, file
  67. IniWrite, 1, %config%, OPTIONS, relative
  68. IniWrite, 0, %config%, OPTIONS, Resist1
  69. IniWrite, 0, %config%, OPTIONS, Resist2
  70. IniWrite, 1, %config%, OPTIONS, Resist3
  71. IniWrite, 1, %config%, OPTIONS, dropshadow
  72. IniWrite, Arial, %config%, OPTIONS, Fontstylefont
  73. IniWrite, 16, %config%, OPTIONS, Fontstylesize
  74. IniWrite, 1, %config%, OPTIONS, boldhighlight
  75. Gosub config
  76. }
  77.  
  78. ;--- Read ini file and assign KEYS
  79. IniRead, start, %config%, KEYS, start
  80. IniRead, exit, %config%, KEYS, exit
  81. IniRead, configkey, %config%, KEYS, configkey
  82. IniRead, chatlogkey, %config%, KEYS, chatlogkey
  83. IniRead, chatLog, %config%, CHATLOG, file
  84. IniRead, relative, %config%, OPTIONS, relative , 0
  85. IniRead, Resist1, %config%, OPTIONS,Resist1 , 0
  86. IniRead, Resist2, %config%, OPTIONS,Resist2 , 0
  87. IniRead, Resist3, %config%, OPTIONS,Resist3 , 0
  88. IniRead, dropshadow, %config%,OPTIONS,dropshadow
  89. IniRead, Fontstylefont, %config%, OPTIONS, Fontstylefont
  90. IniRead, Fontstylesize, %config%, OPTIONS, Fontstylesize
  91. IniRead, searchkey, %config%, OPTIONS, searchkey
  92. Loop, Read, %iniFile%
  93. {
  94. checkExist := InStr(A_LoopReadLine,"boldhighlight")-1
  95. }
  96. if checkExist != 0
  97. IniWrite, 1, %config%, OPTIONS, boldhighlight
  98. IniRead, boldhighlight, %config%, OPTIONS, boldhighlight
  99. FileGetSize, filesize, %chatLog%
  100. oldsize:=filesize
  101.  
  102. If (Resist1= 0 and Resist3=0)
  103. AllResist:=2
  104. If (Resist2=0 and Resist3=0)
  105. AllResist:=1
  106. If (Resist1=0 and Resist2=0)
  107. AllResist:=3
  108.  
  109. Hotkey, ~LButton, daoc, off
  110. Hotkey, %start%, start, off
  111. Hotkey, %searchkey%, search, off
  112. Hotkey, %exit%, escape, on
  113. Hotkey, %configkey%, config, on
  114. OnMessage(0x03, "MsgMonitor")
  115. OnMessage(0x201, "WM_LBUTTONDOWN")
  116. If !pToken := Gdip_Startup()
  117. ExitApp
  118.  
  119. Width:=800, height:=800
  120. Gui, 3: -Caption +E0x80000 +LastFound +AlwaysOnTop +ToolWindow +OwnDialogs
  121. Gui, 3: Show, NA
  122. hwnd1 := WinExist()
  123. hbm := CreateDIBSection(Width, Height)
  124. hdc := CreateCompatibleDC()
  125. obm := SelectObject(hdc, hbm)
  126. G := Gdip_GraphicsFromHDC(hdc)
  127. Gdip_SetSmoothingMode(G, 4)
  128. If (dropshadow=0)
  129. {
  130. pBrush := Gdip_BrushCreateSolid(0x590000)
  131. Gdip_FillRectangle(G, pBrush, 0, 0, Width, Height)
  132. Gdip_DeleteBrush(pBrush)
  133. }
  134. Font = %Fontstylefont%
  135. If !Gdip_FontFamilyCreate(Font)
  136. {
  137. MsgBox Font not installed setting to Arial
  138. IniWrite, Arial, %config%, OPTIONS, Fontstylefont
  139. IniRead, Fontstylefont, %config%, OPTIONS, Fontstylefont
  140. Font = %Fontstylefont%
  141. Gdip_FontFamilyCreate(Font)
  142. }
  143.  
  144. Gui,1: +e0x20 +AlwaysOnTop +LastFound -SysMenu
  145. Gui,1: Color, ffffff, ffffff
  146. Gui,1: Font, Normal c1e91bb
  147. Gui,1: Add, Groupbox, x7 y7 h65 w160, [Scout] Quickstart
  148. Gui,1: Font, Normal s8 c000000, Verdana
  149. Gui 1: Add,Text, x15 y24 BackgroundTrans vtext4 w200,%start% - Start Script`n%configkey% - Configurations/FAQ`n%exit% - Exit
  150. gui,1: hide
  151. Update()
  152. Return
  153.  
  154.  
  155. ;updater stuff
  156. Update(){
  157. If winactive("DAoC Scout - Configuration")
  158. return
  159. else{
  160. Gui,ProgressBar: -Caption +Border +AlwaysOnTop
  161. Gui,ProgressBar: Margin, 5,5
  162. Gui,ProgressBar: Add, Picture, x1 y5, Resources\Scout.png
  163. Gui,ProgressBar: Add, Progress, x4 w337 h20 BackgroundC9C9C9 c001216 vProg -Smooth, 50
  164. Gui,ProgressBar: Font, c001216 s9 Normal, Verdana
  165. Gui,ProgressBar: Add, Text, x0 y+5 w310 +Center vProgText BackgroundTrans
  166. Gui,ProgressBar: Show
  167. global ProgText, Prog
  168. GuiControl,ProgressBar:, Prog, 0 ; ProgressBar!
  169. GuiControl,ProgressBar:, ProgText, Checking for updates... ; Infotext in the Progressbar
  170. Sleep 50
  171. Random, p, 1, 10
  172. GuiControl,ProgressBar:, Prog, %p%
  173. Sleep 100
  174. Version_Number = %Version_Number% ;The script's version number
  175. changeLog = %changeLog%
  176. Random, p, 11, 35
  177. GuiControl,ProgressBar:, Prog, %p%
  178. Sleep 100
  179. Update_URL = %Update_URL%
  180. Random,Filler,10000000,99999999
  181. Version_File := A_Temp . "\" . Filler . ".ini"
  182. Random, p, 36, 55
  183. GuiControl,ProgressBar:, Prog, %p%
  184. Sleep 100
  185. UrlDownloadToFile,%Update_URL%,%Version_File%
  186. IniRead,Version,%Version_File%,Info,Version
  187. Random, p, 60, 85
  188. GuiControl,ProgressBar:, Prog, %p%
  189. FileDelete,%Version_File%
  190. GuiControl,ProgressBar:, ProgText, Loading functions... ;
  191. sleep 100
  192. GuiControl,ProgressBar:, Prog, 99
  193. sleep 100
  194. Gui,ProgressBar: Destroy
  195. If (Version > Version_Number)
  196. {
  197. Gui,1: Hide
  198. Gui,Update: +AlwaysOnTop
  199. Gui,Update: Color, ffffff, ffffff
  200. Gui,Update: Add, GroupBox, w430 h90 cGreen, Update available!
  201. Gui,Update: Add, Text, x20 y30, Installed version:
  202. Gui,Update: Add, Text, x20 y+2, Latest version:
  203. If (Version > Version_Number)
  204. {
  205.  
  206. currversColor := "cRed"
  207. newversColor := "cGreen"
  208. }
  209. If (Version <= Version_Number)
  210. {
  211. currversColor := "cBlack"
  212. newversColor := "cBlack"
  213. }
  214.  
  215. Gui,Update: Add, Text, x110 y30 %currversColor%, %Version_Number%
  216. Gui,Update: Add, Text, x110 y+2 %newversColor%, %Version%
  217. Gui,Update: Font, Underline
  218. Gui,Update: Add, Text, x20 y68 gOpenZip c0066cc, Download ZIP
  219. Gui,Update: Font
  220. Gui,Update: Add, Button, x107 y63 gButtonCheckForUpdates, Update
  221. Gui,Update: Add, Picture, x199 y33 w112 h19, %A_ScriptDir%\Resources\discordLogo.png
  222. Gui,Update: Font, Underline
  223. Gui,Update: Add, Text, x200 y61 gOpenDiscord c0066cc, bysanUI/Scout Discord
  224. Gui,Update: Font
  225. Gui,Update: Add, Text, x321 y32 h45 0x11
  226. Gui,Update: Add, Picture, x332 y33 w96 h21, %A_ScriptDir%\Resources\paypalLogo.png
  227. Gui,Update: Font, Underline
  228. Gui,Update: Add, Text, x331 y61 gOpenPayPal c0066cc, Support DAoC-Scout
  229. Gui,Update: Font
  230. Gui,Update: Add, Edit, x10 ReadOnly w430 h238 BackgroundTrans, %changeLog%
  231. Gui,Update: Add, Button, x403 y348 gUpdateClose, Close
  232. Gui,Update: Show, w450 h380 xCenter yCenter, DAoC-Scout Update
  233. Return
  234. }
  235. else
  236. {
  237. hotkey, %start%, on
  238. hotkey, %searchkey%, on
  239. Gui,1: Show, %main% w173 h78 , DAoC Scout
  240. return
  241. }
  242. }
  243. Return
  244. }
  245.  
  246.  
  247. ;--- Start key pushed
  248. start:
  249. Gui,1: hide
  250. ;gui,3:show
  251. Hotkey, ~LButton, toggle
  252. options3=s%Fontstylesize%
  253. Ifwinexist,ahk_exe game.dll
  254. {
  255. winactivate
  256. winwaitactive, ahk_exe game.dll
  257. }
  258. else
  259. winwaitactive, ahk_exe game.dll
  260. return
  261.  
  262. daoc:
  263. If winactive("ahk_exe game.dll")
  264. {
  265. Gui,3:Show, NA
  266. Send {%chatlogkey%}
  267. While A_TimeSinceThisHotkey < 350
  268. {
  269. If A_TimeSinceThisHotkey>=350
  270. Break
  271. }
  272. Send {%chatlogkey%}
  273. While A_TimeSinceThisHotkey < 400
  274. {
  275. If A_TimeSinceThisHotkey>=400
  276. Break
  277. }
  278. g:=0
  279. While (filesize=oldsize)
  280. {
  281. g++
  282. FileGetSize, filesize, %chatLog%
  283. If (filesize != oldsize)
  284. Break
  285.  
  286. If (g>=30)
  287. break
  288. }
  289. oldsize:=filesize
  290.  
  291. lastChar := FindName(chatlog)
  292.  
  293. ; --- Parse Herald
  294. gosub searchfunction
  295.  
  296. ;----
  297. gosub display
  298.  
  299. If (filesize>40000)
  300. {
  301. Filedelete, % chatLog
  302. FileAppend , , chatLog
  303. FileGetSize, filesize, %chatLog%
  304. oldsize:=filesize
  305. }
  306.  
  307. ;clearing variables to free memory
  308. unfName :=
  309. unfGuild :=
  310. unfClass :=
  311. unfLevel :=
  312. unfRankLevel :=
  313. unfRace :=
  314. unfRankName :=
  315. charName :=
  316. unfGuild1 :=
  317. unfGuild2 :=
  318. unfGuild3 :=
  319. charGuild :=
  320. charClass :=
  321. charLevel :=
  322. unfRankLevel1 :=
  323. charRankLevel :=
  324. charRace :=
  325. charRankName :=
  326. lines:=
  327. resistances:=
  328. columns :=
  329. ; end clearing
  330. return
  331. }
  332. return
  333.  
  334. ;--------------------------------------config gui 2
  335. config:
  336. IniRead, start, %config%, KEYS, start
  337. IniRead, exit, %config%, KEYS, exit
  338. IniRead, configkey, %config%, KEYS, configkey
  339. IniRead, chatlogkey, %config%, KEYS, chatlogkey
  340. IniRead, chatLog, %config%, CHATLOG, file
  341. IniRead, relative, %config%, options, relative , 0
  342. IniRead, Resist1, %config%, options, Resist1
  343. IniRead, Resist2, %config%, options, Resist2
  344. IniRead, Resist3, %config%, options,Resist3 , 0
  345. IniRead, dropshadow, %config%,options,dropshadow
  346. IniRead, Fontstylefont, %config%, options, Fontstylefont
  347. IniRead, Fontstylesize, %config%, options, Fontstylesize
  348. IniRead, boldhighlight, %config%, OPTIONS, boldhighlight
  349. IniRead, searchkey, %config%, OPTIONS, searchkey
  350. Hotkey, ~LButton, daoc, off
  351. Hotkey, %start%, start, off
  352. Hotkey, %searchkey%, search, off
  353. Hotkey, %exit%, escape, off
  354. Hotkey, %configkey%, config, off
  355. gui,3: hide
  356. gui,1: hide
  357. Gui,2: +e0x20 +LastFound
  358. Gui,2: Add, Tab3, x0 y5 w619 h341 -wrap, Configuration| FAQ
  359. Gui,2: Font, Normal c1e91bb
  360. Gui,2: Add, Groupbox, x7 y32 w606 h95, [Scout] Instructions
  361. Gui,2: Font,
  362. Gui,2: Add, Text, x16 y51, 1) Select a hotkey to each of the variables. Note: Chatlog have to be an function key (F1-F12).
  363. Gui,2: Add, Text, x16 y+5, 2) Select the directory where your chat.log file is located. Typically this would be in:
  364. Gui,2: Add, Text, x30 y+5, C:\Users\USERNAME\Documents\Electronic Arts\Dark Age of Camelot
  365. Gui,2: Add, Text, x16 y+5, 3) Ingame, do /macro chatlog /chatlog, then do /qbind <bank> <slot> <qbar> and assign it to your selected Chatlog keybind.
  366. Gui,2: Font, Normal c1e91bb
  367. Gui,2: Add, Groupbox, x7 y+13 w143 h120, [Scout] Keybinds
  368. Gui,2: Font,
  369. Gui,2: Add, Text, x61 y155, Start Script
  370. Gui,2: Add, Text, x61 y+10, Chatlog (F1-F12)
  371. Gui,2: Add, Text, x61 y+10, Configurations
  372. Gui,2: Add, Text, x61 y+10, Exit
  373. Gui,2: Font, Normal c1e91bb
  374. Gui,2: Add, Groupbox, x159 y131 w164 h120, [Scout] Options
  375. Gui,2: Font,
  376. Gui,2: Add, Checkbox, x165 y155 Checked%relative%, Use relative realm colors
  377. Gui,2: Font, Normal c1e91bb
  378. Gui,2: Add, Text, x311 y155, ?
  379. Gui,2: Font,
  380. Gui,2: Add, Radio, x165 y+10 gCheck vResist1, Show melee resistances
  381. Gui,2: Add, Radio, x165 y+10 gCheck vResist2, Show all resistances
  382. Gui,2: Add, Radio, x165 y+10 gCheck vResist3, No resists
  383. Gui,2: Font, Normal c1e91bb
  384. Gui,2: Add, Text, x311 y178,?
  385. Gui,2: Font,
  386. Gui,2: Font, Normal c1e91bb
  387. Gui,2: Add, Text, x311 y201,?
  388. Gui,2: Font,
  389. Gui,2: Font, Normal c1e91bb
  390. Gui,2: Add, Text, x311 y224,?
  391. Gui,2: Font,
  392. Gui,2: Add, Text, x307 y156 h14 w1 0x11
  393. Gui,2: Add, Text, x307 y179 h14 w1 0x11
  394. Gui,2: Add, Text, x307 y202 h14 w1 0x11
  395. Gui,2: Add, Text, x307 y225 h14 w1 0x11
  396. Gui,2: Add, Hotkey, x16 y152 w40 h19 vstart, %start%
  397. Gui,2: Add, Hotkey, x16 y+4 w40 h19 vchatlogkey gchatlogged, %chatlogkey%
  398. Gui,2: Add, Hotkey, x16 y+4 w40 h19 vconfigkey, %configkey%
  399. Gui,2: Add, Hotkey, x16 y+4 w40 h19 vexit, %exit%
  400. Gui,2: Font, Normal c1e91bb
  401. Gui,2: Add, Groupbox, x332 y131 w281 h120, [Scout] Fontstyle
  402. Gui,2: Font
  403. Gui,2: Add, DropDownList, x338 y151 w100 vFontstylefont, Arial|Segoe UI|Trebuchet MS|Tahoma|Verdana|-----------------------|Bariol|Gotham|Montserrat|Noto Sans UI|Overpass|Ubuntu Mono
  404. Gui,2: Add, DropDownList, x338 y+2 w100 vFontstylesize, 12|13|14|15|16|17|18|19|20|21|22|23|24
  405. Gui,2: Add, Text, x442 y155, Fontname
  406. Gui,2: Add, Text, x442 y+10, Fontsize
  407. Gui,2: Add, Checkbox, x338 y+10 vdropshadow, Font with dropshadow
  408. Gui,2: Add, Checkbox, x338 y+10 vboldhighlight, Bold highlights
  409. Gui,2: Font, Normal c1e91bb
  410. Gui,2: Add, Groupbox, x7 y255 w606 h56, [Scout] Chatlog Directory
  411. Gui,2: Font,
  412. Gui,2: Add, Edit, x14 y276 w400 h19 +ReadOnly vChatlogLoc,%Chatlog%
  413. Gui,2: Add, Button, x416 y275 w20 h21 gchatlog, ...
  414. Gui,2: Add, Button, x7 y+22 w64 h19 gbuttonsave, Save
  415. Gui,2: Show, w619 h342 Center, DAoC Scout - Configuration
  416. Gui,2: Tab, 2
  417. Gui,2: Font, Normal c1e91bb
  418. Gui,2: Add, Groupbox, x7 y32 w606 h85, [Scout] About
  419. Gui,2: Font,
  420. Gui,2: Add, Text, x16 y51, The script uses the chat.log-file to determine your last target and looks the target up using the Phoenix Herald. It does not`nread or modIfy any game files, and all information is publicly available. Use at your own risk as the script has yet to be`napproved (or disapproved). Read more in the "About" Section.
  421. Gui,2: Add, Text, x16 y+5, The script is programmed in Autohotkey by Bysan and Teehehe with inspiration from Lerox.
  422. Gui,2: Font, Normal c1e91bb
  423. Gui,2: Add, Groupbox, x7 y122 w606 h59, [Scout] Contact
  424. Gui,2: Font,
  425. Gui,2: Add, Text, x16 y141, Errors and questions can be reported at:
  426. Gui,2: Font, underline
  427. Gui,2: Add, Text, x25 y+5 gOpenDiscord c0066cc,- Discord
  428. Gui,2: Font
  429. SetTimer, ToolTip
  430. var_Static9 = Target info color based on realm color. ; Put this at the top along with any others you want to try.
  431. var_Static10 = Shows Crush/Thrust/Slash resistances.`nGreen = Vulnerable`nRed = Resistant`nWhite = Neutral
  432. var_Static11 = Shows Crush/Thrust/Slash in addition to caster type vulnerabilities.`nGreen = Vulnerable`nRed = Resistant`nWhite = Neutral
  433. var_Static12 = Shows no resists.
  434. GuiControl,2: , Button5, %Resist1%
  435. GuiControl,2: , Button6, %Resist2%
  436. GuiControl,2: , Button7, %Resist3%
  437. GuiControl,2: , Button9, %dropshadow%
  438. GuiControl,2: , Button10, %boldhighlight%
  439. GuiControl,2: ChooseString, Fontstylefont, %Fontstylefont%
  440. GuiControl,2: ChooseString, Fontstylesize, %Fontstylesize%
  441. options3=s%Fontstylesize%
  442. ToolTip:
  443. MouseGetPos, , , id, control
  444. WinGetTitle, title, ahk_id %id%
  445. If title = DAoC Scout - Configuration
  446. {
  447. tmpVar := var_%control%
  448. ToolTip, %tmpVar%
  449. }
  450. Return
  451.  
  452. ;-------------------------------------web function
  453.  
  454. get(URL){
  455. ComObjError(false)
  456. r:=ComObjCreate("WinHttp.WinHttpRequest.5.1")
  457. r.Open("GET", URL, true),r.Send(),r.WaitForResponse()
  458. return r.ResponseText
  459. }
  460. ;----------------------------------------------
  461.  
  462. ;--------------------------------------------readchatlog for target line
  463. FindName(chatLog){
  464. Loop, Read, % chatLog
  465. line_count := A_Index
  466. Loop, 30
  467. {
  468. lineIndex := (line_count-A_Index+1)
  469. FileReadLine, string, %chatLog%, %lineIndex%
  470. If RegExMatch(string, "You target \[(.*)\]\.", Output)
  471. Return Output1
  472. If lineIndex = 0
  473. Return
  474. }
  475. }
  476. ----------------------------------------
  477.  
  478. Check:
  479. gui, submit, nohide
  480. Return
  481. Quit:
  482. ExitApp
  483. OpenPayPal:
  484. Run "https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=TMRB3RCMXPGBN&source=url"
  485. Return
  486. OpenDiscord:
  487. Run "https://discord.gg/cARRWM3"
  488. Return
  489. OpenZIP:
  490. Run "https://dcscout.000webhostapp.com/DAoCScout/DAoCScout.zip"
  491. Return
  492. AboutClose:
  493. DllCall("AnimateWindow",UInt,GUI_ID,UInt,750,UInt,0x90000)
  494. Gui, About:Cancel
  495. Return
  496.  
  497.  
  498. ;----------------------------------exit
  499. Escape:
  500. ExitApp
  501. Return
  502.  
  503.  
  504. ;--------------------------close config window
  505. 2GuiClose:
  506. Gui, 2:destroy
  507. GuiControl,1: , text4,%start% - Start Script`n%configkey% - Configurations/FAQ`n%exit% - Exit
  508. Gui,1: Show, %main% w173 h78 , DAoC Scout
  509. Hotkey, %start%, start, on
  510. Hotkey, %exit%, escape, on
  511. Hotkey, %configkey%, config, on
  512. Hotkey, %searchkey%, search, on
  513. Return
  514.  
  515. ;-------------------------folder select
  516. chatlog:
  517. Gui,2: +OwnDialogs
  518. fileselectfolder, folder
  519. folder:= RegExReplace(Folder, "\\$")
  520. IniWrite, %CHATLOG%, %config%, CHATLOG, file
  521. GuiControl, , ChatlogLoc, %chatLog%
  522. Return
  523.  
  524. ;--------------------------------------save button
  525. buttonsave:
  526. GuiControlGet, start, 2:
  527. GuiControlGet, exit, 2:
  528. GuiControlGet, configkey, 2:
  529. GuiControlGet, chatlogkey, 2:
  530. GuiControlGet, relative, 2:
  531. GuiControlGet, Resist1, 2:
  532. GuiControlGet, Resist2, 2:
  533. GuiControlGet, Resist3, 2:
  534. GuiControlGet, dropshadow, 2:
  535. GuiControlget, boldhighlight, 2:
  536. GuiControlget, Fontstylefont, 2:
  537. GuiControlget, Fontstylesize, 2:
  538. ;saves KEYS from gui to ini
  539.  
  540. ;--------------------------checks for duplicate hotkey
  541. Keylist := [start, exit, configkey, chatlogkey]
  542. KEYS :={}
  543. For each, key in keylist
  544. {
  545. If !(KEYS.haskey(key))
  546. KEYS[key] := 1
  547. Else
  548. {
  549. MsgBox Error! Make sure the KEYS are unique!
  550. Return
  551. }
  552. }
  553.  
  554. ;-----------------------------------------
  555. IniWrite, %start%, %config%, KEYS, start
  556. IniWrite, %exit%, %config%, KEYS, exit
  557. IniWrite, %configkey%, %config%, KEYS, configkey
  558. IniWrite, %chatlogkey%, %config%, KEYS, chatlogkey
  559. IniWrite, %relative%, %config%, OPTIONS, relative
  560. IniWrite, %Resist1%, %config%, OPTIONS, Resist1
  561. IniWrite, %Resist2%, %config%, OPTIONS, Resist2
  562. IniWrite, %Resist3%, %config%, OPTIONS, Resist3
  563. IniWrite, %dropshadow%, %config%, OPTIONS, dropshadow
  564. IniWrite, %Fontstylefont%, %config%, OPTIONS, Fontstylefont
  565. IniWrite, %Fontstylesize%, %config%, OPTIONS, Fontstylesize
  566. IniWrite, %boldhighlight%, %config%, OPTIONS, boldhighlight
  567. Gui, 2:destroy
  568. ;------------------------------------------read ini file and assign KEYS
  569. IniRead, start, %config%, KEYS, start
  570. IniRead, exit, %config%, KEYS, exit
  571. IniRead, configkey, %config%, KEYS, configkey
  572. IniRead, chatlogkey, %config%, KEYS, chatlogkey
  573. IniRead, relative, %config%, OPTIONS, relative
  574. IniRead, Resist1, %config%, OPTIONS, Resist1
  575. IniRead, Resist2, %config%, OPTIONS, Resist2
  576. IniRead, Resist3, %config%, OPTIONS, Resist3
  577. IniRead, dropshadow, %config%,OPTIONS, dropshadow
  578. IniRead, boldhighlight, %config%,OPTIONS, boldhighlight
  579. IniRead, Fontstylefont, %config%, OPTIONS, Fontstylefont
  580. IniRead, Fontstylesize, %config%, OPTIONS, Fontstylesize
  581. IniRead, searchkey, %config%, OPTIONS, searchkey
  582. options3=s%Fontstylesize%
  583. Font = %Fontstylefont%
  584. If !Gdip_FontFamilyCreate(Font)
  585. {
  586. MsgBox Font not installed setting to Arial
  587. IniWrite, Arial, %config%, OPTIONS, Fontstylefont
  588. IniRead, Fontstylefont, %config%, OPTIONS, Fontstylefont
  589. Font = %Fontstylefont%
  590. Gdip_FontFamilyCreate(Font)
  591. }
  592. ;-----------------------------------------------
  593. GuiControl,1: , text4,%start% - Start Script`n%configkey% - Configurations/FAQ`n%exit% - Exit
  594. Gui,1: Show, %main% w173 h78 , DAoC Scout
  595. Hotkey, %start%, start, on
  596. Hotkey, %exit%, escape, on
  597. Hotkey, %configkey%, config, on
  598. Hotkey, %searchkey%, search, on
  599. return
  600.  
  601. ;------------------------chatlog key must be a function key possible other KEYS add to list must be wrapped in to work {F1}
  602. ;{ins}{del} etc... https://www.autohotkey.com/docs/commands/Send.htm
  603. chatlogged:
  604. GuiControlGet chatlogkey, 2:
  605. keylist2:=["F1","F2","F3","F4","F5","F6","F7","F8","F9","F10","F11","F12"]
  606. If !Contains(keylist2, chatlogkey)
  607. MsgBox Please enter a function key F1-F12.
  608.  
  609. Contains(obj, chatlogkey) {
  610. for i, val in obj {
  611. If(val = chatlogkey) {
  612. return true
  613. }
  614. }
  615. }
  616. Return
  617.  
  618. GetColor:
  619. alblist:=["Briton","Highlander","Avalonian","Saracen","Inconnu","Half Ogre"]
  620. hiblist:=["Lurikeen","Celt","Sylvan","Firbolg","Elf","Shar"]
  621. midlist:=["Troll","Dwarf","Kobold","Norseman","Valkyn","Frostalf"]
  622. Error:=["Error"]
  623. If Contains(alblist, charRace)
  624. targetColor = cFFd60000
  625. else If Contains(hiblist, charRace)
  626. targetColor = cFF37d600
  627. else If Contains(midlist, charRace)
  628. targetColor = cFF0056d6
  629. else
  630. targetColor=cFFb80af2
  631. Return
  632.  
  633.  
  634. WM_LBUTTONDOWN(){
  635. PostMessage, 0xA1, 2
  636. }
  637.  
  638.  
  639. MsgMonitor(wParam, lParam){
  640. X := lParam & 0xFFFF
  641. Y := lParam >> 16
  642. If (oX!=X)||(oY!=Y)
  643. {
  644. If (A_Gui=1)
  645. {
  646. If (x!=32768)
  647. {
  648. IniWrite, x%X% y%Y%,%config%,WINDOW POSITION,main
  649. }
  650. }
  651. If (A_Gui=2)
  652. {
  653. If (x!=32768)
  654. {
  655. IniWrite, x%X% y%Y%,%config%,WINDOW POSITION,config
  656. }
  657. }
  658. If (A_Gui=3)
  659. {
  660. If (x!=32768)
  661. {
  662. IniWrite, %X%,%config%,WINDOW POSITION,targetwindowx
  663. IniWrite, %Y%,%config%,WINDOW POSITION,targetwindowy
  664. }
  665. }
  666. If (A_Gui="SearchBox")
  667. {
  668. If (x!=32768)
  669. {
  670. IniWrite, x%X% y%Y%,%config%,WINDOW POSITION,search
  671. }
  672. }
  673. oX:=%X%
  674. oY:=%Y%
  675. }
  676.  
  677. }
  678. Return
  679.  
  680.  
  681. UpdateClose:
  682. Gui, Update: Destroy
  683. Gui,1: show, %main% w173 h78 , DAoC Scout
  684. hotkey, %start%, on
  685. hotkey, %searchkey%, on
  686. Return
  687.  
  688. ButtonCheckForUpdates:
  689. Check_ForUpdate(1, 1, "", "")
  690.  
  691. GetResist:
  692. ;alb
  693. If (charClass="Armsman")||(charClass="Paladin")||(charClass="Armswoman")
  694. resistances:={Thrust:["Resistant","cffff0000"],Crush:["Vulnerable","cFF23fa00"],Slash:["Neutral","cffffffff"],Cold:["Vulnerable","cFF23fa00"],Energy:["Neutral","cffffffff"],Heat:["Resistant","cffff0000"],Matter:["Resistant","cffff0000"],Spirit:["Neutral","cffffffff"],Body:["Vulnerable","cFF23fa00"]}
  695. If (charClass="Cleric")||(charClass="Mercenary")||(charClass="Minstrel")||(charClass="Reaver")
  696. resistances:={Thrust:["Vulnerable","cFF23fa00"],Crush:["Resistant","cffff0000"],Slash:["Neutral","cffffffff"],Cold:["Neutral","cffffffff"],Energy:["Vulnerable","cFF23fa00"],Heat:[" Resistant","cffff0000"],Matter:["Neutral","cffffffff"],Spirit:["Neutral","cffffffff"],Body:["Neutral","cffffffff"]}
  697. If (charClass="Scout")
  698. resistances:={Thrust:["Vulnerable","cFF23fa00"],Crush:["Resistant","cffff0000"],Slash:["Neutral","cffffffff"],Cold:["Vulnerable","cFF23fa00"],Energy:["Resistant","cffff0000"],Heat:["Resistant","cffff0000"],Matter:["Vulnerable","cFF23fa00"],Spirit:["Neutral","cffffffff"],Body:["Resistant","cffff0000"]}
  699. If (charClass="Friar")||(charClass="Infiltrator")
  700. resistances:={Thrust:["Resistant","cffff0000"],Crush:["Vulnerable","cFF23fa00"],Slash:["Neutral","cffffffff"],Cold:["Resistant","cffff0000"],Energy:["Neutral","cffffffff"],Heat:[" Vulnerable","cFF23fa00"],Matter:["Neutral","cffffffff"],Spirit:["Neutral","cffffffff"],Body:["Resistant","cffff0000"]}
  701. If (charClass="Theurgist")||(charClass="Wizard")||(charClass="Cabalist")||(charClass="Sorcerer")||(charClass="Necromancer")||(charClass="Sorceress")
  702. resistances:={Thrust:["Neutral","cffffffff"],Crush:["Neutral","cffffffff"],Slash:["Neutral","cffffffff"],Cold:["Neutral","cffffffff"],Energy:["Resistant","cffff0000"],Heat:[" Neutral","cffffffff"],Matter:["Neutral","cffffffff"],Spirit:["Neutral","cffffffff"],Body:["Resistant","cffff0000"]}
  703.  
  704. ;hib
  705. If (charClass="Champion")||(charClass="Druid")||(charClass="Hero")||(charClass="Heroine")||(charClass="Warden")
  706. resistances:={Thrust:["Neutral","cffffffff"],Crush:["Resistant","cffff0000"],Slash:["Vulnerable","cFF23fa00"],Cold:["Vulnerable","cFF23fa00"],Energy:["Vulnerable","cFF23fa00"],Heat:[" Resistant","cffff0000"],Matter:["Resistant","cffff0000"],Spirit:["Neutral","cffffffff"],Body:["Neutral","cffffffff"]}
  707. If (charClass="Bard")||(charClass="Blademaster")||(charClass="Ranger")
  708. resistances:={Thrust:["Neutral","cffffffff"],Crush:["Vulnerable","cFF23fa00"],Slash:["Resistant","cffff0000"],Cold:["Vulnerable","cFF23fa00"],Energy:["Resistant","cffff0000"], Heat:["Resistant","cffff0000"],Matter:["Vulnerable","cFF23fa00"],Spirit:["Neutral","cffffffff"],Body:["Resistant","cffff0000"]}
  709. If (charClass="Nightshade")
  710. resistances:={Thrust:["Neutral","cffffffff"],Crush:["Vulnerable","cFF23fa00"],Slash:["Resistant","cffff0000"],Cold:["Resistant","cffff0000"],Energy:["Neutral","cffffffff"],Heat:[ "Vulnerable","cFF23fa00"],Matter:["Neutral","cffffffff"],Spirit:["Neutral","cffffffff"],Body:["Resistant","cffff0000"]}
  711. If (charClass="Animist")||(charClass="Enchanter")||(charClass="Mentalist")||(charClass="Eldritch")||(charClass="Valewalker")||(charClass="Enchantress")
  712. resistances:={Thrust:["Neutral","cffffffff"],Crush:["Neutral","cffffffff"],Slash:["Neutral","cffffffff"],Cold:["Neutral","cffffffff"],Energy:["Resistant","cffff0000"],Heat:[" Neutral","cffffffff"],Matter:["Neutral","cffffffff"],Spirit:["Neutral","cffffffff"],Body:["Resistant","cffff0000"]}
  713.  
  714. ;mid
  715. If(charClass="Healer")||(charClass="Shaman")||(charClass="Skald")||(charClass="Thane")||(charClass="Warrior")
  716. resistances:={Thrust:["Vulnerable","cFF23fa00"],Crush:["Neutral","cffffffff"],Slash:["Resistant","cffff0000"],Cold:["Neutral","cffffffff"],Energy:["Vulnerable","cFF23fa00"],Heat:["Resistant","cffff0000"],Matter:["Neutral","cffffffff"],Spirit:["Neutral","cffffffff"],Body:["Neutral","cffffffff"]}
  717. If (charClass="Berserker")||(charClass="Hunter")||(charClass="Savage")
  718. resistances:={Thrust:["Resistant","cffff0000"],Crush:["Neutral","cffffffff"],Slash:["Vulnerable","cFF23fa00"],Cold:["Vulnerable","cFF23fa00"],Energy:["Resistant","cffff0000"],Heat:[" Resistant","cffff0000"],Matter:["Vulnerable","cFF23fa00"],Spirit:["Neutral","cffffffff"],Body:["Resistant","cffff0000"]}
  719. If (charClass="Shadowblade")
  720. resistances:={Thrust:["Resistant","cffff0000"],Crush:["Neutral","cffffffff"], Slash:["Vulnerable","cFF23fa00"],Cold:["Resistant","cffff0000"],Energy:["Neutral","cffffffff"],Heat:["Vulnerable","cFF23fa00"],Matter:["Neutral","cffffffff"],Spirit:["Neutral","cffffffff"],Body:["Resistant","cffff0000"]}
  721. If (charClass="Bonedancer")||(charClass="Runemaster")||(charClass="Spiritmaster")
  722. resistances:={Thrust:["Neutral","cffffffff"],Crush:["Neutral","cffffffff"],Slash:["Neutral","cffffffff"], Cold:["Neutral","cffffffff"],Energy:["Resistant","cffff0000"],Heat:["Neutral","cffffffff"],Matter:["Neutral","cffffffff"],Spirit:["Neutral","cffffffff"],Body:["Resistant","cffff0000"]}
  723. Return
  724.  
  725. About:
  726. IfNotEqual, FirstTimeA, No
  727. {
  728. Gui, About:-Caption +Border +LastFound
  729. WinGet GUI_ID, ID
  730. Gui, About:Color, ffffff, ffffff
  731. Gui, About:Font, S10 c1e91bb Bold,verdana
  732. Gui, About:Add, Text, x185 y27 w170 h20, DAoC Scout
  733. Gui, About:Font, S10 CDefault Normal, Verdana
  734. Gui, About:Add, Text, x185 y+3 w270, A Dark Age of Camelot tool that`nlooks up a targets information.
  735. Gui, About:Add, Text, x183 y+5 w248
  736. Gui, About:Font, S7 CDefault normal, Verdana
  737. Gui, About:Add, Text, x185 y92 w410 h73,
  738. (LTrim
  739. The script reads your chat.log to find your
  740. current target, looks the name up on the Phoenix
  741. Herald and returns the essential information.
  742. All information used by the script is publicly
  743. available, and does not read or modIfy any
  744. game files except for the chat.log.
  745. )
  746. Gui, About:Add, Text, x183 y+4 w248
  747. Gui, About:Add, Text, x16 y174 w410 h24,
  748. (LTrim
  749. The script is programmed by Bysan and Teehehe in AHK. For feedback, bug reports and additional information, please visit:
  750. )
  751. Gui, About: Font, underline
  752. Gui, About: Add, Text, x25 y+5 gOpenDiscord c0066cc,- Discord
  753. Gui, About: Font
  754. Gui, About:Add, Button, 0x8000 x362 y+1 w70 h21 gAboutClose, Close
  755. Gui, About:Add, Picture, x17 y17 w150 h150, %A_ScriptDir%\Resources\LookupImg.png
  756.  
  757. FirstTimeA = No
  758. }
  759.  
  760. height := 240
  761. width := 435
  762. Gui, About:Show, Hide h%height% w%width%, DAoC Scout
  763. DllCall("AnimateWindow",UInt,GUI_ID,UInt,750,UInt,0xa0000)
  764. return
  765.  
  766. Check_ForUpdate(_ReplaceCurrentScript = 1, _SuppressMsgBox = 0, _CallbackFunction = "", ByRef _Information = ""){
  767.  
  768. Retry_Count := 3 ;Retry count for If/when anything goes wrong
  769.  
  770. Random,Filler,10000000,99999999
  771. Version_File := A_Temp . "\" . Filler . ".ini"
  772. , Temp_FileName := A_Temp . "\" . Filler . ".tmp"
  773. , VBS_FileName := A_Temp . "\" . Filler . ".vbs"
  774.  
  775. Loop,% Retry_Count
  776. {
  777. _Information := ""
  778.  
  779. UrlDownloadToFile,%Update_URL%,%Version_File%
  780.  
  781. IniRead,Version,%Version_File%,Info,Version,N/A
  782.  
  783. If (Version = "N/A"){
  784. FileDelete,%Version_File%
  785.  
  786. If (A_Index = Retry_Count)
  787. _Information .= "The version info file doesn't have a ""Version"" key in the ""Info"" section or the file can't be downloaded."
  788. Else
  789. Sleep,500
  790.  
  791. Continue
  792. }
  793.  
  794. If (Version > Version_Number){
  795. If (_SuppressMsgBox != 1 and _SuppressMsgBox != 3){
  796. MsgBox,0x4,New version available,There is a new version of %Script_Name% available.`nCurrent version: %Version_Number%`nNew version: %Version%`n`nWould you like to download it now?
  797. IfMsgBox,Yes
  798. MsgBox_Result := 1
  799. }
  800.  
  801. If (_SuppressMsgBox or MsgBox_Result){
  802. IniRead,URL,%Version_File%,Info,URL,N/A
  803.  
  804. If (URL = "N/A")
  805. _Information .= "The version info file doesn't have a valid URL key."
  806. Else {
  807. SplitPath,URL,,,Extension
  808.  
  809. If (Extension = "ahk" And A_AHKPath = "")
  810. _Information .= "The new version of the script is an .ahk filetype and you do not have AutoHotKey installed on this computer.`r`nReplacing the current script is not supported."
  811. Else If (Extension != "exe" And Extension != "ahk")
  812. _Information .= "The new file to download is not an .EXE or an .AHK file type. Replacing the current script is not supported."
  813. Else {
  814. IniRead,MD5,%Version_File%,Info,MD5,N/A
  815.  
  816. Loop,% Retry_Count
  817. {
  818. UrlDownloadToFile,%URL%,%Temp_FileName%
  819.  
  820. IfExist,%Temp_FileName%
  821. {
  822. If (MD5 = "N/A"){
  823. _Information .= "The version info file doesn't have a valid MD5 key."
  824. , Success := True
  825. Break
  826. } Else {
  827. Ptr := A_PtrSize ? "Ptr" : "UInt"
  828. , H := DllCall("CreateFile",Ptr,&Temp_FileName,"UInt",0x80000000,"UInt",3,"UInt",0,"UInt",3,"UInt",0,"UInt",0)
  829. , DllCall("GetFileSizeEx",Ptr,H,"Int64*",FileSize)
  830. , FileSize := FileSize = -1 ? 0 : FileSize
  831.  
  832. If (FileSize != 0){
  833. VarSetCapacity(Data,FileSize,0)
  834. , DllCall("ReadFile",Ptr,H,Ptr,&Data,"UInt",FileSize,"UInt",0,"UInt",0)
  835. , DllCall("CloseHandle",Ptr,H)
  836. , VarSetCapacity(MD5_CTX,104,0)
  837. , DllCall("advapi32\MD5Init",Ptr,&MD5_CTX)
  838. , DllCall("advapi32\MD5Update",Ptr,&MD5_CTX,Ptr,&Data,"UInt",FileSize)
  839. , DllCall("advapi32\MD5Final",Ptr,&MD5_CTX)
  840.  
  841. FileMD5 := ""
  842. Loop % StrLen(Hex:="123456789ABCDEF0")
  843. N := NumGet(MD5_CTX,87+A_Index,"Char"), FileMD5 .= SubStr(Hex,N>>4,1) . SubStr(Hex,N&15,1)
  844.  
  845. VarSetCapacity(Data,FileSize,0)
  846. , VarSetCapacity(Data,0)
  847.  
  848. If (FileMD5 != MD5){
  849. FileDelete,%Temp_FileName%
  850.  
  851. If (A_Index = Retry_Count)
  852. _Information .= "The MD5 hash of the downloaded file does not match the MD5 hash in the version info file."
  853. Else
  854. Sleep,500
  855.  
  856. Continue
  857. } Else
  858. Success := True
  859. } Else {
  860. DllCall("CloseHandle",Ptr,H)
  861. Success := True
  862. }
  863. }
  864. } Else {
  865. If (A_Index = Retry_Count)
  866. _Information .= "Unable to download the latest version of the file from " . URL . "."
  867. Else
  868. Sleep,500
  869. Continue
  870. }
  871. }
  872. }
  873. }
  874. }
  875. } Else
  876. _Information .= "No update was found."
  877.  
  878. FileDelete,%Version_File%
  879. Break
  880. }
  881.  
  882. If (_ReplaceCurrentScript And Success){
  883. SplitPath,URL,,,Extension
  884. Process,Exist
  885. MyPID := ErrorLevel
  886.  
  887. VBS_P1 =
  888. (LTrim Join`r`n
  889. On Error Resume Next
  890. Set objShell = CreateObject("WScript.Shell")
  891. objShell.Run "TaskKill /F /PID %MyPID%", 0, 1
  892. Set objFSO = CreateObject("Scripting.FileSystemObject")
  893. )
  894.  
  895. If (A_IsCompiled){
  896. SplitPath,A_ScriptFullPath,,Dir,,Name
  897. VBS_P2 =
  898. (LTrim Join`r`n
  899. Finished = False
  900. Count = 0
  901. Do Until (Finished = True Or Count = 5)
  902. Err.Clear
  903. objFSO.CopyFile "%Temp_FileName%", "%Dir%\%Name%.%Extension%", True
  904. If (Err.Number = 0) then
  905. Finished = True
  906. objShell.Run """%Dir%\%Name%.%Extension%"""
  907. Else
  908. WScript.Sleep(1000)
  909. Count = Count + 1
  910. End If
  911. Loop
  912. objFSO.DeleteFile "%Temp_FileName%", True
  913. )
  914.  
  915. Return_Val := Temp_FileName
  916. } Else {
  917. If (Extension = "ahk"){
  918. FileMove,%Temp_FileName%,%A_ScriptFullPath%,1
  919. If (Errorlevel)
  920. _Information .= "Error (" . Errorlevel . ") unable to replace current script with the latest version."
  921. Else {
  922. VBS_P2 =
  923. (LTrim Join`r`n
  924. objShell.Run """%A_ScriptFullPath%"""
  925. )
  926.  
  927. Return_Val := A_ScriptFullPath
  928. }
  929. } Else If (Extension = "exe"){
  930. SplitPath,A_ScriptFullPath,,FDirectory,,FName
  931. FileMove,%Temp_FileName%,%FDirectory%\%FName%.exe,1
  932. FileDelete,%A_ScriptFullPath%
  933.  
  934. VBS_P2 =
  935. (LTrim Join`r`n
  936. objShell.Run """%FDirectory%\%FName%.exe"""
  937. )
  938.  
  939. Return_Val := FDirectory . "\" . FName . ".exe"
  940. } Else {
  941. FileDelete,%Temp_FileName%
  942. _Information .= "The downloaded file is not an .EXE or an .AHK file type. Replacing the current script is not supported."
  943. }
  944. }
  945.  
  946. VBS_P3 =
  947. (LTrim Join`r`n
  948. objFSO.DeleteFile "%VBS_FileName%", True
  949. )
  950.  
  951. If (_SuppressMsgBox < 2)
  952. {
  953. If (InStr(VBS_P2, "Do Until (Finished = True Or Count = 5)"))
  954. {
  955. VBS_P3 .= "`r`nIf (Finished = False) Then"
  956. VBS_P3 .= "`r`nWScript.Echo ""Update failed."""
  957. VBS_P3 .= "`r`nElse"
  958. If (Extension != "exe")
  959. VBS_P3 .= "`r`nobjFSO.DeleteFile """ A_ScriptFullPath """"
  960. VBS_P3 .= "`r`nWScript.Echo ""DAoC-Scout has been updated!"""
  961. VBS_P3 .= "`r`nEnd If"
  962. } Else
  963. VBS_P3 .= "`r`nWScript.Echo ""DAoC-Scout has been updated!"""
  964. }
  965.  
  966. FileDelete,%VBS_FileName%
  967. FileAppend,%VBS_P1%`r`n%VBS_P2%`r`n%VBS_P3%,%VBS_FileName%
  968.  
  969. If (_CallbackFunction != ""){
  970. If (IsFunc(_CallbackFunction))
  971. %_CallbackFunction%()
  972. Else
  973. _Information .= "The callback function is not a valid function name."
  974. }
  975.  
  976. RunWait,%VBS_FileName%,%A_Temp%,VBS_PID
  977. Sleep,2000
  978.  
  979. Process,Close,%VBS_PID%
  980. _Information := "Error (?) unable to replace current script with the latest version.`r`nPlease make sure your computer supports running .vbs scripts and that the script isn't running in a pipe."
  981. }
  982.  
  983. _Information := _Information = "" ? "None" : _Information
  984.  
  985. Return Return_Val
  986. }
  987.  
  988. MeasureText(Str, FontOpts = "", Fontstylefont = "") {
  989. Static DT_FLAGS := 0x0520 ; DT_SINGLELINE = 0x20, DT_NOCLIP = 0x0100, DT_CALCRECT = 0x0400
  990. Static WM_GETFONT := 0x31
  991. Size := {}
  992. Gui, New
  993. If (FontOpts <> "") || (Fontstylefont <> "")
  994. Gui, Font, %FontOpts%, %Fontstylefont%
  995. Gui, Add, Text, hwndHWND
  996. SendMessage, WM_GETFONT, 0, 0, , ahk_id %HWND%
  997. HFONT := ErrorLevel
  998. HDC := DllCall("User32.dll\GetDC", "Ptr", HWND, "Ptr")
  999. DllCall("Gdi32.dll\SelectObject", "Ptr", HDC, "Ptr", HFONT)
  1000. VarSetCapacity(RECT, 16, 0)
  1001. DllCall("User32.dll\DrawText", "Ptr", HDC, "Str", Str, "Int", -1, "Ptr", &RECT, "UInt", DT_FLAGS)
  1002. DllCall("User32.dll\ReleaseDC", "Ptr", HWND, "Ptr", HDC)
  1003. Gui, Destroy
  1004. Size.W := NumGet(RECT, 8, "Int")
  1005. Size.H := NumGet(RECT, 12, "Int")
  1006. Return Size, W
  1007. }
  1008.  
  1009. search:
  1010. If winexist("Search")
  1011. {
  1012. gui, SearchBox: Destroy
  1013. }
  1014.  
  1015. else
  1016. {
  1017. IniRead, search, %config%, WINDOW POSITION, search
  1018. ;Width := 148, Height := 48
  1019. ;BorderWidth := 2
  1020.  
  1021. ;pBitmap := Gdip_CreateBitmap(Width, Height), G := Gdip_GraphicsFromImage(pBitmap)
  1022. ;pPen := Gdip_CreatePen(0xFF1a262f, BorderWidth)
  1023. ;Gdip_DrawRectangle(G, pPen, BorderWidth//2, BorderWidth//2, Width-BorderWidth, Height-BorderWidth)
  1024. ;hBitmap := Gdip_CreateHBITMAPFromBitmap(pBitmap)
  1025. options3=s%Fontstylesize%
  1026. Set = 1
  1027.  
  1028. glassGrey = %A_ScriptDir%\Resources\magGlassGrey.png
  1029. glassBlue = %A_ScriptDir%\Resources\magGlassBlue.png
  1030.  
  1031. Gui, SearchBox: -Caption +LastFound +AlwaysOnTop +ToolWindow +OwnDialogs
  1032. Gui, SearchBox: Margin, 5, 5
  1033. Gui, SearchBox: Add, Picture, % "x0 y0 w" Width-10 " h" Height-6 " 0xE hwndImage" ;%
  1034. SetImage(Image, hBitmap)
  1035. Gui, SearchBox: Color, ffffff
  1036. Gui, SearchBox: Color,, f0f0f0
  1037. Gui, SearchBox: Font, Normal c1e91bb
  1038. Gui, SearchBox: Add, Groupbox, x5 y5 w138 h38, [Scout] Lookup
  1039. Gui, SearchBox: Font, Bold c1e91bb, Verdana
  1040. Gui, SearchBox: Add, Edit, x14 y22 h13 w107 -E0x200 -VScroll vSearchInput,
  1041. Gui, SearchBox: Add, Picture, x121 y22 h13 w13 hwndmagGlass vmagGlass gSearchInput, %glassGrey%
  1042. Gui, SearchBox: Add,Button, Default gSearchInput h0 w0,
  1043. Gui, SearchBox: Font,
  1044. Gui, SearchBox: Show, %search% w148 h48, Search
  1045.  
  1046. SetTimer, MouseOvermagGlass ,1
  1047.  
  1048.  
  1049. ;Gdip_DeleteGraphics(G), Gdip_DisposeImage(pBitmap), Gdip_DeleteBrush(hBrush), DeleteObject(hBitmap)
  1050. ;Gdip_Shutdown(pToken)
  1051. }
  1052. Return
  1053.  
  1054. SearchInput:
  1055. lastChar:=SearchInput
  1056. gui, SearchBox: Destroy
  1057. gosub searchfunction
  1058. gosub display
  1059. return
  1060.  
  1061. searchfunction:
  1062. document:= ComObjCreate("HTMLfile")
  1063. page1:=get("https://herald.playphoenix.online/c/"+lastChar)
  1064.  
  1065. lines := StrSplit(page1, "`n")
  1066. columns := []
  1067. for index, value in lines
  1068. columns.Insert(StrSplit(value, "`t"))
  1069.  
  1070. unfName := columns[49][1]
  1071. unfGuild := columns[51][1]
  1072. unfClass := columns[53][1]
  1073. unfLevel := columns[57][1]
  1074. unfRankLevel := columns[61][1]
  1075. unfRace := columns[65][1]
  1076. unfRankName := columns[67][1]
  1077.  
  1078. charName := RegExReplace(unfName,"\x20{2,}"," ")""
  1079. unfGuild1 := RegExReplace(unfGuild,"<.*?>")
  1080. unfGuild2 := RegExReplace(unfGuild1,"(&lt)")
  1081. unfGuild3 := RegExReplace(unfGuild2,"(&gt)")
  1082. charGuild := RegExReplace(unfGuild3,"\x20{2,}"," ")""
  1083. charClass := RegExReplace(unfClass,"\x20{2,}"," ")""
  1084. charLevel2 := RegExReplace(unfLevel,"\x20{2,}"," ")""
  1085. charLevel := RegExReplace(charLevel2,"Level ")
  1086. charLevel := "Lvl"+charLevel
  1087. unfRankLevel1 := RegExReplace(unfRankLevel,"\x20{2,}"," ")""
  1088. charRankLevel := RegExReplace(unfRankLevel1,"ealm Rank ","")
  1089. charRace := RegExReplace(unfRace,"\x20{2,}"," ")""
  1090. charRankName := RegExReplace(unfRankName,"\x20{2,}"," ")""
  1091.  
  1092. StringTrimLeft, charName, charName, 1
  1093. StringTrimLeft, charClass, charClass, 1
  1094. StringTrimLeft, charLevel, charLevel, 0
  1095. StringTrimLeft, charRankLevel, charRankLevel, 1
  1096. StringTrimLeft, charRace, charRace, 1
  1097. StringTrimLeft, charRankName, charRankName, 1
  1098. StringTrimRight, charGuild, charGuild, 1
  1099. return
  1100.  
  1101.  
  1102. display:
  1103. IniRead, targetwindowx, %config%, WINDOW POSITION, targetwindowx
  1104. IniRead, targetwindowy, %config%, WINDOW POSITION, targetwindowy
  1105. If (relative=1)
  1106. gosub GetColor
  1107. else
  1108. targetColor:="cFFFFFFFF"
  1109.  
  1110. If (dropshadow=0)
  1111. {
  1112. TTG:="Gdip_TextToGraphics"
  1113. options2:=
  1114. }
  1115. If (dropshadow=1)
  1116. {
  1117. TTG:="Gdip_TextToGraphics2"
  1118. options2:="ow1 ocFF000000"
  1119. }
  1120.  
  1121. If (dropshadow=1)
  1122. {
  1123. hbm := CreateDIBSection(Width, Height)
  1124. hdc := CreateCompatibleDC()
  1125. obm := SelectObject(hdc, hbm)
  1126. G := Gdip_GraphicsFromHDC(hdc)
  1127. Gdip_SetSmoothingMode(G, 4)
  1128. pBrush := Gdip_BrushCreateSolid(0x00000000)
  1129. Gdip_FillRoundedRectangle(G, pBrush, 0, 0, Width, Height, 20)
  1130. Gdip_DeleteBrush(pBrush)
  1131. }
  1132.  
  1133. If (dropshadow=0)
  1134. {
  1135. G := Gdip_GraphicsFromHDC(hdc)
  1136. Gdip_SetCompositingMode(G, 1)
  1137. pBrush := Gdip_BrushCreateSolid(0x00000000) ; fully transparent brush 'eraser'
  1138. Gdip_FillRectangle(G, pBrush, 0, 0, Width, Height)
  1139. Gdip_DeleteBrush(pBrush)
  1140. Gdip_SetCompositingMode(G, 0)
  1141. Gdip_SetSmoothingMode(G, 4)
  1142. pBrush := Gdip_BrushCreateSolid(0x00000000)
  1143. Gdip_FillRectangle(G, pBrush, 0, 0, Width, Height)
  1144. Gdip_DeleteBrush(pBrush)
  1145. }
  1146. nameLength := StrLen(charName)
  1147. guildLength:=StrLen(charGuild)
  1148. IfnotInString, page1, %PH%
  1149. {
  1150. Font:=Fontstylefont
  1151. FontSizes := [options3]
  1152.  
  1153. ; Measure Text Width
  1154. For Each, Size in FontSizes {
  1155. T := MeasureText(charName, "s" . Size, Fontstylefont)
  1156. XW0 := T.W
  1157. }
  1158. For Each, Size in FontSizes {
  1159. T := MeasureText(charRace, "s" . Size, Fontstylefont)
  1160. XW1 := T.W
  1161. }
  1162. For Each, Size in FontSizes {
  1163. T := MeasureText(charClass, "s" . Size, Fontstylefont)
  1164. XW2 := T.W
  1165. }
  1166. For Each, Size in FontSizes {
  1167. T := MeasureText(charLevel, "s" . Size, Fontstylefont)
  1168. XW3 := T.W
  1169. }
  1170.  
  1171. For Each, Size in FontSizes {
  1172. T := MeasureText(charRankLevel, "s" . Size, Fontstylefont)
  1173. XW4 := T.W
  1174. }
  1175.  
  1176. ; Define gap width
  1177. if (Fontstylefont = "Tahoma")
  1178. {
  1179. xwI := 1.3
  1180. }
  1181. else if (Fontstylefont = "Verdana")
  1182. {
  1183. xwI := 1.5
  1184. }
  1185. else if ((Fontstylefont = "Arial") or (Fontstylefont = "Trebuchet MS") or (Fontstylefont = "Ubuntu Mono"))
  1186. {
  1187. xwI := 1.6
  1188. }
  1189. else if ((Fontstylefont = "Segoe UI") or (Fontstylefont = "Bariol") or (Fontstylefont = "Montserrat"))
  1190. {
  1191. xwI := 1.9
  1192. }
  1193. else if ((Fontstylefont = "Noto Sans UI") or (Fontstylefont = "Overpass"))
  1194. {
  1195. xwI := 2.2
  1196. }
  1197. else if (Fontstylefont = "Gotham")
  1198. {
  1199. xwI := 2.9
  1200. }
  1201. else
  1202. {
  1203. xwI := 100.5
  1204. }
  1205. Fontsize_x := 17
  1206. ; Placement
  1207. XW1_1 := (XW1/2)-(0.5*Fontstylesize)
  1208. if (XW1 > XW2)
  1209. XW2_2 := (Fontstylesize/xwI)+(((XW2/2)+(0.5*Fontstylesize))-((XW2+XW1)*0.1008))
  1210. else if (XW1 <= XW2)
  1211. XW2_2 := (Fontstylesize/xwI)+((XW2/2)+(0.5*Fontstylesize)-((XW2+XW1)*0.1008))
  1212.  
  1213. XW3_1 := (XW3/2)-(0.5*Fontstylesize)
  1214. if (XW3 > XW4)
  1215. XW4_2 := (Fontstylesize/xwI)+(((XW4/2)+(0.5*Fontstylesize))-((XW4+XW3)*0.1008))
  1216. else if (XW3 <= XW4)
  1217. XW4_2 := (Fontstylesize/xwI)+((XW4/2)+(0.5*Fontstylesize)-((XW4+XW3)*0.1008))
  1218.  
  1219. X1_0 := (XWI/2)-(0.5*Fontstylesize)
  1220.  
  1221. y:=0
  1222. Options = x%X1_0% y%y% w90p Center Bold %targetColor% %options2% r4 %options3%
  1223. %TTG%(G, charName , Options , Font, Width, Height)
  1224.  
  1225. If (unfGuild == " </h2>")
  1226. {
  1227. y:=Fontstylesize
  1228. if boldhighlight=1
  1229. Options = x-%XW4_2% y%y% w90p Center Bold %targetColor% %options2% r4 %options3%
  1230. else
  1231. Options = x-%XW4_2% y%y% w90p Center %targetColor% %options2% r4 %options3%
  1232. %TTG%(G, charLevel, Options , Font, Width, Height)
  1233.  
  1234. Options = x%XW3_1% y%y% w90p Center %targetColor% %options2% r4 %options3%
  1235. %TTG%(G, charRankLevel , Options , Font, Width, Height)
  1236.  
  1237. y:=Fontstylesize*2.05
  1238. if boldhighlight=1
  1239. Options = x-%XW2_2% y%y% w90p Center %targetColor% %options2% r4 %options3%
  1240. else
  1241. Options = x-%XW2_2% y%y% w90p Center Bold %targetColor% %options2% r4 %options3%
  1242. %TTG%(G, charRace, Options , Font, Width, Height)
  1243.  
  1244. Options = x%XW1_1% y%y% w90p Center Bold %targetColor% %options2% r4 %options3%
  1245. %TTG%(G, charClass, Options , Font, Width, Height)
  1246. }
  1247. Else
  1248. {
  1249. y:=Fontstylesize
  1250. if boldhighlight=1
  1251. Options = x%X1_0% y%y% w90p Center %targetColor% %options2% r4 %options3%
  1252. else
  1253. Options = x%X1_0% y%y% w90p Center Bold %targetColor% %options2% r4 %options3%
  1254. %TTG%(G, "<" charGuild ">" , Options , Font, Width, Height)
  1255.  
  1256. y:=Fontstylesize*2.05
  1257. if boldhighlight=1
  1258. Options = x-%XW4_2% y%y% w90p Center %targetColor% %options2% r4 %options3%
  1259. else
  1260. Options = x-%XW4_2% y%y% w90p Center Bold %targetColor% %options2% r4 %options3%
  1261. %TTG%(G, charLevel, Options , Font, Width, Height)
  1262.  
  1263. Options = x%XW3_1% y%y% w90p Center Bold %targetColor% %options2% r4 %options3%
  1264. %TTG%(G, charRankLevel , Options , Font, Width, Height)
  1265.  
  1266. y:=Fontstylesize*3.05
  1267. if (boldhighlight=1)
  1268. Options = x-%XW2_2% y%y% w90p Center %targetColor% %options2% r4 %options3%
  1269. else
  1270. Options = x-%XW2_2% y%y% w90p Center Bold %targetColor% %options2% r4 %options3%
  1271. %TTG%(G, charRace, Options , Font, Width, Height)
  1272. Options = x%XW1_1% y%y% w90p Center Bold %targetColor% %options2% r4 %options3%
  1273. %TTG%(G, charClass, Options , Font, Width, Height)
  1274. }
  1275.  
  1276. gosub getresist
  1277. If (Resist1=1)
  1278. If (unfGuild == " </h2>")
  1279. {
  1280. y:=Fontstylesize*3.2
  1281. x:=-Fontstylesize*4
  1282. Color:=resistances.Thrust.2
  1283. Options = x%x% y%y% w90p Center Bold %Color% %options2% r4 %options3%
  1284. %TTG%(G, "Thrust", Options , Font, Width, Height)
  1285.  
  1286.  
  1287. y:=Fontstylesize*3.2
  1288. Color:=resistances.Crush.2
  1289. Options = x0 y%y% w90p Center Bold %Color% %options2% r4 %options3%
  1290. %TTG%(G, "Crush", Options, Font, Width, Height)
  1291.  
  1292. Longest2:=Fontstylesize*4
  1293. y:=Fontstylesize*3.2
  1294. Color:=resistances.Slash.2
  1295. Options = x%Longest2% y%y% w90p Center Bold %Color% %options2% r4 %options3%
  1296. %TTG%(G, "Slash", Options, Font, Width, Height)
  1297. }
  1298. Else
  1299. {
  1300. y:=Fontstylesize*4.2
  1301. x:=-Fontstylesize*4
  1302. Color:=resistances.Thrust.2
  1303. Options = x%x% y%y% w90p Center Bold %Color% %options2% r4 %options3%
  1304. %TTG%(G, "Thrust", Options , Font, Width, Height)
  1305.  
  1306.  
  1307. y:=Fontstylesize*4.2
  1308. Color:=resistances.Crush.2
  1309. Options = x0 y%y% w90p Center Bold %Color% %options2% r4 %options3%
  1310. %TTG%(G, "Crush", Options, Font, Width, Height)
  1311.  
  1312. Longest2:=Fontstylesize*4
  1313. y:=Fontstylesize*4.2
  1314. Color:=resistances.Slash.2
  1315. Options = x%Longest2% y%y% w90p Center Bold %Color% %options2% r4 %options3%
  1316. %TTG%(G, "Slash", Options, Font, Width, Height)
  1317. }
  1318.  
  1319. If (Resist2=1)
  1320. If (unfGuild == " </h2>")
  1321. {
  1322. y:=Fontstylesize*3
  1323. x:=-Fontstylesize*4
  1324. Color:=resistances.Thrust.2
  1325. Options = x%x% y%y% w90p Center Bold %Color% %options2% r4 %options3%
  1326. %TTG%(G, "Thrust", Options , Font, Width, Height)
  1327.  
  1328.  
  1329. y:=Fontstylesize*4
  1330. Color:=resistances.Crush.2
  1331. Options = x%x% y%y% w90p Center Bold %Color% %options2% r4 %options3%
  1332. %TTG%(G, "Crush", Options, Font, Width, Height)
  1333.  
  1334. y:=Fontstylesize*5
  1335. Color:=resistances.Slash.2
  1336. Options = x%x% y%y% w90p Center Bold %Color% %options2% r4 %options3%
  1337. %TTG%(G, "Slash", Options, Font, Width, Height)
  1338.  
  1339. y:=Fontstylesize*3
  1340. Color:=resistances.Heat.2
  1341. Options = x0 y%y% w90p Center Bold %Color% %options2% r4 %options3%
  1342. %TTG%(G, "Heat",Options , Font, Width, Height)
  1343.  
  1344. y:=Fontstylesize*4
  1345. Color:=resistances.Cold.2
  1346. Options = x0 y%y% w90p Center Bold %Color% %options2% r4 %options3%
  1347. %TTG%(G, "Cold", Options , Font, Width, Height)
  1348.  
  1349. y:=Fontstylesize*5
  1350. Color:=resistances.Matter.2
  1351. Options = x0 y%y% w90p Center Bold %Color% %options2% r4 %options3%
  1352. %TTG%(G, "Matter", Options , Font, Width, Height)
  1353.  
  1354. Longest2:=Fontstylesize*4
  1355. y:=Fontstylesize*3
  1356. Color:=resistances.Energy.2
  1357. Options = x%Longest2% y%y% w90p Center Bold %Color% %options2% r4 %options3%
  1358. %TTG%(G, "Energy", Options , Font, Width, Height)
  1359. y:=Fontstylesize*4
  1360. Color:=resistances.Spirit.2
  1361. Options = x%Longest2% y%y% w90p Center Bold %Color% %options2% r4 %options3%
  1362. %TTG%(G, "Spirit", Options , Font, Width, Height)
  1363.  
  1364. y:=Fontstylesize*5
  1365. Color:=resistances.Body.2
  1366. Options = x%Longest2% y%y% w90p Center Bold %Color% %options2% r4 %options3%
  1367. %TTG%(G, "Body", Options , Font, Width, Height)
  1368. }
  1369. Else
  1370. {
  1371. y:=Fontstylesize*4
  1372. x:=-Fontstylesize*4
  1373. Color:=resistances.Thrust.2
  1374. Options = x%x% y%y% w90p Center Bold %Color% %options2% r4 %options3%
  1375. %TTG%(G, "Thrust", Options , Font, Width, Height)
  1376.  
  1377.  
  1378. y:=Fontstylesize*5
  1379. Color:=resistances.Crush.2
  1380. Options = x%x% y%y% w90p Center Bold %Color% %options2% r4 %options3%
  1381. %TTG%(G, "Crush", Options, Font, Width, Height)
  1382.  
  1383. y:=Fontstylesize*6
  1384. Color:=resistances.Slash.2
  1385. Options = x%x% y%y% w90p Center Bold %Color% %options2% r4 %options3%
  1386. %TTG%(G, "Slash", Options, Font, Width, Height)
  1387.  
  1388. y:=Fontstylesize*4
  1389. Color:=resistances.Heat.2
  1390. Options = x0 y%y% w90p Center Bold %Color% %options2% r4 %options3%
  1391. %TTG%(G, "Heat",Options , Font, Width, Height)
  1392.  
  1393. y:=Fontstylesize*5
  1394. Color:=resistances.Cold.2
  1395. Options = x0 y%y% w90p Center Bold %Color% %options2% r4 %options3%
  1396. %TTG%(G, "Cold", Options , Font, Width, Height)
  1397.  
  1398. y:=Fontstylesize*6
  1399. Color:=resistances.Matter.2
  1400. Options = x0 y%y% w90p Center Bold %Color% %options2% r4 %options3%
  1401. %TTG%(G, "Matter", Options , Font, Width, Height)
  1402.  
  1403. Longest2:=Fontstylesize*4
  1404. y:=Fontstylesize*4
  1405. Color:=resistances.Energy.2
  1406. Options = x%Longest2% y%y% w90p Center Bold %Color% %options2% r4 %options3%
  1407. %TTG%(G, "Energy", Options , Font, Width, Height)
  1408.  
  1409. y:=Fontstylesize*5
  1410. Color:=resistances.Spirit.2
  1411. Options = x%Longest2% y%y% w90p Center Bold %Color% %options2% r4 %options3%
  1412. %TTG%(G, "Spirit", Options , Font, Width, Height)
  1413.  
  1414. y:=Fontstylesize*6
  1415. Color:=resistances.Body.2
  1416. Options = x%Longest2% y%y% w90p Center Bold %Color% %options2% r4 %options3%
  1417. %TTG%(G, "Body", Options , Font, Width, Height)
  1418. }
  1419.  
  1420. UpdateLayeredWindow(hwnd1, hdc, targetwindowx,targetwindowy, Width, Height)
  1421. }
  1422. return
  1423.  
  1424.  
  1425. MouseOvermagGlass:
  1426. Gui, SearchBox: Submit, NoHide
  1427. MouseGetPos,,,,id, 2
  1428. if ( id = magGlass)
  1429. {
  1430. if ( set = "1" )
  1431. {
  1432. GuiControl,SearchBox:, magGlass, %glassBlue%
  1433. set = 0
  1434. }
  1435. return
  1436. }
  1437. if ( set = "0" )
  1438. {
  1439. GuiControl,SearchBox:, magGlass, %glassGrey%
  1440. Set = 1
  1441. }
  1442. Return
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement