Fixing a bug with Axe Mastery rank requirements

This commit is contained in:
nossr50 2019-01-03 04:59:56 -08:00
parent 54cf356b71
commit fe90f1e7eb
2 changed files with 21 additions and 4 deletions

View File

@ -698,7 +698,18 @@ public class AdvancedConfig extends AutoUpdateConfigLoader {
@Deprecated @Deprecated
public int getSubSkillUnlockLevel(SubSkill subSkill, int rank) public int getSubSkillUnlockLevel(SubSkill subSkill, int rank)
{ {
/*
* This is a bit messy but
*
* Some skills have per-rank settings as child nodes for Rank_x nodes
* If they do, we have to grab the child node named LevelReq from Rank_x for that skill
*
* Other skills which do not have complex per-rank settings will instead find their Level Requirement returned at Rank_x
*/
if(config.get(subSkill.getAdvConfigAddress() + ".Rank_Levels.Rank_"+rank+".LevelReq") != null)
return config.getInt(subSkill.getAdvConfigAddress() + ".Rank_Levels.Rank_"+rank+".LevelReq"); return config.getInt(subSkill.getAdvConfigAddress() + ".Rank_Levels.Rank_"+rank+".LevelReq");
else
return config.getInt(subSkill.getAdvConfigAddress() + ".Rank_Levels.Rank_"+rank);
} }
/** /**

View File

@ -22,6 +22,9 @@ public class RankUtils {
{ {
//This adds the highest ranks first //This adds the highest ranks first
addRank(subSkill, numRanks-i); addRank(subSkill, numRanks-i);
//TODO: Remove debug code
/*System.out.println("DEBUG: Adding rank "+(numRanks-i)+" to "+subSkill.toString());*/
} }
} }
@ -52,10 +55,12 @@ public class RankUtils {
{ {
//Compare against the highest to lowest rank in that order //Compare against the highest to lowest rank in that order
int rank = subSkill.getNumRanks()-i; int rank = subSkill.getNumRanks()-i;
//System.out.println("Checking rank "+rank+" of "+subSkill.getNumRanks());
int unlockLevel = getUnlockLevel(subSkill, rank); int unlockLevel = getUnlockLevel(subSkill, rank);
//System.out.println("Rank "+rank+" -- Unlock level: "+unlockLevel);
//System.out.println("Rank" +rank+" -- Player Skill Level: "+currentSkillLevel); //TODO: Remove this debug code
/*System.out.println("[DEBUG RANKCHECK] Checking rank "+rank+" of "+subSkill.getNumRanks());
System.out.println("[DEBUG RANKCHECK] Rank "+rank+" -- Unlock level: "+unlockLevel);
System.out.println("[DEBUG RANKCHECK] Rank" +rank+" -- Player Skill Level: "+currentSkillLevel);*/
//If we check all ranks and still cannot unlock the skill, we return rank 0 //If we check all ranks and still cannot unlock the skill, we return rank 0
if(rank == 0) if(rank == 0)
@ -84,6 +89,7 @@ public class RankUtils {
HashMap<Integer, Integer> rankMap = subSkillRanks.get(subSkill); HashMap<Integer, Integer> rankMap = subSkillRanks.get(subSkill);
System.out.println("[DEBUG]: Rank "+rank+" for "+subSkill.toString()+" requires skill level "+getUnlockLevel(subSkill, rank));
rankMap.put(rank, getUnlockLevel(subSkill, rank)); rankMap.put(rank, getUnlockLevel(subSkill, rank));
} }