DocumentSkill.java 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628
  1. /*
  2. * This program is free software: you can redistribute it and/or modify it under
  3. * the terms of the GNU General Public License as published by the Free Software
  4. * Foundation, either version 3 of the License, or (at your option) any later
  5. * version.
  6. *
  7. * This program is distributed in the hope that it will be useful, but WITHOUT
  8. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  9. * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  10. * details.
  11. *
  12. * You should have received a copy of the GNU General Public License along with
  13. * this program. If not, see <http://www.gnu.org/licenses/>.
  14. */
  15. package net.sf.l2j.gameserver.skills;
  16. import java.io.File;
  17. import java.util.List;
  18. import java.util.logging.Level;
  19. import javolution.util.FastList;
  20. import net.sf.l2j.gameserver.model.L2Skill;
  21. import net.sf.l2j.gameserver.skills.conditions.Condition;
  22. import net.sf.l2j.gameserver.templates.StatsSet;
  23. import net.sf.l2j.gameserver.templates.skills.L2SkillType;
  24. import org.w3c.dom.Document;
  25. import org.w3c.dom.NamedNodeMap;
  26. import org.w3c.dom.Node;
  27. /**
  28. * @author mkizub
  29. *
  30. * TODO To change the template for this generated type comment go to
  31. * Window - Preferences - Java - Code Style - Code Templates
  32. */
  33. class DocumentSkill extends DocumentBase {
  34. public class Skill
  35. {
  36. public int id;
  37. public String name;
  38. public StatsSet[] sets;
  39. public StatsSet[] enchsets1;
  40. public StatsSet[] enchsets2;
  41. public StatsSet[] enchsets3;
  42. public StatsSet[] enchsets4;
  43. public StatsSet[] enchsets5;
  44. public int currentLevel;
  45. public List<L2Skill> skills = new FastList<L2Skill>();
  46. public List<L2Skill> currentSkills = new FastList<L2Skill>();
  47. }
  48. private Skill _currentSkill;
  49. private List<L2Skill> _skillsInFile = new FastList<L2Skill>();
  50. DocumentSkill(File file)
  51. {
  52. super(file);
  53. }
  54. private void setCurrentSkill(Skill skill)
  55. {
  56. _currentSkill = skill;
  57. }
  58. @Override
  59. protected StatsSet getStatsSet()
  60. {
  61. return _currentSkill.sets[_currentSkill.currentLevel];
  62. }
  63. protected List<L2Skill> getSkills()
  64. {
  65. return _skillsInFile;
  66. }
  67. @Override
  68. protected String getTableValue(String name)
  69. {
  70. try
  71. {
  72. return _tables.get(name)[_currentSkill.currentLevel];
  73. }
  74. catch (RuntimeException e)
  75. {
  76. _log.log(Level.SEVERE, "Error in table: "+name+" of Skill Id "+_currentSkill.id, e);
  77. return "";
  78. }
  79. }
  80. @Override
  81. protected String getTableValue(String name, int idx)
  82. {
  83. try
  84. {
  85. return _tables.get(name)[idx-1];
  86. }
  87. catch (RuntimeException e)
  88. {
  89. _log.log(Level.SEVERE, "wrong level count in skill Id "+_currentSkill.id, e);
  90. return "";
  91. }
  92. }
  93. @Override
  94. protected void parseDocument(Document doc)
  95. {
  96. for (Node n=doc.getFirstChild(); n != null; n = n.getNextSibling())
  97. {
  98. if ("list".equalsIgnoreCase(n.getNodeName()))
  99. {
  100. for (Node d=n.getFirstChild(); d != null; d = d.getNextSibling())
  101. {
  102. if ("skill".equalsIgnoreCase(d.getNodeName()))
  103. {
  104. setCurrentSkill(new Skill());
  105. parseSkill(d);
  106. _skillsInFile.addAll(_currentSkill.skills);
  107. resetTable();
  108. }
  109. }
  110. }
  111. else if ("skill".equalsIgnoreCase(n.getNodeName()))
  112. {
  113. setCurrentSkill(new Skill());
  114. parseSkill(n);
  115. _skillsInFile.addAll(_currentSkill.skills);
  116. }
  117. }
  118. }
  119. protected void parseSkill(Node n)
  120. {
  121. NamedNodeMap attrs = n.getAttributes();
  122. int enchantLevels1 = 0;
  123. int enchantLevels2 = 0;
  124. int enchantLevels3 = 0;
  125. int enchantLevels4 = 0;
  126. int enchantLevels5 = 0;
  127. int skillId = Integer.parseInt(attrs.getNamedItem("id").getNodeValue());
  128. String skillName = attrs.getNamedItem("name").getNodeValue();
  129. String levels = attrs.getNamedItem("levels").getNodeValue();
  130. int lastLvl = Integer.parseInt(levels);
  131. if (attrs.getNamedItem("enchantLevels1") != null)
  132. enchantLevels1 = Integer.parseInt(attrs.getNamedItem("enchantLevels1").getNodeValue());
  133. if (attrs.getNamedItem("enchantLevels2") != null)
  134. enchantLevels2 = Integer.parseInt(attrs.getNamedItem("enchantLevels2").getNodeValue());
  135. if (attrs.getNamedItem("enchantLevels3") != null)
  136. enchantLevels3 = Integer.parseInt(attrs.getNamedItem("enchantLevels3").getNodeValue());
  137. if (attrs.getNamedItem("enchantLevels4") != null)
  138. enchantLevels4 = Integer.parseInt(attrs.getNamedItem("enchantLevels4").getNodeValue());
  139. if (attrs.getNamedItem("enchantLevels5") != null)
  140. enchantLevels5 = Integer.parseInt(attrs.getNamedItem("enchantLevels5").getNodeValue());
  141. _currentSkill.id = skillId;
  142. _currentSkill.name = skillName;
  143. _currentSkill.sets = new StatsSet[lastLvl];
  144. _currentSkill.enchsets1 = new StatsSet[enchantLevels1];
  145. _currentSkill.enchsets2 = new StatsSet[enchantLevels2];
  146. _currentSkill.enchsets3 = new StatsSet[enchantLevels3];
  147. _currentSkill.enchsets4 = new StatsSet[enchantLevels4];
  148. _currentSkill.enchsets5 = new StatsSet[enchantLevels5];
  149. for (int i=0; i < lastLvl; i++)
  150. {
  151. _currentSkill.sets[i] = new StatsSet();
  152. _currentSkill.sets[i].set("skill_id", _currentSkill.id);
  153. _currentSkill.sets[i].set("level", i+1);
  154. _currentSkill.sets[i].set("name", _currentSkill.name);
  155. }
  156. if (_currentSkill.sets.length != lastLvl)
  157. throw new RuntimeException("Skill id="+skillId+" number of levels missmatch, "+lastLvl+" levels expected");
  158. Node first = n.getFirstChild();
  159. for (n=first; n != null; n = n.getNextSibling())
  160. {
  161. if ("table".equalsIgnoreCase(n.getNodeName()))
  162. parseTable(n);
  163. }
  164. for (int i=1; i <= lastLvl; i++)
  165. {
  166. for (n=first; n != null; n = n.getNextSibling())
  167. {
  168. if ("set".equalsIgnoreCase(n.getNodeName()))
  169. parseBeanSet(n, _currentSkill.sets[i-1], i);
  170. }
  171. }
  172. for (int i=0; i < enchantLevels1; i++)
  173. {
  174. _currentSkill.enchsets1[i] = new StatsSet();
  175. _currentSkill.enchsets1[i].set("skill_id", _currentSkill.id);
  176. //currentSkill.enchsets1[i] = currentSkill.sets[currentSkill.sets.length-1];
  177. _currentSkill.enchsets1[i].set("level", i+101);
  178. _currentSkill.enchsets1[i].set("name", _currentSkill.name);
  179. //currentSkill.enchsets1[i].set("skillType", "NOTDONE");
  180. for (n=first; n != null; n = n.getNextSibling())
  181. {
  182. if ("set".equalsIgnoreCase(n.getNodeName()))
  183. parseBeanSet(n, _currentSkill.enchsets1[i], _currentSkill.sets.length);
  184. }
  185. for (n=first; n != null; n = n.getNextSibling())
  186. {
  187. if ("enchant1".equalsIgnoreCase(n.getNodeName()))
  188. parseBeanSet(n, _currentSkill.enchsets1[i], i+1);
  189. }
  190. }
  191. if (_currentSkill.enchsets1.length != enchantLevels1)
  192. throw new RuntimeException("Skill id="+skillId+" number of levels missmatch, "+enchantLevels1+" levels expected");
  193. for (int i=0; i < enchantLevels2; i++)
  194. {
  195. _currentSkill.enchsets2[i] = new StatsSet();
  196. //currentSkill.enchsets2[i] = currentSkill.sets[currentSkill.sets.length-1];
  197. _currentSkill.enchsets2[i].set("skill_id", _currentSkill.id);
  198. _currentSkill.enchsets2[i].set("level", i+201);
  199. _currentSkill.enchsets2[i].set("name", _currentSkill.name);
  200. //currentSkill.enchsets2[i].set("skillType", "NOTDONE");
  201. for (n=first; n != null; n = n.getNextSibling())
  202. {
  203. if ("set".equalsIgnoreCase(n.getNodeName()))
  204. parseBeanSet(n, _currentSkill.enchsets2[i], _currentSkill.sets.length);
  205. }
  206. for (n=first; n != null; n = n.getNextSibling())
  207. {
  208. if ("enchant2".equalsIgnoreCase(n.getNodeName()))
  209. parseBeanSet(n, _currentSkill.enchsets2[i], i+1);
  210. }
  211. }
  212. if (_currentSkill.enchsets2.length != enchantLevels2)
  213. throw new RuntimeException("Skill id="+skillId+" number of levels missmatch, "+enchantLevels2+" levels expected");
  214. for (int i=0; i < enchantLevels3; i++)
  215. {
  216. _currentSkill.enchsets3[i] = new StatsSet();
  217. _currentSkill.enchsets3[i].set("skill_id", _currentSkill.id);
  218. _currentSkill.enchsets3[i].set("level", i+301);
  219. _currentSkill.enchsets3[i].set("name", _currentSkill.name);
  220. for (n=first; n != null; n = n.getNextSibling())
  221. {
  222. if ("set".equalsIgnoreCase(n.getNodeName()))
  223. parseBeanSet(n, _currentSkill.enchsets3[i], _currentSkill.sets.length);
  224. }
  225. for (n=first; n != null; n = n.getNextSibling())
  226. {
  227. if ("enchant3".equalsIgnoreCase(n.getNodeName()))
  228. parseBeanSet(n, _currentSkill.enchsets3[i], i+1);
  229. }
  230. }
  231. if (_currentSkill.enchsets3.length != enchantLevels3)
  232. throw new RuntimeException("Skill id="+skillId+" number of levels missmatch, "+enchantLevels3+" levels expected");
  233. for (int i=0; i < enchantLevels4; i++)
  234. {
  235. _currentSkill.enchsets4[i] = new StatsSet();
  236. _currentSkill.enchsets4[i].set("skill_id", _currentSkill.id);
  237. _currentSkill.enchsets4[i].set("level", i+401);
  238. _currentSkill.enchsets4[i].set("name", _currentSkill.name);
  239. for (n=first; n != null; n = n.getNextSibling())
  240. {
  241. if ("set".equalsIgnoreCase(n.getNodeName()))
  242. parseBeanSet(n, _currentSkill.enchsets4[i], _currentSkill.sets.length);
  243. }
  244. for (n=first; n != null; n = n.getNextSibling())
  245. {
  246. if ("enchant4".equalsIgnoreCase(n.getNodeName()))
  247. parseBeanSet(n, _currentSkill.enchsets4[i], i+1);
  248. }
  249. }
  250. if (_currentSkill.enchsets4.length != enchantLevels4)
  251. throw new RuntimeException("Skill id="+skillId+" number of levels missmatch, "+enchantLevels4+" levels expected");
  252. for (int i=0; i < enchantLevels5; i++)
  253. {
  254. _currentSkill.enchsets5[i] = new StatsSet();
  255. _currentSkill.enchsets5[i].set("skill_id", _currentSkill.id);
  256. _currentSkill.enchsets5[i].set("level", i+501);
  257. _currentSkill.enchsets5[i].set("name", _currentSkill.name);
  258. for (n=first; n != null; n = n.getNextSibling())
  259. {
  260. if ("set".equalsIgnoreCase(n.getNodeName()))
  261. parseBeanSet(n, _currentSkill.enchsets5[i], _currentSkill.sets.length);
  262. }
  263. for (n=first; n != null; n = n.getNextSibling())
  264. {
  265. if ("enchant5".equalsIgnoreCase(n.getNodeName()))
  266. parseBeanSet(n, _currentSkill.enchsets5[i], i+1);
  267. }
  268. }
  269. if (_currentSkill.enchsets5.length != enchantLevels5)
  270. throw new RuntimeException("Skill id="+skillId+" number of levels missmatch, "+enchantLevels5+" levels expected");
  271. makeSkills();
  272. for (int i=0; i < lastLvl; i++)
  273. {
  274. _currentSkill.currentLevel = i;
  275. for (n=first; n != null; n = n.getNextSibling())
  276. {
  277. if ("cond".equalsIgnoreCase(n.getNodeName()))
  278. {
  279. Condition condition = parseCondition(n.getFirstChild(), _currentSkill.currentSkills.get(i));
  280. Node msg = n.getAttributes().getNamedItem("msg");
  281. Node msgId = n.getAttributes().getNamedItem("msgId");
  282. if (condition != null && msg != null)
  283. condition.setMessage(msg.getNodeValue());
  284. else if (condition != null && msgId != null)
  285. condition.setMessageId(Integer.decode(getValue(msgId.getNodeValue(), null)));
  286. _currentSkill.currentSkills.get(i).attach(condition, false);
  287. }
  288. if ("for".equalsIgnoreCase(n.getNodeName()))
  289. {
  290. parseTemplate(n, _currentSkill.currentSkills.get(i));
  291. }
  292. }
  293. }
  294. for (int i=lastLvl; i < lastLvl+enchantLevels1; i++)
  295. {
  296. _currentSkill.currentLevel = i-lastLvl;
  297. boolean found = false;
  298. for (n=first; n != null; n = n.getNextSibling())
  299. {
  300. if ("enchant1cond".equalsIgnoreCase(n.getNodeName()))
  301. {
  302. found = true;
  303. Condition condition = parseCondition(n.getFirstChild(), _currentSkill.currentSkills.get(i));
  304. Node msg = n.getAttributes().getNamedItem("msg");
  305. if (condition != null && msg != null)
  306. condition.setMessage(msg.getNodeValue());
  307. _currentSkill.currentSkills.get(i).attach(condition,false);
  308. }
  309. if ("enchant1for".equalsIgnoreCase(n.getNodeName()))
  310. {
  311. found = true;
  312. parseTemplate(n, _currentSkill.currentSkills.get(i));
  313. }
  314. }
  315. // If none found, the enchanted skill will take effects from maxLvL of norm skill
  316. if (!found)
  317. {
  318. _currentSkill.currentLevel = lastLvl-1;
  319. for (n=first; n != null; n = n.getNextSibling())
  320. {
  321. if ("cond".equalsIgnoreCase(n.getNodeName()))
  322. {
  323. Condition condition = parseCondition(n.getFirstChild(), _currentSkill.currentSkills.get(i));
  324. Node msg = n.getAttributes().getNamedItem("msg");
  325. if (condition != null && msg != null)
  326. condition.setMessage(msg.getNodeValue());
  327. _currentSkill.currentSkills.get(i).attach(condition,false);
  328. }
  329. if ("for".equalsIgnoreCase(n.getNodeName()))
  330. {
  331. parseTemplate(n, _currentSkill.currentSkills.get(i));
  332. }
  333. }
  334. }
  335. }
  336. for (int i=lastLvl+enchantLevels1; i < lastLvl+enchantLevels1+enchantLevels2; i++)
  337. {
  338. boolean found = false;
  339. _currentSkill.currentLevel = i-lastLvl-enchantLevels1;
  340. for (n=first; n != null; n = n.getNextSibling())
  341. {
  342. if ("enchant2cond".equalsIgnoreCase(n.getNodeName()))
  343. {
  344. found = true;
  345. Condition condition = parseCondition(n.getFirstChild(), _currentSkill.currentSkills.get(i));
  346. Node msg = n.getAttributes().getNamedItem("msg");
  347. if (condition != null && msg != null)
  348. condition.setMessage(msg.getNodeValue());
  349. _currentSkill.currentSkills.get(i).attach(condition,false);
  350. }
  351. if ("enchant2for".equalsIgnoreCase(n.getNodeName()))
  352. {
  353. found = true;
  354. parseTemplate(n, _currentSkill.currentSkills.get(i));
  355. }
  356. }
  357. // If none found, the enchanted skill will take effects from maxLvL of norm skill
  358. if(!found)
  359. {
  360. _currentSkill.currentLevel = lastLvl-1;
  361. for (n=first; n != null; n = n.getNextSibling())
  362. {
  363. if ("cond".equalsIgnoreCase(n.getNodeName()))
  364. {
  365. Condition condition = parseCondition(n.getFirstChild(), _currentSkill.currentSkills.get(i));
  366. Node msg = n.getAttributes().getNamedItem("msg");
  367. if (condition != null && msg != null)
  368. condition.setMessage(msg.getNodeValue());
  369. _currentSkill.currentSkills.get(i).attach(condition,false);
  370. }
  371. if ("for".equalsIgnoreCase(n.getNodeName()))
  372. {
  373. parseTemplate(n, _currentSkill.currentSkills.get(i));
  374. }
  375. }
  376. }
  377. }
  378. for (int i=lastLvl+enchantLevels1+enchantLevels2; i < lastLvl+enchantLevels1+enchantLevels2+enchantLevels3; i++)
  379. {
  380. boolean found = false;
  381. _currentSkill.currentLevel = i-lastLvl-enchantLevels1-enchantLevels2;
  382. for (n=first; n != null; n = n.getNextSibling())
  383. {
  384. if ("enchant3cond".equalsIgnoreCase(n.getNodeName()))
  385. {
  386. found = true;
  387. Condition condition = parseCondition(n.getFirstChild(), _currentSkill.currentSkills.get(i));
  388. Node msg = n.getAttributes().getNamedItem("msg");
  389. if (condition != null && msg != null)
  390. condition.setMessage(msg.getNodeValue());
  391. _currentSkill.currentSkills.get(i).attach(condition,false);
  392. }
  393. if ("enchant3for".equalsIgnoreCase(n.getNodeName()))
  394. {
  395. found = true;
  396. parseTemplate(n, _currentSkill.currentSkills.get(i));
  397. }
  398. }
  399. // If none found, the enchanted skill will take effects from maxLvL of norm skill
  400. if(!found)
  401. {
  402. _currentSkill.currentLevel = lastLvl-1;
  403. for (n=first; n != null; n = n.getNextSibling())
  404. {
  405. if ("cond".equalsIgnoreCase(n.getNodeName()))
  406. {
  407. Condition condition = parseCondition(n.getFirstChild(), _currentSkill.currentSkills.get(i));
  408. Node msg = n.getAttributes().getNamedItem("msg");
  409. if (condition != null && msg != null)
  410. condition.setMessage(msg.getNodeValue());
  411. _currentSkill.currentSkills.get(i).attach(condition,false);
  412. }
  413. if ("for".equalsIgnoreCase(n.getNodeName()))
  414. {
  415. parseTemplate(n, _currentSkill.currentSkills.get(i));
  416. }
  417. }
  418. }
  419. }
  420. for (int i=lastLvl+enchantLevels1+enchantLevels2+enchantLevels3; i < lastLvl+enchantLevels1+enchantLevels2+enchantLevels3+enchantLevels4; i++)
  421. {
  422. boolean found = false;
  423. _currentSkill.currentLevel = i-lastLvl-enchantLevels1-enchantLevels2-enchantLevels3;
  424. for (n=first; n != null; n = n.getNextSibling())
  425. {
  426. if ("enchant4cond".equalsIgnoreCase(n.getNodeName()))
  427. {
  428. found = true;
  429. Condition condition = parseCondition(n.getFirstChild(), _currentSkill.currentSkills.get(i));
  430. Node msg = n.getAttributes().getNamedItem("msg");
  431. if (condition != null && msg != null)
  432. condition.setMessage(msg.getNodeValue());
  433. _currentSkill.currentSkills.get(i).attach(condition,false);
  434. }
  435. if ("enchant4for".equalsIgnoreCase(n.getNodeName()))
  436. {
  437. found = true;
  438. parseTemplate(n, _currentSkill.currentSkills.get(i));
  439. }
  440. }
  441. // If none found, the enchanted skill will take effects from maxLvL of norm skill
  442. if(!found)
  443. {
  444. _currentSkill.currentLevel = lastLvl-1;
  445. for (n=first; n != null; n = n.getNextSibling())
  446. {
  447. if ("cond".equalsIgnoreCase(n.getNodeName()))
  448. {
  449. Condition condition = parseCondition(n.getFirstChild(), _currentSkill.currentSkills.get(i));
  450. Node msg = n.getAttributes().getNamedItem("msg");
  451. if (condition != null && msg != null)
  452. condition.setMessage(msg.getNodeValue());
  453. _currentSkill.currentSkills.get(i).attach(condition,false);
  454. }
  455. if ("for".equalsIgnoreCase(n.getNodeName()))
  456. {
  457. parseTemplate(n, _currentSkill.currentSkills.get(i));
  458. }
  459. }
  460. }
  461. }
  462. for (int i=lastLvl+enchantLevels1+enchantLevels2+enchantLevels3+enchantLevels4; i < lastLvl+enchantLevels1+enchantLevels2+enchantLevels3+enchantLevels4+enchantLevels5; i++)
  463. {
  464. boolean found = false;
  465. _currentSkill.currentLevel = i-lastLvl-enchantLevels1-enchantLevels2-enchantLevels3-enchantLevels4;
  466. for (n=first; n != null; n = n.getNextSibling())
  467. {
  468. if ("enchant5cond".equalsIgnoreCase(n.getNodeName()))
  469. {
  470. found = true;
  471. Condition condition = parseCondition(n.getFirstChild(), _currentSkill.currentSkills.get(i));
  472. Node msg = n.getAttributes().getNamedItem("msg");
  473. if (condition != null && msg != null)
  474. condition.setMessage(msg.getNodeValue());
  475. _currentSkill.currentSkills.get(i).attach(condition,false);
  476. }
  477. if ("enchant5for".equalsIgnoreCase(n.getNodeName()))
  478. {
  479. found = true;
  480. parseTemplate(n, _currentSkill.currentSkills.get(i));
  481. }
  482. }
  483. // If none found, the enchanted skill will take effects from maxLvL of norm skill
  484. if(!found)
  485. {
  486. _currentSkill.currentLevel = lastLvl-1;
  487. for (n=first; n != null; n = n.getNextSibling())
  488. {
  489. if ("cond".equalsIgnoreCase(n.getNodeName()))
  490. {
  491. Condition condition = parseCondition(n.getFirstChild(), _currentSkill.currentSkills.get(i));
  492. Node msg = n.getAttributes().getNamedItem("msg");
  493. if (condition != null && msg != null)
  494. condition.setMessage(msg.getNodeValue());
  495. _currentSkill.currentSkills.get(i).attach(condition,false);
  496. }
  497. if ("for".equalsIgnoreCase(n.getNodeName()))
  498. {
  499. parseTemplate(n, _currentSkill.currentSkills.get(i));
  500. }
  501. }
  502. }
  503. }
  504. _currentSkill.skills.addAll(_currentSkill.currentSkills);
  505. }
  506. private void makeSkills()
  507. {
  508. int count = 0;
  509. _currentSkill.currentSkills = new FastList<L2Skill>(_currentSkill.sets.length+_currentSkill.enchsets1.length+_currentSkill.enchsets2.length+_currentSkill.enchsets3.length+_currentSkill.enchsets4.length+_currentSkill.enchsets5.length);
  510. for (int i=0; i < _currentSkill.sets.length; i++)
  511. {
  512. try
  513. {
  514. _currentSkill.currentSkills.add(i, _currentSkill.sets[i].getEnum("skillType", L2SkillType.class).makeSkill(_currentSkill.sets[i]));
  515. count++;
  516. }
  517. catch (Exception e)
  518. {
  519. _log.log(Level.SEVERE, "Skill id="+_currentSkill.sets[i].getEnum("skillType", L2SkillType.class).makeSkill(_currentSkill.sets[i]).getDisplayId()+"level"+_currentSkill.sets[i].getEnum("skillType", L2SkillType.class).makeSkill(_currentSkill.sets[i]).getLevel(), e);
  520. }
  521. }
  522. int _count = count;
  523. for (int i=0; i < _currentSkill.enchsets1.length; i++)
  524. {
  525. try
  526. {
  527. _currentSkill.currentSkills.add(_count+i, _currentSkill.enchsets1[i].getEnum("skillType", L2SkillType.class).makeSkill(_currentSkill.enchsets1[i]));
  528. count++;
  529. }
  530. catch (Exception e)
  531. {
  532. _log.log(Level.SEVERE, "Skill id="+_currentSkill.enchsets1[i].getEnum("skillType", L2SkillType.class).makeSkill(_currentSkill.enchsets1[i]).getDisplayId()+" level="+_currentSkill.enchsets1[i].getEnum("skillType", L2SkillType.class).makeSkill(_currentSkill.enchsets1[i]).getLevel(), e);
  533. }
  534. }
  535. _count = count;
  536. for (int i=0; i < _currentSkill.enchsets2.length; i++)
  537. {
  538. try
  539. {
  540. _currentSkill.currentSkills.add(_count+i, _currentSkill.enchsets2[i].getEnum("skillType", L2SkillType.class).makeSkill(_currentSkill.enchsets2[i]));
  541. count++;
  542. }
  543. catch (Exception e)
  544. {
  545. _log.log(Level.SEVERE, "Skill id="+_currentSkill.enchsets2[i].getEnum("skillType", L2SkillType.class).makeSkill(_currentSkill.enchsets2[i]).getDisplayId()+" level="+_currentSkill.enchsets2[i].getEnum("skillType", L2SkillType.class).makeSkill(_currentSkill.enchsets2[i]).getLevel(), e);
  546. }
  547. }
  548. _count = count;
  549. for (int i=0; i < _currentSkill.enchsets3.length; i++)
  550. {
  551. try
  552. {
  553. _currentSkill.currentSkills.add(_count+i, _currentSkill.enchsets3[i].getEnum("skillType", L2SkillType.class).makeSkill(_currentSkill.enchsets3[i]));
  554. count++;
  555. }
  556. catch (Exception e)
  557. {
  558. _log.log(Level.SEVERE, "Skill id="+_currentSkill.enchsets3[i].getEnum("skillType", L2SkillType.class).makeSkill(_currentSkill.enchsets3[i]).getDisplayId()+" level="+_currentSkill.enchsets3[i].getEnum("skillType", L2SkillType.class).makeSkill(_currentSkill.enchsets3[i]).getLevel(), e);
  559. }
  560. }
  561. _count = count;
  562. for (int i=0; i < _currentSkill.enchsets4.length; i++)
  563. {
  564. try
  565. {
  566. _currentSkill.currentSkills.add(_count+i, _currentSkill.enchsets4[i].getEnum("skillType", L2SkillType.class).makeSkill(_currentSkill.enchsets4[i]));
  567. count++;
  568. }
  569. catch (Exception e)
  570. {
  571. _log.log(Level.SEVERE, "Skill id="+_currentSkill.enchsets4[i].getEnum("skillType", L2SkillType.class).makeSkill(_currentSkill.enchsets4[i]).getDisplayId()+" level="+_currentSkill.enchsets4[i].getEnum("skillType", L2SkillType.class).makeSkill(_currentSkill.enchsets4[i]).getLevel(), e);
  572. }
  573. }
  574. _count = count;
  575. for (int i=0; i < _currentSkill.enchsets5.length; i++)
  576. {
  577. try
  578. {
  579. _currentSkill.currentSkills.add(_count+i, _currentSkill.enchsets5[i].getEnum("skillType", L2SkillType.class).makeSkill(_currentSkill.enchsets5[i]));
  580. count++;
  581. }
  582. catch (Exception e)
  583. {
  584. _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);
  585. }
  586. }
  587. }
  588. }