From 330e31cc71ece055908acb1eb967b4009ebc9c46 Mon Sep 17 00:00:00 2001 From: shennetsind Date: Mon, 23 Feb 2015 14:24:36 -0300 Subject: Hercules Ultimate Localization Design Servers can now run on any number of languages, without editing npc files. Designed by Haruna and Ind http://hercules.ws/board/topic/8687-hercules-ultimate-localization-design/ Signed-off-by: shennetsind --- src/map/npc.c | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) (limited to 'src/map/npc.c') diff --git a/src/map/npc.c b/src/map/npc.c index 6cc192f66..16789b726 100644 --- a/src/map/npc.c +++ b/src/map/npc.c @@ -1175,17 +1175,17 @@ void run_tomb(struct map_session_data* sd, struct npc_data* nd) { strftime(time, sizeof(time), "%H:%M", localtime(&nd->u.tomb.kill_time)); // TODO: Find exact color? - snprintf(buffer, sizeof(buffer), msg_txt(857), nd->u.tomb.md->db->name); // "[ ^EE0000%s^000000 ]" + snprintf(buffer, sizeof(buffer), msg_sd(sd,857), nd->u.tomb.md->db->name); // "[ ^EE0000%s^000000 ]" clif->scriptmes(sd, nd->bl.id, buffer); - clif->scriptmes(sd, nd->bl.id, msg_txt(858)); // "Has met its demise" + clif->scriptmes(sd, nd->bl.id, msg_sd(sd,858)); // "Has met its demise" - snprintf(buffer, sizeof(buffer), msg_txt(859), time); // "Time of death : ^EE0000%s^000000" + snprintf(buffer, sizeof(buffer), msg_sd(sd,859), time); // "Time of death : ^EE0000%s^000000" clif->scriptmes(sd, nd->bl.id, buffer); - clif->scriptmes(sd, nd->bl.id, msg_txt(860)); // "Defeated by" + clif->scriptmes(sd, nd->bl.id, msg_sd(sd,860)); // "Defeated by" - snprintf(buffer, sizeof(buffer), msg_txt(861), nd->u.tomb.killer_name[0] ? nd->u.tomb.killer_name : msg_txt(15)); // "[^EE0000%s^000000]" / "Unknown" + snprintf(buffer, sizeof(buffer), msg_sd(sd,861), nd->u.tomb.killer_name[0] ? nd->u.tomb.killer_name : msg_sd(sd,15)); // "[^EE0000%s^000000]" / "Unknown" clif->scriptmes(sd, nd->bl.id, buffer); clif->scriptclose(sd, nd->bl.id); @@ -1566,7 +1566,7 @@ bool npc_trader_open(struct map_session_data *sd, struct npc_data *nd) { /* nothing to display, no items available */ if( i == nd->u.scr.shop->items ) { - clif->colormes(sd->fd,COLOR_RED, msg_txt(881)); + clif->colormes(sd->fd,COLOR_RED, msg_sd(sd,881)); return false; } @@ -2924,7 +2924,13 @@ const char* npc_parse_script(char* w1, char* w2, char* w3, char* w4, const char* if( end == NULL ) return NULL;// (simple) parse error, don't continue + + script->parser_current_npc_name = w3; + scriptroot = script->parse(script_start, filepath, strline(buffer,script_start-buffer), SCRIPT_USE_LABEL_DB, retval); + + script->parser_current_npc_name = NULL; + label_list = NULL; label_list_num = 0; if( script->label_count ) { @@ -3435,7 +3441,12 @@ const char* npc_parse_function(char* w1, char* w2, char* w3, char* w4, const cha if( end == NULL ) return NULL;// (simple) parse error, don't continue + script->parser_current_npc_name = w3; + scriptroot = script->parse(script_start, filepath, strline(buffer,start-buffer), SCRIPT_RETURN_EMPTY_SCRIPT, retval); + + script->parser_current_npc_name = NULL; + if( scriptroot == NULL )// parse error, continue return end; @@ -4611,6 +4622,11 @@ int do_init_npc(bool minimal) { timer->add_func_list(npc->event_do_clock,"npc_event_do_clock"); timer->add_func_list(npc->timerevent,"npc_timerevent"); } + + if( script->lang_export_fp ) { + fclose(script->lang_export_fp); + script->lang_export_fp = NULL; + } // Init dummy NPC npc->fake_nd = (struct npc_data *)aCalloc(1,sizeof(struct npc_data)); -- cgit v1.2.3-70-g09d2