From e07d2b9ec21ad94f4539afac69e1fe62167eaee1 Mon Sep 17 00:00:00 2001 From: Atemo Date: Mon, 30 Mar 2020 16:53:14 +0200 Subject: [PATCH] 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 --- npc/custom/jobmaster.txt | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/npc/custom/jobmaster.txt b/npc/custom/jobmaster.txt index d29582eb05..59c4589a21 100644 --- a/npc/custom/jobmaster.txt +++ b/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; }