forked from pvpgn/d2gs109
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcallback.c
200 lines (158 loc) · 6 KB
/
callback.c
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
#include <windows.h>
#include <stdio.h>
#include "d2gelib/d2server.h"
#include "callback.h"
#include "debug.h"
#include "vars.h"
#include "eventlog.h"
#include "handle_s2s.h"
#define _D(v) #v,v
EVENTCALLBACKTABLE gEventCallbackTable;
extern void __fastcall CloseGame(WORD wGameId)
{
DebugEventCallback("CloseGame",1, _D(wGameId));
D2GSCBCloseGame(wGameId);
return;
}
extern void __fastcall LeaveGame(LPGAMEDATA lpGameData, WORD wGameId, WORD wCharClass,
DWORD dwCharLevel, DWORD dwExpLow, DWORD dwExpHigh,
WORD wCharStatus, LPCSTR lpCharName, LPCSTR lpCharPortrait,
BOOL bUnlock, DWORD dwZero1, DWORD dwZero2,
LPCSTR lpAccountName, PLAYERDATA PlayerData,
PLAYERMARK PlayerMark)
{
DebugEventCallback("LeaveGame",14, _D(lpGameData), _D(wGameId), _D(wCharClass),
_D(dwCharLevel), _D(dwExpLow), _D(dwExpHigh), _D(wCharStatus),
_D(lpCharName), _D(lpCharPortrait), _D(bUnlock), _D(dwZero1),
_D(dwZero2), _D(lpAccountName), _D(PlayerData),_D(PlayerMark));
D2GSCBLeaveGame(lpGameData, wGameId, wCharClass, dwCharLevel, dwExpLow,
dwExpHigh, wCharStatus, lpCharName, lpCharPortrait, bUnlock,
dwZero1, dwZero2, lpAccountName, PlayerData, PlayerMark);
return;
}
extern void __fastcall GetDatabaseCharacter(LPGAMEDATA lpGameData, LPCSTR lpCharName,
DWORD dwClientId, LPCSTR lpAccountName)
{
DebugEventCallback("GetDatabaseCharacter", 4, _D(lpGameData), _D(lpCharName),
_D(dwClientId), _D(lpAccountName));
D2GSCBGetDatabaseCharacter(lpGameData, lpCharName, dwClientId, lpAccountName);
return;
}
extern void __fastcall SaveDatabaseCharacter(LPGAMEDATA lpGameData, LPCSTR lpCharName,
LPCSTR lpAccountName, LPVOID lpSaveData,
DWORD dwSize, PLAYERDATA PlayerData)
{
DebugEventCallback("SaveDatabaseCharacter",6, _D(lpGameData), _D(lpCharName),
_D(lpAccountName), _D(lpSaveData), _D(dwSize), _D(PlayerData));
D2GSCBSaveDatabaseCharacter(lpGameData, lpCharName,
lpAccountName, lpSaveData, dwSize, PlayerData);
return;
}
extern void __cdecl ServerLogMessage(DWORD dwCount, LPCSTR lpFormat, ...)
{
va_list ap;
va_start(ap,lpFormat);
LogAP("ServerLogMessage", lpFormat, ap);
va_end(ap);
return;
}
extern void __fastcall EnterGame(WORD wGameId, LPCSTR lpCharName, WORD wCharClass,
DWORD dwCharLevel, DWORD dwReserved)
{
DebugEventCallback("EnterGame",5, _D(wGameId), _D(lpCharName), _D(wCharClass),
_D(dwCharLevel) , _D(dwReserved));
D2GSCBEnterGame(wGameId, lpCharName, wCharClass, dwCharLevel, dwReserved);
return;
}
extern BOOL __fastcall FindPlayerToken(LPCSTR lpCharName, DWORD dwToken, WORD wGameId,
LPSTR lpAccountName, LPPLAYERDATA lpPlayerData)
{
DebugEventCallback("FindPlayerToken",5, _D(lpCharName), _D(dwToken),
_D(wGameId), _D(lpAccountName), _D(lpPlayerData));
return D2GSCBFindPlayerToken(lpCharName, dwToken, wGameId, lpAccountName, lpPlayerData);
}
extern void __fastcall UnlockDatabaseCharacter(LPGAMEDATA lpGameData, LPCSTR lpCharName,
LPCSTR lpAccountName)
{
DebugEventCallback("UnlockDatabaseCharacter", 3, _D(lpGameData), _D(lpCharName),
_D(lpAccountName));
return;
}
extern void __fastcall RelockDatabaseCharacter(LPGAMEDATA lpGameData, LPCSTR lpCharName,
LPCSTR lpAccountName)
{
DebugEventCallback("RelockDatabaseCharacter", 3, _D(lpGameData), _D(lpCharName),
_D(lpAccountName));
return;
}
extern void __fastcall UpdateCharacterLadder(LPCSTR lpCharName, WORD wCharClass,
DWORD dwCharLevel, DWORD dwCharExpLow,
DWORD dwCharExpHigh, WORD wCharStatus,
PLAYERMARK PlayerMark)
{
DebugEventCallback("UpdateCharacterLadder", 7, _D(lpCharName), _D(wCharClass),
_D(dwCharLevel), _D(dwCharExpLow), _D(dwCharExpHigh),
_D(wCharStatus), _D(PlayerMark));
D2GSUpdateCharacterLadder(lpCharName, wCharClass, dwCharLevel, dwCharExpLow,
dwCharExpHigh, wCharStatus);
return;
}
extern void __fastcall UpdateGameInformation(WORD wGameId, LPCSTR lpCharName,
WORD wCharClass, DWORD dwCharLevel)
{
DebugEventCallback("UpdateGameInformation", 4, _D(lpCharName),
_D(wCharClass), _D(dwCharLevel));
D2GSCBUpdateGameInformation(wGameId, lpCharName, wCharClass, dwCharLevel);
return;
}
extern GAMEDATA __fastcall SetGameData(void)
{
DebugEventCallback("SetGameData", 0);
return (GAMEDATA) 0x87654321;
}
extern void __fastcall SaveDatabaseGuild(DWORD dwReserved1, DWORD dwReserved2,
DWORD dwReserved3)
{
DebugEventCallback("SaveDatabaseGuild",3, _D(dwReserved1), _D(dwReserved2),
_D(dwReserved3));
return;
}
extern void __fastcall ReservedCallback1(DWORD dwReserved1, DWORD dwReserved2)
{
DebugEventCallback("ReservedCallback1",2, _D(dwReserved1), _D(dwReserved2));
return;
}
extern void __fastcall ReservedCallback2(DWORD dwReserved1, DWORD dwReserved2,
DWORD dwReserved3)
{
DebugEventCallback("ReservedCallback2",3, _D(dwReserved1), _D(dwReserved2),
_D(dwReserved3));
return;
}
extern void __fastcall LoadComplete(WORD wGameId, LPCSTR lpCharName, BOOL bExpansion)
{
DebugEventCallback("LoadComplete",3, _D(wGameId), _D(lpCharName),
_D(bExpansion));
//D2GSLoadComplete(wGameId, lpCharName, bExpansion);
return;
}
extern PEVENTCALLBACKTABLE EventCallbackTableInit(void)
{
gEventCallbackTable.fpCloseGame=CloseGame;
gEventCallbackTable.fpLeaveGame=LeaveGame;
gEventCallbackTable.fpGetDatabaseCharacter=GetDatabaseCharacter;
gEventCallbackTable.fpSaveDatabaseCharacter=SaveDatabaseCharacter;
gEventCallbackTable.fpServerLogMessage=ServerLogMessage;
gEventCallbackTable.fpEnterGame=EnterGame;
gEventCallbackTable.fpFindPlayerToken=FindPlayerToken;
gEventCallbackTable.fpUnlockDatabaseCharacter=UnlockDatabaseCharacter;
gEventCallbackTable.fpRelockDatabaseCharacter=RelockDatabaseCharacter;
gEventCallbackTable.fpUpdateCharacterLadder=UpdateCharacterLadder;
gEventCallbackTable.fpUpdateGameInformation=UpdateGameInformation;
gEventCallbackTable.fpSetGameData=SetGameData;
gEventCallbackTable.fpReserved1=ReservedCallback1;
gEventCallbackTable.fpReserved2=ReservedCallback2;
gEventCallbackTable.fpSaveDatabaseGuild=SaveDatabaseGuild;
gEventCallbackTable.fpLoadComplete=LoadComplete;
return &gEventCallbackTable;
}