-
Notifications
You must be signed in to change notification settings - Fork 1
/
CalcTele.cpp
102 lines (75 loc) · 2.46 KB
/
CalcTele.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
#include "DevilPK.h"
//POINT aPath[255];
// POINT WalkPath[255];
// DWORD dwCount;
// int telex=0;
// DWORD QuestID;
// POINT Safed;
bool AutoTele=false;
int CurrentDW;
void Interact(DWORD ID,DWORD Type) {
//fpGetUnitByCords
//13 [DWORD entity kind] [DWORD id]
byte Interact[9]={0x13,00,00,00,00, 00,00,00,00};
*(DWORD*)&Interact[5]=ID;
*(DWORD*)&Interact[1]=Type;
SendGAMEPacket(Interact,sizeof(Interact));
}
void TeleportTo(WORD x, WORD y)
{
BYTE aPacket[5];
aPacket[0] = 0x0C;
memcpy(&aPacket[1],&x,2);
memcpy(&aPacket[3],&y,2);
SendGAMEPacket(aPacket,sizeof(aPacket));
}
DWORD fpCalculateTeleportPath(long x, long y, LPPOINT lpBuffer, DWORD dwMaxCount)
{/*
CCollisionMap g_collisionMap;
if (!g_collisionMap.CreateMap(GetPlayerArea()))
PrintMessage("Failed Creating Map",4);
return 0;
POINT ptStart = GetPosition();
POINT ptEnd = { x, y };
if (!g_collisionMap.IsValidAbsLocation(ptStart.x, ptStart.y)
|| !g_collisionMap.IsValidAbsLocation(ptEnd.x, ptEnd.y))
return 0;
g_collisionMap.AbsToRelative(ptStart);
g_collisionMap.AbsToRelative(ptEnd);
WordMatrix matrix;
if (!g_collisionMap.CopyMapData(matrix))
return 0;
g_collisionMap.MakeBlank(matrix, ptStart);
g_collisionMap.MakeBlank(matrix, ptEnd);
CTeleportPath tf(matrix.GetData(), matrix.GetCX(), matrix.GetCY());
DWORD dwCount = tf.FindTeleportPath(ptStart, ptEnd, lpBuffer, dwMaxCount);
for (DWORD i = 0; i < dwCount; i++)
g_collisionMap.RelativeToAbs(lpBuffer[i]);
return dwCount;*/
return 0;
}
int WalkToPath(long x, long y, LPPOINT lpBuffer, DWORD dwMaxCount)
{ /*
CCollisionMap g_collisionMap;
if (!g_collisionMap.CreateMap(GetPlayerArea()))
return 0;
POINT ptStart = GetPosition();
POINT ptEnd = { x, y };
if (!g_collisionMap.IsValidAbsLocation(ptStart.x, ptStart.y)
|| !g_collisionMap.IsValidAbsLocation(ptEnd.x, ptEnd.y))
return 0;
g_collisionMap.AbsToRelative(ptStart);
g_collisionMap.AbsToRelative(ptEnd);
WordMatrix matrix;
if (!g_collisionMap.CopyMapData(matrix))
return 0;
g_collisionMap.ThickenWalls(matrix, 1);
g_collisionMap.MakeBlank(matrix, ptStart);
g_collisionMap.MakeBlank(matrix, ptEnd);
CWalkPath wp(matrix.GetData(), matrix.GetCX(), matrix.GetCY());
DWORD dwCount = (DWORD)wp.FindWalkPath(ptStart, ptEnd, lpBuffer, dwMaxCount);
for (DWORD i = 0; i < dwCount; i++)
g_collisionMap.RelativeToAbs(lpBuffer[i]);
return dwCount;*/
return 0;
}