# This patch file was generated by NetBeans IDE # Following Index: paths are relative to: /home/lighta/Documents/Myscript/RO/Servs/rathena # This patch can be applied using context Tools: Patch action on respective folder. # It uses platform neutral UTF-8 encoding and \n newlines. # Above lines and this line are ignored by the patching process. Index: conf/msg_athena.conf --- conf/msg_athena.conf Base (BASE) +++ conf/msg_athena.conf Locally Modified (Based On LOCAL) @@ -463,9 +463,13 @@ 508: This player hasn't been banned (Ban option is disabled). //509 Available.... -// mail system +// mail system /auction //---------------------- 510: You have %d new emails (%d unread) +520: Thanks, you won the auction!. +521: Payment for your auction!. +522: No buyers have been found for your auction. +523: Auction Manager // Bot detect messages (currently unused) 535: Possible use of BOT (99%% of chance) or modified client by '%s' (account: %d, char_id: %d). This player ask your name when you are hidden. Index: src/char/char.c --- src/char/char.c Base (BASE) +++ src/char/char.c Locally Modified (Based On LOCAL) Index: src/char/char.h --- src/char/char.h Base (BASE) +++ src/char/char.h Locally Modified (Based On LOCAL) @@ -6,6 +6,7 @@ #include "../config/core.h" #include "../common/core.h" // CORE_ST_LAST +#include "../common/msg_conf.h" enum E_CHARSERVER_ST { Index: src/char/int_auction.c --- src/char/int_auction.c Base (BASE) +++ src/char/int_auction.c Locally Modified (Based On LOCAL) @@ -145,12 +145,12 @@ { if( auction->buyer_id ) { - mail_sendmail(0, "Auction Manager", auction->buyer_id, auction->buyer_name, "Auction", "Thanks, you won the auction!.", 0, &auction->item); + mail_sendmail(0, msg_txt(523), auction->buyer_id, auction->buyer_name, "Auction", msg_txt(520), 0, &auction->item); mapif_Auction_message(auction->buyer_id, 6); // You have won the auction - mail_sendmail(0, "Auction Manager", auction->seller_id, auction->seller_name, "Auction", "Payment for your auction!.", auction->price, NULL); + mail_sendmail(0, msg_txt(523), auction->seller_id, auction->seller_name, "Auction", msg_txt(521), auction->price, NULL); } else - mail_sendmail(0, "Auction Manager", auction->seller_id, auction->seller_name, "Auction", "No buyers have been found for your auction.", 0, &auction->item); + mail_sendmail(0, msg_txt(523), auction->seller_id, auction->seller_name, "Auction", msg_txt(522), 0, &auction->item); ShowInfo("Auction End: id %u.\n", auction->auction_id); Index: src/char/inter.c --- src/char/inter.c Base (BASE) +++ src/char/inter.c Locally Modified (Based On LOCAL) @@ -8,6 +8,7 @@ #include "../common/showmsg.h" #include "../common/socket.h" #include "../common/timer.h" +#include "../common/conf.h" #include "char.h" #include "inter.h" #include "int_party.h" @@ -67,70 +68,6 @@ static DBMap* wis_db = NULL; // int wis_id -> struct WisData* static int wis_dellist[WISDELLIST_MAX], wis_delnum; -#define MAX_JOB_NAMES 106 -static char* msg_table[MAX_JOB_NAMES]; // messages 550 ~ 655 are job names - -const char* msg_txt(int msg_number) { - msg_number -= 550; - if (msg_number >= 0 && msg_number < MAX_JOB_NAMES && - msg_table[msg_number] != NULL && msg_table[msg_number][0] != '\0') - return msg_table[msg_number]; - - return "Unknown"; -} - -/*========================================== - * Read Message Data -- at char server we only keep job names. - *------------------------------------------*/ -int msg_config_read(const char* cfgName) { - int msg_number; - char line[1024], w1[1024], w2[1024]; - FILE *fp; - static int called = 1; - - if ((fp = fopen(cfgName, "r")) == NULL) { - ShowError("Messages file not found: %s\n", cfgName); - return 1; - } - - if ((--called) == 0) - memset(msg_table, 0, sizeof(msg_table[0]) * MAX_JOB_NAMES); - - while(fgets(line, sizeof(line), fp) ) { - if (line[0] == '/' && line[1] == '/') - continue; - if (sscanf(line, "%[^:]: %[^\r\n]", w1, w2) != 2) - continue; - - if (strcmpi(w1, "import") == 0) - msg_config_read(w2); - else { - msg_number = atoi(w1); - if( msg_number < 550 || msg_number > (550+MAX_JOB_NAMES) ) - continue; - msg_number -= 550; - if (msg_number >= 0 && msg_number < MAX_JOB_NAMES) { - if (msg_table[msg_number] != NULL) - aFree(msg_table[msg_number]); - msg_table[msg_number] = (char *)aMalloc((strlen(w2) + 1)*sizeof (char)); - strcpy(msg_table[msg_number],w2); - } - } - } - - fclose(fp); - - return 0; -} - -/*========================================== - * Cleanup Message Data - *------------------------------------------*/ -void do_final_msg(void) { - int i; - for (i = 0; i < MAX_JOB_NAMES; i++) - aFree(msg_table[i]); -} /* from pc.c due to @accinfo. any ideas to replace this crap are more than welcome. */ const char* job_name(int class_) { switch (class_) { @@ -791,7 +728,6 @@ inter_auction_sql_init(); geoip_readdb(); - msg_config_read("conf/msg_athena.conf"); return 0; } @@ -811,8 +747,6 @@ inter_auction_sql_final(); if (accreg_pt) aFree(accreg_pt); - - do_final_msg(); return; } Index: src/common/Makefile.in --- src/common/Makefile.in Base (BASE) +++ src/common/Makefile.in Locally Modified (Based On LOCAL) @@ -3,7 +3,8 @@ obj_all/nullpo.o obj_all/malloc.o obj_all/showmsg.o obj_all/strlib.o obj_all/utils.o \ obj_all/grfio.o obj_all/mapindex.o obj_all/ers.o obj_all/md5calc.o \ obj_all/minicore.o obj_all/minisocket.o obj_all/minimalloc.o obj_all/random.o obj_all/des.o \ - obj_all/conf.o obj_all/thread.o obj_all/mutex.o obj_all/raconf.o obj_all/mempool.o + obj_all/conf.o obj_all/thread.o obj_all/mutex.o obj_all/raconf.o obj_all/mempool.o \ + obj_all/msg_conf.o COMMON_H = $(shell ls ../common/*.h) Index: src/common/conf.c --- src/common/conf.c Base (BASE) +++ src/common/conf.c Locally Modified (Based On LOCAL) @@ -3,8 +3,8 @@ #include "conf.h" #include "libconfig.h" +#include "showmsg.h" // ShowError -#include "../common/showmsg.h" // ShowError int conf_read_file(config_t *config, const char *config_filename) { Index: src/common/conf.h --- src/common/conf.h Base (BASE) +++ src/common/conf.h Locally Modified (Based On LOCAL) @@ -7,6 +7,10 @@ #include "../common/cbasetypes.h" #include "libconfig.h" +const char* msg_txt(int msg_number); +int msg_config_read(const char* cfgName); +void do_final_msg(void); + int conf_read_file(config_t *config, const char *config_filename); int config_setting_copy(config_setting_t *parent, const config_setting_t *src); Index: src/common/core.c --- src/common/core.c Base (BASE) +++ src/common/core.c Locally Modified (Based On LOCAL) @@ -1,17 +1,19 @@ // Copyright (c) Athena Dev Teams - Licensed under GNU GPL // For more information, see LICENCE in the main folder -#include "../common/mmo.h" -#include "../common/showmsg.h" -#include "../common/malloc.h" +#include "mmo.h" +#include "showmsg.h" +#include "malloc.h" #include "core.h" +#include "msg_conf.h" + #ifndef MINICORE -#include "../common/db.h" -#include "../common/socket.h" -#include "../common/timer.h" -#include "../common/thread.h" -#include "../common/mempool.h" -#include "../common/sql.h" + #include "db.h" + #include "socket.h" + #include "timer.h" + #include "thread.h" + #include "mempool.h" + #include "sql.h" #endif #include @@ -324,6 +326,7 @@ mempool_init(); db_init(); signals_init(); + msg_config_read("conf/msg_athena.conf"); #ifdef _WIN32 cevents_init(); @@ -341,8 +344,8 @@ do_sockets(next); } } - do_final(); + do_final_msg(); timer_final(); socket_final(); Index: src/common/msg_conf.c --- src/common/msg_conf.c No Base Revision +++ src/common/msg_conf.c Locally New @@ -0,0 +1,78 @@ +#include +#include +#include + +#include "malloc.h" +#include "msg_conf.h" +#include "showmsg.h" + +#define MAX_MSG 1500 + +static char* msg_table[MAX_MSG]; // Server messages (0-499 reserved for GM commands, 500-999 reserved for others) + +//----------------------------------------------------------- +// Return the message string of the specified number by [Yor] +//----------------------------------------------------------- +const char* msg_txt(int msg_number) +{ + if (msg_number >= 0 && msg_number < MAX_MSG && + msg_table[msg_number] != NULL && msg_table[msg_number][0] != '\0') + return msg_table[msg_number]; + + return "??"; +} + +/*========================================== + * Read Message Data + *------------------------------------------*/ +int msg_config_read(const char* cfgName) +{ + int msg_number; + char line[1024], w1[1024], w2[1024]; + FILE *fp; + static int called = 1; + + if ((fp = fopen(cfgName, "r")) == NULL) { + ShowError("Messages file not found: %s\n", cfgName); + return 1; + } + + if ((--called) == 0) + memset(msg_table, 0, sizeof(msg_table[0]) * MAX_MSG); + + while(fgets(line, sizeof(line), fp)) + { + if (line[0] == '/' && line[1] == '/') + continue; + if (sscanf(line, "%[^:]: %[^\r\n]", w1, w2) != 2) + continue; + + if (strcmpi(w1, "import") == 0) + msg_config_read(w2); + else + { + msg_number = atoi(w1); + if (msg_number >= 0 && msg_number < MAX_MSG) + { + if (msg_table[msg_number] != NULL) + aFree(msg_table[msg_number]); + msg_table[msg_number] = (char *)aMalloc((strlen(w2) + 1)*sizeof (char)); + strcpy(msg_table[msg_number],w2); + } + } + } + + fclose(fp); + + return 0; +} + +/*========================================== + * Cleanup Message Data + *------------------------------------------*/ +void do_final_msg(void) +{ + int i; + for (i = 0; i < MAX_MSG; i++) + aFree(msg_table[i]); +} Index: src/common/msg_conf.h --- src/common/msg_conf.h No Base Revision +++ src/common/msg_conf.h Locally New @@ -0,0 +1,20 @@ +// Copyright (c) Athena Dev Teams - Licensed under GNU GPL +// For more information, see LICENCE in the main folder + +#ifndef MSG_CONF_H +#define MSG_CONF_H + +#ifdef __cplusplus +extern "C" { +#endif + +const char* msg_txt(int msg_number); +int msg_config_read(const char* cfgName); +void do_final_msg(void); + +#ifdef __cplusplus +} +#endif + +#endif /* MSG_CONF_H */ + Index: src/map/atcommand.c --- src/map/atcommand.c Base (BASE) +++ src/map/atcommand.c Locally Modified (Based On LOCAL) @@ -52,9 +52,7 @@ #define ATCOMMAND_LENGTH 50 #define ACMD_FUNC(x) static int atcommand_ ## x (const int fd, struct map_session_data* sd, const char* command, const char* message) -#define MAX_MSG 1500 - typedef struct AtCommandInfo AtCommandInfo; typedef struct AliasInfo AliasInfo; @@ -76,7 +74,6 @@ char atcommand_symbol = '@'; // first char of the commands char charcommand_symbol = '#'; -static char* msg_table[MAX_MSG]; // Server messages (0-499 reserved for GM commands, 500-999 reserved for others) static DBMap* atcommand_db = NULL; //name -> AtCommandInfo static DBMap* atcommand_alias_db = NULL; //alias -> AtCommandInfo static config_t atcommand_config; @@ -100,73 +97,6 @@ return ( i < atcmd_binding_count ) ? atcmd_binding[i] : NULL; } -//----------------------------------------------------------- -// Return the message string of the specified number by [Yor] -//----------------------------------------------------------- -const char* msg_txt(int msg_number) -{ - if (msg_number >= 0 && msg_number < MAX_MSG && - msg_table[msg_number] != NULL && msg_table[msg_number][0] != '\0') - return msg_table[msg_number]; - - return "??"; -} - -/*========================================== - * Read Message Data - *------------------------------------------*/ -int msg_config_read(const char* cfgName) -{ - int msg_number; - char line[1024], w1[1024], w2[1024]; - FILE *fp; - static int called = 1; - - if ((fp = fopen(cfgName, "r")) == NULL) { - ShowError("Messages file not found: %s\n", cfgName); - return 1; - } - - if ((--called) == 0) - memset(msg_table, 0, sizeof(msg_table[0]) * MAX_MSG); - - while(fgets(line, sizeof(line), fp)) - { - if (line[0] == '/' && line[1] == '/') - continue; - if (sscanf(line, "%[^:]: %[^\r\n]", w1, w2) != 2) - continue; - - if (strcmpi(w1, "import") == 0) - msg_config_read(w2); - else - { - msg_number = atoi(w1); - if (msg_number >= 0 && msg_number < MAX_MSG) - { - if (msg_table[msg_number] != NULL) - aFree(msg_table[msg_number]); - msg_table[msg_number] = (char *)aMalloc((strlen(w2) + 1)*sizeof (char)); - strcpy(msg_table[msg_number],w2); - } - } - } - - fclose(fp); - - return 0; -} - -/*========================================== - * Cleanup Message Data - *------------------------------------------*/ -void do_final_msg(void) -{ - int i; - for (i = 0; i < MAX_MSG; i++) - aFree(msg_table[i]); -} - /** * retrieves the help string associated with a given command. * Index: src/map/atcommand.h --- src/map/atcommand.h Base (BASE) +++ src/map/atcommand.h Locally Modified (Based On LOCAL) @@ -30,10 +30,6 @@ 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); - extern int atcmd_binding_count; // @commands (script based) Index: src/map/map.c --- src/map/map.c Base (BASE) +++ src/map/map.c Locally Modified (Based On LOCAL) @@ -3594,7 +3594,6 @@ do_final_pc(); do_final_pet(); do_final_mob(); - do_final_msg(); do_final_skill(); do_final_status(); do_final_unit(); @@ -3873,7 +3872,7 @@ } battle_config_read(BATTLE_CONF_FILENAME); - msg_config_read(MSG_CONF_NAME); + script_config_read(SCRIPT_CONF_NAME); inter_config_read(INTER_CONF_NAME); log_config_read(LOG_CONF_NAME); Index: src/map/map.h --- src/map/map.h Base (BASE) +++ src/map/map.h Locally Modified (Based On LOCAL) @@ -9,6 +9,7 @@ #include "../common/mmo.h" #include "../common/mapindex.h" #include "../common/db.h" +#include "../common/msg_conf.h" /** * [rAthena.org] //Walk intervals at which chase-skills are attempted to be triggered. Index: tools/config.pl --- tools/config.pl Base (BASE) +++ tools/config.pl Locally Modified (Based On LOCAL) @@ -2,6 +2,9 @@ # config script by lighta #TODO list : #- don't always override import/file, sed grep ? +#- auto apply updates .sql check version main, log +#- auto enable coredump +#- auto enable backup \ No newline at end of file use CPAN; use strict;