All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Macros | Functions | Variables
Aion Chatlog Parser

This module parses the chatlog. More...

Macros

#define RE_NAME   "([[:alnum:]]+)"
 
#define RE_ITEM   "\\[item:([[:digit:]]+).*\\]"
 
#define RE_NUM_ROLL   "[0-9\\.]+"
 
#define RE_ITEM_LOOT_SELF   100
 
#define RE_ITEM_LOOT_PLAYER   101
 
#define RE_DAMAGE_INFLICT   200
 
#define RE_DAMAGE_CRITICAL   201
 
#define RE_GROUP_SELF_JOIN   300
 
#define RE_GROUP_SELF_LEAVE   301
 
#define RE_GROUP_SELF_KICK   302
 
#define RE_GROUP_PLAYER_JOIN   303
 
#define RE_GROUP_PLAYER_LEAVE   304
 
#define RE_GROUP_PLAYER_DISCONNECT   305
 
#define RE_GROUP_PLAYER_KICK   306
 
#define RE_GROUP_PLAYER_OFFLINE   307
 
#define RE_GROUP_DISBAND   308
 
#define RE_ALI_SELF_JOIN   350
 
#define RE_ALI_SELF_LEAVE   351
 
#define RE_ALI_SELF_KICK   352
 
#define RE_ALI_PLAYER_JOIN   353
 
#define RE_ALI_PLAYER_LEAVE   354
 
#define RE_ALI_PLAYER_DISCONNECT   355
 
#define RE_ALI_PLAYER_KICK   356
 
#define RE_ALI_PLAYER_OFFLINE   357
 
#define RE_ALI_DISBAND   358
 
#define RE_CHAT_SELF   400
 
#define RE_CHAT_GENERAL   401
 
#define RE_CHAT_WHISPER   402
 
#define RE_CHAT_SHOUT   403
 
#define RE_ROLL_ITEM_SELF   500
 
#define RE_ROLL_ITEM_PLAYER   501
 
#define RE_ROLL_ITEM_PASS   502
 
#define RE_ROLL_ITEM_HIGHEST   503
 
#define RE_ROLL_DICE_SELF   504
 
#define RE_ROLL_DICE_PLAYER   505
 

Functions

static bool chatlog_open (void)
 
void chatlog_parse (uint32_t re_id, const char *matchstr, regmatch_t *rematch, size_t rematch_num)
 
bool chatlog_init ()
 
bool chatlog_readstr (char *chatstr)
 
bool chatlog_poll ()
 
bool chatlog_readfile (char *file)
 

Variables

static FILE * chatlog_file = NULL
 
static re_callback_t chatlog_parse
 
struct regeng re_aion []
 

Chatlog Event Processing Functions

These process various events that are triggered by the regeng engine when it parses the chat log.

They process stuff like:

  • Item loot
  • Item rolls
  • Damage taken/received
  • Group joins/leaves
  • Probably much more..
void parse_action_loot_item (char *player, uint32_t itemid)
 
void parse_action_damage_inflict (char *player, char *target, char *damage, char *skill)
 
void parse_action_group_self_join (void)
 
void parse_action_group_self_leave (void)
 
void parse_action_group_player_join (char *who)
 
void parse_action_group_player_leave (char *who)
 
void parse_action_chat_general (char *name, char *txt)
 
void parse_action_chat_whisper (char *name, char *txt)
 
void parse_action_chat_shout (char *name, char *txt)
 
void parse_action_roll_item_self (void)
 
void parse_action_roll_item_player (char *who)
 
void parse_action_roll_item_pass (char *who)
 
void parse_action_roll_item_highest (char *who)
 

Detailed Description

This module parses the chatlog.

This module reads the chatlog line-by-line and matches each line against a regex and fires off an event accordingly.

Events are processed in a giant loop switch. The loop switch extracts some information from the regex and calls a function with the information as parameters.

Macro Definition Documentation

#define RE_ALI_DISBAND   358

The group was disbanded

#define RE_ALI_PLAYER_DISCONNECT   355

Some player was disconnected

#define RE_ALI_PLAYER_JOIN   353

Some other player joined the group

#define RE_ALI_PLAYER_KICK   356

A player was kicked from the group

#define RE_ALI_PLAYER_LEAVE   354

