Browse Source

Disallow changing to 4th on pre-renewal (#6435)

Fixes #6434

Thanks to @Shaktohh
Lemongrass3110 3 years ago
parent
commit
ec7879c99a
1 changed files with 6 additions and 1 deletions
  1. 6 1
      src/map/pc.cpp

+ 6 - 1
src/map/pc.cpp

@@ -1631,7 +1631,7 @@ bool pc_authok(struct map_session_data *sd, uint32 login_id2, time_t expiration_
 
 	//Set the map-server used job id. [Skotlex]
 	uint64 class_ = pc_jobid2mapid(sd->status.class_);
-	if (class_ == -1) { //Invalid class?
+	if (class_ == -1 || !job_db.exists(sd->status.class_)) { //Invalid class?
 		ShowError("pc_authok: Invalid class %d for player %s (%d:%d). Class was changed to novice.\n", sd->status.class_, sd->status.name, sd->status.account_id, sd->status.char_id);
 		sd->status.class_ = JOB_NOVICE;
 		sd->class_ = MAPID_NOVICE;
@@ -10078,6 +10078,11 @@ bool pc_jobchange(struct map_session_data *sd,int job, char upper)
 	if ((unsigned short)b_class == sd->class_)
 		return false; //Nothing to change.
 
+	// If the job does not exist in the job db, dont allow changing to it
+	if( !job_db.exists( job ) ){
+		return false;
+	}
+
 	// changing from 1st to 2nd job
 	if ((b_class&JOBL_2) && !(sd->class_&JOBL_2) && (sd->class_&MAPID_UPPERMASK) != MAPID_SUPER_NOVICE) {
 		sd->change_level_2nd = sd->status.job_level;