From c8c40a1377834feebb163227094fda816c4093b9 Mon Sep 17 00:00:00 2001 From: Cydh Ramdh Date: Fri, 4 Apr 2014 22:28:11 +0700 Subject: [PATCH] Follow up 0081e25, 8a723ee (msg_conf stuffs) - Revert MAP_MAX_MSG to 1500 - Moved some messages to empty spaces - Added warning message if msg_number is invalid when msg_conf files are being read - And minor stuffs Signed-off-by: Cydh Ramdh --- conf/msg_conf/map_msg.conf | 38 +++++++++++++++------------------- conf/msg_conf/map_msg_idn.conf | 34 +++++++++++++++++------------- src/common/msg_conf.c | 12 +++++++---- src/map/atcommand.c | 12 +++++------ src/map/clif.c | 2 +- src/map/map.c | 2 +- src/map/script.c | 6 +++--- 7 files changed, 56 insertions(+), 50 deletions(-) diff --git a/conf/msg_conf/map_msg.conf b/conf/msg_conf/map_msg.conf index 2a7e70dce0..cee4aecc2f 100644 --- a/conf/msg_conf/map_msg.conf +++ b/conf/msg_conf/map_msg.conf @@ -2,14 +2,10 @@ // Message Configuration // For translation, just change msg here (second line), no need to modify source code, // or alternatively, use conf/import/msg_conf.txt +// // Format: -// // English message -// msg_number: translated message - -// 0-410: reserved for GM commands -// 500-900 reserved for others -// 900-1300: @atcommand - +// msg_number: message (max length is 255 chars) +// // To disable a string (%s) field, make its max length 0: // eg: // 270: *%s %s* (@me format) @@ -737,7 +733,20 @@ 721: [%s] Poison effect was applied to the weapon. 722: Please equipped with a %s. -//723-899 free +// @costume +723: '%s' is an unknown costume +724: You're already wearing a(n) '%s' costume, type '@costume' to remove it. +725: -- %s +726: - Available Costumes +727: '%s' Costume removed. + +// Monster Transformation +728: Traaaansformation-!! %s form!! +729: Cannot transform into monster while in disguise. +730: Character cannot be disguised while in monster form. +731: Transforming into monster is not allowed in Guild Wars. + +//732-899 free //------------------------------------ // More atcommands message @@ -1555,18 +1564,5 @@ 1495: You can't withdraw that much money 1496: Banking is disabled -// Monster Transformation -1497: Traaaansformation-!! %s form!! -1498: Cannot transform into monster while in disguise. -1499: Character cannot be disguised while in monster form. -1500: Transforming into monster is not allowed in Guild Wars. - -// @costume -1501: '%s' is an unknown costume -1502: You're already wearing a(n) '%s' costume, type '@costume' to remove it. -1503: -- %s -1504: - Available Costumes -1505: '%s' Costume removed. - //Custom translations //import: conf/msg_conf/import/map_msg_eng_conf.txt diff --git a/conf/msg_conf/map_msg_idn.conf b/conf/msg_conf/map_msg_idn.conf index 8f48cca834..c7104b2121 100644 --- a/conf/msg_conf/map_msg_idn.conf +++ b/conf/msg_conf/map_msg_idn.conf @@ -2,14 +2,10 @@ // Pengaturan pesan. Diterjemahkan oleh [Cydh] dan [nanakiwurtz] // Untuk terjemahan, cukup ubah pesan di sini (pada baris setelah pesan asli), tidak perlu mengubah source code, // atau juga dapat dilakukan dengan menggunakan conf/msg_conf/import/map_msg_idn_conf.txt +// // Format penulisan: -// //nomor_pesan: pesan asli -// nomor_pesan: pesan yang diterjemahkan - -// 0-410: digunakan untuk perintah GM -// 500-900: digunakan untuk pesan lainnya -// 900-1300: @atcommand - +// nomor_pesan: pesan (maksimal panjang pesan 255 karakter) +// // Untuk meniadakan sebuah string (%s), maka jadikan panjang string maksimal tersebut menjadi 0. // contoh: // 270: *%s %s* (@me format) @@ -455,6 +451,9 @@ 433: Karakter ini diban hingga 434: Char-server meminta untuk %s pemain '%.*s'. 435: Harap masukkan nama pemain (penggunaan: @charunblock ). +436: VIP +437: GM tidak bisa menjadi VIP. +438: Kamu sudah bukan VIP lagi. // Pesan-pesan untuk Homunculus 450: Kamu sudah memiliki homunculus @@ -734,7 +733,20 @@ 721: Efek [%s] Poison diberikan ke senjata. 722: Butuh memakai %s. -//723-899 kosong +// @costume +723: Kotum '%s' tidak diketahui. +724: Kamu sudah menggunakan kostum '%s', keti '@costume' untuk melepasnya. +725: -- %s +726: - Kostum yang tersedia +727: Kostum '%s' telah dilepas. + +// Monster Transformation +728: Berubaaaaaaaaaah-!! Wujud %s!! +729: Tidat dapat berubah menjadi monster ketika sedang disguise. +730: Karakter tidak dapat disguise ketika sedang berwujud monster. +731: Perubahan menjadi monster tidak diizinkan dalam Guild Wars. + +//732-899 kosong //------------------------------------ // Pesan dalam perintah atcommand @@ -1552,11 +1564,5 @@ 1495: Kamu tidak dapat mengambil uang sebanyak itu. 1496: Fitur banking tidak sedang aktif. -// Monster Transformation -1497: Berubaaaaaaaaaah-!! Wujud %s!! -1498: Tidat dapat berubah menjadi monster ketika sedang disguise. -1499: Karakter tidak dapat disguise ketika sedang berwujud monster. -1500: Perubahan menjadi monster tidak diizinkan dalam Guild Wars. - //Bila ada terjemahan lain //import: conf/msg_conf/import/map_msg_idn_conf.txt diff --git a/src/common/msg_conf.c b/src/common/msg_conf.c index c4fc8ea970..0cd5337ffe 100644 --- a/src/common/msg_conf.c +++ b/src/common/msg_conf.c @@ -25,8 +25,8 @@ const char* _msg_txt(int msg_number,int size, char ** msg_table) */ int _msg_config_read(const char* cfgName,int size, char ** msg_table) { - int msg_number; - char line[1024], w1[1024], w2[1024]; + uint16 msg_number, msg_count = 0, line_num = 0; + char line[1024], w1[8], w2[512]; FILE *fp; static int called = 1; @@ -39,9 +39,10 @@ int _msg_config_read(const char* cfgName,int size, char ** msg_table) memset(msg_table, 0, sizeof (msg_table[0]) * size); while (fgets(line, sizeof (line), fp)) { + line_num++; if (line[0] == '/' && line[1] == '/') continue; - if (sscanf(line, "%[^:]: %[^\r\n]", w1, w2) != 2) + if (sscanf(line, "%7[^:]: %511[^\r\n]", w1, w2) != 2) continue; if (strcmpi(w1, "import") == 0) @@ -53,12 +54,15 @@ int _msg_config_read(const char* cfgName,int size, char ** msg_table) aFree(msg_table[msg_number]); msg_table[msg_number] = (char *) aMalloc((strlen(w2) + 1) * sizeof (char)); strcpy(msg_table[msg_number], w2); + msg_count++; } + else + ShowWarning("Invalid message ID '%s' at line %d from '%s' file.\n",w1,line_num,cfgName); } } fclose(fp); - ShowInfo("Finished reading %s.\n",cfgName); + ShowInfo("Done reading "CL_WHITE"'%d'"CL_RESET" messages in "CL_WHITE"'%s'"CL_RESET".\n",msg_count,cfgName); return 0; } diff --git a/src/map/atcommand.c b/src/map/atcommand.c index afb58d6df2..362b25ebcf 100644 --- a/src/map/atcommand.c +++ b/src/map/atcommand.c @@ -4835,7 +4835,7 @@ ACMD_FUNC(disguise) } if (sd->sc.data[SC_MONSTER_TRANSFORM]) { - clif_displaymessage(fd, msg_txt(sd,1499)); // Character cannot be disguised while in monster transform. + clif_displaymessage(fd, msg_txt(sd,730)); // Character cannot be disguised while in monster transform. return -1; } @@ -9417,16 +9417,16 @@ ACMD_FUNC(costume) { if( !message || !*message ) { for( k = 0; k < len; k++ ) { if( sd->sc.data[name2id[k]] ) { - sprintf(atcmd_output, msg_txt(sd, 1505), names[k]); // Costume '%s' removed. + sprintf(atcmd_output, msg_txt(sd, 727), names[k]); // '%s' Costume removed. clif_displaymessage(sd->fd, atcmd_output); status_change_end(&sd->bl, (sc_type)name2id[k], INVALID_TIMER); return 0; } } - clif_displaymessage(sd->fd, msg_txt(sd, 1504)); // Available Costumes + clif_displaymessage(sd->fd, msg_txt(sd, 726)); // Available Costumes for( k = 0; k < len; k++ ) { - sprintf(atcmd_output, msg_txt(sd, 1503), names[k]); // -- %s + sprintf(atcmd_output, msg_txt(sd, 725), names[k]); // -- %s clif_displaymessage(sd->fd, atcmd_output); } return -1; @@ -9434,7 +9434,7 @@ ACMD_FUNC(costume) { for( k = 0; k < len; k++ ) { if( sd->sc.data[name2id[k]] ) { - sprintf(atcmd_output, msg_txt(sd, 1502), names[k]); // You're already with a '%s' costume, type '@costume' to remove it. + sprintf(atcmd_output, msg_txt(sd, 724), names[k]); // You're already wearing a(n) '%s' costume, type '@costume' to remove it. clif_displaymessage(sd->fd, atcmd_output); return -1; } @@ -9445,7 +9445,7 @@ ACMD_FUNC(costume) { break; if( k == len ) { - sprintf(atcmd_output, msg_txt(sd, 1501), message); // '%s' is not a known costume + sprintf(atcmd_output, msg_txt(sd, 723), message); // '%s' is an unknown costume clif_displaymessage(sd->fd, atcmd_output); return -1; } diff --git a/src/map/clif.c b/src/map/clif.c index 2197d9bafb..dff6ac3292 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -9775,7 +9775,7 @@ void clif_parse_LoadEndAck(int fd,struct map_session_data *sd) if (sd->sc.data[SC_MONSTER_TRANSFORM] && battle_config.mon_trans_disable_in_gvg && map_flag_gvg2(sd->bl.m)) { status_change_end(&sd->bl, SC_MONSTER_TRANSFORM, INVALID_TIMER); - clif_displaymessage(sd->fd, msg_txt(sd,1500)); // Transforming into monster is not allowed in Guild Wars. + clif_displaymessage(sd->fd, msg_txt(sd,731)); // Transforming into monster is not allowed in Guild Wars. } clif_weather_check(sd); diff --git a/src/map/map.c b/src/map/map.c index 03ee9f30c1..b3d436fd74 100644 --- a/src/map/map.c +++ b/src/map/map.c @@ -116,7 +116,7 @@ static int block_free_count = 0, block_free_lock = 0; static struct block_list *bl_list[BL_LIST_MAX]; static int bl_list_count = 0; -#define MAP_MAX_MSG 1600 +#define MAP_MAX_MSG 1500 struct map_data map[MAX_MAP_PER_SERVER]; int map_num = 0; diff --git a/src/map/script.c b/src/map/script.c index 9261665d55..c171fcbde5 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -18631,16 +18631,16 @@ BUILDIN_FUNC(montransform) { struct mob_db *monster = mob_db(mob_id); if (battle_config.mon_trans_disable_in_gvg && map_flag_gvg2(sd->bl.m)) { - clif_displaymessage(sd->fd, msg_txt(sd,1500)); // Transforming into monster is not allowed in Guild Wars. + clif_displaymessage(sd->fd, msg_txt(sd,731)); // Transforming into monster is not allowed in Guild Wars. return SCRIPT_CMD_FAILURE; } if (sd->disguise){ - clif_displaymessage(sd->fd, msg_txt(sd,1498)); // Cannot transform into monster while in disguise. + clif_displaymessage(sd->fd, msg_txt(sd,729)); // Cannot transform into monster while in disguise. return SCRIPT_CMD_FAILURE; } - sprintf(msg, msg_txt(sd,1497), monster->name); // Traaaansformation-!! %s form!! + sprintf(msg, msg_txt(sd,728), monster->name); // Traaaansformation-!! %s form!! clif_disp_overhead(&sd->bl, msg); status_change_end(&sd->bl, SC_MONSTER_TRANSFORM, INVALID_TIMER); // Clear previous sc_start2(NULL, &sd->bl, SC_MONSTER_TRANSFORM, 100, mob_id, type, tick);