summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Changelog-Trunk.txt2
-rw-r--r--src/map/pc.c24
2 files changed, 16 insertions, 10 deletions
diff --git a/Changelog-Trunk.txt b/Changelog-Trunk.txt
index 0bb9877ad..accbd5344 100644
--- a/Changelog-Trunk.txt
+++ b/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/01/23
+ * Prevented pc_skill with a value of 2 for 'flag' from granting a skill level that surpasses MAX_SKILL_LEVEL. (bugreport:4022) [Paradox924X]
2010/01/19
* Snatch should warp you anyway even if the target died. [Inkfish]
* Snatch now checks the distance between source and target in case it kills the target and then warps the respawned one. [Inkfish]
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;
}