summaryrefslogtreecommitdiff
path: root/src/map/atcommand.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/map/atcommand.h')
-rw-r--r--src/map/atcommand.h98
1 files changed, 68 insertions, 30 deletions
diff --git a/src/map/atcommand.h b/src/map/atcommand.h
index 8affa4c26..cea59a416 100644
--- a/src/map/atcommand.h
+++ b/src/map/atcommand.h
@@ -1,51 +1,89 @@
-// Copyright (c) Athena Dev Teams - Licensed under GNU GPL
-// For more information, see LICENCE in the main folder
+// Copyright (c) Hercules Dev Team, licensed under GNU GPL.
+// See the LICENSE file
+// Portions Copyright (c) Athena Dev Teams
#ifndef _ATCOMMAND_H_
#define _ATCOMMAND_H_
+/**
+ * Declarations
+ **/
struct map_session_data;
+struct AtCommandInfo;
-//This is the distance at which @autoloot works,
-//if the item drops farther from the player than this,
-//it will not be autolooted. [Skotlex]
-//Note: The range is unlimited unless this define is set.
-//#define AUTOLOOT_DISTANCE AREA_SIZE
-
-extern char atcommand_symbol;
-extern char charcommand_symbol;
+/**
+ * Defines
+ **/
+#define ATCOMMAND_LENGTH 50
+#define MAX_MSG 1500
+/**
+ * Enumerations
+ **/
typedef enum {
COMMAND_ATCOMMAND = 1,
COMMAND_CHARCOMMAND = 2,
} AtCommandType;
-typedef int (*AtCommandFunc)(const int fd, struct map_session_data* sd, const char* command, const char* message);
-
-bool is_atcommand(const int fd, struct map_session_data* sd, const char* message, int type);
-
-void do_init_atcommand(void);
-void do_final_atcommand(void);
-void atcommand_db_load_groups(int* group_ids);
+/**
+ * Typedef
+ **/
+typedef bool (*AtCommandFunc)(const int fd, struct map_session_data* sd, const char* command, const char* message,struct AtCommandInfo *info);
+typedef struct AtCommandInfo AtCommandInfo;
+typedef struct AliasInfo AliasInfo;
-bool atcommand_exists(const char* name);
-
-const char* msg_txt(int msg_number);
-int msg_config_read(const char* cfgName);
-void do_final_msg(void);
+/**
+ * Structures
+ **/
+struct AliasInfo {
+ AtCommandInfo *command;
+ char alias[ATCOMMAND_LENGTH];
+};
-extern int atcmd_binding_count;
+struct AtCommandInfo {
+ char command[ATCOMMAND_LENGTH];
+ AtCommandFunc func;
+ char *at_groups;/* quick @commands "can-use" lookup */
+ char *char_groups;/* quick @charcommands "can-use" lookup */
+ char *help;/* quick access to this @command's help string */
+ bool log;/* whether to log this command or not, regardless of group settings */
+};
-// @commands (script based)
struct atcmd_binding_data {
- char command[50];
- char npc_event[50];
- int level;
- int level2;
+ char command[ATCOMMAND_LENGTH];
+ char npc_event[ATCOMMAND_LENGTH];
+ int group_lv;
+ int group_lv_char;
+ bool log;
};
-struct atcmd_binding_data** atcmd_binding;
+/**
+ * Interface
+ **/
+struct atcommand_interface {
+ unsigned char at_symbol;
+ unsigned char char_symbol;
+ /* atcommand binding */
+ struct atcmd_binding_data** binding;
+ int binding_count;
+ /* */
+ void (*init) (void);
+ void (*final) (void);
+ /* */
+ bool (*parse) (const int fd, struct map_session_data* sd, const char* message, int type);
+ bool (*can_use) (struct map_session_data *sd, const char *command);
+ bool (*can_use2) (struct map_session_data *sd, const char *command, AtCommandType type);
+ void (*load_groups) (int* group_ids);
+ AtCommandInfo* (*exists) (const char* name);
+ int (*msg_read) (const char* cfgName);
+ void (*final_msg) (void);
+ /* atcommand binding */
+ struct atcmd_binding_data* (*get_bind_byname) (const char* name);
+} atcommand_s;
-struct atcmd_binding_data* get_atcommandbind_byname(const char* name);
+struct atcommand_interface *atcommand;
+
+const char* msg_txt(int msg_number);
+void atcommand_defaults(void);
#endif /* _ATCOMMAND_H_ */