-
Notifications
You must be signed in to change notification settings - Fork 1
/
Team.cpp
62 lines (57 loc) · 1.54 KB
/
Team.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
#include "DevilPK.h"
#include "D2Helpers.h"
/*
reminder when updating: Authn.LifeAddr1 is returned in DEC from 0x6FBCC080 in internet.cpp*/
DWORD PlayerRoster=0x11C080;
//DWORD PlayerRoster=0x6FBCC080;
DWORD __declspec(naked) __fastcall D2CLIENT_CheckLoot(DWORD pUnit)
{
__asm
{
mov eax, ecx
call D2CLIENT_CheckLootASM
retn
}
}
RosterUnit* FindPartyById(DWORD dwUnitId)
{
for(RosterUnit* pUnit = (RosterUnit*)*(DWORD*)PlayerRoster; pUnit; pUnit = pUnit->pNext)
if(pUnit->dwUnitId == dwUnitId)
return pUnit;
_asm nop
_asm fnop
return NULL;
}
DWORD GetPvpFlags(DWORD dwPlayerId)
{
DWORD dwFlags = 0;
UnitAny* Me=(UnitAny*)D2CLIENT_GetPlayerUnit();
for(RosterUnit* pUnit = (RosterUnit*)*(DWORD*)PlayerRoster; pUnit; pUnit = pUnit->pNext)
{
if(pUnit->dwUnitId != dwPlayerId)
continue;
if(pUnit->dwUnitId != Me->dwUnitId)
{
if(TestPvpFlag(dwPlayerId, Me->dwUnitId, 8))
dwFlags |= PVP_HOSTILED_YOU;
if(TestPvpFlag(Me->dwUnitId, dwPlayerId, 8))
dwFlags |= PVP_HOSTILED_BY_YOU;
if(pUnit->dwPartyFlags == 2)
dwFlags |= PVP_INVITED_YOU;
if(pUnit->dwPartyFlags == 4)
dwFlags |= PVP_INVITED_BY_YOU;
if(pUnit->dwPartyFlags == 20)
dwFlags |= PVP_ALLIED_WITH_YOU;
if(pUnit->wPartyId != 0xFFFF && pUnit->dwPartyFlags == 1)
{
RosterUnit* pMe = FindPartyById(Me->dwUnitId);
if(pMe->wPartyId == 0xFFFF)
dwFlags |= PVP_ALLIED;
else if(pMe->wPartyId == pUnit->wPartyId)
dwFlags |= PVP_ALLIED;
}
return dwFlags;
}
}
return dwFlags;
}