summaryrefslogtreecommitdiff
path: root/src/txt-converter
diff options
context:
space:
mode:
authorValaris <Valaris@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-01-29 16:00:45 +0000
committerValaris <Valaris@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-01-29 16:00:45 +0000
commita2675f07d7da22a7c6ae11f545bf8f671e785a82 (patch)
tree4b825dc642cb6eb9a060e54bf8d69288fbee4904 /src/txt-converter
parentb8801ae9585201eaaf9fdf80d9c7117ee18f52e2 (diff)
downloadhercules-a2675f07d7da22a7c6ae11f545bf8f671e785a82.tar.gz
hercules-a2675f07d7da22a7c6ae11f545bf8f671e785a82.tar.bz2
hercules-a2675f07d7da22a7c6ae11f545bf8f671e785a82.tar.xz
hercules-a2675f07d7da22a7c6ae11f545bf8f671e785a82.zip
Clearing trunk.
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@5091 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/txt-converter')
-rw-r--r--src/txt-converter/char/Makefile13
-rw-r--r--src/txt-converter/char/char-converter.c845
-rw-r--r--src/txt-converter/char/char.h39
-rw-r--r--src/txt-converter/char/int_guild.h10
-rw-r--r--src/txt-converter/char/int_party.h11
-rw-r--r--src/txt-converter/char/int_pet.h12
-rw-r--r--src/txt-converter/char/int_storage.h11
-rw-r--r--src/txt-converter/common/inter.h28
-rw-r--r--src/txt-converter/common/mmo.h280
-rw-r--r--src/txt-converter/login/Makefile12
-rw-r--r--src/txt-converter/login/login-converter.c262
11 files changed, 0 insertions, 1523 deletions
diff --git a/src/txt-converter/char/Makefile b/src/txt-converter/char/Makefile
deleted file mode 100644
index 6b85a04db..000000000
--- a/src/txt-converter/char/Makefile
+++ /dev/null
@@ -1,13 +0,0 @@
-all: char-converter
-sql: char-converter
-
-COMMON_OBJ = ../../common/obj/core.o ../../common/obj/socket.o ../../common/obj/timer.o ../../common/obj/grfio.o ../../common/obj/db.o ../../common/obj/lock.o ../../common/obj/nullpo.o ../../common/obj/malloc.o ../../common/obj/showmsg.o ../../common/obj/strlib.o
-
-char-converter: char-converter.o $(COMMON_OBJ)
- $(CC) -o ../../../$@ $^ $(LIB_S)
-
-char-converter.o: char-converter.c char.h ../../common/strlib.h
-strlib.o: strlib.c ../../common/strlib.h
-clean:
- rm -f *.o ../../../char-converter
-
diff --git a/src/txt-converter/char/char-converter.c b/src/txt-converter/char/char-converter.c
deleted file mode 100644
index 217bf2b15..000000000
--- a/src/txt-converter/char/char-converter.c
+++ /dev/null
@@ -1,845 +0,0 @@
-// $Id: char-converter.c,v 1.1.1.1 2004/09/10 17:45:03 MagicalTux Exp $
-// original : char2.c 2003/03/14 11:58:35 Rev.1.5
-
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <netinet/in.h>
-#include <sys/time.h>
-#include <sys/ioctl.h>
-#include <unistd.h>
-#include <signal.h>
-#include <fcntl.h>
-#include <string.h>
-#include <arpa/inet.h>
-
-
-#define STORAGE_MEMINC 16
-
-#include "char.h"
-#include "../../common/strlib.h"
-
-#ifdef MEMWATCH
-#include "memwatch.h"
-#endif
-
-char pet_txt[256]="save/pet.txt";
-char storage_txt[256]="save/storage.txt";
-
-MYSQL mysql_handle;
-MYSQL_RES* sql_res ;
-MYSQL_ROW sql_row ;
-int sql_fields, sql_cnt;
-char tmp_sql[65535];
-
-int db_server_port = 3306;
-char db_server_ip[16] = "127.0.0.1";
-char db_server_id[32] = "ragnarok";
-char db_server_pw[32] = "ragnarok";
-char db_server_logindb[32] = "ragnarok";
-
-struct storage *storage_=NULL;
-
-struct mmo_map_server server[MAX_MAP_SERVERS];
-int server_fd[MAX_MAP_SERVERS];
-
-int login_fd;
-char userid[24];
-char passwd[24];
-char server_name[20];
-char login_ip_str[16];
-int login_port = 6900;
-char char_ip_str[16];
-int char_ip;
-int char_port = 6121;
-int char_maintenance;
-int char_new;
-char char_txt[256];
-
-char t_name[256];
-
-#define CHAR_STATE_WAITAUTH 0
-#define CHAR_STATE_AUTHOK 1
-struct char_session_data{
- int state;
- int account_id, login_id1, login_id2, sex;
- int found_char[9];
-};
-
-#define AUTH_FIFO_SIZE 256
-struct {
- int account_id, char_id, login_id1, char_pos, delflag, sex;
-} auth_fifo[AUTH_FIFO_SIZE];
-int auth_fifo_pos=0;
-
-int char_id_count=100000;
-struct mmo_charstatus *char_dat;
-int char_num, char_max;
-int max_connect_user=0;
-int autosave_interval=DEFAULT_AUTOSAVE_INTERVAL;
-
-// ʱ ġ(conf Ϸκ 缳 )
-struct point start_point={"new_1-1.gat", 53,111};
-
-
-
-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_tosql(int pet_id, struct s_pet *p) {
- //`pet` (`pet_id`, `class`,`name`,`account_id`,`char_id`,`level`,`egg_id`,`equip`,`intimate`,`hungry`,`rename_flag`,`incuvate`)
-
- char tmp_sql[65535];
- MYSQL_RES* sql_res ;
- MYSQL_ROW sql_row ;
-
- jstrescapecpy (t_name, p->name);
- 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;
- sprintf(tmp_sql,"SELECT * FROM `pet` WHERE `pet_id`='%d'",pet_id);
- if(mysql_query(&mysql_handle, tmp_sql) ) {
- printf("DB server Error - %s\n", mysql_error(&mysql_handle) );
- }
- sql_res = mysql_store_result(&mysql_handle) ;
- sql_row = mysql_fetch_row(sql_res); //row fetching
- if (!sql_row) //no row -> insert
- sprintf(tmp_sql,"INSERT INTO `pet` (`pet_id`, `class`,`name`,`account_id`,`char_id`,`level`,`egg_id`,`equip`,`intimate`,`hungry`,`rename_flag`,`incuvate`) VALUES ('%d', '%d', '%s', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d')",
- p->pet_id, p->class_, t_name, p->account_id, p->char_id, p->level, p->egg_id,
- p->equip, p->intimate, p->hungry, p->rename_flag, p->incuvate);
- else //row reside -> updating
- sprintf(tmp_sql, "UPDATE `pet` SET `class`='%d',`name`='%s',`account_id`='%d',`char_id`='%d',`level`='%d',`egg_id`='%d',`equip`='%d',`intimate`='%d',`hungry`='%d',`rename_flag`='%d',`incuvate`='%d' WHERE `pet_id`='%d'",
- p->class_, t_name, p->account_id, p->char_id, p->level, p->egg_id,
- p->equip, p->intimate, p->hungry, p->rename_flag, p->incuvate, p->pet_id);
- mysql_free_result(sql_res) ; //resource free
- if(mysql_query(&mysql_handle, tmp_sql) ) {
- printf("DB server Error - %s\n", mysql_error(&mysql_handle) );
- }
-
- printf ("pet dump success! - %d:%s\n", pet_id, p->name);
-
- return 0;
-}
-
-int storage_tosql(int account_id,struct storage *p){
- // id -> DB dump
- // storage {`account_id`/`id`/`nameid`/`amount`/`equip`/`identify`/`refine`/`attribute`/`card0`/`card1`/`card2`/`card3`}
- int i,j;
-
- j=0;
-
- //printf ("starting storage dump to DB - id: %d\n", account_id);
-
- //delete old data.
- sprintf(tmp_sql,"DELETE FROM `storage` WHERE `account_id`='%d'",account_id);
- if(mysql_query(&mysql_handle, tmp_sql) ) {
- printf("DB server Error - %s\n", mysql_error(&mysql_handle) );
- }
-
- //printf ("all storage item was deleted ok\n");
-
- for(i=0;i<MAX_STORAGE;i++) {
- //printf ("save storage num: %d (%d:%d)\n",i, p->storage_[i].nameid , p->storage_[i].amount);
-
- if( (p->storage_[i].nameid) && (p->storage_[i].amount) ){
- sprintf(tmp_sql,"INSERT INTO `storage` (`account_id`,`nameid`,`amount`,`equip`,`identify`,`refine`,`attribute`,`card0`,`card1`,`card2`,`card3`,`broken`) VALUES ('%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d')",
- p->account_id, p->storage_[i].nameid, p->storage_[i].amount, p->storage_[i].equip,
- p->storage_[i].identify, p->storage_[i].refine, p->storage_[i].attribute,
- p->storage_[i].card[0], p->storage_[i].card[1], p->storage_[i].card[2], p->storage_[i].card[3], p->storage_[i].broken );
- //printf ("%s\n",tmp_sql);
- if(mysql_query(&mysql_handle, tmp_sql) ) {
- printf("DB server Error - %s\n", mysql_error(&mysql_handle) );
- }
- j++;
- }
- }
-
- printf ("storage dump to DB - id: %d (total: %d)\n", account_id, j);
- return 0;
-}
-// char to storage
-int storage_fromstr(char *str, struct storage *p)
-{
- int tmp_int[256];
- int set, next, len, i;
-
- set=sscanf(str,"%d, %d%n", &tmp_int[0], &tmp_int[1], &next);
- p->storage_amount=tmp_int[1];
-
- if(set!=2)
- return 0;
- if(str[next]=='\n' || str[next]=='\r')
- return 1;
- next++;
- for(i=0;str[next] && str[next]!='\t';i++){
- if(sscanf(str + next, "%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d%n",
- &tmp_int[0], &tmp_int[1], &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], &tmp_int[11], &len) == 12) {
- p->storage_[i].id = tmp_int[0];
- p->storage_[i].nameid = tmp_int[1];
- p->storage_[i].amount = tmp_int[2];
- p->storage_[i].equip = tmp_int[3];
- p->storage_[i].identify = tmp_int[4];
- p->storage_[i].refine = tmp_int[5];
- p->storage_[i].attribute = tmp_int[6];
- p->storage_[i].card[0] = tmp_int[7];
- p->storage_[i].card[1] = tmp_int[8];
- p->storage_[i].card[2] = tmp_int[9];
- p->storage_[i].card[3] = tmp_int[10];
- p->storage_[i].broken = tmp_int[11];
- next += len;
- if (str[next] == ' ')
- next++;
- }
-
- else if(sscanf(str + next, "%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d%n",
- &tmp_int[0], &tmp_int[1], &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], &len) == 11) {
- p->storage_[i].id = tmp_int[0];
- p->storage_[i].nameid = tmp_int[1];
- p->storage_[i].amount = tmp_int[2];
- p->storage_[i].equip = tmp_int[3];
- p->storage_[i].identify = tmp_int[4];
- p->storage_[i].refine = tmp_int[5];
- p->storage_[i].attribute = tmp_int[6];
- p->storage_[i].card[0] = tmp_int[7];
- p->storage_[i].card[1] = tmp_int[8];
- p->storage_[i].card[2] = tmp_int[9];
- p->storage_[i].card[3] = tmp_int[10];
- p->storage_[i].broken = 0;
- next += len;
- if (str[next] == ' ')
- next++;
- }
-
- else return 0;
- }
- return 1;
-}
-
-/////////////////////////////////
-int mmo_char_fromstr(char *str, struct mmo_charstatus *p) {
- int tmp_int[256];
- int set, next, len, i;
-
- // initilialise character
- memset(p, '\0', sizeof(struct mmo_charstatus));
-
- // If it's not char structure of version 1008 and after
- if ((set = sscanf(str, "%d\t%d,%d\t%[^\t]\t%d,%d,%d\t%d,%d,%d\t%d,%d,%d,%d\t%d,%d,%d,%d,%d,%d\t%d,%d"
- "\t%d,%d,%d\t%d,%d,%d\t%d,%d,%d\t%d,%d,%d,%d,%d"
- "\t%[^,],%d,%d\t%[^,],%d,%d,%d%n",
- &tmp_int[0], &tmp_int[1], &tmp_int[2], p->name, //
- &tmp_int[3], &tmp_int[4], &tmp_int[5],
- &tmp_int[6], &tmp_int[7], &tmp_int[8],
- &tmp_int[9], &tmp_int[10], &tmp_int[11], &tmp_int[12],
- &tmp_int[13], &tmp_int[14], &tmp_int[15], &tmp_int[16], &tmp_int[17], &tmp_int[18],
- &tmp_int[19], &tmp_int[20],
- &tmp_int[21], &tmp_int[22], &tmp_int[23], //
- &tmp_int[24], &tmp_int[25], &tmp_int[26],
- &tmp_int[27], &tmp_int[28], &tmp_int[29],
- &tmp_int[30], &tmp_int[31], &tmp_int[32], &tmp_int[33], &tmp_int[34],
- p->last_point.map, &tmp_int[35], &tmp_int[36], //
- p->save_point.map, &tmp_int[37], &tmp_int[38], &tmp_int[39], &next)) != 43) {
- tmp_int[39] = 0; // partner id
- // If not char structure from version 384 to 1007
- if ((set = sscanf(str, "%d\t%d,%d\t%[^\t]\t%d,%d,%d\t%d,%d,%d\t%d,%d,%d,%d\t%d,%d,%d,%d,%d,%d\t%d,%d"
- "\t%d,%d,%d\t%d,%d,%d\t%d,%d,%d\t%d,%d,%d,%d,%d"
- "\t%[^,],%d,%d\t%[^,],%d,%d%n",
- &tmp_int[0], &tmp_int[1], &tmp_int[2], p->name, //
- &tmp_int[3], &tmp_int[4], &tmp_int[5],
- &tmp_int[6], &tmp_int[7], &tmp_int[8],
- &tmp_int[9], &tmp_int[10], &tmp_int[11], &tmp_int[12],
- &tmp_int[13], &tmp_int[14], &tmp_int[15], &tmp_int[16], &tmp_int[17], &tmp_int[18],
- &tmp_int[19], &tmp_int[20],
- &tmp_int[21], &tmp_int[22], &tmp_int[23], //
- &tmp_int[24], &tmp_int[25], &tmp_int[26],
- &tmp_int[27], &tmp_int[28], &tmp_int[29],
- &tmp_int[30], &tmp_int[31], &tmp_int[32], &tmp_int[33], &tmp_int[34],
- p->last_point.map, &tmp_int[35], &tmp_int[36], //
- p->save_point.map, &tmp_int[37], &tmp_int[38], &next)) != 42) {
- // It's char structure of a version before 384
- tmp_int[26] = 0; // pet id
- set = sscanf(str, "%d\t%d,%d\t%[^\t]\t%d,%d,%d\t%d,%d,%d\t%d,%d,%d,%d\t%d,%d,%d,%d,%d,%d\t%d,%d"
- "\t%d,%d,%d\t%d,%d\t%d,%d,%d\t%d,%d,%d,%d,%d"
- "\t%[^,],%d,%d\t%[^,],%d,%d%n",
- &tmp_int[0], &tmp_int[1], &tmp_int[2], p->name, //
- &tmp_int[3], &tmp_int[4], &tmp_int[5],
- &tmp_int[6], &tmp_int[7], &tmp_int[8],
- &tmp_int[9], &tmp_int[10], &tmp_int[11], &tmp_int[12],
- &tmp_int[13], &tmp_int[14], &tmp_int[15], &tmp_int[16], &tmp_int[17], &tmp_int[18],
- &tmp_int[19], &tmp_int[20],
- &tmp_int[21], &tmp_int[22], &tmp_int[23], //
- &tmp_int[24], &tmp_int[25], //
- &tmp_int[27], &tmp_int[28], &tmp_int[29],
- &tmp_int[30], &tmp_int[31], &tmp_int[32], &tmp_int[33], &tmp_int[34],
- p->last_point.map, &tmp_int[35], &tmp_int[36], //
- p->save_point.map, &tmp_int[37], &tmp_int[38], &next);
- set += 2;
- //printf("char: old char data ver.1\n");
- // Char structure of version 1007 or older
- } else {
- set++;
- //printf("char: old char data ver.2\n");
- }
- // Char structure of version 1008+
- } else {
- //printf("char: new char data ver.3\n");
- }
- if (set != 43)
- return 0;
-
- p->char_id = tmp_int[0];
- p->account_id = tmp_int[1];
- p->char_num = tmp_int[2];
- p->class_ = tmp_int[3];
- p->base_level = tmp_int[4];
- p->job_level = tmp_int[5];
- p->base_exp = tmp_int[6];
- p->job_exp = tmp_int[7];
- p->zeny = tmp_int[8];
- p->hp = tmp_int[9];
- p->max_hp = tmp_int[10];
- p->sp = tmp_int[11];
- p->max_sp = tmp_int[12];
- p->str = tmp_int[13];
- p->agi = tmp_int[14];
- p->vit = tmp_int[15];
- p->int_ = tmp_int[16];
- p->dex = tmp_int[17];
- p->luk = tmp_int[18];
- p->status_point = tmp_int[19];
- p->skill_point = tmp_int[20];
- p->option = tmp_int[21];
- p->karma = tmp_int[22];
- p->manner = tmp_int[23];
- p->party_id = tmp_int[24];
- p->guild_id = tmp_int[25];
- p->pet_id = tmp_int[26];
- p->hair = tmp_int[27];
- p->hair_color = tmp_int[28];
- p->clothes_color = tmp_int[29];
- p->weapon = tmp_int[30];
- p->shield = tmp_int[31];
- p->head_top = tmp_int[32];
- p->head_mid = tmp_int[33];
- p->head_bottom = tmp_int[34];
- p->last_point.x = tmp_int[35];
- p->last_point.y = tmp_int[36];
- p->save_point.x = tmp_int[37];
- p->save_point.y = tmp_int[38];
- p->partner_id = tmp_int[39];
-
- // Some checks
- for(i = 0; i < char_num; i++) {
- if (char_dat[i].char_id == p->char_id) {
- printf("\033[1;31mmmo_auth_init: ******Error: a character has an identical id to another.\n");
- printf(" character id #%d -> new character not readed.\n", p->char_id);
- printf(" Character saved in log file.\033[0m\n");
- return -1;
- } else if (strcmp(char_dat[i].name, p->name) == 0) {
- printf("\033[1;31mmmo_auth_init: ******Error: character name already exists.\n");
- printf(" character name '%s' -> new character not readed.\n", p->name);
- printf(" Character saved in log file.\033[0m\n");
- return -2;
- }
- }
-
- if (str[next] == '\n' || str[next] == '\r')
- return 1; // VKf[^
-
- next++;
-
- for(i = 0; str[next] && str[next] != '\t'; i++) {
- set = sscanf(str+next, "%[^,],%d,%d%n", p->memo_point[i].map, &tmp_int[0], &tmp_int[1], &len);
- if (set != 3)
- return -3;
- p->memo_point[i].x = tmp_int[0];
- p->memo_point[i].y = tmp_int[1];
- next += len;
- if (str[next] == ' ')
- next++;
- }
-
- next++;
-
- for(i = 0; str[next] && str[next] != '\t'; i++) {
- if (sscanf(str + next, "%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d%n",
- &tmp_int[0], &tmp_int[1], &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], &tmp_int[11], &len) == 12) {
- // do nothing, it's ok
- } else if(sscanf(str + next, "%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d%n",
- &tmp_int[0], &tmp_int[1], &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], &len) == 11) {
- tmp_int[11] = 0; // broken doesn't exist in this version -> 0
- } else // invalid structure
- return -4;
- p->inventory[i].id = tmp_int[0];
- p->inventory[i].nameid = tmp_int[1];
- p->inventory[i].amount = tmp_int[2];
- p->inventory[i].equip = tmp_int[3];
- p->inventory[i].identify = tmp_int[4];
- p->inventory[i].refine = tmp_int[5];
- p->inventory[i].attribute = tmp_int[6];
- p->inventory[i].card[0] = tmp_int[7];
- p->inventory[i].card[1] = tmp_int[8];
- p->inventory[i].card[2] = tmp_int[9];
- p->inventory[i].card[3] = tmp_int[10];
- p->inventory[i].broken = tmp_int[11];
- next += len;
- if (str[next] == ' ')
- next++;
- }
-
- next++;
-
- for(i = 0; str[next] && str[next] != '\t'; i++) {
- if (sscanf(str + next, "%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d%n",
- &tmp_int[0], &tmp_int[1], &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], &tmp_int[11], &len) == 12) {
- // do nothing, it's ok
- } else if (sscanf(str + next, "%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d%n",
- &tmp_int[0], &tmp_int[1], &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], &len) == 11) {
- tmp_int[11] = 0; // broken doesn't exist in this version -> 0
- } else // invalid structure
- return -5;
- p->cart[i].id = tmp_int[0];
- p->cart[i].nameid = tmp_int[1];
- p->cart[i].amount = tmp_int[2];
- p->cart[i].equip = tmp_int[3];
- p->cart[i].identify = tmp_int[4];
- p->cart[i].refine = tmp_int[5];
- p->cart[i].attribute = tmp_int[6];
- p->cart[i].card[0] = tmp_int[7];
- p->cart[i].card[1] = tmp_int[8];
- p->cart[i].card[2] = tmp_int[9];
- p->cart[i].card[3] = tmp_int[10];
- p->cart[i].broken = tmp_int[11];
- next += len;
- if (str[next] == ' ')
- next++;
- }
-
- next++;
-
- for(i = 0; str[next] && str[next] != '\t'; i++) {
- set = sscanf(str + next, "%d,%d%n", &tmp_int[0], &tmp_int[1], &len);
- if (set != 2)
- return -6;
- p->skill[tmp_int[0]].id = tmp_int[0];
- p->skill[tmp_int[0]].lv = tmp_int[1];
- next += len;
- if (str[next] == ' ')
- next++;
- }
-
- next++;
-
- for(i = 0; str[next] && str[next] != '\t' && str[next] != '\n' && str[next] != '\r'; i++) { // global_regȑOathena.txt݊̂߈ꉞ'\n'`FbN
- set = sscanf(str + next, "%[^,],%d%n", p->global_reg[i].str, &p->global_reg[i].value, &len);
- if (set != 2) {
- // because some scripts are not correct, the str can be "". So, we must check that.
- // If it's, we must not refuse the character, but just this REG value.
- // Character line will have something like: nov_2nd_cos,9 ,9 nov_1_2_cos_c,1 (here, ,9 is not good)
- if (str[next] == ',' && sscanf(str + next, ",%d%n", &p->global_reg[i].value, &len) == 1)
- i--;
- else
- return -7;
- }
- next += len;
- if (str[next] == ' ')
- next++;
- }
- p->global_reg_num = i;
-
- return 1;
-}
-
-//==========================================================================================================
-int mmo_char_tosql(int char_id, struct mmo_charstatus *p){
- int i,save_flag;
-
- save_flag = char_id;
- printf("request save char data... (%d)\n",char_id);
-
- //`char`( `char_id`,`account_id`,`char_num`,`name`,`class`,`base_level`,`job_level`,`base_exp`,`job_exp`,`zeny`, //9
- //`str`,`agi`,`vit`,`int`,`dex`,`luk`, //15
- //`max_hp`,`hp`,`max_sp`,`sp`,`status_point`,`skill_point`, //21
- //`option`,`karma`,`manner`,`party_id`,`guild_id`,`pet_id`, //27
- //`hair`,`hair_color`,`clothes_color`,`weapon`,`shield`,`head_top`,`head_mid`,`head_bottom`, //35
- //`last_map`,`last_x`,`last_y`,`save_map`,`save_x`,`save_y`)
- sprintf(tmp_sql ,"INSERT INTO `char` SET `char_id`='%d', `account_id`='%d', `char_num`='%d', `name`='%s', `class`='%d', `base_level`='%d', `job_level`='%d',"
- "`base_exp`='%d', `job_exp`='%d', `zeny`='%d',"
- "`max_hp`='%d',`hp`='%d',`max_sp`='%d',`sp`='%d',`status_point`='%d',`skill_point`='%d',"
- "`str`='%d',`agi`='%d',`vit`='%d',`int`='%d',`dex`='%d',`luk`='%d',"
- "`option`='%d',`karma`='%d',`manner`='%d',`party_id`='%d',`guild_id`='%d',`pet_id`='%d',"
- "`hair`='%d',`hair_color`='%d',`clothes_color`='%d',`weapon`='%d',`shield`='%d',`head_top`='%d',`head_mid`='%d',`head_bottom`='%d',"
- "`last_map`='%s',`last_x`='%d',`last_y`='%d',`save_map`='%s',`save_x`='%d',`save_y`='%d', `partner_id` = '%d'",
- char_id,p->account_id,p->char_num,p->name,p->class_, p->base_level, p->job_level,
- p->base_exp, p->job_exp, p->zeny,
- p->max_hp, p->hp, p->max_sp, p->sp, p->status_point, p->skill_point,
- p->str, p->agi, p->vit, p->int_, p->dex, p->luk,
- p->option, p->karma, p->manner, p->party_id, p->guild_id, p->pet_id,
- 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,
- p->save_point.map, p->save_point.x, p->save_point.y, p->partner_id
- );
-
- if(mysql_query(&mysql_handle, tmp_sql) ) {
- printf("DB server Error (update `char`)- %s\n", mysql_error(&mysql_handle) );
- }
-
- //`memo` (`memo_id`,`char_id`,`map`,`x`,`y`)
- sprintf(tmp_sql,"DELETE FROM `memo` WHERE `char_id`='%d'",char_id);
- if(mysql_query(&mysql_handle, tmp_sql) ) {
- printf("DB server Error (delete `memo`)- %s\n", mysql_error(&mysql_handle) );
- }
-
- //insert here.
- for(i=0;i<10;i++){
- if(p->memo_point[i].map[0]){
- sprintf(tmp_sql,"INSERT INTO `memo`(`char_id`,`map`,`x`,`y`) VALUES ('%d', '%s', '%d', '%d')",
- char_id, p->memo_point[i].map, p->memo_point[i].x, p->memo_point[i].y);
- if(mysql_query(&mysql_handle, tmp_sql) )
- printf("DB server Error (insert `memo`)- %s\n", mysql_error(&mysql_handle) );
- }
- }
- //`inventory` (`id`,`char_id`, `nameid`, `amount`, `equip`, `identify`, `refine`, `attribute`, `card0`, `card1`, `card2`, `card3`, `broken`)
- sprintf(tmp_sql,"DELETE FROM `inventory` WHERE `char_id`='%d'",char_id);
- if(mysql_query(&mysql_handle, tmp_sql) ) {
- printf("DB server Error (delete `inventory`)- %s\n", mysql_error(&mysql_handle) );
- }
-
- //insert here.
- for(i=0;i<MAX_INVENTORY;i++){
- if(p->inventory[i].nameid){
- sprintf(tmp_sql,"INSERT INTO `inventory`(`id`,`char_id`, `nameid`, `amount`, `equip`, `identify`, `refine`, `attribute`, `card0`, `card1`, `card2`, `card3`, `broken`)"
- " VALUES ('%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d')",
- p->inventory[i].id, char_id,p->inventory[i].nameid, p->inventory[i].amount, p->inventory[i].equip,
- p->inventory[i].identify, p->inventory[i].refine, p->inventory[i].attribute,
- p->inventory[i].card[0], p->inventory[i].card[1], p->inventory[i].card[2], p->inventory[i].card[3], p->inventory[i].broken);
- if(mysql_query(&mysql_handle, tmp_sql) )
- printf("DB server Error (insert `inventory`)- %s\n", mysql_error(&mysql_handle) );
- }
- }
-
- //`cart_inventory` (`id`,`char_id`, `nameid`, `amount`, `equip`, `identify`, `refine`, `attribute`, `card0`, `card1`, `card2`, `card3`, `broken`)
- sprintf (tmp_sql, "DELETE FROM `cart_inventory` WHERE `char_id`='%d'", char_id);
- if(mysql_query(&mysql_handle, tmp_sql) ) {
- printf("DB server Error (delete `cart_inventory`)- %s\n", mysql_error(&mysql_handle) );
- }
-
- //insert here.
- for(i=0;i<MAX_CART;i++){
- if(p->cart[i].nameid){
- sprintf(tmp_sql,"INSERT INTO `cart_inventory`(`id`,`char_id`, `nameid`, `amount`, `equip`, `identify`, `refine`, `attribute`, `card0`, `card1`, `card2`, `card3`, `broken`)"
- " VALUES ('%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d' )",
- p->cart[i].id, char_id, p->cart[i].nameid, p->cart[i].amount, p->cart[i].equip,
- p->cart[i].identify, p->cart[i].refine, p->cart[i].attribute,
- p->cart[i].card[0], p->cart[i].card[1], p->cart[i].card[2], p->cart[i].card[3], p->cart[i].broken );
- if(mysql_query(&mysql_handle, tmp_sql) ) {
- printf("DB server Error (insert `cart_inventory`)- %s\n", mysql_error(&mysql_handle) );
- }
- }
- }
-
-
- //`skill` (`char_id`, `id`, `lv`)
- sprintf(tmp_sql,"DELETE FROM `skill` WHERE `char_id`='%d'",char_id);
- if(mysql_query(&mysql_handle, tmp_sql) ) {
- printf("DB server Error (delete `skill`)- %s\n", mysql_error(&mysql_handle) );
- }
-
- //insert here.
- for(i=0;i<MAX_SKILL;i++){
- if(p->skill[i].id){
- if (p->skill[i].id && p->skill[i].flag!=1) {
- sprintf(tmp_sql,"INSERT INTO `skill`(`char_id`,`id`, `lv`) VALUES ('%d', '%d', '%d')",
- char_id, p->skill[i].id, (p->skill[i].flag==0)?p->skill[i].lv:p->skill[i].flag-2);
- if(mysql_query(&mysql_handle, tmp_sql) ) {
- printf("DB server Error (insert `skill`)- %s\n", mysql_error(&mysql_handle) );
- }
- }
- }
- }
- //`global_reg_value` (`char_id`, `str`, `value`)
- sprintf(tmp_sql,"DELETE FROM `global_reg_value` WHERE `char_id`='%d'",char_id);
- if(mysql_query(&mysql_handle, tmp_sql) ) {
- printf("DB server Error (delete `global_reg_value`)- %s\n", mysql_error(&mysql_handle) );
- }
-
- //insert here.
- for(i=0;i<p->global_reg_num;i++){
- if(p->global_reg[i].value !=0){
- sprintf(tmp_sql,"INSERT INTO `global_reg_value` (`char_id`, `str`, `value`) VALUES ('%d', '%s','%d')",
- char_id, p->global_reg[i].str, p->global_reg[i].value);
- if(mysql_query(&mysql_handle, tmp_sql) ) {
- printf("DB server Error (insert `global_reg_value`)- %s\n", mysql_error(&mysql_handle) );
- }
- }
- }
-
- printf("saving char is done... (%d)\n",char_id);
- save_flag = 0;
-
- return 0;
-}
-//==========================================================================================================
-
-int mmo_char_init(void){
- char line[65536];
- struct s_pet *p;
- int ret;
- int i=0,set,tmp_int[2], c= 0;
- char input;
- FILE *fp;
-
-
- //DB connection initialized
- mysql_init(&mysql_handle);
- printf("Connect DB server.... (inter server)\n");
- if(!mysql_real_connect(&mysql_handle, db_server_ip, db_server_id, db_server_pw,
- db_server_logindb ,db_server_port, (char *)NULL, 0)) {
- //pointer check
- printf("%s\n",mysql_error(&mysql_handle));
- exit(1);
- }
- else {
- printf ("connect success! (inter server)\n");
- }
-
-
-
- printf("Warning : Make sure you backup your databases before continuing!\n");
- printf("\nDo you wish to convert your Character Database to SQL? (y/n) : ");
- input=getchar();
- if(input == 'y' || input == 'Y'){
- printf("\nConverting Character Database...\n");
- fp=fopen("save/athena.txt","r");
- char_dat = (struct mmo_charstatus*)malloc(sizeof(char_dat[0])*256);
- char_max=256;
- if(fp==NULL)
- return 0;
- while(fgets(line, 65535, fp)){
- if(char_num>=char_max){
- char_max+=256;
- char_dat = (struct mmo_charstatus*)realloc(char_dat, sizeof(char_dat[0]) *char_max);
- }
- memset(&char_dat[char_num], 0, sizeof(char_dat[0]));
- ret=mmo_char_fromstr(line, &char_dat[char_num]);
- if(ret){
- mmo_char_tosql(char_dat[char_num].char_id , &char_dat[char_num]);
- printf ("convert %d -> DB\n",char_dat[char_num].char_id);
- if(char_dat[char_num].char_id>=char_id_count)
- char_id_count=char_dat[char_num].char_id+1;
- char_num++;
- }
- }
- printf("char data convert end\n");
- fclose(fp);
- }
-
- while(getchar() != '\n');
- printf("\nDo you wish to convert your Storage Database to SQL? (y/n) : ");
- input=getchar();
- if(input == 'y' || input == 'Y') {
- printf("\nConverting Storage Database...\n");
- fp=fopen(storage_txt,"r");
- if(fp==NULL){
- printf("cant't read : %s\n",storage_txt);
- return 0;
- }
-
- while(fgets(line,65535,fp)){
- set=sscanf(line,"%d,%d",&tmp_int[0],&tmp_int[1]);
- if(set==2) {
- if(i==0){
- storage_ = (struct storage*)malloc(sizeof(struct storage));
- }else{
- storage_ = (struct storage*)realloc(storage_,sizeof(struct storage)*(i+1));
- }
- memset(&storage_[i],0,sizeof(struct storage));
- storage_[i].account_id=tmp_int[0];
- storage_fromstr(line,&storage_[i]);
- storage_tosql(tmp_int[0],&storage_[i]); //to sql. (dump)
- i++;
- }
- }
- fclose(fp);
- }
-
- while(getchar() != '\n');
- printf("\nDo you wish to convert your Pet Database to SQL? (y/n) : ");
- input=getchar();
- if(input == 'y' || input == 'Y') {
- printf("\nConverting Pet Database...\n");
- if( (fp=fopen(pet_txt,"r")) ==NULL )
- return 1;
-
- p = (struct s_pet*)malloc(sizeof(struct s_pet));
- while(fgets(line, sizeof(line), fp)){
- if(p==NULL){
- printf("int_pet: out of memory!\n");
- exit(0);
- }
- if(inter_pet_fromstr(line, p)==0 && p->pet_id>0){
- //pet dump
- inter_pet_tosql(p->pet_id,p);
- }else{
- printf("int_pet: broken data [%s] line %d\n", pet_txt, c);
- }
- c++;
- }
- fclose(fp);
- }
-
- return 0;
-}
-int inter_config_read(const char *cfgName) {
- int i;
- char line[1024], w1[1024], w2[1024];
- FILE *fp;
-
- printf ("Start reading interserver configuration: %s\n",cfgName);
-
- fp=fopen(cfgName,"r");
- if(fp==NULL){
- printf("File not found: %s\n", cfgName);
- return 1;
- }
- while(fgets(line, 1020, fp)){
- i=sscanf(line,"%[^:]:%s", w1, w2);
- if(i!=2)
- continue;
- if(strcmpi(w1,"storage_txt")==0){
- printf ("set storage_txt : %s\n",w2);
- strncpy(storage_txt, w2, sizeof(storage_txt));
- } else if(strcmpi(w1,"pet_txt")==0){
- printf ("set pet_txt : %s\n",w2);
- strncpy(pet_txt, w2, sizeof(pet_txt));
- }
- //add for DB connection
- else if(strcmpi(w1,"db_server_ip")==0){
- strcpy(db_server_ip, w2);
- printf ("set db_server_ip : %s\n",w2);
- }
- else if(strcmpi(w1,"db_server_port")==0){
- db_server_port=atoi(w2);
- printf ("set db_server_port : %s\n",w2);
- }
- else if(strcmpi(w1,"db_server_id")==0){
- strcpy(db_server_id, w2);
- printf ("set db_server_id : %s\n",w2);
- }
- else if(strcmpi(w1,"db_server_pw")==0){
- strcpy(db_server_pw, w2);
- printf ("set db_server_pw : %s\n",w2);
- }
- else if(strcmpi(w1,"db_server_logindb")==0){
- strcpy(db_server_logindb, w2);
- printf ("set db_server_logindb : %s\n",w2);
- //support the import command, just like any other config
- }else if(strcmpi(w1,"import")==0){
- inter_config_read(w2);
- }
- }
- fclose(fp);
-
- printf("Reading interserver configuration: Done\n");
-
- return 0;
-}
-
-int char_config_read(const char *cfgName) {
- int i;
- char line[1024], w1[1024], w2[1024];
- FILE *fp;
-
- printf ("Start reading char-server configuration: %s\n",cfgName);
-
- 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,"%[^:]:%s", w1, w2);
- if(i!=2)
- continue;
- if(strcmpi(w1,"char_txt")==0){
- printf ("set char_txt : %s\n",w2);
- strcpy(char_txt, w2);
- }
- }
- fclose(fp);
- printf("Reading configuration: Done\n");
-
- return 0;
-}
-
-int do_init(int argc, char **argv){
-
- char_config_read((argc>1)?argv[1]:CHAR_CONF_NAME);
- inter_config_read((argc>2)?argv[2]:INTER_CONF_NAME);
-
- mmo_char_init();
- printf ("Everything's been converted!\n");
- exit (0);
-}
-
-
diff --git a/src/txt-converter/char/char.h b/src/txt-converter/char/char.h
deleted file mode 100644
index e1d5c90dc..000000000
--- a/src/txt-converter/char/char.h
+++ /dev/null
@@ -1,39 +0,0 @@
-#include "../../common/core.h"
-#include "../../common/socket.h"
-#include "../../common/timer.h"
-#include "../common/mmo.h"
-#include "../common/inter.h"
-#include "../../common/version.h"
-#include "../../common/db.h"
-
-#ifndef _CHAR_H_
-#define _CHAR_H_
-
-#define MAX_MAP_SERVERS 30
-
-//#define CHAR_CONF_NAME "conf/char_athena.conf"
-
-#define UNKNOWN_CHAR_NAME "Unknown"
-
-#define DEFAULT_AUTOSAVE_INTERVAL 300*1000
-
-struct mmo_map_server{
- long ip;
- short port;
- int users;
- char map[MAX_MAP_PER_SERVER][16];
-};
-
-int mapif_sendall(char *buf,unsigned int len);
-int mapif_sendallwos(int fd,char *buf,unsigned int len);
-int mapif_send(int fd,char *buf,unsigned int len);
-
-extern int autosave_interval;
-
-#endif
-
-//#include "inter.h"
-#include "int_pet.h"
-#include "int_guild.h"
-#include "int_party.h"
-#include "int_storage.h"
diff --git a/src/txt-converter/char/int_guild.h b/src/txt-converter/char/int_guild.h
deleted file mode 100644
index 2ea85949a..000000000
--- a/src/txt-converter/char/int_guild.h
+++ /dev/null
@@ -1,10 +0,0 @@
-#ifndef _INT_GUILD_H_
-#define _INT_GUILD_H_
-
-int inter_guild_init();
-int inter_guild_save();
-int inter_guild_parse_frommap(int fd);
-
-extern char guild_txt[256];
-
-#endif
diff --git a/src/txt-converter/char/int_party.h b/src/txt-converter/char/int_party.h
deleted file mode 100644
index 036db1af9..000000000
--- a/src/txt-converter/char/int_party.h
+++ /dev/null
@@ -1,11 +0,0 @@
-#ifndef _INT_PARTY_H_
-#define _INT_PARTY_H_
-
-int inter_party_init();
-int inter_party_save();
-
-int inter_party_parse_frommap(int fd);
-
-extern char party_txt[256];
-
-#endif
diff --git a/src/txt-converter/char/int_pet.h b/src/txt-converter/char/int_pet.h
deleted file mode 100644
index 27ba4fc9d..000000000
--- a/src/txt-converter/char/int_pet.h
+++ /dev/null
@@ -1,12 +0,0 @@
-#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[256];
-
-#endif
diff --git a/src/txt-converter/char/int_storage.h b/src/txt-converter/char/int_storage.h
deleted file mode 100644
index 3572ae5de..000000000
--- a/src/txt-converter/char/int_storage.h
+++ /dev/null
@@ -1,11 +0,0 @@
-#ifndef _INT_STORAGE_H_
-#define _INT_STORAGE_H_
-
-int inter_storage_init();
-int inter_storage_save();
-
-int inter_storage_parse_frommap(int fd);
-
-//extern char storage_txt[256];
-
-#endif
diff --git a/src/txt-converter/common/inter.h b/src/txt-converter/common/inter.h
deleted file mode 100644
index 21c921d4a..000000000
--- a/src/txt-converter/common/inter.h
+++ /dev/null
@@ -1,28 +0,0 @@
-#ifndef _INTER_H_
-#define _INTER_H_
-
-int inter_init(const char *file);
-int inter_save();
-int inter_parse_frommap(int fd);
-
-int inter_check_length(int fd,int length);
-
-#define INTER_CONF_NAME "conf/inter_athena.conf"
-
-
-//add include for DBMS(mysql)
-#include <mysql.h>
-
-extern MYSQL mysql_handle;
-extern char tmp_sql[65535];
-extern MYSQL_RES* sql_res ;
-extern MYSQL_ROW sql_row ;
-extern int sql_cnt;
-
-extern int db_server_port;
-extern char db_server_ip[16];
-extern char db_server_id[32];
-extern char db_server_pw[32];
-extern char db_server_logindb[32];
-
-#endif
diff --git a/src/txt-converter/common/mmo.h b/src/txt-converter/common/mmo.h
deleted file mode 100644
index 28462e99d..000000000
--- a/src/txt-converter/common/mmo.h
+++ /dev/null
@@ -1,280 +0,0 @@
-// Original : mmo.h 2003/03/14 12:07:02 Rev.1.7
-
-#ifndef _MMO_H_
-#define _MMO_H_
-
-#include <time.h>
-
-#ifdef CYGWIN
-// txtlogȂǂ̏ot@C̉sR[h
-#define RETCODE "\r\n" // (CR/LFFWindowsn)
-#else
-#define RETCODE "\n" // (LFFUnixnj
-#endif
-
-#define FIFOSIZE_SERVERLINK 128*1024
-
-#define MAX_MAP_PER_SERVER 512
-#define MAX_INVENTORY 100
-#define MAX_AMOUNT 30000
-#define MAX_ZENY 1000000000 // 1G zeny
-#define MAX_CART 100
-#define MAX_SKILL 450
-#define GLOBAL_REG_NUM 96
-#define ACCOUNT_REG_NUM 16
-#define ACCOUNT_REG2_NUM 16
-#define DEFAULT_WALK_SPEED 150
-#define MIN_WALK_SPEED 0
-#define MAX_WALK_SPEED 1000
-#define MAX_STORAGE 300
-#define MAX_GUILD_STORAGE 1000
-#define MAX_PARTY 12
-#define MAX_GUILD 16+10*6 // increased max guild members to accomodate for +6 increase for extension levels [Lupus]
-#define MAX_GUILDPOSITION 20 // increased max guild positions to accomodate for all members [Valaris]
-#define MAX_GUILDEXPLUSION 32
-#define MAX_GUILDALLIANCE 16
-#define MAX_GUILDSKILL 15 // increased max guild skills because of new skills [Sara-chan]
-#define MAX_GUILDCASTLE 24 // increased to include novice castles [Valaris]
-#define MAX_GUILDLEVEL 50
-
-#define MIN_HAIR_STYLE 0
-#define MAX_HAIR_STYLE 20
-#define MIN_HAIR_COLOR 0
-#define MAX_HAIR_COLOR 9
-#define MIN_CLOTH_COLOR 0
-#define MAX_CLOTH_COLOR 4
-
-// for produce
-#define MIN_ATTRIBUTE 0
-#define MAX_ATTRIBUTE 4
-#define ATTRIBUTE_NORMAL 0
-#define MIN_STAR 0
-#define MAX_STAR 3
-
-#define MIN_PORTAL_MEMO 0
-#define MAX_PORTAL_MEMO 2
-
-#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 {
- int id;
- short nameid;
- short amount;
- unsigned short equip;
- char identify;
- char refine;
- char attribute;
- short card[4];
- short broken;
-};
-struct point{
- char map[24];
- short x,y;
-};
-struct skill {
- unsigned short id,lv,flag;
-};
-struct global_reg {
- char str[32];
- 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;
- int partner_id;
-
- int base_exp,job_exp,zeny;
-
- short class_;
- short status_point,skill_point;
- int hp,max_hp,sp,max_sp;
- short option,karma,manner;
- short hair,hair_color,clothes_color;
- int party_id,guild_id,pet_id;
-
- short weapon,shield;
- short head_top,head_mid,head_bottom;
-
- char name[24];
- unsigned char base_level,job_level;
- short str,agi,vit,int_,dex,luk;
- unsigned char char_num,sex;
-
- struct point last_point,save_point,memo_point[10];
- struct item inventory[MAX_INVENTORY],cart[MAX_CART];
- struct skill skill[MAX_SKILL];
- int global_reg_num;
- struct global_reg global_reg[GLOBAL_REG_NUM];
- int account_reg_num;
- struct global_reg account_reg[ACCOUNT_REG_NUM];
- int account_reg2_num;
- struct global_reg account_reg2[ACCOUNT_REG2_NUM];
-};
-
-struct storage {
- int account_id;
- short storage_status;
- short storage_amount;
- struct item storage_[MAX_STORAGE];
-};
-
-struct guild_storage {
- int guild_id;
- short storage_status;
- short storage_amount;
- struct item storage_[MAX_GUILD_STORAGE];
-};
-
-struct map_session_data;
-
-struct gm_account {
- int account_id;
- int level;
-};
-
-struct party_member {
- int account_id;
- char name[24],map[24];
- int leader,online,lv;
- struct map_session_data *sd;
-};
-struct party {
- int party_id;
- char name[24];
- int exp;
- int item;
- struct party_member member[MAX_PARTY];
-};
-
-struct guild_member {
- int account_id, char_id;
- short hair,hair_color,gender,class_,lv;
- int exp,exp_payper;
- short online,position;
- int rsv1,rsv2;
- char name[24];
- struct map_session_data *sd;
-};
-struct guild_position {
- char name[24];
- int mode;
- int exp_mode;
-};
-struct guild_alliance {
- int opposition;
- int guild_id;
- char name[24];
-};
-struct guild_explusion {
- char name[24];
- char mes[40];
- char acc[40];
- int account_id;
- int rsv1,rsv2,rsv3;
-};
-struct guild_skill {
- int id,lv;
-};
-struct guild {
- int guild_id;
- short guild_lv, connect_member, max_member, average_lv;
- int exp,next_exp,skill_point,castle_id;
- char name[24],master[24];
- struct guild_member member[MAX_GUILD];
- struct guild_position position[MAX_GUILDPOSITION];
- char mes1[60],mes2[120];
- int emblem_len,emblem_id;
- char emblem_data[2048];
- struct guild_alliance alliance[MAX_GUILDALLIANCE];
- struct guild_explusion explusion[MAX_GUILDEXPLUSION];
- struct guild_skill skill[MAX_GUILDSKILL];
-};
-struct guild_castle {
- int castle_id;
- char map_name[24];
- char castle_name[24];
- int guild_id;
- int economy;
- int defense;
- int triggerE;
- int triggerD;
- int nextTime;
- int payTime;
- int createTime;
- int visibleC;
- int visibleG0;
- int visibleG1;
- int visibleG2;
- int visibleG3;
- int visibleG4;
- int visibleG5;
- int visibleG6;
- int visibleG7;
- int Ghp0; // added Guardian HP [Valaris]
- int Ghp1;
- int Ghp2;
- int Ghp3;
- int Ghp4;
- int Ghp5;
- int Ghp6;
- int Ghp7;
- int GID0;
- int GID1;
- int GID2;
- int GID3;
- int GID4;
- int GID5;
- int GID6;
- int GID7; // end addition [Valaris]
-
-};
-struct square {
- int val1[5];
- int val2[5];
-};
-
-enum {
- GBI_EXP =1, // MhEXP
- GBI_GUILDLV =2, // MhLv
- GBI_SKILLPOINT =3, // Mh̃XL|Cg
- GBI_SKILLLV =4, // MhXLLv
-
- GMI_POSITION =0, // o[̖EύX
- GMI_EXP =1, // o[EXP
-
-};
-
-#ifndef strcmpi
-#define strcmpi strcasecmp
-#endif
-#ifndef stricmp
-#define stricmp strcasecmp
-#endif
-#ifndef strncmpi
-#define strncmpi strncasecmp
-#endif
-#ifndef strnicmp
-#define strnicmp strncasecmp
-#endif
-
-#endif // _MMO_H_
diff --git a/src/txt-converter/login/Makefile b/src/txt-converter/login/Makefile
deleted file mode 100644
index 7158931d0..000000000
--- a/src/txt-converter/login/Makefile
+++ /dev/null
@@ -1,12 +0,0 @@
-all: login-converter
-sql: login-converter
-
-COMMON_OBJ = ../../common/obj/core.o ../../common/obj/socket.o ../../common/obj/timer.o ../../common/obj/grfio.o ../../common/obj/db.o ../../common/obj/lock.o ../../common/obj/nullpo.o ../../common/obj/malloc.o ../../common/obj/showmsg.o ../../common/obj/strlib.o
-
-COMMON_H = ../../common/core.h ../../common/socket.h ../../common/timer.h ../../common/mmo.h ../../common/version.h ../../common/db.h ../../common/malloc.h ../../common/strlib.h
-
-login-converter: login-converter.o ../../login_sql/md5calc.o $(COMMON_OBJ)
- $(CC) -o ../../../$@ $^ $(LIB_S)
-login-converter.o: login-converter.c ../../login_sql/login.h ../../login_sql/md5calc.h $(COMMON_H)
-clean:
- rm -f *.o ../../../login-converter
diff --git a/src/txt-converter/login/login-converter.c b/src/txt-converter/login/login-converter.c
deleted file mode 100644
index d301e8db3..000000000
--- a/src/txt-converter/login/login-converter.c
+++ /dev/null
@@ -1,262 +0,0 @@
-// $Id: login-converter.c,v 1.1.1.1 2004/09/10 17:45:03 MagicalTux Exp $
-// original : login2.c 2003/01/28 02:29:17 Rev.1.1.1.1
-// login data file to mysql conversion utility.
-//
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <netinet/in.h>
-#include <sys/time.h>
-#include <time.h>
-#include <sys/ioctl.h>
-#include <unistd.h>
-#include <signal.h>
-#include <fcntl.h>
-#include <string.h>
-#include <arpa/inet.h>
-
-#include <mysql.h>
-
-#include "../../common/core.h"
-#include "../../common/socket.h"
-#include "../../login/login.h"
-#include "../../common/mmo.h"
-#include "../../common/version.h"
-#include "../../common/db.h"
-#include "../common/inter.h"
-
-int account_id_count = START_ACCOUNT_NUM;
-int server_num;
-int new_account_flag = 0;
-int login_port = 6900;
-
-struct mmo_char_server server[MAX_SERVERS];
-int server_fd[MAX_SERVERS];
-
-#define AUTH_FIFO_SIZE 256
-struct {
- int account_id,login_id1,login_id2;
- int sex,delflag;
-} auth_fifo[AUTH_FIFO_SIZE];
-int auth_fifo_pos=0;
-struct auth_dat_ {
- int account_id, sex;
- char userid[24], pass[24], lastlogin[24];
- int logincount;
- int state; // packet 0x006a value + 1 (0: compte OK)
- char email[40]; // e-mail (by default: a@a.com)
- char error_message[20]; // Message of error code #6 = You are Prohibited to log in until %s (packet 0x006a)
- time_t ban_until_time; // # of seconds 1/1/1970 (timestamp): ban time limit of the account (0 = no ban)
- time_t connect_until_time; // # of seconds 1/1/1970 (timestamp): Validity limit of the account (0 = unlimited)
- char last_ip[16]; // save of last IP of connection
- char memo[255]; // a memo field
- int account_reg2_num;
- struct global_reg account_reg2[ACCOUNT_REG2_NUM];
-} *auth_dat;
-int auth_num=0,auth_max=0;
-
-char login_account_id[256]="account_id";
-char login_userid[256]="userid";
-char login_user_pass[256]="user_pass";
-char login_db[256]="login";
-
-static struct dbt *gm_account_db;
-
-int db_server_port = 3306;
-char db_server_ip[16] = "127.0.0.1";
-char db_server_id[32] = "ragnarok";
-char db_server_pw[32] = "ragnarok";
-char db_server_logindb[32] = "ragnarok";
-
-int isGM(int account_id)
-{
- struct gm_account *p;
- p = (struct gm_account*)numdb_search(gm_account_db,account_id);
- if( p == NULL)
- return 0;
- return p->level;
-}
-
-int read_gm_account()
-{
- char line[8192];
- struct gm_account *p;
- FILE *fp;
- int c=0;
-
- gm_account_db = numdb_init();
-
- printf("Starting reading gm_account\n");
-
- if( (fp=fopen("conf/GM_account.txt","r"))==NULL )
- return 1;
- while(fgets(line,sizeof(line),fp)){
- if(line[0] == '/' || line[1] == '/' || line[2] == '/')
- continue;
-
- p = (struct gm_account*)malloc(sizeof(struct gm_account));
- if(p==NULL){
- printf("gm_account: out of memory!\n");
- exit(0);
- }
-
- if(sscanf(line,"%d %d",&p->account_id,&p->level) != 2 || p->level <= 0) {
- printf("gm_account: broken data [conf/GM_account.txt] line %d\n",c);
- continue;
- }
- else {
- if(p->level > 99)
- p->level = 99;
- numdb_insert(gm_account_db,p->account_id,p);
- c++;
- printf("GM ID: %d Level: %d\n",p->account_id,p->level);
- }
- }
- fclose(fp);
- printf("%d ID of gm_accounts read.\n",c);
- return 0;
-}
-
-int mmo_auth_init(void)
-{
- MYSQL mysql_handle;
- char tmpsql[1024];
- MYSQL_RES* sql_res ;
- MYSQL_ROW sql_row ;
- FILE *fp;
- int account_id, logincount, user_level, state, n, i;
- char line[2048], userid[2048], pass[2048], lastlogin[2048], sex, email[2048], error_message[2048], last_ip[2048], memo[2048];
- time_t ban_until_time;
- time_t connect_until_time;
- char t_uid[256];
-
- mysql_init(&mysql_handle);
- if(!mysql_real_connect(&mysql_handle, db_server_ip, db_server_id, db_server_pw,
- db_server_logindb ,db_server_port, (char *)NULL, 0)) {
- //pointer check
- printf("%s\n",mysql_error(&mysql_handle));
- exit(1);
- }
- else {
- printf ("Connect: Success!\n");
- }
- printf ("Convert start...\n");
-
-
- fp=fopen("save/account.txt","r");
- auth_dat = (struct auth_dat_*)malloc(sizeof(auth_dat[0])*256);
- auth_max=256;
- if(fp==NULL)
- return 0;
- while(fgets(line,1023,fp)!=NULL){
-
- if(line[0]=='/' && line[1]=='/')
- continue;
-
- i = sscanf(line, "%d\t%[^\t]\t%[^\t]\t%[^\t]\t%c\t%d\t%d\t"
- "%[^\t]\t%[^\t]\t%ld\t%[^\t]\t%[^\t]\t%ld%n",
- &account_id, userid, pass, lastlogin, &sex, &logincount, &state,
- email, error_message, &connect_until_time, last_ip, memo, &ban_until_time, &n);
-
- sprintf(tmpsql, "SELECT `%s`,`%s`,`%s`,`lastlogin`,`logincount`,`sex`,`connect_until`,`last_ip`,`ban_until`,`state`"
- " FROM `%s` WHERE `%s`='%s'", login_account_id, login_userid, login_user_pass, login_db, login_userid, t_uid);
-
- if(mysql_query(&mysql_handle, tmpsql) ) {
- printf("DB server Error - %s\n", mysql_error(&mysql_handle) );
- }
- user_level = isGM(account_id);
- printf ("userlevel: %s (%d)- %d\n",userid, account_id, user_level);
- sql_res = mysql_store_result(&mysql_handle) ;
- sql_row = mysql_fetch_row(sql_res); //row fetching
- if (!sql_row) //no row -> insert
- sprintf(tmpsql, "INSERT INTO `login` (`account_id`, `userid`, `user_pass`, `lastlogin`, `sex`, `logincount`, `email`, `level`) VALUES (%d, '%s', '%s', '%s', '%c', %d, 'user@athena', %d);",account_id , userid, pass,lastlogin,sex,logincount, user_level);
- else //row reside -> updating
- sprintf(tmpsql, "UPDATE `login` SET `account_id`='%d', `userid`='%s', `user_pass`='%s', `lastlogin`='%s', `sex`='%c', `logincount`='%d', `email`='user@athena', `level`='%d'\nWHERE `account_id`='%d';",account_id , userid, pass,lastlogin,sex,logincount, user_level, account_id);
- printf ("Query: %s\n",tmpsql);
- mysql_free_result(sql_res) ; //resource free
- if(mysql_query(&mysql_handle, tmpsql) ) {
- printf("DB server Error - %s\n", mysql_error(&mysql_handle) );
- }
- }
- fclose(fp);
-
- printf ("onvert end...\n");
-
- return 0;
-}
-
-// AJEgf??x?X̏
-void nowork(void)
-{
- //null
-}
-
-int login_config_read(const char *cfgName){
- int i;
- char line[1024], w1[1024], w2[1024];
- FILE *fp;
-
- printf ("Start reading interserver configuration: %s\n",cfgName);
-
- 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,"%[^:]:%s", w1, w2);
- if(i!=2)
- continue;
-
- //add for DB connection
- if(strcmpi(w1,"db_server_ip")==0){
- strcpy(db_server_ip, w2);
- printf ("set db_server_ip : %s\n",w2);
- }
- else if(strcmpi(w1,"db_server_port")==0){
- db_server_port=atoi(w2);
- printf ("set db_server_port : %s\n",w2);
- }
- else if(strcmpi(w1,"db_server_id")==0){
- strcpy(db_server_id, w2);
- printf ("set db_server_id : %s\n",w2);
- }
- else if(strcmpi(w1,"db_server_pw")==0){
- strcpy(db_server_pw, w2);
- printf ("set db_server_pw : %s\n",w2);
- }
- else if(strcmpi(w1,"db_server_logindb")==0){
- strcpy(db_server_logindb, w2);
- printf ("set db_server_logindb : %s\n",w2);
- }
- //support the import command, just like any other config
- else if(strcmpi(w1,"import")==0){
- login_config_read(w2);
- }
- }
- fclose(fp);
- printf ("End reading interserver configuration...\n");
- return 0;
-}
-
-int do_init(int argc,char **argv)
-{
- char input;
- login_config_read( (argc>1)?argv[1]:INTER_CONF_NAME );
- read_gm_account();
-
- printf("\nWarning : Make sure you backup your databases before continuing!\n");
- printf("\nDo you wish to convert your Login Database to SQL? (y/n) : ");
- input=getchar();
- if(input == 'y' || input == 'Y')
- mmo_auth_init();
- printf ("Everything's been converted!\n");
- exit (0);
-}
-
-