|
@@ -22,6 +22,8 @@ import java.util.ArrayList;
|
|
|
import java.util.Arrays;
|
|
|
import java.util.Collection;
|
|
|
import java.util.HashMap;
|
|
|
+import java.util.LinkedHashMap;
|
|
|
+import java.util.LinkedList;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
import java.util.Map.Entry;
|
|
@@ -98,8 +100,8 @@ public final class SkillTreesData implements IXmlReader
|
|
|
|
|
|
private boolean _loading = true;
|
|
|
|
|
|
- /** Parent class Ids are read from XML and stored in this map, to allow easy customization. */
|
|
|
- private final Map<ClassId, ClassId> _parentClassMap = new HashMap<>();
|
|
|
+ /** Parent class IDs are read from XML and stored in this map, to allow easy customization. */
|
|
|
+ private final Map<ClassId, ClassId> _parentClassMap = new LinkedHashMap<>();
|
|
|
|
|
|
/**
|
|
|
* Instantiates a new skill trees data.
|
|
@@ -325,14 +327,25 @@ public final class SkillTreesData implements IXmlReader
|
|
|
*/
|
|
|
public Map<Integer, L2SkillLearn> getCompleteClassSkillTree(ClassId classId)
|
|
|
{
|
|
|
- final Map<Integer, L2SkillLearn> skillTree = new HashMap<>();
|
|
|
+ final Map<Integer, L2SkillLearn> skillTree = new LinkedHashMap<>();
|
|
|
// Add all skills that belong to all classes.
|
|
|
skillTree.putAll(_commonSkillTree);
|
|
|
- while ((classId != null) && (_classSkillTrees.get(classId) != null))
|
|
|
+
|
|
|
+ final LinkedList<ClassId> classSequence = new LinkedList<>();
|
|
|
+ while (classId != null)
|
|
|
{
|
|
|
- skillTree.putAll(_classSkillTrees.get(classId));
|
|
|
+ classSequence.addFirst(classId);
|
|
|
classId = _parentClassMap.get(classId);
|
|
|
}
|
|
|
+
|
|
|
+ for (ClassId cid : classSequence)
|
|
|
+ {
|
|
|
+ final Map<Integer, L2SkillLearn> classSkillTree = _classSkillTrees.get(cid);
|
|
|
+ if (classSkillTree != null)
|
|
|
+ {
|
|
|
+ skillTree.putAll(classSkillTree);
|
|
|
+ }
|
|
|
+ }
|
|
|
return skillTree;
|
|
|
}
|
|
|
|