summaryrefslogtreecommitdiff
path: root/src/map/pc.c
diff options
context:
space:
mode:
authorshennetsind <ind@henn.et>2013-04-15 22:32:10 -0300
committershennetsind <ind@henn.et>2013-04-15 22:32:10 -0300
commit1c9fdc0d3bbe2993ac1e8a31045ccbc60b8fbe26 (patch)
treec0b31c00d9bb2e038b7075f8d2f553135d3dc061 /src/map/pc.c
parent8ce4eddbbfc874706f6a2e6f81c3b9f84ef2039e (diff)
downloadhercules-1c9fdc0d3bbe2993ac1e8a31045ccbc60b8fbe26.tar.gz
hercules-1c9fdc0d3bbe2993ac1e8a31045ccbc60b8fbe26.tar.bz2
hercules-1c9fdc0d3bbe2993ac1e8a31045ccbc60b8fbe26.tar.xz
hercules-1c9fdc0d3bbe2993ac1e8a31045ccbc60b8fbe26.zip
Fixed Bug #7154
http://hercules.ws/board/tracker/issue-7154-equipment-based-skills-skill-891-for-example-persisting-through-resetsremoving-gears/ Merge of 3a9bacc515674885f079391899b22a5ccd8c2e31 Special Thanks to akinari1087 http://hercules.ws/board/topic/410-skill-script-command-updatefix/ Signed-off-by: shennetsind <ind@henn.et>
Diffstat (limited to 'src/map/pc.c')
-rw-r--r--src/map/pc.c88
1 files changed, 49 insertions, 39 deletions
diff --git a/src/map/pc.c b/src/map/pc.c
index 01df6bb64..0e1656b91 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -3436,11 +3436,11 @@ int pc_bonus5(struct map_session_data *sd,int type,int type2,int type3,int type4
}
/*==========================================
- * Grants a player a given skill. Flag values are:
- * 0 - Grant skill unconditionally and forever (only this one invokes status_calc_pc,
- * as the other two are assumed to be invoked from within it)
- * 1 - Grant an item skill (temporary)
- * 2 - Like 1, except the level granted can stack with previously learned level.
+ * Grants a player a given skill. Flag values are:
+ * 0 - Grant permanent skill to be bound to skill tree
+ * 1 - Grant an item skill (temporary)
+ * 2 - Like 1, except the level granted can stack with previously learned level.
+ * 3 - Grant skill unconditionally and forever (persistent to job changes and skill resets)
*------------------------------------------*/
int pc_skill(TBL_PC* sd, int id, int level, int flag)
{
@@ -3460,42 +3460,52 @@ int pc_skill(TBL_PC* sd, int id, int level, int flag)
}
switch( flag ){
- case 0: //Set skill data overwriting whatever was there before.
- sd->status.skill[id].id = id;
- sd->status.skill[id].lv = level;
- sd->status.skill[id].flag = SKILL_FLAG_PERM_GRANTED;
- if( level == 0 ) //Remove skill.
- {
- sd->status.skill[id].id = 0;
- clif->deleteskill(sd,id);
- }
- else
- clif->addskill(sd,id);
- if( !skill->get_inf(id) ) //Only recalculate for passive skills.
- status_calc_pc(sd, 0);
- break;
- case 1: //Item bonus skill.
- if( sd->status.skill[id].id == id ){
- if( sd->status.skill[id].lv >= level )
- return 0;
- if( sd->status.skill[id].flag == SKILL_FLAG_PERMANENT ) //Non-granted skill, store it's level.
- sd->status.skill[id].flag = SKILL_FLAG_REPLACED_LV_0 + sd->status.skill[id].lv;
- } else {
+ case 0: //Set skill data overwriting whatever was there before.
sd->status.skill[id].id = id;
- sd->status.skill[id].flag = SKILL_FLAG_TEMPORARY;
- }
- 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 == SKILL_FLAG_PERMANENT )
- sd->status.skill[id].flag = SKILL_FLAG_REPLACED_LV_0 + sd->status.skill[id].lv; // Store previous level.
- } else {
+ sd->status.skill[id].lv = level;
+ sd->status.skill[id].flag = SKILL_FLAG_PERMANENT;
+ if( level == 0 ) { //Remove skill.
+ sd->status.skill[id].id = 0;
+ clif->deleteskill(sd,id);
+ } else
+ clif->addskill(sd,id);
+ if( !skill->get_inf(id) ) //Only recalculate for passive skills.
+ status_calc_pc(sd, 0);
+ break;
+ case 1: //Item bonus skill.
+ if( sd->status.skill[id].id == id ) {
+ if( sd->status.skill[id].lv >= level )
+ return 0;
+ if( sd->status.skill[id].flag == SKILL_FLAG_PERMANENT ) //Non-granted skill, store it's level.
+ sd->status.skill[id].flag = SKILL_FLAG_REPLACED_LV_0 + sd->status.skill[id].lv;
+ } else {
+ sd->status.skill[id].id = id;
+ sd->status.skill[id].flag = SKILL_FLAG_TEMPORARY;
+ }
+ 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 == SKILL_FLAG_PERMANENT )
+ sd->status.skill[id].flag = SKILL_FLAG_REPLACED_LV_0 + sd->status.skill[id].lv; // Store previous level.
+ } else {
+ sd->status.skill[id].id = id;
+ sd->status.skill[id].flag = SKILL_FLAG_TEMPORARY; //Set that this is a bonus skill.
+ }
+ sd->status.skill[id].lv += level;
+ break;
+ case 3:
sd->status.skill[id].id = id;
- sd->status.skill[id].flag = SKILL_FLAG_TEMPORARY; //Set that this is a bonus skill.
- }
- sd->status.skill[id].lv += level;
- break;
+ sd->status.skill[id].lv = level;
+ sd->status.skill[id].flag = SKILL_FLAG_PERM_GRANTED;
+ if( level == 0 ) { //Remove skill.
+ sd->status.skill[id].id = 0;
+ clif->deleteskill(sd,id);
+ } else
+ clif->addskill(sd,id);
+ if( !skill->get_inf(id) ) //Only recalculate for passive skills.
+ status_calc_pc(sd, 0);
+ break;
default: //Unknown flag?
return 0;
}