Some other player left the group

#define RE_ALI_PLAYER_OFFLINE   357

A player in the group went offline

#define RE_ALI_SELF_JOIN   350

The player joined a group

#define RE_ALI_SELF_KICK   352

The player has been kicked from the ali

#define RE_ALI_SELF_LEAVE   351

The player left the group

#define RE_CHAT_GENERAL   401

General chat

#define RE_CHAT_SELF   400

Chat from the player itself

#define RE_CHAT_SHOUT   403

Somebody shouteed something

#define RE_CHAT_WHISPER   402

A whisper was received

#define RE_DAMAGE_CRITICAL   201

Damage was inflicted and was critical

#define RE_DAMAGE_INFLICT   200

Damage was inflicted

#define RE_GROUP_DISBAND   308

The group was disbanded

#define RE_GROUP_PLAYER_DISCONNECT   305

Some player was disconnected

#define RE_GROUP_PLAYER_JOIN   303

Some other player joined the group

#define RE_GROUP_PLAYER_KICK   306

A player was kicked from the group

#define RE_GROUP_PLAYER_LEAVE   304

Some other player left the group

#define RE_GROUP_PLAYER_OFFLINE   307

A player in the group went offline

#define RE_GROUP_SELF_JOIN   300

The player joined a group

#define RE_GROUP_SELF_KICK   302

The player has been kicked

#define RE_GROUP_SELF_LEAVE   301

The player left the group

#define RE_ITEM   "\\[item:([[:digit:]]+).*\\]"

Item number regex pattern

#define RE_ITEM_LOOT_PLAYER   101

Event, item looted by a character

#define RE_ITEM_LOOT_SELF   100

Event, item looted by player

#define RE_NAME   "([[:alnum:]]+)"

Character name regex pattern

#define RE_NUM_ROLL   "[0-9\\.]+"

Item link regex pattern

#define RE_ROLL_DICE_PLAYER   505

Group member used /roll to roll a dice

#define RE_ROLL_DICE_SELF   504

The player used /roll to roll a dice

#define RE_ROLL_ITEM_HIGHEST   503

Somebody rolled the highest

#define RE_ROLL_ITEM_PASS   502

The player passed on an item

#define RE_ROLL_ITEM_PLAYER   501

Some other player rolled on an item

#define RE_ROLL_ITEM_SELF   500

The player rolled on an item

Function Documentation

bool chatlog_init ( void  )

Initialize the chat log facility

This must be called before any other chatlog function

Return values
trueOn success
falseOn error
bool chatlog_open ( void  )
static

Open the chatlog file

Uses aion_default_install_path() to find the path to the chatlog file.

Return values
trueIf successfull
falseOn error
void chatlog_parse ( uint32_t  re_id,
const char *  matchstr,
regmatch_t *  rematch,
size_t  rematch_num 
)

This is the gigantic switch case that maps the matched ID to an event function. What parameters are passed to the handler is determined in here.

Parameters
[in]re_idMatched regex ID
[in]matchstrMatched string
[in]rematchregmatch_t regex, used to extract arguments
[in]rematch_numNumber of regmatch_t structures in rematch
bool chatlog_poll ( void  )

Checks if there are any new lines in the chatlog. If there are it reads the chatlog and processes the line; otherwise it immediatelly returns

Return values
trueOn success (note, this is returned even if there are no new lines)
falseIf fatal error
bool chatlog_readfile ( char *  file)

This reads the file file as if it was a chatlog

This is mainly used for debugging.

Parameters
[in]fileFile to read chastlog from
Return values
trueOn success
falseIf there was an error processing the file or could not be found
bool chatlog_readstr ( char *  chatstr)

Processes a line from the chatlog

Calls the regeng re_parse() function, which is used to match a particular line to an event

Parameters
chatstrChat line to process
Return values
trueOn sucess
falseIf invalid chatlog line
void parse_action_chat_general ( char *  name,
char *  txt 
)

Process a "general chat" event. This function is called whenever other players say something on on /say, /group, /legion ...

Note
/1,/2,/3 chat is not part of this

Triggered by:

  • RE_CHAT_GENERAL
Parameters
[in]nameThe player that said something on chat
[in]txtThe chat line
void parse_action_chat_shout ( char *  name,
char *  txt 
)

