diff --git a/conf/msg_conf/map_msg.conf b/conf/msg_conf/map_msg.conf index 43eb97de1a..54d2f869fd 100644 --- a/conf/msg_conf/map_msg.conf +++ b/conf/msg_conf/map_msg.conf @@ -751,7 +751,7 @@ 716: Your '%s' is now: %d // MVP EXP reward message -717: Congratulations! You are the MVP! Your reward EXP Points are %u !! +717: Congratulations! You are the MVP! Your reward EXP Points are %llu !! // @showrate 718: Personal rate information is not displayed now. @@ -1332,7 +1332,7 @@ 1244: ATK:%d~%d Range:%d~%d~%d Size:%s Race: %s Element: %s (Lv:%d) 1245: Drops: 1246: This monster has no drops. -1247: MVP Bonus EXP:%u +1247: MVP Bonus EXP:%llu 1248: MVP Items: 1249: This monster has no MVP prizes. diff --git a/conf/msg_conf/map_msg_chn.conf b/conf/msg_conf/map_msg_chn.conf index 1ae738cedd..ab9c966408 100644 --- a/conf/msg_conf/map_msg_chn.conf +++ b/conf/msg_conf/map_msg_chn.conf @@ -1139,7 +1139,7 @@ 1244: 物理攻擊力:%d~%d 攻擊範圍:%d~%d~%d 體型:%s 種族: %s 屬性: %s (Lv:%d) 1245: 掉落: 1246: 此魔物不掉落道具. -1247: MVP額外經驗值:%u +1247: MVP額外經驗值:%llu 1248: MVP額外獎勵道具: 1249: 此魔物無MVP額外獎勵道具. diff --git a/conf/msg_conf/map_msg_frn.conf b/conf/msg_conf/map_msg_frn.conf index b363ce718c..76daad5e70 100644 --- a/conf/msg_conf/map_msg_frn.conf +++ b/conf/msg_conf/map_msg_frn.conf @@ -1152,7 +1152,7 @@ 1244: ATK:%d~%d Range:%d~%d~%d Size:%s Race: %s Elment: %s (Lv:%d) 1245: Drops: 1246: Ce monstre n'a pas de drops. -1247: MVP Bonus EXP:%u +1247: MVP Bonus EXP:%llu 1248: MVP Items: 1249: Ce monstre n'a pas de Prix spcial MVP. diff --git a/conf/msg_conf/map_msg_idn.conf b/conf/msg_conf/map_msg_idn.conf index 5fbe88c8dc..8d8395873e 100644 --- a/conf/msg_conf/map_msg_idn.conf +++ b/conf/msg_conf/map_msg_idn.conf @@ -743,9 +743,6 @@ 715: Point Shop: '%s' 716: '%s' milikmu saat ini: %d -//Item Group -717: [%s] mendapatkan [%s] dari '%s' - //@showrate 718: Informasi mengenai rate pribadi tidak akan ditampilkan lagi. 719: Informasi mengenai rate pribadi akan ditampilkan kembali. @@ -1243,7 +1240,7 @@ 1244: ATK:%d~%d Jarak:%d~%d~%d Ukuran:%s Race: %s Elemen: %s (Lv:%d) 1245: Barang yang dijatuhkan: 1246: Monster ini tidak menjatuhkan barang. -1247: Bonus EXP MVP:%u +1247: Bonus EXP MVP:%llu 1248: Item MVP: 1249: Monster ini tidak memiliki bonus MVP. diff --git a/conf/msg_conf/map_msg_por.conf b/conf/msg_conf/map_msg_por.conf index 01d0e808fb..1f97b672c8 100644 --- a/conf/msg_conf/map_msg_por.conf +++ b/conf/msg_conf/map_msg_por.conf @@ -755,7 +755,7 @@ 715: Lista de loja de pontos: '%s' 716: Seu '%s' agora é: %d // MVP EXP reward message -717: Parabéns! Você é o MVP! Sua recompensa EXP Points are %u !! +717: Parabéns! Você é o MVP! Sua recompensa EXP Points are %llu !! // @showrate 718: As informações de taxa pessoal não são exibidas agora. @@ -1322,7 +1322,7 @@ 1244: ATQ:%d~%d Alcance:%d~%d~%d Tamanho:%s Raça: %s Elemento: %s (Nv:%d) 1245: Drops: 1246: Este monstro não possui drops. -1247: EXP Bônus MVP:%u +1247: EXP Bônus MVP:%llu 1248: Itens MVP: 1249: Este monstro não possui prêmios MVP. diff --git a/conf/msg_conf/map_msg_rus.conf b/conf/msg_conf/map_msg_rus.conf index c77ec70f20..873f4acd1c 100644 --- a/conf/msg_conf/map_msg_rus.conf +++ b/conf/msg_conf/map_msg_rus.conf @@ -1152,7 +1152,7 @@ 1244: ATK:%d~%d :%d~%d~%d :%s : %s : %s (.:%d) 1245: : 1246: . -1247: MVP :%u +1247: MVP :%llu 1248: MVP : 1249: MVP . diff --git a/conf/msg_conf/map_msg_spn.conf b/conf/msg_conf/map_msg_spn.conf index 7ffcb2b43a..5e00c55543 100644 --- a/conf/msg_conf/map_msg_spn.conf +++ b/conf/msg_conf/map_msg_spn.conf @@ -745,7 +745,7 @@ 716: Tu '%s' ahora es: %d // MVP EXP reward message -717: Enhorabuena! Eres todo un MVP! Puntos de experiencia obtenidos: %u!! +717: Enhorabuena! Eres todo un MVP! Puntos de experiencia obtenidos: %llu!! // @showrate 718: La informacin de ratio personal no se mostrar. @@ -1291,7 +1291,7 @@ 1244: ATK:%d~%d Rango:%d~%d~%d Tamao:%s Raza: %s Elemento: %s (Nv:%d) 1245:Objetos: 1246: Este monstruo no tiene ningn objeto. -1247:Bono de EXP MVP:%u +1247:Bono de EXP MVP:%llu 1248:Objetos MVP: 1249: Este monstruo no tiene ningnobjeto de MVP. diff --git a/conf/msg_conf/map_msg_tha.conf b/conf/msg_conf/map_msg_tha.conf index 573007d0af..116b507ec9 100644 --- a/conf/msg_conf/map_msg_tha.conf +++ b/conf/msg_conf/map_msg_tha.conf @@ -1145,7 +1145,7 @@ 1244: ATK:%d~%d Range:%d~%d~%d Size:%s Race: %s Element: %s (Lv:%d) 1245: Drops: 1246: Monster բͧ. -1247: MVP Bonus EXP:%u +1247: MVP Bonus EXP:%llu 1248: MVP Items: 1249: Monster բͧҧ MVP. diff --git a/src/map/atcommand.cpp b/src/map/atcommand.cpp index 35b245f64f..424e92c732 100644 --- a/src/map/atcommand.cpp +++ b/src/map/atcommand.cpp @@ -7396,7 +7396,7 @@ ACMD_FUNC(mobinfo) } #endif // stats - if (mob->mexp) + if( mob->get_bosstype() == BOSSTYPE_MVP ) sprintf(atcmd_output, msg_txt(sd,1240), mob->name, mob->jname, mob->sprite, mob->vd.class_); // MVP Monster: '%s'/'%s'/'%s' (%d) else sprintf(atcmd_output, msg_txt(sd,1241), mob->name, mob->jname, mob->sprite, mob->vd.class_); // Monster: '%s'/'%s'/'%s' (%d) @@ -7451,9 +7451,9 @@ ACMD_FUNC(mobinfo) else if (j % 3 != 0) clif_displaymessage(fd, atcmd_output); // mvp - if (mob->mexp) { + if( mob->get_bosstype() == BOSSTYPE_MVP ){ float mvppercent, mvpremain; - sprintf(atcmd_output, msg_txt(sd,1247), mob->mexp); // MVP Bonus EXP:%u + sprintf(atcmd_output, msg_txt(sd,1247), mob->mexp); // MVP Bonus EXP:%llu clif_displaymessage(fd, atcmd_output); strcpy(atcmd_output, msg_txt(sd,1248)); // MVP Items: mvpremain = 100.0; //Remaining drop chance for official mvp drop mode diff --git a/src/map/clif.cpp b/src/map/clif.cpp index 8ddac3f72b..56ceb0c5f2 100644 --- a/src/map/clif.cpp +++ b/src/map/clif.cpp @@ -1169,7 +1169,7 @@ static void clif_set_unit_idle( struct block_list* bl, bool walking, send_target p.maxHP = -1; p.HP = -1; } - p.isBoss = ( bl->type == BL_MOB && ( ( ( TBL_MOB *)bl )->db->mexp > 0 ) ) ? 1 : 0; + p.isBoss = ( bl->type == BL_MOB ) ? ( (mob_data*)bl )->get_bosstype() : BOSSTYPE_NONE; #endif #if PACKETVER >= 20150513 p.body = vd->body_style; @@ -1304,7 +1304,7 @@ static void clif_spawn_unit( struct block_list *bl, enum send_target target ){ p.HP = -1; } - p.isBoss = ( bl->type == BL_MOB && ( ( ( TBL_MOB *)bl)->db->mexp > 0 ) ) ? 1 : 0; + p.isBoss = ( bl->type == BL_MOB ) ? ( (mob_data*)bl )->get_bosstype() : BOSSTYPE_NONE; #endif #if PACKETVER >= 20150513 p.body = vd->body_style; @@ -1406,7 +1406,7 @@ static void clif_set_unit_walking( struct block_list *bl, struct map_session_dat p.HP = -1; } - p.isBoss = ( bl->type == BL_MOB && (((TBL_MOB*)bl)->db->mexp > 0) ) ? 1 : 0; + p.isBoss = ( bl->type == BL_MOB ) ? ( (mob_data*)bl )->get_bosstype() : BOSSTYPE_NONE; #endif #if PACKETVER >= 20150513 p.body = vd->body_style; @@ -8381,7 +8381,7 @@ void clif_mvp_item( struct map_session_data *sd, t_itemid nameid ){ /// MVP EXP reward message (ZC_MVP_GETTING_SPECIAL_EXP). /// 010b .L -void clif_mvp_exp(struct map_session_data *sd, unsigned int exp) { +void clif_mvp_exp(struct map_session_data *sd, t_exp exp) { #if PACKETVER >= 20131223 // Kro remove this packet [Napster] if (battle_config.mvp_exp_reward_message) { char e_msg[CHAT_SIZE_MAX]; @@ -8396,7 +8396,7 @@ void clif_mvp_exp(struct map_session_data *sd, unsigned int exp) { fd = sd->fd; WFIFOHEAD(fd, packet_len(0x10b)); WFIFOW(fd,0) = 0x10b; - WFIFOL(fd,2) = min(exp, (unsigned int)INT32_MAX); + WFIFOL(fd,2) = (uint32)min( exp, MAX_EXP ); WFIFOSET(fd, packet_len(0x10b)); #endif } diff --git a/src/map/clif.hpp b/src/map/clif.hpp index 351ed0d63d..816e2bd88e 100644 --- a/src/map/clif.hpp +++ b/src/map/clif.hpp @@ -765,7 +765,7 @@ void clif_item_skill(struct map_session_data *sd,uint16 skill_id,uint16 skill_lv void clif_mvp_effect(struct map_session_data *sd); void clif_mvp_item(struct map_session_data *sd, t_itemid nameid); -void clif_mvp_exp(struct map_session_data *sd, unsigned int exp); +void clif_mvp_exp(struct map_session_data *sd, t_exp exp); void clif_mvp_noitem(struct map_session_data* sd); void clif_changed_dir(struct block_list *bl, enum send_target target); diff --git a/src/map/map.cpp b/src/map/map.cpp index 3e5de44e22..0d00f50ac3 100644 --- a/src/map/map.cpp +++ b/src/map/map.cpp @@ -2926,7 +2926,7 @@ int map_removemobs_sub(struct block_list *bl, va_list ap) if( !battle_config.mob_remove_damaged && md->status.hp < md->status.max_hp ) return 0; // is a mvp - if( md->db->mexp > 0 ) + if( md->get_bosstype() == BOSSTYPE_MVP ) return 0; unit_free(&md->bl,CLR_OUTSIGHT); diff --git a/src/map/mob.cpp b/src/map/mob.cpp index 932895b4d9..60ac1b8894 100644 --- a/src/map/mob.cpp +++ b/src/map/mob.cpp @@ -386,6 +386,24 @@ struct view_data * mob_get_viewdata(int mob_id) return &db->vd; } +e_mob_bosstype mob_db::get_bosstype(){ + if( status_has_mode( &this->status, MD_MVP ) ){ + return BOSSTYPE_MVP; + }else if( this->status.class_ == CLASS_BOSS ){ + return BOSSTYPE_MINIBOSS; + }else{ + return BOSSTYPE_NONE; + } +} + +e_mob_bosstype mob_data::get_bosstype(){ + if( this->db != nullptr ){ + return this->db->get_bosstype(); + }else{ + return BOSSTYPE_NONE; + } +} + /** * Create unique view data associated to a spawned monster. * @param md: Mob to adjust @@ -572,7 +590,7 @@ bool mob_ksprotected (struct block_list *src, struct block_list *target) if( mapdata->flag[MF_ALLOWKS] || mapdata_flag_ks(mapdata) ) return false; // Ignores GVG, PVP and AllowKS map flags - if( md->db->mexp || md->master_id ) + if( md->get_bosstype() == BOSSTYPE_MVP || md->master_id ) return false; // MVP, Slaves mobs ignores KS if( (sce = md->sc.data[SC_KSPROTECTED]) == nullptr ) @@ -2414,7 +2432,7 @@ void mob_log_damage(struct mob_data *md, struct block_list *src, int damage) md->dmglog[i].id = char_id; md->dmglog[i].flag= flag; - if(md->db->mexp) + if( md->get_bosstype() == BOSSTYPE_MVP ) pc_damage_log_add(map_charid2sd(char_id),md->bl.id); break; } @@ -2431,7 +2449,7 @@ void mob_log_damage(struct mob_data *md, struct block_list *src, int damage) md->dmglog[minpos].flag= flag; md->dmglog[minpos].dmg = damage; - if(md->db->mexp) + if( md->get_bosstype() == BOSSTYPE_MVP ) pc_damage_log_add(map_charid2sd(char_id),md->bl.id); } } @@ -2644,7 +2662,7 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type) if(battle_config.zeny_from_mobs && md->level) { // zeny calculation moblv + random moblv [Valaris] zeny=(int) ((md->level+rnd()%md->level)*per*bonus/100.); - if(md->db->mexp > 0) + if( md->get_bosstype() == BOSSTYPE_MVP ) zeny*=rnd()%250; } @@ -2728,7 +2746,7 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type) pc_getzeny(tmpsd[i], zeny, LOG_TYPE_PICKDROP_MONSTER, NULL); } - if( md->db->mexp ) + if( md->get_bosstype() == BOSSTYPE_MVP ) pc_damage_log_clear(tmpsd[i],md->bl.id); } @@ -2916,36 +2934,36 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type) add_timer(tick + (!battle_config.delay_battle_damage?500:0), mob_delay_item_drop, 0, (intptr_t)dlist); } - if(mvp_sd && md->db->mexp > 0 && !md->special_state.ai) { + if( mvp_sd && md->get_bosstype() == BOSSTYPE_MVP ){ t_itemid log_mvp_nameid = 0; t_exp log_mvp_exp = 0; - unsigned int mexp; - struct item item; - double exp; + + clif_mvp_effect( mvp_sd ); //mapflag: noexp check [Lorky] - if (map_getmapflag(m, MF_NOBASEEXP) || type&2) - exp =1; - else { - exp = md->db->mexp; + if( md->db->mexp > 0 && !( map_getmapflag( m, MF_NOBASEEXP ) || type&2 ) ){ + log_mvp_exp = md->db->mexp; #if defined(RENEWAL_EXP) int penalty = pc_level_penalty_mod( mvp_sd, PENALTY_MVP_EXP, nullptr, md ); - exp = cap_value( apply_rate( exp, penalty ), 0, MAX_EXP ); + log_mvp_exp = cap_value( apply_rate( log_mvp_exp, penalty ), 0, MAX_EXP ); #endif - if (count > 1) - exp += exp*(battle_config.exp_bonus_attacker*(count-1))/100.; //[Gengar] + if( battle_config.exp_bonus_attacker > 0 && count > 1 ){ + if( count > battle_config.exp_bonus_max_attacker ){ + count = battle_config.exp_bonus_max_attacker; + } + + log_mvp_exp += log_mvp_exp * ( battle_config.exp_bonus_attacker * ( count - 1 ) ) / 100; + } + + log_mvp_exp = cap_value( log_mvp_exp, 1, MAX_EXP ); + + clif_mvp_exp( mvp_sd, log_mvp_exp ); + pc_gainexp( mvp_sd, &md->bl, log_mvp_exp, 0, 0 ); } - mexp = (unsigned int)cap_value(exp, 1, UINT_MAX); - - clif_mvp_effect(mvp_sd); - clif_mvp_exp(mvp_sd,mexp); - pc_gainexp(mvp_sd, &md->bl, mexp,0, 0); - log_mvp_exp = mexp; - if( !(map_getmapflag(m, MF_NOMVPLOOT) || type&1) ) { //Order might be random depending on item_drop_mvp_mode config setting struct s_mob_drop mdrop[MAX_MVP_DROP_TOTAL]; @@ -2995,7 +3013,7 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type) continue; } - memset(&item,0,sizeof(item)); + struct item item = {}; item.nameid=mdrop[i].nameid; item.identify= itemdb_isidentified(item.nameid); clif_mvp_item(mvp_sd,item.nameid); @@ -5410,8 +5428,8 @@ static void mob_drop_ratio_adjust(void){ ratemin = battle_config.item_drop_treasure_min; ratemax = battle_config.item_drop_treasure_max; } else { - bool is_mvp = status_has_mode(&mob->status,MD_MVP); - bool is_boss = (mob->status.class_ == CLASS_BOSS); + bool is_mvp = mob->get_bosstype() == BOSSTYPE_MVP; + bool is_boss = mob->get_bosstype() == BOSSTYPE_MINIBOSS; is_treasurechest = false; diff --git a/src/map/mob.hpp b/src/map/mob.hpp index bc513338c6..aad2637f54 100644 --- a/src/map/mob.hpp +++ b/src/map/mob.hpp @@ -129,6 +129,12 @@ enum e_random_monster_flags { RMF_ALL = 0xFF, ///< Apply all flags }; +enum e_mob_bosstype : uint8{ + BOSSTYPE_NONE, + BOSSTYPE_MINIBOSS, + BOSSTYPE_MVP +}; + struct mob_skill { enum MobSkillState state; uint16 skill_id,skill_lv; @@ -180,6 +186,8 @@ struct mob_db { unsigned int option; int maxskill; struct mob_skill skill[MAX_MOBSKILL]; + + e_mob_bosstype get_bosstype(); }; struct mob_data { @@ -248,6 +256,8 @@ struct mob_data { * MvP Tombstone NPC ID **/ int tomb_nid; + + e_mob_bosstype get_bosstype(); }; class MobAvailDatabase : public YamlDatabase {