Kaynağa Gözat

Fixed bugreport:8201, imported job_db1.txt doesn't change Job Max HP/SP (http://rathena.org/board/tracker/issue-8201-job-db1/)

Signed-off-by: Cydh Ramdh <house.bad@gmail.com>
Cydh Ramdh 11 yıl önce
ebeveyn
işleme
9bda49d64f
1 değiştirilmiş dosya ile 10 ekleme ve 17 silme
  1. 10 17
      src/map/pc.c

+ 10 - 17
src/map/pc.c

@@ -9985,14 +9985,8 @@ static bool pc_readdb_job_exp(char* fields[], int columns, int current)
 	idx = pc_class2idx(job_id);
 	idx = pc_class2idx(job_id);
 
 
 	job_info[idx].max_level[type] = maxlvl;
 	job_info[idx].max_level[type] = maxlvl;
-	for(i=0; i<maxlvl; i++) {
+	for(i=0; i<maxlvl; i++)
 		job_info[idx].exp_table[type][i] = ((uint32) atoi(fields[3+i]));
 		job_info[idx].exp_table[type][i] = ((uint32) atoi(fields[3+i]));
-		//Place the BaseHP/SP calculation here, so we can use the maxlevel from job_exp
-		if (type != 0)
-			continue;
-		job_info[idx].base_hp[i] = pc_calc_basehp(i+1,idx);
-		job_info[idx].base_sp[i] = 10 + ((i+1) * (job_info[idx].sp_factor/100));
-	}
 	//Reverse check in case the array has a bunch of trailing zeros... [Skotlex]
 	//Reverse check in case the array has a bunch of trailing zeros... [Skotlex]
 	//The reasoning behind the -2 is this... if the max level is 5, then the array
 	//The reasoning behind the -2 is this... if the max level is 5, then the array
 	//should look like this:
 	//should look like this:
@@ -10010,7 +10004,6 @@ static bool pc_readdb_job_exp(char* fields[], int columns, int current)
 	}
 	}
 //	ShowInfo("%s - Class %d: %d\n", type?"Job":"Base", job_id, job_info[idx].max_level[type]);
 //	ShowInfo("%s - Class %d: %d\n", type?"Job":"Base", job_id, job_info[idx].max_level[type]);
 	for (i = 1; i < job_count; i++) {
 	for (i = 1; i < job_count; i++) {
-		uint16 j;
 		job_id = jobs[i];
 		job_id = jobs[i];
 		if (!pcdb_checkid(job_id)) {
 		if (!pcdb_checkid(job_id)) {
 			ShowError("pc_readdb_job_exp: Invalid job ID %d.\n", job_id);
 			ShowError("pc_readdb_job_exp: Invalid job ID %d.\n", job_id);
@@ -10018,17 +10011,8 @@ static bool pc_readdb_job_exp(char* fields[], int columns, int current)
 		}
 		}
 		idx = pc_class2idx(job_id);
 		idx = pc_class2idx(job_id);
 		memcpy(job_info[idx].exp_table[type], job_info[pc_class2idx(jobs[0])].exp_table[type], sizeof(job_info[pc_class2idx(jobs[0])].exp_table[type]));
 		memcpy(job_info[idx].exp_table[type], job_info[pc_class2idx(jobs[0])].exp_table[type], sizeof(job_info[pc_class2idx(jobs[0])].exp_table[type]));
-
 		job_info[idx].max_level[type] = maxlvl;
 		job_info[idx].max_level[type] = maxlvl;
 //		ShowInfo("%s - Class %d: %u\n", type?"Job":"Base", job_id, job_info[idx].max_level[type]);
 //		ShowInfo("%s - Class %d: %u\n", type?"Job":"Base", job_id, job_info[idx].max_level[type]);
-
-		//Place the BaseHP/SP calculation here, so we can use the maxlevel from job_exp
-		if (type != 0)
-			continue;
-		for (j = 0; j < maxlvl; j++) {
-			job_info[idx].base_hp[j] = pc_calc_basehp(j+1,idx);
-			job_info[idx].base_sp[j] = 10 + ((j+1) * (job_info[idx].sp_factor/100));
-		}
 	}
 	}
 	return true;
 	return true;
 }
 }
@@ -10267,6 +10251,7 @@ int pc_readdb(void)
 	//Checking if all class have their data
 	//Checking if all class have their data
 	for (i = 0; i < JOB_MAX; i++) {
 	for (i = 0; i < JOB_MAX; i++) {
 		int idx;
 		int idx;
+		uint16 j;
 		if (!pcdb_checkid(i)) continue;
 		if (!pcdb_checkid(i)) continue;
 		if (i == JOB_WEDDING || i == JOB_XMAS || i == JOB_SUMMER || i == JOB_HANBOK || i == JOB_OKTOBERFEST)
 		if (i == JOB_WEDDING || i == JOB_XMAS || i == JOB_SUMMER || i == JOB_HANBOK || i == JOB_OKTOBERFEST)
 			continue; //Classes that do not need exp tables.
 			continue; //Classes that do not need exp tables.
@@ -10275,6 +10260,14 @@ int pc_readdb(void)
 			ShowWarning("Class %s (%d) does not have a base exp table.\n", job_name(i), i);
 			ShowWarning("Class %s (%d) does not have a base exp table.\n", job_name(i), i);
 		if (!job_info[idx].max_level[1])
 		if (!job_info[idx].max_level[1])
 			ShowWarning("Class %s (%d) does not have a job exp table.\n", job_name(i), i);
 			ShowWarning("Class %s (%d) does not have a job exp table.\n", job_name(i), i);
+		
+		//Init and checking the empty value of Base HP/SP [Cydh]
+		for (j = 0; j < (job_info[idx].max_level[0] ? job_info[idx].max_level[0] : MAX_LEVEL); j++) {
+			if (job_info[idx].base_hp[j] == 0)
+				job_info[idx].base_hp[j] = pc_calc_basehp(j+1,idx);
+			if (job_info[idx].base_sp[j] == 0)
+				job_info[idx].base_sp[j] = 10 + ((j+1) * (job_info[idx].sp_factor/100));
+		}
 	}
 	}
  	return 0;
  	return 0;
 }
 }