From aa176338c5018b6fcaf24b11a68d40e77b1d2399 Mon Sep 17 00:00:00 2001 From: ai4rei Date: Fri, 26 Nov 2010 07:44:35 +0000 Subject: * Fixed base and job exp not getting reset on (de)leveling through commands (bugreport:85). - Fixed level up related functions not updating client-side exp information, causing the exp percent value display random values. - Fixed party system not getting notified of level-ups through parameter changes. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@14505 54d463be-8e91-2dee-dedb-b68131a5f0ec --- Changelog-Trunk.txt | 3 +++ src/map/atcommand.c | 16 ++++++++-------- src/map/pc.c | 16 +++++++++++++--- 3 files changed, 24 insertions(+), 11 deletions(-) diff --git a/Changelog-Trunk.txt b/Changelog-Trunk.txt index 3f10ba09e..63745b478 100644 --- a/Changelog-Trunk.txt +++ b/Changelog-Trunk.txt @@ -1,6 +1,9 @@ Date Added 2010/11/26 + * Fixed base and job exp not getting reset on (de)leveling through commands (bugreport:85). [Ai4rei] + - Fixed level up related functions not updating client-side exp information, causing the exp percent value display random values. + - Fixed party system not getting notified of level-ups through parameter changes. * Fixed auto-generated statpoint table missing 3 status points (since r1107). [Ai4rei] 2010/11/25 * Too large client packets, which would otherwise cause the client to crash, are now dropped and reported (bugreport:4391). [Ai4rei] diff --git a/src/map/atcommand.c b/src/map/atcommand.c index d48dda0db..41a27bc8a 100644 --- a/src/map/atcommand.c +++ b/src/map/atcommand.c @@ -1777,8 +1777,10 @@ ACMD_FUNC(baselevelup) sd->status.base_level -= (unsigned int)level; clif_displaymessage(fd, msg_txt(22)); // Base level lowered. } + sd->status.base_exp = 0; clif_updatestatus(sd, SP_STATUSPOINT); clif_updatestatus(sd, SP_BASELEVEL); + clif_updatestatus(sd, SP_BASEEXP); clif_updatestatus(sd, SP_NEXTBASEEXP); status_calc_pc(sd, 0); if(sd->status.party_id) @@ -1808,11 +1810,7 @@ ACMD_FUNC(joblevelup) if ((unsigned int)level > pc_maxjoblv(sd) || (unsigned int)level > pc_maxjoblv(sd) - sd->status.job_level) // fix positiv overflow level = pc_maxjoblv(sd) - sd->status.job_level; sd->status.job_level += (unsigned int)level; - clif_updatestatus(sd, SP_JOBLEVEL); - clif_updatestatus(sd, SP_NEXTJOBEXP); sd->status.skill_point += level; - clif_updatestatus(sd, SP_SKILLPOINT); - status_calc_pc(sd, 0); clif_misceffect(&sd->bl, 1); clif_displaymessage(fd, msg_txt(24)); // Job level raised. } else { @@ -1824,18 +1822,20 @@ ACMD_FUNC(joblevelup) if ((unsigned int)level >= sd->status.job_level) // fix negativ overflow level = sd->status.job_level-1; sd->status.job_level -= (unsigned int)level; - clif_updatestatus(sd, SP_JOBLEVEL); - clif_updatestatus(sd, SP_NEXTJOBEXP); if (sd->status.skill_point < level) pc_resetskill(sd,0); //Reset skills since we need to substract more points. if (sd->status.skill_point < level) sd->status.skill_point = 0; else sd->status.skill_point -= level; - clif_updatestatus(sd, SP_SKILLPOINT); - status_calc_pc(sd, 0); clif_displaymessage(fd, msg_txt(25)); // Job level lowered. } + sd->status.job_exp = 0; + clif_updatestatus(sd, SP_JOBLEVEL); + clif_updatestatus(sd, SP_JOBEXP); + clif_updatestatus(sd, SP_NEXTJOBEXP); + clif_updatestatus(sd, SP_SKILLPOINT); + status_calc_pc(sd, 0); return 0; } diff --git a/src/map/pc.c b/src/map/pc.c index c83bfadc9..28ead8086 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -4767,6 +4767,7 @@ int pc_checkbaselevelup(struct map_session_data *sd) clif_updatestatus(sd,SP_STATUSPOINT); clif_updatestatus(sd,SP_BASELEVEL); + clif_updatestatus(sd,SP_BASEEXP); clif_updatestatus(sd,SP_NEXTBASEEXP); status_calc_pc(sd,0); status_percent_heal(&sd->bl,100,100); @@ -4814,6 +4815,7 @@ int pc_checkjoblevelup(struct map_session_data *sd) } while ((next=pc_nextjobexp(sd)) > 0 && sd->status.job_exp >= next); clif_updatestatus(sd,SP_JOBLEVEL); + clif_updatestatus(sd,SP_JOBEXP); clif_updatestatus(sd,SP_NEXTJOBEXP); clif_updatestatus(sd,SP_SKILLPOINT); status_calc_pc(sd,0); @@ -5270,6 +5272,8 @@ int pc_resetlvl(struct map_session_data* sd,int type) clif_updatestatus(sd,SP_BASELEVEL); clif_updatestatus(sd,SP_JOBLEVEL); clif_updatestatus(sd,SP_STATUSPOINT); + clif_updatestatus(sd,SP_BASEEXP); + clif_updatestatus(sd,SP_JOBEXP); clif_updatestatus(sd,SP_NEXTBASEEXP); clif_updatestatus(sd,SP_NEXTJOBEXP); clif_updatestatus(sd,SP_SKILLPOINT); @@ -5945,11 +5949,15 @@ int pc_setparam(struct map_session_data *sd,int type,int val) } sd->status.base_level = (unsigned int)val; sd->status.base_exp = 0; - clif_updatestatus(sd, SP_BASELEVEL); + // clif_updatestatus(sd, SP_BASELEVEL); // Gets updated at the bottom clif_updatestatus(sd, SP_NEXTBASEEXP); clif_updatestatus(sd, SP_STATUSPOINT); clif_updatestatus(sd, SP_BASEEXP); status_calc_pc(sd, 0); + if(sd->status.party_id) + { + party_send_levelup(sd); + } break; case SP_JOBLEVEL: if ((unsigned int)val >= sd->status.job_level) { @@ -5959,11 +5967,10 @@ int pc_setparam(struct map_session_data *sd,int type,int val) } sd->status.job_level = (unsigned int)val; sd->status.job_exp = 0; - clif_updatestatus(sd, SP_JOBLEVEL); + // clif_updatestatus(sd, SP_JOBLEVEL); // Gets updated at the bottom clif_updatestatus(sd, SP_NEXTJOBEXP); clif_updatestatus(sd, SP_JOBEXP); status_calc_pc(sd, 0); - clif_updatestatus(sd,type); break; case SP_SKILLPOINT: sd->status.skill_point = val; @@ -6036,6 +6043,9 @@ int pc_setparam(struct map_session_data *sd,int type,int val) case SP_FAME: sd->status.fame = val; break; + default: + ShowError("pc_setparam: Attempted to set unknown parameter '%d'.\n", type); + return 0; } clif_updatestatus(sd,type); -- cgit v1.2.3-70-g09d2