123

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#Include, gdiplus.ahk
FileSelectFolder,logsdir,*C:\Users\Admin\Documents\My Games\Crossout\logs\,, Выберите последнюю созданную папку с лоагми игры
enable_overlay:=true
settimer, onoverlay, on
settimer, upd, on
;Ищем последнюю строку с авторизацией
FileRead, Log, %logsdir%\game.log
Loop, Parse, Log, `n
IfInString, A_LoopField, TSConnectionManager: negotiation complete
LastAuthString:=A_LoopField
;Выдергиваем из строки авторизации ник
RegExMatch(LastAuthString, "nickName '([^'+)'", nickName)
nickName:=nickName1
;Цикл подсчета и отображения урона
ShowOverlay:
while(enable_overlay)
{
all_damage:=0
FileRead, Log, %logsdir%\combat.log
;Ищем индекс последней катки
Loop, Parse, Log, `n
IfInString, A_LoopField, Active battle started
LastBattleIndex:=A_Index
;Считаем нанесенный урон
Loop, Parse, Log, `n
{
if(A_Index < LastBattleIndex)
continue
IfInString, A_LoopField, player 0
{
RegExReplace(A_LoopField, "nickname: (\s)", nickname0)
RegExMatch(A_LoopField, "team: (\d+)", teamplayer0)
}
}
;######################
Gdip_TextToGraphics(G, Round(all_damage), Options, , Width, Height)
UpdateLayeredWindow(hwnd, hdc, 360, 100, Width, Height)
Gdip_GraphicsClear(G)
}
return
onoverlay:
settimer, onoverlay, off
If !pToken := Gdip_Startup()
{
MsgBox, 48, gdiplus error!, Gdiplus failed to start. Please ensure you have gdiplus on your system
ExitApp
}
OnExit, Exit
Width := 500, Height := 150
Gui, New, +Hwndhwnd -Caption +E0x80000 +E0x20 +AlwaysOnTop +ToolWindow +OwnDialogs
Gui, Show, NA
hbm := CreateDIBSection(Width, Height)
hdc := CreateCompatibleDC()
obm := SelectObject(hdc, hbm)
G := Gdip_GraphicsFromHDC(hdc)
Gdip_SetSmoothingMode(G, 4)
Options = x30p y5p cbbFFFFFF r4 s30
upd:
Gui, %hwnd%:+AlwaysOnTop
settimer, upd, -1
Return
Exit:
Gdip_DeleteGraphics(G)
SelectObject(hdc, obm)
DeleteObject(hbm)
DeleteDC(hdc)
; gdi+ may now be shutdown on exiting the program
Gdip_Shutdown(pToken)
ExitApp