summaryrefslogtreecommitdiff
path: root/src/map/pc.c
diff options
context:
space:
mode:
authorParadox924X <Paradox924X@54d463be-8e91-2dee-dedb-b68131a5f0ec>2010-01-24 01:13:48 +0000
committerParadox924X <Paradox924X@54d463be-8e91-2dee-dedb-b68131a5f0ec>2010-01-24 01:13:48 +0000
commitc0896d581a8c46fee940eee571c233441a4e78c4 (patch)
treeb567f4bff97542a60a1409cdb30570751c6d26fe /src/map/pc.c
parent79d969881af897a623a87c3c9cde0da709aa3aa8 (diff)
downloadhercules-c0896d581a8c46fee940eee571c233441a4e78c4.tar.gz
hercules-c0896d581a8c46fee940eee571c233441a4e78c4.tar.bz2
hercules-c0896d581a8c46fee940eee571c233441a4e78c4.tar.xz
hercules-c0896d581a8c46fee940eee571c233441a4e78c4.zip
Prevented pc_skill with a value of 2 for 'flag' from granting a skill level that surpasses MAX_SKILL_LEVEL. (bugreport:4022)
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@14225 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/pc.c')
-rw-r--r--src/map/pc.c24
1 files changed, 14 insertions, 10 deletions
diff --git a/src/map/pc.c b/src/map/pc.c
index 56b3fd990..068e6ce8f 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -2954,6 +2954,10 @@ int pc_skill(TBL_PC* sd, int id, int level, int flag)
ShowError("pc_skill: Skill level %d too high. Max lv supported is %d\n", level, MAX_SKILL_LEVEL);
return 0;
}
+ if( flag == 2 && sd->status.skill[id].lv + level > MAX_SKILL_LEVEL ) {
+ ShowError("pc_skill: Skill level bonus %d too high. Max lv supported is %d. Curr lv is %d\n", level, MAX_SKILL_LEVEL, sd->status.skill[id].lv);
+ return 0;
+ }
switch( flag ){
case 0: //Set skill data overwriting whatever was there before.
@@ -2970,16 +2974,6 @@ int pc_skill(TBL_PC* sd, int id, int level, int flag)
if( !skill_get_inf(id) ) //Only recalculate for passive skills.
status_calc_pc(sd, 0);
break;
- case 2: //Add skill bonus on top of what you had.
- if( sd->status.skill[id].id == id ){
- if( !sd->status.skill[id].flag ) // Store previous level.
- sd->status.skill[id].flag = sd->status.skill[id].lv + 2;
- } else {
- sd->status.skill[id].id = id;
- sd->status.skill[id].flag = 1; //Set that this is a bonus skill.
- }
- sd->status.skill[id].lv += level;
- break;
case 1: //Item bonus skill.
if( sd->status.skill[id].id == id ){
if( sd->status.skill[id].lv >= level )
@@ -2992,6 +2986,16 @@ int pc_skill(TBL_PC* sd, int id, int level, int flag)
}
sd->status.skill[id].lv = level;
break;
+ case 2: //Add skill bonus on top of what you had.
+ if( sd->status.skill[id].id == id ){
+ if( !sd->status.skill[id].flag ) // Store previous level.
+ sd->status.skill[id].flag = sd->status.skill[id].lv + 2;
+ } else {
+ sd->status.skill[id].id = id;
+ sd->status.skill[id].flag = 1; //Set that this is a bonus skill.
+ }
+ sd->status.skill[id].lv += level;
+ break;
default: //Unknown flag?
return 0;
}