From c8da743b969b251bab107125d4af82ec7f4e376c Mon Sep 17 00:00:00 2001
From: Jared Adams <jaxad0127@gmail.com>
Date: Sun, 8 Mar 2009 15:18:32 -0600
Subject: Strip some more out

---
 src/char/Makefile      |   7 +-
 src/char/char.c        |  14 +-
 src/char/int_pet.c     | 364 -------------------------------------------------
 src/char/int_pet.h     |  13 --
 src/char/int_storage.c |  11 --
 src/char/inter.c       |   7 -
 src/common/mmo.h       |  21 +--
 src/map/Makefile       |   2 +-
 src/map/atcommand.c    | 157 ---------------------
 src/map/battle.c       |  16 +--
 src/map/battle.h       |   4 -
 src/map/chrif.c        |   8 --
 src/map/itemdb.c       | 201 +--------------------------
 src/map/map.c          | 274 -------------------------------------
 src/map/map.h          |  43 ------
 src/map/mob.c          | 151 +-------------------
 src/map/pc.c           |  39 +-----
 17 files changed, 15 insertions(+), 1317 deletions(-)
 delete mode 100644 src/char/int_pet.c
 delete mode 100644 src/char/int_pet.h

(limited to 'src')

diff --git a/src/char/Makefile b/src/char/Makefile
index 65e2eb4..d4344a0 100644
--- a/src/char/Makefile
+++ b/src/char/Makefile
@@ -3,15 +3,14 @@ txt: char-server
 
 COMMON_OBJ = ../common/core.o ../common/socket.o ../common/timer.o ../common/db.o ../common/lock.o ../common/malloc.o
 COMMON_H = ../common/core.h ../common/socket.h ../common/timer.h ../common/mmo.h ../common/db.h ../common/lock.h ../common/timer.h ../common/malloc.h
-char-server: char.o inter.o int_party.o int_guild.o int_storage.o int_pet.o $(COMMON_OBJ)
+char-server: char.o inter.o int_party.o int_guild.o int_storage.o $(COMMON_OBJ)
 	$(CC) -o ../../$@ $>
 
-char.o: char.c char.h inter.h int_pet.h $(COMMON_H) ../common/version.h
-inter.o: inter.c inter.h int_party.h int_guild.h int_storage.h int_pet.h char.h $(COMMON_H)
+char.o: char.c char.h inter.h $(COMMON_H) ../common/version.h
+inter.o: inter.c inter.h int_party.h int_guild.h int_storage.h char.h $(COMMON_H)
 int_party.o: int_party.c int_party.h inter.h char.h $(COMMON_H)
 int_guild.o: int_guild.c int_guild.h int_storage.h inter.h char.h $(COMMON_H)
 int_storage.o: int_storage.c int_storage.h int_guild.h inter.h char.h $(COMMON_H)
-int_pet.o: int_pet.c int_pet.h inter.h char.h $(COMMON_H)
 
 clean:
 	rm -f *.o ../../char-server
diff --git a/src/char/char.c b/src/char/char.c
index 7512dd0..27ef4c8 100644
--- a/src/char/char.c
+++ b/src/char/char.c
@@ -26,7 +26,6 @@
 #include "char.h"
 
 #include "inter.h"
-#include "int_pet.h"
 #include "int_guild.h"
 #include "int_party.h"
 #include "int_storage.h"
