diff options
author | Valaris <Valaris@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2006-02-10 00:09:29 +0000 |
---|---|---|
committer | Valaris <Valaris@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2006-02-10 00:09:29 +0000 |
commit | 02970d7f1eb4e67ad850d140ff9acebc63d31036 (patch) | |
tree | fc0ec7800afdb0cbc0c14226cbe5c113f691b943 /src/map/skill.c | |
parent | 1ad8c0860982f9f7e01afffcd703a919b7e186c7 (diff) | |
download | hercules-02970d7f1eb4e67ad850d140ff9acebc63d31036.tar.gz hercules-02970d7f1eb4e67ad850d140ff9acebc63d31036.tar.bz2 hercules-02970d7f1eb4e67ad850d140ff9acebc63d31036.tar.xz hercules-02970d7f1eb4e67ad850d140ff9acebc63d31036.zip |
* Removed the conf sql code for now. Maybe will continue later with that project.
Lowered the irc keepalive timer, and added some checks for use_irc that should have been there.
Added a return line \n to the beginning of the title screen. [Valaris]
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@5241 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/skill.c')
-rw-r--r-- | src/map/skill.c | 408 |
1 files changed, 0 insertions, 408 deletions
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)
|