diff options
author | skotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2006-08-08 02:18:01 +0000 |
---|---|---|
committer | skotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2006-08-08 02:18:01 +0000 |
commit | 72fb7ef9f269c5ae8545cb813d7409c3b06526c3 (patch) | |
tree | 073440f219389e6b58c902f7919961ee538d779e /src/map | |
parent | bc8350f550226c4d7d848ea9737f46c4a5d61575 (diff) | |
download | hercules-72fb7ef9f269c5ae8545cb813d7409c3b06526c3.tar.gz hercules-72fb7ef9f269c5ae8545cb813d7409c3b06526c3.tar.bz2 hercules-72fb7ef9f269c5ae8545cb813d7409c3b06526c3.tar.xz hercules-72fb7ef9f269c5ae8545cb813d7409c3b06526c3.zip |
- Cleaned up the apparent mess that is pc_skill. Hopefully it SHOULD fix as described on the docs now, this should also fix adopting not correctly giving the family-related skills. The flag value of skill should be: 0 to set the skill (if skill level is 0, this removes a learned skill), 1 grants the skill as an item bonus which is temporary, and 2 will add a skill bonus like 1, except the skill level adds up to whatever level already known of that skill.
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@8179 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map')
-rw-r--r-- | src/map/pc.c | 41 |
1 files changed, 29 insertions, 12 deletions
diff --git a/src/map/pc.c b/src/map/pc.c index 8614d5956..eaa157075 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -2348,7 +2348,11 @@ int pc_bonus4(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. *------------------------------------------ */ int pc_skill(struct map_session_data *sd,int id,int level,int flag) @@ -2360,30 +2364,43 @@ int pc_skill(struct map_session_data *sd,int id,int level,int flag) ShowError("pc_skill: Skill level %d too high. Max lv supported is MAX_SKILL_LEVEL (%d)\n", level, MAX_SKILL_LEVEL); return 0; } - if(!flag && (sd->status.skill[id].id == id || level == 0)){ // クエスト所得ならここで?件を確認して送信する + 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=0; + if (!level) //Remove skill. + sd->status.skill[id].id = 0; if (!skill_get_inf(id)) //Only recalculate for passive skills. status_calc_pc(sd,0); clif_skillinfoblock(sd); - } - else if(flag==2 && (sd->status.skill[id].id == id || level == 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) + sd->status.skill[id].flag=sd->status.skill[id].lv+2; //Store previous level. + } 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; - if (!skill_get_inf(id)) //Only recalculate for passive skills. - status_calc_pc(sd,0); - clif_skillinfoblock(sd); - } - else if(sd->status.skill[id].lv < level){ // ?えられるがlvが小さいなら + break; + case 1: //Item bonus skill. + if(sd->status.skill[id].lv >= level) + return 0; if(sd->status.skill[id].id==id) { if (!sd->status.skill[id].flag) //Non-granted skill, store it's 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; // cardスキルとする + sd->status.skill[id].flag=1; } sd->status.skill[id].lv=level; + break; + default: //Unknown flag? + return 0; } - - return 0; + return 1; } /*========================================== * カ?ド?入 |