summaryrefslogtreecommitdiff
path: root/src/map
diff options
context:
space:
mode:
Diffstat (limited to 'src/map')
-rw-r--r--src/map/irc.c4
-rw-r--r--src/map/map.c38
-rw-r--r--src/map/map.h29
-rw-r--r--src/map/skill.c408
4 files changed, 6 insertions, 473 deletions
diff --git a/src/map/irc.c b/src/map/irc.c
index 5bc0dd633..5772655be 100644
--- a/src/map/irc.c
+++ b/src/map/irc.c
@@ -149,7 +149,7 @@ int irc_keepalive_timer(int tid, unsigned int tick, int id, int data)
sprintf(send_string,"PRIVMSG %s : ", irc_nick);
irc_send(send_string);
- add_timer(gettick() + 45000, irc_keepalive_timer, 0, 0);
+ add_timer(gettick() + 30000, irc_keepalive_timer, 0, 0);
return 0;
}
@@ -270,6 +270,6 @@ void do_init_irc(void)
add_timer_func_list(irc_connect_timer, "irc_connect_timer");
add_timer_func_list(irc_keepalive_timer, "irc_keepalive_timer");
- add_timer(gettick() + 45000, irc_keepalive_timer, 0, 0);
+ add_timer(gettick() + 30000, irc_keepalive_timer, 0, 0);
}
diff --git a/src/map/map.c b/src/map/map.c
index 3b0c59e28..f30b70619 100644
--- a/src/map/map.c
+++ b/src/map/map.c
@@ -92,35 +92,6 @@ char item_db2_db[32] = "item_db2";
char mob_db_db[32] = "mob_db";
char mob_db2_db[32] = "mob_db2";
-// SQL for databases not supported yet. [Valaris]
-int db_use_newsqldbs = 0;
-
-char abra_sqldb[32]="abra_db";
-char attr_fix_sqldb[32]="attr_fix";
-char cast_sqldb[32]="cast_db";
-char castle_sqldb[32]="castle_db";
-char create_arrow_sqldb[32]="create_arrow_db";
-char exp_sqldb[32]="exp";
-char exp_guild_sqldb[32]="exp_guild";
-char item_bluebox_sqldb[32]="item_bluebox";
-char item_cardalbum_sqldb[32]="item_cardalbum";
-char item_giftbox_sqldb[32]="item_giftbox";
-char item_scroll_sqldb[32]="item_scroll";
-char item_violetbox_sqldb[32]="item_violetbox";
-char job_sqldb1[32]="job_db1";
-char mob_boss_sqldb[32]="mob_boss";
-char mob_branch_sqldb[32]="mob_branch";
-char mob_poring_sqldb[32]="mob_poring";
-char mob_skill_sqldb[32]="mob_skill_db";
-char pet_sqldb[32]="pet_db";
-char produce_sqldb[32]="produce_db";
-char refine_sqldb[32]="refine_db";
-char size_fix_sqldb[32]="size_fix";
-char skill_sqldb[32]="skill_db";
-char skill_require_sqldb[32]="skill_require_db";
-char skill_tree_sqldb[32]="skill_tree";
-// End [Valaris]
-
char login_db[32] = "login";
char login_db_level[32] = "level";
char login_db_account_id[32] = "account_id";
@@ -3467,9 +3438,6 @@ int inter_config_read(char *cfgName)
} else if(strcmpi(w1,"use_sql_db")==0){
db_use_sqldbs = battle_config_switch(w2);
ShowStatus ("Using SQL dbs: %s\n",w2);
- } else if(strcmpi(w1,"use_new_sql_db")==0){
- db_use_newsqldbs = battle_config_switch(w2);
- ShowStatus ("Using New SQL dbs: %s\n",w2);
//Login Server SQL DB
} else if(strcmpi(w1,"login_server_ip")==0){
strcpy(login_server_ip, w2);
@@ -3750,7 +3718,8 @@ void do_final(void) {
do_final_pet();
do_final_mob();
do_final_msg();
- do_final_irc();
+ if(use_irc)
+ do_final_irc();
map_getallusers(NULL); //Clear the memory allocated for this array.
@@ -3947,7 +3916,8 @@ int do_init(int argc, char *argv[]) {
add_timer_func_list(map_removemobs_timer, "map_removemobs_timer");
add_timer_interval(gettick()+1000, map_freeblock_timer, 0, 0, 60*1000);
- do_init_irc();
+ if(use_irc)
+ do_init_irc();
do_init_atcommand();
do_init_battle();
do_init_chrif();
diff --git a/src/map/map.h b/src/map/map.h
index 48c2b4093..f8bfa82cc 100644
--- a/src/map/map.h
+++ b/src/map/map.h
@@ -1365,35 +1365,6 @@ extern char mob_db_db[32];
extern char mob_db2_db[32];
extern char login_db[32];
-// SQL for databases not supported yet. [Valaris]
-extern int db_use_newsqldbs;
-
-extern char abra_sqldb[32];
-extern char attr_fix_sqldb[32];
-extern char cast_sqldb[32];
-extern char castle_sqldb[32];
-extern char create_arrow_sqldb[32];
-extern char exp_sqldb[32];
-extern char exp_guild_sqldb[32];
-extern char item_bluebox_sqldb[32];
-extern char item_cardalbum_sqldb[32];
-extern char item_giftbox_sqldb[32];
-extern char item_scroll_sqldb[32];
-extern char item_violetbox_sqldb[32];
-extern char job_sqldb1[32];
-extern char mob_boss_sqldb[32];
-extern char mob_branch_sqldb[32];
-extern char mob_poring_sqldb[32];
-extern char mob_skill_sqldb[32];
-extern char pet_sqldb[32];
-extern char produce_sqldb[32];
-extern char refine_sqldb[32];
-extern char size_fix_sqldb[32];
-extern char skill_sqldb[32];
-extern char skill_require_sqldb[32];
-extern char skill_tree_sqldb[32];
-// End [Valaris]
-
extern char login_db_level[32];
extern char login_db_account_id[32];
diff --git a/src/map/skill.c b/src/map/skill.c
index 9e45d6304..0c9376acf 100644
--- a/src/map/skill.c
+++ b/src/map/skill.c
@@ -11719,408 +11719,6 @@ int skill_readdb(void)
return 0;
}
-// SQL Skill database reading [Valaris]
-#ifndef TXT_ONLY
-int skill_read_sqldb(void)
-{
- const char unknown_str[NAME_LENGTH] ="unknown";
- int i,j,k,l,m;
- FILE *fp;
- char line[1024],path[1024],*p;
- char *filename[]={"produce_db.txt","produce_db2.txt"};
- long unsigned int ln = 0;
-
- /* スキルデ?タベ?ス */
- memset(skill_db,0,sizeof(skill_db));
-
- //For easier handling of converting. [Skotlex]
-#define TO_INT(a) (sql_row[a]==NULL?0:atoi(sql_row[a]))
-#define TO_STR(a) (sql_row[a]==NULL?unknown_str:sql_row[a])
- sprintf (tmp_sql, "SELECT * FROM `%s`", skill_sqldb);
- if (mysql_query(&mmysql_handle, tmp_sql)) {
- ShowSQL("DB error (%s) - %s\n", skill_sqldb, mysql_error(&mmysql_handle));
- ShowDebug("at %s:%d - %s\n", __FILE__,__LINE__,tmp_sql);
- return 1;
- }
- sql_res = mysql_store_result(&mmysql_handle);
- if (sql_res) {
- while((sql_row = mysql_fetch_row(sql_res))){
- i=TO_INT(0);
- if (i>=10000 && i<10015) // for guild skills [Celest]
- i -= 9500;
- else if(i<=0 || i>MAX_SKILL_DB)
- continue;
-
- ln++;
-
- skill_split_atoi(sql_row[1],skill_db[i].range);
- skill_db[i].hit=TO_INT(2);
- skill_db[i].inf=TO_INT(3);
- skill_db[i].pl=TO_INT(4);
- skill_db[i].nk=TO_INT(5);
- skill_db[i].max=TO_INT(6);
- skill_split_atoi(sql_row[7],skill_db[i].num);
-
- if(strcmpi(TO_STR(8),"yes") == 0)
- skill_db[i].castcancel=1;
- else
- skill_db[i].castcancel=0;
- skill_db[i].cast_def_rate=TO_INT(9);
- skill_db[i].inf2=TO_INT(10);
- skill_db[i].maxcount=TO_INT(11);
- if(strcmpi(TO_STR(12),"weapon") == 0)
- skill_db[i].skill_type=BF_WEAPON;
- else if(strcmpi(TO_STR(12),"magic") == 0)
- skill_db[i].skill_type=BF_MAGIC;
- else if(strcmpi(TO_STR(12),"misc") == 0)
- skill_db[i].skill_type=BF_MISC;
- else
- skill_db[i].skill_type=0;
- skill_split_atoi(sql_row[13],skill_db[i].blewcount);
-
- for (j = 0; skill_names[j].id != 0; j++)
- if (skill_names[j].id == i) {
- skill_db[i].name = skill_names[j].name;
- skill_db[i].desc = skill_names[j].desc;
- break;
- }
- }
- mysql_free_result(sql_res);
- ShowStatus("Done reading '"CL_WHITE"%lu"CL_RESET"' entries in '"CL_WHITE"%s"CL_RESET"'.\n", ln, skill_sqldb);
- ln=0;
- }
-
- sprintf (tmp_sql, "SELECT * FROM `%s`", skill_require_sqldb);
- if (mysql_query(&mmysql_handle, tmp_sql)) {
- ShowSQL("DB error (%s) - %s\n", skill_require_sqldb, mysql_error(&mmysql_handle));
- ShowDebug("at %s:%d - %s\n", __FILE__,__LINE__,tmp_sql);
- return 1;
- }
- sql_res = mysql_store_result(&mmysql_handle);
- if (sql_res) {
- while((sql_row = mysql_fetch_row(sql_res))){
- i=TO_INT(0);
- if (i>=10000 && i<10015) // for guild skills [Celest]
- i -= 9500;
- else if(i<=0 || i>MAX_SKILL_DB)
- continue;
-
- ln++;
-
- skill_split_atoi(sql_row[1],skill_db[i].hp);
- skill_split_atoi(sql_row[2],skill_db[i].mhp);
- skill_split_atoi(sql_row[3],skill_db[i].sp);
- skill_split_atoi(sql_row[4],skill_db[i].hp_rate);
- skill_split_atoi(sql_row[5],skill_db[i].sp_rate);
- skill_split_atoi(sql_row[6],skill_db[i].zeny);
-
- p = sql_row[7];
- for(j=0;j<32;j++){
- l = atoi(p);
- if (l==99) {
- skill_db[i].weapon = 0xffffffff;
- break;
- }
- else
- skill_db[i].weapon |= 1<<l;
- p=strchr(p,':');
- if(!p)
- break;
- p++;
- }
-
- if( strcmpi(TO_STR(8),"hiding")==0 ) skill_db[i].state=ST_HIDING;
- else if( strcmpi(TO_STR(8),"cloaking")==0 ) skill_db[i].state=ST_CLOAKING;
- else if( strcmpi(TO_STR(8),"hidden")==0 ) skill_db[i].state=ST_HIDDEN;
- else if( strcmpi(TO_STR(8),"riding")==0 ) skill_db[i].state=ST_RIDING;
- else if( strcmpi(TO_STR(8),"falcon")==0 ) skill_db[i].state=ST_FALCON;
- else if( strcmpi(TO_STR(8),"cart")==0 ) skill_db[i].state=ST_CART;
- else if( strcmpi(TO_STR(8),"shield")==0 ) skill_db[i].state=ST_SHIELD;
- else if( strcmpi(TO_STR(8),"sight")==0 ) skill_db[i].state=ST_SIGHT;
- else if( strcmpi(TO_STR(8),"explosionspirits")==0 ) skill_db[i].state=ST_EXPLOSIONSPIRITS;
- else if( strcmpi(TO_STR(8),"cartboost")==0 ) skill_db[i].state=ST_CARTBOOST;
- else if( strcmpi(TO_STR(8),"recover_weight_rate")==0 ) skill_db[i].state=ST_RECOV_WEIGHT_RATE;
- else if( strcmpi(TO_STR(8),"move_enable")==0 ) skill_db[i].state=ST_MOVE_ENABLE;
- else if( strcmpi(TO_STR(8),"water")==0 ) skill_db[i].state=ST_WATER;
- else skill_db[i].state=ST_NONE;
-
- skill_split_atoi(sql_row[9],skill_db[i].spiritball);
- skill_db[i].itemid[0]=TO_INT(10);
- skill_db[i].amount[0]=TO_INT(11);
- skill_db[i].itemid[1]=TO_INT(12);
- skill_db[i].amount[1]=TO_INT(13);
- skill_db[i].itemid[2]=TO_INT(14);
- skill_db[i].amount[2]=TO_INT(15);
- skill_db[i].itemid[3]=TO_INT(16);
- skill_db[i].amount[3]=TO_INT(17);
- skill_db[i].itemid[4]=TO_INT(18);
- skill_db[i].amount[4]=TO_INT(19);
- skill_db[i].itemid[5]=TO_INT(20);
- skill_db[i].amount[5]=TO_INT(21);
- skill_db[i].itemid[6]=TO_INT(22);
- skill_db[i].amount[6]=TO_INT(23);
- skill_db[i].itemid[7]=TO_INT(24);
- skill_db[i].amount[7]=TO_INT(25);
- skill_db[i].itemid[8]=TO_INT(26);
- skill_db[i].amount[8]=TO_INT(27);
- skill_db[i].itemid[9]=TO_INT(28);
- skill_db[i].amount[9]=TO_INT(29);
- }
- mysql_free_result(sql_res);
- ShowStatus("Done reading '"CL_WHITE"%lu"CL_RESET"' entries in '"CL_WHITE"%s"CL_RESET"'.\n", ln, skill_require_sqldb);
- ln=0;
- }
-
- sprintf (tmp_sql, "SELECT * FROM `%s`", cast_sqldb);
- if (mysql_query(&mmysql_handle, tmp_sql)) {
- ShowSQL("DB error (%s) - %s\n", cast_sqldb, mysql_error(&mmysql_handle));
- ShowDebug("at %s:%d - %s\n", __FILE__,__LINE__,tmp_sql);
- return 1;
- }
- sql_res = mysql_store_result(&mmysql_handle);
- if (sql_res) {
- while((sql_row = mysql_fetch_row(sql_res))){
- i=TO_INT(0);
- if (i>=10000 && i<10015) // for guild skills [Celest]
- i -= 9500;
- else if(i<=0 || i>MAX_SKILL_DB)
- continue;
-
- ln++;
-
- skill_split_atoi(sql_row[1],skill_db[i].cast);
- skill_split_atoi(sql_row[2],skill_db[i].delay);
- skill_split_atoi(sql_row[3],skill_db[i].upkeep_time);
- skill_split_atoi(sql_row[4],skill_db[i].upkeep_time2);
- }
- mysql_free_result(sql_res);
- ShowStatus("Done reading '"CL_WHITE"%lu"CL_RESET"' entries in '"CL_WHITE"%s"CL_RESET"'.\n", ln, cast_sqldb);
- ln=0;
- }
-
- /* スキルユニットデ?[タベ?[ス */
-
- sprintf(path, "%s/skill_unit_db.txt", db_path);
- fp=fopen(path,"r");
- if (fp==NULL) {
- ShowError("can't read %s\n", path);
- return 1;
- }
- k = 0;
- while (fgets(line,1020,fp)) {
- char *split[50];
- if (line[0]=='/' && line[1]=='/')
- continue;
- j = skill_split_str(line,split,8);
- if (split[7]==NULL || j<8)
- continue;
-
- i=atoi(split[0]);
- if (i>=10000 && i<10015) // for guild skills [Celest]
- i -= 9500;
- else if(i<=0 || i>MAX_SKILL_DB)
- continue;
- skill_db[i].unit_id[0] = strtol(split[1],NULL,16);
- skill_db[i].unit_id[1] = strtol(split[2],NULL,16);
- skill_split_atoi(split[3],skill_db[i].unit_layout_type);
- skill_db[i].unit_range = atoi(split[4]);
- skill_db[i].unit_interval = atoi(split[5]);
-
- if( strcmpi(split[6],"noenemy")==0 ) skill_db[i].unit_target=BCT_NOENEMY;
- else if( strcmpi(split[6],"friend")==0 ) skill_db[i].unit_target=BCT_NOENEMY;
- else if( strcmpi(split[6],"party")==0 ) skill_db[i].unit_target=BCT_PARTY;
- else if( strcmpi(split[6],"ally")==0 ) skill_db[i].unit_target=BCT_PARTY|BCT_GUILD;
- else if( strcmpi(split[6],"all")==0 ) skill_db[i].unit_target=BCT_ALL;
- else if( strcmpi(split[6],"enemy")==0 ) skill_db[i].unit_target=BCT_ENEMY;
- else if( strcmpi(split[6],"self")==0 ) skill_db[i].unit_target=BCT_SELF;
- else if( strcmpi(split[6],"noone")==0 ) skill_db[i].unit_target=BCT_NOONE;
- else skill_db[i].unit_target = strtol(split[6],NULL,16);
-
- skill_db[i].unit_flag = strtol(split[7],NULL,16);
- if (skill_db[i].unit_flag&UF_DEFNOTENEMY && battle_config.defnotenemy)
- skill_db[i].unit_target=BCT_NOENEMY;
-
- //By default, target just characters.
- skill_db[i].unit_target |= BL_CHAR;
- if (skill_db[i].unit_flag&UF_NOPC)
- skill_db[i].unit_target &= ~BL_PC;
- if (skill_db[i].unit_flag&UF_NOMOB)
- skill_db[i].unit_target &= ~BL_MOB;
- if (skill_db[i].unit_flag&UF_SKILL)
- skill_db[i].unit_target |= BL_SKILL;
-
- k++;
- }
- fclose(fp);
- ShowStatus("Done reading '"CL_WHITE"%s"CL_RESET"'.\n",path);
- skill_init_unit_layout();
-
- /* ?サ造系スキルデ?タベ?ス */
- memset(skill_produce_db,0,sizeof(skill_produce_db));
- for(m=0;m<2;m++){
- sprintf(path, "%s/%s", db_path, filename[m]);
- fp=fopen(path,"r");
- if(fp==NULL){
- if(m>0)
- continue;
- ShowError("can't read %s\n",path);
- return 1;
- }
- k=0;
- while(fgets(line,1020,fp)){
- char *split[6 + MAX_PRODUCE_RESOURCE * 2];
- int x,y;
- if(line[0]=='/' && line[1]=='/')
- continue;
- memset(split,0,sizeof(split));
- j = skill_split_str(line,split,(3 + MAX_PRODUCE_RESOURCE * 2));
- if(split[0]==0) //fixed by Lupus
- continue;
- i=atoi(split[0]);
- if(i<=0) continue;
-
- skill_produce_db[k].nameid=i;
- skill_produce_db[k].itemlv=atoi(split[1]);
- skill_produce_db[k].req_skill=atoi(split[2]);
-
- for(x=3,y=0; split[x] && split[x+1] && y<MAX_PRODUCE_RESOURCE; x+=2,y++){
- skill_produce_db[k].mat_id[y]=atoi(split[x]);
- skill_produce_db[k].mat_amount[y]=atoi(split[x+1]);
- }
- k++;
- if(k >= MAX_SKILL_PRODUCE_DB)
- break;
- }
- fclose(fp);
- ShowStatus("Done reading '"CL_WHITE"%d"CL_RESET"' entries in '"CL_WHITE"%s"CL_RESET"'.\n",k,path);
- }
-
- memset(skill_arrow_db,0,sizeof(skill_arrow_db));
-
- sprintf(path, "%s/create_arrow_db.txt", db_path);
- fp=fopen(path,"r");
- if(fp==NULL){
- ShowError("can't read %s\n", path);
- return 1;
- }
- k=0;
- while(fgets(line,1020,fp)){
- char *split[16];
- int x,y;
- if(line[0]=='/' && line[1]=='/')
- continue;
- memset(split,0,sizeof(split));
- j = skill_split_str(line,split,13);
- if(split[0]==0) //fixed by Lupus
- continue;
- i=atoi(split[0]);
- if(i<=0)
- continue;
-
- skill_arrow_db[k].nameid=i;
-
- for(x=1,y=0;split[x] && split[x+1] && y<5;x+=2,y++){
- skill_arrow_db[k].cre_id[y]=atoi(split[x]);
- skill_arrow_db[k].cre_amount[y]=atoi(split[x+1]);
- }
- k++;
- if(k >= MAX_SKILL_ARROW_DB)
- break;
- }
- fclose(fp);
- ShowStatus("Done reading '"CL_WHITE"%d"CL_RESET"' entries in '"CL_WHITE"%s"CL_RESET"'.\n",k,path);
-
- memset(skill_abra_db,0,sizeof(skill_abra_db));
- sprintf(path, "%s/abra_db.txt", db_path);
- fp=fopen(path,"r");
- if(fp==NULL){
- ShowError("can't read %s\n", path);
- return 1;
- }
- k=0;
- while(fgets(line,1020,fp)){
- char *split[16];
- if(line[0]=='/' && line[1]=='/')
- continue;
- memset(split,0,sizeof(split));
- j = skill_split_str(line,split,13);
- if(split[0]==0) //fixed by Lupus
- continue;
- i=atoi(split[0]);
- if(i<=0)
- continue;
-
- skill_abra_db[i].req_lv=atoi(split[2]);
- skill_abra_db[i].per=atoi(split[3]);
-
- k++;
- if(k >= MAX_SKILL_ABRA_DB)
- break;
- }
- fclose(fp);
- ShowStatus("Done reading '"CL_WHITE"%d"CL_RESET"' entries in '"CL_WHITE"%s"CL_RESET"'.\n",k,path);
-
- sprintf(path, "%s/skill_castnodex_db.txt", db_path);
- fp=fopen(path,"r");
- if(fp==NULL){
- ShowError("can't read %s\n", path);
- return 1;
- }
- while(fgets(line,1020,fp)){
- char *split[50];
- if(line[0]=='/' && line[1]=='/')
- continue;
- memset(split,0,sizeof(split));
- j = skill_split_str(line,split,4);
- if(split[0]==0) //fixed by Lupus
- continue;
- i=atoi(split[0]);
- if (i>=10000 && i<10015) // for guild skills [Celest]
- i -= 9500;
- else if(i<=0 || i>MAX_SKILL_DB)
- continue;
-
- skill_split_atoi(split[1],skill_db[i].castnodex);
- if (!split[2])
- continue;
- skill_split_atoi(split[2],skill_db[i].delaynodex);
- if(!split[3])
- continue;
- skill_split_atoi(split[3],skill_db[i].delaynowalk);
- }
- fclose(fp);
- ShowStatus("Done reading '"CL_WHITE"%s"CL_RESET"'.\n",path);
-
- sprintf(path, "%s/skill_nocast_db.txt", db_path);
- fp=fopen(path,"r");
- if(fp==NULL){
- ShowError("can't read %s\n", path);
- return 1;
- }
- k=0;
- while(fgets(line,1020,fp)){
- char *split[16];
- if(line[0]=='/' && line[1]=='/')
- continue;
- memset(split,0,sizeof(split));
- j = skill_split_str(line,split,2);
- if(split[0]==0) //fixed by Lupus
- continue;
- i=atoi(split[0]);
- if (i>=10000 && i<10015) // for guild skills [Celest]
- i -= 9500;
- else if(i<=0 || i>MAX_SKILL_DB)
- continue;
- skill_db[i].nocast=atoi(split[1]);
- k++;
- }
- fclose(fp);
- ShowStatus("Done reading '"CL_WHITE"%s"CL_RESET"'.\n",path);
-
- return 0;
-}
-#endif
-
/*===============================================
* For reading leveluseskillspamount.txt [Celest]
*-----------------------------------------------
@@ -12179,12 +11777,6 @@ void skill_reload(void)
*/
int do_init_skill(void)
{
-
-#ifndef TXT_ONLY
- if(db_use_newsqldbs)
- skill_read_sqldb();
- else
-#endif /* TXT_ONLY */
skill_readdb();
if (battle_config.skill_sp_override_grffile)