-Remove duplication of msg_txt() handlers in char::inter and map::atcommand, transfert it to common::msg_conf
-Add a msg_table for login server to be able to have his own configured message, (not in source) -Split msg_athena.conf file into msg_conf/login_msg.conf, msg_conf/map_msg.conf and msg_conf/char_msg.conf, thus allowing more flexibility wich all table and not have to wory about range and offset for shared index... => that was too annoying and same ram requirement.. --nb you still can do import to override those files -Add msg-config argv options for char and login serv --Fix bugreport:5440 as exemple of new possibility (for char) --Changed auth_fail_login hardcoded logged message to configured with msg_txt, as exemple2 (for login) -Rever athena-start unwanted commit change on r17152 git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@17153 54d463be-8e91-2dee-dedb-b68131a5f0ec
This commit is contained in:
parent
704a4f8108
commit
c0e5e26264
@ -43,11 +43,9 @@ case $1 in
|
||||
'start')
|
||||
print_start
|
||||
check_files
|
||||
if [ -e .${L_SRV}.pid ] && [ -z $(cat .${L_SRV}.pid)] && [$(ps ax | grep $(cat .${L_SRV}.pid)) eq =~ /${L_SRV}/ ]; then
|
||||
else
|
||||
exec ./${L_SRV}&
|
||||
echo $! > .${L_SRV}.pid
|
||||
fi
|
||||
|
||||
exec ./${L_SRV}&
|
||||
echo $! > .${L_SRV}.pid
|
||||
exec ./${C_SRV}&
|
||||
echo $! > .${C_SRV}.pid
|
||||
exec ./${M_SRV}&
|
||||
|
129
conf/msg_conf/char_msg.conf
Normal file
129
conf/msg_conf/char_msg.conf
Normal file
@ -0,0 +1,129 @@
|
||||
// rAthena msg_athena.conf
|
||||
// Message Configuration of char-server
|
||||
// -----------------------
|
||||
0: Novice
|
||||
1: Swordsman
|
||||
2: Magician
|
||||
3: Archer
|
||||
4: Acolyte
|
||||
5: Merchant
|
||||
6: Thief
|
||||
7: Knight
|
||||
8: Priest
|
||||
9: Wizard
|
||||
10: Blacksmith
|
||||
11: Hunter
|
||||
12: Assassin
|
||||
13: Crusader
|
||||
14: Monk
|
||||
15: Sage
|
||||
16: Rogue
|
||||
17: Alchemist
|
||||
18: Bard
|
||||
19: Dancer
|
||||
20: Wedding
|
||||
21: Super Novice
|
||||
22: Gunslinger
|
||||
23: Ninja
|
||||
24: Christmas
|
||||
25: High Novice
|
||||
26: High Swordsman
|
||||
27: High Magician
|
||||
28: High Archer
|
||||
29: High Acolyte
|
||||
30: High Merchant
|
||||
31: High Thief
|
||||
32: Lord Knight
|
||||
33: High Priest
|
||||
34: High Wizard
|
||||
35: Whitesmith
|
||||
//35: Mastersmith //IRO name
|
||||
36: Sniper
|
||||
37: Assassin Cross
|
||||
38: Paladin
|
||||
39: Champion
|
||||
40: Professor
|
||||
//40: Scholar //IRO name
|
||||
41: Stalker
|
||||
42: Creator
|
||||
//42: Biochemist //IRO Name
|
||||
43: Clown
|
||||
//43: Minstrel //IRO Name
|
||||
44: Gypsy
|
||||
45: Baby Novice
|
||||
46: Baby Swordsman
|
||||
47: Baby Magician
|
||||
48: Baby Archer
|
||||
49: Baby Acolyte
|
||||
50: Baby Merchant
|
||||
51: Baby Thief
|
||||
52: Baby Knight
|
||||
53: Baby Priest
|
||||
54: Baby Wizard
|
||||
55: Baby Blacksmith
|
||||
56: Baby Hunter
|
||||
57: Baby Assassin
|
||||
58: Baby Crusader
|
||||
59: Baby Monk
|
||||
60: Baby Sage
|
||||
61: Baby Rogue
|
||||
62: Baby Alchemist
|
||||
63: Baby Bard
|
||||
64: Baby Dancer
|
||||
65: Super Baby
|
||||
66: Taekwon
|
||||
67: Star Gladiator
|
||||
68: Soul Linker
|
||||
//79: FREE
|
||||
//70: FREE
|
||||
71: Summer
|
||||
72: Gangsi
|
||||
73: Death Knight
|
||||
74: Dark Collector
|
||||
75: Rune Knight
|
||||
76: Warlock
|
||||
77: Ranger
|
||||
78: Arch Bishop
|
||||
79: Mechanic
|
||||
80: Guillotine Cross
|
||||
81: Royal Guard
|
||||
82: Sorcerer
|
||||
83: Minstrel
|
||||
//83: Maestro //IRO Name
|
||||
84: Wanderer
|
||||
85: Sura
|
||||
86: Genetic
|
||||
//86: Geneticist //IRO Name
|
||||
87: Shadow Chaser
|
||||
88: Baby Rune Knight
|
||||
89: Baby Warlock
|
||||
90: Baby Ranger
|
||||
91: Baby Arch Bishop
|
||||
92: Baby Mechanic
|
||||
93: Baby Guillotine Cross
|
||||
94: Baby Royal Guard
|
||||
95: Baby Sorcerer
|
||||
96: Baby Minstrel
|
||||
97: Baby Wanderer
|
||||
98: Baby Sura
|
||||
99: Baby Genetic
|
||||
100: Baby Shadow Chaser
|
||||
101: Expanded Super Novice
|
||||
102: Expanded Super Baby
|
||||
103: Kagerou
|
||||
104: Oboro
|
||||
105: Unknown Job
|
||||
|
||||
//Auction
|
||||
200: Auction Manager
|
||||
201: Auction
|
||||
202: Thanks, you won the auction!.
|
||||
203: Payment for your auction!.
|
||||
204: No buyers have been found for your auction.
|
||||
205: Auction canceled.
|
||||
206: Auction closed.
|
||||
207: Auction winner.
|
||||
208: Someone has placed a higher bid.
|
||||
209: You have placed a higher bid.
|
||||
210: You have won the auction.
|
||||
211: Payment for your auction!.
|
26
conf/msg_conf/login_msg.conf
Normal file
26
conf/msg_conf/login_msg.conf
Normal file
@ -0,0 +1,26 @@
|
||||
// rAthena msg_athena.conf
|
||||
// Message Configuration of login-server
|
||||
// -----------------------
|
||||
0: Unregistered ID.
|
||||
1: Incorrect Password.
|
||||
2: Account Expired.
|
||||
3: Rejected from server.
|
||||
4: Blocked by GM.
|
||||
5: Not latest game EXE.
|
||||
6: Banned.
|
||||
7: Server Over-population.
|
||||
8: Account limit from company
|
||||
9: Ban by DBA
|
||||
10: Email not confirmed
|
||||
11: Ban by GM
|
||||
12: Working in DB
|
||||
13: Self Lock
|
||||
14: Not Permitted Group
|
||||
15: Not Permitted Group
|
||||
16: Account gone.
|
||||
17: Login info remains.
|
||||
18: Hacking investigation.
|
||||
19: Bug investigation.
|
||||
20: Deleting char.
|
||||
21: Deleting spouse char.
|
||||
22: Unknown Error.
|
@ -30,6 +30,9 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#define CHAR_MAX_MSG 200
|
||||
static char* msg_table[CHAR_MAX_MSG]; // Login Server messages_conf
|
||||
|
||||
char char_db[256] = "char";
|
||||
char scdata_db[256] = "sc_data";
|
||||
char cart_db[256] = "cart_inventory";
|
||||
@ -4697,6 +4700,7 @@ void do_final(void)
|
||||
|
||||
flush_fifos();
|
||||
|
||||
do_final_msg();
|
||||
do_final_mapif();
|
||||
do_final_loginif();
|
||||
|
||||
@ -4760,9 +4764,11 @@ int do_init(int argc, char **argv)
|
||||
CHAR_CONF_NAME = "conf/char_athena.conf";
|
||||
LAN_CONF_NAME = "conf/subnet_athena.conf";
|
||||
SQL_CONF_NAME = "conf/inter_athena.conf";
|
||||
MSG_CONF_NAME = "conf/msg_conf/char_msg.conf";
|
||||
|
||||
cli_get_options(argc,argv);
|
||||
|
||||
msg_config_read(MSG_CONF_NAME);
|
||||
char_config_read(CHAR_CONF_NAME);
|
||||
char_lan_config_read(LAN_CONF_NAME);
|
||||
sql_config_read(SQL_CONF_NAME);
|
||||
@ -4848,6 +4854,17 @@ int do_init(int argc, char **argv)
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int char_msg_config_read(char *cfgName){
|
||||
return _msg_config_read(cfgName,CHAR_MAX_MSG,msg_table);
|
||||
}
|
||||
const char* char_msg_txt(int msg_number){
|
||||
return _msg_txt(msg_number,CHAR_MAX_MSG,msg_table);
|
||||
}
|
||||
void char_do_final_msg(void){
|
||||
return _do_final_msg(CHAR_MAX_MSG,msg_table);
|
||||
}
|
||||
|
||||
/*======================================================
|
||||
* Login-Server help option info
|
||||
*------------------------------------------------------*/
|
||||
@ -4862,6 +4879,7 @@ void display_helpscreen(bool do_exit)
|
||||
ShowInfo(" --char-config <file>\t\tAlternative char-server configuration.\n");
|
||||
ShowInfo(" --lan-config <file>\t\tAlternative lag configuration.\n");
|
||||
ShowInfo(" --inter-config <file>\t\tAlternative inter-server configuration.\n");
|
||||
ShowInfo(" --msg-config <file>\t\tAlternative message configuration.\n");
|
||||
if( do_exit )
|
||||
exit(EXIT_SUCCESS);
|
||||
}
|
@ -6,6 +6,7 @@
|
||||
|
||||
#include "../config/core.h"
|
||||
#include "../common/core.h" // CORE_ST_LAST
|
||||
#include "../common/msg_conf.h"
|
||||
|
||||
enum E_CHARSERVER_ST
|
||||
{
|
||||
@ -20,6 +21,13 @@ struct mmo_charstatus;
|
||||
|
||||
#define DEFAULT_AUTOSAVE_INTERVAL 300*1000
|
||||
|
||||
#define msg_config_read(cfgName) char_msg_config_read(cfgName)
|
||||
#define msg_txt(msg_number) char_msg_txt(msg_number)
|
||||
#define do_final_msg() char_do_final_msg()
|
||||
int char_msg_config_read(char *cfgName);
|
||||
const char* char_msg_txt(int msg_number);
|
||||
void char_do_final_msg(void);
|
||||
|
||||
enum {
|
||||
TABLE_INVENTORY,
|
||||
TABLE_CART,
|
||||
|
@ -89,7 +89,7 @@ unsigned int auction_create(struct auction_data *auction)
|
||||
for( j = 0; j < MAX_SLOTS; j++ )
|
||||
StringBuf_Printf(&buf, ",'%d'", auction->item.card[j]);
|
||||
StringBuf_AppendStr(&buf, ")");
|
||||
|
||||
|
||||
//Unique Non Stackable Item ID
|
||||
updateLastUid(auction->item.unique_id);
|
||||
dbUpdateUid(sql_handle);
|
||||
@ -131,7 +131,7 @@ unsigned int auction_create(struct auction_data *auction)
|
||||
static void mapif_Auction_message(int char_id, unsigned char result)
|
||||
{
|
||||
unsigned char buf[74];
|
||||
|
||||
|
||||
WBUFW(buf,0) = 0x3854;
|
||||
WBUFL(buf,2) = char_id;
|
||||
WBUFL(buf,6) = result;
|
||||
@ -145,13 +145,13 @@ static int auction_end_timer(int tid, unsigned int tick, int id, intptr_t data)
|
||||
{
|
||||
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(200), auction->buyer_id, auction->buyer_name, msg_txt(201), msg_txt(202), 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(200), auction->seller_id, auction->seller_name, msg_txt(201), msg_txt(203), 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(200), auction->seller_id, auction->seller_name, msg_txt(201), msg_txt(204), 0, &auction->item);
|
||||
|
||||
ShowInfo("Auction End: id %u.\n", auction->auction_id);
|
||||
|
||||
auction->auction_end_timer = INVALID_TIMER;
|
||||
@ -269,7 +269,7 @@ static void mapif_parse_Auction_requestlist(int fd)
|
||||
|
||||
for( auction = dbi_first(iter); dbi_exists(iter); auction = dbi_next(iter) )
|
||||
{
|
||||
if( (type == 0 && auction->type != IT_ARMOR && auction->type != IT_PETARMOR) ||
|
||||
if( (type == 0 && auction->type != IT_ARMOR && auction->type != IT_PETARMOR) ||
|
||||
(type == 1 && auction->type != IT_WEAPON) ||
|
||||
(type == 2 && auction->type != IT_CARD) ||
|
||||
(type == 3 && auction->type != IT_ETC) ||
|
||||
@ -353,7 +353,7 @@ static void mapif_parse_Auction_cancel(int fd)
|
||||
return;
|
||||
}
|
||||
|
||||
mail_sendmail(0, "Auction Manager", auction->seller_id, auction->seller_name, "Auction", "Auction canceled.", 0, &auction->item);
|
||||
mail_sendmail(0, msg_txt(200), auction->seller_id, auction->seller_name, msg_txt(201), msg_txt(205), 0, &auction->item);
|
||||
auction_delete(auction);
|
||||
|
||||
mapif_Auction_cancel(fd, char_id, 0); // The auction has been canceled
|
||||
@ -392,9 +392,9 @@ static void mapif_parse_Auction_close(int fd)
|
||||
}
|
||||
|
||||
// Send Money to Seller
|
||||
mail_sendmail(0, "Auction Manager", auction->seller_id, auction->seller_name, "Auction", "Auction closed.", auction->price, NULL);
|
||||
mail_sendmail(0, msg_txt(200), auction->seller_id, auction->seller_name, msg_txt(201), msg_txt(206), auction->price, NULL);
|
||||
// Send Item to Buyer
|
||||
mail_sendmail(0, "Auction Manager", auction->buyer_id, auction->buyer_name, "Auction", "Auction winner.", 0, &auction->item);
|
||||
mail_sendmail(0, msg_txt(200), auction->buyer_id, auction->buyer_name, msg_txt(201), msg_txt(207), 0, &auction->item);
|
||||
mapif_Auction_message(auction->buyer_id, 6); // You have won the auction
|
||||
auction_delete(auction);
|
||||
|
||||
@ -433,11 +433,11 @@ static void mapif_parse_Auction_bid(int fd)
|
||||
{ // Send Money back to the previous Buyer
|
||||
if( auction->buyer_id != char_id )
|
||||
{
|
||||
mail_sendmail(0, "Auction Manager", auction->buyer_id, auction->buyer_name, "Auction", "Someone has placed a higher bid.", auction->price, NULL);
|
||||
mail_sendmail(0, msg_txt(200), auction->buyer_id, auction->buyer_name, msg_txt(201), msg_txt(208), auction->price, NULL);
|
||||
mapif_Auction_message(auction->buyer_id, 7); // You have failed to win the auction
|
||||
}
|
||||
else
|
||||
mail_sendmail(0, "Auction Manager", auction->buyer_id, auction->buyer_name, "Auction", "You have placed a higher bid.", auction->price, NULL);
|
||||
mail_sendmail(0, msg_txt(200), auction->buyer_id, auction->buyer_name, msg_txt(201), msg_txt(209), auction->price, NULL);
|
||||
}
|
||||
|
||||
auction->buyer_id = char_id;
|
||||
@ -448,9 +448,9 @@ static void mapif_parse_Auction_bid(int fd)
|
||||
{ // Automatic won the auction
|
||||
mapif_Auction_bid(fd, char_id, bid - auction->buynow, 1); // You have successfully bid in the auction
|
||||
|
||||
mail_sendmail(0, "Auction Manager", auction->buyer_id, auction->buyer_name, "Auction", "You have won the auction.", 0, &auction->item);
|
||||
mail_sendmail(0, msg_txt(200), auction->buyer_id, auction->buyer_name, msg_txt(201), msg_txt(210), 0, &auction->item);
|
||||
mapif_Auction_message(char_id, 6); // You have won the auction
|
||||
mail_sendmail(0, "Auction Manager", auction->seller_id, auction->seller_name, "Auction", "Payment for your auction!.", auction->buynow, NULL);
|
||||
mail_sendmail(0, msg_txt(200), auction->seller_id, auction->seller_name, msg_txt(201), msg_txt(211), auction->buynow, NULL);
|
||||
|
||||
auction_delete(auction);
|
||||
return;
|
||||
|
142
src/char/inter.c
142
src/char/inter.c
@ -67,70 +67,6 @@ struct WisData {
|
||||
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_) {
|
||||
@ -141,7 +77,7 @@ const char* job_name(int class_) {
|
||||
case JOB_ACOLYTE:
|
||||
case JOB_MERCHANT:
|
||||
case JOB_THIEF:
|
||||
return msg_txt(550 - JOB_NOVICE+class_);
|
||||
return msg_txt(JOB_NOVICE+class_);
|
||||
|
||||
case JOB_KNIGHT:
|
||||
case JOB_PRIEST:
|
||||
@ -149,10 +85,10 @@ const char* job_name(int class_) {
|
||||
case JOB_BLACKSMITH:
|
||||
case JOB_HUNTER:
|
||||
case JOB_ASSASSIN:
|
||||
return msg_txt(557 - JOB_KNIGHT+class_);
|
||||
return msg_txt(7 - JOB_KNIGHT+class_);
|
||||
|
||||
case JOB_KNIGHT2:
|
||||
return msg_txt(557);
|
||||
return msg_txt(7);
|
||||
|
||||
case JOB_CRUSADER:
|
||||
case JOB_MONK:
|
||||
@ -161,20 +97,20 @@ const char* job_name(int class_) {
|
||||
case JOB_ALCHEMIST:
|
||||
case JOB_BARD:
|
||||
case JOB_DANCER:
|
||||
return msg_txt(563 - JOB_CRUSADER+class_);
|
||||
return msg_txt(13 - JOB_CRUSADER+class_);
|
||||
|
||||
case JOB_CRUSADER2:
|
||||
return msg_txt(563);
|
||||
return msg_txt(13);
|
||||
|
||||
case JOB_WEDDING:
|
||||
case JOB_SUPER_NOVICE:
|
||||
case JOB_GUNSLINGER:
|
||||
case JOB_NINJA:
|
||||
case JOB_XMAS:
|
||||
return msg_txt(570 - JOB_WEDDING+class_);
|
||||
return msg_txt(20 - JOB_WEDDING+class_);
|
||||
|
||||
case JOB_SUMMER:
|
||||
return msg_txt(621);
|
||||
return msg_txt(71);
|
||||
|
||||
case JOB_NOVICE_HIGH:
|
||||
case JOB_SWORDMAN_HIGH:
|
||||
@ -183,7 +119,7 @@ const char* job_name(int class_) {
|
||||
case JOB_ACOLYTE_HIGH:
|
||||
case JOB_MERCHANT_HIGH:
|
||||
case JOB_THIEF_HIGH:
|
||||
return msg_txt(575 - JOB_NOVICE_HIGH+class_);
|
||||
return msg_txt(25 - JOB_NOVICE_HIGH+class_);
|
||||
|
||||
case JOB_LORD_KNIGHT:
|
||||
case JOB_HIGH_PRIEST:
|
||||
@ -191,10 +127,10 @@ const char* job_name(int class_) {
|
||||
case JOB_WHITESMITH:
|
||||
case JOB_SNIPER:
|
||||
case JOB_ASSASSIN_CROSS:
|
||||
return msg_txt(582 - JOB_LORD_KNIGHT+class_);
|
||||
return msg_txt(32 - JOB_LORD_KNIGHT+class_);
|
||||
|
||||
case JOB_LORD_KNIGHT2:
|
||||
return msg_txt(582);
|
||||
return msg_txt(32);
|
||||
|
||||
case JOB_PALADIN:
|
||||
case JOB_CHAMPION:
|
||||
@ -203,10 +139,10 @@ const char* job_name(int class_) {
|
||||
case JOB_CREATOR:
|
||||
case JOB_CLOWN:
|
||||
case JOB_GYPSY:
|
||||
return msg_txt(588 - JOB_PALADIN + class_);
|
||||
return msg_txt(38 - JOB_PALADIN + class_);
|
||||
|
||||
case JOB_PALADIN2:
|
||||
return msg_txt(588);
|
||||
return msg_txt(38);
|
||||
|
||||
case JOB_BABY:
|
||||
case JOB_BABY_SWORDMAN:
|
||||
@ -215,7 +151,7 @@ const char* job_name(int class_) {
|
||||
case JOB_BABY_ACOLYTE:
|
||||
case JOB_BABY_MERCHANT:
|
||||
case JOB_BABY_THIEF:
|
||||
return msg_txt(595 - JOB_BABY + class_);
|
||||
return msg_txt(45 - JOB_BABY + class_);
|
||||
|
||||
case JOB_BABY_KNIGHT:
|
||||
case JOB_BABY_PRIEST:
|
||||
@ -223,10 +159,10 @@ const char* job_name(int class_) {
|
||||
case JOB_BABY_BLACKSMITH:
|
||||
case JOB_BABY_HUNTER:
|
||||
case JOB_BABY_ASSASSIN:
|
||||
return msg_txt(602 - JOB_BABY_KNIGHT + class_);
|
||||
return msg_txt(52 - JOB_BABY_KNIGHT + class_);
|
||||
|
||||
case JOB_BABY_KNIGHT2:
|
||||
return msg_txt(602);
|
||||
return msg_txt(52);
|
||||
|
||||
case JOB_BABY_CRUSADER:
|
||||
case JOB_BABY_MONK:
|
||||
@ -235,26 +171,26 @@ const char* job_name(int class_) {
|
||||
case JOB_BABY_ALCHEMIST:
|
||||
case JOB_BABY_BARD:
|
||||
case JOB_BABY_DANCER:
|
||||
return msg_txt(608 - JOB_BABY_CRUSADER + class_);
|
||||
return msg_txt(58 - JOB_BABY_CRUSADER + class_);
|
||||
|
||||
case JOB_BABY_CRUSADER2:
|
||||
return msg_txt(608);
|
||||
return msg_txt(58);
|
||||
|
||||
case JOB_SUPER_BABY:
|
||||
return msg_txt(615);
|
||||
return msg_txt(65);
|
||||
|
||||
case JOB_TAEKWON:
|
||||
return msg_txt(616);
|
||||
return msg_txt(66);
|
||||
case JOB_STAR_GLADIATOR:
|
||||
case JOB_STAR_GLADIATOR2:
|
||||
return msg_txt(617);
|
||||
return msg_txt(67);
|
||||
case JOB_SOUL_LINKER:
|
||||
return msg_txt(618);
|
||||
return msg_txt(68);
|
||||
|
||||
case JOB_GANGSI:
|
||||
case JOB_DEATH_KNIGHT:
|
||||
case JOB_DARK_COLLECTOR:
|
||||
return msg_txt(622 - JOB_GANGSI+class_);
|
||||
return msg_txt(72 - JOB_GANGSI+class_);
|
||||
|
||||
case JOB_RUNE_KNIGHT:
|
||||
case JOB_WARLOCK:
|
||||
@ -262,7 +198,7 @@ const char* job_name(int class_) {
|
||||
case JOB_ARCH_BISHOP:
|
||||
case JOB_MECHANIC:
|
||||
case JOB_GUILLOTINE_CROSS:
|
||||
return msg_txt(625 - JOB_RUNE_KNIGHT+class_);
|
||||
return msg_txt(75 - JOB_RUNE_KNIGHT+class_);
|
||||
|
||||
case JOB_RUNE_KNIGHT_T:
|
||||
case JOB_WARLOCK_T:
|
||||
@ -270,7 +206,7 @@ const char* job_name(int class_) {
|
||||
case JOB_ARCH_BISHOP_T:
|
||||
case JOB_MECHANIC_T:
|
||||
case JOB_GUILLOTINE_CROSS_T:
|
||||
return msg_txt(625 - JOB_RUNE_KNIGHT_T+class_);
|
||||
return msg_txt(75 - JOB_RUNE_KNIGHT_T+class_);
|
||||
|
||||
case JOB_ROYAL_GUARD:
|
||||
case JOB_SORCERER:
|
||||
@ -279,7 +215,7 @@ const char* job_name(int class_) {
|
||||
case JOB_SURA:
|
||||
case JOB_GENETIC:
|
||||
case JOB_SHADOW_CHASER:
|
||||
return msg_txt(631 - JOB_ROYAL_GUARD+class_);
|
||||
return msg_txt(81 - JOB_ROYAL_GUARD+class_);
|
||||
|
||||
case JOB_ROYAL_GUARD_T:
|
||||
case JOB_SORCERER_T:
|
||||
@ -288,23 +224,23 @@ const char* job_name(int class_) {
|
||||
case JOB_SURA_T:
|
||||
case JOB_GENETIC_T:
|
||||
case JOB_SHADOW_CHASER_T:
|
||||
return msg_txt(631 - JOB_ROYAL_GUARD_T+class_);
|
||||
return msg_txt(81 - JOB_ROYAL_GUARD_T+class_);
|
||||
|
||||
case JOB_RUNE_KNIGHT2:
|
||||
case JOB_RUNE_KNIGHT_T2:
|
||||
return msg_txt(625);
|
||||
return msg_txt(75);
|
||||
|
||||
case JOB_ROYAL_GUARD2:
|
||||
case JOB_ROYAL_GUARD_T2:
|
||||
return msg_txt(631);
|
||||
return msg_txt(81);
|
||||
|
||||
case JOB_RANGER2:
|
||||
case JOB_RANGER_T2:
|
||||
return msg_txt(627);
|
||||
return msg_txt(77);
|
||||
|
||||
case JOB_MECHANIC2:
|
||||
case JOB_MECHANIC_T2:
|
||||
return msg_txt(629);
|
||||
return msg_txt(79);
|
||||
|
||||
case JOB_BABY_RUNE:
|
||||
case JOB_BABY_WARLOCK:
|
||||
@ -319,30 +255,30 @@ const char* job_name(int class_) {
|
||||
case JOB_BABY_SURA:
|
||||
case JOB_BABY_GENETIC:
|
||||
case JOB_BABY_CHASER:
|
||||
return msg_txt(638 - JOB_BABY_RUNE+class_);
|
||||
return msg_txt(88 - JOB_BABY_RUNE+class_);
|
||||
|
||||
case JOB_BABY_RUNE2:
|
||||
return msg_txt(638);
|
||||
return msg_txt(88);
|
||||
|
||||
case JOB_BABY_GUARD2:
|
||||
return msg_txt(644);
|
||||
return msg_txt(94);
|
||||
|
||||
case JOB_BABY_RANGER2:
|
||||
return msg_txt(640);
|
||||
return msg_txt(90);
|
||||
|
||||
case JOB_BABY_MECHANIC2:
|
||||
return msg_txt(642);
|
||||
return msg_txt(92);
|
||||
|
||||
case JOB_SUPER_NOVICE_E:
|
||||
case JOB_SUPER_BABY_E:
|
||||
return msg_txt(651 - JOB_SUPER_NOVICE_E+class_);
|
||||
return msg_txt(101 - JOB_SUPER_NOVICE_E+class_);
|
||||
|
||||
case JOB_KAGEROU:
|
||||
case JOB_OBORO:
|
||||
return msg_txt(653 - JOB_KAGEROU+class_);
|
||||
return msg_txt(103 - JOB_KAGEROU+class_);
|
||||
|
||||
default:
|
||||
return msg_txt(655);
|
||||
return msg_txt(105);
|
||||
}
|
||||
}
|
||||
|
||||
@ -791,7 +727,6 @@ int inter_init_sql(const char *file)
|
||||
inter_auction_sql_init();
|
||||
|
||||
geoip_readdb();
|
||||
msg_config_read("conf/msg_athena.conf");
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -812,7 +747,6 @@ void inter_final(void)
|
||||
|
||||
if (accreg_pt) aFree(accreg_pt);
|
||||
|
||||
do_final_msg();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -81,6 +81,7 @@ set( COMMON_BASE_HEADERS
|
||||
"${COMMON_SOURCE_DIR}/mutex.h"
|
||||
"${COMMON_SOURCE_DIR}/raconf.h"
|
||||
"${COMMON_SOURCE_DIR}/mempool.h"
|
||||
"${COMMON_SOURCE_DIR}/msg_conf.h"
|
||||
"${COMMON_SOURCE_DIR}/cli.h"
|
||||
${LIBCONFIG_HEADERS} # needed by conf.h/showmsg.h
|
||||
CACHE INTERNAL "common_base headers" )
|
||||
@ -105,6 +106,7 @@ set( COMMON_BASE_SOURCES
|
||||
"${COMMON_SOURCE_DIR}/mutex.c"
|
||||
"${COMMON_SOURCE_DIR}/mempool.c"
|
||||
"${COMMON_SOURCE_DIR}/raconf.c"
|
||||
"${COMMON_SOURCE_DIR}/msg_conf.c"
|
||||
"${COMMON_SOURCE_DIR}/cli.c"
|
||||
${LIBCONFIG_SOURCES} # needed by conf.c/showmsg.c
|
||||
CACHE INTERNAL "common_base sources" )
|
||||
|
@ -4,7 +4,7 @@ COMMON_OBJ = obj_all/core.o obj_all/socket.o obj_all/timer.o obj_all/db.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/cli.o
|
||||
obj_all/msg_conf.o obj_all/cli.o
|
||||
|
||||
COMMON_H = $(shell ls ../common/*.h)
|
||||
|
||||
|
@ -62,6 +62,9 @@ int cli_get_options(int argc, char ** argv)
|
||||
display_helpscreen(true);
|
||||
} else if (strcmp(arg, "version") == 0) {
|
||||
display_versionscreen(true);
|
||||
} else if (strcmp(arg, "msg-config") == 0) {
|
||||
if (opt_has_next_value(arg, i, argc))
|
||||
MSG_CONF_NAME = argv[++i];
|
||||
} else if (strcmp(arg, "run-once") == 0) // close the map-server as soon as its done.. for testing [Celest]
|
||||
{
|
||||
runflag = CORE_ST_STOP;
|
||||
@ -111,10 +114,8 @@ int cli_get_options(int argc, char ** argv)
|
||||
} else if (strcmp(arg, "log-config") == 0) {
|
||||
if (opt_has_next_value(arg, i, argc))
|
||||
LOG_CONF_NAME = argv[++i];
|
||||
} else if (strcmp(arg, "msg-config") == 0) {
|
||||
if (opt_has_next_value(arg, i, argc))
|
||||
MSG_CONF_NAME = argv[++i];
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
ShowError("Unknown option '%s'.\n", argv[i]);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
@ -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"
|
||||
#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"
|
||||
#include "cbasetypes.h"
|
||||
#include "msg_conf.h"
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
|
72
src/common/msg_conf.c
Normal file
72
src/common/msg_conf.c
Normal file
@ -0,0 +1,72 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "malloc.h"
|
||||
#include "msg_conf.h"
|
||||
#include "showmsg.h"
|
||||
|
||||
//-----------------------------------------------------------
|
||||
// Return the message string of the specified number by [Yor]
|
||||
//-----------------------------------------------------------
|
||||
|
||||
const char* _msg_txt(int msg_number,int size, char ** msg_table)
|
||||
{
|
||||
if (msg_number >= 0 && msg_number < size &&
|
||||
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 size, char ** msg_table)
|
||||
{
|
||||
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]) * size);
|
||||
|
||||
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,size,msg_table);
|
||||
else {
|
||||
msg_number = atoi(w1);
|
||||
if (msg_number >= 0 && msg_number < size) {
|
||||
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);
|
||||
ShowInfo("Finished reading %s.\n",cfgName);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*==========================================
|
||||
* Cleanup Message Data
|
||||
*------------------------------------------*/
|
||||
void _do_final_msg(int size, char ** msg_table){
|
||||
int i;
|
||||
for (i = 0; i < size; i++)
|
||||
aFree(msg_table[i]);
|
||||
}
|
20
src/common/msg_conf.h
Normal file
20
src/common/msg_conf.h
Normal file
@ -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 size, char ** msg_table);
|
||||
int _msg_config_read(const char* cfgName,int size, char ** msg_table);
|
||||
void _do_final_msg(int size, char ** msg_table);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* MSG_CONF_H */
|
||||
|
@ -10,6 +10,7 @@
|
||||
#include "../common/socket.h"
|
||||
#include "../common/strlib.h"
|
||||
#include "../common/timer.h"
|
||||
#include "../common/msg_conf.h"
|
||||
#include "../common/cli.h"
|
||||
#include "account.h"
|
||||
#include "ipban.h"
|
||||
@ -20,6 +21,8 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#define LOGIN_MAX_MSG 30
|
||||
static char* msg_table[LOGIN_MAX_MSG]; // Login Server messages_conf
|
||||
struct Login_Config login_config;
|
||||
|
||||
int login_fd; // login server socket
|
||||
@ -1239,6 +1242,32 @@ void login_auth_ok(struct login_session_data* sd)
|
||||
}
|
||||
}
|
||||
|
||||
/* Log the result of a failed connection attempt by sd
|
||||
* result: nb (msg define in conf)
|
||||
0 = Unregistered ID
|
||||
1 = Incorrect Password
|
||||
2 = This ID is expired
|
||||
3 = Rejected from Server
|
||||
4 = You have been blocked by the GM Team
|
||||
5 = Your Game's EXE file is not the latest version
|
||||
6 = Your are Prohibited to log in until %s
|
||||
7 = Server is jammed due to over populated
|
||||
8 = No more accounts may be connected from this company
|
||||
9 = MSI_REFUSE_BAN_BY_DBA
|
||||
10 = MSI_REFUSE_EMAIL_NOT_CONFIRMED
|
||||
11 = MSI_REFUSE_BAN_BY_GM
|
||||
12 = MSI_REFUSE_TEMP_BAN_FOR_DBWORK
|
||||
13 = MSI_REFUSE_SELF_LOCK
|
||||
14 = MSI_REFUSE_NOT_PERMITTED_GROUP
|
||||
15 = MSI_REFUSE_NOT_PERMITTED_GROUP
|
||||
99 = This ID has been totally erased
|
||||
100 = Login information remains at %s
|
||||
101 = Account has been locked for a hacking investigation. Please contact the GM Team for more information
|
||||
102 = This account has been temporarily prohibited from login due to a bug-related investigation
|
||||
103 = This character is being deleted. Login is temporarily unavailable for the time being
|
||||
104 = This character is being deleted. Login is temporarily unavailable for the time being
|
||||
default = Unknown Error.
|
||||
*/
|
||||
void login_auth_failed(struct login_session_data* sd, int result)
|
||||
{
|
||||
int fd = sd->fd;
|
||||
@ -1246,34 +1275,12 @@ void login_auth_failed(struct login_session_data* sd, int result)
|
||||
|
||||
if (login_config.log_login)
|
||||
{
|
||||
const char* error;
|
||||
switch( result ) {
|
||||
case 0: error = "Unregistered ID."; break; // 0 = Unregistered ID
|
||||
case 1: error = "Incorrect Password."; break; // 1 = Incorrect Password
|
||||
case 2: error = "Account Expired."; break; // 2 = This ID is expired
|
||||
case 3: error = "Rejected from server."; break; // 3 = Rejected from Server
|
||||
case 4: error = "Blocked by GM."; break; // 4 = You have been blocked by the GM Team
|
||||
case 5: error = "Not latest game EXE."; break; // 5 = Your Game's EXE file is not the latest version
|
||||
case 6: error = "Banned."; break; // 6 = Your are Prohibited to log in until %s
|
||||
case 7: error = "Server Over-population."; break; // 7 = Server is jammed due to over populated
|
||||
case 8: error = "Account limit from company"; break; // 8 = No more accounts may be connected from this company
|
||||
case 9: error = "Ban by DBA"; break; // 9 = MSI_REFUSE_BAN_BY_DBA
|
||||
case 10: error = "Email not confirmed"; break; // 10 = MSI_REFUSE_EMAIL_NOT_CONFIRMED
|
||||
case 11: error = "Ban by GM"; break; // 11 = MSI_REFUSE_BAN_BY_GM
|
||||
case 12: error = "Working in DB"; break; // 12 = MSI_REFUSE_TEMP_BAN_FOR_DBWORK
|
||||
case 13: error = "Self Lock"; break; // 13 = MSI_REFUSE_SELF_LOCK
|
||||
case 14: error = "Not Permitted Group"; break; // 14 = MSI_REFUSE_NOT_PERMITTED_GROUP
|
||||
case 15: error = "Not Permitted Group"; break; // 15 = MSI_REFUSE_NOT_PERMITTED_GROUP
|
||||
case 99: error = "Account gone."; break; // 99 = This ID has been totally erased
|
||||
case 100: error = "Login info remains."; break; // 100 = Login information remains at %s
|
||||
case 101: error = "Hacking investigation."; break; // 101 = Account has been locked for a hacking investigation. Please contact the GM Team for more information
|
||||
case 102: error = "Bug investigation."; break; // 102 = This account has been temporarily prohibited from login due to a bug-related investigation
|
||||
case 103: error = "Deleting char."; break; // 103 = This character is being deleted. Login is temporarily unavailable for the time being
|
||||
case 104: error = "Deleting spouse char."; break; // 104 = This character is being deleted. Login is temporarily unavailable for the time being
|
||||
default : error = "Unknown Error."; break;
|
||||
}
|
||||
|
||||
login_log(ip, sd->userid, result, error);
|
||||
if(result >= 0 && result <= 15)
|
||||
login_log(ip, sd->userid, result, msg_txt(result));
|
||||
else if(result >= 99 && result <= 104)
|
||||
login_log(ip, sd->userid, result, msg_txt(result-83)); //-83 offset
|
||||
else
|
||||
login_log(ip, sd->userid, result, msg_txt(22)); //unknow error
|
||||
}
|
||||
|
||||
if( result == 1 && login_config.dynamic_pass_failure_ban )
|
||||
@ -1745,6 +1752,7 @@ void do_final(void)
|
||||
if( login_config.log_login )
|
||||
loginlog_final();
|
||||
|
||||
do_final_msg();
|
||||
ipban_final();
|
||||
|
||||
for( i = 0; account_engines[i].constructor; ++i )
|
||||
@ -1819,9 +1827,11 @@ int do_init(int argc, char** argv)
|
||||
|
||||
LOGIN_CONF_NAME = "conf/login_athena.conf";
|
||||
LAN_CONF_NAME = "conf/subnet_athena.conf";
|
||||
MSG_CONF_NAME = "conf/msg_conf/login_msg.conf";
|
||||
|
||||
cli_get_options(argc,argv);
|
||||
|
||||
msg_config_read(MSG_CONF_NAME);
|
||||
login_config_read(LOGIN_CONF_NAME);
|
||||
login_lan_config_read(LAN_CONF_NAME);
|
||||
|
||||
@ -1890,6 +1900,17 @@ int do_init(int argc, char** argv)
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int login_msg_config_read(char *cfgName){
|
||||
return _msg_config_read(cfgName,LOGIN_MAX_MSG,msg_table);
|
||||
}
|
||||
const char* login_msg_txt(int msg_number){
|
||||
return _msg_txt(msg_number,LOGIN_MAX_MSG,msg_table);
|
||||
}
|
||||
void login_do_final_msg(void){
|
||||
return _do_final_msg(LOGIN_MAX_MSG,msg_table);
|
||||
}
|
||||
|
||||
/*======================================================
|
||||
* Login-Server help option info
|
||||
*------------------------------------------------------*/
|
||||
@ -1903,6 +1924,7 @@ void display_helpscreen(bool do_exit)
|
||||
ShowInfo(" --run-once\t\t\tCloses server after loading (testing).\n");
|
||||
ShowInfo(" --login-config <file>\t\tAlternative login-server configuration.\n");
|
||||
ShowInfo(" --lan-config <file>\t\tAlternative lag configuration.\n");
|
||||
ShowInfo(" --msg-config <file>\t\tAlternative message configuration.\n");
|
||||
if( do_exit )
|
||||
exit(EXIT_SUCCESS);
|
||||
}
|
||||
|
@ -91,6 +91,15 @@ struct Login_Config {
|
||||
#define sex_num2str(num) ( (num == SEX_FEMALE ) ? 'F' : (num == SEX_MALE ) ? 'M' : 'S' )
|
||||
#define sex_str2num(str) ( (str == 'F' ) ? SEX_FEMALE : (str == 'M' ) ? SEX_MALE : SEX_SERVER )
|
||||
|
||||
#define msg_config_read(cfgName) login_msg_config_read(cfgName)
|
||||
#define msg_txt(msg_number) login_msg_txt(msg_number)
|
||||
#define do_final_msg() login_do_final_msg()
|
||||
|
||||
int login_msg_config_read(char *cfgName);
|
||||
const char* login_msg_txt(int msg_number);
|
||||
void login_do_final_msg(void);
|
||||
|
||||
|
||||
#define MAX_SERVERS 30
|
||||
extern struct mmo_char_server server[MAX_SERVERS];
|
||||
extern struct Login_Config login_config;
|
||||
|
@ -100,73 +100,6 @@ struct atcmd_binding_data* get_atcommandbind_byname(const char* name) {
|
||||
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.
|
||||
*
|
||||
@ -5399,7 +5332,7 @@ ACMD_FUNC(skillid)
|
||||
skillen = strlen(message);
|
||||
|
||||
iter = db_iterator(skilldb_name2id);
|
||||
|
||||
|
||||
for( data = iter->first(iter,&key); iter->exists(iter); data = iter->next(iter,&key) ) {
|
||||
idx = skill_get_index(db_data2i(data));
|
||||
if (strnicmp(key.str, message, skillen) == 0 || strnicmp(skill_db[idx].desc, message, skillen) == 0) {
|
||||
@ -5409,18 +5342,18 @@ ACMD_FUNC(skillid)
|
||||
snprintf(partials[found++], MAX_SKILLID_PARTIAL_RESULTS_LEN, msg_txt(1164), db_data2i(data), skill_db[idx].desc, key.str);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
dbi_destroy(iter);
|
||||
|
||||
|
||||
if( found ) {
|
||||
sprintf(atcmd_output, msg_txt(1398), found); // -- Displaying first %d partial matches
|
||||
clif_displaymessage(fd, atcmd_output);
|
||||
}
|
||||
|
||||
|
||||
for(i = 0; i < found; i++) { /* partials */
|
||||
clif_displaymessage(fd, partials[i]);
|
||||
}
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -30,10 +30,6 @@ void atcommand_db_load_groups(int* group_ids);
|
||||
|
||||
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)
|
||||
|
@ -106,6 +106,9 @@ 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 MAX_MSG 1500
|
||||
static char* msg_table[MAX_MSG]; // map Server messages
|
||||
|
||||
struct map_data map[MAX_MAP_PER_SERVER];
|
||||
int map_num = 0;
|
||||
int map_port=0;
|
||||
@ -3722,7 +3725,7 @@ int do_init(int argc, char *argv[])
|
||||
BATTLE_CONF_FILENAME = "conf/battle_athena.conf";
|
||||
ATCOMMAND_CONF_FILENAME = "conf/atcommand_athena.conf";
|
||||
SCRIPT_CONF_NAME = "conf/script_athena.conf";
|
||||
MSG_CONF_NAME = "conf/msg_athena.conf";
|
||||
MSG_CONF_NAME = "conf/msg_conf/map_msg.conf";
|
||||
GRF_PATH_FILENAME = "conf/grf-files.txt";
|
||||
|
||||
cli_get_options(argc,argv);
|
||||
@ -3835,3 +3838,13 @@ int do_init(int argc, char *argv[])
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int map_msg_config_read(char *cfgName){
|
||||
return _msg_config_read(cfgName,MAX_MSG,msg_table);
|
||||
}
|
||||
const char* map_msg_txt(int msg_number){
|
||||
return _msg_txt(msg_number,MAX_MSG,msg_table);
|
||||
}
|
||||
void map_do_final_msg(void){
|
||||
return _do_final_msg(MAX_MSG,msg_table);
|
||||
}
|
||||
|
@ -9,6 +9,7 @@
|
||||
#include "../common/mmo.h"
|
||||
#include "../common/mapindex.h"
|
||||
#include "../common/db.h"
|
||||
#include "../common/msg_conf.h"
|
||||
|
||||
/**
|
||||
* [rAthena.org]
|
||||
@ -27,6 +28,12 @@ enum E_MAPSERVER_ST
|
||||
MAPSERVER_ST_LAST
|
||||
};
|
||||
|
||||
#define msg_config_read(cfgName) map_msg_config_read(cfgName)
|
||||
#define msg_txt(msg_number) map_msg_txt(msg_number)
|
||||
#define do_final_msg() map_do_final_msg()
|
||||
int map_msg_config_read(char *cfgName);
|
||||
const char* map_msg_txt(int msg_number);
|
||||
void map_do_final_msg(void);
|
||||
|
||||
#define MAX_NPC_PER_MAP 512
|
||||
#define AREA_SIZE battle_config.area_size
|
||||
|
@ -156,6 +156,7 @@
|
||||
<ClInclude Include="..\src\common\thread.h" />
|
||||
<ClInclude Include="..\src\common\timer.h" />
|
||||
<ClInclude Include="..\src\common\utils.h" />
|
||||
<ClInclude Include="..\src\common\msg_conf.h" />
|
||||
<ClInclude Include="..\src\common\cli.h" />
|
||||
<ClInclude Include="..\src\char\char.h" />
|
||||
<ClInclude Include="..\src\char\int_auction.h" />
|
||||
@ -195,6 +196,7 @@
|
||||
<ClCompile Include="..\src\common\thread.c" />
|
||||
<ClCompile Include="..\src\common\timer.c" />
|
||||
<ClCompile Include="..\src\common\utils.c" />
|
||||
<ClCompile Include="..\src\common\msg_conf.c" />
|
||||
<ClCompile Include="..\src\common\cli.c" />
|
||||
<ClCompile Include="..\src\char\char.c" />
|
||||
<ClCompile Include="..\src\char\int_auction.c" />
|
||||
|
@ -162,6 +162,7 @@
|
||||
<ClInclude Include="..\src\common\strlib.h" />
|
||||
<ClInclude Include="..\src\common\timer.h" />
|
||||
<ClInclude Include="..\src\common\utils.h" />
|
||||
<ClInclude Include="..\src\common\msg_conf.h" />
|
||||
<ClInclude Include="..\src\common\cli.h" />
|
||||
<ClInclude Include="..\3rdparty\mt19937ar\mt19937ar.h" />
|
||||
</ItemGroup>
|
||||
@ -192,6 +193,7 @@
|
||||
<ClCompile Include="..\src\common\strlib.c" />
|
||||
<ClCompile Include="..\src\common\timer.c" />
|
||||
<ClCompile Include="..\src\common\utils.c" />
|
||||
<ClCompile Include="..\src\common\msg_conf.c" />
|
||||
<ClCompile Include="..\src\common\cli.c" />
|
||||
<ClCompile Include="..\3rdparty\mt19937ar\mt19937ar.c" />
|
||||
</ItemGroup>
|
||||
|
@ -158,6 +158,7 @@
|
||||
<ClInclude Include="..\src\common\timer.h" />
|
||||
<ClInclude Include="..\src\common\utils.h" />
|
||||
<ClInclude Include="..\src\common\winapi.h" />
|
||||
<ClInclude Include="..\src\common\msg_conf.h" />
|
||||
<ClInclude Include="..\src\common\cli.h" />
|
||||
<ClInclude Include="..\src\map\atcommand.h" />
|
||||
<ClInclude Include="..\src\map\battle.h" />
|
||||
@ -229,6 +230,7 @@
|
||||
<ClCompile Include="..\src\common\thread.c" />
|
||||
<ClCompile Include="..\src\common\timer.c" />
|
||||
<ClCompile Include="..\src\common\utils.c" />
|
||||
<ClCompile Include="..\src\common\msg_conf.c" />
|
||||
<ClCompile Include="..\src\common\cli.c" />
|
||||
<ClCompile Include="..\src\map\atcommand.c" />
|
||||
<ClCompile Include="..\src\map\battle.c" />
|
||||
|
@ -160,6 +160,7 @@
|
||||
<ClInclude Include="..\src\common\timer.h" />
|
||||
<ClInclude Include="..\src\common\utils.h" />
|
||||
<ClInclude Include="..\src\common\cli.h" />
|
||||
<ClInclude Include="..\src\common\msg_conf.h" />
|
||||
<ClInclude Include="..\src\char\char.h" />
|
||||
<ClInclude Include="..\src\char\int_auction.h" />
|
||||
<ClInclude Include="..\src\char\int_elemental.h" />
|
||||
@ -199,6 +200,7 @@
|
||||
<ClCompile Include="..\src\common\timer.c" />
|
||||
<ClCompile Include="..\src\common\utils.c" />
|
||||
<ClCompile Include="..\src\common\cli.c" />
|
||||
<ClCompile Include="..\src\common\msg_conf.c" />
|
||||
<ClCompile Include="..\src\char\char.c" />
|
||||
<ClCompile Include="..\src\char\int_auction.c" />
|
||||
<ClCompile Include="..\src\char\int_elemental.c" />
|
||||
|
@ -167,6 +167,7 @@
|
||||
<ClInclude Include="..\src\common\timer.h" />
|
||||
<ClInclude Include="..\src\common\utils.h" />
|
||||
<ClInclude Include="..\src\common\cli.h" />
|
||||
<ClInclude Include="..\src\common\msg_conf.h" />
|
||||
<ClInclude Include="..\3rdparty\mt19937ar\mt19937ar.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
@ -197,6 +198,7 @@
|
||||
<ClCompile Include="..\src\common\timer.c" />
|
||||
<ClCompile Include="..\src\common\utils.c" />
|
||||
<ClCompile Include="..\src\common\cli.c" />
|
||||
<ClCompile Include="..\src\common\msg_conf.c" />
|
||||
<ClCompile Include="..\3rdparty\mt19937ar\mt19937ar.c" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
|
@ -163,6 +163,7 @@
|
||||
<ClInclude Include="..\src\common\utils.h" />
|
||||
<ClInclude Include="..\src\common\winapi.h" />
|
||||
<ClInclude Include="..\src\common\cli.h" />
|
||||
<ClInclude Include="..\src\common\msg_conf.h" />
|
||||
<ClInclude Include="..\src\map\atcommand.h" />
|
||||
<ClInclude Include="..\src\map\battle.h" />
|
||||
<ClInclude Include="..\src\map\battleground.h" />
|
||||
@ -234,6 +235,7 @@
|
||||
<ClCompile Include="..\src\common\timer.c" />
|
||||
<ClCompile Include="..\src\common\utils.c" />
|
||||
<ClCompile Include="..\src\common\cli.c" />
|
||||
<ClCompile Include="..\src\common\msg_conf.c" />
|
||||
<ClCompile Include="..\src\map\atcommand.c" />
|
||||
<ClCompile Include="..\src\map\battle.c" />
|
||||
<ClCompile Include="..\src\map\battleground.c" />
|
||||
|
@ -436,6 +436,14 @@
|
||||
RelativePath="..\src\common\cli.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\src\common\msg_conf.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\src\common\msg_conf.c"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="char_sql"
|
||||
|
@ -406,6 +406,15 @@
|
||||
RelativePath="..\src\common\cli.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\src\common\msg_conf.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\src\common\msg_conf.c"
|
||||
>
|
||||
</File>
|
||||
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="3rdparty"
|
||||
|
@ -459,6 +459,15 @@
|
||||
RelativePath="..\src\common\cli.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\src\common\msg_conf.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\src\common\msg_conf.c"
|
||||
>
|
||||
</File>
|
||||
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="map_sql"
|
||||
|
Loading…
x
Reference in New Issue
Block a user