Ver Fonte

- Removed setting mob_show_hp, it's been replaced now by mob_show_info, which can be used to specify what kind of info should be displayed from a mob. Current options are two different formats for Hp display, and current level.

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@8644 54d463be-8e91-2dee-dedb-b68131a5f0ec
skotlex há 18 anos atrás
pai
commit
bea0a8c46e
7 ficheiros alterados com 39 adições e 18 exclusões
  1. 4 0
      Changelog-Trunk.txt
  2. 5 0
      conf-tmpl/Changelog.txt
  3. 6 3
      conf-tmpl/battle/monster.conf
  4. 2 2
      src/map/battle.c
  5. 2 2
      src/map/battle.h
  6. 15 6
      src/map/clif.c
  7. 5 5
      src/map/mob.c

+ 4 - 0
Changelog-Trunk.txt

@@ -4,6 +4,10 @@ AS OF SVN REV. 5091, WE ARE NOW USING TRUNK.  ALL UNTESTED BUGFIXES/FEATURES GO
 IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
 
 2006/09/05
+	* Removed setting mob_show_hp, it's been replaced now by mob_show_info,
+	  which can be used to specify what kind of info should be displayed from a
+	  mob. Current options are two different formats for Hp display, and current
+	  level (monster.conf). [Skotlex]
 	* Fixed Signum Crucis Def reduction being 10+2*lv% instead of 10+4*lv%
 	  [Skotlex]
 	* Applied the Ultra Mage's suggestion to have the map server strip trailing

+ 5 - 0
conf-tmpl/Changelog.txt

@@ -1,5 +1,10 @@
 Date	Added
 
+2006/09/05
+	* Removed setting mob_show_hp, it's been replaced now by mob_show_info,
+	  which can be used to specify what kind of info should be displayed from a
+	  mob. Current options are two different formats for Hp display, and current
+	  level (monster.conf). [Skotlex]
 2006/08/31
 	* Added setting attack_walk_delay which specifies whether a character
 	  should (or not) be able to move inmediately after starting a normal attack

+ 6 - 3
conf-tmpl/battle/monster.conf

@@ -150,9 +150,12 @@ mob_changetarget_byskill: no
 // If monster's class is changed will it fully recover HP and SP and Ailments? (Note 1)
 monster_class_change_full_recover: no
 
-// Will display a mob's hp/maxhp when the mouse cursor is over them. (Note 1)
-// Will not display guardian or emperium hp.
-show_mob_hp: no
+// Display some mob info next to their name? (add as needed)
+// (does not works on guardian or emperium)
+// 1: Display mob HP (Hp/MaxHp format)
+// 2: Display mob HP (Percent of full life format)
+// 4: Display mob's level
+show_mob_info: 0
 
 // Zeny from mobs
 zeny_from_mobs: no

+ 2 - 2
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]

+ 2 - 2
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;

+ 15 - 6
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;

+ 5 - 5
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);
 }