From 1c9fdc0d3bbe2993ac1e8a31045ccbc60b8fbe26 Mon Sep 17 00:00:00 2001 From: shennetsind Date: Mon, 15 Apr 2013 22:32:10 -0300 Subject: 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 --- doc/script_commands.txt | Bin 592766 -> 593352 bytes npc/merchants/buying_shops.txt | 2 +- npc/other/gympass.txt | 4 +- sql-files/upgrades/2013-04-16--01-24.sql | 3 ++ sql-files/upgrades/index.txt | 3 +- src/map/pc.c | 88 +++++++++++++++++-------------- 6 files changed, 57 insertions(+), 43 deletions(-) create mode 100644 sql-files/upgrades/2013-04-16--01-24.sql diff --git a/doc/script_commands.txt b/doc/script_commands.txt index ae5465bdf..38c442f74 100644 Binary files a/doc/script_commands.txt and b/doc/script_commands.txt differ diff --git a/npc/merchants/buying_shops.txt b/npc/merchants/buying_shops.txt index 89654f0cc..4532921bd 100644 --- a/npc/merchants/buying_shops.txt +++ b/npc/merchants/buying_shops.txt @@ -211,7 +211,7 @@ alberta_in,58,52,4 script Purchasing Team#Buying 59,{ mes "Okay, you're now approved to open the Bulk Buyer Shop."; set Zeny,Zeny-10000; getitem 6377,5; //Buy_Stall_Permit - skill "ALL_BUYING_STORE",1,0; + skill "ALL_BUYING_STORE",1,3; next; mes "[Mr. Hugh]"; mes "Currently, only normal items ^8C2121EXCEPT^000000 equipment, certain potions, and hand-crafted items can be purchased in bulk, but this can still be very beneficial to you, depending on how you use it."; diff --git a/npc/other/gympass.txt b/npc/other/gympass.txt index 33e4a8f3e..2991e6d84 100644 --- a/npc/other/gympass.txt +++ b/npc/other/gympass.txt @@ -77,7 +77,7 @@ payon,173,141,4 script Ripped Cabus#GymPass 899,{ mes "training together like this."; delitem 7776,1; //Max_Weight_Up_Scroll set gympassmemory,.@add_carry; - skill "ALL_INCCARRY",.@add_carry,0; + skill "ALL_INCCARRY",.@add_carry,3; close; } else { @@ -133,7 +133,7 @@ payon,173,141,4 script Ripped Cabus#GymPass 899,{ mes "muscles grew back,"; mes "just like that! Try not to"; mes "wimp out again, okay?"; - skill "ALL_INCCARRY",gympassmemory,0; + skill "ALL_INCCARRY",gympassmemory,3; close; } else { diff --git a/sql-files/upgrades/2013-04-16--01-24.sql b/sql-files/upgrades/2013-04-16--01-24.sql new file mode 100644 index 000000000..69672b368 --- /dev/null +++ b/sql-files/upgrades/2013-04-16--01-24.sql @@ -0,0 +1,3 @@ +#1366075474 +#Info http://hercules.ws/board/topic/410-skill-script-command-updatefix/ +UPDATE `skill` SET `flag` = 0 WHERE `flag` = 4 AND `id` != 2535 AND `id` != 681; \ No newline at end of file diff --git a/sql-files/upgrades/index.txt b/sql-files/upgrades/index.txt index a803adffc..54502d48b 100644 --- a/sql-files/upgrades/index.txt +++ b/sql-files/upgrades/index.txt @@ -2,4 +2,5 @@ 2013-02-15--18-06.sql 2013-03-05--01-05.sql 2013-03-06--00-00.sql -2013-03-09--01-56.sql \ No newline at end of file +2013-03-09--01-56.sql +2013-04-16--01-24.sql \ No newline at end of file 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; } -- cgit v1.2.3-70-g09d2