blob: 270aba8dfe6cb61a3756ed7dcb6e986018ee2d11 (
plain)
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
|
// parser/fight_results.h
// utilities for parsing the fight results data
// Payload structure:
// FIGHT_RESULTS_START EntityResults (SEPARATOR_ENTITY EntityResults)* FIGHT_RESULTS_END
//
// EntityResults structure:
// field (SEPARATOR_RESULT field)*
// fields are defined in order in the EntityResults struct
#define FIGHT_RESULTS_START "3;19;"
#define FIGHT_RESULTS_END "[--];"
#define SEPARATOR_ENTITY "[--]"
#define SEPARATOR_RESULT "&"
typedef struct {
int team; // friend or enemy
char *name;
int exp;
float field4;
int gold;
float field6;
char *field7;
char *gear; // rares, sets, syngs, orbs
int field9;
char *items; // regular items
int field11;
int field12;
float field13;
float field14; // some multiplier most likely exp/gold/psycho/something else idk
float field15;
int level;
double field17;
float field18;
int field19;
int field20;
float field21;
float field22;
int field23;
int field24;
int psycho;
char *drifs;
int splinters;
int field28;
char *field29;
int field30;
int field31; // possibly information who is the player - 1 for current player, 0 for others (need to double check)
int field32;
int field33;
char *field34;
char *saturation;
} EntityResults;
// values of field "team"
#define TEAM_FRIEND 1
#define TEAM_ENEMY 2
// fight results data for friendly
typedef struct {
char *name;
int exp;
int gold;
char *gear;
char *items;
int level;
int psycho;
char *drifs;
int splinters;
char *saturation_type;
int saturation;
} FriendlyResults;
// fight results data for enemy
typedef struct {
char *name;
int level;
} EnemyResults;
// entire fight resutls
typedef struct {
int num_friendly;
FriendlyResults *friendly_results;
int num_enemy;
EnemyResults *enemy_results;
} FightResults;
// find the first fight results data in stream
// params:
// - stream - stream to find the fight results in
// - stream_len - length of the stream
// - length - length of the fight results data or -1 if there's no end yet
// returns:
// pointer to the beggining of fight results data or NULL if there's none
extern char *find_fight_results(char *stream, int stream_len, int *length);
// parse given fight results
// params:
// - data - fight results data to parse
// - length - length of fight results data
// returns:
// FightResults struct containing parsed data
extern FightResults parse_fight_results(char *data, int length);
|