@@ -237,7 +236,7 @@ int mmo_char_tostr(char *str, struct mmo_charstatus *p) {
 	  p->str, p->agi, p->vit, p->int_, p->dex, p->luk,
 	  p->status_point, p->skill_point,
 	  p->option, p->karma, p->manner,	//
-	  p->party_id, p->guild_id, p->pet_id,
+	  p->party_id, p->guild_id, 0,
 	  p->hair, p->hair_color, p->clothes_color,
 	  p->weapon, p->shield, p->head_top, p->head_mid, p->head_bottom,
 	  p->last_point.map, p->last_point.x, p->last_point.y, //
@@ -384,7 +383,7 @@ int mmo_char_fromstr(char *str, struct mmo_charstatus *p) {
 	p->manner = tmp_int[23];
 	p->party_id = tmp_int[24];
 	p->guild_id = tmp_int[25];
-	p->pet_id = tmp_int[26];
+//	p->pet_id = tmp_int[26];
 	p->hair = tmp_int[27];
 	p->hair_color = tmp_int[28];
 	p->clothes_color = tmp_int[29];
@@ -1470,15 +1469,6 @@ int disconnect_player(int accound_id) {
 static int char_delete(struct mmo_charstatus *cs) {
 	int j;
 
-	// �y�b�g�폜
-	if (cs->pet_id)
-		inter_pet_delete(cs->pet_id);
-	for (j = 0; j < MAX_INVENTORY; j++)
-		if (cs->inventory[j].card[0] == (short)0xff00)
-			inter_pet_delete(*((long *)(&cs->inventory[j].card[2])));
-	for (j = 0; j < MAX_CART; j++)
-		if (cs->cart[j].card[0] == (short)0xff00)
-			inter_pet_delete(*((long *)(&cs->cart[j].card[2])));
 	// �M���h�E��
 	if (cs->guild_id)
 		inter_guild_leave(cs->guild_id, cs->account_id, cs->char_id);
diff --git a/src/char/int_pet.c b/src/char/int_pet.c
deleted file mode 100644
index cff1e43..0000000
--- a/src/char/int_pet.c
+++ /dev/null
@@ -1,364 +0,0 @@
-// $Id: int_pet.c,v 1.1.1.1 2004/09/10 17:26:51 MagicalTux Exp $
-#include "inter.h"
-#include "int_pet.h"
-#include "mmo.h"
-#include "char.h"
-#include "socket.h"
-#include "db.h"
-#include "lock.h"
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-
-char pet_txt[1024]="save/pet.txt";
-
-static struct dbt *pet_db;
-static int pet_newid = 100;
-
-int inter_pet_tostr(char *str,struct s_pet *p)
-{
-	int len;
-
-	if(p->hungry < 0)
-		p->hungry = 0;
-	else if(p->hungry > 100)
-		p->hungry = 100;
-	if(p->intimate < 0)
-		p->intimate = 0;
-	else if(p->intimate > 1000)
-		p->intimate = 1000;
-
-	len=sprintf(str,"%d,%d,%s\t%d,%d,%d,%d,%d,%d,%d,%d,%d",
-		p->pet_id,p->class,p->name,p->account_id,p->char_id,p->level,p->egg_id,
-		p->equip,p->intimate,p->hungry,p->rename_flag,p->incuvate);
-
-	return 0;
-}
-
-int inter_pet_fromstr(char *str,struct s_pet *p)
-{
-	int s;
-	int tmp_int[16];
-	char tmp_str[256];
-	
-	memset(p,0,sizeof(struct s_pet));
-	
-//	printf("sscanf pet main info\n");
-	s=sscanf(str,"%d,%d,%[^\t]\t%d,%d,%d,%d,%d,%d,%d,%d,%d",&tmp_int[0],&tmp_int[1],tmp_str,&tmp_int[2],
-		&tmp_int[3],&tmp_int[4],&tmp_int[5],&tmp_int[6],&tmp_int[7],&tmp_int[8],&tmp_int[9],&tmp_int[10]);
-
-	if(s!=12)
-		return 1;
-	
-	p->pet_id = tmp_int[0];
-	p->class = tmp_int[1];
-	memcpy(p->name,tmp_str,24);
-	p->account_id = tmp_int[2];
-	p->char_id = tmp_int[3];
-	p->level = tmp_int[4];
-	p->egg_id = tmp_int[5];
-	p->equip = tmp_int[6];
-	p->intimate = tmp_int[7];
-	p->hungry = tmp_int[8];
-	p->rename_flag = tmp_int[9];
-	p->incuvate = tmp_int[10];
-
-	if(p->hungry < 0)
-		p->hungry = 0;
-	else if(p->hungry > 100)
-		p->hungry = 100;
-	if(p->intimate < 0)
-		p->intimate = 0;
-	else if(p->intimate > 1000)
-		p->intimate = 1000;
-
-	return 0;
-}
-
-int inter_pet_init()
-{
-	char line[8192];
-	struct s_pet *p;
-	FILE *fp;
-	int c=0;
-
-	pet_db=numdb_init();
-
-	if( (fp=fopen(pet_txt,"r"))==NULL )
-		return 1;
-	while(fgets(line,sizeof(line),fp)){
-		p=calloc(sizeof(struct s_pet), 1);
-		if(p==NULL){
-			printf("int_pet: out of memory!\n");
-			exit(0);
-		}
-		memset(p,0,sizeof(struct s_pet));
-		if(inter_pet_fromstr(line,p)==0 && p->pet_id>0){
-			if( p->pet_id >= pet_newid)
-				pet_newid=p->pet_id+1;
-			numdb_insert(pet_db,p->pet_id,p);
-		}else{
-			printf("int_pet: broken data [%s] line %d\n",pet_txt,c);
-			free(p);
-		}
-		c++;
-	}
-	fclose(fp);
-//	printf("int_pet: %s read done (%d pets)\n",pet_txt,c);
-	return 0;
-}
-
-int inter_pet_save_sub(void *key,void *data,va_list ap)
-{
-	char line[8192];
-	FILE *fp;
-	inter_pet_tostr(line,(struct s_pet *)data);
-	fp=va_arg(ap,FILE *);
-	fprintf(fp,"%s" RETCODE,line);
-	return 0;
-}
-
-int inter_pet_save()
-{
-	FILE *fp;
-	int lock;
-	if( (fp=lock_fopen(pet_txt,&lock))==NULL ){
-		printf("int_pet: cant write [%s] !!! data is lost !!!\n",pet_txt);
-		return 1;
-	}
-	numdb_foreach(pet_db,inter_pet_save_sub,fp);
-	lock_fclose(fp,pet_txt,&lock);
-//	printf("int_pet: %s saved.\n",pet_txt);
-	return 0;
-}
-
-int inter_pet_delete(int pet_id)
-{
-	struct s_pet *p;
-	p = numdb_search(pet_db,pet_id);
-	if( p == NULL)
-		return 1;
-	else {
-		numdb_erase(pet_db,pet_id);
-		printf("pet_id: %d deleted\n",pet_id);
-	}
-	return 0;
-}
-
-int mapif_pet_created(int fd,int account_id,struct s_pet *p)
-{
-	WFIFOW(fd,0)=0x3880;
-	WFIFOL(fd,2)=account_id;
-	if(p!=NULL){
-		WFIFOB(fd,6)=0;
-		WFIFOL(fd,7)=p->pet_id;
-		printf("int_pet: created! %d %s\n",p->pet_id,p->name);
-	}else{
-		WFIFOB(fd,6)=1;
-		WFIFOL(fd,7)=0;
-	}
-	WFIFOSET(fd,11);
-
-	return 0;
-}
-
-int mapif_pet_info(int fd,int account_id,struct s_pet *p)
-{
-	WFIFOW(fd,0)=0x3881;
-	WFIFOW(fd,2)=sizeof(struct s_pet) + 9;
-	WFIFOL(fd,4)=account_id;
-	WFIFOB(fd,8)=0;
-	memcpy(WFIFOP(fd,9),p,sizeof(struct s_pet));
-	WFIFOSET(fd,WFIFOW(fd,2));
-
-	return 0;
-}
-
-int mapif_pet_noinfo(int fd,int account_id)
-{
-	WFIFOW(fd,0)=0x3881;
-	WFIFOW(fd,2)=sizeof(struct s_pet) + 9;
-	WFIFOL(fd,4)=account_id;
-	WFIFOB(fd,8)=1;
-	memset(WFIFOP(fd,9),0,sizeof(struct s_pet));
-	WFIFOSET(fd,WFIFOW(fd,2));
-
-	return 0;
-}
-
-int mapif_save_pet_ack(int fd,int account_id,int flag)
-{
-	WFIFOW(fd,0)=0x3882;
-	WFIFOL(fd,2)=account_id;
-	WFIFOB(fd,6)=flag;
-	WFIFOSET(fd,7);
-
-	return 0;
-}
-
-int mapif_delete_pet_ack(int fd,int flag)
-{
-	WFIFOW(fd,0)=0x3883;
-	WFIFOB(fd,2)=flag;
-	WFIFOSET(fd,3);
-
-	return 0;
-}
-
-int mapif_create_pet(int fd,int account_id,int char_id,short pet_class,short pet_lv,short pet_egg_id,
-	short pet_equip,short intimate,short hungry,char rename_flag,char incuvate,char *pet_name)
-{
-	struct s_pet *p;
-	p=malloc(sizeof(struct s_pet));
-	if(p==NULL){
-		printf("int_pet: out of memory !\n");
-		mapif_pet_created(fd,account_id,NULL);
-		return 0;
-	}
-	memset(p,0,sizeof(struct s_pet));
-	p->pet_id = pet_newid++;
-	memcpy(p->name,pet_name,24);
-	if(incuvate == 1)
-		p->account_id = p->char_id = 0;
-	else {
-		p->account_id = account_id;
-		p->char_id = char_id;
-	}
-	p->class = pet_class;
-	p->level = pet_lv;
-	p->egg_id = pet_egg_id;
-	p->equip = pet_equip;
-	p->intimate = intimate;
-	p->hungry = hungry;
-	p->rename_flag = rename_flag;
-	p->incuvate = incuvate;
-
-	if(p->hungry < 0)
-		p->hungry = 0;
-	else if(p->hungry > 100)
-		p->hungry = 100;
-	if(p->intimate < 0)
-		p->intimate = 0;
-	else if(p->intimate > 1000)
-		p->intimate = 1000;
-	
-	numdb_insert(pet_db,p->pet_id,p);
-	
-	mapif_pet_created(fd,account_id,p);
-	
-	return 0;
-}
-
-int mapif_load_pet(int fd,int account_id,int char_id,int pet_id)
-{
-	struct s_pet *p;
-	p=numdb_search(pet_db,pet_id);
-	if(p!=NULL) {
-		if(p->incuvate == 1) {
-			p->account_id = p->char_id = 0;
-			mapif_pet_info(fd,account_id,p);
-		}
-		else if(account_id == p->account_id && char_id == p->char_id)
-			mapif_pet_info(fd,account_id,p);
-		else
-			mapif_pet_noinfo(fd,account_id);
-	}
-	else
-		mapif_pet_noinfo(fd,account_id);
-
-	return 0;
-}
-
-int mapif_save_pet(int fd,int account_id,struct s_pet *data)
-{
-	struct s_pet *p;
-	int pet_id;
-	int len=RFIFOW(fd,2);
-	if(sizeof(struct s_pet)!=len-8) {
-		printf("inter pet: data size error %d %d\n",sizeof(struct s_pet),len-8);
-	}
-	else{
-		pet_id = data->pet_id;
-		p=numdb_search(pet_db,pet_id);
-		if(p == NULL) {
-			p=malloc(sizeof(struct s_pet));
-			if(p==NULL){
-				printf("int_pet: out of memory !\n");
-				mapif_save_pet_ack(fd,account_id,1);
-				return 0;
-			}
-			memset(p,0,sizeof(struct s_pet));
-			p->pet_id = data->pet_id;
-			if(p->pet_id == 0)
-				data->pet_id = p->pet_id = pet_newid++;
-			numdb_insert(pet_db,p->pet_id,p);		
-		}
-		if(data->hungry < 0)
-			data->hungry = 0;
-		else if(data->hungry > 100)
-			data->hungry = 100;
-		if(data->intimate < 0)
-			data->intimate = 0;
-		else if(data->intimate > 1000)
-			data->intimate = 1000;
-		memcpy(p,data,sizeof(struct s_pet));
-		if(p->incuvate == 1)
-			p->account_id = p->char_id = 0;
-
-		mapif_save_pet_ack(fd,account_id,0);
-	}
-
-	return 0;
-}
-
-int mapif_delete_pet(int fd,int pet_id)
-{
-	mapif_delete_pet_ack(fd,inter_pet_delete(pet_id));
-
-	return 0;
-}
-
-int mapif_parse_CreatePet(int fd)
-{
-	mapif_create_pet(fd,RFIFOL(fd,2),RFIFOL(fd,6),RFIFOW(fd,10),RFIFOW(fd,12),RFIFOW(fd,14),RFIFOW(fd,16),RFIFOL(fd,18),
-		RFIFOL(fd,20),RFIFOB(fd,22),RFIFOB(fd,23),RFIFOP(fd,24));
-	return 0;
-}
-
-int mapif_parse_LoadPet(int fd)
-{
-	mapif_load_pet(fd,RFIFOL(fd,2),RFIFOL(fd,6),RFIFOL(fd,10));
-	return 0;
-}
-
-int mapif_parse_SavePet(int fd)
-{
-	mapif_save_pet(fd,RFIFOL(fd,4),(struct s_pet *)RFIFOP(fd,8));
-	return 0;
-}
-
-int mapif_parse_DeletePet(int fd)
-{
-	mapif_delete_pet(fd,RFIFOL(fd,2));
-	return 0;
-}
-
-// map server ����̒ʐM
-// �E�P�p�P�b�g�̂݉�͂��邱��
-// �E�p�P�b�g���f�[�^��inter.c�ɃZ�b�g���Ă�������
-// �E�p�P�b�g���`�F�b�N��ARFIFOSKIP�͌Ăяo�����ōs����̂ōs���Ă͂Ȃ�Ȃ�
-// �E�G���[�Ȃ�0(false)�A�����łȂ��Ȃ�1(true)���������Ȃ���΂Ȃ�Ȃ�
-int inter_pet_parse_frommap(int fd)
-{
-	switch(RFIFOW(fd,0)){
-	case 0x3080: mapif_parse_CreatePet(fd); break;
-	case 0x3081: mapif_parse_LoadPet(fd); break;
-	case 0x3082: mapif_parse_SavePet(fd); break;
-	case 0x3083: mapif_parse_DeletePet(fd); break;
-	default:
-		return 0;
-	}
-	return 1;
-}
-
diff --git a/src/char/int_pet.h b/src/char/int_pet.h
deleted file mode 100644
index 993f913..0000000
--- a/src/char/int_pet.h
+++ /dev/null
@@ -1,13 +0,0 @@
-// $Id: int_pet.h,v 1.1.1.1 2004/09/10 17:26:51 MagicalTux Exp $
-#ifndef _INT_PET_H_
-#define _INT_PET_H_
-
-int inter_pet_init();
-int inter_pet_save();
-int inter_pet_delete(int pet_id);
-
-int inter_pet_parse_frommap(int fd);
-
-extern char pet_txt[1024];
-
-#endif
diff --git a/src/char/int_storage.c b/src/char/int_storage.c
index 8b656fc..b84b586 100644
--- a/src/char/int_storage.c
+++ b/src/char/int_storage.c
@@ -1,7 +1,6 @@
 // $Id: int_storage.c,v 1.1.1.1 2004/09/10 17:26:51 MagicalTux Exp $
 #include "inter.h"
 #include "int_storage.h"
-#include "int_pet.h"
 #include "int_guild.h"
 #include "mmo.h"
 #include "char.h"
@@ -354,11 +353,6 @@ int inter_storage_delete(int account_id)
 {
 	struct storage *s = numdb_search(storage_db,account_id);
 	if(s) {
-		int i;
-		for(i=0;i<s->storage_amount;i++){
-			if(s->storage[i].card[0] == (short)0xff00)
-				inter_pet_delete(*((long *)(&s->storage[i].card[2])));
-		}
 		numdb_erase(storage_db,account_id);
 		free(s);
 	}
@@ -370,11 +364,6 @@ int inter_guild_storage_delete(int guild_id)
 {
 	struct guild_storage *gs = numdb_search(guild_storage_db,guild_id);
 	if(gs) {
-		int i;
-		for(i=0;i<gs->storage_amount;i++){
-			if(gs->storage[i].card[0] == (short)0xff00)
-				inter_pet_delete(*((long *)(&gs->storage[i].card[2])));
-		}
 		numdb_erase(guild_storage_db,guild_id);
 		free(gs);
 	}
diff --git a/src/char/inter.c b/src/char/inter.c
index 29ec57b..98e7ad0 100644
--- a/src/char/inter.c
+++ b/src/char/inter.c
@@ -11,7 +11,6 @@
 #include "int_party.h"
 #include "int_guild.h"
 #include "int_storage.h"
-#include "int_pet.h"
 #include "lock.h"
 
 #define WISDATA_TTL (60*1000)	// Existence time of Wisp/page data (60 seconds)
@@ -193,8 +192,6 @@ int inter_config_read(const char *cfgName) {
 			strncpy(party_txt, w2, sizeof(party_txt));
 		} else if (strcmpi(w1, "guild_txt") == 0) {
 			strncpy(guild_txt, w2, sizeof(guild_txt));
-		} else if (strcmpi(w1, "pet_txt") == 0) {
-			strncpy(pet_txt, w2, sizeof(pet_txt));
 		} else if (strcmpi(w1, "castle_txt") == 0) {
 			strncpy(castle_txt, w2, sizeof(castle_txt));
 		} else if (strcmpi(w1, "accreg_txt") == 0) {
@@ -238,7 +235,6 @@ int inter_save() {
 	inter_guild_save();
 	inter_storage_save();
 	inter_guild_storage_save();
-	inter_pet_save();
 	inter_accreg_save();
 
 	return 0;
@@ -253,7 +249,6 @@ int inter_init(const char *file) {
 	inter_party_init();
 	inter_guild_init();
 	inter_storage_init();
-	inter_pet_init();
 	inter_accreg_init();
 
 	return 0;
@@ -535,8 +530,6 @@ int inter_parse_frommap(int fd) {
 			break;
 		if (inter_storage_parse_frommap(fd))
 			break;
-		if (inter_pet_parse_frommap(fd))
-			break;
 		return 0;
 	}
 	RFIFOSKIP(fd, len);
diff --git a/src/common/mmo.h b/src/common/mmo.h
index 4105135..377f0b8 100644
--- a/src/common/mmo.h
+++ b/src/common/mmo.h
@@ -8,7 +8,6 @@
 #include "utils.h" // LCCWIN32
 
 #ifdef CYGWIN
-// txt��log�Ȃǂ̏����o���t�@�C���̉��s�R�[�h
 #define RETCODE	"\r\n"	// (CR/LF�FWindows�n)
 #else
 #define RETCODE "\n"	// (LF�FUnix�n�j
@@ -64,9 +63,6 @@
 
 #define MAX_STATUS_TYPE 5
 
-#define WEDDING_RING_M 2634
-#define WEDDING_RING_F 2635
-
 #define CHAR_CONF_NAME  "conf/char_athena.conf"
 
 struct item {
@@ -95,21 +91,6 @@ struct global_reg {
 	int value;
 };
 
-struct s_pet {
-	int account_id;
-	int char_id;
-	int pet_id;
-	short class;
-	short level;
-	short egg_id;//pet egg id
-	short equip;//pet equip name_id
-	short intimate;//pet friendly
-	short hungry;//pet hungry
-	char name[24];
-	char rename_flag;
-	char incuvate;
-};
-
 struct mmo_charstatus {
 	int char_id;
 	int account_id;
@@ -122,7 +103,7 @@ struct mmo_charstatus {
 	int hp,max_hp,sp,max_sp;
 	short option,karma,manner;
 	short hair,hair_color,clothes_color;
-	int party_id,guild_id,pet_id;
+	int party_id,guild_id;
 
 	short weapon,shield;
 	short head_top,head_mid,head_bottom;
diff --git a/src/map/Makefile b/src/map/Makefile
index effb407..0201e59 100644
--- a/src/map/Makefile
+++ b/src/map/Makefile
@@ -15,7 +15,7 @@ map-server: obj/magic-interpreter-lexer.o obj/magic-interpreter-parser.o obj/mag
 	$(CC) -o ../../$@ $> $(LIBS)
 
 obj/%.o: %.c
-	$(COMPILE.c) -DTXT_ONLY $(OUTPUT_OPTION) $<
+	$(COMPILE.c) $(OUTPUT_OPTION) $<
 
 magic-interpreter-lexer.c: magic-interpreter.l
 	$(LEX) -o magic-interpreter-lexer.c magic-interpreter.l
diff --git a/src/map/atcommand.c b/src/map/atcommand.c
index cf26775..9dab48f 100644
--- a/src/map/atcommand.c
+++ b/src/map/atcommand.c
@@ -32,10 +32,6 @@
 
 #include "core.h"
 
-#ifndef TXT_ONLY
-#include "mail.h"
-#endif
-
 #define STATE_BLIND 0x10
 
 static char command_symbol = '@'; // first char of the commands (by [Yor])
@@ -333,11 +329,7 @@ static AtCommandInfo atcommand_info[] = {
 	{ AtCommand_ReloadItemDB,        "@reloaditemdb",    99, atcommand_reloaditemdb }, // admin command
 	{ AtCommand_ReloadMobDB,         "@reloadmobdb",     99, atcommand_reloadmobdb }, // admin command
 	{ AtCommand_ReloadSkillDB,       "@reloadskilldb",   99, atcommand_reloadskilldb }, // admin command
-#ifndef TXT_ONLY
-	{ AtCommand_Rehash,              "@rehash",          99, atcommand_rehash }, // admin command
-#else /* TXT_ONLY */
 	{ AtCommand_ReloadScript,        "@reloadscript",    99, atcommand_reloadscript }, // admin command
-#endif /* TXT_ONLY */
 	{ AtCommand_ReloadGMDB,          "@reloadgmdb",      99, atcommand_reloadgmdb }, // admin command
 	{ AtCommand_CharReset,           "@charreset",       60, atcommand_charreset },
 	{ AtCommand_CharModel,           "@charmodel",       50, atcommand_charmodel },
@@ -441,17 +433,6 @@ static AtCommandInfo atcommand_info[] = {
         { AtCommand_IterateForward, "@hugo", 60, atcommand_iterate_forward_over_players }, // [Fate]
         { AtCommand_IterateBackward, "@linus", 60, atcommand_iterate_backwards_over_players }, // [Fate]
 
-#ifndef TXT_ONLY // sql-only commands
-	{ AtCommand_CheckMail,		 "@checkmail",	      1, atcommand_listmail }, // [Valaris]
-	{ AtCommand_ListMail,		 "@listmail",	      1, atcommand_listmail }, // [Valaris]
-	{ AtCommand_ListNewMail,	 "@listnewmail",      1, atcommand_listmail }, // [Valaris]
-	{ AtCommand_ReadMail,		 "@readmail",	      1, atcommand_readmail }, // [Valaris]
-	{ AtCommand_DeleteMail,		 "@deletemail",	      1, atcommand_readmail }, // [Valaris]
-	{ AtCommand_SendMail,		 "@sendmail",	      1, atcommand_sendmail }, // [Valaris]
-	{ AtCommand_SendPriorityMail,	 "@sendprioritymail",80, atcommand_sendmail }, // [Valaris]
-	{ AtCommand_RefreshOnline,	 "@refreshonline",   99, atcommand_refreshonline }, // [Valaris]
-#endif /* TXT_ONLY */
-
 // add new commands before this line
 	{ AtCommand_Unknown,             NULL,                1, NULL }
 };
@@ -775,37 +756,6 @@ static int atkillmonster_sub(struct block_list *bl, va_list ap) {
 	return 0;
 }
 
-#ifndef TXT_ONLY
-static int atkillnpc_sub(struct block_list *bl, va_list ap)
-{
-        int flag = va_arg(ap,int);
-
-        nullpo_retr(0, bl);
-
-        npc_delete((struct npc_data *)bl);
-
-        flag = 0;
-
-        return 0;
-}
-
-void rehash( const int fd, struct map_session_data* sd )
-{
-        int map_id = 0;
-
-        int LOADED_MAPS = map_num;
-	
-        for (map_id = 0; map_id < LOADED_MAPS;map_id++) {
-
-            if (map_id > LOADED_MAPS)
-                break;
-
-            map_foreachinarea(atkillmonster_sub, map_id, 0, 0, map[map_id].xs, map[map_id].ys, BL_MOB, 0);
-            map_foreachinarea(atkillnpc_sub, map_id, 0, 0, map[map_id].xs, map[map_id].ys, BL_NPC, 0);
-        }
-}
-
-#endif /* not TXT_ONLY */
 /*==========================================
  * Read Message Data
  *------------------------------------------
@@ -5270,22 +5220,10 @@ int atcommand_reloadskilldb(
  *
  *------------------------------------------
  */
-#ifndef TXT_ONLY
-int atcommand_rehash(
-#else /* TXT_ONLY */
 int atcommand_reloadscript(
-#endif /* TXT_ONLY */
 	const int fd, struct map_session_data* sd,
 	const char* command, const char* message)
 {
-#ifndef TXT_ONLY
-	atcommand_broadcast( fd, sd, "@broadcast", "eAthena SQL Server is Rehashing..." );
-	atcommand_broadcast( fd, sd, "@broadcast", "You will feel a bit of lag at this point !" );
-	
-        rehash( fd, sd );
-
-	atcommand_broadcast( fd, sd, "@broadcast", "Reloading NPCs..." );
-#endif /* not TXT_ONLY */
 	do_init_npc();
 	do_init_script();
 
@@ -7414,101 +7352,6 @@ int atcommand_unmute(
 	return 0;
 }
 
-#ifndef TXT_ONLY  /* Begin SQL-Only commands */
-
-/*==========================================
- * Mail System commands by [Valaris]
- *------------------------------------------
- */
-int atcommand_listmail(
-	const int fd, struct map_session_data* sd,
-	const char* command, const char* message)
-{
-	if(!battle_config.mail_system)
-		return 0;
-
-	nullpo_retr(-1, sd);
-
-	if(strlen(command)==12)
-		mail_check(sd,3);
-	else if(strlen(command)==9)
-		mail_check(sd,2);
-	else 
-		mail_check(sd,1);
-	return 0;
-}
-
-int atcommand_readmail(
-	const int fd, struct map_session_data* sd,
-	const char* command, const char* message)
-{
-	if(!battle_config.mail_system)
-		return 0;
-
-	nullpo_retr(-1, sd);
-
-	if (!message || !*message) {
-		clif_displaymessage(sd->fd,"You must specify a message number.");
-		return 0;
-	}
-
-	if(strlen(command)==11)
-		mail_delete(sd,atoi(message));
-	else
-		mail_read(sd,atoi(message));
-
-	return 0;
-}
-
-int atcommand_sendmail(
-	const int fd, struct map_session_data* sd,
-	const char* command, const char* message)
-{
-	if(!battle_config.mail_system)
-		return 0;
-
-	char name[24],text[80];
-
-	nullpo_retr(-1, sd);
-
-	if (!message || !*message) {
-		clif_displaymessage(sd->fd,"You must specify a recipient and a message.");
-		return 0;
-	}
-
-	if ((sscanf(message, "\"%[^\"]\" %79[^\n]", name, text) < 2) &&
-		(sscanf(message, "%23s %79[^\n]", name, text) < 2)) {
-		clif_displaymessage(sd->fd,"You must specify a recipient and a message.");
-		return 0;
-	}
-
-	if(strlen(command)==17)
-		mail_send(sd,name,text,1);
-	else 
-		mail_send(sd,name,text,0);
-
-	return 0;
-}
-
-/*==========================================
- * Refresh online command for SQL [Valaris]
- * Will refresh and check online column of
- * players and set correctly.
- *------------------------------------------
- */
-int atcommand_refreshonline(
-	const int fd, struct map_session_data* sd,
-	const char* command, const char* message)
-{
-	nullpo_retr(-1, sd);
-
-	char_online_check();
-	
-	return 0;
-}
-
-#endif /* end sql only */
-
 /* Magic atcommands by Fate */
 
 static int magic_base = TMW_MAGIC;
diff --git a/src/map/battle.c b/src/map/battle.c
index 40306b7..7d88413 100644
--- a/src/map/battle.c
+++ b/src/map/battle.c
@@ -4517,14 +4517,7 @@ int battle_config_read(const char *cfgName)
 		battle_config.spam_time = 3000;
 		battle_config.spam_threshold = 10;
 		battle_config.chat_maxline = 255;
-
-//SQL-only options start
-#ifndef TXT_ONLY 
-		battle_config.mail_system = 0;
-//SQL-only options end
-#endif
-
-}
+	}
 
 	fp = fopen(cfgName,"r");
 	if (fp == NULL) {
@@ -4730,12 +4723,7 @@ int battle_config_read(const char *cfgName)
 			{ "spam_ban",                          &battle_config.spam_ban		}, 
 			{ "spam_time",                         &battle_config.spam_time		}, 
 			{ "spam_threshold",                    &battle_config.spam_threshold	},
-			{ "chat_maxline",                      &battle_config.chat_maxline	},
-//SQL-only options start
-#ifndef TXT_ONLY 
-			{ "mail_system",		&battle_config.mail_system	}, // added by [Valaris]
-//SQL-only options end
-#endif
+			{ "chat_maxline",                      &battle_config.chat_maxline	}
 		};
 
 		if (line[0] == '/' && line[1] == '/')
diff --git a/src/map/battle.h b/src/map/battle.h
index 27b837b..65abac4 100644
--- a/src/map/battle.h
+++ b/src/map/battle.h
@@ -320,10 +320,6 @@ extern struct Battle_Config {
 
         int drop_pickup_safety_zone; // [Fate] Max. distance to an object dropped by a kill by self in which dropsteal protection works
 
-#ifndef TXT_ONLY /* SQL-only options */
-	int mail_system; // [Valaris]
-#endif
-
         int itemheal_regeneration_factor; // [Fate] itemheal speed factor
 
 } battle_config;
diff --git a/src/map/chrif.c b/src/map/chrif.c
index 228d061..4f8edf6 100644
--- a/src/map/chrif.c
+++ b/src/map/chrif.c
@@ -985,14 +985,6 @@ int check_connect_char_server(int tid, unsigned int tick, int id, int data) {
 		realloc_fifo(char_fd, FIFOSIZE_SERVERLINK, FIFOSIZE_SERVERLINK);
 
 		chrif_connect(char_fd);
-#ifndef TXT_ONLY
-		srvinfo = 0;
-	} else {
-		if (srvinfo == 0) {
-			chrif_ragsrvinfo(battle_config.base_exp_rate, battle_config.job_exp_rate, battle_config.item_rate_common);
-			srvinfo = 1;
-		}
-#endif /* not TXT_ONLY */
 	}
 
 	return 0;
diff --git a/src/map/itemdb.c b/src/map/itemdb.c
index 7b3f157..499b776 100644
--- a/src/map/itemdb.c
+++ b/src/map/itemdb.c
@@ -33,9 +33,6 @@ static int blue_box_default=0,violet_box_default=0,card_album_default=0,gift_box
 
 static void itemdb_read(void);
 static int itemdb_readdb(void);
-#ifndef TXT_ONLY
-static int itemdb_read_sqldb(void);
-#endif /* not TXT_ONLY */
 static int itemdb_read_randomitem();
 static int itemdb_read_itemavail(void);
 static int itemdb_read_itemnametable(void);
@@ -266,33 +263,6 @@ static int itemdb_read_itemslottable(void)
 	return 0;
 }
 
-#ifndef TXT_ONLY
-/*====================================
- * Removed item_value_db, don't re-add
- *------------------------------------
- */
-static void itemdb_read(void)
-{
-	itemdb_read_itemslottable();
-
-	if (db_use_sqldbs)
-	{
-		itemdb_read_sqldb();
-    }
-    else
-    {
-		itemdb_readdb();
-    }
-
-	itemdb_read_randomitem();
-	itemdb_read_itemavail();
-	itemdb_read_noequip();
-
-	if (!battle_config.item_name_override_grffile)
-		itemdb_read_itemnametable();
-}
-
-#endif /* not TXT_ONLY */
 /*==========================================
  * �A�C�e���f�[�^�x�[�X�̓ǂݍ���
  *------------------------------------------
@@ -551,7 +521,7 @@ static int itemdb_read_itemnametable(void)
 
 	return 0;
 }
-#ifdef TXT_ONLY
+
 /*==========================================
  * �J�[�h�C���X�g�̃��\�[�X���O�e�[�u����ǂݍ���
  *------------------------------------------
@@ -586,7 +556,7 @@ static int itemdb_read_cardillustnametable(void)
 
 	return 0;
 }
-#endif /* TXT_ONLY */
+
 /*==========================================
  * ���������t�@�C���ǂݏo��
  *------------------------------------------
@@ -629,170 +599,7 @@ static int itemdb_read_noequip(void)
 	printf("read db/item_noequip.txt done (count=%d)\n",ln);
 	return 0;
 }
-#ifndef TXT_ONLY
-
-/*======================================
-* SQL
-*===================================
-*/
-static int itemdb_read_sqldb(void)
-{
-	unsigned short	nameid;
-	struct			item_data *id;
-	char			script[65535 + 2 + 1]; // Maximum length of MySQL TEXT type (65535) + 2 bytes for curly brackets + 1 byte for terminator
-
-	// ----------
-
-	sprintf(tmp_sql, "SELECT * FROM `%s`", item_db_db);
-
-	// Execute the query; if the query execution succeeded...
-	if (mysql_query(&mmysql_handle, tmp_sql) == 0)
-	{
-		sql_res = mysql_store_result(&mmysql_handle);
-
-		// If the storage of the query result succeeded...
-		if (sql_res)
-		{
-			// Parse each row in the query result into sql_row
-			while ((sql_row = mysql_fetch_row(sql_res)))
-			{
-				/* +----+--------------+---------------+------+-----------+------------+--------+--------+---------+-------+-------+------------+---------------+-----------------+--------------+-------------+------+------------+--------------+
-				   |  0 |            1 |             2 |    3 |         4 |          5 |      6 |      7 |       8 |     9 |    10 |         11 |            12 |              13 |           14 |          15 |   16 |         17 |           18 |
-				   +----+--------------+---------------+------+-----------+------------+--------+--------+---------+-------+-------+------------+---------------+-----------------+--------------+-------------+------+------------+--------------+
-				   | id | name_english | name_japanese | type | price_buy | price_sell | weight | attack | defence | range | slots | equip_jobs | equip_genders | equip_locations | weapon_level | equip_level | view | script_use | script_equip |
-				   +----+--------------+---------------+------+-----------+------------+--------+--------+---------+-------+-------+------------+---------------+-----------------+--------------+-------------+------+------------+--------------+ */
-
-				nameid = atoi(sql_row[0]);
-
-				// If the identifier is not within the valid range, process the next row
-				if (nameid == 0 || nameid >= 20000)
-				{
-					continue;
-				}
-
-				// Insert a new row into the item database
-
-				/*id = calloc(sizeof(struct item_data), 1);
-
-				if (id == NULL)
-				{
-					printf("out of memory : itemdb_read_sqldb\n");
-					exit(1);
-				}
-
-				memset(id, 0, sizeof(struct item_data));
-				numdb_insert(item_db, (int) nameid, id);*/
-
-				// ----------
-				id=itemdb_search(nameid);
-				
-				memcpy(id->name, sql_row[1], 25);
-				memcpy(id->jname, sql_row[2], 25);
-
-				id->type = atoi(sql_row[3]);
-
-				// If price_buy is not NULL and price_sell is not NULL...
-				if ((sql_row[4] != NULL) && (sql_row[5] != NULL))
-				{
-					id->value_buy = atoi(sql_row[4]);
-					id->value_sell = atoi(sql_row[5]);
-				}
-				// If price_buy is not NULL and price_sell is NULL...
-				else if ((sql_row[4] != NULL) && (sql_row[5] == NULL))
-				{
-					id->value_buy = atoi(sql_row[4]);
-					id->value_sell = atoi(sql_row[4]) / 2;
-				}
-				// If price_buy is NULL and price_sell is not NULL...
-				else if ((sql_row[4] == NULL) && (sql_row[5] != NULL))
-				{
-					id->value_buy = atoi(sql_row[5]) * 2;
-					id->value_sell = atoi(sql_row[5]);
-				}
-				// If price_buy is NULL and price_sell is NULL...
-				if ((sql_row[4] == NULL) && (sql_row[5] == NULL))
-				{
-					id->value_buy = 0;
-					id->value_sell = 0;
-				}
-
-				id->weight	= atoi(sql_row[6]);
-
-				id->atk		= (sql_row[7] != NULL)		? atoi(sql_row[7])	: 0;
-				id->def		= (sql_row[8] != NULL)		? atoi(sql_row[8])	: 0;
-				id->range	= (sql_row[9] != NULL)		? atoi(sql_row[9])	: 0;
-				id->slot	= (sql_row[10] != NULL)		? atoi(sql_row[10])	: 0;
-				id->class	= (sql_row[11] != NULL)		? atoi(sql_row[11])	: 0;
-				id->sex		= (sql_row[12] != NULL)		? atoi(sql_row[12])	: 0;
-				id->equip	= (sql_row[13] != NULL)		? atoi(sql_row[13])	: 0;
-				id->wlv		= (sql_row[14] != NULL)		? atoi(sql_row[14])	: 0;
-				id->elv		= (sql_row[15] != NULL)		? atoi(sql_row[15])	: 0;
-				id->look	= (sql_row[16] != NULL)		? atoi(sql_row[16])	: 0;
-
-				id->view_id	= 0;
-
-				// ----------
-
-				if (sql_row[17] != NULL)
-				{
-                                        if (sql_row[17][0] == '{')
-					  id->use_script = parse_script(sql_row[17], 0);
-                                        else {
-					  sprintf(script, "{%s}", sql_row[17]);
-					  id->use_script = parse_script(script, 0);
-                                        }
-				}
-				else
-				{
-					id->use_script = NULL;
-				}
-
-				if (sql_row[18] != NULL)
-				{
-                                        if (sql_row[18][0] == '{')
-					  id->equip_script = parse_script(sql_row[18], 0);
-                                        else {
-					  sprintf(script, "{%s}", sql_row[18]);
-					  id->equip_script = parse_script(script, 0);
-                                        }
-				}
-				else
-				{
-					id->equip_script = NULL;
-				}
-
-				// ----------
-
-				id->flag.available		= 1;
-				id->flag.value_notdc	= 0;
-				id->flag.value_notoc	= 0;
-			}
-
-			// If the retrieval failed, output an error
-			if (mysql_errno(&mmysql_handle))
-			{
-				printf("Database server error (retrieving rows from %s): %s\n", item_db_db, mysql_error(&mmysql_handle));
-			}
-
-			printf("read %s done (count = %lu)\n", item_db_db, (unsigned long) mysql_num_rows(sql_res));
-		}
-		else
-		{
-			printf("MySQL error (storing query result for %s): %s\n", item_db_db, mysql_error(&mmysql_handle));
-		}
-
-		// Free the query result
-		mysql_free_result(sql_res);
-	}
-	else
-	{
-		printf("Database server error (executing query for %s): %s\n", item_db_db, mysql_error(&mmysql_handle));
-	}
-
-	return 0;
-}
 
-#endif /* not TXT_ONLY */
 /*==========================================
  *
  *------------------------------------------
@@ -850,7 +657,7 @@ void itemdebugtxt()
 	fclose(dfp);
 }
 */
-#ifdef TXT_ONLY
+
 /*====================================
  * Removed item_value_db, don't re-add
  *------------------------------------
@@ -866,7 +673,7 @@ static void itemdb_read(void)
 	if (!battle_config.item_name_override_grffile)
 		itemdb_read_itemnametable();
 }
-#endif /* TXT_ONLY */
+
 /*==========================================
  *
  *------------------------------------------
diff --git a/src/map/map.c b/src/map/map.c
index a9120f0..128d50b 100644
--- a/src/map/map.c
+++ b/src/map/map.c
@@ -40,55 +40,6 @@
 #include "memwatch.h"
 #endif
 
-#ifndef TXT_ONLY
-
-#include "mail.h" // mail system [Valaris]
-
-MYSQL mmysql_handle;
-MYSQL_RES* 	sql_res ;
-MYSQL_ROW	sql_row ;
-char tmp_sql[65535]="";
-
-MYSQL lmysql_handle;
-MYSQL_RES* lsql_res ;
-MYSQL_ROW  lsql_row ;
-char tmp_lsql[65535]="";
-
-MYSQL mail_handle; // mail system [Valaris]
-MYSQL_RES* 	mail_res ;
-MYSQL_ROW	mail_row ;
-char tmp_msql[65535]="";
-
-int map_server_port = 3306;
-char map_server_ip[16] = "127.0.0.1";
-char map_server_id[32] = "ragnarok";
-char map_server_pw[32] = "ragnarok";
-char map_server_db[32] = "ragnarok";
-int db_use_sqldbs = 0;
-
-int login_server_port = 3306;
-char login_server_ip[16] = "127.0.0.1";
-char login_server_id[32] = "ragnarok";
-char login_server_pw[32] = "ragnarok";
-char login_server_db[32] = "ragnarok";
-
-char item_db_db[32] = "item_db";
-char mob_db_db[32] = "mob_db";
-char login_db[32] = "login";
-char login_db_level[32] = "level";
-char login_db_account_id[32] = "account_id";
-
-int lowest_gm_level = 1;
-int read_gm_interval = 600000;
-
-char char_db[32] = "char";
-
-static int online_timer(int,unsigned int,int,int);
-
-int CHECK_INTERVAL = 3600000; // [Valaris]
-int check_online_timer=0; // [Valaris]
-
-#endif /* not TXT_ONLY */
 // �ɗ� static�Ń��[�J���Ɏ��߂�
 static struct dbt * id_db=NULL;
 static struct dbt * map_db=NULL;
@@ -1075,10 +1026,6 @@ int map_quit(struct map_session_data *sd) {
 
 	map_delblock(&sd->bl);
 
-#ifndef TXT_ONLY
-	chrif_char_offline(sd);
-#endif
-
 	numdb_erase(id_db,sd->bl.id);
 	strdb_erase(nick_db,sd->status.name);
 	numdb_erase(charid_db,sd->status.char_id);
@@ -1781,200 +1728,6 @@ int map_config_read(char *cfgName) {
 	return 0;
 }
 
-#ifndef TXT_ONLY
-/*=======================================
- *  MySQL Init
- *---------------------------------------
- */
-
-int map_sql_init(void){
-
-    mysql_init(&mmysql_handle);
-
-	//DB connection start
-	printf("Connect Map DB Server....\n");
-	if(!mysql_real_connect(&mmysql_handle, map_server_ip, map_server_id, map_server_pw,
-		map_server_db ,map_server_port, (char *)NULL, 0)) {
-			//pointer check
-			printf("%s\n",mysql_error(&mmysql_handle));
-			exit(1);
-	}
-	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,
-        login_server_db ,login_server_port, (char *)NULL, 0)) {
-	        //pointer check
-			printf("%s\n",mysql_error(&lmysql_handle));
-			exit(1);
-	}
-	 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,
-			map_server_db ,map_server_port, (char *)NULL, 0)) {
-				printf("%s\n",mysql_error(&mail_handle));
-				exit(1);
-		}
-	}
-
-	return 0;
-}
-
-int map_sql_close(void){
-	mysql_close(&mmysql_handle);
-	printf("Close Map DB Connection....\n");
-
-	mysql_close(&lmysql_handle);
-	printf("Close Login DB Connection....\n");
-	return 0;
-}
-
-int sql_config_read(char *cfgName)
-{
-	int i;
-	char line[1024],w1[1024],w2[1024];
-	FILE *fp;
-
-	fp=fopen(cfgName,"r");
-	if(fp==NULL){
-		printf("file not found: %s\n",cfgName);
-		return 1;
-	}
-	while(fgets(line,1020,fp)){
-		if(line[0] == '/' && line[1] == '/')
-			continue;
-		i=sscanf(line,"%[^:]: %[^\r\n]",w1,w2);
-		if(i!=2)
-			continue;
-		if(strcmpi(w1,"item_db_db")==0){
-			strcpy(item_db_db,w2);
-		} else if(strcmpi(w1,"mob_db_db")==0){
-			strcpy(mob_db_db,w2);
-		} else if(strcmpi(w1,"login_db_level")==0){
-			strcpy(login_db_level,w2);
-		} else if(strcmpi(w1,"login_db_account_id")==0){
-		    strcpy(login_db_account_id,w2);
-		} else if(strcmpi(w1,"login_db")==0){
-			strcpy(login_db,w2);
-		} else if (strcmpi(w1, "char_db") == 0) {
-			strcpy(char_db, w2); 
-		//Map Server SQL DB
-		} else if(strcmpi(w1,"map_server_ip")==0){
-			strcpy(map_server_ip, w2);
-			printf ("set map_server_ip : %s\n",w2);
-		} else if(strcmpi(w1,"map_server_port")==0){
-			map_server_port=atoi(w2);
-			printf ("set map_server_port : %s\n",w2);
-		} else if(strcmpi(w1,"map_server_id")==0){
-			strcpy(map_server_id, w2);
-			printf ("set map_server_id : %s\n",w2);
-		} else if(strcmpi(w1,"map_server_pw")==0){
-			strcpy(map_server_pw, w2);
-			printf ("set map_server_pw : %s\n",w2);
-		} else if(strcmpi(w1,"map_server_db")==0){
-			strcpy(map_server_db, w2);
-			printf ("set map_server_db : %s\n",w2);
-		//Map server option to use SQL db or not
-		} else if(strcmpi(w1,"use_sql_db")==0){
-			if (strcmpi(w2,"yes")){db_use_sqldbs=0;} else if (strcmpi(w2,"no")){db_use_sqldbs=1;}
-			printf ("Using SQL dbs: %s\n",w2);
-		//Login Server SQL DB
-		} else if(strcmpi(w1,"login_server_ip")==0){
-			strcpy(login_server_ip, w2);
-			printf ("set login_server_ip : %s\n",w2);
-        	} else if(strcmpi(w1,"login_server_port")==0){
-			login_server_port = atoi(w2);
-			printf ("set login_server_port : %s\n",w2);
-		} else if(strcmpi(w1,"login_server_id")==0){
-			strcpy(login_server_id, w2);
-			printf ("set login_server_id : %s\n",w2);
-		} else if(strcmpi(w1,"login_server_pw")==0){
-			strcpy(login_server_pw, w2);
-			printf ("set login_server_pw : %s\n",w2);
-		} else if(strcmpi(w1,"login_server_db")==0){
-			strcpy(login_server_db, w2);
-			printf ("set login_server_db : %s\n",w2);
-		} else if(strcmpi(w1,"lowest_gm_level")==0){
-			lowest_gm_level = atoi(w2);
-			printf ("set lowest_gm_level : %s\n",w2);
-		} else if(strcmpi(w1,"read_gm_interval")==0){
-			read_gm_interval = ( atoi(w2) * 60 * 1000 ); // Minutes multiplied by 60 secs per min by 1000 milliseconds per second
-			printf ("set read_gm_interval : %s\n",w2);
-		}
-	}
-	fclose(fp);
-
-	return 0;
-}
-
-// sql online status checking [Valaris]
-void char_offline(struct map_session_data *sd)
-{
-	if(sd && sd->status.char_id) {
-		sprintf(tmp_sql,"UPDATE `%s` SET `online`='0' WHERE `char_id`='%d'", char_db, sd->status.char_id);
-	        if(mysql_query(&mmysql_handle, tmp_sql) ) {
-			printf("DB server Error (update online `%s`)- %s\n", char_db, mysql_error(&mmysql_handle) );
-	        }
-	}
-}
-
-void do_reset_online(void)
-{
-	sprintf(tmp_sql,"UPDATE `%s` SET `online`='0' WHERE `online`='1'", char_db);
-	if(mysql_query(&mmysql_handle, tmp_sql) ) {
-		printf("DB server Error (reset_online `%s`)- %s\n", char_db, mysql_error(&mmysql_handle) );
-	}
-}
-
-int online_timer(int tid,unsigned int tick,int id,int data)
-{
-	if(check_online_timer != tid)
-		return 0;
-
-	char_online_check();
-
-	check_online_timer=add_timer(gettick()+CHECK_INTERVAL,online_timer,0,0);	
-
-	return 0;
-}
-
-void char_online_check(void)
-{
-	int i;
-	struct map_session_data *sd=NULL;
-
-	do_reset_online();
-
-	for(i=0;i<fd_max;i++){
-		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) {
-				sprintf(tmp_sql,"UPDATE `%s` SET `online`='1' WHERE `char_id`='%d'", char_db, sd->status.char_id);
-			        if(mysql_query(&mmysql_handle, tmp_sql) ) {
-					printf("DB server Error (update online `%s`)- %s\n", char_db, mysql_error(&mmysql_handle) );
-				}
-			}
-	}
-
-	
-	if(check_online_timer && check_online_timer != -1) {
-		delete_timer(check_online_timer,online_timer);
-		add_timer(gettick()+CHECK_INTERVAL,online_timer,0,0);
-	}
-
-}
-
-#endif /* not TXT_ONLY */
-
 int id_db_final(void *k,void *d,va_list ap){ return 0; }
 int map_db_final(void *k,void *d,va_list ap){ return 0; }
 int nick_db_final(void *k,void *d,va_list ap){ return 0; }
@@ -2038,10 +1791,6 @@ void do_final(void) {
 	do_final_itemdb();
 	do_final_storage();
         do_final_guild();
-#ifndef TXT_ONLY
-	do_reset_online();
-    map_sql_close();
-#endif /* not TXT_ONLY */
 }
 
 void map_helpscreen() {
@@ -2055,9 +1804,6 @@ void map_helpscreen() {
 int do_init(int argc, char *argv[]) {
 	int i;
 
-#ifndef TXT_ONLY
-	unsigned char *SQL_CONF_NAME="conf/inter_athena.conf";
-#endif
 	unsigned char *MAP_CONF_NAME = "conf/map_athena.conf";
 	unsigned char *BATTLE_CONF_FILENAME = "conf/battle_athena.conf";
 	unsigned char *ATCOMMAND_CONF_FILENAME = "conf/atcommand_athena.conf";
@@ -2083,10 +1829,6 @@ int do_init(int argc, char *argv[]) {
 			MSG_CONF_NAME = argv[i+1];
 		else if (strcmp(argv[i],"--grf_path_file") == 0)
 			GRF_PATH_FILENAME = argv[i+1];
-#ifndef TXT_ONLY
-		else if (strcmp(argv[i],"--sql_config") == 0)
-		    SQL_CONF_NAME = argv[i+1];
-#endif /* not TXT_ONLY */
 	}
 
 	map_config_read(MAP_CONF_NAME);
@@ -2094,9 +1836,6 @@ int do_init(int argc, char *argv[]) {
 	atcommand_config_read(ATCOMMAND_CONF_FILENAME);
 	script_config_read(SCRIPT_CONF_NAME);
 	msg_config_read(MSG_CONF_NAME);
-#ifndef TXT_ONLY
-	sql_config_read(SQL_CONF_NAME);
-#endif /* not TXT_ONLY */
 
 	atexit(do_final);
 
@@ -2104,9 +1843,6 @@ int do_init(int argc, char *argv[]) {
 	map_db = strdb_init(16);
 	nick_db = strdb_init(24);
 	charid_db = numdb_init();
-#ifndef TXT_ONLY
-	map_sql_init();
-#endif /* not TXT_ONLY */
 
 	grfio_init(GRF_PATH_FILENAME);
 
@@ -2114,11 +1850,6 @@ int do_init(int argc, char *argv[]) {
 
 	add_timer_func_list(map_clearflooritem_timer, "map_clearflooritem_timer");
 
-#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);	
-#endif /* not TXT_ONLY */
-
 	do_init_chrif();
 	do_init_clif();
 	do_init_itemdb();
@@ -2132,11 +1863,6 @@ int do_init(int argc, char *argv[]) {
 	do_init_skill();
         do_init_magic();
 
-#ifndef TXT_ONLY /* mail system [Valaris] */
-	if(battle_config.mail_system)	
-		do_init_mail();
-#endif /* not TXT_ONLY */
-
 	npc_event_do_oninit();	// npc��OnInit�C�x���g���s
 
 	if (battle_config.pk_mode == 1)
diff --git a/src/map/map.h b/src/map/map.h
index fa2d583..b3ff052 100644
--- a/src/map/map.h
+++ b/src/map/map.h
@@ -354,11 +354,6 @@ struct map_session_data {
 	char chat_lastmsg[513];
 	int chat_threshold;
 	int chat_repeatmsg;
-
-#ifndef TXT_ONLY
-	int mail_counter;	// mail counter for mail system [Valaris]
-#endif
-
 };
 
 struct npc_timerevent_list {
@@ -726,42 +721,4 @@ int map_who(int fd);
 void map_helpscreen(); // [Valaris]
 int map_delmap(char *mapname);
 
-#ifndef TXT_ONLY
-
-// MySQL
-#include <mysql.h>
-
-void char_online_check(void); // [Valaris]
-void char_offline(struct map_session_data *sd);
-
-extern MYSQL mmysql_handle;
-extern char tmp_sql[65535];
-extern MYSQL_RES* sql_res ;
-extern MYSQL_ROW	sql_row ;
-
-extern MYSQL lmysql_handle;
-extern char tmp_lsql[65535];
-extern MYSQL_RES* lsql_res ;
-extern MYSQL_ROW	lsql_row ;
-
-extern MYSQL mail_handle;
-extern MYSQL_RES* 	mail_res ;
-extern MYSQL_ROW	mail_row ;
-extern char tmp_msql[65535];
-
-extern int db_use_sqldbs;
-
-extern char item_db_db[32];
-extern char mob_db_db[32];
-extern char login_db[32];
-
-extern char login_db_level[32];
-extern char login_db_account_id[32];
-
-extern int lowest_gm_level;
-extern int read_gm_interval;
-
-extern char char_db[32];
-#endif /* not TXT_ONLY */
-
 #endif
diff --git a/src/map/mob.c b/src/map/mob.c
index 8f83c94..5a57472 100644
--- a/src/map/mob.c
+++ b/src/map/mob.c
@@ -4249,162 +4249,13 @@ void mob_reload(void)
 	do_init_mob();
 }
 
-#ifndef TXT_ONLY
-/*==========================================
- * SQL reading
- *------------------------------------------
- */
-static int mob_read_sqldb(void)
-{
-	char line[1024];
-	int i,class,ln=0;
-	char *str[55],*p,*np;
-	
-	memset(mob_db,0,sizeof(mob_db));
-	
-    sprintf (tmp_sql, "SELECT * FROM `%s`",mob_db_db);
-	if(mysql_query(&mmysql_handle, tmp_sql) ) {
-		printf("DB server Error (select %s to Memory)- %s\n",mob_db_db,mysql_error(&mmysql_handle) );
-	}
-	sql_res = mysql_store_result(&mmysql_handle);
-	if (sql_res) {
-		while((sql_row = mysql_fetch_row(sql_res))){
-            sprintf(line,"%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s",
-                        sql_row[0],sql_row[1],sql_row[2],sql_row[3],sql_row[4],
-                        sql_row[5],sql_row[6],sql_row[7],sql_row[8],sql_row[9],
-                        sql_row[10],sql_row[11],sql_row[12],sql_row[13],sql_row[14],
-                        sql_row[15],sql_row[16],sql_row[17],sql_row[18],sql_row[19],
-                        sql_row[20],sql_row[21],sql_row[22],sql_row[23],sql_row[24],
-                        sql_row[25],sql_row[26],sql_row[27],sql_row[28],sql_row[29],
-                        sql_row[30],sql_row[31],sql_row[32],sql_row[33],sql_row[34],
-                        sql_row[35],sql_row[36],sql_row[37],sql_row[38],sql_row[39],
-                        sql_row[40],sql_row[41],sql_row[42],sql_row[43],sql_row[44],
-                        sql_row[45],sql_row[46],sql_row[47],sql_row[48],sql_row[49],
-                        sql_row[50],sql_row[51],sql_row[52]);
-
-			for(i=0,p=line;i<55;i++){
-				if((np=strchr(p,','))!=NULL){
-					str[i]=p;
-					*np=0;
-					p=np+1;
-				} else
-					str[i]=p;
-			}
-	
-			class=atoi(str[0]);
-			if(class<=1000 || class>2000)
-				continue;
-			
-			ln++;
-			
-			mob_db[class].view_class=class;
-			memcpy(mob_db[class].name,str[1],24);
-			memcpy(mob_db[class].jname,str[2],24);
-			mob_db[class].lv=atoi(str[3]);
-			mob_db[class].max_hp=atoi(str[4]);
-			mob_db[class].max_sp=atoi(str[5]);
-			mob_db[class].base_exp=atoi(str[6])*
-					battle_config.base_exp_rate/100;
-			if(mob_db[class].base_exp <= 0)
-				mob_db[class].base_exp = 1;
-			mob_db[class].job_exp=atoi(str[7])*
-					battle_config.job_exp_rate/100;
-			if(mob_db[class].job_exp <= 0)
-				mob_db[class].job_exp = 1;
-			mob_db[class].range=atoi(str[8]);
-			mob_db[class].atk1=atoi(str[9]);
-			mob_db[class].atk2=atoi(str[10]);
-			mob_db[class].def=atoi(str[11]);
-			mob_db[class].mdef=atoi(str[12]);
-			mob_db[class].str=atoi(str[13]);
-			mob_db[class].agi=atoi(str[14]);
-			mob_db[class].vit=atoi(str[15]);
-			mob_db[class].int_=atoi(str[16]);
-			mob_db[class].dex=atoi(str[17]);
-			mob_db[class].luk=atoi(str[18]);
-			mob_db[class].range2=atoi(str[19]);
-			mob_db[class].range3=atoi(str[20]);
-			mob_db[class].size=atoi(str[21]);
-			mob_db[class].race=atoi(str[22]);
-			mob_db[class].element=atoi(str[23]);
-			mob_db[class].mode=atoi(str[24]);
-			mob_db[class].speed=atoi(str[25]);
-			mob_db[class].adelay=atoi(str[26]);
-			mob_db[class].amotion=atoi(str[27]);
-			mob_db[class].dmotion=atoi(str[28]);
-
-            for(i=0;i<8;i++){
-				int rate = 0,type,ratemin,ratemax;
-				mob_db[class].dropitem[i].nameid=atoi(str[29+i*2]);
-				type = itemdb_type(mob_db[class].dropitem[i].nameid);
-				if (type == 0) {							// Added by Valaris
-					rate = battle_config.item_rate_heal;
-					ratemin = battle_config.item_drop_heal_min;
-					ratemax = battle_config.item_drop_heal_max;
-				}
-				else if (type == 2) {
-					rate = battle_config.item_rate_use;
-					ratemin = battle_config.item_drop_use_min;
-					ratemax = battle_config.item_drop_use_max;	// End
-				}
-				else if (type == 4 || type == 5 || type == 8) {
-					rate = battle_config.item_rate_equip;
-					ratemin = battle_config.item_drop_equip_min;
-					ratemax = battle_config.item_drop_equip_max;
-				}
-				else if (type == 6) {
-					rate = battle_config.item_rate_card;
-					ratemin = battle_config.item_drop_card_min;
-					ratemax = battle_config.item_drop_card_max;
-				}
-				else {
-					rate = battle_config.item_rate_common;
-					ratemin = battle_config.item_drop_common_min;
-					ratemax = battle_config.item_drop_common_max;
-				}
-				rate = (rate / 100) * atoi(str[30+i*2]);
-				rate = (rate < ratemin)? ratemin: (rate > ratemax)? ratemax: rate;
-				mob_db[class].dropitem[i].p = rate;
-			}
-			
-			mob_db[class].mexp=atoi(str[45])*battle_config.mvp_exp_rate/100;
-			mob_db[class].mexpper=atoi(str[46]);
-			for(i=0;i<3;i++){
-				mob_db[class].mvpitem[i].nameid=atoi(str[47+i*2]);
-				mob_db[class].mvpitem[i].p=atoi(str[48+i*2])*battle_config.mvp_item_rate/100;
-			}
-			for(i=0;i<MAX_RANDOMMONSTER;i++)
-				mob_db[class].summonper[i]=0;
-			mob_db[class].maxskill=0;
-			
-			mob_db[class].sex=0;
-			mob_db[class].hair=0;
-			mob_db[class].hair_color=0;
-			mob_db[class].weapon=0;
-			mob_db[class].shield=0;
-			mob_db[class].head_top=0;
-			mob_db[class].head_mid=0;
-			mob_db[class].head_buttom=0;
-		}
-		mysql_free_result(sql_res);
-		printf("read %s done (count=%d)\n",mob_db_db,ln);
-	}
-	return 0;
-}
-
-#endif /* not TXT_ONLY */
 /*==========================================
  * Circumference initialization of mob
  *------------------------------------------
  */
 int do_init_mob(void)
 {
-#ifndef TXT_ONLY
-    if(db_use_sqldbs)
-        mob_read_sqldb();
-    else 
-#endif /* TXT_ONLY */
-        mob_readdb();
+	mob_readdb();
 
 	mob_readdb_mobavail();
 	mob_read_randommonster();
diff --git a/src/map/pc.c b/src/map/pc.c
index 8fd1a72..6bc2ddd 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -29,10 +29,6 @@
 #include "storage.h"
 #include "trade.h"
 
-#ifndef TXT_ONLY // mail system [Valaris]
-#include "mail.h"
-#endif
-
 #ifdef MEMWATCH
 #include "memwatch.h"
 #endif
@@ -713,10 +709,6 @@ int pc_authok(int id, int login_id2, time_t connect_until_time, short tmw_versio
 
 	sd->doridori_counter = 0;
 
-#ifndef TXT_ONLY // mail system [Valaris]
-	if(battle_config.mail_system)
-		sd->mail_counter = 0;
-#endif
 	sd->spiritball = 0;
 	for(i = 0; i < MAX_SKILL_LEVEL; i++)
 		sd->spirit_timer[i] = -1;
@@ -833,11 +825,6 @@ int pc_authok(int id, int login_id2, time_t connect_until_time, short tmw_versio
 	sd->chat_lastmsg_time = sd->chat_threshold = sd->chat_repeatmsg = 0;
 	sd->chat_lastmsg[0] = '\0';
 
-#ifndef TXT_ONLY
-	if(battle_config.mail_system)
-		mail_check(sd,1); // check mail at login [Valaris]
-#endif
-
 	// message of the limited time of the account
 	if (connect_until_time != 0) { // don't display if it's unlimited or unknow value
 		char tmpstr[1024];
@@ -7216,13 +7203,11 @@ int pc_autosave(int tid,unsigned int tick,int id,int data)
 
 int pc_read_gm_account(int fd)
 {
-#ifdef TXT_ONLY
         int i = 0;
-#endif
 	if (gm_account != NULL)
 		free(gm_account);
 	GM_num = 0;
-#ifdef TXT_ONLY
+
 	gm_account = calloc(sizeof(struct gm_account) * ((RFIFOW(fd,2) - 4) / 5), 1);
 	for (i = 4; i < RFIFOW(fd,2); i = i + 5) {
 		gm_account[GM_num].account_id = RFIFOL(fd,i);
@@ -7230,24 +7215,6 @@ int pc_read_gm_account(int fd)
 		//printf("GM account: %d -> level %d\n", gm_account[GM_num].account_id, gm_account[GM_num].level);
 		GM_num++;
 	}
-#else
-	sprintf (tmp_lsql, "SELECT `%s`,`%s` FROM `%s` WHERE `%s`>='%d'",login_db_account_id,login_db_level,login_db,login_db_level,lowest_gm_level);
-	if(mysql_query(&lmysql_handle, tmp_lsql) ) {
-		printf("DB server Error (select %s to Memory)- %s\n",login_db,mysql_error(&lmysql_handle) );
-	}
-	lsql_res = mysql_store_result(&lmysql_handle);
-	if (lsql_res) {
-	    gm_account = calloc(sizeof(struct gm_account) * mysql_num_rows(lsql_res), 1);
-	    while ((lsql_row = mysql_fetch_row(lsql_res))) {
-	        gm_account[GM_num].account_id = atoi(lsql_row[0]);
-		    gm_account[GM_num].level = atoi(lsql_row[1]);
-		    printf("GM account: %d -> level %d\n", gm_account[GM_num].account_id, gm_account[GM_num].level);
-		    GM_num++;
-	    }
-    }
-	
-    mysql_free_result(lsql_res);
-#endif /* TXT_ONLY */
 	return GM_num;
 }
 
@@ -7674,10 +7641,6 @@ int do_init_pc(void) {
 	add_timer_interval((natural_heal_prev_tick = gettick() + NATURAL_HEAL_INTERVAL), pc_natural_heal, 0, 0, NATURAL_HEAL_INTERVAL);
 	add_timer(gettick() + autosave_interval, pc_autosave, 0, 0);
 
-#ifndef TXT_ONLY
-	pc_read_gm_account(0);
-#endif /* not TXT_ONLY */
-
 	// add night/day timer (by [yor])
 	add_timer_func_list(map_day_timer, "map_day_timer"); // by [yor]
 	add_timer_func_list(map_night_timer, "map_night_timer"); // by [yor]
-- 
cgit v1.2.3-70-g09d2