DocumentSkill.java 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625
  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.model.L2Skill.SkillType;
  22. import net.sf.l2j.gameserver.skills.conditions.Condition;
  23. import net.sf.l2j.gameserver.templates.StatsSet;
  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. if (condition != null && msg != null)
  282. condition.setMessage(msg.getNodeValue());
  283. _currentSkill.currentSkills.get(i).attach(condition, false);
  284. }
  285. if ("for".equalsIgnoreCase(n.getNodeName()))
  286. {
  287. parseTemplate(n, _currentSkill.currentSkills.get(i));
  288. }
  289. }
  290. }
  291. for (int i=lastLvl; i < lastLvl+enchantLevels1; i++)
  292. {
  293. _currentSkill.currentLevel = i-lastLvl;
  294. boolean found = false;
  295. for (n=first; n != null; n = n.getNextSibling())
  296. {
  297. if ("enchant1cond".equalsIgnoreCase(n.getNodeName()))
  298. {
  299. found = true;
  300. Condition condition = parseCondition(n.getFirstChild(), _currentSkill.currentSkills.get(i));
  301. Node msg = n.getAttributes().getNamedItem("msg");
  302. if (condition != null && msg != null)
  303. condition.setMessage(msg.getNodeValue());
  304. _currentSkill.currentSkills.get(i).attach(condition,false);
  305. }
  306. if ("enchant1for".equalsIgnoreCase(n.getNodeName()))
  307. {
  308. found = true;
  309. parseTemplate(n, _currentSkill.currentSkills.get(i));
  310. }
  311. }
  312. // If none found, the enchanted skill will take effects from maxLvL of norm skill
  313. if (!found)
  314. {
  315. _currentSkill.currentLevel = lastLvl-1;
  316. for (n=first; n != null; n = n.getNextSibling())
  317. {
  318. if ("cond".equalsIgnoreCase(n.getNodeName()))
  319. {
  320. Condition condition = parseCondition(n.getFirstChild(), _currentSkill.currentSkills.get(i));
  321. Node msg = n.getAttributes().getNamedItem("msg");
  322. if (condition != null && msg != null)
  323. condition.setMessage(msg.getNodeValue());
  324. _currentSkill.currentSkills.get(i).attach(condition,false);
  325. }
  326. if ("for".equalsIgnoreCase(n.getNodeName()))
  327. {
  328. parseTemplate(n, _currentSkill.currentSkills.get(i));
  329. }
  330. }
  331. }
  332. }
  333. for (int i=lastLvl+enchantLevels1; i < lastLvl+enchantLevels1+enchantLevels2; i++)
  334. {
  335. boolean found = false;
  336. _currentSkill.currentLevel = i-lastLvl-enchantLevels1;
  337. for (n=first; n != null; n = n.getNextSibling())
  338. {
  339. if ("enchant2cond".equalsIgnoreCase(n.getNodeName()))
  340. {
  341. found = true;
  342. Condition condition = parseCondition(n.getFirstChild(), _currentSkill.currentSkills.get(i));
  343. Node msg = n.getAttributes().getNamedItem("msg");
  344. if (condition != null && msg != null)
  345. condition.setMessage(msg.getNodeValue());
  346. _currentSkill.currentSkills.get(i).attach(condition,false);
  347. }
  348. if ("enchant2for".equalsIgnoreCase(n.getNodeName()))
  349. {
  350. found = true;
  351. parseTemplate(n, _currentSkill.currentSkills.get(i));
  352. }
  353. }
  354. // If none found, the enchanted skill will take effects from maxLvL of norm skill
  355. if(!found)
  356. {
  357. _currentSkill.currentLevel = lastLvl-1;
  358. for (n=first; n != null; n = n.getNextSibling())
  359. {
  360. if ("cond".equalsIgnoreCase(n.getNodeName()))
  361. {
  362. Condition condition = parseCondition(n.getFirstChild(), _currentSkill.currentSkills.get(i));
  363. Node msg = n.getAttributes().getNamedItem("msg");
  364. if (condition != null && msg != null)
  365. condition.setMessage(msg.getNodeValue());
  366. _currentSkill.currentSkills.get(i).attach(condition,false);
  367. }
  368. if ("for".equalsIgnoreCase(n.getNodeName()))
  369. {
  370. parseTemplate(n, _currentSkill.currentSkills.get(i));
  371. }
  372. }
  373. }
  374. }
  375. for (int i=lastLvl+enchantLevels1+enchantLevels2; i < lastLvl+enchantLevels1+enchantLevels2+enchantLevels3; i++)
  376. {
  377. boolean found = false;
  378. _currentSkill.currentLevel = i-lastLvl-enchantLevels1-enchantLevels2;
  379. for (n=first; n != null; n = n.getNextSibling())
  380. {
  381. if ("enchant3cond".equalsIgnoreCase(n.getNodeName()))
  382. {
  383. found = true;
  384. Condition condition = parseCondition(n.getFirstChild(), _currentSkill.currentSkills.get(i));
  385. Node msg = n.getAttributes().getNamedItem("msg");
  386. if (condition != null && msg != null)
  387. condition.setMessage(msg.getNodeValue());
  388. _currentSkill.currentSkills.get(i).attach(condition,false);
  389. }
  390. if ("enchant3for".equalsIgnoreCase(n.getNodeName()))
  391. {
  392. found = true;
  393. parseTemplate(n, _currentSkill.currentSkills.get(i));
  394. }
  395. }
  396. // If none found, the enchanted skill will take effects from maxLvL of norm skill
  397. if(!found)
  398. {
  399. _currentSkill.currentLevel = lastLvl-1;
  400. for (n=first; n != null; n = n.getNextSibling())
  401. {
  402. if ("cond".equalsIgnoreCase(n.getNodeName()))
  403. {
  404. Condition condition = parseCondition(n.getFirstChild(), _currentSkill.currentSkills.get(i));
  405. Node msg = n.getAttributes().getNamedItem("msg");
  406. if (condition != null && msg != null)
  407. condition.setMessage(msg.getNodeValue());
  408. _currentSkill.currentSkills.get(i).attach(condition,false);
  409. }
  410. if ("for".equalsIgnoreCase(n.getNodeName()))
  411. {
  412. parseTemplate(n, _currentSkill.currentSkills.get(i));
  413. }
  414. }
  415. }
  416. }
  417. for (int i=lastLvl+enchantLevels1+enchantLevels2+enchantLevels3; i < lastLvl+enchantLevels1+enchantLevels2+enchantLevels3+enchantLevels4; i++)
  418. {
  419. boolean found = false;
  420. _currentSkill.currentLevel = i-lastLvl-enchantLevels1-enchantLevels2-enchantLevels3;
  421. for (n=first; n != null; n = n.getNextSibling())
  422. {
  423. if ("enchant4cond".equalsIgnoreCase(n.getNodeName()))
  424. {
  425. found = true;
  426. Condition condition = parseCondition(n.getFirstChild(), _currentSkill.currentSkills.get(i));
  427. Node msg = n.getAttributes().getNamedItem("msg");
  428. if (condition != null && msg != null)
  429. condition.setMessage(msg.getNodeValue());
  430. _currentSkill.currentSkills.get(i).attach(condition,false);
  431. }
  432. if ("enchant4for".equalsIgnoreCase(n.getNodeName()))
  433. {
  434. found = true;
  435. parseTemplate(n, _currentSkill.currentSkills.get(i));
  436. }
  437. }
  438. // If none found, the enchanted skill will take effects from maxLvL of norm skill
  439. if(!found)
  440. {
  441. _currentSkill.currentLevel = lastLvl-1;
  442. for (n=first; n != null; n = n.getNextSibling())
  443. {
  444. if ("cond".equalsIgnoreCase(n.getNodeName()))
  445. {
  446. Condition condition = parseCondition(n.getFirstChild(), _currentSkill.currentSkills.get(i));
  447. Node msg = n.getAttributes().getNamedItem("msg");
  448. if (condition != null && msg != null)
  449. condition.setMessage(msg.getNodeValue());
  450. _currentSkill.currentSkills.get(i).attach(condition,false);
  451. }
  452. if ("for".equalsIgnoreCase(n.getNodeName()))
  453. {
  454. parseTemplate(n, _currentSkill.currentSkills.get(i));
  455. }
  456. }
  457. }
  458. }
  459. for (int i=lastLvl+enchantLevels1+enchantLevels2+enchantLevels3+enchantLevels4; i < lastLvl+enchantLevels1+enchantLevels2+enchantLevels3+enchantLevels4+enchantLevels5; i++)
  460. {
  461. boolean found = false;
  462. _currentSkill.currentLevel = i-lastLvl-enchantLevels1-enchantLevels2-enchantLevels3-enchantLevels4;
  463. for (n=first; n != null; n = n.getNextSibling())
  464. {
  465. if ("enchant5cond".equalsIgnoreCase(n.getNodeName()))
  466. {
  467. found = true;
  468. Condition condition = parseCondition(n.getFirstChild(), _currentSkill.currentSkills.get(i));
  469. Node msg = n.getAttributes().getNamedItem("msg");
  470. if (condition != null && msg != null)
  471. condition.setMessage(msg.getNodeValue());
  472. _currentSkill.currentSkills.get(i).attach(condition,false);
  473. }
  474. if ("enchant5for".equalsIgnoreCase(n.getNodeName()))
  475. {
  476. found = true;
  477. parseTemplate(n, _currentSkill.currentSkills.get(i));
  478. }
  479. }
  480. // If none found, the enchanted skill will take effects from maxLvL of norm skill
  481. if(!found)
  482. {
  483. _currentSkill.currentLevel = lastLvl-1;
  484. for (n=first; n != null; n = n.getNextSibling())
  485. {
  486. if ("cond".equalsIgnoreCase(n.getNodeName()))
  487. {
  488. Condition condition = parseCondition(n.getFirstChild(), _currentSkill.currentSkills.get(i));
  489. Node msg = n.getAttributes().getNamedItem("msg");
  490. if (condition != null && msg != null)
  491. condition.setMessage(msg.getNodeValue());
  492. _currentSkill.currentSkills.get(i).attach(condition,false);
  493. }
  494. if ("for".equalsIgnoreCase(n.getNodeName()))
  495. {
  496. parseTemplate(n, _currentSkill.currentSkills.get(i));
  497. }
  498. }
  499. }
  500. }
  501. _currentSkill.skills.addAll(_currentSkill.currentSkills);
  502. }
  503. private void makeSkills()
  504. {
  505. int count = 0;
  506. _currentSkill.currentSkills = new FastList<L2Skill>(_currentSkill.sets.length+_currentSkill.enchsets1.length+_currentSkill.enchsets2.length+_currentSkill.enchsets3.length+_currentSkill.enchsets4.length+_currentSkill.enchsets5.length);
  507. for (int i=0; i < _currentSkill.sets.length; i++)
  508. {
  509. try
  510. {
  511. _currentSkill.currentSkills.add(i, _currentSkill.sets[i].getEnum("skillType", SkillType.class).makeSkill(_currentSkill.sets[i]));
  512. count++;
  513. }
  514. catch (Exception e)
  515. {
  516. _log.log(Level.SEVERE, "Skill id="+_currentSkill.sets[i].getEnum("skillType", SkillType.class).makeSkill(_currentSkill.sets[i]).getDisplayId()+"level"+_currentSkill.sets[i].getEnum("skillType", SkillType.class).makeSkill(_currentSkill.sets[i]).getLevel(), e);
  517. }
  518. }
  519. int _count = count;
  520. for (int i=0; i < _currentSkill.enchsets1.length; i++)
  521. {
  522. try
  523. {
  524. _currentSkill.currentSkills.add(_count+i, _currentSkill.enchsets1[i].getEnum("skillType", SkillType.class).makeSkill(_currentSkill.enchsets1[i]));
  525. count++;
  526. }
  527. catch (Exception e)
  528. {
  529. _log.log(Level.SEVERE, "Skill id="+_currentSkill.enchsets1[i].getEnum("skillType", SkillType.class).makeSkill(_currentSkill.enchsets1[i]).getDisplayId()+" level="+_currentSkill.enchsets1[i].getEnum("skillType", SkillType.class).makeSkill(_currentSkill.enchsets1[i]).getLevel(), e);
  530. }
  531. }
  532. _count = count;
  533. for (int i=0; i < _currentSkill.enchsets2.length; i++)
  534. {
  535. try
  536. {
  537. _currentSkill.currentSkills.add(_count+i, _currentSkill.enchsets2[i].getEnum("skillType", SkillType.class).makeSkill(_currentSkill.enchsets2[i]));
  538. count++;
  539. }
  540. catch (Exception e)
  541. {
  542. _log.log(Level.SEVERE, "Skill id="+_currentSkill.enchsets2[i].getEnum("skillType", SkillType.class).makeSkill(_currentSkill.enchsets2[i]).getDisplayId()+" level="+_currentSkill.enchsets2[i].getEnum("skillType", SkillType.class).makeSkill(_currentSkill.enchsets2[i]).getLevel(), e);
  543. }
  544. }
  545. _count = count;
  546. for (int i=0; i < _currentSkill.enchsets3.length; i++)
  547. {
  548. try
  549. {
  550. _currentSkill.currentSkills.add(_count+i, _currentSkill.enchsets3[i].getEnum("skillType", SkillType.class).makeSkill(_currentSkill.enchsets3[i]));
  551. count++;
  552. }
  553. catch (Exception e)
  554. {
  555. _log.log(Level.SEVERE, "Skill id="+_currentSkill.enchsets3[i].getEnum("skillType", SkillType.class).makeSkill(_currentSkill.enchsets3[i]).getDisplayId()+" level="+_currentSkill.enchsets3[i].getEnum("skillType", SkillType.class).makeSkill(_currentSkill.enchsets3[i]).getLevel(), e);
  556. }
  557. }
  558. _count = count;
  559. for (int i=0; i < _currentSkill.enchsets4.length; i++)
  560. {
  561. try
  562. {
  563. _currentSkill.currentSkills.add(_count+i, _currentSkill.enchsets4[i].getEnum("skillType", SkillType.class).makeSkill(_currentSkill.enchsets4[i]));
  564. count++;
  565. }
  566. catch (Exception e)
  567. {
  568. _log.log(Level.SEVERE, "Skill id="+_currentSkill.enchsets4[i].getEnum("skillType", SkillType.class).makeSkill(_currentSkill.enchsets4[i]).getDisplayId()+" level="+_currentSkill.enchsets4[i].getEnum("skillType", SkillType.class).makeSkill(_currentSkill.enchsets4[i]).getLevel(), e);
  569. }
  570. }
  571. _count = count;
  572. for (int i=0; i < _currentSkill.enchsets5.length; i++)
  573. {
  574. try
  575. {
  576. _currentSkill.currentSkills.add(_count+i, _currentSkill.enchsets5[i].getEnum("skillType", SkillType.class).makeSkill(_currentSkill.enchsets5[i]));
  577. count++;
  578. }
  579. catch (Exception e)
  580. {
  581. _log.log(Level.SEVERE, "Skill id="+_currentSkill.enchsets5[i].getEnum("skillType", SkillType.class).makeSkill(_currentSkill.enchsets5[i]).getDisplayId()+" level="+_currentSkill.enchsets5[i].getEnum("skillType", SkillType.class).makeSkill(_currentSkill.enchsets5[i]).getLevel(), e);
  582. }
  583. }
  584. }
  585. }