Forráskód Böngészése

2010/02/06
* Added official packet to display received expirience. (info provided by papkil)

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@14240 54d463be-8e91-2dee-dedb-b68131a5f0ec

Inkfish 15 éve
szülő
commit
27801bb67f
12 módosított fájl, 49 hozzáadás és 15 törlés
  1. 2 0
      Changelog-Trunk.txt
  2. 1 1
      conf/battle/exp.conf
  3. 1 1
      db/packet_db.txt
  4. 25 1
      src/map/clif.c
  5. 1 0
      src/map/clif.h
  6. 2 2
      src/map/mob.c
  7. 2 2
      src/map/npc.c
  8. 1 1
      src/map/party.c
  9. 9 2
      src/map/pc.c
  10. 1 1
      src/map/pc.h
  11. 1 1
      src/map/script.c
  12. 3 3
      src/map/skill.c

+ 2 - 0
Changelog-Trunk.txt

@@ -3,6 +3,8 @@ Date	Added
 AS OF SVN REV. 5091, WE ARE NOW USING TRUNK.  ALL UNTESTED BUGFIXES/FEATURES GO INTO TRUNK.
 IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
 
+2010/02/06
+	* Added official packet to display received expirience. [Inkfish]
 2010/01/30
 	* Added support for PACKETVER 20100105, which updates the vending related packets on this and later clients. [Skotlex]
 2010/01/28

+ 1 - 1
conf/battle/exp.conf

@@ -92,7 +92,7 @@ death_penalty_job: 100
 zeny_penalty: 0
 
 // Will display experience gained from killing a monster. (Note 1)
-disp_experience: no
+disp_experience: yes
 
 // Will display zeny earned (from mobs, trades, etc) (Note 1)
 disp_zeny: no

+ 1 - 1
db/packet_db.txt

@@ -1428,7 +1428,7 @@ packet_ver: 25
 
 //2009-10-27aRagexeRE
 //0x07f5,6
-//0x07f6,14
+0x07f6,14
 
 //2009-11-03aRagexeRE
 //0x07f7,0

+ 25 - 1
src/map/clif.c

@@ -13455,6 +13455,30 @@ void clif_party_show_picker(struct map_session_data * sd, struct item * item_dat
 #endif
 }
 
+// Display gain exp
+// type = 1 -> base_exp
+// type = 2 -> job_exp
+// flag = 0 -> normal exp gain/lost
+// flag = 1 -> quest exp gain/lost
+void clif_displayexp(struct map_session_data *sd, unsigned int exp, char type, bool quest)
+{
+	int fd;
+
+	nullpo_retv(sd);
+
+	fd = sd->fd;
+
+	WFIFOHEAD(fd, packet_len(0x7f6));
+	WFIFOW(fd,0) = 0x7f6;
+	WFIFOL(fd,2) = sd->bl.id;
+	WFIFOL(fd,6) = exp;
+	WFIFOW(fd,10) = type;
+	WFIFOW(fd,12) = quest?1:0;// Normal exp is shown in yellow, quest exp is shown in purple.
+	WFIFOSET(fd,packet_len(0x7f6));
+
+    return;
+}
+
 /*==========================================
  * ƒpƒPƒbƒgƒfƒoƒbƒO
  *------------------------------------------*/
@@ -13846,7 +13870,7 @@ static int packetdb_readdb(void)
 	    6,  2, -1,  4,  4,  4,  4,  8,  8,268,  6,  8,  6, 54, 30, 54,
 #endif
 	    0,  0,  0,  0,  0,  8,  8, 32, -1,  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, 14,  0,  0,  0,  0,  0,  0,  0,  0,  0,
 	 //#0x800
 	    0, -1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
 	};

+ 1 - 0
src/map/clif.h

@@ -413,6 +413,7 @@ void clif_quest_delete(struct map_session_data * sd, int quest_id);
 void clif_quest_update_status(struct map_session_data * sd, int quest_id, bool active); 
 void clif_quest_update_objective(struct map_session_data * sd, struct quest * qd, int index); 
 void clif_quest_show_event(struct map_session_data *sd, struct block_list *bl, short state, short color);
+void clif_displayexp(struct map_session_data *sd, unsigned int exp, char type, bool quest);
 
 int clif_send(const uint8* buf, int len, struct block_list* bl, enum send_target type);
 int do_final_clif(void);

+ 2 - 2
src/map/mob.c

@@ -2151,7 +2151,7 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type)
 			if(base_exp || job_exp)
 			{
 				if( md->dmglog[i].flag != 2 || battle_config.pet_attack_exp_to_master )
-					pc_gainexp(tmpsd[i], &md->bl, base_exp, job_exp);
+					pc_gainexp(tmpsd[i], &md->bl, base_exp, job_exp, false);
 			}
 			if(zeny) // zeny from mobs [Valaris]
 				pc_getzeny(tmpsd[i], zeny);
@@ -2320,7 +2320,7 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type)
 
 		clif_mvp_effect(mvp_sd);
 		clif_mvp_exp(mvp_sd,mexp);
-		pc_gainexp(mvp_sd, &md->bl, mexp,0);
+		pc_gainexp(mvp_sd, &md->bl, mexp,0, false);
 		log_mvp[1] = mexp;
 		if(map[m].flag.nomvploot || type&1)
 			; //No drops.

