From e914c4806f72678babe646c7651bbdbbf78221fd Mon Sep 17 00:00:00 2001 From: shennetsind Date: Wed, 31 Jul 2013 14:19:53 -0300 Subject: Fixed Bug #7453 Added the missing support for conf/battle/gm.conf::atcommand_mobinfo_type on @mobinfo (partially from rathena) Modified @ii to stop always displaying 'monsters dont drop this item' while the configuration is on. Special Thanks to Napster. http://hercules.ws/board/tracker/issue-7453-mobinfo-iteminfo-not-showing-the-correct-information-depending-the-level/ Follow up 2fbec282b9b3eb84f710d5537f70e6bc221187b3 Missing messages.conf entry Signed-off-by: shennetsind --- conf/messages.conf | 3 +++ src/map/atcommand.c | 46 +++++++++++++++++++++++++++++++++++++++------- src/map/mob.c | 8 ++++---- src/map/party.c | 4 +++- src/map/pc.c | 13 ++++--------- src/map/pc.h | 2 +- 6 files changed, 54 insertions(+), 22 deletions(-) diff --git a/conf/messages.conf b/conf/messages.conf index 51815c256..987be40bf 100644 --- a/conf/messages.conf +++ b/conf/messages.conf @@ -1510,5 +1510,8 @@ //src/map/pc.c::pc_isUseitem 1477: Item cannot be open when overweight by 90% +//@homlv +1478: Homun reached its maximum level of '%d' + //Custom translations import: conf/import/msg_conf.txt diff --git a/src/map/atcommand.c b/src/map/atcommand.c index 367025f4f..f25a8f8f6 100644 --- a/src/map/atcommand.c +++ b/src/map/atcommand.c @@ -6656,8 +6656,7 @@ ACMD(mobinfo) } // If monster identifier/name argument is a name - if ((i = mobdb_checkid(atoi(message)))) - { + if ((i = mobdb_checkid(atoi(message)))) { mob_array[0] = mob_db(i); count = 1; } else @@ -6673,17 +6672,32 @@ ACMD(mobinfo) clif->message(fd, atcmd_output); count = MAX_SEARCH; } + for (k = 0; k < count; k++) { + unsigned int job_exp, base_exp; + mob = mob_array[k]; + job_exp = mob->job_exp; + base_exp = mob->base_exp; + +#ifdef RENEWAL_EXP + if( battle_config.atcommand_mobinfo_type ) { + base_exp = base_exp * pc->level_penalty_mod(mob->lv - sd->status.base_level, mob->status.race, mob->status.mode, 1) / 100; + job_exp = job_exp * pc->level_penalty_mod(mob->lv - sd->status.base_level, mob->status.race, mob->status.mode, 1) / 100; + } +#endif + // stats if (mob->mexp) sprintf(atcmd_output, msg_txt(1240), mob->name, mob->jname, mob->sprite, mob->vd.class_); // MVP Monster: '%s'/'%s'/'%s' (%d) else sprintf(atcmd_output, msg_txt(1241), mob->name, mob->jname, mob->sprite, mob->vd.class_); // Monster: '%s'/'%s'/'%s' (%d) clif->message(fd, atcmd_output); - sprintf(atcmd_output, msg_txt(1242), mob->lv, mob->status.max_hp, mob->base_exp, mob->job_exp,MOB_HIT(mob), MOB_FLEE(mob)); // Lv:%d HP:%d Base EXP:%u Job EXP:%u HIT:%d FLEE:%d + + sprintf(atcmd_output, msg_txt(1242), mob->lv, mob->status.max_hp, base_exp, job_exp,MOB_HIT(mob), MOB_FLEE(mob)); // Lv:%d HP:%d Base EXP:%u Job EXP:%u HIT:%d FLEE:%d clif->message(fd, atcmd_output); + sprintf(atcmd_output, msg_txt(1243), // DEF:%d MDEF:%d STR:%d AGI:%d VIT:%d INT:%d DEX:%d LUK:%d mob->status.def, mob->status.mdef,mob->status.str, mob->status.agi, mob->status.vit, mob->status.int_, mob->status.dex, mob->status.luk); @@ -6694,26 +6708,41 @@ ACMD(mobinfo) mob->range2 , mob->range3, msize[mob->status.size], mrace[mob->status.race], melement[mob->status.def_ele], mob->status.ele_lv); clif->message(fd, atcmd_output); + // drops clif->message(fd, msg_txt(1245)); // Drops: strcpy(atcmd_output, " "); j = 0; for (i = 0; i < MAX_MOB_DROP; i++) { int droprate; + if (mob->dropitem[i].nameid <= 0 || mob->dropitem[i].p < 1 || (item_data = itemdb->exists(mob->dropitem[i].nameid)) == NULL) continue; + droprate = mob->dropitem[i].p; + +#ifdef RENEWAL_DROP + if( battle_config.atcommand_mobinfo_type ) { + droprate = droprate * pc->level_penalty_mod(mob->lv - sd->status.base_level, mob->status.race, mob->status.mode, 2) / 100; + + if (droprate <= 0 && !battle_config.drop_rate0item) + droprate = 1; + } +#endif if (item_data->slot) sprintf(atcmd_output2, " - %s[%d] %02.02f%%", item_data->jname, item_data->slot, (float)droprate / 100); else sprintf(atcmd_output2, " - %s %02.02f%%", item_data->jname, (float)droprate / 100); + strcat(atcmd_output, atcmd_output2); + if (++j % 3 == 0) { clif->message(fd, atcmd_output); strcpy(atcmd_output, " "); } } + if (j == 0) clif->message(fd, msg_txt(1246)); // This monster has no drops. else if (j % 3 != 0) @@ -6722,6 +6751,7 @@ ACMD(mobinfo) if (mob->mexp) { sprintf(atcmd_output, msg_txt(1247), mob->mexp); // MVP Bonus EXP:%u clif->message(fd, atcmd_output); + strcpy(atcmd_output, msg_txt(1248)); // MVP Items: j = 0; for (i = 0; i < MAX_MVP_DROP; i++) { @@ -7202,10 +7232,12 @@ ACMD(iteminfo) if (item_data->maxchance == -1) strcpy(atcmd_output, msg_txt(1281)); // - Available in the shops only. - else if (!battle_config.atcommand_mobinfo_type && item_data->maxchance) - sprintf(atcmd_output, msg_txt(1282), (float)item_data->maxchance / 100 ); // - Maximal monsters drop chance: %02.02f%% - else - strcpy(atcmd_output, msg_txt(1283)); // - Monsters don't drop this item. + else if ( !battle_config.atcommand_mobinfo_type ) { + if( item_data->maxchance ) + sprintf(atcmd_output, msg_txt(1282), (float)item_data->maxchance / 100 ); // - Maximal monsters drop chance: %02.02f%% + else + strcpy(atcmd_output, msg_txt(1283)); // - Monsters don't drop this item. + } clif->message(fd, atcmd_output); } diff --git a/src/map/mob.c b/src/map/mob.c index dedd541d9..b181c9b7b 100644 --- a/src/map/mob.c +++ b/src/map/mob.c @@ -2285,7 +2285,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, 1); + int rate = pc->level_penalty_mod(md->level - (tmpsd[i])->status.base_level, md->status.race, md->status.mode, 1); base_exp = (unsigned int)cap_value(base_exp * rate / 100, 1, UINT_MAX); job_exp = (unsigned int)cap_value(job_exp * rate / 100, 1, UINT_MAX); #endif @@ -2313,9 +2313,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, 2) : - second_sd ? pc->level_penalty_mod(second_sd, md, 2): - third_sd ? pc->level_penalty_mod(third_sd, md, 2) : + int drop_modifier = mvp_sd ? pc->level_penalty_mod( md->level - mvp_sd->status.base_level, md->status.race, md->status.mode, 2) : + second_sd ? pc->level_penalty_mod( md->level - second_sd->status.base_level, md->status.race, md->status.mode, 2): + third_sd ? pc->level_penalty_mod( md->level - third_sd->status.base_level, md->status.race, 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; diff --git a/src/map/party.c b/src/map/party.c index cacd016e4..629bf9227 100644 --- a/src/map/party.c +++ b/src/map/party.c @@ -963,7 +963,9 @@ int party_exp_share(struct party_data* p, struct block_list* src, unsigned int b for (i = 0; i < c; i++) { #ifdef RENEWAL_EXP if( !(src && src->type == BL_MOB && ((TBL_MOB*)src)->db->mexp) ){ - int rate = pc->level_penalty_mod(sd[i], (TBL_MOB*)src, 1); + struct mob_data *md = (TBL_MOB*)src; + int rate = pc->level_penalty_mod(md->level - (sd[i])->status.base_level, md->status.race, md->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 9984cb7d7..48172ba5c 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -9609,14 +9609,9 @@ int pc_del_charm(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, struct mob_data *md, int type) +int pc_level_penalty_mod(int diff, unsigned char race, unsigned short mode, int type) { - int diff, rate = 100, i; - - nullpo_ret(sd); - nullpo_ret(md); - - diff = md->level - sd->status.base_level; + int rate = 100, i; if( diff < 0 ) diff = MAX_LEVEL + ( ~diff + 1 ); @@ -9624,8 +9619,8 @@ int pc_level_penalty_mod(struct map_session_data *sd, struct mob_data *md, int t for(i=0; istatus.race != i ){ - if( md->status.mode&MD_BOSS && i < RC_BOSS ) + if( race != i ){ + if( mode&MD_BOSS && i < RC_BOSS ) i = RC_BOSS; else if( i <= RC_BOSS ) continue; diff --git a/src/map/pc.h b/src/map/pc.h index ab6de114e..42bfb56c1 100644 --- a/src/map/pc.h +++ b/src/map/pc.h @@ -954,7 +954,7 @@ struct pc_interface { void (*baselevelchanged) (struct map_session_data *sd); #if defined(RENEWAL_DROP) || defined(RENEWAL_EXP) - int (*level_penalty_mod) (struct map_session_data *sd, struct mob_data * md, int type); + int (*level_penalty_mod) (int diff, unsigned char race, unsigned short mode, int type); #endif }; -- cgit v1.2.3-60-g2f50