diff options
author | Inkfish <Inkfish@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2010-02-06 05:08:37 +0000 |
---|---|---|
committer | Inkfish <Inkfish@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2010-02-06 05:08:37 +0000 |
commit | 2ba08eae75f05d5a81494c7e3b98286796635cb3 (patch) | |
tree | 0039320850c6553383cb3b028273588b4ce66ef8 /src/map | |
parent | 78b321140807eae39e03b79b20c87e21677515f0 (diff) | |
download | hercules-2ba08eae75f05d5a81494c7e3b98286796635cb3.tar.gz hercules-2ba08eae75f05d5a81494c7e3b98286796635cb3.tar.bz2 hercules-2ba08eae75f05d5a81494c7e3b98286796635cb3.tar.xz hercules-2ba08eae75f05d5a81494c7e3b98286796635cb3.zip |
2010/02/06
* Added official packet to display received expirience. (info provided by papkil)
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@14240 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map')
-rw-r--r-- | src/map/clif.c | 26 | ||||
-rw-r--r-- | src/map/clif.h | 1 | ||||
-rw-r--r-- | src/map/mob.c | 4 | ||||
-rw-r--r-- | src/map/npc.c | 4 | ||||
-rw-r--r-- | src/map/party.c | 2 | ||||
-rw-r--r-- | src/map/pc.c | 11 | ||||
-rw-r--r-- | src/map/pc.h | 2 | ||||
-rw-r--r-- | src/map/script.c | 2 | ||||
-rw-r--r-- | src/map/skill.c | 6 |
9 files changed, 45 insertions, 13 deletions
diff --git a/src/map/clif.c b/src/map/clif.c index ab43524e8..f9fd3ffca 100644 --- a/src/map/clif.c +++ b/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; +} + /*========================================== * パケットデバッグ *------------------------------------------*/ @@ -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, }; diff --git a/src/map/clif.h b/src/map/clif.h index 512be8c3d..2a7007e2b 100644 --- a/src/map/clif.h +++ b/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); diff --git a/src/map/mob.c b/src/map/mob.c index 803453718..de9b66ba1 100644 --- a/src/map/mob.c +++ b/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. diff --git a/src/map/npc.c b/src/map/npc.c index a5512eefc..e629848fe 100644 --- a/src/map/npc.c +++ b/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); } } diff --git a/src/map/party.c b/src/map/party.c index be54455d7..207e6c297 100644 --- a/src/map/party.c +++ b/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); } diff --git a/src/map/pc.c b/src/map/pc.c index 068e6ce8f..0df3cda48 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -4743,9 +4743,8 @@ static void pc_calcexp(struct map_session_data *sd, unsigned int *base_exp, unsi /*========================================== * ??値取得 *------------------------------------------*/ -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; diff --git a/src/map/pc.h b/src/map/pc.h index 7a6afd78c..65d21739a 100644 --- a/src/map/pc.h +++ b/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 *); diff --git a/src/map/script.c b/src/map/script.c index 6ef06c2a2..640fa6bdb 100644 --- a/src/map/script.c +++ b/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; } diff --git a/src/map/skill.c b/src/map/skill.c index 4f991272f..336d93975 100644 --- a/src/map/skill.c +++ b/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); |