summaryrefslogtreecommitdiff
path: root/src/map
diff options
context:
space:
mode:
authorJared Adams <jaxad0127@gmail.com>2009-03-08 15:18:32 -0600
committerJared Adams <jaxad0127@gmail.com>2009-03-08 15:18:32 -0600
commitc8da743b969b251bab107125d4af82ec7f4e376c (patch)
tree6d499634d8dcd49d80ae869cb28cca58893b1160 /src/map
parent23c6c0e2c8b10bbecf1e673723914618170ac551 (diff)
downloadtmwa-c8da743b969b251bab107125d4af82ec7f4e376c.tar.gz
tmwa-c8da743b969b251bab107125d4af82ec7f4e376c.tar.bz2
tmwa-c8da743b969b251bab107125d4af82ec7f4e376c.tar.xz
tmwa-c8da743b969b251bab107125d4af82ec7f4e376c.zip
Strip some more out
Diffstat (limited to 'src/map')
-rw-r--r--src/map/Makefile2
-rw-r--r--src/map/atcommand.c157
-rw-r--r--src/map/battle.c16
-rw-r--r--src/map/battle.h4
-rw-r--r--src/map/chrif.c8
-rw-r--r--src/map/itemdb.c201
-rw-r--r--src/map/map.c274
-rw-r--r--src/map/map.h43
-rw-r--r--src/map/mob.c151
-rw-r--r--src/map/pc.c39
10 files changed, 9 insertions, 886 deletions
diff --git a/src/map/Makefile b/src/map/Makefile
index effb407..0201e59 100644
--- a/src/map/Makefile
+++ b/src/map/Makefile
@@ -15,7 +15,7 @@ map-server: obj/magic-interpreter-lexer.o obj/magic-interpreter-parser.o obj/mag
$(CC) -o ../../$@ $> $(LIBS)
obj/%.o: %.c
- $(COMPILE.c) -DTXT_ONLY $(OUTPUT_OPTION) $<
+ $(COMPILE.c) $(OUTPUT_OPTION) $<
magic-interpreter-lexer.c: magic-interpreter.l
$(LEX) -o magic-interpreter-lexer.c magic-interpreter.l
diff --git a/src/map/atcommand.c b/src/map/atcommand.c
index cf26775..9dab48f 100644
--- a/src/map/atcommand.c
+++ b/src/map/atcommand.c
@@ -32,10 +32,6 @@
#include "core.h"
-#ifndef TXT_ONLY
-#include "mail.h"
-#endif
-
#define STATE_BLIND 0x10
static char command_symbol = '@'; // first char of the commands (by [Yor])
@@ -333,11 +329,7 @@ static AtCommandInfo atcommand_info[] = {
{ AtCommand_ReloadItemDB, "@reloaditemdb", 99, atcommand_reloaditemdb }, // admin command
{ AtCommand_ReloadMobDB, "@reloadmobdb", 99, atcommand_reloadmobdb }, // admin command
{ AtCommand_ReloadSkillDB, "@reloadskilldb", 99, atcommand_reloadskilldb }, // admin command
-#ifndef TXT_ONLY
- { AtCommand_Rehash, "@rehash", 99, atcommand_rehash }, // admin command
-#else /* TXT_ONLY */
{ AtCommand_ReloadScript, "@reloadscript", 99, atcommand_reloadscript }, // admin command
-#endif /* TXT_ONLY */
{ AtCommand_ReloadGMDB, "@reloadgmdb", 99, atcommand_reloadgmdb }, // admin command
{ AtCommand_CharReset, "@charreset", 60, atcommand_charreset },
{ AtCommand_CharModel, "@charmodel", 50, atcommand_charmodel },
@@ -441,17 +433,6 @@ static AtCommandInfo atcommand_info[] = {
{ AtCommand_IterateForward, "@hugo", 60, atcommand_iterate_forward_over_players }, // [Fate]
{ AtCommand_IterateBackward, "@linus", 60, atcommand_iterate_backwards_over_players }, // [Fate]
-#ifndef TXT_ONLY // sql-only commands
- { AtCommand_CheckMail, "@checkmail", 1, atcommand_listmail }, // [Valaris]
- { AtCommand_ListMail, "@listmail", 1, atcommand_listmail }, // [Valaris]
- { AtCommand_ListNewMail, "@listnewmail", 1, atcommand_listmail }, // [Valaris]
- { AtCommand_ReadMail, "@readmail", 1, atcommand_readmail }, // [Valaris]
- { AtCommand_DeleteMail, "@deletemail", 1, atcommand_readmail }, // [Valaris]
- { AtCommand_SendMail, "@sendmail", 1, atcommand_sendmail }, // [Valaris]
- { AtCommand_SendPriorityMail, "@sendprioritymail",80, atcommand_sendmail }, // [Valaris]
- { AtCommand_RefreshOnline, "@refreshonline", 99, atcommand_refreshonline }, // [Valaris]
-#endif /* TXT_ONLY */
-
// add new commands before this line
{ AtCommand_Unknown, NULL, 1, NULL }
};
@@ -775,37 +756,6 @@ static int atkillmonster_sub(struct block_list *bl, va_list ap) {
return 0;
}
-#ifndef TXT_ONLY
-static int atkillnpc_sub(struct block_list *bl, va_list ap)
-{
- int flag = va_arg(ap,int);
-
- nullpo_retr(0, bl);
-
- npc_delete((struct npc_data *)bl);
-
- flag = 0;
-
- return 0;
-}
-
-void rehash( const int fd, struct map_session_data* sd )
-{
- int map_id = 0;
-
- int LOADED_MAPS = map_num;
-
- for (map_id = 0; map_id < LOADED_MAPS;map_id++) {
-
- if (map_id > LOADED_MAPS)
- break;
-
- map_foreachinarea(atkillmonster_sub, map_id, 0, 0, map[map_id].xs, map[map_id].ys, BL_MOB, 0);
- map_foreachinarea(atkillnpc_sub, map_id, 0, 0, map[map_id].xs, map[map_id].ys, BL_NPC, 0);
- }
-}
-
-#endif /* not TXT_ONLY */
/*==========================================
* Read Message Data
*------------------------------------------
@@ -5270,22 +5220,10 @@ int atcommand_reloadskilldb(
*
*------------------------------------------
*/
-#ifndef TXT_ONLY
-int atcommand_rehash(
-#else /* TXT_ONLY */
int atcommand_reloadscript(
-#endif /* TXT_ONLY */
const int fd, struct map_session_data* sd,
const char* command, const char* message)
{
-#ifndef TXT_ONLY
- atcommand_broadcast( fd, sd, "@broadcast", "eAthena SQL Server is Rehashing..." );
- atcommand_broadcast( fd, sd, "@broadcast", "You will feel a bit of lag at this point !" );
-
- rehash( fd, sd );
-
- atcommand_broadcast( fd, sd, "@broadcast", "Reloading NPCs..." );
-#endif /* not TXT_ONLY */
do_init_npc();
do_init_script();
@@ -7414,101 +7352,6 @@ int atcommand_unmute(
return 0;
}
-#ifndef TXT_ONLY /* Begin SQL-Only commands */
-
-/*==========================================
- * Mail System commands by [Valaris]
- *------------------------------------------
- */
-int atcommand_listmail(
- const int fd, struct map_session_data* sd,
- const char* command, const char* message)
-{
- if(!battle_config.mail_system)
- return 0;
-
- nullpo_retr(-1, sd);
-
- if(strlen(command)==12)
- mail_check(sd,3);
- else if(strlen(command)==9)
- mail_check(sd,2);
- else
- mail_check(sd,1);
- return 0;
-}
-
-int atcommand_readmail(
- const int fd, struct map_session_data* sd,
- const char* command, const char* message)
-{
- if(!battle_config.mail_system)
- return 0;
-
- nullpo_retr(-1, sd);
-
- if (!message || !*message) {
- clif_displaymessage(sd->fd,"You must specify a message number.");
- return 0;
- }
-
- if(strlen(command)==11)
- mail_delete(sd,atoi(message));
- else
- mail_read(sd,atoi(message));
-
- return 0;
-}
-
-int atcommand_sendmail(
- const int fd, struct map_session_data* sd,
- const char* command, const char* message)
-{
- if(!battle_config.mail_system)
- return 0;
-
- char name[24],text[80];
-
- nullpo_retr(-1, sd);
-
- if (!message || !*message) {
- clif_displaymessage(sd->fd,"You must specify a recipient and a message.");
- return 0;
- }
-
- if ((sscanf(message, "\"%[^\"]\" %79[^\n]", name, text) < 2) &&
- (sscanf(message, "%23s %79[^\n]", name, text) < 2)) {
- clif_displaymessage(sd->fd,"You must specify a recipient and a message.");
- return 0;
- }
-
- if(strlen(command)==17)
- mail_send(sd,name,text,1);
- else
- mail_send(sd,name,text,0);
-
- return 0;
-}
-
-/*==========================================
- * Refresh online command for SQL [Valaris]
- * Will refresh and check online column of
- * players and set correctly.
- *------------------------------------------
- */
-int atcommand_refreshonline(
- const int fd, struct map_session_data* sd,
- const char* command, const char* message)
-{
- nullpo_retr(-1, sd);
-
- char_online_check();
-
- return 0;
-}
-
-#endif /* end sql only */
-
/* Magic atcommands by Fate */
static int magic_base = TMW_MAGIC;
diff --git a/src/map/battle.c b/src/map/battle.c
index 40306b7..7d88413 100644
--- a/src/map/battle.c
+++ b/src/map/battle.c
@@ -4517,14 +4517,7 @@ int battle_config_read(const char *cfgName)
battle_config.spam_time = 3000;
battle_config.spam_threshold = 10;
battle_config.chat_maxline = 255;
-
-//SQL-only options start
-#ifndef TXT_ONLY
- battle_config.mail_system = 0;
-//SQL-only options end
-#endif
-
-}
+ }
fp = fopen(cfgName,"r");
if (fp == NULL) {
@@ -4730,12 +4723,7 @@ int battle_config_read(const char *cfgName)
{ "spam_ban", &battle_config.spam_ban },
{ "spam_time", &battle_config.spam_time },
{ "spam_threshold", &battle_config.spam_threshold },
- { "chat_maxline", &battle_config.chat_maxline },
-//SQL-only options start
-#ifndef TXT_ONLY
- { "mail_system", &battle_config.mail_system }, // added by [Valaris]
-//SQL-only options end
-#endif
+ { "chat_maxline", &battle_config.chat_maxline }
};
if (line[0] == '/' && line[1] == '/')
diff --git a/src/map/battle.h b/src/map/battle.h
index 27b837b..65abac4 100644
--- a/src/map/battle.h
+++ b/src/map/battle.h
@@ -320,10 +320,6 @@ extern struct Battle_Config {
int drop_pickup_safety_zone; // [Fate] Max. distance to an object dropped by a kill by self in which dropsteal protection works
-#ifndef TXT_ONLY /* SQL-only options */
- int mail_system; // [Valaris]
-#endif
-
int itemheal_regeneration_factor; // [Fate] itemheal speed factor
} battle_config;
diff --git a/src/map/chrif.c b/src/map/chrif.c
index 228d061..4f8edf6 100644
--- a/src/map/chrif.c
+++ b/src/map/chrif.c
@@ -985,14 +985,6 @@ int check_connect_char_server(int tid, unsigned int tick, int id, int data) {
realloc_fifo(char_fd, FIFOSIZE_SERVERLINK, FIFOSIZE_SERVERLINK);
chrif_connect(char_fd);
-#ifndef TXT_ONLY
- srvinfo = 0;
- } else {
- if (srvinfo == 0) {
- chrif_ragsrvinfo(battle_config.base_exp_rate, battle_config.job_exp_rate, battle_config.item_rate_common);
- srvinfo = 1;
- }
-#endif /* not TXT_ONLY */
}
return 0;
diff --git a/src/map/itemdb.c b/src/map/itemdb.c
index 7b3f157..499b776 100644
--- a/src/map/itemdb.c
+++ b/src/map/itemdb.c
@@ -33,9 +33,6 @@ static int blue_box_default=0,violet_box_default=0,card_album_default=0,gift_box
static void itemdb_read(void);
static int itemdb_readdb(void);
-#ifndef TXT_ONLY
-static int itemdb_read_sqldb(void);
-#endif /* not TXT_ONLY */
static int itemdb_read_randomitem();
static int itemdb_read_itemavail(void);
static int itemdb_read_itemnametable(void);
@@ -266,33 +263,6 @@ static int itemdb_read_itemslottable(void)
return 0;
}
-#ifndef TXT_ONLY
-/*====================================
- * Removed item_value_db, don't re-add
- *------------------------------------
- */
-static void itemdb_read(void)
-{
- itemdb_read_itemslottable();
-
- if (db_use_sqldbs)
- {
- itemdb_read_sqldb();
- }
- else
- {
- itemdb_readdb();
- }
-
- itemdb_read_randomitem();
- itemdb_read_itemavail();
- itemdb_read_noequip();
-
- if (!battle_config.item_name_override_grffile)
- itemdb_read_itemnametable();
-}
-
-#endif /* not TXT_ONLY */
/*==========================================
* アイテムデータベースの読み込み
*------------------------------------------
@@ -551,7 +521,7 @@ static int itemdb_read_itemnametable(void)
return 0;
}
-#ifdef TXT_ONLY
+
/*==========================================
* カードイラストのリソース名前テーブルを読み込む
*------------------------------------------
@@ -586,7 +556,7 @@ static int itemdb_read_cardillustnametable(void)
return 0;
}
-#endif /* TXT_ONLY */
+
/*==========================================
* 装備制限ファイル読み出し
*------------------------------------------
@@ -629,170 +599,7 @@ static int itemdb_read_noequip(void)
printf("read db/item_noequip.txt done (count=%d)\n",ln);
return 0;
}
-#ifndef TXT_ONLY
-
-/*======================================
-* SQL
-*===================================
-*/
-static int itemdb_read_sqldb(void)
-{
- unsigned short nameid;
- struct item_data *id;
- char script[65535 + 2 + 1]; // Maximum length of MySQL TEXT type (65535) + 2 bytes for curly brackets + 1 byte for terminator
-
- // ----------
-
- sprintf(tmp_sql, "SELECT * FROM `%s`", item_db_db);
-
- // Execute the query; if the query execution succeeded...
- if (mysql_query(&mmysql_handle, tmp_sql) == 0)
- {
- sql_res = mysql_store_result(&mmysql_handle);
-
- // If the storage of the query result succeeded...
- if (sql_res)
- {
- // Parse each row in the query result into sql_row
- while ((sql_row = mysql_fetch_row(sql_res)))
- {
- /* +----+--------------+---------------+------+-----------+------------+--------+--------+---------+-------+-------+------------+---------------+-----------------+--------------+-------------+------+------------+--------------+
- | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 |
- +----+--------------+---------------+------+-----------+------------+--------+--------+---------+-------+-------+------------+---------------+-----------------+--------------+-------------+------+------------+--------------+
- | id | name_english | name_japanese | type | price_buy | price_sell | weight | attack | defence | range | slots | equip_jobs | equip_genders | equip_locations | weapon_level | equip_level | view | script_use | script_equip |
- +----+--------------+---------------+------+-----------+------------+--------+--------+---------+-------+-------+------------+---------------+-----------------+--------------+-------------+------+------------+--------------+ */
-
- nameid = atoi(sql_row[0]);
-
- // If the identifier is not within the valid range, process the next row
- if (nameid == 0 || nameid >= 20000)
- {
- continue;
- }
-
- // Insert a new row into the item database
-
- /*id = calloc(sizeof(struct item_data), 1);
-
- if (id == NULL)
- {
- printf("out of memory : itemdb_read_sqldb\n");
- exit(1);
- }
-
- memset(id, 0, sizeof(struct item_data));
- numdb_insert(item_db, (int) nameid, id);*/
-
- // ----------
- id=itemdb_search(nameid);
-
- memcpy(id->name, sql_row[1], 25);
- memcpy(id->jname, sql_row[2], 25);
-
- id->type = atoi(sql_row[3]);
-
- // If price_buy is not NULL and price_sell is not NULL...
- if ((sql_row[4] != NULL) && (sql_row[5] != NULL))
- {
- id->value_buy = atoi(sql_row[4]);
- id->value_sell = atoi(sql_row[5]);
- }
- // If price_buy is not NULL and price_sell is NULL...
- else if ((sql_row[4] != NULL) && (sql_row[5] == NULL))
- {
- id->value_buy = atoi(sql_row[4]);
- id->value_sell = atoi(sql_row[4]) / 2;
- }
- // If price_buy is NULL and price_sell is not NULL...
- else if ((sql_row[4] == NULL) && (sql_row[5] != NULL))
- {
- id->value_buy = atoi(sql_row[5]) * 2;
- id->value_sell = atoi(sql_row[5]);
- }
- // If price_buy is NULL and price_sell is NULL...
- if ((sql_row[4] == NULL) && (sql_row[5] == NULL))
- {
- id->value_buy = 0;
- id->value_sell = 0;
- }
-
- id->weight = atoi(sql_row[6]);
-
- id->atk = (sql_row[7] != NULL) ? atoi(sql_row[7]) : 0;
- id->def = (sql_row[8] != NULL) ? atoi(sql_row[8]) : 0;
- id->range = (sql_row[9] != NULL) ? atoi(sql_row[9]) : 0;
- id->slot = (sql_row[10] != NULL) ? atoi(sql_row[10]) : 0;
- id->class = (sql_row[11] != NULL) ? atoi(sql_row[11]) : 0;
- id->sex = (sql_row[12] != NULL) ? atoi(sql_row[12]) : 0;
- id->equip = (sql_row[13] != NULL) ? atoi(sql_row[13]) : 0;
- id->wlv = (sql_row[14] != NULL) ? atoi(sql_row[14]) : 0;
- id->elv = (sql_row[15] != NULL) ? atoi(sql_row[15]) : 0;
- id->look = (sql_row[16] != NULL) ? atoi(sql_row[16]) : 0;
-
- id->view_id = 0;
-
- // ----------
-
- if (sql_row[17] != NULL)
- {
- if (sql_row[17][0] == '{')
- id->use_script = parse_script(sql_row[17], 0);
- else {
- sprintf(script, "{%s}", sql_row[17]);
- id->use_script = parse_script(script, 0);
- }
- }
- else
- {
- id->use_script = NULL;
- }
-
- if (sql_row[18] != NULL)
- {
- if (sql_row[18][0] == '{')
- id->equip_script = parse_script(sql_row[18], 0);
- else {
- sprintf(script, "{%s}", sql_row[18]);
- id->equip_script = parse_script(script, 0);
- }
- }
- else
- {
- id->equip_script = NULL;
- }
-
- // ----------
-
- id->flag.available = 1;
- id->flag.value_notdc = 0;
- id->flag.value_notoc = 0;
- }
-
- // If the retrieval failed, output an error
- if (mysql_errno(&mmysql_handle))
- {
- printf("Database server error (retrieving rows from %s): %s\n", item_db_db, mysql_error(&mmysql_handle));
- }
-
- printf("read %s done (count = %lu)\n", item_db_db, (unsigned long) mysql_num_rows(sql_res));
- }
- else
- {
- printf("MySQL error (storing query result for %s): %s\n", item_db_db, mysql_error(&mmysql_handle));
- }
-
- // Free the query result
- mysql_free_result(sql_res);
- }
- else
- {
- printf("Database server error (executing query for %s): %s\n", item_db_db, mysql_error(&mmysql_handle));
- }
-
- return 0;
-}
-#endif /* not TXT_ONLY */
/*==========================================
*
*------------------------------------------
@@ -850,7 +657,7 @@ void itemdebugtxt()
fclose(dfp);
}
*/
-#ifdef TXT_ONLY
+
/*====================================
* Removed item_value_db, don't re-add
*------------------------------------
@@ -866,7 +673,7 @@ static void itemdb_read(void)
if (!battle_config.item_name_override_grffile)
itemdb_read_itemnametable();
}
-#endif /* TXT_ONLY */
+
/*==========================================
*
*------------------------------------------
diff --git a/src/map/map.c b/src/map/map.c
index a9120f0..128d50b 100644
--- a/src/map/map.c
+++ b/src/map/map.c
@@ -40,55 +40,6 @@
#include "memwatch.h"
#endif
-#ifndef TXT_ONLY
-
-#include "mail.h" // mail system [Valaris]
-
-MYSQL mmysql_handle;
-MYSQL_RES* sql_res ;
-MYSQL_ROW sql_row ;
-char tmp_sql[65535]="";
-
-MYSQL lmysql_handle;
-MYSQL_RES* lsql_res ;
-MYSQL_ROW lsql_row ;
-char tmp_lsql[65535]="";
-
-MYSQL mail_handle; // mail system [Valaris]
-MYSQL_RES* mail_res ;
-MYSQL_ROW mail_row ;
-char tmp_msql[65535]="";
-
-int map_server_port = 3306;
-char map_server_ip[16] = "127.0.0.1";
-char map_server_id[32] = "ragnarok";
-char map_server_pw[32] = "ragnarok";
-char map_server_db[32] = "ragnarok";
-int db_use_sqldbs = 0;
-
-int login_server_port = 3306;
-char login_server_ip[16] = "127.0.0.1";
-char login_server_id[32] = "ragnarok";
-char login_server_pw[32] = "ragnarok";
-char login_server_db[32] = "ragnarok";
-
-char item_db_db[32] = "item_db";
-char mob_db_db[32] = "mob_db";
-char login_db[32] = "login";
-char login_db_level[32] = "level";
-char login_db_account_id[32] = "account_id";
-
-int lowest_gm_level = 1;
-int read_gm_interval = 600000;
-
-char char_db[32] = "char";
-
-static int online_timer(int,unsigned int,int,int);
-
-int CHECK_INTERVAL = 3600000; // [Valaris]
-int check_online_timer=0; // [Valaris]
-
-#endif /* not TXT_ONLY */
// 極力 staticでローカルに収める
static struct dbt * id_db=NULL;
static struct dbt * map_db=NULL;
@@ -1075,10 +1026,6 @@ int map_quit(struct map_session_data *sd) {
map_delblock(&sd->bl);
-#ifndef TXT_ONLY
- chrif_char_offline(sd);
-#endif
-
numdb_erase(id_db,sd->bl.id);
strdb_erase(nick_db,sd->status.name);
numdb_erase(charid_db,sd->status.char_id);
@@ -1781,200 +1728,6 @@ int map_config_read(char *cfgName) {
return 0;
}
-#ifndef TXT_ONLY
-/*=======================================
- * MySQL Init
- *---------------------------------------
- */
-
-int map_sql_init(void){
-
- mysql_init(&mmysql_handle);
-
- //DB connection start
- printf("Connect Map DB Server....\n");
- if(!mysql_real_connect(&mmysql_handle, map_server_ip, map_server_id, map_server_pw,
- map_server_db ,map_server_port, (char *)NULL, 0)) {
- //pointer check
- printf("%s\n",mysql_error(&mmysql_handle));
- exit(1);
- }
- else {
- printf ("connect success! (Map Server Connection)\n");
- }
-
- mysql_init(&lmysql_handle);
-
- //DB connection start
- printf("Connect Login DB Server....\n");
- if(!mysql_real_connect(&lmysql_handle, login_server_ip, login_server_id, login_server_pw,
- login_server_db ,login_server_port, (char *)NULL, 0)) {
- //pointer check
- printf("%s\n",mysql_error(&lmysql_handle));
- exit(1);
- }
- else {
- printf ("connect success! (Login Server Connection)\n");
- }
-
- if(battle_config.mail_system) { // mail system [Valaris]
- mysql_init(&mail_handle);
- if(!mysql_real_connect(&mail_handle, map_server_ip, map_server_id, map_server_pw,
- map_server_db ,map_server_port, (char *)NULL, 0)) {
- printf("%s\n",mysql_error(&mail_handle));
- exit(1);
- }
- }
-
- return 0;
-}
-
-int map_sql_close(void){
- mysql_close(&mmysql_handle);
- printf("Close Map DB Connection....\n");
-
- mysql_close(&lmysql_handle);
- printf("Close Login DB Connection....\n");
- return 0;
-}
-
-int sql_config_read(char *cfgName)
-{
- int i;
- char line[1024],w1[1024],w2[1024];
- FILE *fp;
-
- fp=fopen(cfgName,"r");
- if(fp==NULL){
- printf("file not found: %s\n",cfgName);
- return 1;
- }
- while(fgets(line,1020,fp)){
- if(line[0] == '/' && line[1] == '/')
- continue;
- i=sscanf(line,"%[^:]: %[^\r\n]",w1,w2);
- if(i!=2)
- continue;
- if(strcmpi(w1,"item_db_db")==0){
- strcpy(item_db_db,w2);
- } else if(strcmpi(w1,"mob_db_db")==0){
- strcpy(mob_db_db,w2);
- } else if(strcmpi(w1,"login_db_level")==0){
- strcpy(login_db_level,w2);
- } else if(strcmpi(w1,"login_db_account_id")==0){
- strcpy(login_db_account_id,w2);
- } else if(strcmpi(w1,"login_db")==0){
- strcpy(login_db,w2);
- } else if (strcmpi(w1, "char_db") == 0) {
- strcpy(char_db, w2);
- //Map Server SQL DB
- } else if(strcmpi(w1,"map_server_ip")==0){
- strcpy(map_server_ip, w2);
- printf ("set map_server_ip : %s\n",w2);
- } else if(strcmpi(w1,"map_server_port")==0){
- map_server_port=atoi(w2);
- printf ("set map_server_port : %s\n",w2);
- } else if(strcmpi(w1,"map_server_id")==0){
- strcpy(map_server_id, w2);
- printf ("set map_server_id : %s\n",w2);
- } else if(strcmpi(w1,"map_server_pw")==0){
- strcpy(map_server_pw, w2);
- printf ("set map_server_pw : %s\n",w2);
- } else if(strcmpi(w1,"map_server_db")==0){
- strcpy(map_server_db, w2);
- printf ("set map_server_db : %s\n",w2);
- //Map server option to use SQL db or not
- } else if(strcmpi(w1,"use_sql_db")==0){
- if (strcmpi(w2,"yes")){db_use_sqldbs=0;} else if (strcmpi(w2,"no")){db_use_sqldbs=1;}
- printf ("Using SQL dbs: %s\n",w2);
- //Login Server SQL DB
- } else if(strcmpi(w1,"login_server_ip")==0){
- strcpy(login_server_ip, w2);
- printf ("set login_server_ip : %s\n",w2);
- } else if(strcmpi(w1,"login_server_port")==0){
- login_server_port = atoi(w2);
- printf ("set login_server_port : %s\n",w2);
- } else if(strcmpi(w1,"login_server_id")==0){
- strcpy(login_server_id, w2);
- printf ("set login_server_id : %s\n",w2);
- } else if(strcmpi(w1,"login_server_pw")==0){
- strcpy(login_server_pw, w2);
- printf ("set login_server_pw : %s\n",w2);
- } else if(strcmpi(w1,"login_server_db")==0){
- strcpy(login_server_db, w2);
- printf ("set login_server_db : %s\n",w2);
- } else if(strcmpi(w1,"lowest_gm_level")==0){
- lowest_gm_level = atoi(w2);
- printf ("set lowest_gm_level : %s\n",w2);
- } else if(strcmpi(w1,"read_gm_interval")==0){
- read_gm_interval = ( atoi(w2) * 60 * 1000 ); // Minutes multiplied by 60 secs per min by 1000 milliseconds per second
- printf ("set read_gm_interval : %s\n",w2);
- }
- }
- fclose(fp);
-
- return 0;
-}
-
-// sql online status checking [Valaris]
-void char_offline(struct map_session_data *sd)
-{
- if(sd && sd->status.char_id) {
- sprintf(tmp_sql,"UPDATE `%s` SET `online`='0' WHERE `char_id`='%d'", char_db, sd->status.char_id);
- if(mysql_query(&mmysql_handle, tmp_sql) ) {
- printf("DB server Error (update online `%s`)- %s\n", char_db, mysql_error(&mmysql_handle) );
- }
- }
-}
-
-void do_reset_online(void)
-{
- sprintf(tmp_sql,"UPDATE `%s` SET `online`='0' WHERE `online`='1'", char_db);
- if(mysql_query(&mmysql_handle, tmp_sql) ) {
- printf("DB server Error (reset_online `%s`)- %s\n", char_db, mysql_error(&mmysql_handle) );
- }
-}
-
-int online_timer(int tid,unsigned int tick,int id,int data)
-{
- if(check_online_timer != tid)
- return 0;
-
- char_online_check();
-
- check_online_timer=add_timer(gettick()+CHECK_INTERVAL,online_timer,0,0);
-
- return 0;
-}
-
-void char_online_check(void)
-{
- int i;
- struct map_session_data *sd=NULL;
-
- do_reset_online();
-
- for(i=0;i<fd_max;i++){
- if (session[i] && (sd = session[i]->session_data) && sd && sd->state.auth &&
- !(battle_config.hide_GM_session && pc_isGM(sd)))
- if(sd->status.char_id) {
- sprintf(tmp_sql,"UPDATE `%s` SET `online`='1' WHERE `char_id`='%d'", char_db, sd->status.char_id);
- if(mysql_query(&mmysql_handle, tmp_sql) ) {
- printf("DB server Error (update online `%s`)- %s\n", char_db, mysql_error(&mmysql_handle) );
- }
- }
- }
-
-
- if(check_online_timer && check_online_timer != -1) {
- delete_timer(check_online_timer,online_timer);
- add_timer(gettick()+CHECK_INTERVAL,online_timer,0,0);
- }
-
-}
-
-#endif /* not TXT_ONLY */
-
int id_db_final(void *k,void *d,va_list ap){ return 0; }
int map_db_final(void *k,void *d,va_list ap){ return 0; }
int nick_db_final(void *k,void *d,va_list ap){ return 0; }
@@ -2038,10 +1791,6 @@ void do_final(void) {
do_final_itemdb();
do_final_storage();
do_final_guild();
-#ifndef TXT_ONLY
- do_reset_online();
- map_sql_close();
-#endif /* not TXT_ONLY */
}
void map_helpscreen() {
@@ -2055,9 +1804,6 @@ void map_helpscreen() {
int do_init(int argc, char *argv[]) {
int i;
-#ifndef TXT_ONLY
- unsigned char *SQL_CONF_NAME="conf/inter_athena.conf";
-#endif
unsigned char *MAP_CONF_NAME = "conf/map_athena.conf";
unsigned char *BATTLE_CONF_FILENAME = "conf/battle_athena.conf";
unsigned char *ATCOMMAND_CONF_FILENAME = "conf/atcommand_athena.conf";
@@ -2083,10 +1829,6 @@ int do_init(int argc, char *argv[]) {
MSG_CONF_NAME = argv[i+1];
else if (strcmp(argv[i],"--grf_path_file") == 0)
GRF_PATH_FILENAME = argv[i+1];
-#ifndef TXT_ONLY
- else if (strcmp(argv[i],"--sql_config") == 0)
- SQL_CONF_NAME = argv[i+1];
-#endif /* not TXT_ONLY */
}
map_config_read(MAP_CONF_NAME);
@@ -2094,9 +1836,6 @@ int do_init(int argc, char *argv[]) {
atcommand_config_read(ATCOMMAND_CONF_FILENAME);
script_config_read(SCRIPT_CONF_NAME);
msg_config_read(MSG_CONF_NAME);
-#ifndef TXT_ONLY
- sql_config_read(SQL_CONF_NAME);
-#endif /* not TXT_ONLY */
atexit(do_final);
@@ -2104,9 +1843,6 @@ int do_init(int argc, char *argv[]) {
map_db = strdb_init(16);
nick_db = strdb_init(24);
charid_db = numdb_init();
-#ifndef TXT_ONLY
- map_sql_init();
-#endif /* not TXT_ONLY */
grfio_init(GRF_PATH_FILENAME);
@@ -2114,11 +1850,6 @@ int do_init(int argc, char *argv[]) {
add_timer_func_list(map_clearflooritem_timer, "map_clearflooritem_timer");
-#ifndef TXT_ONLY // online status timer, checks every hour [Valaris]
- add_timer_func_list(online_timer, "online_timer");
- check_online_timer=add_timer(gettick()+CHECK_INTERVAL,online_timer,0,0);
-#endif /* not TXT_ONLY */
-
do_init_chrif();
do_init_clif();
do_init_itemdb();
@@ -2132,11 +1863,6 @@ int do_init(int argc, char *argv[]) {
do_init_skill();
do_init_magic();
-#ifndef TXT_ONLY /* mail system [Valaris] */
- if(battle_config.mail_system)
- do_init_mail();
-#endif /* not TXT_ONLY */
-
npc_event_do_oninit(); // npcのOnInitイベント実行
if (battle_config.pk_mode == 1)
diff --git a/src/map/map.h b/src/map/map.h
index fa2d583..b3ff052 100644
--- a/src/map/map.h
+++ b/src/map/map.h
@@ -354,11 +354,6 @@ struct map_session_data {
char chat_lastmsg[513];
int chat_threshold;
int chat_repeatmsg;
-
-#ifndef TXT_ONLY
- int mail_counter; // mail counter for mail system [Valaris]
-#endif
-
};
struct npc_timerevent_list {
@@ -726,42 +721,4 @@ int map_who(int fd);
void map_helpscreen(); // [Valaris]
int map_delmap(char *mapname);
-#ifndef TXT_ONLY
-
-// MySQL
-#include <mysql.h>
-
-void char_online_check(void); // [Valaris]
-void char_offline(struct map_session_data *sd);
-
-extern MYSQL mmysql_handle;
-extern char tmp_sql[65535];
-extern MYSQL_RES* sql_res ;
-extern MYSQL_ROW sql_row ;
-
-extern MYSQL lmysql_handle;
-extern char tmp_lsql[65535];
-extern MYSQL_RES* lsql_res ;
-extern MYSQL_ROW lsql_row ;
-
-extern MYSQL mail_handle;
-extern MYSQL_RES* mail_res ;
-extern MYSQL_ROW mail_row ;
-extern char tmp_msql[65535];
-
-extern int db_use_sqldbs;
-
-extern char item_db_db[32];
-extern char mob_db_db[32];
-extern char login_db[32];
-
-extern char login_db_level[32];
-extern char login_db_account_id[32];
-
-extern int lowest_gm_level;
-extern int read_gm_interval;
-
-extern char char_db[32];
-#endif /* not TXT_ONLY */
-
#endif
diff --git a/src/map/mob.c b/src/map/mob.c
index 8f83c94..5a57472 100644
--- a/src/map/mob.c
+++ b/src/map/mob.c
@@ -4249,162 +4249,13 @@ void mob_reload(void)
do_init_mob();
}
-#ifndef TXT_ONLY
-/*==========================================
- * SQL reading
- *------------------------------------------
- */
-static int mob_read_sqldb(void)
-{
- char line[1024];
- int i,class,ln=0;
- char *str[55],*p,*np;
-
- memset(mob_db,0,sizeof(mob_db));
-
- sprintf (tmp_sql, "SELECT * FROM `%s`",mob_db_db);
- if(mysql_query(&mmysql_handle, tmp_sql) ) {
- printf("DB server Error (select %s to Memory)- %s\n",mob_db_db,mysql_error(&mmysql_handle) );
- }
- sql_res = mysql_store_result(&mmysql_handle);
- if (sql_res) {
- while((sql_row = mysql_fetch_row(sql_res))){
- sprintf(line,"%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s",
- sql_row[0],sql_row[1],sql_row[2],sql_row[3],sql_row[4],
- sql_row[5],sql_row[6],sql_row[7],sql_row[8],sql_row[9],
- sql_row[10],sql_row[11],sql_row[12],sql_row[13],sql_row[14],
- sql_row[15],sql_row[16],sql_row[17],sql_row[18],sql_row[19],
- sql_row[20],sql_row[21],sql_row[22],sql_row[23],sql_row[24],
- sql_row[25],sql_row[26],sql_row[27],sql_row[28],sql_row[29],
- sql_row[30],sql_row[31],sql_row[32],sql_row[33],sql_row[34],
- sql_row[35],sql_row[36],sql_row[37],sql_row[38],sql_row[39],
- sql_row[40],sql_row[41],sql_row[42],sql_row[43],sql_row[44],
- sql_row[45],sql_row[46],sql_row[47],sql_row[48],sql_row[49],
- sql_row[50],sql_row[51],sql_row[52]);
-
- for(i=0,p=line;i<55;i++){
- if((np=strchr(p,','))!=NULL){
- str[i]=p;
- *np=0;
- p=np+1;
- } else
- str[i]=p;
- }
-
- class=atoi(str[0]);
- if(class<=1000 || class>2000)
- continue;
-
- ln++;
-
- mob_db[class].view_class=class;
- memcpy(mob_db[class].name,str[1],24);
- memcpy(mob_db[class].jname,str[2],24);
- mob_db[class].lv=atoi(str[3]);
- mob_db[class].max_hp=atoi(str[4]);
- mob_db[class].max_sp=atoi(str[5]);
- mob_db[class].base_exp=atoi(str[6])*
- battle_config.base_exp_rate/100;
- if(mob_db[class].base_exp <= 0)
- mob_db[class].base_exp = 1;
- mob_db[class].job_exp=atoi(str[7])*
- battle_config.job_exp_rate/100;
- if(mob_db[class].job_exp <= 0)
- mob_db[class].job_exp = 1;
- mob_db[class].range=atoi(str[8]);
- mob_db[class].atk1=atoi(str[9]);
- mob_db[class].atk2=atoi(str[10]);
- mob_db[class].def=atoi(str[11]);
- mob_db[class].mdef=atoi(str[12]);
- mob_db[class].str=atoi(str[13]);
- mob_db[class].agi=atoi(str[14]);
- mob_db[class].vit=atoi(str[15]);
- mob_db[class].int_=atoi(str[16]);
- mob_db[class].dex=atoi(str[17]);
- mob_db[class].luk=atoi(str[18]);
- mob_db[class].range2=atoi(str[19]);
- mob_db[class].range3=atoi(str[20]);
- mob_db[class].size=atoi(str[21]);
- mob_db[class].race=atoi(str[22]);
- mob_db[class].element=atoi(str[23]);
- mob_db[class].mode=atoi(str[24]);
- mob_db[class].speed=atoi(str[25]);
- mob_db[class].adelay=atoi(str[26]);
- mob_db[class].amotion=atoi(str[27]);
- mob_db[class].dmotion=atoi(str[28]);
-
- for(i=0;i<8;i++){
- int rate = 0,type,ratemin,ratemax;
- mob_db[class].dropitem[i].nameid=atoi(str[29+i*2]);
- type = itemdb_type(mob_db[class].dropitem[i].nameid);
- if (type == 0) { // Added by Valaris
- rate = battle_config.item_rate_heal;
- ratemin = battle_config.item_drop_heal_min;
- ratemax = battle_config.item_drop_heal_max;
- }
- else if (type == 2) {
- rate = battle_config.item_rate_use;
- ratemin = battle_config.item_drop_use_min;
- ratemax = battle_config.item_drop_use_max; // End
- }
- else if (type == 4 || type == 5 || type == 8) {
- rate = battle_config.item_rate_equip;
- ratemin = battle_config.item_drop_equip_min;
- ratemax = battle_config.item_drop_equip_max;
- }
- else if (type == 6) {
- rate = battle_config.item_rate_card;
- ratemin = battle_config.item_drop_card_min;
- ratemax = battle_config.item_drop_card_max;
- }
- else {
- rate = battle_config.item_rate_common;
- ratemin = battle_config.item_drop_common_min;
- ratemax = battle_config.item_drop_common_max;
- }
- rate = (rate / 100) * atoi(str[30+i*2]);
- rate = (rate < ratemin)? ratemin: (rate > ratemax)? ratemax: rate;
- mob_db[class].dropitem[i].p = rate;
- }
-
- mob_db[class].mexp=atoi(str[45])*battle_config.mvp_exp_rate/100;
- mob_db[class].mexpper=atoi(str[46]);
- for(i=0;i<3;i++){
- mob_db[class].mvpitem[i].nameid=atoi(str[47+i*2]);
- mob_db[class].mvpitem[i].p=atoi(str[48+i*2])*battle_config.mvp_item_rate/100;
- }
- for(i=0;i<MAX_RANDOMMONSTER;i++)
- mob_db[class].summonper[i]=0;
- mob_db[class].maxskill=0;
-
- mob_db[class].sex=0;
- mob_db[class].hair=0;
- mob_db[class].hair_color=0;
- mob_db[class].weapon=0;
- mob_db[class].shield=0;
- mob_db[class].head_top=0;
- mob_db[class].head_mid=0;
- mob_db[class].head_buttom=0;
- }
- mysql_free_result(sql_res);
- printf("read %s done (count=%d)\n",mob_db_db,ln);
- }
- return 0;
-}
-
-#endif /* not TXT_ONLY */
/*==========================================
* Circumference initialization of mob
*------------------------------------------
*/
int do_init_mob(void)
{
-#ifndef TXT_ONLY
- if(db_use_sqldbs)
- mob_read_sqldb();
- else
-#endif /* TXT_ONLY */
- mob_readdb();
+ mob_readdb();
mob_readdb_mobavail();
mob_read_randommonster();
diff --git a/src/map/pc.c b/src/map/pc.c
index 8fd1a72..6bc2ddd 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -29,10 +29,6 @@
#include "storage.h"
#include "trade.h"
-#ifndef TXT_ONLY // mail system [Valaris]
-#include "mail.h"
-#endif
-
#ifdef MEMWATCH
#include "memwatch.h"
#endif
@@ -713,10 +709,6 @@ int pc_authok(int id, int login_id2, time_t connect_until_time, short tmw_versio
sd->doridori_counter = 0;
-#ifndef TXT_ONLY // mail system [Valaris]
- if(battle_config.mail_system)
- sd->mail_counter = 0;
-#endif
sd->spiritball = 0;
for(i = 0; i < MAX_SKILL_LEVEL; i++)
sd->spirit_timer[i] = -1;
@@ -833,11 +825,6 @@ int pc_authok(int id, int login_id2, time_t connect_until_time, short tmw_versio
sd->chat_lastmsg_time = sd->chat_threshold = sd->chat_repeatmsg = 0;
sd->chat_lastmsg[0] = '\0';
-#ifndef TXT_ONLY
- if(battle_config.mail_system)
- mail_check(sd,1); // check mail at login [Valaris]
-#endif
-
// message of the limited time of the account
if (connect_until_time != 0) { // don't display if it's unlimited or unknow value
char tmpstr[1024];
@@ -7216,13 +7203,11 @@ int pc_autosave(int tid,unsigned int tick,int id,int data)
int pc_read_gm_account(int fd)
{
-#ifdef TXT_ONLY
int i = 0;
-#endif
if (gm_account != NULL)
free(gm_account);
GM_num = 0;
-#ifdef TXT_ONLY
+
gm_account = calloc(sizeof(struct gm_account) * ((RFIFOW(fd,2) - 4) / 5), 1);
for (i = 4; i < RFIFOW(fd,2); i = i + 5) {
gm_account[GM_num].account_id = RFIFOL(fd,i);
@@ -7230,24 +7215,6 @@ int pc_read_gm_account(int fd)
//printf("GM account: %d -> level %d\n", gm_account[GM_num].account_id, gm_account[GM_num].level);
GM_num++;
}
-#else
- sprintf (tmp_lsql, "SELECT `%s`,`%s` FROM `%s` WHERE `%s`>='%d'",login_db_account_id,login_db_level,login_db,login_db_level,lowest_gm_level);
- if(mysql_query(&lmysql_handle, tmp_lsql) ) {
- printf("DB server Error (select %s to Memory)- %s\n",login_db,mysql_error(&lmysql_handle) );
- }
- lsql_res = mysql_store_result(&lmysql_handle);
- if (lsql_res) {
- gm_account = calloc(sizeof(struct gm_account) * mysql_num_rows(lsql_res), 1);
- while ((lsql_row = mysql_fetch_row(lsql_res))) {
- gm_account[GM_num].account_id = atoi(lsql_row[0]);
- gm_account[GM_num].level = atoi(lsql_row[1]);
- printf("GM account: %d -> level %d\n", gm_account[GM_num].account_id, gm_account[GM_num].level);
- GM_num++;
- }
- }
-
- mysql_free_result(lsql_res);
-#endif /* TXT_ONLY */
return GM_num;
}
@@ -7674,10 +7641,6 @@ int do_init_pc(void) {
add_timer_interval((natural_heal_prev_tick = gettick() + NATURAL_HEAL_INTERVAL), pc_natural_heal, 0, 0, NATURAL_HEAL_INTERVAL);
add_timer(gettick() + autosave_interval, pc_autosave, 0, 0);
-#ifndef TXT_ONLY
- pc_read_gm_account(0);
-#endif /* not TXT_ONLY */
-
// add night/day timer (by [yor])
add_timer_func_list(map_day_timer, "map_day_timer"); // by [yor]
add_timer_func_list(map_night_timer, "map_night_timer"); // by [yor]