Maxing Mastery

Junior Spellweaver
Joined
Feb 22, 2009
Messages
112
Reaction score
2
I had a thread here once about this, I thought i fixed my problem. But i further tested and i did not. In ourstory v142 4th job skills are locked there mastery levels are set to 0. I created a work around where when you change jobs it calls the method changeSingleSkillLevel() and that is used in the MaxSkillsByJob function. I used that method and took out the part that maxed skills and left the mastery part in there. Example of my method,
PHP:
public void changeSingleSkillLevel1(Skill skill, byte newMasterlevel, long expiration) {
        Map list = new HashMap();
        boolean hasRecovery = false;
        boolean recalculate = false;
        if (changeSkillData1(skill, newMasterlevel, expiration)) {
            list.put(skill, new SkillEntry(newMasterlevel, expiration));
            if (GameConstants.isRecoveryIncSkill(skill.getId())) {
                hasRecovery = true;
            }
            //if (skill.getId() < 80000000) {
                //recalculate = true;
           // }
        }
        if (list.isEmpty()) {
            return;
        }
        this.client.getSession().write(CWvsContext.updateSkills(list));
        reUpdateStat(hasRecovery, recalculate);
    }
This did the trick 4th job skills get the mastery and skills arent maxed, although each time you change jobs you get a bit of lag but whatever it worked. Problem is, it resets all the skill levels to 0, so say you had your 1st,2nd,3rd job skills all maxed out, when you get your fourth job your prior job skills are all level 0 again... Now i cant see why since the skill level part of the method is removed.. This is the method i call when changing jobs.
PHP:
public final void maxMastery() {
        for (Skill skil : SkillFactory.getAllSkills()) {
            if (GameConstants.isApplicableSkill(skil.getId()) && skil.canBeLearnedBy(getJob()) && GameConstants.canuseskill(skil.getId())) { //no db/additionals/resistance skills
                // if (GameConstants.isApplicableSkill(skil.getId()) && skil.canBeLearnedBy(getJob())) { 
                changeSingleSkillLevel1(SkillFactory.getSkill(skil.getId()), (byte) skil.getMaxLevel(), -1);
            }
        }
    }
With this i noticed its calling all skills, i saw theres a method in skillfactory.java like the same as getAllSkills but called getSkillsByJob(). Thought i could do that and just list the job ids i want to max and it wouldnt reset the skills in prior jobs. But i cant seem to convert it, i cant work past the errors. Does anyone have a solution to this problem? It would be greatly appreciated, id love to further my learning. Very sorry for the huge wall of text here!
 
PHP:
public final void maxMastery() {
    HashMap<Skill, SkillEntry> sa = new HashMap<>();
    for (Skill skil : SkillFactory.getAllSkills()) {
        if (GameConstants.isApplicableSkill(skil.getId()) && (skil.getId() / 10000) == getJobId()) {
				sa.put(skil, new SkillEntry((byte) (getSkillLevel(skil.getId()) > 0 ? getSkillLevel(skil.getId()) : 0), (byte) skil.getMaxLevel(), SkillFactory.getDefaultSExpiry(skil)));
		}
    }
    changeSkillsLevel(sa);
}

This will give every skill corresponding to your jobid mastery. You can send this every job advance, or just at 4th job.
 
Last edited:
Upvote 0
PHP:
public final void maxMastery() {
    HashMap<Skill, SkillEntry> sa = new HashMap<>();
    for (Skill skil : SkillFactory.getAllSkills()) {
        if (GameConstants.isApplicableSkill(skil.getId()) && (skil.getId() / 10000) == getJobId()) {
				sa.put(skil, new SkillEntry((byte) (getSkillLevel(skil.getId()) > 0 ? getSkillLevel(skil.getId()) : 0), (byte) skil.getMaxLevel(), SkillFactory.getDefaultSExpiry(skil)));
		}
    }
    changeSkillsLevel(sa);
}

This will give every skill corresponding to your jobid mastery. You can send this every job advance, or just at 4th job.

Thanks chunk, your honestly the biggest help. I was gettin there but not quite :/ Ill use this and read it to see what you did.

EDIT: Weird, it seems to make my fourth job skills 0 still :/ Although i see that the mastery spot is skl.getMaxLevel() it should work :/ Is there a mistake?
 
Last edited:
Upvote 0
Thanks chunk, your honestly the biggest help. I was gettin there but not quite :/ Ill use this and read it to see what you did.

EDIT: Weird, it seems to make my fourth job skills 0 still :/ Although i see that the mastery spot is skl.getMaxLevel() it should work :/ Is there a mistake?

Hmm, odd. Do you mean it's not giving them points/maxing them? It should make them 0, but give them master level.. Works for me, not sure what went wrong unless you meant to give them their points. If so, just change the first byte (the ternary) to skil.getMaxLevel(), and it'll max those skills. Otherwise, that's weird. What skill and/or job isn't doing it properly?
 
Upvote 0
Hmm, odd. Do you mean it's not giving them points/maxing them? It should make them 0, but give them master level.. Works for me, not sure what went wrong unless you meant to give them their points. If so, just change the first byte (the ternary) to skil.getMaxLevel(), and it'll max those skills. Otherwise, that's weird. What skill and/or job isn't doing it properly?
No it just does set my mastery to the maxlevel, my skills are 0 also, but i want them to stay at 0. I want the mastery to unlock, but ill try restarting the server its debugging, i didnt add a new method i just took the code and added it under public final void maxMastery() { so it would allow me to hotswap :P Maybe it needs to restart though ill try. And edit this post letting you know for sure!
 
Upvote 0
No it just does set my mastery to the maxlevel, my skills are 0 also, but i want them to stay at 0. I want the mastery to unlock, but ill try restarting the server its debugging, i didnt add a new method i just took the code and added it under public final void maxMastery() { so it would allow me to hotswap :P Maybe it needs to restart though ill try. And edit this post letting you know for sure!

wat? you need to restart.. the server reads from the JAR file that was compiled, you can't just "hotswap" a function lol..
 
Upvote 0
wat? you need to restart.. the server reads from the JAR file that was compiled, you can't just "hotswap" a function lol..
I just added the code part underneath my already existing Function , normally it allows you because your not adding a brand new method your just changing the code. Plus it pops up saying you cant hotswap if there was an error so.. Im restarting anyways but im just saying.
PHP:
HashMap<Skill, SkillEntry> sa = new HashMap<>();
    for (Skill skil : SkillFactory.getAllSkills()) {
        if (GameConstants.isApplicableSkill(skil.getId()) && (skil.getId() / 10000) == getJobId()) {
                sa.put(skil, new SkillEntry((byte) (getSkillLevel(skil.getId()) > 0 ? getSkillLevel(skil.getId()) : 0), (byte) skil.getMaxLevel(), SkillFactory.getDefaultSExpiry(skil)));
        }
    }
    changeSkillsLevel(sa);
}

EDIT: Its deffinitly not workin for me :/ I wonder why O.o
 
Last edited:
Upvote 0
Back