Jelajahi Sumber

Fixed an issue in the custom job master npc (#4749)

* The player shouldn't be able to rebirth after being 3rd class
* Added additionnal checks here and there

Closes #4735

Thanks to @reunite-ro
Atemo 5 tahun lalu
induk
melakukan
e07d2b9ec2
1 mengubah file dengan 10 tambahan dan 8 penghapusan
  1. 10 8
      npc/custom/jobmaster.txt

+ 10 - 8
npc/custom/jobmaster.txt

@@ -71,8 +71,8 @@ function	Can_Rebirth	{
 		return false; // Rebirth disabled
 	if( !(eaclass()&EAJL_2) )
 		return false; // Not second Class
-	if( eaclass()&EAJL_UPPER )
-		return false; // Already Rebirthed
+	if( eaclass()&(EAJL_UPPER|EAJL_THIRD) )
+		return false; // Already Rebirthed/ Third Class
 	if( roclass(eaclass()|EAJL_UPPER) < 0 )
 		return false; // Job has no transcended class
 	if( Is_Baby() && !.BabyClass )
@@ -126,7 +126,6 @@ function	Job_Options	{
 	Check_SkillPoints();
 
 	// initialisation
-	deletearray .@job_opt[0],getarraysize(.@job_opt);
 	.@eac = eaclass();
 	.@third_possible = Can_Change_Third();
 	.@rebirth_possible = Can_Rebirth();
@@ -300,6 +299,7 @@ function	Job_Menu	{
 
 // Executes the actual jobchange and closes.
 function	Job_Change	{
+	.@previous_class = Class;
 	.@to_cls = getarg(0);
 	next;
 	mes .NPCName$;
@@ -316,10 +316,12 @@ function	Job_Change	{
 	}
 	specialeffect2 EF_ANGEL2;
 	specialeffect2 EF_ELECTRIC;
-	if (.Platinum)
-		callfunc "F_GetPlatinumSkills";
-	if (.GetJobEquip)
-		Get_Job_Equip();
+	if (.@previous_class != Class) {
+		if (.Platinum)
+			callfunc "F_GetPlatinumSkills";
+		if (.GetJobEquip)
+			Get_Job_Equip();
+	}
 	close; // Always closes after the change
 }
 
@@ -327,7 +329,7 @@ function	Confirm_Change	{
 	// Player confirms he want to change into .@class
 	.@class = getarg(0, -1);
 	.@back = getarg(1, false);
-	if( .@class < 0 ) {
+	if( .@class < 0 || eaclass(.@class) == -1 ) {
 		mes "Unknown Class Error.";
 		close;
 	}