diff options
author | skotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2007-11-20 15:14:51 +0000 |
---|---|---|
committer | skotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2007-11-20 15:14:51 +0000 |
commit | ecfcb989bf2fd07a355714ce588a6ab7e890db76 (patch) | |
tree | fc1a64c5a65471328cf845f922c2ef5e26b75648 /src/map/pc.c | |
parent | 334f81bebe92b6014d4b21607de5539d99af0cf1 (diff) | |
download | hercules-ecfcb989bf2fd07a355714ce588a6ab7e890db76.tar.gz hercules-ecfcb989bf2fd07a355714ce588a6ab7e890db76.tar.bz2 hercules-ecfcb989bf2fd07a355714ce588a6ab7e890db76.tar.xz hercules-ecfcb989bf2fd07a355714ce588a6ab7e890db76.zip |
- Implemented SL_SUPERNOVICE erasing the death record 1% of the casts.
- Implemented current exp being capped to the exp required to level up from the previous level when we are at max level (required for some S. Novice buffs)
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@11764 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/pc.c')
-rw-r--r-- | src/map/pc.c | 53 |
1 files changed, 35 insertions, 18 deletions
diff --git a/src/map/pc.c b/src/map/pc.c index 8ba137bfe..913f108d0 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -4098,7 +4098,6 @@ int pc_checkbaselevelup(struct map_session_data *sd) if (!next || sd->status.base_exp < next) return 0; - do { sd->status.base_exp -= next; //Kyoki pointed out that the max overcarry exp is the exp needed for the previous level -1. [Skotlex] @@ -4272,24 +4271,26 @@ int pc_gainexp(struct map_session_data *sd, struct block_list *src, unsigned int } } - //Overflow checks... think we'll ever really need'em? [Skotlex] - if (base_exp && sd->status.base_exp > UINT_MAX - base_exp) - sd->status.base_exp = UINT_MAX; - else - sd->status.base_exp += base_exp; - - pc_checkbaselevelup(sd); - - clif_updatestatus(sd,SP_BASEEXP); - - if (job_exp && sd->status.job_exp > UINT_MAX - job_exp) - sd->status.job_exp = UINT_MAX; - else - sd->status.job_exp += job_exp; - - pc_checkjoblevelup(sd); + //Cap exp to the level up requirement of the previous level when you are at max level, otherwise cap at UINT_MAX (this is required for some S. Novice bonuses). [Skotlex] + if (base_exp) { + nextb = nextb?UINT_MAX:pc_thisbaseexp(sd); + if(sd->status.base_exp > nextb - base_exp) + sd->status.base_exp = nextb; + else + sd->status.base_exp += base_exp; + pc_checkbaselevelup(sd); + clif_updatestatus(sd,SP_BASEEXP); + } - clif_updatestatus(sd,SP_JOBEXP); + if (job_exp) { + nextj = nextj?UINT_MAX:pc_thisjobexp(sd); + if(sd->status.job_exp > nextj - job_exp) + sd->status.job_exp = nextj; + else + sd->status.job_exp += job_exp; + pc_checkjoblevelup(sd); + clif_updatestatus(sd,SP_JOBEXP); + } if(sd->state.showexp){ sprintf(output, @@ -4326,6 +4327,15 @@ unsigned int pc_nextbaseexp(struct map_session_data *sd) return exp_table[pc_class2idx(sd->status.class_)][0][sd->status.base_level-1]; } +unsigned int pc_thisbaseexp(struct map_session_data *sd) +{ + if(sd->status.base_level>pc_maxbaselv(sd) || sd->status.base_level<=1) + return 0; + + return exp_table[pc_class2idx(sd->status.class_)][0][sd->status.base_level-2]; +} + + /*========================================== * job level側必要??値計算 *------------------------------------------*/ @@ -4338,6 +4348,13 @@ unsigned int pc_nextjobexp(struct map_session_data *sd) return exp_table[pc_class2idx(sd->status.class_)][1][sd->status.job_level-1]; } +unsigned int pc_thisjobexp(struct map_session_data *sd) +{ + if(sd->status.job_level>pc_maxjoblv(sd) || sd->status.job_level<=1) + return 0; + return exp_table[pc_class2idx(sd->status.class_)][1][sd->status.job_level-2]; +} + /*========================================== * 必要ステ?タスポイント計算 *------------------------------------------*/ |