Explorar el Código

Implemented "cooking exp" that increases the success chance of cooking by 0.05% per try and the max bonus is 20%.

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@13854 54d463be-8e91-2dee-dedb-b68131a5f0ec
Inkfish hace 16 años
padre
commit
52aa42124c
Se han modificado 4 ficheros con 14 adiciones y 1 borrados
  1. 2 0
      Changelog-Trunk.txt
  2. 8 0
      src/map/pc.c
  3. 1 0
      src/map/pc.h
  4. 3 1
      src/map/skill.c

+ 2 - 0
Changelog-Trunk.txt

@@ -3,6 +3,8 @@ Date	Added
 AS OF SVN REV. 5091, WE ARE NOW USING TRUNK.  ALL UNTESTED BUGFIXES/FEATURES GO INTO TRUNK.
 IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
 
+09/06/07
+	* Implemented "cooking exp" that increases the success chance of cooking by 0.05% per try and the max bonus is 20%. [Inkfish]
 09/06/05
 	* Job_Battle_Manual and Battle_Manual can be used simultaneously. [Inkfish]
 	* Fixed "sleep" after "attachrid" (a different rid) halts the script. [Inkfish]

+ 8 - 0
src/map/pc.c

@@ -971,6 +971,9 @@ int pc_reg_received(struct map_session_data *sd)
 	sd->cashPoints = pc_readaccountreg(sd,"#CASHPOINTS");
 	sd->kafraPoints = pc_readaccountreg(sd,"#KAFRAPOINTS");
 
+	// Cooking Exp
+	sd->cooking_attempt = pc_readglobalreg(sd,"COOKING_ATTEMPT");
+
 	if( (sd->class_&MAPID_BASEMASK) == MAPID_TAEKWON )
 	{ // Better check for class rather than skill to prevent "skill resets" from unsetting this
 		sd->mission_mobid = pc_readglobalreg(sd,"TK_MISSION_ID");
@@ -6470,6 +6473,11 @@ int pc_setregistry(struct map_session_data *sd,const char *reg,int val,int type)
 			if( i )
 				status_calc_pc(sd,0); // Lost the bonus.
 		}
+		else if( !strcmp(reg,"COOKING_ATTEMPT") && sd->cooking_attempt != val )
+		{
+			val = cap_value(val, 0, 400);
+			sd->cooking_attempt = val;
+		}
 		sd_reg = sd->save_reg.global;
 		max = &sd->save_reg.global_num;
 		regmax = GLOBAL_REG_NUM;

+ 1 - 0
src/map/pc.h

@@ -177,6 +177,7 @@ struct map_session_data {
 	short skillitem,skillitemlv;
 	short skillid_old,skilllv_old;
 	short skillid_dance,skilllv_dance;
+	short cooking_attempt; // max: 400 [Inkfish]
 	unsigned char blockskill[MAX_SKILL];
 	int cloneskill_id;
 	int menuskill_id, menuskill_val;

+ 3 - 1
src/map/skill.c

@@ -10909,7 +10909,9 @@ int skill_produce_mix (struct map_session_data *sd, int skill_id, int nameid, in
 						make_per = 1200*(sd->menuskill_val-10) //12% chance per set level.
 							+ 1000 - 500*(skill_produce_db[idx].itemlv-10) //10% - 5% per dish level
 							+ 20*status->dex + 10*status->luk //0.2% per DEX, 0.1% per LUK
-							+ 1000; //TODO: Replace with MIN(5*COOKINGATTEMPTS;2000)
+							+ 5*sd->cooking_attempt; //+0.05% per try
+					if( sd->cooking_attempt < 400 )
+						pc_setglobalreg(sd, "COOKING_ATTEMPT", sd->cooking_attempt+1);
 					break;
 				}
 				make_per = 5000;