瀏覽代碼

ench 6 support

janiii 16 年之前
父節點
當前提交
71c4e530fb
共有 1 個文件被更改,包括 84 次插入1 次删除
  1. 84 1
      L2_GameServer/java/net/sf/l2j/gameserver/skills/DocumentSkill.java

+ 84 - 1
L2_GameServer/java/net/sf/l2j/gameserver/skills/DocumentSkill.java

@@ -46,6 +46,7 @@ class DocumentSkill extends DocumentBase {
         public StatsSet[]           enchsets3;
         public StatsSet[]           enchsets4;
         public StatsSet[]           enchsets5;
+        public StatsSet[]           enchsets6;
         public int                  currentLevel;
         public List<L2Skill>   skills          = new FastList<L2Skill>();
         public List<L2Skill>   currentSkills   = new FastList<L2Skill>();
@@ -138,6 +139,7 @@ class DocumentSkill extends DocumentBase {
         int enchantLevels3 = 0;
         int enchantLevels4 = 0;
         int enchantLevels5 = 0;
+        int enchantLevels6 = 0;
 		int skillId = Integer.parseInt(attrs.getNamedItem("id").getNodeValue());
 		String skillName = attrs.getNamedItem("name").getNodeValue();
 		String levels = attrs.getNamedItem("levels").getNodeValue();
@@ -152,6 +154,8 @@ class DocumentSkill extends DocumentBase {
             enchantLevels4 = Integer.parseInt(attrs.getNamedItem("enchantLevels4").getNodeValue());
         if (attrs.getNamedItem("enchantLevels5") != null)
             enchantLevels5 = Integer.parseInt(attrs.getNamedItem("enchantLevels5").getNodeValue());
+        if (attrs.getNamedItem("enchantLevels6") != null)
+            enchantLevels6 = Integer.parseInt(attrs.getNamedItem("enchantLevels6").getNodeValue());
 
         _currentSkill.id     = skillId;
         _currentSkill.name   = skillName;
@@ -161,6 +165,7 @@ class DocumentSkill extends DocumentBase {
         _currentSkill.enchsets3   = new StatsSet[enchantLevels3];
         _currentSkill.enchsets4   = new StatsSet[enchantLevels4];
         _currentSkill.enchsets5   = new StatsSet[enchantLevels5];
+        _currentSkill.enchsets6   = new StatsSet[enchantLevels6];
 
 		for (int i=0; i < lastLvl; i++)
 		{
@@ -306,6 +311,29 @@ class DocumentSkill extends DocumentBase {
         if (_currentSkill.enchsets5.length != enchantLevels5)
             throw new RuntimeException("Skill id="+skillId+" number of levels missmatch, "+enchantLevels5+" levels expected");
 
+        for (int i=0; i < enchantLevels6; i++)
+        {
+            _currentSkill.enchsets6[i] = new StatsSet();
+            _currentSkill.enchsets6[i].set("skill_id", _currentSkill.id);
+            _currentSkill.enchsets6[i].set("level",    i+601);
+            _currentSkill.enchsets6[i].set("name",     _currentSkill.name);
+
+            for (n=first; n != null; n = n.getNextSibling())
+            {
+                if ("set".equalsIgnoreCase(n.getNodeName()))
+                    parseBeanSet(n, _currentSkill.enchsets6[i], _currentSkill.sets.length);
+            }
+
+            for (n=first; n != null; n = n.getNextSibling())
+            {
+                if ("enchant6".equalsIgnoreCase(n.getNodeName()))
+                    parseBeanSet(n, _currentSkill.enchsets6[i], i+1);
+            }
+        }
+
+        if (_currentSkill.enchsets6.length != enchantLevels6)
+            throw new RuntimeException("Skill id="+skillId+" number of levels missmatch, "+enchantLevels6+" levels expected");
+
         makeSkills();
 		for (int i=0; i < lastLvl; i++)
 		{
@@ -544,13 +572,55 @@ class DocumentSkill extends DocumentBase {
                 }
             }
         }
+        for (int i=lastLvl+enchantLevels1+enchantLevels2+enchantLevels3+enchantLevels4+enchantLevels5; i < lastLvl+enchantLevels1+enchantLevels2+enchantLevels3+enchantLevels4+enchantLevels5+enchantLevels6; i++)
+        {
+            boolean found = false;
+            _currentSkill.currentLevel = i-lastLvl-enchantLevels1-enchantLevels2-enchantLevels3-enchantLevels4-enchantLevels5;
+            for (n=first; n != null; n = n.getNextSibling())
+            {
+                if ("enchant6cond".equalsIgnoreCase(n.getNodeName()))
+                {
+                    found = true;
+                    Condition condition = parseCondition(n.getFirstChild(), _currentSkill.currentSkills.get(i));
+                    Node msg = n.getAttributes().getNamedItem("msg");
+                    if (condition != null && msg != null)
+                        condition.setMessage(msg.getNodeValue());
+                    _currentSkill.currentSkills.get(i).attach(condition,false);
+                }
+                if ("enchant6for".equalsIgnoreCase(n.getNodeName()))
+                {
+                    found = true;
+                    parseTemplate(n, _currentSkill.currentSkills.get(i));
+                }
+            }
+            // If none found, the enchanted skill will take effects from maxLvL of norm skill
+            if(!found)
+            {
+                _currentSkill.currentLevel = lastLvl-1;
+                for (n=first; n != null; n = n.getNextSibling())
+                {
+                    if ("cond".equalsIgnoreCase(n.getNodeName()))
+                    {
+                        Condition condition = parseCondition(n.getFirstChild(), _currentSkill.currentSkills.get(i));
+                        Node msg = n.getAttributes().getNamedItem("msg");
+                        if (condition != null && msg != null)
+                            condition.setMessage(msg.getNodeValue());
+                        _currentSkill.currentSkills.get(i).attach(condition,false);
+                    }
+                    if ("for".equalsIgnoreCase(n.getNodeName()))
+                    {
+                        parseTemplate(n, _currentSkill.currentSkills.get(i));
+                    }
+                }
+            }
+        }
         _currentSkill.skills.addAll(_currentSkill.currentSkills);
 	}
 
     private void makeSkills()
 	{
         int count = 0;
-        _currentSkill.currentSkills = new FastList<L2Skill>(_currentSkill.sets.length+_currentSkill.enchsets1.length+_currentSkill.enchsets2.length+_currentSkill.enchsets3.length+_currentSkill.enchsets4.length+_currentSkill.enchsets5.length);
+        _currentSkill.currentSkills = new FastList<L2Skill>(_currentSkill.sets.length+_currentSkill.enchsets1.length+_currentSkill.enchsets2.length+_currentSkill.enchsets3.length+_currentSkill.enchsets4.length+_currentSkill.enchsets5.length+_currentSkill.enchsets6.length);
 
 		for (int i=0; i < _currentSkill.sets.length; i++)
         {
@@ -629,5 +699,18 @@ class DocumentSkill extends DocumentBase {
                 _log.log(Level.SEVERE, "Skill id="+_currentSkill.enchsets5[i].getEnum("skillType", L2SkillType.class).makeSkill(_currentSkill.enchsets5[i]).getDisplayId()+" level="+_currentSkill.enchsets5[i].getEnum("skillType", L2SkillType.class).makeSkill(_currentSkill.enchsets5[i]).getLevel(), e);
             }
         }
+        _count = count;
+        for (int i=0; i < _currentSkill.enchsets6.length; i++)
+        {
+            try
+            {
+                _currentSkill.currentSkills.add(_count+i, _currentSkill.enchsets6[i].getEnum("skillType", L2SkillType.class).makeSkill(_currentSkill.enchsets6[i]));
+                count++;
+            }
+            catch (Exception e)
+            {
+                _log.log(Level.SEVERE, "Skill id="+_currentSkill.enchsets6[i].getEnum("skillType", L2SkillType.class).makeSkill(_currentSkill.enchsets6[i]).getDisplayId()+" level="+_currentSkill.enchsets6[i].getEnum("skillType", L2SkillType.class).makeSkill(_currentSkill.enchsets6[i]).getLevel(), e);
+            }
+        }
 	}
 }