diff options
-rw-r--r-- | Changelog-SVN.txt | 6 | ||||
-rw-r--r-- | conf-tmpl/battle_athena.conf | 35 | ||||
-rw-r--r-- | src/map/battle.c | 28 | ||||
-rw-r--r-- | src/map/battle.h | 3 | ||||
-rw-r--r-- | src/map/mob.c | 141 | ||||
-rw-r--r-- | src/map/pc.c | 8 |
6 files changed, 75 insertions, 146 deletions
diff --git a/Changelog-SVN.txt b/Changelog-SVN.txt index f6c0c52b6..8ca6cf7da 100644 --- a/Changelog-SVN.txt +++ b/Changelog-SVN.txt @@ -1,5 +1,11 @@ Date Added +02/24 + * Fixed Steal Item Rate. It has been multiplied twice on common_item_drop value for any kinds of items. [Lupus] + e.g. If you set droprate of comman items to 500%, then even rare items could be stolen more easily. Thanks to Freya + * Items Droprate fix. Now it adjusts correctly, w/o overflows. Thanks to Freya [Lupus] + * mob DBbs EXP reading fix. w/o overflows. Thanks to Freya [Lupus] + 02/23 * Added bAddItemHealRate [celest] * Fixed a crash if adding an offline player to a party, thanks to Alex14 diff --git a/conf-tmpl/battle_athena.conf b/conf-tmpl/battle_athena.conf index a6615b9e2..f2c76990d 100644 --- a/conf-tmpl/battle_athena.conf +++ b/conf-tmpl/battle_athena.conf @@ -149,37 +149,6 @@ item_drop_card_max: 10000 item_drop_mvp_min: 1 item_drop_mvp_max: 10000 -//For fine tuning drop rates for all items -//details = 0: Don't change anything (Default) -// 1: Change drop ratios depending on current rates -// 2: Change drop ratios depending on current rates, but not exceeding minimum -// and maximum values -// Example: details=3 rate_1=1000 min=20 If an item's drops is between 1/10000 - -// 9/10000 it will become at least 1x1000%=10, which is still below 20, -// so it'll be increase to 20/10000 -// -item_rate_details: 0 -// -//Drop rates 1-9 -item_rate_1: 100 -item_rate_1_min: 1 -item_rate_1_max: 9 -// -//Drop rates 10-99 -item_rate_10: 100 -item_rate_10_min: 10 -item_rate_10_max: 99 -// -//Drop rates 100-999 -item_rate_100: 100 -item_rate_100_min: 100 -item_rate_100_max: 999 -// -//Drop rates 1000 and above -item_rate_1000: 100 -item_rate_1000_min: 1000 -item_rate_1000_max: 10000 - // Can the monster's drop rate become 0? (Note 1) drop_rate0item: yes @@ -532,6 +501,10 @@ monster_skill_nofootset: yes // When a player is cloaking, Whether the wall is checked or not. (Note 1) // Note: When set to no players can always cloak away from walls and move around // freely even if the skill level is below 3. +// no or 0 = doesn't check for walls (you can cloacking without walls) +// 1 = it checks for walls +// 2 = it doesn't checks for walls + your cloaking lasts forever +// 3 = it checks for walls, but your cloaking lasts forever player_cloak_check_type: yes // When a monster is cloaking, Whether the wall is checked or not. (Note 1) diff --git a/src/map/battle.c b/src/map/battle.c index 605fd30e0..f58151f3d 100644 --- a/src/map/battle.c +++ b/src/map/battle.c @@ -4122,19 +4122,6 @@ static const struct { { "gm_can_drop_lv", &battle_config.gm_can_drop_lv }, { "disp_hpmeter", &battle_config.disp_hpmeter }, { "bone_drop", &battle_config.bone_drop }, - { "item_rate_details", &battle_config.item_rate_details }, - { "item_rate_1", &battle_config.item_rate_1 }, - { "item_rate_10", &battle_config.item_rate_10 }, - { "item_rate_100", &battle_config.item_rate_100 }, - { "item_rate_1000", &battle_config.item_rate_1000 }, - { "item_rate_1_min", &battle_config.item_rate_1_min }, - { "item_rate_1_max", &battle_config.item_rate_1_max }, - { "item_rate_10_min", &battle_config.item_rate_10_min }, - { "item_rate_10_max", &battle_config.item_rate_10_max }, - { "item_rate_100_min", &battle_config.item_rate_100_min }, - { "item_rate_100_max", &battle_config.item_rate_100_max }, - { "item_rate_1000_min", &battle_config.item_rate_1000_min }, - { "item_rate_1000_max", &battle_config.item_rate_1000_max }, { "item_rate_common", &battle_config.item_rate_common }, // Added by RoVeRT { "item_rate_equip", &battle_config.item_rate_equip }, { "item_rate_card", &battle_config.item_rate_card }, // End Addition @@ -4382,19 +4369,6 @@ void battle_set_defaults() { battle_config.gm_can_drop_lv = 0; battle_config.disp_hpmeter = 0; battle_config.bone_drop = 0; - battle_config.item_rate_details = 0; - battle_config.item_rate_1 = 100; - battle_config.item_rate_10 = 100; - battle_config.item_rate_100 = 100; - battle_config.item_rate_1000 = 100; - battle_config.item_rate_1_min = 1; - battle_config.item_rate_1_max = 9; - battle_config.item_rate_10_min = 10; - battle_config.item_rate_10_max = 99; - battle_config.item_rate_100_min = 100; - battle_config.item_rate_100_max = 999; - battle_config.item_rate_1000_min = 1000; - battle_config.item_rate_1000_max = 10000; battle_config.item_rate_common = 100; battle_config.item_rate_equip = 100; battle_config.item_rate_card = 100; @@ -4605,7 +4579,7 @@ int battle_config_read(const char *cfgName) fp = fopen(cfgName,"r"); if (fp == NULL) { - printf("file not found: %s\n", cfgName); + printf("File not found: %s\n", cfgName); return 1; } while(fgets(line,1020,fp)){ diff --git a/src/map/battle.h b/src/map/battle.h index 4a75dfe1e..95d809b3a 100644 --- a/src/map/battle.h +++ b/src/map/battle.h @@ -280,9 +280,6 @@ extern struct Battle_Config { int gm_can_drop_lv; int disp_hpmeter; int bone_drop; - int item_rate_details,item_rate_1,item_rate_10,item_rate_100,item_rate_1000; //ドロップレート詳細 - int item_rate_1_min,item_rate_10_min,item_rate_100_min,item_rate_1000_min; //ドロップレート詳細min - int item_rate_1_max,item_rate_10_max,item_rate_100_max,item_rate_1000_max; //ドロップレート詳細max int night_at_start; // added by [Yor] int day_duration; // added by [Yor] diff --git a/src/map/mob.c b/src/map/mob.c index 9b2f91da1..130852c97 100644 --- a/src/map/mob.c +++ b/src/map/mob.c @@ -152,11 +152,12 @@ int mob_once_spawn(struct map_session_data *sd,char *mapname, // if(battle_config.etc_log) // printf("mobclass=%d try=%d\n",class_,i); } + if(sd){ if(x<=0) x=sd->bl.x; if(y<=0) y=sd->bl.y; }else if(x<=0 || y<=0){ - printf("mob_once_spawn: ??\n"); + printf("mob_once_spawn: %i at %s x:%i y:%i\n ??\n",class_,map[m].name,x,y); //got idea from Freya [Lupus] } for(count=0;count<amount;count++){ @@ -2683,7 +2684,7 @@ int mob_damage(struct block_list *src,struct mob_data *md,int damage,int type) drop_rate = 1; if(drop_rate < battle_config.item_drop_mvp_min) drop_rate = battle_config.item_drop_mvp_min; - if(drop_rate > battle_config.item_drop_mvp_max) + else if(drop_rate > battle_config.item_drop_mvp_max) //fixed drop_rate = battle_config.item_drop_mvp_max; if(drop_rate <= rand()%10000) continue; @@ -3891,23 +3892,29 @@ static int mob_readdb(void) mob_db[class_].max_hp=atoi(str[4]); mob_db[class_].max_sp=atoi(str[5]); - mob_db[class_].base_exp=atoi(str[6]); - if(mob_db[class_].base_exp < 0) + mob_db[class_].base_exp = atoi(str[6]); + if (mob_db[class_].base_exp <= 0) mob_db[class_].base_exp = 0; - else if(mob_db[class_].base_exp > 0 && (mob_db[class_].base_exp*battle_config.base_exp_rate/100 > 1000000000 || - mob_db[class_].base_exp*battle_config.base_exp_rate/100 < 0)) - mob_db[class_].base_exp=1000000000; - else - mob_db[class_].base_exp*= battle_config.base_exp_rate/100; + else if (mob_db[class_].base_exp * battle_config.base_exp_rate / 100 > 1000000000 || + mob_db[class_].base_exp * battle_config.base_exp_rate / 100 < 0) + mob_db[class_].base_exp = 1000000000; + else { + mob_db[class_].base_exp = mob_db[class_].base_exp * battle_config.base_exp_rate / 100; + if (mob_db[class_].base_exp < 1) + mob_db[class_].base_exp = 1; + } - mob_db[class_].job_exp=atoi(str[7]); - if(mob_db[class_].job_exp < 0) + mob_db[class_].job_exp = atoi(str[7]); + if (mob_db[class_].job_exp <= 0) mob_db[class_].job_exp = 0; - else if(mob_db[class_].job_exp > 0 && (mob_db[class_].job_exp*battle_config.job_exp_rate/100 > 1000000000 || - mob_db[class_].job_exp*battle_config.job_exp_rate/100 < 0)) - mob_db[class_].job_exp=1000000000; - else - mob_db[class_].job_exp*=battle_config.job_exp_rate/100; + else if (mob_db[class_].job_exp * battle_config.job_exp_rate / 100 > 1000000000 || + mob_db[class_].job_exp * battle_config.job_exp_rate / 100 < 0) + mob_db[class_].job_exp = 1000000000; + else { + mob_db[class_].job_exp = mob_db[class_].job_exp * battle_config.job_exp_rate / 100; + if (mob_db[class_].job_exp < 1) + mob_db[class_].job_exp = 1; + } mob_db[class_].range=atoi(str[8]); mob_db[class_].atk1=atoi(str[9]); @@ -3935,73 +3942,32 @@ static int mob_readdb(void) 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 [Valaris] - rate = battle_config.item_rate_heal; + if (type == 0) { + rate = battle_config.item_rate_heal * atoi(str[30+i*2]) / 100; //fix by Yor ratemin = battle_config.item_drop_heal_min; ratemax = battle_config.item_drop_heal_max; } else if (type == 2) { - rate = battle_config.item_rate_use; + rate = battle_config.item_rate_use * atoi(str[30+i*2]) / 100; //fix by Yor ratemin = battle_config.item_drop_use_min; ratemax = battle_config.item_drop_use_max; // End } else if (type == 4 || type == 5 || type == 8) { // Changed to include Pet Equip - rate = battle_config.item_rate_equip; + rate = battle_config.item_rate_equip * atoi(str[30+i*2]) / 100; ratemin = battle_config.item_drop_equip_min; ratemax = battle_config.item_drop_equip_max; } else if (type == 6) { - rate = battle_config.item_rate_card; + rate = battle_config.item_rate_card * atoi(str[30+i*2]) / 100; ratemin = battle_config.item_drop_card_min; ratemax = battle_config.item_drop_card_max; } else { - rate = battle_config.item_rate_common; + rate = battle_config.item_rate_common * atoi(str[30+i*2]) / 100; ratemin = battle_config.item_drop_common_min; ratemax = battle_config.item_drop_common_max; } - if (battle_config.item_rate_details == 1) { //ドロップレート詳細項目が1の時 レート=x/100倍 - if (rate < 10) - rate = rate * battle_config.item_rate_1/100; - else if (rate >= 10 && rate < 100) - rate = rate * battle_config.item_rate_10/100; - else if (rate >= 100 && rate < 1000) - rate = rate * battle_config.item_rate_100/100; - else rate = rate * battle_config.item_rate_1000/100; - } - else if (battle_config.item_rate_details == 2) { //ドロップレート詳細項目が2の時 レート=x/100倍 min max 指定 - if (rate >= 1 && rate < 10) { - if (rate * battle_config.item_rate_1/100 < battle_config.item_rate_1_min) - rate = battle_config.item_rate_1_min; - else if (rate * battle_config.item_rate_1/100 > battle_config.item_rate_1_max) - rate = battle_config.item_rate_1_max; - else rate = rate * battle_config.item_rate_1/100; - } - else if (rate >= 10 && rate < 100) { - if (rate * battle_config.item_rate_10/100 < battle_config.item_rate_10_min) - rate = battle_config.item_rate_10_min; - else if (rate * battle_config.item_rate_10/100 > battle_config.item_rate_10_max) - rate = battle_config.item_rate_10_max; - else rate = rate * battle_config.item_rate_10/100; - } - else if (rate >= 100 && rate < 1000) { - if (rate * battle_config.item_rate_100/100 < battle_config.item_rate_100_min) - rate = battle_config.item_rate_100_min; - else if (rate * battle_config.item_rate_100/100 > battle_config.item_rate_100_max) - rate = battle_config.item_rate_100_max; - else rate = rate * battle_config.item_rate_100/100; - } - else if (rate >= 1000) { - if (rate * battle_config.item_rate_1000/100 < battle_config.item_rate_1000_min) - rate = battle_config.item_rate_1000_min; - else if (rate * battle_config.item_rate_1000/100 > battle_config.item_rate_1000_max) - rate = battle_config.item_rate_1000_max; - else rate = rate * battle_config.item_rate_1000/100; - } - } - rate = rate * atoi(str[30+i*2])/100; - rate = (rate < ratemin)? ratemin: (rate > ratemax)? ratemax: rate; - mob_db[class_].dropitem[i].p = rate; + mob_db[class_].dropitem[i].p = (rate < ratemin) ? ratemin : (rate > ratemax) ? ratemax: rate; } // MVP EXP Bonus, Chance: MEXP,ExpPer mob_db[class_].mexp=atoi(str[49])*battle_config.mvp_exp_rate/100; @@ -4421,14 +4387,30 @@ static int mob_read_sqldb(void) 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_].base_exp = atoi(str[6]); + if (mob_db[class_].base_exp <= 0) + mob_db[class_].base_exp = 0; + else if (mob_db[class_].base_exp * battle_config.base_exp_rate / 100 > 1000000000 || + mob_db[class_].base_exp * battle_config.base_exp_rate / 100 < 0) + mob_db[class_].base_exp = 1000000000; + else { + mob_db[class_].base_exp = mob_db[class_].base_exp * battle_config.base_exp_rate / 100; + if (mob_db[class_].base_exp < 1) + mob_db[class_].base_exp = 1; + } + mob_db[class_].job_exp = atoi(str[7]); + if (mob_db[class_].job_exp <= 0) + mob_db[class_].job_exp = 0; + else if (mob_db[class_].job_exp * battle_config.job_exp_rate / 100 > 1000000000 || + mob_db[class_].job_exp * battle_config.job_exp_rate / 100 < 0) + mob_db[class_].job_exp = 1000000000; + else { + mob_db[class_].job_exp = mob_db[class_].job_exp * battle_config.job_exp_rate / 100; + if (mob_db[class_].job_exp < 1) + 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]); @@ -4456,33 +4438,32 @@ static int mob_read_sqldb(void) 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; + rate = battle_config.item_rate_heal * atoi(str[30+i*2]) / 100; ratemin = battle_config.item_drop_heal_min; ratemax = battle_config.item_drop_heal_max; } else if (type == 2) { - rate = battle_config.item_rate_use; + rate = battle_config.item_rate_use * atoi(str[30+i*2]) / 100; ratemin = battle_config.item_drop_use_min; ratemax = battle_config.item_drop_use_max; // End } else if (type == 4 || type == 5 || type == 8) { // Changed to include Pet Equip - rate = battle_config.item_rate_equip; + rate = battle_config.item_rate_equip * atoi(str[30+i*2]) / 100; ratemin = battle_config.item_drop_equip_min; ratemax = battle_config.item_drop_equip_max; } else if (type == 6) { - rate = battle_config.item_rate_card; + rate = battle_config.item_rate_card * atoi(str[30+i*2]) / 100; ratemin = battle_config.item_drop_card_min; ratemax = battle_config.item_drop_card_max; } else { - rate = battle_config.item_rate_common; + rate = battle_config.item_rate_common * atoi(str[30+i*2]) / 100; 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_].dropitem[i].p = (rate < ratemin) ? ratemin : (rate > ratemax) ? ratemax: rate; } // MVP EXP Bonus, Chance: MEXP,ExpPer mob_db[class_].mexp=atoi(str[49])*battle_config.mvp_exp_rate/100; diff --git a/src/map/pc.c b/src/map/pc.c index 20f5d8854..3110726d2 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -2768,7 +2768,7 @@ int pc_show_steal(struct block_list *bl,va_list ap) int pc_steal_item(struct map_session_data *sd,struct block_list *bl) { if(sd != NULL && bl != NULL && bl->type == BL_MOB) { - int i,skill,rate,itemid,flag, count; + int i,skill,itemid,flag, count; struct mob_data *md; md=(struct mob_data *)bl; if(!md->state.steal_flag && mob_db[md->class_].mexp <= 0 && !(mob_db[md->class_].mode&0x20) && @@ -2789,10 +2789,8 @@ int pc_steal_item(struct map_session_data *sd,struct block_list *bl) if(itemid > 0 && itemdb_type(itemid) != 6) { - rate = (mob_db[md->class_].dropitem[i].p / battle_config.item_rate_common * 100 * skill)/100; - rate += sd->add_steal_rate; - - if(rand()%10000 < rate) + //fixed rate. From Freya [Lupus] + if (rand() % 10000 < ((mob_db[md->class_].dropitem[i].p * skill) / 100 + sd->add_steal_rate)) { struct item tmp_item; memset(&tmp_item,0,sizeof(tmp_item)); |