Advertisement
Guest User

Untitled

a guest
Jul 20th, 2019
199
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 28.38 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 Lookup Tool
  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, [Lookup] 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 Lookup
  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 500
  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, [Lookup] 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, [Lookup] 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, [Lookup] 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: Add, Checkbox, x165 y+10 vdropshadow, Font with dropshadow
  416. Gui,2: Font, Normal c1e91bb
  417. Gui,2: Add, Text, x311 y224,?
  418. Gui,2: Font,
  419. Gui,2: Add, Text, x307 y156 h14 w1 0x11
  420. Gui,2: Add, Text, x307 y179 h14 w1 0x11
  421. Gui,2: Add, Text, x307 y202 h14 w1 0x11
  422. Gui,2: Add, Text, x307 y225 h14 w1 0x11
  423. Gui,2: Add, Hotkey, x16 y152 w40 h19 vstart, %start%
  424. Gui,2: Add, Hotkey, x16 y+4 w40 h19 vchatlogkey gchatlogged, %chatlogkey%
  425. Gui,2: Add, Hotkey, x16 y+4 w40 h19 vconfigkey, %configkey%
  426. Gui,2: Add, Hotkey, x16 y+4 w40 h19 vexit, %exit%
  427. Gui,2: Font, Normal c1e91bb
  428. Gui,2: Add, Groupbox, x332 y131 w281 h120, [Lookup] Fontstyle
  429. Gui,2: Font
  430. Gui,2: Add, DropDownList, x338 y151 w100 vFontstylefont, Arial|Trebuchet MS|Verdana|Overpass|Noto Sans UI|Segoe UI|Comic Sans MS|KSK
  431. Gui,2: Add, DropDownList, x338 y+2 w100 vFontstylesize, 12|13|14|15|16|17|18|19|20|21|22|23|24
  432. Gui,2: Add, Text, x442 y155, Fontname
  433. Gui,2: Add, Text, x442 y+10, Fontsize
  434. Gui,2: Font, Normal c1e91bb
  435. Gui,2: Add, Groupbox, x7 y255 w606 h56, [Lookup] Chatlog Directory
  436. Gui,2: Font,
  437. Gui,2: Add, Edit, x14 y276 w400 h19 +ReadOnly vChatlogLoc,%Chatlog%
  438. Gui,2: Add, Button, x416 y275 w20 h21 gchatlog, ...
  439. Gui,2: Add, Button, x7 y+22 w64 h19 gbuttonsave, Save
  440. Gui,2: Show, w619 h342 Center, DAoC TargetInfo - Configuration
  441. Gui,2: Tab, 2
  442. Gui,2: Font, Normal c1e91bb
  443. Gui,2: Add, Groupbox, x7 y32 w606 h85, [Lookup] About
  444. Gui,2: Font,
  445. 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).
  446. Gui,2: Add, Text, x16 y+5, The script is programmed in Autohotkey by Bysan and Teehehe with inspiration from Lerox.
  447. Gui,2: Font, Normal c1e91bb
  448. Gui,2: Add, Groupbox, x7 y122 w606 h59, [Lookup] Contact
  449. Gui,2: Font,
  450. Gui,2: Add, Text, x16 y141, Errors and questions can be reported at:
  451. Gui,2: Add, Link, x25 y+5 cBlue BackgroundTrans, <a href="https://discord.gg/TqX3b3G">- Discord</a>
  452. SetTimer, ToolTip
  453. var_Static9 = Target info color based on realm color. ; Put this at the top along with any others you want to try.
  454. var_Static10 = Shows Crush/Thrust/Slash resistances.
  455. var_Static11 = Shows Crush/Thrust/Slash in addition to caster type vulnerabilities.
  456. var_Static12 = Toggle dropshadow on overlay font. Checkbox off = no shadow, checkbox on = shadow.`nAvailable in the next update!
  457. GuiControl,2: , Button5, %Resist1%
  458. GuiControl,2: , Button6, %Resist2%
  459. GuiControl,2: , Button7, %dropshadow%
  460. GuiControl,2: ChooseString, Fontstylefont, %Fontstylefont%
  461. GuiControl,2: ChooseString, Fontstylesize, %Fontstylesize%
  462. options3=s%Fontstylesize%
  463. ToolTip:
  464. MouseGetPos, , , id, control
  465. WinGetTitle, title, ahk_id %id%
  466. if title = DAoC TargetInfo - Configuration
  467. {
  468. tmpVar := var_%control%
  469. ToolTip, %tmpVar%
  470. }
  471. return
  472. Return
  473.  
  474. ;-------------------------------------web function
  475.  
  476. get(URL){
  477. ComObjError(false)
  478. r:=ComObjCreate("WinHttp.WinHttpRequest.5.1")
  479. r.Open("GET", URL, true),r.Send(),r.WaitForResponse()
  480. return r.ResponseText
  481. }
  482. ;----------------------------------------------
  483.  
  484. ;--------------------------------------------readchatlog for target line
  485. FileReadLineFromBottom(chatLog, Offset)
  486. {
  487. FileRead f1, % chatLog
  488. StringReplace f1, f1, `n, `n, UseErrorLevel
  489. FileReadLine Line, % chatLog, ErrorLevel + 1 - Offset
  490. Filedelete, % chatLog
  491. if RegExMatch(Line, "You target \[(.*)\]\.", Output)
  492. Return Output1
  493. }
  494. ;---------------------------------------------
  495.  
  496. Check:
  497. gui, submit, nohide
  498. if (Resist1= 0)
  499. AllResist:=2
  500. If (Resist2=0)
  501. AllResist:=1
  502. Return
  503.  
  504. ;---------------------------------------gui stuff
  505. uiMove:
  506. PostMessage, 0xA1, 2,,, A
  507. Return
  508.  
  509. ;--- Tray2
  510. Quit:
  511. ExitApp
  512. Console:
  513. ListLines
  514. Return
  515. OpenPayPal:
  516. Run "https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=TMRB3RCMXPGBN&source=url"
  517. Return
  518. AboutClose:
  519. Gui, About:Cancel
  520. Return
  521.  
  522.  
  523. ;----------------------------------exit
  524. escape:
  525. exitapp
  526. return
  527.  
  528.  
  529. ;--------------------------close config window
  530. 2GuiClose:
  531. gui, 2:destroy
  532. GuiControl,1: , text4,%start% - Start Script`n%configkey% - Configurations/FAQ`n%exit% - Exit
  533. gui, 1:show
  534. Hotkey, %start%, start, on
  535. Hotkey, %exit%, escape, on
  536. Hotkey, %configkey%, config, on
  537. return
  538.  
  539. ;-------------------------folder select
  540. chatlog:
  541. Gui,2: +OwnDialogs
  542. fileselectfolder, folder
  543. folder:= RegExReplace(Folder, "\\$")
  544. chatlog = %folder%\%file%
  545. Iniwrite, %chatlog%, %config%, chatlog, file
  546. GuiControl, , ChatlogLoc, %chatLog%
  547. return
  548.  
  549.  
  550. ;--------------------------------------save button
  551. buttonsave:
  552. GuiControlGet, start, 2:
  553. GuiControlGet, exit, 2:
  554. GuiControlGet, configkey, 2:
  555. GuiControlGet, chatlogkey, 2:
  556. GuiControlGet, relative, 2:
  557. GuiControlGet, Resist1, 2:
  558. GuiControlGet, Resist2, 2:
  559. GuiControlGet, dropshadow, 2:
  560. GuiControlget, Fontstylefont, 2:
  561. GuiControlget, Fontstylesize, 2:
  562. ;saves keys from gui to ini
  563.  
  564. ;--------------------------checks for duplicate hotkey
  565. Keylist := [start, exit, configkey, chatlogkey]
  566. Keys :={}
  567.  
  568. For each, key in keylist
  569. {
  570. If !(keys.haskey(key))
  571. Keys[key] := 1
  572. Else
  573. {
  574. Msgbox Error! Make sure the keys are unique!
  575. Return
  576. }
  577. }
  578.  
  579. ;-----------------------------------------
  580. Iniwrite, %start%, %config%, Keys, start
  581. Iniwrite, %exit%, %config%, Keys, exit
  582. Iniwrite, %configkey%, %config%, Keys, configkey
  583. Iniwrite, %chatlogkey%, %config%, Keys, chatlogkey
  584. IniWrite, %relative%, %config%, options, relative
  585. IniWrite, %Resist1%, %config%, options, Resist1
  586. IniWrite, %Resist2%, %config%, options, Resist2
  587. IniWrite, %dropshadow%, %config%, options, dropshadow
  588. IniWrite, %Fontstylefont%, %config%, options, Fontstylefont
  589. Iniwrite, %Fontstylesize%, %config%, options, Fontstylesize
  590.  
  591. gui, 2:destroy
  592. ;------------------------------------------read ini file and assign keys
  593. IniRead, start, %config%, Keys, start
  594. IniRead, exit, %config%, Keys, exit
  595. IniRead, configkey, %config%, Keys, configkey
  596. IniRead, chatlogkey, %config%, Keys, chatlogkey
  597. IniRead, relative, %config%, options, relative
  598. IniRead, Resist1, %config%, options, Resist1
  599. IniRead, Resist2, %config%, options, Resist2
  600. iniread, dropshadow, %config%,options, dropshadow
  601. Iniread, Fontstylefont, %config%, options, Fontstylefont
  602. Iniread, Fontstylesize, %config%, options, Fontstylesize
  603. options3=s%Fontstylesize%
  604. ;-----------------------------------------------
  605. GuiControl,1: , text4,%start% - Start Script`n%configkey% - Configurations/FAQ`n%exit% - Exit
  606. gui,1:show
  607. Hotkey, %start%, start, on
  608. Hotkey, %exit%, escape, on
  609. Hotkey, %configkey%, config, on
  610. return
  611.  
  612. ;------------------------chatlog key must be a function key possible other keys add to list must be wrapped in to work {F1}
  613. ;{ins}{del} etc... https://www.autohotkey.com/docs/commands/Send.htm
  614. chatlogged:
  615.  
  616. GuiControlGet chatlogkey, 2:
  617. keylist2:=["F1","F2","F3","F4","F5","F6","F7","F8","F9","F10","F11","F12"]
  618. if !Contains(keylist2, chatlogkey)
  619. msgbox Please enter a function key F1-F12.
  620.  
  621. Contains(obj, chatlogkey) {
  622. for i, val in obj {
  623. if(val = chatlogkey) {
  624. return true
  625. }
  626. }
  627. }
  628. return
  629.  
  630.  
  631. GetColor:
  632. alblist:=["Briton","Highlander","Avalonian","Saracen","Inconnu","Half Ogre"]
  633. hiblist:=["Lurikeen","Celt","Sylvan","Firbolg","Elf","Shar"]
  634. midlist:=["Troll","Dwarf","Kobold","Norseman","Valkyn","Frostalf"]
  635. Error:=["Error"]
  636. if Contains(alblist, charRace)
  637. targetColor = cFFd60000
  638. else if Contains(hiblist, charRace)
  639. targetColor = cFF37d600
  640. else if Contains(midlist, charRace)
  641. targetColor = cFF0056d6
  642. else
  643. targetColor=cFFb80af2
  644. Return
  645.  
  646.  
  647. WM_LBUTTONDOWN()
  648. {
  649. PostMessage, 0xA1, 2
  650. }
  651.  
  652.  
  653.  
  654. MsgMonitor(wParam, lParam)
  655. {
  656. X := lParam & 0xFFFF
  657. Y := lParam >> 16
  658. if (oX!=X)||(oY!=Y)
  659. {
  660. if (A_Gui=1)
  661. iniwrite, x%X% y%Y%,%config%,window position,main
  662. if (A_Gui=2)
  663. iniwrite, x%X% y%Y%,%config%,window position,config
  664. if (A_Gui=3)
  665. {
  666. if (x!=32768)
  667. {
  668. iniwrite, %X%,%config%,window position,targetwindowx
  669. iniwrite, %Y%,%config%,window position,targetwindowy
  670. }
  671. }
  672. oX:=%X%
  673. oY:=%Y%
  674. }
  675. IniRead, targetwindowx, %config%, window position, targetwindowx
  676. IniRead, targetwindowy, %config%, window position, targetwindowy
  677. }
  678.  
  679. GetResist:
  680. 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"]
  681. ;alb
  682. if (charClass="Armsman")||(charClass="Paladin")||(charClass="Armswoman")
  683. 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"]}
  684. if (charClass="Cleric")||(charClass="Mercenary")||(charClass="Minstrel")||(charClass="Reaver")
  685. 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"]}
  686. if (charClass="Scout")
  687. 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"]}
  688. if (charClass="Friar")||(charClass="Infiltrator")
  689. 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"]}
  690. if (charClass="Theurgist")||(charClass="Wizard")||(charClass="Cabalist")||(charClass="Sorcerer")||(charClass="Necromancer")
  691. 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"]}
  692. ;hib
  693. if (charClass="Champion")||(charClass="Druid")||(charClass="Hero")||(charClass="Warden")
  694. 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"]}
  695. if (charClass="Bard")||(charClass="Blademaster")||(charClass="Ranger")
  696. 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"]}
  697. if (charClass="Nightshade")
  698. 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"]}
  699. if (charClass="Animist")||(charClass="Enchanter")||(charClass="Mentalist")||(charClass="Eldritch")||(charClass="Valewalker")
  700. 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"]}
  701. ;mid
  702. if(charClass="Healer")||(charClass="Shaman")||(charClass="Skald")||(charClass="Thane")||(charClass="Warrior")
  703. 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"]}
  704. if (charClass="Berserker")||(charClass="Hunter")||(charClass="Savage")
  705. 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"]}
  706. if (charClass="Shadowblade")
  707. 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"]}
  708. if (charClass="Bonedancer")||(charClass="Runemaster")||(charClass="Spiritmaster")
  709. 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"]}
  710.  
  711.  
  712. return
  713.  
  714. About:
  715. IfNotEqual, FirstTimeA, No
  716. {
  717. Gui, About:-Caption +Border
  718. Gui, About:Color, ffffff, ffffff
  719. Gui, About:Font, S10 c1e91bb Bold,verdana
  720. Gui, About:Add, Text, x185 y27 w170 h20, DAoC Lookup Tool
  721. Gui, About:Font, S10 CDefault Normal, Verdana
  722. Gui, About:Add, Text, x185 y+3 w270, A Dark Age of Camelot tool that`nlooks up a targets information.
  723. Gui, About:Add, Text, x183 y+5 w248 0x10
  724. Gui, About:Font, S7 CDefault normal, Verdana
  725. Gui, About:Add, Text, x185 y92 w410 h73,
  726. (LTrim
  727. The script reads your chat.log to find your
  728. current target, looks the name up on the Phoenix
  729. Herald and returns the essential information.
  730. All information used by the script is publicy
  731. accessable, and does not read or modify any
  732. game files except for the chat.log.
  733. )
  734. Gui, About:Add, Text, x183 y+4 w248 0x10
  735. Gui, About:Add, Text, x16 y174 w410 h24,
  736. (LTrim
  737. The script is programmed by Bysan and Teehehe in AHK. For feedback, bug reports and additional information, please visit:
  738. )
  739. Gui, About:Add, Link, x25 y+5 cBlue BackgroundTrans, <a href="https://discord.gg/TqX3b3G">- Discord</a>
  740. Gui, About:Add, Button, 0x8000 x362 y+1 w70 h21 gAboutClose, Close
  741. Gui, About:Add, Picture, x17 y17 w150 h150, %A_ScriptDir%\LookupImg.png
  742.  
  743. FirstTimeA = No
  744. }
  745.  
  746. height := 240
  747. width := 435
  748. Gui, About:Show, h%height% w%width%, DAoC Lookup Tool
  749. return
  750.  
  751. MeasureText(Str, FontOpts = "", FontName = "") {
  752. Static DT_FLAGS := 0x0520 ; DT_SINGLELINE = 0x20, DT_NOCLIP = 0x0100, DT_CALCRECT = 0x0400
  753. Static WM_GETFONT := 0x31
  754. Size := {}
  755. Gui, New
  756. If (FontOpts <> "") || (FontName <> "")
  757. Gui, Font, %FontOpts%, %FontName%
  758. Gui, Add, Text, hwndHWND
  759. SendMessage, WM_GETFONT, 0, 0, , ahk_id %HWND%
  760. HFONT := ErrorLevel
  761. HDC := DllCall("User32.dll\GetDC", "Ptr", HWND, "Ptr")
  762. DllCall("Gdi32.dll\SelectObject", "Ptr", HDC, "Ptr", HFONT)
  763. VarSetCapacity(RECT, 16, 0)
  764. DllCall("User32.dll\DrawText", "Ptr", HDC, "Str", Str, "Int", -1, "Ptr", &RECT, "UInt", DT_FLAGS)
  765. DllCall("User32.dll\ReleaseDC", "Ptr", HWND, "Ptr", HDC)
  766. Gui, Destroy
  767. Size.W := NumGet(RECT, 8, "Int")
  768. Size.H := NumGet(RECT, 12, "Int")
  769. Return Size
  770. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement