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
This commit is contained in:
Atemo 2020-03-30 16:53:14 +02:00 committed by GitHub
parent bdd63022a9
commit e07d2b9ec2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

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