diff options
| author | Maciej Borowiec <81316152+Mosder@users.noreply.github.com> | 2026-07-23 20:17:15 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-07-23 20:17:15 +0200 |
| commit | 3419cad016b3c34d0630456d4390c70063462d91 (patch) | |
| tree | 3a1aa4416e45f134d38f83d4ea2285f1972f9391 /analyzer/parser/fight_results/fight_results.h | |
| parent | 2e3f7fe39791cd671a68330f7ba7a5bb5fc6f9ae (diff) | |
| parent | 682f9fc8288fdd01de1d88af87495d9e43f56b06 (diff) | |
LGTM
Diffstat (limited to 'analyzer/parser/fight_results/fight_results.h')
| -rw-r--r-- | analyzer/parser/fight_results/fight_results.h | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/analyzer/parser/fight_results/fight_results.h b/analyzer/parser/fight_results/fight_results.h new file mode 100644 index 0000000..ec90394 --- /dev/null +++ b/analyzer/parser/fight_results/fight_results.h @@ -0,0 +1,60 @@ +// parser/fight_results.h +// utilities for parsing the fight results data + +#include "parser/parser_defs.h" +#include "utils/tcp.h" + +#ifndef FIGHT_RESULTS_H +#define FIGHT_RESULTS_H + +// Payload structure: +// FIGHT_RESULTS_START EntityResults (SEPARATOR_ENTITY EntityResults)* FIGHT_RESULTS_END +#define FIGHT_RESULTS_START "3;19;" +#define FIGHT_RESULTS_END "[--];" + +// items parsing info +#define INIT_ITEMS_CAPACITY 8 +#define SINGLE_ITEM_BUFFER_LEN 128 +#define SEPARATOR_ITEMS "[-]" + +// Item struct - for keeping item string and type +typedef enum { NORMAL, DRIF, ORB, SYNG, SET, RARE, EPIC } ItemType; +typedef struct { + char *data; + ItemType type; +} Item; + +// fight results data for friendly +typedef struct { + char *name; + int exp; + int gold; + Item *items; + size_t num_items; + int level; + int psycho; + int splinters; + const char *saturation_type; + int saturation; +} FriendlyResults; + +// fight results data for enemy +typedef struct { + char *name; + int level; +} EnemyResults; + +#define INIT_ENTITIES_PER_SIDE 6 + +// entire fight resutls +typedef struct { + size_t num_friendly; + FriendlyResults *friendly_results; + size_t num_enemy; + EnemyResults *enemy_results; +} FightResults; + +extern find_function_t find_fight_results; +extern parse_function_t parse_fight_results; + +#endif |
