Simple @advance command

Joined
Dec 28, 2008
Messages
595
Reaction score
47
Simple @advance command[NOW v111]

Basically, when you reach level 70+ and later 120+ you can get advanced to your next job.THIS IS MY FIRST RELEASE!!!
v111:
Just put this in your commands.java:
If you aren't using ChickenMS (mooplev111) then replace the "sub" with "splitted" and replace every "chr." with "player."
PHP:
}else if (sub[0].equals("advance")) {
         String advanced = "You have advanced.";
         int job_ = chr.getJob().getId();
         if (chr.getLevel() >= 160){
             if (chr.isEvan()){
             chr.changeJob(MapleJob.getById(job_ + 1));
             chr.dropMessage(advanced); 
             } } else if (chr.getLevel() >= 120){ 
            if (chr.is3rdJob() || (chr.isAran() || (chr.isEvan() || (chr.isCygnus() || (chr.isDualBlade() || (chr.isElf() || (chr.isDemonSlayer() || (chr.isCannon()))))))))  {
            chr.changeJob(MapleJob.getById(job_ + 1));
            chr.dropMessage(advanced);
             } } else if (chr.getLevel() >= 100){
             if (chr.isEvan()){
             chr.changeJob(MapleJob.getById(job_ + 1));
             chr.dropMessage(advanced);  
             } } else if (chr.getLevel() >= 80){
             if (chr.isEvan()){
             chr.changeJob(MapleJob.getById(job_ + 1));
             chr.dropMessage(advanced);
             } } else if (chr.getLevel() >= 70){ 
             if (chr.is2ndJob() || (chr.isAran() || (chr.isEvan() || (chr.isCygnus() || (chr.isDualBlade() || (chr.isElf() || (chr.isDemonSlayer() || (chr.isCannon()))))))))  {
             chr.changeJob(MapleJob.getById(job_ + 1));
             chr.dropMessage(advanced);
             }} else if (chr.getLevel() >= 60){
             if (chr.isEvan()){
             chr.changeJob(MapleJob.getById(job_ + 1));
             chr.dropMessage(advanced);
             } } else if (chr.getLevel() >= 55){
             if (chr.isDualBlade()){
             chr.changeJob(MapleJob.getById(job_ + 1));
             chr.dropMessage(advanced);
             } } else if (chr.getLevel() >= 50){
             if (chr.isEvan()){
             chr.changeJob(MapleJob.getById(job_ + 1));
             chr.dropMessage(advanced);
             } } else if (chr.getLevel() >= 40){
             if (chr.isEvan()){
             chr.changeJob(MapleJob.getById(job_ + 1));
             chr.dropMessage(advanced);
             } }else if (chr.getLevel() >= 30){
             if (chr.isEvan()) {
             chr.changeJob(MapleJob.getById(job_ + 1));
             chr.dropMessage(advanced);
             }else if ((chr.isAran() || (chr.isCygnus() || (chr.isDualBlade() || (chr.isElf() || (chr.isDemonSlayer() || (chr.isCannon()))))))){
             chr.changeJob(MapleJob.getById(job_ + 10));    
             }else{ chr.dropMessage("Pick a 2nd job from your job person");
             } }else if (chr.getLevel() >= 20){
             if (chr.isEvan()){
             chr.changeJob(MapleJob.getById(job_ + 10));
             chr.dropMessage(advanced);
             } }else {
             chr.dropMessage("You are not high level enough. Or it is not your job's time to advance.");}
Heres isCannon if you need it:
PHP:
public boolean isCannon(){
       if (getJob().getId() >= 501 && getJob().getId() <= 532 || GameConstants.isCannon(job.getId())) {
            return true;
        }
        return false;
    }
Heres some others if you need it:
PHP:
public boolean isMechanic() {
        return getJob().getId() >= MapleJob.MECHANIC1.getId() && getJob().getId() <= MapleJob.MECHANIC4.getId();
    } 
     public boolean isResistance() {
        return getJob().getId() >= MapleJob.CITIZEN.getId() && getJob().getId() <= MapleJob.MECHANIC4.getId();
    }

    public boolean isEvan() {
        return getJob().getId() >= MapleJob.EVAN.getId() && getJob().getId() <= MapleJob.EVAN10.getId();
    }

    public boolean isWarrior() {
        return getJob().getId() == MapleJob.WARRIOR.getId();
    }
    
    public boolean isMagician() {
        return getJob().getId() == MapleJob.MAGICIAN.getId();
    }
    public boolean isThief() {
        return getJob().getId() == MapleJob.THIEF.getId();
    }
    public boolean isPirate() {
        return getJob().getId() == MapleJob.PIRATE.getId();
    }
    public boolean isBowman() {
        return getJob().getId() == MapleJob.BOWMAN.getId();
    }
    public boolean isDualBlade() {
        return getJob().getId() >= MapleJob.DUALBLADE.getId() && getJob().getId() <= MapleJob.DUALBLADE4.getId();
    }

    public boolean is2ndJob() {
        return getJob().getId()%10 == 0 && getJob().getId()%100 != 0;
    }

    public boolean is3rdJob() {
        return getJob().getId()%10 == 1;
    }
    public boolean isCannon(){
       if (getJob().getId() >= 501 && getJob().getId() <= 532 || GameConstants.isCannon(job.getId())) {
            return true;
        }
        return false;
    public boolean isAran() {
        return getJob().getId() >= 2000 && getJob().getId() <= 2112;
    }
V97:
Put this in your playercommand.java:
PHP:
}else if (splitted[0].equals("advance")) { 
         String advanced = "You have advanced."; 
         if (player.getLevel() >= 20){
             if (player.isEvan()){
         player.autoJob();
             player.dropMessage(advanced);
             }}else if (player.getLevel() >= 30){
             if (player.isEvan() || (player.isAran() || (player.isCygnus() || (player.isDualBlade())))){
         player.autoJob();
             player.dropMessage(advanced);
             } } else if (player.getLevel() >= 40){
             if (player.isEvan()){
         player.autoJob();
             player.dropMessage(advanced);
             } } else if (player.getLevel() >= 50){
             if (player.isEvan()){
         player.autoJob();
             player.dropMessage(advanced);
             } } else if (player.getLevel() >= 55){
             if (player.isDualBlade()){
         player.autoJob();
             player.dropMessage(advanced);
             }} else if (player.getLevel() >= 60){
             if (player.isEvan()){
         player.autoJob();
             player.dropMessage(advanced);
             
             } } else if (player.getLevel() >= 70){ 
             if (player.is2ndJob() || (player.isAran() || (player.isEvan() || (player.isCygnus() || (player.isDualBlade()  )))))  {
             player.autoJob();
          player.dropMessage(advanced);
             } } else if (player.getLevel() >= 80){
             if (player.isEvan()){
         player.autoJob();
             player.dropMessage(advanced); 
             } } else if (player.getLevel() >= 100){
             if (player.isEvan()){
         player.autoJob();
             player.dropMessage(advanced); 
             } } else if (player.getLevel() >= 120){ 
            if (player.is2ndJob() || (player.isAran() || (player.isEvan() || (player.isCygnus() || (player.isDualBlade()  )))))  {
             player.autoJob();
            player.dropMessage(advanced); 
         } } else if (player.getLevel() >= 160){
             if (player.isEvan()){
         player.autoJob();
             player.dropMessage(advanced); 
            } }else {
             player.dropMessage("You are not high level enough. Or it is not your job's time to advance.");}
        
        }
This into maplecharacter.java:
PHP:
 public void autoJob() {
        int job_ = getJob().getId();
        if (isDualBlade()) {
            switch (getLevel()) {
                case 20:
                    changeJob(MapleJob.BLADE_RECRUIT);
                    break;
                case 30:
                    changeJob(MapleJob.BLADE_ACOLYTE);
                    break;
                case 55:
                    changeJob(MapleJob.BLADE_SPECIALIST);
                    break;
                case 70:
                    changeJob(MapleJob.BLADE_LORD);
                    break;
                case 120:
                    changeJob(MapleJob.BLADE_MASTER);
                    break;
            }
        } else if (getJob().getId() >= MapleJob.BATTLEMAGE1.getId() && getJob().getId() <= MapleJob.BATTLEMAGE4.getId()) {
            switch (getLevel()) {
                case 30:
                    changeJob(MapleJob.BATTLEMAGE2);
                    break;
                case 70:
                    changeJob(MapleJob.BATTLEMAGE3);
                    break;
                case 120:
                    changeJob(MapleJob.BATTLEMAGE4);
                    break;
            }
        } else if (isEvan()) {
            switch (getLevel()) {
                case 10:
                    changeJob(MapleJob.EVAN1);
                    break;
                case 20:
                    changeJob(MapleJob.EVAN2);
                    break;
                case 30:
                    changeJob(MapleJob.EVAN3);
                    break;
                case 40:
                    changeJob(MapleJob.EVAN4);
                    break;
                case 50:
                    changeJob(MapleJob.EVAN5);
                    break;
                case 60:
                    changeJob(MapleJob.EVAN6);
                    break;
                case 80:
                    changeJob(MapleJob.EVAN7);
                    break;
                case 100:
                    changeJob(MapleJob.EVAN8);
                    break;
                case 120:
                    changeJob(MapleJob.EVAN9);
                    break;
                case 160:
                    changeJob(MapleJob.EVAN10);
                    break;
                default:
                    break;
            }
        } else if (getJob().getId() >= MapleJob.WILDHUNTER1.getId() && getJob().getId() <= MapleJob.WILDHUNTER4.getId()) {
            switch (getLevel()) {
                case 30:
                    changeJob(MapleJob.WILDHUNTER2);
                    break;
                case 70:
                    changeJob(MapleJob.WILDHUNTER3);
                    break;
                case 120:
                    changeJob(MapleJob.WILDHUNTER4);
                    break;
            }
        } else if (isMechanic()) {
            switch (getLevel()) {
                case 30:
                    changeJob(MapleJob.MECHANIC2);
                    break;
                case 70:
                    changeJob(MapleJob.MECHANIC3);
                    break;
                case 120:
                    changeJob(MapleJob.MECHANIC4);
                    break;
            }
        } else {
            if (!isAran() && level == 9 || !isAran() && !isCygnus() && level == 29) {
                NPCScriptManager.getInstance().start(getClient(), 2003, null, null);
            } else if (isAran() && level == 9) {
                changeJob(MapleJob.getById(2100));
            } else if (isAran() && level == 29) {
                changeJob(MapleJob.getById(2110));
            } else if (isCygnus() && level == 29) {
                changeJob(MapleJob.getById(job_ + 10));
            } else if (isCygnus() && level == 69) {
                changeJob(MapleJob.getById(job_ + 1));
            } else if (isAran() && level == 69) {
                changeJob(MapleJob.getById(2111));
            } else if (isAran() && level == 119) {
                changeJob(MapleJob.getById(2112));
            }
            if (!isAran() && !isCygnus() && level == 69) {
                if (is2ndJob()) {
                    changeJob(MapleJob.getById(job_ + 1));
                } else {
                    NPCScriptManager.getInstance().start(getClient(), 2003, null, null);
                }
            } else if (!isCygnus() && !isAran() && level == 119) {
                if (is3rdJob()) {
                    changeJob(MapleJob.getById(job_ + 1));
                } else if (is2ndJob()) {
                    
                } else {
                    NPCScriptManager.getInstance().start(getClient(), 2003, null, null);
                }
            }
        }
    }
Credits:
V97: I only take credit in writing the actual command. The method has already been implemented in XeonMS v97.
V111: I take full credit in writing the whole command.
 
Last edited:
you'll never get good if you think like this. you should alway make sure it's noob friendly so that could just add for example their ids into an array or something and it would work. learned this from someone.

Asking for somebody who doesn't understand the concept of future proofing to future proof something is not reasonable. Its better to do it this way first so later you are able to understand why you would want to make something more dynamic. Skipping the "hard code" step means that you don't truley know how to make something dynamic because you never understood that was wrong in the first place.
 
Asking for somebody who doesn't understand the concept of future proofing to future proof something is not reasonable. Its better to do it this way first so later you are able to understand why you would want to make something more dynamic. Skipping the "hard code" step means that you don't truley know how to make something dynamic because you never understood that was wrong in the first place.

Thanks for understanding. Hopefully this will help me learn.
 
Instead of having level and job checks on both you should just make the autoJob a boolean and have it return false if the character can't change job yet and then in the command you can just have something like...

Code:
if (autoJob) {
    player.dropMessage("You have advanced.");
} else {
    player.dropMessage("You can't advance yet because I said so...");
}

No need to check job and levels twice.
 
Instead of having level and job checks on both you should just make the autoJob a boolean and have it return false if the character can't change job yet and then in the command you can just have something like...

Code:
if (autoJob) {
    player.dropMessage("You have advanced.");
} else {
    player.dropMessage("You can't advance yet because I said so...");
}

No need to check job and levels twice.

I didn't code the autojob. Not that good yet haha, it was already in my source. (XEONMS v97)
 
I didn't code the autojob. Not that good yet haha, it was already in my source. (XEONMS v97)

I know but I just said that because in your command your using that function, so assuming you at least looked at it you should know that there are checks in it there fore not being needed in your command, so instead you could have that command coded in 4 lines (like I showed you as an example) with a couple of small modifications to autoJob.

Also, this is another way to improve your command without changing autoJob.

Code:
int oldJob = player.getJobId();
player.autoJob();
if (oldJob != player.getJobId()) {
    player.dropMessage("You have advanced.");
} else {
    player.dropMessage("You can't advance yet because I said so...");
}

Note: I am just giving you constructive criticism in order to help you improve so please don't take it the wrong way.
 
Back