Преглед на файлове

Added support for the new monster purple hp bar packet (packetver >= 20120404), make sure to toggle /monsterhp in the client to show the bar. Special Thanks to EvilPuncker and scriptor for the packet structure

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@16669 54d463be-8e91-2dee-dedb-b68131a5f0ec
shennetsind преди 12 години
родител
ревизия
111a20dbc4
променени са 4 файла, в които са добавени 28 реда и са изтрити 2 реда
  1. 1 0
      db/packet_db.txt
  2. 20 1
      src/map/clif.c
  3. 1 0
      src/map/clif.h
  4. 6 1
      src/map/mob.c

+ 1 - 0
db/packet_db.txt

@@ -1756,6 +1756,7 @@ packet_ver: 30
 0x0908,5
 0x08D7,28,battlegroundreg,2:4 //Added to prevent disconnections
 0x08CF,10 //Amulet spirits
+0x0977,14 //Monster HP Bar
 
 //Add new packets here
 //packet_ver: 31

+ 20 - 1
src/map/clif.c

@@ -16221,6 +16221,19 @@ void clif_snap( struct block_list *bl, short x, short y ) {
 	clif_send(buf,packet_len(0x8d2),bl,AREA);
 }
 
+void clif_monster_hp_bar( struct mob_data* md, int fd ) {
+#if PACKETVER >= 20120404	
+	WFIFOHEAD(fd,packet_len(0x977));
+	
+	WFIFOW(fd,0)  = 0x977;
+	WFIFOL(fd,2)  = md->bl.id;
+	WFIFOL(fd,6)  = md->status.hp;
+	WFIFOL(fd,10) = md->status.max_hp;
+	
+	WFIFOSET(fd,packet_len(0x977));
+#endif
+}
+
 /*==========================================
  * Main client packet processing function
  *------------------------------------------*/
@@ -16615,7 +16628,13 @@ static int packetdb_readdb(void)
 		0,  0,  0,  0,  0,  0,  0,  0,  5,  0,  0,  0,  0,  0,  0,  0,
 		0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
 		0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-		0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,	
+		0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+	//#0x0940
+		0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+		0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+		0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+		0,  0,  0,  0,  0,  0,  0, 14,  0,  0,  0,  0,  0,  0,  0,  0,
+
 	};
 	struct {
 		void (*func)(int, struct map_session_data *);

+ 1 - 0
src/map/clif.h

@@ -739,6 +739,7 @@ void clif_elemental_updatestatus(struct map_session_data *sd, int type);
 void clif_talisman(struct map_session_data *sd, short type);
 
 void clif_snap( struct block_list *bl, short x, short y );
+void clif_monster_hp_bar( struct mob_data* md, int fd );
 
 /**
  * Color Table

+ 6 - 1
src/map/mob.c

@@ -2081,10 +2081,15 @@ void mob_damage(struct mob_data *md, struct block_list *src, int damage)
 
 	if (battle_config.show_mob_info&3)
 		clif_charnameack (0, &md->bl);
-
+	
 	if (!src)
 		return;
 	
+#if PACKETVER >= 20120404
+	if( src->type == BL_PC && !(md->status.mode&MD_BOSS) )
+		clif_monster_hp_bar(md, ((TBL_PC*)src)->fd);
+#endif
+	
 	if( md->special_state.ai == 2 ) {//LOne WOlf explained that ANYONE can trigger the marine countdown skill. [Skotlex]
 		md->state.alchemist = 1;
 		mobskill_use(md, gettick(), MSC_ALCHEMIST);