+ 2 - 2
src/map/npc.c

@@ -1331,7 +1331,7 @@ int npc_buylist(struct map_session_data* sd, int n, unsigned short* item_list)
 			z = z * (double)skill * (double)battle_config.shop_exp/10000.;
 			if( z < 1 )
 				z = 1;
-			pc_gainexp(sd,NULL,0,(int)z);
+			pc_gainexp(sd,NULL,0,(int)z, false);
 		}
 	}
 
@@ -1404,7 +1404,7 @@ int npc_selllist(struct map_session_data* sd, int n, unsigned short* item_list)
 			z = z * (double)skill * (double)battle_config.shop_exp/10000.;
 			if (z < 1)
 				z = 1;
-			pc_gainexp(sd,NULL,0,(int)z);
+			pc_gainexp(sd,NULL,0,(int)z, false);
 		}
 	}
 		

+ 1 - 1
src/map/party.c

@@ -906,7 +906,7 @@ int party_exp_share(struct party_data* p, struct block_list* src, unsigned int b
 
 	for (i = 0; i < c; i++)
 	{
-		pc_gainexp(sd[i], src, base_exp, job_exp);
+		pc_gainexp(sd[i], src, base_exp, job_exp, false);
 		if (zeny) // zeny from mobs [Valaris]
 			pc_getzeny(sd[i],zeny);
 	}

+ 9 - 2
src/map/pc.c

@@ -4743,9 +4743,8 @@ static void pc_calcexp(struct map_session_data *sd, unsigned int *base_exp, unsi
 /*==========================================
  * ??’lŽæ“¾
  *------------------------------------------*/
-int pc_gainexp(struct map_session_data *sd, struct block_list *src, unsigned int base_exp,unsigned int job_exp)
+int pc_gainexp(struct map_session_data *sd, struct block_list *src, unsigned int base_exp,unsigned int job_exp,bool quest)
 {
-	char output[256];
 	float nextbp=0, nextjp=0;
 	unsigned int nextb=0, nextj=0;
 	nullpo_retr(0, sd);
@@ -4808,9 +4807,17 @@ int pc_gainexp(struct map_session_data *sd, struct block_list *src, unsigned int
 	}
 
 	if(sd->state.showexp){
+#if PACKETVER >= 20091027
+		if(base_exp)
+			clif_displayexp(sd, base_exp, 1, quest);
+		if(job_exp)
+			clif_displayexp(sd, job_exp,  2, quest);
+#else
+		char output[256];
 		sprintf(output,
 			"Experience Gained Base:%u (%.2f%%) Job:%u (%.2f%%)",base_exp,nextbp*(float)100,job_exp,nextjp*(float)100);
 		clif_disp_onlyself(sd,output,strlen(output));
+#endif
 	}
 
 	return 1;

+ 1 - 1
src/map/pc.h

@@ -610,7 +610,7 @@ unsigned int pc_maxbaselv(struct map_session_data *sd);
 unsigned int pc_maxjoblv(struct map_session_data *sd);
 int pc_checkbaselevelup(struct map_session_data *sd);
 int pc_checkjoblevelup(struct map_session_data *sd);
-int pc_gainexp(struct map_session_data*,struct block_list*,unsigned int,unsigned int);
+int pc_gainexp(struct map_session_data*,struct block_list*,unsigned int,unsigned int, bool);
 unsigned int pc_nextbaseexp(struct map_session_data *);
 unsigned int pc_thisbaseexp(struct map_session_data *);
 unsigned int pc_nextjobexp(struct map_session_data *);

+ 1 - 1
src/map/script.c

@@ -7422,7 +7422,7 @@ BUILDIN_FUNC(getexp)
 	base = (int) cap_value(base * bonus, 0, INT_MAX);
 	job = (int) cap_value(job * bonus, 0, INT_MAX);
 
-	pc_gainexp(sd, NULL, base, job);
+	pc_gainexp(sd, NULL, base, job, true);
 
 	return 0;
 }

+ 3 - 3
src/map/skill.c

@@ -3245,7 +3245,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in
 				heal_get_jobexp = heal_get_jobexp * battle_config.heal_exp / 100;
 				if (heal_get_jobexp <= 0)
 					heal_get_jobexp = 1;
-				pc_gainexp (sd, bl, 0, heal_get_jobexp);
+				pc_gainexp (sd, bl, 0, heal_get_jobexp, false);
 			}
 		}
 		break;
@@ -3321,7 +3321,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in
 						if (jexp < 1) jexp = 1;
 					}
 					if(exp > 0 || jexp > 0)
-						pc_gainexp (sd, bl, exp, jexp);
+						pc_gainexp (sd, bl, exp, jexp, false);
 				}
 			}
 		}
@@ -3433,7 +3433,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in
 		break;
 	case SA_LEVELUP:
 		clif_skill_nodamage(src,bl,skillid,skilllv,1);
-		if (sd && pc_nextbaseexp(sd)) pc_gainexp(sd, NULL, pc_nextbaseexp(sd) * 10 / 100, 0);
+		if (sd && pc_nextbaseexp(sd)) pc_gainexp(sd, NULL, pc_nextbaseexp(sd) * 10 / 100, 0, false);
 		break;
 	case SA_INSTANTDEATH:
 		clif_skill_nodamage(src,bl,skillid,skilllv,1);