- 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://svn.code.sf.net/p/rathena/svn/trunk@8179 54d463be-8e91-2dee-dedb-b68131a5f0ec
This commit is contained in:
skotlex 2006-08-08 02:18:01 +00:00
parent b372f8dfce
commit 367750c38c
2 changed files with 36 additions and 12 deletions

View File

@ -4,6 +4,13 @@ AS OF SVN REV. 5091, WE ARE NOW USING TRUNK. ALL UNTESTED BUGFIXES/FEATURES GO
IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK. IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
2006/08/07 2006/08/07
* Cleaned up the apparent mess that is pc_skill. Hopefully it SHOULD work 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. [Skotlex]
* Fixed EQP_WEAPON related code messing up with both weapon AND shield. * Fixed EQP_WEAPON related code messing up with both weapon AND shield.
[Skotlex] [Skotlex]
* Cleaned up the Asura code so that when the skill fails your * Cleaned up the Asura code so that when the skill fails your

View File

@ -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) 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); ShowError("pc_skill: Skill level %d too high. Max lv supported is MAX_SKILL_LEVEL (%d)\n", level, MAX_SKILL_LEVEL);
return 0; 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].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. if (!skill_get_inf(id)) //Only recalculate for passive skills.
status_calc_pc(sd,0); status_calc_pc(sd,0);
clif_skillinfoblock(sd); clif_skillinfoblock(sd);
} break;
else if(flag==2 && (sd->status.skill[id].id == id || level == 0)){ // クエスト所得ならここで?件を確認して送信する 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; sd->status.skill[id].lv+=level;
if (!skill_get_inf(id)) //Only recalculate for passive skills. break;
status_calc_pc(sd,0); case 1: //Item bonus skill.
clif_skillinfoblock(sd); if(sd->status.skill[id].lv >= level)
} return 0;
else if(sd->status.skill[id].lv < level){ // ?えられるがlvが小さいなら
if(sd->status.skill[id].id==id) { if(sd->status.skill[id].id==id) {
if (!sd->status.skill[id].flag) //Non-granted skill, store it's level. if (!sd->status.skill[id].flag) //Non-granted skill, store it's level.
sd->status.skill[id].flag=sd->status.skill[id].lv+2; sd->status.skill[id].flag=sd->status.skill[id].lv+2;
} else { } else {
sd->status.skill[id].id=id; 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; sd->status.skill[id].lv=level;
break;
default: //Unknown flag?
return 0;
} }
return 1;
return 0;
} }
/*========================================== /*==========================================
* ƒJ?ƒh?ü * ƒJ?ƒh?ü