Sfoglia il codice sorgente

Platinum skills are no longer saved as permanent granted skills - Fixes bugreport:7466
->Updated the docs with more information on flag 4 skills
Please remember to run the SQL upgrade file to fix your skill tables

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@17256 54d463be-8e91-2dee-dedb-b68131a5f0ec

akinari1087 12 anni fa
parent
commit
984218e0e5

+ 7 - 1
doc/script_commands.txt

@@ -3128,7 +3128,7 @@ Example 2:
 
 *getskilllist;
 
-This command sets a bunch of arrays with a complete list of skills the 
+This command sets a bunch of arrays with a complete list of skills the
 invoking character has. Here's what you get:
 
 @skilllist_id[]   - skill ids.
@@ -3141,6 +3141,8 @@ easiest way to store all the skills and make the character something else for a
 while. Advanced job for a day? :) This could also be useful to see how many 
 skills a character has.
 
+This command does not count skills which are set as flag 4 (permament granted) (ALL_BUYING_STORE/ALL_INCCARRY)
+
 ---------------------------------------
 
 *getmonsterinfo(<mob ID>,<type>)
@@ -3234,6 +3236,7 @@ Example:
 Returns the total amount of skill points a character possesses (SkillPoint+SP's used in skills)
 This command can be used to check the currently attached characters total amount of skill points.
 This means the skill points used in skill are counted, and added to SkillPoints (number of skill points not used).
+This command does not count skills which are set as flag 4 (permament granted) (ALL_BUYING_STORE/ALL_INCCARRY)
 
 Example:
 
@@ -5065,6 +5068,9 @@ Flag 2 means that the level parameter is to be interpreted as a stackable
 additional bonus to the skill level. If the character did not have that skill 
 previously, they will now at 0+the level given.
 
+Flag 4 is the same as flag 1 in that it saves to the database.  However, these skills
+are ignored when any action is taken that adjusts the skill tree (reset/job change).
+
 // This will permanently give the character Stone Throw (TF_THROWSTONE,152), at 
 // level 1.
     skill 152,1,0;

+ 1 - 1
npc/merchants/buying_shops.txt

@@ -214,7 +214,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,4;
 				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.";

+ 2 - 2
npc/other/gympass.txt

@@ -79,7 +79,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,4;
 				close;
 			}
 			else {
@@ -135,7 +135,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,4;
 			close;
 		}
 		else {

+ 1 - 0
sql-files/upgrades/upgrade_svn17256.sql

@@ -0,0 +1 @@
+UPDATE `skill` SET `flag` = 0 WHERE `flag` = 4 AND `id` != 2535 AND `id` != 681;

+ 48 - 38
src/map/pc.c

@@ -3419,10 +3419,10 @@ 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)
+ *	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.
+ *	4 - Like 0, except the skill will ignore skill tree (saves through job changes and resets).
  *------------------------------------------*/
 int pc_skill(TBL_PC* sd, int id, int level, int flag)
 {
@@ -3442,44 +3442,54 @@ 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 4: //Permanent granted skills ignore the skill tree
 			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;
-	default: //Unknown flag?
-		return 0;
+			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;
 	}
 	return 1;
 }