forked from noah-/d2bs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Profile.h
69 lines (55 loc) · 2.11 KB
/
Profile.h
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
#ifndef PROFILE_H
#define PROFILE_H
#include "D2BS.h"
enum ProfileType { PROFILETYPE_INVALID, PROFILETYPE_SINGLEPLAYER, PROFILETYPE_BATTLENET, PROFILETYPE_OPEN_BATTLENET, PROFILETYPE_TCPIP_HOST, PROFILETYPE_TCPIP_JOIN };
class Profile {
protected:
ProfileType type;
union {
wchar_t ip[16];
wchar_t username[48];
};
wchar_t password[256];
wchar_t gateway[256];
wchar_t charname[24];
wchar_t diff;
unsigned int maxLoginTime;
unsigned int maxCharTime;
void init(const wchar_t* profileName);
void init(ProfileType pt, const wchar_t* _ipUsername, const wchar_t* _password, const wchar_t* _charname, const wchar_t* _gateway, const wchar_t _diff,
unsigned int _maxLoginTime, unsigned int _maxCharTime) {
type = pt;
wcscpy_s(username, wcslen(username), _ipUsername);
wcscpy_s(password, wcslen(password), _password);
wcscpy_s(gateway, wcslen(gateway), _gateway);
wcscpy_s(charname, wcslen(charname), _charname);
diff = _diff;
maxLoginTime = _maxLoginTime;
maxCharTime = _maxCharTime;
}
public:
// Get the active profile
Profile() {
init(Vars.szProfile);
}
// Get profile by name
Profile(const wchar_t* profileName) {
init(profileName);
}
// Create single player or tcp/ip host profile
Profile(ProfileType pt, const wchar_t* charName, const wchar_t _diff) {
init(pt, L"", L"", charName, L"", _diff, 5000, 5000);
}
// Create battle.net or open battle.net profile
Profile(ProfileType pt, const wchar_t* account, const wchar_t* _pass, const wchar_t* _charname, const wchar_t* _gateway) {
init(pt, account, _pass, _charname, _gateway, 0, 5000, 5000);
}
// Create tcp/ip join profile
Profile(ProfileType pt, const wchar_t* _charname, const wchar_t* ip) {
init(pt, ip, L"", _charname, L"", 0, 5000, 5000);
}
friend JSAPI_PROP(profile_getProperty);
DWORD login(char** error);
static bool ProfileExists(const wchar_t* profile);
};
#endif