-
Notifications
You must be signed in to change notification settings - Fork 1
/
Common.cpp
35 lines (27 loc) · 912 Bytes
/
Common.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
#include "DevilPK.h"
bool GetPlayerRoster(RosterUnit* pUnit, DWORD nUnitId)
{
for (RosterUnit* pUnit = D2CLIENT_PlayerList; pUnit; pUnit = pUnit->pNext)
if (pUnit->dwUnitId == nUnitId)
return true;
return false;
}
int GetPvPStatus(DWORD nUnitId)
{
RosterUnit* pUnit;
for (pUnit = D2CLIENT_PlayerList; pUnit; pUnit = pUnit->pNext)
if (pUnit->dwUnitId == nUnitId)
break;
if (!pUnit)
return PVP_HOSTILE;
UnitAny* mypUnit = D2CLIENT_GetPlayerUnit ();
RosterUnit* prPlayer;
for (prPlayer = D2CLIENT_PlayerList; prPlayer; prPlayer = prPlayer->pNext)
if (prPlayer->dwUnitId == mypUnit->dwUnitId)
break;
if (TestPvpFlag(nUnitId, mypUnit->dwUnitId, 8) || TestPvpFlag(mypUnit->dwUnitId, nUnitId, 8))
return PVP_HOSTILE;
if (pUnit->dwPartyFlags & PARTY_IN_PARTY && prPlayer->wPartyId == pUnit->wPartyId)
return PVP_FRIENDLY;
return PVP_NEUTRAL;
}