-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathGame.cpp
43 lines (35 loc) · 970 Bytes
/
Game.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
#include "Game.h"
#include "D2Ptrs.h"
#include "Constants.h"
#include "D2Helpers.h"
// TODO: Refactor a lot of the JSGame functions here
void SendGold(int nGold, int nMode)
{
*p_D2CLIENT_GoldDialogAmount = nGold;
*p_D2CLIENT_GoldDialogAction = nMode;
D2CLIENT_PerformGoldDialogAction();
}
void __fastcall UseStatPoint(WORD stat, int count)
{
if(D2COMMON_GetUnitStat(D2CLIENT_GetPlayerUnit(), STAT_STATPOINTSLEFT, 0) < count)
return;
BYTE packet[3] = {0x3A};
*(WORD*)&packet[1] = stat;
for( int i = 0; i < count; i++)
{
D2CLIENT_SendGamePacket(3, packet);
if(i != count-1) Sleep(500);
}
}
void __fastcall UseSkillPoint(WORD skill, int count)
{
if(D2COMMON_GetUnitStat(D2CLIENT_GetPlayerUnit(), STAT_SKILLPOINTSLEFT, 0) < count)
return;
BYTE packet[3] = {0x3B};
*(WORD*)&packet[1] = skill;
for( int i = 0; i < count; i++)
{
D2CLIENT_SendGamePacket(3, packet);
if(i != count-1) Sleep(500);
}
}