This module parses the chatlog. More...
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:
| |
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) |
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.
#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
bool chatlog_init | ( | void | ) |
Initialize the chat log facility
This must be called before any other chatlog function
true | On success |
false | On error |
|
static |
Open the chatlog file
Uses aion_default_install_path() to find the path to the chatlog file.
true | If successfull |
false | On 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.
[in] | re_id | Matched regex ID |
[in] | matchstr | Matched string |
[in] | rematch | regmatch_t regex, used to extract arguments |
[in] | rematch_num | Number 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
true | On success (note, this is returned even if there are no new lines) |
false | If fatal error |
bool chatlog_readfile | ( | char * | file) |
This reads the file file as if it was a chatlog
This is mainly used for debugging.
[in] | file | File to read chastlog from |
true | On success |
false | If 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
chatstr | Chat line to process |
true | On sucess |
false | If 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 ...
Triggered by:
[in] | name | The player that said something on chat |
[in] | txt | The 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
[in] | name | The player that shouted |
[in] | txt | The 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:
[in] | name | The whispering player |
[in] | txt | The 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:
[in] | player | Character name |
[in] | target | Afflicted target name |
[in] | damage | Damage number (may contain ,.) |
[in] | skill | Skill 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:
[in] | who | Character 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:
[in] | who | Character 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:
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:
[in] | player | Character name |
[in] | itemid | Item 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:
[in] | who | Player 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:
[in] | who | Player 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:
[in] | who | Player 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:
|
static |
Chatlog FILE descriptor
|
static |
Declaration of chatlog_parse()
struct regeng re_aion[] |
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