Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable HP bar on Emperium and MVP by default #2821

Merged
merged 1 commit into from Dec 15, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 6 additions & 3 deletions conf/map/battle/monster.conf
Expand Up @@ -239,10 +239,13 @@ mvp_tomb_enabled: true
// Default: 10000 (10 seconds)
mvp_tomb_spawn_delay: 10000

// Show hp bar on monsters? (Note 1)
// Show hp bar on monsters? (Note 3)
// NOTE: only works on client 2012-04-04aRagexeRE onwards
// (Default: true)
show_monster_hp_bar: true
// 1 = Show hp bar on all monsters except Emperium and MVP
// 2 = Enable hp bar on Emperium
// 4 = Enable hp bar on MVP
// (Default: 1)
show_monster_hp_bar: 1

// Whether or not the size of specially summoned mobs influences experience, drop rates,
// and stats. The rates will be doubled for large mobs, and halved for small ones.
Expand Down
2 changes: 1 addition & 1 deletion src/map/battle.c
Expand Up @@ -7441,7 +7441,7 @@ static const struct battle_data {
{ "mob_icewall_walk_block", &battle_config.mob_icewall_walk_block, 75, 0, 255, },
{ "boss_icewall_walk_block", &battle_config.boss_icewall_walk_block, 0, 0, 255, },
{ "features/roulette", &battle_config.feature_roulette, 1, 0, 1, },
{ "show_monster_hp_bar", &battle_config.show_monster_hp_bar, 1, 0, 1, },
{ "show_monster_hp_bar", &battle_config.show_monster_hp_bar, 1, 0, 1|2|4, },
{ "fix_warp_hit_delay_abuse", &battle_config.fix_warp_hit_delay_abuse, 0, 0, 1, },
{ "costume_refine_def", &battle_config.costume_refine_def, 1, 0, 1, },
{ "shadow_refine_def", &battle_config.shadow_refine_def, 1, 0, 1, },
Expand Down
26 changes: 23 additions & 3 deletions src/map/clif.c
Expand Up @@ -1155,7 +1155,7 @@ static void clif_set_unit_idle(struct block_list *bl, struct map_session_data *t
p.font = (sd) ? sd->status.font : 0;
#endif
#if PACKETVER >= 20120221
if (battle_config.show_monster_hp_bar && bl->type == BL_MOB && status_get_hp(bl) < status_get_max_hp(bl)) {
if (clif->show_monster_hp_bar(bl)) {
p.maxHP = status_get_max_hp(bl);
p.HP = status_get_hp(bl);
} else {
Expand Down Expand Up @@ -1313,7 +1313,7 @@ static void clif_spawn_unit(struct block_list *bl, enum send_target target)
p.font = (sd) ? sd->status.font : 0;
#endif
#if PACKETVER >= 20120221
if (battle_config.show_monster_hp_bar && bl->type == BL_MOB && status_get_hp(bl) < status_get_max_hp(bl)) {
if (clif->show_monster_hp_bar(bl)) {
p.maxHP = status_get_max_hp(bl);
p.HP = status_get_hp(bl);
} else {
Expand Down Expand Up @@ -1417,7 +1417,7 @@ static void clif_set_unit_walking(struct block_list *bl, struct map_session_data
p.font = (sd) ? sd->status.font : 0;
#endif
#if PACKETVER >= 20120221
if (battle_config.show_monster_hp_bar && bl->type == BL_MOB && status_get_hp(bl) < status_get_max_hp(bl)) {
if (clif->show_monster_hp_bar(bl)) {
p.maxHP = status_get_max_hp(bl);
p.HP = status_get_hp(bl);
} else {
Expand Down Expand Up @@ -20388,6 +20388,25 @@ static void clif_monster_hp_bar(struct mob_data *md, struct map_session_data *sd
#endif
}

static bool clif_show_monster_hp_bar(struct block_list *bl)
{
nullpo_ret(bl);

if (bl->type != BL_MOB)
return false;

const struct mob_data *md = BL_UCCAST(BL_MOB, bl);
if (status_get_hp(bl) < status_get_max_hp(bl)) {
if ((battle->bc->show_monster_hp_bar & 1) != 0 && md->class_ != MOBID_EMPELIUM && (md->status.mode & MD_BOSS) == 0)
return true;
if ((battle->bc->show_monster_hp_bar & 2) != 0 && md->class_ == MOBID_EMPELIUM)
return true;
if ((battle->bc->show_monster_hp_bar & 4) != 0 && (md->status.mode & MD_BOSS) != 0 && md->class_ != MOBID_EMPELIUM)
return true;
}
return false;
}

/* [Ind/Hercules] placeholder for unsupported incoming packets (avoids server disconnecting client) */
static void clif_parse_dull(int fd, struct map_session_data *sd)
{
Expand Down Expand Up @@ -24713,6 +24732,7 @@ void clif_defaults(void)
clif->itemname_ack = clif_itemname_ack;
clif->unknownname_ack = clif_unknownname_ack;
clif->monster_hp_bar = clif_monster_hp_bar;
clif->show_monster_hp_bar = clif_show_monster_hp_bar;
clif->hpmeter = clif_hpmeter;
clif->hpmeter_single = clif_hpmeter_single;
clif->hpmeter_sub = clif_hpmeter_sub;
Expand Down
3 changes: 2 additions & 1 deletion src/map/clif.h
Expand Up @@ -980,7 +980,8 @@ struct clif_interface {
void (*skillname_ack) (int fd, struct block_list *bl);
void (*itemname_ack) (int fd, struct block_list *bl);
void (*unknownname_ack) (int fd, struct block_list *bl);
void (*monster_hp_bar) ( struct mob_data* md, struct map_session_data *sd );
void (*monster_hp_bar) (struct mob_data *md, struct map_session_data *sd);
bool (*show_monster_hp_bar) (struct block_list *bl);
int (*hpmeter) (struct map_session_data *sd);
void (*hpmeter_single) (int fd, int id, unsigned int hp, unsigned int maxhp);
int (*hpmeter_sub) (struct block_list *bl, va_list ap);
Expand Down
4 changes: 2 additions & 2 deletions src/map/mob.c
Expand Up @@ -2379,7 +2379,7 @@ static void mob_damage(struct mob_data *md, struct block_list *src, int damage)

#if PACKETVER >= 20131223
// Resend ZC_NOTIFY_MOVEENTRY to Update the HP
if (battle_config.show_monster_hp_bar)
if (clif->show_monster_hp_bar(&md->bl))
clif->set_unit_walking(&md->bl, NULL, unit->bl2ud(&md->bl), AREA);
#endif

Expand Down Expand Up @@ -3116,7 +3116,7 @@ static void mob_heal(struct mob_data *md, unsigned int heal)
clif->blname_ack(0, &md->bl);
#if PACKETVER >= 20131223
// Resend ZC_NOTIFY_MOVEENTRY to Update the HP
if (battle_config.show_monster_hp_bar)
if (clif->show_monster_hp_bar(&md->bl))
clif->set_unit_walking(&md->bl, NULL, unit->bl2ud(&md->bl), AREA);
#endif

Expand Down