-
Notifications
You must be signed in to change notification settings - Fork 1
/
Timer.cpp
241 lines (223 loc) · 4.46 KB
/
Timer.cpp
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
#include "DevilPK.h"
HANDLE TimerHandle;
bool Flash=false;
int FlashDelay;
int Missled;
int Delay=0;
bool CastMissles=false;
bool D2Inited=false;
int D2Delay=0;
void TimerTick()
{
ChickenCheck();
Delay++;
if(TakeNextTP)
{
if(IsTownLevel(GetPlayerArea()))
TakeNextTP=false;
}
if(CampOn)
{
D2CLIENT_clickMap(3,Camp.x,Camp.y,8);
}
if(CampUnitOn)
{
D2CLIENT_clickMap(3,Camp.x,Camp.y,8);
}
if(Flash)
{
if(FindUnit(Auto.GetPlayerID(),0)!=NULL)
{
FlashPlayer(Auto.GetPlayerID());
FlashDelay=0;
}
if(FindUnit(Auto.GetPlayerID(),0)==NULL)
{
FlashDelay=-1;
}
}
}
DWORD WINAPI TimerTickThread(LPVOID P)
{
while(TRUE)
{
if(!v_GameInit && Myself)
OnGameEvent(FALSE);
else if(v_GameInit && !Myself)
OnGameEvent(TRUE);
if(D2Inited)
if(D2Delay<20)
D2Delay++;
else
{
if(GetGameInfo()->szCharName!=NULL)
TimerTick();
else
{
Flash=false; D2Inited=false; D2Delay=0;
}
}
Sleep(50);
}
return true;
}
void TimerTick2()
{
Delay++;
if(EnchBot)
{
EnchListedPlayers(); EnchListedUnits(); ChantTimerCheck();
}
}
DWORD WINAPI TimerTickThread2(LPVOID P)
{
while(TRUE)
{
BOOL wPlayer=false;
BOOL wMonster=false;
BOOL wVector=false;
BOOL wLevelNames=false;
BOOL wPlayerLine=false;
if(D2Inited)
if(D2Delay<20)
D2Delay++;
else
{
if(GetGameInfo()->szCharName!=NULL)
{
TimerTick2();
}
else
{
D2Inited=false; D2Delay=0;
}
}
if (cfg.CleanShot)
{
if (GetAsyncKeyState(VK_SNAPSHOT))
{
if(cfg.PlayerInfo)
{
cfg.PlayerInfo=false;
wPlayer=true;
}
if(cfg.DrawMonsters)
{
cfg.DrawMonsters=false;
wMonster=true;
}
if(cfg.DrawVectors)
{
cfg.DrawVectors=false;
wVector=true;
}
if(cfg.LevelNames)
{
cfg.LevelNames=false;
wLevelNames=true;
}
if(cfg.PlayerLine)
{
cfg.PlayerLine=false;
wPlayerLine=true;
}
while (GetAsyncKeyState(VK_SNAPSHOT))
Sleep(500);
if(!cfg.PlayerInfo && wPlayer) cfg.PlayerInfo=true;
if(!cfg.DrawVectors && wVector) cfg.DrawVectors=true;
if(!cfg.DrawMonsters && wMonster) cfg.DrawMonsters=true;
if(!cfg.LevelNames && wLevelNames) cfg.LevelNames=true;
if(!cfg.PlayerLine && wPlayerLine) cfg.PlayerLine=true;
}
}
Sleep(50);
}
return true;
}
DWORD GetUnitDist(UnitAny* pUnit1, UnitAny* pUnit2)
{
DWORD dwDist[4] = {0};
switch(pUnit1->dwType)
{
case UNIT_TYPE_PLAYER:
case UNIT_TYPE_MISSILE:
case UNIT_TYPE_ITEM:
dwDist[0] = pUnit1->pPath->xPos;
dwDist[1] = pUnit1->pPath->yPos;
break;
case UNIT_TYPE_OBJECT:
dwDist[0] = pUnit1->pObjectPath->dwPosX;
dwDist[1] = pUnit1->pObjectPath->dwPosY;
break;
}
switch(pUnit2->dwType)
{
case UNIT_TYPE_PLAYER:
case UNIT_TYPE_MISSILE:
case UNIT_TYPE_ITEM:
dwDist[2] = pUnit2->pPath->xPos;
dwDist[3] = pUnit2->pPath->yPos;
break;
case UNIT_TYPE_OBJECT:
dwDist[2] = pUnit2->pObjectPath->dwPosX;
dwDist[3] = pUnit2->pObjectPath->dwPosY;
break;
}
for(int x = 0; x < 4; x++)
if(!dwDist[x])
return INFINITE;
return (DWORD)CalculateDistance(dwDist[0], dwDist[1], dwDist[2], dwDist[3]);
}
VOID CheckAntiTppk()
{
if(IsTownLevel(GetPlayerArea()))
{
v_AntiTppkBusy=false; return;
}
if(v_AntiTppkBusy)
{
for(Room1* pRoom = Myself->pAct->pRoom1; pRoom && v_AntiTppkBusy; pRoom = pRoom->pRoomNext)
{
for(UnitAny* pUnit = pRoom->pUnitFirst; pUnit && v_AntiTppkBusy; pUnit = pUnit->pListNext)
{
if(pUnit->dwType == UNIT_TYPE_OBJECT && pUnit->dwTxtFileNo == 59)
{
if(!stricmp(pUnit->pObjectData->szOwner, Myself->pPlayerData->szName))
{
if(GetUnitDist(Myself, pUnit) < 12)
{
for(INT i = 0; i < 20; i++)
{
if(!GameReady() || IsTownLevel(GetPlayerArea()) ||
Myself->dwMode==PLAYER_MODE_DEATH || Myself->dwMode==PLAYER_MODE_DEAD ||
!TakeNextTP)
{
v_AntiTppkBusy = false;
break;
}
Interact(pUnit->dwUnitId, UNIT_TYPE_OBJECT, TRUE);
Sleep(50);
}
}
}
}
}
}
}
}
DWORD WINAPI TimerTickThread3(LPVOID P)
{
while(TRUE)
{
if(D2Inited)
if(D2Delay<20)
D2Delay++;
else
{
if(GetGameInfo()->szCharName!=NULL)
CheckAntiTppk();
}
Sleep(50);
}
return true;
}