summaryrefslogtreecommitdiff
path: root/src/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/HPMHooking/HPMHooking.Defs.inc32
-rw-r--r--src/plugins/HPMHooking/HPMHooking_char.HPMHooksCore.inc16
-rw-r--r--src/plugins/HPMHooking/HPMHooking_char.HookingPoints.inc4
-rw-r--r--src/plugins/HPMHooking/HPMHooking_char.Hooks.inc106
-rw-r--r--src/plugins/HPMHooking/HPMHooking_login.HPMHooksCore.inc8
-rw-r--r--src/plugins/HPMHooking/HPMHooking_login.HookingPoints.inc2
-rw-r--r--src/plugins/HPMHooking/HPMHooking_login.Hooks.inc52
-rw-r--r--src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc40
-rw-r--r--src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc10
-rw-r--r--src/plugins/HPMHooking/HPMHooking_map.Hooks.inc273
-rw-r--r--src/plugins/generate-translations.c242
11 files changed, 680 insertions, 105 deletions
diff --git a/src/plugins/HPMHooking/HPMHooking.Defs.inc b/src/plugins/HPMHooking/HPMHooking.Defs.inc
index 61de7bbc6..389d273e3 100644
--- a/src/plugins/HPMHooking/HPMHooking.Defs.inc
+++ b/src/plugins/HPMHooking/HPMHooking.Defs.inc
@@ -1330,8 +1330,10 @@ typedef void (*HPMHOOK_pre_clif_autospell) (struct map_session_data **sd, uint16
typedef void (*HPMHOOK_post_clif_autospell) (struct map_session_data *sd, uint16 skill_lv);
typedef void (*HPMHOOK_pre_clif_combo_delay) (struct block_list **bl, int *wait);
typedef void (*HPMHOOK_post_clif_combo_delay) (struct block_list *bl, int wait);
-typedef void (*HPMHOOK_pre_clif_status_change) (struct block_list **bl, int *type, int *flag, int *tick, int *val1, int *val2, int *val3);
-typedef void (*HPMHOOK_post_clif_status_change) (struct block_list *bl, int type, int flag, int tick, int val1, int val2, int val3);
+typedef void (*HPMHOOK_pre_clif_status_change) (struct block_list **bl, int *type, int *flag, int *total_tick, int *val1, int *val2, int *val3);
+typedef void (*HPMHOOK_post_clif_status_change) (struct block_list *bl, int type, int flag, int total_tick, int val1, int val2, int val3);
+typedef void (*HPMHOOK_pre_clif_status_change_sub) (struct block_list **bl, int *type, int *flag, int *tick, int *total_tick, int *val1, int *val2, int *val3);
+typedef void (*HPMHOOK_post_clif_status_change_sub) (struct block_list *bl, int type, int flag, int tick, int total_tick, int val1, int val2, int val3);
typedef void (*HPMHOOK_pre_clif_insert_card) (struct map_session_data **sd, int *idx_equip, int *idx_card, int *flag);
typedef void (*HPMHOOK_post_clif_insert_card) (struct map_session_data *sd, int idx_equip, int idx_card, int flag);
typedef void (*HPMHOOK_pre_clif_inventoryList) (struct map_session_data **sd);
@@ -4178,6 +4180,10 @@ typedef enum parsefunc_rcode (*HPMHOOK_pre_PRIV__lclif_parse_CA_CHARSERVERCONNEC
typedef enum parsefunc_rcode (*HPMHOOK_post_PRIV__lclif_parse_CA_CHARSERVERCONNECT) (enum parsefunc_rcode retVal___, int fd, struct login_session_data *sd);
#endif // LOGIN_LCLIF_P_H
#ifdef COMMON_CONF_H /* libconfig */
+typedef void (*HPMHOOK_pre_libconfig_set_db_path) (const char **db_path);
+typedef void (*HPMHOOK_post_libconfig_set_db_path) (const char *db_path);
+typedef void (*HPMHOOK_pre_libconfig_format_db_path) (const char **filename, char **path_buf, int *buffer_len);
+typedef void (*HPMHOOK_post_libconfig_format_db_path) (const char *filename, char *path_buf, int buffer_len);
typedef int (*HPMHOOK_pre_libconfig_read) (struct config_t **config, FILE **stream);
typedef int (*HPMHOOK_post_libconfig_read) (int retVal___, struct config_t *config, FILE *stream);
typedef void (*HPMHOOK_pre_libconfig_write) (const struct config_t **config, FILE **stream);
@@ -5144,6 +5150,10 @@ typedef int (*HPMHOOK_pre_mapif_parse_ClanMemberCount) (int *fd, int *clan_id, i
typedef int (*HPMHOOK_post_mapif_parse_ClanMemberCount) (int retVal___, int fd, int clan_id, int kick_interval);
#endif // CHAR_MAPIF_H
#ifdef COMMON_MAPINDEX_H /* mapindex */
+typedef bool (*HPMHOOK_pre_mapindex_config_read_dbpath) (const char **filename, const struct config_t **config);
+typedef bool (*HPMHOOK_post_mapindex_config_read_dbpath) (bool retVal___, const char *filename, const struct config_t *config);
+typedef bool (*HPMHOOK_pre_mapindex_config_read) (void);
+typedef bool (*HPMHOOK_post_mapindex_config_read) (bool retVal___);
typedef int (*HPMHOOK_pre_mapindex_init) (void);
typedef int (*HPMHOOK_post_mapindex_init) (int retVal___);
typedef void (*HPMHOOK_pre_mapindex_final) (void);
@@ -5346,6 +5356,8 @@ typedef int (*HPMHOOK_pre_mob_ai_sub_hard_lootsearch) (struct block_list **bl, v
typedef int (*HPMHOOK_post_mob_ai_sub_hard_lootsearch) (int retVal___, struct block_list *bl, va_list ap);
typedef int (*HPMHOOK_pre_mob_warpchase_sub) (struct block_list **bl, va_list ap);
typedef int (*HPMHOOK_post_mob_warpchase_sub) (int retVal___, struct block_list *bl, va_list ap);
+typedef bool (*HPMHOOK_pre_mob_is_in_battle_state) (const struct mob_data **md);
+typedef bool (*HPMHOOK_post_mob_is_in_battle_state) (bool retVal___, const struct mob_data *md);
typedef int (*HPMHOOK_pre_mob_ai_sub_hard_slavemob) (struct mob_data **md, int64 *tick);
typedef int (*HPMHOOK_post_mob_ai_sub_hard_slavemob) (int retVal___, struct mob_data *md, int64 tick);
typedef int (*HPMHOOK_pre_mob_unlocktarget) (struct mob_data **md, int64 *tick);
@@ -7056,8 +7068,10 @@ typedef void (*HPMHOOK_pre_script_load_translations) (void);
typedef void (*HPMHOOK_post_script_load_translations) (void);
typedef bool (*HPMHOOK_pre_script_load_translation_addstring) (const char **file, uint8 *lang_id, const char **msgctxt, const struct script_string_buf **msgid, const struct script_string_buf **msgstr);
typedef bool (*HPMHOOK_post_script_load_translation_addstring) (bool retVal___, const char *file, uint8 lang_id, const char *msgctxt, const struct script_string_buf *msgid, const struct script_string_buf *msgstr);
-typedef int (*HPMHOOK_pre_script_load_translation) (const char **file, uint8 *lang_id);
-typedef int (*HPMHOOK_post_script_load_translation) (int retVal___, const char *file, uint8 lang_id);
+typedef int (*HPMHOOK_pre_script_load_translation_file) (const char **file, uint8 *lang_id);
+typedef int (*HPMHOOK_post_script_load_translation_file) (int retVal___, const char *file, uint8 lang_id);
+typedef int (*HPMHOOK_pre_script_load_translation) (const char **directory, uint8 *lang_id);
+typedef int (*HPMHOOK_post_script_load_translation) (int retVal___, const char *directory, uint8 lang_id);
typedef int (*HPMHOOK_pre_script_translation_db_destroyer) (union DBKey *key, struct DBData **data, va_list ap);
typedef int (*HPMHOOK_post_script_translation_db_destroyer) (int retVal___, union DBKey key, struct DBData *data, va_list ap);
typedef void (*HPMHOOK_pre_script_clear_translations) (bool *reload);
@@ -7066,8 +7080,8 @@ typedef int (*HPMHOOK_pre_script_parse_cleanup_timer) (int *tid, int64 *tick, in
typedef int (*HPMHOOK_post_script_parse_cleanup_timer) (int retVal___, int tid, int64 tick, int id, intptr_t data);
typedef uint8 (*HPMHOOK_pre_script_add_language) (const char **name);
typedef uint8 (*HPMHOOK_post_script_add_language) (uint8 retVal___, const char *name);
-typedef const char* (*HPMHOOK_pre_script_get_translation_file_name) (const char **file);
-typedef const char* (*HPMHOOK_post_script_get_translation_file_name) (const char* retVal___, const char *file);
+typedef const char* (*HPMHOOK_pre_script_get_translation_dir_name) (const char **directory);
+typedef const char* (*HPMHOOK_post_script_get_translation_dir_name) (const char* retVal___, const char *directory);
typedef void (*HPMHOOK_pre_script_parser_clean_leftovers) (void);
typedef void (*HPMHOOK_post_script_parser_clean_leftovers) (void);
typedef void (*HPMHOOK_pre_script_run_use_script) (struct map_session_data **sd, struct item_data **data, int *oid);
@@ -7810,6 +7824,8 @@ typedef int (*HPMHOOK_pre_status_get_sc_def) (struct block_list **src, struct bl
typedef int (*HPMHOOK_post_status_get_sc_def) (int retVal___, struct block_list *src, struct block_list *bl, enum sc_type type, int rate, int tick, int flag);
typedef int (*HPMHOOK_pre_status_change_start) (struct block_list **src, struct block_list **bl, enum sc_type *type, int *rate, int *val1, int *val2, int *val3, int *val4, int *tick, int *flag);
typedef int (*HPMHOOK_post_status_change_start) (int retVal___, struct block_list *src, struct block_list *bl, enum sc_type type, int rate, int val1, int val2, int val3, int val4, int tick, int flag);
+typedef int (*HPMHOOK_pre_status_change_start_sub) (struct block_list **src, struct block_list **bl, enum sc_type *type, int *rate, int *val1, int *val2, int *val3, int *val4, int *tick, int *total_tick, int *flag);
+typedef int (*HPMHOOK_post_status_change_start_sub) (int retVal___, struct block_list *src, struct block_list *bl, enum sc_type type, int rate, int val1, int val2, int val3, int val4, int tick, int total_tick, int flag);
typedef int (*HPMHOOK_pre_status_change_end_) (struct block_list **bl, enum sc_type *type, int *tid, const char **file, int *line);
typedef int (*HPMHOOK_post_status_change_end_) (int retVal___, struct block_list *bl, enum sc_type type, int tid, const char *file, int line);
typedef bool (*HPMHOOK_pre_status_is_immune_to_status) (struct status_change **sc, enum sc_type *type);
@@ -7826,8 +7842,8 @@ typedef int (*HPMHOOK_pre_status_get_val_flag) (enum sc_type *type);
typedef int (*HPMHOOK_post_status_get_val_flag) (int retVal___, enum sc_type type);
typedef void (*HPMHOOK_pre_status_change_start_display) (struct map_session_data **sd, enum sc_type *type, int *val1, int *val2, int *val3, int *val4);
typedef void (*HPMHOOK_post_status_change_start_display) (struct map_session_data *sd, enum sc_type type, int val1, int val2, int val3, int val4);
-typedef bool (*HPMHOOK_pre_status_change_start_unknown_sc) (struct block_list **src, struct block_list **bl, enum sc_type *type, int *calc_flag, int *rate, int *val1, int *val2, int *val3, int *val4, int *tick, int *flag);
-typedef bool (*HPMHOOK_post_status_change_start_unknown_sc) (bool retVal___, struct block_list *src, struct block_list *bl, enum sc_type type, int calc_flag, int rate, int val1, int val2, int val3, int val4, int tick, int flag);
+typedef bool (*HPMHOOK_pre_status_change_start_unknown_sc) (struct block_list **src, struct block_list **bl, enum sc_type *type, int *calc_flag, int *rate, int *val1, int *val2, int *val3, int *val4, int *total_tick, int *flag);
+typedef bool (*HPMHOOK_post_status_change_start_unknown_sc) (bool retVal___, struct block_list *src, struct block_list *bl, enum sc_type type, int calc_flag, int rate, int val1, int val2, int val3, int val4, int total_tick, int flag);
typedef int (*HPMHOOK_pre_status_kaahi_heal_timer) (int *tid, int64 *tick, int *id, intptr_t *data);
typedef int (*HPMHOOK_post_status_kaahi_heal_timer) (int retVal___, int tid, int64 tick, int id, intptr_t data);
typedef int (*HPMHOOK_pre_status_change_timer) (int *tid, int64 *tick, int *id, intptr_t *data);
diff --git a/src/plugins/HPMHooking/HPMHooking_char.HPMHooksCore.inc b/src/plugins/HPMHooking/HPMHooking_char.HPMHooksCore.inc
index a5f65654e..cdba77e09 100644
--- a/src/plugins/HPMHooking/HPMHooking_char.HPMHooksCore.inc
+++ b/src/plugins/HPMHooking/HPMHooking_char.HPMHooksCore.inc
@@ -778,6 +778,10 @@ struct {
struct HPMHookPoint *HP_inter_storage_parse_frommap_post;
struct HPMHookPoint *HP_inter_storage_retrieve_bound_items_pre;
struct HPMHookPoint *HP_inter_storage_retrieve_bound_items_post;
+ struct HPMHookPoint *HP_libconfig_set_db_path_pre;
+ struct HPMHookPoint *HP_libconfig_set_db_path_post;
+ struct HPMHookPoint *HP_libconfig_format_db_path_pre;
+ struct HPMHookPoint *HP_libconfig_format_db_path_post;
struct HPMHookPoint *HP_libconfig_read_pre;
struct HPMHookPoint *HP_libconfig_read_post;
struct HPMHookPoint *HP_libconfig_write_pre;
@@ -1252,6 +1256,10 @@ struct {
struct HPMHookPoint *HP_mapif_parse_ClanMemberKick_post;
struct HPMHookPoint *HP_mapif_parse_ClanMemberCount_pre;
struct HPMHookPoint *HP_mapif_parse_ClanMemberCount_post;
+ struct HPMHookPoint *HP_mapindex_config_read_dbpath_pre;
+ struct HPMHookPoint *HP_mapindex_config_read_dbpath_post;
+ struct HPMHookPoint *HP_mapindex_config_read_pre;
+ struct HPMHookPoint *HP_mapindex_config_read_post;
struct HPMHookPoint *HP_mapindex_init_pre;
struct HPMHookPoint *HP_mapindex_init_post;
struct HPMHookPoint *HP_mapindex_final_pre;
@@ -2391,6 +2399,10 @@ struct {
int HP_inter_storage_parse_frommap_post;
int HP_inter_storage_retrieve_bound_items_pre;
int HP_inter_storage_retrieve_bound_items_post;
+ int HP_libconfig_set_db_path_pre;
+ int HP_libconfig_set_db_path_post;
+ int HP_libconfig_format_db_path_pre;
+ int HP_libconfig_format_db_path_post;
int HP_libconfig_read_pre;
int HP_libconfig_read_post;
int HP_libconfig_write_pre;
@@ -2865,6 +2877,10 @@ struct {
int HP_mapif_parse_ClanMemberKick_post;
int HP_mapif_parse_ClanMemberCount_pre;
int HP_mapif_parse_ClanMemberCount_post;
+ int HP_mapindex_config_read_dbpath_pre;
+ int HP_mapindex_config_read_dbpath_post;
+ int HP_mapindex_config_read_pre;
+ int HP_mapindex_config_read_post;
int HP_mapindex_init_pre;
int HP_mapindex_init_post;
int HP_mapindex_final_pre;
diff --git a/src/plugins/HPMHooking/HPMHooking_char.HookingPoints.inc b/src/plugins/HPMHooking/HPMHooking_char.HookingPoints.inc
index efd72b670..a6043756d 100644
--- a/src/plugins/HPMHooking/HPMHooking_char.HookingPoints.inc
+++ b/src/plugins/HPMHooking/HPMHooking_char.HookingPoints.inc
@@ -425,6 +425,8 @@ struct HookingPointData HookingPoints[] = {
{ HP_POP(inter_storage->parse_frommap, HP_inter_storage_parse_frommap) },
{ HP_POP(inter_storage->retrieve_bound_items, HP_inter_storage_retrieve_bound_items) },
/* libconfig_interface */
+ { HP_POP(libconfig->set_db_path, HP_libconfig_set_db_path) },
+ { HP_POP(libconfig->format_db_path, HP_libconfig_format_db_path) },
{ HP_POP(libconfig->read, HP_libconfig_read) },
{ HP_POP(libconfig->write, HP_libconfig_write) },
{ HP_POP(libconfig->set_options, HP_libconfig_set_options) },
@@ -665,6 +667,8 @@ struct HookingPointData HookingPoints[] = {
{ HP_POP(mapif->parse_ClanMemberKick, HP_mapif_parse_ClanMemberKick) },
{ HP_POP(mapif->parse_ClanMemberCount, HP_mapif_parse_ClanMemberCount) },
/* mapindex_interface */
+ { HP_POP(mapindex->config_read_dbpath, HP_mapindex_config_read_dbpath) },
+ { HP_POP(mapindex->config_read, HP_mapindex_config_read) },
{ HP_POP(mapindex->init, HP_mapindex_init) },
{ HP_POP(mapindex->final, HP_mapindex_final) },
{ HP_POP(mapindex->addmap, HP_mapindex_addmap) },
diff --git a/src/plugins/HPMHooking/HPMHooking_char.Hooks.inc b/src/plugins/HPMHooking/HPMHooking_char.Hooks.inc
index 7ce54d288..b25025b1d 100644
--- a/src/plugins/HPMHooking/HPMHooking_char.Hooks.inc
+++ b/src/plugins/HPMHooking/HPMHooking_char.Hooks.inc
@@ -10116,6 +10116,58 @@ bool HP_inter_storage_retrieve_bound_items(int char_id, int account_id, int guil
return retVal___;
}
/* libconfig_interface */
+void HP_libconfig_set_db_path(const char *db_path) {
+ int hIndex = 0;
+ if (HPMHooks.count.HP_libconfig_set_db_path_pre > 0) {
+ void (*preHookFunc) (const char **db_path);
+ *HPMforce_return = false;
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_libconfig_set_db_path_pre; hIndex++) {
+ preHookFunc = HPMHooks.list.HP_libconfig_set_db_path_pre[hIndex].func;
+ preHookFunc(&db_path);
+ }
+ if (*HPMforce_return) {
+ *HPMforce_return = false;
+ return;
+ }
+ }
+ {
+ HPMHooks.source.libconfig.set_db_path(db_path);
+ }
+ if (HPMHooks.count.HP_libconfig_set_db_path_post > 0) {
+ void (*postHookFunc) (const char *db_path);
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_libconfig_set_db_path_post; hIndex++) {
+ postHookFunc = HPMHooks.list.HP_libconfig_set_db_path_post[hIndex].func;
+ postHookFunc(db_path);
+ }
+ }
+ return;
+}
+void HP_libconfig_format_db_path(const char *filename, char *path_buf, int buffer_len) {
+ int hIndex = 0;
+ if (HPMHooks.count.HP_libconfig_format_db_path_pre > 0) {
+ void (*preHookFunc) (const char **filename, char **path_buf, int *buffer_len);
+ *HPMforce_return = false;
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_libconfig_format_db_path_pre; hIndex++) {
+ preHookFunc = HPMHooks.list.HP_libconfig_format_db_path_pre[hIndex].func;
+ preHookFunc(&filename, &path_buf, &buffer_len);
+ }
+ if (*HPMforce_return) {
+ *HPMforce_return = false;
+ return;
+ }
+ }
+ {
+ HPMHooks.source.libconfig.format_db_path(filename, path_buf, buffer_len);
+ }
+ if (HPMHooks.count.HP_libconfig_format_db_path_post > 0) {
+ void (*postHookFunc) (const char *filename, char *path_buf, int buffer_len);
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_libconfig_format_db_path_post; hIndex++) {
+ postHookFunc = HPMHooks.list.HP_libconfig_format_db_path_post[hIndex].func;
+ postHookFunc(filename, path_buf, buffer_len);
+ }
+ }
+ return;
+}
int HP_libconfig_read(struct config_t *config, FILE *stream) {
int hIndex = 0;
int retVal___ = 0;
@@ -16415,6 +16467,60 @@ int HP_mapif_parse_ClanMemberCount(int fd, int clan_id, int kick_interval) {
return retVal___;
}
/* mapindex_interface */
+bool HP_mapindex_config_read_dbpath(const char *filename, const struct config_t *config) {
+ int hIndex = 0;
+ bool retVal___ = false;
+ if (HPMHooks.count.HP_mapindex_config_read_dbpath_pre > 0) {
+ bool (*preHookFunc) (const char **filename, const struct config_t **config);
+ *HPMforce_return = false;
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_mapindex_config_read_dbpath_pre; hIndex++) {
+ preHookFunc = HPMHooks.list.HP_mapindex_config_read_dbpath_pre[hIndex].func;
+ retVal___ = preHookFunc(&filename, &config);
+ }
+ if (*HPMforce_return) {
+ *HPMforce_return = false;
+ return retVal___;
+ }
+ }
+ {
+ retVal___ = HPMHooks.source.mapindex.config_read_dbpath(filename, config);
+ }
+ if (HPMHooks.count.HP_mapindex_config_read_dbpath_post > 0) {
+ bool (*postHookFunc) (bool retVal___, const char *filename, const struct config_t *config);
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_mapindex_config_read_dbpath_post; hIndex++) {
+ postHookFunc = HPMHooks.list.HP_mapindex_config_read_dbpath_post[hIndex].func;
+ retVal___ = postHookFunc(retVal___, filename, config);
+ }
+ }
+ return retVal___;
+}
+bool HP_mapindex_config_read(void) {
+ int hIndex = 0;
+ bool retVal___ = false;
+ if (HPMHooks.count.HP_mapindex_config_read_pre > 0) {
+ bool (*preHookFunc) (void);
+ *HPMforce_return = false;
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_mapindex_config_read_pre; hIndex++) {
+ preHookFunc = HPMHooks.list.HP_mapindex_config_read_pre[hIndex].func;
+ retVal___ = preHookFunc();
+ }
+ if (*HPMforce_return) {
+ *HPMforce_return = false;
+ return retVal___;
+ }
+ }
+ {
+ retVal___ = HPMHooks.source.mapindex.config_read();
+ }
+ if (HPMHooks.count.HP_mapindex_config_read_post > 0) {
+ bool (*postHookFunc) (bool retVal___);
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_mapindex_config_read_post; hIndex++) {
+ postHookFunc = HPMHooks.list.HP_mapindex_config_read_post[hIndex].func;
+ retVal___ = postHookFunc(retVal___);
+ }
+ }
+ return retVal___;
+}
int HP_mapindex_init(void) {
int hIndex = 0;
int retVal___ = 0;
diff --git a/src/plugins/HPMHooking/HPMHooking_login.HPMHooksCore.inc b/src/plugins/HPMHooking/HPMHooking_login.HPMHooksCore.inc
index ba0fe05c2..556757d76 100644
--- a/src/plugins/HPMHooking/HPMHooking_login.HPMHooksCore.inc
+++ b/src/plugins/HPMHooking/HPMHooking_login.HPMHooksCore.inc
@@ -212,6 +212,10 @@ struct {
struct HPMHookPoint *HP_PRIV__lclif_parse_CA_REQ_HASH_post;
struct HPMHookPoint *HP_PRIV__lclif_parse_CA_CHARSERVERCONNECT_pre;
struct HPMHookPoint *HP_PRIV__lclif_parse_CA_CHARSERVERCONNECT_post;
+ struct HPMHookPoint *HP_libconfig_set_db_path_pre;
+ struct HPMHookPoint *HP_libconfig_set_db_path_post;
+ struct HPMHookPoint *HP_libconfig_format_db_path_pre;
+ struct HPMHookPoint *HP_libconfig_format_db_path_post;
struct HPMHookPoint *HP_libconfig_read_pre;
struct HPMHookPoint *HP_libconfig_read_post;
struct HPMHookPoint *HP_libconfig_write_pre;
@@ -1013,6 +1017,10 @@ struct {
int HP_PRIV__lclif_parse_CA_REQ_HASH_post;
int HP_PRIV__lclif_parse_CA_CHARSERVERCONNECT_pre;
int HP_PRIV__lclif_parse_CA_CHARSERVERCONNECT_post;
+ int HP_libconfig_set_db_path_pre;
+ int HP_libconfig_set_db_path_post;
+ int HP_libconfig_format_db_path_pre;
+ int HP_libconfig_format_db_path_post;
int HP_libconfig_read_pre;
int HP_libconfig_read_post;
int HP_libconfig_write_pre;
diff --git a/src/plugins/HPMHooking/HPMHooking_login.HookingPoints.inc b/src/plugins/HPMHooking/HPMHooking_login.HookingPoints.inc
index 1e3548621..65680e072 100644
--- a/src/plugins/HPMHooking/HPMHooking_login.HookingPoints.inc
+++ b/src/plugins/HPMHooking/HPMHooking_login.HookingPoints.inc
@@ -131,6 +131,8 @@ struct HookingPointData HookingPoints[] = {
{ HP_POP(lclif->p->parse_CA_REQ_HASH, HP_PRIV__lclif_parse_CA_REQ_HASH) },
{ HP_POP(lclif->p->parse_CA_CHARSERVERCONNECT, HP_PRIV__lclif_parse_CA_CHARSERVERCONNECT) },
/* libconfig_interface */
+ { HP_POP(libconfig->set_db_path, HP_libconfig_set_db_path) },
+ { HP_POP(libconfig->format_db_path, HP_libconfig_format_db_path) },
{ HP_POP(libconfig->read, HP_libconfig_read) },
{ HP_POP(libconfig->write, HP_libconfig_write) },
{ HP_POP(libconfig->set_options, HP_libconfig_set_options) },
diff --git a/src/plugins/HPMHooking/HPMHooking_login.Hooks.inc b/src/plugins/HPMHooking/HPMHooking_login.Hooks.inc
index 080fb75ff..8f6076e2a 100644
--- a/src/plugins/HPMHooking/HPMHooking_login.Hooks.inc
+++ b/src/plugins/HPMHooking/HPMHooking_login.Hooks.inc
@@ -2518,6 +2518,58 @@ enum parsefunc_rcode HP_PRIV__lclif_parse_CA_CHARSERVERCONNECT(int fd, struct lo
return retVal___;
}
/* libconfig_interface */
+void HP_libconfig_set_db_path(const char *db_path) {
+ int hIndex = 0;
+ if (HPMHooks.count.HP_libconfig_set_db_path_pre > 0) {
+ void (*preHookFunc) (const char **db_path);
+ *HPMforce_return = false;
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_libconfig_set_db_path_pre; hIndex++) {
+ preHookFunc = HPMHooks.list.HP_libconfig_set_db_path_pre[hIndex].func;
+ preHookFunc(&db_path);
+ }
+ if (*HPMforce_return) {
+ *HPMforce_return = false;
+ return;
+ }
+ }
+ {
+ HPMHooks.source.libconfig.set_db_path(db_path);
+ }
+ if (HPMHooks.count.HP_libconfig_set_db_path_post > 0) {
+ void (*postHookFunc) (const char *db_path);
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_libconfig_set_db_path_post; hIndex++) {
+ postHookFunc = HPMHooks.list.HP_libconfig_set_db_path_post[hIndex].func;
+ postHookFunc(db_path);
+ }
+ }
+ return;
+}
+void HP_libconfig_format_db_path(const char *filename, char *path_buf, int buffer_len) {
+ int hIndex = 0;
+ if (HPMHooks.count.HP_libconfig_format_db_path_pre > 0) {
+ void (*preHookFunc) (const char **filename, char **path_buf, int *buffer_len);
+ *HPMforce_return = false;
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_libconfig_format_db_path_pre; hIndex++) {
+ preHookFunc = HPMHooks.list.HP_libconfig_format_db_path_pre[hIndex].func;
+ preHookFunc(&filename, &path_buf, &buffer_len);
+ }
+ if (*HPMforce_return) {
+ *HPMforce_return = false;
+ return;
+ }
+ }
+ {
+ HPMHooks.source.libconfig.format_db_path(filename, path_buf, buffer_len);
+ }
+ if (HPMHooks.count.HP_libconfig_format_db_path_post > 0) {
+ void (*postHookFunc) (const char *filename, char *path_buf, int buffer_len);
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_libconfig_format_db_path_post; hIndex++) {
+ postHookFunc = HPMHooks.list.HP_libconfig_format_db_path_post[hIndex].func;
+ postHookFunc(filename, path_buf, buffer_len);
+ }
+ }
+ return;
+}
int HP_libconfig_read(struct config_t *config, FILE *stream) {
int hIndex = 0;
int retVal___ = 0;
diff --git a/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc b/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc
index 0b3e9b923..1196e3a99 100644
--- a/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc
+++ b/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc
@@ -922,6 +922,8 @@ struct {
struct HPMHookPoint *HP_clif_combo_delay_post;
struct HPMHookPoint *HP_clif_status_change_pre;
struct HPMHookPoint *HP_clif_status_change_post;
+ struct HPMHookPoint *HP_clif_status_change_sub_pre;
+ struct HPMHookPoint *HP_clif_status_change_sub_post;
struct HPMHookPoint *HP_clif_insert_card_pre;
struct HPMHookPoint *HP_clif_insert_card_post;
struct HPMHookPoint *HP_clif_inventoryList_pre;
@@ -3286,6 +3288,10 @@ struct {
struct HPMHookPoint *HP_itemdb_read_libconfig_lapineddukddak_sub_post;
struct HPMHookPoint *HP_itemdb_read_libconfig_lapineddukddak_sub_sources_pre;
struct HPMHookPoint *HP_itemdb_read_libconfig_lapineddukddak_sub_sources_post;
+ struct HPMHookPoint *HP_libconfig_set_db_path_pre;
+ struct HPMHookPoint *HP_libconfig_set_db_path_post;
+ struct HPMHookPoint *HP_libconfig_format_db_path_pre;
+ struct HPMHookPoint *HP_libconfig_format_db_path_post;
struct HPMHookPoint *HP_libconfig_read_pre;
struct HPMHookPoint *HP_libconfig_read_post;
struct HPMHookPoint *HP_libconfig_write_pre;
@@ -3756,6 +3762,10 @@ struct {
struct HPMHookPoint *HP_map_merge_zone_post;
struct HPMHookPoint *HP_map_zone_clear_single_pre;
struct HPMHookPoint *HP_map_zone_clear_single_post;
+ struct HPMHookPoint *HP_mapindex_config_read_dbpath_pre;
+ struct HPMHookPoint *HP_mapindex_config_read_dbpath_post;
+ struct HPMHookPoint *HP_mapindex_config_read_pre;
+ struct HPMHookPoint *HP_mapindex_config_read_post;
struct HPMHookPoint *HP_mapindex_init_pre;
struct HPMHookPoint *HP_mapindex_init_post;
struct HPMHookPoint *HP_mapindex_final_pre;
@@ -3948,6 +3958,8 @@ struct {
struct HPMHookPoint *HP_mob_ai_sub_hard_lootsearch_post;
struct HPMHookPoint *HP_mob_warpchase_sub_pre;
struct HPMHookPoint *HP_mob_warpchase_sub_post;
+ struct HPMHookPoint *HP_mob_is_in_battle_state_pre;
+ struct HPMHookPoint *HP_mob_is_in_battle_state_post;
struct HPMHookPoint *HP_mob_ai_sub_hard_slavemob_pre;
struct HPMHookPoint *HP_mob_ai_sub_hard_slavemob_post;
struct HPMHookPoint *HP_mob_unlocktarget_pre;
@@ -5590,6 +5602,8 @@ struct {
struct HPMHookPoint *HP_script_load_translations_post;
struct HPMHookPoint *HP_script_load_translation_addstring_pre;
struct HPMHookPoint *HP_script_load_translation_addstring_post;
+ struct HPMHookPoint *HP_script_load_translation_file_pre;
+ struct HPMHookPoint *HP_script_load_translation_file_post;
struct HPMHookPoint *HP_script_load_translation_pre;
struct HPMHookPoint *HP_script_load_translation_post;
struct HPMHookPoint *HP_script_translation_db_destroyer_pre;
@@ -5600,8 +5614,8 @@ struct {
struct HPMHookPoint *HP_script_parse_cleanup_timer_post;
struct HPMHookPoint *HP_script_add_language_pre;
struct HPMHookPoint *HP_script_add_language_post;
- struct HPMHookPoint *HP_script_get_translation_file_name_pre;
- struct HPMHookPoint *HP_script_get_translation_file_name_post;
+ struct HPMHookPoint *HP_script_get_translation_dir_name_pre;
+ struct HPMHookPoint *HP_script_get_translation_dir_name_post;
struct HPMHookPoint *HP_script_parser_clean_leftovers_pre;
struct HPMHookPoint *HP_script_parser_clean_leftovers_post;
struct HPMHookPoint *HP_script_run_use_script_pre;
@@ -6332,6 +6346,8 @@ struct {
struct HPMHookPoint *HP_status_get_sc_def_post;
struct HPMHookPoint *HP_status_change_start_pre;
struct HPMHookPoint *HP_status_change_start_post;
+ struct HPMHookPoint *HP_status_change_start_sub_pre;
+ struct HPMHookPoint *HP_status_change_start_sub_post;
struct HPMHookPoint *HP_status_change_end__pre;
struct HPMHookPoint *HP_status_change_end__post;
struct HPMHookPoint *HP_status_is_immune_to_status_pre;
@@ -7735,6 +7751,8 @@ struct {
int HP_clif_combo_delay_post;
int HP_clif_status_change_pre;
int HP_clif_status_change_post;
+ int HP_clif_status_change_sub_pre;
+ int HP_clif_status_change_sub_post;
int HP_clif_insert_card_pre;
int HP_clif_insert_card_post;
int HP_clif_inventoryList_pre;
@@ -10099,6 +10117,10 @@ struct {
int HP_itemdb_read_libconfig_lapineddukddak_sub_post;
int HP_itemdb_read_libconfig_lapineddukddak_sub_sources_pre;
int HP_itemdb_read_libconfig_lapineddukddak_sub_sources_post;
+ int HP_libconfig_set_db_path_pre;
+ int HP_libconfig_set_db_path_post;
+ int HP_libconfig_format_db_path_pre;
+ int HP_libconfig_format_db_path_post;
int HP_libconfig_read_pre;
int HP_libconfig_read_post;
int HP_libconfig_write_pre;
@@ -10569,6 +10591,10 @@ struct {
int HP_map_merge_zone_post;
int HP_map_zone_clear_single_pre;
int HP_map_zone_clear_single_post;
+ int HP_mapindex_config_read_dbpath_pre;
+ int HP_mapindex_config_read_dbpath_post;
+ int HP_mapindex_config_read_pre;
+ int HP_mapindex_config_read_post;
int HP_mapindex_init_pre;
int HP_mapindex_init_post;
int HP_mapindex_final_pre;
@@ -10761,6 +10787,8 @@ struct {
int HP_mob_ai_sub_hard_lootsearch_post;
int HP_mob_warpchase_sub_pre;
int HP_mob_warpchase_sub_post;
+ int HP_mob_is_in_battle_state_pre;
+ int HP_mob_is_in_battle_state_post;
int HP_mob_ai_sub_hard_slavemob_pre;
int HP_mob_ai_sub_hard_slavemob_post;
int HP_mob_unlocktarget_pre;
@@ -12403,6 +12431,8 @@ struct {
int HP_script_load_translations_post;
int HP_script_load_translation_addstring_pre;
int HP_script_load_translation_addstring_post;
+ int HP_script_load_translation_file_pre;
+ int HP_script_load_translation_file_post;
int HP_script_load_translation_pre;
int HP_script_load_translation_post;
int HP_script_translation_db_destroyer_pre;
@@ -12413,8 +12443,8 @@ struct {
int HP_script_parse_cleanup_timer_post;
int HP_script_add_language_pre;
int HP_script_add_language_post;
- int HP_script_get_translation_file_name_pre;
- int HP_script_get_translation_file_name_post;
+ int HP_script_get_translation_dir_name_pre;
+ int HP_script_get_translation_dir_name_post;
int HP_script_parser_clean_leftovers_pre;
int HP_script_parser_clean_leftovers_post;
int HP_script_run_use_script_pre;
@@ -13145,6 +13175,8 @@ struct {
int HP_status_get_sc_def_post;
int HP_status_change_start_pre;
int HP_status_change_start_post;
+ int HP_status_change_start_sub_pre;
+ int HP_status_change_start_sub_post;
int HP_status_change_end__pre;
int HP_status_change_end__post;
int HP_status_is_immune_to_status_pre;
diff --git a/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc b/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc
index c6e887d08..da72b688a 100644
--- a/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc
+++ b/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc
@@ -485,6 +485,7 @@ struct HookingPointData HookingPoints[] = {
{ HP_POP(clif->autospell, HP_clif_autospell) },
{ HP_POP(clif->combo_delay, HP_clif_combo_delay) },
{ HP_POP(clif->status_change, HP_clif_status_change) },
+ { HP_POP(clif->status_change_sub, HP_clif_status_change_sub) },
{ HP_POP(clif->insert_card, HP_clif_insert_card) },
{ HP_POP(clif->inventoryList, HP_clif_inventoryList) },
{ HP_POP(clif->inventoryItems, HP_clif_inventoryItems) },
@@ -1683,6 +1684,8 @@ struct HookingPointData HookingPoints[] = {
{ HP_POP(itemdb->read_libconfig_lapineddukddak_sub, HP_itemdb_read_libconfig_lapineddukddak_sub) },
{ HP_POP(itemdb->read_libconfig_lapineddukddak_sub_sources, HP_itemdb_read_libconfig_lapineddukddak_sub_sources) },
/* libconfig_interface */
+ { HP_POP(libconfig->set_db_path, HP_libconfig_set_db_path) },
+ { HP_POP(libconfig->format_db_path, HP_libconfig_format_db_path) },
{ HP_POP(libconfig->read, HP_libconfig_read) },
{ HP_POP(libconfig->write, HP_libconfig_write) },
{ HP_POP(libconfig->set_options, HP_libconfig_set_options) },
@@ -1922,6 +1925,8 @@ struct HookingPointData HookingPoints[] = {
{ HP_POP(map->merge_zone, HP_map_merge_zone) },
{ HP_POP(map->zone_clear_single, HP_map_zone_clear_single) },
/* mapindex_interface */
+ { HP_POP(mapindex->config_read_dbpath, HP_mapindex_config_read_dbpath) },
+ { HP_POP(mapindex->config_read, HP_mapindex_config_read) },
{ HP_POP(mapindex->init, HP_mapindex_init) },
{ HP_POP(mapindex->final, HP_mapindex_final) },
{ HP_POP(mapindex->addmap, HP_mapindex_addmap) },
@@ -2023,6 +2028,7 @@ struct HookingPointData HookingPoints[] = {
{ HP_POP(mob->ai_sub_hard_bg_ally, HP_mob_ai_sub_hard_bg_ally) },
{ HP_POP(mob->ai_sub_hard_lootsearch, HP_mob_ai_sub_hard_lootsearch) },
{ HP_POP(mob->warpchase_sub, HP_mob_warpchase_sub) },
+ { HP_POP(mob->is_in_battle_state, HP_mob_is_in_battle_state) },
{ HP_POP(mob->ai_sub_hard_slavemob, HP_mob_ai_sub_hard_slavemob) },
{ HP_POP(mob->unlocktarget, HP_mob_unlocktarget) },
{ HP_POP(mob->randomwalk, HP_mob_randomwalk) },
@@ -2861,12 +2867,13 @@ struct HookingPointData HookingPoints[] = {
{ HP_POP(script->string_dup, HP_script_string_dup) },
{ HP_POP(script->load_translations, HP_script_load_translations) },
{ HP_POP(script->load_translation_addstring, HP_script_load_translation_addstring) },
+ { HP_POP(script->load_translation_file, HP_script_load_translation_file) },
{ HP_POP(script->load_translation, HP_script_load_translation) },
{ HP_POP(script->translation_db_destroyer, HP_script_translation_db_destroyer) },
{ HP_POP(script->clear_translations, HP_script_clear_translations) },
{ HP_POP(script->parse_cleanup_timer, HP_script_parse_cleanup_timer) },
{ HP_POP(script->add_language, HP_script_add_language) },
- { HP_POP(script->get_translation_file_name, HP_script_get_translation_file_name) },
+ { HP_POP(script->get_translation_dir_name, HP_script_get_translation_dir_name) },
{ HP_POP(script->parser_clean_leftovers, HP_script_parser_clean_leftovers) },
{ HP_POP(script->run_use_script, HP_script_run_use_script) },
{ HP_POP(script->run_item_equip_script, HP_script_run_item_equip_script) },
@@ -3238,6 +3245,7 @@ struct HookingPointData HookingPoints[] = {
{ HP_POP(status->isimmune, HP_status_isimmune) },
{ HP_POP(status->get_sc_def, HP_status_get_sc_def) },
{ HP_POP(status->change_start, HP_status_change_start) },
+ { HP_POP(status->change_start_sub, HP_status_change_start_sub) },
{ HP_POP(status->change_end_, HP_status_change_end_) },
{ HP_POP(status->is_immune_to_status, HP_status_is_immune_to_status) },
{ HP_POP(status->is_boss_resist_sc, HP_status_is_boss_resist_sc) },
diff --git a/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc b/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc
index daa1b9d7a..c331d66a9 100644
--- a/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc
+++ b/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc
@@ -11995,14 +11995,14 @@ void HP_clif_combo_delay(struct block_list *bl, int wait) {
}
return;
}
-void HP_clif_status_change(struct block_list *bl, int type, int flag, int tick, int val1, int val2, int val3) {
+void HP_clif_status_change(struct block_list *bl, int type, int flag, int total_tick, int val1, int val2, int val3) {
int hIndex = 0;
if (HPMHooks.count.HP_clif_status_change_pre > 0) {
- void (*preHookFunc) (struct block_list **bl, int *type, int *flag, int *tick, int *val1, int *val2, int *val3);
+ void (*preHookFunc) (struct block_list **bl, int *type, int *flag, int *total_tick, int *val1, int *val2, int *val3);
*HPMforce_return = false;
for (hIndex = 0; hIndex < HPMHooks.count.HP_clif_status_change_pre; hIndex++) {
preHookFunc = HPMHooks.list.HP_clif_status_change_pre[hIndex].func;
- preHookFunc(&bl, &type, &flag, &tick, &val1, &val2, &val3);
+ preHookFunc(&bl, &type, &flag, &total_tick, &val1, &val2, &val3);
}
if (*HPMforce_return) {
*HPMforce_return = false;
@@ -12010,13 +12010,39 @@ void HP_clif_status_change(struct block_list *bl, int type, int flag, int tick,
}
}
{
- HPMHooks.source.clif.status_change(bl, type, flag, tick, val1, val2, val3);
+ HPMHooks.source.clif.status_change(bl, type, flag, total_tick, val1, val2, val3);
}
if (HPMHooks.count.HP_clif_status_change_post > 0) {
- void (*postHookFunc) (struct block_list *bl, int type, int flag, int tick, int val1, int val2, int val3);
+ void (*postHookFunc) (struct block_list *bl, int type, int flag, int total_tick, int val1, int val2, int val3);
for (hIndex = 0; hIndex < HPMHooks.count.HP_clif_status_change_post; hIndex++) {
postHookFunc = HPMHooks.list.HP_clif_status_change_post[hIndex].func;
- postHookFunc(bl, type, flag, tick, val1, val2, val3);
+ postHookFunc(bl, type, flag, total_tick, val1, val2, val3);
+ }
+ }
+ return;
+}
+void HP_clif_status_change_sub(struct block_list *bl, int type, int flag, int tick, int total_tick, int val1, int val2, int val3) {
+ int hIndex = 0;
+ if (HPMHooks.count.HP_clif_status_change_sub_pre > 0) {
+ void (*preHookFunc) (struct block_list **bl, int *type, int *flag, int *tick, int *total_tick, int *val1, int *val2, int *val3);
+ *HPMforce_return = false;
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_clif_status_change_sub_pre; hIndex++) {
+ preHookFunc = HPMHooks.list.HP_clif_status_change_sub_pre[hIndex].func;
+ preHookFunc(&bl, &type, &flag, &tick, &total_tick, &val1, &val2, &val3);
+ }
+ if (*HPMforce_return) {
+ *HPMforce_return = false;
+ return;
+ }
+ }
+ {
+ HPMHooks.source.clif.status_change_sub(bl, type, flag, tick, total_tick, val1, val2, val3);
+ }
+ if (HPMHooks.count.HP_clif_status_change_sub_post > 0) {
+ void (*postHookFunc) (struct block_list *bl, int type, int flag, int tick, int total_tick, int val1, int val2, int val3);
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_clif_status_change_sub_post; hIndex++) {
+ postHookFunc = HPMHooks.list.HP_clif_status_change_sub_post[hIndex].func;
+ postHookFunc(bl, type, flag, tick, total_tick, val1, val2, val3);
}
}
return;
@@ -43234,6 +43260,58 @@ bool HP_itemdb_read_libconfig_lapineddukddak_sub_sources(struct config_setting_t
return retVal___;
}
/* libconfig_interface */
+void HP_libconfig_set_db_path(const char *db_path) {
+ int hIndex = 0;
+ if (HPMHooks.count.HP_libconfig_set_db_path_pre > 0) {
+ void (*preHookFunc) (const char **db_path);
+ *HPMforce_return = false;
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_libconfig_set_db_path_pre; hIndex++) {
+ preHookFunc = HPMHooks.list.HP_libconfig_set_db_path_pre[hIndex].func;
+ preHookFunc(&db_path);
+ }
+ if (*HPMforce_return) {
+ *HPMforce_return = false;
+ return;
+ }
+ }
+ {
+ HPMHooks.source.libconfig.set_db_path(db_path);
+ }
+ if (HPMHooks.count.HP_libconfig_set_db_path_post > 0) {
+ void (*postHookFunc) (const char *db_path);
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_libconfig_set_db_path_post; hIndex++) {
+ postHookFunc = HPMHooks.list.HP_libconfig_set_db_path_post[hIndex].func;
+ postHookFunc(db_path);
+ }
+ }
+ return;
+}
+void HP_libconfig_format_db_path(const char *filename, char *path_buf, int buffer_len) {
+ int hIndex = 0;
+ if (HPMHooks.count.HP_libconfig_format_db_path_pre > 0) {
+ void (*preHookFunc) (const char **filename, char **path_buf, int *buffer_len);
+ *HPMforce_return = false;
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_libconfig_format_db_path_pre; hIndex++) {
+ preHookFunc = HPMHooks.list.HP_libconfig_format_db_path_pre[hIndex].func;
+ preHookFunc(&filename, &path_buf, &buffer_len);
+ }
+ if (*HPMforce_return) {
+ *HPMforce_return = false;
+ return;
+ }
+ }
+ {
+ HPMHooks.source.libconfig.format_db_path(filename, path_buf, buffer_len);
+ }
+ if (HPMHooks.count.HP_libconfig_format_db_path_post > 0) {
+ void (*postHookFunc) (const char *filename, char *path_buf, int buffer_len);
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_libconfig_format_db_path_post; hIndex++) {
+ postHookFunc = HPMHooks.list.HP_libconfig_format_db_path_post[hIndex].func;
+ postHookFunc(filename, path_buf, buffer_len);
+ }
+ }
+ return;
+}
int HP_libconfig_read(struct config_t *config, FILE *stream) {
int hIndex = 0;
int retVal___ = 0;
@@ -49663,6 +49741,60 @@ void HP_map_zone_clear_single(struct map_zone_data *zone) {
return;
}
/* mapindex_interface */
+bool HP_mapindex_config_read_dbpath(const char *filename, const struct config_t *config) {
+ int hIndex = 0;
+ bool retVal___ = false;
+ if (HPMHooks.count.HP_mapindex_config_read_dbpath_pre > 0) {
+ bool (*preHookFunc) (const char **filename, const struct config_t **config);
+ *HPMforce_return = false;
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_mapindex_config_read_dbpath_pre; hIndex++) {
+ preHookFunc = HPMHooks.list.HP_mapindex_config_read_dbpath_pre[hIndex].func;
+ retVal___ = preHookFunc(&filename, &config);
+ }
+ if (*HPMforce_return) {
+ *HPMforce_return = false;
+ return retVal___;
+ }
+ }
+ {
+ retVal___ = HPMHooks.source.mapindex.config_read_dbpath(filename, config);
+ }
+ if (HPMHooks.count.HP_mapindex_config_read_dbpath_post > 0) {
+ bool (*postHookFunc) (bool retVal___, const char *filename, const struct config_t *config);
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_mapindex_config_read_dbpath_post; hIndex++) {
+ postHookFunc = HPMHooks.list.HP_mapindex_config_read_dbpath_post[hIndex].func;
+ retVal___ = postHookFunc(retVal___, filename, config);
+ }
+ }
+ return retVal___;
+}
+bool HP_mapindex_config_read(void) {
+ int hIndex = 0;
+ bool retVal___ = false;
+ if (HPMHooks.count.HP_mapindex_config_read_pre > 0) {
+ bool (*preHookFunc) (void);
+ *HPMforce_return = false;
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_mapindex_config_read_pre; hIndex++) {
+ preHookFunc = HPMHooks.list.HP_mapindex_config_read_pre[hIndex].func;
+ retVal___ = preHookFunc();
+ }
+ if (*HPMforce_return) {
+ *HPMforce_return = false;
+ return retVal___;
+ }
+ }
+ {
+ retVal___ = HPMHooks.source.mapindex.config_read();
+ }
+ if (HPMHooks.count.HP_mapindex_config_read_post > 0) {
+ bool (*postHookFunc) (bool retVal___);
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_mapindex_config_read_post; hIndex++) {
+ postHookFunc = HPMHooks.list.HP_mapindex_config_read_post[hIndex].func;
+ retVal___ = postHookFunc(retVal___);
+ }
+ }
+ return retVal___;
+}
int HP_mapindex_init(void) {
int hIndex = 0;
int retVal___ = 0;
@@ -52296,6 +52428,33 @@ int HP_mob_warpchase_sub(struct block_list *bl, va_list ap) {
}
return retVal___;
}
+bool HP_mob_is_in_battle_state(const struct mob_data *md) {
+ int hIndex = 0;
+ bool retVal___ = false;
+ if (HPMHooks.count.HP_mob_is_in_battle_state_pre > 0) {
+ bool (*preHookFunc) (const struct mob_data **md);
+ *HPMforce_return = false;
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_mob_is_in_battle_state_pre; hIndex++) {
+ preHookFunc = HPMHooks.list.HP_mob_is_in_battle_state_pre[hIndex].func;
+ retVal___ = preHookFunc(&md);
+ }
+ if (*HPMforce_return) {
+ *HPMforce_return = false;
+ return retVal___;
+ }
+ }
+ {
+ retVal___ = HPMHooks.source.mob.is_in_battle_state(md);
+ }
+ if (HPMHooks.count.HP_mob_is_in_battle_state_post > 0) {
+ bool (*postHookFunc) (bool retVal___, const struct mob_data *md);
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_mob_is_in_battle_state_post; hIndex++) {
+ postHookFunc = HPMHooks.list.HP_mob_is_in_battle_state_post[hIndex].func;
+ retVal___ = postHookFunc(retVal___, md);
+ }
+ }
+ return retVal___;
+}
int HP_mob_ai_sub_hard_slavemob(struct mob_data *md, int64 tick) {
int hIndex = 0;
int retVal___ = 0;
@@ -74589,15 +74748,42 @@ bool HP_script_load_translation_addstring(const char *file, uint8 lang_id, const
}
return retVal___;
}
-int HP_script_load_translation(const char *file, uint8 lang_id) {
+int HP_script_load_translation_file(const char *file, uint8 lang_id) {
int hIndex = 0;
int retVal___ = 0;
- if (HPMHooks.count.HP_script_load_translation_pre > 0) {
+ if (HPMHooks.count.HP_script_load_translation_file_pre > 0) {
int (*preHookFunc) (const char **file, uint8 *lang_id);
*HPMforce_return = false;
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_script_load_translation_file_pre; hIndex++) {
+ preHookFunc = HPMHooks.list.HP_script_load_translation_file_pre[hIndex].func;
+ retVal___ = preHookFunc(&file, &lang_id);
+ }
+ if (*HPMforce_return) {
+ *HPMforce_return = false;
+ return retVal___;
+ }
+ }
+ {
+ retVal___ = HPMHooks.source.script.load_translation_file(file, lang_id);
+ }
+ if (HPMHooks.count.HP_script_load_translation_file_post > 0) {
+ int (*postHookFunc) (int retVal___, const char *file, uint8 lang_id);
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_script_load_translation_file_post; hIndex++) {
+ postHookFunc = HPMHooks.list.HP_script_load_translation_file_post[hIndex].func;
+ retVal___ = postHookFunc(retVal___, file, lang_id);
+ }
+ }
+ return retVal___;
+}
+int HP_script_load_translation(const char *directory, uint8 lang_id) {
+ int hIndex = 0;
+ int retVal___ = 0;
+ if (HPMHooks.count.HP_script_load_translation_pre > 0) {
+ int (*preHookFunc) (const char **directory, uint8 *lang_id);
+ *HPMforce_return = false;
for (hIndex = 0; hIndex < HPMHooks.count.HP_script_load_translation_pre; hIndex++) {
preHookFunc = HPMHooks.list.HP_script_load_translation_pre[hIndex].func;
- retVal___ = preHookFunc(&file, &lang_id);
+ retVal___ = preHookFunc(&directory, &lang_id);
}
if (*HPMforce_return) {
*HPMforce_return = false;
@@ -74605,13 +74791,13 @@ int HP_script_load_translation(const char *file, uint8 lang_id) {
}
}
{
- retVal___ = HPMHooks.source.script.load_translation(file, lang_id);
+ retVal___ = HPMHooks.source.script.load_translation(directory, lang_id);
}
if (HPMHooks.count.HP_script_load_translation_post > 0) {
- int (*postHookFunc) (int retVal___, const char *file, uint8 lang_id);
+ int (*postHookFunc) (int retVal___, const char *directory, uint8 lang_id);
for (hIndex = 0; hIndex < HPMHooks.count.HP_script_load_translation_post; hIndex++) {
postHookFunc = HPMHooks.list.HP_script_load_translation_post[hIndex].func;
- retVal___ = postHookFunc(retVal___, file, lang_id);
+ retVal___ = postHookFunc(retVal___, directory, lang_id);
}
}
return retVal___;
@@ -74729,15 +74915,15 @@ uint8 HP_script_add_language(const char *name) {
}
return retVal___;
}
-const char* HP_script_get_translation_file_name(const char *file) {
+const char* HP_script_get_translation_dir_name(const char *directory) {
int hIndex = 0;
const char* retVal___ = NULL;
- if (HPMHooks.count.HP_script_get_translation_file_name_pre > 0) {
- const char* (*preHookFunc) (const char **file);
+ if (HPMHooks.count.HP_script_get_translation_dir_name_pre > 0) {
+ const char* (*preHookFunc) (const char **directory);
*HPMforce_return = false;
- for (hIndex = 0; hIndex < HPMHooks.count.HP_script_get_translation_file_name_pre; hIndex++) {
- preHookFunc = HPMHooks.list.HP_script_get_translation_file_name_pre[hIndex].func;
- retVal___ = preHookFunc(&file);
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_script_get_translation_dir_name_pre; hIndex++) {
+ preHookFunc = HPMHooks.list.HP_script_get_translation_dir_name_pre[hIndex].func;
+ retVal___ = preHookFunc(&directory);
}
if (*HPMforce_return) {
*HPMforce_return = false;
@@ -74745,13 +74931,13 @@ const char* HP_script_get_translation_file_name(const char *file) {
}
}
{
- retVal___ = HPMHooks.source.script.get_translation_file_name(file);
+ retVal___ = HPMHooks.source.script.get_translation_dir_name(directory);
}
- if (HPMHooks.count.HP_script_get_translation_file_name_post > 0) {
- const char* (*postHookFunc) (const char* retVal___, const char *file);
- for (hIndex = 0; hIndex < HPMHooks.count.HP_script_get_translation_file_name_post; hIndex++) {
- postHookFunc = HPMHooks.list.HP_script_get_translation_file_name_post[hIndex].func;
- retVal___ = postHookFunc(retVal___, file);
+ if (HPMHooks.count.HP_script_get_translation_dir_name_post > 0) {
+ const char* (*postHookFunc) (const char* retVal___, const char *directory);
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_script_get_translation_dir_name_post; hIndex++) {
+ postHookFunc = HPMHooks.list.HP_script_get_translation_dir_name_post[hIndex].func;
+ retVal___ = postHookFunc(retVal___, directory);
}
}
return retVal___;
@@ -84705,6 +84891,33 @@ int HP_status_change_start(struct block_list *src, struct block_list *bl, enum s
}
return retVal___;
}
+int HP_status_change_start_sub(struct block_list *src, struct block_list *bl, enum sc_type type, int rate, int val1, int val2, int val3, int val4, int tick, int total_tick, int flag) {
+ int hIndex = 0;
+ int retVal___ = 0;
+ if (HPMHooks.count.HP_status_change_start_sub_pre > 0) {
+ int (*preHookFunc) (struct block_list **src, struct block_list **bl, enum sc_type *type, int *rate, int *val1, int *val2, int *val3, int *val4, int *tick, int *total_tick, int *flag);
+ *HPMforce_return = false;
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_status_change_start_sub_pre; hIndex++) {
+ preHookFunc = HPMHooks.list.HP_status_change_start_sub_pre[hIndex].func;
+ retVal___ = preHookFunc(&src, &bl, &type, &rate, &val1, &val2, &val3, &val4, &tick, &total_tick, &flag);
+ }
+ if (*HPMforce_return) {
+ *HPMforce_return = false;
+ return retVal___;
+ }
+ }
+ {
+ retVal___ = HPMHooks.source.status.change_start_sub(src, bl, type, rate, val1, val2, val3, val4, tick, total_tick, flag);
+ }
+ if (HPMHooks.count.HP_status_change_start_sub_post > 0) {
+ int (*postHookFunc) (int retVal___, struct block_list *src, struct block_list *bl, enum sc_type type, int rate, int val1, int val2, int val3, int val4, int tick, int total_tick, int flag);
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_status_change_start_sub_post; hIndex++) {
+ postHookFunc = HPMHooks.list.HP_status_change_start_sub_post[hIndex].func;
+ retVal___ = postHookFunc(retVal___, src, bl, type, rate, val1, val2, val3, val4, tick, total_tick, flag);
+ }
+ }
+ return retVal___;
+}
int HP_status_change_end_(struct block_list *bl, enum sc_type type, int tid, const char *file, int line) {
int hIndex = 0;
int retVal___ = 0;
@@ -84919,15 +85132,15 @@ void HP_status_change_start_display(struct map_session_data *sd, enum sc_type ty
}
return;
}
-bool HP_status_change_start_unknown_sc(struct block_list *src, struct block_list *bl, enum sc_type type, int calc_flag, int rate, int val1, int val2, int val3, int val4, int tick, int flag) {
+bool HP_status_change_start_unknown_sc(struct block_list *src, struct block_list *bl, enum sc_type type, int calc_flag, int rate, int val1, int val2, int val3, int val4, int total_tick, int flag) {
int hIndex = 0;
bool retVal___ = false;
if (HPMHooks.count.HP_status_change_start_unknown_sc_pre > 0) {
- bool (*preHookFunc) (struct block_list **src, struct block_list **bl, enum sc_type *type, int *calc_flag, int *rate, int *val1, int *val2, int *val3, int *val4, int *tick, int *flag);
+ bool (*preHookFunc) (struct block_list **src, struct block_list **bl, enum sc_type *type, int *calc_flag, int *rate, int *val1, int *val2, int *val3, int *val4, int *total_tick, int *flag);
*HPMforce_return = false;
for (hIndex = 0; hIndex < HPMHooks.count.HP_status_change_start_unknown_sc_pre; hIndex++) {
preHookFunc = HPMHooks.list.HP_status_change_start_unknown_sc_pre[hIndex].func;
- retVal___ = preHookFunc(&src, &bl, &type, &calc_flag, &rate, &val1, &val2, &val3, &val4, &tick, &flag);
+ retVal___ = preHookFunc(&src, &bl, &type, &calc_flag, &rate, &val1, &val2, &val3, &val4, &total_tick, &flag);
}
if (*HPMforce_return) {
*HPMforce_return = false;
@@ -84935,13 +85148,13 @@ bool HP_status_change_start_unknown_sc(struct block_list *src, struct block_list
}
}
{
- retVal___ = HPMHooks.source.status.change_start_unknown_sc(src, bl, type, calc_flag, rate, val1, val2, val3, val4, tick, flag);
+ retVal___ = HPMHooks.source.status.change_start_unknown_sc(src, bl, type, calc_flag, rate, val1, val2, val3, val4, total_tick, flag);
}
if (HPMHooks.count.HP_status_change_start_unknown_sc_post > 0) {
- bool (*postHookFunc) (bool retVal___, struct block_list *src, struct block_list *bl, enum sc_type type, int calc_flag, int rate, int val1, int val2, int val3, int val4, int tick, int flag);
+ bool (*postHookFunc) (bool retVal___, struct block_list *src, struct block_list *bl, enum sc_type type, int calc_flag, int rate, int val1, int val2, int val3, int val4, int total_tick, int flag);
for (hIndex = 0; hIndex < HPMHooks.count.HP_status_change_start_unknown_sc_post; hIndex++) {
postHookFunc = HPMHooks.list.HP_status_change_start_unknown_sc_post[hIndex].func;
- retVal___ = postHookFunc(retVal___, src, bl, type, calc_flag, rate, val1, val2, val3, val4, tick, flag);
+ retVal___ = postHookFunc(retVal___, src, bl, type, calc_flag, rate, val1, val2, val3, val4, total_tick, flag);
}
}
return retVal___;
diff --git a/src/plugins/generate-translations.c b/src/plugins/generate-translations.c
index 759e788a2..14a3c0a4d 100644
--- a/src/plugins/generate-translations.c
+++ b/src/plugins/generate-translations.c
@@ -22,11 +22,13 @@
#include "common/hercules.h"
#include "common/cbasetypes.h"
#include "common/memmgr.h"
+#include "common/nullpo.h"
#include "common/showmsg.h"
#include "common/strlib.h"
#include "common/sysinfo.h"
#include "map/atcommand.h"
#include "map/map.h"
+#include "map/npc.h"
#include "map/script.h"
#include "plugins/HPMHooking.h"
@@ -34,6 +36,8 @@
#include <stdio.h>
#include <stdlib.h>
+#include <sys/stat.h>
+#include <time.h>
HPExport struct hplugin_info pinfo = {
"generate-translations", // Plugin name
@@ -45,14 +49,33 @@ HPExport struct hplugin_info pinfo = {
struct DBMap *translatable_strings; // string map parsed (used when exporting strings only)
/* Set during startup when attempting to export the lang, unset after server initialization is over */
FILE *lang_export_fp;
-char *lang_export_file;/* for lang_export_fp */
+char *lang_export_filepath;
+#define DIRECTORYNAME "generated_translations"
struct script_string_buf lang_export_line_buf;
struct script_string_buf lang_export_escaped_buf;
-int lang_export_stringcount;
+int lang_export_stringcount_total;
+int lang_export_stringcount_current;
/// Whether the translations template generator will automatically run.
bool generating_translations = false;
+bool createdirectory(const char *dirname)
+{
+#ifdef WIN32
+ if (!CreateDirectory(dirname, NULL)) {
+ if (ERROR_ALREADY_EXISTS != GetLastError())
+ return false;
+ }
+#else /* Not WIN32 */
+ struct stat st = { 0 };
+ if (stat(dirname, &st) == -1 ) {
+ if (mkdir(dirname, 0755) != 0)
+ return false;
+ }
+#endif // WIN32 check
+ return true;
+}
+
/**
* --generate-translations
*
@@ -61,49 +84,9 @@ bool generating_translations = false;
*/
CMDLINEARG(generatetranslations)
{
- lang_export_file = aStrdup("./generated_translations.pot");
-
- if ((lang_export_fp = fopen(lang_export_file, "wb")) == NULL) {
- ShowError("export-dialog: failed to open '%s' for writing\n", lang_export_file);
- } else {
- time_t t = time(NULL);
- struct tm *lt = localtime(&t);
- int year = lt->tm_year+1900;
- char timestring[128] = "";
- strftime(timestring, sizeof(timestring), "%Y-%m-%d %H:%M:%S%z", lt);
- fprintf(lang_export_fp,
- "# This file is part of Hercules.\n"
- "# http://herc.ws - http://github.com/HerculesWS/Hercules\n"
- "#\n"
- "# Copyright (C) 2013-%d Hercules Dev Team\n"
- "#\n"
- "# Hercules is free software: you can redistribute it and/or modify\n"
- "# it under the terms of the GNU General Public License as published by\n"
- "# the Free Software Foundation, either version 3 of the License, or\n"
- "# (at your option) any later version.\n"
- "#\n"
- "# This program is distributed in the hope that it will be useful,\n"
- "# but WITHOUT ANY WARRANTY; without even the implied warranty of\n"
- "# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n"
- "# GNU General Public License for more details.\n"
- "#\n"
- "# You should have received a copy of the GNU General Public License\n"
- "# along with this program. If not, see <http://www.gnu.org/licenses/>.\n\n"
-
- "#,fuzzy\n"
- "msgid \"\"\n"
- "msgstr \"\"\n"
- "\"Project-Id-Version: %s\\n\"\n"
- "\"Report-Msgid-Bugs-To: dev@herc.ws\\n\"\n"
- "\"POT-Creation-Date: %s\\n\"\n"
- "\"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\\n\"\n"
- "\"Last-Translator: FULL NAME <EMAIL@ADDRESS>\\n\"\n"
- "\"Language-Team: LANGUAGE <LL@li.org>\\n\"\n"
- "\"Language: \\n\"\n"
- "\"MIME-Version: 1.0\\n\"\n"
- "\"Content-Type: text/plain; charset=ISO-8859-1\\n\"\n"
- "\"Content-Transfer-Encoding: 8bit\\n\"\n\n",
- year, sysinfo->vcsrevision_scripts(), timestring);
+ if (!createdirectory(DIRECTORYNAME)) {
+ ShowError("generatetranslations: Unable to create output directory '%s'.\n", DIRECTORYNAME);
+ return false;
}
generating_translations = true;
return true;
@@ -188,7 +171,8 @@ void script_add_translatable_string_posthook(const struct script_string_buf *str
script->parser_current_npc_name ? script->parser_current_npc_name : "Unknown NPC",
VECTOR_DATA(lang_export_escaped_buf)
);
- lang_export_stringcount++;
+ lang_export_stringcount_total++;
+ lang_export_stringcount_current++;
VECTOR_TRUNCATE(lang_export_line_buf);
VECTOR_TRUNCATE(lang_export_escaped_buf);
}
@@ -214,44 +198,184 @@ void script_parser_clean_leftovers_posthook(void)
VECTOR_CLEAR(lang_export_escaped_buf);
}
+bool translations_enter_file(const char *filepath)
+{
+ const char *p = NULL;
+ int len, i;
+
+ if (!generating_translations)
+ return false;
+
+ p = filepath;
+ len = (int)strlen(filepath) + (int)strlen(DIRECTORYNAME) + (int)strlen(PATHSEP_STR);
+ lang_export_filepath = aCalloc(len + 4 + 1, sizeof(char)); // + ".pot"
+ strncat(lang_export_filepath, DIRECTORYNAME PATHSEP_STR, len);
+ lang_export_stringcount_current = 0;
+
+ i = (int)strlen(lang_export_filepath);
+ while (*p != '\0') {
+ if (Assert_chk(i < len)) {
+ aFree(lang_export_filepath);
+ lang_export_filepath = NULL;
+ return false;
+ }
+ if (*p == '.') {
+ lang_export_filepath[i] = '_';
+ } else if (*p == PATHSEP) {
+ if (!createdirectory(lang_export_filepath)) {
+ ShowError("generatetranslations: Unable to create output directory '%s'.\n", lang_export_filepath);
+ aFree(lang_export_filepath);
+ lang_export_filepath = NULL;
+ return false;
+ }
+ lang_export_filepath[i] = PATHSEP;
+ } else {
+ lang_export_filepath[i] = *p;
+ }
+ i++;
+ p++;
+ }
+ strncat(lang_export_filepath, ".pot", len + 4);
+
+ if ((lang_export_fp = fopen(lang_export_filepath, "wb")) == NULL) {
+ ShowError("export-dialog: failed to open '%s' for writing\n", lang_export_filepath);
+ aFree(lang_export_filepath);
+ lang_export_filepath = NULL;
+ return false;
+ }
+
+ {
+ time_t t = time(NULL);
+ struct tm *lt = localtime(&t);
+ int year = lt->tm_year+1900;
+ char timestring[128] = "";
+ strftime(timestring, sizeof(timestring), "%Y-%m-%d %H:%M:%S%z", lt);
+ fprintf(lang_export_fp,
+ "# This file is part of Hercules.\n"
+ "# http://herc.ws - http://github.com/HerculesWS/Hercules\n"
+ "#\n"
+ "# Copyright (C) 2013-%d Hercules Dev Team\n"
+ "#\n"
+ "# Hercules is free software: you can redistribute it and/or modify\n"
+ "# it under the terms of the GNU General Public License as published by\n"
+ "# the Free Software Foundation, either version 3 of the License, or\n"
+ "# (at your option) any later version.\n"
+ "#\n"
+ "# This program is distributed in the hope that it will be useful,\n"
+ "# but WITHOUT ANY WARRANTY; without even the implied warranty of\n"
+ "# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n"
+ "# GNU General Public License for more details.\n"
+ "#\n"
+ "# You should have received a copy of the GNU General Public License\n"
+ "# along with this program. If not, see <http://www.gnu.org/licenses/>.\n\n"
+
+ "#,fuzzy\n"
+ "msgid \"\"\n"
+ "msgstr \"\"\n"
+ "\"Project-Id-Version: %s\\n\"\n"
+ "\"Report-Msgid-Bugs-To: dev@herc.ws\\n\"\n"
+ "\"POT-Creation-Date: %s\\n\"\n"
+ "\"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\\n\"\n"
+ "\"Last-Translator: FULL NAME <EMAIL@ADDRESS>\\n\"\n"
+ "\"Language-Team: LANGUAGE <LL@li.org>\\n\"\n"
+ "\"Language: \\n\"\n"
+ "\"MIME-Version: 1.0\\n\"\n"
+ "\"Content-Type: text/plain; charset=ISO-8859-1\\n\"\n"
+ "\"Content-Transfer-Encoding: 8bit\\n\"\n\n",
+ year, sysinfo->vcsrevision_scripts(), timestring);
+ }
+ return true;
+}
+
+bool translations_leave_file(const char *filepath)
+{
+ if (lang_export_fp != NULL) {
+ fclose(lang_export_fp);
+ lang_export_fp = NULL;
+ }
+ if (lang_export_filepath != NULL) {
+ if (lang_export_stringcount_current == 0) {
+ remove(lang_export_filepath);
+ } else {
+ ShowMessage("\r");
+ ShowInfo("%s => %s (%d strings)\n", filepath, lang_export_filepath, lang_export_stringcount_current);
+ }
+ aFree(lang_export_filepath);
+ lang_export_filepath = NULL;
+ }
+ lang_export_stringcount_current = 0;
+ return true;
+}
+
+bool msg_config_read_prehook(const char **cfg_name, bool *allow_override)
+{
+ if (*allow_override) // allow_override is true in nested calls
+ return false;
+
+ translations_enter_file(*cfg_name);
+ return true;
+}
+
bool msg_config_read_posthook(bool retVal, const char *cfg_name, bool allow_override)
{
- static int called = 1;
+ int i;
if (!generating_translations || lang_export_fp == NULL)
return retVal;
- if (!retVal)
+ if (allow_override) // allow_override is true in nested calls
return retVal;
- if (++called == 1) { // Original
- int i;
+ if (retVal) {
for (i = 0; i < MAX_MSG; i++) {
if (atcommand->msg_table[0][i] == NULL)
continue;
- fprintf(lang_export_fp, "msgctxt \"messages.conf\"\n"
+ fprintf(lang_export_fp, "\n#: conf/messages.conf\n"
+ "# %d: %s\n"
+ "#, c-format\n"
+ "msgctxt \"messages.conf\"\n"
"msgid \"%s\"\n"
"msgstr \"\"\n",
+ i, atcommand->msg_table[0][i],
atcommand->msg_table[0][i]
);
- lang_export_stringcount++;
+ lang_export_stringcount_total++;
+ lang_export_stringcount_current++;
}
}
+ translations_leave_file(cfg_name);
+
+ return retVal;
+}
+
+int npc_parsesrcfile_prehook(const char **filepath, bool *runOnInit)
+{
+ translations_enter_file(*filepath);
+ return 0;
+}
+
+int npc_parsesrcfile_posthook(int retVal, const char *filepath, bool runOnInit)
+{
+ translations_leave_file(filepath);
return retVal;
}
HPExport void server_preinit(void)
{
addArg("--generate-translations", false, generatetranslations,
- "Creates './generated_translations.pot' file with all translateable strings from scripts, server terminates afterwards.");
+ "Creates 'generated_translations/**/*.pot' file with all translateable strings from scripts, server terminates afterwards.");
VECTOR_INIT(lang_export_line_buf);
VECTOR_INIT(lang_export_escaped_buf);
addHookPost(script, add_translatable_string, script_add_translatable_string_posthook);
addHookPre(script, parse, parse_script_prehook);
addHookPost(script, parser_clean_leftovers, script_parser_clean_leftovers_posthook);
+ addHookPre(atcommand, msg_read, msg_config_read_prehook);
addHookPost(atcommand, msg_read, msg_config_read_posthook);
- lang_export_stringcount = 0;
+ addHookPre(npc, parsesrcfile, npc_parsesrcfile_prehook);
+ addHookPost(npc, parsesrcfile, npc_parsesrcfile_posthook);
+ lang_export_stringcount_total = 0;
+ lang_export_stringcount_current = 0;
}
HPExport void plugin_init(void)
@@ -260,18 +384,12 @@ HPExport void plugin_init(void)
HPExport void server_online(void)
{
- if (generating_translations && lang_export_fp != NULL) {
- ShowInfo("Translations template exported to '%s' with %d strings.\n", lang_export_file, lang_export_stringcount);
- fclose(lang_export_fp);
- lang_export_fp = NULL;
+ if (generating_translations) {
+ ShowInfo("Translations template exported to '%s' with %d strings.\n", DIRECTORYNAME, lang_export_stringcount_total);
}
core->runflag = CORE_ST_STOP;
}
HPExport void plugin_final(void)
{
- if (lang_export_file != NULL) {
- aFree(lang_export_file);
- lang_export_file = NULL;
- }
}