forked from noah-/d2bs
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGame.cpp
More file actions
40 lines (32 loc) · 1.05 KB
/
Game.cpp
File metadata and controls
40 lines (32 loc) · 1.05 KB
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
#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);
}
}