aboutsummaryrefslogtreecommitdiff
path: root/analyzer/parser/fight_results.h
diff options
context:
space:
mode:
authorMosder <xmosder12@gmail.com>2026-07-20 17:58:02 +0200
committerMosder <xmosder12@gmail.com>2026-07-20 17:58:02 +0200
commitf73349115edbc75021885eefd33ee33ee504d9a7 (patch)
tree5d2d79af731bcbc85d07e9d6dd69f6c836c25a5b /analyzer/parser/fight_results.h
parentc182f2f4f850589c23b2241e11dab143e1003ff2 (diff)
feat: added drif parsing and coloring of items depending on type
Diffstat (limited to 'analyzer/parser/fight_results.h')
-rw-r--r--analyzer/parser/fight_results.h91
1 files changed, 84 insertions, 7 deletions
diff --git a/analyzer/parser/fight_results.h b/analyzer/parser/fight_results.h
index 3aadf09..76083ab 100644
--- a/analyzer/parser/fight_results.h
+++ b/analyzer/parser/fight_results.h
@@ -9,17 +9,16 @@
// 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 "&"
+// EntityResults structure:
+// field (SEPARATOR_RESULT field)*
+// fields are defined in order in the EntityResults struct
#define ENTITY_FIELD_COUNT 35
+// clang-format off
#define ENTITY_FIELD_TYPES { \
/* team */ INT, \
/* name */ STRING, \
@@ -94,7 +93,7 @@
&entity_results.field34, \
&entity_results.saturation \
}
-
+// clang-format on
typedef struct {
int team; // friend or enemy
char *name;
@@ -137,6 +136,84 @@ typedef struct {
#define INIT_ITEMS_CAPACITY 8
#define SINGLE_ITEM_BUFFER_LEN 128
#define SEPARATOR_ITEMS "[-]"
+#define SEPARATOR_DRIFS "???" // TODO: change it to correct one which idk at this moment
+#define SEPARATOR_DRIF_INFO ","
+// Item struct - for keeping item string and type
+typedef enum { NORMAL, DRIF, SYNG, SET, RARE, EPIC } ItemType;
+typedef struct {
+ char *data;
+ ItemType type;
+} Item;
+
+// Drif structure:
+// field (SEPARATOR_DRIF field)*
+// fields are defined in order in the Drif struct
+#define DRIF_FIELD_COUNT 19
+// clang-format off
+#define DRIF_FIELD_TYPES { \
+ /* field1 */ STRING, \
+ /* field2 */ INT, \
+ /* field3 */ INT, \
+ /* field4 */ STRING, \
+ /* field5 */ INT, \
+ /* field6 */ INT, \
+ /* field7 */ FLOAT, \
+ /* field8 */ FLOAT, \
+ /* field9 */ INT, \
+ /* field10 */ INT, \
+ /* field11 */ STRING, \
+ /* field12 */ STRING, \
+ /* field13 */ INT, \
+ /* field14 */ INT, \
+ /* field15 */ INT, \
+ /* field16 */ INT, \
+ /* name */ STRING, \
+ /* field18 */ STRING, \
+ /* field19 */ STRING, \
+}
+#define DRIF_FIELD_ADDRESSES(drif) {\
+ &drif.field1, \
+ &drif.field2, \
+ &drif.field3, \
+ &drif.field4, \
+ &drif.field5, \
+ &drif.field6, \
+ &drif.field7, \
+ &drif.field8, \
+ &drif.field9, \
+ &drif.field10, \
+ &drif.field11, \
+ &drif.field12, \
+ &drif.field13, \
+ &drif.field14, \
+ &drif.field15, \
+ &drif.field16, \
+ &drif.name, \
+ &drif.field18, \
+ &drif.field19, \
+}
+// clang-format on
+typedef struct {
+ char *field1;
+ int field2;
+ int field3;
+ char *field4;
+ int field5;
+ int field6;
+ float field7;
+ float field8;
+ int field9;
+ int field10;
+ char *field11;
+ char *field12;
+ int field13;
+ int field14;
+ int field15;
+ int field16;
+ char *name; // <size>drif <name>
+ char *field18;
+ char *field19;
+} Drif;
// values of field "team"
#define TEAM_FRIEND 1
@@ -147,7 +224,7 @@ typedef struct {
char *name;
int exp;
int gold;
- char **items;
+ Item *items;
size_t num_items;
int level;
int psycho;