This module processes APme commands and the chat history. More...
Classes | |
struct | cmd_entry |
Macros | |
#define | CMD_COMMAND_CHAR '?' |
#define | CMD_CHATHIST_CHAR '^' |
#define | CMD_SIZE 64 |
#define | CMD_ARGC_MAX 32 |
#define | CMD_DELIM " ," |
#define | CMD_TEXT_SZ AION_CHAT_SZ |
#define | CMD_RETVAL_OK "OK" |
#define | CMD_RETVAL_ERROR "Error" |
#define | CMD_RETVAL_UNKNOWN "Unknown command" |
Typedefs | |
typedef bool | cmd_func_t (int argc, char *argv[], char *txt) |
Functions | |
static bool | cmd_func_translate (char *txt, int langid) |
static bool | cmd_func_rtranslate (char *txt, int langid) |
static char * | cmd_sanitize (char *str) |
void | cmd_retval_printf (char *fmt,...) |
void | cmd_retval_set (const char *txt) |
bool | cmd_func_help (int argc, char *argv[], char *txt) |
bool | cmd_func_hello (int argc, char *argv[], char *txt) |
bool | cmd_func_nameset (int argc, char *argv[], char *txt) |
bool | cmd_func_ap_stats (int argc, char *argv[], char *txt) |
bool | cmd_func_ap_loot (int argc, char *argv[], char *txt) |
bool | cmd_func_ap_set (int argc, char *argv[], char *txt) |
bool | cmd_func_ap_reset (int argc, char *argv[], char *txt) |
bool | cmd_func_ap_limit (int argc, char *argv[], char *txt) |
bool | cmd_func_ap_format (int argc, char *argv[], char *txt) |
bool | cmd_func_group_add (int argc, char *argv[], char *txt) |
bool | cmd_func_group_del (int argc, char *argv[], char *txt) |
bool | cmd_func_group_leave (int argc, char *argv[], char *txt) |
bool | cmd_func_elyos (int argc, char *argv[], char *txt) |
bool | cmd_func_asmo (int argc, char *argv[], char *txt) |
bool | cmd_func_relyos (int argc, char *argv[], char *txt) |
bool | cmd_func_rasmo (int argc, char *argv[], char *txt) |
bool | cmd_func_echo (int argc, char *argv[], char *txt) |
bool | cmd_func_apcalc (int argc, char *argv[], char *txt) |
bool | cmd_func_inv (int argc, char *argv[], char *txt) |
bool | cmd_func_dbgdump (int argc, char *argv[], char *txt) |
bool | cmd_func_dbgparse (int argc, char *argv[], char *txt) |
bool | cmd_chat_hist (int argc, char *argv[], char *player, size_t player_sz, int *msgnum) |
void | cmd_exec (char *txt) |
void | cmd_poll (void) |
Variables | |
static char | cmd_retval [CMD_TEXT_SZ] |
static cmd_func_t | cmd_func_help |
static cmd_func_t | cmd_func_hello |
static cmd_func_t | cmd_func_nameset |
static cmd_func_t | cmd_func_ap_stats |
static cmd_func_t | cmd_func_ap_loot |
static cmd_func_t | cmd_func_ap_set |
static cmd_func_t | cmd_func_ap_reset |
static cmd_func_t | cmd_func_ap_limit |
static cmd_func_t | cmd_func_ap_format |
static cmd_func_t | cmd_func_group_add |
static cmd_func_t | cmd_func_group_del |
static cmd_func_t | cmd_func_group_leave |
static cmd_func_t | cmd_func_elyos |
static cmd_func_t | cmd_func_asmo |
static cmd_func_t | cmd_func_relyos |
static cmd_func_t | cmd_func_rasmo |
static cmd_func_t | cmd_func_echo |
static cmd_func_t | cmd_func_apcalc |
static cmd_func_t | cmd_func_inv |
static cmd_func_t | cmd_func_dbgdump |
static cmd_func_t | cmd_func_dbgparse |
struct cmd_entry | cmd_list [] |
This module processes APme commands and the chat history.
This module periodically polls the clipboard in cmd_poll(). If it detects a command text (oen starting with '?', or CMD_COMMAND_CHAR) it assumes it's an APme command text and it processes it.
#define CMD_ARGC_MAX 32 |
Maximum number of arguments for a command
#define CMD_CHATHIST_CHAR '^' |
History command prefix
#define CMD_COMMAND_CHAR '?' |
Chat command prefix
#define CMD_DELIM " ," |
delimiters between arguments
#define CMD_RETVAL_ERROR "Error" |
Default response on error
#define CMD_RETVAL_OK "OK" |
Default response on success
#define CMD_RETVAL_UNKNOWN "Unknown command" |
Default response if command not found
#define CMD_SIZE 64 |
Maximum command size
#define CMD_TEXT_SZ AION_CHAT_SZ |
Total command text size
typedef bool cmd_func_t(int argc, char *argv[], char *txt) |
This is the general command processing function format
bool cmd_chat_hist | ( | int | argc, |
char * | argv[], | ||
char * | player, | ||
size_t | player_sz, | ||
int * | msgnum | ||
) |
This functions scans the command arguments (argc,argv) and returns true if it contains a chatlog history command in the format of [N]^+NAME
In case a chat history command is matched, it returns the name of the player to retrieve the chat history and the message number, where 0 is the most recent message
[in] | argc | Number of elements in argv |
[in] | argv | Argument array |
[out] | player | Requested chat history player name |
[in] | player_sz | Size of the buffer pointed to by player |
[out] | msgnum | The index of the chat history line requested (0 being most recent) |
true | If argc/argv contain a valid chathistory command |
false | Otherwise |
void cmd_exec | ( | char * | txt) |
Parses the text in txt
and if it starts with a '?' (CMD_COMMAND_CHAR) string it processes it as an APme command
All the command processing starts here.
[in] | txt | Text to process (usually from the clipboard) |
bool cmd_func_ap_format | ( | int | argc, |
char * | argv[], | ||
char * | txt | ||
) |
This function implements the ?apformat command, it sets the aploot format
[in] | argc | Number of arguments |
[in] | argv | Command arguments
|
[in] | txt | Full chat line text with the command stripped |
true | On success |
false | If argument format error |
bool cmd_func_ap_limit | ( | int | argc, |
char * | argv[], | ||
char * | txt | ||
) |
This function implements the ?aplimit command, sets the upper bound limit for the AP loot
[in] | argc | Number of arguments |
[in] | argv | Command arguments
|
[in] | txt | Full chat line text with the command stripped |
true | On success |
false | If argument format error |
bool cmd_func_ap_loot | ( | int | argc, |
char * | argv[], | ||
char * | txt | ||
) |
This function implements the ?aploot command, which returns the current loot statistics
[in] | argc | Number of arguments |
[in] | argv | Command arguments
|
[in] | txt | Full chat line text with the command stripped |
true | Always returns true |
bool cmd_func_ap_reset | ( | int | argc, |
char * | argv[], | ||
char * | txt | ||
) |
This function implements the ?apreset command, which resets the AP statistics for all known players to 0
[in] | argc | Number of arguments |
[in] | argv | Command arguments
|
[in] | txt | Full chat line text with the command stripped |
true | Always returns true |
bool cmd_func_ap_set | ( | int | argc, |
char * | argv[], | ||
char * | txt | ||
) |
This function implements the ?apset command, sets the AP accumulated by a player to a certain value
[in] | argc | Number of arguments in argv |
[in] | argv | Command arguments:
|
[in] | txt | Full chat line text with the command stripped |
true | On success |
false | If argument format error |
bool cmd_func_ap_stats | ( | int | argc, |
char * | argv[], | ||
char * | txt | ||
) |
This function implements the ?apstat command, which returns the current AP statistics of the group
[in] | argc | Number of arguments |
[in] | argv | Command arguments
|
[in] | txt | Full chat line text with the command stripped |
true | Always returns true |
bool cmd_func_apcalc | ( | int | argc, |
char * | argv[], | ||
char * | txt | ||
) |
This function implements the ?apcalc function
This is used for calculating the values of relics. For example, it can calculate how much AP is 5x<Major Ancient Crown>, or <Major Ancient Crown>x5
[in] | argc | Number of arguments |
[in] | argv | Command arguments
|
[in] | txt | Full chat line text with the command stripped |
true | true on success |
false | On error |
bool cmd_func_asmo | ( | int | argc, |
char * | argv[], | ||
char * | txt | ||
) |
This function implements the ?asmo translator command This is used by Elyos to talk to Asmodians
[in] | argc | Number of arguments |
[in] | argv | Command arguments
|
[in] | txt | Full chat line text with the command stripped |
bool cmd_func_dbgdump | ( | int | argc, |
char * | argv[], | ||
char * | txt | ||
) |
Implements the ?dbgdump function, which dumps the console to stdout
This is a bit awkward to use so maybe somebody can improve this.
[in] | argc | Number of arguments |
[in] | argv | Command arguments
|
[in] | txt | Full chat line text with the command stripped |
true | Always returns true |
bool cmd_func_dbgparse | ( | int | argc, |
char * | argv[], | ||
char * | txt | ||
) |
Implements the ?dbgparse debugging command
It parses a piece of chatlog file from a file, which is useful for debugging
[in] | argc | Number of arguments |
[in] | argv | Command arguments
|
[in] | txt | Full chat line text with the command stripped |
true | True on error |
false | If parsing of the file fails |
bool cmd_func_echo | ( | int | argc, |
char * | argv[], | ||
char * | txt | ||
) |
This function implements the ?echo command
This function just echoes back whatever text it received as argument
[in] | argc | Number of arguments |
[in] | argv | Command arguments
|
[in] | txt | Full chat line text with the command stripped |
true | Always returns true |
bool cmd_func_elyos | ( | int | argc, |
char * | argv[], | ||
char * | txt | ||
) |
This function implements the ?elyos translator command This is used by Elyos to talk to Asmodians
[in] | argc | Number of arguments |
[in] | argv | Command arguments
|
[in] | txt | Full chat line text with the command stripped |
bool cmd_func_group_add | ( | int | argc, |
char * | argv[], | ||
char * | txt | ||
) |
This function implements the ?gradd command, which manually adds a character to the current group if it is not autodetected automatically
[in] | argc | Number of arguments |
[in] | argv | Command arguments
|
[in] | txt | Full chat line text with the command stripped |
true | Always returns true |
bool cmd_func_group_del | ( | int | argc, |
char * | argv[], | ||
char * | txt | ||
) |
This function implements the ?grdeel command, which manually removes a character from the current group if it is not autodetected automatically
[in] | argc | Number of arguments |
[in] | argv | Command arguments
|
[in] | txt | Full chat line text with the command stripped |
true | Always returns true |
bool cmd_func_group_leave | ( | int | argc, |
char * | argv[], | ||
char * | txt | ||
) |
This function implements the ?leave command. The player should use this to leave the a group if it's not autodetected.
[in] | argc | Number of arguments |
[in] | argv | Command arguments
|
[in] | txt | Full chat line text with the command stripped |
true | Always returns true |
bool cmd_func_hello | ( | int | argc, |
char * | argv[], | ||
char * | txt | ||
) |
This function implements the ?hello command, just displays the version number
[in] | argc | Number of arguments in argv |
[in] | argv | Command arguments:
|
[in] | txt | Full chat line text with the command stripped |
true | Always returns true |
bool cmd_func_help | ( | int | argc, |
char * | argv[], | ||
char * | txt | ||
) |
This function implements the ?help command
[in] | argc | Number of arguments in argv |
[in] | argv | Command arguments:
|
[in] | txt | Full chat line text with the command stripped |
true | Always returns true |
bool cmd_func_inv | ( | int | argc, |
char * | argv[], | ||
char * | txt | ||
) |
This function implements the ?inv command for setting the "inventory full" policy handling
It supports arguments:
[in] | argc | Number of arguments |
[in] | argv | Command arguments
|
[in] | txt | Full chat line text with the command stripped |
true | Always returns true |
bool cmd_func_nameset | ( | int | argc, |
char * | argv[], | ||
char * | txt | ||
) |
This function implements the ?name command, which sets the player's name
[in] | argc | Number of arguments in argv |
[in] | argv | Command arguments
|
[in] | txt | Full chat line text with the command stripped |
true | Always returns true |
bool cmd_func_rasmo | ( | int | argc, |
char * | argv[], | ||
char * | txt | ||
) |
This function implements the ?rasmo translator command
This function reverses the text translated by ?asmo back to the original text (if you want to see what other Elyos are saying to Asmodians)
[in] | argc | Number of arguments |
[in] | argv | Command arguments
|
[in] | txt | Full chat line text with the command stripped |
bool cmd_func_relyos | ( | int | argc, |
char * | argv[], | ||
char * | txt | ||
) |
This function implements the ?relyos translator command
This function reverses the text translated by ?elyos back to the original text (if you want to see what other Asmodians are saying to Elyos)
[in] | argc | Number of arguments |
[in] | argv | Command arguments
|
[in] | txt | Full chat line text with the command stripped |
|
static |
Generic reverse translate function, used by cmd_func_relyos() and cmd_func_rasmo
This function is the exact opposite of cmd_func_translate()
[in,out] | txt | Full chat line text with the command stripped |
[in] | langid | Language ID |
true | Always true at the moment |
|
static |
Generic translate functions, used by cmd_func_elyos() and cmd_func_asmo
[in,out] | txt | Full chat line text with the command stripped |
[in] | langid | Language ID |
true | Always true at the moment |
void cmd_poll | ( | void | ) |
Poll the clipboard, if we get some text, pass it to cmd_exec().
void cmd_retval_printf | ( | char * | fmt, |
... | |||
) |
printf-like function for storing a command status strings to the return buffer
[in] | fmt | printf-like format |
[in] | ... | arguments |
void cmd_retval_set | ( | const char * | txt) |
Set the return string for a command
param[in] txt Return string
|
static |
Sanitize the string str:
|
static |
Declaration of cmd_ap_format()
|
static |
Declaration of cmd_ap_limit()
|
static |
Declaration of cmd_func_aploot()
|
static |
Declaration of cmd_ap_reset()
|
static |
Declaration of cmd_ap_set()
|
static |
Declaration of cmd_func_apstat()
|
static |
Declaration of cmd_func_apcalc()
|
static |
Declaration of cmd_func_asmo()
|
static |
Declaration of cmd_func_dbgdump()
|
static |
Declaration of cmd_func_dbgparse()
|
static |
Declaration of cmd_func_echo()
|
static |
Declaration of cmd_func_elyos()
|
static |
Declaration of cmd_func_group_add()
|
static |
Declaration of cmd_func_group_del()
|
static |
Declaration of cmd_func_group_leave()
|
static |
Declaration of cmd_func_hello()
|
static |
Declaration of cmd_func_helpi()
|
static |
Declaration of cmd_func_inv()
|
static |
Declaration of cmd_func_nameset()
|
static |
Declaration of cmd_func_rasmo()
|
static |
Declaration of cmd_func_relyos()
struct cmd_entry cmd_list[] |
Global list of chat commands
|
static |
Whatever a command returns back to the user is written into this static buffer