diff options
Diffstat (limited to 'src/map/mob.c')
-rw-r--r-- | src/map/mob.c | 151 |
1 files changed, 1 insertions, 150 deletions
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(); |