Process a "shout chat" event. This function is called whenever the player receives a shout from another player. The player obviously must be in range of the shout.

Triggered by

  • RE_CHAT_SHOUT
Parameters
[in]nameThe player that shouted
[in]txtThe shout chat line
void parse_action_chat_whisper ( char *  name,
char *  txt 
)

Process a "whisper chat" event. This function is called whenever the player receives a whisper.

Triggered by:

  • RE_CHAT_WHISPER
Parameters
[in]nameThe whispering player
[in]txtThe whisper chat line
void parse_action_damage_inflict ( char *  player,
char *  target,
char *  damage,
char *  skill 
)

Process a "damage inflict" event. This function is called whenever something in chat range inflicts damage

Triggered by:

  • RE_DAMAGE_INFLICT
  • RE_DAMAGE_CRITICAL
Parameters
[in]playerCharacter name
[in]targetAfflicted target name
[in]damageDamage number (may contain ,.)
[in]skillSkill that was used to inflict damage, or NULL if none
void parse_action_group_player_join ( char *  who)

Process "player join group" event. This is triggered when another player joins a group/alliance.

Triggered by:

  • RE_GROUP_PLAYER_JOIN:
Parameters
[in]whoCharacter name that joined
void parse_action_group_player_leave ( char *  who)

Process a "player leave group" event. This is tirggered when another player leaves a group/alliance.

This even is triggered by lots of events, like disconnects, group leavse, offline disconnects...

Triggered by:

  • RE_GROUP_PLAYER_DISCONNECT
  • RE_GROUP_PLAYER_LEAVE
  • RE_GROUP_PLAYER_KICK
  • RE_GROUP_PLAYER_OFFLINE
Parameters
[in]whoCharacter name that left the group
void parse_action_group_self_join ( void  )

Process a "self join group" event. This function is called when the player joins a group.

Triggered by:

  • RE_GROUP_SELF_JOIN
void parse_action_group_self_leave ( void  )

Process a "self leave group" event. This function is called when the player leaves a group or the group is disbanded.

Triggered by:

 - RE_GROUP_SELF_LEAVE
 - RE_GROUP_DISBAND
void parse_action_loot_item ( char *  player,
uint32_t  itemid 
)

Processes an "item loot" event. This function is called whenever a player or a group/alliance member loots an item

Triggered by:

  • RE_ITEM_LOOT_SELF
  • RE_ITEM_LOOT_PLAYER
Parameters
[in]playerCharacter name
[in]itemidItem id number
void parse_action_roll_item_highest ( char *  who)

Process the "player rolled the highest on an item" event. This function is called whenever a player wins an item by rolling the highest dice.

This event is used to detect an "inventory full" condition. If the player wins an item, but doesn't loot it, it means his inventory is full.

Triggered by:

  • RE_ROLL_ITEM_HIGHEST
Parameters
[in]whoPlayer who won the item
void parse_action_roll_item_pass ( char *  who)

Process a "player passed on item" event. This function is called whenever a player passed on an item.

This is also used to autodetect group members. Refer to parse_action_roll_item_player() for more info.

Triggered by:

  • RE_ROLL_ITEM_PASS
Parameters
[in]whoPlayer that passed on an item
void parse_action_roll_item_player ( char *  who)

Process a "player rolled on item" event. This function is called whenever a player rolls on an item.

This is also used to auto-detect group members. the problem is that there's no information in the chat log of group members when you join an EXISTING group. For the time being, the best way to detect the other players is to watch for this event.

Triggered by:

  • RE_ROLL_ITEM_PLAYER
Parameters
[in]whoPlayer that rolled on an item
void parse_action_roll_item_self ( void  )

Process a "self rolled on item" event. This function is called whenever a player rolls for an item.

Triggered by:

  • RE_ROLL_ITEM_SELF
Note
This is currently unused.

Variable Documentation

FILE* chatlog_file = NULL
static

Chatlog FILE descriptor

re_callback_t chatlog_parse
static

Declaration of chatlog_parse()

