Просмотр исходного кода

- Rewrote the txt->sql converter. It now links directly to the char server files so that it should get auto-updated with any code changes in the later.
- The converter will now also convert: account-wide variables, parties, guilds, guild storage and guild castles. At this point the only two things not converted are login-server-wide account variables (##, they belong to the login converter) and homunculus (the SQL save function is messy and doesn't lends itself to be integrated with the converter the way all the other functions are).
- Modified the char servers so they are compatible with the converter, the define TXT_SQL_CONVERT identifies sections unique to each char-server mode (this would had been a hella lot easier if both char servers where the same code-base instead of duplicated code <.<)
- Updated the Makefiles as per the new compiling requirements for the converter.
- misceffect2 will no longer cause the effect on top of the source object when it is the fake npc.
- Added check so that Frost Nova doesn't hides hitting animation on targets.
- Added the missing brackets around the trade logs condition check, thanks to Coltaro.


git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@8908 54d463be-8e91-2dee-dedb-b68131a5f0ec

skotlex 18 лет назад
Родитель
Сommit
42375e1896

+ 16 - 0
Changelog-Trunk.txt

@@ -3,6 +3,22 @@ Date	Added
 AS OF SVN REV. 5091, WE ARE NOW USING TRUNK.  ALL UNTESTED BUGFIXES/FEATURES GO INTO TRUNK.
 IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
 
+2006/09/30
+	* Rewrote the txt->sql converter. It now links directly to the char server
+	  files so that it should get auto-updated with any code changes in the
+	  later. [Skotlex]
+	* The converter will now also convert: account-wide variables, parties,
+	  guilds, guild storage and guild castles. At this point the only two things
+	  not converted are login-server-wide account variables (##, they belong to
+	  the login converter) and homunculus (the SQL save function is messy and
+	  doesn't lends itself to be integrated with the converter the way all the
+	  other functions are). [Skotlex]
+	* misceffect2 will no longer cause the effect on top of the source object
+	  when it is the fake npc. [Skotlex]
+	* Added check so that Frost Nova doesn't hides hitting animation on
+	  targets. [Skotlex]
+	* Added the missing brackets around the trade logs condition check, thanks
+	  to Coltaro. [Skotlex]
 2006/09/29
 	* Spurt state will now trigger on Soul Linkers as well. [Skotlex]
 	* Added a check un unit_run when unit_walktoxy fails. Should fix running

+ 1 - 1
Makefile

@@ -192,7 +192,7 @@ depend: src/common/GNUmakefile src/login/GNUmakefile src/login_sql/GNUmakefile \
 	cd src/map; makedepend -DTXT_ONLY -fGNUmakefile -ptxtobj/ -Y. -Y../common *.c; cd ../..;
 	cd src/map; makedepend -fGNUmakefile -a -psqlobj/ -Y. -Y../common *.c; cd ../..;
 	cd src/ladmin; makedepend -fGNUmakefile -Y. -Y../common *.c; cd ../..;
-	cd src/txt-converter; makedepend -fGNUmakefile -Y. -Y../common *.c; cd ../..;
+	cd src/txt-converter; makedepend -DTXT_SQL_CONVERT -fGNUmakefile -Y. -Y../common *.c; cd ../..;
 	$(MAKE) -C src/plugins $@
 
 Makefile.cache:

+ 25 - 13
src/char/char.c

@@ -42,7 +42,13 @@
 #include "int_status.h"
 #endif
 
-struct mmo_map_server server[MAX_MAP_SERVERS];
+#ifndef TXT_SQL_CONVERT
+struct mmo_map_server{
+	long ip;
+	short port;
+	int users;
+	unsigned short map[MAX_MAP_PER_SERVER];
+} server[MAX_MAP_SERVERS];
 int server_fd[MAX_MAP_SERVERS];
 
 int login_fd, char_fd;
@@ -62,9 +68,11 @@ int char_maintenance;
 int char_new;
 int char_new_display;
 int email_creation = 0; // disabled by default
+#endif
 char char_txt[1024]="save/athena.txt";
 char backup_txt[1024]="save/backup.txt"; //By zanetheinsane
 char friends_txt[1024]="save/friends.txt"; // davidsiaw
+#ifndef TXT_SQL_CONVERT
 char backup_txt_flag = 0; // The backup_txt file was created because char deletion bug existed. Now it's finish and that take a lot of time to create a second file when there are a lot of characters. => option By [Yor]
 char unknown_char_name[1024] = "Unknown";
 char char_log_filename[1024] = "log/char.log";
@@ -107,11 +115,7 @@ int check_ip_flag = 1; // It's to check IP of a player between char-server and o
 static int online_check = 1; //If one, it won't let players connect when their account is already registered online and will send the relevant map server a kick user request. [Skotlex]
 
 int char_id_count = START_CHAR_NUM;
-struct character_data {
-	struct mmo_charstatus status;
-	int global_num;
-	struct global_reg global[GLOBAL_REG_NUM];
-} *char_dat;
+struct character_data *char_dat;
 
 int char_num, char_max;
 int max_connect_user = 0;
@@ -487,7 +491,7 @@ int mmo_char_tostr(char *str, struct mmo_charstatus *p, struct global_reg *reg,
 	*str_p = '\0';
 	return 0;
 }
-
+#endif //TXT_SQL_CONVERT
 //-------------------------------------------------------------------------
 // Function to set the character from the line (at read of characters file)
 //-------------------------------------------------------------------------
@@ -701,6 +705,7 @@ int mmo_char_fromstr(char *str, struct mmo_charstatus *p, struct global_reg *reg
 	p->last_point.map = tmp_int[45];
 	p->save_point.map = tmp_int[46];
 
+#ifndef TXT_SQL_CONVERT
 	// Some checks
 	for(i = 0; i < char_num; i++) {
 		if (char_dat[i].status.char_id == p->char_id) {
@@ -723,7 +728,7 @@ int mmo_char_fromstr(char *str, struct mmo_charstatus *p, struct global_reg *reg
 		char_log("mmo_auth_init: ******WARNING: character name has wisp server name: Character name '%s' = wisp server name '%s'." RETCODE,
 		          p->name, wisp_server_name);
 	}
-
+#endif //TXT_SQL_CONVERT
 	if (str[next] == '\n' || str[next] == '\r')
 		return 1;	// 新規データ
 
@@ -887,7 +892,7 @@ int parse_friend_txt(struct mmo_charstatus *p)
 	fclose(fp);
 	return count;
 }
-
+#ifndef TXT_SQL_CONVERT
 //---------------------------------
 // Function to read characters file
 //---------------------------------
@@ -1680,7 +1685,7 @@ int mmo_char_send006b(int fd, struct char_session_data *sd) {
 	for(i = found_num; i < 9; i++)
 		sd->found_char[i] = -1;
 
-        WFIFOHEAD(fd, offset + found_num * 106);
+	WFIFOHEAD(fd, offset + found_num * 106);
 	memset(WFIFOP(fd,0), 0, offset + found_num * 106);
 	WFIFOW(fd,0) = 0x6b;
 	WFIFOW(fd,2) = offset + found_num * 106;
@@ -4076,6 +4081,7 @@ int char_lan_config_read(const char *lancfgName) {
 	fclose(fp);
 	return 0;
 }
+#endif //TXT_SQL_CONVERT
 
 int char_config_read(const char *cfgName) {
 	char line[1024], w1[1024], w2[1024];
@@ -4103,6 +4109,7 @@ int char_config_read(const char *cfgName) {
 			msg_silent = 0; //To always allow the next line to show up.
 			ShowInfo("Console Silent Setting: %d\n", atoi(w2));
 			msg_silent = atoi(w2);
+#ifndef TXT_SQL_CONVERT
 		} else if (strcmpi(w1, "userid") == 0) {
 			strncpy(userid, w2, 24);
 		} else if (strcmpi(w1, "passwd") == 0) {
@@ -4149,14 +4156,16 @@ int char_config_read(const char *cfgName) {
 			char_new_display = atoi(w2);
 		} else if (strcmpi(w1, "email_creation") == 0) {
 			email_creation = config_switch(w2);
-		} else if (strcmpi(w1, "char_txt") == 0) {
-			strcpy(char_txt, w2);
 		} else if (strcmpi(w1, "scdata_txt") == 0) { //By Skotlex
 			strcpy(scdata_txt, w2);
+#endif
+		} else if (strcmpi(w1, "char_txt") == 0) {
+			strcpy(char_txt, w2);
 		} else if (strcmpi(w1, "backup_txt") == 0) { //By zanetheinsane
 			strcpy(backup_txt, w2);
 		} else if (strcmpi(w1, "friends_txt") == 0) { //By davidsiaw
 			strcpy(friends_txt, w2);
+#ifndef TXT_SQL_CONVERT
 		} else if (strcmpi(w1, "backup_txt_flag") == 0) { // The backup_txt file was created because char deletion bug existed. Now it's finish and that take a lot of time to create a second file when there are a lot of characters. By [Yor]
 			backup_txt_flag = config_switch(w2);
 		} else if (strcmpi(w1, "max_connect_user") == 0) {
@@ -4258,6 +4267,7 @@ int char_config_read(const char *cfgName) {
 			}
 		} else if (strcmpi(w1, "guild_exp_rate") == 0) {
 			guild_exp_rate = atoi(w2);
+#endif //TXT_SQL_CONVERT
 		} else if (strcmpi(w1, "import") == 0) {
 			char_config_read(w2);
 		}
@@ -4268,6 +4278,7 @@ int char_config_read(const char *cfgName) {
 	return 0;
 }
 
+#ifndef TXT_SQL_CONVERT
 int chardb_final(int key, void* data, va_list va)
 {
 	aFree(data);
@@ -4379,7 +4390,7 @@ int do_init(int argc, char **argv) {
 	update_online = time(NULL);
 	create_online_files(); // update online players files at start of the server
 
-	inter_init((argc > 2) ? argv[2] : inter_cfgName);	// inter server 初期化
+	inter_init_txt((argc > 2) ? argv[2] : inter_cfgName);	// inter server 初期化
 
 	set_defaultparse(parse_char);
 
@@ -4411,3 +4422,4 @@ int do_init(int argc, char **argv) {
 
 	return 0;
 }
+#endif //TXT_SQL_CONVERT

+ 10 - 5
src/char/char.h

@@ -16,11 +16,10 @@
 
 #define DEFAULT_AUTOSAVE_INTERVAL 300*1000
 
-struct mmo_map_server{
-	long ip;
-	short port;
-	int users;
-	unsigned short map[MAX_MAP_PER_SERVER];
+struct character_data {
+	struct mmo_charstatus status;
+	int global_num;
+	struct global_reg global[GLOBAL_REG_NUM];
 };
 
 struct mmo_charstatus* search_character(int aid, int cid);
@@ -50,4 +49,10 @@ extern char char_name_letters[];
 extern int autosave_interval;
 extern char db_path[];
 extern int guild_exp_rate;
+extern int log_inter;
+//Exported for use in the TXT-SQL converter.
+extern char char_txt[];
+int char_config_read(const char *cfgName);
+int mmo_char_fromstr(char *str, struct mmo_charstatus *p, struct global_reg *reg, int *reg_num);
+int parse_friend_txt(struct mmo_charstatus *p);
 #endif

+ 8 - 4
src/char/int_guild.c

@@ -19,6 +19,7 @@
 char guild_txt[1024] = "save/guild.txt";
 char castle_txt[1024] = "save/castle.txt";
 
+#ifndef TXT_SQL_CONVERT
 static struct dbt *guild_db;
 static struct dbt *castle_db;
 
@@ -95,7 +96,7 @@ int inter_guild_tostr(char *str, struct guild *g) {
 
 	return 0;
 }
-
+#endif //TXT_SQL_CONVERT
 // ギルドデータの文字列からの変換
 int inter_guild_fromstr(char *str, struct guild *g) {
 	int i, j, c;
@@ -118,7 +119,9 @@ int inter_guild_fromstr(char *str, struct guild *g) {
 	g->max_member = tmp_int[2];
 	g->exp = exp;
 	g->skill_point = tmp_int[4];
+#ifndef TXT_SQL_CONVERT
 	g->castle_id = tmp_int[5];
+#endif
 	memcpy(g->name, tmp_str[0], NAME_LENGTH-1);
 	memcpy(g->master, tmp_str[1], NAME_LENGTH-1);
 	memcpy(g->mes1, tmp_str[2], 60);
@@ -242,7 +245,7 @@ int inter_guild_fromstr(char *str, struct guild *g) {
 
 	return 0;
 }
-
+#ifndef TXT_SQL_CONVERT
 // ギルド城データの文字列への変換
 int inter_guildcastle_tostr(char *str, struct guild_castle *gc) {
 	int len;
@@ -257,7 +260,7 @@ int inter_guildcastle_tostr(char *str, struct guild_castle *gc) {
 
 	return 0;
 }
-
+#endif ///TXT_SQL_CONVERT
 // ギルド城データの文字列からの変換
 int inter_guildcastle_fromstr(char *str, struct guild_castle *gc) {
 	int tmp_int[26];
@@ -334,7 +337,7 @@ int inter_guildcastle_fromstr(char *str, struct guild_castle *gc) {
 
 	return 0;
 }
-
+#ifndef TXT_SQL_CONVERT
 // ギルド関連データベース読み込み
 int inter_guild_readdb(void) {
 	int i;
@@ -1560,3 +1563,4 @@ int inter_guild_mapif_init(int fd) {
 int inter_guild_leave(int guild_id, int account_id, int char_id) {
 	return mapif_parse_GuildLeave(-1, guild_id, account_id, char_id, 0, "** Character Deleted **");
 }
+#endif //TXT_SQL_CONVERT

+ 3 - 0
src/char/int_guild.h

@@ -16,4 +16,7 @@ int inter_guild_sex_changed(int guild_id,int account_id,int char_id, int gender)
 extern char guild_txt[1024];
 extern char castle_txt[1024];
 
+//For the TXT->SQL converter
+int inter_guild_fromstr(char *str, struct guild *g);
+int inter_guildcastle_fromstr(char *str, struct guild_castle *gc);
 #endif

+ 8 - 5
src/char/int_party.c

@@ -16,7 +16,7 @@
 #include "int_party.h"
 
 char party_txt[1024] = "save/party.txt";
-
+#ifndef TXT_SQL_CONVERT
 struct party_data {
 	struct party party;
 	unsigned int min_lv, max_lv;
@@ -107,13 +107,15 @@ int inter_party_tostr(char *str, struct party *p) {
 
 	return 0;
 }
-
+#endif //TXT_SQL_CONVERT
 // パ?ティデ?タの文字列からの?換
 int inter_party_fromstr(char *str, struct party *p) {
 	int i, j;
 	int tmp_int[16];
 	char tmp_str[256];
+#ifndef TXT_SQL_CONVERT
 	struct mmo_charstatus* status;
+#endif
 	
 	memset(p, 0, sizeof(struct party));
 
@@ -144,7 +146,7 @@ int inter_party_fromstr(char *str, struct party *p) {
 		m->leader = tmp_int[2]?1:0;
 
 		str = strchr(str + 1, '\t');
-
+#ifndef TXT_SQL_CONVERT
 		if (!m->account_id) continue;
 		//Lookup player for rest of data.
 		status = search_character(m->account_id, m->char_id);
@@ -154,11 +156,12 @@ int inter_party_fromstr(char *str, struct party *p) {
 		m->class_ = status->class_;
 		m->map = status->last_point.map;
 		m->lv = status->base_level;
+#endif //TXT_SQL_CONVERT
 	}
 
 	return 0;
 }
-
+#ifndef TXT_SQL_CONVERT
 // パ?ティデ?タのロ?ド
 int inter_party_init() {
 	char line[8192];
@@ -736,4 +739,4 @@ int inter_party_parse_frommap(int fd) {
 int inter_party_leave(int party_id, int account_id, int char_id) {
 	return mapif_parse_PartyLeave(-1, party_id, account_id, char_id);
 }
-
+#endif //TXT_SQL_CONVERT

+ 2 - 0
src/char/int_party.h

@@ -15,4 +15,6 @@ int inter_party_logged(int party_id, int account_id, int char_id);
 
 extern char party_txt[1024];
 
+//For the TXT->SQL converter
+int inter_party_fromstr(char *str, struct party *p);
 #endif

+ 4 - 3
src/char/int_pet.c

@@ -16,6 +16,7 @@
 
 char pet_txt[1024]="save/pet.txt";
 
+#ifndef TXT_SQL_CONVERT
 static struct dbt *pet_db;
 static int pet_newid = 100;
 
@@ -38,7 +39,7 @@ int inter_pet_tostr(char *str,struct s_pet *p)
 
 	return 0;
 }
-
+#endif //TXT_SQL_CONVERT
 int inter_pet_fromstr(char *str,struct s_pet *p)
 {
 	int s;
@@ -78,7 +79,7 @@ int inter_pet_fromstr(char *str,struct s_pet *p)
 
 	return 0;
 }
-
+#ifndef TXT_SQL_CONVERT
 int inter_pet_init()
 {
 	char line[8192];
@@ -416,4 +417,4 @@ int inter_pet_parse_frommap(int fd)
 	}
 	return 1;
 }
-
+#endif //TXT_SQL_CONVERT

+ 2 - 0
src/char/int_pet.h

@@ -13,4 +13,6 @@ int inter_pet_parse_frommap(int fd);
 
 extern char pet_txt[1024];
 
+//Exported for use in the TXT-SQL converter.
+int inter_pet_fromstr(char *str,struct s_pet *p);
 #endif

+ 6 - 4
src/char/int_storage.c

@@ -20,6 +20,7 @@
 char storage_txt[1024]="save/storage.txt";
 char guild_storage_txt[1024]="save/g_storage.txt";
 
+#ifndef TXT_SQL_CONVERT
 static struct dbt *storage_db;
 static struct dbt *guild_storage_db;
 
@@ -48,7 +49,7 @@ int storage_tostr(char *str,struct storage *p)
 		str[0]=0;
 	return 0;
 }
-
+#endif //TXT_SQL_CONVERT
 // 文字列を倉庫データに変換
 int storage_fromstr(char *str,struct storage *p)
 {
@@ -89,7 +90,7 @@ int storage_fromstr(char *str,struct storage *p)
 		ShowWarning("storage_fromstr: Found a storage line with more items than MAX_STORAGE (%d), remaining items have been discarded!\n", MAX_STORAGE);
 	return 0;
 }
-
+#ifndef TXT_SQL_CONVERT
 int guild_storage_tostr(char *str,struct guild_storage *p)
 {
 	int i,j,f=0;
@@ -114,7 +115,7 @@ int guild_storage_tostr(char *str,struct guild_storage *p)
 		str[0]=0;
 	return 0;
 }
-
+#endif //TXT_SQL_CONVERT
 int guild_storage_fromstr(char *str,struct guild_storage *p)
 {
 	int tmp_int[256];
@@ -153,7 +154,7 @@ int guild_storage_fromstr(char *str,struct guild_storage *p)
 		ShowWarning("guild_storage_fromstr: Found a storage line with more items than MAX_GUILD_STORAGE (%d), remaining items have been discarded!\n", MAX_GUILD_STORAGE);
 	return 0;
 }
-
+#ifndef TXT_SQL_CONVERT
 static void* create_storage(DBKey key, va_list args) {
 	struct storage *s;
 	s = (struct storage *) aCalloc(sizeof(struct storage), 1);
@@ -474,3 +475,4 @@ int inter_storage_parse_frommap(int fd)
 	}
 	return 1;
 }
+#endif //TXT_SQL_CONVERT

+ 3 - 0
src/char/int_storage.h

@@ -16,4 +16,7 @@ int inter_storage_parse_frommap(int fd);
 extern char storage_txt[1024];
 extern char guild_storage_txt[1024];
 
+//Exported for use in the TXT-SQL converter.
+int storage_fromstr(char *str,struct storage *p);
+int guild_storage_fromstr(char *str,struct guild_storage *p);
 #endif

+ 22 - 24
src/char/inter.c

@@ -25,18 +25,13 @@
                              	// that is the waiting time of answers of all map-servers
 #define WISDELLIST_MAX 256   	// Number of elements of Wisp/page data deletion list
 
+char accreg_txt[1024] = "save/accreg.txt";
+#ifndef TXT_SQL_CONVERT
 char inter_log_filename[1024] = "log/inter.log";
 char main_chat_nick[16] = "Main";
 
-char accreg_txt[1024] = "save/accreg.txt";
 static struct dbt *accreg_db = NULL;
 
-struct accreg {
-	int account_id, char_id;
-	int reg_num;
-	struct global_reg reg[ACCOUNT_REG_NUM];
-};
-
 unsigned int party_share_level = 10;
 
 // sending packet list
@@ -89,7 +84,7 @@ int inter_accreg_tostr(char *str, struct accreg *reg) {
 
 	return 0;
 }
-
+#endif //TXT_SQL_CONVERT
 // アカウント変数を文字列から変換
 int inter_accreg_fromstr(const char *str, struct accreg *reg) {
 	int j, n;
@@ -106,7 +101,7 @@ int inter_accreg_fromstr(const char *str, struct accreg *reg) {
 
 	return 0;
 }
-
+#ifndef TXT_SQL_CONVERT
 // アカウント変数の読み込み
 int inter_accreg_init(void) {
 	char line[8192];
@@ -172,12 +167,12 @@ int inter_accreg_save(void) {
 }
 
 //--------------------------------------------------------
-
+#endif //TXT_SQL_CONVERT
 /*==========================================
  * 設定ファイルを読み込む
  *------------------------------------------
  */
-int inter_config_read(const char *cfgName) {
+static int inter_config_read(const char *cfgName) {
 	char line[1024], w1[1024], w2[1024];
 	FILE *fp;
 
@@ -198,18 +193,19 @@ int inter_config_read(const char *cfgName) {
 			strncpy(storage_txt, w2, sizeof(storage_txt));
 		} else if (strcmpi(w1, "party_txt") == 0) {
 			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, "homun_txt") == 0) {
-			strncpy(homun_txt, w2, sizeof(homun_txt));
-		} else if (strcmpi(w1, "castle_txt") == 0) {
-			strncpy(castle_txt, w2, sizeof(castle_txt));
 		} else if (strcmpi(w1, "accreg_txt") == 0) {
 			strncpy(accreg_txt, w2, sizeof(accreg_txt));
+		} else if (strcmpi(w1, "guild_txt") == 0) {
+			strncpy(guild_txt, w2, sizeof(guild_txt));
+		} else if (strcmpi(w1, "castle_txt") == 0) {
+			strncpy(castle_txt, w2, sizeof(castle_txt));
 		} else if (strcmpi(w1, "guild_storage_txt") == 0) {
 			strncpy(guild_storage_txt, w2, sizeof(guild_storage_txt));
+#ifndef TXT_SQL_CONVERT
+		} else if (strcmpi(w1, "homun_txt") == 0) {
+			strncpy(homun_txt, w2, sizeof(homun_txt));
 		} else if (strcmpi(w1, "party_share_level") == 0) {
 			party_share_level = (unsigned int)atof(w2);
 		} else if (strcmpi(w1, "inter_log_filename") == 0) {
@@ -217,7 +213,8 @@ int inter_config_read(const char *cfgName) {
 		} else if(strcmpi(w1,"log_inter")==0) {
 			log_inter = atoi(w2);
 		} else if(strcmpi(w1, "main_chat_nick")==0){	// Main chat nick [LuzZza]
-			strcpy(main_chat_nick, w2);					// 
+			strcpy(main_chat_nick, w2);
+#endif //TXT_SQL_CONVERT
 		} else if (strcmpi(w1, "import") == 0) {
 			inter_config_read(w2);
 		}
@@ -226,7 +223,7 @@ int inter_config_read(const char *cfgName) {
 
 	return 0;
 }
-
+#ifndef TXT_SQL_CONVERT
 // ログ書き出し
 int inter_log(char *fmt,...) {
 	FILE *logfp;
@@ -258,11 +255,12 @@ int inter_save(void) {
 
 	return 0;
 }
-
+#endif //TXT_SQL_CONVERT
 // 初期化
-int inter_init(const char *file) {
+int inter_init_txt(const char *file) {
 	inter_config_read(file);
 
+#ifndef TXT_SQL_CONVERT
 	wis_db = db_alloc(__FILE__,__LINE__,DB_INT,DB_OPT_RELEASE_DATA,sizeof(int));
 
 	inter_party_init();
@@ -271,10 +269,10 @@ int inter_init(const char *file) {
 	inter_pet_init();
 	inter_homun_init();
 	inter_accreg_init();
-
+#endif //TXT_SQL_CONVERT
 	return 0;
 }
-
+#ifndef TXT_SQL_CONVERT
 // finalize
 void inter_final(void) {
 	accreg_db->destroy(accreg_db, NULL);
@@ -690,4 +688,4 @@ int inter_check_length(int fd, int length) {
 
 	return length;
 }
-
+#endif //TXT_SQL_CONVERT

+ 4 - 3
src/char/inter.h

@@ -4,7 +4,7 @@
 #ifndef _INTER_H_
 #define _INTER_H_
 
-int inter_init(const char *file);
+int inter_init_txt(const char *file);
 void inter_final(void);
 int inter_save(void);
 int inter_parse_frommap(int fd);
@@ -20,8 +20,9 @@ int inter_log(char *fmt,...);
 
 extern unsigned int party_share_level;
 extern char inter_log_filename[1024];
-extern int log_inter;
-
 extern char main_chat_nick[16];
 
+//For TXT->SQL conversion
+extern char accreg_txt[];
+int inter_accreg_fromstr(const char *str, struct accreg *reg);
 #endif

+ 49 - 91
src/char_sql/char.c

@@ -33,8 +33,9 @@
 #include "malloc.h"
 #include "int_guild.h"
 
+#ifndef TXT_SQL_CONVERT
 static struct dbt *char_db_;
-
+#endif
 char char_db[256] = "char";
 char scdata_db[256] = "sc_data";
 char cart_db[256] = "cart_inventory";
@@ -57,6 +58,10 @@ char party_db[256] = "party";
 char pet_db[256] = "pet";
 char gm_db[256] = "gm_accounts";
 char friend_db[256] = "friends";
+#ifdef TXT_SQL_CONVERT
+int save_log = 0; //Have the logs be off by default when converting
+#else
+int save_log = 1;
 int db_use_sqldbs;
 int connection_ping_interval = 0;
 
@@ -67,7 +72,13 @@ int lowest_gm_level = 1;
 
 char *SQL_CONF_NAME = "conf/inter_athena.conf";
 
-struct mmo_map_server server[MAX_MAP_SERVERS];
+struct mmo_map_server{
+  long ip;
+  short port;
+  int users;
+  unsigned short map[MAX_MAP_PER_SERVER];
+} server[MAX_MAP_SERVERS];
+
 int server_fd[MAX_MAP_SERVERS];
 
 int login_fd, char_fd;
@@ -135,7 +146,6 @@ int char_num,char_max;
 int max_connect_user = 0;
 int gm_allow_level = 99;
 int autosave_interval = DEFAULT_AUTOSAVE_INTERVAL;
-int save_log = 1;
 int start_zeny = 0;
 int start_weapon = 1201;
 int start_armor = 2301;
@@ -385,7 +395,7 @@ void read_gm_account(void) {
 	mysql_free_result(lsql_res);
 	mapif_send_gmaccounts();
 }
-
+#endif //TXT_SQL_CONVERT
 int compare_item(struct item *a, struct item *b) {
 
 	if(a->id == b->id &&
@@ -403,13 +413,14 @@ int compare_item(struct item *a, struct item *b) {
 	return 0;
 }
 
+#ifndef TXT_SQL_CONVERT
 static void* create_charstatus(DBKey key, va_list args) {
 	struct mmo_charstatus *cp;
 	cp = (struct mmo_charstatus *) aCalloc(1,sizeof(struct mmo_charstatus));
 	cp->char_id = key.i;
 	return cp;
 }
-
+#endif //TXT_SQL_CONVERT
 int mmo_char_tosql(int char_id, struct mmo_charstatus *p){
 	int i=0,j;
 	int count = 0;
@@ -422,7 +433,11 @@ int mmo_char_tosql(int char_id, struct mmo_charstatus *p){
 
 	if (char_id!=p->char_id) return 0;
 
+#ifndef TXT_SQL_CONVERT
 	cp = idb_ensure(char_db_, char_id, create_charstatus);
+#else
+	cp = aCalloc(1, sizeof(struct mmo_charstatus));
+#endif
 
 	memset(save_status, 0, sizeof(save_status));
 	diff = 0;
@@ -474,6 +489,17 @@ int mmo_char_tosql(int char_id, struct mmo_charstatus *p){
 	if (diff)
 		if (!memitemdata_to_sql(mapitem, count, p->char_id,TABLE_CART))
 			strcat(save_status, " cart");
+#ifdef TXT_SQL_CONVERT
+	//Insert the barebones to then update the rest.
+	sprintf(tmp_sql, "REPLACE INTO `%s` (`account_id`, `char_num`, `name`)  VALUES ('%d', '%d', '%s')",
+		char_db, p->account_id, p->char_num, p->name);
+	if(mysql_query(&mysql_handle, tmp_sql))
+	{
+		ShowSQL("DB error - %s\n",mysql_error(&mysql_handle));
+		ShowDebug("at %s:%d - %s\n", __FILE__,__LINE__,tmp_sql);
+	} else
+		strcat(save_status, " creation");
+#endif
 
 	if (
 		(p->base_exp != cp->base_exp) || (p->base_level != cp->base_level) ||
@@ -640,71 +666,6 @@ int mmo_char_tosql(int char_id, struct mmo_charstatus *p){
 		} else //Skills removed (reset?)
 			strcat(save_status, " skills");
 	}
-/* Saving of global registry values is now handled by the inter-server. [Skotlex]
-	diff = 0;
-	for(i=0;i<p->global_reg_num;i++) {
-		if ((p->global_reg[i].str == NULL) && (cp->global_reg[i].str == NULL))
-			continue;
-		if (((p->global_reg[i].str == NULL) != (cp->global_reg[i].str == NULL)) ||
-			strcmp(p->global_reg[i].value, cp->global_reg[i].value) != 0 ||
-			strcmp(p->global_reg[i].str, cp->global_reg[i].str) != 0
-		) {
-			diff = 1;
-			break;
-		}
-	}
-
-	if (diff)
-	{	//Save global registry.
-		//`global_reg_value` (`char_id`, `str`, `value`)
-		
-		sprintf(tmp_sql,"DELETE FROM `%s` WHERE `type`=3 AND `char_id`='%d'",reg_db, p->char_id);
-		if (mysql_query(&mysql_handle, tmp_sql))
-		{
-			ShowSQL("DB error - %s\n",mysql_error(&mysql_handle));
-			ShowDebug("at %s:%d - %s\n", __FILE__,__LINE__,tmp_sql);
-		}
-
-		//insert here.
-		tmp_ptr = tmp_sql;
-		tmp_ptr += sprintf(tmp_ptr,"INSERT INTO `%s` (`type`, `char_id`, `str`, `value`) VALUES", reg_db);
-		count = 0;
-		for(i=0;i<p->global_reg_num;i++)
-		{
-			if (p->global_reg[i].str && p->global_reg[i].value)
-			{
-				tmp_ptr += sprintf(tmp_ptr,"('3','%d','%s','%s'),",
-					char_id, jstrescapecpy(temp_str,p->global_reg[i].str), jstrescapecpy(temp_str2,p->global_reg[i].value));
-				if (++count%100 == 0)
-				{ //Save every X registers to avoid overflowing tmp_sql [Skotlex]
-					tmp_ptr[-1] = '\0';
-					if(mysql_query(&mysql_handle, tmp_sql))
-					{
-						ShowSQL("DB error - %s\n",mysql_error(&mysql_handle));
-						ShowDebug("at %s:%d - %s\n", __FILE__,__LINE__,tmp_sql);
-					} else
-						strcat(save_status, " global_reg");
-						
-					tmp_ptr = tmp_sql;
-					tmp_ptr += sprintf(tmp_ptr,"INSERT INTO `%s` (`type`, `char_id`, `str`, `value`) VALUES", reg_db);
-					count = 0;
-				}
-			}
-		}
-
-		if (count)
-		{
-			tmp_ptr[-1] = '\0';
-			if(mysql_query(&mysql_handle, tmp_sql))
-			{
-				ShowSQL("DB error - %s\n",mysql_error(&mysql_handle));
-				ShowDebug("at %s:%d - %s\n", __FILE__,__LINE__,tmp_sql);
-			} else
-				strcat(save_status, " global_reg");
-		} else //Values cleared.
-			strcat(save_status, " global_reg");
-	}
-*/
 	diff = 0;
 	for(i = 0; i < MAX_FRIENDS; i++){
 		if(p->friends[i].char_id != cp->friends[i].char_id ||
@@ -748,8 +709,11 @@ int mmo_char_tosql(int char_id, struct mmo_charstatus *p){
 
 	if (save_status[0]!='\0' && save_log)
 		ShowInfo("Saved char %d - %s:%s.\n", char_id, p->name, save_status);
+#ifndef TXT_SQL_CONVERT
 	memcpy(cp, p, sizeof(struct mmo_charstatus));
-
+#else
+	aFree(cp);
+#endif
 	return 0;
 }
 
@@ -820,6 +784,7 @@ int memitemdata_to_sql(struct itemtmp mapitem[], int count, int char_id, int tab
 					{ //Do nothing.
 					} else
 //==============================================Memory data > SQL ===============================
+#ifndef TXT_SQL_CONVERT
 					if(!itemdb_isequip(mapitem[i].nameid))
 					{	//Quick update of stackable items. Update Qty and Equip should be enough, but in case we are also updating identify
 						sprintf(tmp_sql,"UPDATE `%s` SET `equip`='%d', `identify`='%d', `amount`='%d' WHERE `id`='%d' LIMIT 1",
@@ -830,6 +795,7 @@ int memitemdata_to_sql(struct itemtmp mapitem[], int count, int char_id, int tab
 							ShowDebug("at %s:%d - %s\n", __FILE__,__LINE__,tmp_sql);
 						}
 					} else 
+#endif //TXT_SQL_CONVERT
 					{	//Equipment or Misc item, just update all fields.
 						str_p = tmp_sql;
 						str_p += sprintf(str_p,"UPDATE `%s` SET `equip`='%d', `identify`='%d', `refine`='%d',`attribute`='%d'",
@@ -888,7 +854,7 @@ int memitemdata_to_sql(struct itemtmp mapitem[], int count, int char_id, int tab
 	}
 	return 0;
 }
-
+#ifndef TXT_SQL_CONVERT
 //=====================================================================================================
 int mmo_char_fromsql(int char_id, struct mmo_charstatus *p){
 	int i,j, n;
@@ -1690,19 +1656,6 @@ int delete_char_sql(int char_id, int partner_id)
 
 //==========================================================================================================
 
-void mmo_char_sync(void)
-{
-	ShowWarning("mmo_char_sync() - nothing to do\n");
-}
-
-// to do
-///////////////////////////
-
-int mmo_char_sync_timer(int tid, unsigned int tick, int id, int data) {
-	ShowWarning("mmo_char_sync_timer() tic - no works to do\n");
-	return 0;
-}
-
 int count_users(void) {
 	int i, users;
 
@@ -3918,7 +3871,6 @@ int char_lan_config_read(const char *lancfgName) {
 
 void do_final(void) {
 	ShowInfo("Doing final stage...\n");
-	//mmo_char_sync();
 	//inter_save();
 	do_final_itemdb();
 	//check SQL save progress.
@@ -3956,7 +3908,7 @@ void do_final(void) {
 
 	ShowInfo("ok! all done...\n");
 }
-
+#endif //TXT_SQL_CONVERT
 void sql_config_read(const char *cfgName){ /* Kalaspuff, to get login_db */
 	char line[1024], w1[1024], w2[1024];
 	FILE *fp;
@@ -3975,15 +3927,17 @@ void sql_config_read(const char *cfgName){ /* Kalaspuff, to get login_db */
 		if (sscanf(line, "%[^:]: %[^\r\n]", w1, w2) != 2)
 			continue;
 
-		if(strcmpi(w1, "gm_read_method") == 0) {
+		if(strcmpi(w1,"char_db")==0){
+			strcpy(char_db,w2);
+#ifndef TXT_SQL_CONVERT
+		} else if(strcmpi(w1, "gm_read_method") == 0) {
 			if(atoi(w2) != 0)
 				char_gm_read = true;
 			else
 				char_gm_read = false;
 		} else if(strcmpi(w1, "gm_db") == 0) {
 			strcpy(gm_db, w2);
-		} else if(strcmpi(w1,"char_db")==0){
-			strcpy(char_db,w2);
+#endif
 		}else if(strcmpi(w1,"scdata_db")==0){
 			strcpy(scdata_db,w2);
 		}else if(strcmpi(w1,"cart_db")==0){
@@ -4024,6 +3978,7 @@ void sql_config_read(const char *cfgName){ /* Kalaspuff, to get login_db */
 			strcpy(pet_db,w2);
 		}else if(strcmpi(w1,"friend_db")==0){
 			strcpy(friend_db,w2);
+#ifndef TXT_SQL_CONVERT
 		}else if(strcmpi(w1,"db_path")==0){
 			strcpy(db_path,w2);
 		//Map server option to use SQL db or not
@@ -4045,6 +4000,7 @@ void sql_config_read(const char *cfgName){ /* Kalaspuff, to get login_db */
 			lowest_gm_level = atoi(w2);
 			ShowStatus("set lowest_gm_level : %s\n",w2);
 		//support the import command, just like any other config
+#endif
 		}else if(strcmpi(w1,"import")==0){
 			sql_config_read(w2);
 		}
@@ -4053,6 +4009,7 @@ void sql_config_read(const char *cfgName){ /* Kalaspuff, to get login_db */
 	fclose(fp);
 	ShowInfo("done reading %s.\n", cfgName);
 }
+#ifndef TXT_SQL_CONVERT
 
 int char_config_read(const char *cfgName) {
 	char line[1024], w1[1024], w2[1024];
@@ -4263,7 +4220,7 @@ int do_init(int argc, char **argv){
 	
 	ShowInfo("Finished reading the char-server configuration.\n");
 
-	inter_init((argc > 2) ? argv[2] : inter_cfgName); // inter server ÃʱâÈ­
+	inter_init_sql((argc > 2) ? argv[2] : inter_cfgName); // inter server ÃʱâÈ­
 	ShowInfo("Finished reading the inter-server configuration.\n");
 	
 	//Read ItemDB
@@ -4453,3 +4410,4 @@ int char_family(int pl1,int pl2,int pl3) {
 	mysql_free_result (sql_res);
 	return 0;
 }
+#endif //TXT_SQL_CONVERT

+ 12 - 14
src/char_sql/char.h

@@ -1,5 +1,7 @@
 // Copyright (c) Athena Dev Teams - Licensed under GNU GPL
 // For more information, see LICENCE in the main folder
+#ifndef _CHARSQL_H_
+#define _CHARSQL_H_
 
 #include "../common/core.h"
 #include "../common/socket.h"
@@ -9,8 +11,12 @@
 #include "../common/db.h"
 #include "../common/mapindex.h"
 
-#ifndef _CHAR_H_
-#define _CHAR_H_
+#include "inter.h"
+#include "int_pet.h"
+#include "int_guild.h"
+#include "int_party.h"
+#include "int_storage.h"
+#include "itemdb.h"
 
 #define START_CHAR_NUM 150000
 #define MAX_MAP_SERVERS 30
@@ -19,12 +25,6 @@
 
 #define DEFAULT_AUTOSAVE_INTERVAL 300*1000
 
-struct mmo_map_server{
-  long ip;
-  short port;
-  int users;
-  unsigned short map[MAX_MAP_PER_SERVER];
-};
 struct itemtmp {
 	int flag;//checked = 1 else 0
 	int id;
@@ -100,13 +100,11 @@ extern int GM_num;
 extern struct gm_account *gm_account;
 
 extern int guild_exp_rate;
+extern int log_inter;
 
 extern int debug_mysql_query(char *file, int line, void *mysql, const char *q);
 
+//Exported for use in the TXT-SQL converter.
+int mmo_char_tosql(int char_id, struct mmo_charstatus *p);
+void sql_config_read(const char *cfgName);
 #endif
-
-#include "inter.h"
-#include "int_pet.h"
-#include "int_guild.h"
-#include "int_party.h"
-#include "int_storage.h"

+ 47 - 28
src/char_sql/int_guild.c

@@ -20,27 +20,6 @@
 #include "db.h"
 #include "malloc.h"
 
-//Guild cache
-static struct dbt *guild_db_;
-
-struct guild_castle castles[MAX_GUILDCASTLE];
-
-static unsigned int guild_exp[100];
-
-#define GS_BASIC 0x0001
-#define GS_MEMBER 0x0002
-#define GS_POSITION 0x0004
-#define GS_ALLIANCE 0x0008
-#define GS_EXPULSION 0x0010
-#define GS_SKILL 0x0020
-#define GS_EMBLEM 0x0040
-#define GS_CONNECT 0x0080
-#define GS_LEVEL 0x0100
-#define GS_MES 0x0200
-#define GS_MASK 0x03FF
-#define GS_BASIC_MASK (GS_BASIC | GS_EMBLEM | GS_CONNECT | GS_LEVEL | GS_MES)
-#define GS_REMOVE 0x8000
-
 #define GS_MEMBER_UNMODIFIED 0x00
 #define GS_MEMBER_MODIFIED 0x01
 #define GS_MEMBER_NEW 0x02
@@ -52,6 +31,16 @@ static unsigned int guild_exp[100];
 #define GUILD_ALLIANCE_TYPE_MASK 0x01
 #define GUILD_ALLIANCE_REMOVE 0x08
 
+static char dataToHex[] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'};
+
+#ifndef TXT_SQL_CONVERT
+//Guild cache
+static struct dbt *guild_db_;
+
+struct guild_castle castles[MAX_GUILDCASTLE];
+
+static unsigned int guild_exp[100];
+
 int mapif_parse_GuildLeave(int fd,int guild_id,int account_id,int char_id,int flag,const char *mes);
 int mapif_guild_broken(int guild_id,int flag);
 int guild_check_empty(struct guild *g);
@@ -60,7 +49,6 @@ int mapif_guild_basicinfochanged(int guild_id,int type,const void *data,int len)
 int mapif_guild_info(int fd,struct guild *g);
 int guild_break_sub(int key,void *data,va_list ap);
 int inter_guild_tosql(struct guild *g,int flag);
-static char dataToHex[] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'};
 
 #define mysql_query(_x, _y)  debug_mysql_query(__FILE__, __LINE__, _x, _y)
 
@@ -119,7 +107,7 @@ int inter_guild_removemember_tosql(int account_id, int char_id)
 	}
 	return 0;
 }
-
+#endif //TXT_SQL_CONVERT
 // Save guild into sql
 int inter_guild_tosql(struct guild *g,int flag)
 {
@@ -162,6 +150,7 @@ int inter_guild_tosql(struct guild *g,int flag)
 	
 	t_info[0]='\0';
 
+#ifndef TXT_SQL_CONVERT
 	// Insert a new guild the guild
 	if (flag&GS_BASIC && g->guild_id == -1)
 	{
@@ -191,7 +180,31 @@ int inter_guild_tosql(struct guild *g,int flag)
 				return 0; //Failed to get ID??
 		}
 	}
-
+#else
+	// Insert a new guild the guild
+	if (flag&GS_BASIC)
+	{
+		strcat(t_info, " guild_create");
+		// Since the PK is guild id + master id, a replace will not be enough if we are overwriting data, we need to wipe the previous guild.
+		sprintf(tmp_sql,"DELETE FROM `%s` where `guild_id` = '%d'", guild_db,g->guild_id);
+		if(mysql_query(&mysql_handle, tmp_sql) )
+		{
+			ShowSQL("DB error - %s\n",mysql_error(&mysql_handle));
+			ShowDebug("at %s:%d - %s\n", __FILE__,__LINE__,tmp_sql);
+		}
+		// Create a new guild
+		sprintf(tmp_sql,"REPLACE INTO `%s` "
+			"(`guild_id`,`name`,`master`,`guild_lv`,`max_member`,`average_lv`,`char_id`) "
+			"VALUES ('%d', '%s', '%s', '%d', '%d', '%d', '%d')",
+			guild_db,g->guild_id,t_name,jstrescapecpy(t_master,g->master),g->guild_lv,g->max_member,g->average_lv,g->member[0].char_id);
+		if(mysql_query(&mysql_handle, tmp_sql) )
+		{
+			ShowSQL("DB error - %s\n",mysql_error(&mysql_handle));
+			ShowDebug("at %s:%d - %s\n", __FILE__,__LINE__,tmp_sql);
+			return 0; //Failed to create guild.
+		}
+	}
+#endif //TXT_SQL_CONVERT
 	// If we need an update on an existing guild or more update on the new guild
 	if (((flag & GS_BASIC_MASK) && !new_guild) || ((flag & (GS_BASIC_MASK & ~GS_BASIC)) && new_guild))
 	{
@@ -244,8 +257,10 @@ int inter_guild_tosql(struct guild *g,int flag)
 		// Update only needed players
 		for(i=0;i<g->max_member;i++){
 			m = &g->member[i];
+#ifndef TXT_SQL_CONVERT
 			if (!m->modified)
 				continue;
+#endif
 			if(m->account_id) {
 				//Since nothing references guild member table as foreign keys, it's safe to use REPLACE INTO
 				sprintf(tmp_sql,"REPLACE INTO `%s` (`guild_id`,`account_id`,`char_id`,`hair`,`hair_color`,`gender`,`class`,`lv`,`exp`,`exp_payper`,`online`,`position`,`name`) "
@@ -279,8 +294,10 @@ int inter_guild_tosql(struct guild *g,int flag)
 		//printf("- Insert guild %d to guild_position\n",g->guild_id);
 		for(i=0;i<MAX_GUILDPOSITION;i++){
 			struct guild_position *p = &g->position[i];
+#ifndef TXT_SQL_CONVERT
 			if (!p->modified)
 				continue;
+#endif
 			sprintf(tmp_sql,"REPLACE INTO `%s` (`guild_id`,`position`,`name`,`mode`,`exp_mode`) VALUES ('%d','%d', '%s','%d','%d')",
 				guild_position_db, g->guild_id, i, jstrescapecpy(t_position,p->name),p->mode,p->exp_mode);
 			//printf(" %s\n",tmp_sql);
@@ -366,7 +383,7 @@ int inter_guild_tosql(struct guild *g,int flag)
 		ShowInfo("Saved guild (%d - %s):%s\n",g->guild_id,g->name,t_info);
 	return 1;
 }
-
+#ifndef TXT_SQL_CONVERT
 // Read guild from sql
 struct guild * inter_guild_fromsql(int guild_id)
 {
@@ -582,6 +599,7 @@ struct guild * inter_guild_fromsql(int guild_id)
 	return g;
 }
 
+#endif //TXT_SQL_CONVERT
 int inter_guildcastle_tosql(struct guild_castle *gc){
 	// `guild_castle` (`castle_id`, `guild_id`, `economy`, `defense`, `triggerE`, `triggerD`, `nextTime`, `payTime`, `createTime`, `visibleC`, `visibleG0`, `visibleG1`, `visibleG2`, `visibleG3`, `visibleG4`, `visibleG5`, `visibleG6`, `visibleG7`)
 
@@ -607,12 +625,12 @@ ShowDebug("Save guild_castle (%d)\n", gc->castle_id);
 		ShowDebug("at %s:%d - %s\n", __FILE__,__LINE__,tmp_sql);
 	}
 
-
+#ifndef TXT_SQL_CONVERT
 	memcpy(&castles[gc->castle_id],gc,sizeof(struct guild_castle));
-
+#endif //TXT_SQL_CONVERT
 	return 0;
 }
-
+#ifndef TXT_SQL_CONVERT
 
 // Read guild_castle from sql
 int inter_guildcastle_fromsql(int castle_id,struct guild_castle *gc)
@@ -2083,3 +2101,4 @@ int inter_guild_broken(int guild_id)
 {
 	return mapif_guild_broken(guild_id, 0);
 }
+#endif //TXT_SQL_CONVERT

+ 19 - 2
src/char_sql/int_guild.h

@@ -1,8 +1,8 @@
 // Copyright (c) Athena Dev Teams - Licensed under GNU GPL
 // For more information, see LICENCE in the main folder
 
-#ifndef _INT_GUILD_H_
-#define _INT_GUILD_H_
+#ifndef _INT_GUILD_SQL_H_
+#define _INT_GUILD_SQL_H_
 
 int inter_guild_parse_frommap(int fd);
 int inter_guild_sql_init(void);
@@ -15,4 +15,21 @@ int inter_guild_sex_changed(int guild_id,int account_id,int char_id, int gender)
 int inter_guild_CharOnline(int char_id, int guild_id);
 int inter_guild_CharOffline(int char_id, int guild_id);
 
+#define GS_BASIC 0x0001
+#define GS_MEMBER 0x0002
+#define GS_POSITION 0x0004
+#define GS_ALLIANCE 0x0008
+#define GS_EXPULSION 0x0010
+#define GS_SKILL 0x0020
+#define GS_EMBLEM 0x0040
+#define GS_CONNECT 0x0080
+#define GS_LEVEL 0x0100
+#define GS_MES 0x0200
+#define GS_MASK 0x03FF
+#define GS_BASIC_MASK (GS_BASIC | GS_EMBLEM | GS_CONNECT | GS_LEVEL | GS_MES)
+#define GS_REMOVE 0x8000
+
+//For the TXT->SQL converter.
+int inter_guild_tosql(struct guild *g,int flag);
+int inter_guildcastle_tosql(struct guild_castle *gc);
 #endif

+ 37 - 36
src/char_sql/int_party.c

@@ -14,6 +14,7 @@
 #include "../common/socket.h"
 #include "../common/showmsg.h"
 
+#ifndef TXT_SQL_CONVERT
 struct party_data {
 	struct party party;
 	unsigned int min_lv, max_lv;
@@ -40,20 +41,6 @@ int mapif_party_optionchanged(int fd,struct party *p, int account_id, int flag);
 
 #endif
 
-//Party Flags on what to save/delete.
-//Create a new party entry (index holds leader's info) 
-#define PS_CREATE 0x01
-//Update basic party info.
-#define PS_BASIC 0x02
-//Update party's leader
-#define PS_LEADER 0x04
-//Specify new party member (index specifies which party member)
-#define PS_ADDMEMBER 0x08
-//Specify member that left (index specifies which party member)
-#define PS_DELMEMBER 0x10
-//Specify that this party must be deleted.
-#define PS_BREAK 0x20
-	
 //Updates party's level range and unsets even share if broken.
 static int int_party_check_lv(struct party_data *p) {
 	int i;
@@ -114,17 +101,15 @@ static void int_party_calc_state(struct party_data *p)
 	}
 	return;
 }
-
+#endif //TXT_SQL_CONVERT
 // Save party to mysql
-int inter_party_tosql(struct party_data *party, int flag, int index)
+int inter_party_tosql(struct party *p, int flag, int index)
 {
 	// 'party' ('party_id','name','exp','item','leader_id','leader_char')
 	char t_name[NAME_LENGTH*2]; //Required for jstrescapecpy [Skotlex]
-	struct party *p;
 	int party_id;
-	if (party == NULL || party->party.party_id == 0)
+	if (p == NULL || p->party_id == 0)
 		return 0;
-	p = &party->party;
 	party_id = p->party_id;
 
 #ifdef NOISY
@@ -132,6 +117,7 @@ int inter_party_tosql(struct party_data *party, int flag, int index)
 #endif
 	jstrescapecpy(t_name, p->name);
 
+#ifndef TXT_SQL_CONVERT
 	if (flag&PS_BREAK) { //Break the party
 		// we'll skip name-checking and just reset everyone with the same party id [celest]
 		sprintf (tmp_sql, "UPDATE `%s` SET `party_id`='0' WHERE `party_id`='%d'", char_db, party_id);
@@ -148,8 +134,9 @@ int inter_party_tosql(struct party_data *party, int flag, int index)
 		idb_remove(party_db_, party_id);
 		return 1;
 	}
-
+#endif //TXT_SQL_CONVERT
 	if(flag&PS_CREATE) { //Create party
+#ifndef TXT_SQL_CONVERT
 		sprintf(tmp_sql, "INSERT INTO `%s` "
 			"(`name`, `exp`, `item`, `leader_id`, `leader_char`) "
 			"VALUES ('%s', '%d', '%d', '%d', '%d')",
@@ -157,21 +144,29 @@ int inter_party_tosql(struct party_data *party, int flag, int index)
 		if (mysql_query(&mysql_handle, tmp_sql)) {
 			ShowSQL("DB error - %s\n",mysql_error(&mysql_handle));
 			ShowDebug("at %s:%d - %s\n", __FILE__,__LINE__,tmp_sql);
-			aFree(party); //Free party, couldn't create it.
 			return 0;
 		}
 		if(mysql_field_count(&mysql_handle) == 0 &&
 			mysql_insert_id(&mysql_handle) != 0)
 			party_id = p->party_id = (int)mysql_insert_id(&mysql_handle);
-		else { //Failed to retrieve ID??
-			aFree(party); //Free party, couldn't create it.
+		else //Failed to retrieve ID??
+			return 0;
+#else
+		//During conversion, you want to specify the id, and allow overwriting
+		//(in case someone is re-running the process.
+		sprintf(tmp_sql, "REPLACE INTO `%s` "
+			"(`party_id`, `name`, `exp`, `item`, `leader_id`, `leader_char`) "
+			"VALUES ('%d', '%s', '%d', '%d', '%d', '%d')",
+			party_db, p->party_id, t_name, p->exp, p->item, p->member[index].account_id, p->member[index].char_id);
+		if (mysql_query(&mysql_handle, tmp_sql)) {
+			ShowSQL("DB error - %s\n",mysql_error(&mysql_handle));
+			ShowDebug("at %s:%d - %s\n", __FILE__,__LINE__,tmp_sql);
 			return 0;
 		}
-		//Add party to db
-		int_party_calc_state(party);
-		idb_put(party_db_, party_id, party);
+#endif
 	}
 
+#ifndef TXT_SQL_CONVERT
 	if (flag&PS_BASIC) {
 		//Update party info.
 		sprintf(tmp_sql, "UPDATE `%s` SET `name`='%s', `exp`='%d', `item`='%d' WHERE `party_id`='%d'",
@@ -211,12 +206,12 @@ int inter_party_tosql(struct party_data *party, int flag, int index)
 			ShowDebug("at %s:%d - %s\n", __FILE__,__LINE__,tmp_sql);
 		}
 	}
-
+#endif //TXT_SQL_CONVERT
 	if (save_log)
 		ShowInfo("Party Saved (%d - %s)\n", party_id, p->name);
 	return 1;
 }
-
+#ifndef TXT_SQL_CONVERT
 // Read party from mysql
 struct party_data *inter_party_fromsql(int party_id)
 {
@@ -365,7 +360,7 @@ int party_check_empty(struct party_data *p)
 	if (i < MAX_PARTY) return 0;
 	// If there is no member, then break the party
 	mapif_party_broken(p->party.party_id,0);
-	inter_party_tosql(p, PS_BREAK, 0);
+	inter_party_tosql(&p->party, PS_BREAK, 0);
 	return 1;
 }
 
@@ -577,11 +572,16 @@ int mapif_parse_CreateParty(int fd, char *name, int item, int item2, struct part
 	p->party.member[0].online=1;
 
 	p->party.party_id=-1;//New party.
-	if (inter_party_tosql(p,PS_CREATE|PS_ADDMEMBER,0)) {
+	if (inter_party_tosql(&p->party,PS_CREATE|PS_ADDMEMBER,0)) {
+		//Add party to db
+		int_party_calc_state(p);
+		idb_put(party_db_, p->party.party_id, p);
 		mapif_party_created(fd,leader->account_id,leader->char_id,&p->party);
 		mapif_party_info(fd,&p->party);
-	} else //Failed to create party.
+	} else { //Failed to create party.
+		aFree(p);
 		mapif_party_created(fd,leader->account_id,leader->char_id,NULL);
+	}
 
 	return 0;
 }
@@ -627,7 +627,7 @@ int mapif_parse_PartyAddMember(int fd, int party_id, struct party_member *member
 
 		mapif_party_memberadded(fd,party_id,member->account_id,member->char_id,0);
 		mapif_party_info(-1,&p->party);
-		inter_party_tosql(p, PS_ADDMEMBER, i);
+		inter_party_tosql(&p->party, PS_ADDMEMBER, i);
 		return 0;
 	}
 	//Party full
@@ -651,7 +651,7 @@ int mapif_parse_PartyChangeOption(int fd,int party_id,int account_id,int exp,int
 	}
 	p->party.item = item&0x3; //Filter out invalid values.
 	mapif_party_optionchanged(fd,&p->party,account_id,flag);
-	inter_party_tosql(p, PS_BASIC, 0);
+	inter_party_tosql(&p->party, PS_BASIC, 0);
 	return 0;
 }
 // ƒp�[ƒeƒB’E‘Þ—v‹�
@@ -691,7 +691,7 @@ int mapif_parse_PartyLeave(int fd, int party_id, int account_id, int char_id)
 		}
 		//Party gets deleted on the check_empty call below.
 	} else {
-		inter_party_tosql(p,PS_DELMEMBER,i);
+		inter_party_tosql(&p->party,PS_DELMEMBER,i);
 		j = p->party.member[i].lv;
 		if(p->party.member[i].online) p->party.count--;
 		memset(&p->party.member[i], 0, sizeof(struct party_member));
@@ -765,7 +765,7 @@ int mapif_parse_BreakParty(int fd,int party_id)
 
 	if(!p)
 		return 0;
-	inter_party_tosql(p,PS_BREAK,0);
+	inter_party_tosql(&p->party,PS_BREAK,0);
 	mapif_party_broken(fd,party_id);
 	return 0;
 }
@@ -798,7 +798,7 @@ int mapif_parse_PartyLeaderChange(int fd,int party_id,int account_id,int char_id
 			p->party.member[i].char_id == char_id)
 	  	{
 			p->party.member[i].leader = 1;
-			inter_party_tosql(p,PS_LEADER, i);
+			inter_party_tosql(&p->party,PS_LEADER, i);
 		}
 	}
 	return 1;
@@ -927,3 +927,4 @@ int inter_party_CharOffline(int char_id, int party_id) {
 		idb_remove(party_db_, party_id);
 	return 1;
 }
+#endif //TXT_SQL_CONVERT

+ 18 - 2
src/char_sql/int_party.h

@@ -1,8 +1,22 @@
 // Copyright (c) Athena Dev Teams - Licensed under GNU GPL
 // For more information, see LICENCE in the main folder
 
-#ifndef _INT_PARTY_H_
-#define _INT_PARTY_H_
+#ifndef _INT_PARTY_SQL_H_
+#define _INT_PARTY_SQL_H_
+
+//Party Flags on what to save/delete.
+//Create a new party entry (index holds leader's info) 
+#define PS_CREATE 0x01
+//Update basic party info.
+#define PS_BASIC 0x02
+//Update party's leader
+#define PS_LEADER 0x04
+//Specify new party member (index specifies which party member)
+#define PS_ADDMEMBER 0x08
+//Specify member that left (index specifies which party member)
+#define PS_DELMEMBER 0x10
+//Specify that this party must be deleted.
+#define PS_BREAK 0x20
 
 int inter_party_parse_frommap(int fd);
 int inter_party_sql_init(void);
@@ -11,4 +25,6 @@ int inter_party_leave(int party_id,int account_id, int char_id);
 int inter_party_logged(int party_id, int account_id, int char_id);
 int inter_party_CharOnline(int char_id, int party_id);
 int inter_party_CharOffline(int char_id, int party_id);
+//Required for the TXT->SQL converter
+int inter_party_tosql(struct party *p, int flag, int index);
 #endif

+ 2 - 2
src/char_sql/int_pet.c

@@ -68,7 +68,7 @@ int inter_pet_tosql(int pet_id, struct s_pet *p) {
 		ShowInfo("Pet saved %d - %s.\n", pet_id, p->name);
 	return 1;
 }
-
+#ifndef TXT_SQL_CONVERT
 int inter_pet_fromsql(int pet_id, struct s_pet *p){
 
 #ifdef NOISY
@@ -355,4 +355,4 @@ int inter_pet_parse_frommap(int fd){
 	}
 	return 1;
 }
-
+#endif //TXT_SQL_CONVERT

+ 4 - 2
src/char_sql/int_pet.h

@@ -1,8 +1,8 @@
 // Copyright (c) Athena Dev Teams - Licensed under GNU GPL
 // For more information, see LICENCE in the main folder
 
-#ifndef _INT_PET_H_
-#define _INT_PET_H_
+#ifndef _INT_PET_SQL_H_
+#define _INT_PET_SQL_H_
 
 int inter_pet_init(void);
 void inter_pet_sql_final(void);
@@ -13,4 +13,6 @@ int inter_pet_parse_frommap(int fd);
 int inter_pet_sql_init(void);
 //extern char pet_txt[256];
 
+//Exported for use in the TXT-SQL converter.
+int inter_pet_tosql(int pet_id, struct s_pet *p);
 #endif

+ 6 - 3
src/char_sql/int_storage.c

@@ -13,6 +13,7 @@
 
 #define STORAGE_MEMINC	16
 
+#ifndef TXT_SQL_CONVERT
 // reset by inter_config_read()
 struct storage *storage_pt=NULL;
 struct guild_storage *guild_storage_pt=NULL;
@@ -27,6 +28,7 @@ struct guild_storage *guild_storage_pt=NULL;
 
 #endif
 
+#endif //TXT_SQL_CONVERT
 // storage data -> DB conversion
 int storage_tosql(int account_id,struct storage *p){
 	int i,j;
@@ -55,6 +57,7 @@ int storage_tosql(int account_id,struct storage *p){
 	//printf ("storage dump to DB - id: %d (total: %d)\n", account_id, j);
 	return 0;
 }
+#ifndef TXT_SQL_CONVERT
 
 // DB -> storage data conversion
 int storage_fromsql(int account_id, struct storage *p){
@@ -99,7 +102,7 @@ int storage_fromsql(int account_id, struct storage *p){
 	ShowInfo ("storage load complete from DB - id: %d (total: %d)\n", account_id, p->storage_amount);
 	return 1;
 }
-
+#endif //TXT_SQL_CONVERT
 // Save guild_storage data to sql
 int guild_storage_tosql(int guild_id, struct guild_storage *p){
 	int i,j;
@@ -128,7 +131,7 @@ int guild_storage_tosql(int guild_id, struct guild_storage *p){
 	ShowInfo ("guild storage save to DB - id: %d (total: %d)\n", guild_id,i);
 	return 0;
 }
-
+#ifndef TXT_SQL_CONVERT
 // Load guild_storage data to mem
 int guild_storage_fromsql(int guild_id, struct guild_storage *p){
 	int i=0,j;
@@ -361,4 +364,4 @@ int inter_storage_parse_frommap(int fd){
 	}
 	return 1;
 }
-
+#endif //TXT_SQL_CONVERT

+ 5 - 5
src/char_sql/int_storage.h

@@ -1,8 +1,8 @@
 // Copyright (c) Athena Dev Teams - Licensed under GNU GPL
 // For more information, see LICENCE in the main folder
 
-#ifndef _INT_STORAGE_H_
-#define _INT_STORAGE_H_
+#ifndef _INT_STORAGE_SQL_H_
+#define _INT_STORAGE_SQL_H_
 
 int inter_storage_sql_init(void);
 void inter_storage_sql_final(void);
@@ -11,7 +11,7 @@ int inter_guild_storage_delete(int guild_id);
 
 int inter_storage_parse_frommap(int fd);
 
-
-//extern char storage_txt[256];
-
+//Exported for use in the TXT-SQL converter.
+int storage_tosql(int account_id,struct storage *p);
+int guild_storage_tosql(int guild_id, struct guild_storage *p);
 #endif

+ 22 - 21
src/char_sql/inter.c

@@ -21,16 +21,6 @@
 #define WISDELLIST_MAX 256			// Wisデータ削除リストの要素数
 
 
-struct accreg {
-	int account_id, char_id;
-	int reg_num;
-	struct global_reg reg[MAX_REG_NUM];
-};
-
-static struct accreg *accreg_pt;
-
-
-unsigned int party_share_level = 10;
 MYSQL mysql_handle;
 MYSQL_RES* 	sql_res ;
 MYSQL_ROW	sql_row ;
@@ -54,6 +44,10 @@ char login_server_id[32] = "ragnarok";
 char login_server_pw[32] = "ragnarok";
 char login_server_db[32] = "ragnarok";
 
+#ifndef TXT_SQL_CONVERT
+
+static struct accreg *accreg_pt;
+unsigned int party_share_level = 10;
 char main_chat_nick[16] = "Main";
 
 // sending packet list
@@ -93,6 +87,7 @@ static int wis_dellist[WISDELLIST_MAX], wis_delnum;
 
 int inter_sql_test (void);
 
+#endif //TXT_SQL_CONVERT
 //--------------------------------------------------------
 // Save registry to sql
 int inter_accreg_tosql(int account_id, int char_id, struct accreg *reg, int type){
@@ -141,6 +136,7 @@ int inter_accreg_tosql(int account_id, int char_id, struct accreg *reg, int type
 	}
 	return 1;
 }
+#ifndef TXT_SQL_CONVERT
 
 // Load account_reg from sql (type=2)
 int inter_accreg_fromsql(int account_id,int char_id, struct accreg *reg, int type)
@@ -187,12 +183,13 @@ int inter_accreg_sql_init(void)
 	return 0;
 
 }
+#endif //TXT_SQL_CONVERT
 
 /*==========================================
  * read config file
  *------------------------------------------
  */
-int inter_config_read(const char *cfgName) {
+static int inter_config_read(const char *cfgName) {
 	int i;
 	char line[1024], w1[1024], w2[1024];
 	FILE *fp;
@@ -236,7 +233,6 @@ int inter_config_read(const char *cfgName) {
 		}
 		//Logins information to be read from the inter_athena.conf
 		//for character deletion (checks email in the loginDB)
-
 		else if(strcmpi(w1,"login_server_ip")==0){
 			strcpy(login_server_ip, w2);
 			ShowStatus ("set login_server_ip : %s\n",w2);
@@ -257,19 +253,17 @@ int inter_config_read(const char *cfgName) {
 			strcpy(login_server_db, w2);
 			ShowStatus ("set login_server_db : %s\n",w2);
 		}
+#ifndef TXT_SQL_CONVERT
 		else if(strcmpi(w1,"party_share_level")==0){
 			party_share_level=(unsigned int)atof(w2);
 		}
 		else if(strcmpi(w1,"log_inter")==0){
 			log_inter = atoi(w2);
 		}
-		else if(strcmpi(w1,"login_server_db")==0){
-			strcpy(login_server_db, w2);
-			ShowStatus ("set login_server_db : %s\n",w2);
-		}
 		else if(strcmpi(w1, "main_chat_nick")==0){	// Main chat nick [LuzZza]
 			strcpy(main_chat_nick, w2);				// 			
 		}
+#endif //TXT_SQL_CONVERT
 		else if(strcmpi(w1,"import")==0){
 			inter_config_read(w2);
 		}
@@ -280,6 +274,7 @@ int inter_config_read(const char *cfgName) {
 
 	return 0;
 }
+#ifndef TXT_SQL_CONVERT
 
 // Save interlog into sql
 int inter_log(char *fmt,...)
@@ -312,9 +307,10 @@ int inter_sql_ping(int tid, unsigned int tick, int id, int data)
 		mysql_ping(&lmysql_handle);
 	return 0;
 }
+#endif //TXT_SQL_CONVERT
 
 // initialize
-int inter_init(const char *file)
+int inter_init_sql(const char *file)
 {
 	//int i;
 
@@ -330,6 +326,7 @@ int inter_init(const char *file)
 			ShowFatalError("%s\n",mysql_error(&mysql_handle));
 			exit(1);
 	}
+#ifndef TXT_SQL_CONVERT
 	else if (inter_sql_test()) {
 		ShowStatus("Connect Success! (Character Server)\n");
 	}
@@ -346,37 +343,40 @@ int inter_init(const char *file)
 			ShowStatus ("Connect Success! (Login Server)\n");
 		}
 	}
+#endif //TXT_SQL_CONVERT
 	if(strlen(default_codepage) > 0 ) {
 		sprintf( tmp_sql, "SET NAMES %s", default_codepage );
 		if (mysql_query(&mysql_handle, tmp_sql)) {
 			ShowSQL("DB error - %s\n",mysql_error(&mysql_handle));
 			ShowDebug("at %s:%d - %s\n", __FILE__,__LINE__,tmp_sql);
 		}
+#ifndef TXT_SQL_CONVERT
 		if(char_gm_read)
 			if (mysql_query(&lmysql_handle, tmp_sql)) {
 				ShowSQL("DB error - %s\n",mysql_error(&lmysql_handle));
 				ShowDebug("at %s:%d - %s\n", __FILE__,__LINE__,tmp_sql);
 			}
+#endif //TXT_SQL_CONVERT
 	}
+
+#ifndef TXT_SQL_CONVERT
 	wis_db = db_alloc(__FILE__,__LINE__,DB_INT,DB_OPT_RELEASE_DATA,sizeof(int));
 	inter_guild_sql_init();
 	inter_storage_sql_init();
 	inter_party_sql_init();
-
 	inter_pet_sql_init();
 	inter_homunculus_sql_init(); // albator
 	inter_accreg_sql_init();
 
-	//printf ("interserver timer initializing : %d sec...\n",autosave_interval);
-	//i=add_timer_interval(gettick()+autosave_interval,inter_save_timer,0,0,autosave_interval);
-
 	if (connection_ping_interval) {
 		add_timer_func_list(inter_sql_ping, "inter_sql_ping");
 		add_timer_interval(gettick()+connection_ping_interval*60*60*1000,
 				inter_sql_ping, 0, 0, connection_ping_interval*60*60*1000);
 	}
+#endif //TXT_SQL_CONVERT
 	return 0;
 }
+#ifndef TXT_SQL_CONVERT
 
 int inter_sql_test (void)
 {
@@ -808,3 +808,4 @@ int inter_check_length(int fd, int length)
 
 	return length;
 }
+#endif //TXT_SQL_CONVERT

+ 4 - 5
src/char_sql/inter.h

@@ -1,10 +1,10 @@
 // Copyright (c) Athena Dev Teams - Licensed under GNU GPL
 // For more information, see LICENCE in the main folder
 
-#ifndef _INTER_H_
-#define _INTER_H_
+#ifndef _INTER_SQL_H_
+#define _INTER_SQL_H_
 
-int inter_init(const char *file);
+int inter_init_sql(const char *file);
 void inter_final(void);
 int inter_parse_frommap(int fd);
 int inter_mapif_init(int fd);
@@ -50,8 +50,7 @@ extern char login_db_server_id[32];
 extern char login_db_server_pw[32];
 extern char login_db_server_db[32];
 
-extern int log_inter;
-
 extern char main_chat_nick[16];
 
+int inter_accreg_tosql(int account_id, int char_id, struct accreg *reg, int type);
 #endif

+ 7 - 0
src/common/mmo.h

@@ -149,6 +149,13 @@ struct global_reg {
 	char value[256]; // [zBuffer]
 };
 
+//Holds array of global registries, used by the char server and converter.
+struct accreg {
+	int account_id, char_id;
+	int reg_num;
+	struct global_reg reg[MAX_REG_NUM];
+};
+
 //For saving status changes across sessions. [Skotlex]
 struct status_change_data {
 	unsigned short type; //SC_type

+ 1 - 1
src/map/script.c

@@ -9677,7 +9677,7 @@ int buildin_misceffect(struct script_state *st)
 	int type;
 
 	type=conv_num(st,& (st->stack->stack_data[st->start+2]));
-	if(st->oid) {
+	if(st->oid && st->oid != fake_nd->bl.id) {
 		struct block_list *bl = map_id2bl(st->oid);
 		if (bl)
 			clif_misceffect2(bl,type);

+ 5 - 5
src/map/skill.c

@@ -6400,13 +6400,10 @@ static int skill_dance_overlap_sub(struct block_list *bl, va_list ap)
 		return 0;
 	if (!(target->val2 & src->val2 & ~UF_ENSEMBLE)) //They don't match (song + dance) is valid.
 		return 0;
-	if (flag) { //Set dissonance
-		target->val1 = src->val1 = target->val2&UF_SONG?BA_DISSONANCE:DC_UGLYDANCE;
+	if (flag) //Set dissonance
 		target->val2 |= UF_ENSEMBLE; //Add ensemble to signal this unit is overlapping.
-	} else { //Remove dissonance
-		target->val1 = target->group->skill_id; //Restore skill id
+	else //Remove dissonance
 		target->val2 &= ~UF_ENSEMBLE;
-	}
 	clif_skill_setunit(target); //Update look of affected cell.
 	return 1;
 }
@@ -9158,6 +9155,9 @@ int skill_attack_area (struct block_list *bl, va_list ap)
 		!status_check_skilluse(NULL, bl, skillid, 2))
 		return 0;
 	
+	if (skillid == WZ_FROSTNOVA) //Only skill that doesn't requires the animation to be removed :X
+		return skill_attack(atk_type,src,dsrc,bl,skillid,skilllv,tick,flag);
+
 	//Area-splash, disable skill animation.
 	return skill_attack(atk_type,src,dsrc,bl,skillid,skilllv,tick,flag|SD_ANIMATION);
 }

+ 4 - 2
src/map/trade.c

@@ -485,9 +485,10 @@ void trade_tradecommit(struct map_session_data *sd) {
 			flag = pc_additem(tsd, &sd->status.inventory[n], sd->deal.item[trade_i].amount);
 			if (flag == 0) {
 				//Logs (T)rade [Lupus]
-				if(log_config.enable_logs&0x2)
+				if(log_config.enable_logs&0x2) {
 					log_pick(sd, "T", 0, sd->status.inventory[n].nameid, -(sd->deal.item[trade_i].amount), &sd->status.inventory[n]);
 					log_pick(tsd, "T", 0, sd->status.inventory[n].nameid, sd->deal.item[trade_i].amount, &sd->status.inventory[n]);
+				}
 				//Logs
 				pc_delitem(sd, n, sd->deal.item[trade_i].amount, 1);
 			} else
@@ -501,9 +502,10 @@ void trade_tradecommit(struct map_session_data *sd) {
 			flag = pc_additem(sd, &tsd->status.inventory[n], tsd->deal.item[trade_i].amount);
 			if (flag == 0) {
 				//Logs (T)rade [Lupus]
-				if(log_config.enable_logs&0x2)
+				if(log_config.enable_logs&0x2) {
 					log_pick(tsd, "T", 0, tsd->status.inventory[n].nameid, -(tsd->deal.item[trade_i].amount), &tsd->status.inventory[n]);
 					log_pick(sd, "T", 0, tsd->status.inventory[n].nameid, tsd->deal.item[trade_i].amount, &tsd->status.inventory[n]);
+				}
 				//Logs
 				pc_delitem(tsd, n, tsd->deal.item[trade_i].amount, 1);
 			} else

+ 10 - 1
src/txt-converter/Makefile

@@ -1,6 +1,12 @@
 all sql: char-converter login-converter
 
-char-converter: char-converter.o ../common/obj/minicore.o ../common/obj/malloc.o ../common/obj/showmsg.o ../common/obj/strlib.o ../common/obj/mapindex.o ../common/obj/ers.o
+char-converter: char-converter.o ../common/obj/minicore.o \
+	../common/obj/malloc.o ../common/obj/showmsg.o ../common/obj/strlib.o \
+	../common/obj/mapindex.o ../common/obj/ers.o \
+	../char/char.o ../char/int_pet.o ../char/int_storage.o ../char/inter.o \
+	../char/int_party.o ../char/int_guild.o \
+	../char_sql/char.o ../char_sql/int_pet.o ../char_sql/int_storage.o \
+	../char_sql/inter.o ../char_sql/int_party.o ../char_sql/int_guild.o
 	$(CC) -o ../../tools/$@ $^ $(LIB_S)
 
 login-converter: login-converter.o ../common/obj/minicore.o ../common/obj/db.o ../common/obj/malloc.o ../common/obj/showmsg.o ../common/obj/ers.o
@@ -11,5 +17,8 @@ clean:
 
 # DO NOT DELETE
 
+%.o: %.c
+	$(COMPILE.c) -DTXT_SQL_CONVERT $(OUTPUT_OPTION) $<
+
 char-converter.o: char-converter.c
 login-converter.o: login-converter.c

Разница между файлами не показана из-за своего большого размера
+ 60 - 1124
src/txt-converter/char-converter.c


Некоторые файлы не были показаны из-за большого количества измененных файлов