Repository navigation
Expand file tree
/
Copy pathDataInterface.h
More file actions
585 lines (503 loc) · 13.7 KB
/
Copy pathDataInterface.h
File metadata and controls
585 lines (503 loc) · 13.7 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
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
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
#include "framework.h"
#include <mysql/mysql.h>
#include "INIParser.h"
#define WORKER_QUEUELENGTH 128 // jobs at max
#define WORKER_THREADS 1
typedef struct
{
sint8 Accountname[15];
uint32 ID;
union
{
struct
{
uint32 UID1;
uint32 UID2;
};
unsigned long long uid;
};
}authSessionInfo_t;
typedef struct
{
void (*workCallback)(MYSQL *dbCon, void *job, void *cb, void *param);
void *doneCallBack;
void *param; // cgm
void *jobData;
}DataInterfaceWorkerQueueEntry_t;
typedef struct
{
MYSQL *dbCon;
DataInterfaceWorkerQueueEntry_t jobQueue[WORKER_QUEUELENGTH];
sint32 queueWriteIndex;
sint32 queueReadIndex;
}DataInterfaceWorkerThread_t;
/* character */
#define SWAPSET_SIZE 21
#define CHARACTER_FIRSTNAMELIMIT 64
#define NPC_NAMELIMIT 56
typedef struct
{
unsigned long long characterID;
sint8 unicodeName[CHARACTER_FIRSTNAMELIMIT];
sint8 unicodeFamily[CHARACTER_FIRSTNAMELIMIT];
bool genderIsMale;
sint8 raceID; // 1 to 4
sint8 slotIndex; // 0 to 15
sint32 classID;
unsigned long long userID;
float posX;
float posY;
float posZ;
sint32 currentContextId;
struct
{
sint32 classId; // entityClassId
uint32 hue; // 0xAABBGGRR
}appearanceData[SWAPSET_SIZE];
}di_characterPreview_t;
typedef struct
{
sint8 unicodeName[CHARACTER_FIRSTNAMELIMIT];
sint8 unicodeFamily[CHARACTER_FIRSTNAMELIMIT];
bool genderIsMale;
sint8 raceID; // 1 to 4
sint8 slotIndex; // 0 to 15
sint32 classId; // character class
unsigned long long userID;
float posX;
float posY;
float posZ;
sint32 currentContextId;
struct
{
sint32 classId; // entityClassId
uint32 hue; // 0xAABBGGRR
}appearanceData[SWAPSET_SIZE];
// output
bool error; // set to true by the sint32erface if the character could not be created
bool error_nameAlreadyInUse; // set to true if the name is already used
}di_characterLayout_t;
typedef struct {
uint32 missionId;
uint32 missionState;
}di_CharacterMissionData;
typedef struct
{
unsigned long long characterID;
sint8 unicodeName[CHARACTER_FIRSTNAMELIMIT];
sint8 unicodeFamily[CHARACTER_FIRSTNAMELIMIT];
bool genderIsMale;
sint8 raceID; // 1 to 4
sint8 slotIndex; // 0 to 15
sint32 classID;
unsigned long long userID;
float posX;
float posY;
float posZ;
sint32 currentContextId;
struct
{
sint32 classId; // entityClassId
uint32 hue; // 0xAABBGGRR
}appearanceData[SWAPSET_SIZE];
// stats shit
// inventory shit
// mission data
uint32 missionStateCount;
di_CharacterMissionData *missionStateData;
}di_characterData_t;
/* npc */
typedef struct
{
unsigned long long npcID;
uint32 creatureTypeId;
sint32 npcPackageId;
struct
{
sint32 classId; // entityClassId
uint32 hue; // 0xAABBGGRR
}appearanceData[SWAPSET_SIZE];
}di_npcData_t;
/* vendor */
typedef struct
{
uint32 itemTemplateId;
uint32 stacksize;
sint32 sequence;
}di_vendorItemData_t;
typedef struct
{
uint32 creatureTypeId;
sint32 vendorPackageId;
// list of items
uint32 numberOfItems;
di_vendorItemData_t* itemList;
}di_vendorData_t;
/* creature loot table */
typedef struct
{
sint32 itemTemplateId;
float chance;
sint32 stacksizeMin;
sint32 stacksizeMax;
}diData_lootTable_t;
/* creature type */
typedef struct
{
sint32 id;
sint8 name[70];
sint32 nameId;
sint32 classId;
sint16 faction;
float walkspeed;
float runspeed;
sint32 hitpoints;
sint32 missile[8]; // up to 8 different abilities/attacks
float wanderDistance;
// loot table
sint32 numLootEntries;
diData_lootTable_t* lootTable;
}diJob_creatureType_t;
/* missile */
typedef struct
{
sint32 id;
sint8 description[50];
sint32 actionId; // action
sint32 actionArgId; // subaction
float rangeMin;
float rangeMax;
sint32 recoverTime; // cooldown time after use
sint32 recoverTimeGlobal; // min cooldown of all available actions
sint32 windupTime; // windup animation time
sint32 minDamage; // min damage, not all missile actions use this
sint32 maxDamage; // max damage, not all missile actions use this
}diJob_creatureAction_t;
/* spawnpool */
typedef struct
{
sint32 id;
sint32 mode; // 0 -> automatic spawn, 1 -> base/outpost(CP) spawn, 2 -> scripted spawn (must be triggered)
sint8 animType; // 0 -> no animation, 1 -> bane dropship
sint32 respawnTime; // only for automatic spawn, how long it takes to respawn creatures after all are killed
float posX;
float posY;
float posZ;
sint32 contextId;
struct
{
sint32 creatureType;
sint32 countMin;
sint32 countMax;
}spawnSlot[6];
}diJob_spawnpool_t;
typedef struct
{
sint32 mode;
sint8 animType;
sint32 respawnTime;
float posX;
float posY;
float posZ;
sint32 contextId;
struct
{
sint32 creatureType;
sint32 countMin;
sint32 countMax;
}spawnSlot[6];
}diData_spawnEntry_t;
/* TEST:entitydata */
typedef struct
{
unsigned long long npcID;
sint8 unicodeName[NPC_NAMELIMIT];
sint32 entityClassID;
float posX;
float posY;
float posZ;
float rotation;
sint32 currentContextId;
struct
{
sint32 classId; // entityClassId
uint32 hue; // 0xAABBGGRR
}appearanceData[SWAPSET_SIZE];
}di_entityDataW_t;
/*TEST entity queue job*/
typedef struct
{
di_entityDataW_t *entityData;
}diJob_updateEntityW_t;
/* TEST 2*/
typedef struct baseBehavior_baseNode
{
float x;
float y;
float z;
sint32 contextid;
sint32 pindex; //-- postition of pathnode
}cbaseNode;
typedef struct
{
sint32 spawntype;
float posX;
float posY;
float posZ;
sint32 pathindex;
sint32 currentContextId;
}di_pathNodeDataW2_t;
typedef struct
{
di_pathNodeDataW2_t *pnodedata;
}diJob_updatePathNodeW2_t;
typedef struct
{
uint32 id;
uint32 contextid;
uint32 type; //--- twostate teleporter, waypoint, wormhole,etc
uint32 nameId; // used for name lookup
//uint32 modelid; //---appereance (now integrated into type)
sint8 label[50];
float sx; //---current location
float sy;
float sz;
float dx; //---destination
float dy;
float dz;
float bx; //---activation area
float bz;
}di_teleporterData;
typedef struct
{
uint32 mapContextId;
uint32 scount;
di_teleporterData *tdata;
}diJob_teleporterData;
/* item templates */
typedef struct
{
sint32 itemTemplateId;
sint32 classId;
sint32 qualityId;
sint32 type;
sint32 reqLevel; // min level required
bool hasSellableFlag;
bool notTradeableFlag;
bool hasCharacterUniqueFlag;
bool hasAccountUniqueFlag;
bool hasBoEFlag;
bool boundToCharacterFlag;
bool notPlaceableInLockBoxFlag;
sint32 inventoryCategory;
sint32 buyPrice;
sint32 sellPrice;
sint32 stacksize;
}diJob_itemTemplateEntry_t;
typedef struct
{
sint32 numberOfItemTemplates;
diJob_itemTemplateEntry_t* itemTemplateList;
}diJob_itemTemplate_t;
typedef struct
{
sint32 itemTemplateId;
sint32 slotType;
sint32 skillId; // -1 if not used
sint32 skillMinVal;
// todo: Add appearance hue to this table?
}diJob_itemTemplateEquipmentEntry_t;
typedef struct
{
sint32 numberOfTemplates;
diJob_itemTemplateEquipmentEntry_t* itemTemplateEquipmentList;
}diJob_itemTemplateEquipment_t;
typedef struct
{
sint32 itemTemplateId;
sint32 damageAbsorbed; // damage absorbed
sint32 regenRate; // regen rate
sint32 armorValue; // body armor
}diJob_itemTemplateArmorEntry_t;
typedef struct
{
sint32 numberOfTemplates;
diJob_itemTemplateArmorEntry_t* itemTemplateArmorList;
}diJob_itemTemplateArmor_t;
typedef struct
{
sint32 itemTemplateId;
uint32 clipSize;
uint32 currentAmmo;
float aimRate;
uint32 reloadTime;
sint32 altActionId;
sint32 altActionArg;
sint8 aeType;
uint32 aeRadius;
uint32 recoilAmount;
sint8 reuseOverride;
uint32 coolRate;
float heatPerShot;
sint8 toolType;
// bool isJammed; -> Doesn't make much sense to have weapons that are "jammed" by default?
sint8 ammoPerShot;
uint32 minDamage;
uint32 maxDamage;
uint32 ammoClassId;
sint8 damageType;
sint32 windupTime;
uint32 recoveryTime;
uint32 refireTime;
uint32 range;
uint32 altMaxDamage;
sint8 altDamageType;
uint32 altRange;
uint32 altAERadius;
sint8 altAEType;
sint8 attackType;
}diJob_itemTemplateWeaponEntry_t;
typedef struct
{
sint32 numberOfTemplates;
diJob_itemTemplateWeaponEntry_t* itemTemplateWeaponList;
}diJob_itemTemplateWeapon_t;
/* mission */
typedef struct
{
sint32 missionId;
unsigned long long dispenserNPC;
unsigned long long collectorNPC;
// more todo
}di_missionData_t;
typedef struct
{
uint32 id;
uint32 missionId;
uint16 command;
uint16 state;
uint8 flags;
sint32 value1;
sint32 value2;
sint32 value3;
}di_missionScriptLine_t;
typedef struct
{
uint32 scriptLineCount;
di_missionScriptLine_t* scriptLines;
}di_missionScript_t;
/* job data blocks */
typedef struct
{
unsigned long long userId;
uint32 slotIndex;
// output
di_characterPreview_t *outPreviewData[16];
}diJob_getCharacterPreviewInfo_t;
typedef struct
{
unsigned long long userId;
uint32 slotIndex;
// output
di_characterData_t *outCharacterData;
}diJob_characterData_t;
typedef struct
{
unsigned long long userId;
uint32 slotId;
// output
bool error;
}diJob_deleteCharacter_t;
typedef struct
{
// output
sint32 outNpcCount;
di_npcData_t *outNpcList;
}diJob_npcListData_t;
typedef struct
{
// output
sint32 outVendorCount;
di_vendorData_t *outVendorList;
}diJob_vendorListData_t;
typedef struct
{
di_npcData_t *npcData;
}diJob_updateNPC_t;
typedef struct
{
// output
sint32 outState;
unsigned long long outEntityId;
}diJob_getLastNPCEntityID_t;
typedef struct
{
// output
sint32 outMissionCount;
di_missionData_t *outMissionList;
}diJob_missionListData_t;
typedef struct
{
float pos[3];
//sint32 nodeIndex;
}diData_pathNodes_t;
typedef struct
{
sint32 pathId;
sint32 contextId;
sint32 mode;
sint32 numberOfNodes;
sint32 spawnpool; // the spawnpool that will use this path, 0 if not used
float nodeOffsetRandomization; // how far away can creatures pass a path node
diData_pathNodes_t* pathnodes;
bool _isFinished; // only used by the data interface methods
}diData_path_t;
typedef struct
{
// when writing a single path
diData_path_t* pathData;
// when reading all paths from the db
diData_path_t* pathList;
sint32 pathCount;
}diJob_path_t;
/* general */
void DataInterface_init();
void* DataInterface_allocJob(sint32 size);
void DataInterface_freeJob(void *job);
void DataInterface_queueJob(void *jobData, void *workCallback, void *doneCallback, void *param);
/* character */
void DataInterface_Character_getCharacterPreviewInfo(unsigned long long userID, uint32 slotIndex, void (*cb)(void *param, diJob_getCharacterPreviewInfo_t *jobData), void *param);
void DataInterface_Character_getCharacterData(unsigned long long userID, uint32 slotIndex, void (*cb)(void *param, diJob_characterData_t *jobData), void *param);
void DataInterface_Character_createCharacter(di_characterLayout_t *characterData, void (*cb)(void *param, di_characterLayout_t *jobData), void *param);
void DataInterface_Character_deleteCharacter(unsigned long long userID, sint32 slotId, void (*cb)(void *param, diJob_deleteCharacter_t *jobData), void *param);
/* npc */
void DataInterface_NPC_getNPCList(void (*cb)(void *param, diJob_npcListData_t *jobData), void *param);
/* vendor */
void DataInterface_Vendor_getVendorList(void (*cb)(void *param, diJob_vendorListData_t *jobData), void *param);
//void DataInterface_NPC_updateNPC(di_npcData_t *npcData, void (*cb)(void *param, diJob_updateNPC_t *jobData), void *param);
/* creatureType */
void DataInterface_Creature_getCreatureTypeList(void (*cb)(void *param, diJob_creatureType_t *jobData), void *param);
/* path nodes */
void DataInterface_Creature_getPathList(void (*cb)(void *param, diJob_path_t *jobData), void *param);
void DataInterface_Creature_savePath(diData_path_t* pathData);
/* spawn system */
void DataInterface_SpawnSystem_getSpawnPoolList(void (*cb)(void *param, diJob_spawnpool_t *jobData), void *param);
sint32 DataInterface_SpawnSystem_addSpawnPoint(diData_spawnEntry_t* spawnEntry);
/* missile */
void DataInterface_Creature_getCreatureActionList(void (*cb)(void *param, diJob_creatureAction_t *jobData), void *param);
/* mission */
void DataInterface_Mission_getMissionList(void (*cb)(void *param, diJob_missionListData_t *jobData), void *param);
void DataInterface_Mission_getMissionScriptData(void (*cb)(void *param, di_missionScript_t *jobData), void *param);
/* item template */
void DataInterface_Item_getItemTemplates(void (*cb)(void *param, diJob_itemTemplate_t *jobData), void *param);
void DataInterface_Item_getItemEquipmentData(void (*cb)(void *param, diJob_itemTemplateEquipment_t *jobData), void *param);
void DataInterface_Item_getItemArmorData(void (*cb)(void *param, diJob_itemTemplateArmor_t *jobData), void *param);
void DataInterface_Item_getItemWeaponData(void (*cb)(void *param, diJob_itemTemplateWeapon_t *jobData), void *param);
/* extra */
void DataInterface_registerServerForAuth();
uint32 DataInterface_IPtoHex();
uint32 DataInterface_getMyIP();
sint32 DataInterface_QuerySession(uint32 ID1, uint32 ID2, authSessionInfo_t *asiOut);
//void DataInterface_Entity_updateEntityW(di_entityDataW_t *entityData, void (*cb)(void *param, diJob_updateNPC_t *jobData), void *param);
void DataInterface_teleporter_getList(uint32 mapContextId, void (*cb)(void *param, diJob_teleporterData *jobData), void *param);
void DataInterface_teleporter_updateList( di_teleporterData *objectData, void (*cb)(void *param, diJob_teleporterData *jobData), void *param);