summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorajarn <ajarn@54d463be-8e91-2dee-dedb-b68131a5f0ec>2004-12-19 04:33:35 +0000
committerajarn <ajarn@54d463be-8e91-2dee-dedb-b68131a5f0ec>2004-12-19 04:33:35 +0000
commit3ca026b5eef1b777f74e40dca576e6903f980b26 (patch)
treecddf8e705ecdfaaa090dd4f7a48d7fa1f6a1410e /src
parent0c9aad28d9423d0fe49574dc1ea34b3e095212dc (diff)
downloadhercules-3ca026b5eef1b777f74e40dca576e6903f980b26.tar.gz
hercules-3ca026b5eef1b777f74e40dca576e6903f980b26.tar.bz2
hercules-3ca026b5eef1b777f74e40dca576e6903f980b26.tar.xz
hercules-3ca026b5eef1b777f74e40dca576e6903f980b26.zip
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/branches/stable@629 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src')
-rw-r--r--src/char_sql/char.c58
-rw-r--r--src/login_sql/login.c62
-rw-r--r--src/map/map.c177
3 files changed, 154 insertions, 143 deletions
diff --git a/src/char_sql/char.c b/src/char_sql/char.c
index 73271b197..41d2341f0 100644
--- a/src/char_sql/char.c
+++ b/src/char_sql/char.c
@@ -160,12 +160,12 @@ void set_char_online(int char_id, int account_id) {
if (mysql_query(&mysql_handle, tmp_sql)) {
printf("DB server Error (set char online)- %s\n", mysql_error(&mysql_handle));
}
- }
-
+ }
+
WFIFOW(login_fd,0) = 0x272b;
WFIFOL(login_fd,2) = account_id;
WFIFOSET(login_fd,6);
-
+
}
void set_all_offline(void) {
@@ -181,16 +181,16 @@ void set_all_offline(void) {
WFIFOW(login_fd,0) = 0x272c;
WFIFOL(login_fd,2) = atoi(sql_row[0]);
WFIFOSET(login_fd,6);
- }
+ }
}
- }
-
- mysql_free_result(sql_res);
+ }
+
+ mysql_free_result(sql_res);
sprintf(tmp_sql,"UPDATE `%s` SET `online`='0' WHERE `online`='1'", char_db);
if (mysql_query(&mysql_handle, tmp_sql)) {
printf("DB server Error (set_all_offline)- %s\n", mysql_error(&mysql_handle));
}
-
+
}
void set_char_offline(int char_id, int account_id) {
@@ -198,7 +198,7 @@ void set_char_offline(int char_id, int account_id) {
sprintf(tmp_sql,"UPDATE `%s` SET `online`='0' WHERE `account_id`='%d'", char_db, account_id);
else
sprintf(tmp_sql,"UPDATE `%s` SET `online`='0' WHERE `char_id`='%d'", char_db, char_id);
-
+
if (mysql_query(&mysql_handle, tmp_sql))
printf("DB server Error (set_char_offline)- %s\n", mysql_error(&mysql_handle));
@@ -208,7 +208,7 @@ void set_char_offline(int char_id, int account_id) {
WFIFOW(login_fd,0) = 0x272c;
WFIFOL(login_fd,2) = account_id;
WFIFOSET(login_fd,6);
-}
+}
//-----------------------------------------------------
// Function to suppress control characters in a string.
@@ -2060,7 +2060,7 @@ int parse_frommap(int fd) {
set_char_online(RFIFOL(fd,2),RFIFOL(fd,6));
RFIFOSKIP(fd,10);
break;
-
+
default:
// inter server - packet
{
@@ -2141,7 +2141,7 @@ int parse_char(int fd) {
unsigned char *p = (unsigned char *) &session[fd]->client_addr.sin_addr;
sd = session[fd]->session_data;
-
+
if(login_fd < 0)
session[fd]->eof = 1;
if(session[fd]->eof) {
@@ -2176,7 +2176,7 @@ int parse_char(int fd) {
// if (sd == NULL && cmd != 0x65 && cmd != 0x20b && cmd != 0x187 &&
// cmd != 0x2af8 && cmd != 0x7530 && cmd != 0x7532)
// cmd = 0xffff; // パケットダンプを表示させる
-
+
switch(cmd){
case 0x20b: //20040622 encryption ragexe correspondence
if (RFIFOREST(fd) < 19)
@@ -2673,24 +2673,24 @@ int parse_char(int fd) {
// Console Command Parser [Wizputer]
int parse_console(char *buf) {
char *type,*command;
-
+
type = (char *)malloc(64);
command = (char *)malloc(64);
-
+
memset(type,0,64);
memset(command,0,64);
-
+
printf("Console: %s\n",buf);
-
+
if ( sscanf(buf, "%[^:]:%[^\n]", type , command ) < 2 )
sscanf(buf,"%[^\n]",type);
-
+
printf("Type of command: %s || Command: %s \n",type,command);
-
+
if(buf) free(buf);
if(type) free(type);
if(command) free(command);
-
+
return 0;
}
@@ -2856,7 +2856,7 @@ void do_final(void) {
flush_fifos();
sprintf(tmp_sql,"DELETE FROM `ragsrvinfo");
- if (mysql_query(&mysql_handle, tmp_sql))
+ if (mysql_query(&mysql_handle, tmp_sql))
printf("DB server Error (insert `char`)- %s\n", mysql_error(&mysql_handle));
if(gm_account) {
@@ -2954,7 +2954,11 @@ void sql_config_read(const char *cfgName){ /* Kalaspuff, to get login_db */
}else if(strcmpi(w1,"lowest_gm_level")==0){
lowest_gm_level = atoi(w2);
printf("set lowest_gm_level : %s\n",w2);
+ //support the import command, just like any other config
+ }else if(strcmpi(w1,"import")==0){
+ sql_config_read(w2);
}
+
}
fclose(fp);
printf("reading configure done.....\n");
@@ -3140,14 +3144,14 @@ int do_init(int argc, char **argv){
printf("open port %d.....\n",char_port);
char_fd = make_listen_port(char_port);
- if ((naddr_ != 0) && (login_ip_set_ == 0 || char_ip_set_ == 0)) {
+ if ((naddr_ != 0) && (login_ip_set_ == 0 || char_ip_set_ == 0)) {
// The char server should know what IP address it is running on
// - MouseJstr
int localaddr = ntohl(addr_[0]);
unsigned char *ptr = (unsigned char *) &localaddr;
char buf[16];
sprintf(buf, "%d.%d.%d.%d", ptr[0], ptr[1], ptr[2], ptr[3]);;
- if (naddr_ != 1)
+ if (naddr_ != 1)
printf("Multiple interfaces detected.. using %s as our IP address\n", buf);
else
printf("Defaulting to %s as our IP address\n", buf);
@@ -3156,9 +3160,9 @@ int do_init(int argc, char **argv){
if (char_ip_set_ == 0)
strcpy(char_ip_str, buf);
- if (ptr[0] == 192 && ptr[1] == 168)
+ if (ptr[0] == 192 && ptr[1] == 168)
printf("Firewall detected.. edit lan_support.conf and char_athena.conf\n");
- }
+ }
login_ip = inet_addr(login_ip_str);
char_ip = inet_addr(char_ip_str);
@@ -3190,12 +3194,12 @@ int do_init(int argc, char **argv){
}
read_gm_account();
-
+
if ( console ) {
set_defaultconsoleparse(parse_console);
start_console();
}
-
+
printf("char server init func end (now unlimited loop start!)....\n");
printf("The char-server is \033[1;32mready\033[0m (Server is listening on the port %d).\n\n", char_port);
return 0;
diff --git a/src/login_sql/login.c b/src/login_sql/login.c
index 48b29fdda..a8f2720bd 100644
--- a/src/login_sql/login.c
+++ b/src/login_sql/login.c
@@ -124,7 +124,7 @@ int use_md5_passwds = 0;
char login_db[256] = "login";
char loginlog_db[256] = "loginlog";
-// added to help out custom login tables, without having to recompile
+// added to help out custom login tables, without having to recompile
// source so options are kept in the login_athena.conf or the inter_athena.conf
char login_db_account_id[256] = "account_id";
char login_db_userid[256] = "userid";
@@ -582,7 +582,7 @@ int mmo_auth( struct mmo_account* account , int fd){
return 3; // Rejected
#endif
}
-
+
account->account_id = atoi(sql_row[0]);
account->login_id1 = rand();
account->login_id2 = rand();
@@ -685,7 +685,7 @@ int parse_fromchar(int fd){
if (auth_fifo[i].account_id == account_id &&
auth_fifo[i].login_id1 == RFIFOL(fd,6) &&
#if CMP_AUTHFIFO_LOGIN2 != 0
- auth_fifo[i].login_id2 == RFIFOL(fd,10) && // relate to the versions higher than 18
+ auth_fifo[i].login_id2 == RFIFOL(fd,10) && // relate to the versions higher than 18
#endif
auth_fifo[i].sex == RFIFOB(fd,14) &&
#if CMP_AUTHFIFO_IP != 0
@@ -850,9 +850,9 @@ int parse_fromchar(int fd){
server[id].name, acc, sql_row[0], actual_email, ip);
}
}
-
+
}
- }
+ }
RFIFOSKIP(fd, 86);
break;
@@ -929,7 +929,7 @@ int parse_fromchar(int fd){
WBUFL(buf,7) = timestamp; // status or final date of a banishment
charif_sendallwos(-1, buf, 11);
}
- printf("Account: %d Banned until: %ld\n", acc, timestamp);
+ printf("Account: %d Banned until: %ld\n", acc, timestamp);
sprintf(tmpsql, "UPDATE `%s` SET `ban_until` = '%ld', `state`='7' WHERE `%s` = '%d'", login_db, timestamp, login_db_account_id, acc);
// query
if (mysql_query(&mysql_handle, tmpsql)) {
@@ -950,14 +950,14 @@ int parse_fromchar(int fd){
unsigned char buf[16];
acc=RFIFOL(fd,4);
sprintf(tmpsql,"SELECT `sex` FROM `%s` WHERE `%s` = '%d'",login_db,login_db_account_id,acc);
-
+
if(mysql_query(&mysql_handle, tmpsql)) {
printf("DB server Error - %s\n", mysql_error(&mysql_handle));
return 0;
}
-
+
sql_res = mysql_store_result(&mysql_handle) ;
-
+
if (sql_res) {
if (mysql_num_rows(sql_res) == 0) {
mysql_free_result(sql_res);
@@ -965,7 +965,7 @@ int parse_fromchar(int fd){
}
sql_row = mysql_fetch_row(sql_res); //row fetching
}
-
+
if (strcmpi(sql_row[0], "M") == 0)
sex = 1;
else
@@ -1013,7 +1013,7 @@ int parse_fromchar(int fd){
WBUFW(buf,0)=0x2729;
charif_sendallwos(fd,buf,WBUFW(buf,2));
}
- }
+ }
RFIFOSKIP(fd,RFIFOW(fd,2));
//printf("login: save account_reg (from char)\n");
break;
@@ -1043,21 +1043,21 @@ int parse_fromchar(int fd){
RFIFOSKIP(fd,6);
}
return 0;
-
+
case 0x272b: // Set account_id to online [Wizputer]
if (RFIFOREST(fd) < 6)
return 0;
add_online_user(RFIFOL(fd,2));
RFIFOSKIP(fd,6);
break;
-
+
case 0x272c: // Set account_id to offline [Wizputer]
if (RFIFOREST(fd) < 6)
return 0;
remove_online_user(RFIFOL(fd,2));
RFIFOSKIP(fd,6);
break;
-
+
default:
printf("login: unknown packet %x! (from char).\n", RFIFOW(fd,0));
session[fd]->eof = 1;
@@ -1461,24 +1461,24 @@ int parse_login(int fd) {
// Console Command Parser [Wizputer]
int parse_console(char *buf) {
char *type,*command;
-
+
type = (char *)malloc(64);
command = (char *)malloc(64);
-
+
memset(type,0,64);
memset(command,0,64);
-
+
printf("Console: %s\n",buf);
-
+
if ( sscanf(buf, "%[^:]:%[^\n]", type , command ) < 2 )
sscanf(buf,"%[^\n]",type);
-
+
printf("Type of command: %s || Command: %s \n",type,command);
-
+
if(buf) free(buf);
if(type) free(type);
if(command) free(command);
-
+
return 0;
}
@@ -1619,15 +1619,15 @@ int login_config_read(const char *cfgName){
else if(strcmpi(w1,"dynamic_pass_failure_ban_how_long")==0){
dynamic_pass_failure_ban_how_long=atoi(w2);
printf ("set dynamic_pass_failure_ban_how_long : %d\n",dynamic_pass_failure_ban_how_long);
- }
+ }
else if(strcmpi(w1,"anti_freeze_enable")==0){
anti_freeze_enable = config_switch(w2);
- }
+ }
else if (strcmpi(w1, "anti_freeze_interval") == 0) {
ANTI_FREEZE_INTERVAL = atoi(w2);
if (ANTI_FREEZE_INTERVAL < 5)
ANTI_FREEZE_INTERVAL = 5; // minimum 5 seconds
- }
+ }
else if (strcmpi(w1, "import") == 0) {
login_config_read(w2);
} else if(strcmpi(w1,"imalive_on")==0) { //Added by Mugendai for I'm Alive mod
@@ -1741,9 +1741,13 @@ void sql_config_read(const char *cfgName){ /* Kalaspuff, to get login_db */
else if (strcmpi(w1, "loginlog_db") == 0) {
strcpy(loginlog_db, w2);
}
- }
- fclose(fp);
- printf("reading configure done.....\n");
+ //support the import command, just like any other config
+ else if(strcmpi(w1,"import")==0){
+ sql_config_read(w2);
+ }
+ }
+ fclose(fp);
+ printf("reading configure done.....\n");
}
@@ -1830,11 +1834,11 @@ int do_init(int argc,char **argv){
set_defaultconsoleparse(parse_console);
start_console();
}
-
+
// Online user database init
free(online_db);
online_db = numdb_init();
-
+
printf("The login-server is \033[1;32mready\033[0m (Server is listening on the port %d).\n\n", login_port);
return 0;
diff --git a/src/map/map.c b/src/map/map.c
index e40f4d0c3..a59f45818 100644
--- a/src/map/map.c
+++ b/src/map/map.c
@@ -313,7 +313,7 @@ int map_delblock(struct block_list *bl)
if(bl->type==BL_PC)
map[bl->m].users--;
- if(bl->next)
+ if(bl->next)
bl->next->prev = bl->prev;
if(bl->prev==&bl_head){
// リストの頭なので、map[]のblock_listを更新する
@@ -434,14 +434,14 @@ void map_foreachinarea(int (*func)(struct block_list*,va_list),int m,int x0,int
}
}
}
-
+
if(bl_list_count>=BL_LIST_MAX) {
if(battle_config.error_log)
printf("map_foreachinarea: *WARNING* block count too many!\n");
}
map_freeblock_lock(); // メモリからの解放を禁止する
-
+
for(i=blockcount;i<bl_list_count;i++)
if(bl_list[i]->prev) // 有?かどうかチェック
func(bl_list[i],ap);
@@ -550,10 +550,10 @@ void map_foreachinmovearea(int (*func)(struct block_list*,va_list),int m,int x0,
}
map_freeblock_lock(); // メモリからの解放を禁止する
-
+
for(i=blockcount;i<bl_list_count;i++)
if(bl_list[i]->prev) { // 有?かどうかチェック
- if (bl_list[i]->type == BL_PC
+ if (bl_list[i]->type == BL_PC
&& session[((struct map_session_data *) bl_list[i])->fd] == NULL)
continue;
func(bl_list[i],ap);
@@ -602,7 +602,7 @@ void map_foreachincell(int (*func)(struct block_list*,va_list),int m,int x,int y
if(bl && bl->x==x && bl->y==y && bl_list_count<BL_LIST_MAX)
bl_list[bl_list_count++]=bl;
}
- }
+ }
if(bl_list_count>=BL_LIST_MAX) {
if(battle_config.error_log)
@@ -610,7 +610,7 @@ void map_foreachincell(int (*func)(struct block_list*,va_list),int m,int x,int y
}
map_freeblock_lock(); // メモリからの解放を禁止する
-
+
for(i=blockcount;i<bl_list_count;i++)
if(bl_list[i]->prev) // 有?かどうかチェック
func(bl_list[i],ap);
@@ -689,7 +689,7 @@ int map_delobject(int id) {
if(obj==NULL)
return 0;
- map_delobjectnofree(id);
+ map_delobjectnofree(id);
map_freeblock(obj);
return 0;
@@ -965,7 +965,7 @@ int map_quit(struct map_session_data *sd) {
if(sd->chatID) // チャットから出る
chat_leavechat(sd);
-
+
if(sd->trade_partner) // 取引を中?する
trade_tradecancel(sd);
@@ -1191,7 +1191,7 @@ int map_addnpc(int m,struct npc_data *nd) {
void map_removenpc(void) {
int i,m,n=0;
-
+
for(m=0;m<map_num;m++) {
for(i=0;i<map[m].npc_num && i<MAX_NPC_PER_MAP;i++) {
if(map[m].npc[i]!=NULL) {
@@ -1208,7 +1208,7 @@ void map_removenpc(void) {
}
}
}
-
+
sprintf(tmp_output,"Successfully removed and freed from memory '\033[1;29m%d\033[0;0m' NPCs.\n",n);
ShowStatus(tmp_output);
}
@@ -1231,7 +1231,7 @@ int map_mapname2mapid(char *name) {
md = strdb_search(map_db,afm_name);
}
#endif
-
+
if(md==NULL || md->gat==NULL)
return -1;
return md->m;
@@ -1435,29 +1435,29 @@ static void map_readwater(char *watertxt) {
#ifdef USE_AFM
static int map_readafm(int m,char *fn) {
-
+
/*
Advanced Fusion Maps Support
(c) 2003-2004, The Fusion Project
- AlexKreuz
-
+
The following code has been provided by me for eAthena
under the GNU GPL. It provides Advanced Fusion
Map, the map format desgined by me for Fusion, support
for the eAthena emulator.
-
+
I understand that because it is under the GPL
that other emulators may very well use this code in their
GNU project as well.
-
+
The AFM map format was not originally a part of the GNU
GPL. It originated from scratch by my own hand. I understand
that distributing this code to read the AFM maps with eAthena
causes the GPL to apply to this code. But the actual AFM
maps are STILL copyrighted to the Fusion Project. By choosing
-
+
In exchange for that 'act of faith' I ask for the following.
-
+
A) Give credit where it is due. If you use this code, do not
place your name on the changelog. Credit should be given
to AlexKreuz.
@@ -1468,65 +1468,65 @@ static int map_readafm(int m,char *fn) {
and so I ask you to display the copyright message on the STARTUP
SCREEN as I have done here. (refer to core.c)
"Advanced Fusion Maps (c) 2003-2004 The Fusion Project"
-
+
Without this copyright, you are NOT entitled to bundle or distribute
the AFM maps at all. On top of that, your "support" for AFM maps
becomes just as shady as your "support" for Gravity GRF files.
-
+
The bottom line is this. I know that there are those of you who
would like to use this code but aren't going to want to provide the
proper credit. I know this because I speak frome experience. If
you are one of those people who is going to try to get around my
requests, then save your breath because I don't want to hear it.
-
+
I have zero faith in GPL and I know and accept that if you choose to
not display the copyright for the AFMs then there is absolutely nothing
I can do about it. I am not about to start a legal battle over something
this silly.
-
+
Provide the proper credit because you believe in the GPL. If you choose
not to and would rather argue about it, consider the GPL failed.
-
+
October 18th, 2004
- AlexKreuz
- The Fusion Project
*/
-
-
+
+
int s;
int x,y,xs,ys;
size_t size;
-
+
char afm_line[65535];
int afm_size[1];
FILE *afm_file;
char *str;
-
+
afm_file = fopen(fn, "r");
if (afm_file != NULL) {
-
+
// printf("\rLoading Maps [%d/%d]: %-50s ",m,map_num,fn);
// fflush(stdout);
str=fgets(afm_line, sizeof(afm_line)-1, afm_file);
str=fgets(afm_line, sizeof(afm_line)-1, afm_file);
str=fgets(afm_line, sizeof(afm_line)-1, afm_file);
- sscanf(str , "%d%d", &afm_size[0], &afm_size[1]);
+ sscanf(str , "%d%d", &afm_size[0], &afm_size[1]);
- map[m].m = m;
+ map[m].m = m;
xs = map[m].xs = afm_size[0];
ys = map[m].ys = afm_size[1];
map[m].gat = calloc(s = map[m].xs * map[m].ys, 1);
-
+
if(map[m].gat==NULL){
printf("out of memory : map_readmap gat\n");
exit(1);
}
-
+
map[m].npc_num=0;
map[m].users=0;
memset(&map[m].flag,0,sizeof(map[m].flag));
-
+
if(battle_config.pk_mode) map[m].flag.pvp = 1; // make all maps pvp for pk_mode [Valaris]
for (y = 0; y < ys; y++) {
@@ -1535,25 +1535,25 @@ static int map_readafm(int m,char *fn) {
map[m].gat[x+y*xs] = str[x]-48;
}
}
-
+
map[m].bxs=(xs+BLOCK_SIZE-1)/BLOCK_SIZE;
map[m].bys=(ys+BLOCK_SIZE-1)/BLOCK_SIZE;
size = map[m].bxs * map[m].bys * sizeof(struct block_list*);
map[m].block = calloc(size, 1);
-
+
if(map[m].block == NULL){
printf("out of memory : map_readmap block\n");
exit(1);
}
-
+
map[m].block_mob = calloc(size, 1);
if (map[m].block_mob == NULL) {
printf("out of memory : map_readmap block_mob\n");
exit(1);
}
-
+
size = map[m].bxs*map[m].bys*sizeof(int);
-
+
map[m].block_count = calloc(size, 1);
if(map[m].block_count==NULL){
printf("out of memory : map_readmap block\n");
@@ -1590,7 +1590,7 @@ static int map_readmap(int m,char *fn, char *alias) {
int wh;
int i;
int e = 0;
-
+
size_t size;
char progress[21] = " ";
// read & convert fn
@@ -1615,7 +1615,7 @@ static int map_readmap(int m,char *fn, char *alias) {
map[m].npc_num=0;
map[m].users=0;
memset(&map[m].flag,0,sizeof(map[m].flag));
- if(battle_config.pk_mode)
+ if(battle_config.pk_mode)
map[m].flag.pvp = 1; // make all maps pvp for pk_mode [Valaris]
wh=map_waterheight(map[m].name);
for(y=0;y<ys;y++){
@@ -1753,12 +1753,12 @@ int map_addmap(char *mapname) {
int map_delmap(char *mapname) {
int i;
-
+
if (strcmpi(mapname, "all") == 0) {
map_num = 0;
return 0;
}
-
+
for(i = 0; i < map_num; i++) {
if (strcmp(map[i].name, mapname) == 0) {
printf("Removing map [ %s ] from maplist\n",map[i].name);
@@ -1781,52 +1781,52 @@ int parse_console(char *buf) {
int x = 0, y = 0;
int m, n;
struct map_session_data *sd;
-
+
sd = calloc(sizeof(*sd), 1);
-
+
sd->fd = 0;
strcpy( sd->status.name , "console");
-
+
type = (char *)malloc(64);
command = (char *)malloc(64);
map = (char *)malloc(64);
buf2 = (char *)malloc(72);
-
+
memset(type,0,64);
memset(command,0,64);
memset(map,0,64);
- memset(buf2,0,72);
-
+ memset(buf2,0,72);
+
if ( ( n = sscanf(buf, "%[^:]:%[^:]:%99s %d %d[^\n]", type , command , map , &x , &y )) < 5 )
if ( ( n = sscanf(buf, "%[^:]:%[^\n]", type , command )) < 2 )
n = sscanf(buf,"%[^\n]",type);
-
+
if ( n == 5 ) {
if (x <= 0) {
x = rand() % 399 + 1;
sd->bl.x = x;
} else {
sd->bl.x = x;
- }
-
+ }
+
if (y <= 0) {
y = rand() % 399 + 1;
sd->bl.y = y;
} else {
sd->bl.y = y;
- }
-
+ }
+
m = map_mapname2mapid(map);
if ( m >= 0 )
sd->bl.m = m;
else {
printf("Console: Unknown map\n");
goto end;
- }
- }
+ }
+ }
printf("Type of command: %s || Command: %s || Map: %s Coords: %d %d\n",type,command,map,x,y);
-
+
if ( strcmpi("admin",type) == 0 && n == 5 ) {
sprintf(buf2,"console: %s",command);
if( is_atcommand(sd->fd,sd,buf2,99) == AtCommand_None )
@@ -1844,8 +1844,8 @@ int parse_console(char *buf) {
printf("IE: @spawn\n");
printf("To shutdown the server:\n");
printf("server:shutdown\n");
- }
-
+ }
+
end:
free(buf);
free(type);
@@ -1853,7 +1853,7 @@ int parse_console(char *buf) {
free(map);
free(buf2);
free(sd);
-
+
return 0;
}
@@ -1882,7 +1882,7 @@ int map_config_read(char *cfgName) {
} else if (strcmpi(w1, "char_ip") == 0) {
char_ip_set_ = 1;
h = gethostbyname (w2);
- if(h != NULL) {
+ if(h != NULL) {
snprintf(tmp_output,sizeof(tmp_output),"Char Server IP Address : '"CL_WHITE"%s"CL_RESET"' -> '"CL_WHITE"%d.%d.%d.%d"CL_RESET"'.\n", w2, (unsigned char)h->h_addr[0], (unsigned char)h->h_addr[1], (unsigned char)h->h_addr[2], (unsigned char)h->h_addr[3]);
ShowInfo(tmp_output);
sprintf(w2,"%d.%d.%d.%d", (unsigned char)h->h_addr[0], (unsigned char)h->h_addr[1], (unsigned char)h->h_addr[2], (unsigned char)h->h_addr[3]);
@@ -1893,7 +1893,7 @@ int map_config_read(char *cfgName) {
} else if (strcmpi(w1, "map_ip") == 0) {
map_ip_set_ = 1;
h = gethostbyname (w2);
- if (h != NULL) {
+ if (h != NULL) {
snprintf(tmp_output,sizeof(tmp_output),"Map Server IP Address : '"CL_WHITE"%s"CL_RESET"' -> '"CL_WHITE"%d.%d.%d.%d"CL_RESET"'.\n", w2, (unsigned char)h->h_addr[0], (unsigned char)h->h_addr[1], (unsigned char)h->h_addr[2], (unsigned char)h->h_addr[3]);
ShowInfo(tmp_output);
sprintf(w2, "%d.%d.%d.%d", (unsigned char)h->h_addr[0], (unsigned char)h->h_addr[1], (unsigned char)h->h_addr[2], (unsigned char)h->h_addr[3]);
@@ -1973,9 +1973,9 @@ int map_sql_init(void){
else {
printf ("connect success! (Map Server Connection)\n");
}
-
+
mysql_init(&lmysql_handle);
-
+
//DB connection start
printf("Connect Login DB Server....\n");
if(!mysql_real_connect(&lmysql_handle, login_server_ip, login_server_id, login_server_pw,
@@ -1987,7 +1987,7 @@ int map_sql_init(void){
else {
printf ("connect success! (Login Server Connection)\n");
}
-
+
if(battle_config.mail_system) { // mail system [Valaris]
mysql_init(&mail_handle);
if(!mysql_real_connect(&mail_handle, map_server_ip, map_server_id, map_server_pw,
@@ -2010,9 +2010,9 @@ int map_sql_close(void){
}
int log_sql_init(void){
-
+
mysql_init(&mmysql_handle);
-
+
//DB connection start
printf("\033[1;29m[SQL]\033[0;0m: Connecting to Log Database \033[1;29m%s\033[0;0m At \033[1;29m%s\033[0;0m...\n",log_db,log_db_ip);
if(!mysql_real_connect(&mmysql_handle, log_db_ip, log_db_id, log_db_pw,
@@ -2055,7 +2055,7 @@ int sql_config_read(char *cfgName)
} else if(strcmpi(w1,"login_db")==0){
strcpy(login_db,w2);
} else if (strcmpi(w1, "char_db") == 0) {
- strcpy(char_db, w2);
+ strcpy(char_db, w2);
} else if(strcmpi(w1,"gm_db_level")==0){
strcpy(gm_db_level,w2);
} else if(strcmpi(w1,"gm_db_account_id")==0){
@@ -2116,7 +2116,10 @@ int sql_config_read(char *cfgName)
strcpy(log_db_pw, w2);
} else if(strcmpi(w1,"log_db_port")==0) {
log_db_port = atoi(w2);
- }
+ //support the import command, just like any other config
+ } else if(strcmpi(w1,"import")==0){
+ sql_config_read(w2);
+ }
}
fclose(fp);
@@ -2130,7 +2133,7 @@ int online_timer(int tid,unsigned int tick,int id,int data)
char_online_check();
- check_online_timer=add_timer(gettick()+CHECK_INTERVAL,online_timer,0,0);
+ check_online_timer=add_timer(gettick()+CHECK_INTERVAL,online_timer,0,0);
return 0;
}
@@ -2143,14 +2146,14 @@ void char_online_check(void)
chrif_char_reset_offline();
for(i=0;i<fd_max;i++){
- if (session[i] && (sd = session[i]->session_data) && sd && sd->state.auth &&
+ if (session[i] && (sd = session[i]->session_data) && sd && sd->state.auth &&
!(battle_config.hide_GM_session && pc_isGM(sd)))
if(sd->status.char_id) {
chrif_char_online(sd);
}
}
-
+
if(check_online_timer && check_online_timer != -1) {
delete_timer(check_online_timer,online_timer);
add_timer(gettick()+CHECK_INTERVAL,online_timer,0,0);
@@ -2225,7 +2228,7 @@ void do_final(void) {
#ifndef TXT_ONLY
chrif_char_reset_offline();
#endif
- for (i = 0; i < fd_max; i++)
+ for (i = 0; i < fd_max; i++)
delete_session(i);
map_removenpc();
@@ -2341,20 +2344,20 @@ int do_init(int argc, char *argv[]) {
map_config_read(MAP_CONF_NAME);
- if ((naddr_ == 0) && (map_ip_set_ == 0 || char_ip_set_ == 0)) {
+ if ((naddr_ == 0) && (map_ip_set_ == 0 || char_ip_set_ == 0)) {
printf("\nUnable to determine your IP address... please edit\n");
printf("the map_athena.conf file and set it.\n");
printf("(127.0.0.1 is valid if you have no network interface)\n");
}
- if (map_ip_set_ == 0 || char_ip_set_ == 0) {
+ if (map_ip_set_ == 0 || char_ip_set_ == 0) {
// The map server should know what IP address it is running on
// - MouseJstr
int localaddr = ntohl(addr_[0]);
unsigned char *ptr = (unsigned char *) &localaddr;
char buf[16];
sprintf(buf, "%d.%d.%d.%d", ptr[0], ptr[1], ptr[2], ptr[3]);;
- if (naddr_ != 1)
+ if (naddr_ != 1)
printf("Multiple interfaces detected.. using %s as our IP address\n", buf);
else
printf("Defaulting to %s as our IP address\n", buf);
@@ -2363,10 +2366,10 @@ int do_init(int argc, char *argv[]) {
if (char_ip_set_ == 0)
chrif_setip(buf);
- if (ptr[0] == 192 && ptr[1] == 168)
+ if (ptr[0] == 192 && ptr[1] == 168)
printf("\nFirewall detected.. \n edit lan_support.conf and map_athena.conf\n\n");
- }
-
+ }
+
battle_config_read(BATTLE_CONF_FILENAME);
msg_config_read(MSG_CONF_NAME);
atcommand_config_read(ATCOMMAND_CONF_FILENAME);
@@ -2400,7 +2403,7 @@ int do_init(int argc, char *argv[]) {
}
fclose(data_conf);
} // end of reading grf-files.txt for AFMs
-
+
map_readallmap();
@@ -2412,7 +2415,7 @@ int do_init(int argc, char *argv[]) {
#ifndef TXT_ONLY // online status timer, checks every hour [Valaris]
add_timer_func_list(online_timer, "online_timer");
- check_online_timer=add_timer(gettick()+CHECK_INTERVAL,online_timer,0,0);
+ check_online_timer=add_timer(gettick()+CHECK_INTERVAL,online_timer,0,0);
#endif /* not TXT_ONLY */
do_init_chrif();
@@ -2429,11 +2432,11 @@ int do_init(int argc, char *argv[]) {
do_init_npc();
#ifndef TXT_ONLY /* mail system [Valaris] */
- if(battle_config.mail_system)
+ if(battle_config.mail_system)
do_init_mail();
- if (log_config.branch || log_config.drop || log_config.mvpdrop ||
- log_config.present || log_config.produce || log_config.refine ||
+ if (log_config.branch || log_config.drop || log_config.mvpdrop ||
+ log_config.present || log_config.produce || log_config.refine ||
log_config.trade)
{
log_sql_init();
@@ -2441,15 +2444,15 @@ int do_init(int argc, char *argv[]) {
#endif /* not TXT_ONLY */
npc_event_do_oninit(); // npcのOnInitイベント?行
-
+
if ( console ) {
set_defaultconsoleparse(parse_console);
start_console();
}
-
+
if (battle_config.pk_mode == 1)
ShowNotice("Server is running on '"CL_WHITE"PK Mode"CL_RESET"'.\n");
-
+
//Added for Mugendais I'm Alive mod
if (imalive_on)
add_timer_interval(gettick()+10, imalive_timer,0,0,imalive_time*1000);
@@ -2458,7 +2461,7 @@ int do_init(int argc, char *argv[]) {
ShowStatus(tmp_output);
ticks = gettick();
-
+
return 0;
}