Advertisement
Guest User

Untitled

a guest
Jul 20th, 2019
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 28.50 KB | None | 0 0
  1. #singleinstance, force
  2. SetTitleMatchMode,2
  3. DetectHiddenWindows, On
  4. #noenv
  5. #include Gdip_All.ahk
  6. #include Gdip_Ext.ahk
  7. SetWorkingDir %A_ScriptDir%
  8. CoordMode, Mouse, Screen
  9. ;Menu, Tray, Icon, Lookup.ico
  10. #Persistent ; Stay open in background
  11. counter:=0
  12. ; --- Global variables
  13. global chatlogkey, start, widthList, exit, configkey,config, title,gui3_x,gui3_y, newpos, charName,vText, charRace,targetwindowx, targetwindowy
  14. toggle:=1
  15. title:=Dark Age of Camelot
  16. PH:="<h1>Phoenix Herald</h1>"
  17. config:="config.ini"
  18. file2=\Electronic Arts\Dark Age of Camelot\
  19. file=chat.log
  20.  
  21. ; --- Tray
  22. ;Menu, Tray, Icon, %A_ScriptDir%\Lookup.ico
  23. Menu, Tray, NoStandard
  24. Menu, Tray, Tip, DAoC Scout
  25. Menu, Tray, Add, Run, start
  26. Menu, Tray, Add, Config, config
  27. Menu, Tray, Add ; Separator
  28. Menu, Tray, Add, About, About
  29. Menu, Tray, Add, Donate, OpenPayPal
  30. Menu, Tray, Add ; Separator
  31. Menu, Tray, Add,Quit,Quit
  32. ;Menu, Tray, Icon, Run, %A_ScriptDir%\Lookup.ico
  33. ;Menu, Tray, Icon, Config, %A_ScriptDir%\Config.ico
  34.  
  35.  
  36. ;--- Check for configini and creates if not one
  37. ifnotexist,%config%
  38. {
  39. msgbox Could not find config file generating new one
  40. IniWrite, F2, %config% ,Keys, start
  41. IniWrite,Escape, %config% ,Keys, exit
  42. IniWrite, F3, %config% ,Keys, configkey
  43. IniWrite, F4, %config% ,Keys, chatlogkey
  44. iniwrite, x0 y0,%config%,window position,main
  45. iniwrite, 1,%config%,window position,targetwindowx
  46. iniwrite, 1,%config%,window position,targetwindowy
  47. IniWrite, %A_MyDocuments%%file2%%file%,%config%, chatlog, file
  48. IniWrite, 1, %config%, options, relative
  49. IniWrite, 1, %config%, options, Resist1
  50. IniWrite, 0, %config%, options, Resist2
  51. IniWrite, 0, %config%, options, dropshadow
  52. IniWrite, Arial, %config%, options, Fontstylefont
  53. IniWrite, 16, %config%, options, Fontstylesize
  54. Iniwrite, 0, %config%, options, dropshadow
  55. While ! FileExist( config )
  56. {
  57. Sleep 250
  58. }
  59. gosub config
  60. }
  61.  
  62. if (Resist1= 0)
  63. AllResist:=2
  64. If (Resist2=0)
  65. AllResist:=1
  66. ;--- Read ini file and assign keys
  67. IniRead, start, %config%, Keys, start
  68. IniRead, exit, %config%, Keys, exit
  69. IniRead, configkey, %config%, Keys, configkey
  70. IniRead, chatlogkey, %config%, Keys, chatlogkey
  71. IniRead, chatLog, %config%, chatlog, file
  72. IniRead, main, %config%, window position, main
  73. IniRead, targetwindowx, %config%, window position, targetwindowx
  74. IniRead, targetwindowy, %config%, window position, targetwindowy
  75. IniRead, relative, %config%, options, relative , 0
  76. IniRead, Resist1, %config%, options,Resist1 , 0
  77. IniRead, Resist2, %config%, options,Resist2 , 0
  78. Iniread, dropshadow, %config%,options,dropshadow
  79. Iniread, Fontstylefont, %config%, options, Fontstylefont
  80. Iniread, Fontstylesize, %config%, options, Fontstylesize
  81. if (Resist1=0)
  82. AllResist:=2
  83. If (Resist2=0)
  84. AllResist:=1
  85. Hotkey, ~LButton, daoc, off
  86. Hotkey, %start%, start, on
  87. Hotkey, %exit%, escape, on
  88. Hotkey, %configkey%, config, on
  89. OnMessage(0x03, "MsgMonitor")
  90. OnMessage(0x201, "WM_LBUTTONDOWN")
  91. If !pToken := Gdip_Startup()
  92. ExitApp
  93.  
  94. Width:=800, height:=800
  95. Gui, 3: -Caption +E0x80000 +LastFound +AlwaysOnTop +ToolWindow +OwnDialogs
  96. Gui, 3: Show, NA
  97. hwnd1 := WinExist()
  98. hbm := CreateDIBSection(Width, Height)
  99. hdc := CreateCompatibleDC()
  100. obm := SelectObject(hdc, hbm)
  101. G := Gdip_GraphicsFromHDC(hdc)
  102. Gdip_SetSmoothingMode(G, 4)
  103. if (dropshadow=0)
  104. {
  105. pBrush := Gdip_BrushCreateSolid(0x590000)
  106. Gdip_FillRectangle(G, pBrush, 0, 0, Width, Height)
  107. Gdip_DeleteBrush(pBrush)
  108. }
  109. Font = %Fontstylefont%
  110. If !Gdip_FontFamilyCreate(Font)
  111. {
  112. msgbox Font not installed setting to Arial
  113. IniWrite, Arial, %config%, options, Fontstylefont
  114. Iniread, Fontstylefont, %config%, options, Fontstylefont
  115. Font = %Fontstylefont%
  116. Gdip_FontFamilyCreate(Font)
  117. }
  118. Gui,1: +e0x20 +AlwaysOnTop +LastFound -SysMenu
  119. Gui,1: Color, ffffff, ffffff
  120. Gui,1: Font, Normal c1e91bb
  121. Gui,1: Add, Groupbox, x7 y7 h65 w160, [Scout] Quickstart
  122. Gui,1: Font, Normal s8 c000000, Verdana
  123. Gui 1: Add,Text, x15 y24 BackgroundTrans vtext4 GuiMove w200,%start% - Start Script`n%configkey% - Configurations/FAQ`n%exit% - Exit
  124. Gui,1: show, %main% w173 h78 , DAoC Scout
  125. return
  126.  
  127. ;--- Start key pushed
  128. start:
  129. gui,1: hide
  130. ;gui,3:show
  131. Hotkey, ~LButton, toggle
  132.  
  133. IniRead, chatlogkey, %config%, Keys, chatlogkey
  134. Iniread, targetwindowx, %config%, window position, targetwindowx
  135. Iniread, targetwindowy, %config%, window position, targetwindowy
  136. options3=s%Fontstylesize%
  137. ifwinexist,ahk_exe game.dll
  138. {
  139. winactivate
  140. winwaitactive, %title%
  141. }
  142. else
  143. winwaitactive, %title%
  144.  
  145. return
  146.  
  147. daoc:
  148. if winactive("ahk_exe game.dll")
  149. {
  150. gui,3:show, NA
  151. if (dropshadow=1)
  152. {
  153. hbm := CreateDIBSection(Width, Height)
  154. hdc := CreateCompatibleDC()
  155. obm := SelectObject(hdc, hbm)
  156. G := Gdip_GraphicsFromHDC(hdc)
  157. Gdip_SetSmoothingMode(G, 4)
  158. pBrush := Gdip_BrushCreateSolid(0x00000000)
  159. Gdip_FillRoundedRectangle(G, pBrush, 0, 0, Width, Height, 20)
  160. }
  161. counter++
  162. if (x!=1)
  163. send {%chatlogkey%}
  164. sleep 300
  165. send {%chatlogkey%}
  166. lastChar := FileReadLineFromBottom(chatLog, 6)
  167.  
  168. ; --- Parse Herald
  169. document:= ComObjCreate("HTMLfile")
  170. page1:=get("https://herald.playphoenix.online/c/"+lastChar)
  171.  
  172. lines := StrSplit(page1, "`n")
  173. columns := []
  174. for index, value in lines
  175. columns.Insert(StrSplit(value, "`t"))
  176.  
  177. unfName := columns[49][1]
  178. unfGuild := columns[51][1]
  179. unfClass := columns[53][1]
  180. unfLevel := columns[57][1]
  181. unfRankLevel := columns[61][1]
  182. unfRace := columns[65][1]
  183. unfRankName := columns[67][1]
  184.  
  185. charName := RegExReplace(unfName,"\x20{2,}"," ")""
  186. unfGuild1 := RegExReplace(unfGuild,"<.*?>")
  187. unfGuild2 := RegExReplace(unfGuild1,"(&lt)")
  188. unfGuild3 := RegExReplace(unfGuild2,"(&gt)")
  189. charGuild := RegExReplace(unfGuild3,"\x20{2,}"," ")""
  190. charClass := RegExReplace(unfClass,"\x20{2,}"," ")""
  191. charLevel := RegExReplace(unfLevel,"\x20{2,}"," ")""
  192. unfRankLevel1 := RegExReplace(unfRankLevel,"\x20{2,}"," ")""
  193. charRankLevel := RegExReplace(unfRankLevel1,"ealm Rank ","")
  194. charRace := RegExReplace(unfRace,"\x20{2,}"," ")""
  195. charRankName := RegExReplace(unfRankName,"\x20{2,}"," ")""
  196.  
  197. StringTrimLeft, charName, charName, 1
  198. StringTrimLeft, charClass, charClass, 1
  199. StringTrimLeft, charLevel, charLevel, 1
  200. StringTrimLeft, charRankLevel, charRankLevel, 1
  201. StringTrimLeft, charRace, charRace, 1
  202. StringTrimLeft, charRankName, charRankName, 1
  203. StringTrimRight, charGuild, charGuild, 1
  204.  
  205. if (relative=1)
  206. gosub GetColor
  207. else
  208. targetColor:="cFFFFFFFF"
  209.  
  210. If (dropshadow=0)
  211. {
  212. TTG:="Gdip_TextToGraphics"
  213. options2:=
  214. }
  215. if (dropshadow=1)
  216. {
  217. TTG:="Gdip_TextToGraphics2"
  218. options2:="ow1 ocFF000000"
  219. }
  220.  
  221. if (dropshadow=1)
  222. {
  223. hbm := CreateDIBSection(Width, Height)
  224. hdc := CreateCompatibleDC()
  225. obm := SelectObject(hdc, hbm)
  226. G := Gdip_GraphicsFromHDC(hdc)
  227. Gdip_SetSmoothingMode(G, 4)
  228. pBrush := Gdip_BrushCreateSolid(0x00000000)
  229. Gdip_FillRoundedRectangle(G, pBrush, 0, 0, Width, Height, 20)
  230. }
  231.  
  232. if (dropshadow=0)
  233. {
  234. G := Gdip_GraphicsFromHDC(hdc)
  235. Gdip_SetCompositingMode(G, 1)
  236. pBrush := Gdip_BrushCreateSolid(0x00000000) ; fully transparent brush 'eraser'
  237. Gdip_FillRectangle(G, pBrush, 0, 0, Width, Height)
  238. Gdip_DeleteBrush(pBrush)
  239. Gdip_SetCompositingMode(G, 0)
  240. Gdip_SetSmoothingMode(G, 4)
  241. pBrush := Gdip_BrushCreateSolid(0x00000000)
  242. Gdip_FillRectangle(G, pBrush, 0, 0, Width, Height)
  243. Gdip_DeleteBrush(pBrush)
  244. }
  245. nameLength := StrLen(charName)
  246. guildLength:=StrLen(charGuild)
  247. IfnotInString, page1, %PH%
  248. {
  249.  
  250. List = %charName%|<%charGuild%>|%charLevel%|%charClass% + %charRace%
  251. Longest:=0
  252. Loop, Parse, List, |
  253. {
  254. FontName:=Fontstylefont
  255. Size:=Fontstylesize
  256. T := MeasureText(a_loopfield, "" . Size, FontName)
  257. If (T.W > Longest)
  258. Longest:=T.W
  259. }
  260. Longest:=Longest+(Fontstylesize*3)
  261.  
  262. Font:=Fontstylefont
  263. Options = x0 y0 w50p Centre Bold %targetColor% %options2% r4 %options3%
  264. %TTG%(G, charName "`n<" charGuild ">" "`n" charLevel " " charRankLevel "`n" charRace " " charClass charRank , Options , Font, Width, Height)
  265.  
  266. gosub getresist
  267. if (AllResist=1)
  268. {
  269.  
  270. y:=0
  271. Color:=resistances.Thrust.2
  272. Options = x%Longest% y0 w50p Centre Bold %Color% %options2% r4 %options3%
  273. %TTG%(G, "Thrust", Options , Font, Width, Height)
  274.  
  275. y:=0+Fontstylesize
  276. Color:=resistances.Crush.2
  277. Options = x%Longest% y%y% w50p Centre Bold %Color% %options2% r4 %options3%
  278. %TTG%(G, "Crush", Options, Font, Width, Height)
  279.  
  280. Color:=resistances.Slash.2
  281. y:=0+(Fontstylesize*2)
  282. Options = x%Longest% y%y% w50p Centre Bold %Color% %options2% r4 %options3%
  283. %TTG%(G, "Slash", Options, Font, Width, Height)
  284. }
  285.  
  286. if (AllResist=2)
  287. {
  288. y:=0
  289. Color:=resistances.Thrust.2
  290. Options = x%Longest% y%y% w50p Centre Bold %Color% %options2% r4 %options3%
  291. %TTG%(G, "Thrust", Options , Font, Width, Height)
  292.  
  293. y:=(0+Fontstylesize)
  294. Color:=resistances.Crush.2
  295. Options = x%Longest% y%y% w50p Centre Bold %Color% %options2% r4 %options3%
  296. %TTG%(G, "Crush", Options, Font, Width, Height)
  297.  
  298. Color:=resistances.Slash.2
  299. y:=0+(Fontstylesize*2)
  300. Options = x%Longest% y%y% w50p Centre Bold %Color% %options2% r4 %options3%
  301. %TTG%(G, "Slash", Options, Font, Width, Height)
  302.  
  303. ;these need to be fixed visually
  304. Longest2:=Longest+(Fontstylesize*4)
  305. y:=0
  306. Color:=resistances.Heat.2
  307. Options = x%Longest2% y%y% w50p Centre Bold %Color% %options2% r4 %options3%
  308. %TTG%(G, "Heat",Options , Font, Width, Height)
  309.  
  310. y:=(0+Fontstylesize)
  311. Color:=resistances.Cold.2
  312. Options = x%Longest2% y%y% w50p Centre Bold %Color% %options2% r4 %options3%
  313. %TTG%(G, "Cold", Options , Font, Width, Height)
  314.  
  315. y:=0+(Fontstylesize*2)
  316. Color:=resistances.Matter.2
  317. Options = x%Longest2% y%y% w50p Centre Bold %Color% %options2% r4 %options3%
  318. %TTG%(G, "Matter", Options , Font, Width, Height)
  319. Longest2:=0
  320.  
  321. Longest2:=Longest+(Fontstylesize*8)
  322. y:=0
  323. Color:=resistances.Energy.2
  324. Options = x%Longest2% y%y% w50p Centre Bold %Color% %options2% r4 %options3%
  325. %TTG%(G, "Energy", Options , Font, Width, Height)
  326.  
  327. y:=0+Fontstylesize
  328. Color:=resistances.Spirit.2
  329. Options = x%Longest2% y%y% w50p Centre Bold %Color% %options2% r4 %options3%
  330. %TTG%(G, "Spirit", Options , Font, Width, Height)
  331.  
  332. y:=0+(Fontstylesize*2)
  333. Color:=resistances.Body.2
  334. Options = x%Longest2% y%y% w50p Centre Bold %Color% %options2% r4 %options3%
  335. %TTG%(G, "Body", Options , Font, Width, Height)
  336. Longest2:=0
  337. }
  338.  
  339. UpdateLayeredWindow(hwnd1, hdc, targetwindowx,targetwindowy, Width, Height)
  340. }
  341.  
  342.  
  343. if (dropshadow=1)
  344. {
  345. SelectObject(hdc, obm)
  346. DeleteObject(hbm)
  347. DeleteDC(hdc)
  348. Gdip_DeleteGraphics(G)
  349. hbm := CreateDIBSection(Width, Height)
  350. hdc := CreateCompatibleDC()
  351. obm := SelectObject(hdc, hbm)
  352. G := Gdip_GraphicsFromHDC(hdc)
  353. Gdip_SetSmoothingMode(G, 4)
  354. pBrush := Gdip_BrushCreateSolid(0x00000000)
  355. Gdip_FillRoundedRectangle(G, pBrush, 0, 0, Width, Height, 20)
  356. }
  357. return
  358. }
  359. return
  360.  
  361.  
  362. ;--------------------------------------------
  363.  
  364.  
  365. ;--------------------------------------config gui 2
  366. config:
  367. IniRead, start, %config%, Keys, start
  368. IniRead, exit, %config%, Keys, exit
  369. IniRead, configkey, %config%, Keys, configkey
  370. IniRead, chatlogkey, %config%, Keys, chatlogkey
  371. IniRead, chatLog, %config%, chatlog, file
  372. IniRead, main, %config%, window position, main
  373. IniRead, relative, %config%, options, relative , 0
  374. IniRead, Resist1, %config%, options, Resist1
  375. IniRead, Resist2, %config%, options, Resist2
  376. Iniread, dropshadow, %config%,options,dropshadow
  377. Iniread, Fontstylefont, %config%, options, Fontstylefont
  378. Iniread, Fontstylesize, %config%, options, Fontstylesize
  379. Hotkey, ~LButton, daoc, off
  380. Hotkey, %start%, start, off
  381. Hotkey, %exit%, escape, off
  382. Hotkey, %configkey%, config, off
  383. gui,3:hide
  384. gui,1: hide
  385. Gui,2: +e0x20 +LastFound
  386. Gui,2: Add, Tab3, x0 y5 w619 h341 -wrap, Configuration| FAQ
  387. Gui,2: Font, Normal c1e91bb
  388. Gui,2: Add, Groupbox, x7 y32 w606 h95, [Scout] Instructions
  389. Gui,2: Font,
  390. 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).
  391. Gui,2: Add, Text, x16 y+5, 2) Select the directory where your chat.log file is located. Typically this would be in:
  392. Gui,2: Add, Text, x30 y+5, C:\Users\USERNAME\Documents\Electronic Arts\Dark Age of Camelot
  393. 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.
  394. Gui,2: Font, Normal c1e91bb
  395. Gui,2: Add, Groupbox, x7 y+13 w143 h120, [Scout] Keybinds
  396. Gui,2: Font,
  397. Gui,2: Add, Text, x61 y155, Start Script
  398. Gui,2: Add, Text, x61 y+10, Chatlog (F1-F12)
  399. Gui,2: Add, Text, x61 y+10, Configurations
  400. Gui,2: Add, Text, x61 y+10, Exit
  401. Gui,2: Font, Normal c1e91bb
  402. Gui,2: Add, Groupbox, x159 y131 w164 h120, [Scout] Options
  403. Gui,2: Font,
  404. Gui,2: Add, Checkbox, x165 y155 Checked%relative%, Use relative realm colors
  405. Gui,2: Font, Normal c1e91bb
  406. Gui,2: Add, Text, x311 y155, ?
  407. Gui,2: Font,
  408. Gui,2: Add, Radio, x165 y+10 gCheck vResist1, Show melee resistances
  409. Gui,2: Add, Radio, x165 y+10 gCheck vResist2, Show all resistances
  410. Gui,2: Font, Normal c1e91bb
  411. Gui,2: Add, Text, x311 y178,?
  412. Gui,2: Font,
  413. Gui,2: Font, Normal c1e91bb
  414. Gui,2: Add, Text, x311 y201,?
  415. Gui,2: Font,
  416. Gui,2: Add, Checkbox, x165 y+10 vdropshadow, Font with dropshadow
  417. Gui,2: Font, Normal c1e91bb
  418. Gui,2: Add, Text, x311 y224,?
  419. Gui,2: Font,
  420. Gui,2: Add, Text, x307 y156 h14 w1 0x11
  421. Gui,2: Add, Text, x307 y179 h14 w1 0x11
  422. Gui,2: Add, Text, x307 y202 h14 w1 0x11
  423. Gui,2: Add, Text, x307 y225 h14 w1 0x11
  424. Gui,2: Add, Hotkey, x16 y152 w40 h19 vstart, %start%
  425. Gui,2: Add, Hotkey, x16 y+4 w40 h19 vchatlogkey gchatlogged, %chatlogkey%
  426. Gui,2: Add, Hotkey, x16 y+4 w40 h19 vconfigkey, %configkey%
  427. Gui,2: Add, Hotkey, x16 y+4 w40 h19 vexit, %exit%
  428. Gui,2: Font, Normal c1e91bb
  429. Gui,2: Add, Groupbox, x332 y131 w281 h120, [Scout] Fontstyle
  430. Gui,2: Font
  431. Gui,2: Add, DropDownList, x338 y151 w100 vFontstylefont, Arial|Trebuchet MS|Verdana|Overpass|Noto Sans UI|Segoe UI|Comic Sans MS|KSK
  432. Gui,2: Add, DropDownList, x338 y+2 w100 vFontstylesize, 12|13|14|15|16|17|18|19|20|21|22|23|24
  433. Gui,2: Add, Text, x442 y155, Fontname
  434. Gui,2: Add, Text, x442 y+10, Fontsize
  435. Gui,2: Font, Normal c1e91bb
  436. Gui,2: Add, Groupbox, x7 y255 w606 h56, [Scout] Chatlog Directory
  437. Gui,2: Font,
  438. Gui,2: Add, Edit, x14 y276 w400 h19 +ReadOnly vChatlogLoc,%Chatlog%
  439. Gui,2: Add, Button, x416 y275 w20 h21 gchatlog, ...
  440. Gui,2: Add, Button, x7 y+22 w64 h19 gbuttonsave, Save
  441. Gui,2: Show, w619 h342 Center, DAoC Scout - Configuration
  442. Gui,2: Tab, 2
  443. Gui,2: Font, Normal c1e91bb
  444. Gui,2: Add, Groupbox, x7 y32 w606 h85, [Scout] About
  445. Gui,2: Font,
  446. 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 is only using files everyone has access to. Use at your own risk as the script has yet to be`napproved (or disapproved).
  447. Gui,2: Add, Text, x16 y+5, The script is programmed in Autohotkey by Bysan and Teehehe with inspiration from Lerox.
  448. Gui,2: Font, Normal c1e91bb
  449. Gui,2: Add, Groupbox, x7 y122 w606 h59, [Scout] Contact
  450. Gui,2: Font,
  451. Gui,2: Add, Text, x16 y141, Errors and questions can be reported at:
  452. Gui,2: Add, Link, x25 y+5 cBlue BackgroundTrans, <a href="https://discord.gg/TqX3b3G">- Discord</a>
  453. SetTimer, ToolTip
  454. var_Static9 = Target info color based on realm color. ; Put this at the top along with any others you want to try.
  455. var_Static10 = Shows Crush/Thrust/Slash resistances.
  456. var_Static11 = Shows Crush/Thrust/Slash in addition to caster type vulnerabilities.
  457. var_Static12 = Toggle dropshadow on overlay font. Checkbox off = no shadow, checkbox on = shadow.`nAvailable in the next update!
  458. GuiControl,2: , Button5, %Resist1%
  459. GuiControl,2: , Button6, %Resist2%
  460. GuiControl,2: , Button7, %dropshadow%
  461. GuiControl,2: ChooseString, Fontstylefont, %Fontstylefont%
  462. GuiControl,2: ChooseString, Fontstylesize, %Fontstylesize%
  463. options3=s%Fontstylesize%
  464. ToolTip:
  465. MouseGetPos, , , id, control
  466. WinGetTitle, title, ahk_id %id%
  467. if title = DAoC Scout - Configuration
  468. {
  469. tmpVar := var_%control%
  470. ToolTip, %tmpVar%
  471. }
  472. return
  473. Return
  474.  
  475. ;-------------------------------------web function
  476.  
  477. get(URL){
  478. ComObjError(false)
  479. r:=ComObjCreate("WinHttp.WinHttpRequest.5.1")
  480. r.Open("GET", URL, true),r.Send(),r.WaitForResponse()
  481. return r.ResponseText
  482. }
  483. ;----------------------------------------------
  484.  
  485. ;--------------------------------------------readchatlog for target line
  486. FileReadLineFromBottom(chatLog, Offset)
  487. {
  488. FileRead f1, % chatLog
  489. StringReplace f1, f1, `n, `n, UseErrorLevel
  490. FileReadLine Line, % chatLog, ErrorLevel + 1 - Offset
  491. Filedelete, % chatLog
  492. if RegExMatch(Line, "You target \[(.*)\]\.", Output)
  493. Return Output1
  494. }
  495. ;---------------------------------------------
  496.  
  497. Check:
  498. gui, submit, nohide
  499. if (Resist1= 0)
  500. AllResist:=2
  501. If (Resist2=0)
  502. AllResist:=1
  503. Return
  504.  
  505. ;---------------------------------------gui stuff
  506. uiMove:
  507. PostMessage, 0xA1, 2,,, A
  508. Return
  509.  
  510. ;--- Tray2
  511. Quit:
  512. ExitApp
  513. Console:
  514. ListLines
  515. Return
  516. OpenPayPal:
  517. Run "https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=TMRB3RCMXPGBN&source=url"
  518. Return
  519. AboutClose:
  520. DllCall("AnimateWindow",UInt,GUI_ID,UInt,750,UInt,0x90000)
  521. Gui, About:Cancel
  522. Return
  523.  
  524.  
  525. ;----------------------------------exit
  526. escape:
  527. exitapp
  528. return
  529.  
  530.  
  531. ;--------------------------close config window
  532. 2GuiClose:
  533. gui, 2:destroy
  534. GuiControl,1: , text4,%start% - Start Script`n%configkey% - Configurations/FAQ`n%exit% - Exit
  535. gui, 1:show
  536. Hotkey, %start%, start, on
  537. Hotkey, %exit%, escape, on
  538. Hotkey, %configkey%, config, on
  539. return
  540.  
  541. ;-------------------------folder select
  542. chatlog:
  543. Gui,2: +OwnDialogs
  544. fileselectfolder, folder
  545. folder:= RegExReplace(Folder, "\\$")
  546. chatlog = %folder%\%file%
  547. Iniwrite, %chatlog%, %config%, chatlog, file
  548. GuiControl, , ChatlogLoc, %chatLog%
  549. return
  550.  
  551.  
  552. ;--------------------------------------save button
  553. buttonsave:
  554. GuiControlGet, start, 2:
  555. GuiControlGet, exit, 2:
  556. GuiControlGet, configkey, 2:
  557. GuiControlGet, chatlogkey, 2:
  558. GuiControlGet, relative, 2:
  559. GuiControlGet, Resist1, 2:
  560. GuiControlGet, Resist2, 2:
  561. GuiControlGet, dropshadow, 2:
  562. GuiControlget, Fontstylefont, 2:
  563. GuiControlget, Fontstylesize, 2:
  564. ;saves keys from gui to ini
  565.  
  566. ;--------------------------checks for duplicate hotkey
  567. Keylist := [start, exit, configkey, chatlogkey]
  568. Keys :={}
  569.  
  570. For each, key in keylist
  571. {
  572. If !(keys.haskey(key))
  573. Keys[key] := 1
  574. Else
  575. {
  576. Msgbox Error! Make sure the keys are unique!
  577. Return
  578. }
  579. }
  580.  
  581. ;-----------------------------------------
  582. Iniwrite, %start%, %config%, Keys, start
  583. Iniwrite, %exit%, %config%, Keys, exit
  584. Iniwrite, %configkey%, %config%, Keys, configkey
  585. Iniwrite, %chatlogkey%, %config%, Keys, chatlogkey
  586. IniWrite, %relative%, %config%, options, relative
  587. IniWrite, %Resist1%, %config%, options, Resist1
  588. IniWrite, %Resist2%, %config%, options, Resist2
  589. IniWrite, %dropshadow%, %config%, options, dropshadow
  590. IniWrite, %Fontstylefont%, %config%, options, Fontstylefont
  591. Iniwrite, %Fontstylesize%, %config%, options, Fontstylesize
  592.  
  593. gui, 2:destroy
  594. ;------------------------------------------read ini file and assign keys
  595. IniRead, start, %config%, Keys, start
  596. IniRead, exit, %config%, Keys, exit
  597. IniRead, configkey, %config%, Keys, configkey
  598. IniRead, chatlogkey, %config%, Keys, chatlogkey
  599. IniRead, relative, %config%, options, relative
  600. IniRead, Resist1, %config%, options, Resist1
  601. IniRead, Resist2, %config%, options, Resist2
  602. iniread, dropshadow, %config%,options, dropshadow
  603. Iniread, Fontstylefont, %config%, options, Fontstylefont
  604. Iniread, Fontstylesize, %config%, options, Fontstylesize
  605. options3=s%Fontstylesize%
  606. ;-----------------------------------------------
  607. GuiControl,1: , text4,%start% - Start Script`n%configkey% - Configurations/FAQ`n%exit% - Exit
  608. gui,1:show
  609. Hotkey, %start%, start, on
  610. Hotkey, %exit%, escape, on
  611. Hotkey, %configkey%, config, on
  612. return
  613.  
  614. ;------------------------chatlog key must be a function key possible other keys add to list must be wrapped in to work {F1}
  615. ;{ins}{del} etc... https://www.autohotkey.com/docs/commands/Send.htm
  616. chatlogged:
  617.  
  618. GuiControlGet chatlogkey, 2:
  619. keylist2:=["F1","F2","F3","F4","F5","F6","F7","F8","F9","F10","F11","F12"]
  620. if !Contains(keylist2, chatlogkey)
  621. msgbox Please enter a function key F1-F12.
  622.  
  623. Contains(obj, chatlogkey) {
  624. for i, val in obj {
  625. if(val = chatlogkey) {
  626. return true
  627. }
  628. }
  629. }
  630. return
  631.  
  632.  
  633. GetColor:
  634. alblist:=["Briton","Highlander","Avalonian","Saracen","Inconnu","Half Ogre"]
  635. hiblist:=["Lurikeen","Celt","Sylvan","Firbolg","Elf","Shar"]
  636. midlist:=["Troll","Dwarf","Kobold","Norseman","Valkyn","Frostalf"]
  637. Error:=["Error"]
  638. if Contains(alblist, charRace)
  639. targetColor = cFFd60000
  640. else if Contains(hiblist, charRace)
  641. targetColor = cFF37d600
  642. else if Contains(midlist, charRace)
  643. targetColor = cFF0056d6
  644. else
  645. targetColor=cFFb80af2
  646. Return
  647.  
  648.  
  649. WM_LBUTTONDOWN()
  650. {
  651. PostMessage, 0xA1, 2
  652. }
  653.  
  654.  
  655.  
  656. MsgMonitor(wParam, lParam)
  657. {
  658. X := lParam & 0xFFFF
  659. Y := lParam >> 16
  660. if (oX!=X)||(oY!=Y)
  661. {
  662. if (A_Gui=1)
  663. iniwrite, x%X% y%Y%,%config%,window position,main
  664. if (A_Gui=2)
  665. iniwrite, x%X% y%Y%,%config%,window position,config
  666. if (A_Gui=3)
  667. {
  668. if (x!=32768)
  669. {
  670. iniwrite, %X%,%config%,window position,targetwindowx
  671. iniwrite, %Y%,%config%,window position,targetwindowy
  672. }
  673. }
  674. oX:=%X%
  675. oY:=%Y%
  676. }
  677. IniRead, targetwindowx, %config%, window position, targetwindowx
  678. IniRead, targetwindowy, %config%, window position, targetwindowy
  679. }
  680.  
  681. GetResist:
  682. class:=["Armsman","Paladin","Cleric","Mercenary","Minstrel","Scout","Friar","Infiltrator","Theurgist","Wizard","Cabalist","Sorcerer","Necromancer","Reaver","Champion","Druid","Hero","Warden","Bard","Blademaster","Ranger","Nightshade","Animist","Enchanter","Healer","Shaman","Skald","Thane","Warrior","Berserker","Hunter","Shadowblade","Savage","Bonedancer","Runemaster","Spiritmaster"]
  683. ;alb
  684. if (charClass="Armsman")||(charClass="Paladin")||(charClass="Armswoman")
  685. resistances:={Thrust:["Resistant","cfffa1500"],Crush:["Vulnerable","cFF00fa60"],Slash:["Neutral","cffffffff"],Cold:["Vulnerable","cFF00fa60"],Energy:["Neutral","cffffffff"],Heat:["Resistant","cfffa1500"],Matter:["Resistant","cfffa1500"],Spirit:["Neutral","cffffffff"],Body:["Vulnerable","cFF00fa60"]}
  686. if (charClass="Cleric")||(charClass="Mercenary")||(charClass="Minstrel")||(charClass="Reaver")
  687. resistances:={Thrust:["Vulnerable","cFF00fa60"],Crush:["Resistant","cfffa1500"],Slash:["Neutral","cffffffff"],Cold:["Neutral","cffffffff"],Energy:["Vulnerable","cFF00fa60"],Heat:[" Resistant","cfffa1500"],Matter:["Neutral","cffffffff"],Spirit:["Neutral","cffffffff"],Body:["Neutral","cffffffff"]}
  688. if (charClass="Scout")
  689. resistances:={Thrust:["Vulnerable","cFF00fa60"],Crush:["Resistant","cfffa1500"],Slash:["Neutral","cffffffff"],Cold:["Vulnerable","cFF00fa60"],Energy:["Resistant","cfffa1500"],Heat:["Resistant","cfffa1500"],Matter:["Vulnerable","cFF00fa60"],Spirit:["Neutral","cffffffff"],Body:["Resistant","cfffa1500"]}
  690. if (charClass="Friar")||(charClass="Infiltrator")
  691. resistances:={Thrust:["Resistant","cfffa1500"],Crush:["Vulnerable","cFF00fa60"],Slash:["Neutral","cffffffff"],Cold:["Resistant","cfffa1500"],Energy:["Neutral","cffffffff"],Heat:[" Vulnerable","cFF00fa60"],Matter:["Neutral","cffffffff"],Spirit:["Neutral","cffffffff"],Body:["Resistant","cfffa1500"]}
  692. if (charClass="Theurgist")||(charClass="Wizard")||(charClass="Cabalist")||(charClass="Sorcerer")||(charClass="Necromancer")
  693. resistances:={Thrust:["Neutral","cffffffff"],Crush:["Neutral","cffffffff"],Slash:["Neutral","cffffffff"],Cold:["Neutral","cffffffff"],Energy:["Resistant","cfffa1500"],Heat:[" Neutral","cffffffff"],Matter:["Neutral","cffffffff"],Spirit:["Neutral","cffffffff"],Body:["Resistant","cfffa1500"]}
  694. ;hib
  695. if (charClass="Champion")||(charClass="Druid")||(charClass="Hero")||(charClass="Warden")
  696. resistances:={Thrust:["Neutral","cffffffff"],Crush:["Resistant","cfffa1500"],Slash:["Vulnerable","cFF00fa60"],Cold:["Vulnerable","cFF00fa60"],Energy:["Vulnerable","cFF00fa60"],Heat:[" Resistant","cfffa1500"],Matter:["Resistant","cfffa1500"],Spirit:["Neutral","cffffffff"],Body:["Neutral","cffffffff"]}
  697. if (charClass="Bard")||(charClass="Blademaster")||(charClass="Ranger")
  698. resistances:={Thrust:["Neutral","cffffffff"],Crush:["Vulnerable","cFF00fa60"],Slash:["Resistant","cfffa1500"],Cold:["Vulnerable","cFF00fa60"],Energy:["Resistant","cfffa1500"], Heat:["Resistant","cfffa1500"],Matter:["Vulnerable","cFF00fa60"],Spirit:["Neutral","cffffffff"],Body:["Resistant","cfffa1500"]}
  699. if (charClass="Nightshade")
  700. resistances:={Thrust:["Neutral","cffffffff"],Crush:["Vulnerable","cFF00fa60"],Slash:["Resistant","cfffa1500"],Cold:["Resistant","cfffa1500"],Energy:["Neutral","cffffffff"],Heat:[ "Vulnerable","cFF00fa60"],Matter:["Neutral","cffffffff"],Spirit:["Neutral","cffffffff"],Body:["Resistant","cfffa1500"]}
  701. if (charClass="Animist")||(charClass="Enchanter")||(charClass="Mentalist")||(charClass="Eldritch")||(charClass="Valewalker")
  702. resistances:={Thrust:["Neutral","cffffffff"],Crush:["Neutral","cffffffff"],Slash:["Neutral","cffffffff"],Cold:["Neutral","cffffffff"],Energy:["Resistant","cfffa1500"],Heat:[" Neutral","cffffffff"],Matter:["Neutral","cffffffff"],Spirit:["Neutral","cffffffff"],Body:["Resistant","cfffa1500"]}
  703. ;mid
  704. if(charClass="Healer")||(charClass="Shaman")||(charClass="Skald")||(charClass="Thane")||(charClass="Warrior")
  705. resistances:={Thrust:["Vulnerable","cFF00fa60"],Crush:["Neutral","cffffffff"],Slash:["Resistant","cfffa1500"],Cold:["Neutral","cffffffff"],Energy:["Vulnerable","cFF00fa60"],Heat:["Resistant","cfffa1500"],Matter:["Neutral","cffffffff"],Spirit:["Neutral","cffffffff"],Body:["Neutral","cffffffff"]}
  706. if (charClass="Berserker")||(charClass="Hunter")||(charClass="Savage")
  707. resistances:={Thrust:["Resistant","cfffa1500"],Crush:["Neutral","cffffffff"],Slash:["Vulnerable","cFF00fa60"],Cold:["Vulnerable","cFF00fa60"],Energy:["Resistant","cfffa1500"],Heat:[" Resistant","cfffa1500"],Matter:["Vulnerable","cFF00fa60"],Spirit:["Neutral","cffffffff"],Body:["Resistant","cfffa1500"]}
  708. if (charClass="Shadowblade")
  709. resistances:={Thrust:["Resistant","cfffa1500"],Crush:["Neutral","cffffffff"], Slash:["Vulnerable","cFF00fa60"],Cold:["Resistant","cfffa1500"],Energy:["Neutral","cffffffff"],Heat:["Vulnerable","cFF00fa60"],Matter:["Neutral","cffffffff"],Spirit:["Neutral","cffffffff"],Body:["Resistant","cfffa1500"]}
  710. if (charClass="Bonedancer")||(charClass="Runemaster")||(charClass="Spiritmaster")
  711. resistances:={Thrust:["Neutral","cffffffff"],Crush:["Neutral","cffffffff"],Slash:["Neutral","cffffffff"], Cold:["Neutral","cffffffff"],Energy:["Resistant","cfffa1500"],Heat:["Neutral","cffffffff"],Matter:["Neutral","cffffffff"],Spirit:["Neutral","cffffffff"],Body:["Resistant","cfffa1500"]}
  712.  
  713.  
  714. return
  715.  
  716. About:
  717. IfNotEqual, FirstTimeA, No
  718. {
  719. Gui, About:-Caption +Border +LastFound
  720. WinGet GUI_ID, ID
  721. Gui, About:Color, ffffff, ffffff
  722. Gui, About:Font, S10 c1e91bb Bold,verdana
  723. Gui, About:Add, Text, x185 y27 w170 h20, DAoC Scout
  724. Gui, About:Font, S10 CDefault Normal, Verdana
  725. Gui, About:Add, Text, x185 y+3 w270, A Dark Age of Camelot tool that`nlooks up a targets information.
  726. Gui, About:Add, Text, x183 y+5 w248
  727. Gui, About:Font, S7 CDefault normal, Verdana
  728. Gui, About:Add, Text, x185 y92 w410 h73,
  729. (LTrim
  730. The script reads your chat.log to find your
  731. current target, looks the name up on the Phoenix
  732. Herald and returns the essential information.
  733. All information used by the script is publicly
  734. available, and does not read or modify any
  735. game files except for the chat.log.
  736. )
  737. Gui, About:Add, Text, x183 y+4 w248
  738. Gui, About:Add, Text, x16 y174 w410 h24,
  739. (LTrim
  740. The script is programmed by Bysan and Teehehe in AHK. For feedback, bug reports and additional information, please visit:
  741. )
  742. Gui, About:Add, Link, x25 y+5 cBlue BackgroundTrans, <a href="https://discord.gg/TqX3b3G">- Discord</a>
  743. Gui, About:Add, Button, 0x8000 x362 y+1 w70 h21 gAboutClose, Close
  744. Gui, About:Add, Picture, x17 y17 w150 h150, %A_ScriptDir%\LookupImg.png
  745.  
  746. FirstTimeA = No
  747. }
  748.  
  749. height := 240
  750. width := 435
  751. Gui, About:Show, Hide h%height% w%width%, DAoC Scout
  752. DllCall("AnimateWindow",UInt,GUI_ID,UInt,750,UInt,0xa0000)
  753. return
  754.  
  755. MeasureText(Str, FontOpts = "", FontName = "") {
  756. Static DT_FLAGS := 0x0520 ; DT_SINGLELINE = 0x20, DT_NOCLIP = 0x0100, DT_CALCRECT = 0x0400
  757. Static WM_GETFONT := 0x31
  758. Size := {}
  759. Gui, New
  760. If (FontOpts <> "") || (FontName <> "")
  761. Gui, Font, %FontOpts%, %FontName%
  762. Gui, Add, Text, hwndHWND
  763. SendMessage, WM_GETFONT, 0, 0, , ahk_id %HWND%
  764. HFONT := ErrorLevel
  765. HDC := DllCall("User32.dll\GetDC", "Ptr", HWND, "Ptr")
  766. DllCall("Gdi32.dll\SelectObject", "Ptr", HDC, "Ptr", HFONT)
  767. VarSetCapacity(RECT, 16, 0)
  768. DllCall("User32.dll\DrawText", "Ptr", HDC, "Str", Str, "Int", -1, "Ptr", &RECT, "UInt", DT_FLAGS)
  769. DllCall("User32.dll\ReleaseDC", "Ptr", HWND, "Ptr", HDC)
  770. Gui, Destroy
  771. Size.W := NumGet(RECT, 8, "Int")
  772. Size.H := NumGet(RECT, 12, "Int")
  773. Return Size
  774. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement