Browse Source

> Follow up to r16337 and completed suggestion (tid:76250). Drop and EXP rates now take player and mob level into consideration for specific information commands.
- Added RENEWAL_EXP level penalty mod to @mobinfo.
- Added RENEWAL_DROP level penalty mod that got removed from @mobinfo.
- Added RENEWAL_DROP level penalty mod to @showmobs.
- Enabled atcommand_mobinfo_type by default (needs RENEWAL_EXP or RENEWAL_DROP to be enabled to work).

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@17173 54d463be-8e91-2dee-dedb-b68131a5f0ec

aleos 12 years ago
parent
commit
290638c829
6 changed files with 41 additions and 16 deletions
  1. 3 2
      conf/battle/gm.conf
  2. 21 2
      src/map/atcommand.c
  3. 4 4
      src/map/mob.c
  4. 7 1
      src/map/party.c
  5. 5 6
      src/map/pc.c
  6. 1 1
      src/map/pc.h

+ 3 - 2
conf/battle/gm.conf

@@ -26,7 +26,8 @@ atcommand_max_stat_bypass: no
 // Duration of the ban, in minutes (default: 5). To disable the ban, set 0.
 // Duration of the ban, in minutes (default: 5). To disable the ban, set 0.
 ban_hack_trade: 5
 ban_hack_trade: 5
 
 
-// requires RENEWAL_DROP to be enabled (src/map/config/renewal.h)
+// requires RENEWAL_EXP or RENEWAL_DROP to be enabled (src/map/config/renewal.h)
 // modifies @mobinfo to display the users' real drop rate as per renewal_drop formula
 // modifies @mobinfo to display the users' real drop rate as per renewal_drop formula
 // modifies @iteminfo to not display the minimum item drop rate (since it can't tell the mob level)
 // modifies @iteminfo to not display the minimum item drop rate (since it can't tell the mob level)
-atcommand_mobinfo_type: 0
+// modifies @whodrops to display the users' real drop rate as per renewal_drop formula
+atcommand_mobinfo_type: 1

+ 21 - 2
src/map/atcommand.c

@@ -6649,6 +6649,7 @@ ACMD_FUNC(mobinfo)
 	struct mob_db *mob, *mob_array[MAX_SEARCH];
 	struct mob_db *mob, *mob_array[MAX_SEARCH];
 	int count;
 	int count;
 	int i, j, k;
 	int i, j, k;
+	unsigned int base_exp, job_exp;
 
 
 	memset(atcmd_output, '\0', sizeof(atcmd_output));
 	memset(atcmd_output, '\0', sizeof(atcmd_output));
 	memset(atcmd_output2, '\0', sizeof(atcmd_output2));
 	memset(atcmd_output2, '\0', sizeof(atcmd_output2));
@@ -6678,14 +6679,22 @@ ACMD_FUNC(mobinfo)
 	}
 	}
 	for (k = 0; k < count; k++) {
 	for (k = 0; k < count; k++) {
 		mob = mob_array[k];
 		mob = mob_array[k];
+		base_exp = mob->base_exp;
+		job_exp = mob->job_exp;
 
 
+#ifdef RENEWAL_EXP
+		if( battle_config.atcommand_mobinfo_type ) {
+			base_exp = base_exp * pc_level_penalty_mod(sd, mob->lv, mob->status.race, mob->status.mode, 1) / 100;
+			job_exp = job_exp * pc_level_penalty_mod(sd, mob->lv, mob->status.race, mob->status.mode, 1) / 100;
+		}
+#endif
 		// stats
 		// stats
 		if (mob->mexp)
 		if (mob->mexp)
 			sprintf(atcmd_output, msg_txt(1240), mob->name, mob->jname, mob->sprite, mob->vd.class_); // MVP Monster: '%s'/'%s'/'%s' (%d)
 			sprintf(atcmd_output, msg_txt(1240), mob->name, mob->jname, mob->sprite, mob->vd.class_); // MVP Monster: '%s'/'%s'/'%s' (%d)
 		else
 		else
 			sprintf(atcmd_output, msg_txt(1241), mob->name, mob->jname, mob->sprite, mob->vd.class_); // Monster: '%s'/'%s'/'%s' (%d)
 			sprintf(atcmd_output, msg_txt(1241), mob->name, mob->jname, mob->sprite, mob->vd.class_); // Monster: '%s'/'%s'/'%s' (%d)
 		clif_displaymessage(fd, atcmd_output);
 		clif_displaymessage(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_displaymessage(fd, atcmd_output);
 		clif_displaymessage(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
 		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.def, mob->status.mdef,mob->status.str, mob->status.agi,
@@ -6707,6 +6716,10 @@ ACMD_FUNC(mobinfo)
 				continue;
 				continue;
 			droprate = mob->dropitem[i].p;
 			droprate = mob->dropitem[i].p;
 
 
+#ifdef RENEWAL_DROP
+			if( battle_config.atcommand_mobinfo_type )
+				droprate = droprate * pc_level_penalty_mod(sd, mob->lv, mob->status.race, mob->status.mode, 2) / 100;
+#endif
 			if (item_data->slot)
 			if (item_data->slot)
 				sprintf(atcmd_output2, " - %s[%d]  %02.02f%%", item_data->jname, item_data->slot, (float)droprate / 100);
 				sprintf(atcmd_output2, " - %s[%d]  %02.02f%%", item_data->jname, item_data->slot, (float)droprate / 100);
 			else
 			else
@@ -7221,7 +7234,13 @@ ACMD_FUNC(whodrops)
 
 
 			for (j=0; j < MAX_SEARCH && item_data->mob[j].chance > 0; j++)
 			for (j=0; j < MAX_SEARCH && item_data->mob[j].chance > 0; j++)
 			{
 			{
-				sprintf(atcmd_output, "- %s (%02.02f%%)", mob_db(item_data->mob[j].id)->jname, item_data->mob[j].chance/100.);
+				int dropchance = item_data->mob[j].chance;
+
+#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.race, mob_db(item_data->mob[j].id)->status.mode, 2) / 100;
+#endif
+				sprintf(atcmd_output, "- %s (%02.02f%%)", mob_db(item_data->mob[j].id)->jname, dropchance/100.);
 				clif_displaymessage(fd, atcmd_output);
 				clif_displaymessage(fd, atcmd_output);
 			}
 			}
 		}
 		}

+ 4 - 4
src/map/mob.c

@@ -2289,7 +2289,7 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type)
 			{
 			{
 				if( md->dmglog[i].flag != MDLF_PET || battle_config.pet_attack_exp_to_master ) {
 				if( md->dmglog[i].flag != MDLF_PET || battle_config.pet_attack_exp_to_master ) {
 #ifdef RENEWAL_EXP
 #ifdef RENEWAL_EXP
-					int rate = pc_level_penalty_mod(tmpsd[i], md, 1);
+					int rate = pc_level_penalty_mod(tmpsd[i], md->level, md->status.race, md->status.mode, 1);
 					base_exp = (unsigned int)cap_value(base_exp * rate / 100, 1, UINT_MAX);
 					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);
 					job_exp = (unsigned int)cap_value(job_exp * rate / 100, 1, UINT_MAX);
 #endif
 #endif
@@ -2317,9 +2317,9 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type)
 		struct item_data* it = NULL;
 		struct item_data* it = NULL;
 		int drop_rate;
 		int drop_rate;
 #ifdef RENEWAL_DROP
 #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(mvp_sd, md->level, md->status.race, md->status.mode, 2)   :
+							second_sd ? pc_level_penalty_mod(second_sd, md->level, md->status.race, md->status.mode, 2):
+							third_sd  ? pc_level_penalty_mod(third_sd, md->level, md->status.race, md->status.mode, 2) :
 							100;/* no player was attached, we dont use any modifier (100 = rates are not touched) */
 							100;/* no player was attached, we dont use any modifier (100 = rates are not touched) */
 #endif
 #endif
 		dlist->m = md->bl.m;
 		dlist->m = md->bl.m;

+ 7 - 1
src/map/party.c

@@ -944,7 +944,13 @@ int party_exp_share(struct party_data* p, struct block_list* src, unsigned int b
 	for (i = 0; i < c; i++) {
 	for (i = 0; i < c; i++) {
 #ifdef RENEWAL_EXP
 #ifdef RENEWAL_EXP
 		if( !(src && src->type == BL_MOB && ((TBL_MOB*)src)->db->mexp) ){
 		if( !(src && src->type == BL_MOB && ((TBL_MOB*)src)->db->mexp) ){
-			int rate = pc_level_penalty_mod(sd[i], (TBL_MOB*)src, 1);
+			TBL_MOB *md = BL_CAST(BL_MOB, src);
+			int rate = 0;
+
+			if (!md)
+				return 0;
+
+			rate = pc_level_penalty_mod(sd[i], md->db->lv, md->db->status.race, md->db->status.mode, 1);
 			base_exp = (unsigned int)cap_value(base_exp_bonus * rate / 100, 1, UINT_MAX);
 			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);
 			job_exp = (unsigned int)cap_value(job_exp_bonus * rate / 100, 1, UINT_MAX);
 		}
 		}

+ 5 - 6
src/map/pc.c

@@ -9341,14 +9341,13 @@ int pc_del_talisman(struct map_session_data *sd,int count,int type)
  * Renewal EXP/Itemdrop rate modifier base on level penalty
  * Renewal EXP/Itemdrop rate modifier base on level penalty
  * 1=exp 2=itemdrop
  * 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(struct map_session_data *sd, int mob_level, uint32 mob_race, uint32 mob_mode, int type)
 {
 {
 	int diff, rate = 100, i;
 	int diff, rate = 100, i;
 
 
 	nullpo_ret(sd);
 	nullpo_ret(sd);
-	nullpo_ret(md);
-
-	diff = md->level - sd->status.base_level;
+	
+	diff = mob_level - sd->status.base_level;
 
 
 	if( diff < 0 )
 	if( diff < 0 )
 		diff = MAX_LEVEL + ( ~diff + 1 );
 		diff = MAX_LEVEL + ( ~diff + 1 );
@@ -9356,8 +9355,8 @@ int pc_level_penalty_mod(struct map_session_data *sd, struct mob_data *md, int t
 	for(i=0; i<RC_MAX; i++){
 	for(i=0; i<RC_MAX; i++){
 		int tmp;
 		int tmp;
 
 
-		if( md->status.race != i ){
-			if( md->status.mode&MD_BOSS && i < RC_BOSS )
+		if( mob_race != i ){
+			if( mob_mode&MD_BOSS && i < RC_BOSS )
 				i = RC_BOSS;
 				i = RC_BOSS;
 			else if( i <= RC_BOSS )
 			else if( i <= RC_BOSS )
 				continue;
 				continue;

+ 1 - 1
src/map/pc.h

@@ -927,6 +927,6 @@ int pc_del_talisman(struct map_session_data *sd,int count,int type);
 void pc_baselevelchanged(struct map_session_data *sd);
 void pc_baselevelchanged(struct map_session_data *sd);
 
 
 #if defined(RENEWAL_DROP) || defined(RENEWAL_EXP)
 #if defined(RENEWAL_DROP) || defined(RENEWAL_EXP)
-int pc_level_penalty_mod(struct map_session_data *sd, struct mob_data * md, int type);
+int pc_level_penalty_mod(struct map_session_data *sd, int mob_level, uint32 mob_race, uint32 mob_mode, int type);
 #endif
 #endif
 #endif /* _PC_H_ */
 #endif /* _PC_H_ */