From b307ae800477e426c1d122cfe3fed5e09ac781d5 Mon Sep 17 00:00:00 2001 From: aleos89 Date: Sat, 30 Jan 2016 11:20:20 -0500 Subject: [PATCH] Added MD_FIXED_ITEMDROP mob mode * When active the mob's drops are not affected by item drop modifiers. --- doc/mob_db_mode_list.txt | 56 ++++++++++++++++++++----------------- src/map/atcommand.c | 8 +++--- src/map/mob.c | 60 +++++++++++++++++++++------------------- src/map/party.c | 2 +- src/map/pc.c | 5 +++- src/map/pc.h | 2 +- src/map/status.h | 49 ++++++++++++++++---------------- 7 files changed, 97 insertions(+), 85 deletions(-) diff --git a/doc/mob_db_mode_list.txt b/doc/mob_db_mode_list.txt index 12d2a0991d..36ea84c659 100644 --- a/doc/mob_db_mode_list.txt +++ b/doc/mob_db_mode_list.txt @@ -11,31 +11,31 @@ Bit Legend ------------------------------------------------------------------------------- -MD_CANMOVE | 0x000001 | 1 -MD_LOOTER | 0x000002 | 2 -MD_AGGRESSIVE | 0x000004 | 4 -MD_ASSIST | 0x000008 | 8 -MD_CASTSENSOR_IDLE | 0x000010 | 16 -MD_BOSS | 0x000020 | 32 -MD_PLANT | 0x000040 | 64 -MD_CANATTACK | 0x000080 | 128 -MD_DETECTOR | 0x000100 | 256 -MD_CASTSENSOR_CHASE | 0x000200 | 512 -MD_CHANGECHASE | 0x000400 | 1024 -MD_ANGRY | 0x000800 | 2048 -MD_CHANGETARGET_MELEE | 0x001000 | 4096 -MD_CHANGETARGET_CHASE | 0x002000 | 8192 -MD_TARGETWEAK | 0x004000 | 16384 -MD_RANDOMTARGET | 0x008000 | 32768 -MD_IGNOREMELEE | 0x010000 | 65536 -MD_IGNOREMAGIC | 0x020000 | 131072 -MD_IGNORERANGED | 0x040000 | 262144 -MD_MVP | 0x080000 | 524288 -MD_IGNOREMISC | 0x100000 | 1048576 -MD_KNOCKBACK_IMMUNE | 0x200000 | 2097152 -MD_NORANDOM_WALK | 0x400000 | 4194304 -MD_NOCAST_SKILL | 0x800000 | 8388608 - +MD_CANMOVE | 0x0000001 | 1 +MD_LOOTER | 0x0000002 | 2 +MD_AGGRESSIVE | 0x0000004 | 4 +MD_ASSIST | 0x0000008 | 8 +MD_CASTSENSOR_IDLE | 0x0000010 | 16 +MD_BOSS | 0x0000020 | 32 +MD_PLANT | 0x0000040 | 64 +MD_CANATTACK | 0x0000080 | 128 +MD_DETECTOR | 0x0000100 | 256 +MD_CASTSENSOR_CHASE | 0x0000200 | 512 +MD_CHANGECHASE | 0x0000400 | 1024 +MD_ANGRY | 0x0000800 | 2048 +MD_CHANGETARGET_MELEE | 0x0001000 | 4096 +MD_CHANGETARGET_CHASE | 0x0002000 | 8192 +MD_TARGETWEAK | 0x0004000 | 16384 +MD_RANDOMTARGET | 0x0008000 | 32768 +MD_IGNOREMELEE | 0x0010000 | 65536 +MD_IGNOREMAGIC | 0x0020000 | 131072 +MD_IGNORERANGED | 0x0040000 | 262144 +MD_MVP | 0x0080000 | 524288 +MD_IGNOREMISC | 0x0100000 | 1048576 +MD_KNOCKBACK_IMMUNE | 0x0200000 | 2097152 +MD_NORANDOM_WALK | 0x0400000 | 4194304 +MD_NOCAST_SKILL | 0x0800000 | 8388608 +MD_FIXED_ITEMDROP | 0x1000000 | 16777216 Explanation for modes ------------------------------------------------------------------------------- @@ -97,6 +97,12 @@ Ignore Misc: The mob will take 1 HP damage from "none" attack type. Knockback Immune: The mob will be unable to be knocked back. +No Random Walk: The mob will not randomly walk around while in the + idle state. + +No Cast Skill: The mob will be unable to cast skills. + +Fixed Item Drop: The mob's drops are not affected by item drop modifiers. Aegis Mob Types ------------------------------------------------------------------------------- diff --git a/src/map/atcommand.c b/src/map/atcommand.c index bef6977945..c96e004f81 100644 --- a/src/map/atcommand.c +++ b/src/map/atcommand.c @@ -7065,8 +7065,8 @@ ACMD_FUNC(mobinfo) #ifdef RENEWAL_EXP if( battle_config.atcommand_mobinfo_type ) { - base_exp = base_exp * pc_level_penalty_mod(sd, mob->lv, mob->status.class_, 1) / 100; - job_exp = job_exp * pc_level_penalty_mod(sd, mob->lv, mob->status.class_, 1) / 100; + base_exp = base_exp * pc_level_penalty_mod(sd, mob->lv, mob->status.class_, mob->status.mode, 1) / 100; + job_exp = job_exp * pc_level_penalty_mod(sd, mob->lv, mob->status.class_, mob->status.mode, 1) / 100; } #endif #ifdef VIP_ENABLE @@ -7106,7 +7106,7 @@ ACMD_FUNC(mobinfo) #ifdef RENEWAL_DROP if( battle_config.atcommand_mobinfo_type ) { - droprate = droprate * pc_level_penalty_mod(sd, mob->lv, mob->status.class_, 2) / 100; + droprate = droprate * pc_level_penalty_mod(sd, mob->lv, mob->status.class_, mob->status.mode, 2) / 100; if (droprate <= 0 && !battle_config.drop_rate0item) droprate = 1; } @@ -7649,7 +7649,7 @@ ACMD_FUNC(whodrops) #ifdef RENEWAL_DROP if( battle_config.atcommand_mobinfo_type ) - dropchance = dropchance * pc_level_penalty_mod(sd, mob_db(item_data->mob[j].id)->lv, mob_db(item_data->mob[j].id)->status.class_, 2) / 100; + dropchance = dropchance * pc_level_penalty_mod(sd, mob_db(item_data->mob[j].id)->lv, mob_db(item_data->mob[j].id)->status.class_, mob_db(item_data->mob[j].id)->status.mode, 2) / 100; #endif #ifdef VIP_ENABLE // Display item rate increase for VIP. diff --git a/src/map/mob.c b/src/map/mob.c index 36e00ec19d..05fba13529 100644 --- a/src/map/mob.c +++ b/src/map/mob.c @@ -2401,7 +2401,7 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type) if(base_exp || job_exp) { if( md->dmglog[i].flag != MDLF_PET || battle_config.pet_attack_exp_to_master ) { #ifdef RENEWAL_EXP - int rate = pc_level_penalty_mod(tmpsd[i], md->level, md->status.class_, 1); + int rate = pc_level_penalty_mod(tmpsd[i], md->level, md->status.class_, md->status.mode, 1); if (rate != 100) { base_exp = (unsigned int)cap_value(apply_rate(base_exp, rate), 1, UINT_MAX); job_exp = (unsigned int)cap_value(apply_rate(job_exp, rate), 1, UINT_MAX); @@ -2434,9 +2434,9 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type) struct item_data* it = NULL; int drop_rate; #ifdef RENEWAL_DROP - int drop_modifier = mvp_sd ? pc_level_penalty_mod(mvp_sd, md->level, md->status.class_, 2) : - second_sd ? pc_level_penalty_mod(second_sd, md->level, md->status.class_, 2): - third_sd ? pc_level_penalty_mod(third_sd, md->level, md->status.class_, 2) : + int drop_modifier = mvp_sd ? pc_level_penalty_mod(mvp_sd, md->level, md->status.class_, md->status.mode, 2) : + second_sd ? pc_level_penalty_mod(second_sd, md->level, md->status.class_, md->status.mode, 2): + third_sd ? pc_level_penalty_mod(third_sd, md->level, md->status.class_, md->status.mode, 2) : 100;/* no player was attached, we dont use any modifier (100 = rates are not touched) */ #endif dlist->m = md->bl.m; @@ -2459,33 +2459,35 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type) drop_rate = 1; } - // change drops depending on monsters size [Valaris] - if (battle_config.mob_size_influence) { - if (md->special_state.size == SZ_MEDIUM && drop_rate >= 2) - drop_rate /= 2; - else if( md->special_state.size == SZ_BIG) - drop_rate *= 2; - } + if (!md->status.mode&MD_FIXED_ITEMDROP) { + // change drops depending on monsters size [Valaris] + if (battle_config.mob_size_influence) { + if (md->special_state.size == SZ_MEDIUM && drop_rate >= 2) + drop_rate /= 2; + else if( md->special_state.size == SZ_BIG) + drop_rate *= 2; + } - if (src) { - //Drops affected by luk as a fixed increase [Valaris] - if (battle_config.drops_by_luk) - drop_rate += status_get_luk(src)*battle_config.drops_by_luk/100; - //Drops affected by luk as a % increase [Skotlex] - if (battle_config.drops_by_luk2) - drop_rate += (int)(0.5+drop_rate*status_get_luk(src)*battle_config.drops_by_luk2/10000.); - } - if (sd && battle_config.pk_mode && - (int)(md->level - sd->status.base_level) >= 20) - drop_rate = (int)(drop_rate*1.25); // pk_mode increase drops if 20 level difference [Valaris] + if (src) { + //Drops affected by luk as a fixed increase [Valaris] + if (battle_config.drops_by_luk) + drop_rate += status_get_luk(src)*battle_config.drops_by_luk/100; + //Drops affected by luk as a % increase [Skotlex] + if (battle_config.drops_by_luk2) + drop_rate += (int)(0.5+drop_rate*status_get_luk(src)*battle_config.drops_by_luk2/10000.); + } + if (sd && battle_config.pk_mode && + (int)(md->level - sd->status.base_level) >= 20) + drop_rate = (int)(drop_rate*1.25); // pk_mode increase drops if 20 level difference [Valaris] - // Increase drop rate if user has SC_ITEMBOOST - if (sd && sd->sc.data[SC_ITEMBOOST]) // now rig the drop rate to never be over 90% unless it is originally >90%. - drop_rate = max(drop_rate,cap_value((int)(0.5+drop_rate*(sd->sc.data[SC_ITEMBOOST]->val1)/100.),0,9000)); - // Increase item drop rate for VIP. - if (battle_config.vip_drop_increase && (sd && pc_isvip(sd))) { - drop_rate += (int)(0.5 + (drop_rate * battle_config.vip_drop_increase) / 100); - drop_rate = min(drop_rate,10000); //cap it to 100% + // Increase drop rate if user has SC_ITEMBOOST + if (sd && sd->sc.data[SC_ITEMBOOST]) // now rig the drop rate to never be over 90% unless it is originally >90%. + drop_rate = max(drop_rate,cap_value((int)(0.5+drop_rate*(sd->sc.data[SC_ITEMBOOST]->val1)/100.),0,9000)); + // Increase item drop rate for VIP. + if (battle_config.vip_drop_increase && (sd && pc_isvip(sd))) { + drop_rate += (int)(0.5 + (drop_rate * battle_config.vip_drop_increase) / 100); + drop_rate = min(drop_rate,10000); //cap it to 100% + } } #ifdef RENEWAL_DROP if( drop_modifier != 100 ) { diff --git a/src/map/party.c b/src/map/party.c index cfe055b800..88f91ad154 100644 --- a/src/map/party.c +++ b/src/map/party.c @@ -1071,7 +1071,7 @@ int party_exp_share(struct party_data* p, struct block_list* src, unsigned int b if (!md) return 0; - rate = pc_level_penalty_mod(sd[i], md->db->lv, md->db->status.class_, 1); + rate = pc_level_penalty_mod(sd[i], md->db->lv, md->db->status.class_, md->db->status.mode, 1); base_exp = (unsigned int)cap_value(base_exp_bonus * rate / 100, 1, UINT_MAX); job_exp = (unsigned int)cap_value(job_exp_bonus * rate / 100, 1, UINT_MAX); } diff --git a/src/map/pc.c b/src/map/pc.c index 3b7cd9bf9e..28aeae3126 100755 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -10393,13 +10393,16 @@ void pc_delspiritcharm(struct map_session_data *sd, int count, int type) * Renewal EXP/Itemdrop rate modifier base on level penalty * 1=exp 2=itemdrop *------------------------------------------*/ -int pc_level_penalty_mod(struct map_session_data *sd, int mob_level, uint32 mob_class, int type) +int pc_level_penalty_mod(struct map_session_data *sd, int mob_level, uint32 mob_class, enum e_mode mode, int type) { int diff, rate = 100, i; int tmp; nullpo_ret(sd); + if (type == 2 && mode&MD_FIXED_ITEMDROP) + return rate; + diff = mob_level - sd->status.base_level; if( diff < 0 ) diff --git a/src/map/pc.h b/src/map/pc.h index f796d6c5a5..4a89e3cfb4 100644 --- a/src/map/pc.h +++ b/src/map/pc.h @@ -1221,6 +1221,6 @@ void pc_show_questinfo(struct map_session_data *sd); void pc_show_questinfo_reinit(struct map_session_data *sd); #if defined(RENEWAL_DROP) || defined(RENEWAL_EXP) -int pc_level_penalty_mod(struct map_session_data *sd, int mob_level, uint32 mob_class, int type); +int pc_level_penalty_mod(struct map_session_data *sd, int mob_level, uint32 mob_class, enum e_mode mode, int type); #endif #endif /* _PC_H_ */ diff --git a/src/map/status.h b/src/map/status.h index e6035a456e..9b847a80e8 100644 --- a/src/map/status.h +++ b/src/map/status.h @@ -1672,30 +1672,31 @@ extern int current_equip_card_id; /// Mode definitions to clear up code reading. [Skotlex] enum e_mode { - MD_CANMOVE = 0x000001, - MD_LOOTER = 0x000002, - MD_AGGRESSIVE = 0x000004, - MD_ASSIST = 0x000008, - MD_CASTSENSOR_IDLE = 0x000010, - MD_BOSS = 0x000020, - MD_PLANT = 0x000040, - MD_CANATTACK = 0x000080, - MD_DETECTOR = 0x000100, - MD_CASTSENSOR_CHASE = 0x000200, - MD_CHANGECHASE = 0x000400, - MD_ANGRY = 0x000800, - MD_CHANGETARGET_MELEE = 0x001000, - MD_CHANGETARGET_CHASE = 0x002000, - MD_TARGETWEAK = 0x004000, - MD_RANDOMTARGET = 0x008000, - MD_IGNOREMELEE = 0x010000, - MD_IGNOREMAGIC = 0x020000, - MD_IGNORERANGED = 0x040000, - MD_MVP = 0x080000, - MD_IGNOREMISC = 0x100000, - MD_KNOCKBACK_IMMUNE = 0x200000, - MD_NORANDOM_WALK = 0x400000, - MD_NOCAST_SKILL = 0x800000, + MD_CANMOVE = 0x0000001, + MD_LOOTER = 0x0000002, + MD_AGGRESSIVE = 0x0000004, + MD_ASSIST = 0x0000008, + MD_CASTSENSOR_IDLE = 0x0000010, + MD_BOSS = 0x0000020, + MD_PLANT = 0x0000040, + MD_CANATTACK = 0x0000080, + MD_DETECTOR = 0x0000100, + MD_CASTSENSOR_CHASE = 0x0000200, + MD_CHANGECHASE = 0x0000400, + MD_ANGRY = 0x0000800, + MD_CHANGETARGET_MELEE = 0x0001000, + MD_CHANGETARGET_CHASE = 0x0002000, + MD_TARGETWEAK = 0x0004000, + MD_RANDOMTARGET = 0x0008000, + MD_IGNOREMELEE = 0x0010000, + MD_IGNOREMAGIC = 0x0020000, + MD_IGNORERANGED = 0x0040000, + MD_MVP = 0x0080000, + MD_IGNOREMISC = 0x0100000, + MD_KNOCKBACK_IMMUNE = 0x0200000, + MD_NORANDOM_WALK = 0x0400000, + MD_NOCAST_SKILL = 0x0800000, + MD_FIXED_ITEMDROP = 0x1000000, }; #define MD_MASK 0x00FFFF #define ATR_MASK 0xFF0000