struct regeng re_aion[]
Initial value:
=
{
{
.re_exp = "^: You have acquired " RE_ITEM,
},
{
.re_exp = "^: Vous avez gagné " RE_ITEM,
},
{
.re_exp = "^: Ihr habt " RE_ITEM " erhalten\\.",
},
{
.re_exp = "^: " RE_NAME " has acquired " RE_ITEM,
},
{
.re_exp = "^: " RE_NAME " a gagné " RE_ITEM,
},
{
.re_exp = "^: " RE_NAME " hat " RE_ITEM " erhalten\\."
},
{
.re_exp = "^: You have joined the group\\.",
},
{
.re_exp = "^: Vous avez rejoint le groupe\\.",
},
{
.re_exp = "^: Ihr seid der Gruppe beigetreten\\.",
},
{
.re_exp = "^: You left the group\\.",
},
{
.re_exp = "^: Vous avez quitté le groupe\\.",
},
{
.re_exp = "^: Ihr habt die Gruppe verlassen\\.",
},
{
.re_exp = "^: You have been kicked out of the group\\.",
},
{
.re_exp = "^: Vous avez été exclue du groupe\\.",
},
{
.re_exp = "^: Ihr wurdet aus der Gruppe geworfen\\.",
},
{
.re_exp = "^: " RE_NAME " has joined your group\\.",
},
{
.re_exp = "^: " RE_NAME " a rejoint votre groupe\\.",
},
{
.re_exp = "^: " RE_NAME " ist Eurer Gruppe beigetreten.",
},
{
.re_exp = "^: " RE_NAME " has left your group\\.",
},
{
.re_exp = "^: " RE_NAME " a quitté votre groupe\\.",
},
{
.re_exp = "^: " RE_NAME " hat Eure Gruppe verlassen\\."
},
{
.re_exp = "^: " RE_NAME " has been disconnected\\.",
},
{
.re_exp = "^: " RE_NAME " a quitté Atréia.\\.",
},
{
.re_exp = "^: " RE_NAME " has been kicked out of your group\\.",
},
{
.re_exp = "^: " RE_NAME " a été exclue de votre groupe\\.",
},
{
.re_exp = "^: " RE_NAME " wurde aus Eurer Gruppe geworfen\\.",
},
{
.re_exp = "^: " RE_NAME " has been offline for too long and is automatically excluded from the group\\.",
},
{
.re_exp = "^: " RE_NAME " est déconnecté depuis trop longtemps et a été automatiquement exclu du groupe\\.",
},
{
.re_id = RE_GROUP_DISBAND,
.re_exp = "^: The group has been disbanded\\.",
},
{
.re_id = RE_GROUP_DISBAND,
.re_exp = "^: Le groupe a été dissous.\\.",
},
{
.re_id = RE_GROUP_DISBAND,
.re_exp = "^: Die Gruppe wurde aufgelöst\\.",
},
{
.re_id = RE_ALI_SELF_JOIN,
.re_exp = "^: You have joined the alliance\\.",
},
{
.re_id = RE_ALI_SELF_JOIN,
.re_exp = "^: Vous avez rejoint la cohorte\\.",
},
{
.re_id = RE_ALI_SELF_JOIN,
.re_exp = "^: Ihr seid der Allianz beigetreten\\.",
},
{
.re_exp = "^: You have left the alliance\\.",
},
{
.re_exp = "^: Vous avez quitté la cohorte\\.",
},
{
.re_exp = "^: Ihr habt die Allianz verlassen\\.",
},
{
.re_id = RE_ALI_SELF_KICK,
.re_exp = "^: You have been kicked out of the alliance\\.",
},
{
.re_id = RE_ALI_SELF_KICK,
.re_exp = "^: Vous avez été expulsée de la cohorte\\.",
},
{
.re_id = RE_ALI_SELF_KICK,
.re_exp = "^: Ihr wurdet aus der Allianz geworfen\\.",
},
{
.re_exp = "^: " RE_NAME " has joined the alliance\\.",
},
{
.re_exp = "^: " RE_NAME " a rejoint la cohorte\\.",
},
{
.re_exp = "^: " RE_NAME " ist der Allianz beigetreten\\.",
},
{
.re_exp = "^: " RE_NAME " has left the alliance\\.",
},
{
.re_exp = "^: " RE_NAME " a quitté la cohorte\\.",
},
{
.re_exp = "^: " RE_NAME " hat die Allianz verlassen\\.",
},
{
.re_exp = "^: " RE_NAME " has been kicked out of the alliance\\.",
},
{
.re_exp = "^: " RE_NAME " a été expulsé de la cohorte\\.",
},
{
.re_exp = "^: " RE_NAME " wurde aus der Allianz geworfen\\.",
},
{
.re_exp = "^: " RE_NAME " has been offline for too long and had been automatically kicked out of the alliance\\."
},
{
.re_exp = "^: " RE_NAME " a passé trop de temps hors connexion. Expulsion automatique de la Cohorte\\."
},
{
.re_id = RE_ALI_DISBAND,
.re_exp = "^: The alliance has been disbanded\\.",
},
{
.re_id = RE_ALI_DISBAND,
.re_exp = "^: La cohorte a été dissoute\\.",
},
{
.re_id = RE_ALI_DISBAND,
.re_exp = "^: Die Allianz wurde aufgelöst\\.",
},
{
.re_id = RE_CHAT_GENERAL,
.re_exp = "^: \\[charname:" RE_NAME ";.*\\]: (.*)$",
},
{
.re_id = RE_CHAT_WHISPER,
.re_exp = "^: \\[charname:" RE_NAME ";.*\\] Whispers: (.*)$",
},
{
.re_id = RE_CHAT_WHISPER,
.re_exp = "^: \\[charname:" RE_NAME ";.*\\] murmure : (.*)$",
},
{
.re_id = RE_CHAT_WHISPER,
.re_exp = "^: \\[charname:" RE_NAME ";.*\\] flüstert: (.*)$",
},
{
.re_id = RE_CHAT_SHOUT,
.re_exp = "^: \\[charname:" RE_NAME ";.*\\] Shouts: (.*)$",
},
{
.re_id = RE_CHAT_SHOUT,
.re_exp = "^: \\[charname:" RE_NAME ";.*\\] crie : (.*)$",
},
{
.re_id = RE_CHAT_SHOUT,
.re_exp = "^: \\[charname:" RE_NAME ";.*\\] ruft: (.*)$",
},
{
.re_exp = "^: You rolled the dice and got " RE_NUM_ROLL " \\(max\\. " RE_NUM_ROLL "\\)\\.",
},
{
.re_exp = "^: Vous avez lancé les dés et obtenu " RE_NUM_ROLL " \\(max\\. " RE_NUM_ROLL "\\)\\.",
},
{
.re_exp = "^: Ihr habt eine " RE_NUM_ROLL " gewürfelt \\(max\\. " RE_NUM_ROLL "\\)\\.",
},
{
.re_exp = "^: " RE_NAME " rolled the dice and got " RE_NUM_ROLL " \\(max\\. " RE_NUM_ROLL "\\)\\.",
},
{
.re_exp = "^: " RE_NAME " a lancé les dés et a obtenu " RE_NUM_ROLL " \\(max\\. " RE_NUM_ROLL "\\)\\.",
},
{
.re_exp = "^: " RE_NAME " hat eine " RE_NUM_ROLL " gewürfelt \\(max\\. " RE_NUM_ROLL "\\)\\.",
},
{
.re_exp = "^: " RE_NAME " gave up rolling the dice",
},
{
.re_exp = "^: " RE_NAME " a renoncé à lancer les dés",
},
{
.re_exp = "^: " RE_NAME " hat aufgehört zu würfeln\\.",
},
{
.re_exp = "^: " RE_NAME " rolled the highest",
},
{
.re_exp = "^: " RE_NAME " a obtenu le meilleur score",
},
{
.re_exp = "^: " RE_NAME " hat den höchsten Wert gewürfelt",
},
{
.re_exp = "^: You rolled the dice and got a " RE_NUM_ROLL " \\(max\\. " RE_NUM_ROLL "\\)\\.",
},
{
.re_exp = "^: " RE_NAME " rolled the dice and got a " RE_NUM_ROLL " \\(max\\. " RE_NUM_ROLL "\\)\\.",
},
}

Define chatlog regex patterns and corresponding event.

This list is scanned from beginning to end. If a regular expressions matches, an event is generated.

For speed reasons, try to put most commonly matched regular expressions at the beginning

See Also
regeng