diff options
Diffstat (limited to 'src/map')
-rw-r--r-- | src/map/battle.c | 4 | ||||
-rw-r--r-- | src/map/battle.h | 4 | ||||
-rw-r--r-- | src/map/clif.c | 21 | ||||
-rw-r--r-- | src/map/mob.c | 10 |
4 files changed, 24 insertions, 15 deletions
diff --git a/src/map/battle.c b/src/map/battle.c index fe693d1ec..e446e8376 100644 --- a/src/map/battle.c +++ b/src/map/battle.c @@ -3670,7 +3670,7 @@ static const struct battle_data_short { { "max_exp_gain_rate", &battle_config.max_exp_gain_rate }, // [Skotlex] { "backstab_bow_penalty", &battle_config.backstab_bow_penalty }, { "night_at_start", &battle_config.night_at_start }, // added by [Yor] - { "show_mob_hp", &battle_config.show_mob_hp }, // [Valaris] + { "show_mob_info", &battle_config.show_mob_info }, // [Valaris] { "ban_spoof_namer", &battle_config.ban_spoof_namer }, // added by [Yor] { "hack_info_GM_level", &battle_config.hack_info_GM_level }, // added by [Yor] { "any_warp_GM_min_level", &battle_config.any_warp_GM_min_level }, // added by [Yor] @@ -4103,7 +4103,7 @@ void battle_set_defaults() { battle_config.night_at_start = 0; // added by [Yor] battle_config.day_duration = 2*60*60*1000; // added by [Yor] (2 hours) battle_config.night_duration = 30*60*1000; // added by [Yor] (30 minutes) - battle_config.show_mob_hp = 0; // [Valaris] + battle_config.show_mob_info = 0; battle_config.ban_spoof_namer = 5; // added by [Yor] (default: 5 minutes) battle_config.hack_info_GM_level = 60; // added by [Yor] (default: 60, GM level) battle_config.any_warp_GM_min_level = 20; // added by [Yor] diff --git a/src/map/battle.h b/src/map/battle.h index fec0a9025..f5eb6e666 100644 --- a/src/map/battle.h +++ b/src/map/battle.h @@ -302,8 +302,8 @@ extern struct Battle_Config { unsigned short pk_mode;
unsigned short pk_level_range;
- unsigned short manner_system;
- unsigned short show_mob_hp; // end additions [Valaris]
+ unsigned short manner_system; // end additions [Valaris]
+ unsigned short show_mob_info;
unsigned short agi_penalty_count_lv;
unsigned short vit_penalty_count_lv;
diff --git a/src/map/clif.c b/src/map/clif.c index a1942d5fc..f60594160 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -7852,15 +7852,24 @@ int clif_charnameack (int fd, struct block_list *bl) WBUFB(buf,30) = 0;
memcpy(WBUFP(buf,54), md->guardian_data->guild_name, NAME_LENGTH);
memcpy(WBUFP(buf,78), md->guardian_data->castle->castle_name, NAME_LENGTH);
- } else if (battle_config.show_mob_hp) {
- char mobhp[50];
+ } else if (battle_config.show_mob_info) {
+ char mobhp[50], *str_p = mobhp;
+
WBUFW(buf, 0) = cmd = 0x195;
- sprintf(mobhp, "HP: %u/%u", md->status.hp, md->status.max_hp);
+ if (battle_config.show_mob_info&4)
+ str_p += sprintf(str_p, "Lv. %d |", md->level);
+ if (battle_config.show_mob_info&1)
+ str_p += sprintf(str_p, "HP: %u/%u |", md->status.hp, md->status.max_hp);
+ if (battle_config.show_mob_info&2)
+ str_p += sprintf(str_p, "HP: %d%% |", 100*md->status.hp/md->status.max_hp);
//Even thought mobhp ain't a name, we send it as one so the client
//can parse it. [Skotlex]
- memcpy(WBUFP(buf,30), mobhp, NAME_LENGTH);
- WBUFB(buf,54) = 0;
- memcpy(WBUFP(buf,78), mobhp, NAME_LENGTH);
+ if (str_p != mobhp) {
+ *(str_p-2) = '\0'; //Remove trailing space + pipe.
+ memcpy(WBUFP(buf,30), mobhp, NAME_LENGTH);
+ WBUFB(buf,54) = 0;
+ memcpy(WBUFP(buf,78), mobhp, NAME_LENGTH);
+ }
}
}
break;
diff --git a/src/map/mob.c b/src/map/mob.c index 005994e58..67c44574d 100644 --- a/src/map/mob.c +++ b/src/map/mob.c @@ -1584,7 +1584,7 @@ void mob_damage(struct mob_data *md, struct block_list *src, int damage) if(md->guardian_data && md->guardian_data->number < MAX_GUARDIANS) // guardian hp update [Valaris] (updated by [Skotlex]) md->guardian_data->castle->guardian[md->guardian_data->number].hp = md->status.hp; - if (battle_config.show_mob_hp) + if (battle_config.show_mob_info&3) clif_charnameack (0, &md->bl); if (!src) @@ -2185,7 +2185,7 @@ void mob_revive(struct mob_data *md, unsigned int hp) clif_spawn(&md->bl); skill_unit_move(&md->bl,tick,1); mobskill_use(md, tick, MSC_SPAWN); - if (battle_config.show_mob_hp) + if (battle_config.show_mob_info&3) clif_charnameack (0, &md->bl); } @@ -2303,8 +2303,8 @@ int mob_class_change (struct mob_data *md, int class_) if(md->lootitem == NULL && md->db->status.mode&MD_LOOTER) md->lootitem=(struct item *)aCalloc(LOOTITEM_SIZE,sizeof(struct item)); - if (battle_config.show_mob_hp) - clif_charnameack(0, &md->bl); + //Need to update name display. + clif_charnameack(0, &md->bl); return 0; } @@ -2319,7 +2319,7 @@ void mob_heal(struct mob_data *md,unsigned int heal) // guardian hp update [Valaris] (updated by [Skotlex]) md->guardian_data->castle->guardian[md->guardian_data->number].hp = md->status.hp; - if (battle_config.show_mob_hp) + if (battle_config.show_mob_info&3) clif_charnameack (0, &md->bl); } |